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 |
|---|---|---|---|---|---|---|
Exception handler called when the performance of an action raises an exception.
|
def rescue_action(exception)
log_error(exception) unless logger.nil?
if consider_all_requests_local || local_request?
rescue_action_locally(exception)
else
rescue_action_in_public(exception)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def rescue_action(e) raise e end",
"def rescue_action(e) raise e end",
"def rescue_action(e) raise e end",
"def rescue_action(e) raise e end",
"def exception_handler; end",
"def exception_handler(ex)\n \nend",
"def rescue_action(e); raise e; end",
"def process_action(*args)\n super\n rescue Exception => exception\n raise if RocketPants.pass_through_errors?\n # Otherwise, use the default built in handler.\n logger.error \"Exception occured: #{exception.class.name} - #{exception.message}\"\n logger.error \"Exception backtrace:\"\n exception.backtrace[0, 10].each do |backtrace_line|\n logger.error \"=> #{backtrace_line}\"\n end\n exception_notifier_callback.call(self, exception, request)\n render_error exception\n end",
"def pass_exception\n throw :next_exception_handler\n end",
"def rescue_action(exception)\n if handler_for_rescue(exception)\n rescue_action_with_handler(exception)\n else\n log_error(exception) if logger\n erase_results if performed?\n\n # Let the exception alter the response if it wants.\n # For example, MethodNotAllowed sets the Allow header.\n if exception.respond_to?(:handle_response!)\n exception.handle_response!(response)\n end\n\n if consider_all_requests_local || local_request?\n rescue_action_locally(exception)\n else\n rescue_action_in_public(exception)\n end\n end\n end",
"def serve_exception(_exception); end",
"def rescue_action(exception)\n rescue_with_handler(exception) ||\n rescue_action_without_handler(exception)\n end",
"def handle_exception(exception)\n if safe_rescue_exception?(exception)\n # This exception should be safely rescued to prevent false positive for the dynamic scanners. Log the exception\n message = \"Automatic handled \" + exception.class.to_s + \": \" + exception.message + \" to prevent false positive\"\n logger.debug message\n flash[:alert] = message unless running?\n # Try to render the normal controller action (although with empty results) as if everything is well\n render\n else\n # This exception should not be safe rescued (possible SQL injection!). Simply raise the exception again to display the full error.\n logger.fatal \"Params: \"+ params.inspect\n raise exception\n end\n end",
"def on_exception(&blk)\n @on_exception = blk\n end",
"def error_handler(exception)\n puts exception\n end",
"def on_error(exception)\n raise exception\n end",
"def rescue_action_locally(exception)\n cashboard_rescue_exception()\n super(exception)\n end",
"def enter_exception_context(exception); end",
"def handle_perform_error(_e); end",
"def exception_handler=(exception_handler); end",
"def processCrash; raise \"Abstract Exception: AbstractBeezwaxCrashProcessor.processCrash must be extended\"; end",
"def on_exception(&f)\n @on_exception = f\n end",
"def rescue_action_locallyyyyyyyyyyyy(e)\n @exception = e\n log_exception(e)\n rescue_action_in_public(e)\n end",
"def each_exception_handler(&iterator); model.each_exception_handler(&iterator) end",
"def handle_exception(data)\n logger.warn \"Got exception from remote call of #{data[\"action\"]}: #{data[\"message\"]}\"\n end",
"def bypass_rescue\n if ::Rails::VERSION::STRING >= '2.2'\n def controller.rescue_action(exception)\n raise exception\n end\n else\n def controller.rescue_action_with_handler(exception)\n raise exception\n end\n end\n end",
"def render_action(action, params)\n send(action, params)\n \n rescue RenderExit, ActionExit => e1\n # Just stop rendering. \n \n rescue ActionError => e2\n # Client Error family of errors, typically send 4XX\n # status code.\n handle_error(e2, 404)\n error e2.to_s\n \n rescue Object => e3\n # Server Error family of errors, typically send 5XX\n # status code. \n handle_error(e3, 500)\n error \"Error while handling #{self.class}##{action.to_s.gsub(/___super$/, '')}(#{params.join(', ')})\"\n error pp_exception(e3)\n end",
"def abort_on_exception=(*) end",
"def abort_on_exception(*) end",
"def egregious_exception_handler(exception)\n egregious_flash(exception)\n egregious_log(exception)\n egregious_respond_to(exception)\n end",
"def raise(exception); end",
"def handle_exception(exception)\n end",
"def on_exception(&value)\n @on_exception = value if block_given?\n \n @on_exception\n end",
"def dispatch_exception(request, response, exception)\n klass = Exceptions rescue Controller\n request.params[:original_params] = request.params.dup rescue {}\n request.params[:original_session] = request.session.dup rescue {}\n request.params[:original_cookies] = request.cookies.dup rescue {}\n request.params[:exception] = exception\n request.params[:action] = exception.name\n dispatch_action(klass, exception.name, request, response, exception.class::STATUS)\n rescue => dispatch_issue\n dispatch_issue = controller_exception(dispatch_issue) \n # when no action/template exist for an exception, or an\n # exception occurs on an InternalServerError the message is\n # rendered as simple text.\n # ControllerExceptions raised from exception actions are \n # dispatched back into the Exceptions controller\n if dispatch_issue.is_a?(ControllerExceptions::NotFound)\n dispatch_default_exception(klass, request, response, exception)\n elsif dispatch_issue.is_a?(ControllerExceptions::InternalServerError)\n dispatch_default_exception(klass, request, response, dispatch_issue)\n else\n exception = dispatch_issue\n retry\n end\n end",
"def exception\n @context[:exception]\n end",
"def exception; end",
"def exception; end",
"def exception; end",
"def exception; end",
"def exception; end",
"def amf_exception_handler(ex)\n RAILS_DEFAULT_LOGGER.error ex.message\n RAILS_DEFAULT_LOGGER.error ex.backtrace.join( \"\\n\" )\n render :amf => FaultObject.new(ex.to_s) if is_amf\n end",
"def raise_exc\n raise\n rescue\n end",
"def resource_failed(resource, action, exception)\n puts COLOR_RED\n puts \"failed to handle resource --> :#{action} #{resource}\"\n puts COLOR_RESET\n puts \"#{exception}\"\n end",
"def raise_exc\n <<-CODE\n t1 = stack_pop();\n cpu_raise_exception(state, c, t1);\n CODE\n end",
"def my_rescue_action_in_public(exception)\n # MorLog.my_debug exception.to_yaml\n # MorLog.my_debug exception.backtrace.to_yaml\n time = Time.now()\n id = time.strftime(\"%Y%m%d%H%M%S\")\n address = 'gui_crashes@kolmisoft.com'\n extra_info = \"\"\n swap = nil\n begin\n MorLog.my_debug(\"Rescuing exception: #{exception.class.to_s} controller: #{params[:controller].to_s}, action: #{params[:action].to_s}\", true)\n if important_exception(exception)\n MorLog.my_debug(\" >> Exception is important\", true)\n MorLog.log_exception(exception, id, params[:controller].to_s, params[:action].to_s) if params[:do_not_log_test_exception].to_i == 0\n\n trace = exception.backtrace.collect { |t| t.to_s }.join(\"\\n\")\n\n exception_class = escape_for_email(exception.class).to_s\n exception_class_previous = Confline.get_value(\"Last_Crash_Exception_Class\", 0).to_s\n exception_send_email = Confline.get_value(\"Exception_Send_Email\").to_i\n\n # Lots of duplication but this is due fact that in future there may be\n # need for separate link for every error.\n flash_help_link = nil\n\n\n if exception_class.include?(\"Net::SMTPFatalError\")\n flash_notice = _('smtp_server_error')\n flash_help_link = \"\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'smtp_server_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Errno::ENETUNREACH\")\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_Errno::ENETUNREACH\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Errno::EACCES\")\n flash_notice = _('File_permission_error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'File_permission_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Errno::EHOSTUNREACH\") or (exception_class.include?(\"Errno::ECONNREFUSED\") and trace.to_s.include?(\"rami.rb:380\"))\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_SystemExit\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"SystemExit\") or (exception_class.include?('RuntimeError') and (exception.message.include?('No route to host') or exception.message.include?('getaddrinfo: Name or service not known') or exception.message.include?('Connection refused')))\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_SystemExit\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n end\n\n if exception_class.include?('RuntimeError') and (exception.message.include?('Connection timed out') or exception.message.include?('Invalid argument') or exception.message.include?('Connection reset by peer') or exception.message.include?('Network is unreachable') or exception.message.include?('exit'))\n flash_notice = _('Your_Asterisk_server_is_not_accessible_Please_check_if_address_entered_is_valid_and_network_is_OK')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n exception_send_email = 0\n end\n\n if exception_class.include?(\"SocketError\") and !trace.to_s.include?(\"smtp_tls.rb\")\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_SystemExit\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n end\n if exception_class.include?(\"Errno::ETIMEDOUT\")\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_SystemExit\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n exception_send_email = 0\n end\n\n if exception_class.include?(\"OpenSSL::SSL::SSLError\") or exception_class.include?(\"OpenSSL::SSL\")\n flash_notice = _('Verify_mail_server_details_or_try_alternative_smtp_server')\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'SMTP_connection_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"ActiveRecord::RecordNotFound\")\n flash_notice = _('Data_not_found')\n flash_help_link = ''\n exception_send_email = 1\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Data_not_found', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"ActiveRecord::StatementInvalid\") and exception.message.include?('Access denied for user')\n flash_notice = _('MySQL_permission_problem_contact_Kolmisoft_to_solve_it')\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'MySQL_permission_problem', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Transactions::TransactionError\")\n flash_notice = _(\"Transaction_error\")\n swap = []\n swap << %x[vmstat]\n # swap << ActiveRecord::Base.connection.select_all(\"SHOW INNODB STATUS;\")\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Transaction_errors', :data2 => exception.message).save\n exception_send_email = 0\n end\n\n if exception_class.include?(\"Errno::ENOENT\") and exception.message.include?('/tmp/mor_debug_backup.txt')\n flash_notice = _('Backup_file_not_found')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Backup_file_not_found', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"GoogleCheckoutError\") and exception.message.include?(\"No seller found with id\")\n flash_notice = _('Internal_Error_Contact_Administrator')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n # database not updated\n if exception_class.include?(\"NoMethodError\") and !exception.message.include?(\"nil:NilClass\") and exception.message.include?(\"for #<\")\n flash_notice = _('Database_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Database_Error', :data2 => exception.message).save\n end\n if exception_class.include? \"ActiveModel::MissingAttributeError\"\n flash_notice = _('Database_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Database_Error', :data2 => exception.message).save\n end\n if exception_class.include?(\"ActiveRecord::StatementInvalid\") and exception.message.include?(\"Unknown column\")\n flash_notice = _('Database_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Database_Error', :data2 => exception.message).save\n end\n #\n\n if exception_class.include?(\"GoogleCheckoutError\") and exception.message.include?(\"The currency used in the cart must match the currency of the seller account.\")\n flash_notice = _('Internal_Error_Contact_Administrator')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Google4R\") and exception.message.include?(\"Missing URL component: expected id:\")\n flash_notice = _('Internal_Error_Contact_Administrator')\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Google4R\") and exception.message.include?('expected id: (\\d{10})|(\\d{15})')\n flash_notice = _(\"Payment_Error_Contact_Administrator_enter_merchant_id\")\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Google4R\") and exception.message.include?('Seller Account') and exception.message.include?('is not active.')\n flash_notice = _(\"Payment_Error_Contact_Administrator_account_not_active\")\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception.message.include?('Unexpected response code')\n flash_notice = _(\"Google_checkout_error\") + ': ' + exception.message.to_s #.gsub('Google Unexpected response code', 'Unexpected response code')\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception.message.include?('An API Certificate or API Signature is required to make requests to PayPal')\n flash_notice = _('An_API_Certificate_or_API_Signature_is_required_to_make_requests_to_PayPal')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception.message.include?('Temporary failure in name resolution')\n flash_notice = _('DNS_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'DNS_Error', :data2 => exception.message).save\n end\n\n if exception.message.include?('Ambethia::ReCaptcha::Controller::RecaptchaError')\n flash_notice = _('ReCaptcha_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'ReCaptcha_Error', :data2 => exception.message).save\n end\n\n #if exception_class.include?(\"Net::SMTP\") or (exception_class.include?(\"Errno::ECONNREFUSED\") and trace.to_s.include?(\"smtp_tls.rb\")) or (exception_class.include?(\"SocketError\") and trace.to_s.include?(\"smtp_tls.rb\")) or ((exception_class.include?(\"Timeout::Error\") and trace.to_s.include?(\"smtp.rb\"))) or trace.to_s.include?(\"smtp.rb\")\n flash_help_link = email_exceptions(exception) if flash_help_link.blank? and flash_notice.blank?\n #end\n\n if exception_class.include?(\"LoadError\") and exception.message.to_s.include?('locations or via rubygems.')\n if exception.message.include?('cairo')\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/Cannot_generate_PDF\"\n else\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_Ruby_Gems\"\n end\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Ruby_gems_not_found', :data2 => exception.message).save\n exception_send_email = 0\n end\n\n # Specific case for acunetix security scanner\n if (exception.message.include?('invalid byte sequence in UTF-8') or exception.message.include?('{\"$acunetix\"=>\"1\"}')) and ['try_to_login', 'signup_end'].member?(params[:action])\n flash_notice = _('Internal_Error_Contact_Administrator')\n exception_send_email = 0\n end\n\n if exception_send_email == 1 and exception_class != exception_class_previous and !flash_help_link or params[:this_is_fake_exception].to_s == \"YES\"\n MorLog.my_debug(\" >> Need to send email\", true)\n\n if exception_class.include?(\"NoMemoryError\")\n extra_info = get_memory_info\n MorLog.my_debug(extra_info)\n end\n\n # Gather all exception\n rep, rev, status = get_svn_info\n rp = []\n (params.each { |k, v| rp << [\"#{k} => #{v}\"] })\n\n message = [\n \"ID: #{id.to_s}\",\n \"IP: #{request.env['SERVER_ADDR']}\",\n \"Class: #{exception_class}\",\n \"Message: #{exception}\",\n \"Controller: #{params[:controller]}\",\n \"Action: #{params[:action]}\",\n \"User ID: #{session ? session[:user_id].to_i : 'possible_from_api'}\",\n \"----------------------------------------\",\n \"Repositority: #{rep}\",\n \"Revision: [#{rev}]\",\n \"Local version modified: #{status}\",\n \"----------------------------------------\",\n\n \"Request params: \\n#{rp.join(\"\\n\")}\",\n \"----------------------------------------\",\n \"Seesion params: \\n#{nice_session if session}\",\n \"----------------------------------------\"\n ]\n if extra_info.length > 0\n message << \"----------------------------------------\"\n message << extra_info\n message << \"----------------------------------------\"\n end\n message << \"#{trace}\"\n\n if test_machine_active?\n if File.exists?('/var/log/mor/test_system')\n message << \"----------------------------------------\"\n message << %x[tail -n 50 /var/log/mor/test_system]\n end\n end\n\n if swap\n message << \"----------------------------------------\"\n message << swap.to_yaml\n end\n\n if exception_class.include?(\"Errno::EPERM\")\n message << \"----------------------------------------\"\n message << %x[ls -la /home/mor/tmp/]\n message << \"----------------------------------------\"\n message << %x[ls -la /home/mor/]\n end\n\n Confline.set_value(\"Last_Crash_Exception_Class\", exception_class, 0)\n\n if params[:this_is_fake_exception].to_s == \"YES\"\n MorLog.my_debug(' >> Crash email NOT sent THIS IS JUST TEST', true)\n return :text => flash_notice.to_s + flash_help_link.to_s + message.join(\"\\n\")\n #render :text => message.join(\"\\n\") and return false\n else\n\n subject = \"#{ExceptionNotifier_email_prefix} Exception. ID: #{id.to_s}\"\n time = Confline.get_value(\"Last_Crash_Exception_Time\", 0)\n if time and !time.blank? and (Time.now - Time.parse(time)) < 1.minute\n MorLog.my_debug(\"Crash email NOT sent : Time.now #{Time.now.to_s(:db)} - Last_Crash_Exception_Time #{time}\")\n else\n send_crash_email(address, subject, message.join(\"\\n\")) if params[:do_not_log_test_exception].to_i == 0\n Confline.set_value(\"Last_Crash_Exception_Time\", Time.now.to_s(:db), 0)\n MorLog.my_debug('Crash email sent')\n end\n end\n else\n MorLog.my_debug(\" >> Do not send email because:\", true)\n MorLog.my_debug(\" >> Email should not be sent. Confline::Exception_Send_Email: #{exception_send_email.to_s}\", true) if exception_send_email != 1\n MorLog.my_debug(\" >> The same exception twice. Last exception: #{exception_class.to_s}\", true) if exception_class == exception_class_previous\n MorLog.my_debug(\" >> Contained explanation. Flash: #{ flash_help_link}\", true) if flash_help_link\n end\n\n if !flash_help_link.blank?\n flash[:notice] = _('Something_is_wrong_please_consult_help_link')\n flash[:notice] += \"<a id='exception_info_link' href='#{flash_help_link}' target='_blank'><img alt='Help' src='#{Web_Dir}/assets/icons/help.png' title='#{_('Help')}' /></a>\".html_safe\n else\n flash[:notice] = flash_notice.to_s.blank? ? \"INTERNAL ERROR. - ID: #{id} - #{exception_class}\" : flash_notice\n end\n\n if session and session[:forgot_pasword] == 1\n session[:forgot_pasword] = 0\n flash[:notice_forgot]= (_('Cannot_change_password') + \"<br />\" + _('Email_not_sent_because_bad_system_configurations')).html_safe\n end\n\n if session and session[:flash_not_redirect].to_i == 0\n #redirect_to Web_Dir + \"/callc/main\" and return false\n else\n session[:flash_not_redirect] = 0 if session\n #render(:layout => \"layouts/mor_min\") and return false\n end\n end\n rescue Exception => e\n MorLog.log_exception(e, id, params[:controller].to_s, params[:action].to_s)\n message =\"Exception in exception at: #{escape_for_email(request.env['SERVER_ADDR'])} \\n --------------------------------------------------------------- \\n #{escape_for_email(%x[tail -n 50 /var/log/mor/test_system])}\"\n command = ApplicationController::send_email_dry(\"guicrashes@kolmisoft.com\", address, message, \"#{ExceptionNotifier_email_prefix} SERIOUS EXCEPTION\", \"-o tls='auto'\")\n system(command)\n flash[:notice] = \"INTERNAL ERROR.\"\n #redirect_to Web_Dir + \"/callc/main\" and return false\n end\n end",
"def exception_callback\n @exception_callback\n end",
"def handle_error action, e\n warn \"#{action} failed: #{e} #{e.backtrace.join(\"\\t\")}\" ;\n @cassandra_db = nil\n sleep 0.2\n end",
"def exception\n request.env['action_dispatch.exception']\n end",
"def handle_error(e)\n raise e\n end",
"def abort_on_exception=(_arg0); end",
"def exception\n\t\t@exception\n\tend",
"def each_exception_handler(&iterator)\n model.each_exception_handler(&iterator)\n end",
"def action\n raise( NotImplementedError, I18n.t( \"events.actions.event_logger_action_error\" ) )\n end",
"def internal_server_error\n @exception = env['action_dispatch.exception']\n #TODO: log exception information you want to log here\n # after removing it from the normal logging via lograge\n render status: 500\n end",
"def rescue_action(exception)\n @message = exception.message\n @backtrace = exception.backtrace.join(\"\\n\") unless exception.nil?\n logger.info @message\n logger.info @backtrace\n render :file => \"#{RAILS_ROOT}/app/views/errors/error.rhtml\", :layout=> false, :status => 404\n end",
"def exceptions; end",
"def exceptions_app; end",
"def exceptions_app; end",
"def catch_exceptions; end",
"def handle_process_exception(exception, item)\n raise exception\n end",
"def handle_exception(e, env)\n trace = e.backtrace.join \"\\n\"\n Tom::Log.logger.info e\n Tom::Log.logger.info trace\n [500, {}, {error: e,\n stacktrace: trace,\n url: env[\"REQUEST_URI\"]\n }.to_json]\n end",
"def perform(exception, route)\n Rails.configuration.failed_request_counter.observe(1, { route: route, exception: exception })\n sleep 5\n Rails.configuration.failed_request_counter.observe(1, { route: route, exception: exception })\n end",
"def server_error(exception)\n # Whatever code that handles the exception\n\n ExceptionNotifier.notify_exception(exception,\n :env => request.env, :data => {:message => \"was doing something wrong\"})\n end",
"def rescue_action_with_handler(exception)\n if handler = handler_for_rescue(exception)\n if handler.arity != 0\n handler.call(exception)\n else\n handler.call\n end\n true # don't rely on the return value of the handler\n end\n end",
"def exception(ex)\n update_result(Automation::Result::Exception)\n @logger.error(format_exception(ex))\n end",
"def exception\n raise \"It's a bad one!\"\n end",
"def exception_handler\n @exception_handler ||= {}\n end",
"def on_fetcher_call_error(event)\n fatal \"Fetcher crash due to an error: #{event[:error]}\"\n end",
"def criticalError(msg='Critical error')\n logExceptionMsg msg\n do_action 'StopSociety' if run\n exit 1\nend",
"def handle_request_error(exception)\n end",
"def log_error(exception); end",
"def after_exception(e)\n logger.error \"Error processing request\", e.message, e\n after(500)\n end",
"def handle_exceptions_gracefully\n\n begin\n\n yield\n\n rescue => se\n\n Rails.logger.error(\"Exception in API: #{se.message} trace: #{se.backtrace}\")\n\n ExceptionNotifier.notify_exception(\n se,\n env: request.env\n )\n\n r = Result::Base.error(\n internal_id: 'ac_3',\n general_error_identifier: 'something_went_wrong'\n )\n\n return render_api_response(r)\n\n end\n\n end",
"def exceptions\n end",
"def handle_exception(e = Exception, &block)\n raise CapabilitiesExceeded\n end",
"def custom_exception_handler(exception)\n custom_exception_handlers[exception.to_s]\n end",
"def error(exception)\n logger.info \"execution failed: #{exception}\"\n end",
"def exceptions_app=(_arg0); end",
"def exceptions_app=(_arg0); end",
"def operation_raised_error(exception)\n save_failure(I18n.t(\"operation.errors.server_error\"))\n ExceptionNotifier.notify_exception(exception)\n raise exception if Rails.env.test?\n end",
"def rescue_action(e)\n\n # sometimes, Rails likes to pass you instance variables that you don't want\n # this should get rid of any junk that the previous renders left behind that rails failed to clean up\n erase_render_results\n #forget_variables_added_to_assigns\n reset_variables_added_to_assigns\n \n @error = e\n @error_name = e.class.to_s.demodulize.underscore\n\n @error_trace = @error.backtrace\n @error_message = @error.to_s.gsub('<', '<').gsub('>', '>')\n\n if(@error.respond_to? :status_code)\n @status = @error.status_code\n elsif(DEFAULT_RESCUE_RESPONSES.has_key? @error.class.to_s)\n @status = DEFAULT_RESCUE_RESPONSES[@error.class.to_s]\n else\n @status = DEFAULT_RESCUE_RESPONSE\n end\n \n if logger.level > Logger::INFO\n logger.error %{\n Processing #{self.class.name}\\##{action_name} (for #{request_origin}) [#{request.method.to_s.upcase}]\n Session ID: #{@_session.session_id if @_session and @_session.respond_to?(:session_id)}\n Parameters: #{respond_to?(:filter_parameters) ? filter_parameters(params).inspect : params.inspect}}\n end\n logger.error %{\n Error: #{@error.clean_message} (status: #{@status})\n Trace: #{(@error_trace.is_a? Array)? @error_trace.join(\"\\n\\t \") : @error_trace }\n }\n\n respond_to do |format|\n format.html do\n begin\n render :partial => \"shared/errors/error\", :layout => 'error', :status => @status\n rescue\n super(e)\n end\n end\n format.js do\n begin\n render :template => \"shared/errors/error\"\n rescue\n render :update do |page|\n page.alert \"There has been an error, and then another error occured while first error was being processed... Too bad. The original error was: #{@error.to_s}.\"\n page.alert \"The additional error was: #{$!.to_s}.\"\n end\n end\n end\n end\n \n rescue_with_handler(e) or notify_airbrake(e)\n end",
"def rescue_action_locally(exception)\n @exception = exception\n @rescues_path = File.dirname(__FILE__) + \"/templates/rescues/\"\n add_variables_to_assigns\n @contents = @template.render_file(template_path_for_local_rescue(exception), false)\n \n @headers[\"Content-Type\"] = \"text/html\"\n render_file(rescues_path(\"layout\"), \"500 Internal Error\")\n end",
"def rescue_action_locally(exception)\n @exception = exception\n @rescues_path = File.dirname(__FILE__) + \"/templates/rescues/\"\n add_variables_to_assigns\n @contents = @template.render_file(template_path_for_local_rescue(exception), false)\n \n @headers[\"Content-Type\"] = \"text/html\"\n render_file(rescues_path(\"layout\"), \"500 Internal Error\")\n end",
"def error(exception)\n logger.error \"Beetle: handler execution raised an exception: #{exception.class}(#{exception.message})\"\n end",
"def error_handler\n begin\n yield\n rescue => exception\n options = Rails.env.development? ? {:backtrace => exception.backtrace, :class => exception.class.to_s} : {}\n render_error(exception.message, options)\n end\n end",
"def before_server_error(exception); end",
"def notify_exception(e)\n # ignore exception because the exception caused tuple server is down...\n Util.ignore_exception do\n write(Tuple[:exception].new(uuid, agent_type, e))\n end\n end",
"def rescue_action_locally(exception)\n rescue_action_in_public(exception)\n end",
"def handle_errors(interactor)\n interactor.call\n rescue Errors::Base => e\n context.fail!(resource: e, status: e.status)\n end",
"def handle_exception(exception, request, response)\n response.flush\n response.status = 500\n\n if config.development?\n response.content_type = \"text/html\"\n response.puts(Rack::ShowExceptions.new(nil).pretty(request.env, exception))\n else\n response.layout = \"layouts/exception\" if Harbor::View.exists?(\"layouts/exception\")\n\n if Harbor::View.exists?(\"exceptions/500.html.erb\")\n response.render \"exceptions/500.html.erb\", :exception => exception\n else\n response.puts \"We're sorry, but something went wrong.\"\n end\n end\n\n raise_event(:exception, Events::ServerErrorEvent.new(request, response, exception))\n end",
"def handle_emit_exception(e)\n RailsPipeline.logger.error(\"Error during emit(): #{e}\")\n puts e.backtrace.join(\"\\n\")\n raise e # this probably isn't going anywhere BTW\n end",
"def rescue_with_handler(exception)\n to_return = super\n if to_return\n verbose = self.class.exception_notifiable_verbose && respond_to?(:logger) && !logger.nil?\n logger.info(\"[RESCUE STYLE] rescue_with_handler\") if verbose\n data = get_exception_data\n status_code = status_code_for_exception(exception)\n #We only send email if it has been configured in environment\n send_email = should_email_on_exception?(exception, status_code, verbose)\n #We only send web hooks if they've been configured in environment\n send_web_hooks = should_web_hook_on_exception?(exception, status_code, verbose)\n the_blamed = ExceptionNotification::Notifier.config[:git_repo_path].nil? ? nil : lay_blame(exception)\n rejected_sections = %w(request session)\n # Debugging output\n verbose_output(exception, status_code, \"rescued by handler\", send_email, send_web_hooks, nil, the_blamed, rejected_sections) if verbose\n # Send the exception notification email\n perform_exception_notify_mailing(exception, data, nil, the_blamed, verbose, rejected_sections) if send_email\n # Send Web Hook requests\n ExceptionNotification::HooksNotifier.deliver_exception_to_web_hooks(ExceptionNotification::Notifier.config, exception, self, request, data, the_blamed) if send_web_hooks\n pass_it_on(exception, ENV, verbose)\n end\n to_return\n end",
"def index\n set_excuses\n end",
"def severe_error(note =\"\", excpt)\n if @controller and @controller.class < ApplicationController\n @controller.expires_now\n @controller.head :internal_server_error,\n x_error_details: 'Something is wrong with this relay. Try again later.'\n end\n _log_exception ERROR,note,excpt\n end",
"def exeception_rescuer\n begin\n yield\n rescue ActiveRecord::RecordNotFound\n exeception_to_log\n false\n end\n end",
"def exeception_rescuer\n begin\n yield\n rescue ActiveRecord::RecordNotFound\n exeception_to_log\n false\n end\n end",
"def with_error_handling(event)\n\tbegin\n\t\tyield\n\trescue => e\n\t\tevent.respond \"Had an error: \" + e.class.to_s\n\t\traise e\n\tend\nend",
"def run_custom_exception_handling(exception)\n case handler = custom_exception_handler(exception)\n when String\n write handler \n when Symbol\n self.send(custom_exception_handler(exception))\n end\n end",
"def render_error exception\n\n logger.info\"==========error 500=========\"\n #Rails.logger.error(exception)\n #render :template => \"/errors/500.html.erb\", :status => 500\n logger.info \"#{'-'*100} #{request.format} #{'-'*100}\"\n @error = exception\n ActiveSupport::Notifications.instrument \"exception.action_controller\", message: @error.message, inspect: @error.inspect, backtrace: @error.backtrace\n respond_to do |format|\n format.html { render template: \"errors/error_500\", status: 500, layout:false }\n format.all { render nothing: true, status: 500}\n\n end\n log_exception_handler(exception)\n end"
] |
[
"0.70532775",
"0.70532775",
"0.70532775",
"0.70532775",
"0.7029266",
"0.69289756",
"0.6922621",
"0.6841352",
"0.6635382",
"0.6467078",
"0.63432395",
"0.6294149",
"0.6284292",
"0.61866593",
"0.61778235",
"0.6122075",
"0.61210626",
"0.6094156",
"0.6070316",
"0.60647213",
"0.60589254",
"0.60503596",
"0.60344183",
"0.5998976",
"0.59835255",
"0.59676975",
"0.59457695",
"0.5925935",
"0.5923835",
"0.59148175",
"0.58991015",
"0.5893195",
"0.5885398",
"0.5869027",
"0.5868313",
"0.5853497",
"0.5853497",
"0.5853497",
"0.5853497",
"0.5853497",
"0.5842467",
"0.5822715",
"0.58224547",
"0.5820857",
"0.58197093",
"0.5815129",
"0.58015513",
"0.5783138",
"0.57634944",
"0.5762083",
"0.5748934",
"0.5728319",
"0.57238907",
"0.57160914",
"0.57119244",
"0.569833",
"0.569547",
"0.569547",
"0.569523",
"0.56735945",
"0.56485313",
"0.56420964",
"0.56389964",
"0.5638336",
"0.5615843",
"0.5615087",
"0.561505",
"0.5612802",
"0.5610952",
"0.560042",
"0.5600237",
"0.5596504",
"0.5594076",
"0.55935186",
"0.55920094",
"0.5591718",
"0.55838186",
"0.5578273",
"0.5578273",
"0.55739826",
"0.5571218",
"0.5553509",
"0.5553509",
"0.55532485",
"0.55302864",
"0.5520299",
"0.55199146",
"0.5513882",
"0.5503594",
"0.5501811",
"0.5500539",
"0.54961604",
"0.549082",
"0.548619",
"0.54830784",
"0.54825264",
"0.5482433",
"0.5481621",
"0.54760486"
] |
0.6007206
|
23
|
Overwrite to implement custom logging of errors. By default logs as fatal.
|
def log_error(exception) #:doc:
if ActionView::TemplateError === exception
logger.fatal(exception.to_s)
else
logger.fatal(
"\n\n#{exception.class} (#{exception.message}):\n " +
clean_backtrace(exception).join("\n ") +
"\n\n"
)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fatal(msg); @logger.fatal(msg); end",
"def error(msg); @logger.error(msg); end",
"def fatal(message)\n log(4, message)\n end",
"def fatal(*args)\n log(*args)\n fail_now\n end",
"def fatal(msg)\n logger.fatal msg\n end",
"def fatal(msg) log(FATAL, \"FATAL \" << format(msg) << \", \" << caller[0][caller[0].rindex(\"/\").nil? ? 0 : caller[0].rindex(\"/\") + 1 .. -1]); end",
"def fatal(msg)\n log.fatal msg\n end",
"def error(msg)\r\n prelog\r\n logger.error(msg)\r\n end",
"def fatal(*args)\n log(:fatal, *args)\n end",
"def error_log\n end",
"def error_log\n end",
"def error_log\n end",
"def error\n %i[error fatal]\n end",
"def fatal message; write FATAL, message, caller[0] unless level > @level end",
"def fatal(msg)\r\n prelog\r\n logger.fatal(msg)\r\n end",
"def fatal(msg)\n log(msg, level: Level::FATAL)\n end",
"def error(log)\n output.puts log if log_level <= ERROR\n end",
"def error message; write ERROR, message, caller[0] unless level > @level end",
"def fatal?; @logger.fatal? end",
"def error(*args)\n log(*args)\n fail\n end",
"def fatal(message)\n log(\"#{color(\"FATAL:\", :red, :bold)} #{message}\")\n end",
"def err(e)\n @logger.error(e)\n end",
"def error(msg)\n @logger.error(msg)\n end",
"def fatal(message)\n err(\"#{color('FATAL:', :red, :bold)} #{message}\")\n end",
"def fatal(input)\n puts \"[#{Time.now.strftime(\"%T\").purple} \" + \"FATAL\".red.bold + \"] \" + \"#{input.red.bold}\"\n end",
"def fatal; end",
"def error(*args)\n log(:error, *args)\n end",
"def log_error(e = $!)\n (@logger ||= OMF::Base::LObject.new(self.class)).error(e)\n end",
"def fatal!(msg, err = -1)\n Backdat::Log.fatal(msg)\n Process.exit err\n end",
"def log_error(exception); end",
"def fatal(error)\n debug(error)\n raise(error)\n end",
"def fatal( msg=nil, &block )\n\t\t\t\tMongrel2.logger.add( Logger::FATAL, msg, @classname, &block )\n\t\t\tend",
"def fatal(*args, &block)\n add_with_options(FATAL, *args, &block)\n end",
"def error(msg)\n log(msg, level: Level::ERROR)\n end",
"def error(message, color = :red)\n Strainer.log.error(message)\n\n return if quiet?\n message = set_color(message, *color) if color\n super(message)\n end",
"def fatal\n logger.add(Logger::FATAL, nil, facility) { yield } if logger && logger.fatal?\n end",
"def error(*args, &block)\n logger_instance.error(args, &block)\n end",
"def error!\n self.severity = :ERROR\n end",
"def fatal(m)\n log_handler.fatal msg(m)\n end",
"def error(msg)\n log.error msg\n end",
"def log_fatal(message)\n logger.fatal(message) if logger && logger.fatal?\n end",
"def fatal(*args, &block)\n logger_instance.fatal(args, &block)\n end",
"def log_errors!\n if AnyCable.config.debug?\n # Print error with backtrace in debug mode\n AnyCable.capture_exception do |e|\n stack = e.backtrace\n backtrace = stack ? \":\\n#{stack.take(20).join(\"\\n\")}\" : \"\"\n AnyCable.logger.error(\"#{e.message}#{backtrace}\")\n end\n else\n AnyCable.capture_exception { |e| AnyCable.logger.error(e.message) }\n end\n end",
"def fatal\n asl_log(@aslclient, @aslmsg, ASL_LEVEL_CRIT, message)\n end",
"def fatalf(string, *args)\n logf(string, *args)\n fail_now\n end",
"def fatal( msg=nil, &block )\n\t\t\t\tGemserver.logger.add( Logger::FATAL, msg, @classname, &block )\n\t\t\tend",
"def log_error(*error_messages)\r\n options = custom_infos.extract_options!\r\n\r\n infos = []\r\n infos << \"Non-Exception Error raised when executing #{request.method} #{request.fullpath}\" if defined? request\r\n error_messages.each do |e_message|\r\n infos << \"\\t#{e_message}\"\r\n end\r\n infos << \"Error trace:\"\r\n include_trace_to info\r\n infos << \"\\n\"\r\n\r\n if options[:write_to] && options[:write_to].to_sym == :info\r\n $arb_log.error infos.join(\"\\n\")\r\n else\r\n $log.error infos.join(\"\\n\")\r\n end\r\nend",
"def error(message)\n log.error(message.to_s.red)\n end",
"def fatal_error(error)\n STDERR.puts Rainbow(\"Fatal error: #{error}\").red\n STDERR.puts \"Backtrace:\"\n STDERR.puts format_backtrace(error.backtrace)\n end",
"def error(message)\n # note, we always log error messages\n add(:error, message)\n end",
"def error(message)\n # note, we always log error messages\n add(:error, message)\n end",
"def fatal(*args, &block)\n Log.fatal(*args, &block)\n end",
"def log_errors!\n if AnyCable.config.debug?\n # Print error with backtrace in debug mode\n AnyCable.capture_exception do |e|\n AnyCable.logger.error(\"#{e.message}:\\n#{e.backtrace.take(20).join(\"\\n\")}\")\n end\n else\n AnyCable.capture_exception { |e| AnyCable.logger.error(e.message) }\n end\n end",
"def log_error(err)\n\t\tprint_error(err)\n\n\t\twlog(err)\n\n\t\t# If it's a syntax error, log the call stack that it originated from.\n\t\tdlog(\"Call stack:\\n#{$@.join(\"\\n\")}\", 'core', LEV_1)\n\tend",
"def log_error(ex)\n if @config.logger.respond_to?(:error)\n @config.logger.error(\"CrashHook Error: #{ex.inspect}\")\n elsif @config.logger.kind_of?(IO)\n @config.logger.puts(\"CrashHook Error: #{ex.inspect}\")\n end\n end",
"def log_error(exception)\n message = format_error(exception)\n log_message(message, log_method: 'fatal')\n end",
"def log_error(message)\n logger.error(message) if logger && logger.error?\n end",
"def fatal?; @loggers.first.level <= FATAL; end",
"def log_error(msg)\n logger ? logger.error(msg) : $stderr.puts(msg)\n end",
"def fatal(*msg, &block)\n log(:fatal, *msg, &block)\n end",
"def error?; @logger.error? end",
"def reset_logging\n\t\tLoggability.formatter = nil\n\t\tLoggability.output_to( $stderr )\n\t\tLoggability.level = :fatal\n\tend",
"def error?; @loggers.first.level <= ERROR; end",
"def error_and_log(message)\n @ui.error(message)\n @logger.error(message)\n end",
"def error_and_log(message, log, logger)\n log.error(message)\n logger.error(message)\n end",
"def fatal!(msg, err = -1)\n Kitchenplan::Log.fatal(msg)\n Process.exit err\n end",
"def fatal?; @level <= FATAL; end",
"def fatal?; @level <= FATAL; end",
"def log_error(err)\n backtrace = Array(err.backtrace).flatten.compact\n\n backtrace =\n if backtrace.empty?\n ''\n else\n prefix = \"\\n \"\n prefix + backtrace.join(prefix)\n end\n\n message = \"#{err.class}: #{err.message}#{backtrace}\"\n Fluffle.logger.error message\n end",
"def cr_error(s)\n # barclamp-deployer:\n # Chef::Log.error(s)\n # barclamp-crowbar:\n # Rails.logger.error(s)\n raise NotImplementedError, \"#{self.class} didn't implement error\"\n end",
"def fatal_error(error)\n if $stdout.isatty\n $stdout.puts(\"\\033[31m#{error.message}\\033[0m\")\n else\n $stdout.puts(error.message)\n end\n end",
"def error(msg)\n @logProvider.error(msg)\n end",
"def error(string)\n @logger.error(string)\n end",
"def log_error(exception)\n logger.fatal do\n message = +\"#{exception.class} (#{exception.message}):\\n\\n\"\n message << exception.annotated_source_code.to_s if exception.respond_to?(:annotated_source_code)\n message << \" \" << exception.backtrace.join(\"\\n \")\n \"#{message}\\n\\n\"\n end\n end",
"def log_error(msg, e=nil)\n #log_msg = msg + \": #{e}\\n\\t\" + e.backtrace.join(\"\\n\\t\") + \"\\n\" if e\n #Logging.log_msg(log_msg, Logger::ERROR)\n (@logger ||= OMF::Common::LObject.new(self.class)).error(msg, \"\\n\", e, \"\\n\", e.backtrace.join(\"\\n\\t\"))\n end",
"def log_error(msg, logger, opts={})\r\n\t\t\t\t## Preconditions & preparation:\r\n\t\t\t\tdefaults = {\r\n\t\t\t\t\t:lvl => Logger::ERROR,\r\n\t\t\t\t}.merge(opts)\r\n\t\t\t\t## Main:\r\n\t\t\t\tlogger.add(defaults[:lvl], msg)\r\n\t\t\tend",
"def error(text)\n GitPusshuTen::Log.error(text)\n end",
"def error(msg) log(ERROR, \"ERROR \" << format(msg) << \", \" << caller[0][caller[0].rindex(\"/\").nil? ? 0 : caller[0].rindex(\"/\") + 1 .. -1]); end",
"def severity\n :error\n end",
"def error(msg)\n $ibm_cloud_log.error(format_message(msg))\n end",
"def fatal(object, **rest)\n protect do\n emit Log::Event.ify(object, severity: __method__, rest: rest)\n end\n end",
"def log_error(message)\n Rails.logger.error message\n puts message\n end",
"def error(message)\n log(\"#{color(\"ERROR:\", :red, :bold)} #{message}\")\n end",
"def get_default_log_check_levels\n return [:error, :fatal]\n end",
"def error\n logger.add(Logger::ERROR, nil, facility) { yield } if logger && logger.error?\n end",
"def log_and_die(msg)\n logger.fatal(msg)\n raise msg\n end",
"def _error(msg = nil)\n @api_error[:msg] = msg if msg\n logger.warn(@api_error[:loc]) { @api_error[:msg].message }\n end",
"def print_error (msg, opts={})\r\n\t\t\t\t## Preconditions & preparation:\r\n\t\t\t\t# ???: you can use STDERR or $stderr, unsure which is best\r\n\t\t\t\tdefaults = {\r\n\t\t\t\t\t:stream => $stderr,\r\n\t\t\t\t\t:lvl => Logger::ERROR,\r\n\t\t\t\t}.merge(opts)\r\n\t\t\t\tif defaults[:lvl].is_a?(Fixnum)\r\n\t\t\t\t\tdefaults[:lvl] = LEVELS[defaults[:lvl]] || LEVELS[-1]\r\n\t\t\t\tend\r\n\t\t\t\t## Main:\r\n\t\t\t\tlvl_str = defaults[:lvl]\r\n\t\t\t\tdefaults[:stream].write(\"#{lvl_str.empty?()? '': lvl_str + ': '}#{msg}\\n\")\r\n\t\t\tend",
"def log_error(error)\n @logger.error \"* [JOB] #{name} failed with #{error.class.name}: #{error.message}\"\n @logger.error error.backtrace.inspect\n end",
"def fatal_error(error, msg, args)\n Distributed.fatal \"#{self}: fatal error '#{error.message}' while processing #{msg}(#{args.join(\", \")})\"\n Distributed.fatal Roby.filter_backtrace(error.backtrace).join(\"\\n \")\n @connection_state = :disconnecting\n queue_call false, :fatal_error, [error, msg, args]\n end",
"def fatal_error(error)\n $stderr.puts \"#{$0}: error: #{error}\"\n exit 1\nend",
"def log_error(error)\n error_msg = error\n if current_user == nil\n error_msg += \" User: nil\"\n else\n error_msg += \" User: #{current_user.username}\"\n end\n Rails.logger.error(error_msg)\n end",
"def errorf(string, *args)\n logf(string, *args)\n fail\n end",
"def write_fatal_error message\n puts \"Error: #{message}. See spritemaster -h for usage\"\n exit\n end",
"def log_error(msg)\n print_error(msg)\n\n elog(msg, 'hwbridge', error: $!)\n end",
"def error_level=(level)\n\t\t\t@stderr_logger.level = level\n\t\tend",
"def error_level=(level)\n\t\t\t@stderr_logger.level = level\n\t\tend",
"def add_fatal_error(error)\n warn error if verbose\n @errors << error\n end",
"def error(exception)\n log \"#{exception.message}\\n#{exception.backtrace.join(\"\\n\")}\", :error\n end"
] |
[
"0.73099035",
"0.6945621",
"0.67913467",
"0.6784043",
"0.67269146",
"0.6723689",
"0.66577005",
"0.6656997",
"0.66544837",
"0.65693283",
"0.65693283",
"0.65693283",
"0.6563614",
"0.65523416",
"0.6542061",
"0.65316445",
"0.6519924",
"0.65118873",
"0.65096015",
"0.6504362",
"0.65001774",
"0.6463359",
"0.6423566",
"0.6395669",
"0.6375696",
"0.6355404",
"0.6313848",
"0.6297225",
"0.62966955",
"0.62962425",
"0.62923825",
"0.6286066",
"0.6283105",
"0.62580687",
"0.62389755",
"0.62287813",
"0.6224824",
"0.621942",
"0.62143105",
"0.62094176",
"0.6202593",
"0.6198308",
"0.61858624",
"0.6181547",
"0.61803335",
"0.61754125",
"0.61544955",
"0.6133338",
"0.6128515",
"0.61217016",
"0.61217016",
"0.6117267",
"0.6101516",
"0.60969263",
"0.60917073",
"0.60787565",
"0.60770833",
"0.6074669",
"0.6069782",
"0.60652626",
"0.6057525",
"0.60384727",
"0.60241765",
"0.60228294",
"0.60140014",
"0.60040814",
"0.59938335",
"0.59938335",
"0.5987333",
"0.5972553",
"0.59591883",
"0.59552515",
"0.5951121",
"0.59437096",
"0.5939859",
"0.59398085",
"0.59364367",
"0.59235555",
"0.59168553",
"0.59079444",
"0.5879165",
"0.5877222",
"0.58694965",
"0.5867612",
"0.58606374",
"0.5808775",
"0.5799716",
"0.57942563",
"0.5779032",
"0.5767302",
"0.57665145",
"0.576176",
"0.5745084",
"0.57442117",
"0.57409704",
"0.5739423",
"0.5739423",
"0.5724838",
"0.571392"
] |
0.5834101
|
86
|
Overwrite to implement public exception handling (for requests answering false to local_request?).
|
def rescue_action_in_public(exception) #:doc:
render_text "<html><body><h1>Application error (Rails)</h1></body></html>"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def handle_request_error(exception)\n end",
"def serve_exception(_exception); end",
"def abort_on_exception(*) end",
"def abort_on_exception=(*) end",
"def wrapped_exception; end",
"def exception_handler; end",
"def is_exception?; end",
"def server_error?; end",
"def respond_bad_request; make_response(nil, false, 400, \"Bad Request\") end",
"def original_exception; end",
"def catch_exceptions; end",
"def request\n yield\n rescue Unauthorized, InvalidRequest => e\n raise e\n rescue StandardError => e\n raise UnkownError.new(e)\n end",
"def abort_on_exception=(_arg0); end",
"def check_error(response)\n raise NotImplementedError\n end",
"def local_request?\n LOCAL_REQUEST_ERROR\n end",
"def handle(_request)\n fail NotImplementedError\n end",
"def before_server_error(exception); end",
"def exceptions; end",
"def client_error?; end",
"def in_exception_context?; end",
"def handle_perform_error(_e); end",
"def exception; end",
"def exception; end",
"def exception; end",
"def exception; end",
"def exception; end",
"def rescue_action(e); raise e; end",
"def handle_exception(e)\n if e.flags.has_key?(:layout) then\n @_layout = e.flags[:layout]\n end\n\n if e.flags.has_key?(:no_after_filters) then\n @_stop_no_after_filters = true\n end\n\n if e.flags.has_key?(:redirect) then\n @_layout = false\n to = e.flags[:redirect]\n clear\n @_content = \"<!DOCTYPE HTML PUBLIC \\\"-//W3C//DTD HTML 4.0 Transitional//EN\\\"><html><head><title>Redirecting...</title><meta http-equiv=\\\"REFRESH\\\" content=\\\"0;url=#{to}\\\"></HEAD></HTML>\"\n @cancel_execution = true\n end\n\n if e.flags.has_key?(:error) then\n @_layout = false\n http_status \"SERVER_ERROR\"\n clear\n @error_message = e.flags[:error]\n @cancel_execution = true\n trace = ''\n if Cuca::App.config['display_errors'] then\n e.backtrace.each do |b|\n trace<< \"<br/>#{b}\"\n end\n end\n mab { html { body { h2 \"Error\"; text @error_message; br; text trace }}}\n end\n \n if e.flags.has_key?(:cancel_execution) then\n @cancel_execution = true\n end\n end",
"def rescue_action_in_public_with_errornot(exception)\n unless errornot_ignore_user_agent?\n ErrornotNotifier.notify_or_ignore(exception, errornot_request_data)\n end\n rescue_action_in_public_without_errornot(exception)\n end",
"def underlying_exception; end",
"def exc_msg_and_response(exc, response = T.unsafe(nil)); end",
"def log_request_response(exception = nil)\n super(exception) if exception.present?\n end",
"def handle_bad_request\n make_response(400, 'Bad request (invalid input)')\nend",
"def handle_bad_request\n make_response(400, 'Bad request (invalid input)')\nend",
"def fallback_error_handler(exception)\n __debug_exception('RESCUE_FROM', exception, trace: true)\n self.status = :internal_server_error\n if rendering_html?\n flash_now_alert(exception)\n render\n elsif posting_html?\n redirect_back(fallback_location: root_path, alert: exception.message)\n end\n rescue => error\n error_handler_deep_fallback(__method__, error)\n end",
"def handle_unverified_request; end",
"def handle_unverified_request; end",
"def server_error\n if !session[:exception]\n redirect_to_back(root_path)\n else\n # do nothing\n end\n return session.delete(:exception)\n end",
"def unexpected_error(e)\n log_error(\"Unexpected error while processing request\", e)\n end",
"def rescue_action(e) raise e end",
"def rescue_action(e) raise e end",
"def rescue_action(e) raise e end",
"def rescue_action(e) raise e end",
"def exception_handler(ex)\n \nend",
"def __raise_transport_error(response)\n error = ERRORS[response.status] || ServerError\n raise error.new \"[#{response.status}] #{response.body}\"\n end",
"def errorhandling\n end",
"def continued_exception; end",
"def server_error\n\n end",
"def error_403\n end",
"def handle_bad_request\n make_response(400, {message: 'Bad request (invalid input)'})\nend",
"def rescue_action_locallyyyyyyyyyyyy(e)\n @exception = e\n log_exception(e)\n rescue_action_in_public(e)\n end",
"def original_exception=(_arg0); end",
"def respond_with_exception(exception = nil)\n msg = exception ? exception.message : \"Internal Server Error\"\n render partial: \"api/error\", locals: { message: msg, error_code: \"exception\" }, status: 500\n return false\n end",
"def underlying_exception=(_arg0); end",
"def bad_request\n #redirect_to \"#{Rails.root}/public/400.html\"\n raise ActionController::RoutingError.new('Bad Request')\n end",
"def with_exception_handling\r\n yield\r\n rescue Timeout::Error => exc\r\n return { code: Scrapers::StatusCodes::BLOCKED_REQUEST }\r\n rescue Exception => exc\r\n @logger.error(\"\\n#{self.class} error\")\r\n @logger.error(exc)\r\n @logger.error(exc.backtrace.join(\"\\n\"))\r\n @logger.error(body)\r\n\r\n return { code: Scrapers::StatusCodes::INTERNAL_ERROR }\r\n end",
"def resource_exception\n remote_errors.exception || super\n end",
"def keep_it_in\n raise \"rawr\"\nrescue\n # ahem\nend",
"def error!(message, status=403)\n throw :error, :message => message, :status => status\n end",
"def test_handles_failure_to_create_request_object\n if defined?(ActionDispatch::Request)\n ActionDispatch::Request.stubs(:new).raises('bad news')\n\n assert_raises RuntimeError do\n get '/foo/bar?q=12'\n end\n\n assert_equal('unhandled error', last_error.message)\n assert_equal('/foo/bar', last_error.params[:request_uri])\n end\n end",
"def rescue_from(exception); end",
"def exceptions\n end",
"def errback &block\n super\n end",
"def errback &block\n super\n end",
"def handle_exception datagram, e\n # stub\n end",
"def process(request, response)\n catch(:abort) do\n super(request, response)\n end\n response\n end",
"def continued_exception=(_arg0); end",
"def status_bad_request\n respond_to do |format|\n format.any { head :bad_request }\n end\n end",
"def exception\n raise \"It's a bad one!\"\n end",
"def my_method\n\nrescue\n\nend",
"def exception?\n false\n end",
"def rescue_action(exception)\n log_error(exception) unless logger.nil?\n\n if consider_all_requests_local || local_request?\n rescue_action_locally(exception)\n else\n rescue_action_in_public(exception)\n end\n end",
"def rescue_action(exception)\n log_error(exception) unless logger.nil?\n\n if consider_all_requests_local || local_request?\n rescue_action_locally(exception)\n else\n rescue_action_in_public(exception)\n end\n end",
"def interrupt_exception\n\t\t\tm = Module.new\n\t\t\t(class << m; self; end).instance_eval do\n\t\t\t\tdefine_method(:===){|e|\n\t\t\t\t\te.message =~ /interrupt/i || e.class == Curl::Err::MultiBadEasyHandle\n\t\t\t\t}\n\t\t\tend\n\t\t\tm\n\t\tend",
"def handle_request_exception(exception)\n # puts \"ERROR: #{exception}\\n\" + exception.backtrace.join(\"\\n\")\n handle_error_response(exception.kind_of?(CAHTTPError) ? JSON.parse(exception.response) : {})\n end",
"def exception_response\n { ok: false, message: 'Error processing request' }\n end",
"def rescue_action_in_public_with_notifier(exception) #:doc:\n response_code = response_code_for_rescue(exception)\n status = interpret_status(response_code)[0,3]\n respond_to do |format|\n # Personalize rescue rules for backend\n if controller_path =~ /^backend\\//\n # Usually when we made a post we submit the form\n # to a target iframe, so we need to respond to the parent.\n if request.post?\n responds_to_parent do\n render :update do |page|\n page.unmask\n page.ext_alert I18n.t(\"lipsiadmin.exceptions.#{status}.title\"), I18n.t(\"lipsiadmin.exceptions.#{status}.description\")\n end\n end\n else\n # We can't use status, because Backend.app.load don't permit load 500, 404 pages\n format.html { render :template => \"/exceptions/#{status}\" }\n format.js do\n render :update do |page|\n page.unmask\n page.ext_alert I18n.t(\"lipsiadmin.exceptions.#{status}.title\"), I18n.t(\"lipsiadmin.exceptions.#{status}.description\")\n end\n end\n format.all { render :nothing => true, :status => status }\n end\n else\n format.html { render :template => \"/exceptions/#{status}\", :status => status }\n format.all { render :nothing => true, :status => status }\n end\n end\n rescue Exception => e\n logger.error e.message\n erase_results\n rescue_action_in_public_without_notifier(exception)\n ensure\n if response_code != :not_found && Lipsiadmin::Mailer::ExceptionNotifier.send_mail\n Lipsiadmin::Mailer::ExceptionNotifier.deliver_exception(exception, self, request)\n end\n end",
"def server_error(exception)\n # Whatever code that handles the exception\n\n ExceptionNotifier.notify_exception(exception,\n :env => request.env, :data => {:message => \"was doing something wrong\"})\n end",
"def process(request, response)\r\n catch(:abort) do\r\n super(request, response)\r\n end\r\n response\r\n end",
"def method_missing(*args)\n rescue_404\n end",
"def rescue_action_locally(exception)\n rescue_action_in_public(exception)\n end",
"def internal_server_error(exception = nil)\n error_rendering exception, __callee__\n end",
"def handle_not_found(exception)\n raise exception\n end",
"def x\n # ...\nrescue\n # ...\nend",
"def bypass_rescue\n if ::Rails::VERSION::STRING >= '2.2'\n def controller.rescue_action(exception)\n raise exception\n end\n else\n def controller.rescue_action_with_handler(exception)\n raise exception\n end\n end\n end",
"def error(exception) nil ; end",
"def error_handler_deep_fallback(meth, error = nil)\n Log.error { \"#{meth} FAILED: #{error.inspect}\" } if error\n self.status = :internal_server_error\n render welcome_path\n end",
"def handle_error(e)\n raise e\n end",
"def unknown_error(error, req = T.unsafe(nil), text = T.unsafe(nil)); end",
"def rescue_action(exception)\n if handler_for_rescue(exception)\n rescue_action_with_handler(exception)\n else\n log_error(exception) if logger\n erase_results if performed?\n\n # Let the exception alter the response if it wants.\n # For example, MethodNotAllowed sets the Allow header.\n if exception.respond_to?(:handle_response!)\n exception.handle_response!(response)\n end\n\n if consider_all_requests_local || local_request?\n rescue_action_locally(exception)\n else\n rescue_action_in_public(exception)\n end\n end\n end",
"def with_error_handling(event)\n\tbegin\n\t\tyield\n\trescue => e\n\t\tevent.respond \"Had an error: \" + e.class.to_s\n\t\traise e\n\tend\nend",
"def handle_generic_error(exception)\n end",
"def server_errors; end",
"def onerror(&blk); super; end",
"def expects_exception?; self.class.expects_exception; end",
"def raise_exceptions?\n false\n end",
"def rescue_action_in_public(exception)\n case exception\n when CustomNotFoundError, ::ActionController::UnknownAction then\n #render_with_layout \"shared/error404\", 404, \"standard\"\n render :template => \"errors/404\", :status => 404\n else\n #@reference = Xircles::Logger.log( exception, binding )\n render :template => 'errors/generic', :status => 500\n end\n end",
"def rescue_action_in_public(exception) #:doc:\n render_optional_error_file response_code_for_rescue(exception)\n end",
"def rescue_action_in_public(exception) #:doc:\n render_optional_error_file response_code_for_rescue(exception)\n end",
"def record_internal_exception\n yield\n rescue => e\n @internal_exception = e\n raise\n end",
"def check_404\n end"
] |
[
"0.71346956",
"0.6864399",
"0.68486553",
"0.67631716",
"0.6696974",
"0.6639288",
"0.65948355",
"0.6588481",
"0.64793456",
"0.64716864",
"0.64696455",
"0.6410618",
"0.63530475",
"0.6326964",
"0.630591",
"0.62972033",
"0.6293544",
"0.62822443",
"0.62674904",
"0.6267001",
"0.6248094",
"0.6241461",
"0.6241461",
"0.6241461",
"0.6241461",
"0.6241461",
"0.62290144",
"0.6216466",
"0.6202568",
"0.6188768",
"0.6179481",
"0.61601675",
"0.614628",
"0.614628",
"0.6133628",
"0.6125315",
"0.6125315",
"0.6104195",
"0.61030066",
"0.60972846",
"0.60972846",
"0.60972846",
"0.60972846",
"0.6097007",
"0.60936314",
"0.60881627",
"0.60557634",
"0.6051626",
"0.60436",
"0.6012819",
"0.59929425",
"0.5984057",
"0.5980597",
"0.5980083",
"0.59643865",
"0.5959397",
"0.5949342",
"0.5946983",
"0.59375304",
"0.5926958",
"0.5918692",
"0.5918486",
"0.59171826",
"0.59171826",
"0.59105664",
"0.59075516",
"0.5899562",
"0.58982176",
"0.58729523",
"0.5865784",
"0.58597994",
"0.5854744",
"0.5854744",
"0.5850569",
"0.5845994",
"0.5844463",
"0.5843821",
"0.5838671",
"0.58178365",
"0.5812721",
"0.58105886",
"0.57992715",
"0.57947856",
"0.5786663",
"0.57856876",
"0.57766676",
"0.57725793",
"0.57671344",
"0.576058",
"0.5760227",
"0.5759665",
"0.57520616",
"0.57475555",
"0.5744288",
"0.57408684",
"0.5735399",
"0.5727392",
"0.5726735",
"0.5726735",
"0.57266927",
"0.57253337"
] |
0.0
|
-1
|
Overwrite to expand the meaning of a local request in order to show local rescues on other occurances than the remote IP being 127.0.0.1. For example, this could include the IP of the developer machine when debugging remotely.
|
def local_request? #:doc:
@request.remote_addr == "127.0.0.1"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def local_request? #:doc:\n request.remote_addr == LOCALHOST && request.remote_ip == LOCALHOST\n end",
"def local_request? #:doc:\n request.remote_addr == LOCALHOST && request.remote_ip == LOCALHOST\n end",
"def local_request?()\n return true if %w( development test ).include?(Rails.env)\n local = %w( 0.0.0.0 127.0.0.1 localhost localhost.localdomain )\n local.include?(request.remote_addr) and local.include?(request.remote_ip)\n end",
"def local_request?()\n return true if %w( development test ).include?(Rails.env)\n local = %w( 0.0.0.0 127.0.0.1 localhost localhost.localdomain )\n local.include?(request.remote_addr) and local.include?(request.remote_ip)\n end",
"def request_origin\n @request_origin ||= \"#{request.remote_ip} at #{Time.now.to_s(:db)}\"\n end",
"def local_address\n super\n end",
"def local_request?\n remote = IPAddr.new(request.remote_ip)\n !self.class.local_addresses.detect { |addr| addr.include?(remote) }.nil?\n end",
"def local_request?\n remote = IPAddr.new(request.remote_ip)\n !self.class.local_addresses.detect { |addr| addr.include?(remote) }.nil?\n end",
"def tunnel_local\n\t\tbegin\n\t\t\trstream.localinfo\n\t\trescue ::Exception\n\t\t\t'127.0.0.1'\n\t\tend\n\tend",
"def clientip\n localhost ? local_ip : request.remote_ip\n end",
"def local_request?\n true\n end",
"def local?(ip = remote_ip)\n # TODO: should check if requesting machine is the one the server is running\n return true if ip == '127.0.0.1'\n end",
"def rdaw_local_mode?\n respond_to?(:local_request?) ? local_request? : request.local?\n end",
"def consider_all_requests_local=(_arg0); end",
"def consider_all_requests_local=(_arg0); end",
"def local_request?\n true\n end",
"def local_request?\n return false unless $LOCAL_REQUEST_ADDRESSES.is_a? Array\n $LOCAL_REQUEST_ADDRESSES.any?{ |local_ip| request.remote_addr == local_ip && request.remote_ip == local_ip }\n end",
"def local_hosts_entry\n \"127.0.0.1 #{name}\\n127.0.0.1 localhost.localdomain localhost ubuntu\"\n end",
"def remote_ip\r\n@remote_ip ||= (@env[\"action_dispatch.remote_ip\"] || ip).to_s\r\nend",
"def full_host\n if(request.host =~ /^localhost/ && request.port != 80)\n \"#{request.host}:#{request.port}\"\n else\n request.host\n end\n end",
"def ip_restrict\n allow_ips = Settings.ip_addresses.monstarlab.to_h.values.flatten\n allow_ips << \"::1\" if Rails.env.development?\n remote_ip = request.remote_ip\n\n return render_404 unless allow_ips.include? remote_ip\n end",
"def local_ip\n\nend",
"def localIP\r\n @@local_ip_address\r\n end",
"def consider_local(*args)\n local_addresses.concat(args.flatten.map { |a| IPAddr.new(a) })\n end",
"def consider_all_requests_local; end",
"def consider_all_requests_local; end",
"def local_host\n get('beef.http.host') || '0.0.0.0'\n end",
"def remote_ip\n if request.remote_ip == '127.0.0.1'\n # Hard coded remote address\n '18.228.1.115'\n else\n request.remote_ip\n end\n end",
"def local_ip\n # turn off reverse DNS resolution temporarily\n orig = Socket.do_not_reverse_lookup\n Socket.do_not_reverse_lookup = true\n\n UDPSocket.open do |s|\n # ip is for Google\n s.connect '64.233.187.99', 1\n s.addr.last\n end\n ensure\n # restore previous setting\n Socket.do_not_reverse_lookup = orig\n end",
"def mock_ip_address\n if Rails.env == 'development' || Rails.env == 'cucumber' || Rails.env == 'test'\n test_ip = ENV['RAILS_TEST_IP_ADDRESS']\n unless test_ip.nil? or test_ip.empty?\n request.instance_eval <<-EOS\n def ip\n \"#{test_ip}\"\n end\n EOS\n end\n end\n end",
"def local?\n ip = server_ip.to_s\n is_localhost = ip == '127.0.0.1'\n is_in_ifconfig = `/sbin/ifconfig -a`.include? ip\n is_in_ip_addr = `/sbin/ip addr show`.include? ip\n is_localhost || is_in_ifconfig || is_in_ip_addr\n rescue => err\n (MorLog.my_debug '#{err.message}') && (return false)\n end",
"def is_local_host\n require 'ipaddr'\n begin\n local = IPAddr.new(\"127.0.0.0/8\")\n private1 = IPAddr.new(\"10.0.0.0/8\")\n private2 = IPAddr.new(\"172.16.0.0/12\")\n private3 = IPAddr.new(\"192.168.0.0/16\")\n private4 = IPAddr.new(\"85.230.85.45\")\n private5 = IPAddr.new(\"94.234.170.18\")\n\n if local.include?(request.remote_ip)\n return true\n end\n if private1.include?(request.remote_ip)\n return true\n end\n if private2.include?(request.remote_ip)\n return true\n end\n if private3.include?(request.remote_ip)\n return true\n end\n if private4.include?(request.remote_ip)\n return true\n end\n if private5.include?(request.remote_ip)\n return true\n end\n return false\n rescue\n return false\n end\n end",
"def remote_ip; end",
"def local_ip\n Synchronizer.config['local_url']\n end",
"def src_addr_on_header\n request.headers['X-Forwarded-For'] || request.headers['REMOTE_ADDR']\n end",
"def local\n {\n :merchant_account_id => origin.merchant_id,\n :request_id => origin.request_id,\n :parent_transaction_id => origin.parent_transaction_id,\n :ip_address => REQUEST_IP_ADDRESS\n }\n end",
"def remote_ip\n request.env['HTTP_X_FORWARDED_FOR'] || request.remote_ip\n end",
"def remote_addr; end",
"def local_request?\n false\n end",
"def local_request?\n false\n end",
"def local_request?\n false\n end",
"def local?\r\nLOCALHOST =~ remote_addr && LOCALHOST =~ remote_ip\r\nend",
"def remote_addr_header; end",
"def true_address\r\n addr = servlet_response.getLocalName\r\n $log.debug(\"True address/hostname is #{addr}\")\r\n addr\r\n end",
"def ip\n render text: local_ip\n end",
"def get_remote_ip(env)\n# X-Forwarded-For provides a list of IP addresses, from the calling client to the last proxy:\n# X-Forwarded-For: client1, proxy1, proxy2\n if addr = env['HTTP_X_FORWARDED_FOR']\n addr.split(',').first.strip\n else\n env['REMOTE_ADDR'] # Only gives the IP address of the last proxy.\n end\nend",
"def getlocalname\n if [nil, '0.0.0.0', '::'].include?(self.localhost) && [nil, 0].include?(self.localport)\n _, self.localhost, self.localport = getsockname\n end\n\n family = Socket.is_ipv4?(self.localhost) ? ::Socket::AF_INET : ::Socket::AF_INET6\n [family, self.localhost, self.localport]\n end",
"def ip\n request.env['HTTP_X_FORWARDED_FOR'] || request.remote_ip \n end",
"def local_ip\n # turn off reverse DNS resolution temporarily\n orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true\n\n UDPSocket.open do |s|\n s.connect '64.233.187.99', 1 # google\n s.addr.last\n end\n ensure\n Socket.do_not_reverse_lookup = orig\n end",
"def request_ip(env)\n obtain_ip_from_rails(env) || obtain_ip_from_rack(env)\n end",
"def local_request?\n LOCAL_REQUEST_ERROR\n end",
"def remote_ip\n return request.env['HTTP_X_FORWARDED_FOR'] if request.env['HTTP_X_FORWARDED_FOR']\n return request.remote_ip\n end",
"def req_origin(env)\n req = env.request.context\n action = req[:action]\n action = color(action, color_method(action), true)\n client = req[:client].to_s.gsub('PriceHubble::Client', 'PriceHubble')\n \"#{client.underscore}##{action}\"\n end",
"def remote_address\n super\n end",
"def use_for_local_addresses\n return @use_for_local_addresses\n end",
"def patch_ip\n remote_addrs = request.headers['REMOTE_ADDR'] ? request.headers['REMOTE_ADDR'].split(/[,\\s]+/) : []\n remote_addrs.reject! { |addr| trusted_proxy?(addr) }\n\n return if remote_addrs.any?\n\n forwarded_ips = request.headers['HTTP_X_FORWARDED_FOR'] ?\n request.headers['HTTP_X_FORWARDED_FOR'].strip.split(/[,\\s]+/) : []\n logger.info('remote_addrs: ' + remote_addrs.to_s)\n\n if client_ip = request.headers['HTTP_CLIENT_IP']\n # If forwarded_ips doesn't include the client_ip, it might be an\n # ip spoofing attempt, so we ignore HTTP_CLIENT_IP\n if forwarded_ips.include?(client_ip) then\n request.headers['REMOTE_ADDR'] = client_ip\n return\n end\n end\n\n logger.info('forwarded_ips: ' + forwarded_ips.to_s)\n\n client_ip = forwarded_ips.reject { |ip| trusted_proxy?(ip) }.last\n request.headers['REMOTE_ADDR'] = client_ip if client_ip\n end",
"def remote_ip\n\t\tif request.remote_ip == '127.0.0.1'\n\t\t\t# Random remote address for testing on develop\n\t\t\t\"#{rand(255)}.#{rand(255)}.#{rand(255)}.#{rand(255)}\"\n\t\telse\n\t\t\trequest.remote_ip\n\t\tend\n\tend",
"def local\n @local\n end",
"def remote_ip\n return env['HTTP_CLIENT_IP'] if env.include? 'HTTP_CLIENT_IP'\n\n if env.include? 'HTTP_X_FORWARDED_FOR' then\n remote_ips = env['HTTP_X_FORWARDED_FOR'].split(',').reject do |ip|\n ip =~ /^unknown$|^(10|172\\.16|192\\.168)\\./i\n end\n\n return remote_ips.first.strip unless remote_ips.empty?\n end\n\n return env['REMOTE_ADDR']\n end",
"def local_ip_address\n conf['base_address'] ||\n %x{ip addr show #{conf['base_interface'] || 'br0'} | grep inet}.split(' ')[1].to_s.strip.split('/').first.to_s\nend",
"def default_lookup(req, *args)\n req.address\n end",
"def before_request(uri, http_verb = :get, options = {})\n if ENV['REMOTELY_DEBUG']\n puts \"-> #{http_verb.to_s.upcase} #{uri}\" \n puts \" #{options.inspect}\"\n end\n end",
"def local_ip\n orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true # turn off reverse DNS resolution temporarily\n\n UDPSocket.open do |s|\n s.connect '64.233.187.99', 1\n s.addr.last\n end\n ensure\n Socket.do_not_reverse_lookup = orig\n end",
"def local_ipv4\n `echo \"#{ifconfig}\" | #{filter}`.split(\"\\n\")\n end",
"def append_info_to_payload(payload)\n super\n payload[:remote_ip] = request.remote_ip\n end",
"def identify( request_env )\n return request_env['HTTP_X_FORWARDED_FOR'] || request_env['REMOTE_ADDR'], request_env['HTTP_USER_AGENT']\n end",
"def my_ip\n get(\"/tools/myip\")\n end",
"def client_ip\n req = request\n return nil unless req\n # Look for an external address being forwarded\n split_ips = []\n PREFFERED_IP_HEADERS.each do |header_name|\n forwarded = req.env[header_name]\n ips = split_ip_addresses(forwarded)\n lip = ips.find { |ip| (ip !~ TRUSTED_PROXIES) && valid_ip?(ip) }\n split_ips << ips unless ips.empty?\n return lip unless lip.nil?\n end\n # Else fall back to declared remote addr\n r = req.env['REMOTE_ADDR']\n # If this is localhost get the last hop before\n if r.nil? || r =~ LOCALHOST\n split_ips.each do |ips|\n lip = ips.find { |ip| (ip !~ LOCALHOST) && valid_ip?(ip) }\n return lip unless lip.nil?\n end\n end\n r\n end",
"def consider_local? # :nodoc:\n @domain == :both or @domain == :local\n end",
"def local?\n true\n end",
"def use_for_local_addresses=(value)\n @use_for_local_addresses = value\n end",
"def is_local_host?(host)\n if host == 'localhost' || host == '127.0.0.1' || host == '::1'\n true\n else\n require 'socket'\n require 'resolv'\n Socket.ip_address_list.map { |a| a.ip_address }.include? Resolv.getaddress host\n end\n end",
"def local\n uri.local?\n end",
"def local\n uri.local?\n end",
"def current_host\n @current_host ||= \"#{request.protocol}#{request.host_with_port}\"\n end",
"def setlocal()\n if system(\"hostnamectl set-hostname #{@fqdn}\")\n @log.info(\"Set the localhost hostname to #{@fqdn}.\")\n end\n end",
"def info_for_paper_trail\n { :ip => request.remote_ip }\n end",
"def is_local?\n !is_remote?\n end",
"def localinfo\n if (pi = getlocalname)\n return pi[1] + ':' + pi[2].to_s\n end\n end",
"def current_server\n \"#{request.protocol}#{request.host_with_port}\"\n end",
"def get_ip_address \t\t\t\n\t\trequest.remote_ip \n\tend",
"def local_request?\n request.referrer.to_s.start_with?(root_url)\n end",
"def ip_check\n logger.warn request.remote_addr.inspect\n if Rails.env == \"production\" && !request.remote_ip.include?(\"99.166.163.112\")\n render :text => \"GETTHEFUCKOUT\"\n end\n end",
"def local_address\n if !@local_addr\n @local_addr = Addrinfo.tcp(@j_del.localAddress().getAddress().getHostAddress(), @j_del.localAddress().getPort())\n end\n @local_addr\n end",
"def set_local_address(opts)\n opts = check_params(opts,[:addresses])\n super(opts)\n end",
"def external_ip\n begin\n ip = OpenURI.open_uri(\"http://myip.dk\") {|f|f.read.scan(/([0-9]{1,3}\\.){3}[0-9]{1,3}/); $~.to_s}\n rescue\n ip = local_ip\n puts \"Seems like there is a problem adquiring external IP address, ...using local address: (#{ip})\"\n end\n ip\n end",
"def rescue_action_in_public!\n @request.remote_addr = '208.77.188.166' # example.com\n end",
"def log_request_details(event)\n env = event.payload\n debug do\n \"[#{req_id(env)}] #{req_dest(env)} > \" \\\n \"#{env.request_headers.sort.to_h.to_json}\"\n end\n end",
"def parse_ip\n @request[FHOST] || BLANK_STR\n end",
"def local?\n @local\n end",
"def local?\n @local\n end",
"def request=(request)\n if request.respond_to?(:env) and request.env.kind_of?(Hash)\n self.ip = request.env[\"REMOTE_ADDR\"] if request.env[\"REMOTE_ADDR\"]\n self.referer = request.env[\"HTTP_REFERER\"] if request.env[\"HTTP_REFERER\"]\n end\n end",
"def annotate(request)\n\t\t\t\ttask = Async::Task.current\n\t\t\t\taddress = request.remote_address\n\t\t\t\t\n\t\t\t\t@logger.info(request) {\"Headers: #{request.headers.to_h} from #{address.inspect}\"}\n\t\t\t\t\n\t\t\t\ttask.annotate(\"#{request.method} #{request.path} from #{address.inspect}\")\n\t\t\tend",
"def local?\n @local\n end",
"def user_variables\n {:ip=>request.remote_ip, :user_agent=>request.env['HTTP_USER_AGENT'], :referrer=>request.env['HTTP_REFERER']}\n end",
"def location\n \t#@ip = request.remote_id\n \t@ip = '118.113.226.34'\n \t@location = Rails.cache.read(@ip)\n end",
"def local_ip\n orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true # turn off reverse DNS resolution temporarily\n\n UDPSocket.open do |s|\n s.connect '64.233.187.99', 1\n s.addr.last\n end\nensure\n Socket.do_not_reverse_lookup = orig\nend",
"def exploit_type\n Msf::Exploit::Type::Local\n end",
"def local_ips\n list = cmd(\"addr show dev #{name} primary\", sudo: false, errors: true) +\n cmd(\"addr show dev #{name} secondary\", sudo: false, errors: true)\n list.lines.grep(/inet ([0-9\\.]+)\\/.* #{name}/i){ $1 }\n rescue\n raise Errors::UnknownInterface, \"Interface #{name} not found on this machine\" unless exists?\n raise\n end"
] |
[
"0.64021605",
"0.64021605",
"0.63067764",
"0.63067764",
"0.62527925",
"0.6127323",
"0.5992975",
"0.5992975",
"0.59674674",
"0.5888512",
"0.58279514",
"0.580215",
"0.5795832",
"0.57882535",
"0.57882535",
"0.5769815",
"0.5719964",
"0.570767",
"0.5694553",
"0.5659948",
"0.5656065",
"0.56520575",
"0.56333315",
"0.5609728",
"0.5592",
"0.5592",
"0.5548962",
"0.5547713",
"0.55315465",
"0.55280143",
"0.5519726",
"0.5499565",
"0.549681",
"0.54949105",
"0.5479291",
"0.547074",
"0.5432259",
"0.54162",
"0.5406385",
"0.5406385",
"0.5406385",
"0.53800786",
"0.53739727",
"0.5363477",
"0.5361107",
"0.5332385",
"0.5326025",
"0.5324325",
"0.53234893",
"0.532311",
"0.5321714",
"0.5297836",
"0.52951527",
"0.5292819",
"0.528798",
"0.5280069",
"0.5279476",
"0.5273748",
"0.5252256",
"0.52335846",
"0.52297986",
"0.52279615",
"0.52171814",
"0.52109075",
"0.5201657",
"0.5193793",
"0.51897484",
"0.5167917",
"0.51564616",
"0.5142772",
"0.514078",
"0.51392317",
"0.5137882",
"0.5137882",
"0.5116709",
"0.51129067",
"0.5107222",
"0.5104472",
"0.5083484",
"0.5080291",
"0.50719345",
"0.5069722",
"0.5058153",
"0.50531334",
"0.5052564",
"0.5047945",
"0.5045405",
"0.50422776",
"0.50374144",
"0.50361234",
"0.50361234",
"0.50357443",
"0.5035581",
"0.50328636",
"0.50313926",
"0.5031038",
"0.5028483",
"0.50279224",
"0.5017721"
] |
0.6258805
|
5
|
Renders a detailed diagnostics screen on action exceptions.
|
def rescue_action_locally(exception)
@exception = exception
@rescues_path = File.dirname(__FILE__) + "/templates/rescues/"
add_variables_to_assigns
@contents = @template.render_file(template_path_for_local_rescue(exception), false)
@headers["Content-Type"] = "text/html"
render_file(rescues_path("layout"), "500 Internal Error")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def rescue_action(exception)\n @message = exception.message\n @backtrace = exception.backtrace.join(\"\\n\") unless exception.nil?\n logger.info @message\n logger.info @backtrace\n render :file => \"#{RAILS_ROOT}/app/views/errors/error.rhtml\", :layout=> false, :status => 404\n end",
"def show_detailed_exceptions?; end",
"def render_error(exception)\n # use the exception_notifier gem to send out an e-mail to the notification list specified in config/environment.rb\n ExceptionNotifier.notify_exception(exception)\n\n #TODO: hide stack traces from students after the beta. leave @error undefined to hide stack traces\n @error = exception\n\n render \"home/error\"\n end",
"def exception_renderer; end",
"def resource_failed(resource, action, exception)\n puts COLOR_RED\n puts \"failed to handle resource --> :#{action} #{resource}\"\n puts COLOR_RESET\n puts \"#{exception}\"\n end",
"def render_not_found(exception)\n # Render detailed diagnostics for unhandled exceptions rescued from\n # a controller action.\n rescue_action_locally(exception)\n end",
"def rescue_action(e)\n\n # sometimes, Rails likes to pass you instance variables that you don't want\n # this should get rid of any junk that the previous renders left behind that rails failed to clean up\n erase_render_results\n #forget_variables_added_to_assigns\n reset_variables_added_to_assigns\n \n @error = e\n @error_name = e.class.to_s.demodulize.underscore\n\n @error_trace = @error.backtrace\n @error_message = @error.to_s.gsub('<', '<').gsub('>', '>')\n\n if(@error.respond_to? :status_code)\n @status = @error.status_code\n elsif(DEFAULT_RESCUE_RESPONSES.has_key? @error.class.to_s)\n @status = DEFAULT_RESCUE_RESPONSES[@error.class.to_s]\n else\n @status = DEFAULT_RESCUE_RESPONSE\n end\n \n if logger.level > Logger::INFO\n logger.error %{\n Processing #{self.class.name}\\##{action_name} (for #{request_origin}) [#{request.method.to_s.upcase}]\n Session ID: #{@_session.session_id if @_session and @_session.respond_to?(:session_id)}\n Parameters: #{respond_to?(:filter_parameters) ? filter_parameters(params).inspect : params.inspect}}\n end\n logger.error %{\n Error: #{@error.clean_message} (status: #{@status})\n Trace: #{(@error_trace.is_a? Array)? @error_trace.join(\"\\n\\t \") : @error_trace }\n }\n\n respond_to do |format|\n format.html do\n begin\n render :partial => \"shared/errors/error\", :layout => 'error', :status => @status\n rescue\n super(e)\n end\n end\n format.js do\n begin\n render :template => \"shared/errors/error\"\n rescue\n render :update do |page|\n page.alert \"There has been an error, and then another error occured while first error was being processed... Too bad. The original error was: #{@error.to_s}.\"\n page.alert \"The additional error was: #{$!.to_s}.\"\n end\n end\n end\n end\n \n rescue_with_handler(e) or notify_airbrake(e)\n end",
"def render_show_server_error\n render :action => :show_server_error\n end",
"def render_action(action, params)\n send(action, params)\n \n rescue RenderExit, ActionExit => e1\n # Just stop rendering. \n \n rescue ActionError => e2\n # Client Error family of errors, typically send 4XX\n # status code.\n handle_error(e2, 404)\n error e2.to_s\n \n rescue Object => e3\n # Server Error family of errors, typically send 5XX\n # status code. \n handle_error(e3, 500)\n error \"Error while handling #{self.class}##{action.to_s.gsub(/___super$/, '')}(#{params.join(', ')})\"\n error pp_exception(e3)\n end",
"def display\n\t\t\tGlyph.warning exception.message\n\t\t\tGlyph.msg \" source: #{@macro.source}\\n path: #{@macro.path}\"\n\t\t\tGlyph.msg \"#{\"-\"*54}\\n#{@macro.node.to_s.gsub(/\\t/, ' ')}\\n#{\"-\"*54}\" if Glyph.debug?\n\t\tend",
"def render_show_server_error\n\t\trender :action => :show_server_error\n\tend",
"def render_error(exception)\n # use the exception_notifier gem to send out an e-mail\n # to the notification list specified in config/environment.rb\n ExceptionNotifier.notify_exception(exception, env: request.env,\n data: {\n user: current_user,\n course: @course,\n assessment: @assessment,\n submission: @submission\n })\n\n respond_to do |format|\n format.html do\n # stack traces are only shown to instructors and administrators\n # by leaving @error undefined, students and CAs do not see stack traces\n if !current_user.nil? && (current_user.instructor? || current_user.administrator?)\n @error = exception\n\n # Generate course id and assessment id objects\n @course_name = params[:course_name] ||\n (params[:controller] == \"courses\" ? params[:name] : nil)\n if @course_name\n @assessment_name = params[:assessment_name] ||\n (params[:controller] == \"assessments\" ? params[:name] : nil)\n\n end\n end\n\n render \"home/error_500\"\n end\n format.json { head :internal_server_error }\n format.js { head :internal_server_error }\n end\n end",
"def show\n @error = ErrorDetails.new(request.env)\n Rails.logger.error(\"#{@error.reference} for #{@error.message}\")\n template = (@error.status_code == 404 ? '404' : '500')\n render template, status: @error.status_code\n end",
"def error_explanation(resource)\n render 'error_explanation', :resource => resource\n end",
"def handle_exception(e)\n if e.flags.has_key?(:layout) then\n @_layout = e.flags[:layout]\n end\n\n if e.flags.has_key?(:no_after_filters) then\n @_stop_no_after_filters = true\n end\n\n if e.flags.has_key?(:redirect) then\n @_layout = false\n to = e.flags[:redirect]\n clear\n @_content = \"<!DOCTYPE HTML PUBLIC \\\"-//W3C//DTD HTML 4.0 Transitional//EN\\\"><html><head><title>Redirecting...</title><meta http-equiv=\\\"REFRESH\\\" content=\\\"0;url=#{to}\\\"></HEAD></HTML>\"\n @cancel_execution = true\n end\n\n if e.flags.has_key?(:error) then\n @_layout = false\n http_status \"SERVER_ERROR\"\n clear\n @error_message = e.flags[:error]\n @cancel_execution = true\n trace = ''\n if Cuca::App.config['display_errors'] then\n e.backtrace.each do |b|\n trace<< \"<br/>#{b}\"\n end\n end\n mab { html { body { h2 \"Error\"; text @error_message; br; text trace }}}\n end\n \n if e.flags.has_key?(:cancel_execution) then\n @cancel_execution = true\n end\n end",
"def get_errors exception\n puts exception\n puts exception.backtrace\n Rails.logger.error(exception)\n\n @error_title = I18n.t 'errors.get_errors.title', default: 'Get An Error!'\n @error_message = I18n.t 'errors.get_errors.message', default: 'The operation you did get an error'\n render :template => '/errors/error_page',layout: false\n end",
"def my_rescue_action_in_public(exception)\n # MorLog.my_debug exception.to_yaml\n # MorLog.my_debug exception.backtrace.to_yaml\n time = Time.now()\n id = time.strftime(\"%Y%m%d%H%M%S\")\n address = 'gui_crashes@kolmisoft.com'\n extra_info = \"\"\n swap = nil\n begin\n MorLog.my_debug(\"Rescuing exception: #{exception.class.to_s} controller: #{params[:controller].to_s}, action: #{params[:action].to_s}\", true)\n if important_exception(exception)\n MorLog.my_debug(\" >> Exception is important\", true)\n MorLog.log_exception(exception, id, params[:controller].to_s, params[:action].to_s) if params[:do_not_log_test_exception].to_i == 0\n\n trace = exception.backtrace.collect { |t| t.to_s }.join(\"\\n\")\n\n exception_class = escape_for_email(exception.class).to_s\n exception_class_previous = Confline.get_value(\"Last_Crash_Exception_Class\", 0).to_s\n exception_send_email = Confline.get_value(\"Exception_Send_Email\").to_i\n\n # Lots of duplication but this is due fact that in future there may be\n # need for separate link for every error.\n flash_help_link = nil\n\n\n if exception_class.include?(\"Net::SMTPFatalError\")\n flash_notice = _('smtp_server_error')\n flash_help_link = \"\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'smtp_server_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Errno::ENETUNREACH\")\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_Errno::ENETUNREACH\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Errno::EACCES\")\n flash_notice = _('File_permission_error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'File_permission_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Errno::EHOSTUNREACH\") or (exception_class.include?(\"Errno::ECONNREFUSED\") and trace.to_s.include?(\"rami.rb:380\"))\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_SystemExit\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"SystemExit\") or (exception_class.include?('RuntimeError') and (exception.message.include?('No route to host') or exception.message.include?('getaddrinfo: Name or service not known') or exception.message.include?('Connection refused')))\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_SystemExit\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n end\n\n if exception_class.include?('RuntimeError') and (exception.message.include?('Connection timed out') or exception.message.include?('Invalid argument') or exception.message.include?('Connection reset by peer') or exception.message.include?('Network is unreachable') or exception.message.include?('exit'))\n flash_notice = _('Your_Asterisk_server_is_not_accessible_Please_check_if_address_entered_is_valid_and_network_is_OK')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n exception_send_email = 0\n end\n\n if exception_class.include?(\"SocketError\") and !trace.to_s.include?(\"smtp_tls.rb\")\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_SystemExit\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n end\n if exception_class.include?(\"Errno::ETIMEDOUT\")\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_SystemExit\"\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Asterik_server_connection_error', :data2 => exception.message).save\n exception_send_email = 0\n end\n\n if exception_class.include?(\"OpenSSL::SSL::SSLError\") or exception_class.include?(\"OpenSSL::SSL\")\n flash_notice = _('Verify_mail_server_details_or_try_alternative_smtp_server')\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'SMTP_connection_error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"ActiveRecord::RecordNotFound\")\n flash_notice = _('Data_not_found')\n flash_help_link = ''\n exception_send_email = 1\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Data_not_found', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"ActiveRecord::StatementInvalid\") and exception.message.include?('Access denied for user')\n flash_notice = _('MySQL_permission_problem_contact_Kolmisoft_to_solve_it')\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'MySQL_permission_problem', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Transactions::TransactionError\")\n flash_notice = _(\"Transaction_error\")\n swap = []\n swap << %x[vmstat]\n # swap << ActiveRecord::Base.connection.select_all(\"SHOW INNODB STATUS;\")\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Transaction_errors', :data2 => exception.message).save\n exception_send_email = 0\n end\n\n if exception_class.include?(\"Errno::ENOENT\") and exception.message.include?('/tmp/mor_debug_backup.txt')\n flash_notice = _('Backup_file_not_found')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Backup_file_not_found', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"GoogleCheckoutError\") and exception.message.include?(\"No seller found with id\")\n flash_notice = _('Internal_Error_Contact_Administrator')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n # database not updated\n if exception_class.include?(\"NoMethodError\") and !exception.message.include?(\"nil:NilClass\") and exception.message.include?(\"for #<\")\n flash_notice = _('Database_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Database_Error', :data2 => exception.message).save\n end\n if exception_class.include? \"ActiveModel::MissingAttributeError\"\n flash_notice = _('Database_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Database_Error', :data2 => exception.message).save\n end\n if exception_class.include?(\"ActiveRecord::StatementInvalid\") and exception.message.include?(\"Unknown column\")\n flash_notice = _('Database_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Database_Error', :data2 => exception.message).save\n end\n #\n\n if exception_class.include?(\"GoogleCheckoutError\") and exception.message.include?(\"The currency used in the cart must match the currency of the seller account.\")\n flash_notice = _('Internal_Error_Contact_Administrator')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Google4R\") and exception.message.include?(\"Missing URL component: expected id:\")\n flash_notice = _('Internal_Error_Contact_Administrator')\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Google4R\") and exception.message.include?('expected id: (\\d{10})|(\\d{15})')\n flash_notice = _(\"Payment_Error_Contact_Administrator_enter_merchant_id\")\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception_class.include?(\"Google4R\") and exception.message.include?('Seller Account') and exception.message.include?('is not active.')\n flash_notice = _(\"Payment_Error_Contact_Administrator_account_not_active\")\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception.message.include?('Unexpected response code')\n flash_notice = _(\"Google_checkout_error\") + ': ' + exception.message.to_s #.gsub('Google Unexpected response code', 'Unexpected response code')\n flash_help_link = ''\n exception_send_email = 0\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception.message.include?('An API Certificate or API Signature is required to make requests to PayPal')\n flash_notice = _('An_API_Certificate_or_API_Signature_is_required_to_make_requests_to_PayPal')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Payment_Gateway_Error', :data2 => exception.message).save\n end\n\n if exception.message.include?('Temporary failure in name resolution')\n flash_notice = _('DNS_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'DNS_Error', :data2 => exception.message).save\n end\n\n if exception.message.include?('Ambethia::ReCaptcha::Controller::RecaptchaError')\n flash_notice = _('ReCaptcha_Error')\n flash_help_link = ''\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'ReCaptcha_Error', :data2 => exception.message).save\n end\n\n #if exception_class.include?(\"Net::SMTP\") or (exception_class.include?(\"Errno::ECONNREFUSED\") and trace.to_s.include?(\"smtp_tls.rb\")) or (exception_class.include?(\"SocketError\") and trace.to_s.include?(\"smtp_tls.rb\")) or ((exception_class.include?(\"Timeout::Error\") and trace.to_s.include?(\"smtp.rb\"))) or trace.to_s.include?(\"smtp.rb\")\n flash_help_link = email_exceptions(exception) if flash_help_link.blank? and flash_notice.blank?\n #end\n\n if exception_class.include?(\"LoadError\") and exception.message.to_s.include?('locations or via rubygems.')\n if exception.message.include?('cairo')\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/Cannot_generate_PDF\"\n else\n flash_help_link = \"http://wiki.kolmisoft.com/index.php/GUI_Error_-_Ruby_Gems\"\n end\n Action.new(:user_id => session[:user_id].to_i, :date => Time.now.to_s(:db), :action => \"error\", :data => 'Ruby_gems_not_found', :data2 => exception.message).save\n exception_send_email = 0\n end\n\n # Specific case for acunetix security scanner\n if (exception.message.include?('invalid byte sequence in UTF-8') or exception.message.include?('{\"$acunetix\"=>\"1\"}')) and ['try_to_login', 'signup_end'].member?(params[:action])\n flash_notice = _('Internal_Error_Contact_Administrator')\n exception_send_email = 0\n end\n\n if exception_send_email == 1 and exception_class != exception_class_previous and !flash_help_link or params[:this_is_fake_exception].to_s == \"YES\"\n MorLog.my_debug(\" >> Need to send email\", true)\n\n if exception_class.include?(\"NoMemoryError\")\n extra_info = get_memory_info\n MorLog.my_debug(extra_info)\n end\n\n # Gather all exception\n rep, rev, status = get_svn_info\n rp = []\n (params.each { |k, v| rp << [\"#{k} => #{v}\"] })\n\n message = [\n \"ID: #{id.to_s}\",\n \"IP: #{request.env['SERVER_ADDR']}\",\n \"Class: #{exception_class}\",\n \"Message: #{exception}\",\n \"Controller: #{params[:controller]}\",\n \"Action: #{params[:action]}\",\n \"User ID: #{session ? session[:user_id].to_i : 'possible_from_api'}\",\n \"----------------------------------------\",\n \"Repositority: #{rep}\",\n \"Revision: [#{rev}]\",\n \"Local version modified: #{status}\",\n \"----------------------------------------\",\n\n \"Request params: \\n#{rp.join(\"\\n\")}\",\n \"----------------------------------------\",\n \"Seesion params: \\n#{nice_session if session}\",\n \"----------------------------------------\"\n ]\n if extra_info.length > 0\n message << \"----------------------------------------\"\n message << extra_info\n message << \"----------------------------------------\"\n end\n message << \"#{trace}\"\n\n if test_machine_active?\n if File.exists?('/var/log/mor/test_system')\n message << \"----------------------------------------\"\n message << %x[tail -n 50 /var/log/mor/test_system]\n end\n end\n\n if swap\n message << \"----------------------------------------\"\n message << swap.to_yaml\n end\n\n if exception_class.include?(\"Errno::EPERM\")\n message << \"----------------------------------------\"\n message << %x[ls -la /home/mor/tmp/]\n message << \"----------------------------------------\"\n message << %x[ls -la /home/mor/]\n end\n\n Confline.set_value(\"Last_Crash_Exception_Class\", exception_class, 0)\n\n if params[:this_is_fake_exception].to_s == \"YES\"\n MorLog.my_debug(' >> Crash email NOT sent THIS IS JUST TEST', true)\n return :text => flash_notice.to_s + flash_help_link.to_s + message.join(\"\\n\")\n #render :text => message.join(\"\\n\") and return false\n else\n\n subject = \"#{ExceptionNotifier_email_prefix} Exception. ID: #{id.to_s}\"\n time = Confline.get_value(\"Last_Crash_Exception_Time\", 0)\n if time and !time.blank? and (Time.now - Time.parse(time)) < 1.minute\n MorLog.my_debug(\"Crash email NOT sent : Time.now #{Time.now.to_s(:db)} - Last_Crash_Exception_Time #{time}\")\n else\n send_crash_email(address, subject, message.join(\"\\n\")) if params[:do_not_log_test_exception].to_i == 0\n Confline.set_value(\"Last_Crash_Exception_Time\", Time.now.to_s(:db), 0)\n MorLog.my_debug('Crash email sent')\n end\n end\n else\n MorLog.my_debug(\" >> Do not send email because:\", true)\n MorLog.my_debug(\" >> Email should not be sent. Confline::Exception_Send_Email: #{exception_send_email.to_s}\", true) if exception_send_email != 1\n MorLog.my_debug(\" >> The same exception twice. Last exception: #{exception_class.to_s}\", true) if exception_class == exception_class_previous\n MorLog.my_debug(\" >> Contained explanation. Flash: #{ flash_help_link}\", true) if flash_help_link\n end\n\n if !flash_help_link.blank?\n flash[:notice] = _('Something_is_wrong_please_consult_help_link')\n flash[:notice] += \"<a id='exception_info_link' href='#{flash_help_link}' target='_blank'><img alt='Help' src='#{Web_Dir}/assets/icons/help.png' title='#{_('Help')}' /></a>\".html_safe\n else\n flash[:notice] = flash_notice.to_s.blank? ? \"INTERNAL ERROR. - ID: #{id} - #{exception_class}\" : flash_notice\n end\n\n if session and session[:forgot_pasword] == 1\n session[:forgot_pasword] = 0\n flash[:notice_forgot]= (_('Cannot_change_password') + \"<br />\" + _('Email_not_sent_because_bad_system_configurations')).html_safe\n end\n\n if session and session[:flash_not_redirect].to_i == 0\n #redirect_to Web_Dir + \"/callc/main\" and return false\n else\n session[:flash_not_redirect] = 0 if session\n #render(:layout => \"layouts/mor_min\") and return false\n end\n end\n rescue Exception => e\n MorLog.log_exception(e, id, params[:controller].to_s, params[:action].to_s)\n message =\"Exception in exception at: #{escape_for_email(request.env['SERVER_ADDR'])} \\n --------------------------------------------------------------- \\n #{escape_for_email(%x[tail -n 50 /var/log/mor/test_system])}\"\n command = ApplicationController::send_email_dry(\"guicrashes@kolmisoft.com\", address, message, \"#{ExceptionNotifier_email_prefix} SERIOUS EXCEPTION\", \"-o tls='auto'\")\n system(command)\n flash[:notice] = \"INTERNAL ERROR.\"\n #redirect_to Web_Dir + \"/callc/main\" and return false\n end\n end",
"def visit_exception\n exception = object.value\n\n puts(\n EXCEPTION_ERROR_MESSAGE % [\n exception.inspect,\n exception.backtrace.join(\"\\n\")\n ]\n )\n end",
"def internal_server_error(exception = nil)\n error_rendering exception, __callee__\n end",
"def exception_renderer=(_arg0); end",
"def render_error(exception)\n Bugsnag.notify(exception)\n render template: 'errors/internal_server_error', status: :not_found\n end",
"def display_exception(e, display_name=nil)\n STDERR.puts \"CAUGHT EXCEPTION in: #{display_name}\"\n STDERR.puts e.inspect\n if e.respond_to?(:response)\n STDERR.puts e.response\n if e.response.respond_to?(:body)\n STDERR.puts \"RESPONSE BODY: #{e.response.body}\"\n end\n end\n end",
"def long_display\n backtrace = filter_backtrace(@exception.backtrace).join(\"\\n \")\n [\n \"Error\".red.bold, \n \":\\n\", \n \"#@test_name:\".white, \n \"\\n\", \"#{message}\".red, \n \"\\n #{backtrace}\".gsub(/:(\\d+):/,\":#{'\\1'.red}:\")\n ].join('')\n end",
"def show_error_encountered(error)\n print \"\\033[31mError encountered:\\033[0m\\n\"\n print error.inspect\n end",
"def alert_on_error(exception, action, msg)\n case action\n when :warn\n Chef::Log.warn <<-MSG\nWARNING: #{exception}\n#{msg}\n MSG\n when :fatal\n fail exception, msg\n end\n end",
"def render_exception(e)\n @message = e.message\n @backtrace = e.backtrace\n\n response_erb = ERB.new(File.read(\"../lib/templates/rescue.html.erb\"))\n response_text = response_erb.result(binding)\n response = ['500', {'Content-type' => 'text/html'}, [response_text]]\n end",
"def show\n @exception = ExceptionHandler::Exception.new request #-> Service Object\n render status: @exception.status #-> Show apppropriate response\n end",
"def error\n\t\t@page_title = '500 Error'\n\t\t@url_path = get_path\n\t\tflash.now[:error] = \"An error occurred while attempting to access ‘#{@path}’.\"\n\t\trender :action=>'error', :status=>'500 Error'\n\tend",
"def render_error(exception = nil)\n\trespond_to do |format|\n\t\tformat.html{\n\t\t\trender :file => \"/app/views/errors/500.html.erb\", :status => 500, :layout => \"application\"\n\t\t}\n\t\tformat.xml { head :not_found }\n\t\tformat.any { head :not_found }\t\n\tend\n end",
"def resource_failed(resource, action, exception)\n _, start_time = @resource_stack.pop\n elapsed = Time.now - start_time\n @resource_action_times[[resource.to_s, action.to_s]] << elapsed\n puts_line \"#{resource} action #{action} (#{elapsed}s) FAILED: #{exception}\", :red\n unindent\n end",
"def render_error_page\n # Create Warden proxy for devise integration\n proxy = Warden::Proxy.new({}, Warden::Manager.new({}))\n renderer = ApplicationController.renderer.new('warden' => proxy)\n renderer.render('errors/error')\n end",
"def default_exception_renderer=(_arg0); end",
"def error_handler\n begin\n yield\n rescue => exception\n options = Rails.env.development? ? {:backtrace => exception.backtrace, :class => exception.class.to_s} : {}\n render_error(exception.message, options)\n end\n end",
"def amf_exception_handler(ex)\n RAILS_DEFAULT_LOGGER.error ex.message\n RAILS_DEFAULT_LOGGER.error ex.backtrace.join( \"\\n\" )\n render :amf => FaultObject.new(ex.to_s) if is_amf\n end",
"def display_error_message(ex)\n $stderr.puts self.to_s()\n super(ex) \n end",
"def action_error\n puts\n puts \"Sorry, I don't recognize that command.\"\n puts\nend",
"def error_render_method(exception)\n path = request.path\n UserMailer.generic_email(\"arability.smartsoft@gmail.com\",\n exception, exception.backtrace.join(\"\\n\")).deliver\n if path.include? \"developers/\"\n if !path.include? \"developers/projects\"\n redirect_to projects_path, flash: { error: t(:exception) }\n return\n end\n end\n redirect_to root_path, flash: { error: t(:exception) }\n end",
"def alert(msg, action)\n\tSTDERR.puts \"ERROR:\\t#{msg}\"\n\tSTDERR.puts \"\\t#{action}\"\nend",
"def internal_server_error\n @exception = env['action_dispatch.exception']\n #TODO: log exception information you want to log here\n # after removing it from the normal logging via lograge\n render status: 500\n end",
"def server_error\n messages = [\"Captain!\", \"Man overboard!\", \"Ekk!\"]\n MsteamsNotifier::Message.quick_message \"#{messages.sample} We've had a 500 error at #{request.referrer}\"\n render status: 500, layout: \"dash/error\"\n end",
"def render_error exception\n\n logger.info\"==========error 500=========\"\n #Rails.logger.error(exception)\n #render :template => \"/errors/500.html.erb\", :status => 500\n logger.info \"#{'-'*100} #{request.format} #{'-'*100}\"\n @error = exception\n ActiveSupport::Notifications.instrument \"exception.action_controller\", message: @error.message, inspect: @error.inspect, backtrace: @error.backtrace\n respond_to do |format|\n format.html { render template: \"errors/error_500\", status: 500, layout:false }\n format.all { render nothing: true, status: 500}\n\n end\n log_exception_handler(exception)\n end",
"def rescue_action_locally(exception)\n @template.instance_variable_set(\"@exception\", exception)\n @template.instance_variable_set(\"@rescues_path\", RESCUES_TEMPLATE_PATH)\n @template.instance_variable_set(\"@contents\",\n @template.render(:file => template_path_for_local_rescue(exception)))\n\n response.content_type = Mime::HTML\n render_for_file(rescues_path(\"layout\"),\n response_code_for_rescue(exception))\n end",
"def details(options = {})\n\t\toptions = {colorize: true}.merge(options)\n\t\tinspect_results = inspect_variables(options)\n\t\tparts = []\n\t\tparts << (options[:colorize] ? red('Exception:') : 'Exception:')\n\t\tparts << \"\\t\" + \"#{self.class.name}: #{message}\"\n\t\tparts << (options[:colorize] ? red('Variables:') : 'Variables:')\n\t\tparts << inspect_results\n\t\tparts << (options[:colorize] ? red('Backtrace:') : 'Backtrace:')\n\t\tparts << \"\\t\" + backtrace.to_a.join(\"\\n\")\n\t\tparts.join(\"\\n\")\n\tend",
"def error(event, msg, code=500, trace = [])\n title = case code\n when 400\n \"Bad Request (400)\"\n when 401\n \"Unauthorized Request\"\n when 403\n \"Access Restricted\"\n when 404\n \"Page Not Found\"\n when 405\n \"HTTP Method Not Allowed\"\n else\n \"An Error Has Occured\"\n end\n @content = render('error', {title: title, message: msg, error_code: code, trace: trace})\n warnlog 'Error handler called with \"' << msg << '\", code ' << code.to_s << ' (trace: ' << trace.to_s << ')'\n end",
"def rescue_action_in_public(exception) #:doc:\n render_text \"<html><body><h1>Application error (Rails)</h1></body></html>\"\n end",
"def rescue_action_in_public(exception) #:doc:\n render_text \"<html><body><h1>Application error (Rails)</h1></body></html>\"\n end",
"def error_help_block(text)\n render partial: 'shared/help_block', locals: {is_error: true, text: text.humanize}\n end",
"def display_error_message(ex)\n $stderr.puts \"#{@name} aborted!\"\n $stderr.puts ex.message\n $stderr.puts ex.backtrace.join(\"\\n\")\n end",
"def show\n template = if template_exists?(status_code, 'exceptions')\n \"exceptions/#{status_code}\"\n else\n 'exceptions/500'\n end\n\n respond_to do |format|\n format.html { render template: template, status: status_code }\n format.json do\n render json: { message: exception.message }, status: status_code\n end\n end\n end",
"def render_create_error\n render_error @resource\n end",
"def render_500(exception = nil)\n JsonApiServer.logger.error(exception.try(:message))\n JsonApiServer.logger.error(exception.try(:backtrace))\n\n errors = JsonApiServer.errors(\n status: 500,\n title: I18n.t('json_api_server.render_500.title'),\n detail: I18n.t('json_api_server.render_500.detail')\n )\n render json: errors.to_json, status: 500\n end",
"def display_error_message(ex)\n $stderr.puts \"#{name} aborted!\"\n $stderr.puts ex.message\n if options.trace\n $stderr.puts ex.backtrace.join(\"\\n\")\n else\n $stderr.puts tdp_file_location(ex.backtrace)\n end\n $stderr.puts \"(See full trace by running task with --trace)\" unless options.trace\n end",
"def for_display(context = {})\n my_context = context.merge(\n server: @server_deployment.server,\n server_deployment: @server_deployment,\n task: @server_deployment.task)\n @failures.map do |failure|\n log_snippets = failure.error_for_display(my_context)\n [failure.name, failure.description(my_context), '', 'LOG:', log_snippets].join(\"\\n\")\n end\n end",
"def process_action(*args)\n super\n rescue Exception => exception\n raise if RocketPants.pass_through_errors?\n # Otherwise, use the default built in handler.\n logger.error \"Exception occured: #{exception.class.name} - #{exception.message}\"\n logger.error \"Exception backtrace:\"\n exception.backtrace[0, 10].each do |backtrace_line|\n logger.error \"=> #{backtrace_line}\"\n end\n exception_notifier_callback.call(self, exception, request)\n render_error exception\n end",
"def cashboard_rescue_exception\n logger.error '^^^ CASHBOARD SPECIFIC INFO FOR ABOVE ERROR'\n logger.error '--------------------------------------------------------------------------------'\n begin\n logger.error \"URL : #{request.env['PATH_INFO']}\"\n logger.error \"BROWSER: #{request.env['HTTP_USER_AGENT']}\"\n logger.error \"IP ADDR: #{request.env['REMOTE_ADDR']}\"\n # Try to find account if it's not set\n @account ||= Account.find_by_subdomain(account_subdomain)\n if @account\n logger.error \"ACCOUNT: #{@account.subdomain}\"\n end\n if @user\n logger.error \"USER : #{@user.inspect}\\n\"\n end\n rescue\n logger.error '...An error happend logging specific errors...wtf?'\n end\n logger.error '--------------------------------------------------------------------------------'\n logger.error ''\n end",
"def rescue_action_locally(request, exception)\n template = ActionView::Base.new([RESCUES_TEMPLATE_PATH],\n :request => request,\n :exception => exception,\n :application_trace => application_trace(exception),\n :framework_trace => framework_trace(exception),\n :full_trace => full_trace(exception)\n )\n file = \"rescues/#{@@rescue_templates[exception.class.name]}.erb\"\n body = template.render(:file => file, :layout => 'rescues/layout.erb')\n render(status_code(exception), body)\n end",
"def display\n\t\t\twarning exception.message\n\t\t\tpath = @macro.path.blank? ? \"\" : \"\\n path: #{@macro.path}\"\n\t\t\tmsg \" source: #{@macro.source_name}#{path}\"\n\t\t\tmsg \"#{\"-\"*54}\\n#{@macro.node.to_s.gsub(/\\t/, ' ')}\\n#{\"-\"*54}\" if Glyph.debug?\n\t\tend",
"def error_internal\n respond_to do |format|\n format.html{render :layout => \"error\"}\n end\n end",
"def error_rendering(exception, symbol)\n Rails.logger.error exception\n\n @exception = exception\n @symbol = symbol\n @code = Rack::Utils::SYMBOL_TO_STATUS_CODE[symbol].to_i\n respond_with @exception, status: @code, template: ERROR_PATH, prefixes: _prefixes\n end",
"def render_exception_with_project_106(env, exception)\n key = 'action_dispatch.show_detailed_exceptions'\n\n # don't report production exceptions here as it is done below\n # in call_with_project_106() when show_detailed_exception is false\n if not env.has_key?(key) or env[key]\n # sending exception to project-106 to collect exception data\n report_exception_to_project_106(env, exception)\n end\n render_exception_without_project_106(env, exception)\n end",
"def present_non_assertion_error_summary\n return if non_assertion_errors.empty?\n Terminal.format_title(@io, 2, \"Errors other than assertion failures\")\n non_assertion_errors.each do |error|\n error.non_assertion_error_details(@io)\n end\n end",
"def exception_details(e, msg); end",
"def render_update_error\n render_error @resource\n end",
"def express_error_context resource\n I18n.t \"errors.action.#{params[:controller]}.#{params[:action]}.#{resource.class.model_name.i18n_key}\",\n default: \"Couldn't #{params[:action]} the #{resource.class.to_s.downcase}\"\n end",
"def render_500(exception=nil)\n if exception\n logger.error \"Rendering 500 with exception: #{exception.message}\"\n logger.error exception.backtrace.join(\"\\n\")\n ExceptionNotifier.notify_exception(exception, env: request.env)\n end\n breadcrumbs.clear\n @error = [500, 'Internal Server Error']\n render status: 500, template: 'errors/default.html'\n end",
"def display_error_message(ex)\n $stderr.puts \"#{name} aborted!\"\n $stderr.puts ex.message\n if options.trace\n $stderr.puts ex.backtrace.join(\"\\n\")\n else\n $stderr.puts ex.backtrace.find {|str| str =~ /#{@rakefile}/ } || \"\"\n $stderr.puts \"(See full trace by running task with --trace)\"\n end\n end",
"def display_exceptions?\n !!@exception_display_handler\n end",
"def rescue_action(exception)\n case exception.class.name\n when 'ActiveRecord::RecordInvalid'\n render_invalid_record(exception.record)\n when 'ActionController::RoutingError',\n 'ActionController::UnknownAction',\n 'ActiveRecord::RecordNotFound'\n render_404\n else\n if exception.message =~ /undefined local variable or method `simple[_a-z]*_page_path'/\n render :text => \"You must install this plugin's routes! Add the line 'map.from_plugin :simple_pages' to your config/routes.rb\", :layout => true and return\n end\n super\n end\n end",
"def err_mex \n flash.now[:notice] = \"Non sei il possessore di questo feed e non detieni i privilegi per alterarlo!\" \t\t\t\n render \"show\"\n end",
"def display_errors\n return super unless format == :json\n\n errors, status = resource_errors\n\n controller.render problem: errors, status: status\n end",
"def index\n @trace_exceptions = TraceException.all\n end",
"def render_500\n render 'errors/index_500'\n end",
"def render_error\n nil\n end",
"def render_error\n nil\n end",
"def exceptions_app; end",
"def exceptions_app; end",
"def display_abort(exception)\r\n puts;\r\n puts exception\r\n\r\n if debug\r\n puts\r\n puts \"Data Stack Contents:\"\r\n pp data_stack\r\n puts\r\n puts \"Control Stack Contents:\"\r\n pp ctrl_stack\r\n puts\r\n puts \"Mode = #{mode.inspect}, Level = #{level}\"\r\n end\r\n\r\n interpreter_reset\r\n compiler_reset\r\n end",
"def exceptions\n end",
"def handle_public_exception(exception)\n render :template => 'testing/error_page.html'\n end",
"def handle_generic_error ex\n log_exception(ex)\n errors _(\"An unexpected error has occurred, details have been logged.\")\n redirect_back\n end",
"def index\n set_excuses\n end",
"def show_error\n yield(@source, @index_1, @length_1, @index_2, @length_2)\n end",
"def showStackError(stack)\n region = stack['region']\n stack_name = getStackName(stack)\n begin\n resources = MU::Cloud::AWS.cloudformation(region: region).describe_stack_resources(:stack_name => stack_name)\n\n MU.log \"CloudFormation stack #{stack_name} failed\", MU::ERR\n\n resources[:stack_resources].each { |resource|\n MU.log \"#{resource.resource_type} #{resource.resource_status} #{resource.resource_status_reason }\", MU::ERR\n }\n rescue Aws::CloudFormation::Errors::ValidationError => e\n MU.log e.inspect, MU::ERR, details: e.backtrace\n end\n end",
"def failed_action(action, uuid, reason)\n log_action(\"FAILED #{action}\", uuid, reason, Syslog::LOG_WARNING)\n end",
"def report_errors\n yield\n rescue Exception => e\n puts \"Exception occured while running sketch #{File.basename SKETCH_PATH}:\"\n puts e.to_s\n puts e.backtrace.join(\"\\n\")\n end",
"def show_action_error(string)\n ErrorSound.play\n text = \"Sequence key : #{phase_sequence[battle_phase].call}\\n\" + \n \"Uninitalized Constant for #{string} in :action command\"\n msgbox text\n exit\n end",
"def handle_500(exception = env[\"action_dispatch.exception\"])\n # Some one requested '/500' directly?\n if exception.blank?\n if (error_500_url_alias = Settler[:error_page_500]).present? && @node = Node.find_by_url_alias(error_500_url_alias)\n @page = @node.content\n render :template => 'pages/show', :status => :internal_server_error\n else\n render :template => 'errors/500', :status => :internal_server_error\n end\n return\n end\n\n if Rails.env.test?\n puts \"\\n#{exception.message}\"\n puts exception.backtrace.join(\"\\n\")\n end\n\n send_exception_notification(exception)\n error = { :error => \"#{exception} (#{exception.class})\", :backtrace => exception.backtrace.join('\\n') }\n @page_title = t('errors.internal_server_error')\n\n respond_to do |f|\n f.html do\n if request.xhr?\n render :json => error.to_json, :status => :internal_server_error\n else\n set_view_paths\n if (error_500_url_alias = Settler[:error_page_500]).present? && @node = Node.find_by_url_alias(error_500_url_alias)\n @page = @node.content\n render :template => 'pages/show', :status => :internal_server_error\n else\n render :template => 'errors/500', :status => :internal_server_error\n end\n end\n end\n f.xml { render :xml => error.to_xml, :status => :internal_server_error }\n f.any(:json, :js) { render :json => error.to_json, :status => :internal_server_error }\n f.any(:rss, :atom) { render :xml => error.to_xml, :status => :internal_server_error, :layout => false }\n f.all { render :nothing => true, :status => :internal_server_error }\n end\n end",
"def rescue_action_in_public(exception)\n case exception\n when CustomNotFoundError, ::ActionController::UnknownAction then\n #render_with_layout \"shared/error404\", 404, \"standard\"\n render :template => \"errors/404\", :status => 404\n else\n #@reference = Xircles::Logger.log( exception, binding )\n render :template => 'errors/generic', :status => 500\n end\n end",
"def identify_error\n begin\n yield\n rescue => ex\n ex.message.insert(0, \"#{@id} error: \")\n raise\n end\n end",
"def error_500\n render 'error/error500'\n end",
"def index\n @exception_names = LoggedException.class_names\n @controller_actions = LoggedException.controller_actions\n query\n end",
"def error exception, req, res\n backtrace = exception.backtrace.join \"\\n\"\n\n res.content_type = 'text/html'\n res.status = 500\n res.body = <<-BODY\n<!DOCTYPE html>\n<html>\n<head>\n<meta content=\"text/html; charset=UTF-8\" http-equiv=\"Content-Type\">\n\n<title>Error - #{ERB::Util.html_escape exception.class}</title>\n\n<link type=\"text/css\" media=\"screen\" href=\"#{@mount_path}/css/rdoc.css\" rel=\"stylesheet\">\n</head>\n<body>\n<h1>Error</h1>\n\n<p>While processing <code>#{ERB::Util.html_escape req.request_uri}</code> the\nRDoc (#{ERB::Util.html_escape RDoc::VERSION}) server has encountered a\n<code>#{ERB::Util.html_escape exception.class}</code>\nexception:\n\n<pre>#{ERB::Util.html_escape exception.message}</pre>\n\n<p>Please report this to the\n<a href=\"https://github.com/ruby/rdoc/issues\">RDoc issues tracker</a>. Please\ninclude the RDoc version, the URI above and exception class, message and\nbacktrace. If you're viewing a gem's documentation, include the gem name and\nversion. If you're viewing Ruby's documentation, include the version of ruby.\n\n<p>Backtrace:\n\n<pre>#{ERB::Util.html_escape backtrace}</pre>\n\n</body>\n</html>\n BODY\n end",
"def obvious_error(message, e)\n \"#{stars}\\n#{message}\\n#{stars}\\n#{e.message}#{stars}\"\n end",
"def fail_unexpected_exception(ex)\n add_diagnostic(\"Test raised unexpected #{ex.class} exception, please notify instructors\")\n add_diagnostic(\"Exception message: #{ex.message}\")\n\n # Set the test to visible in this case, otherwise the student\n # won't see the diagnostic\n @test.visibility(true)\n end",
"def show_exit_error\n @end_time = Time.now\n puts TTY::Box.error(\n \"Flow : #{self.class.name}\\n\" \\\n \"Start : #{@start_time}\\n\" \\\n \"End : #{@end_time}\\n\" \\\n \"Time : #{@end_time - @start_time} sec\",\n width: TTY::Screen.width, padding: 1\n )\n end",
"def show_error (error_message, return_to_address)\n flash[:notice]= error_message\n render(return_to_address)\n end",
"def show_error (error_message, return_to_address)\n flash[:notice]= error_message\n render(return_to_address)\n end",
"def show_error (error_message, return_to_address)\n flash[:notice]= error_message\n render(return_to_address)\n end",
"def render_exception(ex)\n error_code = ex.respond_to?(:code) ? ex.code : 1\n message = ex.message\n internal_error = true\n field = ex.respond_to?(:field) ? ex.field : nil\n\n case ex\n when OpenShift::ValidationException\n return render_error(:unprocessable_entity, nil, nil, nil, nil, get_error_messages(ex.resource))\n\n when Mongoid::Errors::Validations\n field_map =\n case ex.document\n when Domain then requested_api_version <= 1.5 ? {\"namespace\" => \"id\"} : {\"namespace\" => \"name\"}\n end\n messages = get_error_messages(ex.document, field_map || {})\n return render_error(:unprocessable_entity, nil, nil, nil, nil, messages)\n\n when Mongoid::Errors::InvalidFind\n status = :not_found\n message = \"No resource was requested.\"\n internal_error = false\n\n when Mongoid::Errors::DocumentNotFound\n status = :not_found\n model = ex.klass\n\n target =\n if ComponentInstance >= model then target = 'Cartridge'\n elsif CartridgeInstance >= model then target = 'Cartridge'\n elsif CartridgeType >= model then target = 'Cartridge'\n elsif GroupInstance >= model then target = 'Gear group'\n else model.to_s.underscore.humanize\n end\n\n message =\n if ex.unmatched.length > 1\n \"The #{target.pluralize.downcase} with ids #{ex.unmatched.map{ |id| \"'#{id}'\"}.join(', ')} were not found.\"\n elsif ex.unmatched.length == 1\n \"#{target} '#{ex.unmatched.first}' not found.\"\n else\n if name = (\n (Domain >= model and ex.params[:canonical_namespace].presence) or\n (Application >= model and ex.params[:canonical_name].presence) or\n (ComponentInstance >= model and ex.params[:cartridge_name].presence) or\n (CartridgeInstance >= model and ex.params[:name].presence) or\n (CartridgeType >= model and ex.params[:name].presence) or\n (Alias >= model and ex.params[:fqdn].presence) or\n (CloudUser >= model and ex.params[:login].presence) or\n (CloudUser >= model and ex.params[:_id].presence) or\n (SshKey >= model and ex.params[:name].presence)\n )\n \"#{target} '#{name}' not found.\"\n else\n \"The requested #{target.downcase} was not found.\"\n end\n end\n error_code =\n if Cartridge >= model then 129\n elsif ComponentInstance >= model then 129\n elsif SshKey >= model then 118\n elsif GroupInstance >= model then 101\n elsif Authorization >= model then 129\n elsif Domain >= model then 127\n elsif Alias >= model then 173\n elsif Application >= model then 101\n else error_code\n end\n internal_error = false\n\n when OpenShift::UserException\n status = ex.response_code || :unprocessable_entity\n error_code, node_message, messages = extract_node_messages(ex, error_code, message, field)\n message = node_message || \"Unable to complete the requested operation. \\nReference ID: #{request.uuid}\"\n messages.push(Message.new(:error, message, error_code, field))\n return render_error(status, message, error_code, field, nil, messages, false)\n\n when OpenShift::AccessDeniedException\n status = :forbidden\n internal_error = false\n\n when OpenShift::AuthServiceException\n status = :internal_server_error\n message = \"Unable to authenticate the user. Please try again and contact support if the issue persists. \\nReference ID: #{request.uuid}\"\n\n when OpenShift::DNSException, OpenShift::DNSLoginException\n status = :internal_server_error\n\n when OpenShift::LockUnavailableException\n status = :internal_server_error\n message ||= \"Another operation is already in progress. Please try again in a minute.\"\n internal_error = false\n\n when OpenShift::NodeUnavailableException\n Rails.logger.error \"Got Node Unavailable Exception\"\n status = :internal_server_error\n message = \"\"\n if ex.resultIO\n error_code = ex.resultIO.exitcode\n message = ex.resultIO.errorIO.string.strip + \"\\n\" unless ex.resultIO.errorIO.string.empty?\n Rail.logger.error \"message: #{message}\"\n end\n message ||= \"\"\n message += \"Unable to complete the requested operation due to: #{ex.message}. Please try again and contact support if the issue persists. \\nReference ID: #{request.uuid}\"\n\n when OpenShift::ApplicationOperationFailed\n status = :internal_server_error\n error_code, node_message, messages = extract_node_messages(ex, error_code, message, field)\n messages.push(Message.new(:error, node_message, error_code, field)) unless node_message.blank?\n message = \"#{message}\\nReference ID: #{request.uuid}\"\n return render_error(status, message, error_code, field, nil, messages, internal_error)\n\n when OpenShift::NodeException, OpenShift::OOException\n status = :internal_server_error\n error_code, message, messages = extract_node_messages(ex, error_code, message, field)\n message ||= \"unknown error\"\n message = \"Unable to complete the requested operation due to: #{message}\\nReference ID: #{request.uuid}\"\n\n # just trying to make sure that the error message is the last one to be added\n messages.push(Message.new(:error, message, error_code, field))\n\n return render_error(status, message, error_code, field, nil, messages, internal_error)\n else\n status = :internal_server_error\n message = \"Unable to complete the requested operation due to: #{message}\\nReference ID: #{request.uuid}\"\n end\n\n Rails.logger.error \"Reference ID: #{request.uuid} - #{ex.message}\\n #{ex.backtrace.join(\"\\n \")}\" if internal_error\n\n render_error(status, message, error_code, field, nil, nil, internal_error)\n end"
] |
[
"0.7090987",
"0.6866481",
"0.6565763",
"0.6374556",
"0.6367066",
"0.6263703",
"0.62625855",
"0.62474465",
"0.6246485",
"0.6245408",
"0.62429893",
"0.61952895",
"0.60968935",
"0.60960615",
"0.60771024",
"0.60467863",
"0.5985887",
"0.5984449",
"0.5941006",
"0.5936079",
"0.5919427",
"0.5900982",
"0.5857554",
"0.5853859",
"0.585315",
"0.5840225",
"0.5838647",
"0.5826905",
"0.58144134",
"0.5793616",
"0.57823086",
"0.5775996",
"0.5774065",
"0.57543284",
"0.57368964",
"0.5720809",
"0.5718781",
"0.57184875",
"0.57109386",
"0.5707998",
"0.5707803",
"0.57037526",
"0.56922734",
"0.56855935",
"0.56834143",
"0.56834143",
"0.5682341",
"0.5674809",
"0.5672039",
"0.5654857",
"0.5654136",
"0.5651757",
"0.56514263",
"0.5647873",
"0.5636763",
"0.56130296",
"0.5608702",
"0.5596953",
"0.55905086",
"0.5586331",
"0.5576264",
"0.55581987",
"0.5552094",
"0.5543888",
"0.5543171",
"0.553504",
"0.55316794",
"0.5519244",
"0.55179214",
"0.5516961",
"0.5506681",
"0.5505756",
"0.55054224",
"0.55054224",
"0.54942435",
"0.54942435",
"0.54913104",
"0.5488275",
"0.54846734",
"0.5481563",
"0.54743046",
"0.5471564",
"0.54428476",
"0.5438688",
"0.54343766",
"0.543351",
"0.543292",
"0.54326993",
"0.5427284",
"0.5425906",
"0.5413164",
"0.54056764",
"0.5404692",
"0.53951114",
"0.53945243",
"0.53944796",
"0.53944796",
"0.53944796",
"0.5383196"
] |
0.6063134
|
15
|
strong parameters /safe guard from mass assignment
|
def address_params
params[:address].permit(:user_id, :street, :city, :pin, :title)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def safe_attributes=(attrs, user=User.current)\n return unless attrs.is_a?(Hash)\n\n attrs = attrs.dup\n attrs = delete_unsafe_attributes(attrs, user)\n \n return if attrs.empty?\n\n # mass-assignment security bypass\n assign_attributes attrs, :without_protection => true\n end",
"def sanitized_allowed_attributes=(attributes); end",
"def sanitized_allowed_attributes=(attributes); end",
"def valid_params?; end",
"def scrub(param, model_or_array = [])\n allowed_attrs = model_or_array.is_a?(Array) ? model_or_array : model_or_array.accessible_attributes.to_a\n posted_attrs = param.stringify_keys.keys\n attrs_to_update = allowed_attrs & posted_attrs\n param.delete_if{|k,v|!attrs_to_update.include?(k)}\n end",
"def validate_params!\n self.params ||= Hash.new\n self.class.instance_variable_get(:@__required_params).each do |e|\n raise ArgumentError, \"Insufficient parameters set (#{e} not supplied)\" if self.params[e].nil?\n end\n end",
"def allowed_attributes=(_arg0); end",
"def allowed_attributes=(_arg0); end",
"def mass_assign_protected_attributes\n @admin.systems_enabled = params[:admin][:systems_enabled] || []\n @admin.active = params[:admin][:active]\n @admin.permissions_attributes = params[:admin][:permissions_attributes] || {}\n @admin.can_act_as_customer = params[:admin][:can_act_as_customer]\n @admin.can_change_prices = params[:admin][:can_change_prices]\n @admin.limited_sales_rep = params[:admin][:limited_sales_rep]\n @admin.updated_by = current_admin.email\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n 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 permitir_parametros\n \t\tparams.permit!\n \tend",
"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 mass_assign(new_attrs = {})\n case self.class.assignment_mode\n when :whitelist\n whitelist_assign(new_attrs)\n when :carefree\n carefree_assign(new_attrs)\n end\n end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def safe_product_params\n\t\tparams.require(:product).permit(:name,:price)\n\t\t#don't permit ids\n\t\t#single :product\n\tend",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def sanitize_params\n if valid_lease?\n sanitize_lease_params\n elsif valid_embargo?\n sanitize_embargo_params\n elsif !wants_lease? && !wants_embargo?\n sanitize_unrestricted_params\n else\n @attributes\n end\n end",
"def sanitize_for_mass_assignment(attrs)\n return attrs\n 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 safe_params\n safe_attributes = %i[name key]\n params.require(:role).permit(safe_attributes)\n end",
"def check_params(params)\n\n\t\tself.assign_attributes(params)\n\t\tself.check\n\t\treturn false unless @valid\n\t\treturn self\n\tend",
"def model_attributes(params)\n clean_params = super #hydra-editor/app/forms/hydra_editor/form.rb:54\n # model expects these as multi-value; cast them back\n clean_params[:rights] = Array(params[:rights]) if params[:rights]\n clean_params[:title] = Array(params[:title]) if params[:title]\n if params[:description]\n clean_params[:description] = Array(params[:description])\n clean_params[:description].map! do |description|\n ::DescriptionSanitizer.new.sanitize(description)\n end\n end\n # Model expects provenance as single-value.\n if params[:provenance]\n clean_params[:provenance] = ::DescriptionSanitizer.\n new.sanitize(params[:provenance])\n end\n\n # Oops; we're blanking out these values when changing permissions and probably versions, too\n # -- they don't have these fields in the form at all so they don't get repopulated.\n clean_params = encode_physical_container(params, clean_params)\n clean_params = encode_external_id(params, clean_params)\n\n clean_params.keys.each do |key|\n # strip ALL the things!\n if clean_params[key].is_a?(Array)\n clean_params[key].map!(&:strip)\n elsif clean_params[key].is_a?(String)\n clean_params[key] = clean_params[key].strip\n end\n end\n\n clean_params\n end",
"def clean_params_for_save!\n if params[resource_param_name].present?\n params[resource_param_name].delete(:id)\n params[resource_param_name].delete(:user_id)\n end\n end",
"def permitted=(_arg0); end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permit(*permitted)\n hardened_params = params.dup\n\n hardened_params.keep_if { |k, _v| permitted.flatten.include?(k.to_sym) }\n\n hardened_params.symbolize_keys\n end",
"def student_params(*args) #is the helper method \n\n\t\tparams.require(:student).permit(*args)\n\t\t#uses .require and .permit methods as stronger params to prevent hacks through inspect element right click edit html \n\t\t#require restricts, permit allows, and *args is for the custom arguments\n\tend",
"def student_params\n params.require(:student).permit!\n end",
"def mass_assign(new_attrs = {})\n case self.class.assignment_mode\n when :whitelist\n whitelist_assign(new_attrs)\n when :carefree\n carefree_assign(new_attrs)\n end\n end",
"def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end",
"def strengthen_params!(method_name)\n permitting_model_name = self.class.instance_variable_defined?(:@permitting_model_name) && self.class.instance_variable_get(:@permitting_model_name)\n target_model_name = (permitting_model_name || self.class.name.sub(/.+::/, '').sub(/Controller$/, '')).singularize.underscore.tr('/', '_').to_sym\n permitted_attributes = self.class.instance_variable_defined?(:@permitted_attributes) && self.class.instance_variable_get(:@permitted_attributes)\n\n method_parameters = method(method_name).parameters\n method_parameters.each do |type, key|\n trimmed_key = key.to_s.sub(/_params\\z/, '').to_sym\n if (trimmed_key == target_model_name) && permitted_attributes\n params.require(trimmed_key) if %i[req keyreq].include?(type)\n params[trimmed_key] = params[trimmed_key].try :permit, *permitted_attributes if params.key? trimmed_key\n end\n end\n end",
"def obj_params\n params.require(:data).require(:attributes)\n end",
"def valid_attributes\n {\n :title => 'Test Title',\n :user_id => 1\n }\n end",
"def validate_create_params!(params); end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def manage_assign_attributes_with_params _params\n\t\t\tassign_attributes _params.permit([:status, :note])\n\t\tend",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def initialize( params )\n super( Parametrization.permit( params, whitelist, model_name ) )\n @params = @params.with_indifferent_access # After building the internal params hash, make it a little friendlier.\n end",
"def apply(params, to:)\n assign_attributes(params.require(model_name.param_key).permit(*attributes.keys))\n return false unless valid?\n # TODO: If this returns false, we need to provide errors\n # Can we just overwrite errors to delegate to the object\n # if there are no errors?\n update(to, to_model_attributes)\n end",
"def expected_permitted_parameter_names; end",
"def assign_attributes_with_params _params\n\t\t\tassign_attributes _params.permit([:request_type, :object_type, :object_id, :message])\n\t\tend",
"def permitted?; end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def set_prefecture\n params.require(:id, :name)\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def valid_attributes\n {}\n end",
"def sanitize_for_mass_assignment(attributes)\n return attributes\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def less_active_member_params\n clean_params = params.require(:less_active_member).permit(:surname, :given_name, :current_address, :new_address, :new_phone, :reference, :new_note, :resources, tag_list: [])\n clean_params.merge!({current_user_id: current_user.id}) unless current_user.nil?\n end",
"def check_params; true; end",
"def attr_params\n params[:attr].permit(:name, :type, :value, :foreign_key, :ordinal, :group, :visible, :editable, :required, :input)\n end",
"def permitted_update_params\n fail NotImplementedError\n end",
"def mass_assignment_authorizer\n super + Field.valid_options\n end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def section_params\n#it is same as using \"params[:subject]\" except that it:\n#-- raise an error if :subject is not present\n#-- allows listed attributes to be mass-assigned\n params.require(:section).permit(:name, :posistion, :visible)\n end",
"def some_thing_params\n params.require(:some_thing).permit(:val)\n end",
"def person_params\n params.require(:person).permit!\n end",
"def resource_params\n deserialized_params.permit!\n end",
"def valid_attributes\n { }\n end",
"def valid_attributes\n { }\n end",
"def unpermitted_parameters\n fail 'Define me!'\n end",
"def contact_params\n params.require(:contact).permit(Contact.safe_attributes)\n end",
"def validate_instance\n super\n # @wfd_show/edit_paramaeters must be arrays of symbols\n @wfd_show_parameters.each_with_index do |sp,i|\n unless sp.kind_of? Symbol then\n raise ArgumentError.new( \"permitted show parameter at [ #{ i } ] = #{ sp.to_s } is not a Symbol\" )\n end\n end\n @wfd_edit_parameters.each_with_index do |ep,i|\n unless ep.kind_of? Symbol then\n raise ArgumentError.new( \"permitted edit parameter at [ #{ i } ] = #{ ep.to_s } is not a Symbol\" )\n end\n end\n # @wfd_show/edit_parameters must not have duplicates\n dup_param1 = @wfd_show_parameters.detect {|e| @wfd_show_parameters.rindex(e) != @wfd_show_parameters.index(e) }\n unless dup_param1.nil? then\n raise ArgumentError.new( \"permitted show parameter #{ dup_param1 } occurs more than once.\")\n end\n dup_param1 = @wfd_edit_parameters.detect {|e| @wfd_edit_parameters.rindex(e) != @wfd_edit_parameters.index(e) }\n unless dup_param1.nil? then\n raise ArgumentError.new( \"permitted edit parameter #{ dup_param1 } occurs more than once.\")\n end\n # intersection of both arrays should be empty because at any time\n # a parameter can only be shown or editable...\n dup_params = @wfd_show_parameters & @wfd_edit_parameters\n unless dup_params.length == 0\n raise ArgumentError.new( \"parameters #{ dup_params.to_s } are defined to both show and edit\" )\n end\n end",
"def valid_attributes\n { name: 'do this' }\n end",
"def remove_attributes_protected_from_mass_assignment_with_exception_on_unsafe_attributes(attributes)\n safe_attributes = remove_attributes_protected_from_mass_assignment_without_exception_on_unsafe_attributes(attributes)\n if attributes != safe_attributes\n raise RuntimeError, \"Cannot mass assign the following attributes: #{(attributes.keys - safe_attributes.keys).to_sentence}\"\n end\n safe_attributes\n end",
"def product_params\n params.require(:product).permit! if params[:product]\n end",
"def prevent_mass_assignment_of(attribute)\r\n PreventMassAssignmentOf.new(attribute)\r\n end",
"def valid_attributes\n { }\n end",
"def object_params\n params.require(resource.name.underscore.to_sym)\n .permit(resource_params)\n end",
"def safe_attributes=(attrs, user=User.current)\n if attrs.respond_to?(:to_unsafe_hash)\n attrs = attrs.to_unsafe_hash\n end\n\n @attributes_set_by = user\n return unless attrs.is_a?(Hash)\n\n attrs = attrs.deep_dup\n\n if attrs['custom_field_values'].present?\n editable_custom_field_ids = editable_custom_field_values(user).map {|v| v.custom_field_id.to_s}\n attrs['custom_field_values'].select! {|k, v| editable_custom_field_ids.include?(k.to_s)}\n end\n\n if attrs['custom_fields'].present?\n editable_custom_field_ids = editable_custom_field_values(user).map {|v| v.custom_field_id.to_s}\n attrs['custom_fields'].select! {|c| editable_custom_field_ids.include?(c['id'].to_s)}\n end\n\n if ActiveRecord::VERSION::MAJOR <= 4\n # mass-assignment security bypass\n assign_attributes attrs, :without_protection => true\n else\n assign_attributes attrs\n end\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def valid_attributes\n { \"name\" => \"MyString\" }\n end",
"def model_params\n mn = @model.model_name.singular.to_sym\n # {user: {name: \"something\", other_column_name: \"somevalue\"}}\n return {} if params[mn].blank? # to allow create for empty items\n\n # params.require(:table_name).permit(:column_name1, :column_name2, etc., array_type: [], array_type2: [])\n params.require(mn).permit(permitted_columns)\n end",
"def permitted_params\n if is_singleton?\n singleton_permitted_params\n else\n params.require(:data).permit(allowed_resource_params.to_a)\n end\n end",
"def permitted_params\n \t@permitted_params ||= PermittedParams.new(params, current_user)\n end",
"def has_attributes?; end",
"def valid_params_request?; end",
"def product_params\n params.fetch(:product,{}).permit!\n end",
"def permitted_params\n @implementation_class ||= implementation_class\n\n res = @implementation_class.permitted_params\n @implementation_class.refine_permitted_params res\n end",
"def attr_params\n params.require(:attr).permit(:name)\n end",
"def mass_assign!(attributes)\n attributes.each { |key, value| send \"#{key}=\", value } if attributes\n end",
"def permit_attributes\n params.require(resource_as_param_key).permit(*permitted_attributes)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def sanitize_params(form_params)\n super.tap do |params|\n params['title'] = Array.wrap(params['title']) if params.key?('title')\n params['description'] = Array.wrap(params['description']) if params.key?('description')\n end\n end",
"def set_restricted(hash, type)\n return self if hash.empty?\n meths = setter_methods(type)\n strict = strict_param_setting\n hash.each do |k,v|\n m = \"#{k}=\"\n if meths.include?(m)\n set_column_value(m, v)\n elsif strict\n # Avoid using respond_to? or creating symbols from user input\n if public_methods.map(&:to_s).include?(m)\n if Array(model.primary_key).map(&:to_s).member?(k.to_s) && model.restrict_primary_key?\n raise MassAssignmentRestriction, \"#{k} is a restricted primary key\"\n else\n raise MassAssignmentRestriction, \"#{k} is a restricted column\"\n end\n else\n raise MassAssignmentRestriction, \"method #{m} doesn't exist\"\n end\n end\n end\n self\n end",
"def set_restricted(hash, type)\n return self if hash.empty?\n meths = setter_methods(type)\n strict = strict_param_setting\n hash.each do |k,v|\n m = \"#{k}=\"\n if meths.include?(m)\n set_column_value(m, v)\n elsif strict\n # Avoid using respond_to? or creating symbols from user input\n if public_methods.map(&:to_s).include?(m)\n if Array(model.primary_key).map(&:to_s).member?(k.to_s) && model.restrict_primary_key?\n raise MassAssignmentRestriction, \"#{k} is a restricted primary key\"\n else\n raise MassAssignmentRestriction, \"#{k} is a restricted column\"\n end\n else\n raise MassAssignmentRestriction, \"method #{m} doesn't exist\"\n end\n end\n end\n self\n end",
"def valid_attributes\n { \"username\" => \"MyString\" }\n end",
"def valid_attributes\n {\n title: \"My Title\",\n committee_id: committee.id\n }\n end",
"def update_attributes(params = {})\n super validate_attributes(params)\n end",
"def student_params\n # params.fetch(:student, {})\n params.require(:student).permit(:first_name, :last_name, :teacher_id, :active)\n end",
"def pointless_params\n params.require(:pointless).permit(:title, :content)\n end",
"def permitted_params(action, kind=nil)\n params.require(model_name).permit!\n end",
"def <%= singular_name %>_params\n params.require(:<%= singular_name %>).permit(<%= attributes_allowed %>)\n end"
] |
[
"0.6650437",
"0.6547737",
"0.6547737",
"0.6437754",
"0.6396407",
"0.63740087",
"0.635594",
"0.635594",
"0.63110334",
"0.6277052",
"0.6267508",
"0.62641597",
"0.6257784",
"0.6255771",
"0.6239609",
"0.6227382",
"0.622628",
"0.6160975",
"0.615994",
"0.6145809",
"0.61449534",
"0.61365217",
"0.6130598",
"0.6109843",
"0.6107073",
"0.6101612",
"0.6080332",
"0.60794675",
"0.6079197",
"0.6075867",
"0.6050554",
"0.604099",
"0.6019319",
"0.6014849",
"0.60083765",
"0.60028696",
"0.59950393",
"0.5986352",
"0.5982642",
"0.5963749",
"0.5957844",
"0.5952781",
"0.59456366",
"0.59412247",
"0.59384155",
"0.59370154",
"0.59336066",
"0.59336066",
"0.59336066",
"0.59336066",
"0.59336066",
"0.59336066",
"0.59336066",
"0.59336066",
"0.5924218",
"0.5908836",
"0.5903423",
"0.58958316",
"0.58919275",
"0.58834815",
"0.58730716",
"0.5869937",
"0.5854692",
"0.5850754",
"0.584867",
"0.5841709",
"0.5841459",
"0.5841459",
"0.58385056",
"0.58369666",
"0.58349454",
"0.5834455",
"0.5830888",
"0.5830229",
"0.582987",
"0.58201724",
"0.5814889",
"0.5807371",
"0.5804545",
"0.5804545",
"0.58025163",
"0.5801501",
"0.580025",
"0.5797735",
"0.5793885",
"0.5793162",
"0.57870495",
"0.57869303",
"0.57868505",
"0.57751274",
"0.5758974",
"0.57587564",
"0.57577336",
"0.57577336",
"0.57450527",
"0.573476",
"0.5733927",
"0.5732762",
"0.57326466",
"0.571503",
"0.5710091"
] |
0.0
|
-1
|
Public: Grabs the next frame and prepares it for detection. The process is as follows: Grab a frame from the capture source Calculate the delta mask by subtracting the background Run a threshold on the background to eliminate shadows Erode and dilate the delta image as a second step to remove shadows.
|
def with_cycle(cycle_number = nil)
@frame = nil
# Loop until we get a (perspective corrected) frame from the map.
while !@frame do
@camera.set(CAMERA_OPTIONS) if @live
@frame = @map.frame
end
# We only count processing times as soon as we get the map. Seen as
# this is a really fast operation (and most of the time is spent on
# background subtration).
cycle_start = Time.now
next_cycle!
Log4r::NDC.push("##{ @cycle }") if cycle_number
@delta = @bg_subtractor.subtract(@frame, LEARNING_RATE)
# Resize the frames
[@frame, @delta].map do |img|
img.resize!(Size.new(Map::A0_HEIGHT, Map::A0_WIDTH))
end
# Turn all pixels until 128.0 to 0.0.
@delta.threshold! 128.0, 255.0
# Contract shapes.
@delta.erode!(EROSION_AMOUNT)
# Save stuff
if @debug
@frame.write "#{ Theia.tmp_path }/#{ "%04i" % @cycle }-frame.png"
@delta.write "#{ Theia.tmp_path }/#{ "%04i" % @cycle }-delta.png"
end
yield @frame, @delta
cycle_finish = Time.now
msecs = (cycle_finish - cycle_start)
# After measuring how long it took to process the frame, add it to
# processing times, make sure we only account for the last 10
# measurements, average them out and divide them by 1 (sec). This
# gives us the FPS.
@processing_times << msecs
@processing_times.shift if @processing_times.length > 10
@fps = 1.0 / @processing_times.mean
ensure
Log4r::NDC.pop if cycle_number
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def take\n check\n `adb pull /dev/graphics/fb0 fb0`\n `dd bs=1920 count=800 if=fb0 of=fb0b`\n `ffmpeg -vframes 1 -vcodec rawvideo -f rawvideo -pix_fmt rgb565 -s 480x800 -i fb0 -f image2 -vcodec png #{@destination_folder}/#{@prefix}#{@no}.png`\n `rm fb0b`\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 timeout\n @background.copy_area(0, 0, @background.width, @background.height,\n @frame, 0, 0)\n\n f = Float(@frame_num % CYCLE_LEN) / CYCLE_LEN;\n\n xmid = @background.width / 2.0\n ymid = @background.height / 2.0\n\n radius = [xmid, ymid].min / 2.0\n\n @images.each_with_index do |image, i|\n ang = 2.0 * Math::PI * Float(i) / IMAGE_NAMES.length - f * 2.0 * Math::PI\n\n r = radius + (radius / 3.0) * Math.sin(f * 2.0 * Math::PI)\n\n xpos = (xmid + r * Math.cos(ang) - image.width / 2.0 + 0.5).floor\n ypos = (ymid + r * Math.sin(ang) - image.height / 2.0 + 0.5).floor\n\n k = if (i & 1) == 1\n Math.sin(f * 2.0 * Math::PI)\n else\n Math.cos(f * 2.0 * Math::PI)\n end\n k = [0.25, 2.0 * k * k].max\n\n r1 = Gdk::Rectangle.new(xpos, ypos, image.width * k, image.height * k)\n r2 = Gdk::Rectangle.new(0, 0, @background.width, @background.height)\n\n dest = r1.intersect(r2)\n if dest\n @frame.composite!(image, dest.x, dest.y, dest.width, dest.height,\n xpos, ypos, k, k, Gdk::Pixbuf::INTERP_NEAREST,\n if (i & 1) == 1\n [\n 127,\n (255 * Math.sin(f * 2.0 * Math::PI)).abs\n ].max\n else\n [\n 127,\n (255 * Math.cos(f * 2.0 * Math::PI)).abs\n ].max\n end)\n end\n end\n @da.queue_draw\n @frame_num += 1\n true\n end",
"def frame_reset\n @delta_time = @frame_to_skip = 0\n @ruby_time = @current_time = @last_time = @last_second_time = Time.new\n reset_gc_time\n reset_ruby_time\n @last_frame_count = Graphics.frame_count\n end",
"def next_frame\n #populate our @channels instance vaiable\n create_channel_list\n do_frame_lookup\n\n if File.exist?(\"/home/lee/src/eyebleach/test_images/#{message[:channel_name]}-frame#{message[:frame_no]}.gif\")\n image = Base64.encode64(File.open(\"/home/lee/src/eyebleach/test_images/#{message[:channel_name]}-frame#{message[:frame_no]}.gif\").read)\n frame_message :next_frame, image, message[:frame_no], @channels[message[:channel_name]], message[:channel_name]\n else\n image = Base64.encode64(File.open(\"/home/lee/src/eyebleach/test_images/#{message[:channel_name]}-frame0.gif\").read)\n frame_message :next_frame, image, 0, @channels[message[:channel_name]], message[:channel_name]\n end\n end",
"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 last_frame; frames.last; end",
"def frames; end",
"def add_normal_frame(index, frame)\n pin = @pins[index]\n if @pins[index.succ].nil?\n frame.score = pin\n @skip_flag = true\n else\n frame.score = pin + @pins[index.succ]\n @skip_flag = true\n end\n end",
"def nextFrame(view)\n # Compute how long it took to display the last frame. This will\n # be used to compute how much to move or turnfor the next frame.\n time = view.last_refresh_time\n time_delay = 0\n if( time < 0.04 )\n time_delay = 0.04 - time\n time = 0.04\n end\n \n if( (@keys & (LEFT_ARROW | RIGHT_ARROW)) != 0 )\n self.send(self.lr_function, view, time)\n end\n if( (@keys & (UP_ARROW | DOWN_ARROW)) != 0 )\n self.send(self.ud_function, view, time)\n end\n \n # update the camera parameters\n @rep.update(view.camera) if @rep\n\n view.show_frame time_delay\n self.show_height\n \n true\nend",
"def get_frame\n next_frame\n rescue StopIteration => e\n return nil\n end",
"def cover\n manipulate! do |frame, index|\n frame if index.zero?\n end\n end",
"def capture\n filename = Time.now.to_f.to_s + '.png'\n \n file = \"#{dir}/#{filename}\"\n \n capture_time = Time.now\n \n @frame_capture.call(file)\n volume = @audio_sampler.call if @audio_sampler\n \n File.exist? file or raise \"Couldn't capture frame\"\n\n sample = Lava::Sample.new( :file => file, :time => capture_time, :last => samples.last, :volume => volume )\n samples << sample\n sample\n end",
"def rasterise \r\n @frames.each do |frame|\r\n printf '.';\r\n canvas = Canvas.new(@width, @height);\r\n @canvases.push(canvas);\r\n if frame.pixmaps.length == 0 then next; end;\r\n frame.pixmaps.each do |pixmap|\r\n img = pixmap.sprite.getImage(pixmap.frame);\r\n pixmap.frame = (pixmap.frame + 1) % (pixmap.sprite.images.length);\r\n canvas.add(img, pixmap.x, pixmap.y);\r\n end\r\n end \r\n end",
"def run\n failed_attempts = 0\n failed_white_attempts = 0\n x = 0\n y = 0\n loop do\n # If white just sail through until we hit another color\n if @current_color == 1\n x_next, y_next = move_direction(x, y)\n\n # If in white and hit boundary or black then step through dp\n if restricted?(x_next, y_next)\n toggle_cc\n step_dp\n failed_white_attempts += 1\n else\n x = x_next\n y = y_next\n @current_color = @image.color(x, y)\n failed_attempts = 0\n failed_white_attempts = 0\n end\n\n break if failed_white_attempts == 4\n else\n @size = 0\n temp_x = x\n temp_y = y\n x, y, @size = block_fill(x, y)\n # puts \"CURR: #{temp_x+1}, #{temp_y+1}, NEXT: #{x+1}, #{y+1}\"\n x_next, y_next = move_direction(x, y)\n # If we are hitting the edge or a black codel try another direction\n if restricted?(x_next, y_next)\n update_movement(failed_attempts)\n failed_attempts += 1\n else # here we move into the next color block after processing the action\n next_color = @image.color(x_next, y_next)\n process_action(@current_color, next_color)\n x = x_next\n y = y_next\n @current_color = next_color\n failed_attempts = 0\n failed_white_attempts = 0\n end\n\n break if failed_attempts == 8\n end\n end\n end",
"def pbCaveEntranceEx(exiting)\n sprite = BitmapSprite.new(Graphics.width,Graphics.height)\n sprite.z = 100000\n totalBands = 15\n totalFrames = 15\n bandheight = ((Graphics.height/2)-10).to_f/totalBands\n bandwidth = ((Graphics.width/2)-12).to_f/totalBands\n grays = []\n tbm1 = totalBands-1\n for i in 0...totalBands\n grays.push(exiting ? 0 : 255)\n end\n totalFrames.times do |j|\n x = 0\n y = 0\n rectwidth = Graphics.width\n rectheight = Graphics.height\n for k in 0...j\n t = (255.0)/totalFrames\n if exiting\n t = 1.0-t\n t *= 1.0+((k)/totalFrames.to_f)\n else\n t *= 1.0+0.3*(((totalFrames-k)/totalFrames.to_f)**0.7)\n end\n grays[k] -= t\n grays[k] = 0 if grays[k]<0\n end\n for i in 0...totalBands\n currentGray = grays[i]\n sprite.bitmap.fill_rect(Rect.new(x,y,rectwidth,rectheight),\n Color.new(currentGray,currentGray,currentGray))\n x += bandwidth\n y += bandheight\n rectwidth -= bandwidth*2\n rectheight -= bandheight*2\n end\n Graphics.update\n Input.update\n end\n if exiting\n pbToneChangeAll(Tone.new(255,255,255),0)\n else\n pbToneChangeAll(Tone.new(-255,-255,-255),0)\n end\n for j in 0..15\n if exiting\n sprite.color = Color.new(255,255,255,j*255/15)\n else\n sprite.color = Color.new(0,0,0,j*255/15) \n end\n Graphics.update\n Input.update\n end\n pbToneChangeAll(Tone.new(0,0,0),8)\n for j in 0..5\n Graphics.update\n Input.update\n end\n sprite.dispose\nend",
"def next_frame\n raise(StopIteration, \"End of file\") if @file.eof?\n @garbage = []\n @frame = {}\n ingest_frame\n @input_frame_number += 1 if !@frame.empty?\n frame[\"index\"] ||= @input_frame_number\n @footer = @garbage if @file.eof?\n if @input_frame_number > 1 && !@file.eof? && !@garbage.empty?\n STDERR.puts \"Extra text found:\\n #{@garbage * \"\"}\"\n end\n unless [\"start_time\", \"end_time\", \"content\"].all?{|k| @frame.has_key?(k)}\n if @file.eof?\n raise StopIteration, \"No more valid frames\"\n else\n raise \"Invalid frame and not EOF: #{frame}\"\n end\n end\n return @frame\n end",
"def update\n super\n if self.bitmap != nil and delay(@delay) and @animated\n x = @current_frame * @frame_width + @offset_x\n self.src_rect = Rect.new(x, @offset_y, @frame_width, @frame_height)\n @current_frame = (@current_frame + 1) unless @frames == 0\n @animated = false if @current_frame == @frames and @once\n @current_frame %= @frames\n end\n end",
"def frame\n (@frame || 1).to_f\n end",
"def frames\n _nudge[3]\n end",
"def anim1\n # load ball sprite\n ball = Sprite.new(@viewport)\n ball.bitmap = pbBitmap(\"Graphics/EBDX/Transitions/Common/ball\")\n ball.center!(true)\n ball.zoom_x = 0\n ball.zoom_y = 0\n # spin ball into place\n 16.delta_add.times do\n ball.angle += 22.5/self.delta\n ball.zoom_x += 0.0625/self.delta\n ball.zoom_y += 0.0625/self.delta\n pbWait(1)\n end\n ball.angle = 0\n ball.zoom = 1\n # take screenshot\n bmp = Graphics.snap_to_bitmap\n pbWait(8.delta_add)\n # dispose ball sprite\n ball.dispose\n # black background\n black = Sprite.new(@viewport)\n black.bitmap = Bitmap.new(@viewport.width, @viewport.height)\n black.bitmap.fill_rect(0, 0, @viewport.width, @viewport.height, Color.black)\n # split screenshot into two halves\n field1 = Sprite.new(@viewport)\n field1.bitmap = Bitmap.new(@viewport.width, @viewport.height)\n field1.bitmap.blt(0, 0, bmp, @viewport.rect)\n field1.src_rect.height = @viewport.height/2\n field2 = Sprite.new(@viewport)\n field2.bitmap = field1.bitmap.clone\n field2.y = @viewport.height/2\n field2.src_rect.height = @viewport.height/2\n field2.src_rect.y = @viewport.height/2\n # move halves off screen\n 16.delta_add.times do\n field1.x -= (@viewport.width/16)/self.delta\n field2.x += (@viewport.width/16)/self.delta\n pbWait(1)\n end\n field1.x = -@viewport.width\n field2.x = @viewport.width\n @viewport.color = Color.black\n # dispose unused sprites\n black.dispose\n field1.dispose\n field2.dispose\n end",
"def frame=(pos); end",
"def create_background\n add_disposable @background = UI::BlurScreenshot.new(@__last_scene)\n @background.opacity -= 255 / ENTERING_ANIMATION_DURATION * ENTERING_ANIMATION_DURATION\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 frame; end",
"def target_framerate\n\t\t\t\tif @target_frametime\n\t\t\t\t\t1000.0 / @target_frametime\n\t\t\t\telse\n\t\t\t\t\tnil\n\t\t\t\tend\n\t\t\trescue ZeroDivisionError\n\t\t\t\treturn nil\n\t\t\tend",
"def anim2\n # take screenshot and draw black background\n bmp = Graphics.snap_to_bitmap\n black = Sprite.new(@viewport)\n black.bitmap = Bitmap.new(@viewport.width, @viewport.height)\n black.bitmap.fill_rect(0, 0, @viewport.width, @viewport.height, Color.black)\n # split screenshot into two halves\n field1 = Sprite.new(@viewport)\n field1.bitmap = Bitmap.new(@viewport.width, @viewport.height)\n field1.bitmap.blt(0, 0, bmp, @viewport.rect)\n field1.src_rect.height = @viewport.height/2\n field2 = Sprite.new(@viewport)\n field2.bitmap = field1.bitmap.clone\n field2.y = @viewport.height/2\n field2.src_rect.height = @viewport.height/2\n field2.src_rect.y = @viewport.height/2\n # draw ballsprites for transition\n ball1 = Sprite.new(@viewport)\n ball1.bitmap = pbBitmap(\"Graphics/EBDX/Transitions/Common/ball\")\n ball1.center!\n ball1.x = @viewport.width + ball1.ox\n ball1.y = @viewport.height/4\n ball1.zoom_x = 0.5\n ball1.zoom_y = 0.5\n ball2 = Sprite.new(@viewport)\n ball2.bitmap = pbBitmap(\"Graphics/EBDX/Transitions/Common/ball\")\n ball2.center!\n ball2.y = (@viewport.height/4)*3\n ball2.x = -ball2.ox\n ball2.zoom_x = 0.5\n ball2.zoom_y = 0.5\n # move ballsprites on screen\n 16.delta_add.times do\n ball1.x -= (@viewport.width/8)/self.delta\n ball2.x += (@viewport.width/8)/self.delta\n pbWait(1)\n end\n # move screenshots\n 32.delta_add.times do\n field1.x -= (@viewport.width/16)/self.delta\n field1.y -= (@viewport.height/32)/self.delta\n field2.x += (@viewport.width/16)/self.delta\n field2.y += (@viewport.height/32)/self.delta\n pbWait(1)\n end\n @viewport.color = Color.black\n # dispose unused sprites\n black.dispose\n ball1.dispose\n ball2.dispose\n field1.dispose\n field2.dispose\n end",
"def c_frame?; end",
"def setup_frames\n @frames ||=\n begin\n frames = 10.times.map {|i| Frame.new(i+1,0,0,0,nil)}\n # link frames\n (0...9).each {|i| frames[i].next_frame = frames[i+1]}\n frames\n end\n end",
"def updateDebugFPS(frame)\n end",
"def update \n\t\t@currentframe = (@currentframe + 1) % @frames.size \n\t\t@image = @frames[@currentframe] # load the image\n \t@rect.move!(-@xspeed,0) # move horizontally left \n if @rect.right() < 0\n\t\t\t\tself.kill # went off screen, kill it\n\t\t\t\treturn \n\t\t end\n end",
"def frames; motion.frames; end",
"def last?\n if @frame_index > (@credit_sprite.bitmap.height + 500)\n $scene = Scene_Map.new\n Audio.bgm_fade(10000) #aprox 10 seconds\n return true\n end\n return false\n end",
"def pbBGMFade(x=0.0); pbBGMStop(x);end",
"def read_frame\n\t\t\t\tframe = @framer.read_frame(@local_settings.maximum_frame_size)\n\t\t\t\t# puts \"#{self.class} #{@state} read_frame: class=#{frame.class} stream_id=#{frame.stream_id} flags=#{frame.flags} length=#{frame.length} (remote_stream_id=#{@remote_stream_id})\"\n\t\t\t\t# puts \"Windows: local_window=#{@local_window.inspect}; remote_window=#{@remote_window.inspect}\"\n\t\t\t\t\n\t\t\t\treturn if ignore_frame?(frame)\n\t\t\t\t\n\t\t\t\tyield frame if block_given?\n\t\t\t\tframe.apply(self)\n\t\t\t\t\n\t\t\t\treturn frame\n\t\t\trescue GoawayError => error\n\t\t\t\t# Go directly to jail. Do not pass go, do not collect $200.\n\t\t\t\traise\n\t\t\trescue ProtocolError => error\n\t\t\t\tsend_goaway(error.code || PROTOCOL_ERROR, error.message)\n\t\t\t\t\n\t\t\t\traise\n\t\t\trescue HPACK::Error => error\n\t\t\t\tsend_goaway(COMPRESSION_ERROR, error.message)\n\t\t\t\t\n\t\t\t\traise\n\t\t\tend",
"def first_defined_frame\n first_f = @segments[0].end_frame\n return 1 if first_f == NEG_INF\n return first_f\n end",
"def update_src_rect\n @sap_frame_count %= @sap_time_interval\n if @sap_frame_count == 0\n @sap_current_frame += 1\n @sap_current_frame = 0 if self.bitmap.width < (@sap_current_frame + 1)*@sap_frame_width\n sx = @sap_current_frame*@sap_frame_width\n self.src_rect.set(sx, 0, @sap_frame_width, self.bitmap.height)\n end\n @sap_frame_count += 1\n end",
"def catchupFrames(fromFrameNo, toFrameNo)\r\n #puts \"#{fromFrameNo} --> #{toFrameNo}\"\r\n for i in fromFrameNo..toFrameNo do\r\n #puts \"Catching up frame #{i}:\";\r\n if @frames.length <= i then\r\n @frames[i] = Frame.new(self);\r\n @frames[i-1].pixmaps.each do |pixmap|\r\n @frames[i].addPixmap(pixmap)\r\n end\r\n end\r\n end\r\n return @frames[toFrameNo];\r\n end",
"def load_frames\n\t\tw,h = @_w, @_h # convenience assignments\n\t\twt = 0.8 * w\n\t\tdw = 0.5 * (w-wt) \n\t img = Surface.new([w,h]).fill(@@bg_color)\n\t img.draw_polygon_s([[0,h], [dw,0], [dw+wt,0], [w,h],[0,h]], BROWN)\n\t return [img]\n\tend",
"def roll\n # repeat same process for 9 times for first 9 frames\n 9.times do |x|\n frame\n end\n\n # 10th frame\n tenth_frame\n @frame_score_array\n end",
"def deanimate\n @frame=0\n @currentIndex=0\n @actualBitmap.clear\n @actualBitmap.stretch_blt(Rect.new(0,0,@width,@height),@bitmap,Rect.new(@currentIndex*(@width/@scale),0,@width/@scale,@height/@scale))\n end",
"def deanimate\n @frame=0\n @currentIndex=0\n @actualBitmap.clear\n @actualBitmap.stretch_blt(Rect.new(0,0,@width,@height),@bitmap,Rect.new(@currentIndex*(@width/@scale),0,@width/@scale,@height/@scale))\n end",
"def run\n _image_files = image_files\n\n specified_camera = @roll.camera\n camera = @config.cameras.find { |camera| camera.tag == specified_camera }\n raise \"Camera #{specified_camera} not found in config.yml\" unless camera\n\n @roll.frames.each_with_index do |frame, i|\n break if i >= _image_files.count\n\n specified_lens = frame.lens || @roll.lens\n lens = camera.lenses.find { |lens| lens.tag == specified_lens }\n raise \"Lens #{specified_lens} not found for frame #{frame.number}\" unless lens\n\n relative_path = _image_files[i].gsub(%r(^#{Dir.pwd}/), \"\")\n puts \"Processing frame #{frame.number}\\n #{relative_path}\" unless @silent\n\n ExifToolImage.new(_image_files[i]).tap do |exif|\n exif[\"Artist\"] = @roll.artist || @config.artist\n exif[\"Copyright\"] = template_copyright(@config, @roll, frame)\n exif[\"DateTimeOriginal\"] = frame.date_captured || @roll.date_captured\n exif[\"CreateDate\"] = frame.date_scanned || @roll.date_scanned\n exif[\"Make\"] = camera.make\n exif[\"Model\"] = camera.model\n exif[\"LensModel\"] = lens.model\n exif[\"ISO\"] = @roll.iso\n exif[\"ExposureTime\"] = frame.shutter || @roll.shutter\n exif[\"FNumber\"] = frame.aperture || @roll.aperture\n exif[\"FocalLength\"] = frame.focal_length || lens.focal_length || @roll.focal_length\n exif[\"Flash\"] = frame.flash ? 1 : 0\n exif[\"Orientation\"] = frame.orientation || 1\n\n exif.save\n end\n end\n end",
"def last_defined_frame\n last_f = @segments[-1].start_frame\n return 100 if last_f == POS_INF\n return last_f\n end",
"def skipping_frame?\n return @frame_to_skip > 0\n end",
"def frame_interval\n 1.0/@fps\n end",
"def frame_interval\n 1.0/@fps\n end",
"def frame_interval\n 1.0/@fps\n end",
"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 setup\n size 200, 200\n frame_rate 30\n @a = 0\n \n # The background image must be the same size as the parameters\n # into the size method. In this program, the size of \"milan_rubbish.jpg\"\n # is 200 x 200 pixels.\n @background_image = load_image \"milan_rubbish.jpg\"\nend",
"def next_update_process\n @skip_frame = true\n # Force the next update to be called if a frame skip was requested\n while @skip_frame\n @skip_frame = false\n log_debug(\"Calling #{@next_update} phase\")\n send(@next_update)\n end\n end",
"def extract_cover!(offset=0.0)\n random_name = (0...8).map { (65 + rand(26)).chr }.join\n tmp_file = \"tmp/#{random_name}.jpg\"\n\n `ffmpeg -itsoffset -#{offset} -i '#{video_file.path}' -vframes 1 -an #{tmp_file}`\n\n # Attach output image as cover image\n File.open(tmp_file) do |f|\n self.cover_image = f\n save\n end\n end",
"def generate_previews(filename, options = {})\n\tframegrab_grid = options['framegrab_grid'] || Config['PreviewSettings']['default_grid']\n\tframegrab_interval = options['framegrab_interval'] || Config['PreviewSettings']['default_interval']\n\tframegrab_height = options['framegrab_height'] || Config['PreviewSettings']['default_height']\n\n\tbase_filename = File.basename(filename)\n\tfilesize = File.size(filename)\n\tfile_info = Mediainfo.new filename\n\n\tif framegrab_interval.to_i == 0\n\t\ttotal_images = 1\n\t\tframegrab_grid.split('x').each do |x|\n\t\t\ttotal_images *= x.to_i\n\t\tend\n\t\tframegrab_interval = file_info.duration / total_images\n\tend\n\n\tcount = 0\n\tunits = ['bytes', 'KB', 'MB', 'GB', 'TB']\n\tloop do\n\t\tbreak if filesize < 1024.0\n\t\tcount += 1\n\t\tfilesize /= 1024.0\n\tend\n\n\tpretty_filesize = filesize.round(2).to_s + ' ' + units[count]\n\n\tduration = file_info.duration\n\tremainder = 0\n\tcount = 0\n\tunits = ['sec','min','h']\n\tloop do\n\t\tbreak if duration < 60\n\t\tcount += 1\n\t\tremainder = duration % 60\n\t\tduration /= 60\n\tend\n\n\tpretty_duration = duration.round(0).to_s + ' ' + units[count]\n\n\tif remainder > 0\n\t\tpretty_duration += ' ' + remainder.round(0).to_s + ' ' + units[count-1]\n\tend\n\n\tcommand = \"ffmpeg -loglevel panic -y -i \\\"#{filename}\\\" -frames 1 -q:v 1 -vf \\\"select='isnan(prev_selected_t)+gte(t-prev_selected_t\\,\" + framegrab_interval.to_s + \")',scale=-1:\" + framegrab_height.to_s + \",tile=\" + framegrab_grid + \"\\\" '/tmp/video_preview.jpg'\"\n\t# puts command\n\tif system(command)\n\t# \t# Now that the preview is generated, post it to Mattermost\n\t\tif !(uploaded_file_url = upload_file('/tmp/video_preview.jpg', base_filename))\n\t\t\tcall_mattermost({:text => \"We ran into a problem uploading the file. Have someone look at this!\"})\n\t\telse\n\t\t\tmessage = \"\\n\\n\"\n\t\t\tmessage+= \"|#{base_filename}|[(preview)](#{uploaded_file_url})|\\n\"\n\t\t\tmessage+= \"|-|-:|\\n\"\n\t\t\tmessage+= \"|File Size| **#{pretty_filesize}**|\\n\"\n\t\t\tmessage+= \"|Duration| **#{pretty_duration}**|\\n\"\n\t\t\tmessage+= \"|Format| **#{file_info.format}**|\"\n\n\t\t\tactions = Config['FileOperations']\n\t\t\tattachments_actions = []\n\t\t\tactions.keys.each do |key|\n\t\t\t\taction_hash = {\n\t\t\t\t\t'name': key,\n\t\t\t\t\t'integration': {\n\t\t\t\t\t\t'url': [Config['Webhook']['url'], 'run-command'].join('/'),\n\t\t\t\t\t\t'context': {\n\t\t\t\t\t\t\t'command': key,\n\t\t\t\t\t\t\t'filename': File.realpath(filename)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tattachments_actions.push(action_hash)\n\t\t\tend\n\n\n\t\t\tattachments = [\n \t\t{\n \t\t\t\"text\": message,\n \t\t\t\"actions\": attachments_actions\n\t\t }]\n\n\t\t\tpayload = {:attachments => attachments}\n\n\t\t\tcall_mattermost(payload)\n\t\tend\n\telse\n\t\tLog.error \"There was an error running the command: #{command}\"\n\t\tcall_mattermost({:text => \"### DANGER WILL ROBINSON\\nERROR\"})\n\tend\n\nend",
"def update_manage\n return update_normal unless @fps_balancing\n # Auto skip\n if @frame_to_skip > 0\n @frame_to_skip -= 1\n Graphics.frame_count += 1\n Graphics.update_only_input\n update_time\n return\n end\n # Adding the time Ruby worked (because the GPU will equilibrate its work time)\n @delta_time += (dt = Time.new - @ruby_time)\n update_ruby_time(dt) # Update the Ruby time counters to show the right FPS\n # Estimating frame duration\n t = Time.new\n @update.call\n dt = Time.new - t # Time of the elapsed frame ~0.016\n update_gc_time(dt) # Update the GPU time counters to show the right FPS\n dt -= DT # Substract the time of a constant frame if the result is > 0 we'll need to skip frames\n @delta_time += dt # Adding the difference\n # Try to balance the drawing\n if @delta_time >= DT\n @frame_to_skip = (@delta_time / DT).to_i\n @delta_time -= @frame_to_skip * DT\n elsif @delta_time <= DTM\n #Saving framecount\n while @delta_time <= DTM\n t = Time.new\n update_no_input\n @delta_time += (dt = Time.new - t)\n update_gc_time(dt)\n end\n end\n update_time\n @ruby_time = Time.new\n end",
"def pop_frame\n stack.pop if stack.last[:prepared]\n stack.pop\n end",
"def move_background\n self.enumerateChildNodesWithName \"skyline\", usingBlock: -> (node, stop) {\n velocity = CGPointMake(-20, 0)\n movement_amount = CGPointMake(velocity.x * @delta, velocity.y * @delta)\n node.position = CGPointMake(node.position.x + movement_amount.x, node.position.y + movement_amount.y)\n\n if node.position.x <= -node.size.width / 2\n node.position = CGPointMake((node.position.x + node.size.width) * 2, node.position.y)\n end\n }\n end",
"def frame\n @rad.frame(0)\n end",
"def cur_image\n @frames.cur_image\n end",
"def capture_pre(args, &callback)\r\n RCapture::Internal.capture_pre(\r\n RCapture::Internal.singleton_class(self), \r\n args, \r\n &callback\r\n )\r\n end",
"def update\n if @frame == @gfx.length - 1\n @frame = 0\n elsif @frame == 7\n @frame += 1\n @deleted = true\n else\n @frame += 1\n end\n end",
"def prepare_parsed_frame frame\n end",
"def each_packet\n\t\treturn if not capture\n\t\tbegin\n\t\t\t@capture_count = 0\n\t\t\treader = Thread.new do\n\t\t\t\tcapture.each do |pkt|\n\t\t\t\t\tyield(pkt)\n\t\t\t\t\t@capture_count += 1\n\t\t\t\tend\n\t\t\tend\n\t\t\treader.join\n\t\trescue ::Exception\n\t\t\traise $!\n\t\tensure\n\t\t\treader.kill if reader.alive?\n\t\tend\n\n\t\t@capture_count\n\tend",
"def extract_start_transition_frame(output_path)\n video_duration = Info.new(@start_inputs[:mp4]).duration\n end_frame_extraction_start_seek(video_duration).step(0, LAST_FRAME_STEP) do |seek|\n Cmd::ExtractFrame.new(@start_inputs[:mp4], output_path, seek).run! *logs('1_extract_start_transition_frame')\n break if File.exists? output_path\n end\n\n # Raise an exception if couldn't extract the frame\n unless File.exists? output_path\n raise Error.new('start transition frame extraction failed', start_input_mp4: @start_inputs[:mp4])\n end\n end",
"def frame_step \n send_cmd(\"frame_step\")\n end",
"def start_load_screenshot\n show_loading_bar\n Thread.new{extract_graphic}\n end",
"def framing\n previous, klass.current_frame = klass.current_frame, self unless @delegate_to_klass\n yield\n ensure\n klass.current_frame = previous unless @delegate_to_klass\n end",
"def last_frame_with_previous_spare\n return false if number < 11\n\n previous_frame.spare\n end",
"def capture_traffic\n check_pcaprub_loaded()\n ::Socket.do_not_reverse_lookup = true # Mac OS X workaround\n open_pcap({'FILTER' => datastore['FILTER']})\n @capture_thread = Rex::ThreadFactory.spawn(\"DNSSpoofer\", false) do\n each_packet do |pack|\n begin\n parsed = PacketFu::Packet.parse(pack)\n reply = reply_packet(parsed)\n service.dispatch_request(reply, parsed.payload)\n rescue => e\n vprint_status(\"PacketFu could not parse captured packet\")\n dlog(e.backtrace)\n end\n end\n end\n end",
"def pasteLast\r\n copyFrame(@currentframe-1,@currentframe) if @currentframe>0\r\n end",
"def last_of frame_type\n frame = nil\n @avi.process_movi do |indices, movi|\n indices.reverse.each do |m|\n movi.pos = m[:offset] + 8\n f = Frame.new(movi.read(m[:size]), m[:id], m[:flag])\n if f.is?(frame_type)\n frame = f\n break\n end\n end\n [indices, movi]\n end\n frame\n end",
"def calculate_frame(frame)\n @groups.each { |calc| calc.calculate_frame(frame) }\n end",
"def initialize(dir, filename, hue = 0)\r\n @frames = []\r\n @currentFrame = 0\r\n @framecount = 0\r\n panorama = RPG::Cache.load_bitmap(dir, filename, hue)\r\n if filename[/^\\[(\\d+)(?:,(\\d+))?\\]/] # Starts with 1 or 2 numbers in brackets\r\n # File has a frame count\r\n numFrames = $1.to_i\r\n delay = $2.to_i\r\n delay = 10 if delay == 0\r\n raise \"Invalid frame count in #{filename}\" if numFrames <= 0\r\n raise \"Invalid frame delay in #{filename}\" if delay <= 0\r\n if panorama.width % numFrames != 0\r\n raise \"Bitmap's width (#{panorama.width}) is not divisible by frame count: #{filename}\"\r\n end\r\n @frameDelay = delay\r\n subWidth = panorama.width / numFrames\r\n for i in 0...numFrames\r\n subBitmap = BitmapWrapper.new(subWidth, panorama.height)\r\n subBitmap.blt(0, 0, panorama, Rect.new(subWidth * i, 0, subWidth, panorama.height))\r\n @frames.push(subBitmap)\r\n end\r\n panorama.dispose\r\n else\r\n @frames = [panorama]\r\n end\r\n end",
"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 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 sehFrameWalk()\n toKernel32Code = toKernel32()\n data = <<EOS\n push esi\n push ecx\n push ebx\n\n xor ebx,ebx\n not ebx ; ebx = 0xFFFFFFFF\n\n xor ecx, ecx\n mov cl,0x18 ; image size of ntdll.dll image on Windows 7 Ultimate SP1 (ENG), large enough to cover other versions as well\n shl ecx,16\n\n ; walk SEH chain until we find a candidate default SEH frame\n mov esi,esp\n seh_walking: \n lodsd ; load dword from stack\n cmp eax,ebx\n jne seh_walking\n ; Check if the candidate default SEH frame has correct function pointer\n ; [esi-4] now points to 0xFFFFFFFF so if this truly is the last SEH frame, [esi] (SE Handler) should point into ntdll.dll or kernel32.dll and [esi+20] (return into RtlUserThreadStart) too\n mov eax,[esi] ; potential SE Handler\n sub eax,[esi+16] ; potential return address of top stack frame\n cmp eax, ecx ; size limit means function pointer candidates have to reside in same image.\n ja seh_walking ; continue walking\n ; we now have a candidate, esi potentially points to default SE Handler in ntdll.dll\n mov eax,[esi]\n\n ; work through potential image until we find base address (within size limit to reduce potential false positives)\n find_begin:\n ; if we didn't find image base within size limit, give up on this candidate and try next\n test ecx, ecx\n je seh_walking\n dec eax\n xor ax,ax\n cmp word [eax],0x5A4D ; MZ start of PE header\n jnz find_begin\n\n pop ebx\n pop ecx\n pop esi\n\n mov edx, eax\n ; edx points to either ntdll.dll or kernel32.dll base address (depending on windows version)\n\n #{toKernel32Code}\nEOS\n\n data\n end",
"def start_driver\n begin\n every(interval) do\n handle_frame\n end\n super\n rescue Exception => e\n Logger.error \"Error starting Opencv driver!\"\n Logger.error e.message\n Logger.error e.backtrace.inspect\n end\n end",
"def pasteLast\n copyFrame(@currentframe-1,@currentframe) if @currentframe>0\n end",
"def update_backdrops\n $game_temp.backdrop.looping_position_check(@back1_sprite.bitmap, true)\n $game_temp.backdrop.looping_position_check(@back2_sprite.bitmap, false)\n if TSBS::Looping_Background\n @back1_sprite.ox = -$game_temp.backdrop.screen_x1 \n @back2_sprite.ox = -$game_temp.backdrop.screen_x2 \n @back1_sprite.oy = -$game_temp.backdrop.screen_y1 \n @back2_sprite.oy = -$game_temp.backdrop.screen_y2\n else\n @back1_sprite.x = $game_temp.backdrop.screen_x1\n @back2_sprite.x = $game_temp.backdrop.screen_x2\n @back1_sprite.y = $game_temp.backdrop.screen_y1\n @back2_sprite.y = $game_temp.backdrop.screen_y2\n end\n @back1_sprite.zoom_x = @back1_sprite.zoom_y = $game_temp.backdrop.zoom_1\n @back2_sprite.zoom_x = @back2_sprite.zoom_y = $game_temp.backdrop.zoom_2\n if backdrop_changed?\n Graphics.freeze if $game_temp.backdrop.trans_flag\n @backdrop_name1 = $game_temp.backdrop.name_1\n @backdrop_name2 = $game_temp.backdrop.name_2\n @back1_sprite.bitmap = Cache.battleback1(@backdrop_name1)\n @back2_sprite.bitmap = Cache.battleback2(@backdrop_name2)\n if TSBS::Looping_Background\n $game_temp.backdrop.looping_position_check(@back1_sprite.bitmap, true)\n $game_temp.backdrop.looping_position_check(@back2_sprite.bitmap, false)\n @back1_sprite.ox = -$game_temp.backdrop.screen_x1 \n @back1_sprite.oy = -$game_temp.backdrop.screen_y1 \n @back2_sprite.ox = -$game_temp.backdrop.screen_x2 \n @back2_sprite.oy = -$game_temp.backdrop.screen_y2\n else\n center_sprite(@back1_sprite)\n center_sprite(@back2_sprite)\n end\n name = $game_temp.backdrop.transition\n name = \"Graphics/System/\" + name unless name.empty?\n if $game_temp.backdrop.trans_flag\n Graphics.transition($game_temp.backdrop.duration,name,\n $game_temp.backdrop.trans_vague) \n end\n $game_system.backdecor_refresh[:notrans] = false if \n $imported[:TSBS_BattleDecor]\n end\n end",
"def build_frames\n prev_frame = nil\n 10.times.map do |frame_number|\n prev_frame = Frame.new(10 - frame_number, prev_frame)\n end.reverse!\n end",
"def diff\n if samples.count == 0\n self.capture\n end\n \n current = self.capture\n \n current.diff\n end",
"def each_frame(callback=nil, &frame_block)\n=begin\n raise ArgumentError, \"No block provided\" unless block_given?\n\n av_packet = AVPacket.new\n FFI::FFmpeg.av_init_packet(av_packet)\n av_packet[:data] = nil\n av_packet[:size] = 0\n\n while FFI::FFmpeg.av_read_frame(@av_format_context, av_packet) >= 0\n if av_packet[:stream_index] == index\n #frame = frame_block.call(decode_frame(av_packet)) unless av_packet.null?\n #rc = frame ? yield(frame) : true\n frame = decode_frame(av_packet)\n frame_block.call(frame)\n end\n\n FFI::FFmpeg.av_free_packet(av_packet)\n\n break if rc == false\n end\n=end\n extract_packets(true, &frame_block)\n\n callback.call if callback\n end",
"def load_editor_background\n x_extra = (self.width / TILE_SIZE.to_f / EDITOR_SCALE_LEVELS[0] / 2).ceil\n y_extra = (self.height / TILE_SIZE.to_f / EDITOR_SCALE_LEVELS[0] / 2).ceil\n\n @editor_background = Gosu.record(1, 1) do\n x = -x_extra\n while (x < EDITOR_WIDTH + x_extra)\n y = -y_extra\n while (y < EDITOR_HEIGHT + y_extra)\n color = position_in_bounds?(x, y) ? Gosu::Color::WHITE : Gosu::Color.new(255 / 2, 255, 255, 255)\n background = @background_images[@track.background_type]\n background.draw(x * TILE_SIZE, y * TILE_SIZE, 0, 1, 1, color)\n y += 1\n end\n x += 1\n end\n end\nend",
"def frame_total\n if last_frame?\n last_frame_total\n else\n first_two + frame_bonus\n end\n end",
"def process_image_black_and_white\n file_name = \"#{Rails.root}/tmp/temp-#{self.id}.jpg\"\n\n open(file_name, 'wb') do |file|\n file << open(self.image_uncompressed.url).read\n end\n\n image = OpenCV::Cv::Mat.new\n image = OpenCV::Cv::imread file_name\n\n OpenCV::Cv::cvtColor(image, image, OpenCV::Cv::COLOR_BGR2GRAY)\n\n size = OpenCV::Cv::Size.new(5,5)\n OpenCV::Cv::GaussianBlur(image, image, size, 0)\n OpenCV::Cv::adaptive_threshold(image, image, 251, OpenCV::CV_ADAPTIVE_THRESH_GAUSSIAN_C, OpenCV::CV_THRESH_BINARY, 19, 11)\n\n photo = OpenCV::Cv::imwrite \"#{Rails.root}/tmp/black_and_white-#{self.id}.png\", image\n\n file = File.open \"#{Rails.root}/tmp/black_and_white-#{self.id}.png\"\n\n self.image_black_and_white = file\n\n begin\n self.save!\n rescue CarrierWave::ProcessingError => error\n raise error.cause\n end\n\n self.exam.check_for_black_and_white\n end",
"def backtrack\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # current x, y, target x, y and resulting path\n cx, cy, x, y, result = @tx, @ty, 0, 0, []\n # find the way back from destination to start\n loop do\n # change current coordinates\n cx, cy = cx - x, cy - y\n # stop if reached corrected start position\n break if cx == @sx && cy == @sy\n # add movement command\n pix.times {result.unshift(Cache::TDirs[@closed[cx, cy]])}\n # track back next node\n x, y = Cache::DirOffsets[@closed[cx, cy]]\n end\n # modify found path if pixel movement is being used\n modify(result) if pix > 1\n # return result\n return result\n end",
"def _nudge\n frames = @total\n secs = (@total.to_f/@fps).floor\n frames-=(secs*@fps)\n mins = (secs/60).floor\n secs -= (mins*60)\n hrs = (mins/60).floor\n mins-= (hrs*60)\n \n raise RangeError, \"More than 59 minutes\" if mins > 59 \n raise RangeError, \"More than 59 seconds\" if secs > 59\n raise TimecodeLibError, \"More than #{@fps.to_s} frames (#{frames}) in the last second\" if frames >= @fps\n raise RangeError, \"Timecode cannot be longer that 99 hrs\" if hrs > 99 \n \n [hrs, mins, secs, frames]\n end",
"def frame_self(frame_postion=0)\n #This is a stub, used for indexing\n end",
"def pbBGSFade(x=0.0); pbBGSStop(x);end",
"def read_live\n\t#incident number counter\n\ti = 0\n\tstream = PacketFu::Capture.new(:start => true, :iface => 'en0', :promisc => true)\n\t#stream.show_live()\n\tstream.stream.each do |raw|\n\t\tpkt = PacketFu::Packet.parse(raw)\n\t\tif pkt.is_tcp?\n\t\t\t#update incident number\n\t\t\ti= i + 1\n\n\t\t\t#get the source IP address of the scan\n\t\t\tsIP = pkt.ip_saddr\n\n\t\t\t#get all protocols used in packet\n\t\t\tprotocol = pkt.proto\n\n\t\t\t#get last protocol used\n\t\t\tp = protocol.last\n\t\t\t\n\t\t\t#NULL scan\n\t\t\tif pkt.tcp_flags.urg == 0 && pkt.tcp_flags.ack == 0 && pkt.tcp_flags.psh == 0 &&\n\t\t\t\tpkt.tcp_flags.rst == 0 && pkt.tcp_flags.syn == 0 && pkt.tcp_flags.fin == 0\n\t\t\t\tputs i.to_s + \". ALERT: NULL scan is detected from \" + sIP + \" (\" + p + \") \" + \"(\" + pkt.payload + \")!\"\n\t\t\tend\n\t\t\t\n\t\t\t#FIN scan\n\t\t\tif pkt.tcp_flags.urg == 0 && pkt.tcp_flags.ack == 0 && pkt.tcp_flags.psh == 0 &&\n\t\t\t\tpkt.tcp_flags.rst == 0 && pkt.tcp_flags.syn == 0 && pkt.tcp_flags.fin == 1\n\t\t\t\tputs i.to_s + \". ALERT: FIN scan is detected from \" + sIP + \" (\" + p + \") \" + \"(\" + pkt.payload + \")!\"\n\t\t\tend\n\t\t\t\n\t\t\t#Xmas scan\n\t\t\tif pkt.tcp_flags.urg == 1 && pkt.tcp_flags.ack == 0 && pkt.tcp_flags.psh == 1 &&\n\t\t\t\tpkt.tcp_flags.rst == 0 && pkt.tcp_flags.syn == 0 && pkt.tcp_flags.fin == 1\n\t\t\t\tputs i.to_s + \". ALERT: XMAS scan is detected from \" + sIP + \" (\" + p + \") \" + \"(\" + pkt.payload + \")!\"\n\t\t\tend\t\t\t\t\n\n\t\t\t#Other Nmap scans\n\t\t\tif pkt.payload.scan(/\\x4E\\x6D\\x61\\x70/)\n\t\t\t\tputs i.to_s + \". ALERT: Nmap scan is detected from \" + sIP + \" (\" + p + \") \" + \"(\" + \"(\" + pkt.payload + \")!\"\n\t\t\tend\n\t\t\t\n\t\t\t#Nikto scan \n\t\t\tif pkt.payload.scan(/\\x4E\\x69\\x6B\\x74\\x6F\\x0A/)\n\t\t\t\tputs i.to_s + \". ALERT: Nikto scan is detected from \" + sIP + \" (\" + p + \") \" + \"(\" + pkt.payload + \")!\"\n\t\t\tend\n\n\t\t\t#Credit card leak \n\t\t\tif pkt.payload.scan(/4\\d{3}(\\s|-)?\\d{4}(\\s|-)?\\d{4}(\\s|-)?\\d{4}/) || pkt.payload.scan(/5\\d{3}(\\s|-)?\\d{4}(\\s|-)?\\d{4}(\\s|-)?\\d{4}/) || pkt.payload.scan(/6011(\\s|-)?\\d{4}(\\s|-)?\\d{4}(\\s|-)?\\d{4}/) || pkt.payload.scan(/3\\d{3}(\\s|-)?\\d{6}(\\s|-)?\\d{5}/)\n\t\t\t\tputs i.to_s + \". ALERT: Credit card leaked in the clear from \" + sIP + \" (\" + p + \") \" + \"(\" + pkt.payload + \")!\"\n\t\t\tend\n\t\tend\n\tend\t\t\t\nend",
"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 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 first_of frame_type\n frame = nil\n @avi.process_movi do |indices, movi|\n indices.each do |m|\n movi.pos = m[:offset] + 8\n f = Frame.new(movi.read(m[:size]), m[:id], m[:flag])\n if f.is?(frame_type)\n frame = f\n break\n end\n end\n [indices, movi]\n end\n frame\n end",
"def look_back()\r\n camera = Sketchup.active_model.active_view.camera.set(@eye, @target, @up)\r\n end",
"def look_back()\r\n camera = Sketchup.active_model.active_view.camera.set(@eye, @target, @up)\r\n end",
"def frame_test(frame, idx_tx, exp, cnt = 32)\n # Create and Tx frame\n frame_tx(frame, idx_tx, cnt)\n \n # Check frame\n exp.each do |e|\n if_rx = $dut.if_list[e.idx_rx]\n if_rx.rx_buffer.each do |rx_buf|\n error = true\n e.frame_table.each do |f|\n fr = f.create_frame\n rx_f = Frame.new(rx_buf[f.data_offs..-1])\n if (rx_f.dmac == fr.dmac and rx_f.smac == fr.smac && rx_f.data == fr.data)\n # Expected frame, remove it from frame table\n e.frame_table -= [f]\n error = false\n break\n end\n end\n frame_log(error, \"Rx\", e.idx_rx, Frame.new(rx_buf), cnt)\n end\n\n # All frames in the table must be received\n e.frame_table.each do |f|\n frame_log(true, \"No\", e.idx_rx, f.create_frame, cnt)\n end\n end\nend",
"def capture(dest)\n VideoCapture.new(current_image.to_s) >> dest\n dest\n end",
"def dynamic_range \n\t\tpage\n\t\tframes\n\t\tnum = 0\n\t\twhile num < 4 \n\t\t\tif page == frames[num] \n\t\t\t\t@destination = frames[num] \n\t\t\tend \n\t\t\tnum += 1 \n\t\tend\n\tend",
"def regular_frame\n @total_score += @roll + @next_roll\n @current_roll +=2\n end",
"def bonus_spare(index)\n frame = frames[index + 1]\n frame.first\n end",
"def frame\n animation[Gosu.milliseconds / 100 % animation.size]\n end"
] |
[
"0.5764144",
"0.5697106",
"0.5686045",
"0.54953426",
"0.54810065",
"0.54605556",
"0.53902674",
"0.5385765",
"0.5211709",
"0.51832473",
"0.51578534",
"0.51454633",
"0.50896716",
"0.50258684",
"0.50167793",
"0.50079465",
"0.497904",
"0.49656343",
"0.49429202",
"0.4921613",
"0.49045616",
"0.49020132",
"0.4900331",
"0.4896831",
"0.488424",
"0.48346004",
"0.48146105",
"0.48119515",
"0.48114708",
"0.47986108",
"0.47912917",
"0.47742084",
"0.47707903",
"0.4733979",
"0.4727135",
"0.47084898",
"0.46978053",
"0.46856114",
"0.46745887",
"0.4674584",
"0.46428663",
"0.46428663",
"0.46365243",
"0.463527",
"0.4633062",
"0.46314865",
"0.46314865",
"0.46314865",
"0.46080783",
"0.46079186",
"0.4592513",
"0.456983",
"0.45563886",
"0.45514205",
"0.4544127",
"0.4534426",
"0.4533781",
"0.45332024",
"0.45321545",
"0.45276198",
"0.45007065",
"0.44941026",
"0.44913572",
"0.44868764",
"0.4463417",
"0.44515732",
"0.44431105",
"0.44422084",
"0.4438518",
"0.44383225",
"0.44350776",
"0.4433749",
"0.44276604",
"0.44266516",
"0.44256255",
"0.4418878",
"0.4412152",
"0.44098938",
"0.4407163",
"0.44025955",
"0.4393842",
"0.43850842",
"0.4378944",
"0.4377696",
"0.43505988",
"0.4349929",
"0.43405265",
"0.4340133",
"0.43341628",
"0.4332718",
"0.43320626",
"0.43313718",
"0.4327162",
"0.4327162",
"0.43243253",
"0.43235108",
"0.43045333",
"0.42973274",
"0.42942637",
"0.4293042"
] |
0.5507612
|
3
|
Public: Iterates through contours and yields them.
|
def with_each_contour
contours.each do |contour|
# Generate a MASK based on the current contour, and erode it so
# that we can get rid of some of the shadow around the piece.
# The whole map is black and the piece is white.
yield contour, grab_color_from_contour(contour)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def contour( *args )\n return bezier.contour\n end",
"def get_contour_points_adv()\r\n result = []\r\n idx = 0\r\n result[idx] = Offset.vertices(@active_face.outer_loop.vertices, -(@bit_diameter * 0.5)).offsetPoints\r\n# puts \" outer #{result[idx].length} #{result[idx]} \"\r\n @active_face.loops.each { |lp|\r\n if (!lp.outer?)\r\n idx += 1\r\n result[idx] = Offset.vertices(lp.vertices, -(@bit_diameter * 0.5) ).offsetPoints \r\n# puts \" inner[#{idx}] #{result[idx]}\" \r\n end\r\n }\r\n return result \r\nend",
"def colors_from_contours!(contours, previous)\n contours = contours.sort_by { |c| c.rect.y }\n\n contours.to_enum.with_index.each_with_object(previous) do |(contour, index), hash|\n piece = Piece.all[index]\n color = grab_color_from_contour(contour)\n\n Theia.logger.info \"FOUND! contour for #{ Piece.all[index].key } \" +\n \"with y: #{ contour.rect.y } with color: \" +\n \"#{ color.to_a }\"\n\n (hash[piece.key] ||= []).push(color)\n end\n end",
"def get_contour_points(loop)\r\n# puts \"get contour points\"\r\n# return get_offset_points(loop, -(@bit_diameter * 0.5))\r\n bb = loop.face.bounds\r\n ht = bb.max.y - bb.min.y - @bit_diameter - 0.001\r\n wd = bb.max.x - bb.min.x - @bit_diameter - 0.001\r\n # do not even try if the face is not bigger than the bitdiameter\r\n bd = @bit_diameter / 2\r\n if ((wd > bd) || (ht > bd)) \r\n return Offset.vertices(@active_face.outer_loop.vertices, -(@bit_diameter * 0.5)).offsetPoints\r\n else\r\n return nil\r\n end\r\nend",
"def each_vertex; @vertices.each {|v| yield v} end",
"def each()\n @tour.each do |node_id|\n yield node_id\n end\n end",
"def each_coordination_object(&block)\n @coordination_objects.each(&block)\n end",
"def each\n start = self.class.start_index\n (start..max_index).each { |i| yield @subcomposites[i] } if max_index\n end",
"def each_file_in_tree\n self.directories_in_tree.find_each do |directory|\n next if directory.nil?\n directory.cfs_files.find_each do |cfs_file|\n next if cfs_file.nil?\n\n yield cfs_file if block_given?\n end\n end\n end",
"def each\n @collection.each { |c| yield c }\n end",
"def each(&block)\n each_vertex(&block)\n end",
"def each_clobbers(&block)\n @clobbers.each(&block)\n end",
"def each # :yields: segment\n return unless @segments\n @segments.each { |s| yield s }\n end",
"def each\n @molecules.each do |mol|\n yield mol\n end\n end",
"def each\n return vertices.values.each unless block_given?\n vertices.values.each { |v| yield v }\n end",
"def each_collision(game_object)\r\n start_x = (game_object.bb.left / @grid[0]).to_i\r\n stop_x = (game_object.bb.right / @grid[0]).to_i\r\n \r\n (start_x ... stop_x).each do |x|\r\n start_y = (game_object.bb.top / @grid[1]).to_i\r\n stop_y = (game_object.bb.bottom / @grid[1]).to_i\r\n \r\n (start_y ... stop_y).each do |y|\r\n yield @map[x][y] if @map[x] && @map[x][y] && @map[x][y] != game_object # Don't yield collisions with itself\r\n end\r\n end\r\n end",
"def each &block\n if block_given?\n Tempfile.open('temp', binmode: true) do |newmovi|\n @avi.process_movi do |indices, movi|\n newindices = indices.select do |m|\n movi.pos = m[:offset] + 8 # 8 for id and size\n frame = Frame.new(movi.read(m[:size]), m[:id], m[:flag])\n block.call frame\n unless frame.data.nil?\n m[:offset] = newmovi.pos\n m[:size] = frame.data.size\n m[:flag] = frame.flag\n m[:id] = frame.id\n newmovi.print m[:id]\n newmovi.print [frame.data.size].pack('V')\n newmovi.print frame.data\n newmovi.print \"\\0\" if frame.data.size % 2 == 1\n true\n else\n false\n end\n end\n [newindices, newmovi]\n end\n end\n else\n self.enum_for :each\n end\n end",
"def each_block\n 0.upto(3) do |x|\n 0.upto(3) do |y|\n # TODO: Move the bitwise and into #rotation.\n # Not sure now there's a rotate method for each direction.\n c = Tetrominos[@shape][@rotation & 3][y][x]\n yield x, y, c if c == 1\n end\n end\n end",
"def each_in_neighbor(v)\n raise NotImplementedError\n yield u\n end",
"def each(&blk)\n coordinates.each { |coordinate| yield coordinate }\n end",
"def each(&block)\n @atlas.each(&block)\n end",
"def each_involved_task(&block)\n return enum_for(__method__) unless block_given?\n\n trace.each_vertex(&block)\n end",
"def each\n self.num_geometries.times do |n|\n yield self.get_geometry_n(n)\n end\n nil\n end",
"def each\n self.num_geometries.times do |n|\n yield self.get_geometry_n(n)\n end\n nil\n end",
"def each\n\t\t\t@joints.each { |x| yield x }\n\t\tend",
"def each(filter = {}, &block)\n vertices(filter).each(&block)\n end",
"def each(&block)\n @extent.each(&block)\n end",
"def contour(x, y, h, z, major_h)\n # TODO: check: Arrays have incorrect length or dimension.\n nx = x.length\n ny = y.length\n nh = h.length\n super(nx, ny, nh, x, y, h, z, major_h)\n end",
"def contour(x, y, h, z, major_h)\n # TODO: check: Arrays have incorrect length or dimension.\n nx = x.length\n ny = y.length\n nh = h.length\n super(nx, ny, nh, x, y, h, z, major_h)\n end",
"def each(&x) #:yields: segmentpair\n exons.each(&x)\n end",
"def each(&x) #:yields: segmentpair\n exons.each(&x)\n end",
"def each(&x) #:yields: segmentpair\n exons.each(&x)\n end",
"def foreach\n for j in @min_vis_y..@max_vis_y\n for i in @min_vis_x..@max_vis_x\n pos = get_screen_pos i, j\n yield i, j, pos.x, pos.y\n end\n end\n end",
"def each(&block)\n begin\n while true\n block.call(@fiber.resume)\n end\n rescue StopIteration\n end\n end",
"def each(&block)\n yield self\n children.each {|c| c.each(&block)}\n end",
"def each\n cycles_found = []\n\n @graph.keys.each do |start_node|\n @ticker.tick\n next if cycles_found.include?(start_node)\n\n find_cycles(start_node).each do |cycle|\n unless cycles_found.include?(cycle.node)\n cycles_found << cycle.node\n yield cycle.node\n end\n end\n end\n end",
"def each_cds\n ft.each do |cds_feature|\n if cds_feature.feature == 'CDS'\n yield cds_feature\n end\n end\n end",
"def each()\n hijos.each() do |v|\n yield v\n end\n end",
"def each_transform_output\n if !(tr = model.transformer)\n return\n end\n\n model.each_output_port do |port|\n if associated_transform = tr.find_transform_of_port(port)\n from = selected_frames[associated_transform.from]\n to = selected_frames[associated_transform.to]\n yield(port, from, to)\n end\n end\n end",
"def each_point\n @points.each {|pt| yield pt }\n end",
"def pt_arcs\n _arcs = arcs.select {|arc| arc.from_place_to_transition?}\n\n if block_given?\n _arcs.each {|arc| yield arc}\n else\n return _arcs\n end\n end",
"def each(&block)\n scenes_collection.each(&block)\n end",
"def each(&block)\n @grouped_collection.each { |gc| block.call(gc) }\n end",
"def each_channel(&block); end",
"def each\n @children.each { |child| yield child }\n end",
"def each\n @children.each {|child| yield child}\n end",
"def each(&block)\n @files.each(&block)\n end",
"def print_continent_cities(graph_instance)\n graph_instance.continent_hash.each_key { |key|\n continent = graph_instance.continent_hash[key]\n puts \"Cities in #{key} are - \"\n continent.each { |city|\n puts \"#{city}\"\n }\n }\nend",
"def each(&block)\n raise Error::UnsupportedOperation, \"Method GeometryCollection#each not defined.\"\n end",
"def enum_paths(&block)\n @maze.connections_from(@at, @subset_mask, &block)\n end",
"def each &block\n @parts.each(&block)\n end",
"def each_result_arg\n match_all = ->(_) { true }\n changeset.file_paths.each do |relative_filename|\n next unless relative_filename.to_s.end_with?(\".rb\")\n path = case relative_filename\n when Pathname then relative_filename\n else\n File.expand_path(relative_filename, @relative_git_dir)\n end\n\n root_ast = Imagen::Node::Root.new.build_from_file(path)\n next if root_ast.children.empty?\n\n coverage = lcov.source_files[path.to_s]\n\n root_ast.children[0].find_all(match_all).each do |node|\n yield(path.to_s, coverage, node)\n end\n end\n end",
"def each_edge(&block)\n\t\t\tedges.each(&block)\n\t\tend",
"def each_index\n\t\t\t@joints.each_index { |x| yield x }\n\t\tend",
"def each_child\n @children.each { |child| yield child }\n end",
"def each(&block)\n dots.each(&block)\n end",
"def each_map_block\n (0...world.map.x_count_block).each { |xb|\n xl = world.map.block_index[xb]\n (0...world.map.y_count_block).each { |yb|\n yl = xl[yb]\n (0...world.map.z_count_block).each { |z|\n p = yl[z]\n yield p if p\n }\n }\n }\n end",
"def each(&proc)\n @parts.each(&proc)\n end",
"def each(&block)\n return @parts.each(&block)\n end",
"def each(&block)\n @pz.each do |row|\n row.each do |cell|\n yield cell\n end\n end\n end",
"def codepoints\n return to_enum :codepoints unless block_given?\n while c = getc\n c.codepoints.each do |cp|\n yield cp\n end\n end\n end",
"def each\n @locations.each do |x|\n yield(x)\n end\n end",
"def each\r\n assert_exists\r\n arr_cells = cells\r\n for i in 0..arr_cells.length - 1 do\r\n yield arr_cells[i]\r\n end\r\n end",
"def each_container(&block)\n collection.each_value(&block)\n end",
"def each_content\n @content.each do |content|\n yield content if content\n end\n end",
"def each\n yield self\n children.each {|c| c.each {|n| yield n}}\n end",
"def edges\n\t (@vertices + [@vertices.first]).each_cons(2) {|v1,v2| yield v1, v2}\n\tend",
"def each(&block)\n @v.each &block\n end",
"def each\n self.traverse_down { |node| yield(node) }\n end",
"def each_child\n @children.each { |child| yield child }\n end",
"def each\n changeset.each { |file| yield file }\n end",
"def each\n files.each do |file|\n yield file\n end\n end",
"def each_child\n @children.each_pair { |_, child| yield child }\n end",
"def each_image(&block)\n images.each(&block)\n end",
"def map\n start = self.class.start_index\n (start..max_index).map { |i| yield @subcomposites[i] } if max_index\n end",
"def each_vertex\n\t\treturn enum_for(:each_vertex) unless block_given?\n\t\t\n\t\tsuper do |v|\n\t\t\tyield v\n\t\tend\n\tend",
"def each_bfs (option_hash={:full_traverse=>true})\n def adjust_context context, dir\n con = context.dup\n case dir\n when 0 then con[:y] += 1\n when 1 then con[:x] += 1\n when 2 then con[:y] -= 1\n when 3 then con[:x] -= 1\n end\n return con\n end\n color_list, white_list = [], []\n full_traverse = option_hash[:full_traverse] \n yield_x_range, yield_y_range = option_hash[:yield_range]\n\n # white list contains data to yield and process each pass.\n white_list << [self, {:x=>0, :y=>0}]\n color_list << self\n\n # while we still have something to act upon process it.\n # And yield the result to our block of code.\n while !white_list.empty?\n r, context = white_list.shift()\n\n yield(r, context) if yield_x_range == nil || yield_y_range == nil || (yield_x_range === context[:x] && yield_y_range === context[:y])\n\n r.each_dir do |e| \n next if full_traverse == false && (e.flags_state.is_set(:soft_door) || e.flags_state.is_set(:closed))\n if e.towards_room.gri == nil\n e.do_delete\n next\n end\n if !color_list.include?(e.towards_room.gri)\n white_list << [e.towards_room.gri, adjust_context(context, e.direction)]\n color_list << e.towards_room.gri \n end\n end\n end\n return nil\n end",
"def each(&block)\n axis_iterator(:child).each(&block)\n end",
"def each_vertex(&block) # :yields: v\n raise NotImplementedError\n end",
"def each(&block)\n internal_collection.each(&block)\n end",
"def each_vertex(&b)\n @forward_edges_with_info.each_key(&b)\n end",
"def clip_map\n @nodes.each{|n| clip_intersection(n)}\n end",
"def each\n file_rec = next_candidate\n until file_rec.nil?\n yield file_rec\n\n file_rec = next_candidate\n end\n end",
"def each_object (&block)\n\n each_object_path do |path|\n block.call(load_object(path))\n end\n end",
"def each\r\n if block_given?\r\n @colours.each {|colour| yield colour}\r\n end\r\n end",
"def each_section\n @sections.each_value do | section |\n yield( section )\n end\n end",
"def cours_list\n @cours = Haiwet::Cour.list\n @cours.each.with_index(1) do |cour, i|\n puts \"#{i}- #{cour.name}\"\n end\n end",
"def each_cell(rect)\n (rect.top_left.left..rect.top_right.left).each do |left|\n (rect.top_left.top..rect.bottom_left.top).each do |top|\n yield left, top\n end\n end\nend",
"def segment_each(geojson)\n flatten_each(geojson) do |feature, feature_index|\n # Exclude null Geometries\n return if feature[:geometry].nil?\n\n # (Multi)Point geometries do not contain segments therefore they are ignored during this operation.\n type = feature[:geometry][:type]\n return if %w[Point MultiPoint].include?(type)\n\n segment_index = 0\n\n # Generate 2-vertex line segments\n previous_coords = nil\n previous_feature_index = 0\n coord_each(feature) do |current_coord|\n # Simulating a meta.coord_reduce() since `reduce` operations cannot be stopped by returning `false`\n if previous_coords.nil? || feature_index > previous_feature_index\n previous_coords = current_coord\n previous_feature_index = feature_index\n segment_index = 0\n next\n end\n\n segment = Turf.line_string([previous_coords, current_coord], properties: feature[:properties])\n next unless yield(segment, feature_index)\n\n segment_index += 1\n previous_coords = current_coord\n end\n end\n end",
"def each\n nodo = @principio\n while (nodo != nil)\n yield nodo.referencia\n nodo = nodo.siguiente\n end\n end",
"def each(&proc)\n @subtrees.each(&proc)\n end",
"def each\n @roots.each {|cert| yield cert}\n end",
"def each\n @roots.each {|cert| yield cert}\n end",
"def each_with_level(objects, &block)\n Iterator.new(objects).each_with_level(&block)\n end",
"def each(node, &block)\n visit(node, &block)\n end",
"def each\n @cells.each_with_index do |row, ir|\n row.each_with_index do |val, ic|\n yield ir, ic, val\n end\n end\n end",
"def each_CDS\n parse if !@cdslist\n each_item(@cdslist) { |id, recs, component | yield id, recs, component }\n end",
"def each\n \ti = 0\n \twhile hijos[i] != nil\n \t\tyield hijos[i]\n \t\ti += 1\n \tend\n \tend",
"def eachNode(&block)\n @topo.eachNode(&block) if !@topo.nil?\n end",
"def each_child(&_block)\n @children.each { |child| yield child }\n end"
] |
[
"0.60089713",
"0.5678124",
"0.559642",
"0.549338",
"0.52676505",
"0.5193994",
"0.5161028",
"0.5131451",
"0.50493115",
"0.5042759",
"0.50266737",
"0.4899071",
"0.48570544",
"0.48410073",
"0.4837293",
"0.48018655",
"0.4788069",
"0.47867218",
"0.47665426",
"0.47369778",
"0.47241673",
"0.4718557",
"0.4706699",
"0.4706699",
"0.46934637",
"0.46840596",
"0.46781686",
"0.46638283",
"0.46638283",
"0.4647269",
"0.4647269",
"0.4647269",
"0.4608014",
"0.4593427",
"0.45731708",
"0.45648247",
"0.4562154",
"0.45603117",
"0.45562696",
"0.4556213",
"0.45558304",
"0.45547253",
"0.45545498",
"0.45510194",
"0.45412168",
"0.45290402",
"0.45265436",
"0.45226088",
"0.45112118",
"0.45060685",
"0.4505078",
"0.45033896",
"0.45030078",
"0.4498104",
"0.44966003",
"0.44918412",
"0.4484467",
"0.44812438",
"0.4479601",
"0.44756714",
"0.4475537",
"0.44744495",
"0.44640142",
"0.4461941",
"0.44601828",
"0.445497",
"0.4454296",
"0.44516075",
"0.44495434",
"0.44483548",
"0.44464645",
"0.44415906",
"0.44297945",
"0.44290346",
"0.44114947",
"0.441058",
"0.44080737",
"0.44078964",
"0.44038698",
"0.44030452",
"0.4402115",
"0.4400779",
"0.43967947",
"0.4390447",
"0.43856823",
"0.43852833",
"0.43821013",
"0.43820933",
"0.43730155",
"0.43710086",
"0.43664834",
"0.43627942",
"0.43627942",
"0.43605924",
"0.43545812",
"0.4350812",
"0.43456525",
"0.43450347",
"0.43417892",
"0.43342954"
] |
0.7435681
|
0
|
Ask user for input Save vowels and consonants so that you can change to the next letter Swap first and last name by asking for each part of name and then adding it starting with last + first Make the translated code go into a new array Add a hash at the end to store the names
|
def alias_creator(nickname)
vowels="aeiou"
consonants="bcdfghjklmnpqrstvwxyz"
#consonants exclude all vowels
nickname_split=nickname.split("")
new_nickname=[]
#The translated nickname will be saved in the new_nickname arrawy
nickname_split.map! do |x|
if vowels.include?(x)
new_nickname << vowels[vowels.index(x)+1]
elsif consonants.include?(x)
new_nickname << consonants[consonants.index(x)+1]
elsif x == " "
new_nickname << " "
end
end
new_nickname.join("").split.map {|x| x.capitalize}.join(" ")
#We are doing this so that we capitalize the first letter of both words
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def namecoder\n valid_input = false\n until valid_input\n secret_name_database = []\n \n puts \"Whats your first name?\"\n fname = gets.chomp.downcase.split('')\n puts \"What's your last name?\"\n lname = gets.chomp.downcase.split('')\n original_name = [fname,\" \", lname].join\n fullname = [fname,\" \", lname].reverse.flatten\n # p fullname\n \n fullalphabet = \"abcdefghijklmnopqrstuvwxyz\"\n consonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']\n alpha = ['a', 'b', 'c', 'd', 'e', 'u', 'z']\n vowels = ['a', 'e', 'i', 'o', 'u']\n \n # vowel_code(original_name)\n vowels = ['a', 'e', 'i', 'o', 'u']\n fn_vowel = fullname.map do |vowel|\n if vowels.include?(vowel)\n vowels.rotate(1)[vowels.index(vowel)]\n else\n vowel\n end\n end\n # p fn_vowel \n # name_vowels_changed.join\n \n # def cons_code(name_vowels_changed)\n # name_vowels_changed = name_vowels_changed.split('')\n name_both_changed = fn_vowel.map do |cons|\n if consonants.include?(cons)\n consonants.rotate(1)[consonants.index(cons)]\n else\n cons\n end\n end\n # p name_both_changed\n secret_name = name_both_changed.join\n orig_fullname = fullname.join.capitalize\n secret_name_database << [original_name, secret_name]\n p original_name\n p secret_name\n \n puts \"Press enter if you'd like to do another name. Otherwise, type 'quit'.\"\n continue = gets.chomp\n if continue == \"quit\"\n puts \"Thank you for using the program. Here is your list of names:\"\n secret_name_database.each do |orig, secret|\n puts \"#{orig}'s secret name is #{secret}.\"\n end \n valid_input = true\n else\n puts \"Time to add another name...\"\n end \n end\nend",
"def alias_manager\nname = \"\"\nvowels = \"aeiou\"\nconsonants = \"bcdfghjklmnpqrstvwxyz\"\ninput = \"\"\nuser_input = []\ncapitalized_name_storage = []\ncounter = 0\n\nwhile input != \"quit\"\nputs \"What is your first and last name? Please separate with a space. Type 'quit' to exit.\"\ninput = gets.chomp\nif input == \"quit\"\n puts \"Thanks for using Alias Manager.\"\nelse\n user_input << input\n name = input.downcase.split(' ').reverse.join(' ')\n reverse_name = name\n split_reverse = reverse_name.chars\n new_name = \"\"\n split_reverse.map! do |letter|\n if letter == \" \"\n new_name += \" \"\n elsif letter.scan(/[aeiou]/).join == \"a\" ||\n letter.scan(/[aeiou]/).join == \"e\" ||\n letter.scan(/[aeiou]/).join == \"i\" ||\n letter.scan(/[aeiou]/).join == \"o\"\n index = vowels.index(letter)\n new_name += vowels[index + 1]\n elsif letter.scan(/[aeiou]/).join == \"u\"\n index = vowels.index(letter)\n new_name += \"a\"\n elsif letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"b\" || letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"c\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"d\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"f\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"g\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"h\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"j\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"k\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"l\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"m\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"n\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"p\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"q\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"r\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"s\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"t\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"v\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"w\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"x\" ||\n letter.scan(/[bcdfghjklmnpqrstvwxyz]/).join == \"y\"\n index = consonants.index(letter)\n new_name += consonants[index + 1]\n elsif letter == \"z\"\n new_name += \"b\"\n else\n p \"ERROR, UNRECOGNIZED CHARACTER\"\n end\n end\n\n capitalized_name_array = new_name.split(' ').map! {|name| name. capitalize}\n p capitalized_name = capitalized_name_array.join(' ')\n capitalized_name_storage << capitalized_name\nend\nend\nputs \"Summary:\"\nuser_input.each do |name|\n puts \"Name converted: #{name} is now #{capitalized_name_storage[counter]}.\"\n counter += 1\nend\nend",
"def name_converter(first_name, last_name)\n #1. swap the order names\n swapped_names = fake_name(first_name, last_name)\n #2 break swappedNames into array\n character_array = swapped_names.split('')\n #3. iterate through array\n vowel = [\"a\",\"e\",\"i\",\"o\",\"u\"]\n consonant = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\",\"y\",\"z\"]\n\n result = ''\n character_array.each do |character|\n if vowel.include?(character)\n #move forward next vowel in vowel array\n if character == 'u'\n result += 'a'\n next\n end \n \n current_index = vowel.index (character)\n new_index = current_index + 1\n #3. go to vowel array with new_index and retrieve that letter\n # next_letter = 'i'\n # add next_letter to result\n result += vowel[new_index]\n\n #follow same steps for moving forward next vowel for consonant \n\n elsif consonant.include?(character)\n if character == \"z\"\n result += 'b'\n next\n end\n\n current_index = consonant.index (character)\n new_index = current_index + 1\n\n result += consonant [new_index]\n\n result += character \n # add new letter to result\n end\n end\n #4. if the character is a vowel do a vowel swap\n #5. elsif the character is a consonant do a consonant swap\n \n result\nend",
"def alias_genrator\n done = false\n real_names = []\n spy_names = []\n\n puts \"Welcome to the super secret alias name generator. What is your full name?\"\n real_name = gets.chomp.downcase\n\n until done\n done = false\n\n real_name_array = real_name.split(' ') # Turn name into array\n\n real_first_name = real_name_array[0].capitalize # Gets and capitalizes first string in real_first_name\n real_last_name = real_name_array.last.capitalize # Gets and capitalizes last string in real_first_name\n\n real_names << real_first_name + \" \" + real_last_name # Stores real name to an array\n\n name_letters = real_name.split('') # Turns user input into array of letters\n\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\" ]\n\n index = 0\n name_letters.each do |letter| # Checks each letter in name_letters to see if the letter is in the vowels array\n if letter == \"u\"\n name_letters[index] = \"a\"\n elsif\n if vowels.include?(letter) # If it is, store the index of the vowel plus one\n vowel_index = vowels.index(letter)+1\n name_letters[index] = vowels[vowel_index] # Store the new letter in the corresponding index of name_letters\n end\n end\n index+=1\n end\n\n index = 0\n name_letters.each do |letter| # Checks each letter in name_letters to see if the letter is in the consonants array\n if letter == \"z\"\n name_letters[index] = \"b\"\n elsif\n if consonants.include?(letter) # If it is, store the index of the consonants plus one\n consonant_index = consonants.index(letter)+1\n name_letters[index] = consonants[consonant_index] # Store the new letter in the corresponding index of name_letters\n end\n end\n index+=1\n end\n\n new_full_name = name_letters.join('').split(' ') # Joins the new letters of name_letters and splits it into two strings\n\n # In case spy's real name includes a middle name\n first_name = new_full_name[0].capitalize # Gets and capitalizes first string in new_full_name\n last_name = new_full_name.last.capitalize # Gets and capitalizes last string in new_full_name\n\n alias_name = last_name + \" \" + first_name\n\n spy_names << alias_name # Stores alias into an array\n\n p \"Great, your cool new alias is #{alias_name}! Enter another name or type 'done' to exit.\"\n answer = gets.chomp.downcase\n\n if answer == \"done\" # Checks if user is done\n done = true\n else\n real_name = answer\n end\n end\n\n num_of_spies = real_names.length # Gets the number of spies\n counter = 0\n\n while counter < num_of_spies\n p \"#{spy_names[counter]} is really #{real_names[counter]}\" # Prints spies real names and aliases\n counter+=1\n end\nend",
"def make_up_name(name)\nchanged_name = [] #empty array to push letters from name into when it goes through iteration\nvowels = \"aeiou\"\n\nconsonant = \"bcdfghjklmnpqrstvwxyz\"\n\n\n#if the index of the name provided is a consonant then change it to the next letter.\n\nindex = 0 #start at 0\n \n while index < name.length\n \t\tletter = name[index] #takes every index of every letter in name and stores it in a variable\n \t\tif vowels.include?(letter) #deals with edge case\n \t\t\tif letter == \"u\"\n \t\t\t\tchanged_name.push(\"a\")\n \t\t\telse #need to make it so every other vowel changes to next vowel letter.next\n \t\t\tend\n \t\telsif consonant.inlcude?(letter)\n \t\t\tif letter == \"z\" #deals with edge case\n \t\t\t\tchanged_name.push(\"b\")\n \t\t\telse #everything else will need to be next letter using letter.next \t\t \t\t\n \t\t\tend\n \t\telsif letter == \" \"\n \t\t\t\tchanged_name.push(\" \")\n \t\t\tend\n \t\t \t index += 1\n \tend\nnew_name_array = changed_name.join('') #takes all the letters in the array above and puts it in a new array\nnew_name_array.each {|name| p name.capitalize}\nend",
"def alias\n puts \"Hello Agent, what is your name?\"\n original_name = gets.chomp.downcase\n\n# split first and last name into two arrays\n#swap first name and last name \n\n split_name = original_name.split\n reverse_name = split_name.reverse!\n \n #join back together in a string with a space\n new_name = reverse_name.join(\" \")\n \n\n# each character into it's own array\n\n letters = new_name.each_char.to_a\n#vowel logic\n#if a charcters = vowel then change to next vowel\n\n\n\n vowels = %w(a e i o u a)\n consonant = %w(b c d f g h j k l m n p q r s t v w x y z b)\n new_alias = letters.map do |letter|\n letter.next \n end\nputs new_alias.join('')\nend",
"def change_name(name)\r\n\t#store new name in new variable, downcase, split in an array and reverse order\r\n\tnew_name = name.downcase.split(' ').reverse.join(' ')\r\n\t#return the array of all the letters\r\n\t#p new_name\r\n\t#puts new_name.length\r\n\t#p new_name\r\n\talias_and_real_name = []\r\n\tindex = 0\r\n\tvowel_list = \"aeiou\"\r\n\tconsonant_list = \"bcdfghjklmnpqrstvwxyz\"\r\n\twhile index < new_name.length\r\n\t\t#[index] takes and integer and retunrs char, .index takes a char\r\n\t\t#and returns integer**\r\n\t\t#Does the letter at the # index of new_name match the vowel_list string\r\n\t\tif vowel_list.include?(new_name[index])\r\n\t\t\t#next_vowel_index is a #\r\n\t\t\t#it equals the vowel string at the letter index \r\n\t\t\t#from new_name's # index\r\n\t\t\t#Then get the next number\r\n\t\t\tnext_vowel_index = vowel_list.index(new_name[index]).next\r\n\t\t\t#new_name at that index # now equal this new # \r\n\t\t\t#Equals the vowel list at index of the next #\r\n\t\t\tnew_name[index] = vowel_list[next_vowel_index]\r\n\t\t\t\t#Solve for edge cases\r\n\t\t\t\t#If the letter is the name is going to be the last letter \r\n\t\t\t\t#in the vowel string, change it automatically to \r\n\t\t\t\t#the first on\r\n\t\t\r\n\t\t\t\r\n\t\telsif consonant_list.include?(new_name[index])\r\n\t\t\tnext_consonant_index = consonant_list.index(new_name[index]).next\r\n\t\t\tnew_name[index] = consonant_list[next_consonant_index]\r\n\r\n\t\tend #End if statement\r\n\t\t#Incriment outside of if statment but inside while loop\r\n\t\tindex += 1\r\n\t\r\n\tend #End While loop\r\n\r\n\t#return the new alias name\r\n\tnew_name\r\n\t\r\n\t#Take the alias name and stoe it in an array, new name first and real \r\n\t#name second\r\n\talias_and_real_name << new_name << name\r\n\t\r\n#End method\t\t\r\nend",
"def name_change(normal_name)\nvowels = \"aeiouAEIOU\".split(\"\")\nconsonants = \"bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ\".split(\"\")\n\nchanged_name = normal_name.split(\" \")\nchanged_name[0], changed_name[1] = changed_name[1], changed_name[0]\n split_name = changed_name.join(\" \")\nname = split_name.split(\"\")\n\nnew_name = \"\"\nname.each_with_index do |letter, letter_index|\n if vowels.include?(letter)\n vowels.each_with_index do |vowel, vowel_index|\n if letter === vowel\n if letter === \"u\"\n new_name << \"a\"\n elsif letter === \"U\"\n new_name << \"A\"\n else\n new_name << vowels[vowel_index+1]\n end\n end\n end\nend\n if consonants.include?(letter)\n consonants.each_with_index do |consonant, consonant_index|\n if letter === consonant\n if letter === \"z\"\n new_name << \"b\"\n elsif letter === \"Z\"\n new_name << \"B\"\n else\n new_name << consonants[consonant_index+1]\n end\n end\n end\nend\n if letter === \" \"\n new_name << \" \"\n end\n end\n new_name\nend",
"def aliass(full_name)\n alphabet = \"bcdfghjklmnpqrstvwxyz\"\n vowels = \"aeiou\"\n new_string = \"\"\n \n #break input word into array and iterate through each letter\n #if the letter is a vowel, take it and change it to next_vowel\n #if the letter is a consonant, take it and change it to consonant\n #else just add with no modification\n full_name.split('').each do |letter|\n if vowels.include?(letter)\n new_string += vowel(letter)\n elsif alphabet.include?(letter)\n new_string += consonant(letter)\n else\n new_string += letter\n end\n end\n #transform this new string into an array\n new_word = new_string.split(' ')\n #swap first and second word in array\n new_word.reverse!\n #turn new word into string\n new_word.map {|names| names.capitalize!}\n new_string = new_word.join(\" \")\n end",
"def aliass(full_name)\n\talphabet = \"bcdfghjklmnpqrstvwxyz\"\n\tvowels = \"aeiou\"\n\tnew_string = \"\"\n\n full_name.split('').each do |letter|\n \t\tif vowels.include?(letter)\n \t\t\tnew_string += vowel(letter)\n \t\telsif alphabet.include?(letter)\n \t\t\tnew_string += consonant(letter)\n \t\telse\n \t\t\tnew_string += letter\n \t\tend\nend\n#Transform this new string into an array\n#Swap first and second word in array\n#Turn new word into string\n#Create empty array outside of loop\nnew_word = new_string.split(' ')\n new_word.reverse!\n\nnew_word.map {|names| names.capitalize!}\nnew_string = new_word.join(\" \")\nend",
"def name_scrambler\r\n\t\r\n\r\n\tscrambled_names = {}\r\n\tputs \"What is your first and last name?\"\r\n\tuser_name = gets.chomp \r\n\twhile user_name != \"quit\" && user_name != \"\" \r\n\t\tnew_name = user_name.downcase.split(' ').reverse!.join(' ')\r\n\t\tname_to_array = new_name.chars\r\n\t\t# This takes the string version of the name and makes it into an \tarray, with each letter separated. \r\n\t\tconsonants = %w{b c d f g h j k l m n p q r s t v w x y z}\r\n\t\tvowels = %w{a e i o u}\r\n\t\t# Setting the new strings we want our conditions to match\r\n\t\tname_to_array.map! do |letter| \r\n\t\t\tif letter == \"u\"\r\n\t\t\t\tletter = \"a\"\r\n \t\t\telsif vowels.include?(letter)\r\n \t\t\t\t# if the letter returns a true value(is a vowel), re\t-assign a new index to that letter (advanced by 1)\r\n \t\t\t\tnew_vowel_index = vowels.index(letter) + 1\r\n \t\t\t\tnew_vowel = vowels[new_vowel_index]\r\n\t\t\telsif letter == \"z\"\r\n\t\t\t\tletter = \"b\"\r\n\t\t\telsif consonants.include?(letter)\r\n\t\t\t\tnew_consonant_index = consonants.index(letter) + 1\r\n\t\t\t\tnew_consonant = consonants[new_consonant_index]\r\n\t\t\telse \r\n\t\t\t\tletter # Accounts for spaces\r\n\t\t\tend\t\t\r\n\t\tend\r\n\t\t#re capitalize by joining the indiv. letters, splitting into first \tand last, capitalizing, and rejoining\r\n\t\tscrambled_name = name_to_array.join('').split(\" \").each{|i| i\t.capitalize!}.join(\" \")\r\n\t\tscrambled_names[user_name] = scrambled_name\r\n\t\tuser_name = gets.chomp #assigns new input to user_name to see if it should loop back to begining or quit\r\n\t\tend \r\nscrambled_names.each do |user_name, scrambled_name|\r\n\tputs \"#{scrambled_name} is more commonly known as #{user_name}\"\r\nend \r\nend",
"def alias_generator(name)\n\nname = name.downcase\n\nvowels_lowcase = %w(a e i o u)\nvowels = vowels_lowcase\nconsonants_lowcase = (\"a\"..\"z\").to_a - vowels\nconsonants = consonants_lowcase\n\n# original = (vowels + consonants)\n# new_letters = (vowels.rotate + consonants.rotate)\n\nname_array = name.split\nname_reverse = name_array.reverse\n\nname_reverse.map! do |word|\n word_split = word.split(\"\")\n # name_reverse[1].split(\"\")\n\n word_split.map! do |letter|\n if vowels.include? letter\n index = vowels.index(letter)\n if letter == vowels.last\n letter = vowels.first\n else\n letter = vowels[index + 1]\n end\n else\n index = consonants.index(letter)\n if letter == consonants.last\n letter = consonants.first\n else\n letter = consonants[index + 1]\n end\n end\n end\n\n word_split[0] = word_split[0].upcase\n word_split.join('')\nend\n\nname_reverse.join(' ')\n# # p name_reverse.tr(original,new_letters)\n\n\n\nend",
"def vowels_consonant_movement2(name)\n name = name.downcase.split(\" \")\nfirst_name = name[0]\nsecond_name = name[1]\n consonants = \"bcdfghjklmnpqrstvwxyz\"\n vowels = \"aeiou\"\n translated_name = []\n translated_name2 = []\n\n#adjust first name \n x = 0 \n while x < first_name.length\n if first_name[x] == \"z\"\n first_name[x] = \"b\"\n translated_name << first_name[x]\n elsif\n first_name[x] == \"u\"\n first_name[x] = \"a\"\n translated_name << first_name[x]\n \n elsif consonants.include?first_name[x]\n \n new_position = consonants.index(first_name[x]) + 1 \n \n first_name[x] = consonants[new_position]\n translated_name << first_name[x]\n \n elsif vowels.include?first_name[x]\n newer_position = vowels.index(first_name[x]) + 1\n first_name[x] = vowels[newer_position]\n translated_name << first_name[x]\n \n end\n \n x += 1\n end\n \n#adjust second name \n x = 0 \n while x < second_name.length\n if second_name[x] == \"z\"\n second_name[x] = \"b\"\n translated_name2 << second_name[x]\n elsif\n second_name[x] == \"u\"\n second_name[x] = \"a\"\n translated_name2 << second_name[x]\n \n elsif consonants.include?second_name[x]\n \n new_position = consonants.index(second_name[x]) + 1 \n \n second_name[x] = consonants[new_position]\n translated_name2 << second_name[x]\n \n elsif vowels.include?second_name[x]\n newer_position = vowels.index(second_name[x]) + 1\n second_name[x] = vowels[newer_position]\n translated_name2 << second_name[x]\n \n end\n \n x += 1\n end\n \n first_letter = translated_name[0].upcase\n translated_name.delete_at(0)\n translated_name.insert(0, first_letter)\n \n first_letter2 = translated_name2[0].upcase\n translated_name2.delete_at(0)\n translated_name2.insert(0, first_letter2)\n \n return translated_name2.join(\"\") + \" \" + translated_name.join(\"\")\n \n \nend",
"def name_swapper(full_name)\n full_name = full_name.downcase\n vowel_array = ['a','e','i','o','u']\n consenant_array = \"bcdfghjklmnpqrstvwxyz\".split('')\n name_array = full_name.split(\" \")\n reversed_name= \"#{name_array[1]} #{name_array[0]}\"\n secret_name = reversed_name.split('').map! do |letter|\n if vowel_array.include?(letter)\n vowel_array[vowel_array.index(letter)+1]\n elsif consenant_array.include?(letter)\n consenant_array[consenant_array.index(letter)+1]\n elsif letter == \" \"\n \" \"\n end\n\n end\n puts \"Your name USED to be #{full_name.upcase}...but now your name is #{secret_name.join.upcase}!\"\n secret_name.join.upcase\nend",
"def alias_creator(full_name)\n full_name = full_name.downcase\n name = full_name.split(' ').to_a\n first_name = name[0]\n last_name = name[1]\n first_name_letters = first_name.split('')\n last_name_letters = last_name.split('')\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\", \"a\"]\n consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\", \"b\"]\n \n first_name_letters.map! do |letter|\n if vowels.include?(letter)\n letter_index = vowels.index(letter)\n new_letter_index = letter_index + 1\n letter = vowels[new_letter_index]\n elsif consonants.include?(letter)\n letter_index = consonants.index(letter)\n new_letter_index = letter_index + 1\n letter = consonants[new_letter_index]\n end\n end\n new_first_name = first_name_letters.join('').capitalize\n \n last_name_letters.map! do |letter|\n if vowels.include?(letter)\n letter_index = vowels.index(letter)\n new_letter_index = letter_index + 1\n letter = vowels[new_letter_index]\n elsif consonants.include?(letter)\n letter_index = consonants.index(letter)\n new_letter_index = letter_index + 1\n letter = consonants[new_letter_index]\n end\n end\n new_last_name = last_name_letters.join('').capitalize\n\n new_name = new_last_name + \" \" + new_first_name\n return new_name\n \nend",
"def aliass(full_name)\n\talphabet = \"bcdfghjklmnpqrstvwxyz\"\n\tvowels = \"aeiou\"\n\tnew_string = \"\"\n\n\t#break input word into array and iterate through each letter\n\t#if the letter is a vowel, take it and change it to next_vowel\n\t#if the letter is a consonant, take it and change it to consonant\n\t#else just add with no modification\n\tfull_name.split('').each do |letter|\n\t\tif vowels.include?(letter)\n\t\t\tnew_string += vowel(letter)\n\t\telsif alphabet.include?(letter)\n\t\t\tnew_string += consonant(letter)\n\t\telse\n\t\t\tnew_string += letter\n\t\tend\n\tend\n\t#transform this new string into an array\n\tnew_word = new_string.split(' ')\n\t#swap first and second word in array\n\tnew_word.reverse!\n\t#turn new word into string\n\tnew_word.map {|names| names.capitalize!}\n\tnew_string = new_word.join(\" \")\nend",
"def alias_creator (str)\n# downcase all characters incase the name had initial caps.\nstr = str.downcase\t\n\n# create vowel string for cross checking each character (I ADDED 3 REPEATING VOWEL SEGMENTS TO PREVENT EDGE CASE FROM BREAKING WHEN ENCODING A VOEWEL AT THE END OF THE STRING LIKE U in \"AEIOU\") \nvowels = \"aeiouaeiouaeiou\"\n# create consonant string for cross checking each character\nconsonants = \"bcdfghjklmnpqrstvwxz\"\n# create empty strings that encoded first and last names will be stored in.\nname_alias = \"\"\n# create empty string to create an encoded full name \nspy_alias = \"\"\n=begin encoding names \n 1.taking the first name string and iterate through each character \n 2. check if vowels string includes current character in first name string\n 3. if it does access the letter in vowels string by its index, increment that index by one\n add that new letter to the alias string. \n 4. if the current character is a consonant it will go through the same process but using the consonants string\n 5. if the current character is a space a space will be added to the encoded string. \n=end\n \n str.each_char do |char| \n \tif char == \" \"\n name_alias+= \" \"\n\n \telsif vowels.include?(char)\n \t\tname_alias += vowels[vowels.index(char).next]\n \n elsif consonants.include?(char)\n \tname_alias += consonants[consonants.index(char).next]\n\n \n\n end \n \t\n end\n # check if the string that was encoded was a full name or just a first or last name\n # if it is a full name. sperate the first and last name and reverse the order (Lastname Firstname)\n \n if name_alias.include?(\" \")\n swap_name = name_alias.split(\" \")\n spy_alias = swap_name[1] + \" \" +swap_name[0]\n else spy_alias = name_alias\n end \n \n \n return spy_alias\n\n\nend",
"def alias_creator(name)\n name.downcase!\n name_array = name.split(' ')\n name_array.reverse!\n # insert method for changing vowels here\n post_vowels = next_vowel(name_array)\n # insert method for changing consonants here#\n new_name = next_consonant(post_vowels)\n # re-capitalize the first letter of each name\n new_name.map! {|word| word.capitalize}\n # take our array and turn it into a string\n puts \"Your automatically generated alias is:\"\n p new_name * \" \"\nend",
"def spy_alias1 full_name\n alias_name = full_name.downcase.split(' ').reverse!.join(' ').split(//)\n vowels=['a','e','i','o','u']\n alias_name.map! do |letter|\n next_vowel=letter\n vowels.each_index do |index|\n if vowels[index]=='u'&&letter==vowels[index]\n next_vowel='a'\n elsif letter==vowels[index]\n next_vowel=vowels[index+1]\n end\n end\n next_vowel\n end\n \n consonants=['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']\n alias_name.map! do |letter|\n next_consonant=letter\n consonants.each_index do |index|\n if consonants[index]=='z'&&letter==consonants[index]\n next_consonant='b'\n elsif letter==consonants[index]\n next_consonant=consonants[index+1]\n end\n end\n next_consonant\n end\n \n alias_name=alias_name.join('').split(' ').map! {|name| name.capitalize}.join(' ')\nend",
"def spy_name(str)\n #CREATE VARIABLES FOR VOWELS AND CONSONANTS\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n #CHANGE STRING FIRST INTO ARRAY THAT MAKES EACH WORD A VALUE THEN REVERSE THEM. \n #THEN TURN ARRAY BACK INTO STRING AND DOWNCASE ANY LETTER.\n #THEN TURN STRING BACK INTO ARRAY THAT TAKES EACH INDIVIDUAL CHARACATER AS A VALUE.\n str = str.split(' ').reverse.join.downcase\n str = str.split('')\n #CREATE TEMPORARY VARIABLE STR_NEW TO EQUEL STR THEN CHANGE BUMP EACH \n #VOWEL AND CONSONANT TO THE NEXT ONE IN LINE. \n str_new = str.map do |char|\n if vowels.include?(char)\n vowels.rotate(1)[vowels.index(char)]\n elsif consonants.include?(char)\n consonants.rotate(1)[consonants.index(char)]\n else\n char\n end\n end\n #TURN ARRAY BACK INTO STRING.\n str_new.join\nend",
"def spy_alias2 full_name\n alphabet = {\n vowels: ['a','e','i','o','u'],\n consonants: ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']\n }\n alias_name = full_name.downcase.split(' ').reverse!.join(' ').split(//)\n alias_name.map! do |letter|\n next_letter=letter\n if alphabet[:vowels].include?(letter)\n index=alphabet[:vowels].index(letter)\n if letter==alphabet[:vowels][-1]\n next_letter=alphabet[:vowels][0]\n else\n next_letter=alphabet[:vowels][index+1]\n end\n elsif alphabet[:consonants].include?(letter)\n index = alphabet[:consonants].index(letter)\n if letter==alphabet[:consonants][-1]\n next_letter=alphabet[:consonants][0]\n else\n next_letter=alphabet[:consonants][index+1]\n end\n end\n next_letter\n end\n alias_name=alias_name.join('').split(' ').map! {|name| name.capitalize}.join(' ')\nend",
"def vowel_converter(swapped_name)\r\n\t# Forces all letters to be lower case in order for code to work properly\r\n\tcode_name = swapped_name.downcase.chars\r\n\tvowels = %w{a e i o u}\r\n\tcode_name.map! do |letter|\r\n\t\t# Edge case fix to make code work as intended\r\n\t\tif letter == \"u\"\r\n\t\t\tletter = \"a\"\r\n\t\telsif vowels.include?(letter)\r\n\t\t\tvowels[vowels.index(letter) + 1]\r\n\t\telse\r\n\t\t\tletter\r\n\t\tend\r\n\tend\r\n\t# This re-capitalizes the first letter of each part of the name\r\n\tcode_name.join('').split.map(&:capitalize).join(' ')\r\nend",
"def letter_change\n consonant = \"bcdfghjklmnpqrstvwxyz\"\n vowel = \"aeiou\"\n new_name = \"\"\n letter_new = \"\"\n\n split_flip_name.each do |letter|\n if consonant.index(letter) != nil\n letter_new = consonant[consonant.index(letter) + 1]\n elsif vowel.index(letter) != nil\n #addresses last vowel edge case\n if letter == \"u\"\n letter_new = \"a\"\n elsif\n letter_new = vowel[vowel.index(letter) + 1]\n end\n elsif letter == \" \"\n letter_new = letter\n end\n #.to_s addresses a nil edge case\n new_name += letter_new.to_s\n end\n p new_name\n\nend",
"def name_handler(name)\n name = name.downcase.chars #takes the input and makes it downcase and breaks it into an array to increment through\n name_new = name.map do |letter| #create a new array called name_new and start block to increment through each array\n letter_change(letter)\n end\n #Code addressing capitalization and swapping first / last\n namearr = name_new.join('').split #join the new_name array back into a string\n p namearr\n first_name = namearr[0] #assign first name to a new variable based on index\n last_name = namearr[1] #assign first name to a new variable based on index\n name_new = last_name.capitalize! + \" \" + first_name.capitalize! #capitalize and swap first for last\nend",
"def name_swap(name)\n new_name = name.downcase.split(' ')\n spy_name = new_name[1] + ' ' + new_name[0]\n vowels = 'aeioua'\n consonants = 'bcdfghjklmnpqrstvwxyzb'\n new_letter = \"\"\n spy_name.chars.each do |letter|\n if vowels.include?(letter)\n new_letter += change_vowels(letter)\n #p new_letter\n elsif consonants.include?(letter)\n new_letter += change_consonant(letter)\n #p new_letter\n else\n new_letter += letter\n end\n end\n change_name = new_letter.split(' ')\n final_name = change_name.map{|name| name.capitalize}.join(' ')\n# Add a hash to store names and alias names\n alias_names = { name: name, encrypted_name: final_name}\n alias_names.store(:name, name)\n alias_names.store(:encrypted_name, final_name)\n return alias_names\n end",
"def change_name(name)\n # swapes names\n name = name.split(' ').reverse.join(' ')\n\n #change all consonant's\n name = name.downcase.split('').map do |l|\n if l.match(/[a,e,i,o,u,\\s]/)\n l = l\n #account for edge case\n elsif l == \"z\"\n l = \"b\"\n else\n l = l.next\n #fixes consonant's that changed into vowels\n if l.match(/[a,e,i,o,u]/)\n l.next\n else\n l = l\n end\n end\n end\n#Loop through vowles\n for i in 0..name.length()-1\n case name[i]\n when \"a\"\n name[i] = \"e\"\n when \"e\"\n name[i] = \"i\"\n when \"i\"\n name[i] = \"o\"\n when \"o\"\n name[i] = \"u\"\n when \"u\"\n name[i] = \"a\"\n end\n end\nname = name.join()\nname = name.split.map(&:capitalize).join(' ')\nputs name\nname\nend",
"def alias_manager(name)\n name = name.downcase\n name = name.split(\" \").reverse.join(\" \")\n name = name.split(\"\")\n index = 0\n consonant = \"bcdfghjklmnpqrstvwqyz\"\n vowel = \"aeiou\"\n while index < name.length\n if\n !consonant.index(name[index]) && !vowel.index(name[index])\n elsif\n index_of_letter = vowel.index(name[index])\n new_letter = vowel[index_of_letter + 1]\n name[index] = new_letter\n else\n index_of_letter = consonant.index(name[index])\n new_letter = consonant[index_of_letter + 1]\n name[index]= new_letter\n end\n index += 1\n end\n name.join(\"\")\nend",
"def advance(string)\n\n vowels_str = 'aeioua'\n vowels_arr = vowels_str.split('')\n consonants_str = 'bcdfghjklmnpqrstvwxyzb'\n consonants_arr = consonants_str.split('')\n \n string0 = string.downcase.split[1] + \" \" + string.downcase.split[0]\n str1 = string0.split('')\n\n str_new = str1.map do |char|\n if vowels_arr.include?(char)\n vowels_arr.rotate(1)[vowels_arr.index(char)]\n elsif consonants_arr.include?(char)\n consonants_arr.rotate(1)[consonants_arr.index(char)]\n else\n char\n end\n end\n\n newname = str_new.join #joining the array into a string\n spyname = newname.split.map(&:capitalize).join(' ') #splitting that string to capitalize the first letter, then rejoining\n p spyname\n realname = string.split.map(&:capitalize).join(' ')\n $codenames << [spyname, realname]\nend",
"def spy_name_map(str)\n# reverse first and last name\n\t# str = str.downcase\n\tsplit_name = str.split(' ')\n\treverse_name = split_name.reverse\n\tspy_name = reverse_name.join(' ')\n\tstored_names = []\n\nletters = spy_name.split('')\ni = 0\n\n\tletters.map! { |letter| letter.next }\n\tspy_final = letters.join('')\n# if spy_final.include? '!'\nspy_final = spy_final.gsub!('!', ' ')\n\tstored_names << spy_final\n\tp spy_final\nend",
"def fake_name(name)\n\n name_array = name.split('')\n\n name_array.map! do |letter|\n vowels = ['a','e','i','o','u', 'a']\n i = 0\n until i>vowels.length\n if i == 5\n letter = letter.next\n if vowels.include?(letter.downcase)\n letter = letter.next\n end\n break\n elsif letter.downcase == vowels[i]\n letter = vowels[i+1]\n break\n elsif letter.downcase == \" \"\n break\n else\n i += 1 \n end \n end\n letter\n end\n\n p name_array \n\n final_name = name_array.join.split(' ')\n\n final_name.map! do |letter|\n letter.capitalize\n end\n\n final_name2 = final_name.rotate.join(' ')\n\n return final_name2\n\nend",
"def change_name(name)\n\t\t# create alphabet range\n\t\tvowels = 'aeiou'\n\t\tvowel_change = vowels.split('').reverse\n\t\tconsonants = 'abcdefghijklmnopqrstuvwxyz'\n\t\tconsonant_change = consonants.delete('aeiou').split('').reverse\n\n\t\toriginal_name = name\n\t\tname_reverse = original_name.downcase.split.reverse.join('').split('')\n\n\n\t\tnew_name = name_reverse.map do |letter|\n\t\t\tif vowels.include?(letter)\n\t\t\t\tvowel_change[vowel_change.index(letter)-1]\n\t\t\telsif consonants.include?(letter)\n\t\t\t\tconsonant_change[consonant_change.index(letter)-1]\n\t\t\telse\n\t\t\t\tletter\n\t\t\tend\nend\n\nfinal_name = new_name.join.split.map { |name| name.capitalize}.join('')\nend",
"def create_alias(real_name)\n\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\",\n \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\",\n \"v\", \"w\", \"x\", \"y\", \"z\"]\n\n # takes the real name, splits into words, reverses the order, joins into string again, and lowercases\n reversed_lowcase_str = real_name.split(\" \").reverse.join(\" \").downcase\n name_char_array = reversed_lowcase_str.chars\n fake_name_char_arr = name_char_array.map! do |letter|\n if letter == \" \"\n letter\n elsif letter == \"u\"\n letter = \"a\"\n elsif letter == \"z\"\n letter = \"b\"\n elsif vowels.include?(letter)\n letter = vowels[vowels.index(letter) + 1] # assigns the letter to be the next vowel\n elsif consonants.include?(letter)\n letter = consonants[consonants.index(letter) + 1]\n end\n end\n\n# rejoins the character array into one string, splits it into word array,\n# capitalizes each word, rejoins into string\n fake_name = fake_name_char_arr.join(\"\").split(\" \").map!{|name| name.capitalize}.join(\" \")\nend",
"def fake_name (full_name)\n words_array = full_name.split (\" \")\n swap_name_array = words_array.reverse\n swap_name = swap_name_array.join(\" \")\n letters = swap_name.chars\n fake_letters = []\n letters.each do |letter|\n vowel = %w[a A e E i I o O u U]\n if vowel.include?(letter)\n fake_letters << next_vowel(letter)\n elsif letter == \" \"\n fake_letters << \" \"\n else\n fake_letters << next_unvowel(letter)\n end\nend\n return fake_letters.join (\"\")\nend",
"def letter_swap(agent_name)\n vowels = \"aeiou\"\n consonants = \"bcdfghjklmnpqrstvwxyz\"\n letter_swap = agent_name.split(\"\")\n secret_name = []\n letter_swap.map! do |ltr|\n if vowels.include?(ltr)\n secret_name << vowels[vowels.index(ltr)+1]\n elsif consonants.include?(ltr)\n secret_name << consonants [consonants.index(ltr)+1]\n else\n puts \" \"\n end\n end\n\n secret_name.join(\"\").split.map {|ltr| ltr.capitalize}.join(' ').capitalize\n\nend",
"def name_muddler (array)\nvowels = [\"a\",\"e\",\"i\",\"o\",\"u\"]\nconsonants = \"bcdfghjklmnpqrstvwxyz\"\nconsonant_array = consonants.chars \nnew_name = []\nindex = 0\nwhile index < array.length\n if array[index] == \"u\"\n new_name[index] = \"a\"\n elsif vowels.include?(array[index])\n new_name[index] = vowels[vowels.index(array[index]).next]\n elsif array[index] == \"z\"\n new_name[index] = \"b\"\n else new_name[index] = consonant_array[consonant_array.index(array[index]).next]\n end\n index += 1\nend \nreturn new_name\nend",
"def alias_generator(name)\n name_ord_reversed = name.split(' ').reverse\n name_ord_reversed = name_ord_reversed.join(\" \")\n name_ord_reversed = name_ord_reversed.split('')\n p name_ord_reversed\n vowels = \"aeiou\"\n vowels_array = vowels.split('')\n p vowels_array\n consonants = \"bcdfghjklmnpqrstvwxyz\"\n consonants_array = consonants.split('')\n p consonants_array\n index = 0 \n until index >= name.length do\n new_alias = []\n letter = name_ord_reversed[index]\n if letter == \" \"\n new_alias << letter\n elsif vowels.include? letter\n new_letter = vowels[index+1]\n new_alias << new_letter\n elsif consonants.include? letter\n new_letter = consonants[index+1]\n new_alias << new_letter\n end \n index += 1 \n end \n \n \n \n\n \nend",
"def spy_name(real_name) ####Still in progress...######\nnew_name = real_name.downcase\nadjust = new_name.split(' ')\nfirst_n = adjust[0].split('')\nlast_n = adjust[1].split('')\n\n\tindex = 0\n\tuntil index == first_n.last\n\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n\t\t\tif first_n[index] == [\"a\", \"e\", \"i\", \"o\"]\n\t\t\t\tfirst_n[index] = vowels.next\n\t\t\telsif first_n[index] == \"u\"\n\t\t\t\tfirst_n[index] = \"a\"\n\t\t\telsif first_n[index] == \"z\"\n\t\t\t\tfirst_n[index] = \"b\"\n\t\t\telse first_n[index].next\n\t\t\t\tfirst_n[index] = first_n[index].next\n\t\tend\n\t\tindex += 1\n\tend\n#don't forget to return the method\n\tindex = 0\n\tuntil index == last_n.last\n\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n\t\t\tif last_n[index] == [\"a\", \"e\", \"i\", \"o\"]\n\t\t\t\tlast_n[index] = vowels.next\n\t\t\telsif last_n[index] == \"u\"\n\t\t\t\tlast_n[index] = \"a\"\n\t\t\telsif last_n[index] == \"z\"\n\t\t\t\tlast_n[index] = \"b\"\n\t\t\telse last_n[index].next\n\t\t\t\tlast_n[index] = last_n[index].next\n\t\tend\n\t\tindex += 1\n\tend\n\n\nend",
"def translate(input)\n\tinputArray = input.downcase.split(\" \")\n\tanswerArray = []\n\tvowelList = [\"a\", \"e\", \"i\", \"o\", \"u\", \"y\"]\n\tcurrentWordNum = 0\n\tcurrentLetterNum = 0\n\tnumberOfWords = inputArray.length - 1\n\tcurrentWordStr = inputArray[currentWordNum].to_s\n\tcurrentWordLength = currentWordStr.length - 1\n\tcurrentLetterStr = inputArray[currentWordNum][currentLetterNum].to_s\n\n\twhile currentWordNum <= numberOfWords\n\n\t\twhile currentLetterNum <= currentWordLength\n\n\t\t\t#if vowelList.include? currentLetterStr == true\n\t\t\tif currentLetterStr.among?vowelList\n\n\t\t\t\tpreviousLetterNum = currentLetterNum - 1\n\t\t\t\tpreviousLetterStr = inputArray[currentWordNum][previousLetterNum].to_s\n\n\t\t\t\tif currentLetterNum == 0\n\t\t\t\t\tcurrentWordStr = inputArray[currentWordNum].to_s\n\t\t\t\t\t\n\t\t\t\t\tnewWordStr = currentWordStr + \"ay\"\n\t\t\t\t\tputs \"newWordStr = \" + newWordStr\n\t\t\t\t\t\n\t\t\t\t\tanswerArray = answerArray.push newWordStr\n\t\t\t\t\tputs \"answerArray = \" + answerArray.to_s\n\n\t\t\t\t\tcurrentLetterNum = currentWordLength + 1\n\n\t\t\t\telsif previousLetterStr == \"q\"\n\t\t\t\t\t#quiet = ietquay\n\t\t\t\t\tcurrentWordStr = inputArray[currentWordNum].to_s\n\t\t\t\t\t\n\t\t\t\t\ttempLetterNum = currentLetterNum + 1\n\t\t\t\t\tnewWordPrefix = currentWordStr[tempLetterNum..currentWordLength]\n\t\t\t\t\t\n\t\t\t\t\tnewWordSuffix = currentWordStr[0..currentLetterNum]\n\n\t\t\t\t\tputs \"newWordPrefix = \" + newWordPrefix\n\t\t\t\t\tputs \"newWordSuffix = \" + newWordSuffix\n\t\t\t\t\t\n\t\t\t\t\tnewWordStr = newWordPrefix + newWordSuffix + \"ay\"\n\t\t\t\t\tputs \"newWordStr = \" + newWordStr\n\t\t\t\t\t\n\t\t\t\t\tanswerArray = answerArray.push newWordStr\n\t\t\t\t\tputs \"answerArray = \" + answerArray.to_s\n\n\t\t\t\t\tcurrentLetterNum = currentWordLength + 1\n\n\t\t\t\telse\n\t\t\t\t\tcurrentWordStr = inputArray[currentWordNum].to_s\n\t\t\t\t\t\n\t\t\t\t\tnewWordPrefix = currentWordStr[currentLetterNum..currentWordLength]\n\t\t\t\t\ttempLetterNum = currentLetterNum - 1\n\t\t\t\t\tnewWordSuffix = currentWordStr[0..tempLetterNum]\n\t\t\t\t\t\n\t\t\t\t\tnewWordStr = newWordPrefix + newWordSuffix + \"ay\"\n\t\t\t\t\tputs \"newWordStr = \" + newWordStr\n\t\t\t\t\t\n\t\t\t\t\tanswerArray = answerArray.push newWordStr\n\t\t\t\t\tputs \"answerArray = \" + answerArray.to_s\n\n\t\t\t\t\tcurrentLetterNum = currentWordLength + 1\n\t\t\t\tend\n\n\t\t\telse\n\n\t\t\t\tcurrentLetterNum = currentLetterNum + 1\n\t\t\t\tcurrentLetterStr = inputArray[currentWordNum][currentLetterNum].to_s\n\n\t\t\tend\n\n\t\tend\n\n\t\tcurrentWordNum = currentWordNum + 1\n\n\t\tif currentWordNum > numberOfWords\n\t\t\tbreak\n\t\tend\n\n\t\tcurrentWordStr = inputArray[currentWordNum].to_s\n\t\t# puts \"currentWordStr = \" + currentWordStr.to_s\n\n\t\tcurrentWordLength = currentWordStr.length - 1\n\t\t# puts \"currentWordLength = \" + currentWordLength.to_s\n\t\tcurrentLetterNum = 0\n\t\tcurrentLetterStr = inputArray[currentWordNum][currentLetterNum].to_s\n\n\tend\n\n\tanswer = answerArray.join(' ')\n\tputs answer\n\treturn answer\nend",
"def encrypt_name(name)\n\n\t\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n\t\tconsonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"i\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n\t\talias_name = \"\"\n\t\t\t\n\t\t\tname.each_char do |letter|\n\t\t\t# if the letter is inside the array called vowels\n\t\t\t\tif vowels.include?(letter)\n\t\t\t\t\t# replace the letter with the next vowel in the array\n\t\t\t\t\t# put it into alias_name\n\t\t\t\t\talias_name << vowels[vowels.index(letter)+1]\n\t\t\t\t# replace the letter with the next consonant in the array\n\t\t\t\t# put it into alias_name\n\t\t\t\telsif consonants.include?(letter)\n\t\t\t\t\talias_name << consonants[consonants.index(letter)+1]\n\t\t\t\t# put letter into alias_name\n\t\t\t\t# this is for the spaces\t\n\t\t\t\telse\n\t\t\t\t\talias_name << letter\t\n\t\t\t\tend\n\t\t\tend\n\t\t\n\t\talias_name.split.reverse.map(&:capitalize)*' '\n\nend",
"def name_to_alias(string)\n #--variables to be used inside the while loop--#\n vowels_downcase = \"aeiou\"\n vowels_downcase_array = vowels_downcase.split('')\n vowels_upcase = \"AEIOU\"\n vowels_upcase_array = vowels_upcase.split('')\n consonants_downcase = \"bcdfghjklmnpqrstvwxyz\"\n consonants_downcase_array = consonants_downcase.split('')\n consonants_upcase = \"BCDFGHJKLMNPQRSTVWXYZ\"\n consonants_upcase_array = consonants_upcase.split('')\n #--loop that iterates through and modifies a string--#\n alias_string = \"\"\n count = 0\n while count < string.length\n if string[count] == \" \"\n alias_string[count] = \" \"\n count +=1\n elsif string[count].downcase == \"z\"\n if string[count] == \"z\"\n alias_string[count] = \"b\"\n else\n alias_string[count] = \"B\"\n end\n count += 1\n elsif string[count].downcase == \"u\"\n if string[count] == \"u\"\n alias_string[count] = \"a\"\n else\n alias_string[count] = \"A\"\n end\n count += 1\n elsif vowels_downcase_array.include? string[count]\n converted = vowels_downcase.index(string[count]) + 1\n alias_letter = vowels_downcase[converted]\n alias_string[count] = alias_letter\n count += 1\n elsif consonants_downcase_array.include? string[count]\n converted = consonants_downcase.index(string[count]) + 1\n alias_letter = consonants_downcase[converted]\n alias_string[count] = alias_letter\n count += 1\n elsif vowels_upcase_array.include? string[count]\n converted = vowels_upcase.index(string[count]) + 1\n alias_letter = vowels_upcase[converted]\n alias_string[count] = alias_letter\n count += 1\n elsif consonants_upcase_array.include? string[count]\n converted = consonants_upcase.index(string[count]) + 1\n alias_letter = consonants_upcase[converted]\n alias_string[count] = alias_letter\n count += 1\n else\n alias_string[count] = \" \"\n count += 1\n end\n end\nalias_string\nend",
"def aliasMaker(name)\r\n\tnewName = []\r\n\tnewName2 = []\r\n\tvowels = [\"a\",\"e\",\"i\",\"o\",\"u\"]\r\n\tconsonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\r\n\tstep1 = name.split(\" \")\r\n\ti = 0\r\n\tj = 0\r\n\r\n\twhile i <= step1.length\r\n\t\tnewName.push(step1[i])\r\n\t\ti += 1\r\n\tend\r\n\tnewName = newName.reverse\r\n\tnewName = newName.join(\" \")\r\n\tstep2 = newName\r\n\twhile j <= step2.length\r\n\t\tif isConsonant(step2[j]) == true\r\n\t\t\tnewName2.push(nextConsonant(step2[j]))\r\n\t\telsif isVowel(step2[j]) == true\r\n\t\t\tnewName2.push(nextVowel(step2[j]))\r\n\t\telse newName2.push(step2[j])\r\n\t\tend\r\n\t\tj += 1\r\n\tend\r\n\tanswer = newName2.join(\"\")\r\n\r\nend",
"def vowel_changer(name)\n vowel_guide = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n name.each do |names|\n name = names.split('')\n name\n name.map! do |char|\n index = 0\n while index < vowel_guide.length\n if char == vowel_guide[index]\n char = vowel_guide[index += 1]\n index += 1\n elsif char == \"u\"\n char = \"a\"\n index += 1\n else\n char\n index += 1\n end\n\n end\n char\n end\n name\n end\n name\nend",
"def alias_name\n first_name = \"lia\".chars\nlast_name = \"hogan\".chars\np first_name.class\nfirst_name[3] = last_name[0]\nfirst_name[4] = last_name[1]\nfirst_name[5] = last_name[2]\nfirst_name[6] = last_name[3]\nfirst_name[7] = last_name[4]\np first_name\n\nlast_name[5] = first_name[0]\nlast_name[6] = first_name[1]\nlast_name[7] = first_name[2]\np last_name\nfirst_name.delete_at(0)\nfirst_name.delete_at(0)\nfirst_name.delete_at(0)\np first_name\nlast_name.delete_at(0)\nlast_name.delete_at(0)\nlast_name.delete_at(0)\nlast_name.delete_at(0)\nlast_name.delete_at(0)\np last_name\n \n full_name = first_name + last_name\n index = 0 \n str_back = \"\"\n while index < full_name.length\n str_back[index]\n if full_name[index] == \"a\"\n str_back[index] = \"e\"\n elsif full_name[index] == \"b\" \n str_back[index] = \"c\"\n elsif full_name[index] == \"c\" \n str_back[index] = \"d\" \n elsif full_name[index] == \"d\" \n str_back[index] = \"f\"\n elsif full_name[index] == \"e\" \n str_back[index] = \"i\"\n elsif full_name[index] == \"f\" \n str_back[index] = \"g\"\n elsif full_name[index] == \"g\" \n str_back[index] = \"h\"\n elsif full_name[index] == \"h\" \n str_back[index] = \"j\"\n elsif full_name[index] == \"i\" \n str_back[index] = \"o\"\n elsif full_name[index] == \"j\" \n str_back[index] = \"k\"\n elsif full_name[index] == \"k\" \n str_back[index] = \"l\"\n elsif full_name[index] == \"l\" \n str_back[index] = \"m\"\n elsif full_name[index] == \"m\" \n str_back[index] = \"n\"\n elsif full_name[index] == \"n\" \n str_back[index] = \"p\"\n elsif full_name[index] == \"o\" \n str_back[index] = \"u\"\n elsif full_name[index] == \"p\" \n str_back[index] = \"q\"\n elsif full_name[index] == \"q\" \n str_back[index] = \"r\"\n elsif full_name[index] == \"r\" \n str_back[index] = \"s\"\n elsif full_name[index] == \"s\" \n str_back[index] = \"t\"\n elsif full_name[index] == \"t\" \n str_back[index] = \"v\"\n elsif full_name[index] == \"u\" \n str_back[index] = \"y\"\n elsif full_name[index] == \"v\" \n str_back[index] = \"w\"\n elsif full_name[index] == \"w\" \n str_back[index] = \"x\"\n elsif full_name[index] == \"x\" \n str_back[index] = \"z\"\n elsif full_name[index] == \"y\" \n str_back[index] = \"a\"\n elsif full_name[index] == \"z\" \n str_back[index] = \"b\"\n else \n str_back[index] = \" \"\n end\n index += 1 \n end\n str_back\nend",
"def create_alias(word)\n vowels_lower = ['a','e','i','o','u']\n vowels_upper = vowels_lower.map(&:upcase)\n consonants_lower = ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']\n consonants_upper = consonants_lower.map(&:upcase)\n \nupdated_vowels = word.map do |char|\n case\n when vowels_lower.include?(char)\n vowels_lower.rotate(1)[vowels_lower.index(char)]\n when vowels_upper.include?(char)\n vowels_upper.rotate(1)[vowels_upper.index(char)]\n when consonants_lower.include?(char)\n consonants_lower.rotate(1)[consonants_lower.index(char)]\n when consonants_upper.include?(char)\n consonants_upper.rotate(1)[consonants_upper.index(char)]\n else (char)\nend\nend\nend",
"def fake_identities(real_name)\n\n # input is downcase, split, and has reverse positions\n new_alias = real_name.downcase.split(' ').reverse\n # use map! to mutate name\n new_alias.map! {|name_info| name_info.split('')}\n\n new_alias.map! do |name_info|\n name_info.map! do |vowel|\n\n if vowel == \"z\"\n vowel = \"a\"\n elsif next_vowels(vowel) == vowel\n vowel.next!\n if next_vowels(vowel) != vowel\n vowel.next!\n end\n vowel\n else\n next_vowels(vowel)\n end\n end\n # returns a string and capitalizes first letter\n name_info.join('').capitalize\n end\n new_alias.join(' ') # keeps blank space here, otherwise it doesnt work\nend",
"def vowel_converter(string)\r\n\tname_array = string.split('')\r\n vowel = ['a', 'e', 'i', 'o', 'u']\r\n counter = 0\r\n vowel_counter = 0\r\n# Outer loop that loops through entire name (first and last)\r\n while counter < name_array.length\r\n# Inner loop that loops through list of vowels, compares them with name, and changes vowels in name\r\n \twhile vowel_counter < vowel.length\r\n \t\tif name_array[counter] == vowel[vowel_counter]\r\n if name_array[counter] == 'u'\r\n \tname_array[counter] = 'a'\r\n break\r\n else\t\r\n \t\t name_array[counter] = vowel[vowel_counter + 1]\r\n \t\t break\r\n \t\t end\r\n \t end\r\n vowel_counter += 1\r\n end\r\n counter += 1\r\n vowel_counter = 0\r\n end \r\n return name_array\r\nend",
"def fake_name(letters)\r\n\tvowel_arr = ['a', 'e', 'i', 'o', 'u']\r\n\tletters.map! do |letter|\r\n\t\tif vowel_arr.include?(letter.downcase)\r\n\t\t\tif letter.upcase! == nil\r\n\t\t\t\t\tif letter.downcase == vowel_arr[4]\r\n\t\t\t\t\t\tletter = vowel_arr[0].upcase\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tnumber = vowel_arr.index(letter.downcase)\r\n\t\t\t\t\t\tnumber = number + 1\r\n\t\t\t\t\t\tletter = vowel_arr[number].upcase\r\n\t\t\t\t\tend\r\n\t\t\telse\r\n\t\t\t\tnumber = vowel_arr.index(letter.downcase)\r\n\t\t\t\t\tif number == 4\r\n\t\t\t\t\t\tletter = vowel_arr[0]\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tnumber = number + 1\r\n\t\t\t\t\t\tletter = vowel_arr[number]\r\n\t\t\t\t\tend\r\n\t\t\tend\r\n\t\telsif \"abcdefghijklmnopqrstuvwxyz\".include?(letter.downcase) == false\r\n\t\t\tletter = letter\r\n\t\telse \r\n\t\t\t\tif letter.downcase == 'z'\r\n\t\t\t\t\tletter = (letter.chr.ord - 24). chr\r\n\t\t\t\telsif vowel_arr.include?(letter.next.downcase) == false\r\n\t\t\t\t\tletter = letter.next\r\n\t\t\t\telse\r\n\t\t\t\t\tletter = letter.next.next\r\n\t\t\t\tend\r\n\t\tend\r\n\tend\r\nletters.join(\"\")\r\nend",
"def next_vowel(str)\n\t# Need to identify the vowels in the English alphabet in a new variable\n\tvowels = [\"a\",\"e\",\"i\",\"o\",\"u\"]\n\t# Need to also identify the consonants in the English alphabet in a new variable\n\tconsonants = [\"b\",\"c\",\"d\",\"f\",\"g\",\"h\",\"j\",\"k\",\"l\",\"m\",\"n\",\"p\",\"q\",\"r\",\n\t\t\"s\",\"t\",\"v\",\"w\",\"x\",\"y\",\"z\"]\n\twords = str.split # Splitting the name into words based on space (' ')\n\t\n\t## Loop into each name\n\ti = 0 # Setting an index to zero\n\tnew_word = [] # Setting up an empty array for our new scrambled word\n\tmod_word = [] # Setting up an empty array to hold the capitalized scrambled word\n\n\twhile i < words.length # Looping into each word\n\t\tchars = words[i].split('') # Split each word into characters\n\t\tnew_chars = chars.map{|char| # Mapping into each character\n\t\t\tif vowels.include?(char) # If the character is included in the vowels variable\n\t\t\t\tvowels.rotate(1)[vowels.index(char)] # Reassign it to the next vowel\n\t\t\telsif consonants.include?(char) # If the character is included in the consonants variable\n\t\t\t\tconsonants.rotate(1)[consonants.index(char)] # Reassign it to the next consonet\n\t\t\telse\n\t\t\t\tchar # Otherwise don't do anything (In case there are odd characters)\n\t\t\tend\n\t\t}\n\t\tnew_word.push(new_chars.join) # rejoin the word\n\t\t# This bit of code capitalizes the first character of the name\n\t\tmod_word.push(new_word[i].slice(0,1).capitalize + new_word[i].slice(1..-1))\n\t\ti += 1 # increment counter\n\tend\n\treturn mod_word.join(' ') # return the rejoined words\nend",
"def alias_generator(agent)\n\n# changes vowels into array and uses .reverse method to account \n# for edge cases\n\tvowels = \"aeiou\"\n\tnew_vowels = \"aeiou\".split('').reverse\n\n# changes consonants into array and uses .reverse method to account\n# for edge cases\n\tconsonants = \"bcdfghjklmnpqrstvwxyz\"\n\tnew_consonants = \"bcdfghjklmnpqrstvwxyz\".split('').reverse\n\n# defines variables for user input and parameter\n\treal_name = agent\n\n# swaps first and last names and turns them into arrays \n\treversed_real_name = real_name.downcase.split(' ').reverse\n \talias_name_array = reversed_real_name.join(' ').split('')\n\n # maps the new array through the indices of the vowel and consonant arrays\n \taltered_name = alias_name_array.map do |char| \n if vowels.include?(char)\n # if there is a vowel, it will map to the next vowel\n new_vowels[new_vowels.index(char)-1]\n elsif consonants.include?(char)\n # if there is a consonant, it will map to the next consonant\n new_consonants[new_consonants.index(char)-1]\n else\n # accounts for space or another character\n char\n end\n end \n\n# takes the newly mapped array, joins it back together and capitalizes it\n\tnew_alias = altered_name.join.split.map!{ |name| name.capitalize }.join(\" \")\nend",
"def secret_name (name)\r\n\tname = name.downcase\r\n\r\n#create temporary name container \r\ntemp_name = \"\"\r\n#make to strings containing vowels and consonants \r\n#handle edge case by copying the first character to the end\r\nvowels = \"aeioua\"\r\nconsonants = \"bcdfghjklmnpqrstvwxyzb\"\r\n#iterate through each character in the name string and find vowels, consonants and spaces\r\n#add the corresponding letter/character to the temporary name variable and return that variable\r\nname.each_char do |letter| \r\n\tif letter == \" \"\r\n\t\ttemp_name += \" \"\r\n\t\t\r\n\telsif vowels.include?(letter)\r\n \t\ttemp_name += vowels[vowels.index(letter).next]\r\n \t\r\n elsif consonants.include?(letter)\r\n \ttemp_name += consonants[consonants.index(letter).next]\r\n \r\nend\r\n end\r\n return temp_name\r\n end",
"def translate(str)\n\n\n\n # Vowels to consider\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n \n # Special cases to consider\n two_letter_consonants = [\"ch\", \"sh\", \"qu\", \"th\", \"br\"]\n three_letter_consonants = [\"thr\", \"sch\", \"squ\"]\n\n words = str.split(\" \")\n result = []\n\n words.each do |word|\n if vowels.include?(word[0])\n result.push word << \"ay\"\n else \n if three_letter_consonants.include? (word[0] + word[1] + word[2])\n first_three_letters = word.slice!(0,3)\n \n # Add letters to end of word with 'ay'\n result.push word << first_three_letters << 'ay'\n elsif two_letter_consonants.include?(word[0] + word[1])\n first_two_letters = word.slice!(0,2)\n result.push word << first_two_letters << \"ay\"\n else \n first_letter = word.slice!(0)\n \n # Add first letter to end of word with 'ay'\n result.push word << first_letter << 'ay'\n end #End of special consonant check\n end \n end \n return result.join(\" \")\nend",
"def make_fake_name(name)\n # downcase to avoid issues due to capitalization\n # convert name to an array of characters\n # for each letter,\n name = name.downcase.chars.map! do |letter|\n # if it is a vowel, change it to the next vowel\n if 'aeiou'.include?(letter)\n next_vowel(letter)\n # elsif it is a letter, change it to the next consonant\n elsif ('a'..'z').include?(letter)\n next_consonant(letter)\n # otherwise, nil it\n end\n end\n # convert name back to a string and re-capitalize it\n name = name.join.capitalize\nend",
"def pig_latin_translate\n english_word_arr = []\n vowel_array = %w(a e i o u)\n \n print \"What word would you like to translate? \"\n input = gets.chomp!.downcase\n \n english_word_to_translate = input.split(/ /)\n \n english_word_to_translate.each do |word|\n english_word_arr = word.split(//)\n\n\n\n #split by words\n #split by character\n #Take first letter move to end\n #add 'Ay'\n #join and return word\n end\nend",
"def next_letter(name)\n vowels = \"aeiou\".split(\"\")\n consonants = \"bcdfghjklmnpqrstvwxyz\".split(\"\")\n spy_name = []\n \n name.split(\"\").map do |letter|\n if vowels.include?(letter)\n vowels.index(letter)\n index = vowels.index(letter)\n new_letter = vowels[index + 1]\n new_letter\n elsif consonants.include?(letter)\n consonants.index(letter)\n index = consonants.index(letter)\n new_letter = consonants[index + 1]\n new_letter\n elsif letter == \" \"\n new_letter = \" \"\n new_letter\n end\n spy_name.push(new_letter)\n end\n \n spy_name.join(\"\")\nend",
"def name_change(agent)\r\n\tcode_list = []\r\n\tname = agent\r\n\tcoded_name = name.split('')\r\n\r\n# After the user enters a name, the name will be split into separate letters, which will be placed in an array.\r\n\r\n\tcoded_name.map! { |code| code.next }\r\n\r\n# Each letter in the array will then be changed to the letter that follows it in the alphabet.\r\n\r\n\tcoded_name\r\n\tfalse_name = coded_name.join('')\r\n\r\n# Finally, the letters will be joined back into a new string. This string is the result of the original name being changed by this method.\r\n\r\n\tcode_list << false_name\r\n\r\n# The above line will store the changed names in an array, which was initialized at the beginning of the method.\r\n\r\nend",
"def scramble\n\tconsonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z', 'B', 'C', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Y', 'Z']\n\tvowels = ['a', 'e', 'i', 'o', 'u', 'A', 'E', 'I', 'O', 'U']\n\n\tputs \"What name would you like to use?\"\n# Get name and return a string\n\t\tspy_name = gets.chomp.to_str\n# Turn into an array to swap name places\n\t\trotate_name = spy_name.split(' ').rotate!\n\t\tp rotate_name\n# Change all of the vowels\n\t\tscramble_name = rotate_name.join(' ')\n\t\tnew_spy_name = scramble_name.split(' ')\n\t\tvowels.each do |vowel|\n\t\t\tnew_spy_name << vowel.next\n\t\tend\nend",
"def name_encryption(full_name)\n\nfull_name = full_name.split(' ').rotate.join(' ')\n# .split(' ') splits full_name into array [\"first\", \"last\"]\n# .rotate rotates the first and last name within the array. (Ex. [\"last\", \"first\"])\n# .join(' ') combines array into a string. (Ex. \"last first\")\n\ncode_name = full_name.split('').map{ |x| x = next_letter(x)}\n# .split('') splits the string \"last first\" into individual characters.\n# .map{ |x| x = next_letter(x)} uses the next_letter method on each character and saves the changes.\n\ncode_name = code_name.join('')\n# .join('') combines individual characters into a\n\nend",
"def alias_method (name)\r\n\tnew_first = []\r\n\tnew_last = []\r\n\tvowels_string = \"aeiou\"\r\n\tvowels = vowels_string.split('')\r\n\tconsonants_string = \"bcdfghjklmnpqrstvwxyz\"\r\n\tconsonants = consonants_string.split('')\r\n\ttwo_names = name.split(' ')\r\n\tfirst_name = two_names[0].split('')\r\n\tlast_name = two_names[1].split('')\r\n\tlast_name.each do |character|\r\n\t\tcharacter = character.downcase\r\n\t\tif vowels.include?(character)\r\n\t\t\tindex = vowels.index(character)\r\n\t\t\tnew_last.push(vowels[index + 1])\r\n\t\tend\r\n\t\tif consonants.include?(character)\r\n\t\t\tindex = consonants.index(character)\r\n\t\t\tnew_last.push(consonants[index + 1])\r\n\t\tend\r\n\t\tif character.downcase == 'z'\r\n\t\t\tnew_last.push('b')\r\n\t\tend\r\n\t\tif character.downcase == 'u'\r\n\t\t\tnew_last.push('a')\r\n\t\tend\r\n\tend\r\n\tfirst_name.each do |character|\r\n\t\tcharacter = character.downcase\r\n\t\tif vowels.include?(character)\r\n\t\t\tindex = vowels.index(character)\r\n\t\t\tnew_first.push(vowels[index + 1])\r\n\t\tend\r\n\t\tif consonants.include?(character)\r\n\t\t\tindex = consonants.index(character)\r\n\t\t\tnew_first.push(consonants[index + 1])\r\n\t\tend\r\n\t\tif character.downcase == 'z'\r\n\t\t\tnew_first.push('b')\r\n\t\tend\r\n\t\tif character.downcase == 'u'\r\n\t\t\tnew_first.push('a')\r\n\t\tend\r\n\tend\r\n\tnew_last.push(' ')\r\n\tnew_last = new_last.join('').capitalize\r\n\tnew_first = new_first.join('').capitalize\r\n\treturn_val = new_last + new_first\r\n\treturn_val\r\nend",
"def secret_alias_maker(secret_name)\n reverse_name = swapping_names(secret_name)\n char = reverse_name.split('')\n char_swapped_vowels = swapping_vowels(char)\n added_to_array = swapping_consonents(char_swapped_vowels)\n added_to_array.join('')\nend",
"def alias_maker(name)\n \n consonants = \"bcdfghjklmnpqrstvwxz\"\n next_cons = \"cdfghjklmnpqrstvwxzb\"\n \n name.downcase.tr(consonants,next_cons)\n .tr('aeiouy', 'eiouya')\n .split.reverse.each {|word| word.capitalize!}\n .join(' ')\n\n # Separated methods on lines 24-27 for readability\n # First .tr changes all consonants to next\n # Second .tr changes all vowels to next vowel\n # Split names to reverse and capitalize them\n # Rejoin to a single string\n\nend",
"def codename_method\ncode_names = []\n # set up a loop to ask agent for names continuously, until 'done'\noption = ''\nuntil option == \"quit\"\n # get user input and call methods to swap and scramble the name\n puts \"What is your real name, agent?\"\n agent_name = gets.chomp\n # call both methods to swap and scramble name -> string output, use split to convert\n #to an array for later iteration\n alias_name = code_letter(swap_split_name(agent_name)).split\n # use map method to get both words in the array and capitalize both, use bang op\n p alias_name\n alias_name.map do |x|\n x.capitalize!\n end\n alias_name = alias_name.join(' ')\n # Give agent a new name!\n puts \"Agent, your new identity is: #{alias_name}\"\n # add alias_name to array code_names\n code_names << [agent_name, alias_name]\n # ask user for more input if wanted, otherwise quit\n puts \"Would you like to enter another name? Press any key and enter.\n If Finished, type 'quit'.\"\n option = gets.chomp\n end\n\n\n # Finally, iterate through the array, and print all user input before program exits.\ncode_names.each do |real, spy|\n puts \"Agent's real name: #{real}.\"\n puts \"Agent's code name: #{spy}.\"\nend\nend",
"def fake_name(name)\n fake_name = name.chars.map! do |letter|\n if letter == \" \"\n letter = \" \"\n elsif \"aeiou\".include?(letter)\n letter = next_vowel(letter)\n elsif \"zdhnt\".include?(letter)\n letter = pre_vowel_scramble(letter)\n else\n letter.next\n end\n end\n fake_name = fake_name.join\n swap_name_order(fake_name)\nend",
"def codeName (str)\n\tstr = str.to_s.downcase.split(' ')\n\tk = str[0]\n\tstr[0] = str[1]\n\tstr[1] = k\n\tvowels = \"aeiou\"\n\tconsonants = \"bcdfghjklmnpqrstvwxyz\"\n\t\n\tlastName = str[0].chars\n\tfirstName = str[1].chars\n\t\n\tfor i in 0..(lastName.length-1)\n\t\tif lastName[i] == \"a\" || lastName[i] == \"e\" || lastName[i] == \"i\" || lastName[i] == \"o\" || lastName[i] == \"u\"\n\t\t\tlastName[i] = vowels[vowels.index(lastName[i])+1]\n\t\telse\n\t\t\tlastName[i] = consonants[consonants.index(lastName[i])+1]\n\t\tend\n\tend\n\t\n\tfor i in 0..(firstName.length-1)\n\t\tif firstName[i] == \"a\" || firstName[i] == \"e\" || firstName[i] == \"i\" || firstName[i] == \"o\" || firstName[i] == \"u\"\n\t\t\tfirstName[i] = vowels[vowels.index(firstName[i])+1]\n\t\telse\n\t\t\tfirstName[i] = consonants[consonants.index(firstName[i])+1]\n\t\tend\n\tend\n\tstr[0] = lastName.join('').capitalize\n\tstr[1] = firstName.join('').capitalize\n\tstr.join(' ')\n\t\nend",
"def fake_name(name)\n name = name.split.rotate\n name.map! do |n|\n n.downcase!\n vowels = 'aeiou'\n vowels_shifted = vowels.split('').rotate.join\n consonants = 'bcdfghjklmnpqrstvwxyz'\n consonants_shifted = consonants.split('').rotate.join\n\n n.tr!(vowels, vowels_shifted)\n n.tr!(consonants, consonants_shifted)\n\n n = n.split('')\n n[0] = n[0].upcase\n n = n.join\n end\n name = name.join(' ')\nend",
"def english_translate\n pig_latin_arr = []\n pig_latin = []\n print \"What word would you like to translate? \"\n input = gets.chomp!.downcase\n \n pig_latin_word_to_translate = input.split(/ /)\n\n pig_latin_word_to_translate.each do |word|\n pig_latin_arr = word.split(//)\n\n first_letter = pig_latin_word_to_translate.delete_at(0)\n new_letters = english_word_to_translate.join\n\n word = new_letters + first_letter + \"ay\"\n\n pig_latin << word\n end\n \n puts pig_latin.join(' ').capitalize\nend",
"def alias_creator(name_split)\r\n vowels = \"aeiou\"\r\n consonants = \"bcdfghjklmnpqrstvwxy\"\r\n\r\n name_split.map! do |string|\r\n if vowels.index(string) != nil\r\n new_vowel = vowels.index(string) + 1\r\n string = vowels[new_vowel]\r\n elsif consonants.index(string) != nil\r\n new_consonant = consonants.index(string) + 1\r\n string = consonants[new_consonant]\r\n else\r\n string = string\r\n end\r\n end\r\nend",
"def next_letter (name)\n vowels = \"aeiou\".split('')\nalphabet = ('a'..'z').to_a\nconsonants = alphabet - vowels\nname_array = name.split('')\nname_array.map! { |letter|\n if letter == \"u\"\n \"a\"\n elsif letter == \"z\"\n \"b\"\n elsif consonants.include? letter\n consonants[consonants.index(letter) + 1]\n elsif vowels.include? letter\n vowels[vowels.index(letter) + 1]\n else\n letter\n end\n}\nname_array.join('')\nend",
"def name_change(real_name)\r\n\tnew_name = real_name.downcase.split(' ')\r\n\tnew_name.map! { |real_name|\r\n\t\treal_name.split('').map! { |char|\r\n\t\t\tif \"aeiou\".index(char) != nil\r\n\t\t\t\tchange_char(char, \"aeiou\")\r\n\t\t\telse \r\n\t\t\t\tchange_char(char, \"bcdfghjklmnpqrstvwxyz\")\r\n\t\t\tend\r\n\t\t}\r\n\t}\r\n\tnew_first_name = new_name[1].join('')\r\n\tnew_last_name = new_name[0].join('')\r\n\treturn new_first_name.capitalize + \" \" + new_last_name.capitalize\r\nend",
"def name_rotate(name)\r\n consonants = %w[b c d f g h j k l m n p q r s t v w x y z]\r\n vowels = ['a', 'e', 'i', 'o', 'u']\r\n \r\n name = name.downcase.split('')\r\n \r\n name_rotate = name.map { |char|\r\n if vowels.include?(char)\r\n vowels.rotate(1)[vowels.index(char)]\r\n elsif consonants.include?(char)\r\n consonants.rotate(1)[consonants.index(char)]\r\n else\r\n char\r\n end\r\n }\r\n \r\n name_rotate.join.split(' ').reverse.map { |x| x.capitalize }.join(' ')\r\nend",
"def translate(arr)\n vowels = %w{a e i o u y}\n consonants = %w{b c d f g h j k l m n p q r s t v w x y z}\n\n a = arr.split.map do |word| \n if vowels.include?(word[0])\n word + \"ay\"\n elsif word[0..1] == \"qu\"\n word[2..-1] + \"quay\"\n elsif word[0..2] == \"sch\"\n word[3..-1] + \"schay\"\n elsif word[0..2] == \"squ\"\n word[3..-1] + \"squay\"\n elsif consonants.include?(word[0]) && consonants.include?(word[1]) && consonants.include?(word[2])\n word[3..-1] + word[0..2] + \"ay\"\n elsif consonants.include?(word[0]) && consonants.include?(word[1])\n word[2..-1] + word[0..1] + \"ay\"\n elsif consonants.include?(word[0])\n word[1..-1] + word[0] + \"ay\"\n end\n end\n\n a.join(\" \")\nend",
"def name_swap(name)\n reverse_name = name.downcase.split.reverse.join(' ')\n vowel_swap = reverse_name.tr!('aeiou', 'eioua')\n consonant_swap = vowel_swap.tr!('bcdfghjklmnpqrstvwxyz', 'cdfghjklmnpqrstvwxyz').split\n final_alias = consonant_swap.map(&:capitalize).join(' ')\nend",
"def vowel_switch\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\", \"A\", \"E\", \"I\", \"O\", \"U\"]\n @split_name.map! do |char|\n if vowels.include?(char)\n char = vowels[vowels.index(char)+1]\n else\n char = char.next\n end\nend\np @split_name\nend",
"def vowel_swap (secret_name)\n\t#first separate string into an array of characters\n\t#the loop through looking for vowels\n\t#use each do loop to then go through each character\n\t#check to see if it is a vowel using gsub and replace with the next vowel\n\t#have to replace with an uppercase vowel, so when a becomes 'e' and then I check for 'e's, those 'a's don't become 'i's and etc\n\tsecret_name = secret_name.split('')\n\tsecret_name.each do |letters|\n\t\tletters.gsub!(/[a]/, \"E\")\n\t\tletters.gsub!(/[e]/, \"I\")\n\t\tletters.gsub!(/[i]/, \"O\")\n\t\tletters.gsub!(/[o]/, \"U\")\n\t\tletters.gsub!(/[u]/, \"A\")\n\tend\n\t#then downcase eveything\n\tsecret_name.map!{|letter| letter.downcase}\n\t\nend",
"def name_scramble(str)\n\tarr = str.downcase.split(\"\")\n\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n\tconsonant = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n\tstr_new = arr.map do |char|\n\t\tif vowels.include?(char) \n\t\t\tvowels.rotate[vowels.index(char)];\n\t\telsif consonant.include?(char)\n\t\t\tconsonant.rotate[consonant.index(char)]\n\t\tend\n\tend\n\tstr_new.join.capitalize\nend",
"def next_vowcon(oldlet) #actually takes in the whole name (not just 1 letter), since it is only split to an array of [first_name, last_name]\r\n vowel = ['a','e','i','o','u']\r\n rot_vow = vowel.rotate #reverses vowel array\r\n consonant = 'bcdfghjklmnpqrstvwxzy'.split('')\r\n rot_cons= consonant.rotate #reverses consonant array\r\n i=0\r\n while i < oldlet.length\r\n if vow_index = vowel.index(oldlet[i])\r\n oldlet[i] = rot_vow[vow_index]\r\n else\r\n cons_index = consonant.index(oldlet[i])\r\n oldlet[i] = rot_cons[cons_index]\r\n end\r\n i +=1\r\n end\r\n return oldlet\r\nend",
"def alias_modifier(full_name)\n low_vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n up_vowels = [\"A\", \"E\", \"I\", \"O\", \"U\"]\n low_consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n up_consonants = [\"B\", \"C\", \"D\", \"F\", \"G\", \"H\", \"J\", \"K\", \"L\", \"M\", \"N\", \"P\", \"Q\", \"R\", \"S\", \"T\", \"V\", \"W\", \"X\", \"Y\", \"Z\"]\n full_name = full_name.split('')\n updated_name = full_name.map do |char|\n if low_vowels.include?(char)\n low_vowels.rotate[low_vowels.index(char)]\n elsif up_vowels.include?(char)\n up_vowels.rotate[up_vowels.index(char)]\n elsif low_consonants.include?(char)\n low_consonants.rotate[low_consonants.index(char)]\n elsif up_consonants.include?(char)\n up_consonants.rotate[up_consonants.index(char)]\n else\n char\n end\n end\n updated_name.join\nend",
"def letter_change(letter)\nvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\nconsonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z' ]\n if vowels.include?(letter) #conditional to check if the letter is in the vowels array above\n vowels.rotate[vowels.index(letter)] #within the vowels array.rotate over by one[the index of the letter in the vowels array]\n elsif consonants.include?(letter) #conditional to check if the letter is in the consonant array defined above\n consonants.rotate[consonants.index(letter)] #because this has met the above condition, we know that the char exists in the array. we are asking for the index of the letter in the consonants array and from there are rotate to the next by one. This movement is being saved into the new name_new array.\n elsif letter == \"z\" #edge case\n letter == \"b\"\n elsif letter == \"u\" #edge case\n letter == \"a\" \n elsif letter == \" \" #edge case\n letter = \" \" \n end\nend",
"def to_alias_chars(name_chars)\nname_chars.map! do |character|\n\tcharacter = character.downcase\n\tif character == \"a\"\n\t\tnext_vowel(character)\n\telsif character == \"e\"\n\t\tnext_vowel(character)\n\telsif character == \"i\"\n\t\tnext_vowel(character)\n\telsif character == \"o\"\n\t\tnext_vowel(character)\n\telsif character == \"u\"\n\t\tnext_vowel(character)\n\telse \n\t\tnext_consonant(character)\n\tend\nend\nend",
"def translate string\n\n\t#This splits the string into an array of words\n\twords = string.split(\" \")\n\t\n\t#Goes through each word in array words\n\tfor i in 0...words.length\n\n\t\t#This splits each word into an array of characters\n\t\tcharacters = words[i].chars\n\n\t\t#If a word begins with a vowel, add \"ay\" to the end of the word\n\t\tif isVowel characters[0]\n\n\t\t\tcharacters.push(\"a\", \"y\")\n\t\t\twords[i] = characters.join(\"\")\n\n\t\t#If a word does not begin with a vowel...\n\t\telse\n\n\t\t\t#While the first character is not a vowel, move it to the back of the word\n\t\t\twhile !(isVowel characters[0])\n\n\t\t\t\t#If the first character is a \"q,\"\n\t\t\t\tif characters[0] == \"q\"\n\n\t\t\t\t\t#and the next character is a \"u,\" push both the \"qu\" to the end\n\t\t\t\t\tif characters[1] == \"u\"\n\n\t\t\t\t\t\tconsonant = characters.shift\n\t\t\t\t\t\tcharacters.push(consonant)\n\t\t\t\t\t\tu = characters.shift\n\t\t\t\t\t\tcharacters.push(u)\n\n\t\t\t\t\tend\n\n\t\t\t\t#Otherwise, just push the first letter to the end\n\t\t\t\telse\n\n\t\t\t\t\tconsonant = characters.shift\n\t\t\t\t\tcharacters.push(consonant)\n\n\t\t\t\tend\n\n\t\t\tend\n\n\t\t\t#Then add \"ay\" to the end of the word\n\t\t\tcharacters.push(\"a\", \"y\")\n\t\t\twords[i] = characters.join(\"\")\n\n\t\tend\n\t\t\n\tend\n\n\t#Joins together all the words with a space in between them and returns the modified string as an answer\n\tanswer = words.join(\" \")\n\treturn answer\n\nend",
"def alias_maker(fullname)\r\n\tfullname= fullname.downcase\r\n\treverse_name = fullname.split(' ').reverse!.join(' ')\r\n\tletter_array = reverse_name.split('') \r\n\tletter_array.map! do |char|\r\n\t\tif char == \"a\"\r\n\t\t\tchar = \"e\"\r\n\t\telsif char == \"e\"\r\n\t\t\tchar = \"i\"\r\n\t\telsif char == \"i\"\r\n\t\t\tchar = \"o\"\r\n\t\telsif char == \"o\"\r\n\t\t\tchar = \"u\"\r\n\t\telsif char == \"u\"\r\n\t\t\tchar =\"a\"\r\n\t\telsif char == \" \"\r\n\t\t\tchar = \" \"\r\n\t\telse\r\n\t\t\tif char.next == \"a\"\r\n\t\t\tchar = char.next!.next!\r\n\t\t\telsif char.next == \"e\"\r\n\t\t\tchar = char.next!.next!\r\n\t\t\telsif char.next == \"i\"\r\n\t\t\tchar = char.next!.next!\r\n\t\t\telsif char.next == \"o\"\r\n\t\t\tchar = char.next!.next!\r\n\t\t\telsif char.next == \"u\"\r\n\t\t\tchar = char.next!.next!\r\n\t\t\telse\t\r\n\t\t\t\tchar = char.next!\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\n\tnew_name = letter_array.join\r\n\tfull_alias = new_name.split.map(&:capitalize).join(\" \")\r\nend",
"def alias_method\n name = \"\"\n name_2 = \"\"\n until name == \"quit\"\n puts \"what is your name? type quit to exit\"\n alias_name = {\n :name_1 => name_2\n }\n name = gets.chomp\n if name != \"quit\"\n alias_name[:name_1] = name\n name_2 = name.split(\" \").reverse.join(\" \").tr('aeiou', 'eioua').tr('bcdfghjklmnpqrstvwxyz', 'cdfghjklmnpqrstvwxyzb')\n break if name == \"quit\"\n end\n end\n alias_name.each do |name_1, name_2|\n p \"#{name_1} is actually #{name_2}!\"\n end\nend",
"def consonant_swap (secret_name)\n\t\n\tsecret_name.map do |letters|\n\t\t\n\t\tif letters == \" \"\n\t\t\tletters\n\t\telsif letters == \"z\"\n\t\t\tletters.gsub!(/[z]/, \"a\")\n\t\telsif letters =~ /[aeiou]/\n\t\t\tletters\n\t\telse \n\t\t\tletters.next!\n\t\t\tif letters =~ /[aeiou]/\n\t\t\t\tletters.next!\n\t\t\tend\n\t\tend\n\n\tend\n\tsecret_name\nend",
"def make_fake_name (name)\n\t# Swap first & last name\n\tswap_name = name.split(' ').reverse.join(' ')\n\n\t# Swap characters - change all vowels to next vowel,\n\t# and all consonants to next consonant\n\n\t# Initialize fake_name & index (counter) variables \n\tfake_name = ''\n\tindex = 0\n\twhile index < swap_name.length\n\t\tchar = swap_name[index]\n\n\t\t# For each character\n\t\tif char == ' '\n\t\t\t# If space, add space\n\t\t\tfake_name += ' '\n\t\telse\n\t\t\t# Handle lower & uppercase properly\n\t\t\tif char == char.downcase\n\t\t\t\tfake_name += get_swapped_char(char)\n\t\t\telse\n\t\t\t\tfake_name += get_swapped_char(char.downcase).upcase\n\t\t\tend\n\t\tend\n\n\t\t# Increment counter\n\t\tindex += 1\n\tend\n\n\tfake_name\nend",
"def fake_name(real_name)\n\treal_full_name = real_name.split(\" \")\n\treal_first_name = real_full_name[0].downcase \n\treal_last_name = real_full_name[1].downcase\n\talphabet = [\"a\",\"b\", \"c\", \"d\", \"e\",\"f\", \"g\", \"h\",\"i\", \"j\", \"k\", \"l\", \"m\", \"n\", \"o\", \"p\", \"q\", \"r\", \"s\", \"t\", \"u\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n\ti = 0\n\tfake_first_name = \"\"\n\tfake_last_name = \"\"\n\tlength_first = real_first_name.length\n\tlength_last = real_last_name.length \n\n\twhile i < length_first\n\t\tif real_first_name[i] == \"z\"\n\t\t\tfake_first_name += \"a\"\n\t\telsif real_first_name[i] == \"a\" || real_first_name[i] ==\"e\" || \n\t\t\t real_first_name[i] == \"i\" || real_first_name[i] == \"o\" || \n\t\t\t real_first_name[i] == \"u\"\n\t\t\tfake_first_name += real_first_name[i] \n\t\telsif \n\t\t\tind = alphabet.index(real_first_name[i])\n\t\t\tfake_first_name += alphabet[ind+1]\n\t\tend \n\t\ti+=1\n\t\t#fake_first_name[0] = fake_first_name[0].upcase\n\tend \n\tfake_first_name\nend",
"def next_letter(reversed_name)\n vowels = 'aeioua'\n consonants = 'bcdfghjklmnpqrstvwxy'\n #reversed name to array\n reversed_name_array = reversed_name.split('')\n #check if letter is vowel if so make it next vowel\n #check if letter is consonant if so make it next consonant\n reversed_name_array.map! { |letter|\n if vowels.index(letter) != nil\n new_vowel = vowels.index(letter) + 1\n letter = vowels[new_vowel]\n elsif consonants.index(letter) != nil\n new_consonant = consonants.index(letter) + 1\n letter = consonants[new_consonant]\n else\n letter = letter\n end\n }\n reversed_name_array_joined = reversed_name_array.join\nend",
"def translate(text)\n\nvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"] #create array of vowels\nwords = text.split(\" \") #create array of individual words from text \ntranslation = [] #create empty array to receive the individually translated words\n\n words.each do |word| #for each individual word in the array\n \n #create loop to continue while first letter is not a vowel.\n while vowels.include?(word[0].downcase) == false #check index 0 (first letter) in word is NOT a vowel\n \n if word[0..1] == \"qu\" #create exceptional case for 'qu'\n word = word [2..-1] + word[0..1] #splice the first two letters to the end of the word\n else\n word = word [1..-1] + word[0] #push the first letter in the word (index [0]) to the end of the array\n end \n \n end\n \n word = word + \"ay\"\n translation.push(word) #push the word to the end of the final array\n\n end\n \ntranslation.join(\" \")\n \nend",
"def spyname(real_name)\n spy_array = []\n split_name = real_name.reverse.split('')\n split_name.join.chars\n split_name.map! do|name|\n name.tr!(\"aeiouAEIUO\",\"eiouaEIOUA\")\n name.tr!(\"bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ\",\"cdfghjklmnpqrstvwxyzbCDFGHJKLMNPQRSTVWXYZB\")\n spy_array << name.to_str\nend\n p spy_array.join\nend",
"def fakeName(name)\r\n\tnameLen = name.length\r\n\tnameIndex = 0\r\n\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\r\n\tcons = [\"b\", \"c\",\"d\", \"f\",\"g\", \"h\",\"j\", \"k\",\"l\", \"m\",\"n\", \"p\",\"q\", \"r\",\"s\", \"t\",\"v\", \"x\", \"z\",\"w\", \"y\"]\r\n\tnewName = \"\"\r\n\twhile nameIndex < nameLen\r\n\t\tvowelArrayIndex = 0\r\n\t\tvowels.each do |vow|\r\n\t\t\tif name[nameIndex] == vow\r\n\t\t\t\tnextchar = next_vowel(vowelArrayIndex)\r\n\t\t\t\tnewName = newName + nextchar\r\n\t\t\tend\r\n\t\t\tvowelArrayIndex += 1\r\n\t\tend\r\n\t\tvowelArrayIndex = 0\r\n\t\tconsArrayIndex = 0\r\n\t\tcons.each do |cons|\r\n\t\t\tif name[nameIndex] == cons\r\n\t\t\t\tnextchar = next_cons(consArrayIndex)\r\n\t\t\t\tnewName = newName + nextchar\r\n\t\t\tend\r\n\t\t\tconsArrayIndex += 1\r\n\t\tend\r\n\t\tnameIndex += 1\r\n\tend\r\n\treturn newName\r\nend",
"def name_switch(str)\n name_hash = Hash.new,\n str.reverse.tr(\"\\\\^aeiou\", \"*\")\nend",
"def fake_name_c2(real_name)\n\treal_full_name = real_name.split(\" \")\n\treal_first_name = real_full_name[0] \n\treal_last_name = real_full_name[1]\n\ti = 0\n\tfake_first_name = \"\"\n\tfake_last_name = \"\"\n\tvowel_index = \"\"\n\tlength_first = real_first_name.length\n\tlength_last = real_last_name.length \n\t\twhile i < length_last\n\t\tif real_last_name[i] == \"z\"\n\t\t\tfake_last_name += \"a\"\n\t\telsif real_last_name[i] == \"a\" || real_last_name[i] ==\"e\" || \n\t\t\t real_last_name[i] == \"i\" || real_last_name[i] == \"o\" || \n\t\t\t real_last_name[i] == \"u\"\n\t\t\tfake_last_name += real_last_name[i] \n\t\telse \n\t\t\tfake_last_name += real_last_name[i].next \n\t\tend \n\t\ti+=1\n\tend\n\tfake_last_name\nend",
"def swapping_vowels(vowel_char)\n vowels = { 'a' => 'e', 'e' => 'i', 'i' => 'o', 'o' => 'u', 'u' => 'a' }\n\n# We take our arguement and run the iteration and create our if/els/els statement.\n# we use .map to store the next change of our letter and if the vowels are included printer the letter of the vowels otherwise print them downcase and switch them to uppercase.\n vowel_char.map! do |letter|\n if vowels.include?(letter)\n vowels[letter]\n elsif vowels.include?(letter.downcase)\n vowels[letter.downcase].upcase\n else\n letter\n end\n end\nend",
"def vowel_changer(name)\n vowel_string = \"aeiou\"\n name_array = name.downcase.chars\n new_name = []\n name_array.each do |character|\n if character == \"u\"\n character = \"a\"\n new_name << character\n elsif vowel_string.include? character\n character = vowel_string[vowel_string.index(character) +1]\n new_name << character\n else\n new_name << character\n end\n end\n new_name.join(\"\").split(\" \").each {|word| word.capitalize!}.join(\" \")\nend",
"def name_scrambler \n while gets.chomp != 'quit'\n puts \"Enter your first name: \"\n first_name = gets.chomp.downcase\n puts \"Enter your last name: \"\n last_name = gets.chomp.downcase\n \n new_first_name = next_letter(first_name)\n new_last_name = next_letter(last_name)\n fake_name = new_last_name.capitalize + \" \" + new_first_name.capitalize\n puts \"This is your new name: #{fake_name}.\" \n \n new_names = {}\n new_names[\"#{first_name} #{last_name}\"] = fake_name \n puts new_names \n end\nend",
"def cypher(name)\n consonants = \"bcdfghjklmnpqrstvwxyz\"\n vowels = \"aeiou\"\n\tnew_name = split_reverse(name).map! { |name| \n\t\tname.chars.map! { |char| \n\t\t\tif consonants.include?(char)\n\t\t\t \tconsonant(char)\n\t\t\telsif vowels.include?(char) \n\t\t\t\tvowel(char)\n\t\t\telsif consonants.upcase.include?(char) || vowels.upcase.include?(char) \n\t\t\t\tupcase(char)\n\t\t\telse\n\t\t\t\tspecial_char(char)\n\t\t\tend\n\t\t}\n\t}\n\tjoin(new_name)\nend",
"def pig_latin_name(word)\n \n letters = word.split(\"\")\n \n final_array = letters.clone\n letters.each do |letter| #[p, l, u, m]\n \n \n if is_consonants?(letter)\n final_array.rotate! \n # #puts \".........#{removed_consonant}\"\n # #letters.push(removed_consonant)\n # puts \".........#{final_array}..#{letters}\"\n else \n # puts \"*****#{final_array}.... #{letters}\"\n final_array.push(\"ay\")\n return final_array.join\n end\n end\nend",
"def make_vowel_change(first)\n\tnew_first = first.split(\"\") \n\ti = 0\n\tfake_firstname = \"\"\n\tlengthfirst = first.length\n\twhile i < lengthfirst\n\tif new_first[i] == \"a\"\n\t\tfake_firstname += \"e\"\n\telsif new_first[i] == \"e\"\n\t\tfake_firstname += \"i\"\n\telsif new_first[i] == \"i\"\n\t\tfake_firstname += \"o\"\n\telsif new_first[i] == \"o\"\n\t\tfake_firstname += \"u\"\n\telsif new_first[i] == \"u\"\n\t\tfake_firstname == \"a\"\n\telsif (new_first[i] != \"a\" || new_first[i] !=\"e\" || new_first[i] != \"i\" || new_first[i] != \"o\" || new_first[i] != \"u\")\n\t\tfake_firstname += new_first[i]\n\tend\n\ti+=1 \n\tend \n\tfake_firstname\nend",
"def alias_interface\r\n\talias_database = {}\r\n\r\n\tputs \"Push ENTER to run program (Type quit to exit)\"\r\n\tuser_input = gets.chomp\r\n\r\n\tuntil user_input == \"quit\"\r\n\r\n\t\tputs \"Please enter first name:\"\r\n\t\tfirst_name = gets.chomp\r\n\r\n\t\tputs \"Please enter last name:\"\r\n\t\tlast_name = gets.chomp\r\n\r\n\t\tcode_name = consonant_converter(vowel_converter(name_swap(first_name, last_name)))\r\n\r\n\t\tfirst_name = first_name + \" \"\r\n\r\n\t\tfull_name = first_name + last_name\r\n\r\n\t\talias_database[full_name] = code_name\r\n\r\n\t\tputs \"Push ENTER to run program again (Type quit to exit)\"\r\n\t\tuser_input = gets.chomp\r\n\r\n\tend\r\n\talias_database.each_pair {|full_name, code_name| puts \"#{code_name} is actually #{full_name}\"}\r\nend",
"def translate(string)\n newArr = []\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n \n # * Split it into words\n words = string.split()\n\n # * For every word in the sentence...\n words.each do |word|\n # * If the word has 'qu'\n if word[1..2].downcase == \"qu\"\n newArr << word[3..-1] + word[0..2] + \"ay\"\n\n elsif word[0..1].downcase == \"qu\"\n newArr << word[2..-1] + word[0..1] + \"ay\"\n\n # * If it starts with a vowel\n elsif vowels.include?(word[0].downcase)\n newArr << word + \"ay\"\n\n # * If the first three consonants aren't vowels\n elsif not vowels.include?(word[0].downcase) and not vowels.include?(word[1]) and not vowels.include?(word[2])\n newArr << word[3..-1] + word[0..2] + \"ay\" \n # * ...or if the first two consonants aren't vowels\n elsif not vowels.include?(word[0].downcase) and not vowels.include?(word[1])\n newArr << word[2..-1] + word[0..1] + \"ay\" \n \n # * After all that, if it starts with one consonant\n else\n newArr << word[1..-1] + word[0] + \"ay\"\n end\n end\n\n newArr.join(\" \")\nend",
"def code_name(word)\n#set a new word to an empty string, we are going to fill it using the rest of the loop:\n\tnew_word = \"\"\n#start index at 0\n\ti = 0\n#loop through the string:\n\twhile i < word.length\n#letter is going to be the index of the word put in, starting at the 0 position until the end of the word's length\n\tletter = word[i]\n#if a space is found, add a space to the new word\n\t\tif letter == ' '\n\t\tnew_word += ' '\n#everything else, find the next letter or the next vowel or next edge case, and add it to the new word\n\t\telse\n\t\t letter == letter.downcase\n\t\tnew_word += vowels_and_edges(letter)\n \t\tend\n \t\ti += 1\n end\n#should result in a new word, when all strings are pieced together \n new_word\nend",
"def pig_latin_name(word)\n# and returns a new string (pig latinified)\n# need to define vowels (can be an array?)\n vowels_list = vowels\n# break word into letters\n letters = word.split(\"\")\n# iterate through each letter of the word\n# until we hit a vowel\n letters.each do |letter|\n\n # check if first letter is vowel or consonant\n if is_consonant?(letter)\n # move it to the end\n removed_consonant = letters.shift\n letters = letters + removed_consonant.split\n #\n else\n letters.push(\"ay\")\n return letters.join\n end\n\n # then add \"ay\" at the end and return\n end\n\nend"
] |
[
"0.79662883",
"0.7713442",
"0.7711268",
"0.7619452",
"0.7580007",
"0.7563903",
"0.7547847",
"0.7466393",
"0.74379456",
"0.7319693",
"0.72768354",
"0.72687477",
"0.72406626",
"0.72405505",
"0.72147334",
"0.72056395",
"0.71974885",
"0.7190954",
"0.71695256",
"0.7083699",
"0.7063513",
"0.7018067",
"0.7012386",
"0.7008641",
"0.69936997",
"0.6965421",
"0.6935749",
"0.6926707",
"0.6888155",
"0.6874189",
"0.68732226",
"0.6858778",
"0.68566716",
"0.6849706",
"0.6841717",
"0.6822442",
"0.6814193",
"0.6783077",
"0.67822725",
"0.6771032",
"0.6758337",
"0.67559445",
"0.67550963",
"0.6753017",
"0.6740199",
"0.6709102",
"0.67084163",
"0.67004603",
"0.6693581",
"0.66834617",
"0.66690934",
"0.66635716",
"0.6661482",
"0.6648143",
"0.66395867",
"0.66320497",
"0.6630956",
"0.6619944",
"0.66020936",
"0.66002595",
"0.6583607",
"0.6542278",
"0.65399736",
"0.6532593",
"0.6530588",
"0.65299773",
"0.65298253",
"0.6512887",
"0.6512033",
"0.6503217",
"0.6502021",
"0.64946944",
"0.6492021",
"0.6486447",
"0.64788634",
"0.6460625",
"0.6455499",
"0.6453593",
"0.6449006",
"0.6436255",
"0.6430488",
"0.64144206",
"0.6410269",
"0.6382487",
"0.63740945",
"0.6356109",
"0.63390374",
"0.6332711",
"0.6329311",
"0.6321895",
"0.6299176",
"0.629849",
"0.62821364",
"0.6280634",
"0.6270072",
"0.6268205",
"0.6251021",
"0.623628",
"0.6235808",
"0.6222942"
] |
0.7218378
|
14
|
=begin Savings Related =end
|
def update_total_savings_account
incoming = member.savings_entries.where(
:savings_status => SAVINGS_STATUS[:savings_account],
:direction => FUND_DIRECTION[:incoming]
).sum("amount")
outgoing = member.savings_entries.where(
:savings_status => SAVINGS_STATUS[:savings_account],
).sum("amount")
self.total_savings_account = incoming - outgoing
self.save
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def savings(inc_vat:)\n price_calculator.savings(inc_vat: inc_vat)\n end",
"def stock_market; end",
"def savings\n read_attribute(:price) - read_attribute(:sale_price)\n end",
"def annualized_portfolio_amount_needed\n savings_portion_needed * 12.0\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 investor\n end",
"def sales\n end",
"def savings\n if raw_data[:PackagePrice] && raw_data[:PackagePrice][:TotalSavings]\n Money.new(raw_data[:PackagePrice][:TotalSavings][:Value].to_f * 100, raw_data[:PackagePrice][:TotalSavings][:Currency])\n else\n nil\n end\n end",
"def required_annual_savings\n needed_amount_less_savings / years_to_retirement\n end",
"def set_finance\r\n end",
"def spend\n self\n end",
"def pay_slip\n \n end",
"def revenue\n##ONLY ONE I NEED TO WORK ON!!!!\n\n end",
"def weighIntrade()\n\n end",
"def franchisee_royalty_pay_slip\n \n end",
"def _spent_on\n return payment\n end",
"def trade; end",
"def stocks\n\n end",
"def getSavingsWithdrawalTransactionObjName\r\n\t\t return \"mfiforce__savings_withdrawal_transaction__c\"\r\n\t\tend",
"def investment\n if buy_price\n num_of_shares * buy_price\n end\n end",
"def getSavingsAccountInterestObjName\r\n\t\t return \"mfiforce__savings_account_interest__c\"\r\n\t\tend",
"def calculate_invoice\n @event.category == \"bill\" ? \"Bill-#{Time.now.strftime(\"%Y\")}/1\" : \"Quotation-#{Time.now.strftime(\"%Y\")}/1\"\n end",
"def invested(domain)\n #identify unique rounds to this vc\n #go through my startups and identify the domain \n #if domain string == the startup domain, return the startup investment \n myStartupRound = FundingRound.all.select do |round|\n round.startup.domain == domain\n end\n myInvestment = myStartupRound.map do |round|\n round.investment\n end\n myInvestment.sum\n end",
"def savings_portion_needed\n adjusted_target_income - (self.social_security + self.pensions + self.other_income)\n end",
"def period; end",
"def period; end",
"def period; end",
"def only_savings_payment?\n (has_paid == true ) && (only_savings == true ) && (no_payment == false ) && \n (not transaction_activity_id.nil? ) && \n (week_number != nil) && (is_independent_weekly_payment == false ) # the true case is handled by only_savings_independent_payment?\n end",
"def unit_saving(point)\n point.price - price\n end",
"def consumption_total_period_to_invoice\n ctp = consumption_total_period\n meter.is_shared? ? (ctp / meter.shared_coefficient).round : ctp\n end",
"def update_warehouse(event, amount, sim, period)\n\t\tamount = truncate(amount)\n\t\t#period -= 1\n\t\tcase event\n\t\t when \"payments_received\" \n\t\t\t\t#add amount this to the total payments received this period\n\t\t\t\tsim.aggregates['payments_received'][period] += amount\n\t\t\t\tsim.aggregates['period_cash_flow'][period] += amount\n\t\t \n\t\t when \"capital_deployed\" \n\t\t\t\t#add this to the total capital deployed this period\n\t\t\t\tsim.aggregates['capital_deployed'][period] += amount\n\t\t\t\tsim.aggregates['period_cash_flow'][period] -= amount\n\t\t\t\tsim.aggregates['cumulative_capital_in'][period] += amount\n\t\t \n\t\t when \"residual_value_tangible\" \n\t\t\t\t#add this to the total capital deployed this period\n\t\t\t\tsim.aggregates['residual_value_tangible'][period] += amount\n\t\t\t\tsim.aggregates['period_cash_flow'][period] += amount\n\t\t \n\t\t else raise \"unsupported warehouse event\"\n\t\tend\n\tend",
"def current_commission\n if timesheets.current_week.any?\n pay = timesheets.current_week.distinct.sum(:gross_pay)\n bill = timesheets.current_week.distinct.sum(:total_bill)\n (bill - pay) /2 * 0.05 #FAKE COMMISSION RATE\n else\n 0.00\n end\n end",
"def check_saving\n \t\tputs \"Looking up savings!\"\n \t\tputs self.savings\n \t\tself\n \tend",
"def record_sales\n @deleted_lines.each {|l| l.delete}\n @deleted_lines.clear\n calc_values\n save\n @lines.each do |li|\n li.li_order_id = @data_object.order_id\n li.save\n end\n end",
"def profit\n \tself.bid - self.payout\n end",
"def sales_invoice?\n false\n end",
"def sales_invoice?\n false\n end",
"def new_sale_price \n noi(num_years_to_hold + 1) / cap_rate(num_years_to_hold + 1)\n end",
"def revenue\n end",
"def market\n end",
"def getSavingsPaymentCollectionRecordObjName\r\n\t\t return \"mfiforce__savings_payment_collection_record__c\"\r\n\t\tend",
"def prepare_interest_svc_line(batch, facility)\r\n interest = insurance_payment_eob.claim_interest.to_f\r\n charge = service_procedure_charge_amount.to_f\r\n\r\n if facility.details[:service_date_from]\r\n min_date = insurance_payment_eob.find_least_date_for_interest_svc_line\r\n end\r\n min_date ||= batch.bank_deposit_date\r\n insurance_payment_eob.total_submitted_charge_for_claim =\r\n ( insurance_payment_eob.total_submitted_charge_for_claim - charge )+ interest\r\n insurance_payment_eob.total_amount_paid_for_claim =\r\n ( insurance_payment_eob.total_amount_paid_for_claim - charge ) + interest\r\n insurance_payment_eob.save\r\n \r\n { :service_procedure_charge_amount => interest,\r\n :service_paid_amount => interest,\r\n :date_of_service_from => min_date, :date_of_service_to => min_date }\r\n end",
"def booking_deposit\n\n booking_amount\n\n end",
"def stderrs; end",
"def invested(domain)\n #binding.pry\n funding_rounds.select{|fr| fr.startup.domain == domain}.map{|fr| fr.investment}.sum\n end",
"def quarter_wind; end",
"def active_sale\n first_sale(active_sale_prices) if on_sale?\n end",
"def sale_params\n params.require(:sale).permit(:operation_date, :share_holder_id, :shares_required, :cash, :dividends, :adjustment, :share_type_id)\n end",
"def amount_owed\n invoice_total - total_amount_paid\n end",
"def to_extend_now\n length = self.this_year.contract.contract_length \n auction_value = self.current_contract.subcontracts.first.salary_amount\n this_progression = SalaryProgression.find_by_auction_value(auction_value).attributes.to_a\n next_salary = this_progression[(length + 1)][1]\n return next_salary\n end",
"def dod_paygrade; end",
"def contract_saved contract\n\t\t@contract = contract\n\t\t@semesters = @contract.semesters\n\t\t# Prices\n\t\t@application_fee = Prices::application_fee\n\t\t@deposit = Prices::deposit(@semesters)\n\t\t@early_bird = Prices::early_bird(@semesters, Date.today)\n\t\t@rent = Prices::rent(@semesters)\n\t\t@parking = Prices::parking_price(@contract.parking_type, @semesters)\n\t\t@multiple_semesters = Prices::multiple_semester_discounts @semesters\n\n\t\t# Calculations\n\t\t@parking_price = 0\n\t\t@parking.each do |park|\n\t\t\t@parking_price += park\n\t\tend\n\t\t@early_bird_sum = 0\n\t\t@early_bird.each do |early|\n\t\t\t@early_bird_sum += early\n\t\tend\n\t\t@multiple_semesters_sum = 0\n\t\t@multiple_semesters.each do |discount|\n\t\t\t@multiple_semesters_sum += discount\n\t\tend\n\n\t\t@euro = 0\n\t\t@euro = 50 unless @contract.euro.empty?\n\t\t@discounts_total = @early_bird_sum + @multiple_semesters_sum + @euro\n\n\t\t@rent_sum = 0\n\t\t@rent.each do |rent|\n\t\t\t@rent_sum += rent\n\t\tend\n\t\t@total = @application_fee + @deposit + @rent_sum + @parking_price - @discounts_total\n\n\t\tmail to: ['managers@windsormanor.net', @contract.email],\n\t\t\tsubject: 'Your Receipt for Windsor Manor'\n\tend",
"def period_helper\n \"#{@sprint_start_date } - #{@sprint_end_date}\"\n end",
"def book_quantity(period='enddate', basis, exclude)\n volarray = []\n sales = self.book_sales(period, basis, exclude)\n sales.each do |sale|\n volarray << sale.quantities_by_band.inject(0) { |sum, i| sum + i }\n end\n book_quantity = volarray.inject(0) { |sum, i| sum +i.to_f }\n end",
"def needed_amount_less_savings\n recommended_min_portfolio - portfolio_after_growth\n end",
"def booking_invoice\n NotificationsMailer.with(sports_centre: SportsCentre.first, order: Order.first).booking_invoice\n end",
"def print\n current_ts = Timesheet.find(params[:current_ts_id])\n if params[:weekof].present?\n weekof = Date.parse(params[:weekof]) \n else\n weekof = Date.today\n end\n name = User.current.firstname\n wage = User.current.wage.amount.to_s\n current = Date.today\n\n #TODO change the name of the default scopes on TimeEntry for dates, they need to express that the collection includes the dates indicated.\n usrtiments = TimeEntry.foruser(User.current).after(weekof).before(weekof + 6.days) #this use of before and after is cool\n\n mon = (usrtiments.select {|t| t.spent_on == weekof}).inject(0) {|sum, x| sum + x.hours}\n tue = (usrtiments.select {|t| t.spent_on == (weekof + 1)}).inject(0) {|sum, x| sum + x.hours} \n wed = (usrtiments.select {|t| t.spent_on == (weekof + 2)}).inject(0) {|sum, x| sum + x.hours}\n thu = (usrtiments.select {|t| t.spent_on == (weekof + 3)}).inject(0) {|sum, x| sum + x.hours}\n fri = (usrtiments.select {|t| t.spent_on == (weekof + 4)}).inject(0) {|sum, x| sum + x.hours}\n sat = (usrtiments.select {|t| t.spent_on == (weekof + 5)}).inject(0) {|sum, x| sum + x.hours}\n sun = (usrtiments.select {|t| t.spent_on == (weekof + 6)}).inject(0) {|sum, x| sum + x.hours}\n\n hours = mon + tue + wed + thu + fri + sat + sun\n status =\"\"\n\n #need to check for valid datetime instead of nil\n if current_ts.paid != nil\n status = \"Paid\"\n elsif current_ts.paid == nil && current_ts.submitted != nil\n status = \"Submitted, but not paid\"\n else\n status = \"Not submitted and not paid\"\n end\n\n if hours == 0 || hours > 100\n #flash[:warning] = 'You do not have any hours for the specified week! Add hours to print a timecard.'\n flash[:warning] = 'Error, error! Either you are printing a timesheet with no need for payment or you got some wiring loose and logged too many hours.'\n redirect_to :action => 'employee_index' #potential problem with this when admin uses it\n else #method in timesheethelper\n send_data (generate_timesheet_pdf(name, wage, current, weekof, mon, tue, wed, thu, fri, sat, sun,status),\n :filename => name + \"_timecard_from_\" + weekof.to_s + \"_to_\" + (weekof + 6.days).to_s + \".pdf\",\n :type => \"application/pdf\")\n end\n end",
"def sales_invoice?\n false\n end",
"def quality_driven_software_export\n @from = Time.zone.now - 1.week\n @to = Time.zone.now\n end",
"def complete_investigation; end",
"def current_contract\n self.this_year.contract\n end",
"def reshare_lending_summary(model, institution, fiscal_year)\n\n # Get the prefix of the table for the reshare model\n prefix = table_name_prefix(model::Reshare)\n\n # Get the rollup of lending attempts\n model::Reshare::Transaction.connection.select_all(\n \"SELECT\n COALESCE(\n #{prefix}transactions.borrower, 'All Institutions'\n ) AS borrower,\n COUNT(DISTINCT #{prefix}transactions.request_id) AS total_requests,\n COUNT(DISTINCT #{prefix}transactions.request_id) FILTER (\n WHERE #{prefix}transactions.lender_status = 'RES_COMPLETE'\n ) AS complete,\n COUNT(DISTINCT #{prefix}transactions.request_id) FILTER (\n WHERE #{prefix}transactions.lender_status = 'RES_UNFILLED'\n ) as unfilled,\n COUNT(DISTINCT #{prefix}transactions.request_id) FILTER (\n WHERE #{prefix}transactions.lender_status = 'RES_CANCELLED'\n ) AS cancelled,\n COUNT(DISTINCT #{prefix}transactions.request_id) FILTER (\n WHERE #{prefix}transactions.lender_status NOT IN (\n 'RES_UNFILLED', 'RES_COMPLETE', 'RES_CANCELLED'\n )\n ) AS pending,\n ROUND(\n CAST(\n COUNT(DISTINCT #{prefix}transactions.request_id) FILTER (\n WHERE #{prefix}transactions.lender_status = 'RES_COMPLETE'\n ) AS DECIMAL\n ) / NULLIF(\n CAST(\n COUNT(DISTINCT #{prefix}transactions.request_id) FILTER (\n WHERE #{prefix}transactions.lender_status IN (\n 'RES_COMPLETE', 'RES_UNFILLED', 'RES_CANCELLED'\n )\n ) AS DECIMAL\n ), 0\n ), 2\n ) AS fill_rate,\n ROUND(AVG(#{prefix}lending_turnarounds.time_to_fill) FILTER (\n WHERE #{prefix}transactions.lender_status != 'RES_UNFILLED'\n ), 2) AS average_time_to_fill,\n ROUND(AVG(#{prefix}lending_turnarounds.time_to_ship) FILTER (\n WHERE #{prefix}transactions.lender_status != 'RES_UNFILLED'\n ), 2) AS average_time_to_ship,\n ROUND(AVG(#{prefix}lending_turnarounds.time_to_receipt) FILTER (\n WHERE #{prefix}transactions.lender_status != 'RES_UNFILLED'\n ), 2) AS average_time_to_receipt,\n ROUND(AVG(#{prefix}lending_turnarounds.total_time) FILTER (\n WHERE #{prefix}transactions.lender_status != 'RES_UNFILLED'\n ), 2) AS average_turnaround\n FROM #{prefix}transactions\n LEFT JOIN #{prefix}lending_turnarounds\n ON #{prefix}lending_turnarounds.request_id = #{prefix}transactions.lender_id\n WHERE #{prefix}transactions.lender = '#{institution}'\n AND #{prefix}transactions.date_created\n BETWEEN '#{fiscal_year-1}-07-01' AND '#{fiscal_year}-06-30'\n GROUP BY ROLLUP (borrower)\n ORDER BY borrower NULLS FIRST;\"\n ).rows\n end",
"def transfer_to_savings funds\n withdraw_checking(funds).deposit_savings(funds)\n return nil #No chaining after this method --subject to change--\n end",
"def payment_term; end",
"def business_decision_support \n end",
"def index\n @financial_reports = @company.financial_reports.annual.recent.include_statements\n end",
"def recurring; end",
"def getSavingsProductAccountingSetupObjName\r\n\t\t return \"mfiforce__savings_product_accounting_setup__c\"\r\n\t\tend",
"def nonprofit\n end",
"def document_fee\n 0\n end",
"def reporting\n # STUB\n end",
"def pay_targeted_invoices_first!\n payments.each do |pm|\n if pm.invoice\n @remaining_amounts[pm.invoice.fy_year] ||= Hash.new(0)\n if pm.invoice.canceled?\n @remaining_amounts[pm.invoice.fy_year][pm.invoice.object_type] += pm.amount\n else\n paid_amount = [[pm.amount, pm.invoice.missing_amount].min, 0].max\n pm.invoice.increment!(:paid_amount, paid_amount)\n @remaining_amounts[pm.invoice.fy_year][pm.invoice.object_type] += pm.amount - paid_amount\n end\n else\n @remaining_amount += pm.amount\n end\n end\n end",
"def total_to_be_disbursed_savings\n member_id_list = self.preserved_active_group_loan_memberships.map{|x| x.member_id }\n \n SavingBook.where(:member_id => member_id_list).sum(\"total_extra_savings\")\n end",
"def shipping_report\n @data.start_date = DionDate.new(\"start\", Time.now)\n @data.end_date = DionDate.new(\"end\", Time.now)\n shipping_report_common\n end",
"def invested(domain)\n FundingRound.all.inject(0) do |sum, funding_round|\n if (funding_round.venture_capitalist == self && funding_round.startup.domain == domain)\n sum += funding_round.investment\n else\n sum\n end\n end\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 getSavingsProductObjName\r\n\t\t return \"mfiforce__savings_product__c\"\r\n\t\tend",
"def payment_owed\n if workshop_price&.recurring_payments?\n to_pay = recurring_what_should_be_paid_by_now - amount_paid\n to_pay.negative? ? Money.new(0, workshop_price.price.currency) : to_pay\n else\n balance_owed\n end\n end",
"def sell_pending\n end",
"def amount; end",
"def update_defaultee_savings_deduction\n default_payment = self.default_payment \n total_compulsory_savings = self.total_compulsory_savings\n total_voluntary_savings = self.total_voluntary_savings\n total_deductible_member_savings = total_compulsory_savings + total_extra_savings\n \n # refresh the state \n default_payment.compulsory_savings_deduction_amount = BigDecimal(\"0\")\n default_payment.voluntary_savings_deduction_amount = BigDecimal(\"0\")\n default_payment.amount_to_be_shared_with_non_defaultee = BigDecimal(\"0\")\n \n total_amount = default_payment.outstanding_grace_period_amount \n \n if total_amount <= total_compulsory_savings\n default_payment.compulsory_savings_deduction_amount = total_amount \n elsif total_amount > total_compulsory_savings && total_amount <= total_deductible_member_savings \n default_payment.amount_of_compulsory_savings_deduction = total_compulsory_savings \n default_payment.voluntary_savings_deduction_amount = total_amount - total_compulsory_savings\n elsif total_amount > total_deductible_member_savings \n default_payment.compulsory_savings_deduction_amount = total_compulsory_savings \n default_payment.voluntary_savings_deduction_amount = total_extra_savings\n default_payment.amount_to_be_shared_with_non_defaultee = total_amount - total_deductible_member_savings\n end \n \n default_payment.save\n end",
"def total_budget=\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 book_royalty(period='enddate', basis=\"Net receipts\")\n royarray = []\n sales = self.book_sales(period, basis, false) # this calls the royalty calculation for net receipts\n sales.each do |sale|\n royarray << sale.royalty_by_band.inject(0) { |sum, i| sum + i.to_f unless i.nan? || i.nil? }\n end\n book_royalty = royarray.inject(0) { |sum, i| sum +i.to_f }\n end",
"def business_plan\n end",
"def interests\n\t\t\"rwe\"\n\tend",
"def share_prices\n stock_market.market.first\n end",
"def invoice!\n if self.chosen_presenter && self.rate \n Xero.invoice_booking(self)\n end\n end",
"def pre_pay_offered\n end",
"def tax_share_12\n tax_share(tax12)\n end",
"def sign_contract(venture_capitalist, investment, investment_amt)\n new_funding_round = FundingROund.new(self, venture_capitalist, investment, investment_amt )\nend",
"def income_this_week\n Sale.past_week.sum(:total)\n end",
"def invoice\n raise \"override in purchase_order or sales_order\"\n end",
"def invested(domain_string)\n total_invested = 0\n self.funding_rounds.each do |funding_round|\n if funding_round.startup.domain == domain_string\n total_invested += funding_round.investment \n end \n end \n return total_invested\n end",
"def pay_salaries(week)\n cpp = cost_payment_plan\n human_resources.each do |hr|\n nyd = 'Pago sueldo ' + hr.name\n am = hr.salary\n unless CostLine.where(name: nyd, payment_week: week).length > 0\n cl = CostLine.new(name: nyd, description: nyd,\n amount: am, real_amount: am,\n payment_week: week, real_payment_week: week,\n cost_payment_plan_id: cpp.id, status: 'Pagado',\n funding_source: 'Reserva de actividades')\n cl.save\n use_budget(cl)\n end\n end\n end",
"def integrations; end",
"def integrations; end",
"def price_adjustment \n price_adjustment_fixed / 100.0 \n end",
"def transaction_fee_invoice\n NotificationsMailer.with(sports_centre: SportsCentre.first, amountPaid: 32.00, poliId: \"345678976543\").transaction_fee_invoice\n end",
"def service_billing_period\n (self.service_period_start_on..self.service_period_end_on)\n end"
] |
[
"0.6275364",
"0.5767553",
"0.5746997",
"0.5744801",
"0.56642556",
"0.5645332",
"0.5603326",
"0.5585042",
"0.5562884",
"0.5536648",
"0.5533023",
"0.55208504",
"0.5501514",
"0.547009",
"0.54682106",
"0.54283625",
"0.54234743",
"0.54034615",
"0.5385218",
"0.538247",
"0.5351512",
"0.53512275",
"0.52917737",
"0.52660525",
"0.5248279",
"0.5248279",
"0.5248279",
"0.5244937",
"0.5239484",
"0.5217555",
"0.520323",
"0.5200555",
"0.5188317",
"0.51871663",
"0.5185793",
"0.51811576",
"0.51811576",
"0.51767874",
"0.51744807",
"0.5130159",
"0.51176107",
"0.51149684",
"0.5112189",
"0.50945294",
"0.50929284",
"0.5089925",
"0.50868297",
"0.5086047",
"0.5055801",
"0.5054864",
"0.50481725",
"0.5043038",
"0.5040193",
"0.50397855",
"0.502727",
"0.50239724",
"0.5020294",
"0.5016816",
"0.5014217",
"0.5004366",
"0.49938595",
"0.49916193",
"0.49879268",
"0.49803492",
"0.49802047",
"0.4976176",
"0.4972706",
"0.4970218",
"0.49692893",
"0.49679312",
"0.49634144",
"0.4958644",
"0.49546644",
"0.49538785",
"0.49504623",
"0.49482256",
"0.4941602",
"0.49403176",
"0.493048",
"0.49283978",
"0.49283952",
"0.49254915",
"0.49237448",
"0.4922637",
"0.49180526",
"0.4915738",
"0.4914709",
"0.49116978",
"0.4909745",
"0.49018043",
"0.48890483",
"0.48830608",
"0.48821157",
"0.48759058",
"0.48723757",
"0.48674348",
"0.48674348",
"0.48608512",
"0.48582003",
"0.4853454"
] |
0.51045537
|
43
|
metodo que crea los frames
|
def matrix
10.times do |round|
@score_table.push([])
rolls
if round == 9 && @suma == 10
if @suma == 10
@roll_three = rand(0..10)
@score += @roll_three
llenado(4, round)
end
else
llenado(3, round)
end
end
bonus = Score.new(@score_table)
bonus.bonus
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def setup_frames\n @frames ||=\n begin\n frames = 10.times.map {|i| Frame.new(i+1,0,0,0,nil)}\n # link frames\n (0...9).each {|i| frames[i].next_frame = frames[i+1]}\n frames\n end\n end",
"def build_frames\n prev_frame = nil\n 10.times.map do |frame_number|\n prev_frame = Frame.new(10 - frame_number, prev_frame)\n end.reverse!\n end",
"def frames; end",
"def load_frames\n\t\tw,h = @_w, @_h # convenience assignments\n\t\twt = 0.8 * w\n\t\tdw = 0.5 * (w-wt) \n\t img = Surface.new([w,h]).fill(@@bg_color)\n\t img.draw_polygon_s([[0,h], [dw,0], [dw+wt,0], [w,h],[0,h]], BROWN)\n\t return [img]\n\tend",
"def create_frame\n @frame = Sprite.new(@viewport)\n end",
"def create_frame\n @current_frame = {\n :vlocks => {},\n :parent_frame => current_frame\n }\n end",
"def frames\n\t\tframes = [\"day\", \"week\", \"month\", \"year\"]\n\tend",
"def add_frame(frame)\n end",
"def create_frame_and_thumbnail\n if (File.extname(self.image_sequence) == \".mha\")\n file_path = Rails.root.join(dir_path, self.image_sequence)\n result = system(Rails.root.join('scripts','mha_to_png','bin',\"MhaToPng #{file_path} 1\").to_s)\n base_name = File.basename(file_path, \".mha\")\n image = MiniMagick::Image.open(\"#{dir_path}/#{base_name}_frame.png\")\n image.resize \"200x200\"\n image.format \"png\"\n image.write \"#{dir_path}/#{base_name}_thumbnail.png\"\n File.chmod(0644, \"#{dir_path}/#{base_name}_thumbnail.png\")\n self.thumbnail = \"#{base_name}_thumbnail.png\"\n self.frame = \"#{base_name}_frame.png\"\n end\n end",
"def next_frame\n #populate our @channels instance vaiable\n create_channel_list\n do_frame_lookup\n\n if File.exist?(\"/home/lee/src/eyebleach/test_images/#{message[:channel_name]}-frame#{message[:frame_no]}.gif\")\n image = Base64.encode64(File.open(\"/home/lee/src/eyebleach/test_images/#{message[:channel_name]}-frame#{message[:frame_no]}.gif\").read)\n frame_message :next_frame, image, message[:frame_no], @channels[message[:channel_name]], message[:channel_name]\n else\n image = Base64.encode64(File.open(\"/home/lee/src/eyebleach/test_images/#{message[:channel_name]}-frame0.gif\").read)\n frame_message :next_frame, image, 0, @channels[message[:channel_name]], message[:channel_name]\n end\n end",
"def catchupFrames(fromFrameNo, toFrameNo)\r\n #puts \"#{fromFrameNo} --> #{toFrameNo}\"\r\n for i in fromFrameNo..toFrameNo do\r\n #puts \"Catching up frame #{i}:\";\r\n if @frames.length <= i then\r\n @frames[i] = Frame.new(self);\r\n @frames[i-1].pixmaps.each do |pixmap|\r\n @frames[i].addPixmap(pixmap)\r\n end\r\n end\r\n end\r\n return @frames[toFrameNo];\r\n end",
"def create_graphics\n create_viewport\n create_base_ui\n create_pocket_ui\n create_scroll_bar\n create_bag_sprite\n create_item_list\n create_arrow\n create_info\n create_shadow\n create_search\n create_frame # Should always be last\n end",
"def initialize(dir, filename, hue = 0)\r\n @frames = []\r\n @currentFrame = 0\r\n @framecount = 0\r\n panorama = RPG::Cache.load_bitmap(dir, filename, hue)\r\n if filename[/^\\[(\\d+)(?:,(\\d+))?\\]/] # Starts with 1 or 2 numbers in brackets\r\n # File has a frame count\r\n numFrames = $1.to_i\r\n delay = $2.to_i\r\n delay = 10 if delay == 0\r\n raise \"Invalid frame count in #{filename}\" if numFrames <= 0\r\n raise \"Invalid frame delay in #{filename}\" if delay <= 0\r\n if panorama.width % numFrames != 0\r\n raise \"Bitmap's width (#{panorama.width}) is not divisible by frame count: #{filename}\"\r\n end\r\n @frameDelay = delay\r\n subWidth = panorama.width / numFrames\r\n for i in 0...numFrames\r\n subBitmap = BitmapWrapper.new(subWidth, panorama.height)\r\n subBitmap.blt(0, 0, panorama, Rect.new(subWidth * i, 0, subWidth, panorama.height))\r\n @frames.push(subBitmap)\r\n end\r\n panorama.dispose\r\n else\r\n @frames = [panorama]\r\n end\r\n end",
"def frame; end",
"def set_canvas_frame(canvasFrame_wnd)\r\n canvasFrame = FXVerticalFrame.new(canvasFrame_wnd, FRAME_THICK|LAYOUT_FILL_Y|LAYOUT_TOP|LAYOUT_LEFT)\r\n canvasFrame.create\r\n \r\n #p \"**** set frame...\"\r\n if @game_cmd_bt_list.size > 0 \r\n # send canvas size changed\r\n @app_owner.activate_canvas_frame\r\n return\r\n end\r\n \r\n label_wnd = FXLabel.new(canvasFrame, \"Comandi gioco \", nil, JUSTIFY_LEFT|LAYOUT_FILL_X)\r\n label_wnd.create\r\n \r\n bt_wnd_list = []\r\n bt_wnd_list << FXButton.new(canvasFrame, \"uno\", @app_owner.icons_app[:numero_uno], nil, 0,FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_BOTTOM|LAYOUT_LEFT,0, 0, 0, 0, 10, 10, 5, 5)\r\n bt_wnd_list << FXButton.new(canvasFrame, \"due\", @app_owner.icons_app[:numero_due], nil, 0,FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_BOTTOM|LAYOUT_LEFT,0, 0, 0, 0, 10, 10, 5, 5)\r\n bt_wnd_list << FXButton.new(canvasFrame, \"tre\", @app_owner.icons_app[:numero_tre], nil, 0,FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_BOTTOM|LAYOUT_LEFT,0, 0, 0, 0, 10, 10, 5, 5)\r\n \r\n bt_wnd_list.each do |bt_wnd|\r\n bt_wnd.iconPosition = (bt_wnd.iconPosition|ICON_BEFORE_TEXT) & ~ICON_AFTER_TEXT\r\n bt_hash = {:bt_wnd => bt_wnd, :status => :not_used}\r\n @game_cmd_bt_list << bt_hash\r\n bt_wnd.create\r\n end\r\n free_all_btcmd # hide all commands buttons\r\n \r\n # send canvas size changed\r\n @app_owner.activate_canvas_frame\r\n end",
"def frames\n @frames ||=\n search('frame').map { |node| Frame.new(node, @mech, self) }\n end",
"def frames\n @frames ||=\n search('frame').map { |node| Frame.new(node, @mech, self) }\n end",
"def initialize(frames = 1024)\n $frames = Frame.new(1024)\n $bm = Bitmap.new(1024)\n\n init_segment_table\n end",
"def initial_frame(bindings); end",
"def rasterise \r\n @frames.each do |frame|\r\n printf '.';\r\n canvas = Canvas.new(@width, @height);\r\n @canvases.push(canvas);\r\n if frame.pixmaps.length == 0 then next; end;\r\n frame.pixmaps.each do |pixmap|\r\n img = pixmap.sprite.getImage(pixmap.frame);\r\n pixmap.frame = (pixmap.frame + 1) % (pixmap.sprite.images.length);\r\n canvas.add(img, pixmap.x, pixmap.y);\r\n end\r\n end \r\n end",
"def frame=(pos); end",
"def initialize(swf, id, frame_count)\n #initialize/assign defaults\n @swf = swf\n @frame_count = frame_count\n @frame_labels = {}\n @frames = [nil] #frame 0 is empty\n \n #private vars\n @blend_mode = nil\n @cache_as_bitmap = false\n @classname = nil\n @frame = Frame.new\n @name = \"Sprite#{id}\"\n \n end",
"def create\n @frame = Frame.new(params[:frame])\n\n respond_to do |format|\n if @frame.save\n format.html { redirect_to @frame, notice: 'Frame was successfully created.' }\n format.json { render json: @frame, status: :created, location: @frame }\n else\n format.html { render action: \"new\" }\n format.json { render json: @frame.errors, status: :unprocessable_entity }\n end\n end\n end",
"def frame(options)\n set RGhost::Frame.new(options)\n end",
"def create_and_push_frame_manager(bindings, _pry_, options = T.unsafe(nil)); end",
"def create\r\n @pad = Pad.find(:first, :conditions => [\"id=?\", params[:frame][:pad_id]])\r\n @frame = Frame.new\r\n @frame.name = params[:frame][:name]\r\n @frame.pad_id = params[:frame][:pad_id]\r\n @frame.descr = params[:frame][:descr]\r\n @frame.image = params[:frame][:image]\r\n respond_to do |format|\r\n @pad.frames << @frame\r\n format.html { redirect_to @frame, notice: 'Frame was successfully created.' }\r\n format.json { render json: @frame, status: :created, location: @frame }\r\n end\r\n end",
"def prepare_strip\r\n @strip = []\r\n for i in 0...@totalFrames\r\n bitmap = Bitmap.new(@width,@height)\r\n bitmap.stretch_blt(Rect.new(0,0,@width,@height),@bitmaps[i],Rect.new(0,0,@width,@height))\r\n @strip.push(bitmap)\r\n end\r\n end",
"def at n\n frame = nil\n @avi.process_movi do |indices, movi|\n m = indices[n]\n unless m.nil?\n movi.pos = m[:offset] + 8\n frame = Frame.new(movi.read(m[:size]), m[:id], m[:flag])\n movi.rewind\n end\n [indices, movi]\n end\n frame\n end",
"def createFrame(var_Object, var_Store)\n \n Common::Logger.print(Common::VAR_DEBUG, self, \"[createFrame]: Creating frame for [#{var_Object.to_s()}]\")\n \n binderList = createBinder(var_Object, var_Store)\n \n Common::Logger.print(Common::VAR_DEBUG, self, \"[createFrame]: Created binder list, lenght \" +\n \"[#{binderList.to_s()}], data [#{binderList.to_s()}]\")\n \n frame = Frame.new(binderList)\n \n Common::Logger.print(Common::VAR_DEBUG, self, \"[createFrame]: Created frame\\n[#{frame.to_s()}]\")\n \n return Frame.new(binderList)\n end",
"def build(filename, frames)\n frames = normalize_depth frames, to: 3 # frames are rows of pixels\n pixel_args = frames.flat_map.with_index do |rows, z|\n width, height = frames.first.first.length, frames.first.length\n [ '(',\n '-size', \"#{width}x#{height}\", 'xc:none',\n '-frame', z.to_s,\n *rows.flat_map.with_index { |pixels, y|\n pixels.flat_map.with_index do |pixel, x|\n color = if pixel[:transparent]\n ['-alpha', 'Transparent']\n else\n [\"-fill\", \"RGB(#{pixel.fetch :red},#{pixel.fetch :green},#{pixel.fetch :blue})\",\n \"-draw\", \"point #{x},#{y}\"\n ]\n end\n end\n },\n ')',\n ]\n end\n\n if File.exist? filename\n puts \"skipping #{filename}\"\n else\n program = 'convert', '-coalesce', *pixel_args, filename\n puts program.join ' '\n system *program\n end\nend",
"def convert_frames\n MiniMagick.configure do |config|\n config.validate_on_create = false\n end\n\n Dir[\"#{templates_path}/**/*.psd\"].each do |psd|\n resulting_path = psd.gsub('.psd', '.png')\n next if File.exist?(resulting_path)\n\n UI.important \"Converting PSD file '#{psd}'\"\n image = MiniMagick::Image.open(psd)\n\n if psd =~ /iPhone-SE/\n UI.success \"Removing white background 🚫 ⬜️\"\n\n # The iPhone-SE screenshots from April 2016 have\n # 3 layers, a background, a product, and the 'put your image here' layer\n # imagemagick seems to add an additional layer with no label which this the\n # composite of all three. We want to remove the background and composite layer\n good_layers = image.layers.reject do |layer|\n label = layer.details['Properties']['label']\n label.to_s.length == 0 || label =~ /White B/i\n end\n product_layer = good_layers.shift\n\n good_layers.each do |layer|\n product_layer.layers << layer\n end\n\n image = product_layer\n end\n\n if image\n image.format 'png'\n image.trim\n\n image.write(resulting_path)\n else\n UI.error \"Could not parse PSD file at path '#{psd}'\"\n end\n end\n end",
"def push frame\n raise TypeError unless frame.kind_of? Frame\n @avi.process_movi do |indices, movi|\n this_size = movi.size\n movi.pos = this_size\n movi.print frame.id\n movi.print [frame.data.size].pack('V')\n movi.print frame.data\n movi.print \"\\0\" if frame.data.size % 2 == 1\n indices << {\n :id => frame.id,\n :flag => frame.flag,\n :offset => this_size,\n :size => frame.data.size,\n }\n [indices, movi]\n end\n self\n end",
"def prepare_parsed_frame frame\n end",
"def create\n @frame = Frame.new({knocked_pins:frame_params[:knocked_pins],frame:frame_params[:frame],turn:frame_params[:turn],player_id:frame_params[:player_id]})\n\n respond_to do |format|\n if @frame.save\n format.html {redirect_back fallback_location: root_path}\n format.json { render :show, status: :created, location: @frame }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @frame.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_backgrounds\n create_over\n create_hud_bg\n create_under\n create_flow\n end",
"def create_graphics\n create_viewport\n @all_window = UI::SpriteStack.new(@viewport)\n create_background\n create_windows\n @all_window.each { |window| window.visible = false } if @delete_game\n @max_index = @all_window.size - 1\n Graphics.sort_z\n refresh\n end",
"def create\n @game = Game.find_by_id(params[:game_id])\n @frame_by_user = FrameByUser.where(user_id: params[:frame][:user_id], game_id: params[:game_id]).first\n @frame = Frame.new(frame_params.merge(frame_by_user: @frame_by_user, turn: @frame_by_user.game.turn))\n unless @frame.save\n @game_id = params[:game_id]\n @game = Game.find_by_id(@game_id)\n render :new\n return nil\n end\n update_past()\n set_score_general()\n set_turn_general()\n set_winner() if @game.turn == 10\n redirect_to Game.find_by_id(params[:game_id]), notice: 'Frame was successfully created'\n end",
"def create_graphics\n super()\n create_background\n create_type_background\n create_pokemon_battler_stack\n create_pokemon_text_boxes\n create_congratulation_text_boxes\n create_pokemon_stars_animation\n create_graveyard_anim\n create_turning_ball\n create_party_battler_stack\n create_league_champion_text_box\n create_trainer_infos_text_box\n create_end_stars\n end",
"def create_graphics\n create_viewport\n create_base_ui\n create_credit_payout\n create_bands\n end",
"def create_graphics\n create_viewport\n create_base_ui\n create_sub_background\n create_trainer_sprite\n create_badge_sprites\n create_texts\n end",
"def create_graphics\n create_viewport\n create_background\n create_pokemon_sprite\n create_egg_sprite\n end",
"def to_frame(frame)\r\n # checks if specified string parameter\r\n if frame.is_a?(String)\r\n if frame == \"last\"\r\n frame = @totalFrames - 1\r\n else\r\n frame = 0\r\n end\r\n end\r\n # sets frame\r\n frame = @totalFrames - 1 if frame >= @totalFrames\r\n frame = 0 if frame < 0\r\n @currentIndex = frame\r\n end",
"def create\n @game_id = params[:game_id]\n @players = User.where(:id => Game.find(@game_id).score_board.keys)\n @frame = Frame.new(frame_params.merge!(game_id: @game_id))\n respond_to do |format|\n if @frame.save\n format.html { redirect_to game_frames_url, notice: 'Frame was successfully created.' }\n format.json { render :index, status: :created, location: @frame }\n else\n format.html { render :new }\n format.json { render json: @frame.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @frame = Frame.new(frame_params)\n frame_storage = FrameStorage.find(params[:frame_storage_id].to_i)\n begin\n Frame.transaction do\n @frame.save\n frame_storage.update_attributes(:frame_id=>@frame.id)\n @frame.batch_create_boxer_storage\n end\n redirect_to @frame, notice: 'Container was successfully created.'\n rescue\n puts '创建架子规格及存储架子的空间出错!'\n render :new\n end\n\n end",
"def create_graphics\n create_viewport\n create_background\n create_buttons\n init_entering\n end",
"def create_graphics\n create_viewport\n create_base\n create_ui\n end",
"def initialize\r\n super\r\n #print \"Se crea un pez\\n\"\r\n @image = Image[\"pez3.png\"]\r\n # Hacer que el pez se mueva\r\n @animation = Chingu::Animation.new(:file => \"pezcompleto_50x33.bmp\")\r\n @animation.frame_names = { :izquierda => 0...2, :derecha => 2...4 }\r\n @frame_name = :izquierda\r\n\r\n @direccion = Direccion.new($window.width, $window.height, 10, @image.width, @image.height)\r\n @pez_vivo = true\r\n # print @image.width.to_s + \", \" + @image.height.to_s + \" -- \"\r\n # print $window.width.to_s + \", \" + $window.height.to_s + \"\\n\"\r\n @z = 1\r\n @nombre = rand.to_s\r\n @ultimo = self\r\n @genero = 1\r\n @vida = 5\r\n @vida_inicio = Time.now\r\n @vida_desviacion = rand(5)\r\n @reproducir = 2 # tiempo que espera para reproducirse\r\n @reproducir_veces1 = 0 # veces que se ha reproducido\r\n @reproducir_veces2 = 5 # maximo de veces que puede reproducirse\r\n @reproducir_puede = false\r\n @reproducir_inicio = Time.now\r\n @reproducir_desviacion = rand(5)\r\n @libre = true # Es para saber si el pez se puede mover hacia otra comida\r\n @perseguido = false # Es para saber si el pez debe evitar una coordenada\r\n @evitarx = 0 # Coordenadas a evitar si es perseguido\r\n @evitary = 0 # Coordenadas a evitar si es perseguido\r\n\r\n end",
"def create\n game = Game.find(params[:game_id])\n\n ball_1 = params[:ball_1].empty? ? nil : params[:ball_1]\n ball_2 = params[:ball_2].empty? ? nil : params[:ball_2]\n ball_3 = params[:ball_3]\n @frame = game.frames.create(:ball_1 => ball_1, :ball_2 => ball_2, :ball_3 => ball_3, :number_frame => game.current_frame+1) \n if @frame.errors.any?\n flash[:errors] = @frame.errors.full_messages\n else\n game.add_frame\n game.reload\n @frame.calculate_points\n end\n if game.finished?\n redirect_to game_path(game), notice: 'Game was successfully created.'\n else \n redirect_to new_frame_path(game), notice: 'Game was successfully created.' \n end \n end",
"def show_frames\r\n jssh_command = \"var frameset = #{WINDOW_VAR}.frames;\r\n var elements_frames = new Array();\r\n for(var i = 0; i < frameset.length; i++)\r\n {\r\n var frames = frameset[i].frames;\r\n for(var j = 0; j < frames.length; j++)\r\n {\r\n elements_frames.push(frames[j].frameElement); \r\n }\r\n }\r\n elements_frames.length;\"\r\n \r\n jssh_command.gsub!(\"\\n\", \"\")\r\n $jssh_socket.send(\"#{jssh_command};\\n\", 0)\r\n length = read_socket().to_i \r\n \r\n puts \"There are #{length} frames\"\r\n \r\n frames = Array.new(length)\r\n for i in 0..length - 1 do\r\n frames[i] = Frame.new(self, :jssh_name, \"elements_frames[#{i}]\")\r\n end\r\n \r\n for i in 0..length - 1 do\r\n puts \"frame: name: #{frames[i].name}\"\r\n puts \" index: #{i+1}\"\r\n end\r\n end",
"def animation_set_sprites(frame)\n cell_data = frame.cell_data\n for i in 0..15\n sprite = @animation_sprites[i]\n next if sprite == nil\n pattern = cell_data[i, 0]\n if pattern == nil or pattern == -1\n sprite.visible = false\n next\n end\n if pattern < 100\n sprite.bitmap = @animation_bitmap1\n else\n sprite.bitmap = @animation_bitmap2\n end\n sprite.visible = true\n sprite.src_rect.set(pattern % 5 * 192,\n pattern % 100 / 5 * 192, 192, 192)\n if @animation_mirror\n sprite.x = @animation_ox - cell_data[i, 1]\n sprite.y = @animation_oy + cell_data[i, 2]\n sprite.angle = (360 - cell_data[i, 4])\n sprite.mirror = (cell_data[i, 5] == 0)\n else\n sprite.x = @animation_ox + cell_data[i, 1]\n sprite.y = @animation_oy + cell_data[i, 2]\n sprite.angle = cell_data[i, 4]\n sprite.mirror = (cell_data[i, 5] == 1)\n end\n sprite.z = self.z + 300 + i\n sprite.ox = 96\n sprite.oy = 96\n sprite.zoom_x = cell_data[i, 3] / 100.0\n sprite.zoom_y = cell_data[i, 3] / 100.0\n sprite.opacity = cell_data[i, 6] * self.opacity / 255.0\n sprite.blend_type = cell_data[i, 7]\n end\n end",
"def initialize\n self.frames = []\n self.options = {}\n reset_for_fullscreen\n end",
"def index\n @frames = Frame.all\n end",
"def index\n @frames = Frame.all\n end",
"def index\n @frames = Frame.all\n end",
"def index\n @frames = Frame.all\n end",
"def frame(text, char)\n\n longest_word_length = (text.map { |w| w.length }.max)\n frame_width = longest_word_length + 4\n\n frame_top_bottom = char*(frame_width)\n frame_arr = []\n\n #top of frame\n frame_arr.push(\"#{frame_top_bottom}\\n\")\n\n #middle of frame (content and the sides of the frame)\n text.each do |word|\n diff = longest_word_length - word.length\n spaces = ' '*diff\n frame_arr.push(\"#{char} #{word} #{spaces}#{char}\\n\")\n end\n\n #bottom of frame\n frame_arr.push(\"#{frame_top_bottom}\")\n frame_arr.join\nend",
"def create_all!\n if title_card_path.exist?\n Dir\n .glob(story.screenshots.join(\"*page*.png\"))\n .sort_by { |path| path.scan(/\\d+/).first.to_i }\n .each do |path|\n\n path.slice! File.extname(path) # drop the extension\n @paths[:pages] << absolute(path) # store the result in the index\n end\n return\n end\n\n FileUtils.mkdir_p story.screenshots\n browser.add_script_tag content: <<~JS\n pageflow.ready.then(function() {\n $('.multimedia_alert').remove()\n })\n JS\n\n # Grab all navigable pages.\n browser.goto story.url\n sleep 10\n pages = browser.css('#scrollytelling-navigation a')\n puts \"#{pages.length} screenshots in #{story.screenshots}\"\n\n pages.each_with_index do |link, index|\n perma_id = link.attribute('href')[/#(\\d*)\\z/, 1]\n url = [story.url, link.attribute('href')].join\n filename = [story.slug, 'page', index + 1, \"#{perma_id}.png\"].join('-')\n next if File.exist?(story.screenshots.join(filename))\n\n print \"#{url} \"\n browser.goto url\n sleep 3\n\n until browser.at_css('body').attribute('class').include? 'finished-loading'\n sleep 1\n end\n\n browser.screenshot(path: story.screenshots.join(filename))\n @paths[:pages] << absolute(story.screenshots.join(filename))\n puts \"✅ #{filename}\"\n end\n\n # Grab the opening page; when this exists, all screens are complete.\n browser.goto story.url\n sleep 10\n\n browser.screenshot(full: true, path: title_card_path)\n @paths[:title] = absolute(title_card_path)\n\n browser.quit\n end",
"def frame(id); end",
"def prepare_scores\n i = 0\n while @all_rolls[i]\n if(@all_rolls[i] == 10)\n #add empty second roll for strikes\n @all_rolls.insert(i+1, 0)\n end\n\n if(!@all_rolls[i+1])\n #allows for incomplete frames\n f = Frame.new(@all_rolls[i], 0)\n else\n #build frame\n f = Frame.new(@all_rolls[i], @all_rolls[i+1])\n end\n\n @all_frames.push(f)\n i += 2\n end\n \n #cushion to account for out of bounds errors\n @all_frames.push(Frame.new(0, 0))\n @all_frames.push(Frame.new(0, 0))\n end",
"def initialize\n @frame = Rect.zeroRect\n end",
"def frames(*frame_names)\n frame_names.each do |name|\n if name.respond_to?(:to_sym)\n name = name.to_s\n elsif name.respond_to?(:to_str)\n name = name.to_str\n else\n raise ArgumentError, \"frame names should be strings, got #{name.inspect}\"\n end\n\n name = name.to_s\n if name !~ /^\\w+$/\n raise ArgumentError, \"frame names can only contain alphanumeric characters and _, got #{name}\"\n end\n\n if !has_frame?(name.to_str)\n available_frames << name.to_str\n end\n end\n available_frames\n end",
"def create_graphics\n create_character_sprite\n create_phrase\n create_inputs\n refresh_chars\n end",
"def addFrameNewBuffer fileLocation, fileName, fileContent, rights, serverSide, line, overWrite = false\n buffer = Buffer.new(fileLocation, fileName, fileContent,\n rights, serverSide, self)\n cursor = Cursor.new(self, buffer.fileContent, line)\n frame = Frame.new(cursor, overWrite)\n @frames[buffer] = frame\n buffer.id\n end",
"def c_frame?; end",
"def show_frame(count)\n\n clear_screen()\n\n if count == 0\n 12.times {puts \" \"}\n elsif count == 1\n 9.times {puts \" \"}\n puts \" _________ \"\n 2.times {puts \" \"}\n elsif count == 2\n 3.times {puts \" \"}\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" ____|____ \"\n 2.times {puts \" \"}\n elsif count == 3\n 2.times {puts \" \"}\n puts \" ______ \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" ____|____ \"\n 2.times {puts \" \"}\n elsif count == 4\n 2.times {puts \" \"}\n puts \" ______ \"\n puts \" | | \"\n puts \" | | \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" ____|____ \"\n 2.times {puts \" \"}\n elsif count == 5\n 2.times {puts \" \"}\n puts \" ______ \"\n puts \" | | \"\n puts \" | | \"\n puts \" | O \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" ____|____ \"\n 2.times {puts \" \"}\n elsif count == 6\n 2.times {puts \" \"}\n puts \" ______ \"\n puts \" | | \"\n puts \" | | \"\n puts \" | O \"\n puts \" | | \"\n puts \" | \"\n puts \" | \"\n puts \" ____|____ \"\n 2.times {puts \" \"}\n elsif count == 7\n 2.times {puts \" \"}\n puts \" ______ \"\n puts \" | | \"\n puts \" | | \"\n puts \" | O \"\n puts \" | /| \"\n puts \" | \"\n puts \" | \"\n puts \" ____|____ \"\n 2.times {puts \" \"}\n elsif count == 8\n 2.times {puts \" \"}\n puts \" ______ \"\n puts \" | | \"\n puts \" | | \"\n puts \" | O \"\n puts \" | /|\\\\ \"\n puts \" | \"\n puts \" | \"\n puts \" ____|____ \"\n 2.times {puts \" \"}\n elsif count == 9\n 2.times {puts \" \"}\n puts \" ______ \"\n puts \" | | \"\n puts \" | | \"\n puts \" | O \"\n puts \" | /|\\\\ \"\n puts \" | / \"\n puts \" | \"\n puts \" ____|____ \"\n 2.times {puts \" \"}\n elsif count == 10\n 2.times {puts \" \"}\n puts \" ______ \"\n puts \" | | \"\n puts \" | | \"\n puts \" | O \"\n puts \" | /|\\\\ \"\n puts \" | / \\\\ \"\n puts \" | \"\n puts \" ____|____ \"\n 2.times {puts \" \"}\n end\n\nend",
"def create\n @frame = Frame.new(params[:frame])\n\n if @frame.save\n respond_to do |format|\n format.html {\n render :json => [@frame.to_jq_upload].to_json,\n :content_type => 'text/html',\n :layout => false\n }\n format.json {\n render :json => [@frame.to_jq_upload].to_json\n }\n end\n else\n render :json => [{:error => \"custom_failure\"}], :status => 304\n end\n end",
"def create_gtbs_back \n case self\n when Windows_Status_GTBS\n back_name = 'TBS_Status.png'\n when Window_EXP_Earn\n back_name = 'TBS_Exp_Gain.png'\n when Commands_All\n back_name = 'Commands_All.png'\n when Battle_Option\n back_name = 'TBS_Battle_Option.png'\n when Command_Confirm\n back_name = 'Command_Confirm.png'\n when Window_Actor_Display\n back_name = 'Actor_Display.png'\n when Window_Config\n back_name = 'TBS_Config.png'\n when Window_Select_Color\n back_name = 'TBS_Select_Color.png'\n when TBS_Item, TBS_Skill\n back_name = 'TBS_Item_Skill.png'\n when Window_Full_Status\n back_name = 'TBS_Full_Status.png'\n end\n if back_name and FileTest.exist?('Graphics/Pictures/GTBS/' + back_name)\n @back = Sprite.new\n self.opacity = 0\n @back.bitmap = Cache.picture('GTBS/' + back_name)\n @back.visible = false\n @back.opacity = GTBS::CONTROL_OPACITY\n else\n self.opacity = GTBS::CONTROL_OPACITY\n end\n end",
"def create_graphics\n create_viewport\n create_spriteset_and_background\n create_action_sprites(@viewport.rect.width / 2)\n create_selection\n end",
"def animation_set_sprites(frame)\n cell_data = frame.cell_data\n @ani_sprites.each_with_index do |sprite, i|\n next unless sprite\n pattern = cell_data[i, 0]\n if !pattern || pattern < 0\n sprite.visible = false\n next\n end\n sprite.bitmap = pattern < 100 ? @ani_bitmap1 : @ani_bitmap2\n sprite.visible = true\n sprite.src_rect.set(pattern % 5 * 192,\n pattern % 100 / 5 * 192, 192, 192)\n zoom = (camera_animation_zoom? ? $tsbs_camera.zoom : 1.0)\n if @ani_mirror\n sprite.x = @ani_ox - (cell_data[i, 1] * zoom)\n sprite.y = @ani_oy + (cell_data[i, 2] * zoom)\n sprite.angle = (360 - cell_data[i, 4])\n sprite.mirror = (cell_data[i, 5] == 0)\n else\n sprite.x = @ani_ox + (cell_data[i, 1] * zoom)\n sprite.y = @ani_oy + (cell_data[i, 2] * zoom)\n sprite.angle = cell_data[i, 4]\n sprite.mirror = (cell_data[i, 5] == 1)\n end\n sprite.z = self.z + 1 #+ i\n sprite.ox = 96\n sprite.oy = 96\n sprite.zoom_x = (cell_data[i, 3] / 100.0) * zoom\n sprite.zoom_y = (cell_data[i, 3] / 100.0) * zoom\n sprite.opacity = cell_data[i, 6] * @spr_battler.opacity / 255.0\n sprite.blend_type = cell_data[i, 7]\n end\n end",
"def content\n @bgs, @gbs = [], []\n img = image(\"#{HH::STATIC}/hhhello.png\")\n img.move 305, 42\n @bgs << img\n @bgs << rect(38, 0, width-38, 35, fill: \"#CDC\")\n @bgs << rect(38, 0, width-38, 38, fill: black.push(0.05)..black.push(0.2))\n @tabs, @tables = [], HH::DB.tables\n @scripts = HH.scripts\n\n hometab \"Programs\", true, 50, 13 do\n @slot.append do\n @homepane.clear{home_scripts}\n flush\n end\n end\n hometab \"Samples\", false, 168, 13 do\n @slot.append do\n @homepane.clear{sample_scripts}\n flush\n end\n end\n @bgs << rect(38, 38, 300, 4, fill: rgb(233, 239, 224))\n\n @slot.append do\n stack(height: 40){}\n @homepane = flow(margin_top: 10){home_scripts}\n flush\n end\n\n=begin\n stack :margin_left => 12 do\n background rgb(233, 239, 224, 0.85)..rgb(233, 239, 224, 0.0)\n image 10, 70\n end\n @bulletin_stack = stack do\n end\n=end\n end",
"def create_pdf_animation(width, height, moves_per_frame: 1, fps: 25, turtle_size: 20, turns_as_frames: false)\n configure(x: width / 2.0, y: height / 2.0)\n\n doc = HexaPDF::Document.new(config: {\"page.default_media_box\" => nil})\n doc.pages.root[:MediaBox] = [0, 0, width, height]\n image = doc.images.add(File.join(__dir__, 'turtle.png'))\n\n page = doc.pages.add\n page.canvas.image(image, at: [@x - turtle_size / 2, @y - turtle_size / 2], width: turtle_size)\n\n form = doc.wrap({Type: :XObject, Subtype: :Form})\n canvas = HexaPDF::Content::Canvas.new(form)\n frame_states = draw(canvas, mark_frames: true, turns_as_frames: turns_as_frames)\n frames = HexaPDF::Filter.string_from_source(canvas.stream_data.fiber).split(/\\/Turtle MP\\n/)\n\n streams = []\n duration = (fps ? 1.0 / fps : nil)\n data = \"\"\n\n index = 0\n while index < frame_states.length\n page = doc.pages.add\n page[:Dur] = duration if duration\n\n moves_per_frame.times do\n data << frames[index]\n index += 1\n if index % 10 == 0\n streams << doc.add({Filter: :FlateDecode}, stream: data)\n data = \"\"\n end\n break if index >= frame_states.length\n end\n\n canvas = HexaPDF::Content::Canvas.new(page)\n origin = [frame_states[index - 1][0], frame_states[index - 1][1]]\n canvas.rotate(frame_states[index - 1][2] * 180 / Math::PI, origin: origin) do\n canvas.image(image, at: [origin[0] - turtle_size / 2, origin[1] - turtle_size / 2], width: turtle_size)\n end\n page_data = data + \"\\nS\\n\" + HexaPDF::Filter.string_from_source(canvas.stream_data.fiber)\n\n page[:Contents] = streams.dup + [doc.add({Filter: :FlateDecode}, stream: page_data)]\n end\n\n doc\n end",
"def create\n for i in 1 .. (@canvas_height - 1) do\n @buffer.append(i, \" \" * (@canvas_width - 1))\n end\n end",
"def animation_set_sprites(frame)\n cell_data = frame.cell_data\n @ani_sprites.each_with_index do |sprite, i|\n next unless sprite\n pattern = cell_data[i, 0]\n if !pattern || pattern < 0\n sprite.visible = false\n next\n end\n sprite.bitmap = pattern < 100 ? @ani_bitmap1 : @ani_bitmap2\n sprite.visible = true\n sprite.src_rect.set(pattern % 5 * 192,\n pattern % 100 / 5 * 192, 192, 192)\n zoom = (camera_animation_zoom? ? $tsbs_camera.zoom : 1.0)\n if @ani_mirror\n sprite.x = @ani_ox - (cell_data[i, 1] * zoom)\n sprite.y = @ani_oy + (cell_data[i, 2] * zoom)\n sprite.angle = (360 - cell_data[i, 4])\n sprite.mirror = (cell_data[i, 5] == 0)\n else\n sprite.x = @ani_ox + (cell_data[i, 1] * zoom)\n sprite.y = @ani_oy + (cell_data[i, 2] * zoom)\n sprite.angle = cell_data[i, 4]\n sprite.mirror = (cell_data[i, 5] == 1)\n end\n sprite.z = self.z + (anim_behind? ? -16 : 1)\n sprite.ox = 96\n sprite.oy = 96\n sprite.zoom_x = (cell_data[i, 3] / 100.0) * zoom\n sprite.zoom_y = (cell_data[i, 3] / 100.0) * zoom\n sprite.opacity = cell_data[i, 6] * @spr_battler.opacity / 255.0\n sprite.blend_type = cell_data[i, 7]\n end\n end",
"def makesheet(edir, emote, framedir)\n fdelays = []\n Dir.chdir(framedir)\n frames = Dir.glob(\"*_frame*png\").sort\n Dir.glob(emote + \"*txt\").sort.each do |file|\n delay = File.read(file).chomp\n fdelays << delay\n end\n if(fdelays.uniq.length != 1)\n frames << frames[0]\n end\n img = ImageList.new(framedir + \"/\" + frames[0])\n ex, ey = img.columns, img.rows\n img = ImageList.new\n frames.each do |frame|\n img.push(Image.read(framedir + \"/\" + frame).first)\n end\n begin\n img.append(false).write(edir + \"/\" + emote + \"-sheet.png\")\n rescue Exception\n puts \"Could not write: \" + edir + \"/\" + emote + \"-sheet.png\"\n end\n system(\"optipng -quiet \" + edir + \"/\" + emote + \"-sheet.png > \" + $bitbucket)\n return ex, ey\nend",
"def frames; motion.frames; end",
"def create\n @frame = Frame.new(frame_params)\n\n # movie = FFMPEG::Movie.new(\"/Users/nicolai/code/projects/emotionAPI_test/public/mark_zuck.mp4\")\n # movie.transcode(\"movie.mp4\", \"-r 1 /Users/nicolai/code/projects/emotionAPI_test/public/test2/image-%04d.jpeg\") { |progress| puts progress } # 0.2 ... 0.5 ... 1.0\n\n # Emotion Image API attempt\n if @frame.save\n uri = URI('https://api.projectoxford.ai/emotion/v1.0/recognize')\n uri.query = URI.encode_www_form({\n })\n\n data = File.read(\"./public/full color pic.png\")\n\n request = Net::HTTP::Post.new(uri.request_uri)\n # Request headers\n request['Ocp-Apim-Subscription-Key'] = '6f027d66bef64938872d4f519168495f'\n # Request body\n # request.body = data\n request['Content-Type'] = 'application/octet-stream'\n request.body = data\n # '{\"url\": \"http://localhost:4000/mark_zuck.mp4\"}'\n response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n http.request(request)\n end\n\n puts response.body\n # Capture response and save it into database each emotion at a time\n # Create chart from data; save it into db?\n else\n # TBD\n end\n # Failed Emotion Video API attempt\n # uri = URI('https://api.projectoxford.ai/emotion/v1.0/recognizeinvideo')\n # uri.query = URI.encode_www_form({\n # })\n\n # # data = File.read(\"./public/mark_zuck.mov\")\n\n # request = Net::HTTP::Post.new(uri.request_uri)\n # # Request headers\n # request['Ocp-Apim-Subscription-Key'] = '6f027d66bef64938872d4f519168495f'\n # # Request body\n # # request.body = data\n # request['Content-Type'] = 'application/octet-stream'\n # request.body = '{\"url\": \"http://localhost:4000/mark_zuck.mp4\"}'\n # response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n # http.request(request)\n # end\n\n # puts response.body\n\n\n # respond_to do |format|\n # if @frame.save\n # format.html { redirect_to @frame, notice: 'Frame was successfully created.' }\n # format.json { render :show, status: :created, location: @frame }\n # else\n # format.html { render :new }\n # format.json { render json: @frame.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def index frame\n n = -1\n @avi.process_movi do |indices, movi|\n indices.each_with_index do |m, i|\n movi.pos = m[:offset] + 8\n f = Frame.new(movi.read(m[:size]), m[:id], m[:flag]) \n if f == frame\n n = i\n break\n end\n end\n [indices, movi]\n end\n n\n end",
"def populate_frames\n\n # reset the frame roll values\n @frames.each {|f| f.reset }\n\n nstrikes = 0 # keep track of the 'strikes' as they result in 'skip' to the next frame\n # iterate the rolls array and populate the corresponding frame instances\n @rolls.each_with_index {|e,i|\n \n # add the 'nstrikes'\n index_adjusted_by_strikes = i+nstrikes\n\n if index_adjusted_by_strikes == 20 # last frame, 3rd element\n @frames.last.roll_3 = e\n else\n q,r = index_adjusted_by_strikes.divmod(2) # determine the frame and the 'roll' index within the frame\n f = @frames[q]\n f.send(:\"roll_#{r+1}=\", e)\n nstrikes +=1 if f.strike? # increment 'nstrikes' if strike\n end\n }\n @frames\n end",
"def frames\n _nudge[3]\n end",
"def iframes; end",
"def suitable_frame\n unless @suitable_frame\n frames = ['last'] + (0..renderer.max_frames).to_a.reverse\n\n # render a batch of frames to speed up the process\n renderer.render_batch!(frames)\n\n frames.each do |frame|\n @suitable_frame = frame if !@suitable_frame && suitable_frame?(frame)\n end\n\n @suitable_frame ||= 'last'\n end\n\n @suitable_frame\n end",
"def animated_sprite_bitmap\n @frame_set = -1 if @frame_set == nil\n @frame_set += 1\n @frame_set = 0 if @frame_set >= @ani_frames\n \n zi = @z_size\n tempbat = Cache.battler(@battler_name, @battler_hue)\n howide = tempbat.width / @ani_frames\n temprec = Rect.new(@frame_set * howide, 0, howide, tempbat.height)\n tempmap = Bitmap.new(tempbat.width / @ani_frames * zi, tempbat.height * zi)\n tempmap.stretch_blt(tempmap.rect, tempbat, temprec)\n return tempmap\n end",
"def initialize(*frames)\n if frames.last.respond_to?(:fetch)\n opts = frames.pop\n @encoding = opts[:encoding]\n @frame_separator = opts[:frame_separator]\n end\n\n @frames = frames\n super(@frames)\n end",
"def pbSceneStandby\n Graphics.frame_reset; yield\n $scene.disposeSpritesets if $scene && $scene.is_a?(Scene_Map)\n $scene.createSpritesets if $scene && $scene.is_a?(Scene_Map)\nend",
"def new\n @story = Story.find(params[:story_id])\n @frame = @story.frames.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @frame }\n end\n end",
"def place_cards_to_display\r\n @cards_todisp = []\r\n left_pl1_card = 20 \r\n #top_pl1_card = @canvas_disp.height - (img_card.height + 5)\r\n top_pl1_card = 30\r\n num_img = @cards_img.size - 1\r\n (0..num_img).each do |ix|\r\n img_card = @cards_img[ix]\r\n xoffset = img_card.width + 5\r\n x_fin = left_pl1_card + ix * xoffset\r\n cd = CardGfx.new(self, x_fin, top_pl1_card, img_card, :not_def, 1 )\r\n @cards_todisp << cd\r\n end\r\n end",
"def screenshots(num_thumbnail_imgs)\n puts \"transcoded_movie thumbnail generation\"\n\t puts \"number of thumbnails #{num_thumbnail_imgs}\"\n\t \n\t \n\t #skipping some frames from begining and ending to take screenshots\n\t init_time = 15\n seek_t = ($transcoded_movie.duration - init_time*2) / num_thumbnail_imgs.to_i\n \t \n\t \n\t i = 0\n\t \n\t while i < num_thumbnail_imgs.to_i do\n filename = \"thumbnail_#{i}.jpg\"\n \n \t #, preserve_aspect_ratio: :width\n # keeping 160x90 to preserve aspect ratio 16:9 \n\t\t \n\t\t puts \"generating #{filename}\"\n \n\t\t $transcoded_movie.screenshot(filename, seek_time: (init_time + seek_t * i), resolution: '160x90')\n\t\t i += 1\n end #end while\t \n end",
"def frame_params\n params.require(:frame).permit(:frame_seq, :frame_name, :frame_type, :code_order, :horizontal_direction, :vertiacal_direction, :frame_rows, :frame_columns)\n end",
"def add_frame(name, options = {}, &block)\n name = name.to_sym\n raise DuplicateNameError if @stkw_object_list.include?(name)\n options = fix_position(options.dup)\n @stkw_object_list[name] = SimpleTk::Window.new(options.merge(parent: content, stk___frame: true), &block)\n end",
"def frame\n @rad.frame(0)\n end",
"def parse\n frames = []\n loop do\n break if @buffer.length < INFO_SIZE\n size, type = @buffer[0, INFO_SIZE].join.unpack('l>l>')\n frame = { size: size - FRAME_TYPE_SIZE, type: type.to_i }\n\n break if @buffer.length < frame[:size] + INFO_SIZE\n frame[:data] = @buffer[INFO_SIZE, frame[:size]].join\n frames << build_frame(frame)\n @buffer.shift(INFO_SIZE + frame[:size])\n end\n frames\n end",
"def show_frame()\n\n 2.times {puts \" \"}\n puts \" ______ \"\n puts \" | | \"\n puts \" | | \"\n puts \" | O \"\n puts \" | /|\\\\ \"\n puts \" | / \\\\ \"\n puts \" | \"\n puts \" ____|____ \"\n 2.times {puts \" \"}\n\nend",
"def new\n @frame = Frame.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @frame }\n end\n end",
"def aa_frames seq\n res = []\n # remove white space\n seq = seq.gsub(/\\s/,'')\n ajpseq = Biolib::Emboss.ajSeqNewNameC(seq,\"Test sequence\")\n [1,2,3,-1,-2,-3].each do | frame |\n ajpseqt = Biolib::Emboss.ajTrnSeqOrig(@trn_table,ajpseq,frame)\n aa = Biolib::Emboss.ajSeqGetSeqCopyC(ajpseqt)\n res.push({:frame => frame, :sequence => aa})\n end\n res\n end",
"def create_implicit_frame(flags)\n {}.tap do |memo|\n flags.each_pair do |key, val|\n memo[\"@#{key}\"] = [val]\n end\n end\n end",
"def frame!\n if self.mac?\n MacEditor.new.frame!(self)\n else\n Editor.new.frame!(self)\n end\n end",
"def with_cycle(cycle_number = nil)\n @frame = nil\n\n # Loop until we get a (perspective corrected) frame from the map.\n while !@frame do\n @camera.set(CAMERA_OPTIONS) if @live\n @frame = @map.frame\n end\n\n # We only count processing times as soon as we get the map. Seen as\n # this is a really fast operation (and most of the time is spent on\n # background subtration).\n cycle_start = Time.now\n\n next_cycle!\n\n Log4r::NDC.push(\"##{ @cycle }\") if cycle_number\n\n @delta = @bg_subtractor.subtract(@frame, LEARNING_RATE)\n\n # Resize the frames\n [@frame, @delta].map do |img|\n img.resize!(Size.new(Map::A0_HEIGHT, Map::A0_WIDTH))\n end\n\n # Turn all pixels until 128.0 to 0.0.\n @delta.threshold! 128.0, 255.0\n\n # Contract shapes.\n @delta.erode!(EROSION_AMOUNT)\n\n # Save stuff\n if @debug\n @frame.write \"#{ Theia.tmp_path }/#{ \"%04i\" % @cycle }-frame.png\"\n @delta.write \"#{ Theia.tmp_path }/#{ \"%04i\" % @cycle }-delta.png\"\n end\n\n yield @frame, @delta\n\n cycle_finish = Time.now\n msecs = (cycle_finish - cycle_start)\n\n # After measuring how long it took to process the frame, add it to\n # processing times, make sure we only account for the last 10\n # measurements, average them out and divide them by 1 (sec). This\n # gives us the FPS.\n @processing_times << msecs\n @processing_times.shift if @processing_times.length > 10\n @fps = 1.0 / @processing_times.mean\n ensure\n Log4r::NDC.pop if cycle_number\n end",
"def change_frame_to(index, run_whereami = T.unsafe(nil)); end",
"def create_image_frame(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :POST, 'File')\n end",
"def setup\n size 200, 200\n frame_rate 30\n @a = 0\n \n # The background image must be the same size as the parameters\n # into the size method. In this program, the size of \"milan_rubbish.jpg\"\n # is 200 x 200 pixels.\n @background_image = load_image \"milan_rubbish.jpg\"\nend",
"def create\n\n respond_to do |format|\n if @time_frame.save\n format.html { redirect_to time_frames_path, notice: 'Time frame was successfully created.' }\n format.json { render json: @time_frame, status: :created, location: @time_frame }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_frame.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7582912",
"0.7371906",
"0.7366729",
"0.7116567",
"0.6987366",
"0.6696666",
"0.6456462",
"0.6291647",
"0.6282093",
"0.62450194",
"0.6211275",
"0.61752737",
"0.61316735",
"0.6096042",
"0.6093267",
"0.60881716",
"0.60881716",
"0.6063691",
"0.60539216",
"0.6007254",
"0.5991986",
"0.596637",
"0.5937004",
"0.5932011",
"0.58374894",
"0.58160204",
"0.581218",
"0.5799904",
"0.57671493",
"0.57488626",
"0.57462597",
"0.5731923",
"0.57284856",
"0.57272476",
"0.5722524",
"0.57196426",
"0.5708258",
"0.56879205",
"0.56760126",
"0.56757665",
"0.5655771",
"0.56418186",
"0.5639222",
"0.56281894",
"0.55981773",
"0.55923307",
"0.55747294",
"0.55699307",
"0.5557534",
"0.5506995",
"0.5495462",
"0.547205",
"0.547205",
"0.547205",
"0.547205",
"0.5469468",
"0.54465455",
"0.54417443",
"0.54392594",
"0.5437933",
"0.5435606",
"0.5431916",
"0.54298276",
"0.54210806",
"0.5418249",
"0.54122365",
"0.54024106",
"0.54005367",
"0.53974265",
"0.53970945",
"0.5394295",
"0.5391268",
"0.5387488",
"0.5384493",
"0.5342805",
"0.5337607",
"0.5329416",
"0.5314596",
"0.5309821",
"0.52939194",
"0.52915084",
"0.5284052",
"0.5275536",
"0.5270574",
"0.52658695",
"0.52509123",
"0.52444243",
"0.5243822",
"0.52436304",
"0.5239515",
"0.5228203",
"0.5224795",
"0.5221783",
"0.5208751",
"0.51983356",
"0.5185149",
"0.5184297",
"0.5175738",
"0.5171821",
"0.5169982",
"0.51614606"
] |
0.0
|
-1
|
metodo que llena los frames
|
def llenado(numero, round)
numero.times do |columns|
@score_table[round][columns] = tiros(columns)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def frames; end",
"def frames\n _nudge[3]\n end",
"def frame=(pos); end",
"def frame; end",
"def frames; motion.frames; end",
"def setup_frames\n @frames ||=\n begin\n frames = 10.times.map {|i| Frame.new(i+1,0,0,0,nil)}\n # link frames\n (0...9).each {|i| frames[i].next_frame = frames[i+1]}\n frames\n end\n end",
"def c_frame?; end",
"def build_frames\n prev_frame = nil\n 10.times.map do |frame_number|\n prev_frame = Frame.new(10 - frame_number, prev_frame)\n end.reverse!\n end",
"def last_frame; frames.last; end",
"def tenth_frame; end",
"def length; return @totalFrames; end",
"def frames\n @keyframes.last.index + @keyframes.last.duration\n end",
"def frames\n\t\tframes = [\"day\", \"week\", \"month\", \"year\"]\n\tend",
"def next_frame\n #populate our @channels instance vaiable\n create_channel_list\n do_frame_lookup\n\n if File.exist?(\"/home/lee/src/eyebleach/test_images/#{message[:channel_name]}-frame#{message[:frame_no]}.gif\")\n image = Base64.encode64(File.open(\"/home/lee/src/eyebleach/test_images/#{message[:channel_name]}-frame#{message[:frame_no]}.gif\").read)\n frame_message :next_frame, image, message[:frame_no], @channels[message[:channel_name]], message[:channel_name]\n else\n image = Base64.encode64(File.open(\"/home/lee/src/eyebleach/test_images/#{message[:channel_name]}-frame0.gif\").read)\n frame_message :next_frame, image, 0, @channels[message[:channel_name]], message[:channel_name]\n end\n end",
"def frame\n (@frame || 1).to_f\n end",
"def catchupFrames(fromFrameNo, toFrameNo)\r\n #puts \"#{fromFrameNo} --> #{toFrameNo}\"\r\n for i in fromFrameNo..toFrameNo do\r\n #puts \"Catching up frame #{i}:\";\r\n if @frames.length <= i then\r\n @frames[i] = Frame.new(self);\r\n @frames[i-1].pixmaps.each do |pixmap|\r\n @frames[i].addPixmap(pixmap)\r\n end\r\n end\r\n end\r\n return @frames[toFrameNo];\r\n end",
"def load_frames\n\t\tw,h = @_w, @_h # convenience assignments\n\t\twt = 0.8 * w\n\t\tdw = 0.5 * (w-wt) \n\t img = Surface.new([w,h]).fill(@@bg_color)\n\t img.draw_polygon_s([[0,h], [dw,0], [dw+wt,0], [w,h],[0,h]], BROWN)\n\t return [img]\n\tend",
"def frames\n value_parts[3]\n end",
"def frames\n value_parts[3]\n end",
"def frame\n @rad.frame(0)\n end",
"def frame_reset\n @delta_time = @frame_to_skip = 0\n @ruby_time = @current_time = @last_time = @last_second_time = Time.new\n reset_gc_time\n reset_ruby_time\n @last_frame_count = Graphics.frame_count\n end",
"def update\n if @frame == @gfx.length - 1\n @frame = 0\n elsif @frame == 7\n @frame += 1\n @deleted = true\n else\n @frame += 1\n end\n end",
"def ani_frames\n return @ani_frames\n end",
"def initial_frame(bindings); end",
"def show_frames\r\n jssh_command = \"var frameset = #{WINDOW_VAR}.frames;\r\n var elements_frames = new Array();\r\n for(var i = 0; i < frameset.length; i++)\r\n {\r\n var frames = frameset[i].frames;\r\n for(var j = 0; j < frames.length; j++)\r\n {\r\n elements_frames.push(frames[j].frameElement); \r\n }\r\n }\r\n elements_frames.length;\"\r\n \r\n jssh_command.gsub!(\"\\n\", \"\")\r\n $jssh_socket.send(\"#{jssh_command};\\n\", 0)\r\n length = read_socket().to_i \r\n \r\n puts \"There are #{length} frames\"\r\n \r\n frames = Array.new(length)\r\n for i in 0..length - 1 do\r\n frames[i] = Frame.new(self, :jssh_name, \"elements_frames[#{i}]\")\r\n end\r\n \r\n for i in 0..length - 1 do\r\n puts \"frame: name: #{frames[i].name}\"\r\n puts \" index: #{i+1}\"\r\n end\r\n end",
"def update \n\t\t@currentframe = (@currentframe + 1) % @frames.size \n\t\t@image = @frames[@currentframe] # load the image\n \t@rect.move!(-@xspeed,0) # move horizontally left \n if @rect.right() < 0\n\t\t\t\tself.kill # went off screen, kill it\n\t\t\t\treturn \n\t\t end\n end",
"def add_frame(frame)\n end",
"def end_frame\n end",
"def to_frame(frame)\r\n # checks if specified string parameter\r\n if frame.is_a?(String)\r\n if frame == \"last\"\r\n frame = @totalFrames - 1\r\n else\r\n frame = 0\r\n end\r\n end\r\n # sets frame\r\n frame = @totalFrames - 1 if frame >= @totalFrames\r\n frame = 0 if frame < 0\r\n @currentIndex = frame\r\n end",
"def eb; self.iframes += 15; end",
"def index frame\n n = -1\n @avi.process_movi do |indices, movi|\n indices.each_with_index do |m, i|\n movi.pos = m[:offset] + 8\n f = Frame.new(movi.read(m[:size]), m[:id], m[:flag]) \n if f == frame\n n = i\n break\n end\n end\n [indices, movi]\n end\n n\n end",
"def frame(id); end",
"def frame_count\n image.get(\"height\") / size.y\n end",
"def frame_number\n @frame_number ||= valid? ? frame.size : frame.size - 1\n end",
"def cover\n manipulate! do |frame, index|\n frame if index.zero?\n end\n end",
"def prepare_parsed_frame frame\n end",
"def frame_count; motion.frame_count; end",
"def frame\n animation[Gosu.milliseconds / 100 % animation.size]\n end",
"def * times\n result = self.slice 0, 0\n frames = self.slice 0..-1\n times.times do\n result.concat frames\n end\n result\n end",
"def populate_frames\n\n # reset the frame roll values\n @frames.each {|f| f.reset }\n\n nstrikes = 0 # keep track of the 'strikes' as they result in 'skip' to the next frame\n # iterate the rolls array and populate the corresponding frame instances\n @rolls.each_with_index {|e,i|\n \n # add the 'nstrikes'\n index_adjusted_by_strikes = i+nstrikes\n\n if index_adjusted_by_strikes == 20 # last frame, 3rd element\n @frames.last.roll_3 = e\n else\n q,r = index_adjusted_by_strikes.divmod(2) # determine the frame and the 'roll' index within the frame\n f = @frames[q]\n f.send(:\"roll_#{r+1}=\", e)\n nstrikes +=1 if f.strike? # increment 'nstrikes' if strike\n end\n }\n @frames\n end",
"def set_frame\n frames = @animations[@playing_animation]\n case frames\n when Range\n reset_clipping_rect\n @clip_x = @current_frame * @clip_width\n when Array\n f = frames[@current_frame]\n @clip_x = f[:x] || @defaults[:clip_x]\n @clip_y = f[:y] || @defaults[:clip_y]\n @clip_width = f[:width] || @defaults[:clip_width]\n @clip_height = f[:height] || @defaults[:clip_height]\n @frame_time = f[:time] || @defaults[:frame_time]\n end\n end",
"def refresh_frame(run_whereami = T.unsafe(nil)); end",
"def update\n @currentFrame += 1\n self.updateElements\n if !@totalFrames.nil? && @totalFrames >= 0 && @currentFrame >= @totalFrames\n self.restart\n end\n end",
"def get_frame\n next_frame\n rescue StopIteration => e\n return nil\n end",
"def rasterise \r\n @frames.each do |frame|\r\n printf '.';\r\n canvas = Canvas.new(@width, @height);\r\n @canvases.push(canvas);\r\n if frame.pixmaps.length == 0 then next; end;\r\n frame.pixmaps.each do |pixmap|\r\n img = pixmap.sprite.getImage(pixmap.frame);\r\n pixmap.frame = (pixmap.frame + 1) % (pixmap.sprite.images.length);\r\n canvas.add(img, pixmap.x, pixmap.y);\r\n end\r\n end \r\n end",
"def frame_step \n send_cmd(\"frame_step\")\n end",
"def cur_image\n @frames.cur_image\n end",
"def rindex frame\n n = -1\n @avi.process_movi do |indices, movi|\n indices.reverse.each_with_index do |m, i|\n movi.pos = m[:offset] + 8\n f = Frame.new(movi.read(m[:size]), m[:id], m[:flag])\n if f == frame\n n = indices.size - 1 - i\n break\n end\n end\n [indices, movi]\n end\n n\n end",
"def each_frame(&block)\n if !block_given?\n return enum_for(:each_frame)\n end\n\n available_frames.each(&block)\n supercall(nil, :each_frame, &block)\n end",
"def frame\n context.frame\n end",
"def initialize(dir, filename, hue = 0)\r\n @frames = []\r\n @currentFrame = 0\r\n @framecount = 0\r\n panorama = RPG::Cache.load_bitmap(dir, filename, hue)\r\n if filename[/^\\[(\\d+)(?:,(\\d+))?\\]/] # Starts with 1 or 2 numbers in brackets\r\n # File has a frame count\r\n numFrames = $1.to_i\r\n delay = $2.to_i\r\n delay = 10 if delay == 0\r\n raise \"Invalid frame count in #{filename}\" if numFrames <= 0\r\n raise \"Invalid frame delay in #{filename}\" if delay <= 0\r\n if panorama.width % numFrames != 0\r\n raise \"Bitmap's width (#{panorama.width}) is not divisible by frame count: #{filename}\"\r\n end\r\n @frameDelay = delay\r\n subWidth = panorama.width / numFrames\r\n for i in 0...numFrames\r\n subBitmap = BitmapWrapper.new(subWidth, panorama.height)\r\n subBitmap.blt(0, 0, panorama, Rect.new(subWidth * i, 0, subWidth, panorama.height))\r\n @frames.push(subBitmap)\r\n end\r\n panorama.dispose\r\n else\r\n @frames = [panorama]\r\n end\r\n end",
"def nextFrame(view)\n # Compute how long it took to display the last frame. This will\n # be used to compute how much to move or turnfor the next frame.\n time = view.last_refresh_time\n time_delay = 0\n if( time < 0.04 )\n time_delay = 0.04 - time\n time = 0.04\n end\n \n if( (@keys & (LEFT_ARROW | RIGHT_ARROW)) != 0 )\n self.send(self.lr_function, view, time)\n end\n if( (@keys & (UP_ARROW | DOWN_ARROW)) != 0 )\n self.send(self.ud_function, view, time)\n end\n \n # update the camera parameters\n @rep.update(view.camera) if @rep\n\n view.show_frame time_delay\n self.show_height\n \n true\nend",
"def update_frame_index_array\n @index_array = [0,1,2] if !@character_anim\n hash = @character.pose_path\n if hash != nil and hash.keys.include?(@pose+1)\n @index_array = hash[@pose+1]\n @max_frame = hash[@pose+1].size\n else\n hash = @character.frame_hash\n if hash != nil and hash.keys.include?(@pose+1)\n @max_frame = hash[@pose+1]\n else\n @max_frame = GTBS::DEFAULT_POSE_FRAMES\n end\n @index_array = []\n for i in 0...@max_frame\n @index_array.push(i)\n end\n end\n @frame_index = 0 #force reset current frame index to 0\n end",
"def initialize\n self.frames = []\n self.options = {}\n reset_for_fullscreen\n end",
"def frame_chain!\n @frame_chain\n end",
"def updateDebugFPS(frame)\n end",
"def parse\n frames = []\n loop do\n break if @buffer.length < INFO_SIZE\n size, type = @buffer[0, INFO_SIZE].join.unpack('l>l>')\n frame = { size: size - FRAME_TYPE_SIZE, type: type.to_i }\n\n break if @buffer.length < frame[:size] + INFO_SIZE\n frame[:data] = @buffer[INFO_SIZE, frame[:size]].join\n frames << build_frame(frame)\n @buffer.shift(INFO_SIZE + frame[:size])\n end\n frames\n end",
"def initialize\n @frame = Rect.zeroRect\n end",
"def change(frames = 0, delay = 0, offx = 0, offy = 0,\n startf = 0, once = false)\n @frames = frames\n @delay = delay\n @offset_x, @offset_y = offx, offy\n @current_frame = startf\n @once = once\n x = @current_frame * @frame_width + @offset_x\n self.src_rect = Rect.new(x, @offset_y, @frame_width, @frame_height)\n @goingup = true\n @animated = true\n end",
"def showFrames()\n=begin\n \n ff = @ie.document.frames\n\n log \"there are \" + ff.length.to_s + \" frames\" if $debuglevel >=0\n\n for f in 0 .. ff.length-1\n log \"Frame: \" + ff[f.to_s].name.to_s if $debuglevel >=0 \n log \"My parent is: \" + ff[f.to_s].parentWindow.name.to_s if $debuglevel >=0\n end \n\n #frame = @ie.document.frames[ frameName ].document\n \n=end\n end",
"def set_canvas_frame(canvasFrame_wnd)\r\n canvasFrame = FXVerticalFrame.new(canvasFrame_wnd, FRAME_THICK|LAYOUT_FILL_Y|LAYOUT_TOP|LAYOUT_LEFT)\r\n canvasFrame.create\r\n \r\n #p \"**** set frame...\"\r\n if @game_cmd_bt_list.size > 0 \r\n # send canvas size changed\r\n @app_owner.activate_canvas_frame\r\n return\r\n end\r\n \r\n label_wnd = FXLabel.new(canvasFrame, \"Comandi gioco \", nil, JUSTIFY_LEFT|LAYOUT_FILL_X)\r\n label_wnd.create\r\n \r\n bt_wnd_list = []\r\n bt_wnd_list << FXButton.new(canvasFrame, \"uno\", @app_owner.icons_app[:numero_uno], nil, 0,FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_BOTTOM|LAYOUT_LEFT,0, 0, 0, 0, 10, 10, 5, 5)\r\n bt_wnd_list << FXButton.new(canvasFrame, \"due\", @app_owner.icons_app[:numero_due], nil, 0,FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_BOTTOM|LAYOUT_LEFT,0, 0, 0, 0, 10, 10, 5, 5)\r\n bt_wnd_list << FXButton.new(canvasFrame, \"tre\", @app_owner.icons_app[:numero_tre], nil, 0,FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_BOTTOM|LAYOUT_LEFT,0, 0, 0, 0, 10, 10, 5, 5)\r\n \r\n bt_wnd_list.each do |bt_wnd|\r\n bt_wnd.iconPosition = (bt_wnd.iconPosition|ICON_BEFORE_TEXT) & ~ICON_AFTER_TEXT\r\n bt_hash = {:bt_wnd => bt_wnd, :status => :not_used}\r\n @game_cmd_bt_list << bt_hash\r\n bt_wnd.create\r\n end\r\n free_all_btcmd # hide all commands buttons\r\n \r\n # send canvas size changed\r\n @app_owner.activate_canvas_frame\r\n end",
"def frame_args(frame_position=0)\n #This is a stub, used for indexing\n end",
"def frame_interval\n 1.0/@fps\n end",
"def frame_interval\n 1.0/@fps\n end",
"def frame_interval\n 1.0/@fps\n end",
"def update!(**args)\n @frames = args[:frames] if args.key?(:frames)\n end",
"def frames\n @frames ||=\n search('frame').map { |node| Frame.new(node, @mech, self) }\n end",
"def frames\n @frames ||=\n search('frame').map { |node| Frame.new(node, @mech, self) }\n end",
"def index\n @frames = Frame.all\n end",
"def index\n @frames = Frame.all\n end",
"def index\n @frames = Frame.all\n end",
"def index\n @frames = Frame.all\n end",
"def push frame\n raise TypeError unless frame.kind_of? Frame\n @avi.process_movi do |indices, movi|\n this_size = movi.size\n movi.pos = this_size\n movi.print frame.id\n movi.print [frame.data.size].pack('V')\n movi.print frame.data\n movi.print \"\\0\" if frame.data.size % 2 == 1\n indices << {\n :id => frame.id,\n :flag => frame.flag,\n :offset => this_size,\n :size => frame.data.size,\n }\n [indices, movi]\n end\n self\n end",
"def current_frame\n @current_frame\n end",
"def update_frame\n # If animation frame is different, change graphic\n if @unit.frame != Graphics.frame_count % 60 / 15\n @unit.frame = Graphics.frame_count % 60 / 15\n end\n #Update the flag graphic\n # Is $viewing ranges necessary?#\n unless @is_moving or @unit.selected\n @flag.moveto(@unit.x, @unit.y)\n @flag.update\n @health.moveto(@unit.x, @unit.y)\n @health.update\n else\n @flag.bitmap = nil\n @health.bitmap = nil\n end\n \n end",
"def initialize(frames = 1024)\n $frames = Frame.new(1024)\n $bm = Bitmap.new(1024)\n\n init_segment_table\n end",
"def next_frame\n raise(StopIteration, \"End of file\") if @file.eof?\n @garbage = []\n @frame = {}\n ingest_frame\n @input_frame_number += 1 if !@frame.empty?\n frame[\"index\"] ||= @input_frame_number\n @footer = @garbage if @file.eof?\n if @input_frame_number > 1 && !@file.eof? && !@garbage.empty?\n STDERR.puts \"Extra text found:\\n #{@garbage * \"\"}\"\n end\n unless [\"start_time\", \"end_time\", \"content\"].all?{|k| @frame.has_key?(k)}\n if @file.eof?\n raise StopIteration, \"No more valid frames\"\n else\n raise \"Invalid frame and not EOF: #{frame}\"\n end\n end\n return @frame\n end",
"def iframes; end",
"def initialize\n @rolls = []\n @frames = []\n end",
"def frame\n world.nil? ? nil : world.frame\n end",
"def frame_self(frame_postion=0)\n #This is a stub, used for indexing\n end",
"def frame_status(pins)\n @frame_complete = !@frame_complete if pins != 10\n end",
"def update_frame\n # If animation frame is different, change graphic\n if @anim_frame != @unit.frame\n @anim_frame = @unit.frame\n end\n end",
"def show_frame(count)\n\n clear_screen()\n\n if count == 0\n 12.times {puts \" \"}\n elsif count == 1\n 9.times {puts \" \"}\n puts \" _________ \"\n 2.times {puts \" \"}\n elsif count == 2\n 3.times {puts \" \"}\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" ____|____ \"\n 2.times {puts \" \"}\n elsif count == 3\n 2.times {puts \" \"}\n puts \" ______ \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" ____|____ \"\n 2.times {puts \" \"}\n elsif count == 4\n 2.times {puts \" \"}\n puts \" ______ \"\n puts \" | | \"\n puts \" | | \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" ____|____ \"\n 2.times {puts \" \"}\n elsif count == 5\n 2.times {puts \" \"}\n puts \" ______ \"\n puts \" | | \"\n puts \" | | \"\n puts \" | O \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" ____|____ \"\n 2.times {puts \" \"}\n elsif count == 6\n 2.times {puts \" \"}\n puts \" ______ \"\n puts \" | | \"\n puts \" | | \"\n puts \" | O \"\n puts \" | | \"\n puts \" | \"\n puts \" | \"\n puts \" ____|____ \"\n 2.times {puts \" \"}\n elsif count == 7\n 2.times {puts \" \"}\n puts \" ______ \"\n puts \" | | \"\n puts \" | | \"\n puts \" | O \"\n puts \" | /| \"\n puts \" | \"\n puts \" | \"\n puts \" ____|____ \"\n 2.times {puts \" \"}\n elsif count == 8\n 2.times {puts \" \"}\n puts \" ______ \"\n puts \" | | \"\n puts \" | | \"\n puts \" | O \"\n puts \" | /|\\\\ \"\n puts \" | \"\n puts \" | \"\n puts \" ____|____ \"\n 2.times {puts \" \"}\n elsif count == 9\n 2.times {puts \" \"}\n puts \" ______ \"\n puts \" | | \"\n puts \" | | \"\n puts \" | O \"\n puts \" | /|\\\\ \"\n puts \" | / \"\n puts \" | \"\n puts \" ____|____ \"\n 2.times {puts \" \"}\n elsif count == 10\n 2.times {puts \" \"}\n puts \" ______ \"\n puts \" | | \"\n puts \" | | \"\n puts \" | O \"\n puts \" | /|\\\\ \"\n puts \" | / \\\\ \"\n puts \" | \"\n puts \" ____|____ \"\n 2.times {puts \" \"}\n end\n\nend",
"def change_frame_to(index, run_whereami = T.unsafe(nil)); end",
"def blit; end",
"def clearFrame(frame)\n if frame>=0 && frame<@animation.length\n for i in 0...PBAnimation::MAXSPRITES\n if self.deletable?(i)\n @animation[frame][i]=nil\n else\n pbResetCel(@animation[frame][i])\n end\n @dirty[i]=true if frame==@currentframe \n end\n end\n end",
"def read_frame\n\t\t\t\tframe = @framer.read_frame(@local_settings.maximum_frame_size)\n\t\t\t\t# puts \"#{self.class} #{@state} read_frame: class=#{frame.class} stream_id=#{frame.stream_id} flags=#{frame.flags} length=#{frame.length} (remote_stream_id=#{@remote_stream_id})\"\n\t\t\t\t# puts \"Windows: local_window=#{@local_window.inspect}; remote_window=#{@remote_window.inspect}\"\n\t\t\t\t\n\t\t\t\treturn if ignore_frame?(frame)\n\t\t\t\t\n\t\t\t\tyield frame if block_given?\n\t\t\t\tframe.apply(self)\n\t\t\t\t\n\t\t\t\treturn frame\n\t\t\trescue GoawayError => error\n\t\t\t\t# Go directly to jail. Do not pass go, do not collect $200.\n\t\t\t\traise\n\t\t\trescue ProtocolError => error\n\t\t\t\tsend_goaway(error.code || PROTOCOL_ERROR, error.message)\n\t\t\t\t\n\t\t\t\traise\n\t\t\trescue HPACK::Error => error\n\t\t\t\tsend_goaway(COMPRESSION_ERROR, error.message)\n\t\t\t\t\n\t\t\t\traise\n\t\t\tend",
"def combine_frames(frames)\n frames.first.zip(*frames[1..-1]).map do |pixels|\n combine_pixels pixels\n end\n end",
"def frame_time; motion.frame_time; end",
"def update\n super\n if self.bitmap != nil and delay(@delay) and @animated\n x = @current_frame * @frame_width + @offset_x\n self.src_rect = Rect.new(x, @offset_y, @frame_width, @frame_height)\n @current_frame = (@current_frame + 1) unless @frames == 0\n @animated = false if @current_frame == @frames and @once\n @current_frame %= @frames\n end\n end",
"def last_of frame_type\n frame = nil\n @avi.process_movi do |indices, movi|\n indices.reverse.each do |m|\n movi.pos = m[:offset] + 8\n f = Frame.new(movi.read(m[:size]), m[:id], m[:flag])\n if f.is?(frame_type)\n frame = f\n break\n end\n end\n [indices, movi]\n end\n frame\n end",
"def slice *args\n b, l = get_beginning_and_length *args\n if l.nil?\n self.at b\n else\n e = b + l - 1\n r = self.to_avi\n r.frames.each_with_index do |f, i|\n unless i >= b && i <= e\n f.data = nil\n end\n end\n r.frames\n end\n end",
"def frame?\n current_frame = []\n @scorecard.each do |key, value|\n current_frame << key if value.framescore[:roll_1].nil? || value.framescore[:roll_2].nil?\n end\n current_frame.sort\n # to get the current frame as an integer, use this:\n # p current_frame[0][-1].to_i\n current_frame[0]\n end",
"def pasteLast\r\n copyFrame(@currentframe-1,@currentframe) if @currentframe>0\r\n end",
"def at n\n frame = nil\n @avi.process_movi do |indices, movi|\n m = indices[n]\n unless m.nil?\n movi.pos = m[:offset] + 8\n frame = Frame.new(movi.read(m[:size]), m[:id], m[:flag])\n movi.rewind\n end\n [indices, movi]\n end\n frame\n end",
"def remove_frame(frame)\n end",
"def frame_description(b); end",
"def end_frame\n @frame = false\n end",
"def rewind\n @frame_manager.rewind\n self\n end",
"def rewind\n @frame_manager.rewind\n self\n end"
] |
[
"0.8589545",
"0.73132855",
"0.72158456",
"0.71395475",
"0.7058525",
"0.7052266",
"0.6854691",
"0.6780105",
"0.6776601",
"0.67535096",
"0.6684968",
"0.66157055",
"0.6610187",
"0.65869415",
"0.65182",
"0.6484023",
"0.6372667",
"0.6341841",
"0.6341841",
"0.62912405",
"0.6271168",
"0.6266158",
"0.62034696",
"0.6173516",
"0.6168314",
"0.61606437",
"0.61303216",
"0.6095645",
"0.6087463",
"0.6048478",
"0.60432845",
"0.602699",
"0.6020653",
"0.6015436",
"0.60062546",
"0.5995641",
"0.5990432",
"0.5982862",
"0.5949306",
"0.594054",
"0.59234494",
"0.59212077",
"0.59114647",
"0.58941144",
"0.58809406",
"0.586999",
"0.58683264",
"0.5859749",
"0.58464164",
"0.5845951",
"0.58411616",
"0.5840609",
"0.584041",
"0.58242124",
"0.5810987",
"0.57928866",
"0.5786964",
"0.57532066",
"0.5752884",
"0.5750769",
"0.57507545",
"0.57463694",
"0.5743657",
"0.5743657",
"0.5743657",
"0.5727367",
"0.57248217",
"0.57248217",
"0.5719805",
"0.5719805",
"0.5719805",
"0.5719805",
"0.57032204",
"0.569512",
"0.5684296",
"0.5673351",
"0.5661926",
"0.5659816",
"0.56588256",
"0.56516004",
"0.5638702",
"0.5634414",
"0.5622598",
"0.56200063",
"0.5607084",
"0.55831987",
"0.5577539",
"0.55540204",
"0.55487704",
"0.55484337",
"0.5547682",
"0.55466074",
"0.5544154",
"0.5530428",
"0.5520013",
"0.55174017",
"0.55125934",
"0.55019873",
"0.5500972",
"0.5500449",
"0.5500449"
] |
0.0
|
-1
|
Metodo que muestra los frames
|
def show
10.times do |round|
@cadena = ''
if round == 9
show_auxiliar(4, round, @cadena)
else
show_auxiliar(3, round, @cadena)
end
puts "#{@cadena}\n"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def frames; end",
"def frame; end",
"def frame=(pos); end",
"def setup_frames\n @frames ||=\n begin\n frames = 10.times.map {|i| Frame.new(i+1,0,0,0,nil)}\n # link frames\n (0...9).each {|i| frames[i].next_frame = frames[i+1]}\n frames\n end\n end",
"def c_frame?; end",
"def frames; motion.frames; end",
"def initial_frame(bindings); end",
"def frames\n _nudge[3]\n end",
"def frames\n\t\tframes = [\"day\", \"week\", \"month\", \"year\"]\n\tend",
"def add_frame(frame)\n end",
"def catchupFrames(fromFrameNo, toFrameNo)\r\n #puts \"#{fromFrameNo} --> #{toFrameNo}\"\r\n for i in fromFrameNo..toFrameNo do\r\n #puts \"Catching up frame #{i}:\";\r\n if @frames.length <= i then\r\n @frames[i] = Frame.new(self);\r\n @frames[i-1].pixmaps.each do |pixmap|\r\n @frames[i].addPixmap(pixmap)\r\n end\r\n end\r\n end\r\n return @frames[toFrameNo];\r\n end",
"def refresh_frame(run_whereami = T.unsafe(nil)); end",
"def build_frames\n prev_frame = nil\n 10.times.map do |frame_number|\n prev_frame = Frame.new(10 - frame_number, prev_frame)\n end.reverse!\n end",
"def frame(id); end",
"def next_frame\n #populate our @channels instance vaiable\n create_channel_list\n do_frame_lookup\n\n if File.exist?(\"/home/lee/src/eyebleach/test_images/#{message[:channel_name]}-frame#{message[:frame_no]}.gif\")\n image = Base64.encode64(File.open(\"/home/lee/src/eyebleach/test_images/#{message[:channel_name]}-frame#{message[:frame_no]}.gif\").read)\n frame_message :next_frame, image, message[:frame_no], @channels[message[:channel_name]], message[:channel_name]\n else\n image = Base64.encode64(File.open(\"/home/lee/src/eyebleach/test_images/#{message[:channel_name]}-frame0.gif\").read)\n frame_message :next_frame, image, 0, @channels[message[:channel_name]], message[:channel_name]\n end\n end",
"def change_frame_to(index, run_whereami = T.unsafe(nil)); end",
"def frame\n (@frame || 1).to_f\n end",
"def prepare_parsed_frame frame\n end",
"def current_frame\n @current_frame\n end",
"def frame\n @rad.frame(0)\n end",
"def set_canvas_frame(canvasFrame_wnd)\r\n canvasFrame = FXVerticalFrame.new(canvasFrame_wnd, FRAME_THICK|LAYOUT_FILL_Y|LAYOUT_TOP|LAYOUT_LEFT)\r\n canvasFrame.create\r\n \r\n #p \"**** set frame...\"\r\n if @game_cmd_bt_list.size > 0 \r\n # send canvas size changed\r\n @app_owner.activate_canvas_frame\r\n return\r\n end\r\n \r\n label_wnd = FXLabel.new(canvasFrame, \"Comandi gioco \", nil, JUSTIFY_LEFT|LAYOUT_FILL_X)\r\n label_wnd.create\r\n \r\n bt_wnd_list = []\r\n bt_wnd_list << FXButton.new(canvasFrame, \"uno\", @app_owner.icons_app[:numero_uno], nil, 0,FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_BOTTOM|LAYOUT_LEFT,0, 0, 0, 0, 10, 10, 5, 5)\r\n bt_wnd_list << FXButton.new(canvasFrame, \"due\", @app_owner.icons_app[:numero_due], nil, 0,FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_BOTTOM|LAYOUT_LEFT,0, 0, 0, 0, 10, 10, 5, 5)\r\n bt_wnd_list << FXButton.new(canvasFrame, \"tre\", @app_owner.icons_app[:numero_tre], nil, 0,FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_BOTTOM|LAYOUT_LEFT,0, 0, 0, 0, 10, 10, 5, 5)\r\n \r\n bt_wnd_list.each do |bt_wnd|\r\n bt_wnd.iconPosition = (bt_wnd.iconPosition|ICON_BEFORE_TEXT) & ~ICON_AFTER_TEXT\r\n bt_hash = {:bt_wnd => bt_wnd, :status => :not_used}\r\n @game_cmd_bt_list << bt_hash\r\n bt_wnd.create\r\n end\r\n free_all_btcmd # hide all commands buttons\r\n \r\n # send canvas size changed\r\n @app_owner.activate_canvas_frame\r\n end",
"def frame\n context.frame\n end",
"def showFrames()\n=begin\n \n ff = @ie.document.frames\n\n log \"there are \" + ff.length.to_s + \" frames\" if $debuglevel >=0\n\n for f in 0 .. ff.length-1\n log \"Frame: \" + ff[f.to_s].name.to_s if $debuglevel >=0 \n log \"My parent is: \" + ff[f.to_s].parentWindow.name.to_s if $debuglevel >=0\n end \n\n #frame = @ie.document.frames[ frameName ].document\n \n=end\n end",
"def show_frames\r\n jssh_command = \"var frameset = #{WINDOW_VAR}.frames;\r\n var elements_frames = new Array();\r\n for(var i = 0; i < frameset.length; i++)\r\n {\r\n var frames = frameset[i].frames;\r\n for(var j = 0; j < frames.length; j++)\r\n {\r\n elements_frames.push(frames[j].frameElement); \r\n }\r\n }\r\n elements_frames.length;\"\r\n \r\n jssh_command.gsub!(\"\\n\", \"\")\r\n $jssh_socket.send(\"#{jssh_command};\\n\", 0)\r\n length = read_socket().to_i \r\n \r\n puts \"There are #{length} frames\"\r\n \r\n frames = Array.new(length)\r\n for i in 0..length - 1 do\r\n frames[i] = Frame.new(self, :jssh_name, \"elements_frames[#{i}]\")\r\n end\r\n \r\n for i in 0..length - 1 do\r\n puts \"frame: name: #{frames[i].name}\"\r\n puts \" index: #{i+1}\"\r\n end\r\n end",
"def last_frame; frames.last; end",
"def parent_frame; end",
"def update \n\t\t@currentframe = (@currentframe + 1) % @frames.size \n\t\t@image = @frames[@currentframe] # load the image\n \t@rect.move!(-@xspeed,0) # move horizontally left \n if @rect.right() < 0\n\t\t\t\tself.kill # went off screen, kill it\n\t\t\t\treturn \n\t\t end\n end",
"def update_frame\n # If animation frame is different, change graphic\n if @anim_frame != @unit.frame\n @anim_frame = @unit.frame\n end\n end",
"def load_frames\n\t\tw,h = @_w, @_h # convenience assignments\n\t\twt = 0.8 * w\n\t\tdw = 0.5 * (w-wt) \n\t img = Surface.new([w,h]).fill(@@bg_color)\n\t img.draw_polygon_s([[0,h], [dw,0], [dw+wt,0], [w,h],[0,h]], BROWN)\n\t return [img]\n\tend",
"def frames\n @frames ||=\n search('frame').map { |node| Frame.new(node, @mech, self) }\n end",
"def frames\n @frames ||=\n search('frame').map { |node| Frame.new(node, @mech, self) }\n end",
"def frame_args(frame_position=0)\n #This is a stub, used for indexing\n end",
"def tenth_frame; end",
"def initialize\n self.frames = []\n self.options = {}\n reset_for_fullscreen\n end",
"def frame_reset\n @delta_time = @frame_to_skip = 0\n @ruby_time = @current_time = @last_time = @last_second_time = Time.new\n reset_gc_time\n reset_ruby_time\n @last_frame_count = Graphics.frame_count\n end",
"def frame_step \n send_cmd(\"frame_step\")\n end",
"def set_frame\n frames = @animations[@playing_animation]\n case frames\n when Range\n reset_clipping_rect\n @clip_x = @current_frame * @clip_width\n when Array\n f = frames[@current_frame]\n @clip_x = f[:x] || @defaults[:clip_x]\n @clip_y = f[:y] || @defaults[:clip_y]\n @clip_width = f[:width] || @defaults[:clip_width]\n @clip_height = f[:height] || @defaults[:clip_height]\n @frame_time = f[:time] || @defaults[:frame_time]\n end\n end",
"def update_frame\n # If animation frame is different, change graphic\n if @unit.frame != Graphics.frame_count % 60 / 15\n @unit.frame = Graphics.frame_count % 60 / 15\n end\n #Update the flag graphic\n # Is $viewing ranges necessary?#\n unless @is_moving or @unit.selected\n @flag.moveto(@unit.x, @unit.y)\n @flag.update\n @health.moveto(@unit.x, @unit.y)\n @health.update\n else\n @flag.bitmap = nil\n @health.bitmap = nil\n end\n \n end",
"def end_frame\n end",
"def frame_method(frame_position=0)\n #This is a stub, used for indexing\n end",
"def each_frame(&block)\n if !block_given?\n return enum_for(:each_frame)\n end\n\n available_frames.each(&block)\n supercall(nil, :each_frame, &block)\n end",
"def clear_frame_managers(_pry_); end",
"def frames\n @keyframes.last.index + @keyframes.last.duration\n end",
"def iframes; end",
"def frame\n world.nil? ? nil : world.frame\n end",
"def frame_self(frame_postion=0)\n #This is a stub, used for indexing\n end",
"def update\n if @frame == @gfx.length - 1\n @frame = 0\n elsif @frame == 7\n @frame += 1\n @deleted = true\n else\n @frame += 1\n end\n end",
"def frames\n value_parts[3]\n end",
"def frames\n value_parts[3]\n end",
"def nav\n frame_text = self.redirect {$ie.show_frames}\n if frame_text =~ /mainFrameSet/ then $ie.frame(:id, 'main').frame(:id, 'navigationFrame')\n else $ie.frame(:id, 'navigationFrame')\n end\n end",
"def eb; self.iframes += 15; end",
"def ani_frames\n return @ani_frames\n end",
"def to_frame(frame)\r\n # checks if specified string parameter\r\n if frame.is_a?(String)\r\n if frame == \"last\"\r\n frame = @totalFrames - 1\r\n else\r\n frame = 0\r\n end\r\n end\r\n # sets frame\r\n frame = @totalFrames - 1 if frame >= @totalFrames\r\n frame = 0 if frame < 0\r\n @currentIndex = frame\r\n end",
"def index frame\n n = -1\n @avi.process_movi do |indices, movi|\n indices.each_with_index do |m, i|\n movi.pos = m[:offset] + 8\n f = Frame.new(movi.read(m[:size]), m[:id], m[:flag]) \n if f == frame\n n = i\n break\n end\n end\n [indices, movi]\n end\n n\n end",
"def index\n @frames = Frame.all\n end",
"def index\n @frames = Frame.all\n end",
"def index\n @frames = Frame.all\n end",
"def index\n @frames = Frame.all\n end",
"def framing\n previous, klass.current_frame = klass.current_frame, self unless @delegate_to_klass\n yield\n ensure\n klass.current_frame = previous unless @delegate_to_klass\n end",
"def update!(**args)\n @frames = args[:frames] if args.key?(:frames)\n end",
"def frame_chain!\n @frame_chain\n end",
"def updateDebugFPS(frame)\n end",
"def frame_teardown\n @top_frame = @frame = @current_thread = nil \n @threads2frames = {}\n end",
"def push frame\n raise TypeError unless frame.kind_of? Frame\n @avi.process_movi do |indices, movi|\n this_size = movi.size\n movi.pos = this_size\n movi.print frame.id\n movi.print [frame.data.size].pack('V')\n movi.print frame.data\n movi.print \"\\0\" if frame.data.size % 2 == 1\n indices << {\n :id => frame.id,\n :flag => frame.flag,\n :offset => this_size,\n :size => frame.data.size,\n }\n [indices, movi]\n end\n self\n end",
"def cur_image\n @frames.cur_image\n end",
"def remove_frame(frame)\n end",
"def frame_locals(frame)\n #This is a stub, used for indexing\n end",
"def adjust_frame(frame_num, absolute_pos)\n frame, frame_num = get_frame(frame_num, absolute_pos)\n if frame \n @frame = frame\n @frame.index = frame_num\n prefix = \"--> ##{frame_num} \" \n unless @settings[:traceprint]\n msg(\"#{prefix}%s\" %\n @frame.describe(:basename => settings[:basename],\n :maxwidth => settings[:maxwidth] - prefix.size,\n :callstyle => settings[:callstyle]))\n end\n @line_no = @frame.line\n @frame\n else\n nil\n end\n end",
"def cover\n manipulate! do |frame, index|\n frame if index.zero?\n end\n end",
"def update\n @currentFrame += 1\n self.updateElements\n if !@totalFrames.nil? && @totalFrames >= 0 && @currentFrame >= @totalFrames\n self.restart\n end\n end",
"def update_frame_index_array\n @index_array = [0,1,2] if !@character_anim\n hash = @character.pose_path\n if hash != nil and hash.keys.include?(@pose+1)\n @index_array = hash[@pose+1]\n @max_frame = hash[@pose+1].size\n else\n hash = @character.frame_hash\n if hash != nil and hash.keys.include?(@pose+1)\n @max_frame = hash[@pose+1]\n else\n @max_frame = GTBS::DEFAULT_POSE_FRAMES\n end\n @index_array = []\n for i in 0...@max_frame\n @index_array.push(i)\n end\n end\n @frame_index = 0 #force reset current frame index to 0\n end",
"def create_frame\n @current_frame = {\n :vlocks => {},\n :parent_frame => current_frame\n }\n end",
"def frame_managers(_pry_); end",
"def populate_frames\n\n # reset the frame roll values\n @frames.each {|f| f.reset }\n\n nstrikes = 0 # keep track of the 'strikes' as they result in 'skip' to the next frame\n # iterate the rolls array and populate the corresponding frame instances\n @rolls.each_with_index {|e,i|\n \n # add the 'nstrikes'\n index_adjusted_by_strikes = i+nstrikes\n\n if index_adjusted_by_strikes == 20 # last frame, 3rd element\n @frames.last.roll_3 = e\n else\n q,r = index_adjusted_by_strikes.divmod(2) # determine the frame and the 'roll' index within the frame\n f = @frames[q]\n f.send(:\"roll_#{r+1}=\", e)\n nstrikes +=1 if f.strike? # increment 'nstrikes' if strike\n end\n }\n @frames\n end",
"def pop_frame_manager(_pry_); end",
"def get_frame\n next_frame\n rescue StopIteration => e\n return nil\n end",
"def set_game_frame(frame)\n @frame = frame\n end",
"def get_frames\n return driver.find_elements(:css, 'internal-frame')\nend",
"def change(frames = 0, delay = 0, offx = 0, offy = 0,\n startf = 0, once = false)\n @frames = frames\n @delay = delay\n @offset_x, @offset_y = offx, offy\n @current_frame = startf\n @once = once\n x = @current_frame * @frame_width + @offset_x\n self.src_rect = Rect.new(x, @offset_y, @frame_width, @frame_height)\n @goingup = true\n @animated = true\n end",
"def frame(options)\n set RGhost::Frame.new(options)\n end",
"def frame\n animation[Gosu.milliseconds / 100 % animation.size]\n end",
"def frame!\n if self.mac?\n MacEditor.new.frame!(self)\n else\n Editor.new.frame!(self)\n end\n end",
"def iframes=(x); @iframes = x; end",
"def replace_external_frame\n end",
"def blit; end",
"def initialize(frames = 1024)\n $frames = Frame.new(1024)\n $bm = Bitmap.new(1024)\n\n init_segment_table\n end",
"def nextFrame(view)\n # Compute how long it took to display the last frame. This will\n # be used to compute how much to move or turnfor the next frame.\n time = view.last_refresh_time\n time_delay = 0\n if( time < 0.04 )\n time_delay = 0.04 - time\n time = 0.04\n end\n \n if( (@keys & (LEFT_ARROW | RIGHT_ARROW)) != 0 )\n self.send(self.lr_function, view, time)\n end\n if( (@keys & (UP_ARROW | DOWN_ARROW)) != 0 )\n self.send(self.ud_function, view, time)\n end\n \n # update the camera parameters\n @rep.update(view.camera) if @rep\n\n view.show_frame time_delay\n self.show_height\n \n true\nend",
"def rasterise \r\n @frames.each do |frame|\r\n printf '.';\r\n canvas = Canvas.new(@width, @height);\r\n @canvases.push(canvas);\r\n if frame.pixmaps.length == 0 then next; end;\r\n frame.pixmaps.each do |pixmap|\r\n img = pixmap.sprite.getImage(pixmap.frame);\r\n pixmap.frame = (pixmap.frame + 1) % (pixmap.sprite.images.length);\r\n canvas.add(img, pixmap.x, pixmap.y);\r\n end\r\n end \r\n end",
"def initialize\n @frame = Rect.zeroRect\n end",
"def frm\n self.frame(:src=>/TBD/)\n end",
"def frm\n self.frame(:src=>/TBD/)\n end",
"def frm\n self.frame(:src=>/TBD/)\n end",
"def frm\n self.frame(:src=>/TBD/)\n end",
"def show_frame(count)\n\n clear_screen()\n\n if count == 0\n 12.times {puts \" \"}\n elsif count == 1\n 9.times {puts \" \"}\n puts \" _________ \"\n 2.times {puts \" \"}\n elsif count == 2\n 3.times {puts \" \"}\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" ____|____ \"\n 2.times {puts \" \"}\n elsif count == 3\n 2.times {puts \" \"}\n puts \" ______ \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" ____|____ \"\n 2.times {puts \" \"}\n elsif count == 4\n 2.times {puts \" \"}\n puts \" ______ \"\n puts \" | | \"\n puts \" | | \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" ____|____ \"\n 2.times {puts \" \"}\n elsif count == 5\n 2.times {puts \" \"}\n puts \" ______ \"\n puts \" | | \"\n puts \" | | \"\n puts \" | O \"\n puts \" | \"\n puts \" | \"\n puts \" | \"\n puts \" ____|____ \"\n 2.times {puts \" \"}\n elsif count == 6\n 2.times {puts \" \"}\n puts \" ______ \"\n puts \" | | \"\n puts \" | | \"\n puts \" | O \"\n puts \" | | \"\n puts \" | \"\n puts \" | \"\n puts \" ____|____ \"\n 2.times {puts \" \"}\n elsif count == 7\n 2.times {puts \" \"}\n puts \" ______ \"\n puts \" | | \"\n puts \" | | \"\n puts \" | O \"\n puts \" | /| \"\n puts \" | \"\n puts \" | \"\n puts \" ____|____ \"\n 2.times {puts \" \"}\n elsif count == 8\n 2.times {puts \" \"}\n puts \" ______ \"\n puts \" | | \"\n puts \" | | \"\n puts \" | O \"\n puts \" | /|\\\\ \"\n puts \" | \"\n puts \" | \"\n puts \" ____|____ \"\n 2.times {puts \" \"}\n elsif count == 9\n 2.times {puts \" \"}\n puts \" ______ \"\n puts \" | | \"\n puts \" | | \"\n puts \" | O \"\n puts \" | /|\\\\ \"\n puts \" | / \"\n puts \" | \"\n puts \" ____|____ \"\n 2.times {puts \" \"}\n elsif count == 10\n 2.times {puts \" \"}\n puts \" ______ \"\n puts \" | | \"\n puts \" | | \"\n puts \" | O \"\n puts \" | /|\\\\ \"\n puts \" | / \\\\ \"\n puts \" | \"\n puts \" ____|____ \"\n 2.times {puts \" \"}\n end\n\nend",
"def frames(*frame_names)\n frame_names.each do |name|\n if name.respond_to?(:to_sym)\n name = name.to_s\n elsif name.respond_to?(:to_str)\n name = name.to_str\n else\n raise ArgumentError, \"frame names should be strings, got #{name.inspect}\"\n end\n\n name = name.to_s\n if name !~ /^\\w+$/\n raise ArgumentError, \"frame names can only contain alphanumeric characters and _, got #{name}\"\n end\n\n if !has_frame?(name.to_str)\n available_frames << name.to_str\n end\n end\n available_frames\n end",
"def at n\n frame = nil\n @avi.process_movi do |indices, movi|\n m = indices[n]\n unless m.nil?\n movi.pos = m[:offset] + 8\n frame = Frame.new(movi.read(m[:size]), m[:id], m[:flag])\n movi.rewind\n end\n [indices, movi]\n end\n frame\n end",
"def intro\n\t\t@frame = @frame + 1\n\t\tif @frame == 1 or @frame == 40 \n\t\t\t@screen.fill([0, 0, 0])\n\t\telsif @frame == 10 or @frame == 60\n\t\t\t@map.updateBackground\n\t\t\t@map.sprites.each { |sprite|\n\t\t\t\tsprite.draw(@screen)\n\t\t\t}\n\t\telsif @frame == 220\n\t\t\t@frame = 0\n\t\t\tstats\n\t\t\tsetMenu\n\t\telsif @frame > 120\n\t\t\t@dialogueText.draw\n\t\tend\n\tend",
"def delete_frame_managers(_pry_); end",
"def suitable_frame\n unless @suitable_frame\n frames = ['last'] + (0..renderer.max_frames).to_a.reverse\n\n # render a batch of frames to speed up the process\n renderer.render_batch!(frames)\n\n frames.each do |frame|\n @suitable_frame = frame if !@suitable_frame && suitable_frame?(frame)\n end\n\n @suitable_frame ||= 'last'\n end\n\n @suitable_frame\n end",
"def url_for_frameset; end",
"def url_for_frameset; end"
] |
[
"0.85845155",
"0.7584838",
"0.73254853",
"0.7113471",
"0.6955063",
"0.6818274",
"0.6782232",
"0.6754397",
"0.67473024",
"0.66151756",
"0.6511677",
"0.6446934",
"0.6441692",
"0.64107955",
"0.63725597",
"0.6370485",
"0.6357772",
"0.6311363",
"0.6309925",
"0.6305402",
"0.6303264",
"0.62922513",
"0.6272873",
"0.62717915",
"0.6267853",
"0.61960834",
"0.61910605",
"0.618359",
"0.618154",
"0.61691225",
"0.61691225",
"0.61689097",
"0.6167173",
"0.61600626",
"0.6150396",
"0.6145112",
"0.61208117",
"0.6116866",
"0.61029214",
"0.60974413",
"0.6084501",
"0.6076061",
"0.6072298",
"0.6067861",
"0.605609",
"0.60559964",
"0.6046955",
"0.6034762",
"0.6034762",
"0.6009155",
"0.6006904",
"0.60043305",
"0.5992241",
"0.59479773",
"0.5935614",
"0.5935614",
"0.5935614",
"0.5935614",
"0.59351414",
"0.59294885",
"0.59179556",
"0.5917499",
"0.58993345",
"0.58788556",
"0.58782774",
"0.584948",
"0.58482367",
"0.5839886",
"0.58374566",
"0.58364743",
"0.5828022",
"0.58042014",
"0.5799507",
"0.5780973",
"0.5780809",
"0.57449895",
"0.5721584",
"0.5707215",
"0.5706084",
"0.5688635",
"0.5684043",
"0.5677667",
"0.567401",
"0.5672536",
"0.56626624",
"0.5658965",
"0.56566733",
"0.5655873",
"0.5649085",
"0.56363225",
"0.56363225",
"0.56363225",
"0.56363225",
"0.56216234",
"0.5614521",
"0.5606181",
"0.55969745",
"0.55889285",
"0.5585031",
"0.55824846",
"0.55824846"
] |
0.0
|
-1
|
Metodo switch para rellenar la matriz
|
def tiros(columns)
case columns
when 0
@roll_one
when 1
@roll_two
when 2
@score
else
@roll_three
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def matrix\n end",
"def principal\n op=0\n while (op!=5)\n op= menu1\n case op\n when 1\n\tputs \"CREAR MATRICES\"\n\tputs \"Introduce la dimension de las matriz 1: \"\n\tprint \"Filas? \"\n\tSTDOUT.flush\n\tf=gets.chomp\n\tprint \"Columnas? \"\n\tc=gets.chomp\n\top4=menu4\n\tcase op4\n\t when 1\n\t a= Matriz_densa.new(f.to_i,c.to_i)\n\t when 2\n\t a= Matriz_dispersa.new(f.to_i,c.to_i)\n\tend\n\top3=menu3\n\tcase op3\n\t when 1\n\t a.introducir_datos(1)\n\t when 2\n\t a.introducir_datos(2)\n\tend\n\n\tputs \"Introduce la dimension de las matriz 2: \"\n\tprint \"Filas? \"\n\tSTDOUT.flush\n\tf=gets.chomp\n\tprint \"Columnas? \"\n\tc=gets.chomp\n\top4=menu4\n\tcase op4\n\t when 1\n\t b= Matriz_densa.new(f.to_i,c.to_i)\n\t when 2\n\t b= Matriz_dispersa.new(f.to_i,c.to_i)\n\tend\n\top3=menu3\n\tcase op3\n\t when 1\n\t b.introducir_datos(1)\n\t when 2\n\t b.introducir_datos(2)\n\tend\n\tputs a.to_s\n\tputs b.to_s\n\t\n when 2\n\tputs \"GENERAR MATRICES CON VALORES ALEATORIOS\"\n\tputs \"Introduce la dimension de la matriz 1: \"\n\tprint \"Filas? \"\n\tSTDOUT.flush\n\tf=gets.chomp\n\tprint \"Columnas? \"\n\tc=gets.chomp\t\n\top4=menu4\n\tcase op4\n\t when 1\n\t a= Matriz_densa.new(f.to_i,c.to_i)\n\t when 2\n\t a= Matriz_dispersa.new(f.to_i,c.to_i)\n\tend\n\top3=menu3\n\tcase op3\n\t when 1\n\t a.generar(1)\n\t when 2\n\t a.generar(2)\n\tend\n\t\n\tputs \"Introduce la dimension de la matriz 2: \"\n\tprint \"Filas? \"\n\tSTDOUT.flush\n\tf=gets.chomp\n\tprint \"Columnas? \"\n\tc=gets.chomp\n\top4=menu4\n\tcase op4\n\t when 1 #matriz densa\n\t b= Matriz_densa.new(f.to_i,c.to_i)\n\t when 2 #matriz dispersa\n\t b= Matriz_dispersa.new(f.to_i,c.to_i)\n\tend\n\top3=menu3\n\tcase op3\n\t when 1\n\t b.generar(1)\n\t when 2\n\t b.generar(2)\n\tend\n\tputs a.to_s\n \tputs b.to_s\n\n when 3\n\t op2=0\n\t while (op2!=5)\n\t op2= menu2\n\t case op2\n\t when 1\n\t\tputs \"Suma\"\n\t\tputs \"M1 + M2 = M3\"\n\t\tputs a.to_s\n\t\tputs \"+\" \n\t\tputs b.to_s\n\t\tputs \"=\"\n\t\tc = a+b\n\t\tputs c.to_s\n\t\n\t\tputs \"Resta\"\n\t\tputs \"M1 - M2 = M3\"\n\t\tputs a.to_s\n\t\tputs \"-\" \n\t\tputs b.to_s\n\t\tputs \"=\"\n\t\tc = a-b\n\t\tputs c.to_s\n\t\tpausa\n\t\t\n\t when 2\n\t\tputs \"Mutiplicacion por un escalar\"\n\t\tprint \"Numero a multiplicar?: \"\n\t\tSTDOUT.flush\n\t\tnum=gets.chomp\n\t\tnum = num.to_i\n\t\tputs \"#{num.to_i} * M1 = M3\"\n\t\tputs a.to_s\n\t\tc= a*num\n\t\tputs c.to_s\n\t\tputs \"Producto de matrices\"\n\t\tputs \"M1 * M2 = M3\"\n\t\tputs a.to_s\n\t\tputs \"*\"\n\t\tputs b.to_s\n\t\tputs \"=\"\n\t\td=a*b\n\t\tputs d.to_s\n\t\tpausa\n\n\t when 3\n\t\tputs \"Traspuesta de matrices\"\n\t\tputs \"M1\"\n\t\tputs a.to_s\n\t\tputs \"traspuesta M1\"\n\t\tputs \"#{a.t.to_s}\"\n\t\tputs \"M2\"\n\t\tputs b.to_s\n\t\tputs \"traspuesta M2\"\n\t\tputs \"#{b.t.to_s}\"\n\t\tpausa\n\n\t when 4\n\t\tputs \"Elementos maximos y minimos\"\n\t\tputs \"Maximo y minimo de M1\"\n\t\tputs a.to_s\n\t\tputs \"Max= #{a.max}\"\n\t\tputs \"Min= #{a.min}\"\n\t\tputs \"Maximo y minimo de M2\"\n\t\tputs b.to_s\n\t\tputs \"Max= #{b.max}\"\n\t\tputs \"Min= #{b.min}\"\n\t\tpausa\n\t end\n\t end\n when 4\n\t\n nueva = MatrizDSL.new(\"suma\") do\n\toption(\"densa\",\"densa\")\n\tresul(operand([[1,2,3],[4,5,6],[7,8,9]]),operand([[1,1,1],[1,1,1],[1,1,1]]))\n end\n# puts \"#{nueva.class}\"\n puts nueva\n# \tm=MatrizDSL.new(\"suma\")\n# \tputs m.to_s\n\tputs \"MOSTRAR\"\n\tputs \"M1 = \"\n\tputs a.to_s\n\tputs \"M2 = \"\n\tputs b.to_s\n\tif a==b\n\t puts \"Las matrices son iguales\"\n\telse\n\t puts \"Las matrices son diferentes\"\n\tend\n end\n pausa\n end\nend",
"def mostrar_matriz(matriz, fila_letra, oculto)\n# recibe fila_letra como punto de inicio de las letras\n# para las filas '@' para comenzar desde 'A' y 'J'\n# para comenzar desde 'K'\n espacios=\" \"*20\n\n if oculto == true\n imprimir_leyenda_1\n puts \" *Has hundido #{contar_algo(matriz,Barco_Hundido)} de los barcos enemigos,\"\n puts \" hay todavía al menos #{contar_algo(matriz,Barco )}\"\n end\n\n print_cintillo_numerico(matriz.length)\n for i in 0..matriz.length-1\n print \"#{espacios}#{fila_letra=fila_letra.next}\"\n print \"|\"\n for x in 0..matriz[0].length-1\n if oculto== true\n print \"#{ocultar_informacion(matriz[i][x])}|\"\n else\n print \"#{mostrar_informacion(matriz[i][x])}|\"\n end\n end\n print fila_letra\n puts\n\n\n end\n print_cintillo_numerico(matriz.length)\n\n if oculto == false\n imprimir_leyenda_2\n puts \" *El enemigo ha hundido #{contar_algo(matriz,Barco_Hundido)} de tus barcos,\"\n puts \" aun cuentas con #{contar_algo(matriz,Barco)} de ellos. \"\n end\nend",
"def exercise_1113 (matrix)\n end",
"def matriz_clave\n @m_clave=Array.new(4){Array.new()}\n i,j,contador=0,0,0\n @k.each do |x|\n if(contador==4)\n contador=0\n i=0\n j+=1\n end\n @m_clave[i][j] = x\n i+=1\n contador+=1\n end\n @m_clave\n end",
"def matriz_mensaje\n @m_mensaje=Array.new(4){Array.new(4,'')}\n i,j,contador=0,0,0\n @m.each do |x|\n if(contador==4)\n contador=0\n i=0\n j+=1\n end\n @m_mensaje[i][j] = x\n #p a[i][j]\n i+=1\n contador+=1\n end\n @m_mensaje\n\n end",
"def imprimir_Matriz\n\t\tx,y = 0,0\n\t\t\n\t\twhile x < row\n\t\t\twhile y < col\n\t\t\t\tprint(\"#{matriz[x][y]} \\t\")\n\t\t\t\tprint(\"\") \n\t\t\t\ty= y + 1\t\t\t\n\t\t\tend\n\t\t\tputs\n \t\t\tx = x + 1\n \t\t\ty = 0\n\t\tend\n\t\tputs \n\tend",
"def to_dispersa(mat)\n resultado = {}\n for i in 0...mat.f do\n for j in 0...mat.c do\n if (mat.matriz[i][j] != 0)\n if (resultado[i].nil?)\n resultado[i] = {}\n end\n resultado[i][j] = mat.matriz[i][j]\n end\n end \n end\n aux = Dispersa.new(mat.f, mat.c, resultado)\n end",
"def trasponer\n\t\telemento = Array.new(0)\n\t\tfor i in 0...colum do\n\t\t\tfila = Array.new(0)\n\t\t\tfor j in 0...filas do\n\t\t\t\tfila << pos[j][i]\n\t\t\tend\n\t\t\telemento << fila\n\t\tend\n\t\tMatriz.new(@ncol, @nfil, elemento)\n\tend",
"def trasponer\n\t\t\telemento = Array.new(0)\n\t\t\tfor i in 0...colum\n\t\t\t\tfila = Array.new(0)\n\t\t\t\tfor j in 0...filas\n\t\t\t\t\tfila << pos[j][i]\n\t\t\t\tend\n\t\t\t\telemento << fila\n\t\t\tend\n\t\t\tMatriz.new(@ncol, @nfil, elemento)\n\t\tend",
"def +(mat)\n if (mat.f == @f && mat.c == @c)\n resultado = Array.new\n for i in 0...@f do\n resultado[i] = Array.new\n for j in 0...@c do\n# \t if((!@matriz[i].nil?) && (!@matriz[i][j].nil?) && (!mat.matriz[i].nil?) && (!mat.matriz[i][j].nil?) && ((@matriz[i][j].class = Fraccion) || (mat.matriz[i][j] == Fraccion)))\n# \t resultado[i][j] = Fraccion.new(0,1)\n# \t else\n\t resultado[i][j] = 0 \n# \t end\n end\n end\n aux = Densa.new(resultado)\n nElementos = 0\n for i in 0...@f do\n for j in 0...@c do\n\t if ((!@matriz[i].nil?) && (!@matriz[i][j].nil?) && (!mat.matriz[i].nil?) && (!mat.matriz[i][j].nil?))\n aux.matriz[i][j] = @matriz[i][j] + mat.matriz[i][j]\n nElementos += 1\n\t elsif ((!@matriz[i].nil?) && (!@matriz[i][j].nil?) && ((!mat.matriz[i].nil?) || (!mat.matriz[i].nil? && !mat.matriz[i][j].nil?)))\n\t aux.matriz[i][j] = @matriz[i][j]\n nElementos += 1\n\t elsif ((!mat.matriz[i].nil?) && (!mat.matriz[i][j].nil?) && ((!@matriz[i].nil?) || (!@matriz[i].nil? && !@matriz[i][j].nil?)))\n\t aux.matriz[i][j] = mat.matriz[i][j]\n nElementos += 1\n\t end\n end\n end\n if ((@f * @c) * 0.4 > nElementos)\n aux = to_dispersa(aux)\n end\n else\n aux = \"No se pueden sumar\"\n end\n aux\n end",
"def redesign\n x = @mat[0].length\n y = @mat.size\n (1..y-2).each do |i|\n (1..x-2).each do |j|\n @mat[i][j] = \"0\"\n end\n end\n\n divide(1,x-2,1,y-2)\n end",
"def ask_matrix(rows, columns)\n accl = []\n while accl.length < rows * columns do\n accl.concat ask\n end\n Matrix::build(rows, columns) do |r, c|\n accl[ c + r * rows ]\n end\nend",
"def fifteen \n size_x = 10 \n size_y = 10\n row = []\n for i in 1..size_x\n row.push(0)\n end\n\n @@mat = []\n\n for i in 1..size_y\n @@mat.push(row.clone)\n end\n \n move(0,0)\n\n return @@mat[size_x-1][size_y-1]\n\nend",
"def -(mat)\n if (mat.nFil == @nFil && mat.mCol == @mCol)\n \n maux=Array.new(@nFil) { Array.new(@mCol) }\n \n (@nFil).times do |i|\n (@mCol).times do |j|\n maux[i][j] = @matriz[i][j]\n end\n end\n \n aux = Matriz.new(maux)\n (@nFil).times do |i|\n (@mCol).times do |j|\n aux.matriz[i][j] = @matriz[i][j] - mat.matriz[i][j]\n end\n end\n else\n aux = 0\n end\n aux\n end",
"def matrix_addition_reloaded(*matricies)\n addition = matricies[0]\n \n i = 1\n while i < matricies.length\n return nil if matricies[i].length != addition.length\n addition = matrix_addition(addition, matricies[i])\n \n i += 1\n end\n \n addition\nend",
"def redesign\n reset_mat\n recur_divide(0, 0, m, n, cut_dir(c, r))\n end",
"def -(mat)\n if (mat.f == @f && mat.c == @c)\n result = Array.new\n for i in 0...@f do\n result[i] = Array.new\n for j in 0...@c do\n result[i][j] = 0\n end\n end\n aux = Densa.new(result)\n nElementos = 0\n for i in 0...@f do\n for j in 0...@c do\n if ((!@matriz[i].nil?) && (!@matriz[i][j].nil?) && (!mat.matriz[i].nil?) && (!mat.matriz[i][j].nil?))\n aux.matriz[i][j] = @matriz[i][j] - mat.matriz[i][j]\n nElementos += 1\n elsif ((!@matriz[i].nil?) && (!@matriz[i][j].nil?) && ((!mat.matriz[i].nil?) || (!mat.matriz[i].nil? && !mat.matriz[i][j].nil?)))\n aux.matriz[i][j] = @matriz[i][j]\n nElementos += 1\n elsif ((!mat.matriz[i].nil?) && (!mat.matriz[i][j].nil?) && ((!@matriz[i].nil?) || (!@matriz[i].nil? && !@matriz[i][j].nil?)))\n aux.matriz[i][j] = - mat.matriz[i][j]\n nElementos += 1\n end\n end\n end\n if ((@f * @c) * 0.4 > nElementos)\n aux = to_dispersa(aux)\n end\n else\n aux = \"No se pueden sumar\"\n end\n aux\n end",
"def display\n @mat.each do | _ ,row|\n row.each do |ele|\n if ele == \"1\"\n print ele\n else\n print \" \"\n end\n end\n puts \"\\n\"\n end\n end",
"def empty\n # On itère dans la matrice comme en C de 0 à Nb colonne -1 (Faut faire gaffe au -1)\n\t\t0.upto(@rows-1) do |row|\n\t\t\t0.upto(@cols-1) do |col|\n\t\t\t\t@map[row][col] = Case.create(0)\n\t\t\tend\n\t\tend\n return nil\n\tend",
"def create_matrix\n @long.times do |long|\n @matriz.push([])\n @width.times do |_width|\n @matriz[long].push([' . ', ' * '].sample)\n end\n end\n kill_cells_in_borders\n end",
"def *(mat)\n if (@mCol == mat.nFil)\n result = Array.new\n (@nFil).times do |i|\n result[i] = Array.new\n (mat.mCol).times do |j|\n\t if(@matriz[i][j].class==Fraccion)\n result[i][j] = Fraccion.new(0,1)\n\t else\n\t result[i][j] = 0\n\t end\n end\n end\n\n aux = Matriz.new(result)\n\n (@nFil).times do |i|\n (mat.mCol).times do |j|\n (@mCol).times do |z|\n aux.matriz[i][j] += @matriz[i][z] * mat.matriz[z][j]\n end\n end\n end\n else\n aux = 0\n end\n aux\n end",
"def matrix_addition_reloaded(*matrix) # collapses args into one array - extra outer [] shell \n if matrix_counter(matrix) == false\n return nil\n end\n\n if matrix.length == 1\n return matrix[0]\n end\n\n \n (1...matrix.length).each do |number|\n matrix[0] = matrix_addition(matrix[0], matrix[number])\n end\n\n matrix[0]\nend",
"def matrix\n 10.times do |round|\n @score_table.push([])\n rolls\n if round == 9 && @suma == 10\n if @suma == 10\n @roll_three = rand(0..10)\n @score += @roll_three\n llenado(4, round)\n end\n else\n llenado(3, round)\n end\n end\n bonus = Score.new(@score_table)\n bonus.bonus\n end",
"def -(mat)\n end",
"def render_matrix\n Matrix.rows render_rows\n end",
"def reset_mat\n for i in 1..(n-2)\n for j in 1..(m-2)\n if i % 2 == 1 and j % 2 == 0\n maze_mat[i][j] = 0\n elsif i % 2 == 0 and j % 2 == 1\n maze_mat[i][j] = 0\n end\n end\n end\n end",
"def clearcolumns\r\n\t\t\t@matrix = []\r\n\t\t\t@matrix[0] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[1] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[2] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[3] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[4] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[5] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\tend",
"def zero_matrix(matrix)\n\nend",
"def set_matriz\n @matriz = Matriz.find(params[:id])\n end",
"def matrix_addition_reloaded(*matrices)\n\nend",
"def turno!\r\n\t\t#CICLO PARA PASAR POR EL ARREGLO HASTA ENCONTRAR LAS CELDAS VIVAS O LAS CELULAS MUERTAS QUE CUMPLEN CON LA REGLA 4\r\n\t\tfor f in 0..@y1-1\r\n\t\t\tfor c in 0..@x1-1\r\n\r\n\t\t\t\tif @matriz[f][c] == true\r\n\t\t\t\t\tVecinos(@matriz,f,c) #checo cuantos vecinos tengo alrededor\r\n\t\t\t\t\tReglas(@matriz,@matrizTMP,@cuantos,f,c)#verifico si cumple alguna regla de conway\r\n\r\n\t\t\t\t\t\t\r\n\t\t\t\telse # de lo contrario la celda esta en false y debo comprobar la regla 4\r\n\t\t\t\t\t\r\n\t\t\t\t\tVecinos(@matriz,f,c) #regreso cuantos vecinos tiene vivos\r\n\t\t\t\t\t#REGLA 4. Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.\r\n\t\t\t\t\tif @cuantos == 3\r\n\t\t\t\t\t\t@matrizTMP[f][c] = true\r\n\t\t\t\t\tend\r\n\t\t\t\tend #cierra if\r\n\t\t\tend #cierra ciclo for\r\n\t\tend #cierra ciclo for \r\n\r\n\t\t#ACTUALIZO LA MATRIZ CON LA TEMPORAL QUE ES COMO DEBE QUEDAR AHORA EL JUEGO\r\n\t\tfor f in 0..@y1-1\r\n\t\t\tfor c in 0..@x1-1\r\n\t\t \t\t@matriz[f][c]=@matrizTMP[f][c]\r\n\t\t\tend\r\n\t\tend\r\n\r\n\tend",
"def clear(row, col)\n if !@field[row][col].contains_mine?\n @field[row][col].reveal!\n if row == 0 && col == 0\n if !@field[row][col + 1].contains_mine? && !@field[row + 1][col].contains_mine? && !@field[row + 1][col + 1].contains_mine?\n @field[row][col + 1].reveal!\n @field[row + 1][col].reveal!\n @field[row + 1][col + 1].reveal!\n end\n elsif row == 0 && col == @column_count - 1\n if !@field[row][col - 1].contains_mine? && !@field[row + 1][col - 1].contains_mine? && !@field[row + 1][col].contains_mine? &&\n @field[row][col - 1].reveal!\n @field[row + 1][col - 1].reveal!\n @field[row + 1][col].reveal!\n end\n elsif row == @row_count - 1 && col == 0\n if !@field[row][col + 1].contains_mine? && !@field[row - 1][col + 1].contains_mine? && !@field[row - 1][col].contains_mine? &&\n @field[row][col + 1].reveal!\n @field[row - 1][col + 1].reveal!\n @field[row - 1][col].reveal!\n end\n elsif row == @row_count - 1 && col == @column_count - 1\n if !@field[row][col - 1].contains_mine? && !@field[row - 1][col - 1].contains_mine? && !@field[row - 1][col].contains_mine? &&\n @field[row][col - 1].reveal!\n @field[row - 1][col - 1].reveal!\n @field[row - 1][col].reveal!\n end\n elsif row == 0\n if !@field[row][col - 1].contains_mine? && !@field[row][col + 1].contains_mine? && !@field[row + 1][col - 1].contains_mine? && !@field[row + 1][col].contains_mine? && !@field[row + 1][col + 1].contains_mine? &&\n @field[row][col - 1].reveal!\n @field[row][col + 1].reveal!\n @field[row + 1][col - 1].reveal!\n @field[row + 1][col].reveal!\n @field[row + 1][col + 1].reveal!\n end\n elsif col == 0\n if !@field[row - 1][col].contains_mine? && !@field[row - 1][col + 1].contains_mine? && !@field[row][col + 1].contains_mine? && !@field[row - 1][col].contains_mine? && !@field[row - 1][col + 1].contains_mine? &&\n @field[row - 1][col].reveal!\n @field[row - 1][col + 1].reveal!\n @field[row][col + 1].reveal!\n @field[row - 1][col].reveal!\n @field[row - 1][col + 1].reveal!\n end\n elsif row == @row_count - 1\n if !@field[row][col - 1].contains_mine? && !@field[row][col + 1].contains_mine? && !@field[row - 1][col - 1].contains_mine? && !@field[row - 1][col].contains_mine? && !@field[row - 1][col + 1].contains_mine? &&\n @field[row][col - 1].reveal!\n @field[row][col + 1].reveal!\n @field[row - 1][col - 1].reveal!\n @field[row - 1][col].reveal!\n @field[row - 1][col + 1].reveal!\n end\n elsif col == @column_count - 1\n if !@field[row - 1][col].contains_mine? && !@field[row - 1][col - 1].contains_mine? && !@field[row][col - 1].contains_mine? && !@field[row - 1][col].contains_mine? && !@field[row - 1][col - 1].contains_mine? &&\n @field[row - 1][col].reveal!\n @field[row - 1][col - 1].reveal!\n @field[row][col - 1].reveal!\n @field[row - 1][col].reveal!\n @field[row - 1][col - 1].reveal!\n end\n elsif row > 0 && row < @row_count && col > 0 && col < @column_count\n adjacent_cells(row, col).each do |cell|\n if !cell.contains_mine?\n cell.reveal!\n end\n end\n end\n else @field[row][col].reveal!\n end\n end",
"def move_to_next_generation\n @x.times{ |r|\n @y.times{|c| \n @mat[r][c].step_generation\n }\n } \n end",
"def clone\n Matrix.rows(@rows)\n end",
"def clear_image\n tmp = [];\n @rows.times do |row|\n @cols.times do |col|\n tmp << @default_color\n end\n end\n @matrix = tmp.each_slice(@cols).to_a\n #display_image\n end",
"def displayemptyframe\r\n\t\t\t@matrix = []\r\n\t\t\t@matrix[0] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[1] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[2] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[3] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[4] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\t@matrix[5] = [\"_\", \"_\", \"_\", \"_\", \"_\", \"_\", \"_\"]\r\n\t\t\ttitle = \" 1 2 3 4 5 6 7 \"\r\n\t\t\trowdivider = \"+-+-+-+-+-+-+-+\"\r\n\t\t\trowempty = \"|_|_|_|_|_|_|_|\"\r\n\t\t\t@output.puts(\"#{title}\")\r\n\t\t\t@output.puts(\"#{rowdivider}\")\r\n\t\t\t\r\n\t\t\tfor i in 1..6\r\n\t\t\t\t@output.puts(\"#{rowempty}\")\r\n\t\t\tend\r\n\t\tend",
"def *(mat)\n if (@mCol == mat.nFil)\n result = Array.new\n for i in 0...@nFil do\n result[i] = Array.new\n for j in 0...mat.mCol do\n if (mat.matriz[0][0].class == Fraccion)\n result[i][j] = Fraccion.new(0, 1)\n else\n result[i][j] = 0\n end\n end\n end\n\n aux = MatrizDensa.new(result)\n\n for i in 0...@nFil do\n for j in 0...mat.mCol do\n for z in 0...@mCol do\n aux.matriz[i][j] += @matriz[i][z] * mat.matriz[z][j]\n end\n end\n end\n else\n aux = 0\n end\n aux\n end",
"def [](index)\n\n @rowSize = (index >= @rowSize) ? index + 1 : @rowSize\n @matrix[index] = [] if (@matrix[index] == nil)\n @matrix[index]\n\n end",
"def set_matriz\n @matriz = Matriz.find(params[:matriz_id])\n end",
"def populate1(matrix)\n\t(0..5).each do |x|\n\t\t(0..5).each do |y|\n\t\t\tmatrix[x][y] = (@cols[y] & @rows[x]).sample\n\t\t\t@cols[y].delete(matrix[x][y])\n\t\t\t@rows[x].delete(matrix[x][y])\n\t\tend\n\tend\n\n# \tp z = matrix.flatten\n# \tif z.include?(nil)!=true\n# \t\treturn matrix\n# \telse\n# \t\tp \"has nil(s)\"\n# \tend\nend",
"def PrimeraRonda(matriz,numAleatorios)\t\r\n\t\tfor x1 in 0..numAleatorios\r\n\t\t\t\t@tablero[Random.rand(fila-1)][Random.rand(col-1)]= true\r\n\t\tend\r\n\tend",
"def print_matrix\n @matrix.each do |m|\n print \"#{m}\\n\"\n end\n end",
"def printmatrices\n count = 0;\n @matrices.each do |matrix|\n puts \"Matrix \" + count.to_s\n count += 1\n for i in 0..3\n for o in 0..3\n print matrix[i][o]\n print \" \"\n end\n print \"\\n\"\n end\n print \"\\n\"\n end\nend",
"def initialize( valor_entrada) \n @filas = valor_entrada.length\n\t@columnas = valor_entrada[0].length\n \t@matriz = Array.new(filas){Array.new(columnas)}\n\n \t@filas.times{ |i|\n \t\t@columnas.times{ |j|\n \t\t@matriz[i][j] = valor_entrada[i][j]\n \t\t}\n \t}\nend",
"def createMatrix()\n #matriks = Matrix.new\n @matriks_data = Matrix.zero(@jumlah_node)\n for i in 0..@jumlah_node-1\n for j in 0..@jumlah_node-1\n @matriks_data[i,j] = @file_data[i*@jumlah_node+ j]\n end\n end\n end",
"def *(mat)\n if (@c == mat.f)\n result = Array.new\n for i in 0...@f do\n result[i] = Array.new\n for j in 0...@c do\n result[i][j] = 0\n end\n end\n aux = Densa.new(result)\n nElementos = 0\n for i in 0...@f do\n for j in 0...mat.c do\n for z in 0...@c do\n if ((!@matriz[i].nil?) && (!@matriz[i][z].nil?) && (!mat.matriz[z].nil?) && (!mat.matriz[z][j].nil?))\n aux.matriz[i][j] += @matriz[i][z] * mat.matriz[z][j]\n nElementos += 1\n end\n end\n end\n end\n if ((@f * @c) * 0.4 > nElementos)\n aux = to_dispersa(aux)\n end\n else\n aux = \"No se pueden multiplicar\"\n end\n aux\n end",
"def Reglas(matriz,matrizTMP,cantVecinos,y,x)\r\n\t\t@matriz=matriz\r\n\t\t@cantVecinos=cantVecinos\r\n\t\t@x=x\r\n\t\t@y=y\r\n\t\t@matrizTMP=matrizTMP #matriz temporal de como quedara la siguiente ronda\r\n\r\n\r\n\t\t#REGLA 1. Any live cell with fewer than two live neighbours dies, as if caused by under-population.\r\n\r\n\t\tif @cantVecinos < 2\r\n\t\t\t#puts \"REGLA 1\"\r\n\t\t\t@matrizTMP[y][x]=false\r\n\r\n\t\t#REGLA 2. Any live cell with two or three live neighbours lives on to the next generation.\r\n\r\n\t\telsif @cantVecinos ==2 || @cantVecinos == 3\r\n\t\t\t#puts \"REGLA 2\"\r\n\t\t \t@matrizTMP[y][x]=true\r\n\r\n\t\t#Regla 3. Any live cell with more than three live neighbours dies, as if by overcrowding.\r\n\r\n\t\telsif @cantVecinos > 3\r\n\t\t\t#puts \"REGLA 3\"\r\n\t\t \t@matrizTMP[y][x]=false\r\n\t\tend\r\n\t\t\r\n\tend",
"def generate_submatrices\n @hilbert_basis.find.to_a.combination(VERTICES).collect{ \n |x|Matrix.rows(x)}\n end",
"def matricula\n end",
"def redesign()\n\t\tr_maze= maze {|r,c| r_maze[r][c].to_i}\n\t\t(1..row-2).each {|r| (1..col-2).each {|c| r_maze[r][c] = Random.rand(2).to_s}}\n\t\treturn r_maze\n\tend",
"def -(other)\r\n\t\t\r\n\t\t#if ((other.class.to_s == \"Dispersa\") && (other.fil == @fil) && (other.col == @col))\r\n\t\t\t\r\n\t\t\tmatrizResta = Array.new(@fil) {Array.new(@col) {0}}\r\n\t\t\t\r\n\t\t\ti = 0\r\n\t\t\t\r\n\t\t\t(other.numElementos - 1).times {\r\n\t\t\t\t\r\n\t\t\t\tmatrizResta[other.filM[i]][other.colM[i]] = 0 - other.eleM[i]\r\n\t\t\t\t\r\n\t\t\t\ti += 1\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t\r\n\t\t\ti = 0\r\n\t\t\t\r\n\t\t\t(@numElementos - 1).times {\r\n\t\t\t\t\r\n\t\t\t\tmatrizResta[@filM[i]][@colM[i]] += @eleM[i] \r\n\t\t\t\t\r\n\t\t\t\ti += 1\r\n\t\t\t}\r\n\t\t\t\t\r\n\t\t\t#puts \"resta = #{matrizResta}\"\r\n\t\t\treturn matrizResta\r\n\t\t\t\r\n\t\t#else\r\n\t\t\t#raise ArgumentError, \"Matrices de distinto tamanio\"\r\n\t\t#end\r\n\tend",
"def lcs\n setup\n compute_matrix\n @matrix.last.last\n end",
"def x(escalar)\n maux=Array.new(@nFil) { Array.new(@mCol) }\n \n (@nFil).times do |i|\n (@mCol).times do |j|\n maux[i][j] = @matriz[i][j]\n end\n end\n \n aux = Matriz.new(maux)\n for i in 0...@nFil do\n for j in 0...@mCol do\n aux.matriz[i][j] = @matriz[i][j] * escalar\n end\n end\n aux\n end",
"def execute(m,row,col)\n for i in 0..m.size-1\n aux = m[i][col] \n if aux != 0\n for j in 1..m[0].size-1\n if i != row \n m[i][j] -= (aux * m[row][j]).to_f\n m[i][j] = 0 if m[i][j] > -0.001 && m[i][j] < 0.001\n end \n end\n if i != row \n print \"L#{i} = L#{i}-#{aux<0 ? '('+aux.to_s+')': aux}L#{row} \\n\".italic.blue\n #print_matrix(m,row,col, i)\n end \n end\n end\n m\nend",
"def [](i,j) \n @matriz[i][j]\nend",
"def -(other)\n\t if (other.is_a? Matriz_Dispersa)\n\t\tif(@alt==other.alt && @anc=other.anc)\n\t\t\tresta=Matriz_Dispersa.new(@alt+1,@anc+1, [],[],[], (@n_elem+other.n_elem))\n\t\t\tm = 0\n\t\t\t(0..resta.n_elem-1).map do |i|\n\t\t\t if(other.elem[i].is_a? Fixnum)\n\t\t\t resta.elem[i]=0\n\t\t\t end\n\t\t\t if(other.elem[i].is_a? Fraccion)\n\t\t\t resta.elem[i]=Fraccion.new(0,1)\n\t\t\t end\n\t\t\tend\n\t\t\t(0..@alt).map do |i|\n\t\t\t (0..@anc).map do |j|\n\t\t\t (0..@n_elem-1).map do |h|\n\t\t\t if(i==@alto[h])\n\t\t\t\t(0..@n_elem-1).map do |t|\n\t\t\t\t if(j == @alto[t] && h==t)\n\t\t\t\t resta.elem[m]=@elem[t]\n\t\t\t\t resta.alto[m]=@alto[t]\n\t\t\t\t resta.ancho[m]=@ancho[t]\n\t\t\t\t m = m+1\n\t\t\t\t end\n\t\t\t\tend\n\t\t\t end\n\t\t\t end\n\t\t\t (0..other.n_elem-1).map do |l|\n\t\t\t\tif(i==other.alto[l])\n\t\t\t\t (0..other.n_elem-1).map do |t|\n\t\t\t\t if(j==other.alto[t] && l==t)\n\t\t\t\t resta.elem[m]=(resta.elem[m]-other.elem[t])\n\t\t\t\t resta.alto[m]=other.alto[t]\n\t\t\t\t resta.ancho[m]=other.ancho[t]\n\t\t\t\t m = m+1\n\t\t\t\t end\n\t\t\t\t end\n\t\t\t\tend\n\t\t\t end\n\t\t\t end\n\t\t\tend\n\t\t\tresta\n\t\telse\n\t\t puts \"no se puede realizar la resta\"\n\t\tend\n\t else\n\t if(other.is_a? Matriz_Densa)\n\t if(@alt==other.alt && @anc=other.anc)\n\t\tself.to_densa.-(other)\n\t else\n\t\tputs \"no se puede realizar la resta\"\n\t end\n\t end\n\t end\n\tend",
"def +(mat)\n if (mat.nFil == @nFil && mat.mCol == @mCol)\n maux=Array.new(@nFil) { Array.new(@mCol) }\n \n (@nFil).times do |i|\n (@mCol).times do |j|\n maux[i][j] = @matriz[i][j]\n end\n end\n \n aux = Matriz.new(maux)\n (@nFil).times do |i|\n (@mCol).times do |j|\n aux.matriz[i][j] = @matriz[i][j] + mat.matriz[i][j]\n end\n end\n else\n aux = 0\n end\n aux\n end",
"def print_matrix(m, row = nil, col = nil, rbold = nil)\n print \"\\n\"\n for i in 0..m.size-1\n print \"|\\t\"\n for j in 0..m[i].size-1\n n = m[i][j]\n if n.is_a? Numeric\n n = n.round(2)\n #n = n.to_r.rationalize(Rational('0.005')) #printar em fração\n #n = n.numerator if n.denominator == 1\n\n if row==i&&col==j\n print n.to_s.reverse_color\n elsif rbold == i\n print n.to_s.bold.bg_blue\n else\n print n\n end\n else\n print n\n end\n print \"\\t\" \n end\n puts \"|\"\n end\n print \"\\n\"\nend",
"def print_matrix(matrix)\n matrix.each do |row|\n p row\n end\nend",
"def paintMatrix(a)\n\t\n\tputs \" | 1 | 2 | 3 | 4 | 5 | 6\".green\n\tputs \"\"\n\tfor i in 0..5\n\t\tif ( i != 0 )\n\t\tputs \" \"\n\t\tend\n\t\tfor j in 0..5\n\t\t\t\tprint \" | \".blue\n\t\t\t\tprint \"#{a[i][j]}\"\n\t\tend\n\t\tputs \"\"\n\tend\n\tputs\"\"\n\tend",
"def index\n @matrizs = Matriz.all\n end",
"def -(other)\t \n\t\tif(self.fil == other.fil and self.col == other.col)\n\t\t\t# SELF Matrices densas\n\t\t\tif self.instance_of?MatrizDensa\n\t\t\t\ttemp = MatrizDensa.new(self.fil, self.col, nil)\n\t\t\t\tif other.instance_of?MatrizDensa\t\t\n\t\t\t\t\t#for i in (0...@fil.to_i)\n\t\t\t\t\t@fil.to_i.times do |i| \n\t\t\t\t\t\n\t\t\t\t\t\t#for j in (0...@col.to_i)\n\t\t\t\t\t\t@col.to_i.times do |j| \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\ttemp.mat[i][j] = (self.mat[i][j]) - (other.mat[i][j])\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\tif other.instance_of?MatrizDispersa\n\t\t\t\t\t#for i in (0...@fil.to_i)\n\t\t\t\t\t@fil.to_i.times do |i| \n\t\t\t\t\t\n\t\t\t\t\t\t#for j in (0...@col.to_i)\n\t\t\t\t\t\t@col.to_i.times do |j| \n\t\t\t\t\t\n\t\t\t\t\t\t\tencontrado = 0\n\t\t\t\t\t\t\t#for k in (0...other.posx.size)\n\t\t\t\t\t\t\tother.posx.size.times do |k| \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif (i==other.posx[k] and j==other.posy[k] and encontrado==0)\n\t\t\t\t\t\t\t\t\ttemp.mat[i][j] = (self.mat[i][j]) - (other.valor[k])\n\t\t\t\t\t\t\t\t\tencontrado = 1\t\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tif (encontrado == 0)\n\t\t\t\t\t\t\t\ttemp.mat[i][j] = self.mat[i][j]\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# SELF Matriz Dispersa\n\t\t\tif self.instance_of?MatrizDispersa\n\t\t\t\tif other.instance_of?MatrizDensa\n\t\t\t\t\ttemp = MatrizDensa.new(self.fil, self.col, nil)\n\t\t\t\t\t#for i in (0...@fil.to_i)\n\t\t\t\t\t@fil.to_i.times do |i| \n\t\t\t\t\t\n\t\t\t\t\t\t#for j in (0...@col.to_i)\n\t\t\t\t\t\t@col.to_i.times do |j| \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tencontrado = 0\n\t\t\t\t\t\t\t#for k in (0...self.posx.size.to_i)\n\t\t\t\t\t\t\tself.posx.size.times do |k| \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif (i==self.posx[k] and j==self.posy[k] and encontrado==0)\n\t\t\t\t\t\t\t\t\ttemp.mat[i][j] = (other.mat[i][j]) - (self.valor[k])\n\t\t\t\t\t\t\t\t\tencontrado = 1\t\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tif (encontrado == 0)\n\t\t\t\t\t\t\t\ttemp.mat[i][j] = other.mat[i][j]\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\n\n\t\t\t\tif other.instance_of?MatrizDispersa\n\t\t\t\t\ttemp = MatrizDispersa.new(self.fil,self.col,[],[],[])\n\t\t\t\t\ttemp.valor = self.valor\n\t\t\t\t\ttemp.posx = self.posx\n\t\t\t\t\ttemp.posy = self.posy\n\n\t\t\t\t\t#for j in (0...other.posx.size.to_i)\n\t\t\t\t\tother.posx.size.times do |j| \n\t\t\t\t\t\t\t\n\t\t\t\t\t\tencontrado = false\n\t\t\t\t\t\t#for k in (0...self.posx.size.to_i)\n\t\t\t\t\t\tself.posx.size.times do |k| \n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif(other.posx[j] == temp.posx[k] and other.posy[j] == temp.posy[k])\n\t\t\t\t\t\t\t\ttemp.valor[k] = temp.valor[k] - other.valor[j]\n\t\t\t\t\t\t\t\tencontrado = true\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif (encontrado == false)\n\t\t\t\t\t\t\ttemp.posx << other.posx[j]\n\t\t\t\t\t\t\ttemp.posy << other.posy[j]\n\t\t\t\t\t\t\ttemp.valor << other.valor[j]\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\n\t\t\treturn temp\n\t\telse \n\t\t\treturn nil\n\t\tend\n\tend",
"def RotateMatrix (squareImg)\n r = squareImg.size - 1\n c = squareImg[0].size - 1\n\n (0..r/2).each do |row|\n (0..c/2).each do |col|\n\nsquareImg[row][col], squareImg[r - row][col], squareImg[r-row][c-col], squareImg[row][c-col] = squareImg[r - row][col], squareImg[r-row][c-col], squareImg[row][c-col], squareImg[row][col]\n\n\n end\n end\nsquareImg\nend",
"def matz; end",
"def set_matrix\n @matrix = Matrix.find(params[:id])\n end",
"def matrix_helper(matrix, row, column)\n if matrix[row].nil? # QUESTION: Recurses one extra time? Better to stop early?\n return matrix\n elsif matrix[row][column] == 0\n go_to_next_cell(matrix, row, column)\n set_zeros_in_columns(matrix, row)\n set_zeros_in_rows(matrix, column)\n return matrix\n else # value in current cell is 1\n go_to_next_cell(matrix, row, column)\n end\nend",
"def matrix_addition_reloaded(*matrices)\n size = matrices.first.size\n return if matrices.any? { |m| m.size != size }\n\n new_matrix = matrices[0].dup\n matrices[1..-1].each do |mat2|\n new_matrix = matrix_addition(new_matrix, mat2)\n end\n new_matrix\nend",
"def test_creac\n #Matriz densa\n assert_equal(@m1.rows, 2)\n assert_equal(@m1.cols, 2)\n \n #Matriz dispersa\n assert_equal(@m4.rows, 2)\n assert_equal(@m4.cols, 2)\n \n #Creacion\n assert_equal(Matriz.vector(2,2,[1,1,1,1]).to_s,@m2.to_s)\n assert_equal(Matriz.nula.to_s,@m3.to_s)\n end",
"def clear\n raise ArgumentError.new(\"There is no image\") if self.data == []\n @data = Matrix.build(self.data.row_count, self.data.column_count) {\"O\"}\n end",
"def matrix_convert_to_0(matrix)\n (matrix.length).times do |i| #number of rows times do runs 3 times\n (matrix[i].length).times do |j| #number of columns this runs 4 times\n if matrix[i][j] == 0 #if something in this row/column is 0\n row = i\n column = j #select the column\n (matrix[row].length).times do |j| #change the whole row to 0\n matrix[row][j] = 0\n end\n (matrix.length).times do |i|\n matrix[i][column] = 0\n end\n end\n end\n end\n return matrix\nend",
"def print_matrix(m)\n (0...m.length).each do |i|\n step = 0\n (0..i).each do |_j|\n print \"#{m[i - step][step]} \"\n step += 1\n end\n puts ''\n end\nend",
"def set_matrix\n @matrix = Matrix.find(params[:id])\n end",
"def refresh\n d = @data.dup.map{ |row| row.split(\"\") }\n @num_rotations.times { d = d.transpose.map(&:reverse) }\n d.map(&:reverse!) if @flipped\n d.map(&:join)\n end",
"def sets\n rows = @board.each_slice(9).to_a # rows\n cols = rows.transpose\n (rows + cols + boxes).each do |set|\n set.delete(\"0\")\n end\n end",
"def -(mat)\n if (mat.nFil == @nFil && mat.mCol == @mCol)\n aux = MatrizDensa.new(@matriz)\n for i in 0...@nFil do\n for j in 0...@mCol do\n aux.matriz[i][j] = @matriz[i][j] - mat.matriz[i][j]\n end\n end\n else\n aux = 0\n end\n aux\n end",
"def load(arg)\n index = 0\n @mat.each do | _ ,row|\n (0..row.length-1).each do |i|\n row[i] = arg[index]\n index += 1\n end\n end\n end",
"def expansionclave(iteracion)\n t_mclave=@m_clave\n aux=Array.new(4){Array.new(4)}\n #operacion del rotword (rotando la ultima columna de la matriz de las claves)\n aux[0][3],aux[1][3],aux[2][3],aux[3][3]=t_mclave[1][3],t_mclave[2][3],t_mclave[3][3],t_mclave[0][3]\n\n #relleno la matriz completa con los demas elementos de la matrz de la clave\n for i in 0...4\n for j in 0...3\n aux[i][j]=t_mclave[i][j]\n end\n end\n #se busca en la sbox los valores de la matriz\n aux[0][3],aux[1][3],aux[2][3],aux[3][3]=get_sbox(aux[0][3].to_i(16)).to_s(16).rjust(2,'0'),get_sbox(aux[1][3].to_i(16)).to_s(16).rjust(2,'0'),get_sbox(aux[2][3].to_i(16)).to_s(16).rjust(2,'0'),get_sbox(aux[3][3].to_i(16)).to_s(16).rjust(2,'0')\n #se realiza la operación de principal de la epansion de claves\n aux[0][0]=(@m_clave[0][0].to_i(16)^aux[0][3].to_i(16)^Rcon[0][iteracion]).to_s(16).rjust(2,'0')\n aux[1][0]=(@m_clave[1][0].to_i(16)^aux[1][3].to_i(16)^Rcon[1][iteracion]).to_s(16).rjust(2,'0')\n aux[2][0]=(@m_clave[2][0].to_i(16)^aux[2][3].to_i(16)^Rcon[2][iteracion]).to_s(16).rjust(2,'0')\n aux[3][0]=(@m_clave[3][0].to_i(16)^aux[3][3].to_i(16)^Rcon[3][iteracion]).to_s(16).rjust(2,'0')\n for i in 0...4\n for j in 1...4\n aux[i][j]=(@m_clave[i][j].to_i(16)^aux[i][j-1].to_i(16)).to_s(16).rjust(2,'0')\n end\n end\n\n @m_clave=aux\n end",
"def matrix_addition_reloaded(*matrices)\n return nil if matrices.any? {|matrix| matrices[0].length != matrix.length}\n\n new_matrix = Array.new(matrices.first.length) {Array.new(matrices.first.first.length, 0)}\n\n matrices.each_with_index do |matrix, mi|\n matrix.each_with_index do |array, ai|\n array.each_with_index do |el, eli|\n new_matrix[ai][eli] += el\n end\n end\n end\n new_matrix\nend",
"def rotate_matrix(arr)\n\nend",
"def *(mat)\n end",
"def probar_matriz_dev\n mi_matriz = generar_matriz(10)\n system(\"clear\")\n sigue=true\n while (sigue) do\n puts \"contador de barcos = #{contar_barcos(mi_matriz)}\"\n puts \"dame la columna: del 1 al 10 \"\n columna = gets.chomp.to_i\n puts \"dame la fila en letras de la a..j: \"\n fila=gets.chomp\n\n array_coordenadas = determinar_coordenadas_dev(fila, columna)\n poner_algo_en_matriz(mi_matriz,array_coordenadas[0], array_coordenadas[1], 1)\n mostrar_matriz_dev(mi_matriz)\n puts \"dime si sigo en minusculas s o n:\"\n sigue_= gets.chomp\n\n\n if sigue_ == 'n'\n sigue= false\n end\n end\nend",
"def initialize_matrix!\n @matrix = config.map do |_hand, minimum_position|\n minimum_position\n end.each_slice(13).to_a\n end",
"def *(other)\n\t\t\telemento = Array.new(0)\n\t\t\tfor i in 0...filas\n\t\t\t\tfila = Array.new(0)\n\t\t\t\tfor j in 0...colum\n\t\t\t\t\tfila << pos[i][j]*other\n\t\t\t\tend\n\t\t\t\telemento << fila\n\t\t\tend\n\t\t\tMatriz.new(@nfil, @ncol, elemento)\n\t\tend",
"def -(other)\n\t\t\tif ((@nfil != other.nfil) || (@ncol != other.ncol))\n\t\t\t\tputs \"No se pueden restar las matrices\"\n\t\t\telse\n\t\t\t\telemento = Array.new(0)\n\t\t\t\tfor i in 0...filas\n\t\t\t\t\tfila = Array.new(0)\n\t\t\t\t\tfor j in 0...colum\n\t\t\t\t\t\tfila << pos[i][j] - other.pos[i][j]\n\t\t\t\t\tend\n\t\t\t\t\telemento << fila\n\t\t\t\tend\n\t\t\tend\n\t\t\tMatriz.new(@nfil, @ncol, elemento)\n\t\tend",
"def *(other)\n\t\telemento = Array.new(0)\n\t\tfor i in 0...filas do\n\t\t\tfila = Array.new(0)\n\t\t\tfor j in 0...colum do\n\t\t\t\tfila << pos[i][j]*other\n\t\t\tend\n\t\t\telemento << fila\n\t\tend\n\t\tMatriz.new(@nfil, @ncol, elemento)\n\tend",
"def matrix_addition_reloaded(*matrices)\n return matrices[0] if matrices.length == 1\n \n sum_mat = nil\n\n # debugger\n\n (0...matrices.length-1).each do |n|\n temp = nil\n if sum_mat.nil?\n temp = matrices[n]\n else\n temp = sum_mat\n end\n if check_rowcol?(temp, matrices[n+1])\n neigbhor_sum = matrix_addition(temp, matrices[n+1])\n sum_mat = neigbhor_sum\n else\n return nil\n end\n end\n\n return sum_mat\nend",
"def rotate!\n @grid = @grid.transpose.map{|c| c.reverse}\n end",
"def -(other)\n raise ArgumentError, \"Las matrices no son cuadradas.\" unless @nfil == other.nfil && @ncol == other.ncol\n m = Array.new(@nfil){Array.new(@ncol){0}}\n for i in 0...nfil \n for j in 0...ncol\n\t m[i][j] = mat[i][j]- other.mat[i][j]\n end\n end\n return Matriz.new(other.nfil,other.ncol,m) \n end",
"def matrix_addition_reloaded(*matrices)\n\n length = matrices.first.length\n if (matrices.all? { |ele| ele.length == length})\n else\n return nil\n end\n\n matrices.inject do |acc, ele|\n # p acc\n i = 0\n sum_matrix = []\n while i < acc.length\n row_arr = []\n j = 0\n while j < acc.first.length\n # print acc[i][j]\n sum = acc[i][j]+ele[i][j]\n row_arr << sum\n j+= 1\n end\n sum_matrix << row_arr\n i += 1\n end\n sum_matrix\n end\nend",
"def matrix_addition_reloaded(*matrices)\n height = matrices[0].size\n width = matrices[0][0].size\n return nil if matrices.select {|m| m.size == height && m[0].size == width}.count != matrices.count\n \n sum = Array.new(height) {|i| Array.new(width, 0)}\n\n (0...height).each do |h|\n (0...width).each do |w|\n matrices.each {|m| sum[h][w] += m[h][w]}\n end\n end\n sum\nend",
"def matrix_addition_reloaded(*matrixs)\n # matrixs.each { |matrix| return nil if matrixs.first.length != matrix.length}\n # first_matrix = matrixs.first\n # matrix_sum = []\n # i = 0\n\n # while matrix_sum.length < first_matrix.length do \n # sum = 0 \n # sum += matrixs[i][i][i]\n # matrix_sum << sum\n\n # end\n # matrix_sum\n\n matrix = matrixs.first\n height = matrix.length\n width = matrix[0].length\n matrix_sum = Array.new(height) { [0] * width}\n\n matrixs.inject(matrix_sum) do |m1, m2|\n return nil if m2.length != height || m2[0].length != width\n matrix_addition(m1, m2)\n\n end\nend",
"def display\n print \"\\n\"\n @x.times{ |r|\n @y.times{|c| \n print @mat[r][c].is_alive ? \"X \" : \"- \"\n }\n print \"\\n\"\n }\n end",
"def matrix_addition_reloaded(*matrices)\n matrix = matrices.first\n height = matrix.length\n width = matrix[0].length\n\n empty_matrix = Array.new(height) { [0] * width }\n matrices.inject(empty_matrix) do |m1, m2|\n return nil if m2.length != height or m2[0].length != width\n matrix_addition(m1, m2)\n end\nend",
"def subMatrix(rows,cols)\n newDelegate = @delegate.clone\n newDelegate.subMatrix(rows,cols)\n newMatrix = SparseMatrix.new(newDelegate)\n return newMatrix\n end",
"def matrix_addition_reloaded(*matrices)\n matrix = matrices.first\n height = matrix.length\n width = matrix[0].length\n\n empty_matrix = Array.new(height) { [0] * width }\n matrices.inject(empty_matrix) do |m1, m2|\n return nil if m2.length != height or m2[0].length != width\n matrix_addition(m1, m2)\n end\nend",
"def matrix_convert_to_0(matrix)\n zero_locations = location_of_zeros(matrix)\n\n coordinates = 0\n while coordinates < zero_locations.length do\n row_to_change = zero_locations[coordinates][0]\n column_to_change = zero_locations[coordinates][1]\n\n # change row here\n change_row = 0\n while change_row < matrix.length do\n matrix[row_to_change][change_row] = 0\n change_row += 1\n end\n\n # change column here\n change_column = 0\n while change_column < matrix.length do\n# puts \"Inside change column section\"\n matrix[change_column][column_to_change] = 0\n# puts \"#{matrix[change_column][column_to_change]}\"\n change_column += 1\n# puts \"Next iteration\"\n end\n\n coordinates += 1\n end\n return matrix\nend",
"def redesign\r\n\t\tm = MazeMaker.new(@n,@m)\r\n\t\t@maze = m.make_maze\r\n\tend",
"def d; Matrix.new(RAtlas.vec2diag(@storage)); end",
"def generate_matrix\n elements_qty = (@size * @size) - 1\n\n elements = *(0..(elements_qty)).map { |n| rand(A_CHAR_ASCII..Z_CHAR_ASCII).chr }\n matrix = []\n elements.each_slice(@size) { |x| matrix.push(x) }\n matrix\n end",
"def initialize(nfil,ncol,mat) \n @nfil = nfil # inicializo numero de filas\n @ncol = ncol # inicializo numero de columnas \n @mat = Array.new(mat) #inicializo la matriz pasando como parametro un objeto de tipo matriz \n end"
] |
[
"0.6669849",
"0.64438766",
"0.63313633",
"0.62931114",
"0.6205714",
"0.6169655",
"0.6119537",
"0.61051834",
"0.6076336",
"0.6004007",
"0.5978644",
"0.596345",
"0.5926436",
"0.5923426",
"0.589799",
"0.58484995",
"0.5779267",
"0.57717454",
"0.5753438",
"0.5746196",
"0.57262516",
"0.57109076",
"0.57065076",
"0.5694772",
"0.5689362",
"0.5676209",
"0.5667294",
"0.5660587",
"0.5644424",
"0.5627198",
"0.55978024",
"0.55933386",
"0.55877244",
"0.5585973",
"0.5572413",
"0.5563311",
"0.55614007",
"0.55584157",
"0.5550152",
"0.5526877",
"0.552269",
"0.5514313",
"0.5513108",
"0.54862714",
"0.5469899",
"0.54634845",
"0.5458839",
"0.54548025",
"0.5454049",
"0.5444949",
"0.5443027",
"0.543572",
"0.5433992",
"0.5433033",
"0.5428066",
"0.54104745",
"0.54088736",
"0.5407873",
"0.54030126",
"0.5401449",
"0.5392369",
"0.5389652",
"0.5386574",
"0.5373843",
"0.53527236",
"0.53427434",
"0.5338167",
"0.5336749",
"0.5328349",
"0.53260654",
"0.53257763",
"0.53049594",
"0.5299055",
"0.528322",
"0.52818215",
"0.5280644",
"0.5277712",
"0.5273831",
"0.5270898",
"0.52633",
"0.5245572",
"0.52453554",
"0.5244082",
"0.5241251",
"0.5239523",
"0.5234956",
"0.52296776",
"0.52171105",
"0.5211894",
"0.52117455",
"0.5209803",
"0.5207092",
"0.520351",
"0.5197804",
"0.51957667",
"0.5186353",
"0.5186008",
"0.51822037",
"0.51787466",
"0.5175316",
"0.51727027"
] |
0.0
|
-1
|
GET /nature_financings GET /nature_financings.json
|
def index
@nature_financings = NatureFinancing.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_nature_financing\n begin\n @nature_financing = current_institute.nature_financings.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n redirect_to nature_financings_path\n end\n end",
"def index\n @filials = Filial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @filials }\n end\n end",
"def index\n render json: @fiestas\n end",
"def show\n @foiltype = Foiltype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foiltype }\n end\n end",
"def show\n @foil = Foil.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foil }\n end\n end",
"def nature_financing_params\n params.require(:nature_financing).permit(:title, :description, :institute_id)\n end",
"def index\n @fretes = Frete.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fretes }\n end\n end",
"def ajax_fines\n @fines = params['fines']&.values.to_a\n render json: { record: render_to_string('_fines', layout: false), locals: { fines: @fines } }\n end",
"def index\n\t @fares = Fare.all\n\n\t respond_to do |format|\n\t\tformat.html # index.html.erb\n\t\tformat.json { render json: @fares }\n\t end\n\tend",
"def index\n @fiction = Fiction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fiction }\n end\n end",
"def index\n @frais_hebergements = FraisHebergement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_hebergements }\n end\n end",
"def index\n @personal_finances = PersonalFinance.all\n end",
"def index\n @familia = Familium.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @familia }\n end\n end",
"def index\n @finances = Finance.all\n end",
"def index\n @families = Family.all.paginate(page: params[:page])\n render json: @families\n end",
"def index \n fans = Fan.all \n render json: fans \n end",
"def index\n @frais_annexes = FraisAnnex.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_annexes }\n end\n end",
"def index\n @monthly_finances = MonthlyFinance.all\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @monthly_finances }\n # end\n end",
"def index\n @ftypes = Ftype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ftypes }\n end\n end",
"def index\n @financers = Financer.all\n end",
"def show\n @finding_aural = FindingAural.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @finding_aural }\n end\n end",
"def create\n @nature_financing = NatureFinancing.new(nature_financing_params)\n @nature_financing.institute = current_institute\n\n respond_to do |format|\n if @nature_financing.save\n format.html { redirect_to @nature_financing, notice: 'Nature financing was successfully created.' }\n format.json { render :show, status: :created, location: @nature_financing }\n else\n format.html { render :new }\n format.json { render json: @nature_financing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @fiction = Fiction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fiction }\n end\n end",
"def show\n @finance = Finance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @finance }\n end\n end",
"def query_for_finances\n base = \"http://www.opensecrets.org/api\"\n header = {\n \"X-API-Key\" => open_secrets_key,\n \"Accept\" => \"application/json\",\n }\n CongressMember.all.each do |cm|\n if cm.crp_id\n options = {\n :apikey => open_secrets_key,\n :output => \"json\",\n :method => \"candIndustry\",\n :cid => cm.crp_id,\n }\n if cm.donations.size < 10\n response = JSON.parse(Faraday.get(base, options, header).body)\n response[\"response\"][\"industries\"][\"industry\"].each do |ind|\n industry_name = ind[\"@attributes\"][\"industry_name\"]\n total = ind[\"@attributes\"][\"total\"]\n industry = Industry.find_or_create_by(:name => industry_name)\n Donation.create(congress_member: cm, amount: total, industry: industry)\n end\n end\n end\n end\nend",
"def show\n @filial = Filial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @filial }\n end\n end",
"def update\n respond_to do |format|\n if @nature_financing.update(nature_financing_params)\n format.html { redirect_to @nature_financing, notice: 'Nature financing was successfully updated.' }\n format.json { render :show, status: :ok, location: @nature_financing }\n else\n format.html { render :edit }\n format.json { render json: @nature_financing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @nfer = Nfer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nfer }\n end\n end",
"def index\n @nepals = Nepal.all\n\n render json: @nepals\n end",
"def show\n @finance_inflow = FinanceInflow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @finance_inflow }\n end\n end",
"def show\n @favourite_food = FavouriteFood.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @favourite_food }\n end\n end",
"def index\n if current_user\n @flats = Flat.all\n else\n @flats = Flat.where('displayed=? and approved=?', true, true).all\n end\n\n @facilities=Facility.where(\"is_building=?\", true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @flats }\n end\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def get_finding_info\n\t\tidDec = params[:idDec].to_i\n\t\tidMap = params[:idMap].to_i\n\t\thallazgo = Finding.where(\"decision_map_id = ? AND governance_decision_id = ?\", idMap, idDec).first\n\t\trespond_to do |format|\n\t\t\tformat.json {render json: hallazgo}\n \tend\n\tend",
"def show\n @family = get_family(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @life_insurances }\n end\n end",
"def get_favourite_restaurants\n @profile = Profile.find(params[:id])\n @restaurants = @profile.favourites\n\n render status: 200, json: @restaurants\n end",
"def index\n @frais_repas = FraisRepa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_repas }\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 @family_members = FamilyMember.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @family_members }\n end\n end",
"def show\n @fishing_method = FishingMethod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fishing_method }\n end\n end",
"def index\n @factores_fluctuantes = FactoresFluctuante.all\n end",
"def show\n @forest = Forest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @forest }\n end\n end",
"def index\n @foros = Foro.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foros }\n end\n end",
"def index\n @funds = Fund.all\n\n render json: @funds\n end",
"def index\n @facts = fact_type.all\n @title = fact_type\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @facts }\n end\n end",
"def get_folio_data\n netid = params['netid']\n url = ENV['OKAPI_URL']\n tenant = ENV['OKAPI_TENANT']\n account = CUL::FOLIO::Edge.patron_account(url, tenant, folio_token, { username: netid })\n # Rails.logger.debug(\"mjc12test: Got FOLIO account #{account.inspect}\")\n render json: account\n end",
"def show\n @frais_annex = FraisAnnex.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @frais_annex }\n end\n end",
"def index\n @situations = Situation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @situations }\n end\n end",
"def index\n @faculties = Faculty.all\n json_response(@faculties)\n end",
"def show\n @familium = Familium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @familium }\n end\n end",
"def new\n @foiltype = Foiltype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foiltype }\n end\n end",
"def show\n @favourite_listing = get_favourite_listing(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @favourite_listing }\n end\n end",
"def index\n @financiamentos = Financiamento.all\n end",
"def index\n @forests = Forest.all\n end",
"def show\n render json: Festival.build_for(params[:id]).to_json\n end",
"def new\n @foil = Foil.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foil }\n end\n end",
"def index\n @food_type_id = @foodTypes.first\n\n if params['type']\n @foods = Food.includes(:type).includes(:nutritional_information).where( type_id: params['type']['type_id']).paginate(page: params[:page])\n else\n @foods = Food.includes(:type).includes(:nutritional_information).where( type_id: @food_type_id).paginate(page: params[:page])\n end\n\n respond_with @foods\n end",
"def index\n @futboladas = Futbolada.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @futboladas }\n end\n end",
"def show\n @fortune = Fortune.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fortune }\n end\n end",
"def index\n type = params[:type]\n fg = params[:fg]\n @page = Page.find(2)\n @foodTypes = FoodType.all\n @type_id = type\n\n @foods = Food.find_by_sql([\"SELECT * FROM FOODS WHERE food_type_id = ?\", type])\n\n \n @foods = Food.find_by_sql(\"SELECT * FROM FOODS WHERE important = 't'\") if !params.has_key?(:type)\n \n \n if !fg.nil?\n @front_food = Food.find(fg) \n end if\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foods }\n end\n end",
"def index\n @funeral_infos = FuneralInfo.all\n end",
"def show\n @fec_filing = FecFiling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @fec_filing }\n end\n end",
"def show\n @fec_filing = FecFiling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @fec_filing }\n end\n end",
"def index\n @foafs = Foaf.all\n # if all else fails, make RDF then\n # rapper -o dot -i turtle me.ttl | dot -Tsvg -o me.svg\n respond_to do |format|\n format.html #{ render text: convert_one_to_rdf(@foaf, :html) }\n format.ttl { render text: convert_many_to_rdf(@foafs, :ttl) }\n format.rj { render text: convert_many_to_rdf(@foafs, :json) }\n format.nt { render text: convert_many_to_rdf(@foafs, :ntriples) }\n format.rdf { render text: convert_many_to_rdf(@foafs, :rdf) }\n format.jsonld { render text: convert_many_to_rdf(@foafs, :jsonld) }\n end\n end",
"def show\n @family = Family.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end",
"def show\n\t\trespond_to do |format|\n\t\t\tformat.html { }\n\t\t\tformat.json { render :json => {:fallacyfolder => @fallacyfolder}.to_json }\n\t\tend\n\tend",
"def show\r\n\r\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/#{params[:id]}/information\")\r\n\r\n http = Net::HTTP.new(url.host, url.port)\r\n http.use_ssl = true\r\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\r\n request = Net::HTTP::Get.new(url)\r\n request[\"x-rapidapi-key\"] = ENV[\"SPOONACULAR_API_KEY\"] # hidden API key\r\n request[\"x-rapidapi-host\"] = 'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com'\r\n\r\n response = http.request(request)\r\n @recipe = JSON.parse response.read_body # gets the recipe\r\n\r\n p url_ingredients = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/#{params[:id]}/ingredientWidget.json\")\r\n\r\n http_ingredients = Net::HTTP.new(url_ingredients.host, url_ingredients.port)\r\n http_ingredients.use_ssl = true\r\n http_ingredients.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\r\n request_ingredients = Net::HTTP::Get.new(url_ingredients)\r\n request_ingredients[\"x-rapidapi-key\"] = ENV[\"SPOONACULAR_API_KEY\"]\r\n request[\"x-rapidapi-host\"] = 'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com'\r\n\r\n response_ingredients = http.request(request_ingredients)\r\n # puts response_ingredients.read_body\r\n @ingredients = JSON.parse # data is a string (which looks like a hash -> convert to hash) response_ingredients.read_body\r\n p \"RECIPES\"\r\n # p @recipe\r\n p \"INGREDIENTS\"\r\n p @ingredients\r\n\r\n end",
"def index\n @factura = Factura.find(params[:factura_id])\n @renglon_facturas = @factura.renglon_facturas\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @renglon_facturas }\n end\n end",
"def show\n @frais_hebergement = FraisHebergement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @frais_hebergement }\n end\n end",
"def show\n @filial = Filial.find(params[:id])\n @instructors = @filial.instructors\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @filial }\n end\n end",
"def index\n @frances = France.all\n end",
"def show\n @inning = Inning.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inning }\n end\n end",
"def index\n @flaws = Flaw.order(\"date DESC, created_at DESC\").page( params[:page] ).per(10)\n \n @flaw = Flaw.new\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @flaws }\n end\n end",
"def new\n @finding_aural = FindingAural.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @finding_aural }\n end\n end",
"def show\n @family_crest = FamilyCrest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_crest }\n end\n end",
"def food_info(food_id)\n get(\"/foods/#{food_id}.json\")\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @funerals }\n end\n end",
"def index\n @funders = Funder.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @funders }\n end\n end",
"def show\n @financial = Financial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @financial }\n end\n end",
"def index\n @funkces = Funkce.all\n end",
"def index\n @fines = Fine.all\n end",
"def index\n @factures = Facture.all\n end",
"def index\n @factures = Facture.all\n end",
"def show\n family = current_family\n p current_family\n render json: family.as_json\n end",
"def index\n @financing = Financing.find(params['financing_id'])\n @financing_items = @financing.items\n if @financing_items.empty?\n @financing_items.push @financing.default_item\n end\n end",
"def index\n @familles = Famille.all\n end",
"def index\n @pizzas = Pizza.all\n render json: @pizzas\n end",
"def new\n @fishing_method = FishingMethod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fishing_method }\n end\n end",
"def show\n #@klass_fee = KlassFee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @klass_fee }\n end\n end",
"def show\n @holiday = Holiday.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @holiday }\n end\n end",
"def show\n @flat_happening = FlatHappening.find(params[:id])\n\n render json: @flat_happening\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @holiday }\n end\n end",
"def show\n @financial_donation = FinancialDonation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @financial_donation }\n end\n end",
"def index\n @facults = Facult.all\n end",
"def show\n @faction = Faction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @faction }\n end\n end",
"def index\n @featuring = Featuring.all\n end",
"def index\n @factions = Faction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @factions }\n end\n end",
"def show\n @fan_out = FanOut.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fan_out }\n end\n end",
"def index\n @ef_pares = EfPare.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ef_pares }\n end\n end"
] |
[
"0.66428757",
"0.62522465",
"0.6037751",
"0.6009311",
"0.5964351",
"0.5962566",
"0.59222186",
"0.5899061",
"0.58915544",
"0.58852136",
"0.58818626",
"0.58692473",
"0.58586335",
"0.584415",
"0.58214456",
"0.5809563",
"0.5794413",
"0.578763",
"0.578101",
"0.5777905",
"0.57561946",
"0.5756116",
"0.5745438",
"0.5731968",
"0.5729497",
"0.57279176",
"0.5701408",
"0.56974393",
"0.56715375",
"0.56700486",
"0.56557465",
"0.56478727",
"0.5641838",
"0.5639896",
"0.5628446",
"0.56146455",
"0.5611964",
"0.5596039",
"0.5583109",
"0.5579642",
"0.5579569",
"0.55738795",
"0.5572345",
"0.55718637",
"0.5571712",
"0.5570766",
"0.5567345",
"0.5564103",
"0.55533993",
"0.55524963",
"0.55503285",
"0.55470717",
"0.5540303",
"0.55389756",
"0.55384874",
"0.5537107",
"0.55206215",
"0.5518837",
"0.5511363",
"0.5506026",
"0.5496919",
"0.5494526",
"0.5488001",
"0.5488001",
"0.54855853",
"0.5481182",
"0.5475863",
"0.54663885",
"0.54614645",
"0.54517156",
"0.5450913",
"0.54463637",
"0.5439792",
"0.54380864",
"0.54358184",
"0.5427303",
"0.5426061",
"0.5418731",
"0.5417927",
"0.54145354",
"0.5411238",
"0.54026085",
"0.5402218",
"0.5402218",
"0.5400811",
"0.54003805",
"0.5399757",
"0.539711",
"0.5393175",
"0.5385494",
"0.53832364",
"0.53828984",
"0.5382674",
"0.5381304",
"0.53803456",
"0.5372873",
"0.53725266",
"0.5371528",
"0.5369947",
"0.5365778"
] |
0.7403564
|
0
|
GET /nature_financings/1 GET /nature_financings/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @nature_financings = NatureFinancing.all\n end",
"def set_nature_financing\n begin\n @nature_financing = current_institute.nature_financings.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n redirect_to nature_financings_path\n end\n end",
"def show\n @foiltype = Foiltype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foiltype }\n end\n end",
"def show\n @foil = Foil.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foil }\n end\n end",
"def index\n @filials = Filial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @filials }\n end\n end",
"def show\n @finding_aural = FindingAural.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @finding_aural }\n end\n end",
"def show\n @finance = Finance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @finance }\n end\n end",
"def index\n render json: @fiestas\n end",
"def show\n @nfer = Nfer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nfer }\n end\n end",
"def show\n @fiction = Fiction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fiction }\n end\n end",
"def show\n @filial = Filial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @filial }\n end\n end",
"def show\n @finance_inflow = FinanceInflow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @finance_inflow }\n end\n end",
"def index\n @familia = Familium.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @familia }\n end\n end",
"def nature_financing_params\n params.require(:nature_financing).permit(:title, :description, :institute_id)\n end",
"def show\n render json: Festival.build_for(params[:id]).to_json\n end",
"def show\n @family = get_family(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end",
"def get_finding_info\n\t\tidDec = params[:idDec].to_i\n\t\tidMap = params[:idMap].to_i\n\t\thallazgo = Finding.where(\"decision_map_id = ? AND governance_decision_id = ?\", idMap, idDec).first\n\t\trespond_to do |format|\n\t\t\tformat.json {render json: hallazgo}\n \tend\n\tend",
"def show\n @favourite_food = FavouriteFood.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @favourite_food }\n end\n end",
"def show\n @familium = Familium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @familium }\n end\n end",
"def index\n @fiction = Fiction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fiction }\n end\n end",
"def show\n @frais_annex = FraisAnnex.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @frais_annex }\n end\n end",
"def create\n @nature_financing = NatureFinancing.new(nature_financing_params)\n @nature_financing.institute = current_institute\n\n respond_to do |format|\n if @nature_financing.save\n format.html { redirect_to @nature_financing, notice: 'Nature financing was successfully created.' }\n format.json { render :show, status: :created, location: @nature_financing }\n else\n format.html { render :new }\n format.json { render json: @nature_financing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @fishing_method = FishingMethod.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fishing_method }\n end\n end",
"def update\n respond_to do |format|\n if @nature_financing.update(nature_financing_params)\n format.html { redirect_to @nature_financing, notice: 'Nature financing was successfully updated.' }\n format.json { render :show, status: :ok, location: @nature_financing }\n else\n format.html { render :edit }\n format.json { render json: @nature_financing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @fretes = Frete.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fretes }\n end\n end",
"def index\n\t @fares = Fare.all\n\n\t respond_to do |format|\n\t\tformat.html # index.html.erb\n\t\tformat.json { render json: @fares }\n\t end\n\tend",
"def show\n @forest = Forest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @forest }\n end\n end",
"def index\n @frais_hebergements = FraisHebergement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_hebergements }\n end\n end",
"def index\n @personal_finances = PersonalFinance.all\n end",
"def index\n @finances = Finance.all\n end",
"def show\n @fec_filing = FecFiling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @fec_filing }\n end\n end",
"def show\n @fec_filing = FecFiling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @fec_filing }\n end\n end",
"def show\r\n\r\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/#{params[:id]}/information\")\r\n\r\n http = Net::HTTP.new(url.host, url.port)\r\n http.use_ssl = true\r\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\r\n request = Net::HTTP::Get.new(url)\r\n request[\"x-rapidapi-key\"] = ENV[\"SPOONACULAR_API_KEY\"] # hidden API key\r\n request[\"x-rapidapi-host\"] = 'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com'\r\n\r\n response = http.request(request)\r\n @recipe = JSON.parse response.read_body # gets the recipe\r\n\r\n p url_ingredients = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/#{params[:id]}/ingredientWidget.json\")\r\n\r\n http_ingredients = Net::HTTP.new(url_ingredients.host, url_ingredients.port)\r\n http_ingredients.use_ssl = true\r\n http_ingredients.verify_mode = OpenSSL::SSL::VERIFY_NONE\r\n\r\n request_ingredients = Net::HTTP::Get.new(url_ingredients)\r\n request_ingredients[\"x-rapidapi-key\"] = ENV[\"SPOONACULAR_API_KEY\"]\r\n request[\"x-rapidapi-host\"] = 'spoonacular-recipe-food-nutrition-v1.p.rapidapi.com'\r\n\r\n response_ingredients = http.request(request_ingredients)\r\n # puts response_ingredients.read_body\r\n @ingredients = JSON.parse # data is a string (which looks like a hash -> convert to hash) response_ingredients.read_body\r\n p \"RECIPES\"\r\n # p @recipe\r\n p \"INGREDIENTS\"\r\n p @ingredients\r\n\r\n end",
"def index\n @frais_annexes = FraisAnnex.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_annexes }\n end\n end",
"def index \n fans = Fan.all \n render json: fans \n end",
"def new\n @foiltype = Foiltype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foiltype }\n end\n end",
"def show\n @institucional = Institucional.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @institucional }\n end\n end",
"def show\n @family = Family.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end",
"def index\n @monthly_finances = MonthlyFinance.all\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @monthly_finances }\n # end\n end",
"def new\n @foil = Foil.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foil }\n end\n end",
"def query_for_finances\n base = \"http://www.opensecrets.org/api\"\n header = {\n \"X-API-Key\" => open_secrets_key,\n \"Accept\" => \"application/json\",\n }\n CongressMember.all.each do |cm|\n if cm.crp_id\n options = {\n :apikey => open_secrets_key,\n :output => \"json\",\n :method => \"candIndustry\",\n :cid => cm.crp_id,\n }\n if cm.donations.size < 10\n response = JSON.parse(Faraday.get(base, options, header).body)\n response[\"response\"][\"industries\"][\"industry\"].each do |ind|\n industry_name = ind[\"@attributes\"][\"industry_name\"]\n total = ind[\"@attributes\"][\"total\"]\n industry = Industry.find_or_create_by(:name => industry_name)\n Donation.create(congress_member: cm, amount: total, industry: industry)\n end\n end\n end\n end\nend",
"def index\n @families = Family.all.paginate(page: params[:page])\n render json: @families\n end",
"def index\n @ftypes = Ftype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ftypes }\n end\n end",
"def index\n @financers = Financer.all\n end",
"def show\n @frais_hebergement = FraisHebergement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @frais_hebergement }\n end\n end",
"def show\n @financial_donation = FinancialDonation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @financial_donation }\n end\n end",
"def show\n @fortune = Fortune.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fortune }\n end\n end",
"def show\n @fact = Fact.find(params[:id])\n @restriction = Restriction.find(@fact.restriction_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fact }\n end\n end",
"def show\n @financial = Financial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @financial }\n end\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def show\n #@klass_fee = KlassFee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @klass_fee }\n end\n end",
"def food_info(food_id)\n get(\"/foods/#{food_id}.json\")\n end",
"def index\n type = params[:type]\n fg = params[:fg]\n @page = Page.find(2)\n @foodTypes = FoodType.all\n @type_id = type\n\n @foods = Food.find_by_sql([\"SELECT * FROM FOODS WHERE food_type_id = ?\", type])\n\n \n @foods = Food.find_by_sql(\"SELECT * FROM FOODS WHERE important = 't'\") if !params.has_key?(:type)\n \n \n if !fg.nil?\n @front_food = Food.find(fg) \n end if\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foods }\n end\n end",
"def show\n @frais_repa = FraisRepa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @frais_repa }\n end\n end",
"def index\n @facts = fact_type.all\n @title = fact_type\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @facts }\n end\n end",
"def ajax_fines\n @fines = params['fines']&.values.to_a\n render json: { record: render_to_string('_fines', layout: false), locals: { fines: @fines } }\n end",
"def show\n @flat_happening = FlatHappening.find(params[:id])\n\n render json: @flat_happening\n end",
"def show\n @inning = Inning.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inning }\n end\n end",
"def show\n @faction = Faction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @faction }\n end\n end",
"def show\n @budgeting_type = BudgetingType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @budgeting_type }\n end\n end",
"def show\n @family_crest = FamilyCrest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family_crest }\n end\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @life_insurances }\n end\n end",
"def show\n @situation = Situation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @situation }\n end\n end",
"def show\n @situation = Situation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @situation }\n end\n end",
"def new\n @finding_aural = FindingAural.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @finding_aural }\n end\n end",
"def index\n @frais_repas = FraisRepa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_repas }\n end\n end",
"def index\n @food_type_id = @foodTypes.first\n\n if params['type']\n @foods = Food.includes(:type).includes(:nutritional_information).where( type_id: params['type']['type_id']).paginate(page: params[:page])\n else\n @foods = Food.includes(:type).includes(:nutritional_information).where( type_id: @food_type_id).paginate(page: params[:page])\n end\n\n respond_with @foods\n end",
"def get_favourite_restaurants\n @profile = Profile.find(params[:id])\n @restaurants = @profile.favourites\n\n render status: 200, json: @restaurants\n end",
"def show\n @holiday = Holiday.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @holiday }\n end\n end",
"def show\n @fish_type = FishType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fish_type }\n end\n end",
"def show\n @favourite_listing = get_favourite_listing(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @favourite_listing }\n end\n end",
"def show\n family = current_family\n p current_family\n render json: family.as_json\n end",
"def get_folio_data\n netid = params['netid']\n url = ENV['OKAPI_URL']\n tenant = ENV['OKAPI_TENANT']\n account = CUL::FOLIO::Edge.patron_account(url, tenant, folio_token, { username: netid })\n # Rails.logger.debug(\"mjc12test: Got FOLIO account #{account.inspect}\")\n render json: account\n end",
"def index\n @factura = Factura.find(params[:factura_id])\n @renglon_facturas = @factura.renglon_facturas\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @renglon_facturas }\n end\n end",
"def show\n @family = Family.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @family }\n end\n end",
"def index\n @funds = Fund.all\n\n render json: @funds\n end",
"def show\n @filing_doc = FilingDoc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @filing_doc }\n end\n end",
"def new\n @fishing_method = FishingMethod.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fishing_method }\n end\n end",
"def show\n @fan_out = FanOut.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fan_out }\n end\n end",
"def show\n @holidaytype = Holidaytype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @holidaytype }\n end\n end",
"def show\n\t\trespond_to do |format|\n\t\t\tformat.html { }\n\t\t\tformat.json { render :json => {:fallacyfolder => @fallacyfolder}.to_json }\n\t\tend\n\tend",
"def index\n @situations = Situation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @situations }\n end\n end",
"def show\n @factura = Factura.find(params[:factura_id])\n @renglon_factura = @factura.renglon_facturas.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @renglon_factura }\n end\n end",
"def show\n\n @food = Food.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food }\n end\n end",
"def show\n @food = Food.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food }\n end\n end",
"def new\n @finance = Finance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @finance }\n end\n end",
"def show\n @financial_institution = FinancialInstitution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @financial_institution }\n end\n end",
"def show\n @flaw = Flaw.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flaw }\n end\n end",
"def index\n @foros = Foro.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foros }\n end\n end",
"def show\n begin\n @dev_folio = DevFolio.find(params[:id])\n rescue\n @dev_folio = DevFolio.where(label: params[:id]).first()\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dev_folio }\n end\n end",
"def show\n @frete = Frete.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @frete }\n end\n end",
"def show\n @factoid = Factoid.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @factoid }\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 show\n @forecast = Forecast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @forecast }\n end\n end",
"def index\n @nepals = Nepal.all\n\n render json: @nepals\n end",
"def show\n @filial = Filial.find(params[:id])\n @instructors = @filial.instructors\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @filial }\n end\n end",
"def index\n @flaws = Flaw.order(\"date DESC, created_at DESC\").page( params[:page] ).per(10)\n \n @flaw = Flaw.new\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @flaws }\n end\n end",
"def index\n @funeral_infos = FuneralInfo.all\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @life_insurance }\n end\n end",
"def index\n if current_user\n @flats = Flat.all\n else\n @flats = Flat.where('displayed=? and approved=?', true, true).all\n end\n\n @facilities=Facility.where(\"is_building=?\", true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @flats }\n end\n end",
"def show\n @foro = Foro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foro }\n end\n end"
] |
[
"0.72915167",
"0.68248355",
"0.6327514",
"0.6265682",
"0.62127054",
"0.60246485",
"0.6022422",
"0.6012324",
"0.6007121",
"0.59941745",
"0.5985369",
"0.5964428",
"0.5923561",
"0.5890361",
"0.5886626",
"0.5885426",
"0.58840656",
"0.58838266",
"0.5881547",
"0.58787084",
"0.58772695",
"0.5872083",
"0.5869037",
"0.585737",
"0.5854363",
"0.5847863",
"0.58454317",
"0.5819349",
"0.58188885",
"0.58029956",
"0.5788833",
"0.5788833",
"0.57875687",
"0.57725304",
"0.5766349",
"0.57565576",
"0.5752103",
"0.5751634",
"0.5750358",
"0.5747284",
"0.57421464",
"0.5721829",
"0.5720373",
"0.57163227",
"0.5714778",
"0.5710361",
"0.57025445",
"0.56976885",
"0.5696198",
"0.56945586",
"0.5689975",
"0.56869256",
"0.568554",
"0.5673572",
"0.56733793",
"0.5669089",
"0.56665844",
"0.5664424",
"0.56585884",
"0.5655563",
"0.56537765",
"0.5651604",
"0.56500566",
"0.56476754",
"0.56384945",
"0.5635919",
"0.5633371",
"0.5631157",
"0.56263006",
"0.5626063",
"0.5624902",
"0.5618809",
"0.56169933",
"0.5607219",
"0.5602607",
"0.5584607",
"0.5571381",
"0.5567622",
"0.5563635",
"0.5556548",
"0.5552236",
"0.5552062",
"0.5551114",
"0.5547958",
"0.55458426",
"0.55440545",
"0.55402243",
"0.55362225",
"0.55355006",
"0.5534633",
"0.5531772",
"0.5530414",
"0.5526586",
"0.5524378",
"0.5522455",
"0.5521372",
"0.5521195",
"0.5518142",
"0.5509901",
"0.550973",
"0.55091876"
] |
0.0
|
-1
|
POST /nature_financings POST /nature_financings.json
|
def create
@nature_financing = NatureFinancing.new(nature_financing_params)
@nature_financing.institute = current_institute
respond_to do |format|
if @nature_financing.save
format.html { redirect_to @nature_financing, notice: 'Nature financing was successfully created.' }
format.json { render :show, status: :created, location: @nature_financing }
else
format.html { render :new }
format.json { render json: @nature_financing.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def nature_financing_params\n params.require(:nature_financing).permit(:title, :description, :institute_id)\n end",
"def set_nature_financing\n begin\n @nature_financing = current_institute.nature_financings.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n redirect_to nature_financings_path\n end\n end",
"def index\n @nature_financings = NatureFinancing.all\n end",
"def create\n\n # Rails.logger.warn \"====================\"\n # Rails.logger.warn foaf_params[:interests_attributes]\n # Rails.logger.warn \"====================\"\n\n \n @foaf = Foaf.new(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n end\n end\n\n respond_to do |format|\n if @foaf.save \n format.html { redirect_to @foaf, notice: 'FOAF was successfully created.' }\n format.json { render action: 'show', status: :created, location: @foaf }\n else\n format.html { render action: 'new' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n # Rails.logger.warn \"====================\"\n # Rails.logger.warn foaf_params[:interests_attributes]\n # Rails.logger.warn \"====================\"\n\n \n @foaf = Foaf.new(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n end\n end\n\n respond_to do |format|\n if @foaf.save \n format.html { redirect_to @foaf, notice: 'Foaf was successfully created.' }\n format.json { render action: 'show', status: :created, location: @foaf }\n else\n format.html { render action: 'new' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @nature_financing.update(nature_financing_params)\n format.html { redirect_to @nature_financing, notice: 'Nature financing was successfully updated.' }\n format.json { render :show, status: :ok, location: @nature_financing }\n else\n format.html { render :edit }\n format.json { render json: @nature_financing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @finance_inflow = FinanceInflow.new(params[:finance_inflow])\n\n respond_to do |format|\n if @finance_inflow.save\n format.html { redirect_to polymorphic_path([:personal_finance, :income]), notice: 'Finance inflow was successfully created.' }\n format.json { render json: @finance_inflow, status: :created, location: @finance_inflow }\n else\n format.html { render action: \"new\" }\n format.json { render json: @finance_inflow.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\n @foiltype = Foiltype.new(params[:foiltype])\n\n respond_to do |format|\n if @foiltype.save\n format.html { redirect_to @foiltype, notice: 'Foil Type was successfully created.' }\n format.json { render json: @foiltype, status: :created, location: @foiltype }\n else\n format.html { render action: \"new\" }\n format.json { render json: @foiltype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def ajax_fines\n @fines = params['fines']&.values.to_a\n render json: { record: render_to_string('_fines', layout: false), locals: { fines: @fines } }\n end",
"def create\n @finantial_product = FinantialProduct.new(finantial_product_params)\n\n respond_to do |format|\n if @finantial_product.save\n format.html { redirect_to @finantial_product, notice: \"Finantial product was successfully created.\" }\n format.json { render :show, status: :created, location: @finantial_product }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @finantial_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @finding_aural = FindingAural.new(params[:finding_aural])\n\n respond_to do |format|\n if @finding_aural.save\n format.html { redirect_to @finding_aural, notice: 'Finding aural was successfully created.' }\n format.json { render json: @finding_aural, status: :created, location: @finding_aural }\n else\n format.html { render action: \"new\" }\n format.json { render json: @finding_aural.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bonificacionfact = Bonificacionfact.new(bonificacionfact_params)\n\n respond_to do |format|\n if @bonificacionfact.save\n format.html { redirect_to @bonificacionfact, notice: 'Bonificacionfact was successfully created.' }\n format.json { render :show, status: :created, location: @bonificacionfact }\n else\n format.html { render :new }\n format.json { render json: @bonificacionfact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invited_fiend = InvitedFiend.new(invited_fiend_params)\n\n respond_to do |format|\n if @invited_fiend.save\n format.html { redirect_to @invited_fiend, notice: 'Invited fiend was successfully created.' }\n format.json { render :show, status: :created, location: @invited_fiend }\n else\n format.html { render :new }\n format.json { render json: @invited_fiend.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @nfer = Nfer.new(params[:nfer])\n\n respond_to do |format|\n if @nfer.save\n format.html { redirect_to @nfer, notice: 'Nfer was successfully created.' }\n format.json { render json: @nfer, status: :created, location: @nfer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nfer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @foil = Foil.new(params[:foil])\n\n respond_to do |format|\n if @foil.save\n format.html { redirect_to @foil, notice: 'Foil was successfully created.' }\n format.json { render json: @foil, status: :created, location: @foil }\n else\n format.html { render action: \"new\" }\n format.json { render json: @foil.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @personal_finance = PersonalFinance.new(personal_finance_params)\n\n respond_to do |format|\n if @personal_finance.save\n format.html { redirect_to @personal_finance, notice: 'Personal finance was successfully created.' }\n format.json { render action: 'show', status: :created, location: @personal_finance }\n else\n format.html { render action: 'new' }\n format.json { render json: @personal_finance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @finnancial_product_type = FinnancialProductType.new(finnancial_product_type_params)\n\n respond_to do |format|\n if @finnancial_product_type.save\n format.html { redirect_to @finnancial_product_type, notice: 'Finnancial product type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @finnancial_product_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @finnancial_product_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fec_filing = FecFiling.new(params[:fec_filing])\n\n respond_to do |format|\n if @fec_filing.save\n format.html { redirect_to @fec_filing, :notice => 'Fec filing was successfully created.' }\n format.json { render :json => @fec_filing, :status => :created, :location => @fec_filing }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @fec_filing.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @fec_filing = FecFiling.new(params[:fec_filing])\n\n respond_to do |format|\n if @fec_filing.save\n format.html { redirect_to @fec_filing, :notice => 'Fec filing was successfully created.' }\n format.json { render :json => @fec_filing, :status => :created, :location => @fec_filing }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @fec_filing.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @fiestum = Fiestum.new(fiestum_params)\n\n respond_to do |format|\n if @fiestum.save\n format.html { redirect_to @fiestum, notice: 'Fiestum was successfully created.' }\n format.json { render :show, status: :created, location: @fiestum }\n else\n format.html { render :new }\n format.json { render json: @fiestum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @familia = Familia.new(familia_params)\n #@fp=@familia.familias_propiedades.new\n\n respond_to do |format|\n if @familia.save\n format.html { redirect_to :familias, :locals => {:id => @id}, notice: 'Familia was successfully created.' }\n format.json { render action: 'show', status: :created, location: @familia }\n else\n format.html { render action: 'new' }\n format.json { render json: @familia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @facture = Facture.new(facture_params)\n\n respond_to do |format|\n if @facture.save\n format.html { redirect_to add_ref_path(@facture), notice: 'La facture a bien été créée.'} \n format.json { render :add_ref, status: :created, location: @facture }\n else\n format.html { render :new }\n format.json { render json: @facture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fact = @cat.facts.create!({ fact: api_request })\n if @fact.save\n render json: @fact\n else\n render error: { message: \"Não foi possível criar esse fato para este gatinho! :(\" }, status: 400\n end\n end",
"def create\n @finance = Finance.new(params[:finance])\n\n respond_to do |format|\n if @finance.save\n format.html { redirect_to @finance, notice: 'Finance was successfully created.' }\n format.json { render json: @finance, status: :created, location: @finance }\n else\n format.html { render action: \"new\" }\n format.json { render json: @finance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def foaf_params\n params.require(:foaf).permit(:name, :work, :slug, :birthday, :interests_attributes)\n end",
"def foaf_params\n params.require(:foaf).permit(:name, :work, :slug, :birthday, :interests_attributes)\n end",
"def create\n @featuring = Featuring.new(featuring_params)\n\n respond_to do |format|\n if @featuring.save\n format.html { redirect_to @featuring, notice: 'Featuring was successfully created.' }\n format.json { render :show, status: :created, location: @featuring }\n else\n format.html { render :new }\n format.json { render json: @featuring.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @nature_financing.destroy\n respond_to do |format|\n format.html { redirect_to nature_financings_url, notice: 'Nature financing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @membership_fee = MembershipFee.new(params[:membership_fee])\n\n respond_to do |format|\n if @membership_fee.save\n format.html { redirect_to @membership_fee, notice: 'Membership fee was successfully created.' }\n format.json { render json: @membership_fee, status: :created, location: @membership_fee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @membership_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @furniture = Furniture.new(furniture_params)\n respond_to do |format|\n if @furniture.save\n format.html { redirect_to @furniture, notice: \"Furniture was successfully created.\" }\n format.json { render :show, status: :created, location: @furniture }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @furniture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new #GIRO: POST /foals(.:format) foals#create\n@foal = Foal.new #GIRO: http://localhost:3000/foals/new\nend",
"def create_folio\n rs = Folio.new\n rs.input_type_id = params[:input_type_id]\n #rs.folio_no = gen_folio_no\n rs.remark = params[:remark]\n if rs.save\n respond_to do |format|\n format.json { render json: {success: true} }\n end\n else\n respond_to do |format|\n format.json { render json: {success: false} }\n end\n end\n end",
"def create\n @frais_annex = FraisAnnex.new(params[:frais_annex])\n\n respond_to do |format|\n if @frais_annex.save\n format.html { redirect_to @frais_annex, :notice => 'Le frais annexe a bien été créé' }\n format.json { render :json => @frais_annex, :status => :created, :location => @frais_annex }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @frais_annex.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @filing = Filing.new(filing_params)\n\n respond_to do |format|\n if @filing.save\n format.html { redirect_to @filing, notice: 'Filing was successfully created.' }\n format.json { render action: 'show', status: :created, location: @filing }\n else\n format.html { render action: 'new' }\n format.json { render json: @filing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def fond_params\n\t\tparams.require(:fond).permit(:document_type, :document_number, :business_name, :fond_type)\n end",
"def create\n @filial = Filial.new(params[:filial])\n\n respond_to do |format|\n if @filial.save\n format.html { redirect_to filials_path, notice: 'Filial was successfully created.' }\n format.json { render json: @filial, status: :created, location: @filial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @filial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def facture_params\n params.require(:facture).permit(:n_facute, :date, :code_client, :cree_bar, :montant_ttc, :montant_ht, :montant_tva, :est_valid, :est_regle, :mode_reglement)\n end",
"def create\n #@klass_fee = KlassFee.new(params[:klass_fee])\n ap params[:fee]\n begin\n params[:fee].each do |fee_type_id, amount|\n puts \"=======xx==========\"\n ap KlassFee.create({klass_id: @klass.id, fee_type_id: fee_type_id, amount: amount[:amount]})\n end\n \n redirect_to klass_klass_fees_path(@klass), notice: 'Klass fee was successfully created.'\n #rescue Exception => e\n # render action: \"new\" \n end\n end",
"def create\n @faltante = Faltante.new(faltante_params)\n @employees = Employee.all\n @faltantes = Tipofaltante.all\n \n respond_to do |format|\n if @faltante.save\n format.html { redirect_to @faltante, notice: 'Faltante was successfully created.' }\n format.json { render :show, status: :created, location: @faltante }\n else\n format.html { render :new }\n format.json { render json: @faltante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n @franchise = @franchise_set.franchises.new(params[:franchise])\n\n respond_to do |format|\n if @franchise.save \n format.html { redirect_to \"/franchise_sets/#{@franchise_set.id}/edit\", :franchise_set_id => franchise_set.id, notice: 'Franchise was successfully created.' }\n format.json { render json: @franchise}\n else\n format.html { render action: \"new\" }\n format.json { render json: @franchise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @finance = Finance.new(finance_params)\n\n respond_to do |format|\n if @finance.save\n format.html { redirect_to @finance, notice: 'Finance was successfully created.' }\n format.json { render :show, status: :created, location: @finance }\n else\n format.html { render :new }\n format.json { render json: @finance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fondo = Fondo.new(fondo_params)\n\n respond_to do |format|\n if @fondo.save\n format.html { redirect_to @fondo, notice: 'Fondo was successfully created.' }\n format.json { render :show, status: :created, location: @fondo }\n else\n format.html { render :new }\n format.json { render json: @fondo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @freind = Freind.new(freind_params)\n\n respond_to do |format|\n if @freind.save\n format.html { redirect_to @freind, notice: \"Freind was successfully created.\" }\n format.json { render :show, status: :created, location: @freind }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @freind.errors, status: :unprocessable_entity }\n end\n end\n end",
"def query_for_finances\n base = \"http://www.opensecrets.org/api\"\n header = {\n \"X-API-Key\" => open_secrets_key,\n \"Accept\" => \"application/json\",\n }\n CongressMember.all.each do |cm|\n if cm.crp_id\n options = {\n :apikey => open_secrets_key,\n :output => \"json\",\n :method => \"candIndustry\",\n :cid => cm.crp_id,\n }\n if cm.donations.size < 10\n response = JSON.parse(Faraday.get(base, options, header).body)\n response[\"response\"][\"industries\"][\"industry\"].each do |ind|\n industry_name = ind[\"@attributes\"][\"industry_name\"]\n total = ind[\"@attributes\"][\"total\"]\n industry = Industry.find_or_create_by(:name => industry_name)\n Donation.create(congress_member: cm, amount: total, industry: industry)\n end\n end\n end\n end\nend",
"def create\n @filial = Filial.new(params[:filial])\n\n respond_to do |format|\n if @filial.save\n format.html { redirect_to @filial, notice: 'Filial was successfully created.' }\n format.json { render json: @filial, status: :created, location: @filial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @filial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fishing_method = FishingMethod.new(params[:fishing_method])\n\n respond_to do |format|\n if @fishing_method.save\n format.html { redirect_to @fishing_method, notice: 'Fishing method was successfully created.' }\n format.json { render json: @fishing_method, status: :created, location: @fishing_method }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fishing_method.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @auction_foregift = AuctionForegift.new(auction_foregift_params)\n\n respond_to do |format|\n if @auction_foregift.save\n format.html { redirect_to @auction_foregift, notice: 'Auction foregift was successfully created.' }\n format.json { render :show, status: :created, location: @auction_foregift }\n else\n format.html { render :new }\n format.json { render json: @auction_foregift.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @financial_donation = FinancialDonation.new(params[:financial_donation])\n\n respond_to do |format|\n if @financial_donation.save\n format.html { redirect_to @financial_donation, notice: 'Financial donation was successfully created.' }\n format.json { render json: @financial_donation, status: :created, location: @financial_donation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @financial_donation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @foiltype = Foiltype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foiltype }\n end\n end",
"def create\n @fiction = Fiction.new(params[:fiction])\n\n respond_to do |format|\n if @fiction.save\n format.html { redirect_to @fiction, notice: 'Fiction was successfully created.' }\n format.json { render json: @fiction, status: :created, location: @fiction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fiction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fournisseur = Fournisseur.new(fournisseur_params)\n\n respond_to do |format|\n if @fournisseur.save\n format.html { redirect_to @fournisseur, notice: 'Fournisseur was successfully created.' }\n format.json { render :show, status: :created, location: @fournisseur }\n else\n format.html { render :new }\n format.json { render json: @fournisseur.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inning = Inning.new(params[:inning])\n\n respond_to do |format|\n if @inning.save\n format.html { redirect_to @inning, notice: 'Inning was successfully created.' }\n format.json { render json: @inning, status: :created, location: @inning }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inning.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @fact = Fact.new\n @restriction = @fact.build_restriction\n @feature = @restriction.build_feature\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fact }\n end\n end",
"def create\n @frais_hebergement = FraisHebergement.new(params[:frais_hebergement])\n\n respond_to do |format|\n if @frais_hebergement.save\n format.html { redirect_to @frais_hebergement, :notice => 'Le frais d\\'hébergement a bien été créé' }\n format.json { render :json => @frais_hebergement, :status => :created, :location => @frais_hebergement }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @frais_hebergement.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @flat_happening = FlatHappening.where(:namespaced_id => params[:flat_happening][:namespaced_id]).first_or_initialize(params[:flat_happening])\n # @happening = Happening.where(:source => params[:happening][:source], :meta => params[:happening][:meta]).first_or_initialize(create_params)\n\n if @flat_happening.save\n render json: @flat_happening, status: :created\n # , location: @flat_happening\n else\n render json: @flat_happening.errors, status: :unprocessable_entity\n end\n end",
"def create\n @entidadfinanciera = Entidadfinanciera.new(params[:entidadfinanciera])\n\n respond_to do |format|\n if @entidadfinanciera.save\n format.html { redirect_to(@entidadfinanciera, :notice => 'Entidadfinanciera was successfully created.') }\n format.xml { render :xml => @entidadfinanciera, :status => :created, :location => @entidadfinanciera }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @entidadfinanciera.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @financial = Financial.new(params[:financial])\n\n respond_to do |format|\n if @financial.save\n format.html { redirect_to @financial, notice: 'Financial was successfully created.' }\n format.json { render json: @financial, status: :created, location: @financial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @financial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fund = Fund.new(fund_params)\n\n if @fund.save\n render json: @fund, status: :created, location: @fund\n else\n render json: @fund.errors, status: :unprocessable_entity\n end\n end",
"def create\n @outra_nota_fiscal = OutraNotaFiscal.new(outra_nota_fiscal_params)\n\n respond_to do |format|\n if @outra_nota_fiscal.save\n format.html { redirect_to @outra_nota_fiscal, notice: 'Outra nota fiscal was successfully created.' }\n format.json { render :show, status: :created, location: @outra_nota_fiscal }\n else\n format.html { render :new }\n format.json { render json: @outra_nota_fiscal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @factores_fluctuante = FactoresFluctuante.new(factores_fluctuante_params)\n\n respond_to do |format|\n if @factores_fluctuante.save\n format.html { redirect_to @factores_fluctuante, notice: 'Factores fluctuante was successfully created.' }\n format.json { render :show, status: :created, location: @factores_fluctuante }\n else\n format.html { render :new }\n format.json { render json: @factores_fluctuante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @falta = Falta.new(falta_params)\n\n respond_to do |format|\n if @falta.save\n format.html { redirect_to @falta, notice: \"Falta was successfully created.\" }\n format.json { render :show, status: :created, location: @falta }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @falta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @forest = Forest.new(params[:forest])\n\n respond_to do |format|\n if @forest.save\n format.html { redirect_to @forest, notice: 'Forest was successfully created.' }\n format.json { render json: @forest, status: :created, location: @forest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @forest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def bonificacionfact_params\n params.require(:bonificacionfact).permit(:bonificacion_id, :factura_id, :edesal_id, :linea, :porcentaje, :fdesde, :fhasta)\n end",
"def create_founder(perk)\n @user = session[:user_id]\n @project = Project.where(\"perk_id = ?\", perk)\n @funder = Funder.new(\"user_id\" => @user, \"perk_id\" =>perk, \"project_id\" => @project)\n\n\n respond_to do |format|\n if @funder.save\n format.html { redirect_to @project}\n format.json { render :show, status: :created, location: @funder }\n else\n format.html { render :new }\n format.json { render json: @funder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n render :json => @fiestas.push(params[:fiesta])\n end",
"def create\n @facture = Facture.new(facture_params)\n\n respond_to do |format|\n if @facture.save\n format.html { redirect_to @facture, notice: 'Facture was successfully created.' }\n format.json { render :show, status: :created, location: @facture }\n else\n format.html { render :new }\n format.json { render json: @facture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @favourite_food = FavouriteFood.new(params[:favourite_food])\n\n respond_to do |format|\n if @favourite_food.save\n format.html { redirect_to @favourite_food, notice: 'Favourite food was successfully created.' }\n format.json { render json: @favourite_food, status: :created, location: @favourite_food }\n else\n format.html { render action: \"new\" }\n format.json { render json: @favourite_food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ingpizza = Ingpizza.new(ingpizza_params)\n\n respond_to do |format|\n if @ingpizza.save\n format.html { redirect_to @ingpizza, notice: 'Ingpizza was successfully created.' }\n format.json { render :show, status: :created, location: @ingpizza }\n else\n format.html { render :new }\n format.json { render json: @ingpizza.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fan_out = FanOut.new(params[:fan_out])\n\n respond_to do |format|\n if @fan_out.save\n format.html { redirect_to @fan_out, notice: 'Fan out was successfully created.' }\n format.json { render json: @fan_out, status: :created, location: @fan_out }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fan_out.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @finanzposition = Finanzposition.new(params[:finanzposition])\n #@finanzposition.users << current_user\n #@finanzposition.FinanzenNr << current_finanzens\n respond_to do |format|\n if @finanzposition.save\n format.html { redirect_to @finanzposition, notice: 'finanzposition was successfully created.' }\n format.json { render json: @finanzposition, status: :created, location: @finanzposition }\n else\n format.html { render action: \"new\" }\n format.json { render json: @finanzposition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @detalle_factura = DetalleFactura.new(detalle_factura_params)\n\n respond_to do |format|\n if @detalle_factura.save\n format.html { redirect_to @detalle_factura, notice: 'Detalle factura was successfully created.' }\n format.json { render :show, status: :created, location: @detalle_factura }\n else\n format.html { render :new }\n format.json { render json: @detalle_factura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @institucional = Institucional.new(params[:institucional])\n\n respond_to do |format|\n if @institucional.save\n format.html { redirect_to @institucional, notice: 'Institucional was successfully created.' }\n format.json { render json: @institucional, status: :created, location: @institucional }\n else\n format.html { render action: \"new\" }\n format.json { render json: @institucional.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @fact = fact_type.new(fact_params)\n\n respond_to do |format|\n if @fact.save\n format.html { redirect_to @fact, notice: 'Fact was successfully created.' }\n format.json { render json: @fact, status: :created, location: @fact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @feild = Feild.new(feild_params)\n\n respond_to do |format|\n if @feild.save\n format.html { redirect_to @feild, notice: 'Feild was successfully created.' }\n format.json { render :show, status: :created, location: @feild }\n else\n format.html { render :new }\n format.json { render json: @feild.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @frat = Frat.new(frat_params)\n\n respond_to do |format|\n if @frat.save\n format.html { redirect_to @frat, notice: 'Frat was successfully created.' }\n format.json { render action: 'show', status: :created, location: @frat }\n else\n format.html { render action: 'new' }\n format.json { render json: @frat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n saved = false\n begin\n ActiveRecord::Base.transaction do\n @financer = Financer.new(financer_params)\n @financer.save!\n saved = true\n end\n rescue ActiveRecord::RecordInvalid\n end\n\n respond_to do |format|\n if saved\n format.html { redirect_to @financer, notice: 'Financer was successfully created.' }\n format.json { render :show, status: :created, location: @financer }\n else\n format.html { render :new }\n format.json { render json: @financer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @furdo = Furdo.new(furdo_params)\n\n respond_to do |format|\n if @furdo.save\n format.html { redirect_to @furdo, notice: 'Furdo was successfully created.' }\n format.json { render :show, status: :created, location: @furdo }\n else\n format.html { render :new }\n format.json { render json: @furdo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @foil_item = FoilItem.new(foil_item_params)\n\n respond_to do |format|\n if @foil_item.save\n format.html { redirect_to @foil_item, notice: 'Foil item was successfully created.' }\n format.json { render :show, status: :created, location: @foil_item }\n else\n format.html { render :new }\n format.json { render json: @foil_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @finance_inflow = FinanceInflow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @finance_inflow }\n end\n end",
"def create\n @fee = Fee.new(params[:fee])\n\n respond_to do |format|\n if @fee.save\n format.html { redirect_to fees_path, notice: 'Fee was successfully created.' }\n format.json { render json: @fee, status: :created, location: @fee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @infection = Infection.new(infection_params)\n\n respond_to do |format|\n if @infection.save\n format.html { redirect_to @infection, notice: 'Infection was successfully created.' }\n format.json { render :show, status: :created, location: @infection }\n else\n format.html { render :new }\n format.json { render json: @infection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @familium = Familium.new(familium_params)\n\n respond_to do |format|\n if @familium.save\n format.html { redirect_to @familium, notice: 'Familium was successfully created.' }\n format.json { render :show, status: :created, location: @familium }\n else\n format.html { render :new }\n format.json { render json: @familium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @famille = Famille.new(famille_params)\n\n respond_to do |format|\n if @famille.save\n format.html { redirect_to @famille, notice: 'Famille was successfully created.' }\n format.json { render :show, status: :created, location: @famille }\n\t else\n format.html { render :new }\n end\n end\n end",
"def create\n @nail_salon = NailSalon.new(params[:nail_salon])\n\n respond_to do |format|\n if @nail_salon.save\n format.html { redirect_to @nail_salon, notice: 'Nail salon was successfully created.' }\n format.json { render json: @nail_salon, status: :created, location: @nail_salon }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nail_salon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @facility = Facility.new(facility_params)\n @facility.save\n respond_with @facility\n end",
"def new\n @foil = Foil.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foil }\n end\n end",
"def create\n @fornecedor = Fornecedor.new(fornecedor_params)\n\n respond_to do |format|\n if @fornecedor.save\n format.html { redirect_to @fornecedor, notice: 'Fornecedor was successfully created.' }\n format.json { render :show, status: :created, location: @fornecedor }\n else\n format.html { render :new }\n format.json { render json: @fornecedor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def fine_params\n params.require(:fine).permit(:date, :description, :status, :amount, :offender_id, :proposer_id)\n end",
"def create\n @familium = Familium.new(params[:familium])\n\n respond_to do |format|\n if @familium.save\n format.html { redirect_to familia_path, notice: 'Familia fue creada exitosamente.' }\n format.json { render json: @familium, status: :created, location: @familium }\n else\n format.html { render action: \"new\" }\n format.json { render json: @familium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post_ingredient = @post.post_ingredients.build(post_ingredient_params)\n\n respond_to do |format|\n if @post_ingredient.save\n format.html { redirect_to post_post_ingredients_path(@post), notice: \"Post ingredient was successfully created.\" }\n format.json { render :show, status: :created, location: @post_ingredient }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @post_ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @festival = Festival.new\n \n fy = @festival.festival_years.build\n e = fy.events.build\n a = e.build_address\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @festival }\n end\n end",
"def create\n @filing_doc = FilingDoc.new(params[:filing_doc])\n\n respond_to do |format|\n if @filing_doc.save\n format.html { redirect_to @filing_doc, notice: 'Filing doc was successfully created.' }\n format.json { render json: @filing_doc, status: :created, location: @filing_doc }\n else\n format.html { render action: \"new\" }\n format.json { render json: @filing_doc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.find_by_id(session[:user_id])\n @firend_relationship = @user.firend_relationship.new(firend_relationship_params)\n\n respond_to do |format|\n if @firend_relationship.save\n format.html { redirect_to user_firend_relationships_path, notice: 'Firend relationship was successfully created.' }\n format.json { render :show, status: :created, location: @user_firend_relationships }\n else\n format.html { render :new }\n format.json { render json: @firend_relationship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ficha_ingreso = FichaIngreso.new(ficha_ingreso_params)\n\n respond_to do |format|\n if @ficha_ingreso.save\n format.html { redirect_to @ficha_ingreso, notice: 'Ficha ingreso was successfully created.' }\n format.json { render :show, status: :created, location: @ficha_ingreso }\n else\n format.html { render :new }\n format.json { render json: @ficha_ingreso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @frais_repa = FraisRepa.new(params[:frais_repa])\n\n respond_to do |format|\n if @frais_repa.save\n format.html { redirect_to @frais_repa, :notice => 'Le frais de repas a bien été créé' }\n format.json { render :json => @frais_repa, :status => :created, :location => @frais_repa }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @frais_repa.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @nepal = Nepal.new(nepal_params)\n\n if @nepal.save\n render json: @nepal, status: :created, location: @nepal\n else\n render json: @nepal.errors, status: :unprocessable_entity\n end\n end",
"def create\n @classification_fund = ClassificationFund.new(classification_fund_params)\n\n respond_to do |format|\n if @classification_fund.save\n format.html { redirect_to @classification_fund, notice: 'Classification fund was successfully created.' }\n format.json { render :show, status: :created, location: @classification_fund }\n else\n format.html { render :new }\n format.json { render json: @classification_fund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @facturaventum = Facturaventum.new(facturaventum_params)\n\n respond_to do |format|\n if @facturaventum.save\n format.html { redirect_to @facturaventum, notice: 'Facturaventum was successfully created.' }\n format.json { render :show, status: :created, location: @facturaventum }\n else\n format.html { render :new }\n format.json { render json: @facturaventum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @narration = Narration.new(narration_params)\n\n respond_to do |format|\n if @narration.save\n format.html { redirect_to @narration, notice: 'Narration was successfully created.' }\n format.json { render :show, status: :created, location: @narration }\n else\n format.html { render :new }\n format.json { render json: @narration.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6604814",
"0.6420883",
"0.638493",
"0.6008372",
"0.59575504",
"0.592031",
"0.5761156",
"0.57413477",
"0.56809795",
"0.56630325",
"0.563797",
"0.5607012",
"0.5606789",
"0.56050414",
"0.5593278",
"0.5548935",
"0.55449504",
"0.55356085",
"0.55339384",
"0.55339384",
"0.55304164",
"0.55201197",
"0.54887766",
"0.5485935",
"0.5481237",
"0.5479562",
"0.5479562",
"0.54787385",
"0.54609615",
"0.5460468",
"0.5457981",
"0.54532784",
"0.54437083",
"0.5436099",
"0.54230875",
"0.5403168",
"0.54024434",
"0.5395448",
"0.5392498",
"0.5388527",
"0.5383469",
"0.53511524",
"0.5347611",
"0.53422815",
"0.5342264",
"0.5339189",
"0.5318507",
"0.53012156",
"0.52990586",
"0.52981794",
"0.52956027",
"0.52861565",
"0.52843904",
"0.52771026",
"0.52754265",
"0.52660894",
"0.5263046",
"0.526275",
"0.526224",
"0.5255018",
"0.52487355",
"0.52465963",
"0.5238012",
"0.52345043",
"0.52330524",
"0.5220538",
"0.5218661",
"0.5217368",
"0.5213258",
"0.5202831",
"0.5200779",
"0.51958907",
"0.51946145",
"0.51938945",
"0.51914924",
"0.51913327",
"0.5184618",
"0.51840156",
"0.51809657",
"0.5179084",
"0.5178299",
"0.51742464",
"0.5174095",
"0.51700395",
"0.5169785",
"0.5162744",
"0.51609725",
"0.51602596",
"0.5157426",
"0.5157127",
"0.51565367",
"0.5156099",
"0.5155822",
"0.51517224",
"0.51395667",
"0.5133818",
"0.5131897",
"0.51308006",
"0.51281285",
"0.51273996"
] |
0.6804349
|
0
|
PATCH/PUT /nature_financings/1 PATCH/PUT /nature_financings/1.json
|
def update
respond_to do |format|
if @nature_financing.update(nature_financing_params)
format.html { redirect_to @nature_financing, notice: 'Nature financing was successfully updated.' }
format.json { render :show, status: :ok, location: @nature_financing }
else
format.html { render :edit }
format.json { render json: @nature_financing.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'FOAF was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'Foaf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @foiltype = Foiltype.find(params[:id])\n\n respond_to do |format|\n if @foiltype.update_attributes(params[:foiltype])\n format.html { redirect_to @foiltype, notice: 'Foiltype was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @foiltype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @foil = Foil.find(params[:id])\n\n respond_to do |format|\n if @foil.update_attributes(params[:foil])\n format.html { redirect_to @foil, notice: 'Foil was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @foil.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end",
"def update\n respond_to do |format|\n if @socio_doc_fiscais_coring.update(socio_doc_fiscais_coring_params)\n format.html { redirect_to @socio_doc_fiscais_coring, notice: 'Socio doc fiscais coring was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_doc_fiscais_coring.errors, status: :unprocessable_entity }\n end\n end\n end",
"def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end",
"def update\n @flat_happening = FlatHappening.find(params[:id])\n\n if @flat_happening.update_attributes(params[:flat_happening])\n head :no_content\n else\n render json: @flat_happening.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @bonificacionfact.update(bonificacionfact_params)\n format.html { redirect_to @bonificacionfact, notice: 'Bonificacionfact was successfully updated.' }\n format.json { render :show, status: :ok, location: @bonificacionfact }\n else\n format.html { render :edit }\n format.json { render json: @bonificacionfact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @personal_finance.update(personal_finance_params)\n format.html { redirect_to @personal_finance, notice: 'Personal finance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @personal_finance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @facture.update(facture_params)\n format.html { redirect_to add_ref_path(@facture), notice: 'La facture a bien été mise à jour.' }\n format.json { render :show, status: :ok, location: @facture }\n else\n format.html { render :edit }\n format.json { render json: @facture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @appraisal_fee.update(appraisal_fee_params)\n format.html { redirect_to appraisal_fees_path, notice: 'Appraisal fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @appraisal_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @finance_inflow = FinanceInflow.find(params[:id])\n\n respond_to do |format|\n if @finance_inflow.update_attributes(params[:finance_inflow])\n format.html { redirect_to @finance_inflow, notice: 'Finance inflow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @finance_inflow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fiestum.update(fiestum_params)\n format.html { redirect_to @fiestum, notice: 'Fiestum was successfully updated.' }\n format.json { render :show, status: :ok, location: @fiestum }\n else\n format.html { render :edit }\n format.json { render json: @fiestum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @nfer = Nfer.find(params[:id])\n\n respond_to do |format|\n if @nfer.update_attributes(params[:nfer])\n format.html { redirect_to @nfer, notice: 'Nfer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @nfer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @furniture.update(furniture_params)\n format.html { redirect_to @furniture, notice: \"Furniture was successfully updated.\" }\n format.json { render :show, status: :ok, location: @furniture }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @furniture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fishing_method = FishingMethod.find(params[:id])\n\n respond_to do |format|\n if @fishing_method.update_attributes(params[:fishing_method])\n format.html { redirect_to @fishing_method, notice: 'Fishing method was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fishing_method.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fact.update(fact_params)\n format.html { redirect_to @fact, notice: 'Fact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fiction = Fiction.find(params[:id])\n\n respond_to do |format|\n if @fiction.update_attributes(params[:fiction])\n format.html { redirect_to @fiction, notice: 'Fiction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fiction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fondo.update(fondo_params)\n format.html { redirect_to @fondo, notice: 'Fondo was successfully updated.' }\n format.json { render :show, status: :ok, location: @fondo }\n else\n format.html { render :edit }\n format.json { render json: @fondo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n save_relations\n if @ingredient.update(ingredient_params)\n format.html { redirect_to @ingredient.recipe, notice: 'Ingredient was successfully updated.' }\n format.json { render :show, status: :ok, location: @ingredient }\n else\n format.html { render :edit }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fact.update(fact_params)\n format.html { redirect_to :back }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @finance = Finance.find(params[:id])\n\n respond_to do |format|\n if @finance.update_attributes(params[:finance])\n format.html { redirect_to @finance, notice: 'Finance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @finance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @finding_aural = FindingAural.find(params[:id])\n\n respond_to do |format|\n if @finding_aural.update_attributes(params[:finding_aural])\n format.html { redirect_to @finding_aural, notice: 'Finding aural was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @finding_aural.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n @family.slug=nil\n if @family.update(family_params)\n format.html { redirect_to @family, notice: 'La familia fue actualizada exitosamente.' }\n format.json { render :show, status: :ok, location: @family }\n else\n format.html { render :edit }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @feature.update(feature_params)\n @feature.update(publicationState: 'Pendiente')\n format.html { redirect_to user_path(current_user) }\n format.json { render :show, status: :ok, location: @feature }\n else\n format.html { render :edit }\n format.json { render json: @feature.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_nature_financing\n begin\n @nature_financing = current_institute.nature_financings.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n redirect_to nature_financings_path\n end\n end",
"def update\n respond_to do |format|\n if @filing.update(filing_params)\n format.html { redirect_to @filing, notice: 'Filing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @filing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fee = Fee.find(params[:id])\n\n respond_to do |format|\n if @fee.update_attributes(params[:fee])\n format.html { redirect_to fees_path, notice: 'Fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @factoid = Factoid.find(params[:id])\n\n respond_to do |format|\n if @factoid.update_attributes(params[:factoid])\n format.html { redirect_to @factoid, notice: 'Factoid was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @factoid.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @inning = Inning.find(params[:id])\n\n respond_to do |format|\n if @inning.update_attributes(params[:inning])\n format.html { redirect_to @inning, notice: 'Inning was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inning.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @festival = Festival.find(params[:id])\n\n respond_to do |format|\n if @festival.update_attributes(params[:festival])\n format.html { redirect_to @festival, notice: 'Festival was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @festival.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @spoofer = Spoofer.find(params[:id])\n\n respond_to do |format|\n if @spoofer.update_attributes(params[:spoofer])\n format.html { redirect_to @spoofer, notice: 'Spoofer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spoofer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @family.update(family_params)\n format.html { redirect_to @family, notice: 'Family was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @factores_fluctuante.update(factores_fluctuante_params)\n format.html { redirect_to @factores_fluctuante, notice: 'Factores fluctuante was successfully updated.' }\n format.json { render :show, status: :ok, location: @factores_fluctuante }\n else\n format.html { render :edit }\n format.json { render json: @factores_fluctuante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @furniture.update(furniture_params)\n format.html { redirect_to @furniture, notice: 'Furniture Has Been Successfully Updated.' }\n format.json { render :show, status: :ok, location: @furniture }\n else\n format.html { render :edit }\n format.json { render json: @furniture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fee.update(fee_params)\n format.html { redirect_to @fee, notice: 'Fee was successfully updated.' }\n format.json { render :show, status: :ok, location: @fee }\n else\n format.html { render :edit }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fee.update(fee_params)\n format.html { redirect_to @fee, notice: 'Fee was successfully updated.' }\n format.json { render :show, status: :ok, location: @fee }\n else\n format.html { render :edit }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pregnancy.update(pregnancy_params)\n format.html { redirect_to @pregnancy, notice: 'Pregnancy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:fundation][:population_ids] ||= [] \n @fundation = Fundation.find(params[:id])\n\n respond_to do |format|\n if @fundation.update_attributes(params[:fundation])\n format.html { redirect_to(@fundation, :notice => 'Fundation was successfully updated.') }\n format.xml { head :ok }\n format.json { render :json => {:resp => \"ok\"} }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @fundation.errors, :status => :unprocessable_entity }\n format.json { render :json => {:resp => \"error\"} } \n end\n end\n end",
"def update\n respond_to do |format|\n if @fact.update(fact_params)\n format.html { redirect_to @fact, notice: 'Fact was successfully updated.' }\n format.json { render :show, status: :ok, location: @fact }\n else\n format.html { render :edit }\n format.json { render json: @fact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @feeling = Feeling.find(params[:id])\n\n respond_to do |format|\n if @feeling.update_attributes(params[:feeling])\n format.html { redirect_to @feeling, notice: 'Feeling was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feeling.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @family_bond.update(family_bond_params)\n format.html { redirect_to @family_bond, notice: 'Family bond was successfully updated.' }\n format.json { render :show, status: :ok, location: @family_bond }\n else\n format.html { render :edit }\n format.json { render json: @family_bond.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @star_fact = Star::Fact.find(params[:id])\n\n respond_to do |format|\n if @star_fact.update_attributes(params[:star_fact])\n format.html { redirect_to @star_fact, notice: 'Fact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @star_fact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fast_food.update(fast_food_params)\n format.html { redirect_to @fast_food, notice: 'Fast food was successfully updated.' }\n format.json { render :show, status: :ok, location: @fast_food }\n else\n format.html { render :edit }\n format.json { render json: @fast_food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @financer.update(financer_params)\n format.html { redirect_to @financer, notice: 'Financer was successfully updated.' }\n format.json { render :show, status: :ok, location: @financer }\n else\n format.html { render :edit }\n format.json { render json: @financer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fascicle.update(fascicle_params)\n format.html { redirect_to @fascicle, notice: 'Fascicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fascicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fisier.update(fisier_params)\n format.html { redirect_to root_path, notice: 'Fisier was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fisier.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @funding_requirement.update(funding_requirement_params)\n format.html { redirect_to @funding_requirement, notice: 'Funding requirement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @funding_requirement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @feild.update(feild_params)\n format.html { redirect_to @feild, notice: 'Feild was successfully updated.' }\n format.json { render :show, status: :ok, location: @feild }\n else\n format.html { render :edit }\n format.json { render json: @feild.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @financiamento.update(financiamento_params)\n format.html { redirect_to @financiamento, notice: 'Financiamento was successfully updated.' }\n format.json { render :show, status: :ok, location: @financiamento }\n else\n format.html { render :edit }\n format.json { render json: @financiamento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @falta.update(falta_params)\n format.html { redirect_to @falta, notice: \"Falta was successfully updated.\" }\n format.json { render :show, status: :ok, location: @falta }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @falta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @infection.update(infection_params)\n format.html { redirect_to @infection, notice: 'Infection was successfully updated.' }\n format.json { render :show, status: :ok, location: @infection }\n else\n format.html { render :edit }\n format.json { render json: @infection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @financing_item.update(financing_item_params)\n format.html { redirect_to @financing_item, notice: 'Financing item was successfully updated.' }\n format.json { render :show, status: :ok, location: @financing_item }\n else\n format.html { render :edit }\n format.json { render json: @financing_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sub_family.update(sub_family_params)\n format.html { redirect_to @sub_family, notice: 'Sub família foi atualizada.' }\n format.json { render :show, status: :ok, location: @sub_family }\n else\n format.html { render :edit }\n format.json { render json: @sub_family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fat.update(fat_params)\n format.html { redirect_to @fat, notice: 'Fat was successfully updated.' }\n format.json { render :show, status: :ok, location: @fat }\n else\n format.html { render :edit }\n format.json { render json: @fat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@klass_fee = KlassFee.find(params[:id])\n\n respond_to do |format|\n if @klass_fee.update_attributes(params[:klass_fee])\n format.html { redirect_to klass_klass_fees_path(@klass), notice: 'Klass fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @klass_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @meal = @meal_recipe.meal\n @meal_plan = @meal.day.meal_plan\n @leftover = Leftover.meal_recipe(@meal_recipe).first\n @meal_ingredient = MealIngredient.new\n\n respond_to do |format|\n if params[:meal_recipe][:multiply].present?\n multiply_portions_and_ingredients(params[:meal_recipe][:multiply].to_d)\n end\n\n if params[:meal_recipe][:add].present?\n # @meal_recipe = MealRecipe.find(params[:id])\n @portions = @meal_recipe.portions\n ratio_increase = 1 + 1/@portions\n multiply_portions_and_ingredients(ratio_increase)\n end\n\n \n if @meal_recipe.update(meal_recipe_params)\n format.turbo_stream\n format.html { redirect_to @meal_recipe, notice: \"Meal recipe was successfully updated.\" }\n format.json { render :show, status: :ok, location: @meal_recipe }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @meal_recipe.errors, status: :unprocessable_entity }\n end\n \n end\n end",
"def update\n @frais_annex = FraisAnnex.find(params[:id])\n\n respond_to do |format|\n if @frais_annex.update_attributes(params[:frais_annex])\n format.html { redirect_to @frais_annex, :notice => 'Le frais annexe a bien été modifié' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @frais_annex.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @contractor_feature = ContractorFeature.find(params[:id])\n\n respond_to do |format|\n if @contractor_feature.update_attributes(params[:contractor_feature])\n format.html { redirect_to @contractor_feature, notice: 'Contractor feature was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contractor_feature.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fact = Fact.find(fact_params)\n\n respond_to do |format|\n if @fact.update_attributes(fact_params)\n format.html { redirect_to @fact, notice: 'Fact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @auction_foregift.update(auction_foregift_params)\n format.html { redirect_to @auction_foregift, notice: 'Auction foregift was successfully updated.' }\n format.json { render :show, status: :ok, location: @auction_foregift }\n else\n format.html { render :edit }\n format.json { render json: @auction_foregift.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @finantial_product.update(finantial_product_params)\n format.html { redirect_to @finantial_product, notice: \"Finantial product was successfully updated.\" }\n format.json { render :show, status: :ok, location: @finantial_product }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @finantial_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @taxon_determination.update(taxon_determination_params)\n format.html { redirect_to @taxon_determination, notice: 'Taxon determination was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @taxon_determination.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @facture.update(facture_params)\n format.html { redirect_to @facture, notice: 'Facture was successfully updated.' }\n format.json { render :show, status: :ok, location: @facture }\n else\n format.html { render :edit }\n format.json { render json: @facture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @festival.update(festival_params)\n format.html { redirect_to @festival, notice: 'Festival was successfully updated.' }\n format.json { render :show, status: :ok, location: @festival }\n else\n format.html { render :edit }\n format.json { render json: @festival.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ingredient = Ingredient.find(params[:id])\n\n respond_to do |format|\n if @ingredient.update_attributes(params[:ingredient])\n format.html { redirect_to @ingredient, notice: 'Ingredient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n recipe.update(recipe_params)\n render json: recipe\n end",
"def update\n respond_to do |format|\n if @ingredients_nutrient.update(ingredients_nutrient_params)\n format.html { redirect_to @ingredients_nutrient, notice: 'Ingredients nutrient was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ingredients_nutrient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n @franchise = @franchise_set.franchises.find(params[:id])\n\n respond_to do |format|\n franchise_set = FranchiseSet.find(params[:franchise_set_id])\n if @franchise.update_attributes(params[:franchise])\n format.html { redirect_to \"/franchise_sets/#{franchise_set.id}/edit\" , notice: 'Franchise was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @franchise.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pronunciation = Pronunciation.find(params[:id])\n @pronunciation.update_attributes(params[:pronunciation])\n respond_with @definition\n end",
"def update\n respond_to do |format|\n @person = @profissional.person\n if @person.update(profissional_params[:person_attributes])\n if profissional_params[:specialization].present?\n @profissional.update_attributes(:specialization => profissional_params[:specialization])\n format.html { redirect_to @profissional, notice: 'Profissional was successfully updated.' }\n format.json { render :show, status: :ok, location: @profissional }\n else\n format.html { render :edit }\n format.json { render json: @profissional.errors, status: :unprocessable_entity }\n end\n\n end\n end\n end",
"def update\n respond_to do |format|\n if @family_relationship.update(family_relationship_params)\n format.html { redirect_to @family_relationship, notice: 'Family relationship was successfully updated.' }\n format.json { render :show, status: :ok, location: @family_relationship }\n else\n format.html { render :edit }\n format.json { render json: @family_relationship.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @familium = Familium.find(params[:id])\n\n respond_to do |format|\n if @familium.update_attributes(params[:familium])\n format.html { redirect_to @familium, notice: 'Familia fue actualizada existosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @familium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @food_expenditure.update(food_expenditure_params)\n @food_expenditure.update_attributes(:edit_able=>false)\n format.html { redirect_to @food_expenditure, notice: 'FoodExpenditure was successfully updated.' }\n format.json { render :show, status: :ok, location: @food_expenditure }\n else\n format.html { render :edit }\n format.json { render json: @food_expenditure.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @family.update(family_params)\r\n format.html { redirect_to @family, notice: 'Family was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @family }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @family.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @recipe = Recipe.find(params[:id])\n @recipe.ingrediences = Ingredience.find(params[:ingredience_ids]) if params[:ingredience_ids] \n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n flash[:notice] = 'Recipe was successfully updated.'\n format.html { redirect_to(@recipe) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @recipe.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def nature_financing_params\n params.require(:nature_financing).permit(:title, :description, :institute_id)\n end",
"def update\n respond_to do |format|\n if @budget_file.update(budget_file_params)\n #if @revenue.update(revenue_params.merge({:tree_info => tree_info, :rows => rows}))\n # @budget_file.taxonomy.explanation = explanation\n # @budget_file.taxonomy.save\n\n format.html { redirect_to @budget_file, notice: t('budget_files_controller.save') }\n format.json { render :show, status: :ok, location: @budget_file }\n else\n format.html { render :edit }\n format.json { render json: @budget_file.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def update\n @membership_fee = MembershipFee.find(params[:id])\n\n respond_to do |format|\n if @membership_fee.update_attributes(params[:membership_fee])\n format.html { redirect_to @membership_fee, notice: 'Membership fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @membership_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @infraction.update(infraction_params)\n format.html { redirect_to @infraction, notice: 'Infraction was successfully updated.' }\n format.json { render :show, status: :ok, location: @infraction }\n else\n format.html { render :edit }\n format.json { render json: @infraction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ingredient.update(ingredient_params)\n format.html { redirect_to @ingredient, notice: 'Ingredient was successfully updated.' }\n format.json { render :show, status: :ok, location: @ingredient }\n else\n format.html { render :edit }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @food = Food.find(params[:id])\n\n respond_to do |format|\n if @food.update_attributes(params[:food])\n format.html { redirect_to foods_path(), notice: 'Food was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @foam = Foam.find(params[:id])\n\n respond_to do |format|\n if @foam.update_attributes(params[:foam])\n format.html { redirect_to @foam, notice: 'Foam was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @foam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @food = Food.find(params[:id])\n\n respond_to do |format|\n if @food.update_attributes(params[:food])\n format.html { redirect_to @food, notice: \"Piatto aggiornato correttamente.\" }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @future_recipe.update(future_recipe_params)\n format.html { redirect_to @future_recipe, notice: 'Future link was successfully updated.' }\n format.json { render :show, status: :ok, location: @future_recipe }\n else\n format.html { render :edit }\n format.json { render json: @future_recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end",
"def update\n respond_to do |format|\n if @finance.update(finance_params)\n format.html { redirect_to @finance, notice: 'Finance was successfully updated.' }\n format.json { render :show, status: :ok, location: @finance }\n else\n format.html { render :edit }\n format.json { render json: @finance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @featuring.update(featuring_params)\n format.html { redirect_to @featuring, notice: 'Featuring was successfully updated.' }\n format.json { render :show, status: :ok, location: @featuring }\n else\n format.html { render :edit }\n format.json { render json: @featuring.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n calculate_nutrients \n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @facult.update(facult_params)\n format.html { redirect_to @facult, notice: 'Facult was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @facult.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @favourite_food = FavouriteFood.find(params[:id])\n\n respond_to do |format|\n if @favourite_food.update_attributes(params[:favourite_food])\n format.html { redirect_to @favourite_food, notice: 'Favourite food was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @favourite_food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @finnancial_product_type.update(finnancial_product_type_params)\n format.html { redirect_to @finnancial_product_type, notice: 'Finnancial product type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @finnancial_product_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fridge = Fridge.find(params[:id])\n\n respond_to do |format|\n if @fridge.update_attributes(params[:fridge])\n format.html { redirect_to @fridge, notice: 'Fridge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fridge.errors, status: :unprocessable_entity }\n end\n end\n end",
"def restobooking\n @buchung = Buchung.find(params[:id])\n @buchung.status='B' \n \n respond_to do |format|\n if @buchung.update_attributes(params[:buchung])\n format.html { redirect_to @buchung, notice: 'Buchung wurde erfolgreich geaendert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @buchung.errors, status: :unprocessable_entity }\n end\n end \n end",
"def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @thirtyfife.update(thirtyfife_params)\n format.html { redirect_to @thirtyfife, notice: 'Thirtyfive was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @thirtyfife.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @beef.update(beef_params)\n format.html { redirect_to @beef, notice: 'Beef was successfully updated.' }\n format.json { render :show, status: :ok, location: @beef }\n else\n format.html { render :edit }\n format.json { render json: @beef.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fabricsofaset.update(fabricsofaset_params)\n format.html { redirect_to @fabricsofaset, notice: 'Fabricsofaset was successfully updated.' }\n format.json { render :show, status: :ok, location: @fabricsofaset }\n else\n format.html { render :edit }\n format.json { render json: @fabricsofaset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n puts \"update #{@feeling.as_json} #{updated_params.as_json}\"\n respond_to do |format|\n if @feeling.update(updated_params)\n puts \"brucep update success\"\n #format.html { redirect_to @feeling, notice: 'Feeling was successfully updated.' }\n format.html { redirect_to new_feeling_path }\n format.json { render :show, status: :ok, location: @feeling }\n #format.js\n else\n format.html { render :edit }\n format.json { render json: @feeling.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.68497854",
"0.6820507",
"0.61943775",
"0.61264604",
"0.6111212",
"0.6064038",
"0.60610753",
"0.60450727",
"0.60300046",
"0.60036325",
"0.5999813",
"0.5993303",
"0.5987237",
"0.5986764",
"0.5986676",
"0.59830415",
"0.59792536",
"0.5975104",
"0.5968804",
"0.59637606",
"0.5962685",
"0.59620434",
"0.5956249",
"0.5947189",
"0.5938489",
"0.59328365",
"0.59293556",
"0.59197336",
"0.591931",
"0.5906958",
"0.59000725",
"0.58992285",
"0.58966404",
"0.5895476",
"0.58918756",
"0.58858067",
"0.58846945",
"0.58846945",
"0.5882669",
"0.5880653",
"0.58716446",
"0.58612293",
"0.5860969",
"0.585823",
"0.5845749",
"0.58437306",
"0.58428985",
"0.58370334",
"0.58361197",
"0.58359957",
"0.5833262",
"0.58223563",
"0.58190846",
"0.58172846",
"0.5815708",
"0.58134943",
"0.580575",
"0.5802129",
"0.57967263",
"0.5795983",
"0.57869965",
"0.578578",
"0.57827044",
"0.57794863",
"0.57710344",
"0.57705957",
"0.57647675",
"0.5760178",
"0.57596654",
"0.5756274",
"0.5754742",
"0.5754153",
"0.5752254",
"0.5750221",
"0.5747672",
"0.57467616",
"0.574563",
"0.5744869",
"0.5744147",
"0.5742424",
"0.5742062",
"0.57409537",
"0.57404476",
"0.57361436",
"0.5735324",
"0.57314384",
"0.57310295",
"0.5730881",
"0.5724156",
"0.57187766",
"0.57175577",
"0.5717023",
"0.5715177",
"0.57124907",
"0.5711938",
"0.57088464",
"0.5707334",
"0.57048756",
"0.5704693",
"0.5703577"
] |
0.7074337
|
0
|
DELETE /nature_financings/1 DELETE /nature_financings/1.json
|
def destroy
@nature_financing.destroy
respond_to do |format|
format.html { redirect_to nature_financings_url, notice: 'Nature financing was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end",
"def destroy\n @socio_doc_fiscais_coring.destroy\n respond_to do |format|\n format.html { redirect_to socio_doc_fiscais_corings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foiltype = Foiltype.find(params[:id])\n @foiltype.destroy\n\n respond_to do |format|\n format.html { redirect_to foiltypes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @personal_finance.destroy\n respond_to do |format|\n format.html { redirect_to personal_finances_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inhabitant = Inhabitant.find_by_id(params[:id])\n @inhabitant.destroy\n\n respond_to do |format|\n format.html { redirect_to inhabitants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @taxon_determination.destroy\n respond_to do |format|\n format.html { redirect_to taxon_determinations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foil = Foil.find(params[:id])\n @foil.destroy\n\n respond_to do |format|\n format.html { redirect_to foils_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @forest = Forest.find(params[:id])\n @forest.destroy\n\n respond_to do |format|\n format.html { redirect_to forests_url }\n format.json { head :no_content }\n end\n end",
"def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end",
"def destroy\n @forest.destroy\n respond_to do |format|\n format.html { redirect_to forests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @festival = Festival.find(params[:id])\n @festival.destroy\n\n respond_to do |format|\n format.html { redirect_to festivals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @futbolada = Futbolada.find(params[:id])\n @futbolada.destroy\n\n respond_to do |format|\n format.html { redirect_to gestion_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @factura = Factura.find(params[:factura_id])\n @renglon_factura = @factura.renglon_facturas.find(params[:id]).destroy\n\n respond_to do |format|\n format.html { head :ok }\n #format.json { head :ok }\n end\n end",
"def destroy\n @fascicle.destroy\n respond_to do |format|\n format.html { redirect_to fascicles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foaf.destroy\n\n respond_to do |format|\n format.html { redirect_to foafs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foaf.destroy\n\n respond_to do |format|\n format.html { redirect_to foafs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @finance_inflow = FinanceInflow.find(params[:id])\n @finance_inflow.destroy\n\n respond_to do |format|\n format.html { redirect_to finance_inflows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @familium = Familium.find(params[:id])\n @familium.destroy\n\n respond_to do |format|\n format.html { redirect_to familia_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @habitant.destroy\n respond_to do |format|\n format.html { redirect_to habitants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @finance = Finance.find(params[:id])\n @finance.destroy\n\n respond_to do |format|\n format.html { redirect_to finances_url }\n format.json { head :no_content }\n end\n end",
"def destroy \n @franchise = @franchise_set.franchises.find(params[:id])\n @franchise.destroy\n\n # respond_to do |format| \n # format.html { redirect_to \"/franchise_sets/#{franchise_set.id}/edit\" }\n # format.json { head :ok }\n # end\n \n respond_to do |format|\n format.json {head :ok}\n end\n \n end",
"def destroy\n @nail_salon = NailSalon.find(params[:id])\n @nail_salon.destroy\n\n respond_to do |format|\n format.html { redirect_to nail_salons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n franchise.destroy\n\n respond_to do |format|\n format.html { redirect_to franchises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inning = Inning.find(params[:id])\n @inning.destroy\n\n respond_to do |format|\n format.html { redirect_to innings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @institucional = Institucional.find(params[:id])\n @institucional.destroy\n\n respond_to do |format|\n format.html { redirect_to institucionals_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @filing.destroy\n respond_to do |format|\n format.html { redirect_to filings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @finding_aural = FindingAural.find(params[:id])\n @finding_aural.destroy\n\n respond_to do |format|\n format.html { redirect_to finding_aurals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fiction = Fiction.find(params[:id])\n @fiction.destroy\n\n respond_to do |format|\n format.html { redirect_to fiction_index_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @historic_refinancing.destroy\n respond_to do |format|\n format.html { redirect_to historic_refinancings_url, notice: 'Historic refinancing was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @frais_annex = FraisAnnex.find(params[:id])\n @frais_annex.destroy\n\n respond_to do |format|\n format.html { redirect_to frais_annexes_url }\n format.json { head :no_content }\n end\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 @nfer = Nfer.find(params[:id])\n @nfer.destroy\n\n respond_to do |format|\n format.html { redirect_to nfers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @furniture.destroy\n respond_to do |format|\n format.html { redirect_to furnitures_url, notice: 'Furniture Has Been Successfully Deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @occasion = Occasion.find(params[:id])\n @occasion.destroy\n\n respond_to do |format|\n format.html { redirect_to occasions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@klass_fee = KlassFee.find(params[:id])\n #@klass_fee.destroy\n\n respond_to do |format|\n format.html { redirect_to klass_fees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @plantation.destroy\n respond_to do |format|\n format.html { redirect_to farm_plantations_url(@farm), notice: 'Plantation enlevée.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @facture.destroy\n respond_to do |format|\n format.html { redirect_to factures_url, notice: 'La facture a bien été supprimée.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @campus_food = CampusFood.find(params[:id])\n @campus_food.destroy\n\n respond_to do |format|\n format.html { redirect_to campus_foods_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @fishing_method = FishingMethod.find(params[:id])\n @fishing_method.destroy\n\n respond_to do |format|\n format.html { redirect_to fishing_methods_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @budgeting_type = BudgetingType.find(params[:id])\n @budgeting_type.destroy\n\n respond_to do |format|\n format.html { redirect_to budgeting_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @facult.destroy\n respond_to do |format|\n format.html { redirect_to facults_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @situation = Situation.find(params[:id])\n @situation.destroy\n\n respond_to do |format|\n format.html { redirect_to situations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @situation = Situation.find(params[:id])\n @situation.destroy\n\n respond_to do |format|\n format.html { redirect_to situations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @frais_hebergement = FraisHebergement.find(params[:id])\n @frais_hebergement.destroy\n\n respond_to do |format|\n format.html { redirect_to frais_hebergements_url }\n format.json { head :no_content }\n end\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 @bonificacionfact.destroy\n respond_to do |format|\n format.html { redirect_to bonificacionfacts_url, notice: 'Bonificacionfact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expensesbasis.destroy\n respond_to do |format|\n format.html { redirect_to [@post, @expensesbasis], notice: 'Expensesbase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @life_insurance.destroy\n\n respond_to do |format|\n format.html { redirect_to life_insurances_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @food.destroy\n @food.image.destroy\n @j = Joint.where(food_id: @food.id)\n if @j == true\n @j.destroy_all\n end\n respond_to do |format|\n format.html { redirect_to foods_url, notice: 'Food was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @historial = Historial.find(params[:id])\n @historial.destroy\n\n respond_to do |format|\n format.html { redirect_to historials_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @facture.destroy\n respond_to do |format|\n format.html { redirect_to factures_url, success: 'Votre facture a été supprimé avec succès!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fondo.destroy\n respond_to do |format|\n format.html { redirect_to fondos_url, notice: 'Fondo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ingredients_nutrient.destroy\n respond_to do |format|\n format.html { redirect_to ingredients_nutrients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fisier.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fee = Fee.find(params[:id])\n @fee.destroy\n\n respond_to do |format|\n format.html { redirect_to fees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @life_insurance.destroy\n respond_to do |format|\n format.html { redirect_to life_insurances_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @furniture.destroy\n respond_to do |format|\n format.html { redirect_to furnitures_url, notice: \"Furniture was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @infraction.destroy\n respond_to do |format|\n format.html { redirect_to infractions_url, notice: 'Infraction 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 @interest = Interest.find(params[:id])\n @interest.destroy\n\n respond_to do |format|\n format.json { head :ok }\n end \n end",
"def destroy\n @favourite_food = FavouriteFood.find(params[:id])\n @favourite_food.destroy\n\n respond_to do |format|\n format.html { redirect_to favourite_foods_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 delete\n supprimer = SondageService.instance.supprimerSondage(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\nend",
"def borrar \n\n fiesta.destroy\n render json: fiesta \n end",
"def destroy\n @frat.destroy\n respond_to do |format|\n format.html { redirect_to frats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @occupant = Occupant.find(params[:id])\n @occupant.destroy\n\n respond_to do |format|\n format.html { redirect_to occupants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @infection.destroy\n respond_to do |format|\n format.html { redirect_to infections_url, notice: 'Infection was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fiestum.destroy\n respond_to do |format|\n format.html { redirect_to fiesta_url, notice: 'Fiestum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @factura = Factura.find(params[:id])\n if @factura.destroy\n respond_to do |format|\n format.html { head :ok }\n format.json { head :ok }\n end\n else\n respond_to do |format|\n format.json { render json: @factura.errors }\n end\n end\n\n \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 @financing_item.destroy\n respond_to do |format|\n format.html { redirect_to financing_items_url, notice: 'Financing item was successfully destroyed.' }\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 @fridge_food = FridgeFood.find(params[:id])\n @fridge_food.destroy\n\n respond_to do |format|\n format.html { redirect_to(fridge_foods_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @flat_happening = FlatHappening.find(params[:id])\n @flat_happening.destroy\n\n head :no_content\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 delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @baton = Baton.find(params[:id])\n @baton.destroy\n\n respond_to do |format|\n format.html { redirect_to batons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @indicator_federation.destroy\n respond_to do |format|\n format.html { redirect_to @indicator_federation.indicator}\n format.json { head :no_content }\n end\n end",
"def destroy\n @taxon = Taxon.find(params[:id])\n @taxon.destroy\n\n respond_to do |format|\n format.html { redirect_to taxons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @financial_donation = FinancialDonation.find(params[:id])\n @financial_donation.destroy\n\n respond_to do |format|\n format.html { redirect_to financial_donations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ingredient = Ingredient.find(params[:id])\n @ingredient.destroy\n\n respond_to do |format|\n format.html { redirect_to ingredients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @barrels_income.destroy\n respond_to do |format|\n format.html { redirect_to barrels_incomes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @four.destroy\n respond_to do |format|\n format.html { redirect_to fours_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fast_food.destroy\n respond_to do |format|\n format.html { redirect_to fast_foods_url, notice: 'Fast food was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @featuring.destroy\n respond_to do |format|\n format.html { redirect_to featuring_index_url, notice: 'Featuring was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crime_thief.destroy\n respond_to do |format|\n format.html { redirect_to crime_thiefs_url, notice: 'Procedimiento eliminado con éxito.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @firend_relationship.destroy\n respond_to do |format|\n format.html { redirect_to user_firend_relationships_url, notice: 'Firend relationship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manage_nourish.destroy\n respond_to do |format|\n format.html { redirect_to manage_nourishes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @festival.destroy\n respond_to do |format|\n format.html { redirect_to festivals_url, notice: 'Festival was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fish_type = FishType.find(params[:id])\n @fish_type.destroy\n\n respond_to do |format|\n format.html { redirect_to fish_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foam = Foam.find(params[:id])\n @foam.destroy\n\n respond_to do |format|\n format.html { redirect_to foams_url }\n format.json { head :ok }\n end\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end",
"def destroy\n @taxon = Taxon.find(params[:id])\n @taxon.destroy\n\n respond_to do |format|\n format.html { redirect_to taxons_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @raw_food.destroy\n respond_to do |format|\n format.html { redirect_to raw_foods_url, notice: 'Raw food was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ninja = Ninja.find(params[:id])\n @ninja.destroy\n\n respond_to do |format|\n format.html { redirect_to ninjas_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.6873725",
"0.6706721",
"0.67030793",
"0.6683761",
"0.6608549",
"0.65908784",
"0.65865266",
"0.6575249",
"0.65596765",
"0.6547893",
"0.6520962",
"0.65199906",
"0.6508244",
"0.6507091",
"0.6505291",
"0.6505291",
"0.65048474",
"0.6492816",
"0.6486912",
"0.64862823",
"0.6481518",
"0.6479189",
"0.64774436",
"0.64667076",
"0.6466332",
"0.6461061",
"0.64570755",
"0.64468926",
"0.64395565",
"0.64315283",
"0.6426671",
"0.64255166",
"0.64252675",
"0.64204055",
"0.6417631",
"0.64134777",
"0.64080757",
"0.64061266",
"0.6406126",
"0.6404246",
"0.64005977",
"0.63971",
"0.6390038",
"0.6386624",
"0.6386624",
"0.6386492",
"0.6386492",
"0.63848805",
"0.63836473",
"0.63810974",
"0.63782",
"0.63760316",
"0.63751394",
"0.6373978",
"0.63721937",
"0.6363467",
"0.63632727",
"0.63630694",
"0.63615495",
"0.635355",
"0.6346558",
"0.6337145",
"0.6334788",
"0.6330162",
"0.632804",
"0.6324778",
"0.6323817",
"0.6323628",
"0.6322872",
"0.63215095",
"0.6318948",
"0.6317089",
"0.631695",
"0.63165724",
"0.6314068",
"0.63127124",
"0.6309069",
"0.63075286",
"0.63045245",
"0.63045245",
"0.6301673",
"0.630051",
"0.62995535",
"0.6298653",
"0.6298649",
"0.6298505",
"0.62922597",
"0.62917805",
"0.6290227",
"0.6286161",
"0.6285707",
"0.6284047",
"0.6281531",
"0.6280865",
"0.6280048",
"0.62795997",
"0.6278965",
"0.62779707",
"0.62757605",
"0.6275132"
] |
0.7301639
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_nature_financing
begin
@nature_financing = current_institute.nature_financings.find(params[:id])
rescue ActiveRecord::RecordNotFound
redirect_to nature_financings_path
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def nature_financing_params
params.require(:nature_financing).permit(:title, :description, :institute_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 valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def backend_user_params\n params.permit!\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.6981269",
"0.6783559",
"0.6746007",
"0.67423046",
"0.6735905",
"0.6593568",
"0.6504213",
"0.649792",
"0.6482664",
"0.6478558",
"0.64566684",
"0.64392304",
"0.6380194",
"0.6376366",
"0.636562",
"0.63208145",
"0.63006365",
"0.63001287",
"0.6292953",
"0.62927175",
"0.62911004",
"0.6290563",
"0.6284484",
"0.62436926",
"0.6239928",
"0.62184125",
"0.62158304",
"0.6210187",
"0.6194002",
"0.61786795",
"0.61759156",
"0.617342",
"0.6162248",
"0.61528504",
"0.61527",
"0.6146735",
"0.6122714",
"0.61169004",
"0.61082125",
"0.61052656",
"0.6091036",
"0.60807735",
"0.6070328",
"0.60634184",
"0.60213035",
"0.6017676",
"0.6013606",
"0.601112",
"0.6007318",
"0.6007318",
"0.6001461",
"0.6001135",
"0.59966296",
"0.5992013",
"0.59919006",
"0.599182",
"0.5980991",
"0.59676576",
"0.5960269",
"0.59588194",
"0.59585214",
"0.59578323",
"0.5953503",
"0.5952524",
"0.59432703",
"0.5939858",
"0.59388995",
"0.59388995",
"0.5933866",
"0.5930038",
"0.5925672",
"0.5924214",
"0.59169805",
"0.59106255",
"0.5910254",
"0.59086037",
"0.5906149",
"0.5898294",
"0.58981514",
"0.5896171",
"0.58944154",
"0.58943397",
"0.5892325",
"0.5887239",
"0.58842856",
"0.5880209",
"0.5874584",
"0.58694917",
"0.5868719",
"0.58669394",
"0.5866552",
"0.58662945",
"0.5864085",
"0.58623236",
"0.5862258",
"0.58597904",
"0.58579135",
"0.58542645",
"0.5853335",
"0.58517563",
"0.5850614"
] |
0.0
|
-1
|
GET /inventory_snapshot_contents GET /inventory_snapshot_contents.json
|
def index
@inventory_snapshot_contents = InventorySnapshotContent.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def snapshot\n begin\n response = resource[\"/snapshot/#{app}\"].post(nil)\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end",
"def set_inventory_snapshot_content\n @inventory_snapshot_content = InventorySnapshotContent.find(params[:id])\n end",
"def index\n @snapshots = current_account.snapshots.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @snapshots }\n end\n end",
"def get_snapshots\n ensure_uri && ensure_client\n uri = \"#{@data['uri']}/snapshots\"\n self.class.find_with_pagination(@client, uri)\n end",
"def get(params = {})\n # Set snapshot name or we'll get the repository instead\n snapshot = name || \"_all\"\n response = client.get \"/_snapshot/{repository}/{snapshot}\", update_params(params, snapshot: snapshot, action: \"snapshot.get\", rest_api: \"snapshot.get\")\n response.body\n end",
"def available_snapshots\n snapshot_info = `#{config[:path]} --json snapshots`\n JSON.parse(snapshot_info, { symbolize_names: true })\n end",
"def snapshots\n unless @vm.exists?\n return Response.new :code => 1, :message => 'VM does not exist'\n end\n\n conf_file_response = @vm.conf_file\n return conf_file_response unless conf_file_response.successful?\n\n command = \"#{vmrun_cmd} listSnapshots \"\n command << \"'#{conf_file_response.data}' 2>&1\"\n\n command_exec = Fission::Action::ShellExecutor.new command\n result = command_exec.execute\n\n response = Response.new :code => result['process_status'].exitstatus\n\n if response.successful?\n response.data = parse_snapshot_names_from_output result['output']\n else\n response.message = result['output']\n end\n\n response\n end",
"def getSnapshots()\n\t\tsnaps = JSON.parse(RestClient.get(\"https://#{Cbthelper.username}:#{Cbthelper.authkey}@crossbrowsertesting.com/api/v3/selenium/#{@testId}/snapshots/\"))\t\n\t\tret = []\n\n\t\tfor snap in snaps\n\t\t\tret.push(Snapshot.new(snap[\"hash\"], @testId))\n\n\t\tend\n\t\treturn ret\n\tend",
"def new\n @snapshot = current_account.snapshots.new\n @volumes = current_account.volumes\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @snapshot }\n end\n end",
"def show\n @stashed_inventory = StashedInventory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stashed_inventory }\n end\n end",
"def snapshots\n unless exists?\n return Response.new :code => 1, :message => 'VM does not exist'\n end\n\n conf_file_response = conf_file\n return conf_file_response unless conf_file_response.successful?\n\n command = \"#{vmrun_cmd} listSnapshots \"\n command << \"#{conf_file_response.data} 2>&1\"\n output = `#{command}`\n\n response = Response.new :code => $?.exitstatus\n\n if response.successful?\n snaps = output.split(\"\\n\").select { |s| !s.include? 'Total snapshots:' }\n response.data = snaps.map { |s| s.strip }\n else\n response.message = output\n end\n\n response\n end",
"def snapshots\n client = Aws::EC2::Client.new\n client.describe_snapshots({\n filters: [{\n name: \"tag:type\",\n values: [\"auto\"]\n }]\n }).snapshots\nend",
"def update\n respond_to do |format|\n if @inventory_snapshot_content.update(inventory_snapshot_content_params)\n format.html { redirect_to @inventory_snapshot_content, notice: 'Inventory snapshot content was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventory_snapshot_content }\n else\n format.html { render :edit }\n format.json { render json: @inventory_snapshot_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def enrollment_snapshots(params = {})\n snapshot_id = params.delete :snapshot_id\n\n response =\n default_scope.get(\"enrollment/snapshot\" + (snapshot_id ? \"/#{snapshot_id}\" : '')) do |request|\n request.params = params\n end\n JSON.parse(response.body)\n end",
"def enrollment_snapshot_data(params = {})\n scope 'default'\n get(\"enrollment/snapshot/#{params[:snapshot_id]}/data\")\n end",
"def create\n\n @inventory_snapshot_content = InventorySnapshotContent.new(inventory_snapshot_content_params)\n\n respond_to do |format|\n if @inventory_snapshot_content.save\n format.html { redirect_to @inventory_snapshot_content, notice: 'Inventory snapshot content was successfully created.' }\n format.json { render :show, status: :created, location: @inventory_snapshot_content }\n else\n format.html { render :new }\n format.json { render json: @inventory_snapshot_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def fetch_snapshots\n @snapshots = ::Refinery::Snapshots::Snapshot.all\n end",
"def snapshot\n @agent = Agent.find(:first,\n :include => { :user => :user_icons },\n :conditions => { :id => params[:id] }\n )\n\n respond_to do |format|\n format.html { render :layout => nil }\n format.xml { render :xml => @agent }\n end\n end",
"def inventory_snapshot_content_params\n params.require(:inventory_snapshot_content).permit(:inventory_snapshot_id, :rfid_hardware_id, :trackable_id)\n end",
"def show\n @inventory_entry = InventoryEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inventory_entry }\n end\n end",
"def show\n respond_to do |f| \n f.json {\n render :json => { \n :activity_log => @activity_log,\n :snapshots => @activity_log.snapshots.order(\"id ASC\")\n }\n }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @snapshot }\n end\n end",
"def snapshots\n raise Fission::Error,\"VM #{@name} does not exist\" unless self.exists?\n\n command = \"#{vmrun_cmd} listSnapshots #{vmx_path.shellescape} 2>&1\"\n output = `#{command}`\n\n raise \"There was an error listing the snapshots of #{@name} :\\n #{output}\" unless $?.exitstatus==0\n\n snaps_unfiltered = output.split(\"\\n\").select { |s| !s.include? 'Total snapshots:' }\n snaps=snaps_unfiltered.map { |s| s.strip }\n return snaps\n end",
"def show\n repo = assets_repo\n @v_asset = repo.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @v_asset }\n end\n end",
"def list_instance_snapshots(rds_resource)\n instance_snapshots = []\n rds_resource.db_snapshots.each do |s|\n instance_snapshots.append({\n \"id\": s.snapshot_id,\n \"status\": s.status\n })\n end\n instance_snapshots\nrescue Aws::Errors::ServiceError => e\n puts \"Couldn't list instance snapshots:\\n #{e.message}\"\nend",
"def snapshots\n Fission::Action::Snapshot::Lister.new(self).snapshots\n end",
"def create\n @snapshot = current_account.snapshots.new(params[:snapshot])\n\n respond_to do |format|\n if @snapshot.save\n flash[:notice] = 'Snapshot was successfully created.'\n format.html { redirect_to(@snapshot) }\n format.xml { render :xml => @snapshot, :status => :created, :location => @snapshot }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @snapshot.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_snapshot(aws_id,commit_state)\n params = {:aws_id => aws_id, :commit_state => commit_state, :api_version => 1.0 }\n json=nil\n SystemTimer.timeout_after(@api_snap_timeout) do\n body = RestClient.put @api_url+\"/update_ebs_snapshot.js\",params\n puts \"UPDATED SNAP: #{aws_id}\"\n end\n json \n rescue Exception => e\n display_exception(e, \"update_snapshot(#{aws_id}, #{commit_state})\")\n end",
"def list_snapshots\n snaps = execute(:list_snapshots, VmID: vm_id)\n snaps.map { |s| s['Name'] }\n end",
"def index\n @inventory_files = InventoryFile.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @inventory_files }\n end\n end",
"def list_snapshot(regex = '.*')\n @admin.listSnapshots(Pattern.compile(regex)).to_a\n end",
"def show\n @inventories = @inventory_file.inventories.page(params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def get_virtualization_vmware_virtual_machine_snapshot_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VirtualizationApi.get_virtualization_vmware_virtual_machine_snapshot_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/virtualization/VmwareVirtualMachineSnapshots'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].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', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\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] || 'VirtualizationVmwareVirtualMachineSnapshotResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"VirtualizationApi.get_virtualization_vmware_virtual_machine_snapshot_list\",\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: VirtualizationApi#get_virtualization_vmware_virtual_machine_snapshot_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def list_snapshots(**options)\n Terminal.list_snapshots(@user_token, @access_token, **options)\n end",
"def snapshot()\n puts \"TODO\"\n end",
"def snapshot\r\n date = self.class.service_instance.snapshot_blob(self.path)\r\n properties = self.class.service_instance.get_blob_properties(self.path)\r\n return BlobObject.new(:name => self.name, \r\n :url => self.class.service_instance.generate_request_uri(self.path) + \"?snapshot=#{date}\",\r\n :content_type => properties[:content_type],\r\n :snapshot_date => date)\r\n end",
"def show\n @inventoryitem = Inventoryitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inventoryitem }\n end\n end",
"def list_snapshots\n @s3.buckets[@snapshot_bucket].objects.with_prefix(@prefix).to_a\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inventory_file }\n format.download {\n send_file @inventory_file.inventory.download,\n filename: @inventory_file.inventory_filename,\n type: 'application/octet-stream'\n }\n end\n end",
"def show\n @asset_allocation_history = AssetAllocationHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asset_allocation_history }\n end\n end",
"def show\n @revision = Revision.find(params[:id])\n\n render json: @revision\n end",
"def status(params = {})\n response = client.get \"/_snapshot{/repository}{/snapshot}/_status\", update_params(params, action: \"snapshot.status\", rest_api: \"snapshot.status\")\n response.body\n end",
"def new\n @stashed_inventory = StashedInventory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stashed_inventory }\n end\n end",
"def index\n @releases = @environment.releases.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @releases }\n end\n end",
"def snapshot(snapshot_id)\n snapshots(snapshot_id)[0]\n end",
"def show\n @inventory_item = InventoryItem.find(params[:id])\n \n authorize! :read, @inventory_item\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inventory_item }\n end\n end",
"def index\n @artifacts = Artifact.all\n end",
"def index\n authorize! :read, @binder\n \n initialize_uploader(current_user.id, @binder.id, 'inventory')\n \n @inventory_items = working_binder.inventory_items\n @count = @inventory_items.count\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inventory_items }\n end\n end",
"def show\n @inventory_report = InventoryReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inventory_report }\n end\n end",
"def take_snapshot\n json_string = self.snapshot_model.to_json\n Crypto::Bytes.from_string(json_string)\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 show\n @daily_inventory = DailyInventory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @daily_inventory }\n end\n end",
"def index\n @screenshots = Screenshot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @screenshots }\n end\n end",
"def show\n @inventory_status = InventoryStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inventory_status }\n end\n end",
"def show\n @screenshot = Screenshot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @screenshot }\n end\n end",
"def volume_snapshots(volume_id)\n ec2.snapshots.select { |snapshot| snapshot.volume_id == volume_id }\n end",
"def get_artifact_info(page)\n print \"\\rFetching artifacts page: #{page} \"\n client = Octokit::Client.new(access_token: ENV['PERSONAL_TOKEN'], per_page: 100)\n client.get(\"https://api.github.com/repos/SaraAlert/SaraAlert/actions/artifacts?page=#{page}\")\nend",
"def show\n @inventory_shelf_barcode = InventoryShelfBarcode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inventory_shelf_barcode }\n end\n end",
"def snapshot\n if snapshot_key\n snapshots.find_by(key: snapshot_key)\n else\n snapshots.order('created_at DESC').limit(1).first\n end\n end",
"def show\n @inventory = Inventory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @inventory }\n end\n end",
"def index\n @inventories = Inventory.all\n end",
"def index\n @inventory_items = InventoryItem.all\n end",
"def update\n @inventory = Accounting::Entry.take_inventory params[:item_id], @current_user.id, DateTime.parse(params[:date]), params[:amount]\n\n respond_to do |format|\n format.json { render json: @inventory }\n end\n end",
"def get\n @contents\n end",
"def show\n @project_screenshot = ProjectScreenshot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project_screenshot }\n end\n end",
"def snapshot(cart_name)\n raise NotImplementedError(\"snapshot\")\n end",
"def index\n @contents = @event.contents\n end",
"def artifact_id\n return unless snapshot_artifact?\n meta = Nokogiri::XML(open(snapshot_metadata_url))\n versions = meta.xpath('/metadata/versioning/snapshotVersions/snapshotVersion/value')\n versions.first.content if versions\n end",
"def destroy\n @inventory_snapshot_content.destroy\n respond_to do |format|\n format.html { redirect_to inventory_snapshot_contents_url, notice: 'Inventory snapshot content was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def show\n\n add_breadcrumb @asset.asset_tag, inventory_path(@asset)\n add_breadcrumb \"Maintenance History\", inventory_maintenance_events_path(@asset)\n add_breadcrumb \"Service on #{@maintenance_event.event_date}\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @maintenance_event }\n end\n\n end",
"def get_sha_and_contents\n repo_req = @api.get do |req|\n req.headers['User-Agent'] = \"#{@user_agent}\"\n req.headers['Authorization'] = \"token #{@current_user.github_token}\"\n end\n\n repo_contents = JSON.parse(repo_req.body)['content']\n repo_sha = JSON.parse(repo_req.body)['sha']\n return { sha: repo_sha, content: repo_contents } \n end",
"def restore\n p \"Doing a restore ...\"\n params = {:instance_href => \"/api/clouds/907/instances/#{@instance2_id}\"}\n id = @test_client.backups.index(:lineage => \"ns_backup_test_lineage\").first.show.href.split(\"/\")[-1] # => to get the id\n task = @test_client.backups(:id => id).show.restore(params)\n return task\nend",
"def snapshot esurl, snapurl, options\n elastic esurl\n set_opts(options)\n set_repository snapurl, options\n initiate_snapshot snapurl\n end",
"def list_snapshots options = {}\n paged_enum = subscriber.list_snapshots project: project_path(options),\n page_size: options[:max],\n page_token: options[:token]\n\n paged_enum.response\n end",
"def index\n @shots = Shot.all\n\n render json: @shots\n end",
"def create_snapshots(isCopy)\n ec2 = AWS::EC2.new.client\n\n #get all volumes tagged as \"backup\"\n volumes = ec2.describe_volumes(:filters => [:name => 'tag-key', :values => ['backup']])\n snapshots = []\n\n #loop thru and create snapshots for all these volumes\n if volumes \n volumes.data[:volume_set].each do |v|\n name = get_tagvalue(v, \"Name\")\n snap = ec2.create_snapshot(:volume_id => v[:volume_id], :description => \"Backup for \" + Time.now.to_s + \" - created by SDK\")\n if snap\n snapshots << snap.data\n #add name tag\n ec2.create_tags(:resources => [snap.data[:snapshot_id]], :tags => [{:key => \"Name\", :value => name + \" backup\"}])\n\n #now copy snapshots to another region\n if isCopy\n copy_snapshot(snap.data[:snapshot_id], AWSCONFIG[:default_region], AWSCONFIG[:backup_region], \n name + \" backup\", \"Backup for \" + Time.now.to_s + \" - created by SDK\")\n end\n end\n end\n end\n\n return snapshots\n end",
"def show\n @page = Page.find(params[:page_id])\n @revision = @page.revisions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @revision }\n end\n end",
"def snapshotInfo(_refresh = false)\n sni = nil\n @cacheLock.synchronize(:SH) do\n sni = @invObj.dupObj(snapshotInfo_locked)\n end\n (sni)\n end",
"def show\n @mounted_inventory = MountedInventory.find(params[:id])\n end",
"def index\n @page = Page.find(params[:page_id])\n @revisions = @page.revisions\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @revisions }\n end\n end",
"def show\n @release = @environment.releases.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @release }\n end\n end",
"def snapshots\n with_admin { |admin| admin.listSnapshots }.map { |sd|\n props = sd.getAllFields.map { |k, v|\n [k.name.to_sym, v.respond_to?(:name) ? v.name : v]\n }\n Hash[props]\n }\n end",
"def index\n @inventory_files = InventoryFile.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def create_snapshot(device, options = {})\n # TODO - add in new param commit=explicit once the API is availible\n params = {:device => device, \n :suffix => options[:suffix], \n :description => options[:description], \n :tag => options[:tag],\n :max_snaps => options[:max_snaps],\n :prefix_override => options[:prefix_override],\n :commit => \"explicit\",\n :api_version => 1.0}\n # Perform API call to snapshot the volume attached to the device on the instance\n STDERR.puts \"Performing RightScale API call to create a new snapshot\"\n #STDERR.puts \"HERE IS THE URL: #{@api_url}/create_ebs_snapshot.js (PARAMS: #{params.inspect})\"\n json=nil\n SystemTimer.timeout_after(@api_snap_timeout) do\n body = RestClient.post @api_url+\"/create_ebs_snapshot.js\",params\n json = body.nil? ? nil: JSON.load(body)\n STDERR.puts \"CREATED_SNAP: #{json}\"\n end\n json \n rescue Exception => e\n display_exception(e, \"create_snapshot(#{device}, #{options.inspect})\")\n end",
"def snapshot(url)\n `phantomjs #{File.dirname(__FILE__)}/take_snapshot.js '#{url}'`\n end",
"def index\n @artefact = Artefact.find(params[:artefact_id])\n\n @assets = @artefact.assets\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assets }\n end\n end",
"def show\n @mostsmallitemequipinventory = Mostsmallitemequipinventory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallitemequipinventory }\n end\n end",
"def createEBSSnapshot(client=nil,description='',volume_id=nil)\n return false if volume_id.nil? || client.nil?\n # Fetch the Volume Name. This will be used in the description of the snapshot\n resp = client.describe_volumes({dry_run: false, volume_ids: [volume_id] })\n resp.volumes[0].tags.each do |t|\n if t.key=='Name'\n description = t.value unless t.value.empty?\n break\n end\n end\n # puts \"Taking snapshot of volume #{volume_id}...\"\n return client.create_snapshot({\n dry_run: false,\n volume_id: volume_id,\n description: description\n })\nend",
"def list_snapshots request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_list_snapshots_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::NetApp::V1::ListSnapshotsResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def current_snapshot\n @snapshots[0][1]\n end",
"def list_all_aos_versions(args = {}) \n get(\"/aosversions.json/all\", args)\nend",
"def list_fusion_vm_snapshots(options)\n snapshot_list = get_fusion_vm_snapshots(options)\n handle_output(snapshot_list)\n return\nend",
"def download_prepared_dump id\n name = \"trunk-#{id}.dump\"\n target_path = File.expand_path(\"../../fixtures/#{name}\", __FILE__)\n \n puts \"Accessing prepared DB test snapshot #{id} from S3.\"\n \n require 's3'\n service = S3::Service.new(:access_key_id => access_key_id, :secret_access_key => secret_access_key)\n bucket = service.buckets.find(\"cocoapods-org-testing-dumps\")\n \n # Due to a bug in the s3 gem we are searching for the object via iterating.\n bucket.objects.each do |obj|\n if obj.key == name\n puts \"Downloading prepared DB test snapshot #{id} from S3.\"\n File.open(target_path, 'w') do |file|\n file.write(obj.content)\n end\n break\n end\n end\n \n puts \"Prepared DB test snapshot #{id} downloaded to #{target_path}\"\n end",
"def index\n @mounted_inventories = MountedInventory.all\n @mounted_inventory = MountedInventory.new\n respond_to do |format|\n format.html\n end\n end",
"def get(*args)\n params = arguments(args, required: [:owner, :repo, :id]).params\n\n get_request(\"/repos/#{owner}/#{repo}/releases/assets/#{id}\" , params)\n end",
"def _dump\n self.contents\n end",
"def save_snapshot\n return unless @current_snapshot\n current_state = @bitmap.to_json\n return if snapshots_match?(@current_snapshot, current_state)\n\n @snapshots << @current_snapshot\n end",
"def show\n @recipe = Recipe.find(params[:id])\n @nutrition_info = NutritionInfo.where( \"recipe_id = ?\", @recipe.id ).first\n @inventory_items = []\n @recipe.inventory_items.each do |inventory_item|\n @inventory_items << inventory_item\n end\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end",
"def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend",
"def show\n @mostsmalltrapeffectinventory = Mostsmalltrapeffectinventory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmalltrapeffectinventory }\n end\n end"
] |
[
"0.68496674",
"0.6571057",
"0.65362597",
"0.6531449",
"0.6490074",
"0.6254804",
"0.6193462",
"0.61878216",
"0.61849135",
"0.60949624",
"0.6060234",
"0.60109794",
"0.6005607",
"0.60007113",
"0.59459823",
"0.5931839",
"0.58714306",
"0.5845803",
"0.58300704",
"0.5812881",
"0.5782298",
"0.57456297",
"0.57371986",
"0.5723114",
"0.5693266",
"0.5653085",
"0.56185967",
"0.5612292",
"0.5610725",
"0.5600668",
"0.5577156",
"0.5576897",
"0.55733144",
"0.5568439",
"0.5564545",
"0.55573624",
"0.55437934",
"0.5534286",
"0.55321926",
"0.55313075",
"0.55205506",
"0.5510778",
"0.5505078",
"0.54686385",
"0.5458967",
"0.5458468",
"0.54379785",
"0.54336137",
"0.5433502",
"0.54301655",
"0.54300416",
"0.5425993",
"0.54227006",
"0.54223096",
"0.5419663",
"0.5412047",
"0.53963953",
"0.53822327",
"0.5368078",
"0.5363815",
"0.53555053",
"0.53519136",
"0.5305579",
"0.5303352",
"0.5299907",
"0.529239",
"0.529209",
"0.52915114",
"0.5288013",
"0.5282334",
"0.5280922",
"0.52785116",
"0.52772737",
"0.5276249",
"0.5258733",
"0.5258407",
"0.5257062",
"0.52560925",
"0.5254255",
"0.5252035",
"0.5243188",
"0.52377737",
"0.52276397",
"0.5226233",
"0.52214116",
"0.52187264",
"0.52181643",
"0.5207477",
"0.51913667",
"0.5185979",
"0.518543",
"0.5181771",
"0.5175728",
"0.51746917",
"0.5174457",
"0.51735365",
"0.51729727",
"0.51675826",
"0.5158791",
"0.51586676"
] |
0.76583564
|
0
|
GET /inventory_snapshot_contents/1 GET /inventory_snapshot_contents/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @inventory_snapshot_contents = InventorySnapshotContent.all\n end",
"def snapshot\n begin\n response = resource[\"/snapshot/#{app}\"].post(nil)\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end",
"def set_inventory_snapshot_content\n @inventory_snapshot_content = InventorySnapshotContent.find(params[:id])\n end",
"def get(params = {})\n # Set snapshot name or we'll get the repository instead\n snapshot = name || \"_all\"\n response = client.get \"/_snapshot/{repository}/{snapshot}\", update_params(params, snapshot: snapshot, action: \"snapshot.get\", rest_api: \"snapshot.get\")\n response.body\n end",
"def index\n @snapshots = current_account.snapshots.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @snapshots }\n end\n end",
"def get_snapshots\n ensure_uri && ensure_client\n uri = \"#{@data['uri']}/snapshots\"\n self.class.find_with_pagination(@client, uri)\n end",
"def show\n @stashed_inventory = StashedInventory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stashed_inventory }\n end\n end",
"def new\n @snapshot = current_account.snapshots.new\n @volumes = current_account.volumes\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @snapshot }\n end\n end",
"def show\n @inventory_entry = InventoryEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inventory_entry }\n end\n end",
"def show\n respond_to do |f| \n f.json {\n render :json => { \n :activity_log => @activity_log,\n :snapshots => @activity_log.snapshots.order(\"id ASC\")\n }\n }\n end\n end",
"def available_snapshots\n snapshot_info = `#{config[:path]} --json snapshots`\n JSON.parse(snapshot_info, { symbolize_names: true })\n end",
"def update\n respond_to do |format|\n if @inventory_snapshot_content.update(inventory_snapshot_content_params)\n format.html { redirect_to @inventory_snapshot_content, notice: 'Inventory snapshot content was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventory_snapshot_content }\n else\n format.html { render :edit }\n format.json { render json: @inventory_snapshot_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @inventory_snapshot_content = InventorySnapshotContent.new(inventory_snapshot_content_params)\n\n respond_to do |format|\n if @inventory_snapshot_content.save\n format.html { redirect_to @inventory_snapshot_content, notice: 'Inventory snapshot content was successfully created.' }\n format.json { render :show, status: :created, location: @inventory_snapshot_content }\n else\n format.html { render :new }\n format.json { render json: @inventory_snapshot_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n repo = assets_repo\n @v_asset = repo.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @v_asset }\n end\n end",
"def snapshots\n unless @vm.exists?\n return Response.new :code => 1, :message => 'VM does not exist'\n end\n\n conf_file_response = @vm.conf_file\n return conf_file_response unless conf_file_response.successful?\n\n command = \"#{vmrun_cmd} listSnapshots \"\n command << \"'#{conf_file_response.data}' 2>&1\"\n\n command_exec = Fission::Action::ShellExecutor.new command\n result = command_exec.execute\n\n response = Response.new :code => result['process_status'].exitstatus\n\n if response.successful?\n response.data = parse_snapshot_names_from_output result['output']\n else\n response.message = result['output']\n end\n\n response\n end",
"def snapshots\n client = Aws::EC2::Client.new\n client.describe_snapshots({\n filters: [{\n name: \"tag:type\",\n values: [\"auto\"]\n }]\n }).snapshots\nend",
"def getSnapshots()\n\t\tsnaps = JSON.parse(RestClient.get(\"https://#{Cbthelper.username}:#{Cbthelper.authkey}@crossbrowsertesting.com/api/v3/selenium/#{@testId}/snapshots/\"))\t\n\t\tret = []\n\n\t\tfor snap in snaps\n\t\t\tret.push(Snapshot.new(snap[\"hash\"], @testId))\n\n\t\tend\n\t\treturn ret\n\tend",
"def snapshot\n @agent = Agent.find(:first,\n :include => { :user => :user_icons },\n :conditions => { :id => params[:id] }\n )\n\n respond_to do |format|\n format.html { render :layout => nil }\n format.xml { render :xml => @agent }\n end\n end",
"def show\n @inventoryitem = Inventoryitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inventoryitem }\n end\n end",
"def show\n @revision = Revision.find(params[:id])\n\n render json: @revision\n end",
"def snapshots\n unless exists?\n return Response.new :code => 1, :message => 'VM does not exist'\n end\n\n conf_file_response = conf_file\n return conf_file_response unless conf_file_response.successful?\n\n command = \"#{vmrun_cmd} listSnapshots \"\n command << \"#{conf_file_response.data} 2>&1\"\n output = `#{command}`\n\n response = Response.new :code => $?.exitstatus\n\n if response.successful?\n snaps = output.split(\"\\n\").select { |s| !s.include? 'Total snapshots:' }\n response.data = snaps.map { |s| s.strip }\n else\n response.message = output\n end\n\n response\n end",
"def enrollment_snapshot_data(params = {})\n scope 'default'\n get(\"enrollment/snapshot/#{params[:snapshot_id]}/data\")\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @snapshot }\n end\n end",
"def inventory_snapshot_content_params\n params.require(:inventory_snapshot_content).permit(:inventory_snapshot_id, :rfid_hardware_id, :trackable_id)\n end",
"def show\n @inventory_status = InventoryStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inventory_status }\n end\n end",
"def show\n @asset_allocation_history = AssetAllocationHistory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asset_allocation_history }\n end\n end",
"def enrollment_snapshots(params = {})\n snapshot_id = params.delete :snapshot_id\n\n response =\n default_scope.get(\"enrollment/snapshot\" + (snapshot_id ? \"/#{snapshot_id}\" : '')) do |request|\n request.params = params\n end\n JSON.parse(response.body)\n end",
"def fetch_snapshots\n @snapshots = ::Refinery::Snapshots::Snapshot.all\n end",
"def show\n @inventory_item = InventoryItem.find(params[:id])\n \n authorize! :read, @inventory_item\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inventory_item }\n end\n end",
"def index\n @inventory_files = InventoryFile.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @inventory_files }\n end\n end",
"def snapshot\n if snapshot_key\n snapshots.find_by(key: snapshot_key)\n else\n snapshots.order('created_at DESC').limit(1).first\n end\n end",
"def snapshot(snapshot_id)\n snapshots(snapshot_id)[0]\n end",
"def show\n @inventories = @inventory_file.inventories.page(params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def show\n @inventory_shelf_barcode = InventoryShelfBarcode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inventory_shelf_barcode }\n end\n end",
"def show\n @inventory_report = InventoryReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inventory_report }\n end\n end",
"def show\n @screenshot = Screenshot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @screenshot }\n end\n end",
"def new\n @stashed_inventory = StashedInventory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stashed_inventory }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inventory_file }\n format.download {\n send_file @inventory_file.inventory.download,\n filename: @inventory_file.inventory_filename,\n type: 'application/octet-stream'\n }\n end\n end",
"def list_instance_snapshots(rds_resource)\n instance_snapshots = []\n rds_resource.db_snapshots.each do |s|\n instance_snapshots.append({\n \"id\": s.snapshot_id,\n \"status\": s.status\n })\n end\n instance_snapshots\nrescue Aws::Errors::ServiceError => e\n puts \"Couldn't list instance snapshots:\\n #{e.message}\"\nend",
"def show\n @daily_inventory = DailyInventory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @daily_inventory }\n end\n end",
"def index\n @screenshots = Screenshot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @screenshots }\n end\n end",
"def index\n authorize! :read, @binder\n \n initialize_uploader(current_user.id, @binder.id, 'inventory')\n \n @inventory_items = working_binder.inventory_items\n @count = @inventory_items.count\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inventory_items }\n end\n end",
"def show\n @project_screenshot = ProjectScreenshot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project_screenshot }\n end\n end",
"def snapshot\r\n date = self.class.service_instance.snapshot_blob(self.path)\r\n properties = self.class.service_instance.get_blob_properties(self.path)\r\n return BlobObject.new(:name => self.name, \r\n :url => self.class.service_instance.generate_request_uri(self.path) + \"?snapshot=#{date}\",\r\n :content_type => properties[:content_type],\r\n :snapshot_date => date)\r\n end",
"def status(params = {})\n response = client.get \"/_snapshot{/repository}{/snapshot}/_status\", update_params(params, action: \"snapshot.status\", rest_api: \"snapshot.status\")\n response.body\n end",
"def index\n @releases = @environment.releases.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @releases }\n end\n end",
"def show\n @inventory = Inventory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @inventory }\n end\n end",
"def index\n @artifacts = Artifact.all\n end",
"def create\n @snapshot = current_account.snapshots.new(params[:snapshot])\n\n respond_to do |format|\n if @snapshot.save\n flash[:notice] = 'Snapshot was successfully created.'\n format.html { redirect_to(@snapshot) }\n format.xml { render :xml => @snapshot, :status => :created, :location => @snapshot }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @snapshot.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @release = @environment.releases.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @release }\n end\n end",
"def list_snapshot(regex = '.*')\n @admin.listSnapshots(Pattern.compile(regex)).to_a\n end",
"def snapshots\n raise Fission::Error,\"VM #{@name} does not exist\" unless self.exists?\n\n command = \"#{vmrun_cmd} listSnapshots #{vmx_path.shellescape} 2>&1\"\n output = `#{command}`\n\n raise \"There was an error listing the snapshots of #{@name} :\\n #{output}\" unless $?.exitstatus==0\n\n snaps_unfiltered = output.split(\"\\n\").select { |s| !s.include? 'Total snapshots:' }\n snaps=snaps_unfiltered.map { |s| s.strip }\n return snaps\n end",
"def show\n @mostsmalltrapeffectinventory = Mostsmalltrapeffectinventory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmalltrapeffectinventory }\n end\n end",
"def show\n @mostsmallitemequipinventory = Mostsmallitemequipinventory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallitemequipinventory }\n end\n end",
"def show\n @mounted_inventory = MountedInventory.find(params[:id])\n end",
"def index\n @shots = Shot.all\n\n render json: @shots\n end",
"def snapshot()\n puts \"TODO\"\n end",
"def current_snapshot\n @snapshots[0][1]\n end",
"def index\n @inventories = Inventory.all\n end",
"def show\n @os_release = OsRelease.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @os_release }\n end\n end",
"def update_snapshot(aws_id,commit_state)\n params = {:aws_id => aws_id, :commit_state => commit_state, :api_version => 1.0 }\n json=nil\n SystemTimer.timeout_after(@api_snap_timeout) do\n body = RestClient.put @api_url+\"/update_ebs_snapshot.js\",params\n puts \"UPDATED SNAP: #{aws_id}\"\n end\n json \n rescue Exception => e\n display_exception(e, \"update_snapshot(#{aws_id}, #{commit_state})\")\n end",
"def index\n @artefact = Artefact.find(params[:artefact_id])\n\n @assets = @artefact.assets\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assets }\n end\n end",
"def show\n @recipe = Recipe.find(params[:id])\n @nutrition_info = NutritionInfo.where( \"recipe_id = ?\", @recipe.id ).first\n @inventory_items = []\n @recipe.inventory_items.each do |inventory_item|\n @inventory_items << inventory_item\n end\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end",
"def index\n @inventory_items = InventoryItem.all\n end",
"def show\n\n add_breadcrumb @asset.asset_tag, inventory_path(@asset)\n add_breadcrumb \"Maintenance History\", inventory_maintenance_events_path(@asset)\n add_breadcrumb \"Service on #{@maintenance_event.event_date}\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @maintenance_event }\n end\n\n end",
"def artifact_id\n return unless snapshot_artifact?\n meta = Nokogiri::XML(open(snapshot_metadata_url))\n versions = meta.xpath('/metadata/versioning/snapshotVersions/snapshotVersion/value')\n versions.first.content if versions\n end",
"def restore\n p \"Doing a restore ...\"\n params = {:instance_href => \"/api/clouds/907/instances/#{@instance2_id}\"}\n id = @test_client.backups.index(:lineage => \"ns_backup_test_lineage\").first.show.href.split(\"/\")[-1] # => to get the id\n task = @test_client.backups(:id => id).show.restore(params)\n return task\nend",
"def show\n @page = Page.find(params[:page_id])\n @revision = @page.revisions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @revision }\n end\n end",
"def get_virtualization_vmware_virtual_machine_snapshot_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VirtualizationApi.get_virtualization_vmware_virtual_machine_snapshot_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/virtualization/VmwareVirtualMachineSnapshots'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].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', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\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] || 'VirtualizationVmwareVirtualMachineSnapshotResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"VirtualizationApi.get_virtualization_vmware_virtual_machine_snapshot_list\",\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: VirtualizationApi#get_virtualization_vmware_virtual_machine_snapshot_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_artifact_info(page)\n print \"\\rFetching artifacts page: #{page} \"\n client = Octokit::Client.new(access_token: ENV['PERSONAL_TOKEN'], per_page: 100)\n client.get(\"https://api.github.com/repos/SaraAlert/SaraAlert/actions/artifacts?page=#{page}\")\nend",
"def list_snapshots\n @s3.buckets[@snapshot_bucket].objects.with_prefix(@prefix).to_a\n end",
"def snapshots\n Fission::Action::Snapshot::Lister.new(self).snapshots\n end",
"def show\n @item_selected_name = ItemSelectedName.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_selected_name.item_revision }\n end\n end",
"def index\n @contents = @event.contents\n end",
"def destroy\n @inventory_snapshot_content.destroy\n respond_to do |format|\n format.html { redirect_to inventory_snapshot_contents_url, notice: 'Inventory snapshot content was successfully destroyed.' }\n format.json { head :no_content }\n end\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 index\n @page = Page.find(params[:page_id])\n @revisions = @page.revisions\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @revisions }\n end\n end",
"def list_snapshots\n snaps = execute(:list_snapshots, VmID: vm_id)\n snaps.map { |s| s['Name'] }\n end",
"def update\n @inventory = Accounting::Entry.take_inventory params[:item_id], @current_user.id, DateTime.parse(params[:date]), params[:amount]\n\n respond_to do |format|\n format.json { render json: @inventory }\n end\n end",
"def show\n @inventory_detail = InventoryDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @inventory_detail }\n end\n end",
"def index\n @mounted_inventories = MountedInventory.all\n @mounted_inventory = MountedInventory.new\n respond_to do |format|\n format.html\n end\n end",
"def get_snapshot(name)\n results = get_snapshots\n results.find { |snap| snap['name'] == name }\n end",
"def index\n info = Aws.get_recipes_from_db\n render :json => info\n end",
"def show\n @storage = @client.storages.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @storage }\n end\n end",
"def volume_snapshots(volume_id)\n ec2.snapshots.select { |snapshot| snapshot.volume_id == volume_id }\n end",
"def take_snapshot\n json_string = self.snapshot_model.to_json\n Crypto::Bytes.from_string(json_string)\n end",
"def get\n @contents\n end",
"def get_sha_and_contents\n repo_req = @api.get do |req|\n req.headers['User-Agent'] = \"#{@user_agent}\"\n req.headers['Authorization'] = \"token #{@current_user.github_token}\"\n end\n\n repo_contents = JSON.parse(repo_req.body)['content']\n repo_sha = JSON.parse(repo_req.body)['sha']\n return { sha: repo_sha, content: repo_contents } \n end",
"def index\n @inventory_statuses = InventoryStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inventory_statuses }\n end\n end",
"def show\n render json: JSONAPI::Serializer.serialize(@repo)\n end",
"def list_snapshots(**options)\n Terminal.list_snapshots(@user_token, @access_token, **options)\n end",
"def index\n @inventory_files = InventoryFile.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def json_index_static_contents\n\n @static_contents = StaticContent.all\n respond_to do |format|\n\n format.json { render json: @static_contents }\n end\n end",
"def show\n @activity_inventory = ActivityInventory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @activity_inventory }\n end\n end",
"def get_aos_version_box_by_id(args = {}) \n get(\"/aosversions.json/aosversionbox/#{args[:aosVersionBoxId]}\", args)\nend",
"def new\n @inventory_file = InventoryFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @inventory_file }\n end\n end",
"def get(index, snap_id)\n \n end",
"def index\n @client_releases = ClientRelease.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @client_releases }\n end\n end",
"def current_snapshot\n `zfs list -r -H -t snapshot -o name -S creation #{@dataset}/share | head -1`.chomp\n end",
"def index\n @contents = Content.all\n render json: @contents\n end",
"def show\n @asset = Asset.find(params[:id])\n @assets = @uploadable.assets\n respond_to do |format|\n format.html\n format.json { render json: @asset}\n end\n end"
] |
[
"0.76774454",
"0.6707781",
"0.6662215",
"0.6516531",
"0.6456946",
"0.63349783",
"0.6293955",
"0.6239831",
"0.60875183",
"0.6057676",
"0.6033851",
"0.6019267",
"0.60180235",
"0.60124",
"0.59836453",
"0.5956271",
"0.58814824",
"0.5877155",
"0.5863907",
"0.58595973",
"0.5850956",
"0.58198684",
"0.5819448",
"0.5792109",
"0.5773447",
"0.5772237",
"0.5759838",
"0.5758631",
"0.57445216",
"0.57367283",
"0.57367086",
"0.5733741",
"0.5731826",
"0.5699547",
"0.5694851",
"0.56911063",
"0.5684785",
"0.5673241",
"0.5658122",
"0.5657768",
"0.5619006",
"0.56049955",
"0.5594641",
"0.5594592",
"0.5567525",
"0.55436045",
"0.554222",
"0.55340904",
"0.55336046",
"0.55126953",
"0.55044436",
"0.5503517",
"0.5496905",
"0.5496698",
"0.54883176",
"0.5478976",
"0.54770243",
"0.5476299",
"0.54744357",
"0.54721266",
"0.54700744",
"0.5469026",
"0.54688764",
"0.5466886",
"0.54647547",
"0.54602915",
"0.5460268",
"0.54601705",
"0.54417646",
"0.5438761",
"0.542887",
"0.5417874",
"0.54052496",
"0.53985494",
"0.538741",
"0.5379533",
"0.53789496",
"0.53763485",
"0.5356373",
"0.535589",
"0.53542817",
"0.5353981",
"0.53409415",
"0.5333235",
"0.533298",
"0.53320897",
"0.5330385",
"0.5323833",
"0.5320439",
"0.5319814",
"0.5309404",
"0.53065944",
"0.5305827",
"0.53039986",
"0.5285999",
"0.5283236",
"0.52772593",
"0.52707523",
"0.5269494",
"0.5268427",
"0.5267226"
] |
0.0
|
-1
|
POST /inventory_snapshot_contents POST /inventory_snapshot_contents.json
|
def create
@inventory_snapshot_content = InventorySnapshotContent.new(inventory_snapshot_content_params)
respond_to do |format|
if @inventory_snapshot_content.save
format.html { redirect_to @inventory_snapshot_content, notice: 'Inventory snapshot content was successfully created.' }
format.json { render :show, status: :created, location: @inventory_snapshot_content }
else
format.html { render :new }
format.json { render json: @inventory_snapshot_content.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @inventory_snapshot_contents = InventorySnapshotContent.all\n end",
"def set_inventory_snapshot_content\n @inventory_snapshot_content = InventorySnapshotContent.find(params[:id])\n end",
"def inventory_snapshot_content_params\n params.require(:inventory_snapshot_content).permit(:inventory_snapshot_id, :rfid_hardware_id, :trackable_id)\n end",
"def snapshot\n begin\n response = resource[\"/snapshot/#{app}\"].post(nil)\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end",
"def create\n @snapshot = current_account.snapshots.new(params[:snapshot])\n\n respond_to do |format|\n if @snapshot.save\n flash[:notice] = 'Snapshot was successfully created.'\n format.html { redirect_to(@snapshot) }\n format.xml { render :xml => @snapshot, :status => :created, :location => @snapshot }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @snapshot.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @inventory_snapshot_content.update(inventory_snapshot_content_params)\n format.html { redirect_to @inventory_snapshot_content, notice: 'Inventory snapshot content was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventory_snapshot_content }\n else\n format.html { render :edit }\n format.json { render json: @inventory_snapshot_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def createEBSSnapshot(client=nil,description='',volume_id=nil)\n return false if volume_id.nil? || client.nil?\n # Fetch the Volume Name. This will be used in the description of the snapshot\n resp = client.describe_volumes({dry_run: false, volume_ids: [volume_id] })\n resp.volumes[0].tags.each do |t|\n if t.key=='Name'\n description = t.value unless t.value.empty?\n break\n end\n end\n # puts \"Taking snapshot of volume #{volume_id}...\"\n return client.create_snapshot({\n dry_run: false,\n volume_id: volume_id,\n description: description\n })\nend",
"def create_snapshot\n @current_snapshot = @bitmap.to_json if @bitmap\n end",
"def snapshot_params\n params.require(:snapshot).permit(:name, :snapshot)\n end",
"def save_snapshot\n return unless @current_snapshot\n current_state = @bitmap.to_json\n return if snapshots_match?(@current_snapshot, current_state)\n\n @snapshots << @current_snapshot\n end",
"def create_snapshot(device, options = {})\n # TODO - add in new param commit=explicit once the API is availible\n params = {:device => device, \n :suffix => options[:suffix], \n :description => options[:description], \n :tag => options[:tag],\n :max_snaps => options[:max_snaps],\n :prefix_override => options[:prefix_override],\n :commit => \"explicit\",\n :api_version => 1.0}\n # Perform API call to snapshot the volume attached to the device on the instance\n STDERR.puts \"Performing RightScale API call to create a new snapshot\"\n #STDERR.puts \"HERE IS THE URL: #{@api_url}/create_ebs_snapshot.js (PARAMS: #{params.inspect})\"\n json=nil\n SystemTimer.timeout_after(@api_snap_timeout) do\n body = RestClient.post @api_url+\"/create_ebs_snapshot.js\",params\n json = body.nil? ? nil: JSON.load(body)\n STDERR.puts \"CREATED_SNAP: #{json}\"\n end\n json \n rescue Exception => e\n display_exception(e, \"create_snapshot(#{device}, #{options.inspect})\")\n end",
"def copy_tags_to_snapshot\n data[:copy_tags_to_snapshot]\n end",
"def copy_tags_to_snapshot\n data[:copy_tags_to_snapshot]\n end",
"def new\n @snapshot = current_account.snapshots.new\n @volumes = current_account.volumes\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @snapshot }\n end\n end",
"def create_snapshot(snapshot, description = nil)\n ensure_uri && ensure_client\n if snapshot.is_a?(OneviewSDK::Resource) || snapshot.is_a?(Hash)\n name = snapshot[:name] || snapshot['name']\n description ||= snapshot[:description] || snapshot['description']\n else\n name = snapshot\n end\n data = generate_snapshot_data(name, description)\n response = @client.rest_post(\"#{@data['uri']}/snapshots\", { 'body' => data }, @api_version)\n @client.response_handler(response)\n true\n end",
"def update_snapshot(aws_id,commit_state)\n params = {:aws_id => aws_id, :commit_state => commit_state, :api_version => 1.0 }\n json=nil\n SystemTimer.timeout_after(@api_snap_timeout) do\n body = RestClient.put @api_url+\"/update_ebs_snapshot.js\",params\n puts \"UPDATED SNAP: #{aws_id}\"\n end\n json \n rescue Exception => e\n display_exception(e, \"update_snapshot(#{aws_id}, #{commit_state})\")\n end",
"def create(body = {}, params = {})\n response = client.put \"/_snapshot/{repository}/{snapshot}\", update_params(params, body: body, action: \"snapshot.create\", rest_api: \"snapshot.create\")\n response.body\n end",
"def snapshot()\n puts \"TODO\"\n end",
"def create_snapshot( dashboard = {} )\n\n raise ArgumentError.new('dashboard must be an Hash') unless( dashboard.is_a?(String) )\n\n endpoint = '/api/snapshots'\n @logger.debug(\"Creating dashboard snapshot (POST #{endpoint})\") if @debug\n\n post(endpoint, dashboard)\n end",
"def create_snapshot_action(id, description=\"New Snapshot\", type=:vapp)\n params = {\n \"method\" => :post,\n \"command\" => \"/vApp/#{type}-#{id}/action/createSnapshot\"\n }\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.CreateSnapshotParams(\n \"xmlns\" => \"http://www.vmware.com/vcloud/v1.5\") {\n xml.Description description\n }\n end\n response, headers = send_request(params, builder.to_xml, \"application/vnd.vmware.vcloud.createSnapshotParams+xml\")\n task_id = headers[:location].gsub(/.*\\/task\\//, \"\")\n task_id\n end",
"def take_snapshot\n json_string = self.snapshot_model.to_json\n Crypto::Bytes.from_string(json_string)\n end",
"def createRDSSnapshot(client=nil,db_instance=nil,snapshot_name=nil,tags=[])\n return false if db_instance.nil? || client.nil?\n if snapshot_name.nil?\n snapshot_name=\"#{db_instance}-#{Time.now.to_i}\"\n end\n unless tags.instance_of? Array\n puts \"\\e[31mtags must be an Array\\e[0m\"\n return false\n end\n begin\n puts \"\\e[32mTaking snapshot of db instance #{db_instance}. Snapshot will be named #{snapshot_name}\\e[0m\"\n resp = client.create_db_snapshot({\n db_snapshot_identifier: snapshot_name,\n db_instance_identifier: db_instance,\n tags: tags\n })\n rescue Exception => e\n puts \"\\e[31m#{e.message}\\e[0m\"\n return false\n end\n return resp\nend",
"def create_snapshot_action(id, description=\"New Snapshot\", type=:vapp)\n params = {\n \"method\" => :post,\n \"command\" => \"/vApp/#{type}-#{id}/action/createSnapshot\"\n }\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.CreateSnapshotParams(\n \"xmlns\" => \"http://www.vmware.com/vcloud/v1.5\") {\n xml.Description description\n }\n end\n response, headers = send_request(params, builder.to_xml, \"application/vnd.vmware.vcloud.createSnapshotParams+xml\")\n task_id = headers[:location].gsub(/.*\\/task\\//, \"\")\n task_id\n end",
"def create_snapshot\n @attributes[:create_snapshot]\n end",
"def create_snapshot(name)\n unless exists?\n return Response.new :code => 1, :message => 'VM does not exist'\n end\n\n running_response = running?\n return running_response unless running_response.successful?\n\n unless running_response.data\n message = 'The VM must be running in order to take a snapshot.'\n return Response.new :code => 1, :message => message\n end\n\n conf_file_response = conf_file\n return conf_file_response unless conf_file_response.successful?\n\n snapshots_response = snapshots\n return snapshots_response unless snapshots_response.successful?\n\n if snapshots_response.data.include? name\n message = \"There is already a snapshot named '#{name}'.\"\n return Response.new :code => 1, :message => message\n end\n\n command = \"#{vmrun_cmd} snapshot \"\n command << \"#{conf_file_response.data} \\\"#{name}\\\" 2>&1\"\n\n Response.from_command(`#{command}`)\n end",
"def create_ebs_backup(options = {})\n params = options.merge( { :commit => \"explicit\", :api_version => 1.0 } )\n STDERR.puts \"Performing RightScale API call to create a new snapshot\"\n json=nil\n SystemTimer.timeout_after(@api_snap_timeout) do\n body = RestClient.post @api_url+\"/create_ebs_backup.js\", params\n json = body.nil? ? nil: JSON.load(body)\n STDERR.puts \"CREATED_SNAPS: #{json}\"\n end\n json \n rescue Exception => e\n display_exception(e, \"create_ebs_backup(#{options.inspect})\")\n end",
"def snapshots\n client = Aws::EC2::Client.new\n client.describe_snapshots({\n filters: [{\n name: \"tag:type\",\n values: [\"auto\"]\n }]\n }).snapshots\nend",
"def build_snapshot\n Sherlock::Models::Snapshot.new(\n :node_id => snapshot_json[:node_id],\n :timestamp => Time.now\n )\n end",
"def create_snapshot(options)\n snapshot = ec2.snapshots.new\n snapshot.volume_id = options['volume_id']\n snapshot.description = options['description']\n\n attempts = 0\n\n begin\n snapshot.save\n snapshot.reload\n rescue Fog::Compute::AWS::Error\n sleep 5\n attempts += 1\n if attempts == 5\n log \"Error communicating with API; Unable to save volume `#{options['volume_id']}` (Desc: #{options['description']})\"\n end\n return unless attempts == 5\n end\n\n options['tags'].each do |k,v|\n begin\n ec2.tags.create({resource_id: snapshot.id, key: k, value: v})\n rescue Errno::EINPROGRESS , Errno::EISCONN\n log \"API Connection Error\"\n sleep 1\n retry\n rescue Fog::Compute::AWS::Error\n log \"Failed attaching tag `'#{k}' => #{v}` to #{options['snapshot_type']} snapshot #{snapshot.id}\"\n sleep 1\n retry\n end\n end\n\n end",
"def index\n @snapshots = current_account.snapshots.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @snapshots }\n end\n end",
"def create_snapshots(isCopy)\n ec2 = AWS::EC2.new.client\n\n #get all volumes tagged as \"backup\"\n volumes = ec2.describe_volumes(:filters => [:name => 'tag-key', :values => ['backup']])\n snapshots = []\n\n #loop thru and create snapshots for all these volumes\n if volumes \n volumes.data[:volume_set].each do |v|\n name = get_tagvalue(v, \"Name\")\n snap = ec2.create_snapshot(:volume_id => v[:volume_id], :description => \"Backup for \" + Time.now.to_s + \" - created by SDK\")\n if snap\n snapshots << snap.data\n #add name tag\n ec2.create_tags(:resources => [snap.data[:snapshot_id]], :tags => [{:key => \"Name\", :value => name + \" backup\"}])\n\n #now copy snapshots to another region\n if isCopy\n copy_snapshot(snap.data[:snapshot_id], AWSCONFIG[:default_region], AWSCONFIG[:backup_region], \n name + \" backup\", \"Backup for \" + Time.now.to_s + \" - created by SDK\")\n end\n end\n end\n end\n\n return snapshots\n end",
"def enrollment_snapshot_data(params = {})\n scope 'default'\n get(\"enrollment/snapshot/#{params[:snapshot_id]}/data\")\n end",
"def create\n @stashed_inventory = StashedInventory.new(params[:stashed_inventory])\n\n respond_to do |format|\n if @stashed_inventory.save\n format.html { redirect_to @stashed_inventory, notice: 'Stashed inventory was successfully created.' }\n format.json { render json: @stashed_inventory, status: :created, location: @stashed_inventory }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stashed_inventory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def _dump\n self.contents\n end",
"def destroy\n @inventory_snapshot_content.destroy\n respond_to do |format|\n format.html { redirect_to inventory_snapshot_contents_url, notice: 'Inventory snapshot content was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def enrollment_snapshots(params = {})\n snapshot_id = params.delete :snapshot_id\n\n response =\n default_scope.get(\"enrollment/snapshot\" + (snapshot_id ? \"/#{snapshot_id}\" : '')) do |request|\n request.params = params\n end\n JSON.parse(response.body)\n end",
"def list_instance_snapshots(rds_resource)\n instance_snapshots = []\n rds_resource.db_snapshots.each do |s|\n instance_snapshots.append({\n \"id\": s.snapshot_id,\n \"status\": s.status\n })\n end\n instance_snapshots\nrescue Aws::Errors::ServiceError => e\n puts \"Couldn't list instance snapshots:\\n #{e.message}\"\nend",
"def write_snapshots\n FileUtils.mkdir_p(snapshots_path)\n File.write(snapshot_path, Snapshot.dump(snapshots))\n end",
"def snapshot(cart_name)\n raise NotImplementedError(\"snapshot\")\n end",
"def create_snapshot(name)\n Fission::Action::Snapshot::Creator.new(self).create_snapshot(name)\n end",
"def new\n @stashed_inventory = StashedInventory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stashed_inventory }\n end\n end",
"def add_inv inv_file\n self.inventory_database = JSON.parse File.read(inv_file)\n end",
"def create_snapshot(rds_resource, db_instance_name)\n id = \"snapshot-#{rand(10**6)}\"\n db_instance = rds_resource.db_instance(db_instance_name)\n db_instance.create_snapshot({\n db_snapshot_identifier: id\n })\nrescue Aws::Errors::ServiceError => e\n puts \"Couldn't create DB instance snapshot #{id}:\\n #{e.message}\"\nend",
"def create_snapshot(snap_id, snap_name)\n memory_dumps = true\n memory_dumps = CONFIG[:memory_dumps] \\\n unless CONFIG[:memory_dumps].nil?\n\n snapshot_hash = {\n :name => snap_id,\n :description => \"OpenNebula Snapshot: #{snap_name}\",\n :memory => memory_dumps,\n :quiesce => true\n }\n\n begin\n @item.CreateSnapshot_Task(snapshot_hash).wait_for_completion\n rescue StandardError => e\n error = \"Cannot create snapshot for VM: #{e.message}.\"\n\n if VCenterDriver::CONFIG[:debug_information]\n error += \"\\n\\n#{e.backtrace.join(\"\\n\")}\"\n end\n\n raise error\n end\n\n snap_id\n end",
"def getSnapshots()\n\t\tsnaps = JSON.parse(RestClient.get(\"https://#{Cbthelper.username}:#{Cbthelper.authkey}@crossbrowsertesting.com/api/v3/selenium/#{@testId}/snapshots/\"))\t\n\t\tret = []\n\n\t\tfor snap in snaps\n\t\t\tret.push(Snapshot.new(snap[\"hash\"], @testId))\n\n\t\tend\n\t\treturn ret\n\tend",
"def generate_snapshot_data(name, description = nil)\n { type: 'Snapshot', description: description, name: name }\n end",
"def create\n @inventory = Inventory.new(inventory_params)\n\n respond_to do |format|\n if @inventory.save\n format.html { redirect_to inventories_path, notice: 'Inventory was successfully created.' }\n format.json { render :show, status: :created, location: @inventory }\n else\n format.html { render :new }\n format.json { render json: @inventory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_snapshots\n ensure_uri && ensure_client\n uri = \"#{@data['uri']}/snapshots\"\n self.class.find_with_pagination(@client, uri)\n end",
"def snapshot_disk(disk_id, metadata)\n metadata = Hash[metadata.map { |key, value| [key.to_s, value] }]\n\n with_thread_name(\"snapshot_disk(#{disk_id})\") do\n volume = @ec2_resource.volume(disk_id)\n devices = []\n volume.attachments.each { |attachment| devices << attachment.device }\n\n name = ['deployment', 'job', 'index'].collect { |key| metadata[key] }\n name << devices.first.split('/').last unless devices.empty?\n\n snapshot = volume.create_snapshot(name.join('/'))\n logger.info(\"snapshot '#{snapshot.id}' of volume '#{disk_id}' created\")\n\n\n tags = {}\n ['agent_id', 'instance_id', 'director_name', 'director_uuid'].each do |key|\n tags[key] = metadata[key]\n end\n tags['device'] = devices.first unless devices.empty?\n tags['Name'] = name.join('/')\n TagManager.tags(snapshot, tags)\n\n ResourceWait.for_snapshot(snapshot: snapshot, state: 'completed')\n snapshot.id\n end\n end",
"def download_prepared_dump id\n name = \"trunk-#{id}.dump\"\n target_path = File.expand_path(\"../../fixtures/#{name}\", __FILE__)\n \n puts \"Accessing prepared DB test snapshot #{id} from S3.\"\n \n require 's3'\n service = S3::Service.new(:access_key_id => access_key_id, :secret_access_key => secret_access_key)\n bucket = service.buckets.find(\"cocoapods-org-testing-dumps\")\n \n # Due to a bug in the s3 gem we are searching for the object via iterating.\n bucket.objects.each do |obj|\n if obj.key == name\n puts \"Downloading prepared DB test snapshot #{id} from S3.\"\n File.open(target_path, 'w') do |file|\n file.write(obj.content)\n end\n break\n end\n end\n \n puts \"Prepared DB test snapshot #{id} downloaded to #{target_path}\"\n end",
"def snapshot_disk(disk_id, metadata)\n metadata = Hash[metadata.map { |key, value| [key.to_s, value] }]\n\n with_thread_name(\"snapshot_disk(#{disk_id})\") do\n volume = @ec2_client.volumes[disk_id]\n devices = []\n volume.attachments.each { |attachment| devices << attachment.device }\n\n name = ['deployment', 'job', 'index'].collect { |key| metadata[key] }\n name << devices.first.split('/').last unless devices.empty?\n\n snapshot = volume.create_snapshot(name.join('/'))\n logger.info(\"snapshot '#{snapshot.id}' of volume '#{disk_id}' created\")\n\n ['agent_id', 'instance_id', 'director_name', 'director_uuid'].each do |key|\n TagManager.tag(snapshot, key, metadata[key])\n end\n TagManager.tag(snapshot, 'device', devices.first) unless devices.empty?\n TagManager.tag(snapshot, 'Name', name.join('/'))\n\n ResourceWait.for_snapshot(snapshot: snapshot, state: :completed)\n snapshot.id\n end\n end",
"def set_snapshot\n @snapshot = Snapshot.find(params[:id])\n end",
"def snapshot\r\n date = self.class.service_instance.snapshot_blob(self.path)\r\n properties = self.class.service_instance.get_blob_properties(self.path)\r\n return BlobObject.new(:name => self.name, \r\n :url => self.class.service_instance.generate_request_uri(self.path) + \"?snapshot=#{date}\",\r\n :content_type => properties[:content_type],\r\n :snapshot_date => date)\r\n end",
"def dump contents;\r\n # p contents\r\n @dumps = Array.new unless @dumps \r\n @dumps << contents \r\n end",
"def snapshot\n @agent = Agent.find(:first,\n :include => { :user => :user_icons },\n :conditions => { :id => params[:id] }\n )\n\n respond_to do |format|\n format.html { render :layout => nil }\n format.xml { render :xml => @agent }\n end\n end",
"def copy_snapshot(source_snapshot_id, source_region, target_region, name, description)\n ec2 = AWS::EC2.new(:region => target_region).client\n snap = ec2.copy_snapshot(:source_region => source_region, :source_snapshot_id => source_snapshot_id,\n :description => description)\n if snap\n #add expiry tag if snapshots_expire_in setting > 0. if 0 they never expire\n if SNAPSHOTS_EXPIRE_IN > 0\n ec2.create_tags(:resources => [snap.data[:snapshot_id]], :tags => [{:key => \"expiring\", :value =>\n (Time.now + SNAPSHOTS_EXPIRE_IN.to_i.days).to_s}, {:key => \"Name\", :value => name}])\n end\n return snap.data[:snapshot_id]\n end\n\n return \"\"\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 create(name)\n p \"Doing a create ...\"\n params = {:backup => {:lineage => \"ns_backup_test_lineage\", :name => name, :volume_attachment_hrefs => [@volume_attachment_href_1, @volume_attachment_href_2]}}\n return @test_client.backups.create(params)\nend",
"def snapshot_params\n params.require(:snapshot).permit(:comment, :content, :annotation, :annotated_snapshot_url)\n end",
"def create_snapshot request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/zones/#{request_pb.zone}/disks/#{request_pb.disk}/createSnapshot\"\n body = request_pb.snapshot_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end",
"def snapshot esurl, snapurl, options\n elastic esurl\n set_opts(options)\n set_repository snapurl, options\n initiate_snapshot snapurl\n end",
"def available_snapshots\n snapshot_info = `#{config[:path]} --json snapshots`\n JSON.parse(snapshot_info, { symbolize_names: true })\n end",
"def create_snapshot(snapshot_name)\n execute(:create_snapshot, VmId: vm_id, SnapName: snapshot_name)\n end",
"def show\n @stashed_inventory = StashedInventory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stashed_inventory }\n end\n end",
"def make_backup\n @backup = editor.create_snapshot\n end",
"def save_inventory(opts = {})\n save_inventory_with_http_info(opts)\n return nil\n end",
"def snapshots\n unless @vm.exists?\n return Response.new :code => 1, :message => 'VM does not exist'\n end\n\n conf_file_response = @vm.conf_file\n return conf_file_response unless conf_file_response.successful?\n\n command = \"#{vmrun_cmd} listSnapshots \"\n command << \"'#{conf_file_response.data}' 2>&1\"\n\n command_exec = Fission::Action::ShellExecutor.new command\n result = command_exec.execute\n\n response = Response.new :code => result['process_status'].exitstatus\n\n if response.successful?\n response.data = parse_snapshot_names_from_output result['output']\n else\n response.message = result['output']\n end\n\n response\n end",
"def save_inventory(opts = {})\n save_inventory_with_http_info(opts)\n nil\n end",
"def snapshot_disk(disk_id, metadata={})\n # TODO: Get vhd from 'vhd' container in vm storage account and use blob client to snapshot it\n end",
"def update\n @inventory = Accounting::Entry.take_inventory params[:item_id], @current_user.id, DateTime.parse(params[:date]), params[:amount]\n\n respond_to do |format|\n format.json { render json: @inventory }\n end\n end",
"def enrollment_snapshot(trading_partner_id, x12_file)\n scope 'default'\n url = URI.parse(@api_url + '/enrollment/snapshot')\n\n File.open(x12_file) do |f|\n req = Net::HTTP::Post::Multipart.new url.path,\n 'file' => UploadIO.new(f, 'application/EDI-X12', x12_file),\n 'trading_partner_id' => trading_partner_id\n req['Authorization'] = \"Bearer #{default_scope.token}\"\n req['User-Agent'] = user_agent\n\n @response = Net::HTTP.start(url.host, url.port) do |http|\n http.request(req)\n end\n end\n\n JSON.parse(@response.body)\n end",
"def createNewSnapshot\n snap_id = @deploy.getResourceName(@config[\"name\"]) + Time.new.strftime(\"%M%S\").to_s\n\n attempts = 0\n begin\n MU::Cloud::AWS.elasticache(region: @region, credentials: @credentials).create_snapshot(\n cache_cluster_id: @config[\"identifier\"],\n snapshot_name: snap_id\n )\n rescue Aws::ElastiCache::Errors::InvalidCacheClusterState => e\n if attempts < 10\n MU.log \"Tried to create snapshot for #{@config[\"identifier\"]} but cache cluster is busy, retrying a few times\"\n attempts += 1\n sleep 30\n retry\n else\n raise MuError, \"Failed to create snpashot for cache cluster #{@config[\"identifier\"]}: #{e.inspect}\"\n end\n end\n \n attempts = 0\n loop do\n MU.log \"Waiting for snapshot of cache cluster #{@config[\"identifier\"]} to be ready...\", MU::NOTICE if attempts % 20 == 0\n MU.log \"Waiting for snapshot of cache cluster #{@config[\"identifier\"]} to be ready...\", MU::DEBUG\n\n snapshot_resp = MU::Cloud::AWS.elasticache(region: @region, credentials: @credentials).describe_snapshots(snapshot_name: snap_id)\n attempts += 1\n break unless snapshot_resp.snapshots.first.snapshot_status != \"available\"\n sleep 15\n end\n\n return snap_id\n end",
"def build_snapshot\n raise \"build_snapshot not implemented in #{self}\"\n end",
"def create_snapshot_bundle\n # we shouldn't specify -k $EC2_PRIVATE_KEY since we assume private keys are already appended to /root/.ssh/authorized_keys\n # but it's a required parameter -- doh!\n run \"#{ec2_cmd('ec2-bundle-vol')} -v #{volume_to_bundle} -d #{bundling_directory} -k $EC2_PRIVATE_KEY -u #{@ec2_user_id} -s #{volume_size}\"\n end",
"def restore(body = {}, params = {})\n response = client.post \"/_snapshot/{repository}/{snapshot}/_restore\", update_params(params, body: body, action: \"snapshot.restore\", rest_api: \"snapshot.restore\")\n response.body\n end",
"def create_db_snapshot(identifier, name)\n request({\n 'Action' => 'CreateDBSnapshot',\n 'DBInstanceIdentifier' => identifier,\n 'DBSnapshotIdentifier' => name,\n :parser => Fog::Parsers::AWS::RDS::CreateDBSnapshot.new\n })\n end",
"def create\n @take_inventory = TakeInventory.new(take_inventory_params)\n\n respond_to do |format|\n if @take_inventory.save\n format.html { redirect_to @take_inventory, notice: 'Take inventory was successfully created.' }\n format.json { render :show, status: :created, location: @take_inventory }\n else\n format.html { render :new }\n format.json { render json: @take_inventory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inventory_entry = InventoryEntry.new(params[:inventory_entry])\n\n respond_to do |format|\n if @inventory_entry.save\n format.html { redirect_to @inventory_entry, notice: 'Inventory entry was successfully created.' }\n format.json { render json: @inventory_entry, status: :created, location: @inventory_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inventory_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inventory = Inventory.new(inventory_params)\n\n respond_to do |format|\n if @inventory.save\n format.html { redirect_to @inventory, notice: 'Inventory was successfully created.' }\n format.json { render :show, status: :created, location: @inventory }\n else\n format.html { render :new }\n format.json { render json: @inventory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inventory = Inventory.new(inventory_params)\n\n respond_to do |format|\n if @inventory.save\n format.html { redirect_to @inventory, notice: 'Inventory was successfully created.' }\n format.json { render :show, status: :created, location: @inventory }\n else\n format.html { render :new }\n format.json { render json: @inventory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_snapshot()\r\n result={}\r\n\tresult[:session]=[]\r\n\tdt=Time.now()\r\n\t#logger.debug(\"Hello Jerry World #{snap_data[:image_buffer].inspect()}\\n\")#[:image_buffer].inspect()\r\n\tsite_id=params[1]\r\n\ts_session=params[3]\r\n\ttrace=params[2]\r\n\tuser_ip=params[0]\r\n\tan=Site.find(site_id.to_i).analyzer\r\n\tn_f=Datalog.cal_noise_floor(trace,an.id)\r\n f_session= (s_session!=\"\" && Snapshot.exists?(:session=>s_session)) ? s_session : \"#{dt.to_i}_#{site_id}_#{user_ip}\"\r\n\tsnap=Snapshot.new()\t \r\n\tsnap.update_attributes(:image=>trace,:source=>'Realview',:noise_floor=>n_f,:create_dt=>dt,:site_id=>site_id,:session=>f_session,:description=>\"livetrace\")\r\n result[:session]=f_session \r\n respond_to do |format|\r\n\t\t\tformat.amf { \r\n\t\t render :amf => result\r\n\t\t \t}\r\n\t end\r\n end",
"def inventory_data\n {}\n end",
"def inventory_data\n {}\n end",
"def take_a_snapshot\n raise NotImplementedError\n end",
"def roll_back_to_share_snapshot_post(param, opts = {})\n data, _status_code, _headers = roll_back_to_share_snapshot_post_with_http_info(param, opts)\n return data\n end",
"def snapshot_disk(disk_id, metadata)\n metadata = Hash[metadata.map { |key, value| [key.to_s, value] }]\n\n with_thread_name(\"snapshot_disk(#{disk_id})\") do\n volume = @ec2_resource.volume(disk_id)\n devices = []\n volume.attachments.each { |attachment| devices << attachment.device }\n\n name = ['deployment', 'job', 'index'].collect { |key| metadata[key] }\n\n unless devices.empty?\n name << devices.first.split('/').last\n metadata['device'] = devices.first\n end\n\n snapshot = volume.create_snapshot(description: name.join('/'))\n logger.info(\"snapshot '#{snapshot.id}' of volume '#{disk_id}' created\")\n\n metadata.merge!(\n 'director' => metadata['director_name'],\n 'instance_index' => metadata['index'].to_s,\n 'instance_name' => metadata['job'] + '/' + metadata['instance_id'],\n 'Name' => name.join('/')\n )\n\n %w[director_name index job].each do |tag|\n metadata.delete(tag)\n end\n\n TagManager.create_tags(snapshot, **metadata)\n ResourceWait.for_snapshot(snapshot: snapshot, state: 'completed')\n snapshot.id\n end\n end",
"def copy_snapshots! snaps\n # account_snapshots = account.snapshots\n # backed_up_snapshots = self.snapshots\n # backed_up_snapshot_descriptions = backed_up_snapshots.collect { |bus| bus.description }\n if snaps.count > 0\n VfSnapshots.verbose \"\\n#{snaps.count} to copy, here we go.\"\n else\n VfSnapshots.verbose \"\\nNothing to copy.\"\n end\n begin\n tags = { tags: [\n {\n key: \"Account\",\n value: account.name,\n },\n ]\n }\n\n snaps.each_with_index do |snapshot,idx|\n VfSnapshots.verbose \"\\n[#{idx+1} of #{snaps.length}] Copying #{account.name} #{snapshot.description}\"\n\n # modify the source snapshot to share with the backup account\n snapshot.modify_attribute(attribute:'createVolumePermission', operation_type: 'add', user_ids: [ account.account_id ], create_volume_permission: { add: [{ user_id: account_id }] } )\n # get it in the backup account\n shared_snapshot = ec2.snapshot(snapshot.id)\n region = 'us-east-1'\n new_desc = \"#{account.name} #{snapshot.description}\"\n copy_response = shared_snapshot.copy(\n description: new_desc,\n source_region: region,\n destination_region: region,\n )\n ec2.snapshot(copy_response.snapshot_id).create_tags tags\n # puts \"Sleeping...\"\n # sleep 1\n # puts \"Woke!\"\n end\n rescue Aws::EC2::Errors::ResourceLimitExceeded\n VfSnapshots.verbose \"\\nThrottled!\"\n exit\n end\n end",
"def create\n @inventory = Inventory.new(inventory_params)\n\n respond_to do |format|\n if @inventory.save\n format.html { redirect_to @inventory, notice: 'Inventory was successfully created.' }\n format.json { render action: 'show', status: :created, location: @inventory }\n else\n format.html { render action: 'new' }\n format.json { render json: @inventory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_snapshot(metadata={})\n Azure::Blobs.create_snapshot(self, metadata)\n end",
"def update\n respond_to do |format|\n if @snapshot.update_attributes(params[:snapshot])\n flash[:notice] = 'Snapshot was successfully updated.'\n format.html { redirect_to(@snapshot) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @snapshot.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_snapshot(vm, name)\n task = vm.CreateSnapshot_Task(\n name: name,\n memory: false,\n quiesce: false)\n\n if block_given?\n task.wait_for_progress do |progress|\n yield progress unless progress.nil?\n end\n else\n task.wait_for_completion\n end\n end",
"def takeSnapshot(description= nil)\n\n #@return : the Snapshot instance for this snapshot\t\n\t\t response = RestClient.post(\"https://#{Cbthelper.username}:#{Cbthelper.authkey}@crossbrowsertesting.com/api/v3/selenium/#{@testId}/snapshots\",\n\t\t \t\"selenium_test_id=#{@testId}\")\n\t\t hash = /(?<=\"hash\": \")((\\w|\\d)*)/.match(response)[0]\n\t\t snap = Snapshot.new(hash, @testId)\n\t\t if description != nil\n\t\t \tsnap.setDescription(description)\n\t\t end\n\t\t return snap\n\n\tend",
"def create_backup\n @slice = Xen::Slice.find(params[:id])\n @slice.create_backup\n\n respond_to do |format|\n format.html { redirect_to slice_path(@slice.name)}\n format.xml { render :xml => @backups }\n end\n end",
"def create\n @reserve_inventory = ReserveInventory.new(inventory_params)\n\n respond_to do |format|\n if @reserve_inventory.save\n format.html { redirect_to @reserve_inventory, notice: 'ReserveInventory was successfully created.' }\n format.json { render :show, status: :created, location: @reserve_inventory }\n else\n format.html { render :new }\n format.json { render json: @reserve_inventory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def take_snapshot\n select\n end",
"def create_snap # rubocop:disable Metrics/AbcSize\n authcookie = ComputeBase.new\n authcookie = authcookie.authenticate(id_domain, user, passwd, restendpoint)\n url = restendpoint + @function\n uri = URI.parse(url)\n #account = '/Compute-' + @id_domain + '/' + @user\n account = '/Compute-' + id_domain + '/cloud_storage'\n create_data = Hash.new\n create_data = { 'account' => account, 'instance' => container }\n create_data['machineimage'] = @machine_image if !@machine_image.nil?\n http = Net::HTTP.new(uri.host, uri.port, @proxy_addr, @proxy_port) # Creates a http object\n http.use_ssl = true # When using https\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(uri.request_uri)\n request.add_field 'Cookie', authcookie\n request.add_field 'Content-type', 'application/oracle-compute-v3+json'\n http.request(request, create_data.to_json)\n end",
"def snapshot\n @snapshot ||= begin\n snapshot = hash.clone\n if snapshot.key?(:custom)\n snapshot[:custom] = hash[:custom].clone\n end\n snapshot\n end\n end",
"def create_from_snapshot(snapshot_name, properties, volume_template = nil, is_permanent = true)\n snapshot = get_snapshot(snapshot_name)\n raise IncompleteResource, 'Snapshot not found!' unless snapshot\n storage_pool_uri = nil\n volume_template_uri = if volume_template.nil?\n storage_pool_uri = @data['storagePoolUri']\n get_volume_template_uri(isRoot: true, family: 'StoreServ')\n else\n raise IncompleteResource, 'Volume Template not found!' unless volume_template.retrieve!\n storage_pool_uri = volume_template['storagePoolUri']\n volume_template['uri']\n end\n\n data = {\n 'properties' => properties.merge('storagePool' => storage_pool_uri, 'snapshotPool' => storage_pool_uri),\n 'snapshotUri' => snapshot['uri'],\n 'templateUri' => volume_template_uri,\n 'isPermanent' => is_permanent\n }\n\n response = @client.rest_post(\"#{BASE_URI}/from-snapshot\", { 'body' => data }, @api_version)\n self.class.new(@client, client.response_handler(response))\n end",
"def add_aos_version_box(args = {}) \n post(\"/aosversions.json/aosversionbox\", args)\nend",
"def get(params = {})\n # Set snapshot name or we'll get the repository instead\n snapshot = name || \"_all\"\n response = client.get \"/_snapshot/{repository}/{snapshot}\", update_params(params, snapshot: snapshot, action: \"snapshot.get\", rest_api: \"snapshot.get\")\n response.body\n end"
] |
[
"0.7063605",
"0.6874044",
"0.65961987",
"0.65095544",
"0.623067",
"0.6076004",
"0.5891567",
"0.5864759",
"0.58224505",
"0.57561773",
"0.5733231",
"0.5695487",
"0.5695487",
"0.5670691",
"0.5603551",
"0.5540606",
"0.549805",
"0.5497956",
"0.5493898",
"0.54928637",
"0.54853433",
"0.5483492",
"0.545212",
"0.5428852",
"0.53977734",
"0.5394104",
"0.5389711",
"0.53690886",
"0.5361186",
"0.534972",
"0.5340407",
"0.5334787",
"0.532466",
"0.531867",
"0.53161675",
"0.53041923",
"0.528588",
"0.5281176",
"0.52693856",
"0.5238271",
"0.52318734",
"0.5219678",
"0.5190939",
"0.51861274",
"0.5173967",
"0.5145632",
"0.5135203",
"0.5130705",
"0.51290923",
"0.5120697",
"0.5117507",
"0.5113777",
"0.5113536",
"0.5108013",
"0.50931954",
"0.5092875",
"0.5086494",
"0.5084803",
"0.5069566",
"0.5060062",
"0.50571734",
"0.5046354",
"0.50447994",
"0.5042862",
"0.50402427",
"0.503341",
"0.50324845",
"0.50316334",
"0.50309014",
"0.5029127",
"0.502711",
"0.50239545",
"0.5012539",
"0.50077146",
"0.49975863",
"0.49970853",
"0.49955037",
"0.49922007",
"0.4987214",
"0.4987214",
"0.49821034",
"0.4972939",
"0.4972939",
"0.49701765",
"0.4959576",
"0.49561235",
"0.49559334",
"0.49541697",
"0.49470368",
"0.4946669",
"0.49425983",
"0.49350578",
"0.49263036",
"0.49107957",
"0.49107665",
"0.49103975",
"0.49068752",
"0.49054936",
"0.48980814",
"0.48939198"
] |
0.69451535
|
1
|
PATCH/PUT /inventory_snapshot_contents/1 PATCH/PUT /inventory_snapshot_contents/1.json
|
def update
respond_to do |format|
if @inventory_snapshot_content.update(inventory_snapshot_content_params)
format.html { redirect_to @inventory_snapshot_content, notice: 'Inventory snapshot content was successfully updated.' }
format.json { render :show, status: :ok, location: @inventory_snapshot_content }
else
format.html { render :edit }
format.json { render json: @inventory_snapshot_content.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_inventory_snapshot_content\n @inventory_snapshot_content = InventorySnapshotContent.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @snapshot.update_attributes(params[:snapshot])\n flash[:notice] = 'Snapshot was successfully updated.'\n format.html { redirect_to(@snapshot) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @snapshot.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @stashed_inventory = StashedInventory.find(params[:id])\n\n respond_to do |format|\n if @stashed_inventory.update_attributes(params[:stashed_inventory])\n format.html { redirect_to @stashed_inventory, notice: 'Stashed inventory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stashed_inventory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mounted_inventory.update(params[:mounted_inventory])\n format.html { redirect_to @mounted_inventory, notice: 'A mounted inventory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mounted_inventory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @inventory.update(inventory_params)\n format.html { redirect_to inventories_path, notice: 'Inventory was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventory }\n else\n format.html { render :edit }\n format.json { render json: @inventory.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 respond_to do |format|\n if @inventory.update(inventory_params)\n format.html { redirect_to @inventory, notice: 'Inventory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @inventory.errors, status: :unprocessable_entity }\n end\n end\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(params = {})\n params ||= {}\n params[:id] = @attributes[:id]\n raise MissingParameterError.new(\"Current object doesn't have a id\") unless @attributes[:id]\n raise InvalidParameterError.new(\"Bad parameter: id must be an Integer\") if params[:id] and !params[:id].is_a?(Integer)\n raise InvalidParameterError.new(\"Bad parameter: expires_at must be an String\") if params[:expires_at] and !params[:expires_at].is_a?(String)\n raise InvalidParameterError.new(\"Bad parameter: name must be an String\") if params[:name] and !params[:name].is_a?(String)\n raise InvalidParameterError.new(\"Bad parameter: paths must be an Array\") if params[:paths] and !params[:paths].is_a?(Array)\n raise MissingParameterError.new(\"Parameter missing: id\") unless params[:id]\n\n Api.send_request(\"/snapshots/#{@attributes[:id]}\", :patch, params, @options)\n end",
"def vagrant_json_update(image_name, version_entry)\n # Load the vagrant JSON file\n json_file = File.new(\"#{Packer::OUTPUT_DIR}/#{image_name}.json\", 'w+')\n json_str = json_file.read\n \n # Load the JSON data\n begin\n json_data = JSON.load json_str\n rescue JSON::ParserError\n json_data = {\n \"name\" => image_name,\n \"versions\" => []\n }\n end\n\n # This will make sure there are no duplicate\n # entries for each box version specified in the\n # JSON file\n json_data['versions'].each_index do |i|\n box_version = json_data['versions'][i]\n if box_version['version'] == version_entry['version']\n json_data['versions'][i].delete\n break\n end\n end\n\n # Insert the new version entry\n json_data['versions'].push version_entry\n \n # Write the thing\n json_file.puts JSON.dump json_data\nend",
"def update\n \n begin\n DetailValue.transaction do\n # Increment the instance version\n increment_instance_version\n @resource = update_value(params[:detail_id], \n params[:id], \n {\n 'lock_version' => params[:value][:lock_version],\n 'value' => params[:value][:value] \n })\n \n end\n render :response => :PUT\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end",
"def inventory_snapshot_content_params\n params.require(:inventory_snapshot_content).permit(:inventory_snapshot_id, :rfid_hardware_id, :trackable_id)\n end",
"def update\n respond_to do |format|\n if @inventory.update(inventory_params)\n format.html { redirect_to @inventory, notice: 'Inventory was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventory }\n else\n format.html { render :edit }\n format.json { render json: @inventory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @inventory.update(inventory_params)\n format.html { redirect_to @inventory, notice: 'Inventory was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventory }\n else\n format.html { render :edit }\n format.json { render json: @inventory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @inventory.update(inventory_params)\n format.html { redirect_to @inventory, notice: 'Inventory was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventory }\n else\n format.html { render :edit }\n format.json { render json: @inventory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @contents = args[:contents] if args.key?(:contents)\n end",
"def update!(**args)\n @contents = args[:contents] if args.key?(:contents)\n end",
"def update\n @inventory = Accounting::Entry.take_inventory params[:item_id], @current_user.id, DateTime.parse(params[:date]), params[:amount]\n\n respond_to do |format|\n format.json { render json: @inventory }\n end\n end",
"def update_snapshot(aws_id,commit_state)\n params = {:aws_id => aws_id, :commit_state => commit_state, :api_version => 1.0 }\n json=nil\n SystemTimer.timeout_after(@api_snap_timeout) do\n body = RestClient.put @api_url+\"/update_ebs_snapshot.js\",params\n puts \"UPDATED SNAP: #{aws_id}\"\n end\n json \n rescue Exception => e\n display_exception(e, \"update_snapshot(#{aws_id}, #{commit_state})\")\n end",
"def update\n respond_to do |format|\n if @inventory_file.update_attributes(inventory_file_params)\n flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.inventory_file'))\n format.html { redirect_to(@inventory_file) }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @inventory_file.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def test_put\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n contents = last_response.body\n contents_id = contents['_id']\n\n data = File.read 'sample-traces/1.json'\n put(\"/traces/#{contents_id}\", data, 'CONTENT_TYPE': 'application/json')\n contents = last_response.body\n\n assert_equal contents_id, contents['_id']\n end",
"def update\n @inventory_entry = InventoryEntry.find(params[:id])\n\n respond_to do |format|\n if @inventory_entry.update_attributes(params[:inventory_entry])\n format.html { redirect_to @inventory_entry, notice: 'Inventory entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inventory_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @take_inventory.update(take_inventory_params)\n format.html { redirect_to @take_inventory, notice: 'Take inventory was successfully updated.' }\n format.json { render :show, status: :ok, location: @take_inventory }\n else\n format.html { render :edit }\n format.json { render json: @take_inventory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @contents = args[:contents] if args.key?(:contents)\n @path = args[:path] if args.key?(:path)\n end",
"def update\n respond_to do |format|\n if @item_inventory.update(item_inventory_params)\n format.html { redirect_to @item_inventory, notice: 'Item inventory was successfully updated.' }\n format.json { render :show, status: :ok, location: @item_inventory }\n else\n format.html { render :edit }\n format.json { render json: @item_inventory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n add_breadcrumb @asset.asset_tag, inventory_path(@asset)\n add_breadcrumb \"Maintenance History\", inventory_maintenance_events_path(@asset)\n add_breadcrumb \"Service on #{@maintenance_event.date}\"\n add_breadcrumb \"Update\"\n\n respond_to do |format|\n if @maintenance_event.update(form_params)\n notify_user(:notice, \"The service record was successfully updated.\")\n format.html { redirect_to inventory_maintenance_event_url(@asset, @maintenance_event) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @maintenance_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @inventory_file.update(inventory_file_params)\n flash[:notice] = t('controller.successfully_updated', model: t('activerecord.models.inventory_file'))\n format.html { redirect_to(@inventory_file) }\n format.json { head :no_content }\n else\n prepare_options\n format.html { render action: \"edit\" }\n format.json { render json: @inventory_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @inventory_need.update(inventory_need_params)\n format.html { redirect_to @inventory_need }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @inventory_need.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @artifact.update(artifact_params)\n format.html { redirect_to @artifact, notice: (t 'artifacts.flash.updated') }\n format.json { render json: @artifact, status: :ok }\n else\n format.html { render :new }\n format.json { render json: @artifact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reserve_inventory.update(inventory_params)\n format.html { redirect_to @reserve_inventory, notice: 'ReserveInventory was successfully updated.' }\n format.json { render :show, status: :ok, location: @reserve_inventory }\n else\n format.html { render :edit }\n format.json { render json: @reserve_inventory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @instrument_version = InstrumentVersion.find(params[:id])\n\n respond_to do |format|\n if @instrument_version.update_attributes(params[:instrument_version])\n flash[:notice] = 'InstrumentVersion was successfully updated.'\n format.html { redirect_to(@instrument_version) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @instrument_version.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n if @snap.update(snap_params)\n render :show, status: :ok, location: @snap\n else\n render json: @snap.errors, status: :unprocessable_entity\n end\n end",
"def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @shot = Shot.find(params[:id])\n\n if @shot.update(shot_params)\n head :no_content\n else\n render json: @shot.errors, status: :unprocessable_entity\n end\n end",
"def update\n @inventory_item = InventoryItem.find(params[:id])\n @binder = Binder.find(@inventory_item.binder_id)\n \n authorize! :write, @inventory_item\n\n respond_to do |format|\n if @inventory_item.update_attributes(params[:inventory_item])\n @inventory_items = InventoryItem.where(:binder_id => @inventory_item.binder_id).order(\"name\")\n format.html { redirect_to @inventory_item, notice: 'Inventory item was successfully updated.' }\n format.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inventory_item.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def index\n @inventory_snapshot_contents = InventorySnapshotContent.all\n end",
"def update\n respond_to do |format|\n @old_ID = @asset.id\n asset_params[:id] = nil\n #get all activities from the asset and update their asset id\n @asset_activities = @asset.asset_activities\n if @asset = Asset.create(asset_params) \n #keep track of old assetID id for current asset\n format.html { redirect_to @asset, notice: 'Asset was successfully updated.' }\n format.json { head :no_content } \n #turn off current revision\n @old_revision_id = Revision.find_by(asset_id: @old_ID)\n #create revision record\n @new_revision = Revision.new()\n #inset new revision into table\n @new_revision.old_revision_id = @old_revision_id\n @new_revision.asset_id = @asset.id\n @new_revision.save()\n #update the activity ID that pertains to the asset ID\n @asset_activities.update_all(:asset_id => @asset.id)\n\n else\n format.html { render action: 'edit' }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_update_object_by_id\r\n\t VCR.use_cassette('edit_object') do\r\n\t\t cred=JSON.parse(YAML::load_file('test/fixtures/credential.yml').to_json)\r\n\t\t json = JSON.parse(File.read(\"test/fixtures/edit_specimen.json\"))\r\n\t\t id = json[\"id\"]\r\n\t\t json[\"id\"] = \"\" #id cannot be updated\r\n\t\t result=CordraRestClient::DigitalObject.update(API_URL, id, json, cred[\"uc_1\"])\r\n\r\n\t\t #check that the result is saved\r\n\t\t assert_equal 200, result[:code]\r\n\t\t assert_equal \"OK\", result[\"message\"]\r\n\t\tend\r\n\t end",
"def update\n respond_to do |format|\n if @inventory_item.update(inventory_item_params)\n format.html { redirect_to @inventory_item, notice: 'Inventory item was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventory_item }\n else\n format.html { render :edit }\n format.json { render json: @inventory_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @inventory_item.update(inventory_item_params)\n format.html { redirect_to @inventory_item, notice: 'Inventory item was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventory_item }\n else\n format.html { render :edit }\n format.json { render json: @inventory_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @inventory = Inventory.find(params[:id])\n @inventory.subtotal = (params[:inventory][:qty].to_f*@inventory.unit_price) if params[:inventory][:qty].present?\n if @inventory.update_attributes(params[:inventory])\n @inventories = current_company.inventories\n response_message = {:message => \"Item was updated successfully.\", :inventory => @inventory}\n else\n response_message = {:message => \"Please try again\"}\n end\n respond_to do |format|\n format.xml{render :xml => response_message }\n format.json{ render :json => response_message }\n end\n end",
"def update!(**args)\n @asset = args[:asset] if args.key?(:asset)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n @status = args[:status] if args.key?(:status)\n end",
"def create\n\n @inventory_snapshot_content = InventorySnapshotContent.new(inventory_snapshot_content_params)\n\n respond_to do |format|\n if @inventory_snapshot_content.save\n format.html { redirect_to @inventory_snapshot_content, notice: 'Inventory snapshot content was successfully created.' }\n format.json { render :show, status: :created, location: @inventory_snapshot_content }\n else\n format.html { render :new }\n format.json { render json: @inventory_snapshot_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @exportable_contents = args[:exportable_contents] if args.key?(:exportable_contents)\n @id = args[:id] if args.key?(:id)\n end",
"def update\n @inventoryitem = Inventoryitem.find(params[:id])\n\n respond_to do |format|\n if @inventoryitem.update_attributes(params[:inventoryitem])\n format.html { redirect_to @inventoryitem, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inventoryitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @revision = Revision.find(params[:id])\n\n if @revision.update(params[:revision])\n head :no_content\n else\n render json: @revision.errors, status: :unprocessable_entity\n end\n end",
"def update\n version_event = false\n\n if params.has_key?(:revision) and params[:revision] != @generic_file.content.latest_version.versionID\n revision = @generic_file.content.get_version(params[:revision])\n @generic_file.add_file_datastream(revision.content, :dsid => 'content')\n version_event = true\n begin\n Resque.enqueue(ContentRestoredVersionEventJob, @generic_file.pid, current_user.user_key, params[:revision])\n rescue Redis::CannotConnectError\n logger.error \"Redis is down!\"\n end\n end\n\n if params.has_key?(:filedata)\n return unless virus_check(params[:filedata]) == 0\n add_posted_blob_to_asset(@generic_file, params[:filedata])\n version_event = true\n begin\n Resque.enqueue(ContentNewVersionEventJob, @generic_file.pid, current_user.user_key)\n rescue Redis::CannotConnectError\n logger.error \"Redis is down!\"\n end\n end\n @generic_file.update_attributes(params[:generic_file].reject { |k,v| %w{ Filedata Filename revision part_of date_modified date_uploaded format }.include? k})\n @generic_file.set_visibility(params)\n @generic_file.date_modified = Time.now.ctime\n @generic_file.save\n # do not trigger an update event if a version event has already been triggered\n begin\n Resque.enqueue(ContentUpdateEventJob, @generic_file.pid, current_user.user_key) unless version_event\n rescue Redis::CannotConnectError\n logger.error \"Redis is down!\"\n end\n record_version_committer(@generic_file, current_user)\n redirect_to sufia.edit_generic_file_path(:tab => params[:redirect_tab]), :notice => render_to_string(:partial=>'generic_files/asset_updated_flash', :locals => { :generic_file => @generic_file })\n\n end",
"def update\n\n respond_to do |format|\n if @fixed_asset.update(fixed_asset_params)\n FixedAsset.reindex\n format.html { redirect_to @fixed_asset, notice: 'Fixed asset was successfully updated.' }\n format.json { render :show, status: :ok, location: @fixed_asset }\n else\n format.html { render :edit }\n format.json { render json: @fixed_asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @rackitem = Rackitem.find(params[:id])\n\n respond_to do |format|\n if @rackitem.update_attributes(params[:rackitem])\n format.html { redirect_to @rackitem, notice: 'Rackitem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rackitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @artefact = Artefact.find(params[:artefact_id])\n\n @asset = @artefact.assets.find(params[:id])\n\n respond_to do |format|\n if @asset.update_attributes(asset_params)\n format.html { redirect_to artefact_path(@artefact), notice: 'Asset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n record = Asset.find(params[:id])\n record.update_attributes(params[:record])\n \n respond_to do |format|\n format.html\n format.json {\n render json: {}\n }\n end\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 find_asset\n @asset.update!(asset_params)\n\n render json: @asset, adapter: :json\n end",
"def update!(**args)\n @compressed_document_trees = args[:compressed_document_trees] if args.key?(:compressed_document_trees)\n @converted_contents = args[:converted_contents] if args.key?(:converted_contents)\n @embedded_links_info = args[:embedded_links_info] if args.key?(:embedded_links_info)\n @headless_response = args[:headless_response] if args.key?(:headless_response)\n @is_alternate_snapshot = args[:is_alternate_snapshot] if args.key?(:is_alternate_snapshot)\n @original_encoding = args[:original_encoding] if args.key?(:original_encoding)\n @raw_redirect_info = args[:raw_redirect_info] if args.key?(:raw_redirect_info)\n @referenced_resource = args[:referenced_resource] if args.key?(:referenced_resource)\n @rendered_snapshot = args[:rendered_snapshot] if args.key?(:rendered_snapshot)\n @rendered_snapshot_image = args[:rendered_snapshot_image] if args.key?(:rendered_snapshot_image)\n @rendered_snapshot_metadata = args[:rendered_snapshot_metadata] if args.key?(:rendered_snapshot_metadata)\n @rendered_snapshot_quality_score = args[:rendered_snapshot_quality_score] if args.key?(:rendered_snapshot_quality_score)\n @rendering_output_metadata = args[:rendering_output_metadata] if args.key?(:rendering_output_metadata)\n @richcontent_data = args[:richcontent_data] if args.key?(:richcontent_data)\n end",
"def update!(**args)\n @asset = args[:asset] if args.key?(:asset)\n @asset_set = args[:asset_set] if args.key?(:asset_set)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n @status = args[:status] if args.key?(:status)\n end",
"def update\n @inventory_shelf_barcode = InventoryShelfBarcode.find(params[:id])\n\n respond_to do |format|\n if @inventory_shelf_barcode.update_attributes(params[:inventory_shelf_barcode])\n format.html { redirect_to @inventory_shelf_barcode, notice: 'Inventory shelf barcode was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inventory_shelf_barcode.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stage = Stage.find(params[:id])\n\n if @stage.update_attributes(params[:stage])\n head :no_content\n else\n format.json { render json: @stage.errors, status: :unprocessable_entity }\n end\n end",
"def update\n @inventory_detail = InventoryDetail.find(params[:id])\n\n respond_to do |format|\n if @inventory_detail.update_attributes(params[:inventory_detail])\n flash[:notice] = 'InventoryDetail was successfully updated.'\n format.html { redirect_to(@inventory_detail) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inventory_detail.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.attributes = params[:physical_rack]\n @physical_rack.audits << Audit.new(source: 'controller', action: 'update', admin_user: current_user)\n respond_to do |format|\n if @physical_rack.save\n format.html { redirect_to @physical_rack, notice: 'Physical rack was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @physical_rack.errors, status: :unprocessable_entity }\n end\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 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 respond_to do |format|\n if @inventory_check.update(inventory_check_params)\n format.html { redirect_to @inventory_check, notice: 'Inventory check was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @inventory_check.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @inventory_template = InventoryTemplate.find(params[:id])\n # @inventory_template.restaurant = current_owner.restaurant\n\n respond_to do |format|\n if @inventory_template.update_attributes(params[:inventory_template])\n format.html { redirect_to @inventory_template, notice: 'Inventory template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inventory_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @acl = args[:acl] if args.key?(:acl)\n @content = args[:content] if args.key?(:content)\n @item_type = args[:item_type] if args.key?(:item_type)\n @metadata = args[:metadata] if args.key?(:metadata)\n @name = args[:name] if args.key?(:name)\n @payload = args[:payload] if args.key?(:payload)\n @queue = args[:queue] if args.key?(:queue)\n @status = args[:status] if args.key?(:status)\n @structured_data = args[:structured_data] if args.key?(:structured_data)\n @version = args[:version] if args.key?(:version)\n end",
"def update!(**args)\n @acl = args[:acl] if args.key?(:acl)\n @content = args[:content] if args.key?(:content)\n @item_type = args[:item_type] if args.key?(:item_type)\n @metadata = args[:metadata] if args.key?(:metadata)\n @name = args[:name] if args.key?(:name)\n @payload = args[:payload] if args.key?(:payload)\n @queue = args[:queue] if args.key?(:queue)\n @status = args[:status] if args.key?(:status)\n @structured_data = args[:structured_data] if args.key?(:structured_data)\n @version = args[:version] if args.key?(:version)\n end",
"def update\n @inventory = Inventory.find(params[:id])\n\n respond_to do |format|\n if @inventory.update_attributes(params[:inventory])\n flash[:notice] = \"You've updated your inventory!\"\n format.html { redirect_to(@inventory) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inventory.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @inventory_status = InventoryStatus.find(params[:id])\n\n respond_to do |format|\n if @inventory_status.update_attributes(params[:inventory_status])\n format.html { redirect_to @inventory_status, notice: 'Inventory status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inventory_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n do_patch { return } # check if patch and do submission and return early if it is a patch (submission)\n # otherwise this is a PUT of the dataset metadata\n check_status { return } # check it's in progress, clone a submitted or raise an error\n respond_to do |format|\n format.json do\n dp = if @resource\n DatasetParser.new(hash: params['dataset'], id: @resource.identifier, user: @user) # update dataset\n else\n DatasetParser.new(hash: params['dataset'], user: @user, id_string: params[:id]) # upsert dataset with identifier\n end\n @stash_identifier = dp.parse\n ds = Dataset.new(identifier: @stash_identifier.to_s) # sets up display objects\n render json: ds.metadata, status: 200\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @shot = Shot.find(params[:id])\n\n respond_to do |format|\n if @shot.update_attributes(params[:shot])\n format.html { redirect_to @shot, notice: 'Shot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @artifacts = args[:artifacts] if args.key?(:artifacts)\n end",
"def update!(**args)\n @deleted = args[:deleted] if args.key?(:deleted)\n @description = args[:description] if args.key?(:description)\n @etag = args[:etag] if args.key?(:etag)\n @included_permissions = args[:included_permissions] if args.key?(:included_permissions)\n @name = args[:name] if args.key?(:name)\n @stage = args[:stage] if args.key?(:stage)\n @title = args[:title] if args.key?(:title)\n end",
"def update\n @shot = Shot.find(params[:id])\n @shot.update_attributes(shot_params)\n respond_with @shot\n end",
"def update\n respond_to do |format|\n if @property_toilet_artifact.update(property_toilet_artifact_params)\n format.html { redirect_to @property_toilet_artifact, notice: 'Property toilet artifact was successfully updated.' }\n format.json { render :show, status: :ok, location: @property_toilet_artifact }\n else\n format.html { render :edit }\n format.json { render json: @property_toilet_artifact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @contents = args[:contents] if args.key?(:contents)\n @default_viewport = args[:default_viewport] if args.key?(:default_viewport)\n @expandable = args[:expandable] if args.key?(:expandable)\n @key = args[:key] if args.key?(:key)\n @name = args[:name] if args.key?(:name)\n @type = args[:type] if args.key?(:type)\n @visibility = args[:visibility] if args.key?(:visibility)\n end",
"def update\n @snap = Snap.find(params[:id])\n\n respond_to do |format|\n if @snap.update_attributes(params[:snap])\n format.html { redirect_to(@snap, :notice => 'Snap was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @snap.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @mostsmalltrapeffectinventory = Mostsmalltrapeffectinventory.find(params[:id])\n\n respond_to do |format|\n if @mostsmalltrapeffectinventory.update_attributes(params[:mostsmalltrapeffectinventory])\n format.html { redirect_to @mostsmalltrapeffectinventory, notice: 'Mostsmalltrapeffectinventory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mostsmalltrapeffectinventory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n self.publish_json\n end",
"def snapshot\n begin\n response = resource[\"/snapshot/#{app}\"].post(nil)\n rescue RestClient::InternalServerError\n display \"An error has occurred.\"\n end\n display response.to_s\n end",
"def update!(**args)\n @contents = args[:contents] if args.key?(:contents)\n @errors = args[:errors] if args.key?(:errors)\n @is_pending = args[:is_pending] if args.key?(:is_pending)\n @is_sitemaps_index = args[:is_sitemaps_index] if args.key?(:is_sitemaps_index)\n @last_downloaded = args[:last_downloaded] if args.key?(:last_downloaded)\n @last_submitted = args[:last_submitted] if args.key?(:last_submitted)\n @path = args[:path] if args.key?(:path)\n @type = args[:type] if args.key?(:type)\n @warnings = args[:warnings] if args.key?(:warnings)\n end",
"def update\n @storage = @client.storages.find(params[:id])\n\n respond_to do |format|\n if @storage.update_attributes(params[:storage])\n format.html { redirect_to client_path(@client), notice: 'Storage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @storage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if check_user_permission(@artifact)\n respond_to do |format|\n if @artifact.update(artifact_params)\n format.html { redirect_to @artifact, notice: \"Artifact was successfully updated.\" }\n format.json { render :show, status: :ok, location: @artifact }\n else\n format.html { render :edit }\n format.json { render json: @artifact.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n if @entry_item.update_attributes(params[:entry_item])\n flash[:notice] = 'EntryItem was successfully updated.'\n #format.html { redirect_to(@entry_item) }\n format.xml { head :ok }\n else\n #format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(uuid, key, value)\n put(uri: \"/files/#{uuid}/metadata/#{key}/\", content: value.to_json)\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n @derived_struct_data = args[:derived_struct_data] if args.key?(:derived_struct_data)\n @id = args[:id] if args.key?(:id)\n @json_data = args[:json_data] if args.key?(:json_data)\n @name = args[:name] if args.key?(:name)\n @parent_document_id = args[:parent_document_id] if args.key?(:parent_document_id)\n @schema_id = args[:schema_id] if args.key?(:schema_id)\n @struct_data = args[:struct_data] if args.key?(:struct_data)\n end",
"def update\n respond_to do |format|\n if @stock_attachment.update(stock_attachment_params)\n format.html { redirect_to @stock_attachment, notice: 'Stock attachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @stock_attachment }\n else\n format.html { render :edit }\n format.json { render json: @stock_attachment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @inventory_filters = args[:inventory_filters] if args.key?(:inventory_filters)\n @resources = args[:resources] if args.key?(:resources)\n end",
"def update!(**args)\n @artifact_uri = args[:artifact_uri] if args.key?(:artifact_uri)\n @automatic_resources = args[:automatic_resources] if args.key?(:automatic_resources)\n @container_spec = args[:container_spec] if args.key?(:container_spec)\n @dedicated_resources = args[:dedicated_resources] if args.key?(:dedicated_resources)\n @large_model_reference = args[:large_model_reference] if args.key?(:large_model_reference)\n @model_display_name = args[:model_display_name] if args.key?(:model_display_name)\n @shared_resources = args[:shared_resources] if args.key?(:shared_resources)\n @title = args[:title] if args.key?(:title)\n end",
"def update!(**args)\n @contents = args[:contents] if args.key?(:contents)\n @default_viewport = args[:default_viewport] if args.key?(:default_viewport)\n @description = args[:description] if args.key?(:description)\n @id = args[:id] if args.key?(:id)\n @name = args[:name] if args.key?(:name)\n @project_id = args[:project_id] if args.key?(:project_id)\n end",
"def update_metadata(params)\n @client.put(metadata_path, nil, params, \"Content-Type\" => \"application/json\")\n end",
"def update_restore(request, &block)\n put \"/restore/#{request[:restore_id]}/\", request, &block\n end",
"def update!(**args)\n @etag = args[:etag] if args.key?(:etag)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end",
"def update!(**args)\n @errors = args[:errors] if args.key?(:errors)\n @etag = args[:etag] if args.key?(:etag)\n @items = args[:items] if args.key?(:items)\n @kind = args[:kind] if args.key?(:kind)\n end",
"def update!(**args)\n @content = args[:content] if args.key?(:content)\n @custom_ids = args[:custom_ids] if args.key?(:custom_ids)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @locale = args[:locale] if args.key?(:locale)\n @name = args[:name] if args.key?(:name)\n @status = args[:status] if args.key?(:status)\n @status_reports = args[:status_reports] if args.key?(:status_reports)\n @time_created = args[:time_created] if args.key?(:time_created)\n @type = args[:type] if args.key?(:type)\n @uploader_name = args[:uploader_name] if args.key?(:uploader_name)\n end",
"def update!(**args)\n @content_details = args[:content_details] if args.key?(:content_details)\n @etag = args[:etag] if args.key?(:etag)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @snippet = args[:snippet] if args.key?(:snippet)\n end",
"def update\n megam_rest.update_assembly(to_hash)\n end",
"def batch_change_inventory(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/inventory/changes/batch-create',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end)\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def update!(**args)\n @baseline = args[:baseline] if args.key?(:baseline)\n @deleted = args[:deleted] if args.key?(:deleted)\n @description = args[:description] if args.key?(:description)\n @etag = args[:etag] if args.key?(:etag)\n @instance_filter = args[:instance_filter] if args.key?(:instance_filter)\n @name = args[:name] if args.key?(:name)\n @os_policies = args[:os_policies] if args.key?(:os_policies)\n @reconciling = args[:reconciling] if args.key?(:reconciling)\n @revision_create_time = args[:revision_create_time] if args.key?(:revision_create_time)\n @revision_id = args[:revision_id] if args.key?(:revision_id)\n @rollout = args[:rollout] if args.key?(:rollout)\n @rollout_state = args[:rollout_state] if args.key?(:rollout_state)\n @uid = args[:uid] if args.key?(:uid)\n end",
"def item_inventory_update\n \n item = Item.find(params[:item_id])\n order= Order.find(params[:id])\n item_order = ItemOrder.where(item_id: item.id, order_id: order.id).first\n new_inventory = item.inventory - item_order.quantity\n item_order.update(status: \"fulfilled\")\n item.update(inventory: new_inventory)\n end"
] |
[
"0.63918066",
"0.6122518",
"0.61052436",
"0.60411817",
"0.5987605",
"0.59689766",
"0.5941832",
"0.5919314",
"0.59164494",
"0.5915763",
"0.58930266",
"0.5860993",
"0.5847519",
"0.5847519",
"0.5847519",
"0.58218503",
"0.58218503",
"0.58209634",
"0.581484",
"0.5792977",
"0.5749526",
"0.5748166",
"0.57439804",
"0.5718717",
"0.57133746",
"0.57042253",
"0.56980705",
"0.5679614",
"0.5673512",
"0.56639904",
"0.56637454",
"0.5662299",
"0.56617916",
"0.56405556",
"0.5636841",
"0.5636765",
"0.5620053",
"0.56038105",
"0.5587709",
"0.5586081",
"0.5586081",
"0.5579721",
"0.55786073",
"0.5556053",
"0.5549596",
"0.55464876",
"0.55368906",
"0.55282307",
"0.55043346",
"0.54776484",
"0.54759187",
"0.5473744",
"0.54735976",
"0.5470885",
"0.5466164",
"0.54565495",
"0.54544955",
"0.54444957",
"0.5432187",
"0.5431592",
"0.5430774",
"0.54304016",
"0.5421926",
"0.54214096",
"0.54166526",
"0.54166526",
"0.5413053",
"0.5412175",
"0.5410548",
"0.54100364",
"0.5388148",
"0.5380145",
"0.5380035",
"0.53792524",
"0.53772587",
"0.53706795",
"0.53612995",
"0.5358064",
"0.53579605",
"0.5352476",
"0.53486633",
"0.53476006",
"0.53443164",
"0.534154",
"0.53414285",
"0.53398544",
"0.5339349",
"0.53337836",
"0.53307986",
"0.53238636",
"0.5322739",
"0.53191143",
"0.5312529",
"0.5310357",
"0.53025585",
"0.5299489",
"0.52975494",
"0.5296323",
"0.52921385",
"0.52908796"
] |
0.72562665
|
0
|
DELETE /inventory_snapshot_contents/1 DELETE /inventory_snapshot_contents/1.json
|
def destroy
@inventory_snapshot_content.destroy
respond_to do |format|
format.html { redirect_to inventory_snapshot_contents_url, notice: 'Inventory snapshot content was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete_snapshot(snapshot_id)\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @snapshot.destroy\n\n respond_to do |format|\n format.html { redirect_to(snapshots_url) }\n format.xml { head :ok }\n end\n end",
"def delete_snapshot(name)\n result = get_snapshot(name)\n response = @client.rest_delete(result['uri'], { 'If-Match' => result['eTag'] }, @api_version)\n @client.response_handler(response)\n true\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def delete(params = {})\n response = client.delete \"/_snapshot/{repository}/{snapshot}\", update_params(params, action: \"snapshot.delete\", rest_api: \"snapshot.delete\")\n response.body\n end",
"def destroy\n @inventory_file.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_files_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventory_file.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_files_url }\n format.json { head :no_content }\n end\n end",
"def deleteEBSSnapshot(client=nil,snapshots_to_delete=[],dry_run=true)\n return false if client.nil?\n unless snapshots_to_delete.instance_of? Array\n snapshots_to_delete = [snapshots_to_delete]\n end\n snapshots_to_delete.each do |snapshot|\n if dry_run\n printf \"\\e[33m\\\"Delete snapshot #{snapshot}?\\\" (y/n)? \\e[0m\"\n prompt = STDIN.gets.chomp\n next unless prompt == \"y\"\n end\n print \"Deleting ec2 snapshot #{snapshot}...\"\n begin\n # delete_snapshot API has no response\n client.delete_snapshot({\n dry_run: dry_run,\n snapshot_id: snapshot\n })\n puts \"\\e[32msuccess\\e[0m\"\n rescue Exception => e\n puts \"\\e[31mfailed - #{e.message}\\e[0m\"\n end\n end\n return 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_snapshot snapshot\n subscriber.delete_snapshot snapshot: snapshot_path(snapshot)\n end",
"def delete\n ensure_service!\n service.delete_snapshot name\n true\n end",
"def delete_snapshot(key)\n\n raise ArgumentError.new('key must be an String') unless( key.is_a?(String) )\n\n endpoint = format( '/api/snapshots-delete/%s', key)\n @logger.debug(\"Deleting snapshot id #{key} (GET #{endpoint})\") if @debug\n\n delete(endpoint)\n end",
"def snap_delete(volume,snapshot)\n output = @filer.invoke(\"snapshot-delete\",\"volume\",volume,\"snapshot\",snapshot)\n if (output.results_status() == \"failed\")\n raise \"Error #{output.results_errno} deleting snapshot #{snapshot} on #{volume}: #{output.results_reason()}\\n\"\n end\n end",
"def destroy\n @inventory_entry = InventoryEntry.find(params[:id])\n @inventory_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_entries_url }\n format.json { head :no_content }\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 @inventory.destroy\n respond_to do |format|\n format.html { redirect_to inventories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @snap = Snap.find(params[:id])\n @snap.destroy\n\n respond_to do |format|\n format.html { redirect_to(snaps_url) }\n format.xml { head :ok }\n end\n end",
"def snap_delete(volume,snapshot)\n output = @filer.invoke(\"snapshot-create\",\"volume\",volume,\"snapshot\",snapshot)\n if (output.results_status() == \"failed\")\n raise \"Error #{output.results_errno} creating snapshot #{snapshot} on #{volume}: #{output.results_reason()}\\n\"\n end\n end",
"def destroy\n @stashed_inventory = StashedInventory.find(params[:id])\n @stashed_inventory.destroy\n\n respond_to do |format|\n format.html { redirect_to @stashed_inventory.product }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mounted_inventory.destroy\n respond_to do |format|\n format.html { redirect_to mounted_inventories_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 @screenshot = Screenshot.find(params[:id])\n @screenshot.destroy\n\n respond_to do |format|\n format.html { redirect_to screenshots_url }\n format.json { head :no_content }\n end\n end",
"def delete\n @service.delete_snapshot(self)\n end",
"def purgeOldSnapshots(profile,region)\n json = `aws --profile #{profile} --region #{region} ec2 describe-snapshots --owner-ids self`\n parsed = JSON.parse(json)\n parsed[\"Snapshots\"].each do |snapshot|\n desc = snapshot[\"Description\"]\n snapid = snapshot[\"SnapshotId\"]\n if desc.to_s.match('deleteafter')\n deletedate = desc.to_s.split('-deleteafter').last\n vol = desc.to_s.split('-deleteafter').first\n if Date.strptime(deletedate, \"%Y-%m-%d\") < Date.today\n puts \"Deleting #{snapid} for volume #{vol}- Due date: #{deletedate}\"\n `aws --profile #{profile} --region #{region} ec2 delete-snapshot --snapshot-id #{snapid}`\n end\n end\n end\nend",
"def delete(path)\n repository = path.split(/\\//)[2]\n objectid = path.split(/\\//)[3]\n if storage_fetch(repository, objectid) && storage_delete(repository, objectid)\n ['200', {}, []]\n else\n ['404', {}, [\"Repository #{repository} or ObjectID #{objectid} not found: #{path}\"]]\n end\n end",
"def destroy\n @inventory_detail = InventoryDetail.find(params[:id])\n @inventory_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to(inventory_details_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @inventoryitem = Inventoryitem.find(params[:id])\n @inventoryitem.destroy\n\n respond_to do |format|\n format.html { redirect_to inventoryitems_url }\n format.json { head :no_content }\n end\n end",
"def delete(key)\n log \"deleting #{key} from #{container_path}\"\n object_path = File.join(container_path, Raca::Util.url_encode(key))\n response = storage_client.delete(object_path)\n (200..299).cover?(response.code.to_i)\n end",
"def destroy_rest\n @instrument_version = InstrumentVersion.find(params[:id])\n @instrument_version.destroy\n\n respond_to do |format|\n format.html { redirect_to(instrument_versions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @inventory = Inventory.find(params[:id])\n @inventory.destroy\n\n respond_to do |format|\n format.html { redirect_to(inventories_url) }\n format.xml { head :ok }\n end\n end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def delete # rubocop:disable Metrics/AbcSize\n attrcheck = { 'container name' => @options[:container] }\n @validate.attrvalidate(@options, attrcheck)\n containerview = ObjectStorage.new(@options[:id_domain], @options[:user_name], @options[:passwd])\n if @options[:recurse]\n contents = containerview.contents(@options[:container])\n container_contents = contents.body.split(/\\n/)\n container_contents.each do |content|\n containerview.delete_content(@options[:container], content)\n puts 'deleted ' + content\n end\n end\n containerview = containerview.delete(@options[:container])\n if containerview.code == '204'\n puts \"Container #{@options[:container]} deleted\"\n else\n @util.response_handler(containerview)\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! snaps\n if snaps.count > 0\n VfSnapshots.verbose \"\\n#{snaps.count} to delete, here we go.\"\n else\n VfSnapshots.verbose \"\\nNothing to delete.\"\n end\n begin\n snaps.each_with_index do |snapshot,idx|\n VfSnapshots.verbose \"[#{idx+1} of #{snaps.length}] Deleting #{account.name} #{snapshot.description}\"\n snapshot.delete\n # puts \"Sleeping...\"\n # sleep 1\n # puts \"Woke!\"\n end\n rescue Aws::EC2::Errors::ResourceLimitExceeded\n VfSnapshots.verbose \"\\nThrottled!\"\n exit\n end\n end",
"def destroy\n @daily_inventory = DailyInventory.find(params[:id])\n @daily_inventory.destroy\n\n respond_to do |format|\n format.html { redirect_to daily_inventories_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 @logstash = Logstash.find(params[:id])\n @logstash.destroy\n\n respond_to do |format|\n format.html { redirect_to logstashes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventory.destroy\n respond_to do |format|\n format.html { redirect_to inventories_path, notice: 'Inventory was successfully destroyed.' }\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 delete_snapshot(name)\n Fission::Action::Snapshot::Deleter.new(self).delete_snapshot(name)\n end",
"def destroy\n @backup.destroy\n respond_to do |format|\n format.html { redirect_to backups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventory_check.destroy\n respond_to do |format|\n format.html { redirect_to inventory_checks_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end",
"def destroy\n @inventory.destroy\n respond_to do |format|\n format.html { redirect_to inventories_url, notice: 'Inventory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventory.destroy\n respond_to do |format|\n format.html { redirect_to inventories_url, notice: 'Inventory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventory.destroy\n respond_to do |format|\n format.html { redirect_to inventories_url, notice: 'Inventory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity_inventory = ActivityInventory.find(params[:id])\n @activity_inventory.destroy\n\n respond_to do |format|\n format.html { redirect_to(activity_inventories_url) }\n format.xml { head :ok }\n end\n end",
"def delete_fusion_vm_snapshot(options)\n clone_list = []\n if options['clone'].to_s.match(/\\*/) or options['clone'].to_s.match(/all/)\n clone_list = get_fusion_vm_snapshots(options)\n clone_list = clone_list.split(\"\\n\")[1..-1]\n else\n clone_list[0] = options['clone']\n end\n clone_list.each do |clone|\n fusion_vmx_file = get_fusion_vm_vmx_file(options)\n message = \"Information:\\tDeleting snapshot \"+clone+\" for #{options['vmapp']} VM \"+options['name']\n command = \"'#{options['vmrun']}' -T fusion deleteSnapshot '#{fusion_vmx_file}' '#{clone}'\"\n execute_command(options,message,command)\n end\n return\nend",
"def destroy\n @take_inventory.destroy\n respond_to do |format|\n format.html { redirect_to take_inventories_url, notice: 'Take inventory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_snapshot(snapshot_id)\n log \"\\e[0;31m:: Deleting snapshot:\\e[0m #{snapshot_id}\"\n\n begin\n ec2.delete_snapshot(snapshot_id)\n sleep 0.2\n rescue Fog::Compute::AWS::NotFound\n log \"Failed to delete snapshot: #{snapshot_id}; setting { 'protected' => true }\"\n ec2.tags.create({resource_id: snapshot_id, key: 'protected', value: 'true'})\n rescue Fog::Compute::AWS::Error\n log \"API Error\"\n end\n\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 @mostsmalltrapeffectinventory = Mostsmalltrapeffectinventory.find(params[:id])\n @mostsmalltrapeffectinventory.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmalltrapeffectinventories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventory_status = InventoryStatus.find(params[:id])\n @inventory_status.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_statuses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @backup_file = BackupFile.find(params[:id])\n @backup_file.destroy\n\n respond_to do |format|\n format.html { redirect_to backup_files_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventory_template = InventoryTemplate.find(params[:id])\n @inventory_template.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item_inventory.destroy\n respond_to do |format|\n format.html { redirect_to item_inventories_url, notice: 'Item inventory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n repo = assets_repo\n repo.destroy(params[:id])\n\n respond_to do |format|\n format.html { redirect_to v_assets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sub1_line_item.destroy\n respond_to do |format|\n format.html { redirect_to sub1_line_items_url, notice: 'Sub1 line item was successfully destroyed.' }\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 @asset_allocation_history = AssetAllocationHistory.find(params[:id])\n @asset_allocation_history.destroy\n\n respond_to do |format|\n format.html { redirect_to asset_allocation_histories_url }\n format.json { head :no_content }\n end\n end",
"def delete\n raise HistoricalIntegrityViolation unless current?\n transaction do\n original_uri = @uri\n record = CloudKit.storage_adapter[@id]\n record['uri'] = \"#{@uri.string}/versions/#{@etag}\"\n record['archived'] = escape(true)\n @uri = wrap_uri(record['uri'])\n @archived = unescape(record['archived'])\n CloudKit.storage_adapter[@id] = record\n self.class.new(original_uri, @json, @remote_user, {:deleted => true}).save\n end\n reload\n end",
"def destroy\n @shot.destroy\n\n head :no_content\n end",
"def destroy\r\n @event.destroy\r\n @item.image.destroy # remove image from s3\r\n @item.image.clear # queues attachment to be deleted\r\n respond_to do |format|\r\n format.html { redirect_to events_url }\r\n format.json { head :no_content }\r\n end\r\n flash[:success] = \"Event deleted.\"\r\n redirect_to events_url\r\n end",
"def delete(uuid, key)\n request(method: 'DELETE', uri: \"/files/#{uuid}/metadata/#{key}/\")\n end",
"def delete(container_name, file_name)\n validate_path_elements(container_name, file_name)\n\n client.request(\n method: :delete,\n path: \"#{container_name}/#{file_name}\",\n expected: 204\n )\n end",
"def destroy\n @reserve_inventory.destroy\n respond_to do |format|\n format.html { redirect_to reserve_inventories_path, notice: 'ReserveInventory was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize @artifact, :can_manage_artifacts?\n if @artifact.destroy\n render :json => @artifact, :status => :ok\n else\n render :js => \"alert('error deleting attachment');\"\n end\n #redirect_to tenant_project_url(tenant_id: Tenant.current_tenant_id, id: @artifact.project_id), notice: 'Artifact was successfully destroyed.'\n end",
"def destroy\n @volume.destroy\n respond_to do |format|\n format.html { redirect_to volumes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventory_item.destroy\n respond_to do |format|\n format.html { redirect_to inventory_items_url, notice: 'Inventory item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventory_item.destroy\n respond_to do |format|\n format.html { redirect_to inventory_items_url, notice: 'Inventory item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @revision = Revision.find(params[:id])\n @revision.destroy\n\n head :no_content\n end",
"def delete\n response = client[\"/vaults/#{vault_id}/blobs/#{blob_id}\"].delete\n response.code == 200\n end",
"def remove_artifacts(job_ids)\n\n job_ids.each do |id|\n api_url = \"#{BASE_URL}/v4/projects/#{PROJECT_ID}/jobs/#{id}/artifacts\"\n\n begin\n response = RestClient::Request.new(\n :method => :delete,\n :url => api_url,\n :verify_ssl => false,\n :headers => {\"PRIVATE-TOKEN\" => API_TOKEN}\n ).execute\n\n if response != nil && response.code == 204\n puts \"delete job artifacts #{id} => success\"\n else\n puts \"delete job artifacts #{id} => failed\"\n end\n\n rescue RestClient::ExceptionWithResponse => err\n puts \"delete job artifacts #{id} => error\"\n end\n end\n\nend",
"def destroy\n @inventory_part = InventoryPart.find(params[:id])\n @inventory_part.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_parts_url }\n format.json { head :no_content }\n end\n end",
"def delete_from_entzumena\n headline = Headline.where({:source_item_type => params[:source_item_type], :source_item_id => params[:source_item_id]}).first\n if headline.destroy\n render :json => true, :status => 200\n else\n render :json => false, :status => :error\n end\n end",
"def destroy\n @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 @invoice_row.destroy\n respond_to do |format|\n format.html { redirect_to invoice_rows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testfile.destroy\n respond_to do |format|\n format.html { redirect_to materials_path }\n format.json { head :no_content }\n end\n end",
"def test_delete_object_by_id\r\n\t VCR.use_cassette('delete_object') do\r\n\t\t cred=JSON.parse(YAML::load_file('test/fixtures/credential.yml').to_json)\r\n\t\t id = \"#{CORDRA_PREFIX}/newspecimen03\"\r\n\t\t result=CordraRestClient::DigitalObject.delete(API_URL, id, cred[\"uc_1\"])\r\n\r\n\t\t #check that the result is saved\r\n\t\t assert_equal 200, result[:code]\r\n\t\t assert_equal \"OK\", result[\"message\"]\r\n\t\tend\r\n\t end",
"def destroy\n @mostsmallitemequipinventory = Mostsmallitemequipinventory.find(params[:id])\n @mostsmallitemequipinventory.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallitemequipinventories_url }\n format.json { head :no_content }\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 @file_version.destroy\n head :no_content\n end",
"def destroy\n @inventory_item = InventoryItem.find(params[:id])\n @inventory_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(inventory_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n output = \"oneimage delete #{resource[:name]} \", self.class.login\n `#{output}`\n end",
"def destroy\n @database = Database.find(params[:id])\n path = @database.path\n delete = %x[rm -R #{path}]\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_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 Audit.find(params[:id]).destroy\n head :no_content\n end",
"def destroy\n @shot = Shot.find(params[:id])\n @shot.destroy\n\n respond_to do |format|\n format.html { redirect_to(shots_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @inventory_item.destroy\n respond_to do |format|\n format.html { redirect_to backoffice_inventory_list_path, notice: 'Bem de patrimônio deletado com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @inventory_report = InventoryReport.find(params[:id])\n @inventory_report.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_reports_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project_screenshot = ProjectScreenshot.find(params[:id])\n @project_screenshot.destroy\n\n respond_to do |format|\n format.html { redirect_to project_screenshots_url }\n format.json { head :no_content }\n end\n end",
"def delete_storage(request, params)\n # --- Get the Image ---\n image = ImageOCCI.new(\n Image.build_xml(params[:id]),\n @client)\n\n # --- Delete the Image ---\n rc = image.delete\n if OpenNebula.is_error?(rc)\n return rc, CloudServer::HTTP_ERROR_CODE[rc.errno]\n end\n\n return \"\", 204\n end",
"def destroy\n @asset_recovery.destroy\n respond_to do |format|\n format.html { redirect_to asset_recoveries_url, notice: 'Asset recovery was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shot = Shot.find(params[:id])\n @shot.destroy\n\n respond_to do |format|\n format.html { redirect_to shots_url }\n format.json { head :no_content }\n end\n end",
"def delete_snapshot(snapshot_name)\n execute(:delete_snapshot, VmID: vm_id, SnapName: snapshot_name)\n end",
"def delete_snapshot(vm, name)\n snapshot = enumerate_snapshots(vm).find { |s| s.name == name }\n\n # No snapshot matching \"name\"\n return nil if snapshot.nil?\n\n task = snapshot.snapshot.RemoveSnapshot_Task(removeChildren: false)\n\n if block_given?\n task.wait_for_progress do |progress|\n yield progress unless progress.nil?\n end\n else\n task.wait_for_completion\n end\n end",
"def b2_delete_file(file)\n\n if parse_files_json(file) == {}\n\n puts \"File not present\"\n\n else\n \n result_hash = convert_json(b2_delete_file_version(file))\n\n if result_hash[\"fileName\"] == file\n puts \"File deleted successfully\"\n else\n puts \"Error deleting file\"\n end\n\n end\n\nend"
] |
[
"0.71034294",
"0.6989312",
"0.698219",
"0.6873329",
"0.6862213",
"0.67356247",
"0.67318803",
"0.67318803",
"0.66691077",
"0.66383034",
"0.6449294",
"0.64359504",
"0.64261997",
"0.6413788",
"0.6397142",
"0.63857067",
"0.63417417",
"0.63295454",
"0.632338",
"0.6293428",
"0.6273916",
"0.6270182",
"0.62631094",
"0.62412965",
"0.62296486",
"0.62252396",
"0.6222182",
"0.62160057",
"0.6209939",
"0.6207192",
"0.6205561",
"0.6199206",
"0.61872905",
"0.6186877",
"0.616704",
"0.61627823",
"0.6155935",
"0.61498475",
"0.6140658",
"0.6140346",
"0.6135444",
"0.6130087",
"0.61256605",
"0.6116277",
"0.6114989",
"0.61139214",
"0.61139214",
"0.61139214",
"0.6113339",
"0.6112863",
"0.6104609",
"0.6093993",
"0.60920143",
"0.6089045",
"0.60748637",
"0.6070117",
"0.6067886",
"0.60552233",
"0.6053276",
"0.6044211",
"0.60438746",
"0.6042315",
"0.6037239",
"0.60286164",
"0.60203195",
"0.5994315",
"0.5991654",
"0.5990824",
"0.5990314",
"0.5989878",
"0.59866035",
"0.59866035",
"0.59841263",
"0.5982721",
"0.5974313",
"0.5974097",
"0.5973978",
"0.59727657",
"0.59704304",
"0.5963327",
"0.59595555",
"0.59582675",
"0.5953022",
"0.5949926",
"0.5943837",
"0.5940479",
"0.5940461",
"0.5939368",
"0.5938152",
"0.59366536",
"0.5934612",
"0.59316134",
"0.5929089",
"0.5925512",
"0.5924589",
"0.5924307",
"0.5920575",
"0.591985",
"0.5919375",
"0.5914301"
] |
0.74888015
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_inventory_snapshot_content
@inventory_snapshot_content = InventorySnapshotContent.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def inventory_snapshot_content_params
params.require(:inventory_snapshot_content).permit(:inventory_snapshot_id, :rfid_hardware_id, :trackable_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
|
before_action :configure_account_update_params, only: [:update] GET /resource/sign_up
|
def new
@user = User.new
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def configure_account_update_params\n devise_parameter_sanitizer.permit(\n :account_update, keys: authentication_params(type: :sign_up)\n )\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:email,:password, :password_confirmation, :first_name, :last_name, :circonscription])\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name, :email, :password, :password_confirmation, :circonscription])\n end",
"def configure_update_params\n allow_params(:account_update)\n end",
"def update_sanitized_params\n\t\tdevise_parameter_sanitizer.for(:sign_up) \t\t\t\t{ |u| u.permit(:name, :email, :password, :password_confirmation, :company, :role_type, :celp_no, :approval, :authorize) }\n\t\tdevise_parameter_sanitizer.for(:account_update) { |u| u.permit(:name, :email, :password, :password_confirmation, :current_password, :company, :role_type, :celp_no, :approval, :authorize) }\n\tend",
"def configure_sign_up_params\n #devise_parameter_sanitizer.for(:sign_up) << :email, :password, :password_confirmation\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:email, :password, :password_confirmation, :picture, :bio, :username ) }\n\n devise_parameter_sanitizer.for(:account_update) << :bio\n devise_parameter_sanitizer.for(:account_update) << :role\n devise_parameter_sanitizer.for(:account_update) << :type\n devise_parameter_sanitizer.for(:account_update) << :picture\n devise_parameter_sanitizer.for(:account_update) << :username\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:email,\n :password, :username, :first_name, :last_name])\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name, :email, :password, :password_confirmation, :about, :profile_pic, :role, :display_title, :skype_id, :linkedin_url, :github_url])\n end",
"def configure_account_update_params\n if request.content_type == 'application/json' || request.content_type == 'text/plain'\n params[:registration].permit(:email, :password, :birth_date, :first_name, :last_name, :alias, :current_password, :password, :mobile)\n else\n params[:user].permit(:email, :password, :birth_date, :first_name, :last_name, :alias, :current_password, :password, :mobile)\n end\n end",
"def update\n set_action(:update)\n set_account_type\n validate_account_type!\n assign_params\n set_affiliate\n set_updated_by\n\n after_update\n account\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) << [\n :name, :current_profession, :years_experience,\n :desired_profession, :desired_location, :work_status\n ]\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) << [:attribute , :first_name , :last_name, :profile_image]\n end",
"def account_update_params\n\t\tparams.require(:user).permit(:email, :password, :password_confirmation, :username, :current_password, :age, :bio, :gender)\n\tend",
"def update_sanitized_params\n devise_parameter_sanitizer.for(:sign_up) {|u| u.permit(:email, :password, :password_confirmation, :phone)}\n devise_parameter_sanitizer.for(:account_update) {|u| u.permit(:email, :password, :password_confirmation, :phone)}\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name, :email, :phone_number, :current_password, :password, :password_confirmation, :place, :zip_code, :city, :sector])\n end",
"def sign_up_params\n params.require(resource_name).permit(\n :name,\n :email,\n :profile,\n :password,\n :password_confirmation\n )\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update) do |user_params|\n user_params.permit(:email, :password, :password_confirmation, :current_password, :names, :surnames, :area_of_residence_id, :area_of_interest_id)\n end\n end",
"def configure_params_update\n devise_parameter_sanitizer.permit(:account_update, keys: [:name, :email])\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:fname, :lname, :avatar, :bio, :school, :job, :nickname, :grade, :major, :hometown])\n end",
"def configure_account_update_params\n devise_params_sanitizer.permit(:account_update, keys: [:name, :description, :password, :email, :password_confirmation, :avatar])\n end",
"def configure_perimitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys:[:fname, :lname, :username, :seller])\n devise_parameter_sanitizer.permit(:account_update, keys:[:fname, :lname, :username, :seller])\n end",
"def configure_account_update_params\n\n devise_parameter_sanitizer.permit(:account_update, keys: [:name, :cpf])\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) << [:email]\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name, :email, :password])\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:username, :fname, :lname, :avatar, :bio, :street, :city, :state, :country, :lat, :lng])\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) << :username\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [\n :username, :profilename, :avatar, :cover, :birthday, :birthday_visibility,\n :country, :language\n ])\n end",
"def configure_account_update_params\n # devise_parameter_sanitizer.permit(:account_update, :keys => [:username])\n devise_parameter_sanitizer.for(:account_update) << :username\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: UPDATE_KEYS)\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: %i[first_name last_name organization admin])\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:username])\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:username])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) do |user|\n user.permit(:name, :email, :user_avatar, :password, :password_confirmation)\n end\n devise_parameter_sanitizer.for(:account_update) do |user|\n user.permit(:name, :email, :user_avatar, :password, :password_confirmation, :current_password, :commit)\n end\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:email, :name])\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :middle_name, :last_name, :phone, \n :gender, :birthday, :graduation_date, :school, :organization, :email])\n end",
"def configure_account_update_params\n # devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])\n params.require(:user).permit(:firstname,:lastname ,:email, :password,:password_confirmation,:current_password,:phone,:address,:avatar)\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:name, :phone, :real_estate_company, :real_estate_company_id])\n end",
"def configure_account_update_params\n devise_parameter_sanitizer\n .permit(:account_update,\n keys:\n %i[first_name\n last_name\n affiliation\n training_status_id\n timezone])\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:firstname, :lastname, :username ])\n devise_parameter_sanitizer.permit(:account_update, keys: [:firstname, :lastname, :username])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [\n :first_name,\n :last_name,\n :street,\n :apartment_number,\n :city,\n :state,\n :zip_code,\n :phone,\n :email,\n :password])\n devise_parameter_sanitizer.permit(:account_update, keys: [\n :first_name,\n :last_name,\n :street,\n :apartment_number,\n :city,\n :state,\n :zip_code,\n :phone,\n :email,\n :password,\n :current_password])\n end",
"def configure_permitted_parameters\n added_attrs = [:email, :first_name, :last_name, :account_type]\n devise_parameter_sanitizer.permit :sign_up, keys: added_attrs\n devise_parameter_sanitizer.permit :account_update, keys: added_attrs\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) << :shopname << :address\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name, :membership_number, :authorized_for_app])\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name, :membership_number, :authorized_for_app])\n end",
"def account_update_params \n params.require(:user).permit(:username, :email, :password, :password_confirmation, :current_password)\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name])\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name])\n end",
"def configure_account_update_params\n update_attrs = [:password, :password_confirmation, :current_password]\n devise_parameter_sanitizer.permit :account_update, keys: update_attrs\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: custom_parameters)\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) {\n |u| u.permit( :email, :password,\n :first_name, :last_name, :company_name, roles: [])}\n end",
"def account_update_params\n params.require(:user).permit(:email, :password, :password_confirmation, :current_password)\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) << :first_name << :last_name << :phone_number\n end",
"def configure_account_update_params\n\n devise_parameter_sanitizer.permit(:update_user, keys: [:email, :password, :password_confirmation, :current_password, :prenom, :nom])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:username, :first_name, :last_name])\n devise_parameter_sanitizer.permit(:account_update, keys: [:username, :first_name, :last_name])\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:nickname])\n end",
"def account_update_params\n params.require(:user).permit(:is_active)\n # devise_parameter_sanitizer.permit(:account_update, keys: [:is_active])\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) << [:password, :password_confirmation,\n :current_password, :global_email_notifications]\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:name])\n end",
"def account_update\n #define our custom strong parameters by monkey patching Devise's account_update method which controls\n #which fields/props are mass assigned in the RegistrationController during /users/edit PUT\n default_params.permit(:first_name, :last_name, :email, :password, :password_confirmation, :current_password)\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, \\\n keys: %i[name date_of_birth username])\n end",
"def configure_account_update_params\n # devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])\n params.require(:user).permit(:firstname,:lastname ,:email, :gender, :phone,:address)\nend",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name])\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name])\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) << :first_name << :last_name\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name, :role])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:username]) \n devise_parameter_sanitizer.permit(:account_update, keys: [:username])\nend",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) do |u|\n u.permit(:username, :first_name, :last_name,\n :email, :postcode, :city, :rating, :password, :phone_number, :password_confirmation)\n end\n devise_parameter_sanitizer.for(:account_update) do |u|\n u.permit(:username, :first_name, :last_name,\n :email, :postcode, :city, :rating, :password, :phone_number, :password_confirmation, :current_password)\n end\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:nick_name,:mobile_phone, :location, :password, :password_confirmation, :current_password) }\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:name, :phone, :workgroup, :timezone])\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:nickname, :major_id])\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:name, :company_id, :birthday, :admin])\n end",
"def account_update_params\n params.fetch(:user).permit(:title, :email, :password, :password_confirmation, :thumbnail, :description, :current_password)\n end",
"def account_update_params\n params.require(:user).permit(:username, :bio, :email, :password, :password_confirmation, :current_password, :full_name, :profile_image_datafile)\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) do |u|\n u.permit(:first_name, :last_name, :zipcode, :money_transfer_destination_id,\n :email, :password, :password_confirmation, :accept_emails, :accept_terms)\n end\n devise_parameter_sanitizer.for(:account_update) do |u|\n u.permit(:first_name, :last_name, :zipcode, :money_transfer_destination_id,\n :email, :password, :password_confirmation, :current_password)\n end\n end",
"def account_update_params\n params.require(:user).permit(\n :first_name,\n :last_name,\n :company_name,\n :location,\n :email,\n :password,\n :password_confirmation,\n :current_password,\n :description,\n :business,\n :birth_date,\n :gender,\n :education,\n :field,\n :pay_rate,\n :availability,\n :description\n )\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) << :nickname\n end",
"def account_update_params\n params.require(:user).permit(:email, :password, :password_confirmation, :gender, :bio)\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up) do |u|\n u.permit(:name, :last_name,\n :email, :password, :password_confirmation)\n end\n devise_parameter_sanitizer.permit(:account_update) do |u|\n u.permit(:name, :last_name,\n :email, :password, :password_confirmation, :current_password)\n end\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name])#Permits first & last name for sign_up.\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name])#Permits first & last name for account_update(user profile edit).\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) << [:role_id,\n :store_name,\n :avatar,\n :name,\n :passport,\n :birthdate]\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:firstname,:middlename,:lastname,:contact,:birthday,:gender, :bio, :username])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up) do |u|\n u.permit(:email, :password, :password_confirmation, :first_name, :last_name, :sex, :date_of_birth, :contact_no, :address)\n end\n devise_parameter_sanitizer.permit(:account_update) do |u|\n u.permit(:password, :password_confirmation, :first_name, :last_name, :sex, :date_of_birth, :contact_no, :address)\n end\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name,:avatar, :nickname])\n end",
"def configure_permitted_parameters\n added_attrs = [:email, :first_name, :last_name]\n devise_parameter_sanitizer.permit :sign_up, keys: added_attrs\n devise_parameter_sanitizer.permit :account_update, keys: added_attrs\n end",
"def configure_permitted_parameters\n added_attrs = [:email, :first_name, :last_name]\n devise_parameter_sanitizer.permit :sign_up, keys: added_attrs\n devise_parameter_sanitizer.permit :account_update, keys: added_attrs\n end",
"def configure_permitted_parameters\n added_attrs = [:email, :first_name, :last_name]\n devise_parameter_sanitizer.permit :sign_up, keys: added_attrs\n devise_parameter_sanitizer.permit :account_update, keys: added_attrs\n end",
"def configure_permitted_parameters\n\t \tattributes = [:name, :email, :password, :password_confirmation, :remember_me]\n \tdevise_parameter_sanitizer.permit(:sign_up, keys: attributes)\n \tdevise_parameter_sanitizer.permit(:account_update, keys: attributes)\n\t end",
"def update_sanitized_params\n devise_parameter_sanitizer.permit(:account_update) do |user_params|\n user_params.permit(:name, :last_name, :login, :about, :adress, :email, :country,:avatar,:terms_of_service, :birth_date,:current_password, :password, :password_confirmation, :zip_code, :city, :phone)\n end\n\n devise_parameter_sanitizer.permit(:sign_up) do |user_params|\n user_params.permit(:name, :last_name, :login, :about, :email, :country,:avatar,:terms_of_service, :birth_date,:current_password, :password, :password_confirmation, :zip_code, :city, :phone)\n end\n\n devise_parameter_sanitizer.permit(:sign_in) do |user_params|\n user_params.permit(:name, :last_name, :login, :about, :email, :country,:avatar,:terms_of_service, :birth_date,:current_password, :password, :password_confirmation, :zip_code, :city, :phone)\n end\n \n end",
"def configure_permitted_parameters\n added_attrs = %i[username email password password_confirmation]\n devise_parameter_sanitizer.permit :sign_up, keys: added_attrs\n devise_parameter_sanitizer.permit :account_update, keys: added_attrs\n end",
"def account_update_params\n params.require(:user).permit(:name, :last_name, :email, :password, :password_confirmation, :current_password)\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) << :attribute\n end",
"def account_update_params\n params.require(:user).permit(:password, :password_confirmation, :name, :dob, :sex, :location, :about, :art_style, :avatar)\n end",
"def configure_permitted_parameters\n added_attrs = [:username, :email, :password, :password_confirmation]\n devise_parameter_sanitizer.permit :sign_up, keys: added_attrs\n devise_parameter_sanitizer.permit :account_update, keys: added_attrs\n end",
"def configure_permitted_parameters\n \t\n devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :email, :role, :year, :password])\n devise_parameter_sanitizer.permit(:account_update, keys: [:name, :email, :role, :year, :password, :current_password])\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:name, :email, :password, :password_confirmation, :tag_name])\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) << [:first_name, :last_name, :time_zone, :stripe_id, photo_attributes: [:file, :remote_file_url]]\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])\n end"
] |
[
"0.7499267",
"0.71698177",
"0.7040482",
"0.7001558",
"0.69494694",
"0.6947952",
"0.6911424",
"0.6848661",
"0.6848325",
"0.6831332",
"0.68107826",
"0.6782843",
"0.67642134",
"0.6758337",
"0.6755052",
"0.67527187",
"0.6745702",
"0.6733424",
"0.6731361",
"0.6719885",
"0.67175007",
"0.67172587",
"0.67059094",
"0.6704998",
"0.6701723",
"0.6699669",
"0.6688252",
"0.6676212",
"0.66755146",
"0.66745746",
"0.66745746",
"0.6664701",
"0.6653802",
"0.6651901",
"0.66480166",
"0.6646257",
"0.6642054",
"0.66386026",
"0.6624359",
"0.66238946",
"0.6617441",
"0.6615822",
"0.66127765",
"0.6609285",
"0.66083425",
"0.66061544",
"0.660509",
"0.660502",
"0.66021055",
"0.6594576",
"0.6593063",
"0.65914726",
"0.65872484",
"0.65844184",
"0.6584288",
"0.6582233",
"0.6580329",
"0.6579752",
"0.6577701",
"0.65760326",
"0.65760326",
"0.6575006",
"0.657321",
"0.6568194",
"0.6556534",
"0.6554814",
"0.6553079",
"0.65505385",
"0.6549526",
"0.6548427",
"0.654572",
"0.65447164",
"0.6544361",
"0.65436375",
"0.6542142",
"0.6541744",
"0.65373963",
"0.6534695",
"0.65344447",
"0.6534317",
"0.6532995",
"0.65298796",
"0.65298796",
"0.65298796",
"0.6522851",
"0.65222466",
"0.6521425",
"0.65204436",
"0.6518498",
"0.6516316",
"0.6515933",
"0.6514243",
"0.65129995",
"0.65120995",
"0.6511772",
"0.6511772",
"0.6511772",
"0.6511772",
"0.6511772",
"0.6511772",
"0.6511772"
] |
0.0
|
-1
|
GET /resource/edit def edit super end PUT /resource
|
def update
self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key)
prev_unconfirmed_email = resource.unconfirmed_email if resource.respond_to?(:unconfirmed_email)
resource_updated = update_resource(resource, account_update_params)
yield resource if block_given?
if resource_updated
if is_flashing_format?
flash_key = update_needs_confirmation?(resource, prev_unconfirmed_email) ?
:update_needs_confirmation : :updated
set_flash_message :notice, flash_key
end
sign_in resource_name, resource, bypass: true
respond_with resource, location: after_update_path_for(resource)
else
clean_up_passwords resource
respond_with resource
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def edit\n respond_with(resource)\n end",
"def edit\n @resource = Resource.find(params[:id])\n \n respond_to do |format|\n # format.html { render :layout => false }\n format.html\n format.any(:xml, :json) { render request.format.to_sym => @resource }\n end\n end",
"def edit\n respond_to do |format|\n format.html { render :action => resource_template(\"edit\") }\n end\n end",
"def edit(options = {}, &block)\n object = get_resource_ivar || find_resource\n\n respond_with(object, options, &block)\n end",
"def edit\n @resource = Admin.find(params[:id])\n end",
"def edit\n authorize! :edit, resource\n yield if block_given? # after_edit\n respond_with resource\n end",
"def edit\n resource.before_actions[:edit].call(@record) if resource.before_actions[:edit]\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n add_breadcrumb I18n.t('integral.actions.view'), backend_resource_url(@resource)\n add_breadcrumb I18n.t('integral.actions.edit')\n end",
"def update\n @resource = Resource.find(params[:id])\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n format.html { redirect_to(edit_admin_resource_path(@resource), :notice => 'Resource was successfully updated.') }\n format.xml { head :ok }\n else\n get_resource_info\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def update\n @resource = Resource.find(params[:id])\n \n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n flash[:notice] = 'Resource was successfully updated.'\n format.html { redirect_to(@resource) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit\r\n end",
"def update\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def edit\n\n end",
"def update\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n flash[:notice] = 'Resource was successfully updated.'\n format.html { redirect_to(@resource) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n flash[:notice] = 'Resource was successfully updated.'\n format.html { redirect_to(@resource) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @resource.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end",
"def edit\n end"
] |
[
"0.84682256",
"0.79906833",
"0.784054",
"0.76603776",
"0.7518685",
"0.7514583",
"0.7485632",
"0.7473292",
"0.73174673",
"0.73140186",
"0.73098606",
"0.7260759",
"0.7260759",
"0.7260759",
"0.7260759",
"0.7260759",
"0.7260759",
"0.7260759",
"0.7260759",
"0.7260759",
"0.7260759",
"0.7260759",
"0.7260759",
"0.7260759",
"0.7245805",
"0.7236653",
"0.7224149",
"0.7224149",
"0.7218493",
"0.7218493",
"0.7218493",
"0.7218493",
"0.7218493",
"0.7218493",
"0.7218493",
"0.7218493",
"0.7218493",
"0.7218493",
"0.7218493",
"0.7218493",
"0.7218493",
"0.7218493",
"0.7205608",
"0.7205608",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545",
"0.71508545"
] |
0.0
|
-1
|
If you have extra params to permit, append them to the sanitizer.
|
def configure_sign_up_params
devise_parameter_sanitizer.permit(:sign_up, keys: [:role, :first_name, :last_name, :company_name, :postal_code, :city, :province, :gender, :birth_date])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"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(:user).permit(param_whitelist)\n end",
"def devise_parameter_sanitizer; end",
"def update_sanitized_params\n\t\t\tdevise_parameter_sanitizer.for(:sign_up) {|u| u.permit(:name, :email, :password, :password_confirmation)}\n\t\tend",
"def sign_up_params\n devise_parameter_sanitizer.sanitize(:sign_up)\n end",
"def update_sanitized_params\n devise_parameter_sanitizer.for(:sign_up) {|u| u.permit(:password_confirmation ,:password ,:email, :role, :avatar, :avatar_cache, :remove_avatar, :invite_code, :firstname, :lastname)}\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def permit(*permitted)\n hardened_params = params.dup\n\n hardened_params.keep_if { |k, _v| permitted.flatten.include?(k.to_sym) }\n\n hardened_params.symbolize_keys\n end",
"def update_sanitized_params\n devise_parameter_sanitizer.for(:sign_up) {|u| u.permit(:name, :email, :approved , :password, :password_confirmation,:approved, :role_ids => [], affiliate_person_attributes: [:name], :performer_attributes => [ :first_name, :avatar, :photo_id, :profile_thumb, :profile_gif, :photo_id, :location_id, :avatar, :id, :white_label_id, :twitter_sign_in, :video_upload_twitter, :order_placed_twitter] )}\n devise_parameter_sanitizer.for(:account_update) {|u| u.permit(:name, :email, :password, :password_confirmation,:approved, :sign_in_twitter, :video_upload_twitter, :order_placed_twitter, :performer => [], :role_ids => [], :performer_attributes => [ :first_name, :avatar, :photo_id, :profile_thumb, :profile_gif, :photo_id, :location_id, :avatar, :id, :white_label_id])}\n end",
"def update_sanitized_params\n devise_parameter_sanitizer.for(:sign_up) {|u| u.permit(:email, :password, :password_confirmation, :phone)}\n devise_parameter_sanitizer.for(:account_update) {|u| u.permit(:email, :password, :password_confirmation, :phone)}\n end",
"def strong_params\n params.require(:team_member).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 safe_params\n params.require(:user).permit(:name)\n end",
"def permit_all_params options = {}\n prepend_before_filter do\n self.params.deep_permit!\n end\n end",
"def sanitize_params\n if valid_lease?\n sanitize_lease_params\n elsif valid_embargo?\n sanitize_embargo_params\n elsif !wants_lease? && !wants_embargo?\n sanitize_unrestricted_params\n else\n @attributes\n end\n end",
"def 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 sanitized_allowed_attributes=(attributes); end",
"def sanitized_allowed_attributes=(attributes); end",
"def update_sanitized_params\n\t\tdevise_parameter_sanitizer.for(:sign_up) \t\t\t\t{ |u| u.permit(:name, :email, :password, :password_confirmation, :company, :role_type, :celp_no, :approval, :authorize) }\n\t\tdevise_parameter_sanitizer.for(:account_update) { |u| u.permit(:name, :email, :password, :password_confirmation, :current_password, :company, :role_type, :celp_no, :approval, :authorize) }\n\tend",
"def student_params(*args) #is the helper method \n\n\t\tparams.require(:student).permit(*args)\n\t\t#uses .require and .permit methods as stronger params to prevent hacks through inspect element right click edit html \n\t\t#require restricts, permit allows, and *args is for the custom arguments\n\tend",
"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 strong_params\n params.require(:experience).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 whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def devise_parameter_sanitizer\n if resource_class == User\n User::ParameterSanitizer.new(User, :user, params)\n else\n super\n end\n end",
"def devise_parameter_sanitizer\n if resource_class == User\n User::ParameterSanitizer.new(User, :user, params)\n else\n super\n end\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 sanitize_attrs(attrs = {}, permitted = [])\n sanitized = {}\n attrs.each do |key, value|\n sanitized[key.to_s] = value if permitted.include?(key.to_s)\n end\n sanitized\n end",
"def additional_permitted_params\n []\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def student_params\n params.require(:student).permit(:name, :sex, :birthplace, :birthdate, :phone, :email, :employment,\n :street_address, :district, :regency_city, :religion, :registered_at,\n :avatar, :crop_x, :crop_y, :crop_w, :crop_h).tap do |whitelisted|\n if params[:student][:biodata]\n whitelisted[:biodata] = params[:student][:biodata]\n end\n end\n end",
"def user_strong_params\n html_safe(params[:user]).strip\n end",
"def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"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 update_sanitized_params\n\t\t\tif \"#{resource_name}\" == \"lecturer\"\n\t\t\t\tdevise_parameter_sanitizer.for(:sign_up) {\n\t\t\t\t\t|lecturer| lecturer.permit(:name, :email,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :department)\n\t\t\t\t}\n\t\t\t\tdevise_parameter_sanitizer.for(:account_update) {\n\t\t\t\t\t|lecturer| lecturer.permit(:name, :current_password,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :department,\n\t\t\t\t\t\t:profile_image, :profile_image_cache)\n\t\t\t\t}\n\t\t\telsif \"#{resource_name}\" == \"student\"\n\t\t\t\tdevise_parameter_sanitizer.for(:sign_up) {\n\t\t\t\t\t|student| student.permit(:name, :email,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :faculty, :major, :semester,\n\t\t\t\t\t\t:advising, :probation)\n\t\t\t\t}\n\t\t\t\tdevise_parameter_sanitizer.for(:account_update) {\n\t\t\t\t\t|student| student.permit(:name, :current_password,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :faculty, :major, :semester,\n\t\t\t\t\t\t:advising, :probation, :profile_image,\n\t\t\t\t\t\t:profile_image_cache)\n\t\t\t\t}\n\t\t\telsif \"#{resource_name}\" == \"teaching_assistant\"\n\t\t\t\tdevise_parameter_sanitizer.for(:sign_up) {\n\t\t\t\t\t|teaching_assistant| teaching_assistant.permit(:name,\n\t\t\t\t\t\t:email, :password, :password_confirmation,\n\t\t\t\t\t\t:graduated_from, :graduated_year, :degree,\n\t\t\t\t\t\t:university, :department)\n\t\t\t\t}\n\t\t\t\tdevise_parameter_sanitizer.for(:account_update) {\n\t\t\t\t\t|teaching_assistant| teaching_assistant.permit(:name,\n\t\t\t\t\t\t:current_password, :password, :password_confirmation,\n\t\t\t\t\t\t:graduated_from, :graduated_year, :degree,\n\t\t\t\t\t\t:university, :department, :profile_image,\n\t\t\t\t\t\t:profile_image_cache)\n\t\t\t\t}\n\t\t\tend\n\t\tend",
"def quote_params\n params.permit!\n end",
"def configure_permitted_parameters\n extra_params = [:full_name, :programme, :student_number]\n devise_parameter_sanitizer.for(:sign_up).push(*extra_params)\n devise_parameter_sanitizer.for(:account_update).push(*extra_params)\n end",
"def post_card_params\n params[:post_card].permit!\n end",
"def sanitize_params(params = params)\n params = walk_hash(params) if params\n end",
"def expected_permitted_parameter_names; end",
"def white_params\n params.require(:therapist).permit(Therapist.therapist_whitelist, \n therapist_availability_attributes:Therapist.therapist_availability_whitelist, \n therapist_availability_rec_attributes:Therapist.therapist_recurring_whitelist)\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def permit_params_on_create *keys\n filter_strong_params :permit, [:create], keys\n end",
"def sanitize_params(params = params)\n params = walk_hash(params) if params\n end",
"def surgery_params\n params.require(:surgery).permit(:name)\n end",
"def safe_params\n params.require(:youtube_search).permit(:search_terms, :alert_on_new_result)\n end",
"def post_params\n permit_params\n end",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def update_sanitized_params\n devise_parameter_sanitizer.permit(:account_update) do |user_params|\n user_params.permit(:name, :last_name, :login, :about, :adress, :email, :country,:avatar,:terms_of_service, :birth_date,:current_password, :password, :password_confirmation, :zip_code, :city, :phone)\n end\n\n devise_parameter_sanitizer.permit(:sign_up) do |user_params|\n user_params.permit(:name, :last_name, :login, :about, :email, :country,:avatar,:terms_of_service, :birth_date,:current_password, :password, :password_confirmation, :zip_code, :city, :phone)\n end\n\n devise_parameter_sanitizer.permit(:sign_in) do |user_params|\n user_params.permit(:name, :last_name, :login, :about, :email, :country,:avatar,:terms_of_service, :birth_date,:current_password, :password, :password_confirmation, :zip_code, :city, :phone)\n end\n \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 specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def sanitize!(request)\n [ :path, :query, :body ].each do |name|\n send(\"#{name}_parameters\").sanitize_object!(request.params)\n end\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 strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def surgical_params\n params.require(:surgical).permit(Surgical.safe_attributes)\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 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 configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) << :terms_of_service << :first_name << :last_name\n devise_parameter_sanitizer.for(:account_update) << :first_name << :last_name\n end",
"def safe_params\n safe_attributes = %i[name key]\n params.require(:role).permit(safe_attributes)\n end",
"def permitted_params\n if is_singleton?\n singleton_permitted_params\n else\n params.require(:data).permit(allowed_resource_params.to_a)\n end\n end",
"def submission_params\n allowed = :student_number, :last_name, :first_name, :week, :hours, :comments, :email, :github, :challenging\n (1..Course.current.exercises_max).each do |i|\n allowed << \"a#{i}\".to_s\n end\n params.require(:submission).permit(allowed)\n end",
"def less_active_member_params\n clean_params = params.require(:less_active_member).permit(:surname, :given_name, :current_address, :new_address, :new_phone, :reference, :new_note, :resources, tag_list: [])\n clean_params.merge!({current_user_id: current_user.id}) unless current_user.nil?\n end",
"def csrfattack_params\n params.require(:csrfattack).permit(:professor, :vote)\n end",
"def sanitize_params(form_params)\n super.tap do |params|\n params['title'] = Array.wrap(params['title']) if params.key?('title')\n params['description'] = Array.wrap(params['description']) if params.key?('description')\n end\n end",
"def configure_permitted_parameters\n \tdevise_parameter_sanitizer.permit(:sign_up, keys: %i[first_name last_name username technology_id secondary_technology])\n end",
"def build_permitted_params\n super + [\n { date_of_work_attributes: permitted_time_span_params },\n { inscription_attributes: permitted_inscription_params },\n { additional_credit_attributes: permitted_additional_credit_params },\n after: [],\n artist: [],\n attributed_to: [],\n author: [],\n addressee: [],\n creator_of_work: [],\n contributor: [],\n editor: [],\n engraver: [],\n interviewee: [],\n interviewer: [],\n manner_of: [],\n school_of: [],\n manufacturer: [],\n photographer: [],\n printer: [],\n printer_of_plates: [],\n publisher: [],\n place_of_interview: [],\n place_of_manufacture: [],\n place_of_publication: [],\n place_of_creation: [],\n ]\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:fname, :lname, :avatar, :avatar_cache, :bio, :school, :job, :nickname, :grade, :major, :hometown])\n end",
"def post_params(*args)\n params.require(:student).permit(*args)\n end",
"def anonymous_filter_params\n p = params.required('payload')\n # p.permit!('controls_params')\n # p.permit!('columns_params')\n # p.permit!('sorting')\n # p.permit!('global_config')\n p.permit(\n 'name',\n 'controls_list' => [],\n 'controls_hl_mode' => [],\n 'controls_params' => {},\n 'columns_list' => [],\n 'columns_params' => {},\n 'sorting' => {},\n 'global_config' => {}\n ).merge(permit_hashes(p, [\n 'controls_params',\n 'columns_params',\n 'sorting',\n 'global_config'\n ]))\n end",
"def additional_subject_params\n params.permit(:name)\n end",
"def hack_params\n params.require(:hack).permit(:title, :body, :tag_list, :tag)\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up,\n keys: [:face_image, :worker_number, :name, :name_kana, :trade_name, :phone, :address_zip, :address, :warehouse_zip, :warehouse, :warehouse_info, :inaba,\n :yodo, :takubo, :ykkap, :sankyo, :lixil])\n end",
"def permit_attributes\n params.require(resource_as_param_key).permit(*permitted_attributes)\n end",
"def student_params\n params.require(:student).permit!\n end",
"def visit_params\n params.require(:visit).permit(*allowable)\n end",
"def special_params\n params.require(:special).permit(:info)\n end",
"def safe_movie_params\n\t\treturn params.require(:movie).permit(:title, :description, :year_released)\n\tend",
"def user_pleasure_params\n params.permit(:title)\n end",
"def full_sanitizer=(_arg0); end",
"def full_sanitizer=(_arg0); end",
"def full_sanitizer=(_arg0); end",
"def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) << :first_name << :last_name << :phone_number\n end",
"def surgery_params\n\t\t# Permitting the profile photo params\n\t\tparams.require(:surgery).permit(:name)\n\tend",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:fname, :lname, :avatar, :bio, :school, :job, :nickname, :grade, :major, :hometown])\n end",
"def string_enforcer_params\n params.fetch(:string_enforcer, {})\n end",
"def update_params\n permitted = params.permit(*common_params,\n annotated_students_attributes:\n %i[id student_id _destroy])\n permitted[:annotated_students_attributes] = [] if @annotation.is_group\n permitted\n end",
"def sanitizer\n if options = sanitization\n @sanitizer ||= options.to_sanitize\n end\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:username, :fname, :lname, :avatar, :bio, :street, :city, :state, :country, :lat, :lng])\n end",
"def configure_permitted_parameters\n added_attrs = [:email, :password, :password_confirmation, :name, :description, :age, :gender,\n :favorite_movie, :favorite_food, :favorite_song, :job_title, :hobbies, :school, :social_media_link,\n :snap_chat_name, :allow_male, :allow_female, :allow_other]\n devise_parameter_sanitizer.permit :sign_up, keys: added_attrs\n devise_parameter_sanitizer.permit :account_update, keys: added_attrs\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.for(:sign_up) << [\n :name, :current_profession, :years_experience,\n :desired_profession, :desired_location, :work_status\n ]\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:practice, :last_name, :first_name, :email, :phone, :birthday, :gender, :password,\n :password_confirmation, :avatar, :avatar_cache, :remove_avatar, address_attributes: [ :id, :postcode, :prefecture, :city, :street, :building ]])\n 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 configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:api_key, :home_zip_code, :full_name, :found_option])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:account_update) do |u|\n u.permit(:name, :email, :password, :password_confirmation, :current_password, :role_ids, :performer_attributes => [:first_name, :avatar, :photo_id, :profile_thumb, :profile_gif, :photo_id, :location_id, :avatar, :id ,:description, :white_label_id, :clip_category_performers_attributes => [:id, :clip_category_ids]])\n end\n Rails.logger.info'****************************************'\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) << [:firstname, :lastname, :ucard, :course, :level]\n devise_parameter_sanitizer.for(:account_update) << [:firstname, :lastname, :ucard, :course, :level]\n\n end",
"def unsanitised_user_params\n params.require(:user).permit(\n :name,\n :email,\n :organisation_id,\n :invitation_token,\n :password,\n :password_confirmation,\n :require_2sv,\n :role,\n supported_permission_ids: [],\n ).to_h\n end",
"def param_whitelist\n [:rating, :review]\n end"
] |
[
"0.6905034",
"0.683687",
"0.68280804",
"0.67889357",
"0.6674015",
"0.66522104",
"0.66448265",
"0.6595933",
"0.65606564",
"0.64921725",
"0.6489163",
"0.64781183",
"0.64483696",
"0.64394945",
"0.6419598",
"0.6419251",
"0.63999707",
"0.63977224",
"0.63977224",
"0.63934815",
"0.6381383",
"0.63552105",
"0.6351666",
"0.63470167",
"0.6263344",
"0.62456423",
"0.6201932",
"0.6201932",
"0.61927104",
"0.61919683",
"0.6170647",
"0.6156662",
"0.61398244",
"0.61027503",
"0.6095907",
"0.6092075",
"0.60888684",
"0.60829175",
"0.6078085",
"0.6074742",
"0.6032367",
"0.5991786",
"0.597175",
"0.5967426",
"0.59671617",
"0.596185",
"0.5957206",
"0.5954368",
"0.5938198",
"0.59285605",
"0.5927781",
"0.59138155",
"0.59032714",
"0.58997184",
"0.58978087",
"0.5896996",
"0.58940434",
"0.5887589",
"0.5887006",
"0.588294",
"0.58775926",
"0.58737236",
"0.5871206",
"0.5870724",
"0.586412",
"0.58603865",
"0.5850765",
"0.58469373",
"0.5843961",
"0.58388746",
"0.5837621",
"0.58303636",
"0.5808892",
"0.5802483",
"0.57949424",
"0.5791214",
"0.5791014",
"0.57847995",
"0.5782731",
"0.5781977",
"0.57755154",
"0.5772579",
"0.5772579",
"0.5772579",
"0.5769446",
"0.5766719",
"0.5758603",
"0.575704",
"0.5756578",
"0.57548386",
"0.57541984",
"0.57518667",
"0.5751863",
"0.5748482",
"0.5746564",
"0.5744878",
"0.5743098",
"0.5728885",
"0.5727657",
"0.57257277",
"0.572434"
] |
0.0
|
-1
|
If you have extra params to permit, append them to the sanitizer.
|
def configure_account_update_params
devise_parameter_sanitizer.permit(:account_update, keys: [:role])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"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(:user).permit(param_whitelist)\n end",
"def devise_parameter_sanitizer; end",
"def update_sanitized_params\n\t\t\tdevise_parameter_sanitizer.for(:sign_up) {|u| u.permit(:name, :email, :password, :password_confirmation)}\n\t\tend",
"def sign_up_params\n devise_parameter_sanitizer.sanitize(:sign_up)\n end",
"def update_sanitized_params\n devise_parameter_sanitizer.for(:sign_up) {|u| u.permit(:password_confirmation ,:password ,:email, :role, :avatar, :avatar_cache, :remove_avatar, :invite_code, :firstname, :lastname)}\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def permit(*permitted)\n hardened_params = params.dup\n\n hardened_params.keep_if { |k, _v| permitted.flatten.include?(k.to_sym) }\n\n hardened_params.symbolize_keys\n end",
"def update_sanitized_params\n devise_parameter_sanitizer.for(:sign_up) {|u| u.permit(:name, :email, :approved , :password, :password_confirmation,:approved, :role_ids => [], affiliate_person_attributes: [:name], :performer_attributes => [ :first_name, :avatar, :photo_id, :profile_thumb, :profile_gif, :photo_id, :location_id, :avatar, :id, :white_label_id, :twitter_sign_in, :video_upload_twitter, :order_placed_twitter] )}\n devise_parameter_sanitizer.for(:account_update) {|u| u.permit(:name, :email, :password, :password_confirmation,:approved, :sign_in_twitter, :video_upload_twitter, :order_placed_twitter, :performer => [], :role_ids => [], :performer_attributes => [ :first_name, :avatar, :photo_id, :profile_thumb, :profile_gif, :photo_id, :location_id, :avatar, :id, :white_label_id])}\n end",
"def update_sanitized_params\n devise_parameter_sanitizer.for(:sign_up) {|u| u.permit(:email, :password, :password_confirmation, :phone)}\n devise_parameter_sanitizer.for(:account_update) {|u| u.permit(:email, :password, :password_confirmation, :phone)}\n end",
"def strong_params\n params.require(:team_member).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 safe_params\n params.require(:user).permit(:name)\n end",
"def permit_all_params options = {}\n prepend_before_filter do\n self.params.deep_permit!\n end\n end",
"def sanitize_params\n if valid_lease?\n sanitize_lease_params\n elsif valid_embargo?\n sanitize_embargo_params\n elsif !wants_lease? && !wants_embargo?\n sanitize_unrestricted_params\n else\n @attributes\n end\n end",
"def 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 sanitized_allowed_attributes=(attributes); end",
"def sanitized_allowed_attributes=(attributes); end",
"def update_sanitized_params\n\t\tdevise_parameter_sanitizer.for(:sign_up) \t\t\t\t{ |u| u.permit(:name, :email, :password, :password_confirmation, :company, :role_type, :celp_no, :approval, :authorize) }\n\t\tdevise_parameter_sanitizer.for(:account_update) { |u| u.permit(:name, :email, :password, :password_confirmation, :current_password, :company, :role_type, :celp_no, :approval, :authorize) }\n\tend",
"def student_params(*args) #is the helper method \n\n\t\tparams.require(:student).permit(*args)\n\t\t#uses .require and .permit methods as stronger params to prevent hacks through inspect element right click edit html \n\t\t#require restricts, permit allows, and *args is for the custom arguments\n\tend",
"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 strong_params\n params.require(:experience).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 whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def devise_parameter_sanitizer\n if resource_class == User\n User::ParameterSanitizer.new(User, :user, params)\n else\n super\n end\n end",
"def devise_parameter_sanitizer\n if resource_class == User\n User::ParameterSanitizer.new(User, :user, params)\n else\n super\n end\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 sanitize_attrs(attrs = {}, permitted = [])\n sanitized = {}\n attrs.each do |key, value|\n sanitized[key.to_s] = value if permitted.include?(key.to_s)\n end\n sanitized\n end",
"def additional_permitted_params\n []\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def student_params\n params.require(:student).permit(:name, :sex, :birthplace, :birthdate, :phone, :email, :employment,\n :street_address, :district, :regency_city, :religion, :registered_at,\n :avatar, :crop_x, :crop_y, :crop_w, :crop_h).tap do |whitelisted|\n if params[:student][:biodata]\n whitelisted[:biodata] = params[:student][:biodata]\n end\n end\n end",
"def user_strong_params\n html_safe(params[:user]).strip\n end",
"def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"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 update_sanitized_params\n\t\t\tif \"#{resource_name}\" == \"lecturer\"\n\t\t\t\tdevise_parameter_sanitizer.for(:sign_up) {\n\t\t\t\t\t|lecturer| lecturer.permit(:name, :email,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :department)\n\t\t\t\t}\n\t\t\t\tdevise_parameter_sanitizer.for(:account_update) {\n\t\t\t\t\t|lecturer| lecturer.permit(:name, :current_password,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :department,\n\t\t\t\t\t\t:profile_image, :profile_image_cache)\n\t\t\t\t}\n\t\t\telsif \"#{resource_name}\" == \"student\"\n\t\t\t\tdevise_parameter_sanitizer.for(:sign_up) {\n\t\t\t\t\t|student| student.permit(:name, :email,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :faculty, :major, :semester,\n\t\t\t\t\t\t:advising, :probation)\n\t\t\t\t}\n\t\t\t\tdevise_parameter_sanitizer.for(:account_update) {\n\t\t\t\t\t|student| student.permit(:name, :current_password,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :faculty, :major, :semester,\n\t\t\t\t\t\t:advising, :probation, :profile_image,\n\t\t\t\t\t\t:profile_image_cache)\n\t\t\t\t}\n\t\t\telsif \"#{resource_name}\" == \"teaching_assistant\"\n\t\t\t\tdevise_parameter_sanitizer.for(:sign_up) {\n\t\t\t\t\t|teaching_assistant| teaching_assistant.permit(:name,\n\t\t\t\t\t\t:email, :password, :password_confirmation,\n\t\t\t\t\t\t:graduated_from, :graduated_year, :degree,\n\t\t\t\t\t\t:university, :department)\n\t\t\t\t}\n\t\t\t\tdevise_parameter_sanitizer.for(:account_update) {\n\t\t\t\t\t|teaching_assistant| teaching_assistant.permit(:name,\n\t\t\t\t\t\t:current_password, :password, :password_confirmation,\n\t\t\t\t\t\t:graduated_from, :graduated_year, :degree,\n\t\t\t\t\t\t:university, :department, :profile_image,\n\t\t\t\t\t\t:profile_image_cache)\n\t\t\t\t}\n\t\t\tend\n\t\tend",
"def quote_params\n params.permit!\n end",
"def configure_permitted_parameters\n extra_params = [:full_name, :programme, :student_number]\n devise_parameter_sanitizer.for(:sign_up).push(*extra_params)\n devise_parameter_sanitizer.for(:account_update).push(*extra_params)\n end",
"def post_card_params\n params[:post_card].permit!\n end",
"def sanitize_params(params = params)\n params = walk_hash(params) if params\n end",
"def expected_permitted_parameter_names; end",
"def white_params\n params.require(:therapist).permit(Therapist.therapist_whitelist, \n therapist_availability_attributes:Therapist.therapist_availability_whitelist, \n therapist_availability_rec_attributes:Therapist.therapist_recurring_whitelist)\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def permit_params_on_create *keys\n filter_strong_params :permit, [:create], keys\n end",
"def sanitize_params(params = params)\n params = walk_hash(params) if params\n end",
"def surgery_params\n params.require(:surgery).permit(:name)\n end",
"def safe_params\n params.require(:youtube_search).permit(:search_terms, :alert_on_new_result)\n end",
"def post_params\n permit_params\n end",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def update_sanitized_params\n devise_parameter_sanitizer.permit(:account_update) do |user_params|\n user_params.permit(:name, :last_name, :login, :about, :adress, :email, :country,:avatar,:terms_of_service, :birth_date,:current_password, :password, :password_confirmation, :zip_code, :city, :phone)\n end\n\n devise_parameter_sanitizer.permit(:sign_up) do |user_params|\n user_params.permit(:name, :last_name, :login, :about, :email, :country,:avatar,:terms_of_service, :birth_date,:current_password, :password, :password_confirmation, :zip_code, :city, :phone)\n end\n\n devise_parameter_sanitizer.permit(:sign_in) do |user_params|\n user_params.permit(:name, :last_name, :login, :about, :email, :country,:avatar,:terms_of_service, :birth_date,:current_password, :password, :password_confirmation, :zip_code, :city, :phone)\n end\n \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 specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def sanitize!(request)\n [ :path, :query, :body ].each do |name|\n send(\"#{name}_parameters\").sanitize_object!(request.params)\n end\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 strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def surgical_params\n params.require(:surgical).permit(Surgical.safe_attributes)\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 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 configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) << :terms_of_service << :first_name << :last_name\n devise_parameter_sanitizer.for(:account_update) << :first_name << :last_name\n end",
"def safe_params\n safe_attributes = %i[name key]\n params.require(:role).permit(safe_attributes)\n end",
"def permitted_params\n if is_singleton?\n singleton_permitted_params\n else\n params.require(:data).permit(allowed_resource_params.to_a)\n end\n end",
"def submission_params\n allowed = :student_number, :last_name, :first_name, :week, :hours, :comments, :email, :github, :challenging\n (1..Course.current.exercises_max).each do |i|\n allowed << \"a#{i}\".to_s\n end\n params.require(:submission).permit(allowed)\n end",
"def less_active_member_params\n clean_params = params.require(:less_active_member).permit(:surname, :given_name, :current_address, :new_address, :new_phone, :reference, :new_note, :resources, tag_list: [])\n clean_params.merge!({current_user_id: current_user.id}) unless current_user.nil?\n end",
"def csrfattack_params\n params.require(:csrfattack).permit(:professor, :vote)\n end",
"def sanitize_params(form_params)\n super.tap do |params|\n params['title'] = Array.wrap(params['title']) if params.key?('title')\n params['description'] = Array.wrap(params['description']) if params.key?('description')\n end\n end",
"def configure_permitted_parameters\n \tdevise_parameter_sanitizer.permit(:sign_up, keys: %i[first_name last_name username technology_id secondary_technology])\n end",
"def build_permitted_params\n super + [\n { date_of_work_attributes: permitted_time_span_params },\n { inscription_attributes: permitted_inscription_params },\n { additional_credit_attributes: permitted_additional_credit_params },\n after: [],\n artist: [],\n attributed_to: [],\n author: [],\n addressee: [],\n creator_of_work: [],\n contributor: [],\n editor: [],\n engraver: [],\n interviewee: [],\n interviewer: [],\n manner_of: [],\n school_of: [],\n manufacturer: [],\n photographer: [],\n printer: [],\n printer_of_plates: [],\n publisher: [],\n place_of_interview: [],\n place_of_manufacture: [],\n place_of_publication: [],\n place_of_creation: [],\n ]\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:fname, :lname, :avatar, :avatar_cache, :bio, :school, :job, :nickname, :grade, :major, :hometown])\n end",
"def post_params(*args)\n params.require(:student).permit(*args)\n end",
"def anonymous_filter_params\n p = params.required('payload')\n # p.permit!('controls_params')\n # p.permit!('columns_params')\n # p.permit!('sorting')\n # p.permit!('global_config')\n p.permit(\n 'name',\n 'controls_list' => [],\n 'controls_hl_mode' => [],\n 'controls_params' => {},\n 'columns_list' => [],\n 'columns_params' => {},\n 'sorting' => {},\n 'global_config' => {}\n ).merge(permit_hashes(p, [\n 'controls_params',\n 'columns_params',\n 'sorting',\n 'global_config'\n ]))\n end",
"def additional_subject_params\n params.permit(:name)\n end",
"def hack_params\n params.require(:hack).permit(:title, :body, :tag_list, :tag)\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up,\n keys: [:face_image, :worker_number, :name, :name_kana, :trade_name, :phone, :address_zip, :address, :warehouse_zip, :warehouse, :warehouse_info, :inaba,\n :yodo, :takubo, :ykkap, :sankyo, :lixil])\n end",
"def permit_attributes\n params.require(resource_as_param_key).permit(*permitted_attributes)\n end",
"def student_params\n params.require(:student).permit!\n end",
"def visit_params\n params.require(:visit).permit(*allowable)\n end",
"def special_params\n params.require(:special).permit(:info)\n end",
"def safe_movie_params\n\t\treturn params.require(:movie).permit(:title, :description, :year_released)\n\tend",
"def user_pleasure_params\n params.permit(:title)\n end",
"def full_sanitizer=(_arg0); end",
"def full_sanitizer=(_arg0); end",
"def full_sanitizer=(_arg0); end",
"def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) << :first_name << :last_name << :phone_number\n end",
"def surgery_params\n\t\t# Permitting the profile photo params\n\t\tparams.require(:surgery).permit(:name)\n\tend",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:fname, :lname, :avatar, :bio, :school, :job, :nickname, :grade, :major, :hometown])\n end",
"def string_enforcer_params\n params.fetch(:string_enforcer, {})\n end",
"def update_params\n permitted = params.permit(*common_params,\n annotated_students_attributes:\n %i[id student_id _destroy])\n permitted[:annotated_students_attributes] = [] if @annotation.is_group\n permitted\n end",
"def sanitizer\n if options = sanitization\n @sanitizer ||= options.to_sanitize\n end\n end",
"def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:username, :fname, :lname, :avatar, :bio, :street, :city, :state, :country, :lat, :lng])\n end",
"def configure_permitted_parameters\n added_attrs = [:email, :password, :password_confirmation, :name, :description, :age, :gender,\n :favorite_movie, :favorite_food, :favorite_song, :job_title, :hobbies, :school, :social_media_link,\n :snap_chat_name, :allow_male, :allow_female, :allow_other]\n devise_parameter_sanitizer.permit :sign_up, keys: added_attrs\n devise_parameter_sanitizer.permit :account_update, keys: added_attrs\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.for(:sign_up) << [\n :name, :current_profession, :years_experience,\n :desired_profession, :desired_location, :work_status\n ]\n end",
"def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:practice, :last_name, :first_name, :email, :phone, :birthday, :gender, :password,\n :password_confirmation, :avatar, :avatar_cache, :remove_avatar, address_attributes: [ :id, :postcode, :prefecture, :city, :street, :building ]])\n 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 configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:api_key, :home_zip_code, :full_name, :found_option])\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:account_update) do |u|\n u.permit(:name, :email, :password, :password_confirmation, :current_password, :role_ids, :performer_attributes => [:first_name, :avatar, :photo_id, :profile_thumb, :profile_gif, :photo_id, :location_id, :avatar, :id ,:description, :white_label_id, :clip_category_performers_attributes => [:id, :clip_category_ids]])\n end\n Rails.logger.info'****************************************'\n end",
"def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) << [:firstname, :lastname, :ucard, :course, :level]\n devise_parameter_sanitizer.for(:account_update) << [:firstname, :lastname, :ucard, :course, :level]\n\n end",
"def unsanitised_user_params\n params.require(:user).permit(\n :name,\n :email,\n :organisation_id,\n :invitation_token,\n :password,\n :password_confirmation,\n :require_2sv,\n :role,\n supported_permission_ids: [],\n ).to_h\n end",
"def param_whitelist\n [:rating, :review]\n end"
] |
[
"0.6905034",
"0.683687",
"0.68280804",
"0.67889357",
"0.6674015",
"0.66522104",
"0.66448265",
"0.6595933",
"0.65606564",
"0.64921725",
"0.6489163",
"0.64781183",
"0.64483696",
"0.64394945",
"0.6419598",
"0.6419251",
"0.63999707",
"0.63977224",
"0.63977224",
"0.63934815",
"0.6381383",
"0.63552105",
"0.6351666",
"0.63470167",
"0.6263344",
"0.62456423",
"0.6201932",
"0.6201932",
"0.61927104",
"0.61919683",
"0.6170647",
"0.6156662",
"0.61398244",
"0.61027503",
"0.6095907",
"0.6092075",
"0.60888684",
"0.60829175",
"0.6078085",
"0.6074742",
"0.6032367",
"0.5991786",
"0.597175",
"0.5967426",
"0.59671617",
"0.596185",
"0.5957206",
"0.5954368",
"0.5938198",
"0.59285605",
"0.5927781",
"0.59138155",
"0.59032714",
"0.58997184",
"0.58978087",
"0.5896996",
"0.58940434",
"0.5887589",
"0.5887006",
"0.588294",
"0.58775926",
"0.58737236",
"0.5871206",
"0.5870724",
"0.586412",
"0.58603865",
"0.5850765",
"0.58469373",
"0.5843961",
"0.58388746",
"0.5837621",
"0.58303636",
"0.5808892",
"0.5802483",
"0.57949424",
"0.5791214",
"0.5791014",
"0.57847995",
"0.5782731",
"0.5781977",
"0.57755154",
"0.5772579",
"0.5772579",
"0.5772579",
"0.5769446",
"0.5766719",
"0.5758603",
"0.575704",
"0.5756578",
"0.57548386",
"0.57541984",
"0.57518667",
"0.5751863",
"0.5748482",
"0.5746564",
"0.5744878",
"0.5743098",
"0.5728885",
"0.5727657",
"0.57257277",
"0.572434"
] |
0.0
|
-1
|
Raises an error depending on the mode
|
def raise_error_with(message, **arguments)
message = message.call(**arguments) if message.is_a?(Proc)
raise self.class.argument_error_class, message
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def error_mode; end",
"def error_mode=(_arg0); end",
"def error?; @level <= ERROR; end",
"def error?; @level <= ERROR; end",
"def mode\n raise \"Not implemented\"\n end",
"def error?; end",
"def error?; end",
"def error?; end",
"def error?()\n #This is a stub, used for indexing\n end",
"def error?\n @level <= 3\n end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def error; end",
"def error?\n level == 2\n end",
"def valid_mode?(mode)\n [:cooked, :fake, :raw].include?(mode)\n end",
"def error!\n @error = true\n end",
"def error?\n level <= ERROR\n end",
"def error?\n outcome == ERROR\n end",
"def error?\n @status == ERROR_FLAG\n end",
"def error\n end",
"def error?\n true\n end",
"def unrecognized_option(err); end",
"def error!\n throw NotImplementedError\n end",
"def error?\n false\n end",
"def eprotonosupport?() EPROTONOSUPPORT == @error_code; end",
"def error?\n false\n end",
"def error\n end",
"def error\n failure\n end",
"def error\n 1/0\n end",
"def error?\n false\n end",
"def error?\n false\n end",
"def error?\n self.type == :error\n end",
"def error?\n self.type == :error\n end",
"def fail\n # no-op\n end",
"def error\n\t\t\traise 'Test'\n\t\tend",
"def error?\n level >= ASL_LEVEL_ERR\n end",
"def einval?() EINVAL == @error_code; end",
"def error?\n type == :error\n end",
"def mode; end",
"def mode; end",
"def mode; end",
"def mode; end",
"def call_error?(rc) (rc.respond_to?(:ok?) and rc.ok?) ? false : true end",
"def error\n raise Exception, \"An example of what an error looks like if you make a mistake using Commandable.\"\n end",
"def error!\n self.severity = :ERROR\n end",
"def error(nvae)\n end",
"def mode() end",
"def error?\n raise NotImplementedError.new\n end",
"def error_threshold; end",
"def on_error?\n @kind == :on_error\n end",
"def has_exception_case?\n @exception_case > 0\n end",
"def failure?; terminal_flag == :failure end",
"def failure?; terminal_flag == :failure end",
"def ensure_mode(mode)\n case mode\n\n when :user\n run('end') if configuration?\n\n when :privileged\n run('end') if configuration?\n enable_privileged(@credentials[:password]) if user?\n\n when :configuration\n run('configure terminal') unless configuration?\n\n end\n end",
"def error=(_arg0); end",
"def error=(_arg0); end",
"def error=(_arg0); end",
"def eterm?() ETERM == @error_code; end",
"def error\n nil\n end",
"def error(attribute_name, options = T.unsafe(nil)); end",
"def error(*args); end",
"def error!(text, **message)\n\t\t\t\t\tmessage[:errno] ||= -1\n\t\t\t\t\t\n\t\t\t\t\tsend(status: text, **message)\n\t\t\t\tend",
"def fail\n end",
"def error?\n severity == :ERROR\n end",
"def error\n @status = ERROR_FLAG if @status == SUCCESS_FLAG\n end",
"def protocol_failure(ctx, **)\n true\n end",
"def error?\n !!(status.to_s =~ /[4|5]\\d\\d/)\n end",
"def check_retval(rc, e_klass = nil)\n return true unless ::OpenNebula.is_error?(rc)\n fail (e_klass ? e_klass : RuntimeError ), rc.message\n end",
"def error\n\t\traise StandardError\n\tend",
"def verify_mode=(_arg0); end",
"def mode?\n return @mode\n end",
"def error message; write ERROR, message, caller[0] unless level > @level end",
"def has_mode?(arg)\r\n return for_context(false) { |c| c.has_mode?(arg) }\r\n end",
"def errorhandling\n end",
"def error!\n throw :return, -1\n end",
"def is_exception?; end",
"def do_failure; end",
"def error(exception) nil ; end",
"def error\n nil\n end",
"def efsm?() EFSM == @error_code; end",
"def error?\n error\n end",
"def error=(value) @error = true; end",
"def error\n placed_error = placed ? nil : 'Eva is not placed'\n placed_error || command.error\n end",
"def checkRetraitFail\n\n end",
"def mode() @mode ||= detect_mode end",
"def error!(message)\n error(message)\n fail!\n end",
"def failure!\n end",
"def check_retval(rc, e_klass)\n return true unless OpenNebula.is_error?(rc)\n case rc.errno\n when OpenNebula::Error::EAUTHENTICATION\n fail Errors::AuthenticationError, rc.message\n when OpenNebula::Error::EAUTHORIZATION\n fail Errors::UserNotAuthorizedError, rc.message\n when OpenNebula::Error::ENO_EXISTS\n fail Errors::ResourceNotFoundError, rc.message\n when OpenNebula::Error::EACTION\n fail Errors::ResourceStateError, rc.message\n else\n fail e_klass, rc.message\n end\n end",
"def fatal?; end",
"def fatal?; end",
"def error(description, result)\n raise \"Implement this in a sub-class\"\n end",
"def certain?\n fail NotImplementedError\n end",
"def has_error?\n status == ERROR \n end",
"def mode(msg); \"202 Only accepts stream\"; end",
"def error?\n @error\n end",
"def error?\n @error\n end",
"def strict_mode=(value); end"
] |
[
"0.7741705",
"0.76432985",
"0.6749671",
"0.6749671",
"0.65676486",
"0.6463306",
"0.6463306",
"0.6463306",
"0.6212837",
"0.61819977",
"0.61784637",
"0.61784637",
"0.61784637",
"0.61784637",
"0.61784637",
"0.61784637",
"0.61784637",
"0.6096074",
"0.60069615",
"0.59988827",
"0.5908854",
"0.590075",
"0.58953536",
"0.58918965",
"0.5886696",
"0.58659434",
"0.58301413",
"0.5813073",
"0.5812583",
"0.5810955",
"0.5810156",
"0.5788435",
"0.5753329",
"0.57449144",
"0.57449144",
"0.5741129",
"0.5741129",
"0.5736298",
"0.5726447",
"0.57189083",
"0.57051736",
"0.5692689",
"0.5685727",
"0.5685727",
"0.5685727",
"0.5685727",
"0.5676194",
"0.5659237",
"0.5654097",
"0.56319916",
"0.5606239",
"0.560547",
"0.55826277",
"0.55758303",
"0.55682886",
"0.5556353",
"0.5556353",
"0.5544403",
"0.5519473",
"0.5519473",
"0.5519473",
"0.55137163",
"0.55095786",
"0.5503833",
"0.5495244",
"0.549347",
"0.5491011",
"0.548725",
"0.54855794",
"0.54841673",
"0.5477482",
"0.54766476",
"0.54762554",
"0.54647684",
"0.5462568",
"0.54625636",
"0.5454919",
"0.54462373",
"0.5441755",
"0.5438733",
"0.54354733",
"0.5433652",
"0.5431164",
"0.54301226",
"0.54261476",
"0.54148406",
"0.5411909",
"0.54105186",
"0.54066",
"0.54021865",
"0.539571",
"0.53924686",
"0.5386309",
"0.5386309",
"0.538462",
"0.53687704",
"0.5366467",
"0.53617984",
"0.53614175",
"0.53614175",
"0.53502446"
] |
0.0
|
-1
|
GET /trips GET /trips.json
|
def index
@trips = Trip.all
@now = Date.today
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def trips\n get '/gtfs/trips'\n end",
"def trips\n flight = Flight.where(\"id = ?\", params[:id]).take\n if flight.nil?\n render :json => {errors: \"404\"}, :status => 404\n else\n respond_with( flight.trips )\n end\n end",
"def index\n @trips = Trip.all\n\n render json: @trips\n end",
"def index\n @trips = Trip.all\n\n render json: @trips\n end",
"def trips\n @trip_requests = current_user.trip_requests.trips.paginate(page:params[:page], per_page:20)\n json_response(@trip_requests)\n end",
"def index\n @trips = Trip.all\n render :json => @trips\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def get_user_trips\n\n\t\tputs \"Trips driving\"\n\t\tputs current_user.past_trips_driven[0]\n\t\tputs current_user.trips_requested\n\t\tif current_user \n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\ttrips_requested: Trip.where( :_id.in => current_user.trips_requested ),\n\t\t\t\ttrips_listed: Trip.where( :_id.in => current_user.trips_driving ),\n\t\t\t\ttrips_accepted: Trip.where( :_id.in => current_user.trips_accepted ),\n\t\t\t\texpired_requests: Trip.where( :_id.in => current_user.past_trips_requested),\n\t\t\t\texpired_listings: Trip.where( :_id.in => current_user.past_trips_driven),\n\t\t\t\tcurrent_userstrips: current_user.trips_driving\n\t\t\t}, status: 200\n\t\telse\n\t\t\trender json: {\n\t\t\t\tstatus: 'error',\n\t\t\t\tmessage: 'User is not signed in!'\n\t\t\t}, status: 422\n\t\tend\n\tend",
"def index\n @trips = Trip.all\n end",
"def index\n trips = Trip.all\n render json: trips\n end",
"def index\n \t@trips = Trip.all\n end",
"def list\n @trips = Trips.my_trips(cookies[ :user_id ] )\n end",
"def user_trips(user_id=self.username)\n connection.get(\"/users/#{user_id}/trips\").body.trips\n end",
"def index\n @trips = current_user.trips\n end",
"def index\n @trips = current_user.trips\n end",
"def index\n unless params[:user_id].nil?\n @user = User.find(params[:user_id])\n @trips = @user.trips\n else\n @trips = Trip.all\n end\n end",
"def my\n @trips = Trip.completed.\n includes(:driver, {trip_request: :rider}).\n joins(trip_request: :rider).\n where(users: {id: params[:rider_id]})\n\n options = {}\n # JSON API: https://jsonapi.org/format/#fetching-sparse-fieldsets\n # fast_jsonapi: https://github.com/Netflix/fast_jsonapi#sparse-fieldsets\n #\n # convert input params to options arguments\n if params[:fields]\n trip_params = params[:fields].permit(:trips).to_h.\n inject({}) { |h, (k,v)| h[k.singularize.to_sym] = v.split(\",\").map(&:to_sym); h }\n options.merge!(fields: trip_params)\n end\n\n render json: TripSerializer.new(@trips, options).serializable_hash\n end",
"def index\n @profile = Profile.find_by_user_id(current_user.id)\n @trips = @profile.trips\n end",
"def index\n @trips = Trip.desc.all\n @latest_trip = @trips.first\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trips }\n end\n end",
"def index\n @trips = Trip.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def index\n @trips = Trip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def index\n @trips = Trip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def index\n trips = Trip.all\n respond_with trips\n end",
"def show\n @trips_connect = TripsConnect.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trips_connect }\n end\n end",
"def index\n\t@trips = Trip.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def index\n search = TripSearch.new(search_params)\n trips = Trip.apply_scopes(\n search.start_location,\n search.driver_name,\n search.rider_name\n )\n\n render json: trips\n end",
"def trips_by_trip_id(trip_id)\n get \"/gtfs/trips/tripId/#{trip_id}\"\n end",
"def trips\n trips = RideShare::Trip.trips_by_rider(@id)\n if trips != nil\n return trips\n else\n return []\n end\n end",
"def index\n if params[:passenger_id]\n @passenger = Passenger.find_by(id: params[:passenger_id])\n @trips = @passenger.trips\n else\n render :notfound, status: :not_found\n end\n end",
"def trip(trip_id)\n connection.get(\"/trips/#{trip_id}\").body\n end",
"def trips\n RideShare::Trip.find_all_for_rider(@id)\n end",
"def index\n # Get trips for the trip type\n trips = Trip.all.where(trip_type: params[:trip_type] || 2)\n # (optional) if city_id params was provided\n trips = trips.joins(:city).where(\"cities.id = ?\", params[:city_id]) if params[:city_id]\n # (optional) if country_id params was provided\n trips = trips.joins(:city => :country).where(\"countries.id = ?\", params[:country_id]) if params[:country_id]\n # (optional) if sort params was provided\n if params[:sort]\n \n case params[:sort].downcase\n when 'popularity' # by number of bookings\n trips = trips.most_popular\n when 'rating' # by rating of reviews\n trips = trips.best_rated\n end\n\n end\n\n # Paginate\n trips = trips.page(params[:page] || 1).per(params[:per_page] || 20)\n\n render json: {\n trips: ActiveModelSerializers::SerializableResource.new(trips, each_serializer: TripSerializer),\n total: trips.total_count,\n page: trips.current_page,\n per_page: trips.limit_value\n }\n end",
"def all_trips\n return Rideshare::Trip.find_trip_by_rider(@id)\n end",
"def show\n # raise\n authorize @trip\n @user = current_user\n @routes = @trip.routes\n add_markers_and_site_geoloc if !@routes.first.nil? # add the markers and the @site_loc. Reject routes without localisation.\n\n @trips = []\n @trips << @user.trips\n @trips << @user.joint_user_trips.map { |jut| jut.trip }\n @trips = @trips.flatten\n end",
"def trips_by_route_id(route_id)\n get \"/gtfs/trips/routeid/#{route_id}\"\n end",
"def trips\n @agent.get(TRIPS_URL)\n\n # If session expires, re-login to citibikenyc.com. The site will redirect\n # back to TRIPS_URL upon sign in (friendly forwarding)\n login unless @agent.page.title == TRIPS_PAGE_TITLE\n\n rows = Nokogiri::HTML(@agent.page.body).xpath('//table/tbody/tr')\n\n # Reject bike trips that are either in progress or have durations <\n # MIN_TRIP_DURATION minutes.\n rows = rows.reject do |row|\n duration = row.at_xpath('td[6]/text()').to_s.match(/(\\d{1,2})m/)\n !duration || (duration.captures[0].to_i < MIN_TRIP_DURATION)\n end\n rows.map { |row| row_to_trip(row) }\n end",
"def index\n @trip = Trip.find(params[:trip_id])\n end",
"def show\n render json: @trip\n end",
"def show\n render json: @trip\n end",
"def show\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip }\n end\n end",
"def show\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip }\n end\n end",
"def show\n @request = Request.find(params[:id])\n #@sorted_trips = @request.get_sorted_trips\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @request }\n end\n end",
"def trips\n @analysis[:trips]\n end",
"def show\n @trip_item = TripItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip_item }\n end\n end",
"def index\n @trips = Trip.where(user: current_user)\n @trip = Trip.new\n end",
"def trips\n Trip.where(:route_id => self.route_id)\n end",
"def trips\n Trip.where(:route_id => self.route_id)\n end",
"def index\n @tips_tricks = @tips_tricks.published.recent.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tips_tricks }\n end\n end",
"def get_trip_listing \n\t\t@trip = Trip.find_by(_id: trip_params[:trip_id])\n\t\tif current_user.trips_driving.include?(trip_params[:trip_id]) || current_user.past_trips_driven.include?(trip_params[:trip_id])\n\t\t\t@user_requests = User.where(:_id.in => @trip.user_requests).map { |user|\n\t\t\t\tuser = {\n\t\t\t\t\t_id: user.id,\n\t\t\t\t\tfirst_name: user.first_name,\n\t\t\t\t\tlast_name: user.last_name,\n\t\t\t\t\tfacebook_link: user.facebook_link,\n\t\t\t\t\temail: user.email,\n\t\t\t\t\tphone_number: user.phone_number\n\t\t\t\t}\n\t\t\t}\n\t\t\t@accepted_users = User.where(:_id.in => @trip.accepted_users).map { |user| \n\t\t\t\tuser = {\n\t\t\t\t\t_id: user.id,\n\t\t\t\t\tfirst_name: user.first_name,\n\t\t\t\t\tlast_name: user.last_name,\n\t\t\t\t\tfacebook_link: user.facebook_link,\n\t\t\t\t\temail: user.email,\n\t\t\t\t\tphone_number: user.phone_number\n\t\t\t\t}\n\t\t\t}\n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\ttrip: {\n\t\t\t\t\ttrip_details: @trip,\n\t\t\t\t\tuser_requests: @user_requests,\n\t\t\t\t\taccepted_users: @accepted_users\n\t\t\t\t}\n\t\t\t}\n\t\telse\n\t\t\trender json: {\n\t\t\t\tstatus: 'error',\n\t\t\t\tmessage: 'This user is not the driver for this trip'\n\t\t\t}\n\t\tend\n\tend",
"def get_trip\n\t\t@trip = Trip.find_by(_id: trip_params[:trip_id])\n\t\tif @trip\n\t\t\t@user_requests = User.where(:_id.in => @trip.user_requests).map { |user|\n\t\t\t\tuser = {\n\t\t\t\t\t_id: user.id,\n\t\t\t\t\tfirst_name: user.first_name,\n\t\t\t\t\tlast_name: user.last_name\n\t\t\t\t}\n\t\t\t}\n\t\t\t@accepted_users = User.where(:_id.in => @trip.accepted_users).map { |user| \n\t\t\t\tuser = {\n\t\t\t\t\t_id: user.id,\n\t\t\t\t\tfirst_name: user.first_name,\n\t\t\t\t\tlast_name: user.last_name\n\t\t\t\t}\n\t\t\t}\n\t\t\t@trip._id = @trip._id.to_s\n\t\t\t@driver = User.find_by(_id: @trip.driver)\n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\ttrip: @trip,\n\t\t\t\tdriver: {\n\t\t\t\t\tfirst_name: @driver.first_name,\n\t\t\t\t\tlast_name: @driver.last_name,\n\t\t\t\t\trating: @driver.driver_rating\n\t\t\t\t},\n\t\t\t\tuser_requests: @user_requests,\n\t\t\t\taccepted_users: @accepted_users\n\t\t\t}, status: 200\n\t\telse\n\t\t\trender json: {\n\t\t\t\tstatus: 'error',\n\t\t\t\tmessage: 'That trip could not be found!'\n\t\t\t}, status: 422\n\t\tend\n\tend",
"def personal_trips\n @personal_trips = trips.where(driver_id: 0)\n end",
"def index\n tips = Tip.all\n json_response(tips)\n end",
"def index\n redirect_to find_trips_path\n end",
"def index\n @trips = current_user.trips_validated\n @pending_trips = current_user.pending_trips\n\n @visitor = current_user\n respond_to do |format|\n format.html{}\n format.js{}\n end\n end",
"def get_travellers\n if current_user != nil\n @trip = Trip.find(params[:id])\n render json: @trip.trip_json\n else\n render json: session[:trip].trip_json\n end\n\n end",
"def show\n @profile = Profile.find_by_user_id(current_user.id)\n @trip = @profile.trips.find(params[:id])\n end",
"def index\n @class_trips = ClassTrip.all\n end",
"def invites\n user = current_user\n\n # Query to get only not yet accepted trips associated wiht the current user\n @trips = Trip.joins(:user_trips).where(user_trips: { accepted: false }).where(user_trips: { user_id: user.id })\n render json: @trips\n end",
"def get_trip_detail(id)\n server_response = handle_timeouts do\n get \"/1/trips/#{id}.json?locale=en\"\n end\n server_response['response']\n end",
"def show\n @trip = Trips.find_trip(params[ :id ] )\n end",
"def group\n @trips = Trip.find(current_user).trip_users\n\n render json: { result: \"success\", data: @trips }\n end",
"def trips\n #will find upcoming trips/reservations for guests\n Reservation.where(guest_id: self.id)\n end",
"def trips\n Trip.find_for_driver(@driver_id)\n end",
"def trips\n @trips = Trip.all.select do |trip|\n trip.listing == self\n end\n end",
"def index\n @trip_routes = TripRoute.all\n end",
"def index\n @snips = Snip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snips }\n end\n end",
"def show\n @trip = Trip.find(params[:id])\nend",
"def new\n @trips_connect = TripsConnect.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trips_connect }\n end\n end",
"def accepted_trips\n trip_ids = self.user_trips.where(state: \"accepted\").map(&:trip_id)\n Trip.where(id: trip_ids)\n end",
"def show\n @trip = Trip.find(params[:trip_id])\n end",
"def index\n @future_trips = FutureTrip.all\n end",
"def flights\n trip = Trip.where('id = ?', params[:id]).take\n if !trip.nil\n respond_with( trip.flights )\n else\n render :json => { error: 404 }, :status => 404\n end\n end",
"def find_trip\n @trip = Trip.find(params[:id])\n end",
"def create\n trip = current_user.trips.new(trip_params)\n if trip.save\n render json: {\n status: :created,\n trip: trip\n }\n else\n render json: {\n status: 500,\n errors: trip.errors.full_messages\n }\n end\n end",
"def index\n # redirect /oj to here\n load_trips\n\n respond_to do |format|\n format.html { render :index }\n end\n end",
"def index\n @trips = Trip.order(params[:sort].to_s + \" \" + params[:direction].to_s)\n @tripLocation = Trip.pluck(:id)\n @markers = Marker.where(\"trip_id in (?)\", @tripLocation)\n @gmaps_options = @markers.to_gmaps4rails\n\n @polylines_json = {}\n polylines = []\n\n @trips.each_with_index do |trip, i|\n polylines[i] = []\n trip.markers.each do |marker|\n polylines[i] += [{:lng=>marker.longitude.to_f, :lat=>marker.latitude.to_f}]\n end\n end\n \n @polylines_json = polylines.to_json\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trips }\n end\n end",
"def trips \n Trips.all.each do |trip|\n trip \n end \n\n #return to airbnb\n \n\n\n \nend",
"def view_current_trips\n @trips = Request.all\n @count = Request.count\n @trips.each do |trip|\n @curLoc = trip.currentLoc\n @destination = trip.destination\n end\n end",
"def show\n if request.referer =~ /\\/embed\\/parks/ && request.format == 'html'\n redirect_to \"/embed\" + request.path\n return\n end\n\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json do\n @trip['start_lat'] = @trip.starting_trailhead.latitude\n @trip['start_lng'] = @trip.starting_trailhead.longitude\n @trip['end_lat'] = @trip.ending_trailhead.latitude\n @trip['end_lng'] = @trip.ending_trailhead.longitude\n render json: @trip\n end\n end\n end",
"def search_trips(trips, opts = {})\n service_id = opts[:service_id]\n route_id = opts[:route_id]\n service_id ||= 'S1'\n\n valid_trips = trips.select { |trip| \n trip[:service_id].eql? service_id\n }\n trips_with_route = valid_trips.select{ |trip| \n if !route_id.nil? then \n trip[:route_id].eql? route_id \n else \n true\n end \n }\n trips_with_route.map {|trip| trip[:trip_id]}\n end",
"def show\n @trip = Trip.find_by_marketable_url(params[:marketable_url])\n end",
"def index\n @trips = current_user.trips\n @unvalidated = @trips.where(:validated => false)\n @validated = @trips.where(:validated => true)\n end",
"def trips_stats \n @all = current_user.trip_requests.trips.count\n @completed = current_user.trip_requests.trips.completed.count\n @cancelled = current_user.trip_requests.trips.cancelled.count\n @pending = current_user.trip_requests.trips.pending.count\n @on_going = current_user.trip_requests.trips.on_going.count\n @active = current_user.trip_requests.trips.active.count\n @monthly_successful = current_user.trip_requests.completed.trips.group_by_month(:created_at, format: \"%b\", reverse:true).count\n @monthly_pending = current_user.trip_requests.pending.trips.group_by_month(:created_at, format: \"%b\", reverse:true).count\n @response = { all: @all, completed: @completed, cancelled: @cancelled, active: @active, monthly_pending:@monthly_pending, monthly_successful:@monthly_successful, pending: @pending, on_going: @on_going }\n json_response(@response)\n end",
"def rider_trip_instances\n rider_trips = RideShare::Trip.all_rider_trip_instances(@rider_id)\n return rider_trips\n end",
"def index\n @guide_trips = GuideTrip.all\n end",
"def index\n @trip_types = TripType.all\n end",
"def show\n\n set_no_cache\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip }\n end\n\n end",
"def index\n # @locations = Location.all.where(:trip_id => @trip)\n @locations = Location.all.where(trip_id: @trip)\n @trip = Trip.find(params[:trip_id])\n end",
"def request_trip\n\t\t@trip = Trip.find_by(_id: trip_params[:trip_id])\n\t\t# Check that the current user has not requested more than 3 trips, \n\t\t# That the user has not already requested this trip\n\t\t# and that the trip has available spaces and that the driver is not the requestor\n\t\tif current_user.trips_requested.size <= 5 && \n\t\t\t!(@trip.user_requests.include?(current_user._id)) && @trip.spaces > 0 && @trip.driver != current_user.id.to_s && !(current_user.trips_accepted.include?(@trip.id))\n\n\t\t\t@trip.user_requests << current_user._id\n\t\t\tcurrent_user.trips_requested << @trip._id.to_s\n\t\t\tcurrent_user.save!\n\t\t\t@trip.save!\n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\ttrip: @trip\n\t\t\t}, status: 200\n\t\telse\n\t\t\t# Error handling\n\t\t\tif current_user.trips_requested.size > 5\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'This user has requested too many requests!'\n\t\t\t\t}, status: 422\n\t\t\telsif @trip.user_requests.include?(current_user._id)\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'You have already requested this trip!'\n\t\t\t\t}, status: 422\n\t\t\telsif @trip.spaces <= 0\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'There is no more space in this trip!'\n\t\t\t\t}, status: 422\n\t\t\telsif @trip.driver == current_user.id.to_s\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'You cannot request your own trip!'\n\t\t\t\t}, status: 422\n\t\t\telsif current_user.trips_accepted.include?(@trip.id)\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: \"You've already been accepted on this trip!\"\n\t\t\t\t}, status: 422\n\t\t\telse\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'Something went wrong...'\n\t\t\t\t}, status: 422\n\t\t\tend\n\t\tend\n\tend",
"def show\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @trip.to_json, :callback => params[:callback] }\n end\n end",
"def show\n travels = Travel.find(params[:id])\n render json: travels, status: :ok\n end",
"def show\n\n trip = Trip.find(params[:id])\n\n departureOrder = LineStation.find_by_station_id(trip.departureStation_id).order\n arrivalOrder = LineStation.find_by_station_id(trip.arrivalStation_id).order\n\n lineStations = LineStation.where(:order => departureOrder..arrivalOrder)\n lineStations = lineStations.where(:line_id => trip.line_id)\n if departureOrder < arrivalOrder\n lineStations.order('order ASC')\n else\n lineStations.order('order DESC')\n end\n\n times = Array.new\n currentTime = trip.beginTime\n lineStations.each do |ls|\n \n station = Station.find(ls.station_id)\n train = Train.find(trip.train_id)\n\n times << { :station => station, :time => currentTime.strftime('%H:%M') }\n\n timeElapsed = ls.distance.to_f / train.velocity\n currentTime = currentTime + timeElapsed.hours\n end\n\n render :json => { :trip => trip, :times => times }\n\n end",
"def show\n @trip = Trip.find(params[:id])\n @places = @trip.places\n end",
"def trips\n Trip.all.filter do |trip|\n trip.listing == self\n end\n end"
] |
[
"0.819985",
"0.8043565",
"0.7999928",
"0.7999928",
"0.7953077",
"0.79234964",
"0.7489612",
"0.7489612",
"0.7489612",
"0.7489612",
"0.7489612",
"0.7489612",
"0.7489612",
"0.74755937",
"0.7470587",
"0.74533826",
"0.7362053",
"0.73253477",
"0.73083544",
"0.72763485",
"0.72763485",
"0.7260733",
"0.72002304",
"0.7086844",
"0.70487815",
"0.6971206",
"0.69445527",
"0.69445527",
"0.69388366",
"0.69309473",
"0.68985903",
"0.6892204",
"0.6837193",
"0.6768157",
"0.671072",
"0.6710333",
"0.66557366",
"0.6624722",
"0.6569882",
"0.6550658",
"0.6535147",
"0.65117127",
"0.64567643",
"0.64511406",
"0.64511406",
"0.64426136",
"0.64426136",
"0.6411448",
"0.63857335",
"0.63678586",
"0.63616145",
"0.6348935",
"0.6348935",
"0.63207763",
"0.63196856",
"0.63187015",
"0.63165563",
"0.63073975",
"0.63030964",
"0.630154",
"0.62946653",
"0.6288707",
"0.6211777",
"0.6174148",
"0.6171557",
"0.6169472",
"0.6117155",
"0.6076959",
"0.6062517",
"0.5990182",
"0.598936",
"0.59892684",
"0.598809",
"0.595672",
"0.5949097",
"0.5938888",
"0.5931925",
"0.59234995",
"0.5923327",
"0.59211785",
"0.5896652",
"0.58955705",
"0.5887292",
"0.5868445",
"0.5857938",
"0.58304405",
"0.58293706",
"0.5825155",
"0.5815014",
"0.58065104",
"0.58064824",
"0.57996196",
"0.57564837",
"0.5747491",
"0.57279253",
"0.5712348",
"0.57086414",
"0.56974435",
"0.5696325",
"0.56903106"
] |
0.6161163
|
66
|
GET /trips/1 GET /trips/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def trips\n flight = Flight.where(\"id = ?\", params[:id]).take\n if flight.nil?\n render :json => {errors: \"404\"}, :status => 404\n else\n respond_with( flight.trips )\n end\n end",
"def index\n @trips = Trip.all\n\n render json: @trips\n end",
"def index\n @trips = Trip.all\n\n render json: @trips\n end",
"def trips\n get '/gtfs/trips'\n end",
"def index\n @trips = Trip.all\n render :json => @trips\n end",
"def index\n @trips = Trip.desc.all\n @latest_trip = @trips.first\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trips }\n end\n end",
"def trips\n @trip_requests = current_user.trip_requests.trips.paginate(page:params[:page], per_page:20)\n json_response(@trip_requests)\n end",
"def index\n trips = Trip.all\n render json: trips\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n \t@trips = Trip.all\n end",
"def show\n @trips_connect = TripsConnect.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trips_connect }\n end\n end",
"def trip(trip_id)\n connection.get(\"/trips/#{trip_id}\").body\n end",
"def trips_by_trip_id(trip_id)\n get \"/gtfs/trips/tripId/#{trip_id}\"\n end",
"def index\n unless params[:user_id].nil?\n @user = User.find(params[:user_id])\n @trips = @user.trips\n else\n @trips = Trip.all\n end\n end",
"def my\n @trips = Trip.completed.\n includes(:driver, {trip_request: :rider}).\n joins(trip_request: :rider).\n where(users: {id: params[:rider_id]})\n\n options = {}\n # JSON API: https://jsonapi.org/format/#fetching-sparse-fieldsets\n # fast_jsonapi: https://github.com/Netflix/fast_jsonapi#sparse-fieldsets\n #\n # convert input params to options arguments\n if params[:fields]\n trip_params = params[:fields].permit(:trips).to_h.\n inject({}) { |h, (k,v)| h[k.singularize.to_sym] = v.split(\",\").map(&:to_sym); h }\n options.merge!(fields: trip_params)\n end\n\n render json: TripSerializer.new(@trips, options).serializable_hash\n end",
"def index\n @trip = Trip.find(params[:trip_id])\n end",
"def show\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip }\n end\n end",
"def show\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip }\n end\n end",
"def index\n @profile = Profile.find_by_user_id(current_user.id)\n @trips = @profile.trips\n end",
"def index\n @trips = current_user.trips\n end",
"def index\n @trips = current_user.trips\n end",
"def index\n @trips = Trip.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def get_user_trips\n\n\t\tputs \"Trips driving\"\n\t\tputs current_user.past_trips_driven[0]\n\t\tputs current_user.trips_requested\n\t\tif current_user \n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\ttrips_requested: Trip.where( :_id.in => current_user.trips_requested ),\n\t\t\t\ttrips_listed: Trip.where( :_id.in => current_user.trips_driving ),\n\t\t\t\ttrips_accepted: Trip.where( :_id.in => current_user.trips_accepted ),\n\t\t\t\texpired_requests: Trip.where( :_id.in => current_user.past_trips_requested),\n\t\t\t\texpired_listings: Trip.where( :_id.in => current_user.past_trips_driven),\n\t\t\t\tcurrent_userstrips: current_user.trips_driving\n\t\t\t}, status: 200\n\t\telse\n\t\t\trender json: {\n\t\t\t\tstatus: 'error',\n\t\t\t\tmessage: 'User is not signed in!'\n\t\t\t}, status: 422\n\t\tend\n\tend",
"def index\n trips = Trip.all\n respond_with trips\n end",
"def show\n @trip_item = TripItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip_item }\n end\n end",
"def index\n @trips = Trip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def index\n @trips = Trip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def show\n @trip = Trips.find_trip(params[ :id ] )\n end",
"def trips_by_route_id(route_id)\n get \"/gtfs/trips/routeid/#{route_id}\"\n end",
"def get_trip_detail(id)\n server_response = handle_timeouts do\n get \"/1/trips/#{id}.json?locale=en\"\n end\n server_response['response']\n end",
"def list\n @trips = Trips.my_trips(cookies[ :user_id ] )\n end",
"def index\n\t@trips = Trip.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def index\n # Get trips for the trip type\n trips = Trip.all.where(trip_type: params[:trip_type] || 2)\n # (optional) if city_id params was provided\n trips = trips.joins(:city).where(\"cities.id = ?\", params[:city_id]) if params[:city_id]\n # (optional) if country_id params was provided\n trips = trips.joins(:city => :country).where(\"countries.id = ?\", params[:country_id]) if params[:country_id]\n # (optional) if sort params was provided\n if params[:sort]\n \n case params[:sort].downcase\n when 'popularity' # by number of bookings\n trips = trips.most_popular\n when 'rating' # by rating of reviews\n trips = trips.best_rated\n end\n\n end\n\n # Paginate\n trips = trips.page(params[:page] || 1).per(params[:per_page] || 20)\n\n render json: {\n trips: ActiveModelSerializers::SerializableResource.new(trips, each_serializer: TripSerializer),\n total: trips.total_count,\n page: trips.current_page,\n per_page: trips.limit_value\n }\n end",
"def show\n render json: @trip\n end",
"def show\n render json: @trip\n end",
"def index\n if params[:passenger_id]\n @passenger = Passenger.find_by(id: params[:passenger_id])\n @trips = @passenger.trips\n else\n render :notfound, status: :not_found\n end\n end",
"def user_trips(user_id=self.username)\n connection.get(\"/users/#{user_id}/trips\").body.trips\n end",
"def show\n @profile = Profile.find_by_user_id(current_user.id)\n @trip = @profile.trips.find(params[:id])\n end",
"def show\n @request = Request.find(params[:id])\n #@sorted_trips = @request.get_sorted_trips\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @request }\n end\n end",
"def index\n search = TripSearch.new(search_params)\n trips = Trip.apply_scopes(\n search.start_location,\n search.driver_name,\n search.rider_name\n )\n\n render json: trips\n end",
"def show\n @trip = Trip.find(params[:id])\nend",
"def show\n @trip = Trip.find(params[:trip_id])\n end",
"def find_trip\n @trip = Trip.find(params[:id])\n end",
"def get_trip\n\t\t@trip = Trip.find_by(_id: trip_params[:trip_id])\n\t\tif @trip\n\t\t\t@user_requests = User.where(:_id.in => @trip.user_requests).map { |user|\n\t\t\t\tuser = {\n\t\t\t\t\t_id: user.id,\n\t\t\t\t\tfirst_name: user.first_name,\n\t\t\t\t\tlast_name: user.last_name\n\t\t\t\t}\n\t\t\t}\n\t\t\t@accepted_users = User.where(:_id.in => @trip.accepted_users).map { |user| \n\t\t\t\tuser = {\n\t\t\t\t\t_id: user.id,\n\t\t\t\t\tfirst_name: user.first_name,\n\t\t\t\t\tlast_name: user.last_name\n\t\t\t\t}\n\t\t\t}\n\t\t\t@trip._id = @trip._id.to_s\n\t\t\t@driver = User.find_by(_id: @trip.driver)\n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\ttrip: @trip,\n\t\t\t\tdriver: {\n\t\t\t\t\tfirst_name: @driver.first_name,\n\t\t\t\t\tlast_name: @driver.last_name,\n\t\t\t\t\trating: @driver.driver_rating\n\t\t\t\t},\n\t\t\t\tuser_requests: @user_requests,\n\t\t\t\taccepted_users: @accepted_users\n\t\t\t}, status: 200\n\t\telse\n\t\t\trender json: {\n\t\t\t\tstatus: 'error',\n\t\t\t\tmessage: 'That trip could not be found!'\n\t\t\t}, status: 422\n\t\tend\n\tend",
"def index\n @trips = Trip.where(user: current_user)\n @trip = Trip.new\n end",
"def index\n @tips_tricks = @tips_tricks.published.recent.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tips_tricks }\n end\n end",
"def trips\n trips = RideShare::Trip.trips_by_rider(@id)\n if trips != nil\n return trips\n else\n return []\n end\n end",
"def show\n # raise\n authorize @trip\n @user = current_user\n @routes = @trip.routes\n add_markers_and_site_geoloc if !@routes.first.nil? # add the markers and the @site_loc. Reject routes without localisation.\n\n @trips = []\n @trips << @user.trips\n @trips << @user.joint_user_trips.map { |jut| jut.trip }\n @trips = @trips.flatten\n end",
"def trips\n RideShare::Trip.find_all_for_rider(@id)\n end",
"def trips\n Trip.where(:route_id => self.route_id)\n end",
"def trips\n Trip.where(:route_id => self.route_id)\n end",
"def get_travellers\n if current_user != nil\n @trip = Trip.find(params[:id])\n render json: @trip.trip_json\n else\n render json: session[:trip].trip_json\n end\n\n end",
"def show\n @trip_driver = TripDriver.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip_driver }\n end\n end",
"def show\n @trip = Trip.find_by_marketable_url(params[:marketable_url])\n end",
"def flights\n trip = Trip.where('id = ?', params[:id]).take\n if !trip.nil\n respond_with( trip.flights )\n else\n render :json => { error: 404 }, :status => 404\n end\n end",
"def index\n redirect_to find_trips_path\n end",
"def personal_trips\n @personal_trips = trips.where(driver_id: 0)\n end",
"def index\n @class_trips = ClassTrip.all\n end",
"def all_trips\n return Rideshare::Trip.find_trip_by_rider(@id)\n end",
"def show\n\n set_no_cache\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trip }\n end\n\n end",
"def index\n @trips = Trip.all\n @now = Date.today\n end",
"def new\n @trips_connect = TripsConnect.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trips_connect }\n end\n end",
"def show\n travels = Travel.find(params[:id])\n render json: travels, status: :ok\n end",
"def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip }\n end\n end",
"def new\n @trip = Trip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip }\n end\n end",
"def show\n @troop = Troop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @troop }\n end\n end",
"def trips \n Trips.all.each do |trip|\n trip \n end \n\n #return to airbnb\n \n\n\n \nend",
"def show\n @tripdate = Tripdate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tripdate }\n end\n end",
"def index\n # @locations = Location.all.where(:trip_id => @trip)\n @locations = Location.all.where(trip_id: @trip)\n @trip = Trip.find(params[:trip_id])\n end",
"def show\n if request.referer =~ /\\/embed\\/parks/ && request.format == 'html'\n redirect_to \"/embed\" + request.path\n return\n end\n\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json do\n @trip['start_lat'] = @trip.starting_trailhead.latitude\n @trip['start_lng'] = @trip.starting_trailhead.longitude\n @trip['end_lat'] = @trip.ending_trailhead.latitude\n @trip['end_lng'] = @trip.ending_trailhead.longitude\n render json: @trip\n end\n end\n end",
"def index\n tips = Tip.all\n json_response(tips)\n end",
"def show\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @trip }\n end\n end",
"def show\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @trip }\n end\n end",
"def trips\n @analysis[:trips]\n end",
"def index\n @trip_routes = TripRoute.all\n end",
"def show\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @trip.to_json, :callback => params[:callback] }\n end\n end",
"def find_trip\n @find_trip = Trip.where(\"id = #{params[:trip_id]}\")\n end",
"def get_trip_listing \n\t\t@trip = Trip.find_by(_id: trip_params[:trip_id])\n\t\tif current_user.trips_driving.include?(trip_params[:trip_id]) || current_user.past_trips_driven.include?(trip_params[:trip_id])\n\t\t\t@user_requests = User.where(:_id.in => @trip.user_requests).map { |user|\n\t\t\t\tuser = {\n\t\t\t\t\t_id: user.id,\n\t\t\t\t\tfirst_name: user.first_name,\n\t\t\t\t\tlast_name: user.last_name,\n\t\t\t\t\tfacebook_link: user.facebook_link,\n\t\t\t\t\temail: user.email,\n\t\t\t\t\tphone_number: user.phone_number\n\t\t\t\t}\n\t\t\t}\n\t\t\t@accepted_users = User.where(:_id.in => @trip.accepted_users).map { |user| \n\t\t\t\tuser = {\n\t\t\t\t\t_id: user.id,\n\t\t\t\t\tfirst_name: user.first_name,\n\t\t\t\t\tlast_name: user.last_name,\n\t\t\t\t\tfacebook_link: user.facebook_link,\n\t\t\t\t\temail: user.email,\n\t\t\t\t\tphone_number: user.phone_number\n\t\t\t\t}\n\t\t\t}\n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\ttrip: {\n\t\t\t\t\ttrip_details: @trip,\n\t\t\t\t\tuser_requests: @user_requests,\n\t\t\t\t\taccepted_users: @accepted_users\n\t\t\t\t}\n\t\t\t}\n\t\telse\n\t\t\trender json: {\n\t\t\t\tstatus: 'error',\n\t\t\t\tmessage: 'This user is not the driver for this trip'\n\t\t\t}\n\t\tend\n\tend",
"def show\n @trip = Trip.find(params[:id])\n @places = @trip.places\n end",
"def new\n @trip_item = TripItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip_item }\n end\n end",
"def index\n @trips = current_user.trips_validated\n @pending_trips = current_user.pending_trips\n\n @visitor = current_user\n respond_to do |format|\n format.html{}\n format.js{}\n end\n end",
"def show\n @tipp = Tipp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipp }\n end\n end",
"def index\n @trip_types = TripType.all\n end",
"def index\n @future_trips = FutureTrip.all\n end",
"def index\n # redirect /oj to here\n load_trips\n\n respond_to do |format|\n format.html { render :index }\n end\n end",
"def create\n trip = current_user.trips.new(trip_params)\n if trip.save\n render json: {\n status: :created,\n trip: trip\n }\n else\n render json: {\n status: 500,\n errors: trip.errors.full_messages\n }\n end\n end",
"def trips\n #will find upcoming trips/reservations for guests\n Reservation.where(guest_id: self.id)\n end",
"def index\n @tunes = Tune.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tunes }\n end\n end",
"def show\n\n trip = Trip.find(params[:id])\n\n departureOrder = LineStation.find_by_station_id(trip.departureStation_id).order\n arrivalOrder = LineStation.find_by_station_id(trip.arrivalStation_id).order\n\n lineStations = LineStation.where(:order => departureOrder..arrivalOrder)\n lineStations = lineStations.where(:line_id => trip.line_id)\n if departureOrder < arrivalOrder\n lineStations.order('order ASC')\n else\n lineStations.order('order DESC')\n end\n\n times = Array.new\n currentTime = trip.beginTime\n lineStations.each do |ls|\n \n station = Station.find(ls.station_id)\n train = Train.find(trip.train_id)\n\n times << { :station => station, :time => currentTime.strftime('%H:%M') }\n\n timeElapsed = ls.distance.to_f / train.velocity\n currentTime = currentTime + timeElapsed.hours\n end\n\n render :json => { :trip => trip, :times => times }\n\n end",
"def show\n redirect_to trips_path\n end",
"def set_trip\n @trip = current_user.trips.find(params[:id])\n end",
"def index\n @snips = Snip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snips }\n end\n end",
"def group\n @trips = Trip.find(current_user).trip_users\n\n render json: { result: \"success\", data: @trips }\n end",
"def show\n @tramite = Tramite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tramite }\n end\n end"
] |
[
"0.7947563",
"0.77819043",
"0.77819043",
"0.77373976",
"0.77221835",
"0.76180017",
"0.74432886",
"0.73136485",
"0.726699",
"0.726699",
"0.726699",
"0.726699",
"0.726699",
"0.726699",
"0.726699",
"0.7163972",
"0.71326137",
"0.70854133",
"0.7082617",
"0.70766836",
"0.7049975",
"0.6957324",
"0.69205475",
"0.6899256",
"0.6899256",
"0.6881529",
"0.6879557",
"0.6879557",
"0.6846366",
"0.68350697",
"0.68303436",
"0.68237835",
"0.67845726",
"0.67845726",
"0.67240494",
"0.6720681",
"0.6710238",
"0.6688509",
"0.6679808",
"0.66637766",
"0.664289",
"0.664289",
"0.6634705",
"0.6629078",
"0.6592034",
"0.65406376",
"0.6536147",
"0.6513188",
"0.6487932",
"0.6439335",
"0.64265275",
"0.63271344",
"0.62732697",
"0.6260126",
"0.62476236",
"0.6211087",
"0.6200533",
"0.6200533",
"0.618771",
"0.61537236",
"0.61441934",
"0.61441314",
"0.61389756",
"0.6094183",
"0.6086359",
"0.6082574",
"0.6082537",
"0.60787153",
"0.6069418",
"0.60638887",
"0.6045735",
"0.6045735",
"0.6028289",
"0.6026374",
"0.60107934",
"0.6007986",
"0.60079145",
"0.60052913",
"0.5996564",
"0.5996564",
"0.5991058",
"0.597718",
"0.59675026",
"0.59522885",
"0.5948172",
"0.59054035",
"0.59029347",
"0.58726925",
"0.5866485",
"0.5858159",
"0.5842142",
"0.58357394",
"0.5826674",
"0.58248127",
"0.58245826",
"0.5798523",
"0.57931924",
"0.5792146",
"0.57879525",
"0.57704437",
"0.5760153"
] |
0.0
|
-1
|
POST /trips POST /trips.json
|
def create
@trip = Trip.new(trip_params)
@trip.user = @current_user
@trip.users.append(current_user)
respond_to do |format|
if @trip.save
format.html { redirect_to @trip, notice: 'Trip was successfully created.' }
format.json { render json: {message: 'Utworzono tripa.', admin_id: @trip.user_id}, status: :ok }
else
format.html { render :new }
format.json {
render json:
{errors: @trip.errors}, status: :unprocessable_entity
}
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def trips\n get '/gtfs/trips'\n end",
"def create\n trip = current_user.trips.new(trip_params)\n if trip.save\n render json: {\n status: :created,\n trip: trip\n }\n else\n render json: {\n status: 500,\n errors: trip.errors.full_messages\n }\n end\n end",
"def trips\n flight = Flight.where(\"id = ?\", params[:id]).take\n if flight.nil?\n render :json => {errors: \"404\"}, :status => 404\n else\n respond_with( flight.trips )\n end\n end",
"def trips\n @trip_requests = current_user.trip_requests.trips.paginate(page:params[:page], per_page:20)\n json_response(@trip_requests)\n end",
"def index\n @trips = Trip.all\n\n render json: @trips\n end",
"def index\n @trips = Trip.all\n\n render json: @trips\n end",
"def create\n @trip = current_user.trips.build(params[:trip])\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render json: @trip, status: :created, location: @trip }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @trips = Trip.all\n render :json => @trips\n end",
"def create\n trip = Trip.create(trip_params)\n\n respond_with trip\n end",
"def create\n @trip = current_user.trips.build(trip_params)\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render action: 'show', status: :created, location: @trip }\n else\n format.html { render action: 'new' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def my\n @trips = Trip.completed.\n includes(:driver, {trip_request: :rider}).\n joins(trip_request: :rider).\n where(users: {id: params[:rider_id]})\n\n options = {}\n # JSON API: https://jsonapi.org/format/#fetching-sparse-fieldsets\n # fast_jsonapi: https://github.com/Netflix/fast_jsonapi#sparse-fieldsets\n #\n # convert input params to options arguments\n if params[:fields]\n trip_params = params[:fields].permit(:trips).to_h.\n inject({}) { |h, (k,v)| h[k.singularize.to_sym] = v.split(\",\").map(&:to_sym); h }\n options.merge!(fields: trip_params)\n end\n\n render json: TripSerializer.new(@trips, options).serializable_hash\n end",
"def create\n err_objs=[]\n error=false\n user_id=MobileDevice.where(:access_token=>params[:access_token]).first.user_id\n if params.has_key?('trips')\n params[:trips].each do |trip|\n trip_id=trip[1][:trip_id] #save ref to trip id in case @trip.save fails (used in return response)\n if !create_trip(trip[1],user_id)\n error=true\n err_objs.push(trip_id)\n end\n end\n else\n error=true\n end\n respond_to do |format|\n if !error\n format.json { render json: {:msg => \"success\"}, status: :created }\n else\n format.json { render json: {:msg => \"Could not save the following trips. Please check that all required fields are filled out (license_plate, cargo, start_location, end_location, start_timestamp, end_timestamp)\", :err_ids => err_objs}, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = Trip.new(trip_params)\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to trips_path, notice: 'Cesta byla vytvořena.' }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { render :new }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = Trip.new(params[:trip])\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip, :notice => 'Trip was successfully created.' }\n format.json { render :json => @trip, :status => :created, :location => @trip }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = Trip.new(trip_params)\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { render :new }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trips_connect = TripsConnect.new(params[:trips_connect])\n\n respond_to do |format|\n if @trips_connect.save\n format.html { redirect_to @trips_connect, notice: 'Trips connect was successfully created.' }\n format.json { render json: @trips_connect, status: :created, location: @trips_connect }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trips_connect.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n # inflate a trip proxy object from the form params\n @trip_proxy = create_trip_proxy_from_form_params\n \n if @trip_proxy.valid?\n @trip = create_trip(@trip_proxy)\n end\n\n # Create makers for the map control\n @markers = create_markers(@trip_proxy)\n\n respond_to do |format|\n if @trip\n if @trip.save\n @trip.reload\n @planned_trip = @trip.planned_trips.first\n @planned_trip.create_itineraries\n format.html { redirect_to user_planned_trip_path(@traveler, @planned_trip) }\n format.json { render json: @planned_trip, status: :created, location: @planned_trip }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trip_proxy.errors, status: :unprocessable_entity }\n end\n else\n format.html { render action: \"new\", flash[:alert] => t(:correct_errors_to_create_a_trip) }\n end\n end\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def index\n @trips = Trip.all\n end",
"def create\n @trip = current_user.trips.new(params[:trip].except(:places))\n params[:trip][:places] ||= []\n @trip.add_trip_places(params[:trip][:places])\n if @trip.save\n flash[:notice] = \"Trip succesfully created\"\n redirect_to @trip\n else\n flash.now[:error] = @trip.errors.full_messages\n @places = params[:trip][:places]\n render \"new\"\n end\n end",
"def create\n # We have to convert the two posted values for each time into a single string\n # If we don't Trip.new can't populate the Trips values based on the post hash\n @trip = Trip.new(parse_post params[:trip])\n\n respond_to do |format|\n if @trip.save\n flash[:notice] = 'Trip was successfully created.'\n format.html { redirect_to(@trip) }\n format.xml { render :xml => @trip, :status => :created, :location => @trip }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n # We have to convert the two posted values for each time into a single string\n # If we don't Trip.new can't populate the Trips values based on the post hash\n @trip = Trip.new(parse_post params[:trip])\n\n respond_to do |format|\n if @trip.save\n flash[:notice] = 'Trip was successfully created.'\n format.html { redirect_to(@trip) }\n format.xml { render :xml => @trip, :status => :created, :location => @trip }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @trip_item = TripItem.new(params[:trip_item])\n\n respond_to do |format|\n if @trip_item.save\n format.html { redirect_to @trip_item, notice: 'Trip item was successfully created.' }\n format.json { render json: @trip_item, status: :created, location: @trip_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trip_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = Trip.new(trip_params.merge(user_id: current_user.id))\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { render :new }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = Trip.new(trip_params)\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to current_user, notice: 'Trip was successfully created.' }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { redirect_to current_user, notice: \"Trip can't be created\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def index\n @trips = Trip.all\n end",
"def create\n @user = current_user()\n @trip = @user.own_trips.new(params[:trip])\n\n respond_to do |format|\n if @trip.save\n flash[:notice] = 'Trip was successfully created.'\n format.html { redirect_to(@trip) }\n format.xml { render :xml => @trip, :status => :created, :location => @trip }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def get_user_trips\n\n\t\tputs \"Trips driving\"\n\t\tputs current_user.past_trips_driven[0]\n\t\tputs current_user.trips_requested\n\t\tif current_user \n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\ttrips_requested: Trip.where( :_id.in => current_user.trips_requested ),\n\t\t\t\ttrips_listed: Trip.where( :_id.in => current_user.trips_driving ),\n\t\t\t\ttrips_accepted: Trip.where( :_id.in => current_user.trips_accepted ),\n\t\t\t\texpired_requests: Trip.where( :_id.in => current_user.past_trips_requested),\n\t\t\t\texpired_listings: Trip.where( :_id.in => current_user.past_trips_driven),\n\t\t\t\tcurrent_userstrips: current_user.trips_driving\n\t\t\t}, status: 200\n\t\telse\n\t\t\trender json: {\n\t\t\t\tstatus: 'error',\n\t\t\t\tmessage: 'User is not signed in!'\n\t\t\t}, status: 422\n\t\tend\n\tend",
"def user_trips(user_id=self.username)\n connection.get(\"/users/#{user_id}/trips\").body.trips\n end",
"def new\n @trip = current_user.trips.build\n 5.times {@trip.places.build}\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip }\n end\n end",
"def create\r\n # @trip = Trip.new(trip_params)\r\n @trip = current_user.trips.build(trip_params)\r\n if @trip.save\r\n redirect_to trips_path, notice: 'Trip was successfully created.'\r\n else\r\n redirect_to new_trip_path, notice: 'Cannot leave information blank.'\r\n end\r\n end",
"def create\n trip = Trip.new(trip_params)\n trip.rand_code = generate_code(6)\n\n # checks to see if photo was sent, and assigns default if none sent\n if params[:photo_base]\n trip.photo = params[:photo_base]\n else\n trip.photo = default_photo\n end\n\n trip.save!\n\n # creates a UserTrip object as a reference between Users and Trips\n tripid = Trip.last.id\n userid = params[:user_id]\n UserTrip.create(user_id: userid, trip_id: tripid)\n render json: trip\n end",
"def index\n unless params[:user_id].nil?\n @user = User.find(params[:user_id])\n @trips = @user.trips\n else\n @trips = Trip.all\n end\n end",
"def create_trip\n # Only attempt to create trip if all the necessary pieces are there\n return false unless @itinerary && @trip && @service && @user\n \n label = request_label(:book, trip_id)\n \n @http_request_bundler.add(\n label, \n @url + \"/create_trip\", \n :post,\n head: headers,\n body: body_for_booking(@booking_options).to_json\n ).response!(label)\n end",
"def create\n @trip = Trip.new(params[:trip])\n @trip.user = current_user\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render json: @trip, status: :created, location: @trip }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n \t@trips = Trip.all\n end",
"def index\n trips = Trip.all\n render json: trips\n end",
"def trip_params\n params.require(:trip).permit(:starts_on, :ends_on, :name, :location, {:item_ids => []})\n end",
"def create\n @trip = Trip.new(params[:trip])\n @trip.user = current_user\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render json: @trip, status: :created, location: @trip }\n else\n format.html { render action: \"new\" }\n end\n end\n end",
"def trip_params\n params.require(:trip).permit(:sightsnum, :location, :location_radius, :tag, :user_id)\n end",
"def index\n @trips = current_user.trips\n end",
"def index\n @trips = current_user.trips\n end",
"def create\n @origin = Origin.new(\n :latitude => trip_params[:origin][:latitude],\n :longitude => trip_params[:origin][:longitude]\n )\n @origin.save\n @destination = Destination.new(:address => trip_params[:destination][:address].concat(\" New York City\"))\n @destination.save\n @trip = Trip.new(:origin_id => @origin.id, :destination_id => @destination.id)\n @trip.save \n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip }\n format.json { render action: 'show', status: :created, location: @trip }\n else\n format.html { render action: 'new' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def trip_params\n params.require(:trip).permit(:student_id, :ymen_trips, :num_ymen_camping_trips, :camping_locations, :num_vocational_trips, :businesses_visited, :num_cultural_trips, :cultural_places_visited, :ymen_trips_fun_listed)\n end",
"def trip_params\n params.require(:trip).permit(:name, :description, :user_id, :start_date, :airport_id, :base64, attendee_ids:[], leg_ids:[])\n end",
"def list\n @trips = Trips.my_trips(cookies[ :user_id ] )\n end",
"def create\n @trip = Trip.new(trip_name: trip_params[:trip_name], user_id: current_user.id)\n respond_to do |format|\n if @trip.save\n UserTrip.create(user_id: current_user.id, trip_id: @trip.id)\n UserTrip.add_users_to_trip(params[:trippers], @trip.id, current_user)\n Exchange.set_defaults(@trip.id)\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render action: 'show', status: :created, location: @trip }\n else\n format.html { render action: 'new' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = Trip.new({\"name\" => \"New Trip\",\n \"beginning\" => Time.now.strftime(\"%d/%m/%Y\"),\n \"duration\" => \"0\",\n \"user\" => current_user})\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { render home_path }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def trip_params\n params.require(:trip).permit(:idRio, :nomeRio)\n end",
"def create_trip(trip_proxy)\n\n trip = Trip.new()\n trip.creator = current_or_guest_user\n trip.user = @traveler\n trip.trip_purpose = TripPurpose.find(trip_proxy.trip_purpose_id)\n\n # get the start for this trip\n from_place = TripPlace.new()\n from_place.sequence = 0\n place = get_preselected_place(trip_proxy.from_place_selected_type, trip_proxy.from_place_selected.to_i, true)\n if place[:poi_id]\n from_place.poi = Poi.find(place[:poi_id])\n elsif place[:place_id]\n from_place.place = @traveler.places.find(place[:place_id])\n else\n from_place.raw_address = place[:address]\n from_place.lat = place[:lat]\n from_place.lon = place[:lon] \n end\n\n # get the end for this trip\n to_place = TripPlace.new()\n to_place.sequence = 1\n place = get_preselected_place(trip_proxy.to_place_selected_type, trip_proxy.to_place_selected.to_i, false)\n if place[:poi_id]\n to_place.poi = Poi.find(place[:poi_id])\n elsif place[:place_id]\n to_place.place = @traveler.places.find(place[:place_id])\n else\n to_place.raw_address = place[:address]\n to_place.lat = place[:lat]\n to_place.lon = place[:lon] \n end\n\n # add the places to the trip\n trip.trip_places << from_place\n trip.trip_places << to_place\n\n planned_trip = PlannedTrip.new\n planned_trip.trip = trip\n planned_trip.creator = trip.creator\n planned_trip.is_depart = trip_proxy.arrive_depart == 'departing at' ? true : false\n planned_trip.trip_datetime = trip_proxy.trip_datetime\n planned_trip.trip_status = TripStatus.find_by_name(TripStatus::STATUS_NEW) \n \n trip.planned_trips << planned_trip\n\n return trip\n end",
"def trip_params\n params.require(:trip).permit(:trip_name, :tripper)\n end",
"def create\n @trip_todo = TripTodo.new(trip_todo_params)\n\n respond_to do |format|\n if @trip_todo.save\n format.html { redirect_to @trip_todo, notice: 'Trip todo was successfully created.' }\n format.json { render :show, status: :created, location: @trip_todo }\n else\n format.html { render :new }\n format.json { render json: @trip_todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def trip_params\n params.require(:trip).permit(:location, :latitude, :longitude, :start_date, :end_date, :days, :notes, :name, clips_attributes: [:uri, :day_list, :date_list, :type_list, :day, :date, :external_reference])\n end",
"def new\n @trips_connect = TripsConnect.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trips_connect }\n end\n end",
"def create\n @trip = Trip.new(trip_params)\n authorize @trip\n @trip.submitter = current_account.accountable\n\n\n @trip.estimated_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @trip.destination\n req.expense_type = 'estimated'\n end\n end\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to home_index_path, notice: 'Trip was successfully created.' }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { render :new }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = Trip.new(params[:trip])\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render :json => @trip.to_json, :callback => params[:callback], status: :created, location: @trip }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n search = TripSearch.new(search_params)\n trips = Trip.apply_scopes(\n search.start_location,\n search.driver_name,\n search.rider_name\n )\n\n render json: trips\n end",
"def create\n @trip = Trip.new(trip_params)\n @trip.user_id = current_user.id\n\n authorize @trip, :create?\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render action: 'show', status: :created, location: @trip }\n else\n format.html { render action: 'new' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = Trip.new(params[:trip])\n @trip.user = @current_user\n r = Request.find_by_url(@trip.url)\n if r; r.destroy; end\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to(@trip, :notice => 'Trip was successfully created.') }\n format.xml { render :xml => @trip, :status => :created, :location => @trip }\n format.json { render :json => @trip }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n format.json { render :json => @trip.errors.full_messages, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = Trip.new(trip_params)\n\n respond_to do |format|\n if @trip.save\n # Get the permission's type which represent an usual user and an admin one.\n permUser = Permission_type.find_by(permission: \"user\").id\n permAdmin = Permission_type.find_by(permission: \"admin\").id\n\n # Create current user's admin permission on the new created trip.\n adminPerm = Permission.new(:user_id => current_user.id, :trip_id => @trip.id, :permission_type_id => permAdmin, :accepted => 1)\n adminPerm.save\n # Create a \"user\" permission for each selected users.\n if params[\"users\"]\n params[\"users\"].each do |user|\n userId = user[2, user.length]\n\n # We don't add the current user, which is an admin.\n if userId != String(current_user.id)\n currentPermission = user[0] == \"1\" ? permAdmin : permUser\n\n perm = Permission.new(:user_id => userId, :trip_id => @trip.id, :permission_type_id => currentPermission, :accepted => 0)\n perm.save\n end\n end\n end\n\n # Create each waypoint of the trip.\n if params['waypoints']\n i = 0\n params['waypoints'].each do |waypoint|\n i += 1\n w = Stop.new(:title => @trip.title + \" - #{i}\", :loc_lat => waypoint[1][0], :loc_lon => waypoint[1][1], :trip_id => @trip.id, :etape_nb => i)\n w.save\n end\n\n # If the endpoint is also the startpoint, add an extra stop.\n if params['arrivalEqualsStart']\n w = Stop.new(:title => @trip.title + \" - #{i + 1}\", :loc_lat => params[\"waypoints\"][\"0\"][0], :loc_lon => params[\"waypoints\"][\"0\"][1], :trip_id => @trip.id, :etape_nb => (i + 1))\n w.save\n end\n end\n\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { render :new }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @profile = Profile.find_by_user_id(current_user.id)\n @trip = @profile.trips.build(params.require(:trip).permit(:date, :time, :pickup_location, :destination, :price, :seats_available, :driver_id, :profile_id))\n if @trip.save\n redirect_to profile_trip_url(@profile, @trip)\n else\n render :action => \"new\"\n end\n end",
"def trip_params\n #Ajouter identifiant de l’utilisateur dans le post\n params.require(:trip).permit(:city, :user_id)\n\tend",
"def create\n # binding.pry\n @trip = Trip.new(trip_params)\n respond_to do |format|\n if @trip.save\n @trip_user_list = TripUserList.new(trip_id: @trip.id,user_id: session[:user_id])\n # binding.pry\n @trip_user_list.save\n format.html { redirect_to \"/trips/#{@trip.id}/locations\", notice: 'Trip was successfully created.' }\n else\n format.html { render :index }\n end\n end\n end",
"def create\n @trip = Trip.new(trip_params)\n @trip.nomad_id = current_nomad.id\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { render :new }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n trips = Trip.all\n respond_with trips\n end",
"def trip_params\n params.require(:trip).permit(:user_id, :trip_name, :walked_at, :planned_at, :distance, :completion)\n end",
"def create\n @trip = Trip.new(user_id: params[:user_id], trip_name: params[:trip_name], distance: params[:distance], walked_at: Time.now)\n @origin = Place.new(user_id: params[:user_id], place_name: params[:origin_name], latitude: params[:origin_lat], longitude: params[:origin_long])\n @destination = Place.new(user_id: params[:user_id], place_name: params[:dest_name], latitude: params[:dest_lat], longitude: params[:dest_long])\n if @trip.save && @origin.save && @destination.save\n @origin_point = TripPoint.new(trip_id: @trip.id, place_id: @origin.id, place_type: \"Origin\")\n @destination_point = TripPoint.new(trip_id: @trip.id, place_id: @destination.id, place_type: \"Destination\")\n @origin_point.save\n @destination_point.save\n else\n render :json => {:success => false, :errors => [\"Trip creation failed.\"]}\n end\n end",
"def trip_params\n params.require(:trip).permit(:code, :name, :price, :temperature, :depart_at, :return_at, :url)\n end",
"def create\n @trip_waypoint = TripWaypoint.new\n @trip_waypoint.place_id = params[:place_id]\n @trip_waypoint.trip_id = params[:trip_id]\n @trip_waypoint.save\n\n respond_to do |format|\n if @trip_waypoint.save\n format.html { redirect_to edit_partner_trip_path(params[:trip_id]), notice: \"Le lieu a été ajouté à l'itinéraire\" }\n # format.json { render :show, status: :created, location: @trip_waypoint }\n else\n format.html { render :new }\n # format.json { render json: @trip_waypoint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = Trip.new(trip_params)\n @trip.session_id = session.id\n @trip.user_id = current_user.id\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip.parent || @trip, notice: 'Trip was successfully created.', change: 'list' }\n format.json { render action: 'show', status: :created, location: @trip, day: 1 }\n else\n format.html { render action: 'new' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ministry = Ministry.find(params[:ministry])\n @trip = @ministry.trips.build(params[:trip])\n\n respond_to do |format|\n if @trip.save\n #flash[:notice] = 'Trip was successfully created.'\n format.html { redirect_to(@trip) }\n format.xml { render :xml => @trip, :status => :created,\n :location => @trip }\n else\n @data_files = DataFile.find(:all, :order => :name)\n format.html { render :action => \"new\" }\n format.xml { render :xml => @trip.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @trips = Trip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def index\n @trips = Trip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def request_trip\n\t\t@trip = Trip.find_by(_id: trip_params[:trip_id])\n\t\t# Check that the current user has not requested more than 3 trips, \n\t\t# That the user has not already requested this trip\n\t\t# and that the trip has available spaces and that the driver is not the requestor\n\t\tif current_user.trips_requested.size <= 5 && \n\t\t\t!(@trip.user_requests.include?(current_user._id)) && @trip.spaces > 0 && @trip.driver != current_user.id.to_s && !(current_user.trips_accepted.include?(@trip.id))\n\n\t\t\t@trip.user_requests << current_user._id\n\t\t\tcurrent_user.trips_requested << @trip._id.to_s\n\t\t\tcurrent_user.save!\n\t\t\t@trip.save!\n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\ttrip: @trip\n\t\t\t}, status: 200\n\t\telse\n\t\t\t# Error handling\n\t\t\tif current_user.trips_requested.size > 5\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'This user has requested too many requests!'\n\t\t\t\t}, status: 422\n\t\t\telsif @trip.user_requests.include?(current_user._id)\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'You have already requested this trip!'\n\t\t\t\t}, status: 422\n\t\t\telsif @trip.spaces <= 0\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'There is no more space in this trip!'\n\t\t\t\t}, status: 422\n\t\t\telsif @trip.driver == current_user.id.to_s\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'You cannot request your own trip!'\n\t\t\t\t}, status: 422\n\t\t\telsif current_user.trips_accepted.include?(@trip.id)\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: \"You've already been accepted on this trip!\"\n\t\t\t\t}, status: 422\n\t\t\telse\n\t\t\t\trender json: {\n\t\t\t\t\tstatus: 'error',\n\t\t\t\t\tmessage: 'Something went wrong...'\n\t\t\t\t}, status: 422\n\t\t\tend\n\t\tend\n\tend",
"def trips\n @agent.get(TRIPS_URL)\n\n # If session expires, re-login to citibikenyc.com. The site will redirect\n # back to TRIPS_URL upon sign in (friendly forwarding)\n login unless @agent.page.title == TRIPS_PAGE_TITLE\n\n rows = Nokogiri::HTML(@agent.page.body).xpath('//table/tbody/tr')\n\n # Reject bike trips that are either in progress or have durations <\n # MIN_TRIP_DURATION minutes.\n rows = rows.reject do |row|\n duration = row.at_xpath('td[6]/text()').to_s.match(/(\\d{1,2})m/)\n !duration || (duration.captures[0].to_i < MIN_TRIP_DURATION)\n end\n rows.map { |row| row_to_trip(row) }\n end",
"def index\n @trips = Trip.where(user: current_user)\n @trip = Trip.new\n end",
"def trip(trip_id)\n connection.get(\"/trips/#{trip_id}\").body\n end",
"def index\n redirect_to find_trips_path\n end",
"def new\n @trip = current_user.trips.new\n @places = []\n end",
"def create\n @trip = Trip.new(params[:trip])\n\t@trip.seat = params[:trip][:seat].to_i + 1\n\t\n\tif params[:trip][:on_demand] == 'Passager'\n\t\t@trip.on_demand = true\n\t\t@trip.driver = nil\n\telse\n\t\t@trip.on_demand = false\n\t\t@trip.driver = current_user\n\tend\n respond_to do |format|\n if @trip.save\n\t\t @trip.users << current_user\n\t\t @trip.save\n format.html { redirect_to(@trip, :notice => 'Le trajet à correctement été enregistré') }\n format.xml { render :xml => @trip, :status => :created, :location => @trip }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def trip_params\n params.require(:trip).permit(:date, :destination, :distance, :price)\n end",
"def set_trip\n @trip = current_user.trips.find(params[:id])\n end",
"def trip_params\n params.require(:trip).permit(:driver_id, :source_id, :destination_id, :departure_time, :seats, :users)\n end",
"def group\n @trips = Trip.find(current_user).trip_users\n\n render json: { result: \"success\", data: @trips }\n end",
"def trip_params\n params.require(:trip).permit(:name, :start_date, :end_date, :town_id)\n end",
"def trip_params\n params.require(:trip).permit(:start_date, :end_date, :name, :completed, :notes)\n end",
"def trip_params\n params.require(:trip).permit(:name, :accomodation_url, :price_per_night, :number_of_possible_attendees, :start_date, :end_date, :start_location, :end_location, :type_of_trip, :total_possible_cost, :total_confirmed_cost, :started, :ended)\n end",
"def trip_params\n params.require(:trip).permit(:name, :description, :nomad_id)\n end",
"def create\n @trip = Trip.new(trip_params)\n\n\n user_ids = params[:trip][:users_attributes]\n\n puts user_ids\n if not user_ids.nil?\n user_ids.keys().each do |k|\n user = User.find(user_ids[k][\"id\"])\n @trip.users << user if user_ids[k][\"_destroy\"] != \"1\" and not @trip.users.include? user\n end\n end\n\n\n respond_to do |format|\n if @trip.save\n format.html { redirect_to @trip, flash: {success: \"Trip was successfully created.\" } }\n format.json { render :show, status: :created, location: @trip }\n else\n format.html { render :new }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @profile = Profile.find_by_user_id(current_user.id)\n @trips = @profile.trips\n end",
"def index\n @trips = Trip.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def create\n @tip = Tip.new(params[:tip])\n\n respond_to do |format|\n if @tip.save\n format.html { redirect_to @tip, notice: 'Tip was successfully created.' }\n format.json { render json: @tip, status: :created, location: @tip }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def trip_params\n params.require(:trip).permit(:name, :description, :starts_at, :ends_at, :image, :image_cache, :place, :promo_cache, :promo, :default_time_zone)\n end",
"def create\n @user = User.find(session[:user_id])\n coordinates = Geocoder.coordinates(future_trip_params[:name])\n @future_trip = @user.future_trips.new(future_trip_params)\n FutureTrip.set_coordinates(@future_trip)\n\n respond_to do |format|\n if @future_trip.save\n\n format.html { redirect_to @future_trip, notice: 'Future trip was successfully created.' }\n format.json { render json: @future_trip }\n else\n format.html { render :new }\n format.json { render json: @future_trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @tips_trick.save\n format.html { redirect_to @tips_trick, notice: 'Tips trick was successfully created.' }\n format.json { render json: @tips_trick, status: :created, location: @tips_trick }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tips_trick.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7208045",
"0.70307076",
"0.6864295",
"0.68321437",
"0.6772133",
"0.6772133",
"0.6692161",
"0.66867685",
"0.664916",
"0.6610407",
"0.6559959",
"0.6522311",
"0.6514665",
"0.6384032",
"0.63697636",
"0.6347624",
"0.6323213",
"0.6318997",
"0.6318997",
"0.6318997",
"0.6318997",
"0.6318997",
"0.6318997",
"0.6318997",
"0.631402",
"0.6307524",
"0.6307524",
"0.6274269",
"0.6248592",
"0.6233168",
"0.6204192",
"0.61985326",
"0.61771584",
"0.61559904",
"0.61294633",
"0.6127715",
"0.6125794",
"0.6125532",
"0.61236835",
"0.61135316",
"0.61051804",
"0.60924006",
"0.6058759",
"0.6035928",
"0.601279",
"0.6010867",
"0.6010867",
"0.5978297",
"0.5935399",
"0.5907363",
"0.58978295",
"0.5895387",
"0.5882101",
"0.5880836",
"0.5868172",
"0.58383274",
"0.5819444",
"0.5817939",
"0.5811817",
"0.5809244",
"0.57962656",
"0.5789441",
"0.5782767",
"0.5772618",
"0.57700276",
"0.5769992",
"0.57637006",
"0.5763023",
"0.5762004",
"0.5756554",
"0.57434785",
"0.5730778",
"0.5728416",
"0.5722644",
"0.57206666",
"0.57136875",
"0.5709786",
"0.5709786",
"0.5701241",
"0.5697696",
"0.56867456",
"0.56844664",
"0.56793755",
"0.5674496",
"0.56735945",
"0.5668632",
"0.5656821",
"0.5654662",
"0.5653947",
"0.5650127",
"0.5637452",
"0.56368303",
"0.5624479",
"0.56219417",
"0.56217176",
"0.5619604",
"0.56108797",
"0.56106263",
"0.5604926",
"0.55977154"
] |
0.56690204
|
85
|
PATCH/PUT /trips/1 PATCH/PUT /trips/1.json
|
def update
respond_to do |format|
if @trip.update(trip_params)
format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }
format.json { render :show, status: :ok, location: @trip }
else
format.html { render :edit }
format.json { render json: @trip.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n\n if @trip.update(trip_params)\n render :json => {:success => true}\n else\n render :json => {:success => false, :errors => [\"Trip update failed.\"]}\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n last_clip(@trip, trip_params[:clips_attributes].present?)\n format.html { redirect_to @trip.parent || @trip, notice: 'Trip was successfully updated.', change: \"list\" }\n format.json { head :no_content }\n else\n format.html { redirect_to @trip.parent || @trip }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trip_item = TripItem.find(params[:id])\n\n respond_to do |format|\n if @trip_item.update_attributes(params[:trip_item])\n format.html { redirect_to @trip_item, notice: 'Trip item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trip_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n trip = Trip.find(params[:id])\n if trip.update(trip_params)\n redirect_to trip_path\n else\n render :edit, status: :bad_request\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @trip, :update?\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to trips_path, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if user_can_modify(@trip) and @trip.update_attributes(params[:trip])\n format.html { redirect_to(@trip, :notice => 'Trip was successfully updated.') }\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n format.json { render :json => @trip.errors.full_messages, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to oj_path, notice: 'Trip was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n trip = Trip.find_by_id(params[:trip_id])\n trip.title = params[:title]\n trip.city = params[:city]\n trip.state = params[:state]\n trip.country = params[:country]\n trip.start_date = params[:start_date]\n trip.end_date = params[:end_date]\n trip.description = params[:description]\n trip.link = params[:link]\n if params[:photo_base]\n trip.photo = params[:photo_base]\n end\n trip.save!\n render json: trip\n end",
"def update\n respond_to do |format|\n if @trip_todo.update(trip_todo_params)\n format.html { redirect_to @trip_todo, notice: 'Trip todo was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip_todo }\n else\n format.html { render :edit }\n format.json { render json: @trip_todo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to(@trip, :notice => 'Trip was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to trip_url(@user.trips.last.id), notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n \n \n params[:trip][:category_ids] ||= []\n params[:trip][:type_ids] ||= []\n \n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to @trip, :notice => 'Trip was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(parse_post params[:trip])\n flash[:notice] = 'Trip was successfully updated.'\n format.html { redirect_to(@trip) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n\n respond_to do |format|\n if @trip.update_attributes(parse_post params[:trip])\n flash[:notice] = 'Trip was successfully updated.'\n format.html { redirect_to(@trip) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find_by(id: params[:id])\n if @trip.nil?\n head :not_found\n return\n elsif @trip.update(trip_params)\n redirect_to trip_path\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params.merge(user_id: current_user.id))\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n #params[:trip][:participations] ||=[]\n respond_to do |format|\n if @trip.owner_id == current_user.id && @trip.update_attributes(params[:trip])\n flash[:notice] = 'Trip was successfully updated.'\n format.html { redirect_to(@trip) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @troop = Troop.find(params[:id])\n\n respond_to do |format|\n if @troop.update_attributes(params[:troop])\n format.html { redirect_to @troop, notice: 'Troop was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @troop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tips_trick.update_attributes(params[:tips_trick])\n format.html { redirect_to @tips_trick, notice: 'Tips trick was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tips_trick.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @rip = Rip.find(params[:id])\n respond_to do |format|\n if @rip.update_attributes(params[:rip])\n format.html { redirect_to rip_url(@rip) }\n format.xml { head :ok }\n else\n format.html { render :action => 'edit' }\n format.xml { render :xml => @rip.errors.to_xml }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def update\n @trips_connect = TripsConnect.find(params[:id])\n\n respond_to do |format|\n if @trips_connect.update_attributes(params[:trips_connect])\n format.html { redirect_to @trips_connect, notice: 'Trips connect was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trips_connect.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n if current_user.has_permission?(:trips)\n @trip.accessible = :all\n end\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to [:admin, @trip], :notice => \"Trip was successfully updated.\" }\n else\n flash[:error] = \"Trip was not updated.\"\n format.html { render active_admin_template(:edit) }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n\n if @trip.end_point = Station.find_by(uid: params[:station_id])\n render json: @trip.attributes.merge(station: @trip.end_point.attributes), location: @trip\n else\n render json: @trip.errors, status: :unprocessable_entity\n end\n end",
"def update\n authorize @trip\n\n\n @trip.estimated_expenses.each do |exp|\n exp.requests.each do |req|\n req.amount_from_total = req.percentrequested * exp.total\n req.destination = @trip.destination\n req.expense_type = 'estimated'\n end\n end\n\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip }\n else\n format.html { render :edit }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n @tip = Tip.find(params[:id])\n\n respond_to do |format|\n if @tip.update_attributes(params[:tip])\n format.html { redirect_to @tip, notice: 'Tip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tariff = Tariff.find params[:id]\n\n respond_to do |format|\n if @tariff.update(tariff_params)\n format.html { redirect_to @tariff, notice: 'Tariff was successfully updated.' }\n format.json { respond_with_bip(@tariff) }\n else\n format.html { render :edit }\n format.json { respond_with_bip(@tariff) }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n @tip.update(tips_params)\n json_response(@tip)\n end",
"def edit\n @trip = Trip.find(params[:id])\n end",
"def update\n @user = User.find(params[:user_id])\n @trip.start = params[:trip][:start]\n @trip.end = params[:trip][:end]\n respond_to do |format|\n if @trip.update\n format.html { redirect_to [@user,@trip], notice: 'Trip was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n @ministry = @trip.ministry\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n #flash[:notice] = 'Trip was successfully updated.'\n format.html { redirect_to(@trip) }\n format.xml { head :ok }\n else\n @data_files = DataFile.find(:all, :order => :name)\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trip.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @future_trip.update(future_trip_params)\n format.html { redirect_to @future_trip, notice: 'Future trip was successfully updated.' }\n format.json { render :show, status: :ok, location: @future_trip }\n else\n format.html { render :edit }\n format.json { render json: @future_trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n format.html { redirect_to @trip, notice: 'Trip was successfully updated.' }\n else\n format.html { render :index }\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 if @troop.update(troop_params)\n render :show, status: :ok, location: @troop\n else\n render json: @troop.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @third_rip.update(third_rip_params)\n format.html { redirect_to @third_rip, notice: 'Third rip was successfully updated.' }\n format.json { render :show, status: :ok, location: @third_rip }\n else\n format.html { render :edit }\n format.json { render json: @third_rip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tap.update(tap_params)\n format.html { redirect_to taps_path, notice: 'Tap was successfully updated.' }\n format.json { head :no_content }\n else\n format.json { render json: @tap.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 patch(path, opts = {})\n request(:patch, path, opts).body\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @todo = Todo.find(params[:todo][:id])\n if @todo.update_attributes(user_params)\n render json: @todo\n else\n render nothing: true, status: :bad_request\n end\n end",
"def update\n @gtfs_trip = GtfsTrip.find(params[:id])\n\n respond_to do |format|\n if @gtfs_trip.update_attributes(params[:gtfs_trip])\n format.html { redirect_to(@gtfs_trip, :notice => 'Gtfs trip was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @gtfs_trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n if @todo.update(todo_params)\n render json: @todo\n else\n render json: @todo.errors, status: :unprocessable_entity\n end\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 @trip_feature = TripFeature.find(params[:id])\n\n respond_to do |format|\n if @trip_feature.update_attributes(params[:trip_feature])\n format.html { redirect_to(@trip_feature, :notice => 'TripFeature was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trip_feature.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n respond_to do |format|\n if @tip.update!(tip_params)\n format.html { redirect_to @tip, notice: \"#{@tip.name} tip has been updated.\" }\n format.json { render :show, status: :ok, location: @tip }\n else\n format.html { render :edit }\n format.json { render json: @tip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @first_rip.update(first_rip_params)\n format.html { redirect_to @first_rip, notice: 'First rip was successfully updated.' }\n format.json { render :show, status: :ok, location: @first_rip }\n else\n format.html { render :edit }\n format.json { render json: @first_rip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trompler = Trompler.find(params[:id])\n\n respond_to do |format|\n if @trompler.update_attributes(params[:trompler])\n format.html { redirect_to @trompler, notice: 'Trompler was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trompler.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n params[:trip][:places] ||= []\n @trip.add_trip_places(params[:trip][:places])\n if @trip.update_attributes(params[:trip].except(:places))\n flash[:notice] = \"Trip succesfully updated\"\n redirect_to @trip\n else\n flash.now[:error] = @trip.errors.full_messages\n @places = params[:trip][:places]\n render \"edit\"\n end\n end",
"def update\n @trip = Trip.find(params[:id])\n @trip.assign_attributes(trip_params)\n\n if @trip.save\n redirect_to passenger_trip_path(@trip.passenger_id, @trip.id)\n end\n end",
"def update\n # @user_trick = UserTrick.find(params[:id])\n @user_trick.update(user_trick_params)\n render json: UserTrickSerializer.new(@user_trick).serialized_json\n end",
"def update\n @field_trip = FieldTrip.find(params[:id])\n\n respond_to do |format|\n if @field_trip.update_attributes(params[:field_trip])\n format.html { redirect_to(@field_trip, :notice => 'Field trip was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @field_trip.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def update\n respond_to do |format|\n if @troop.update(troop_params)\n format.html { redirect_to @troop, notice: 'Tropa exitosamente actualizada.' }\n format.json { render :show, status: :ok, location: @troop }\n else\n format.html { render :edit }\n format.json { render json: @troop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tripdate = Tripdate.find(params[:id])\n\n respond_to do |format|\n if @tripdate.update_attributes(params[:tripdate])\n format.html { redirect_to @tripdate, notice: 'Tripdate was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tripdate.errors, status: :unprocessable_entity }\n end\n end\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 # PATCH\n raise NotImplementedError\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n respond_to do |format|\n if @trump.update(trump_params)\n format.html { redirect_to @trump, notice: 'Trump was successfully updated.' }\n format.json { render :show, status: :ok, location: @trump }\n else\n format.html { render :edit }\n format.json { render json: @trump.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fleet = Fleet.find(params[:id])\n\n respond_to do |format|\n if @fleet.update_attributes(params[:fleet])\n format.html { redirect_to @fleet, notice: 'Fleet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fleet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n travel = Travel.find(params[:id])\n if travel.update(travel_params)\n render json: travel, status: 200\n else\n render json: travel.errors, status: 422\n end\n end",
"def update\n respond_to do |format|\n if @tip.update(tip_params)\n format.html { redirect_to @tip, notice: 'Tip was successfully updated.' }\n format.json { render :show, status: :ok, location: @tip }\n else\n format.html { render :edit }\n format.json { render json: @tip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find_by_user_id(current_user.id)\n @trip = Trip.find(params[:id])\n if @trip.update_attributes(params.require(:trip).permit(:date, :time, :pickup_location, :destination, :price, :seats_available, :driver_id, :profile_id))\n redirect_to profile_trip_url(@profile, @trip)\n else\n render :action => \"edit\"\n end\n end",
"def update\n respond_to do |format|\n\n @pizza.toppings.each do |t|\n @pizza.toppings.delete(t)\n end\n\n params[:topping_ids].each do |tid|\n topping = Topping.find_by_id(tid)\n @pizza.toppings << topping\n end\n\n if @pizza.update(pizza_params)\n format.html { redirect_to @pizza, notice: 'Pizza was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pizza.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @spawner = Spawner.find(params[:id])\n @fieldtrips = Fieldtrip.all\n\n respond_to do |format|\n if @spawner.update_attributes(spawner_params)\n format.html { redirect_to @spawner, notice: 'Spawner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spawner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @trip.update_attributes(trip_params)\n flash[:success] = \"Trip updated for #{@trip.student.name}.\"\n redirect_to @trip\n else\n render 'edit'\n end\n end",
"def update\n @tier = Tier.find(params[:id])\n\n respond_to do |format|\n if @tier.update_attributes(params[:tier])\n format.html { redirect_to @tier, :notice => 'Tier was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @tier.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @templete = Templete.find(params[:id])\n\n respond_to do |format|\n if @templete.update_attributes(params[:templete])\n format.html { redirect_to @templete, :notice => 'Templete was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @templete.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip_route.update(trip_route_params)\n format.html { redirect_to @trip_route, notice: 'Trip route was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip_route }\n else\n format.html { render :edit }\n format.json { render json: @trip_route.errors, status: :unprocessable_entity }\n end\n end\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 @trick = Trick.find(params[:id])\n\n respond_to do |format|\n if @trick.update_attributes(params[:trick])\n format.html { redirect_to @trick, notice: 'Trick was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trick.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n if @trip.update(trip_params)\r\n redirect_to trips_path, notice: 'Trip was successfully updated.'\r\n else\r\n redirect_to edit_trip_path, notice: 'Cannot leave information blank.'\r\n end\r\n end",
"def update\n update_resource @ride, ride_params\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update\n @tip_so = TipSo.find(params[:id])\n\n respond_to do |format|\n if @tip_so.update_attributes(params[:tip_so])\n format.html { redirect_to @tip_so, notice: 'Tip so was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tip_so.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @trip = Trip.find_by(id: params[:id])\n \n if @trip.nil?\n redirect_to trip_path\n return\n end\n end",
"def update\n tip = Tip.find(params[:id])\n tip.update(tip_params)\n \n redirect_to tips_path\n end",
"def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end",
"def update\n respond_to do |format|\n if @trip_type.update(trip_type_params)\n format.html { redirect_to @trip_type, notice: 'Trip type was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip_type }\n else\n format.html { render :edit }\n format.json { render json: @trip_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @chest_triceps1.update(chest_triceps1_params)\n format.html { redirect_to \"/chest_triceps1s\" } \n format.json { render :show, status: :ok, location: @chest_triceps1 }\n else\n format.html { render :edit }\n format.json { render json: @chest_triceps1.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6753636",
"0.67453563",
"0.6706192",
"0.6706192",
"0.67016983",
"0.6695184",
"0.65354353",
"0.6473278",
"0.6462758",
"0.6444298",
"0.6444298",
"0.6427983",
"0.64206475",
"0.6391811",
"0.6363443",
"0.63565403",
"0.63495326",
"0.63475513",
"0.63218755",
"0.62844306",
"0.6271477",
"0.6271477",
"0.62124556",
"0.62052286",
"0.6195009",
"0.61638445",
"0.6126397",
"0.61047953",
"0.6102769",
"0.6081704",
"0.6065032",
"0.60479945",
"0.6037175",
"0.6035964",
"0.6003946",
"0.5971208",
"0.5961718",
"0.5959544",
"0.5958563",
"0.5944127",
"0.5935829",
"0.5931404",
"0.5909266",
"0.58790386",
"0.5875228",
"0.58689344",
"0.58441603",
"0.58353835",
"0.58332044",
"0.5826377",
"0.5825725",
"0.58213884",
"0.5818053",
"0.58095217",
"0.58095133",
"0.58095133",
"0.57935184",
"0.5782696",
"0.5779752",
"0.57762766",
"0.57760215",
"0.5761063",
"0.57593244",
"0.57527447",
"0.57514906",
"0.57419324",
"0.57410467",
"0.57410467",
"0.5739464",
"0.57375896",
"0.57214",
"0.5714459",
"0.5708004",
"0.5704344",
"0.5690184",
"0.5689361",
"0.568727",
"0.56850374",
"0.56817997",
"0.56757724",
"0.5675244",
"0.5674373",
"0.5672656",
"0.5671118",
"0.5670697",
"0.5668572",
"0.5667543",
"0.5663453",
"0.5658808",
"0.5654446",
"0.5647802",
"0.56430453",
"0.5633551",
"0.5631217",
"0.56235325"
] |
0.6330609
|
23
|
DELETE /trips/1 DELETE /trips/1.json
|
def destroy
@trip = Trip.find(params[:trip])
if current_user.trips.include?(@trip)
@trip.destroy
render json: {message: "usunięto tripa"}
else
@trip.errors.add(:permissions, 'brak uprawnień')
render json: { errors: @trip.errors }, status: :unauthorized
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to find_trips_url }\n format.json { head :no_content }\n end\n end",
"def delete\n @trip = Trips.find_trip( params[ :id ])\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n trip = Trip.find(params[:id])\n trip.destroy\n render json: {message: \"Successfully deleted trip\"}\n end",
"def destroy\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to(trips_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to(trips_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to(trips_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @trip_item = TripItem.find(params[:id])\n @trip_item.destroy\n\n respond_to do |format|\n format.html { redirect_to trip_items_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n authorize @trip, :destroy?\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trips_connect = TripsConnect.find(params[:id])\n @trips_connect.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_connects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n\n head :no_content\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to @trip.parent || trips_url, change: 'trip' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url, notice: 'Trip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url, notice: 'Trip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url, notice: 'Trip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url, notice: 'Trip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url, notice: 'Trip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url, notice: 'Trip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url, notice: 'Trip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url, notice: 'Trip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url, flash: {success: \"Trip was successfully deleted.\" } }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user = User.find(params[:user_id])\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to user_trips_url(@user) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url, alert: \"L'itinéraire a été supprimé.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip = Trip.find_by(id: params[:id])\n \n if @trip.nil?\n return\n end\n @trip.destroy\n redirect_to trips_path\n return\n end",
"def destroy\n if @trip.destroy\n render :json => {:success => true}\n else\n render :json => {:success => false, :errors => [\"Delete failed.\"]}\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n authorize @trip\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url, notice: 'Trip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t@trip = @user.organized_trips.find(params[:id])\n\t\t@trip.destroy\n\t\trespond_with @trip\n\tend",
"def destroy\n @field_trip = FieldTrip.find(params[:id])\n @field_trip.destroy\n\n respond_to do |format|\n format.html { redirect_to(field_trips_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @gtfs_trip = GtfsTrip.find(params[:id])\n @gtfs_trip.destroy\n\n respond_to do |format|\n format.html { redirect_to(gtfs_trips_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @profile = Profile.find_by_user_id(current_user.id)\n @trip = Trip.find(params[:id])\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to profile_trips_path(@profile) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @step.destroy\n respond_to do |format|\n format.html { redirect_to @trip }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoiced_trip.destroy\n respond_to do |format|\n format.html { redirect_to invoiced_trips_url, notice: 'Invoiced trip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end",
"def destroy\n\n # set the @traveler variable\n get_traveler\n # set the @trip variable\n get_trip\n \n if @trip\n @trip.planned_trips.each do |pt| \n pt.itineraries.each { |x| x.destroy }\n end\n @trip.planned_trips.each { |x| x.destroy }\n @trip.trip_places.each { |x| x.destroy}\n @trip.destroy\n message = t(:trip_was_successfully_removed)\n else\n render text: t(:error_404), status: 404\n return\n end\n\n respond_to do |format|\n format.html { redirect_to(user_planned_trips_path(@traveler), :flash => { :notice => message}) } \n format.json { head :no_content }\n end\n \n end",
"def destroy\n @drip = Drip.find(params[:id])\n @drip.destroy\n\n respond_to do |format|\n format.html { redirect_to drips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @ministry = @trip.ministry\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to(@ministry) }\n format.xml { head :ok }\n end\n end",
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def delete(id)\n request(:delete, \"/recipes/#{id}.json\")\n end",
"def destroy\n @troop = Troop.find(params[:id])\n @troop.destroy\n\n respond_to do |format|\n format.html { redirect_to troops_url }\n format.json { head :ok }\n end\n end",
"def destroy\n # First delete trip's permissions.\n @trip.permissions.each do |perm|\n perm.destroy\n end\n\n # Then delete the trip itself.\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url, notice: 'Trip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n @trip = Trip.find_by(deletion_token: params[:id])\n if @trip\n if @trip.soft_delete!\n # do nothing, render update page\n else\n render :not_found # let's give no information on this error to the internet\n end\n else\n render :not_found # let's give no information on this error to the internet\n end\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n respond_to do |format|\n format.html {}\n format.js { render :layout => false }\n end\n end",
"def destroy\n @class_trip.destroy\n respond_to do |format|\n format.html { redirect_to class_trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip_todo.destroy\n respond_to do |format|\n format.html { redirect_to trip_todos_url, notice: 'Trip todo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destory\n @trip = Trips.delete_trip( params[ :id ] )\n flash[:notice] = \"Trip Deleted successfuly\"\n redirect_to(:action => 'list')\n end",
"def destroy\n @trap = Trap.find(params[:id])\n @trap.destroy\n\n respond_to do |format|\n format.html { redirect_to traps_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @guide_trip.destroy\n respond_to do |format|\n format.html { redirect_to guide_trips_url, notice: 'Guía turístico fue eliminado satisfactoriamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tramite = Tramite.find(params[:id])\n @tramite.destroy\n\n respond_to do |format|\n format.html { redirect_to tramites_url }\n format.json { head :no_content }\n end\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def destroy\n @taxi = Taxi.find(params[:id])\n @taxi.destroy\n\n respond_to do |format|\n format.html { redirect_to taxis_url }\n format.json { head :ok }\n end\n end",
"def destroy\r\n @trip.destroy\r\n redirect_to trips_path, notice: 'Trip was successfully removed.'\r\n end",
"def destroy\n @tripdate = Tripdate.find(params[:id])\n @tripdate.destroy\n\n respond_to do |format|\n format.html { redirect_to tripdates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @snip = Snip.find(params[:id])\n @snip.destroy\n\n respond_to do |format|\n format.html { redirect_to snips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip_story = TripStory.find(params[:id])\n @trip_story.destroy\n\n respond_to do |format|\n format.html { redirect_to(trip_stories_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @treq = Treq.find(params[:id])\n @treq.destroy\n\n respond_to do |format|\n format.html { redirect_to treqs_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def delete(path)\n request(:delete, path)\n end",
"def delete\n @delete ||= Verb.new do |verb|\n verb.entity :trip, :air, :lodging, :car, :profile, :rail, \\\n :transport, :cruise, :restaurant, :activity, :note, :map, \\\n :directions \\\n do |entity, id|\n do_request('delete', entity, {:id=>id}, nil)\n end\n end\n end",
"def destroy\n @third_rip.destroy\n respond_to do |format|\n format.html { redirect_to third_rips_url, notice: 'Third rip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def delete(path)\n request 'DELETE', path\n end",
"def destroy\n @clip.destroy\n respond_to do |format|\n format.html { redirect_to trip_path(@clip.trip.parent), change: 'list' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip_driver = TripDriver.find(params[:id])\n @trip_driver.destroy\n\n respond_to do |format|\n format.html { redirect_to trip_drivers_url }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def delete(path, params)\n parse_response @client[path].delete(:params => params)\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @trail = Trail.find(params[:id])\n @trail.destroy\n\n respond_to do |format|\n format.html { redirect_to trails_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @trio.destroy\n respond_with(@trio, :location => trios_url)\n end",
"def recipe_delete # /v1/user/:id/recipes/:recipe_id (DELETE)\n params[:recipes] = params[:recipe_id]\n recipes_delete\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def destroy\n Todo.find(params[:id]).destroy\n render :json => {:message => \"Record deleted\", :item_id => params[:id]}\n end",
"def destroy\n @tap.destroy\n respond_to do |format|\n format.html { redirect_to taps_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 @trail = Trail.find(params[:id])\n @trail.destroy\n\n respond_to do |format|\n format.html { redirect_to trails_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @trip = Trip.find(params[:id])\n\n stat(@trip, \"del\")\n\n ing = @trip.ing\n if ing\n trip_user_delete(@trip.driver)\n @trip.car.update_attribute(:current_trip, 0)\n @trip.workers.each do |worker|\n trip_user_delete(worker)\n end\n end\n\n @trip.workers.clear\n\n @trip.destroy\n\n respond_to do |format|\n format.html do\n flash[:success] = \"该出车记录已删除!\"\n sign_in(current_user)\n if ing\n redirect_to '/drivers/start'\n else\n redirect_to '/drivers/trips'\n end\n end\n format.json\n end\n end",
"def delete(path, params = {})\n post(path, params.merge(\"_method\" => \"delete\"))\n end",
"def destroy\n @tetramod = Tetramod.find(params[:id])\n @tetramod.destroy\n\n respond_to do |format|\n format.html { redirect_to tetramods_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n travel = Travel.find(params[:id])\n travel.destroy\n head 204\n end",
"def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end",
"def destroy\n rid = params['id']\n if Aws.delete_recipe(rid) && Aws.delete_all_ingredients(rid)\n msg = {:notice => \"Recipe deleted!\"}\n render :json => msg\n else\n msg = {:notice => \"Error while deleting from DynamoDB!\"}\n render :json => msg\n end\n end",
"def destroy\n @future_trip.destroy\n respond_to do |format|\n format.html { redirect_to future_trips_url, notice: 'Future trip was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy \n\n \n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to request.env['HTTP_REFERER'] }\n format.json { head :ok }\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(path, opts = {})\n request(:delete, path, opts).body\n end",
"def destroy\n @todo = Todo.find(params[:id])\n @todo.destroy\n render json: nil, status: :ok\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end",
"def delete(path, params={})\n request(:delete, path, params)\n end"
] |
[
"0.74131525",
"0.7404101",
"0.73837495",
"0.73837495",
"0.7373286",
"0.7373286",
"0.7373286",
"0.7302994",
"0.7280395",
"0.72525823",
"0.72525823",
"0.72525823",
"0.7190258",
"0.7190258",
"0.7190258",
"0.7182205",
"0.71414",
"0.7120381",
"0.70009905",
"0.6918324",
"0.69046646",
"0.6864886",
"0.6864886",
"0.6864886",
"0.6864886",
"0.6864886",
"0.6864886",
"0.6864886",
"0.6864886",
"0.6826263",
"0.6812409",
"0.67842734",
"0.6766543",
"0.6747826",
"0.6714004",
"0.66968817",
"0.6692982",
"0.6662472",
"0.66624093",
"0.6642625",
"0.663986",
"0.6639124",
"0.66235477",
"0.6615175",
"0.66045094",
"0.6601989",
"0.65936184",
"0.65839756",
"0.6573984",
"0.65616924",
"0.65616655",
"0.6560302",
"0.6552975",
"0.6549137",
"0.65373605",
"0.6497046",
"0.64869815",
"0.648346",
"0.6471944",
"0.6468241",
"0.645061",
"0.6439278",
"0.6429702",
"0.64272565",
"0.6419409",
"0.6416836",
"0.6408325",
"0.6394918",
"0.6391476",
"0.63905954",
"0.63902956",
"0.63839346",
"0.6368035",
"0.6350891",
"0.6345016",
"0.634401",
"0.6342431",
"0.6341968",
"0.634112",
"0.63287354",
"0.632164",
"0.6321384",
"0.6320616",
"0.632054",
"0.63156885",
"0.6315574",
"0.6310447",
"0.6304279",
"0.6304049",
"0.63030344",
"0.63015527",
"0.6301481",
"0.6297639",
"0.6295016",
"0.6289316",
"0.6285608",
"0.6282857",
"0.62812924",
"0.62812924",
"0.62812924"
] |
0.6732516
|
34
|
Use callbacks to share common setup or constraints between actions.
|
def set_trip
@trip = Trip.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def trip_params
params.require(:trip).permit(:name, :start_date, :end_date, :town_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
|
Take a file, get all the lines until matching termination_pattern. We are searching for // in particular, which are the termination characters for the cds. TODO: make the method general for any String object, and not for file objects.
|
def get_sequence(file, termination_pattern, keep_last = nil)
assert(file.class == File, "#{file} is not a valid File object.")
assert(termination_pattern.class == Regexp, "#{termination_pattern} is not a valid Regexp object.")
out = ""
line = file.gets
# Continue reading file lines until file ends or
# line match termination_pattern
while (!file.eof? && !line.match(termination_pattern)) do
out += line
line = file.gets # read next line
end
if keep_last
out += line
end
if (!line.match(termination_pattern))
abort("Error: Cannot find termination pattern.")
end
out
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def getFileLineEndings(file)\n File.open(file, 'rb') do |f|\n return f.readline[/\\r?\\n$/]\n end\nend",
"def getFileLineEndings(file)\n File.open(file, 'rb') do |f|\n return f.readline[/\\r?\\n$/]\n end\nend",
"def get_lines raw_file\n lines = raw_file.split(\"\\n\").compact\n lines = lines.uniq.reject{|line| line.empty?}\n lines = lines.reject do |line| \n not LEGAL_CATEGORIES.include? line.split[0]\n end\n end",
"def filter\n read = []\n @file.each do |line|\n line = line.strip\n if !line[0].nil? && (line[0] != '/') # if line is not comment or blank append to output\n line = line.split(' ')[0] # removes inline comments\n read.append(line)\n end\n end\n read\n end",
"def clean_lines\n lines = @file_content.split(\"\\r\").select { |line| !line.match(/$\\s*#/)} unless @file_content.nil?\n end",
"def grep_file(file_path, grep_pattern)\n logc(\"method: #{__method__}, params: #{file_path}, #{grep_pattern}\")\n\n # with File.open(file_path, 'r').each.grep(grep_pattern) possible invalid byte sequence in UTF-8 (ArgumentError)\n # so we use \"match\" to check if line match pattern and 'scrub' to skip bad encoding symbols\n res = []\n File.open(file_path, 'r').each {|line| res << line if line.scrub.match(grep_pattern)}\n return res\nend",
"def find_valid_data filename\n start = 0\n dbfile = File.new(filename)\n s = dbfile.gets\n while s[0] == ?# or s[0]==?\\n\n start+= s.size\n s = dbfile.gets\n end\n dbfile.seek(-128, File::SEEK_END)\n s = dbfile.read(128).chomp;\n last = s.rindex(\"\\n\");\n dbfile.close\n return [start-1,File.size(filename) - last]\nend",
"def lines\n File\n .read(@source_path)\n .lines\n .map(&:chomp)\n .reject { |line| line.strip.empty? || line.match(Tokens::COMMENT_MATCHER) }\n end",
"def get_lines(filename); end",
"def grep(file, regexp, &block)\n if block_given?\n File.open(file, 'r').each {|line| line.chomp!; block[line] if line =~ regexp }\n else\n lines = []\n File.open(file, 'r').each {|line| line.chomp!; lines << line if line =~ regexp }\n lines\n end\n end",
"def read_file(file)\n lines = []\n IO.foreach(find(file)) do |line|\n lines << line.strip unless line.strip == ''\n end\n lines\n end",
"def lines(textFile)\n textFile.to_a.select {|line| /\\S/ =~ line and /^\\#/ !~ line}.length\nend",
"def get_context_from_file(filepath)\r\n context = []\r\n\r\n end_header = false\r\n before_line = \"before\"\r\n\r\n open(filepath) {|f|\r\n f.each {|line|\r\n line = line.encode(\"UTF-16BE\", :invalid => :replace, :undef => :replace, :replace => '?').encode(\"UTF-8\")\r\n line = line.chomp\r\n\r\n if before_line.empty? and not line.empty? and not @header_regxp.match(line)\r\n end_header = true\r\n end\r\n\r\n context << line if end_header\r\n\r\n before_line = line\r\n }\r\n }\r\n context.join(\" \")\r\nend",
"def potential_lines(filename); end",
"def filter_lines(regexp, offset = 0, &block)\n f = File.open(@file_path)\n f.seek(offset) if offset > 0\n @bytes_read = 0\n\n begin\n while line = f.gets\n @bytes_read += line.length\n yield line if line =~ regexp\n end\n ensure\n f.close\n end\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 edit_text_detect_line_endings(input_file, opts = {})\n data, _status_code, _headers = edit_text_detect_line_endings_with_http_info(input_file, opts)\n data\n end",
"def body\n lines = ''\n in_head = true\n File.open(@file).each_line do |line|\n in_head = false if in_head and line.chomp.empty?\n lines << line unless in_head\n end\n return lines\n end",
"def find_file_lines(file)\n file.open { |f| find_number_lines(f) }\n end",
"def find_post_content(file_contents, match, close_length)\n lines = file_contents.split(\"\\n\")\n length = (match.length - 1)\n lines.each do |line|\n next unless line[0..length] == match\n chars = line.split('')\n chars.shift(match.length)\n chars.pop(close_length)\n return chars.join('')\n end\n false\n end",
"def line_count(file)\n\t\tf = File.new(file)\n\t\tnum_newlines = 0\n\t\twhile (c = f.getc) != nil\n\t\t\tnum_newlines += 1 if c == $/\n\t\tend\n\t\tnum_newlines\n\tend",
"def select_valid_lines\n File.readlines(FILE_NAME).select { |l| l.downcase.include?('calling core') }\nend",
"def read_regexps_from_file(file_name)\n matchers = []\n File.open(file_name).each_line do |l|\n next if (l =~ /^(#.*|\\s*)$/) # emtpy lines and lines starting with #\n matchers << Regexp.new(l.strip)\n end\n end",
"def readContacts(lpc_result)\n result_lines = File.readlines(lpc_result)\n pattern = \"Residue Dist Surf HB Arom Phob DC\"\n pattern_line_num = -1\n result_lines.each_with_index do |line, idx| \n if line.include? pattern\n pattern_line_num = idx\n end\n end\n raise \"Cannot find contacts in the LPC result\" if pattern_line_num == -1\n\n contacts = []\n result_lines.each_with_index do |line, idx| \n if idx > pattern_line_num + 1\n break if line =~ /----------/\n contacts.push(line)\n end\n end\n\n contacts\nend",
"def ruby_grep(filename, pattern)\n regexp = Regexp.new(pattern)\n File.open(filename, 'r') do |file|\n file.each_line {|line| puts line if regexp =~ line}\n end\nend",
"def clean_comments(file)\n @in_file = file.readlines\n @in_file.delete_if{|index| index.match(/^[\\/]{2}/) }\n end",
"def matching_lines(regex); 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 guess_line_ending(filehandle, options)\n counts = {\"\\n\" => 0, \"\\r\" => 0, \"\\r\\n\" => 0}\n quoted_char = false\n\n # count how many of the pre-defined line-endings we find\n # ignoring those contained within quote characters\n last_char = nil\n lines = 0\n filehandle.each_char do |c|\n quoted_char = !quoted_char if c == options[:quote_char]\n next if quoted_char\n\n if last_char == \"\\r\"\n if c == \"\\n\"\n counts[\"\\r\\n\"] += 1\n else\n counts[\"\\r\"] += 1 # \\r are counted after they appeared\n end\n elsif c == \"\\n\"\n counts[\"\\n\"] += 1\n end\n last_char = c\n lines += 1\n break if options[:auto_row_sep_chars] && options[:auto_row_sep_chars] > 0 && lines >= options[:auto_row_sep_chars]\n end\n rewind(filehandle)\n\n counts[\"\\r\"] += 1 if last_char == \"\\r\"\n # find the most frequent key/value pair:\n k, _ = counts.max_by{|_, v| v}\n return k\n end",
"def filter(file)\n output = ''\n IO.foreach(file) do |line|\n next if line =~ /^\\s*$/ # Skip blank lines\n next if line =~ /^\\s*#/ # Skip comments\n \n dest, via = line.split\n if via =~ /^\\d+\\.\\d+\\.\\d+\\.\\d+$/ && directly_reachable(via)\n output << line\n else\n @facts['interfaces'].split(',').each do |inf|\n if via == inf\n output << line\n end\n end\n end\n end\n \n if !output.empty?\n output.insert(0, \"# Entries from #{file}\\n\")\n end\n output\nend",
"def _gets_without_comment(fh)\n row = _gets(fh) or return nil\n (m = row.match(@comment[:line])) and return m.pre_match.lstrip\n\n row.lstrip.chomp!\n cblock_pre, cblock_post = @comment[:block]\n (m = row.match(cblock_pre)) or return row.rstrip\n\n former = m.pre_match.lstrip\n row = m.post_match\n until (m = row.match(cblock_post))\n row = _gets(fh) or return nil\n end\n\n latter = m.post_match.chomp.rstrip\n former.empty? and return latter\n latter.empty? or former += \" #{latter}\"\n former\n end",
"def filter_matched_lines(matched_files)\n matched_lines = []\n\n matched_files.each do |file|\n diff = git.diff_for_file(file)\n next if diff.binary?\n\n patch_lines = diff.patch.split(\"\\n\").map(&:strip)\n diff_start_line = [patch_lines.select { |line| line.start_with? \"@@\" }].flatten.compact\n next if diff_start_line.empty?\n\n start_line_number = patch_lines.index(diff_start_line[0]) + 1\n matched_lines += patch_lines[start_line_number, patch_lines.count - 1]\n .map(&:strip)\n .select { |line| line.start_with? \"+\" }\n end\n\n return [matched_lines].flatten.compact\n end",
"def lines\n return self.sale.file_content.lines[self.begins_at_line..self.ends_at_line]\n end",
"def query_lines(chr = nil, start = nil, stop = nil)\n raise EntryFileError, \"Do not know how to query for lines in #{File.basename(@data_file)}!\"\n end",
"def comments_of_file(file)\n File.readlines(file).map { |s| s[2..-1].rstrip if s.start_with?('# ') }.compact\n end",
"def read(path)\n File.open(path) do |f|\n until f.eof?\n line = f.gets.chomp\n next if line.empty? || line =~ /^%%/\n yield line.split(/\\t/).map! { |s| s.empty? ? nil : s }\n end\n end\n end",
"def parse_crlf data\n return if data == ''\n if ilf = data.index(\"\\n\")\n # if we find a LF and that LF is after a CR we first handle\n # the CR\n if icr = data.index(\"\\r\") and ilf != (icr+1) and icr < ilf\n parse_cr data, icr\n else\n parse_lf data, ilf\n end\n else\n if icr = data.index(\"\\r\")\n parse_cr data, icr\n else\n @linebuffer << data\n @outputbuffer.print data\n end\n end\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 line_filter(line)\n entry_pattern.match(line)\n end",
"def getl(fh)\n\t\tfh.each do |line|\n\t\t\tnext if /^#/===line\t\t\t\t\t# comment\n\t\t\tnext if /^[ \\t]*$/===line\t\t# whitespace\n\t\t\treturn line.chomp\n\t\tend\n\tend",
"def find_matching_source_lines\n\t\tmatches = []\n\n\t\tsource_files = $hoespec.spec.files.grep( /\\.(h|c|rb)$/ )\n\t\tsource_files -= self.quality_check_whitelist\n\n\t\tsource_files.each do |filename|\n\t\t\tprevious_line = nil\n\n\t\t\tIO.foreach( filename ).with_index do |line, i|\n\t\t\t\tmatches << [filename, i + 1, line] if yield( line, previous_line )\n\t\t\t\tprevious_line = line\n\t\t\tend\n\t\tend\n\n\t\treturn matches\n\tend",
"def updated_lines\n io = @diff.each_line\n path = nil\n\n found = []\n\n while true\n line = io.next\n if line =~ FILE_PATTERN\n path = $1\n end\n\n if hunk_header?(line)\n line_numbers = line_numbers_for_destination(line)\n found << [ path, line_numbers ]\n end\n end\n rescue StopIteration\n return found\n end",
"def line_from_file(filename, substring)\n fh = File.open(filename)\n begin\n line = fh.gets\n raise TextHandler::InvalidLineError unless line.include?(substring)\n return line\n rescue TextHandler::InvalidLineError => e\n puts \"Invalid line!\"\n puts e\n puts e.backtrace\n puts e.message\n raise\n ensure\n fh.close\n end\n return line\nend",
"def get_lines\n lines = []\n line = \"\"\n until line == \".\"\n line = Readline.readline\n lines << line\n end\n lines.join(\"\\n\")\n end",
"def read_file(file)\r\n\tlines = IO.readlines(file)\r\n\tif lines != nil\r\n\t\tfor i in 0 .. lines.length-1\r\n\t\t\tlines[i] = lines[i].sub(\"\\n\",\"\")\r\n\t\tend\r\n\t\treturn lines[0..lines.length-1]\r\n\tend\r\n\treturn nil\r\nend",
"def find_previous_dotlines(file, expression)\n count = 0\n file.each_line do |line|\n count +=1\n if line.include?(expression)\n return count\n end\n end\n return nil\nend",
"def extract_comment(lines)\n lines.take_while { |line| !line.match?(FILE_MARKER) }\n .join\n end",
"def _gets_until(row, c)\n buf = []\n until m = row.match(c)\n buf.push(row)\n row = _gets_without_comment\n end\n [buf.push(m.pre_match).join(' '), m[1], m.post_match]\n end",
"def read_lines(file_path)\n raise(format(ERROR_FILE_NOT_EXIST, file_path)) unless File.exist?(file_path)\n\n File.readlines(file_path, chomp: true)\n end",
"def pattern_owners\n codeowner_path = search_codeowners_file\n patterns = []\n File.read(codeowner_path).split(\"\\n\").each_with_index { |line, i|\n path_owner = line.split(/\\s+@/, 2)\n if line.match(/^\\s*(?:#.*)?$/)\n patterns.push ['', ''] # Comment/empty line\n elsif path_owner.length != 2 || (path_owner[0].empty? && !path_owner[1].empty?)\n log \"Parse error line #{(i+1).to_s}: \\\"#{line}\\\"\"\n patterns.push ['', ''] # Invalid line\n else\n path_owner[1] = '@'+path_owner[1]\n patterns.push path_owner\n end\n }\n return patterns\n end",
"def eol_pattern()\n return /\\r\\n?|\\n/ # Applicable to *nix, Mac, Windows eol conventions\n end",
"def extract_modified_lines(file_path, options)\n lines = Set.new\n\n flags = '--cached' if options[:staged]\n refs = options[:refs]\n subcmd = options[:subcmd] || 'diff'\n\n `git #{subcmd} --no-color --no-ext-diff -U0 #{flags} #{refs} -- \"#{file_path}\"`.\n scan(DIFF_HUNK_REGEX) do |start_line, lines_added|\n lines_added = (lines_added || 1).to_i # When blank, one line was added\n cur_line = start_line.to_i\n\n lines_added.times do\n lines.add cur_line\n cur_line += 1\n end\n end\n\n lines\n end",
"def extract_modified_lines(file_path, options)\n lines = Set.new\n\n flags = '--cached' if options[:staged]\n refs = options[:refs]\n subcmd = options[:subcmd] || 'diff'\n\n `git #{subcmd} --no-ext-diff -U0 #{flags} #{refs} -- '#{file_path}'`.\n scan(DIFF_HUNK_REGEX) do |start_line, lines_added|\n lines_added = (lines_added || 1).to_i # When blank, one line was added\n cur_line = start_line.to_i\n\n lines_added.times do\n lines.add cur_line\n cur_line += 1\n end\n end\n\n lines\n end",
"def getLines(line_begin, line_end, indent, keepLastLF)\n line = line_begin\n\n return '' if line_begin >= line_end\n\n queue = Array.new(line_end - line_begin)\n\n i = 0\n while line < line_end\n lineIndent = 0\n lineStart = first = @bMarks[line]\n\n if line + 1 < line_end || keepLastLF\n # No need for bounds check because we have fake entry on tail.\n last = @eMarks[line] + 1\n else\n last = @eMarks[line]\n end\n\n while first < last && lineIndent < indent\n ch = charCodeAt(@src, first)\n\n if isSpace(ch)\n if ch === 0x09\n lineIndent += 4 - (lineIndent + @bsCount[line]) % 4\n else\n lineIndent += 1\n end\n elsif first - lineStart < @tShift[line]\n # patched tShift masked characters to look like spaces (blockquotes, list markers)\n lineIndent += 1\n else\n break\n end\n\n first += 1\n end\n\n if lineIndent > indent\n # partially expanding tabs in code blocks, e.g '\\t\\tfoobar'\n # with indent=2 becomes ' \\tfoobar'\n queue[i] = (' ' * (lineIndent - indent)) + @src.slice(first...last)\n else\n queue[i] = @src.slice(first...last)\n end\n line += 1\n i += 1\n end\n\n return queue.join('')\n end",
"def get_sep_string file_path\n sep_string = \"\\r\"\n IO.foreach(file_path, sep_string) do |line|\n if line.split(\"\\n\").length > line.split(\"\\r\").length\n sep_string = \"\\n\"\n break\n end\n end\n return sep_string\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 number_closed(file)\n numClosed = 0;\n line = file.gets\n if line == nil then return end\n # read additional lines\n while line = file.gets do\n # begins with \"path\", must be path specification\n if line[0...4] != \"path\" \n if (!(line.include? \"u\") && !(line.include? \"d\") &&\n !(line.include? \"l\") && !(line.include? \"r\"))\n numClosed += 1;\n end\n end\n end\n puts \"#{numClosed}\"\nend",
"def get_current_line(file, index)\n current_line = file[index.value]\n if !current_line.nil?\n current_line.chomp()\n end\n while (!current_line.nil?) && current_line.match(/\\A\\s*\\Z/)\n index.value += 1\n current_line = file[index.value]\n if !current_line.nil?\n current_line.chomp()\n end\n end\n return current_line\nend",
"def read_up_to(pattern)\n res = []\n while line = read\n if pattern.match(line)\n return LineReader.new(res) \n else\n res << line\n end\n end\n raise \"Missing end tag in template: #{pattern.source}\"\n end",
"def tail(path, n)\n file = File.open(path, \"r\")\n buffer_s = 512\n line_count = 0\n file.seek(0, IO::SEEK_END)\n\n offset = file.pos # we start at the end\n\n while line_count <= n && offset > 0\n to_read = if (offset - buffer_s) < 0\n offset\n else\n buffer_s\n end\n\n file.seek(offset-to_read)\n data = file.read(to_read)\n\n data.reverse.each_char do |c|\n if line_count > n\n offset += 1\n break\n end\n offset -= 1\n if c == \"\\n\"\n line_count += 1\n end\n end\n end\n\n file.seek(offset)\n data = file.read\nend",
"def read_file(fname=nil)\n return if fname.nil?\n # Array we use to store entries\n lines = Array.new\n ah_data = Array.new\n # Deal with DOS line endings by reading in file, then manually splitting on DOS line ending\n File.open(fname).each_line do |line|\n lines = line.split(/\\r\\n?/).map(&:chomp)\n end\n return lines\nend",
"def read_between_the_lines(file_name, start_line, end_line)\n content = File.read(File.expand_path(file_name))\n lines_array = content.each_line.to_a\n\n [lines_array[start_line..end_line].join, normalized_line_number(start_line, lines_array.size),\n normalized_line_number(end_line, lines_array.size)]\n end",
"def readlines(sep=$/) end",
"def readlines(sep=$/) end",
"def file2items(file, marking, eliding=/^\\s*$/)\n items = []\n File.open(file, \"r\") do |f|\n item = []\n f.each do |line|\n if marking.match(line)\n items << item unless item.empty?\n item = []\n #p line\n end\n item << line unless eliding.match(line)\n end\n items << item \n end\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 grepp(file, string)\t\n\tFile.open(file) do |f|\n\t\tline = 0\n\t\tf.each_line do |l|\n\t\t\tline+=1\n\t\t\tputs \"line #{line}: #{l}\" if l.include? string\n\t\tend\n\tend\nend",
"def line_maker\n @lines = File.readlines(path, chomp: true)\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 split_file file\r\n lines = []\r\n has_error = false\r\n File.foreach(file).with_index do |line, line_num|\r\n line_content = line.strip\r\n if line_content.start_with? \"//\" or $ext == \".md\"\r\n line_content.sub!('//', '')\r\n sl = SourceLine.new(file, line_num + 1, line_content)\r\n has_error = sl.parse\r\n lines.push sl\r\n end\r\n end\r\n lines\r\n SourceFile.new(file, lines, has_error)\r\nend",
"def parse_feed_file feed\n feed.each_line\n .reject { |line| blank?(line) || line[0] == '#' }\n .map { |line| parse_feed_line line}\nend",
"def match_with_eol_regex\n return match_regex if resource[:exact]\n return /^(?>#{match_regex})#{$/}/\n end",
"def git_modified_lines(file)\n git_range_info_line_regex = /^@@ .+\\+(?<line_number>\\d+),/ \n git_modified_line_regex = /^\\+(?!\\+|\\+)/\n git_removed_line_regex = /^[-]/\n git_not_removed_line_regex = /^[^-]/\n file_info = git.diff_for_file(file)\n line_number = 0\n lines = []\n file_info.patch.split(\"\\n\").each do |line|\n starting_line_number = 0\n case line\n when git_range_info_line_regex\n starting_line_number = Regexp.last_match[:line_number].to_i\n when git_modified_line_regex\n lines << line_number\n end\n line_number += 1 if line_number > 0\n line_number = starting_line_number if line_number == 0 && starting_line_number > 0\n end\n lines\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 search_file_delete_line(regex)\n search_match(regex, \" \", 'd', 1)\n end",
"def git_modified_lines(file)\n git_range_info_line_regex = /^@@ .+\\+(?<line_number>\\d+),/\n git_modified_line_regex = /^\\+(?!\\+|\\+)/\n file_info = git.diff_for_file(file)\n line_number = 0\n lines = []\n file_info.patch.split(\"\\n\").each do |line|\n starting_line_number = 0\n case line\n when git_range_info_line_regex\n starting_line_number = Regexp.last_match[:line_number].to_i\n when git_modified_line_regex\n lines << line_number\n end\n line_number += 1 if line_number.positive?\n line_number = starting_line_number if line_number.zero? && starting_line_number.positive?\n end\n lines\n end",
"def file_contents_without_cr(path)\n File.read(path).gsub(/\\r\\n/, \"\\n\")\n end",
"def simple_grep(filename, phrase)\n regexp = Regexp.new(phrase)\n File.open(filename, 'r') do |file|\n # file.each_line {|line| puts line if regexp =~line}\n file.each_line do |line|\n puts \"#{$.} - #{line}\" if regexp =~line \n end\n end\nend",
"def entry_lines(file)\n entries = []\n ::Zip::ZipFile.foreach(file) do |zentry|\n entries << zentry\n end\n entries\n end",
"def find_line_boundary(text, start_index, rightwards)\n index = start_index\n vector = -1\n vector = 1 if rightwards\n\n loop do\n character = text[index]\n\n if rightwards\n break if index >= text.length\n break if character == \"\\n\"\n else\n break if index <= 0\n break if text[index - 1] == \"\\n\"\n end\n\n index = index + vector\n end\n\n index\n end",
"def receive_valid_lines_from_file\n File.readlines(FILE_NAME).select { |line| line.downcase.include?('post') }\nend",
"def get_text(srt_file, num_chars)\n begin\n ccfile = File.open(srt_file, 'r:UTF-8', &:read)\n text_collection = false\n text_sample = \"\"\n ccfile.each_line do |line|\n if line =~ /^(\\d\\d:)\\d\\d:\\d\\d[,.]\\d\\d\\d.*-->.*(\\d\\d:)\\d\\d:\\d\\d[,.]\\d\\d\\d/\n text_collection = true\n elsif line.strip.empty?\n text_collection = false\n elsif text_collection && text_sample.length < (num_chars + 1)\n text_sample << line\n end\n break if text_sample.length > (num_chars + 1)\n end\n ensure\n ccfile.close rescue nil\n end\n return text_sample[0, num_chars]\n end",
"def read_file(file)\n\tlines = IO.readlines(file)\n\tif lines != nil\n\t\tfor i in 0 .. lines.length-1\n\t\t\tlines[i] = lines[i].sub(\"\\n\",\"\")\n\t\tend\n\t\treturn lines[0..lines.length-1]\n\tend\n\treturn nil\nend",
"def separator(fname)\n f = File.open(fname)\n enum = f.each_char\n c = enum.next\n loop do\n case c[/\\r|\\n/]\n when \"\\n\" then break\n when \"\\r\"\n c << \"\\n\" if enum.peek == \"\\n\"\n break\n end\n c = enum.next\n end\n c[0][/\\r|\\n/] ? c : \"\\n\"\n end",
"def scan_file(path)\n keys = []\n text = read_file(path)\n text.scan(@pattern) do |match|\n src_pos = Regexp.last_match.offset(0).first\n location = occurrence_from_position(path, text, src_pos, raw_key: strip_literal(match[0]))\n next if exclude_line?(location.line, path)\n\n key = match_to_key(match, path, location)\n next unless key\n\n key += ':' if key.end_with?('.')\n next unless valid_key?(key)\n\n keys << [key, location]\n end\n keys\n rescue Exception => e # rubocop:disable Lint/RescueException\n raise ::I18n::Tasks::CommandError.new(e, \"Error scanning #{path}: #{e.message}\")\n end",
"def sub_line_ending_backslashes(file_text)\n backslash_replacement = '# TAILOR REMOVED BACKSLASH'\n file_text.gsub!(/\\\\\\s*\\n?$/, backslash_replacement)\n\n file_text\n end",
"def extract_parts\n parts_regex = /\n (?: # non-capturing group\n \\A | # start of string OR\n \\r\\n # line break\n )\n (\n --#{Regexp.escape(boundary || \"\")} # boundary delimiter\n (?:--)? # with non-capturing optional closing\n )\n (?=\\s*$) # lookahead matching zero or more spaces followed by line-ending\n /x\n parts = raw_source.split(parts_regex).each_slice(2).to_a\n parts.each_with_index { |(part, _), index| parts.delete_at(index) if index > 0 && part.blank? }\n\n if parts.size > 1\n final_separator = parts[-2][1]\n parts << [\"\"] if final_separator != \"--#{boundary}--\"\n end\n parts.map(&:first)\n end",
"def egrep(pattern)\n Dir['**/*'].\n find_all { |fn| FileTest.file?(fn) }.\n reject { |fn| File.basename(fn) =~ /^\\./ }.\n reject { |fn| fn =~ /^hosting\\// }.\n each do |fn|\n line_count = 0\n open(fn) do |f|\n while line = f.gets\n line_count += 1\n if line =~ pattern\n puts \"#{fn}:#{line_count}:#{line.strip}\"\n end\n end\n end\n end\nend",
"def before_and_after begin_delimeter, end_delimeter\n\n Throw.if_nil_or_empty_strings [ self, begin_delimeter, end_delimeter ]\n\n before_after_lines = []\n in_middle_bit = false\n\n self.each do |candidate_line|\n\n is_middle_boundary = !in_middle_bit && candidate_line.downcase.include?(begin_delimeter.downcase)\n if is_middle_boundary\n in_middle_bit = true\n next\n end\n\n unless in_middle_bit\n before_after_lines.push candidate_line\n next\n end\n\n #--\n #-- Now we are definitely in the middle bit.\n #-- Let's check for the middle end delimeter\n #--\n if candidate_line.downcase.include? end_delimeter.downcase\n in_middle_bit = false\n end\n\n end\n\n return before_after_lines\n\n end",
"def extract_test_from_file(file)\n return nil if ! File.file?(file)\n tests = \"\"; inside = false\n fstr = File.read(file)\n fstr.split(/\\n/).each do |l|\n if l =~ /^=begin[ ]*test/i\n tests << \"\\n\"\n inside = true\n next\n elsif inside and l =~ /^=[ ]*end/\n inside = false\n next\n end\n if inside\n tests << l << \"\\n\"\n end\n end\n tests\n end",
"def is_continuing_line?(line)\n line.expunge =~ /^[^#]*\\\\\\s*(#.*)?$/\n #first use expunge to eliminate inline closures\n #that may contain comment char '#'\n end",
"def read_last_line(f)\n pos = 2\n f.seek(-pos, File::SEEK_END)\n c = f.getc\n result = ''\n while c.chr != \"\\n\"\n result.insert(0,c.chr)\n pos += 1\n f.seek(-pos, File::SEEK_END)\n c = f.getc\n end\n f.rewind\n return result\nend",
"def grep(search, filename)\n regexp = Regexp.new(search)\n File.foreach(filename).with_index { |line, line_number|\n puts \"#{line_number+1}: #{line}\" if regexp =~ line\n }\nend",
"def nextclean\n\t\t\twhile true\n\t\t\t\tc = self.nextchar()\n\t\t\t\tif (c == '/')\n\t\t\t\t\tcase self.nextchar()\n\t\t\t\t\twhen '/'\n\t\t\t\t\t\tc = self.nextchar()\n\t\t\t\t\t\twhile c != \"\\n\" && c != \"\\r\" && c != \"\\0\"\n\t\t\t\t\t\t\tc = self.nextchar()\n\t\t\t\t\t\tend\n\t\t\t\t\twhen '*'\n\t\t\t\t\t\twhile true\n\t\t\t\t\t\t\tc = self.nextchar()\n\t\t\t\t\t\t\traise \"unclosed comment\" if (c == \"\\0\")\n\t\t\t\t\t\t\tif (c == '*')\n\t\t\t\t\t\t\t\tbreak if (self.nextchar() == '/')\n\t\t\t\t\t\t\t\tself.back()\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tself.back()\n\t\t\t\t\t\treturn '/';\n\t\t\t\t\tend\n\t\t\t\telsif c == \"\\0\" || c[0] > \" \"[0]\n\t\t\t\t\treturn(c)\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def extract_modified_lines(file_path, options); end",
"def extract_modified_lines(file_path, options); end",
"def lines\n text.split(/(?<=[\\n\\f])/)\n end",
"def search(pattern)\n\t\tmatching_lines = lines.select { |line| line.match(pattern) }\n\t\tmatching_lines.size == 0 ? nil : matching_lines\n\tend",
"def search(pattern)\n\t\tmatching_lines = lines.select { |line| line.match(pattern) }\n\t\tmatching_lines.size == 0 ? nil : matching_lines\n\tend",
"def parse_log_file0(file)\n File.open(file) { |input|\n input.each_line.inject(Array.new) { |acc, text|\n entry = handling do\n handle MalformedLogEntryError do\n end\n parse_log_entry(text)\n end\n entry ? acc << entry : acc\n }\n }\nend"
] |
[
"0.6186355",
"0.6186355",
"0.5688657",
"0.5572266",
"0.5494056",
"0.54769635",
"0.5469907",
"0.54392624",
"0.5434705",
"0.53960973",
"0.53926474",
"0.53635836",
"0.5352465",
"0.53516716",
"0.5276789",
"0.52446127",
"0.5197745",
"0.51373065",
"0.51366985",
"0.5135233",
"0.512515",
"0.5076012",
"0.50601584",
"0.50257635",
"0.5018623",
"0.5010057",
"0.4994023",
"0.49597034",
"0.4938268",
"0.49268225",
"0.49231842",
"0.49216005",
"0.49150172",
"0.48892358",
"0.4879735",
"0.4865863",
"0.48581657",
"0.48564106",
"0.48446104",
"0.48437175",
"0.48236495",
"0.48228905",
"0.48197153",
"0.48153135",
"0.48082072",
"0.48041582",
"0.47978178",
"0.47950494",
"0.47942546",
"0.47931692",
"0.4792822",
"0.47759712",
"0.47750705",
"0.47735304",
"0.47611514",
"0.4756494",
"0.47560573",
"0.4756037",
"0.474879",
"0.47420338",
"0.47196424",
"0.47149488",
"0.47144663",
"0.47144523",
"0.47132003",
"0.46933773",
"0.46916592",
"0.46899372",
"0.46862623",
"0.4683361",
"0.46815705",
"0.46698853",
"0.46695688",
"0.4666835",
"0.4657082",
"0.46555817",
"0.465333",
"0.46477854",
"0.46474746",
"0.46468642",
"0.46430945",
"0.46424347",
"0.4642084",
"0.46367285",
"0.46344733",
"0.46313825",
"0.46236685",
"0.46228227",
"0.46223867",
"0.46193677",
"0.46165505",
"0.46142915",
"0.46082",
"0.46074674",
"0.45992303",
"0.45992303",
"0.4579887",
"0.4579883",
"0.4579883",
"0.45784846"
] |
0.6285695
|
0
|
group sequence in 80 characters lines long the 80th character is '\n' TODO: try to pass sequence by reference (think 'yeld' statement is involved)
|
def group_sequence (sequence, length)
temp_sequence = ""
index = 0; cont = 0
while sequence[index] != nil do
temp_sequence += sequence[index]
index += 1
if cont < length - 1
cont += 1
else
temp_sequence += "\n"
cont = 0
end
end
temp_sequence
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def string2seq seq\n numN = (seq.length-1) / 60\n for i in 1..numN\n index = i*61 - 1\n seq.insert(index,\"\\n\")\n end\n return seq \nend",
"def sequence_lined(char_per_line)\n counter = char_per_line\n sequence_lined = \"\"\n sequence.each_char { |ch|\n sequence_lined.concat(ch)\n counter = counter - 1\n if counter == 0\n sequence_lined.concat(\"<br/>\")\n counter = char_per_line\n end\n }\n\n sequence_lined\n end",
"def line_to_wrap; end",
"def lines_groups\n @lines_groups = []\n #current_split = ''\n split_count = 0\n\n #@lines_groups ||= text.collect.with_index do |line, i|\n text.each do |line|\n split_line = line.split( /\\s{2,}/ ).reject! {|e| e == '' }\n $stderr.puts \"SPLIT LINE: #{split_line}\"\n # If we're looking at at least one blank area, we need to start a new group.\n if split_line.nil? || split_count == 0\n split_count += 1\n @lines_groups << []\n # Guard against possibly first line being nil.\n @lines_groups.last << split_line unless split_line.nil?\n elsif !split_line.nil? && split_count > 0\n @lines_groups.last << split_line.flatten #.map {|e| e.squish }\n #unless split_line.nil?\n #{\n # index: i, \n # line: split_line, \n # line_size: split_line.length\n #}\n else\n end\n end\n @lines_groups.flatten\n end",
"def wrap(s)\n s.split(\"\\n\").map do |t|\n if t =~ /^[>|]/\n t + \"\\n\"\n else\n t.gsub(/(.{1,74})(\\s+|$)/,\"\\\\1\\n\")\n end\n end.join('')\n end",
"def range_by_lines(range); end",
"def reduce_new_line(_production, _range, _tokens, _children)\n # TODO: control portability\n Regex::Character.new('\\n')\n end",
"def wrap(txt, line_len = 76)\n res = []\n sp = 0\n ep = txt.length\n\n while sp < ep\n # scan back for a space\n p = sp + line_len - 1\n if p >= ep\n p = ep\n else\n while p > sp and txt[p] != ?\\s\n p -= 1\n end\n if p <= sp\n p = sp + line_len\n while p < ep and txt[p] != ?\\s\n p += 1\n end\n end\n end\n res << txt[sp...p] << \"\\n\"\n sp = p\n sp += 1 while sp < ep and txt[sp] == ?\\s\n end\n\n res.join.strip\n end",
"def wrap(txt, line_len = 76)\n res = \"\"\n sp = 0\n ep = txt.length\n while sp < ep\n # scan back for a space\n p = sp + line_len - 1\n if p >= ep\n p = ep\n else\n while p > sp and txt[p] != ?\\s\n p -= 1\n end\n if p <= sp\n p = sp + line_len\n while p < ep and txt[p] != ?\\s\n p += 1\n end\n end\n end\n res << txt[sp...p] << \"\\n\"\n sp = p\n sp += 1 while sp < ep and txt[sp] == ?\\s\n end\n res\n end",
"def wrap(txt, line_len = 76)\n res = \"\"\n sp = 0\n ep = txt.length\n while sp < ep\n # scan back for a space\n p = sp + line_len - 1\n if p >= ep\n p = ep\n else\n while p > sp and txt[p] != ?\\s\n p -= 1\n end\n if p <= sp\n p = sp + line_len\n while p < ep and txt[p] != ?\\s\n p += 1\n end\n end\n end\n res << txt[sp...p] << \"\\n\"\n sp = p\n sp += 1 while sp < ep and txt[sp] == ?\\s\n end\n res\n end",
"def wrap(txt, line_len = 76)\n res = \"\"\n sp = 0\n ep = txt.length\n while sp < ep\n # scan back for a space\n p = sp + line_len - 1\n if p >= ep\n p = ep\n else\n while p > sp and txt[p] != ?\\s\n p -= 1\n end\n if p <= sp\n p = sp + line_len\n while p < ep and txt[p] != ?\\s\n p += 1\n end\n end\n end\n res << txt[sp...p] << \"\\n\"\n sp = p\n sp += 1 while sp < ep and txt[sp] == ?\\s\n end\n res\n end",
"def teardown_to_oneline(line, length = 60)\n lines = []\n line.split(\" \").each {|line|\n if !lines.empty? && lines[-1].size + line.size + 1 <= length\n lines[-1].concat(\" \" + line)\n else\n lines << line\n end\n }\n return lines\n end",
"def wrap(text, line_width = 100)\n text.gsub(/(.{1,#{line_width}})/, \"\\\\1\\n\")\n end",
"def word_wrap(txt, line_length) # :nodoc:\n txt.split(\"\\n\").collect do |line|\n line.length > line_length ? line.gsub(/(.{1,#{line_length}})(\\s+|$)/, \"\\\\1\\n\").strip : line\n end * \"\\n\"\n end",
"def wrap(s, width=80)\n s.gsub(/(.{1,#{width}})(\\s+|\\Z)/, \"\\\\1\\n\")\nend",
"def alignContinuations(theLines)\n\n\tsplitAndAlign(theLines, /^(.*?)\\s+(\\\\)$/, \"\");\n\nend",
"def break_to_newline\n end",
"def sequence_separator; end",
"def wrap(s)\n r = \"\"\n i = 0\n n = s.length\n sofar = 0\n while i < n\n r << String(s[i])\n \n if /\\s/ =~ s[i]\n sofar = 0\n else\n sofar += 1\n end\n \n if sofar >= 100\n r << \"\\n\"\n sofar = 0\n end\n i+=1\n end\n return r\nend",
"def break_lines! hanging_indent=0\n @lines= ['']\n @sentences.each do |sentence|\n sentence.split(/ /).each do |term|\n # term is a single word that either contains hyphens or doesn't\n term.scan(/[^-]+-+|[^-]+|-+/) do |word|\n # word either contains no hyphens, ends in hyphens, or is only\n # hyphens\n width= @screenplay.text_width(@lines.last + word)\n # new line needed\n if width > self.width\n @lines.last.rstrip!\n indent_str= (' ' * hanging_indent)\n # if word is just hyphens, it shouldn't start a line. chop the\n # tail of the last line, move it to the front of the new line.\n if /^-+$/ =~ word\n tail= nil\n @lines.last.sub!(/\\s*[^\\s]+$/) do |match|\n tail= \"#{match} \"\n ''\n end\n @lines.pop if @lines.last.empty?\n @lines << indent_str + tail.lstrip\n else\n @lines << indent_str\n end\n end\n @lines.last << word\n end\n @lines.last << ' '\n end\n @lines.last << ' '\n end\n @lines.last.rstrip!\n if self.limit_to_one_line && @lines.size > 1\n raise \"pagination error: line too long: attempted to break #{self}\"\n end\n @lines\n end",
"def break_to_newline\n end",
"def join_lines\n\t\toutput = []\n\t\tn = 0\n\t\twhile n < @lines.length do\n\t\t\tcur_line = n \n\t\t\tlonger_line = String.new;\n\t\t\t\n\t\t\tif @lines[cur_line].text[-1] == '\\\\'\n\t\t\t\tlonger_line = @lines[cur_line].text.chop()\n\t\t\t\tcur_line += 1\n\t\t\t\tlonger_line += @lines[cur_line].text\n\t\t\t\tlonger_line.chop!() if longer_line[-1] == '\\\\'\n\t\t\tend\n\t\t\twhile @lines[cur_line].text[-1] == '\\\\'\n\t\t\t\tcur_line += 1\n\t\t\t\tlonger_line += @lines[cur_line].text[0..-2]\n\t\t\tend\n\t\t\t\n\t\t\t# if there were joined lines\n\t\t\tif n < cur_line\n\t\t\t\t@lines[n].text = longer_line\n\t\t\t\t\n\t\t\t\t# catch up\n\t\t\t\twhile n < cur_line\n\t\t\t\t\tn += 1\n\t\t\t\t\t@lines[n].text = nil\n\t\t\t\tend\n\t\t\tend\n\t\t\tn += 1\n\t\tend\n\tend",
"def wrap_text(s, width=78) # {{{\n return nil unless s\n\ts.gsub(/(.{1,#{width}})(\\s+|\\Z)/, \"\\\\1\\n\").split(\"\\n\")\nend",
"def str_groups_separated_by_blank_lines(original_filename)\n groups = []\n curr_group = []\n\n get_input_str_arr(original_filename).each do |str|\n if str == ''\n groups << curr_group\n curr_group = []\n next\n end\n\n curr_group << str\n end\n\n groups << curr_group\n groups\nend",
"def word_wrap(text, line_width: T.unsafe(nil), break_sequence: T.unsafe(nil)); end",
"def break_down(text,line_width=80,replacement=\"\\n\")\r\n if text =~ /\\s/\r\n return text.gsub(/\\n/, \"\\n\\n\").gsub(/(.{1,#{line_width}})(\\s+|$)/, \"\\\\1\\n\").strip \r\n end\r\n return text if text.size <= line_width \r\n return text.gsub(/\\n/, \"\\n\\n\").gsub(/(.{1,#{line_width}})/, \"\\\\1#{replacement}\").strip\r\n end",
"def word_wrap(txt, line_length)\n txt.split(\"\\n\").collect do |line|\n line.length > line_length ? line.gsub(/(.{1,#{line_length}})(\\s+|$)/, \"\\\\1\\n\").strip : line\n end * \"\\n\"\n end",
"def encode(width=nil)\n width = 75 unless width\n l = @line\n # Wrap to width, unless width is zero.\n if width > 0\n l = l.gsub(/.{#{width},#{width}}/) { |m| m + \"\\n \" }\n end\n # Make sure it's terminated with no more than a single NL.\n l.gsub(/\\s*\\z/, '') + \"\\n\"\n end",
"def word_wrap(text, line_width: 80, break_sequence: \"\\n\")\n # Match up to `line_width` characters, followed by one of\n # (1) non-newline whitespace plus an optional newline\n # (2) the end of the string, ignoring any trailing newlines\n # (3) a newline\n #\n # -OR-\n #\n # Match an empty line\n pattern = /(.{1,#{line_width}})(?:[^\\S\\n]+\\n?|\\n*\\Z|\\n)|\\n/\n\n text.gsub(pattern, \"\\\\1#{break_sequence}\").chomp!(break_sequence)\n end",
"def word_wrap(text, line_width = 80)\n text.split(\"\\n\").collect do |line|\n line.length > line_width ?\n line.gsub(/(.{1,#{line_width}})(\\s+|$)/, \"\\\\1\\n\").strip :\n line\n end * \"\\n\"\nend",
"def lines\n text.split(/(?<=[\\n\\f])/)\n end",
"def lines(start, num) \n\t\t@text[index_of_position(start)...index_of_position(start + num) - 1]\n\tend",
"def chunk_text(bytes)\n chunks = Array.new\n line = \"\"\n\n @text.split(\" \").each do |word|\n if line.length + word.length <= bytes\n line << \" #{word}\"\n else\n chunks << line\n line = word\n end\n end\n\n chunks << line\n return chunks\n end",
"def reformat_wrapped(s, width = Config::Gui::MSG_WIDTH - 1)\n \t lines = []\n \t line = \"\"\n \t s.split(/\\s+/).each do |word|\n \t if line.size + word.size >= width\n \t lines << line\n \t line = word\n \t elsif line.empty?\n \t line = word\n \t else\n \t line << \" \" << word\n \t end\n \t end\n \t lines << line if line\n \t return lines\n \tend",
"def word_wrap(width=60)\n lines = []\n line = \"\"\n self.split(/\\s+/).each do |word|\n if line.size + word.size >= width\n lines << line\n line = word\n elsif line.empty?\n line = word\n else\n line << \" \" << word\n end\n end\n lines << line if line\n return lines.join \"\\n\"\n end",
"def align_group(input_strings, type)\n\tp = LR_parser.new(type)\n\tmetas = []\n\tinput_strings.each { |str| metas.push(p.parse_meta(str)); }\n\tmetas.each {|m| m.separate_first!}\n\tmatcher = DPMatcher.new\n\tpairs_array = [];\n\tfor i in 0..metas.size-2 do \n\t\tpairs_array.push(matcher.generate_pairs(metas[i].value, metas[i+1].value));\n\tend\n\tr = Recreator.new(type)\n\tchains = r.generate_chains(pairs_array);\n\tlines = r.multiline_reconstruction(metas, chains)\n\treturn lines\nend",
"def wrap_text(txt, col = 80)\n txt.gsub(/(.{1,#{col}})( +|$\\n?)|(.{1,#{col}})/, \"\\\\1\\\\3\\n\") \nend",
"def wrap(width)\n width ||= 80\n output = []\n indent = ''\n\n text = gsub(/\\t/, ' ')\n\n text.lines do |line|\n line.chomp! \"\\n\"\n if line.length > width\n indent = if line.uncolor =~ /^(\\s*(?:[+\\-*]|\\d+\\.) )/\n ' ' * Regexp.last_match[1].length\n else\n ''\n end\n new_lines = line.split_line(width)\n\n while new_lines.length > 1 && new_lines[1].length + indent.length > width\n output.push new_lines[0]\n\n new_lines = new_lines[1].split_line(width, indent)\n end\n output += [new_lines[0], indent + new_lines[1]]\n else\n output.push line\n end\n end\n output.map!(&:rstrip)\n output.join(\"\\n\")\n end",
"def word_wrap(text, line_width=40)\n text.split(\"\\n\").collect do |line|\n line.length > line_width ? line.gsub(/(.{1,#{line_width}})(\\s+|$)/, \"\\\\1\\n\").strip : line\n end * \"\\n\"\n end",
"def wrap(line, cols=80, tabsize=2)\n line = line.gsub(/\\t/, \" \" * tabsize) unless tabsize == nil\n line.gsub(/(.{1,#{cols}})( +|$\\r?\\n?)|(.{1,#{cols}})/, \"\\\\1\\\\3\\n\").split(/\\s*?\\n/)\n end",
"def word_wrap(text, line_width = 80)\n text.split(\"\\n\").collect do |line|\n line.length > line_width ? line.gsub(/(.{1,#{line_width}})(\\s+|$)/, \"\\\\1\\n\").strip : line\n end * \"\\n\"\n end",
"def group_lines\n @lines.rewind\n\n in_list = false\n wanted_type = wanted_level = nil\n\n block = LineCollection.new\n group = nil\n\n while line = @lines.next\n if line.level == wanted_level and line.type == wanted_type\n group.add_text(line.text)\n else\n group = block.fragment_for(line)\n block.add(group)\n\n if line.type == :LIST\n wanted_type = :PARAGRAPH\n else\n wanted_type = line.type\n end\n\n wanted_level = line.type == :HEADING ? line.param : line.level\n end\n end\n\n block.normalize\n block\n end",
"def join_lines_into_one\n\t\t@complete_letter = Array.new\n\t\t@master = 0\n\t\tmaster_comp = @top_line.length\n\t\tuntil @master == master_comp\n\t\t\ttheory_case\n\t\tend\n\tend",
"def process_grouped_examples(lines, pattern, lineno = 1)\n chunks = lines.slice_before(pattern)\n chunks = chunks.map { |chunk| v = [chunk, lineno]; lineno += chunk.size; v }\n chunks.map do |chunk, chunk_lineno|\n trimmed_chunk = chunk.trim_blank\n [trimmed_chunk, chunk_lineno + chunk.index(trimmed_chunk.first)]\n end\n chunks.each { |chunk, chunk_lineno| process_example(chunk, chunk_lineno) }\n self\n end",
"def line_split (in_string)\n my_string_array = in_string.split(\"\\n\")\n\n my_string_array.each_index do |index|\n # determine digits in largest line num, digits in current line num, & necessary padding\n max_line_digits = my_string_array.count.to_s.length\n this_line_digits = (index+1).to_s.length\n padding = ' ' * (max_line_digits - this_line_digits)\n\n # output the line\n puts \"Line #{padding}#{index + 1}: #{my_string_array[index]}\"\n end\nend",
"def insert_new_line(str, length)\n str.split(/\\r\\n|\\n/).map do |line|\n line.strip!\n if line.display_width < 1\n line\n else\n display_length = pastel.strip(line).display_width\n split_length = (line.length * length / display_length).to_i\n line.scan(/.{1,#{split_length}}/).join(\"\\n\") rescue line\n end\n end.join(\"\\n\")\n end",
"def put_new_lines(no_of_newlines)\n no_of_newlines.times do\n puts \"\"\n end\nend",
"def lines\n lines = []\n words = message.split\n start_idx = 0\n\n while start_idx < words.size do\n counter = 1\n loop do\n break if start_idx + counter > words.size || words[start_idx, counter].join(' ').size > row_size \n counter += 1\n end\n lines << words[start_idx, counter - 1].join(' ')\n start_idx += counter - 1\n end\n\n lines\n end",
"def groups\n @groups ||= STDIN.read.split(\"\\n\\n\").map { |e| e.split.map { |f| f.chars } }\nend",
"def wrap(width, width2 = nil)\n lines = []\n line = \"\"\n line_len = 0\n fragments.each do |frag|\n frag_len = frag.gsub(/\\e\\[\\d+(;\\d+)*m/, \"\").size\n if line_len.zero?\n line = frag\n line_len = frag_len\n elsif width && line_len + 1 + frag_len > width\n lines << line\n line = frag\n line_len = frag_len\n width = width2 if width2\n else\n line_len += frag_len + 1\n line = \"#{line} #{frag}\"\n end\n end\n lines << line if line_len.positive?\n lines\n end",
"def wrap_width(width)\n gsub(/([^\\n\\r]{1,#{width}})/,\"\\\\1\\n\")\n end",
"def line\n\t\tl = @name\n\t\t(1..25).each do |i|\n\t\t\tl += \" &\"\n\t\t\tif i <= @number then\n\t\t\t\tl += \" \\\\!$\\\\times$\"\n\t\t\tend\n\t\tend\n\t\tl += \" \\\\\\\\\\n\"\n\t\treturn l\n\tend",
"def indent_each_line!(indent_sequence=\"\\t\")\n\t\treturn self.collect!{ |line|\t\"#{indent_sequence}#{line}\" }\n\tend",
"def parse_line_break; end",
"def break_outmost_groups\n while @maxwidth < @output_width + @buffer_width\n return unless group = @group_queue.deq\n until group.breakables.empty?\n data = @buffer.shift\n @output_width = data.output(@output, @output_width)\n @buffer_width -= data.width\n end\n while !@buffer.empty? && Text === @buffer.first\n text = @buffer.shift\n @output_width = text.output(@output, @output_width)\n @buffer_width -= text.width\n end\n end\n end",
"def reduce_multi_line(_production, _range, _tokens, _children)\n Regexp::MULTILINE\n end",
"def fasta_hash_to_rsphylip(seqs)\n outline = \"\"\n names = seqs.keys\n max_name_l = (names.max.size - 1)\n max_name_l > 10 ? name_block_l = max_name_l : name_block_l = 10\n seqs.each do |k,v|\n outline += k[1..-1] + \"\\s\" * (name_block_l - k.size + 2) + v.scan(/.{1,10}/).join(\"\\s\") + \"\\n\"\n end\n return outline\nend",
"def lines\n total = 0\n chunk { |measurement|\n total += measurement.length + DELIMITER.length * 2\n total / max\n }.map { |_, line|\n [source, line].join(DELIMITER)\n }\n end",
"def wrapped\n @lines.join(\"\\n\")\n end",
"def fancy_newline\n @results += '|'\n newline\n end",
"def mapf_format_by_line(text, max_width = contents_width)\n oline, nline, tw = \"\", \"\", 0\n loop do\n # Format each word until reach the width limit\n oline, nline, tw, done = mapf_format_by_word(text, nline, tw, max_width)\n return oline, nline, tw if done\n end\n end",
"def mapf_format_by_line(text, max_width = contents_width)\n oline, nline, tw = \"\", \"\", 0\n loop do\n # Format each word until reach the width limit\n oline, nline, tw, done = mapf_format_by_word(text, nline, tw, max_width)\n return oline, nline, tw if done\n end\n end",
"def to_rsphylip\n seqs = self.dna_hash\n outline = \"\\s\" + seqs.size.to_s + \"\\s\" + seqs.values[0].size.to_s + \"\\n\"\n names = seqs.keys\n names.collect!{|n| n.tr(\">\", \"\")}\n max_name_l = names.max.size\n max_name_l > 10 ? name_block_l = max_name_l : name_block_l = 10\n seqs.each do |k,v|\n outline += k + \"\\s\" * (name_block_l - k.size + 2) + v.scan(/.{1,10}/).join(\"\\s\") + \"\\n\"\n end\n return outline\n end",
"def array_of_row_arrays(text)\n c = 0\n arr = []\n arr_of_arrys = []\n # add \"\\n\" to last row of string to make symmetric with previous rows\n # creating an array every 51 chars, and push such array into container array\n text.split('').push('\\n').each_with_index do |value, i| \n c += 1\n arr << value\n if c == 51\n c = 0\n arr_of_arrys << arr\n arr = []\n end\n end\n return arr_of_arrys\nend",
"def here_with_pipe(linefeeds = false)\n lines = self.split(\"\\n\")\n lines.map! {|c| c.sub!(/\\s*\\|/, '')}\n new_string = lines.join(linefeeds ? \"\\n\" : \" \")\n self.replace(new_string)\n end",
"def wrap(body)\n separator = \" \"\n words = body.split(separator)\n sentences = []\n sentence = []\n words.each do |word|\n sentence.push(word)\n if (sentence).join(separator).length > 75\n sentence.pop\n sentences.push(sentence.join(separator))\n sentence = [word]\n end\n end\n if sentence.length > 0\n sentences.push(sentence.join(separator))\n end\n sentences.join(\"\\n\")\nend",
"def text\n add_spaces(@text, @chars_per_group)\n end",
"def lines(source); end",
"def lines_of(range)\n min_words = range.first\n max_words = range.last\n words_left = 0\n line = []\n\n @sentences.inject([]) do |result, sentence|\n too_few_words = proc { line.size < min_words || words_left < min_words }\n too_many_words = proc { line.size >= max_words ||\n line.size + words_left > max_words && words_left <= min_words }\n end_line = proc { result << line.join(\" \") and line.clear }\n words = sentence.split\n word_count = words.size\n\n next result << sentence if word_count < min_words * 2\n\n line.clear\n words.each_with_index do |word, i|\n words_left = word_count - i\n if too_few_words[]\n line << word\n end_line.call if word =~ /[,;]$/ && !too_few_words[]\n elsif too_many_words[] || word =~ /^['\"]|^(and|that|or|for|nor|if)$/\n end_line.call\n line << word\n elsif word =~ /[,;]$/\n line << word\n end_line.call\n else\n line << word\n end\n end\n result << line.join(\" \")\n end\n end",
"def wrap_text(txt, col = 80)\n txt.gsub(/(.{1,#{col}})( +|$\\n?)|(.{1,#{col}})/,\n \"\\\\1\\\\3\\n\")\n end",
"def group_consistent_answers(group)\n group_member_count = group.lines.count\n unique_chars = group.chars.uniq.select{|char| /[a-z]/.match?(char)}\n unique_chars.select{|char| group.count(char) == group_member_count}.length\nend",
"def drop_from_each_line(n)\n self.lines.map do |line|\n k = 0\n line.chars.drop_while do |x|\n k += 1\n k <= n && x != \"\\n\"\n end.join(\"\")\n end.join(\"\")\n end",
"def split_into_flow\n res = []\n current_attr = 0\n\n str_len = @str.length\n\n # skip leading invisible text\n i = 0\n i += 1 while i < str_len and @str[i].chr == \"\\0\"\n start_pos = i\n\n # then scan the string, chunking it on attribute changes\n while i < str_len\n new_attr = @attrs[i]\n if new_attr != current_attr\n if i > start_pos\n res << copy_string(start_pos, i)\n start_pos = i\n end\n\n res << change_attribute(current_attr, new_attr)\n current_attr = new_attr\n\n if (current_attr & @attributes.regexp_handling) != 0 then\n i += 1 while\n i < str_len and (@attrs[i] & @attributes.regexp_handling) != 0\n\n res << RDoc::Markup::RegexpHandling.new(current_attr,\n copy_string(start_pos, i))\n start_pos = i\n next\n end\n end\n\n # move on, skipping any invisible characters\n begin\n i += 1\n end while i < str_len and @str[i].chr == \"\\0\"\n end\n\n # tidy up trailing text\n if start_pos < str_len\n res << copy_string(start_pos, str_len)\n end\n\n # and reset to all attributes off\n res << change_attribute(current_attr, 0) if current_attr != 0\n\n res\n end",
"def email_rewrap(text, width=EMAIL_WRAP_WIDTH)\n paragraphs = text.split(\"\\n\\n\")\n paragraphs.each { |para| para.gsub(\"\\n\", ' ') }\n paragraphs.map! { |para| email_wrap para, width }\n paragraphs.join(\"\\n\\n\")\n end",
"def multi_line_address(address, line_length)\n multi_line_address_block = []\n i = 0\n address.split(/[ ,]/).each do |s|\n if multi_line_address_block[i].blank?\n multi_line_address_block[i] = s\n elsif (multi_line_address_block[i].length + s.length < line_length)\n multi_line_address_block[i] += ' ' + s\n else\n i += 1\n multi_line_address_block[i] = s\n end\n end\n multi_line_address_block\n end",
"def make_line(text_array, len)\n start = rand(text_array.length)\n val = start\n line = \"\"\n while true\n val = val + 1\n line = \"#{line} #{text_array[val]}\"\n if line.to_phrase.syllables == len\n line.gsub!('\"','')\n return line\n end\n if line.to_phrase.syllables > len\n line = \"\"\n start = start + 1\n val = start\n end\n end\n end",
"def word_wrap(text, options = {})\n line_width = options.fetch(:line_width, 80)\n\n text.split(\"\\n\").collect! do |line|\n line.length > line_width ? line.gsub(/(.{1,#{line_width}})(\\s+|$)/, \"\\\\1\\n\").strip : line\n end * \"\\n\"\nend",
"def sequence_separator=(_arg0); end",
"def sequence_separator=(_arg0); end",
"def splitText text\n res = Array.new(text.count(\"\\n\") + 1) {LockString.new}\n i = 0\n text.each_char do |c|\n if c == \"\\n\"\n i += 1\n else\n res[i] << c\n end\n end\n puts res.inspect\n res\n end",
"def get_chunks(line)\n # split the line\n parts = line.strip.scan /\\w+|\\W/\n # build all combinations\n (1..(parts.size)).collect do |len|\n (0..(parts.size - len)).collect do |idx|\n parts[idx, len].join \"\"\n end\n end.flatten.reject do |el|\n el.length < @min_len || # to short\n # reject (nonalpha separated by) whitespace at beginning and end\n (el =~ /(^\\W?\\s)|(\\s\\W?$)/)\n end\n end",
"def write\n\n # reverse alignments\n @first_result.reverse!\n @second_result.reverse!\n\n # Create middle section for matches/mismatches\n index = 0\n @first_result.length.times do\n if @first_result[index] == @second_result[index]\n @central_alignment << \"|\"\n else\n @central_alignment << \" \"\n end\n index += 1\n end\n\n offset = @start_first > @start_second ? @start_first.to_s.length : @start_second.to_s.length\n border = \"\"\n\n (offset+1).times do # lines up center with alignments\n border << \"=\"\n end\n\n # formats beginning and end of sequence output\n @first_result.insert(0, @start_first.to_s << \"=\")\n @first_result << \"=\" << @max_cell_row.to_s\n @second_result.insert(0, \"\" << @start_second.to_s << \"=\")\n @second_result << \"=\" << @max_cell_column.to_s\n @central_alignment.insert(0, border)\n @central_alignment << border\n\n # separate sequences and center into at most chunks of at most 60\n first_chunks = @first_result.scan(/.{1,60}/)\n central_chunks = @central_alignment.scan(/.{1,60}/)\n second_chunks = @second_result.scan(/.{1,60}/)\n\n length = first_chunks.length\n\n File.open(\"result.txt\", 'w') {|file| \n i = 0\n length.times do\n file.puts first_chunks[i]\n file.puts central_chunks[i]\n file.puts second_chunks[i]\n file.puts\n i += 1\n end\n }\n\n end",
"def wrap(num_lines)\n cleaned = gsub(/\\s+/, ' ').strip\n\n chars_per_line = cleaned.size / num_lines.to_f\n\n lines = []\n cleaned.split.each do |word|\n if lines.empty?\n lines << word\n else\n if (lines[-1].size + 1 + word.size) <= chars_per_line ||\n lines.size >= num_lines\n lines[-1] << ' ' unless lines[-1].empty?\n lines[-1] << word\n else\n lines << word\n end\n end\n end\n\n Caption.new(lines.join(\"\\n\"))\n end",
"def test_it_turns_strings_into_chunks\n markdown = \"a\\nbbca\\nbc\\n\"\n actual = Chisel.new(\"\").string_to_chunks(markdown)\n expected = [\"a\", \"bbca\", \"bc\"]\n\n assert_equal expected, actual\n end",
"def fasta\n chars = 60\n lines = (length / chars.to_f).ceil\n defline = \">#{accession} #{title}\"\n seqlines = (1..lines).map {|i| to_s[chars * (i - 1), chars]}\n [defline].concat(seqlines).join(\"\\n\")\n end",
"def word_wrap(text, *args)\n options = args.extract_options!\n unless args.blank?\n options[:line_width] = args[0] || 80\n end\n options.reverse_merge!(:line_width => 80)\n\n text.split(\"\\n\").collect do |line|\n line.length > options[:line_width] ? line.gsub(/(.{1,#{options[:line_width]}})(\\s+|$)/, \"\\\\1\\n\").strip : line\n end * \"\\n\"\n end",
"def line_break(character)\n quickly do\n character * 150\n end\n puts \"\"\n end",
"def getLines(line_begin, line_end, indent, keepLastLF)\n line = line_begin\n\n return '' if line_begin >= line_end\n\n queue = Array.new(line_end - line_begin)\n\n i = 0\n while line < line_end\n lineIndent = 0\n lineStart = first = @bMarks[line]\n\n if line + 1 < line_end || keepLastLF\n # No need for bounds check because we have fake entry on tail.\n last = @eMarks[line] + 1\n else\n last = @eMarks[line]\n end\n\n while first < last && lineIndent < indent\n ch = charCodeAt(@src, first)\n\n if isSpace(ch)\n if ch === 0x09\n lineIndent += 4 - (lineIndent + @bsCount[line]) % 4\n else\n lineIndent += 1\n end\n elsif first - lineStart < @tShift[line]\n # patched tShift masked characters to look like spaces (blockquotes, list markers)\n lineIndent += 1\n else\n break\n end\n\n first += 1\n end\n\n if lineIndent > indent\n # partially expanding tabs in code blocks, e.g '\\t\\tfoobar'\n # with indent=2 becomes ' \\tfoobar'\n queue[i] = (' ' * (lineIndent - indent)) + @src.slice(first...last)\n else\n queue[i] = @src.slice(first...last)\n end\n line += 1\n i += 1\n end\n\n return queue.join('')\n end",
"def linewrap_text(orig_line, max_line_length)\n orig_line.gsub!(/\\A\\s*|\\s*\\z/m, '')\n line_array = []\n # Split the string at line-boundaries\n orig_line.split(\"\\n\").each { |s|\n start_offset = 0\n s_len = s.length\n\n ## Process the string in line-size segments \n while ((start_offset + max_line_length) < s_len) do\n line = truncate_on_word_boundary(s, 15, max_line_length, true, start_offset, false)\n line_array << line\n start_offset += line.length\n start_offset += 1 if (start_offset < s_len && s[start_offset..start_offset] =~ /\\s/)\n end\n\n ## Last segment of the string\n line_array << s[start_offset..s_len]\n }\n\n return line_array.join(\"\\n\")\n end",
"def draw_ascii(pattern, width)\n for i in 0...(pattern.size-width+1)\n puts pattern.slice(i, width).join\n end\nend",
"def format_lines(lines)\n prev = lines[0]\n slices = lines.slice_before do |e|\n (prev + 1 != e).tap { prev = e }\n end\n slices.map { |slice_first, *, slice_last| slice_last ? (slice_first..slice_last) : slice_first }\n end",
"def on_newline(p); end",
"def genbank\n chars = 60\n lines = (length / chars.to_f).ceil\n width = length.to_s.length\n\n s = ''\n (1..lines).each do |i|\n s << \"%#{width}d\" % (chars * (i - 1) + 1)\n s << ' '\n s << to_s[chars * (i - 1), chars].scan(/\\w{1,10}/).join(' ')\n s << \"\\n\"\n end\n s\n end",
"def generate_line\n string_array = \"ACGT\".chars.to_a\n Enumerator.new do |yielder|\n loop do\n yielder.yield string_array.sample\n end\n end\nend",
"def get_next_entry(lines)\n entry_lines = lines.take_while {|line| line.size > 0 }\n newlines = lines[entry_lines.size..-1]\n newlines.shift # the space\n [entry_lines.join(\" \"), newlines]\nend",
"def breaking_word_wrap(txt, col = 80)\n txt.gsub(/(.{1,#{col}})( +|$\\n?)|(.{1,#{col}})/,\n \"\\\\1\\\\3\\n\")\n end",
"def group(*) end",
"def normalize\n @height = @text_lines.size\n @width = 0\n @sltn_lines = [ ]\n @text_lines.each do |line|\n len = line.length\n @width = len if (len > @width)\n @sltn_lines << '+' * len\n end\n (0...@text_lines.size).each do |i|\n no_pad_chars = @width - @text_lines[i].length\n 1.upto(no_pad_chars) do\n @text_lines[i] << '+'\n @sltn_lines[i] << '+'\n end\n end\n end",
"def newline; end",
"def wrap_lines(name, folded_lines)\n result = []\n index = 0\n result[index] = \"#{name}: #{folded_lines.shift}\"\n result.concat(folded_lines)\n result.join(\"\\r\\n\\s\")\n end"
] |
[
"0.70442134",
"0.6604634",
"0.6344033",
"0.6255229",
"0.6180489",
"0.60526514",
"0.5995365",
"0.59914327",
"0.5963045",
"0.5961926",
"0.59178966",
"0.58994865",
"0.5895896",
"0.58919954",
"0.5863008",
"0.58487666",
"0.58373606",
"0.58156574",
"0.580436",
"0.57835954",
"0.5719166",
"0.57121474",
"0.5697215",
"0.56722885",
"0.5671445",
"0.5668183",
"0.56603396",
"0.56354004",
"0.5631158",
"0.56270677",
"0.5586762",
"0.5558241",
"0.5556258",
"0.55556685",
"0.5555472",
"0.5543774",
"0.5539509",
"0.5533895",
"0.5526677",
"0.55152303",
"0.55127347",
"0.5510725",
"0.55097556",
"0.54910696",
"0.5479494",
"0.5472761",
"0.54403883",
"0.5426259",
"0.54231507",
"0.54172945",
"0.53980064",
"0.53952575",
"0.53610015",
"0.5356912",
"0.53474176",
"0.53452456",
"0.53295076",
"0.5328188",
"0.5322917",
"0.5298189",
"0.52952534",
"0.52952534",
"0.5286306",
"0.52861494",
"0.5275327",
"0.52716994",
"0.5271038",
"0.5252106",
"0.5245673",
"0.52442276",
"0.52370846",
"0.52018225",
"0.51854813",
"0.51845396",
"0.5180867",
"0.5178358",
"0.51750135",
"0.5170595",
"0.5170595",
"0.51700056",
"0.516987",
"0.51692957",
"0.51675206",
"0.5164501",
"0.51615757",
"0.5160773",
"0.51602024",
"0.5155261",
"0.51419884",
"0.5130885",
"0.5128968",
"0.51278764",
"0.51272345",
"0.512623",
"0.5123541",
"0.51119494",
"0.51101327",
"0.5108854",
"0.51051074",
"0.5103036"
] |
0.75298303
|
0
|
Given a complete CDS sequence (trimmed and concatenated), calculates sequence codons distribution
|
def frequency_distribution (sequence, length_pattern)
assert(length_pattern > 0, "The pattern length must be grater than 0")
frequency = Hash.new
index = 0
while index < sequence.length do
codon = sequence[index .. index + length_pattern - 1]
frequency[codon] == nil ? frequency[codon] = 1 : frequency[codon] += 1
index += length_pattern
end
frequency
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def cds_seq\n cds_length = self.coding_region_cdna_end - self.coding_region_cdna_start + 1\n \n return self.seq[(self.coding_region_cdna_start - 1), cds_length]\n end",
"def gcThree #average gc 3 values for seqs\n freqs = Array.new\n self.codons.each{ | eachRow |\n gcCount = 0\n codonCount = 0\n eachRow.each{ |eachCodon |\n if ! (eachCodon.include?(\"N\") or eachCodon.include?(\"-\"))\n codonCount += 1\n if eachCodon[2,1] =~ /[GC]/\n gcCount += 1\n end\n end\n }\n\n if codonCount != 0\n freqs << gcCount.to_f / codonCount\n end\n }\n\n\n return freqs.sampleMean\n end",
"def gc\n s = codons.map { |c| c.nuc_codon[2] }.join\n ((s.count('G')+s.count('C')).to_f/codons.count).round(4)\n end",
"def genomic2cds(pos)\n return self.genomic2cdna(pos) - self.coding_region_cdna_start\n end",
"def each_CDS_seq\n each_CDS do | id, reclist, component |\n if component\n # p id,reclist,component\n sequence = @sequencelist[component.seqname]\n # p sequence\n if sequence\n seq = assemble(sequence,component.start,reclist,@options.merge(:codonize=>true))\n if seq.size % 3 != 0\n p reclist # leave this in\n # raise \"CDS size #{seq.size} is not a multiple of 3! <#{seq}>\"\n warn \"CDS size is not a multiple of 3\",id\n end\n yield description(id,component,reclist), seq\n else \n warn \"No sequence information for\",id\n end\n end\n end\n end",
"def syn_fraction(seq, pos, alts)\n cod_let = (pos-1)%3\n cod_pos = (pos-1) - cod_let\n cod = seq[cod_pos .. (cod_pos+2)]\n syn = 0\n cod_alts = alts.map do |alt|\n cod_alt = \"#{cod}\"\n cod_alt[cod_let] = alt\n cod_alt\n end\n syn = cod_alts.map{ |i| syn?(cod, i, pos<=3) ? 1 : 0 }.inject(0,:+)\n $codon_fh.puts [syn, cod, cod_alts.join(\",\")].join(\"\\t\") unless $codon_fh.nil?\n syn.to_f/alts.size\nend",
"def coding_region_cdna_start\n answer = 0\n \n self.exons.each do |exon|\n if exon == self.translation.start_exon\n answer += self.translation.seq_start\n return answer\n else\n answer += exon.length\n end\n end\n \n end",
"def sdrm_pr_bulk(sequences, cutoff = 0, temp_r_dir = File.dirname($0))\n region = \"PR\"\n rf_label = 0\n start_codon_number = 1\n n_seq = sequences.size\n mut = {}\n mut_com = []\n aa = {}\n point_mutation_list = []\n sequences.each do |name,seq|\n s = Sequence.new(name,seq)\n s.get_aa_array(rf_label)\n aa_seq = s.aa_array\n aa[name] = aa_seq.join(\"\")\n record = hiv_protease(aa_seq)\n mut_com << record\n record.each do |position,mutation|\n if mut[position]\n mut[position][1] << mutation[1]\n else\n mut[position] = [mutation[0],[]]\n mut[position][1] << mutation[1]\n end\n end\n end\n mut.each do |position,mutation|\n wt = mutation[0]\n mut_list = mutation[1]\n count_mut_list = count(mut_list)\n count_mut_list.each do |m,number|\n ci = r_binom_CI(number, n_seq, temp_r_dir)\n label = number < cutoff ? \"*\" : \"\"\n point_mutation_list << [region, n_seq, position, wt, m, number, (number/n_seq.to_f).round(5), ci[0], ci[1], label]\n end\n end\n point_mutation_list.sort_by! {|record| record[2]}\n\n link = count(mut_com)\n link2 = {}\n link.each do |k,v|\n pattern = []\n if k.size == 0\n pattern = ['WT']\n else\n k.each do |p,m|\n pattern << (m[0] + p.to_s + m[1])\n end\n end\n link2[pattern.join(\"+\")] = v\n end\n linkage_list = []\n link2.sort_by{|_key,value|value}.reverse.to_h.each do |k,v|\n ci = r_binom_CI(v, n_seq, temp_r_dir)\n label = v < cutoff ? \"*\" : \"\"\n linkage_list << [region, n_seq, k, v, (v/n_seq.to_f).round(5), ci[0], ci[1], label]\n end\n\n report_list = []\n\n div_aa = {}\n aa_start = start_codon_number\n\n aa_size = aa.values[0].size - 1\n\n (0..aa_size).to_a.each do |p|\n aas = []\n aa.values.each do |r1|\n aas << r1[p]\n end\n count_aas = count(aas)\n div_aa[aa_start] = count_aas.sort_by{|k,v|v}.reverse.to_h\n aa_start += 1\n end\n\n div_aa.each do |k,v|\n record = [region, k, n_seq]\n $amino_acid_list.each do |amino_acid|\n aa_count = v[amino_acid]\n record << (aa_count.to_f/n_seq*100).round(4)\n end\n report_list << record\n end\n\n return [point_mutation_list, linkage_list, report_list]\nend",
"def measure_DNA\n show do\n title \"Measure DNA Concentration\"\n check \"Elute DNA into 1.5 mL tubes by spinning at 17.0 xg for one minute, keep the columns.\"\n check \"Pipette the flow through (30 uL) onto the center of the column, spin again at 17.0 xg for one minute. Discard the columns this time.\"\n # check \"Go to B9 and nanodrop all of 1.5 mL tubes, enter DNA concentrations for all tubes in the following:\"\n table operations.start_table\n .output_item(OUTPUT)\n .get(:conc, type: 'number', heading: \"Concentration (ng/uL)\", default: 7)\n .get(:note, type: 'text', heading: \"Notes\")\n .end_table\n end\n end",
"def genomic2cdna(pos)\n #FIXME: Still have to check for when pos is outside of scope of cDNA.\n # Identify the exon we're looking at.\n exon_with_target = self.exon_for_genomic_position(pos)\n \n accumulated_position = 0\n ex = self.exons.sort_by {|e| e.seq_region_start}\n ex.reverse! if self.strand == -1\n ex.each do |exon|\n if exon.stable_id == exon_with_target.stable_id\n if self.strand == 1\n accumulated_position += ( pos - exon.start) +1\n else\n accumulated_position += ( exon.stop - pos ) +1\n end \n return accumulated_position\n else\n accumulated_position += exon.length \n end\n end\n return RuntimeError, \"Position outside of cDNA scope\"\n end",
"def codon_usage\n rewind\n\n total_usage = {}\n\n each do |e|\n Bio::Sequence::NA.new(e.seq).codon_usage.each do |c, count|\n aa = Bio::Sequence::NA.new(c).translate\n total_usage[aa] ||= {}\n total_usage[aa][c.upcase] ||= 0\n total_usage[aa][c.upcase] += count\n end\n end\n\n rewind\n\n total_usage\n end",
"def dnaSequence s\n hash, diff = Hash.new(0), Hash.new(0)\n diff[[0, 0, 0]] = 1\n\n sum = 0\n s.chars.each { |c|\n hash[c] += 1\n res = [hash['A'] - hash['C'], hash['C'] - hash['G'], hash['G'] - hash['T']]\n sum += diff[res]\n diff[res] += 1\n }\n sum\nend",
"def cladder_series(charge=1, mod=nil)\r\n get_series(:cladder, charge, mod) do\r\n delta = mass(mod) + mass('H2O') + charge * proton_mass\r\n nterm_series(delta, charge)\r\n end\r\n end",
"def isotopic_distribution(sequence)\n @atom_counts = Mspire::Isotope::AA::ATOM_COUNTS\n resp = sequence.each_char.map do |aa|\n @atom_counts[aa]\n end\n pep_counts = Hash.new {|h,k| h[k] = 0 }\n resp.each do |h|\n h.keys.each {|k| pep_counts[k] += h[k]}\n end\n pep_counts[:h] += 2\n pep_counts[:o] += 1\n require_relative 'isotoper/molecule'\n @m = Molecule.new(pep_counts, charge_state: @opts[:charge_state], name: sequence)\n @m.isotopic_distribution\n end",
"def compute\n @sequence.empty? and return []\n last_r = -Infinity\n min = @sequence.min\n max = @sequence.max\n step = (max - min) / bins.to_f\n Array.new(bins) do |i|\n l = min + i * step\n r = min + (i + 1) * step\n c = 0\n @sequence.each do |x|\n x > last_r and (x <= r || i == bins - 1) and c += 1\n end\n last_r = r\n [ l, c, r ]\n end\n end",
"def nucleotide_pi(seq = {})\n seq_length = seq.values[0].size - 1\n nt_position_hash = {}\n (0..seq_length).each do |n|\n nt_position_hash[n] = []\n seq.values.each do |s|\n nt_position_hash[n] << s[n]\n end\n end\n diver = 0\n com = 0\n nt_position_hash.each do |p,nt|\n nt.delete(\"-\")\n next if nt.size == 1\n nt_count = count(nt)\n combination = (nt.size)*(nt.size - 1)/2\n com += combination\n a = nt_count[\"A\"]\n c = nt_count[\"C\"]\n t = nt_count[\"T\"]\n g = nt_count[\"G\"]\n div = a*c + a*t + a*g + c*t + c*g + t*g\n diver += div\n end\n pi = (diver/com.to_f).round(5)\n return pi\nend",
"def get_codon_orfs1 splitter_func,do_include_leftmost_orf,do_strip_leading_codon\n orfs = split(@codons,splitter_func)\n return [] if orfs.size == 0\n # Drop the first sequence, if there is no match on the first position\n orfs.shift if !do_include_leftmost_orf and !splitter_func.call(orfs.first[0])\n orfs = orfs.map { |codons| \n codons = codons.shift if do_strip_leading_codon and splitter_func.call(codons[0])\n codons\n }\n if @reversed == nil\n TrackSequenceTrait.update_sequence_pos(orfs,@ntseq_pos) # nail against parent\n else\n TrackSequenceTrait.update_reversed_sequence_pos(orfs,@ntseq_pos) # nail against parent\n end\n end",
"def char_to_codon(char)\n (1..SIZE).map { |mult|\n offset = mult * CHAR_OFFSET\n encoded_char = (offset + char.to_i(BASE)) % BASE\n encoded_char.to_s(BASE)\n }.join\n end",
"def synthesize(protein)\n adn = ''\n for a in (0..protein.length-1)\n aminoacido = protein[a,1]\n entropy = rand(100-10) + 10\n \n \n if (@aminoacidos.include?(aminoacido))\n \n adn = adn + @codons[aminoacido][entropy % (@codons[aminoacido].length)]\n end\n \n end\n @synthesize = adn\n end",
"def codon_at( position )\n\n ref_seq.codon_at(position)\n\n rescue => e\n\n warn \"-\"*30\n warn self.inspect\n warn e.inspect\n warn \"-\"*30\n raise\n\n end",
"def getDna (cds, seq)\n loc = cds.locations\n sbeg = loc[0].from.to_i\n send = loc[0].to.to_i\n fasta = Bio::Sequence::NA.new(seq.subseq(sbeg,send))\n position = \"#{sbeg}..#{send}\"\n if loc[0].strand == -1\n fasta.reverse_complement!\n end\n dna = Bio::Sequence.auto(fasta)\n return dna\nend",
"def read_sequence (seq)\n g = 0\n a = 0\n t = 0\n c = 0\n # testen, ob uebergebenes Objekt einzelne Zeichen zurueckgeben kann\n if not seq.respond_to?(\"each_char\")\n return nil\n end\n # iteration ueber alle Symbole (in Großschreibweise) und Ermittlung\n # der absoluten Haeufigkeit der Basen\n seq.each_char do |base|\n base.upcase!\n if base == \"G\"\n g += 1\n elsif base == \"A\"\n a += 1\n elsif base == \"T\"\n t += 1\n elsif base == \"C\"\n c += 1\n else\n return nil\n end\n end\n return g,a,t,c\nend",
"def sdrm_in_bulk(sequences, cutoff = 0, temp_r_dir = File.dirname($0))\n region = \"IN\"\n rf_label = 2\n start_codon_number = 53\n n_seq = sequences.size\n mut = {}\n mut_com = []\n aa = {}\n point_mutation_list = []\n sequences.each do |name,seq|\n s = Sequence.new(name,seq)\n s.get_aa_array(rf_label)\n aa_seq = s.aa_array\n aa[name] = aa_seq.join(\"\")\n record = sdrm_int(aa_seq, start_codon_number)\n mut_com << record\n record.each do |position,mutation|\n if mut[position]\n mut[position][1] << mutation[1]\n else\n mut[position] = [mutation[0],[]]\n mut[position][1] << mutation[1]\n end\n end\n end\n mut.each do |position,mutation|\n wt = mutation[0]\n mut_list = mutation[1]\n count_mut_list = count(mut_list)\n count_mut_list.each do |m,number|\n ci = r_binom_CI(number, n_seq, temp_r_dir)\n label = number < cutoff ? \"*\" : \"\"\n point_mutation_list << [region, n_seq, position, wt, m, number, (number/n_seq.to_f).round(5), ci[0], ci[1], label]\n end\n end\n point_mutation_list.sort_by! {|record| record[2]}\n\n link = count(mut_com)\n link2 = {}\n link.each do |k,v|\n pattern = []\n if k.size == 0\n pattern = ['WT']\n else\n k.each do |p,m|\n pattern << (m[0] + p.to_s + m[1])\n end\n end\n link2[pattern.join(\"+\")] = v\n end\n linkage_list = []\n link2.sort_by{|_key,value|value}.reverse.to_h.each do |k,v|\n ci = r_binom_CI(v, n_seq, temp_r_dir)\n label = v < cutoff ? \"*\" : \"\"\n linkage_list << [region, n_seq, k, v, (v/n_seq.to_f).round(5), ci[0], ci[1], label]\n end\n\n report_list = []\n\n div_aa = {}\n aa_start = start_codon_number\n\n aa_size = aa.values[0].size - 1\n\n (0..aa_size).to_a.each do |p|\n aas = []\n aa.values.each do |r1|\n aas << r1[p]\n end\n count_aas = count(aas)\n div_aa[aa_start] = count_aas.sort_by{|k,v|v}.reverse.to_h\n aa_start += 1\n end\n\n div_aa.each do |k,v|\n record = [region, k, n_seq]\n $amino_acid_list.each do |amino_acid|\n aa_count = v[amino_acid]\n record << (aa_count.to_f/n_seq*100).round(4)\n end\n report_list << record\n end\n\n return [point_mutation_list, linkage_list, report_list]\nend",
"def cdna2genomic(pos)\n #FIXME: Still have to check for when pos is outside of scope of cDNA.\n # Identify the exon we're looking at.\n exon_with_target = self.exon_for_cdna_position(pos)\n \n accumulated_position = 0\n ex = self.exons.sort_by {|e| e.seq_region_start}\n ex.reverse! if self.strand == -1\n ex.each do |exon| \n if exon == exon_with_target\n length_to_be_taken_from_exon = pos - (accumulated_position + 1)\n if self.strand == -1\n return exon.seq_region_end - length_to_be_taken_from_exon\n else\n return exon.seq_region_start + length_to_be_taken_from_exon\n end\n else\n accumulated_position += exon.length \n end\n end\n end",
"def occ(seq, b)\n # löchen alles anstatt was in b drin ist\n return seq.gsub(/^#{b}/, \"\").length\n end",
"def getDna (cds, seq)\n loc = cds.locations\n sbeg = loc[0].from.to_i\n send = loc[0].to.to_i\n fasta = Bio::Sequence::NA.new(seq.subseq(sbeg,send))\n position = \"#{sbeg}..#{send}\"\n if loc[0].strand == -1\n fasta.reverse_complement!\n end\n dna = Bio::Sequence.auto(fasta)\n return dna\n end",
"def cds2genomic(pos)\n return self.cdna2genomic(pos + self.coding_region_cdna_start)\n end",
"def acidic_count(amino_acid_sequence)\n count = 0\n comp = amino_acid_sequence.composition\n ACIDIC_AMINO_ACIDS.each do |acidic|\n if comp[acidic]\n count += comp[acidic]\n end\n end\n return count\n end",
"def compute\n @sequence.empty? and return []\n last_r = -Infinity\n min = @sequence.min\n max = @sequence.max\n step = (max - min) / bins.to_f\n Array.new(bins) do |i|\n l = min + i * step\n r = min + (i + 1) * step\n c = 0\n @sequence.each do |x|\n x > last_r and (x <= r || i == bins - 1) and c += 1\n end\n last_r = r\n Bin.new(l, r, c)\n end\n end",
"def total_card_combs(star_counter)\n c = 0\n star_counter.each { |num_of_stars| c += prmutation(5) * cmbnation(num_of_stars) if num_of_stars > 4 }\n return c\nend",
"def sequence\n return self.dna.sequence\n end",
"def series(sequence, n)\n alpha = (1 + Math.sqrt(5)) / 2\n beta = 1 - alpha\n return ((alpha**n - beta**n) / Math.sqrt(5)).to_i if sequence == \"fibonacci\"\n return (alpha**(n - 1) + beta**(n - 1)).to_i if sequence == \"lucas\"\n return series(\"fibonacci\", n) + series(\"lucas\", n) if sequence == \"summed\"\nend",
"def getPep (cds, seq)\n\nend",
"def consec_ones(deltas)\n co_arr = []\n count = 0\n deltas.each do |delta|\n co_arr.push(count) if delta == 3\n count = delta == 3 ? 0 : count + 1\n end\n co_arr.reject(&:zero?)\nend",
"def consensus(seq_array, cutoff = 0.5)\n seq_length = seq_array[0].size\n seq_size = seq_array.size\n consensus_seq = \"\"\n (0..(seq_length - 1)).each do |position|\n all_base = []\n seq_array.each do |seq|\n all_base << seq[position]\n end\n base_count = count(all_base)\n max_base_list = []\n\n base_count.each do |k,v|\n if v/seq_size.to_f >= cutoff\n max_base_list << k\n end\n end\n consensus_seq += call_consensus_base(max_base_list)\n end\n return consensus_seq\nend",
"def calculate_sequence\n old_sequence.split('')[1..-1].each(&method(:fill_recurrence))\n\n apply_recurrence\n\n recurrences.flatten.join\n end",
"def getFtsSequences\n @gb.each_cds do |ft|\n ftH = ft.to_hash\n loc = ft.locations\n loc = \"c#{ft.locations[0].to_s}\" if ft.locations[0].strand == -1\n gene = []\n product = []\n gene = ftH[\"gene\"] if !ftH[\"gene\"].nil?\n product = ftH[\"product\"] if !ftH[\"product\"].nil?\n dna = getDna(ft,@gb.to_biosequence)\n seqout = dna.output_fasta(\"#{@accession}|#{loc}|#{ftH[\"protein_id\"][0]}|#{gene[0]}|#{product[0]}|#{@org}\",60)\n puts seqout\n end\nend",
"def cyclospectrum_linear(peptide)\n cyclospectrum = []\n for i in 0..peptide.length-1\n sub = 0\n for j in i..peptide.length-1\n sub += peptide[j]\n cyclospectrum << sub\n end\n end\n cyclospectrum\nend",
"def apply_copy_numbers(count_tag: :cn, distribute: :auto,\n copy_names_suffix: :lowcase, origin_tag: :or,\n conserve_components: true)\n segments.sort_by{|s|s.get!(count_tag)}.each do |s|\n multiply_extended(s.name, s.get(count_tag),\n distribute: distribute,\n copy_names: copy_names_suffix,\n conserve_components: conserve_components,\n origin_tag: origin_tag)\n end\n self\n end",
"def collapse(cutoff=1)\n seq_array = self.dna_hash.values\n new_seq_freq = {}\n seq_freq = seq_array.count_freq\n if seq_freq.size == 1\n new_seq_freq = seq_freq\n else\n uniq_seq = seq_freq.keys\n unique_seq_pair = uniq_seq.combination(2)\n dupli_seq = []\n unique_seq_pair.each do |pair|\n seq1 = pair[0]\n seq2 = pair[1]\n diff = seq1.compare_with(seq2)\n if diff <= cutoff\n freq1 = seq_freq[seq1]\n freq2 = seq_freq[seq2]\n freq1 >= freq2 ? dupli_seq << seq2 : dupli_seq << seq1\n end\n end\n\n seq_freq.each do |seq,freq|\n unless dupli_seq.include?(seq)\n new_seq_freq[seq] = freq\n end\n end\n end\n seqhash = ViralSeq::SeqHash.new\n n = 1\n new_seq_freq.each do |seq,freq|\n name = \">seq_\" + n.to_s + '_' + freq.to_s\n seqhash.dna_hash[name] = seq\n n += 1\n end\n return seqhash\n end",
"def cannabinoid; end",
"def base_composition\n if @base_composition\n return @base_composition\n end\n # else run the C method\n composition(@seq.seq)\n alphabet = ['a', 'c', 'g', 't', 'n']\n @base_composition = {}\n @dibase_composition = {}\n bases = []\n dibases = []\n alphabet.each do |c|\n bases << \"#{c}\".to_sym\n end\n alphabet.each do |c|\n alphabet.each do |d|\n dibases << \"#{c}#{d}\".to_sym\n end\n end\n bases.each_with_index do |a,i|\n @base_composition[a] = base_count(i)\n end\n dibases.each_with_index do |a,i|\n @dibase_composition[a] = dibase_count(i)\n end\n return @base_composition\n end",
"def cyclopeptide_sequencing(spectrum)\n # CYCLOPEPTIDESEQUENCING(Spectrum)\n # Peptides ← {empty peptide}\n # while Peptides is nonempty\n # Peptides ← Expand(Peptides)\n # for each peptide Peptide in Peptides\n # if Mass(Peptide) = ParentMass(Spectrum)\n # if Cyclospectrum(Peptide) = Spectrum\n # output Peptide\n # remove Peptide from Peptides\n # else if Peptide is not consistent with Spectrum\n # remove Peptide from Peptides\n\n # What about the branching step? Given the current collection of linear peptides Peptides, \n # define Expand(Peptides) as a new collection containing all possible extensions of peptides in \n # Peptides by a single amino acid mass\n peptides = []\n parent_mass = spectrum[-1]\n output_peptides = []\n loop do\n expanded_peptides = expand_peptides(peptides)\n # puts peptides\n delete_peptides = []\n expanded_peptides.each do |peptide|\n # puts peptide\n if peptide_mass(peptide) == parent_mass\n cyclic_spec_pep = cyclic_spectrum(peptide)\n # puts peptide\n # puts cyclic_spec_pep.join(\" \")\n if cyclic_spec_pep == spectrum \n # puts \"output: \" + peptide_to_mass(peptide)\n output_peptides << peptide_to_mass(peptide) \n end\n delete_peptides << peptide\n else\n unless peptide_consistency_with_spectrum?(peptide, spectrum)\n delete_peptides << peptide\n end\n end\n end\n delete_peptides.uniq.each {|p| expanded_peptides.delete(p) }\n\n break if expanded_peptides.empty?\n peptides = []\n expanded_peptides.each {|p| peptides << p}\n end\n\n output_peptides.uniq\n end",
"def count_and_say(sequence)\n\treturn 0 if sequence == nil\n\tsequence = sequence.to_s\n\tn = sequence.to_s.size\n result = ''\n\ti = 1\n\trepeat = sequence[0]\n\ttimes = 1\n\twhile (i<=n) do\n\t\tif sequence[i] == repeat\n\t\t\ttimes += 1\n else\n \tresult += times.to_s + repeat.to_s\n \ttimes = 1\n repeat \t= sequence[i].to_i\n end\n i+=1\n end \n\treturn result \nend",
"def collatz_sequence\n n = self\n results = []\n\n until n == 1\n results << n\n n = n.even? ? n / 2 : n * 3 + 1\n end\n\n results\n end",
"def countAtoms(seq)\n\t\t\t\to = 0\n\t\t\t\tn = 0\n\t\t\t\tc = 0\n\t\t\t\th = 0\n\t\t\t\ts = 0\n\t\t\t\tp = 0\n\t\t\t\tse = 0\n\t\t\t\tseq.each_char do |aa|\n\t\t\t\t\to = o + MS::Feature::AA::ATOM_COUNTS[aa][:o]\n\t\t\t\t\tn = n + MS::Feature::AA::ATOM_COUNTS[aa][:n]\n\t\t\t\t\tc = c + MS::Feature::AA::ATOM_COUNTS[aa][:c]\n\t\t\t\t\th = h + MS::Feature::AA::ATOM_COUNTS[aa][:h]\n\t\t\t\t\ts = s + MS::Feature::AA::ATOM_COUNTS[aa][:s]\n\t\t\t\t\tp = p + MS::Feature::AA::ATOM_COUNTS[aa][:p]\n\t\t\t\t\tse = se + MS::Feature::AA::ATOM_COUNTS[aa][:se]\n\t\t\t\tend\n\t\t\t\treturn o,n,c,h,s,p,se\n\t\t\tend",
"def translate(codon)\n x = Bio::Sequence::NA.new(codon)\n a = x.translate # or a = x.translate.codes \n return a\nend",
"def sequence\n if !sequence?\n raise NotImplementedException, \"Attempted to get the sequence of a velvet node that is too short, such that the sequence info is not fully present in the node object\"\n end\n kmer_length = @parent_graph.hash_length\n\n # Sequence is the reverse complement of the ends_of_kmers_of_twin_node,\n # Then the ends_of_kmers_of_node after removing the first kmer_length - 1\n # nucleotides\n length_to_get_from_fwd = corresponding_contig_length - @ends_of_kmers_of_twin_node.length\n fwd_length = @ends_of_kmers_of_node.length\n raise \"Programming error\" if length_to_get_from_fwd > fwd_length\n revcom(@ends_of_kmers_of_twin_node)+\n @ends_of_kmers_of_node[-length_to_get_from_fwd...fwd_length]\n end",
"def basic_count(amino_acid_sequence)\n count = 0\n comp = amino_acid_sequence.composition\n BASIC_AMINO_ACIDS.each do |basic|\n if comp[basic]\n count += comp[basic]\n end\n end\n return count\n end",
"def digester(string, missed_cleavages) # Returns an array of chomped sequences\n\tstring.upcase!\n\tarr = (0..(string.upcase.length-1)).map {|i| string[i]}\n\tmisses = 0; splits = []\n\t(0..missed_cleavages).each do |miss_cleav|\n\t\t(0..missed_cleavages).each do |init_num|\n\t\t\tlast, curr, next_item = nil, nil, nil; keeper = \"\"\n\t\t\tmisses = init_num\n\t\t\tarr.each_index do |i|\n\t\t\t\tlast = arr[i-1]; curr = arr[i]; next_item = arr[i+1]\n\t\t#\tputs \"last, curr, next: #{last}, #{curr}, #{next_item}\"\n\t\t\t\tkeeper << curr if curr\n\t\t#\tputs \"keeper: #{keeper}\"\n\t\t\t\tif curr == 'R' or curr == 'K'\n\t\t\t\t\tunless next_item == \"P\"\n\t\t#\t\t\t\tputs \"misses:missed cleavages\t\t\t#{misses}:#{miss_cleav}\"\n\t\t\t\t\t\tif misses < miss_cleav\n\t\t\t\t\t\t\tmisses += 1\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tsplits << keeper\n\t\t\t\t\t\t\tkeeper = \"\";\tmisses = 0\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tsplits << keeper if next_item == nil\n\t\t#\t\tputs \"Splits looks like: #{splits}\"\n\t\t\tend\n\t\tend\t\t\t\n\tend\n\tsplits.uniq\nend",
"def possible_gcds(*ns)\n ns.product(ns).\n map { |(n, m)| n.gcd(m) unless n == m }.\n compact.\n select { |divisor| divisor > 1 }\n end",
"def count_code(str)\n count_coe = 0\n (str.size - 3).times do |i|\n slice = str[i..(i+1)] + str[(i+3)]\n if slice == \"coe\"\n count_coe += 1\n end\n end\n return count_coe\nend",
"def lucas_sequence(len)\nend",
"def cc\n preorder, postorder, visited, cc, ccs = [], [], [], [], []\n @count = 0\n id = {}\n adj_lists.each do |v|\n if !visited.include?(v.name)\n dfs_visit(v.name, adj_lists, id, visited, preorder, postorder)\n @count += 1\n puts \"***Back in cc method***\\n\"\n end\n end\n\n puts \"id = #{id}\\n\\n\"\n\n (0..id.values.last).each do |i|\n id.each do |vertex, component|\n cc << vertex if i == component\n end\n ccs << cc.sort if cc != []\n cc = []\n end\n print \"ccs: #{ccs}\\n\\n\"\n ccs\n end",
"def processCords(cords)\n cords.split(\",\").map do |c|\n c.to_f\n end\n end",
"def distinct_subseq_ii(s)\n alphabets = ('a'..'z').to_a\n dict = Array.new(27, 0)\n mod = 10 ** 9 + 7\n total = 1\n s.chars.each do |char|\n index = alphabets.index(char) + 1\n combo = total * 2 - dict[index]\n dict[index] = total # if 'c' ever appears again, it will clash with the current combos.\n total = combo < 0 ? 0 + mod : combo % mod\n end\n total - 1 # subtract empty string\nend",
"def BCC(address:)\n unless set?(SR_CARRY)\n @program_counter += signed_int(@ram[address])\n end\n end",
"def fetch_ancestral_sequence(start=0,stop=self.length)\n self.genomic_aligns.select{|c| c.find_organism == \"Ancestral sequences\"}.each do |contig|\n puts contig.find_organism\n #return contig.aligned_sequence[start..stop]\n end\n end",
"def calcuate_frequencies(sequences)\n freq_array = Array.new(4) {|i|Array.new(10){|i| 0}} #2-dimensional array, second dimension initialised to 0's\n sequences.each do |seq|\n for position in 0..3\n freq_array[position][seq[position].to_i] += 1 #increment frequency value by 1\n end\n end\n freq_array\nend",
"def get_aa_array(initial_position = 0)\n @aa_array = []\n require_sequence = @dna_sequence[initial_position..-1].tr('-','N')\n base_array = []\n require_sequence.each_char {|base| base_array << base}\n while (base_array.length>=3) do\n base_3= \"\"\n 3.times{base_3 += base_array.shift}\n @aa_array<< amino_acid_2(base_3)\n end\n end",
"def poss( syn )\n cod = SITE_SYNONYMITY[nuc_codon.join]\n return [] unless cod\n\n pos_codon\n .zip(cod.split(\"\"))\n .select{|p| p.last == (syn=='syn' ? 's' : 'n')}\n .map(&:first)\n end",
"def convolution_cyclopeptide_sequencing(spectrum, n, m, integer_mass)\n convolution = spectral_convolution(spectrum)\n extended_alphabet = restrict(convolution, m)\n #puts extended_alphabet.join(' ')\n leaderboard = Set.new\n leader_peptide = []\n leaderboard << leader_peptide\n leader_score = 0\n mass_parent = spectrum.last.to_i\n puts \"mass_parent #{mass_parent}\"\n # due to consistency constraints, we can only expand by integer masses that appear\n # in the spectrum and in the extended alphabet\n expandables = extended_alphabet & integer_mass\n #puts expandables.join(' ')\n while !leaderboard.empty?\n leaderboard = expand(leaderboard, expandables)\n leaderboard.each do |peptide|\n mass_peptide = mass(peptide)\n if mass_peptide == mass_parent\n # score the peptide cyclospectrum with experimental spectrum\n pep_score = cyclopeptide_scoring(peptide, spectrum)\n if pep_score > leader_score\n leader_peptide = peptide\n leader_score = pep_score\n puts \"new leader with score #{pep_score}: #{leader_peptide.join(' ')}\"\n end \n elsif mass_peptide > mass_parent\n leaderboard.delete(peptide)\n end\n end\n leaderboard = trim(leaderboard.to_set, spectrum, n)\n end\n leader_peptide\nend",
"def codon_to_char(codon)\n # the whole \"code\" is really redundant, so the original character\n # can be derived from the first character of the codon\n ((codon.chars.first.to_i(BASE) - CHAR_OFFSET) % BASE).to_s(BASE)\n end",
"def ccs_in_ddi_order\n output = []\n harvest = lambda do |parent|\n output.append parent\n if parent.class.method_defined? :children\n parent.children.each(&harvest)\n end\n end\n harvest.call self.top_sequence\n output\n end",
"def discover_input_sequence_type(sequence)\n # Index of the first newline char.\n start = sequence.index(/\\n/)\n # Remove the sequence FASTA header.\n seq = sequence.slice(start..-1).gsub!(/\\n/, '')\n\n if seq =~ /[EQILFPeqilfp]+/\n type = \"amino_acid\"\n else\n # Length of the sequence minus the FASTA header.\n len = seq.length.to_f\n\n na_percent = 15.0\n counts = []\n\n counts << (seq.count(\"Aa\").to_f / len) * 100\n counts << (seq.count(\"Tt\").to_f / len) * 100\n counts << (seq.count(\"Uu\").to_f / len) * 100\n\n counts << (seq.count(\"Gg\").to_f / len) * 100\n counts << (seq.count(\"Cc\").to_f / len) * 100\n\n counts << (seq.count(\"Nn\").to_f / len) * 100\n\n counts.reject! { |c| c < na_percent }\n if (!counts.empty?)\n type = \"nucleic_acid\"\n else\n type = \"amino_acid\"\n end\n end\n type\n end",
"def coding_region_cdna_end\n answer = 0\n \n self.exons.each do |exon|\n if exon == self.translation.end_exon\n answer += self.translation.seq_end\n return answer\n else\n answer += exon.length\n end\n end\n end",
"def c2q(cycle)\n \"C#{cycle}\"\n end",
"def summation_sequence(start, length)\n\tarry = []\n (1..length).each do |count|\n if count == 1\n arry << start\n else\n x = 0\n (1..arry[-1]).each do |i|\n x += i\n end\n arry << x\n \tend\n end\n return arry\nend",
"def seq\n if @seq.nil?\n @seq = ''\n self.exons.each do |exon|\n @seq += exon.seq\n end\n end\n return @seq\n end",
"def generateAndPrintConcordance(inputLines)\n # Generate Concordance\n words = Hash.new\n index = 0\n # read each line\n for i in 0...inputLines.size\n # read each sentence\n inputLines[i].to_s.split(/\\.|\\?|\\!/).each do |sentence|\n index +=1\n # read each word\n sentence.split(/\\W|\\s/).each do |word|\n # per output sample requirement only adds words\n if word != \"\"\n # per output sample requirement makes all words lower case\n word=word.downcase\n # add words to a hash table as key\n words[word]=words[word]||[0,[]]\n # add word number of occurrences\n words[word][0]+=1\n # add the sentence number where the word occurs\n words[word][1]<<index\n end\n end\n end\n end\n # per output sample requirement sorts hash table key alphabetically\n words = words.sort_by { |key| key }.to_h\n # Print Concordance\n words.each_pair {|key,v| puts \"#{key}: {#{v[0]}:#{v[1].to_s.delete('[]')}}\"}\nend",
"def protein_seq\n return Bio::Sequence::NA.new(self.cds_seq).translate.seq\n end",
"def prepare_sequence(sequence)\n nv = remove_non_amino_acids(sequence)\n split_sequence(nv)\n end",
"def circulating_copies\n copies.count(&:circulates?)\n end",
"def cindgen(n)\n NVector.seq(n, :complex64)\n end",
"def circular_sequences\n to_return = []\n connections.each do |conn|\n if conn.probe1.sequence_index == conn.probe2.sequence_index and\n conn.probe1.side != conn.probe2.side and\n @graph.edges[conn.probe1.to_settable].length == 1 and\n @graph.edges[conn.probe2.to_settable].length == 1\n\n to_return.push conn.probe1.sequence_index\n end\n end\n return to_return\n end",
"def pseudoIsomorphicSubstrings(s)\n\n size = 1 # this show the current size of the set i\n graph = { 0 => {} } # representation of the set sequences\n sizes = []\n\n string_size = s.size\n matrix = []\n\n s_chars = s.chars\n \n s.size.times do |pi| # Si' : Prefix i\n matrix << []\n\n i = 0\n while i <= pi do\n matrix[pi] << s_chars[i..pi].join.ljust(string_size)\n i += 1\n end\n\n matrix[pi] = matrix[pi].join(' | ')\n end\n\n puts matrix\n\n sizes\nend",
"def refseq_sequence\n \"NC_0000\" + chrom.sub(/X/, \"23\").sub(/Y/, \"24\")\n end",
"def chemicals\n begin \n return @sparql.query(\"#{PREFIX} \\n SELECT DISTINCT(?cas) \\n FROM <ccris> \\n WHERE { \\n [] ccris:hasCasRegistryNumber ?cas . \\n ?cas a bio2rdf:CasRN . \\n }\")\n rescue SPARQL::Client::MalformedQuery => e\n STDERR.puts \"Query error:\"\n STDERR.puts e.backtrace.join(\"\\n\")\n end\n end",
"def check_csfasta(fasta)\n # length is the total read lengh + 2\n # cat *.csfasta | perl -ne 'next if /^#/;$i++;if ($i%2==0) {print unless \n # length($_)==52} else {print unless /^>\\d+_\\d+\\_\\d+\\_(F|R)(3|5)(-P2)*\\n$/}'\n # | more\n length = get_bp_length(fasta) + 2\n i = 0\n output = \"\"\n File.open(fasta).each do |l|\n next if /^#/.match(l)\n i = i + 1\n if ( i % 2 == 0 ) && ( l.size != length ) &&\n !/^>\\\\d+_\\\\d+_\\\\d+_(F|R)(3|5)(-P2)*\\n$/.match(l)\n output = output + l\n end\n end\n output\n end",
"def lm_cooccurrence(datapath, opts = {})\n node = {}\n edge = {}\n counter = 0\n pmid = nil\n abstract = ''\n detector = BioTCM::Apps::GeneDetector.new\n\n f_abstracts = File.open(datapath, 'r:utf-8')\n f_abstracts.each do |line|\n if line =~ /^PMID- +(\\d+)/\n pmid = $1\n counter += 1\n BioTCM.logger.info('LMMA') { \"Analyzing article \\##{counter}#{\n opts[:total_number] ? \"/#{opts[:total_number]}\" : ''\n }...\" }\n elsif line =~ /^AB -/\n abstract = line.gsub(/^AB -\\s*/, '').chomp\n abstract += line.gsub(/^\\s+/, ' ') while (line = f_abstracts.gets.chomp) =~ /^\\s/\n\n # Split into sentences\n sentences = abstract.split(/[.?!][\\s]?/)\n\n # Identify genes\n gene_sets = sentences.collect { |sentence| detector.detect(sentence) }\n\n # Update nodes\n gene_sets.flatten.uniq.each do |gene|\n if node[gene]\n node[gene] << pmid\n else\n node[gene] = [pmid]\n end\n end\n\n # Update edges\n gene_sets.collect do |gene_set|\n gene_set.product(gene_set)\n end.inject([]) {|a, b| a + b}.collect do |gene_pair|\n gene_pair.sort\n end.uniq.each do |gene_pair|\n next if gene_pair[0] == gene_pair[1]\n key = gene_pair.join(\"\\t\")\n if edge[key]\n edge[key] << pmid\n else\n edge[key] = [pmid]\n end\n end\n end\n end\n\n # Build tables\n @lm_node = Table.new(\n primary_key: 'Symbol',\n col_keys: ['Occurrence count', 'PMID(s)']\n )\n node.keys.sort_by { |k| - node[k].size }.each do |k|\n @lm_node.row(k, [node[k].size, node[k].join(', ')])\n end\n @lm_edge = Table.new(\n primary_key: \"Source\\tTarget\",\n col_keys: ['Co-occurrence count', 'PMID(s)']\n )\n edge.keys.sort_by { |k| - edge[k].size }.each do |k|\n @lm_edge.row(k, [edge[k].size, edge[k].join(', ')])\n end\n\n # Export\n @lm_node.save(opts[:node_savepath]) if(opts[:node_savepath])\n @lm_edge.save(opts[:edge_savepath]) if(opts[:edge_savepath])\n end",
"def get_codon_orfs2 splitter_func, start_func\n orfs = get_codon_orfs1(splitter_func,true,true)\n orfs.find_all { | orf | start_func.call(orf[0]) }\n end",
"def test_genomic2cdna_fw # forward strand (variation rs67960011)\n t = Ensembl::Core::Transcript.find_by_stable_id(\"ENST00000039007\")\n assert_equal(573,t.genomic2cdna(38260562)) \n end",
"def rna_to_amino_acid(rna)\n # Protein Translation Problem: Translate an RNA string into an amino acid string.\n # Input: An RNA string Pattern and the array GeneticCode.\n # Output: The translation of Pattern into an amino acid string Peptide. \n\n r_to_c_h = rna_to_codon_hash\n # puts r_to_c_h\n i = 0\n codon_length = 3\n amino_acid = \"\"\n while (codon = rna.slice(i, codon_length)) do\n # puts codon\n # puts r_to_c_h[codon.to_sym]\n break if codon.empty?\n amino_acid += r_to_c_h[codon.to_sym].to_s\n i += codon_length\n end\n return amino_acid\n end",
"def number_counting_seq(n)\r\n\r\nend",
"def lucas_sequence(len)\n return [] if len <= 0\n return [2] if len == 1\n return [2, 1] if len == 2\n\n return lucas_sequence(len-1) << lucas_sequence(len-1)[-2..-1].sum\nend",
"def sequence(n, m, c)\r\n i, s = 0, []\r\n while(i < n)\r\n y=m*i + c\r\n\tyield y if block_given?\r\n\ts << y\r\n\ti+= 1\r\n end\r\n s\r\nend",
"def cid(cdr)\n if cdr.phone\n number_to_phone(cdr.phone.complete_phone_number, :area_code => true) \n else\n cdr.src\n end \n end",
"def start_codon?(codon)\n @start.include?(codon.downcase)\n end",
"def getSequence(seq, complement, locations)\n subseq = \"\"\n locations.each do |loc|\n if (loc.strand == 1)\n s1 = loc.from - 1\n s2 = loc.to - 1\n s = seq\n elsif (loc.strand == -1)\n s1 = seq.length - loc.from\n s2 = seq.length - loc.to\n s = complement\n else\n STDERR.printf(\"Error: I don't know how to handle #{locations}\\n\")\n exit(1)\n end\n s1, s2 = s2, s1 if s1 > s2\n subseq += s[s1..s2]\n if subseq.length == 0\n STDERR << \"Problem with \" << loc << \"\\n\"\n end\n end\n return subseq\nend",
"def getcs(n = 1)\n s = \"\"\n n.times do\n s += getc\n end\n return s\n end",
"def aibc(g)\n\t\t# recibe un vector de datos del alimento\n\t\t# devuelve los aibc del alimento, o glucosa, para cada individuo\n\t\tg.map{ |gi| gi.each_with_index.map{ |gindex, i| if0(gindex, gi[0], gi[i-1]) if i > 0 } }.map{ |gi| gi.reject{ |gij| gij.class == nil::NilClass } }.map{ |ri| ri.reduce(0, :+) }\n\tend",
"def split codons, is_splitter_func\n list = []\n node = []\n codons.each_with_index do | c, pos |\n # p [c,pos]\n if is_splitter_func.call(c)\n node.push c\n size = node.size\n # p node\n list.push FrameCodonSequence.new(node,pos+1-size) if size > @min_size_codons\n node = []\n end\n node.push c # always push boundary codon\n end\n list\n end",
"def collatz_sequence(number)\n sequence = [number]\n\n while number != 1\n number.even? ? number = (number / 2) : number = (3 * number) + 1\n sequence.push(number)\n end\n\n sequence\nend",
"def generate_fedex_ccs(count)\n [].tap do |numbers|\n while numbers.length < count\n candidate = generate_fedex\n numbers << candidate if LuhnChecksum.valid?(candidate)\n end\n end\n end",
"def residue_count\n counted = []\n # N-terminal\n n_term = @seq[0].chr\n if PK[:nterm].key? n_term.to_sym\n counted << {\n :num => 1,\n :residue => n_term.to_sym,\n :pK => PK[:nterm][n_term.to_sym],\n :positive => positive?(n_term)\n }\n elsif PK[:normal].key? n_term.to_sym\n counted << {\n :num => 1,\n :residue => n_term.to_sym,\n :pK => PK[:normal][n_term.to_sym],\n :positive => positive?(n_term)\n }\n end\n # Internal\n tmp_internal = {}\n @seq[1,(@seq.length-2)].each_byte do |x|\n aa = x.chr.to_sym\n if PK[:internal].key? aa\n if tmp_internal.key? aa\n tmp_internal[aa][:num] += 1\n else\n tmp_internal[aa] = {\n :num => 1,\n :residue => aa,\n :pK => PK[:internal][aa],\n :positive => positive?(aa.to_s)\n }\n end\n end\n end\n tmp_internal.each do |aa, val|\n counted << val\n end\n # C-terminal\n c_term = @seq[-1].chr\n if PK[:cterm].key? c_term.to_sym\n counted << {\n :num => 1,\n :residue => c_term.to_sym,\n :pK => PK[:cterm][c_term.to_sym],\n :positive => positive?(c_term)\n }\n end\n counted\n end",
"def sequence\r\n n = 1000000\r\n l = 1\r\n digit = 1\r\n n.times do |i|\r\n templ = collatz(i+1)\r\n if templ > l\r\n l = templ\r\n digit = i+1\r\n end\r\n end\r\n puts \"The longest sequence was #{l} from number #{digit}\"\r\nend",
"def summation_sequence(start, length)\n arr = [start]\n\n (0...length-1).each do |i|\n summation = 0\n (0..arr[i]).each{|part| summation += part}\n arr << summation\n end\n\n arr\nend",
"def lucas_sequence(num)\n return [] if num == 0\n array = []\n (1..num).each { |n| array << lucas_number(n) }\n\n array\nend",
"def comb(n, start = 0)\n\n for i in start...n\n @out += @in[i]\n puts @out\n comb(n, i+1)\n @out.chop!\n end \nend",
"def syn?\n\n return [nil, nil] unless codon = Segment.codon_at(chromosome, position)\n return [nil, nil] unless codon.valid?\n\n other_divs =\n Div.where(\"chromosome = ? and position in (?)\",\n chromosome,\n codon.pos_codon.select{ |p| p != position })\n return [nil, nil] unless other_divs.empty?\n\n [codon.pos_syn?(position), nil]\n\n end"
] |
[
"0.59478086",
"0.55945766",
"0.55867183",
"0.5581686",
"0.55613106",
"0.5481199",
"0.5469836",
"0.53891253",
"0.53622663",
"0.5349391",
"0.5330358",
"0.5327501",
"0.53221565",
"0.5314202",
"0.5310147",
"0.530708",
"0.52785164",
"0.5266239",
"0.5258946",
"0.5217964",
"0.51861525",
"0.5099365",
"0.5086039",
"0.5072595",
"0.5069876",
"0.5061182",
"0.5059687",
"0.50457627",
"0.50374407",
"0.50157166",
"0.5010288",
"0.497494",
"0.49298948",
"0.49146473",
"0.49059647",
"0.49031666",
"0.48977926",
"0.48254007",
"0.48237383",
"0.48158306",
"0.4802099",
"0.48003203",
"0.47928905",
"0.47824836",
"0.47821835",
"0.47781456",
"0.4775862",
"0.47748986",
"0.47673294",
"0.47624743",
"0.47426584",
"0.47352183",
"0.472777",
"0.4701769",
"0.46981382",
"0.4697902",
"0.46944007",
"0.46904653",
"0.4674827",
"0.4654898",
"0.4650706",
"0.46472967",
"0.46440217",
"0.46227768",
"0.46218637",
"0.4619251",
"0.46050355",
"0.45884922",
"0.45776945",
"0.45764422",
"0.45627946",
"0.45571348",
"0.45558196",
"0.4551261",
"0.45434678",
"0.45367026",
"0.45229232",
"0.4521721",
"0.45131218",
"0.45123702",
"0.45050788",
"0.45022202",
"0.44930333",
"0.44928637",
"0.44906202",
"0.4488033",
"0.44874066",
"0.44845676",
"0.44829977",
"0.44822654",
"0.4479362",
"0.44757426",
"0.44747517",
"0.44743326",
"0.4470668",
"0.44692385",
"0.44658303",
"0.44610667",
"0.44609854",
"0.44607446"
] |
0.55862707
|
3
|
Send the user an email saying the bulk observation import encountered an error.
|
def bulk_observation_error( user, filename, error_details )
@user = user
@message = error_details[:reason]
@errors = error_details[:errors]
@field_options = error_details[:field_options]
mail_with_defaults(
to: "#{user.name} <#{user.email}>",
subject: [
:were_sorry_but_your_bulk_import_of_filename_has_failed,
{ filename: filename }
]
)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def startup_import_failed(user)\n @user = user\n mail(:to => user.email, :subject => _('Startup import failed on %s.') % [\n Doers::Config.app_name])\n end",
"def bulk_observation_success( user, filename )\n @user = user\n @filename = filename\n mail_with_defaults(\n to: \"#{user.name} <#{user.email}>\",\n subject: [\n :bulk_import_of_filename_is_complete,\n { filename: filename }\n ]\n )\n end",
"def error_occured(error)\n @error = error\n\n mail to: \"jamesreading473@gmail.com\", subject: 'Error occured in depot app'\n end",
"def importing_update( email_list )\n @failed_registrations = FailedRegistration.all \n # email_list.each do | email | \n mail( :to => email_list, \n :subject => \"potoSchool | Tarumanegara Failed Registration #{Time.now}\" )\n # end\n end",
"def error_occured(error)\n @error = error\n mail :to => '846190988@qq.com', subject: 'Depot Exception Warning'\n end",
"def error_occured(error)\n @error = error\n mail to: \"869027168@qq.com\",\n subject: 'Depot App出现了错误' \n end",
"def failed_items_controller_api_request(error_code_and_message)\n begin\n emails = AdminUser.where(email_notifications:true).pluck(:email)\n mail(:to => emails, :subject => \"Problem occurred updating bib availability\")\n rescue => e\n LogWrapper.log('ERROR', {\n 'message' => \"Cannot send failed_items_controller_api_request notification email. Backtrace=#{e.backtrace}.\",\n 'method' => 'AdminMailer.failed_items_controller_api_request'\n })\n raise e\n end\n end",
"def notify_error_retry_ftp_upload_failed(order, error)\n @order = order\n @error = error\n to = [\"lienptb@elarion.com\"]\n\n mail :to => email_to(to), :subject => \"[Pocket Prints] Error when retry upload Order to FTP\"\n end",
"def notify_error(error)\n @error = error\n\n mail to: \"admin@example.org\", subject: \"Depot App Error\"\n end",
"def errored(error)\n @greeting = \"Hi\"\n @error = error\n\n mail to: \"dave@example.org\", :subject => 'App Errored'\n end",
"def exception_occured(exception)\n @exception = exception\n mail subject: \"Exception Occured During Running\"\n end",
"def send_error\n ImageMailer.send_error\n end",
"def failed_update(event)\n error \"Update failed: #{event.payload[:update]}\"\n\n Mailer.exception(\n event.payload[:exception],\n event.payload[:update],\n event.payload[:database_queries]\n ).deliver\n end",
"def send_error(email, message, queue)\n @errors = message\n mail(to: email, subject: 'Ostagram error')\n end",
"def export_finished_error_email(user)\n @user = user\n @url = read_url locale: user.locale\n I18n.with_locale user.locale do\n mail to: @user.email\n end\n end",
"def send_error_email exception\n begin\n data = {\n path: request.path,\n current_user: current_user.try(:email),\n referer: request.referer,\n params: params,\n exception: exception.inspect,\n user_agent: request.user_agent,\n http_accept: request.env['HTTP_ACCEPT'],\n ip: request.ip,\n backtrace: exception.backtrace\n }\n\n if Rails.env.production?\n DebugEmailWorker.perform_async({\n from: 'ivong@themarshallproject.org',\n to: 'ivong+exception@themarshallproject.org',\n subject: \"[#{ENV['RACK_ENV']}] EndRun Exception\",\n text_body: JSON.pretty_generate(data)\n })\n end\n rescue\n logger.error \"Error while reporting error! Not reported! #{$!.inspect}\" # this happens if the API call fails.\n end\n\n raise # reraise the initial error\n end",
"def error(order)\n @order = order\n\n mail to: 'mrigney@yozu.co.uk', subject: 'Pragmatic Store Order Error'\n end",
"def report_error\n mail to: 'mail@fishmarkt.ru', subject: '[Test] Error report'\n end",
"def send_failure_report\n return if @failed_orders.blank?\n failed_orders = ['Order, Tracking, ParcelId, Quantity, Date, Error_Message, Country'] + @failed_orders\n Spree::InnotracMailer.csv(failed_orders.join(\"\\n\"), 'innotrac', \"Sand & Sky : INNOTRAC Failed Shipments Report(#{Time.now.strftime('%d/%m/%Y')})\").deliver\n end",
"def error_email(miner, errors)\n @miner = miner\n @errors = errors\n mail subject: \"[#{ENV['INSTALLATION_TYPE']}][MINER #{miner.name}] Mining Errors\", to: 'alert@whiteboxteam.com'\n end",
"def failure(user, account_id, exception)\n @greeting = \"Error saving account or some sub items - #{account_id}. Exception: #{exception.inspect}\"\n\n mail to: user.email\n end",
"def notify_devs\n ApplicationMailer.notify(\n data: @failed_logs,\n body: {manager_id: @manager_id},\n subject: 'Exception in PostTestEconomySetupJob'\n ).deliver if @failed_logs.present?\n end",
"def notify_submitter_of_import_errors(commit)\n @commit = commit\n submitter_emails = [@commit.author_email, @commit.user.try!(:email)].compact.uniq\n if submitter_emails.present? && @commit.import_errors.present?\n mail to: submitter_emails, subject: t('mailer.commit.notify_submitter_of_import_errors.subject')\n end\n end",
"def failed_updates_present(event)\n error \"TariffSynchronizer found failed updates that need to be fixed before running: #{event.payload[:file_names]}\"\n\n Mailer.failures_reminder(event.payload[:file_names]).deliver\n end",
"def send_error(exception)\n @greeting = \"Hi\"\n @e = exception\n\n mail to: \"samuelralak@hotmail.com\"\n end",
"def email_failure_report(message=\"\")\n\t\t\t@email_addr.each do |email|\n\t\t\t\tsend_email(:to => email, :subject => (\"Servers Down!\" + message), :message => @report.fail_text)\n\t\t\tend\n\t\tend",
"def raised(error, controller_name, action_name)\n @error = error\n @controller_name = controller_name \n @action_name = action_name\n\n mail to: 'marcotello@grupovidanta.com', subject: 'Pragmatic Store Error Raised'\n end",
"def failed_bibs_controller_api_request(request_body, error_code_and_message, action_name, teacher_set)\n begin\n @teacher_set = teacher_set\n @action_name = action_name\n @request_body = request_body\n @error_code_and_message = error_code_and_message\n emails = AdminUser.where(email_notifications:true).pluck(:email)\n mail(:to => emails, :subject => \"Problem occurred updating bib from Sierra\")\n rescue => e\n LogWrapper.log('ERROR', {\n 'message' => \"Cannot send failed_bibs_controller_api_request notification email. Backtrace=#{e.backtrace}.\",\n 'method' => 'AdminMailer.failed_bibs_controller_api_request'\n })\n raise e\n end\n end",
"def send_email(exception)\n ApplicationMailer.notify(\n body: {message: exception.message, backtrace: exception.backtrace},\n subject: \"Exception in fetching Prediction Gas from Gas Station\"\n ).deliver\n end",
"def send_failure_report\n return if @failed_orders.blank?\n failed_orders = ['Order, Tracking, ParcelId, Quantity, Date, Error_Message, Country'] + @failed_orders\n Spree::AsendiaMailer.csv(failed_orders.join(\"\\n\"), 'asendia', \"Sand & Sky : ASENDIA Failed Shipments Report(#{Time.now.strftime('%d/%m/%Y')})\").deliver\n end",
"def error(error_text)\n @error = error_text\n\n mail to: \"cheeerny@rambler.ru\", subject: 'Error'\n end",
"def startup_imported(project)\n @project = project\n mail(:to => project.user.email, :subject => _('%s imported to %s.') % [\n project.title, Doers::Config.app_name])\n end",
"def teacher_set_update_missing_required_fields(bnumber, title, physical_description)\n begin\n @bnumber = bnumber\n @title = title\n @physical_description = physical_description\n emails = AdminUser.where(email_notifications:true).pluck(:email)\n mail(:to => emails, :subject => \"New teacher set bib in Sierra is missing required fields\")\n rescue => e\n LogWrapper.log('ERROR', {\n 'message' => \"Cannot send failed_bibs_controller_api_request notification email. Backtrace=#{e.backtrace}.\",\n 'method' => 'AdminMailer teacher_set_update_missing_required_fields'\n })\n raise e\n end\n end",
"def error\n NotificationMailer.error\n end",
"def handle_deliver_mail_error(e)\n raise(e)\n end",
"def notify_devs\n ApplicationMailer.notify(\n data: @failed_logs,\n body: {manager_id: @manager_id},\n subject: 'Exception in SendSecureDataAccessLinkJob'\n ).deliver if @failed_logs.present?\n end",
"def admin_notified(error_text_for_admin)\r\n @error_text_for_admin = error_text_for_admin\r\n mail to: 'admin@fancy_gifts_shop.net', subject: 'Error from the site www.depot.com !'\r\n end",
"def notify_error(order, error, params)\n @order = order\n @error = error\n @params = params\n to = [\"lienptb@elarion.com\", \"adrian@appiphany.com.au\"]\n\n mail :to => email_to(to), :subject => \"[Pocket Prints] Error when creating Order\"\n end",
"def error_email(user, emsg)\n @user = user\n\t@emsg = emsg\n\tmail(:to => \"shagdaddy@gmail.com\", :subject => \"Error message from RecruitMGR.com \")\n end",
"def smtp_fatal_error\n flash[:error] = \"You have entered invalid email address which doesn't exists.\"\n redirect_to dashboard_new_path\n end",
"def after_complete_batch\n # => create output file\n @output_file = \"tmp/#{@batch_id.split('_').first}.xlsx\"\n package = Axlsx::Package.new\n error_sheet = package.workbook.add_worksheet(name: 'error')\n error_sheet.add_row ['error'] + @header\n success_sheet = package.workbook.add_worksheet(name: 'success')\n success_sheet.add_row @header\n package.serialize (@output_file)\n\n # => process success and error queues\n REDIS_BATCHES.lrange(@batch_success, 0, -1).each { |record| success_sheet.add_row(JSON.parse(record)) }\n REDIS_BATCHES.lrange(@batch_error, 0, -1).each { |record| error_sheet.add_row(JSON.parse(record)) }\n\n # => send file to batch owner\n package.serialize (@output_file)\n subject = \"#{REDIS_BATCHES.llen(@batch_success)} success, #{REDIS_BATCHES.llen(@batch_error)} errors\"\n # => lookup @batch_owner_id and send email\n\n # => set expiration for batch keys\n [@batch_counter, @batch_size, @batch_owner_id, @batch_success, @batch_error, @batch_header].each do |key|\n REDIS_BATCHES.expire(key, 1.week)\n end\n rescue => e\n Rails.logger.error \"#{self.name}.#{__method__} - #{e}\"\n end",
"def flush_error_emails(args = {})\n @error_emails_pending_mutex.synchronize do\n send_time_older_than = Time.new.to_i - @error_emails_time\n \n @error_emails_pending.each do |backtrace_hash, error_email|\n if !args[:ignore_time] and send_time_older_than < error_email[:last_time].to_i and error_email[:messages].length < 1000\n next\n end\n \n @config[:error_report_emails].each do |email|\n next if !email or error_email[:messages].length <= 0\n \n if error_email[:messages].length == 1\n html = error_email[:messages].first\n else\n html = \"<b>First time:</b> #{Datet.in(error_email[:first_time]).out}<br />\"\n html << \"<b>Last time:</b> #{Datet.in(error_email[:last_time]).out}<br />\"\n html << \"<b>Number of errors:</b> #{error_email[:messages].length}<br />\"\n count = 0\n \n error_email[:messages].each do |error_msg|\n count += 1\n \n if count > 10\n html << \"<br /><br /><b><i>Limiting to showing 10 out of #{error_email[:messages].length} messages.</i></b>\"\n break\n end\n \n html << \"<br /><br />\"\n html << \"<b>Message #{count}</b><br />\"\n html << error_msg\n end\n end\n \n self.mail(\n :to => email,\n :subject => error_email[:subject],\n :html => html,\n :from => @config[:error_report_from]\n )\n end\n \n @error_emails_pending.delete(backtrace_hash)\n end\n end\n end",
"def send_error(subject, content=\"\")\n # The exception message\n if ($!.present?)\n content += \"Exception message: #{$!} <br>\"\n content += \"<br>\"\n subject += \" #{$!}\"\n end\n # The stack trace\n if ($@.present?)\n $@.each do |i|\n content += \"#{i}<br>\"\n end\n end\n from = ENV['ERROR_FROM']\n recipient = ENV['ERROR_RECIPIENT']\n if ENV['EMAIL_ASYNC']\n j = Job::Postmarker.create(to: recipient, content: content, subject: subject, from: from)\n j.queued?\n j.save!\n else\n token = ENV['POSTMARK_API_TOKEN_ERROR']\n puts \"===========> Error from,rec: #{from},#{recipient}\"\n return if (recipient.blank? || token.blank? || from.blank?)\n client = Postmark::ApiClient.new(token)\n client.deliver(from: from,\n to: recipient,\n subject: subject,\n html_body: content)\n end\n end",
"def jobfail(log,msg)\n Rails.logger.error(\"#{log} #{self.id}\")\n self.update_attributes(:status =>'error',:errormsg => msg)\n user = User.find_by_email(self.email)\n UserMailer.job_failed(user,self).deliver \n UserMailer.admin_job_failed(self).deliver\n end",
"def email_error_message(message, backtrace, attach_file_path = nil)\n send_email_admin(MailPart.new_subject('Error in job'),\n \"#{message} <br/> <br/> backtrace: #{backtrace}\",\n attach_file_path)\n end",
"def twitter_connection_fail()\n set_attachments\n\n case APP_CONFIG['app_country']\n when 'AR'\n mail(to: 'sebastian@socialtarget.net', subject: \"Notificaciones @ Social Target - Error obteniendo conexiones\")\n when 'CO'\n mail(to: 'sebastian@socialtarget.net', subject: \"Notificaciones @ Social Target - Error obteniendo conexiones\")\n when 'MX'\n mail(to: 'sebastian@socialtarget.net', subject: \"Notificaciones @ Social Target - Error obteniendo conexiones\")\n end\n\n\n end",
"def send_error(email, message, queue,file)\n #@errors = message\n attachments['error.txt'] = file\n mail(to: email, subject: 'Ostagram ERROR')\n end",
"def cart_error(error)\n \n mail to: \"nzakou.cedric@gmail.com\", subject: \"Cart error\"\n end",
"def m_errors(message)\n @message = message\n mail to: \"alexey.kondratenko@mail.ru\", subject: \"Error\"\n end",
"def notify_errors(error_message, result_base = nil)\n user_email = User.using_client_shard(client: @client).get_from_memcache(@user_id).email\n\n admin_emails_for_notification = GlobalConstant::Admin.get_all_admin_emails_for(\n @client_id,\n GlobalConstant::Admin.open_case_request_outcome_notification_type\n )\n\n admin_emails_for_notification << @admin_email\n admin_emails_for_notification.uniq!\n\n admin_emails_for_notification.each do |email_id|\n Email::HookCreator::SendTransactionalMail.new(\n client_id: Client::OST_KYC_CLIENT_IDENTIFIER,\n email: email_id,\n template_name: GlobalConstant::PepoCampaigns.open_case_request_outcome_template,\n template_vars: {success: 0, email: user_email, reason_failure: error_message, case_id: @user_kyc_detail_id}\n ).perform\n end\n\n # Send internal email in case of failure\n if result_base.present?\n ApplicationMailer.notify(\n to: GlobalConstant::Email.default_to,\n body: error_message + result_base.inspect,\n data: {case_id: @user_kyc_detail_id, edit_kyc_table_id: @edit_kyc_id},\n subject: \"Exception::Something went wrong while Unwhitelist Edit KYC request.\"\n ).deliver\n end\n end",
"def job_error_handler(err)\n\tUserMailer.job_notification_email(job_spec, @job_log_s3_full_path).deliver\n self.update(status: ERROR, status_message: error_message(err))\n @job_log.error error_message(err)\n raise err\n end",
"def handle_persist_mail_error(e)\n raise(e)\n end",
"def notify_devs(error_data, err_message)\n ApplicationMailer.notify(\n body: {err_message: err_message},\n data: {\n error_data: error_data\n },\n subject: 'Error while ProcessUnwhitelist'\n ).deliver\n end",
"def notify_dev(error_data)\n ApplicationMailer.notify(\n body: {current_block_number: @current_block_number},\n data: {error_data: error_data},\n subject: 'Error while ReadBlockEvents'\n ).deliver\n end",
"def not_found_error(params)\n @params = params\n\n mail to: \"lsimmonds@reachlocal.com\", subject: 'Object Access Error Occured'\n end",
"def deliver_failed\n OrdersMailer.deliver_failed(self)\n end",
"def error(delayed_job, exception)\n STDERR.putc 'E'\n STDERR.flush\n end",
"def mail_failed_todo(todo)\n\t\tusers = {}\n\t\tlog = []\n\t\ttodo.failed_jobs.each do |failed_job|\n\t\t\tmail = []\n\t\t\tmail << \"#{$config[:global][:base_url]}/dispatch_todos/#{failed_job.id}\"\n\t\t\tmail << failed_job.log\n\t\t\tmail = mail.join(\"\\n\") + \"\\n\\n\"\n\t\t\tlog << mail\n\t\t\tif job = failed_job.dispatch_job and owner_id = job.owner_mail_address\n\t\t\t\tif not users[owner_id]\n\t\t\t\t\tusers[owner_id] = mail\n\t\t\t\telse\n\t\t\t\t\tusers[owner_id] += mail\n\t\t\t\tend\n\t\t\telse\n\t\t\t\terror(\"can not send out e-mail. \")\n\t\t\tend\n\t\tend\n\t\tbegin\n\t\t\tusers.each do |mail, log|\n\t\t\t\tDispatchMailer.error_mail(mail, log).deliver\n\t\t\tend\n\t\trescue\n\t\t\tif rescue_mail_address = Rails.configuration.inki.dispatch_mail_address\n\t\t\t\tDispatchMailer.error_mail(rescue_mail_address, log.join(\"\\n\")).deliver\n\t\t\tend\n\t\tend\n\tend",
"def errorReceived(cart_id)\n @cart = cart_id\n admin=\"karina.simpson@gmail.com\"\n\n mail to: admin, subject: 'Pragmatic Store Error Bad Cart Id was sent'\n end",
"def emailErrorMessage(msg)\n obj = EmailHelper.new()\n emailFrom = \"sol-pipe@bcm.edu\"\n emailTo = obj.getErrorRecepientEmailList()\n emailSubject = \"Error while converting bcl to Fastq for flowcell \" + @fcName + \" for analysis\" \n emailText = \"The error is : \" + msg.to_s\n\n obj.sendEmail(emailFrom, emailTo, emailSubject, emailText)\n end",
"def failed order\n @order = order\n \n mail(to: order.email, \n from: \"#{Store.settings.name} <#{Store.settings.email}>\",\n subject: \"#{Store.settings.name} Order ##{@order.id} failed\"\n ) do |format|\n format.html { render \"themes/#{Store.settings.theme.name}/emails/orders/failed\", layout: \"../themes/#{Store.settings.theme.name}/layout/email\" }\n format.text { render \"themes/#{Store.settings.theme.name}/emails/orders/failed\", layout: \"../themes/#{Store.settings.theme.name}/layout/email\" }\n end\n end",
"def send_error_message_broker_btn(card_id, broker_firstname = \"XXX\")\n self.template_model = { broker_name: broker_firstname, card_id: card_id }\n mail from: \"fred@hellodingdong.com\", to: \"etienne@hellodingdong.com\", postmark_template_alias: \"error-broker-btn\"\n end",
"def email(cdn, e)\n data = JSON.load REDIS[cdn]\n link = \"http://logserver.flocasts.com/#{cdn.to_sym.object_id}\"\n\n tox = data['server_admins']\n from = 'flocast.bordercollie@gmail.com'\n subj = '[ERROR] ' + cdn\n text = [link, \"\\n\", e.message, e.class, e.backtrace].join \"\\n\"\n\n Gmail.new from, 'flocastayo' do |gmail|\n gmail.deliver do\n to tox\n subject subj\n text_part { body text }\n end\n end\nend",
"def handle_resend_errored(error, scope, applies_to)\n Airbrake.notify error, registration: registration.reg_identifier\n Rails.logger.error \"Error #{applies_to} for registration #{registration.reg_identifier}\"\n\n message = I18n.t(\"#{scope}.messages.error.heading\", email: registration.contact_email)\n description = I18n.t(\"#{scope}.messages.error.details\")\n\n flash_error(message, description)\n end",
"def we_miss_you(student)\n @attendance_records = Attendance.where(:student_id => student.id)\n @last_seen = @attendance_records.last.created_at.strftime(\"%A,%B %y\")\n @dojo = Dojo.find(1)\n @student = student\n mail(:to => student.email, :subject => \"#{@student.first_name}, We Miss You!\")\n end",
"def report_error(job)\n host, port = job['distributor'].split(':')\n port = port.to_i\n distributor = self.connections[[host, port]]\n data = {:error => { errback_id: job['on_error'], args: job['args']}}\n data = Marshal.dump(data)\n send_data_to_distributor(distributor, data)\n end",
"def missing_updates(event)\n warn \"Missing #{event.payload[:count]} updates in a row for #{event.payload[:update_type].to_s.upcase}\"\n\n Mailer.missing_updates(event.payload[:count], event.payload[:update_type].to_s).deliver\n end",
"def on_error error\n super(error)\n Wukong::Deploy.vayacondios_client.announce(vayacondios_topic, {\n success: false,\n step: 'prepare',\n error: error.class,\n message: error.message,\n counts: counts,\n files: files,\n })\n Wukong::Deploy.vayacondios_client.set(vayacondios_topic, \"prepare.last\", { state: 0, time: Time.now.utc.to_i })\n end",
"def error job, exception\n if tracetop = exception.backtrace&.first\n # Extract the file and line # from the stack top\n tracetop = \" at<br>\" + tracetop.match(/(.*:[\\d]*)/).to_s.if_present || tracetop\n tracetop.sub! Rails.root.to_s+'/', ''\n end\n errors.add :base, exception.to_s+tracetop\n self.status = :bad if processing? # ...thus allowing others to set the status\n end",
"def email_notification\n return unless app.emailable? && should_email?\n Mailer.err_notification(self).deliver_now\n rescue => e\n HoptoadNotifier.notify(e)\n end",
"def handle_candlepin_server_error ex\n log_exception(ex)\n errors _(\"An error has occurred in the Entitlement Server.\")\n redirect_back\n end",
"def products_imported\n CustomerMailer.products_imported\n end",
"def failure\n Ballots::NotificationsMailer.failure\n end",
"def invalid_order(invalid) \n @misplaced = invalid\n mail :to => \"honzik@localhost\", :subject => 'Invalid order requested'\n end",
"def perform\n current_time = Time.now\n packages = find_packages(city_db_id)\n emails = find_emails(city_db_id)\n\n ## Create list of recipients as array of strings\n recipients = []\n emails.each do |email|\n recipients << email.email_value\n end\n\n Emailer.packages_notification(current_time,packages,recipients).deliver\n end",
"def signupFail(message, phone, date, errors)\n @message = message\n @phone = phone\n @date = date\n @errors = errors\n\n mail(to: 'mvondoyannick@gmail.com', subject: 'Erreur creation compte PAYQUICK')\n end",
"def on_error error\n raise error\n end",
"def add_terminal_error(error, counter)\n if counter\n @terminal_error = I18n.t(\"bulk_import.error.stopped\", row: counter, msg: error)\n else\n @terminal_error = I18n.t(\"bulk_import.error.initialize\", msg: error)\n end\n end_row\n end",
"def propagate_errors_to_file\n errors = aggregate_errors\n current_course.errors.add(:invitations_file, errors.to_sentence) unless errors.empty?\n end",
"def propagate_errors_to_file\n errors = aggregate_errors\n current_course.errors.add(:invitations_file, errors.to_sentence) unless errors.empty?\n end",
"def propagate_errors_to_file\n errors = aggregate_errors\n current_course.errors.add(:invitations_file, errors.to_sentence) unless errors.empty?\n end",
"def set_import_error\n @import_error = current_user.import_errors.find(params[:id])\n end",
"def handle_error(e, args = {})\n @error_emails_pending_mutex.synchronize do\n if !Thread.current[:hayabusa] or !Thread.current[:hayabusa][:httpsession]\n self.log_puts(\"#{Knj::Errors.error_str(e)}\\n\")\n end\n \n browser = _httpsession.browser if _httpsession\n \n send_email = true\n send_email = false if !@config[:smtp_args]\n send_email = false if !@config[:error_report_emails]\n send_email = false if args.has_key?(:email) and !args[:email]\n send_email = false if @config.key?(:error_report_bots) and !@config[:error_report_bots] and browser and browser[\"browser\"] == \"bot\"\n \n if send_email\n backtrace_hash = Knj::ArrayExt.array_hash(e.backtrace)\n \n if !@error_emails_pending.has_key?(backtrace_hash)\n @error_emails_pending[backtrace_hash] = {\n :first_time => Time.new,\n :messages => [],\n :subject => sprintf(\"Error @ %s\", @config[:title]) + \" (#{Knj::Strings.shorten(e.message, 100)})\"\n }\n end\n \n html = \"An error occurred.<br /><br />\"\n html << \"<b>#{Knj::Web.html(e.class.name)}: #{Knj::Web.html(e.message)}</b><br /><br />\"\n \n e.backtrace.each do |line|\n html << \"#{Knj::Web.html(line)}<br />\"\n end\n \n html << \"<br /><b>Post:</b><br /><pre>#{Php4r.print_r(_post, true)}</pre>\" if _post\n html << \"<br /><b>Get:</b><br /><pre>#{Php4r.print_r(_get, true)}</pre>\" if _get\n html << \"<br /><b>Server:</b><br /><pre>#{Php4r.print_r(_server, true).html}</pre>\" if _server\n html << \"<br /><b>Cookie:</b><br /><pre>#{Php4r.print_r(_cookie, true).html}</pre>\" if _meta\n html << \"<br /><b>Session:</b><br /><pre>#{Php4r.print_r(_session, true).html}</pre>\" if _session\n html << \"<br /><b>Session hash:</b><br /><pre>#{Php4r.print_r(_session_hash, true).html}</pre>\" if _session_hash\n \n error_hash = @error_emails_pending[backtrace_hash]\n error_hash[:last_time] = Time.new\n error_hash[:messages] << html\n end\n end\n end",
"def error(str)\n @stdout_log.error(str) if @vars[:log_stdout]\n @log.error(str)\n send_mail(str) if @vars[:log_send_mail]\n end",
"def import\n Category.import(params[:file])\n flash[:success] = 'Emails were successfully imported'\n redirect_to digest_emails_admin_path \n end",
"def errored_during_import?\n import_errors.present?\n end",
"def send_error_email(subject: nil, message: nil)\n mail_opts = {\n to: AppConst::ERROR_MAIL_RECIPIENTS,\n subject: \"[Error #{AppConst::ERROR_MAIL_PREFIX}] #{subject}\",\n body: message\n }\n DevelopmentApp::SendMailJob.enqueue(mail_opts)\n end",
"def bulk_import!\n remote_filenames = [ENV.fetch('BULK_IEP_IMPORT_TARGET')]\n\n import_ieps!(remote_filenames)\n end",
"def on_error(err)\n raise err\n end",
"def startup_exists(project, user)\n @project = project\n @user = user\n mail(:to => user.email, :subject => _('%s already imported once on %s.') % [\n project.title, Doers::Config.app_name])\n end",
"def perform\n import = TransportPassengerImport.find self.id\n import.update_attributes(:status => 1)\n load_all_data\n @rollback = false\n @errors = Array.new\n ActiveRecord::Base.transaction do\n import_csv(import.attachment.to_file)\n raise ActiveRecord::Rollback if @rollback\n end\n if @errors.present?\n import.update_attributes(:status => 4, :last_message => @errors)\n else\n import.update_attributes(:status => 2, :last_message => nil)\n end\n rescue Exception => e\n import.update_attributes(:status => 3, :last_message => ['-', e.message])\n end",
"def import_efforts\n authorize @event\n file_url = FileStore.public_upload('imports', params[:file], current_user.id)\n if file_url\n if Rails.env.production?\n ImportEffortsJob.perform_later(file_url, @event, current_user.id, params.slice(:time_format, :with_times, :with_status))\n render json: {message: 'Import in progress.'}\n else\n ImportEffortsJob.perform_now(file_url, @event, current_user.id, params.slice(:time_format, :with_times, :with_status))\n render json: {message: 'Import complete.'}\n end\n else\n render json: {errors: ['Import file too large.']}, status: :bad_request\n end\n end",
"def notify_error(error)\n end",
"def failure\n UserMailer.failure\n end",
"def report_failure(e)\n # We can use the activity_execution_context method which is available to all\n # classes that extend AWS::Flow::Activities to get the workflow_execution.\n runid = activity_execution_context.workflow_execution.run_id\n puts \"Run Id:#{runid}\"\n puts \"Failure in periodic task:\" + e.backtrace.to_s\n end",
"def email_user\n Mailer.deliver_nesstar_catalogs_processed(datasets, user_id, base_host) if EMAIL_ENABLED && User.find(user_id).person.send_notifications?\n end",
"def unsuccessful_ballot(user, round)\n @user = user\n @round = round\n mail(to: user.email, reply_to: 'connect@nuscomputing.com', subject: '[Locker Ballot] Locker Ballot Unsuccessful') if user.email\n end",
"def emailResults()\n obj = EmailHelper.new()\n emailSubject = \"Illumina Capture Stats : Flowcell \" + @fcBarcode.to_s\n emailFrom = \"sol-pipe@bcm.edu\" \n emailText = @captureResults.formatForSTDOUT()\n emailTo = obj.getCaptureResultRecepientEmailList()\n\n begin\n obj.sendEmail(emailFrom, emailTo, emailSubject, emailText)\n rescue Exception => e\n puts e.message \n puts e.backtrace.inspect\n end\n end",
"def import\n task = Task.create!(name: 'Preparing to import MARCXML records',\n service: Service::LOCAL_STORAGE,\n status: Task::Status::SUBMITTED)\n RecordSource.new.import_async(task)\n rescue => e\n handle_error(e)\n else\n flash['success'] = 'Import will begin momentarily.'\n ensure\n redirect_back fallback_location: tasks_path\n end",
"def perform\n logger.info {\"*** Worker::FailedItem INFO: Begin at #{current_time} : Found #{Item.failed.count} Failed Records ***\"}\n success = 0\n failed = 0\n Item.unscoped.failed.each do |item|\n begin\n # call the Item Sync Service to sync the data\n ItemSyncService.new(item).process\n success += 1\n rescue Exception => e\n failed += 1\n logger.error {\"Worker::FailedItem ERROR: #{e.message}\"}\n end\n end\n logger.info {\"*** Total Success Synced Records: #{success} ***\"}\n logger.info {\"*** Total Failed Synced Records: #{failed} ***\"}\n logger.info {\"*** Worker::FailedItem INFO: End at #{current_time} ***\"}\n FailedItemWorker.perform_in(5.seconds)\n end"
] |
[
"0.7121073",
"0.7028098",
"0.688409",
"0.672163",
"0.66173947",
"0.64790744",
"0.64095193",
"0.6355795",
"0.63334626",
"0.6326061",
"0.62635976",
"0.62318677",
"0.6212769",
"0.6197572",
"0.61504775",
"0.6117635",
"0.61053604",
"0.6094399",
"0.6081655",
"0.6038021",
"0.6022153",
"0.6015319",
"0.59918904",
"0.59603757",
"0.59443957",
"0.59342396",
"0.5930266",
"0.5927899",
"0.58761394",
"0.5874984",
"0.58702797",
"0.5869132",
"0.5860583",
"0.58598137",
"0.58367735",
"0.58036464",
"0.5792894",
"0.5743164",
"0.5738683",
"0.5712007",
"0.56796616",
"0.56662387",
"0.5646174",
"0.56454015",
"0.56400454",
"0.5637009",
"0.5631623",
"0.5609484",
"0.5589016",
"0.5582747",
"0.5574011",
"0.5568933",
"0.55608076",
"0.5528793",
"0.54914707",
"0.54885346",
"0.5482025",
"0.5469531",
"0.54470915",
"0.5430093",
"0.5387205",
"0.53810304",
"0.5368188",
"0.5346404",
"0.5345377",
"0.5330386",
"0.53214455",
"0.53134346",
"0.5309521",
"0.52996355",
"0.52962583",
"0.52656883",
"0.5230829",
"0.52077204",
"0.520219",
"0.5191043",
"0.51884127",
"0.5175433",
"0.5170736",
"0.5170736",
"0.5170736",
"0.51672876",
"0.516645",
"0.5163632",
"0.51429904",
"0.511538",
"0.51147383",
"0.51116264",
"0.51051897",
"0.5103659",
"0.5102426",
"0.5096575",
"0.50948143",
"0.5094262",
"0.50836164",
"0.5076794",
"0.5073306",
"0.5068953",
"0.50554925",
"0.50522155"
] |
0.8026312
|
0
|
Send the user an email saying the bulk observation import was successful.
|
def bulk_observation_success( user, filename )
@user = user
@filename = filename
mail_with_defaults(
to: "#{user.name} <#{user.email}>",
subject: [
:bulk_import_of_filename_is_complete,
{ filename: filename }
]
)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def importing_update( email_list )\n @failed_registrations = FailedRegistration.all \n # email_list.each do | email | \n mail( :to => email_list, \n :subject => \"potoSchool | Tarumanegara Failed Registration #{Time.now}\" )\n # end\n end",
"def bulk_observation_error( user, filename, error_details )\n @user = user\n @message = error_details[:reason]\n @errors = error_details[:errors]\n @field_options = error_details[:field_options]\n mail_with_defaults(\n to: \"#{user.name} <#{user.email}>\",\n subject: [\n :were_sorry_but_your_bulk_import_of_filename_has_failed,\n { filename: filename }\n ]\n )\n end",
"def startup_imported(project)\n @project = project\n mail(:to => project.user.email, :subject => _('%s imported to %s.') % [\n project.title, Doers::Config.app_name])\n end",
"def startup_import_failed(user)\n @user = user\n mail(:to => user.email, :subject => _('Startup import failed on %s.') % [\n Doers::Config.app_name])\n end",
"def export_finished_success_email(user, filename, opml)\n @user = user\n @url = read_url locale: user.locale\n attachments[filename] = opml\n I18n.with_locale user.locale do\n mail to: @user.email\n end\n end",
"def after_complete_batch\n # => create output file\n @output_file = \"tmp/#{@batch_id.split('_').first}.xlsx\"\n package = Axlsx::Package.new\n error_sheet = package.workbook.add_worksheet(name: 'error')\n error_sheet.add_row ['error'] + @header\n success_sheet = package.workbook.add_worksheet(name: 'success')\n success_sheet.add_row @header\n package.serialize (@output_file)\n\n # => process success and error queues\n REDIS_BATCHES.lrange(@batch_success, 0, -1).each { |record| success_sheet.add_row(JSON.parse(record)) }\n REDIS_BATCHES.lrange(@batch_error, 0, -1).each { |record| error_sheet.add_row(JSON.parse(record)) }\n\n # => send file to batch owner\n package.serialize (@output_file)\n subject = \"#{REDIS_BATCHES.llen(@batch_success)} success, #{REDIS_BATCHES.llen(@batch_error)} errors\"\n # => lookup @batch_owner_id and send email\n\n # => set expiration for batch keys\n [@batch_counter, @batch_size, @batch_owner_id, @batch_success, @batch_error, @batch_header].each do |key|\n REDIS_BATCHES.expire(key, 1.week)\n end\n rescue => e\n Rails.logger.error \"#{self.name}.#{__method__} - #{e}\"\n end",
"def products_imported\n CustomerMailer.products_imported\n end",
"def send_success_report\n return if @success_orders.blank?\n success_orders = ['Order, SKU, Tracking, ParcelId, Quantity, Date, Country'] + @success_orders\n Spree::InnotracMailer.csv(success_orders.join(\"\\n\"), 'innotrac', \"Sand & Sky : INNOTRAC Shipments Report(#{Time.now.strftime('%d/%m/%Y')})\").deliver\n end",
"def success(user, account)\n @greeting = \"Successfully retrieved data for your account - #{account.inspect}\"\n\n mail to: user.email\n end",
"def perform\n current_time = Time.now\n packages = find_packages(city_db_id)\n emails = find_emails(city_db_id)\n\n ## Create list of recipients as array of strings\n recipients = []\n emails.each do |email|\n recipients << email.email_value\n end\n\n Emailer.packages_notification(current_time,packages,recipients).deliver\n end",
"def atm_checkout_completed_successfully!\n self.update_column(:payment_status, \"order_placed_ATM\")\n publish(:pub_atm_checkout_completed_successfully, self) # to listener\n LadyboomailerJob.new.async.perform(LadybooMailer, :atm_checkout_completed_successfully, self) if @@sendmail\n LadyboomailerJob.new.async.perform(LadybooMailer, :order_placed, self) if @@sendmail\n #LadybooMailer.atm_checkout_completed_successfully(self).deliver if @@sendmail\n #LadybooMailer.order_placed(self).deliver if @@sendmail\n end",
"def perform(email)\n CompletionMailer.notify_admin_completion(email).deliver_now\n end",
"def complete\n ImportJob.perform_later(import: @import, user: current_user)\n toast!(title: \"Files uploaded\",\n message: \"The files have been uploaded. The import will commence \"\\\n \"momentarily.\")\n render \"shared/reload\"\n end",
"def import\n Category.import(params[:file])\n flash[:success] = 'Emails were successfully imported'\n redirect_to digest_emails_admin_path \n end",
"def email_user\n Mailer.deliver_nesstar_catalogs_processed(datasets, user_id, base_host) if EMAIL_ENABLED && User.find(user_id).person.send_notifications?\n end",
"def send_email\n AlertNotifier.delay.email_back_office_announcement(self)\n end",
"def export_finished_error_email(user)\n @user = user\n @url = read_url locale: user.locale\n I18n.with_locale user.locale do\n mail to: @user.email\n end\n end",
"def email_on_complete\n count = options['email_me']\n return unless count && count > 0\n if Document.owned_by(document.account).pending.count == 0\n LifecycleMailer.documents_finished_processing(document.account, count).deliver_now\n end\n end",
"def handle_import\n set_csv\n if check_csv_ok?\n success, alert = Participant.import(@csv, params[:project_id])\n unless alert.empty?\n flash[:danger] = alert\n end\n unless success.empty?\n flash[:success] = \"Imported participants: <br/>\" + success\n end\n end\n end",
"def error_occured(error)\n @error = error\n\n mail to: \"jamesreading473@gmail.com\", subject: 'Error occured in depot app'\n end",
"def in_progress\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def email_action documents\n mail = RecordMailer.email_record(documents, { to: params[:to], message: params[:message], :callnumber => params[:callnumber], :status => params[:itemStatus] }, url_options, params)\n if mail.respond_to? :deliver_now\n mail.deliver_now\n else\n mail.deliver\n end\n end",
"def import_all\n EmailAccount.active.each do |email_account|\n log \"Importing #{email_account.username}\"\n email_account.loggers = self.loggers\n email_account.import_emails\n log \"Done importing #{email_account.username}\"\n end\n true\n end",
"def email_user\n Mailer.deliver_metadata_processed(dataset_id, user_id, @missing_variables, base_host) if EMAIL_ENABLED && User.find(user_id).person.send_notifications?\n end",
"def start(password)\n\n # This checks to make sure a user has uploaded data to be sent\n if data.blank?\n return { success: false, message: \"Please upload data to send emails!\" } \n end\n \n # This is an initalization of the lists of items that will be sent to the mailer\n emails = []\n subjects = []\n templates = []\n files = campaign.file_paths\n\n # Parse the CSV and aquire the headers\n rows = CSV.parse(data, headers: true)\n headers = rows.headers\n\n # Iterate through the rows in the CSV\n rows.each_with_index do |row, index|\n # Seed the subjects and templates with the default data\n subjects[index] = subject\n templates[index] = template.gsub(\"<p><br></p>\", \"\")\n\n # Iterate through each of the columsn in the row\n headers.each do |header|\n # Clean the header by parametrizing it and changing dashes to underscores\n cleanHeader = header.parameterize.underscore\n\n # Check if you are in the email column\n if cleanHeader == \"email\"\n # If you are in the email column, and the email is not a valid email, stop the sending process\n if !valid_email?(row[header])\n return { success: false, message: \"You seem to have invalid emails in your CSV. Please reupload and try again!\" } \n end\n\n # Add the current email to email list\n emails << row[header]\n end \n\n # Update the template at the proper index with the variables filled in\n subjects[index] = subjects[index].gsub(\"{{#{cleanHeader}}}\", row[header]) \n templates[index] = templates[index].gsub(\"{{#{cleanHeader}}}\", row[header]) \n end\n end\n\n # Calls email service to mass send the emails (or at least start the process)\n send_email = EmailService.bulk_email(credential, emails, subjects, templates, files, password)\n\n # If email sending process was started, return true, otherwise return false and message\n if send_email[:success]\n return { success: true }\n else\n return { success: false, message: send_email[:message] }\n end\n end",
"def send_survey_completion_emails\n return unless EMAILS_ENABLED\n\n UserMailer.survey_completed(@sheet).deliver_now\n end",
"def send_success_report\n return if @success_orders.blank?\n success_orders = ['Order, SKU, Tracking, ParcelId, Quantity, Date, Country'] + @success_orders\n Spree::AsendiaMailer.csv(success_orders.join(\"\\n\"), 'asendia', \"Sand & Sky : ASENDIA Shipments Report(#{Time.now.strftime('%d/%m/%Y')})\").deliver\n end",
"def send_failure_report\n return if @failed_orders.blank?\n failed_orders = ['Order, Tracking, ParcelId, Quantity, Date, Error_Message, Country'] + @failed_orders\n Spree::InnotracMailer.csv(failed_orders.join(\"\\n\"), 'innotrac', \"Sand & Sky : INNOTRAC Failed Shipments Report(#{Time.now.strftime('%d/%m/%Y')})\").deliver\n end",
"def email_action documents\n mail = RecordMailer.email_record(documents, { to: params[:to], message: params[:message], :callnumber => params[:callnumber], :status => params[:itemStatus] }, url_options, params)\n if mail.respond_to? :deliver_now\n mail.deliver_now\n else\n mail.deliver\n end\n end",
"def job_posted_announcer_notification(job)\n @job = job\n @user = User.find(@job.user_id)\n mail(:subject => \"Anuncio enviado com sucesso.\", :to => @user.email)# for announcer and a hide copy to admin\n end",
"def issued\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def study_upload_complete(user, num_successful, problem_lines, warning_lines)\n\t\tbegin\n\t\t\tfrom \t\t\tDEFAULT_FROM\n\t\t\treply_to \t\tDEFAULT_REPLY_TO\n\t\t\tsubject \t\t\"Your SRDR Study Upload\"\n\t\t\trecipients \t\tuser.email\n\t\t\tsent_on \t\tTime.now\n\t\t\t@num_successful = num_successful\n\t\t\t@problem_lines = problem_lines\n\t\t\t@warning_lines = warning_lines\n\t\trescue Exception=>e \n\t\t\tputs \"ERROR SENDING UPLOAD NOTIFICATION: #{e.message}\\n#{e.backtrace}\\n\\n\"\n\t\tend\n\tend",
"def notify_submitter_of_import_errors(commit)\n @commit = commit\n submitter_emails = [@commit.author_email, @commit.user.try!(:email)].compact.uniq\n if submitter_emails.present? && @commit.import_errors.present?\n mail to: submitter_emails, subject: t('mailer.commit.notify_submitter_of_import_errors.subject')\n end\n end",
"def test_complete(user)\n @user = user\n\n mail to: @user.email_id, subject: \"Test Copmleted\"\n end",
"def send_new_meal_record_uploaded_notification(user, meal_record)\n @user = user\n @meal_record = meal_record\n mail(to: ADMIN_CONTACTS, subject: \"[Cinnamon] New meal record available for carbs evaluation!\")\n end",
"def send!\n self.to_csv.split(/\\n/).each do |line|\n user = User.find_by_email(line.split(/\\t/)[0])\n fields = line.strip.split(/\\t/)[1..-1]\n self.send_message(user, fields)\n end\n end",
"def import\n User.import(params[:file])\n flash[:notice] = \"Dormers imported.\"\n flash[:color] = \"valid\"\n\n\n redirect_to generatedb_path\n end",
"def activation_success_email user, application_id\n @user = User.find user\n @application = @user.used_applications.find application_id\n @url = application_url(@application)\n mail(:to => @user.email,\n :subject => \"You have been added to #{@application.application_name}\")\n end",
"def download\n Delayed::Job.enqueue(ExportJob.new(current_account))\n flash[:success] = _('Give us some time then check your email.')\n redirect_to export_pages_path\n end",
"def order_in_progress\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def startup_exists(project, user)\n @project = project\n @user = user\n mail(:to => user.email, :subject => _('%s already imported once on %s.') % [\n project.title, Doers::Config.app_name])\n end",
"def deliver_mail\n @invitation.deliver_mail\n track 'Invitation Deliver Mail', @invitation\n redirect_to account_invitations_path, notice: 'Invitation email has been sent.'\n end",
"def send_email\n AlertNotifier.delay.email_zero_inventory(self)\n end",
"def import\n task = Task.create!(name: 'Preparing to import MARCXML records',\n service: Service::LOCAL_STORAGE,\n status: Task::Status::SUBMITTED)\n RecordSource.new.import_async(task)\n rescue => e\n handle_error(e)\n else\n flash['success'] = 'Import will begin momentarily.'\n ensure\n redirect_back fallback_location: tasks_path\n end",
"def do_email\n @manifest = Manifest.find(params[:id])\n @email = params[:email]\n \n Notifier.manifest(@email, @manifest).deliver\n \n flash[:notice] = \"El documento ha sido enviado con exito .\"\n redirect_to \"/manifests/#{@manifest.id}\"\n end",
"def job_complete(job)\n @job = job\n mail subject: \"Job Complete\"\n end",
"def succesfull_submission(offer)\n @greeting = \"Χαίρετε\"\n @user = User.find(offer.user_id)\n @offer = offer\n @procurement = Procurement.find(offer.procurement_id)\n\n mail to: @user.email, subject: '[E-Proc] Tender Submitted Succesfully'\n end",
"def exception_occured(exception)\n @exception = exception\n mail subject: \"Exception Occured During Running\"\n end",
"def send_failure_report\n return if @failed_orders.blank?\n failed_orders = ['Order, Tracking, ParcelId, Quantity, Date, Error_Message, Country'] + @failed_orders\n Spree::AsendiaMailer.csv(failed_orders.join(\"\\n\"), 'asendia', \"Sand & Sky : ASENDIA Failed Shipments Report(#{Time.now.strftime('%d/%m/%Y')})\").deliver\n end",
"def send_update_email(artifact)\n @artifact = artifact\n list = []\n @artifact.project.users.each do |apu|\n list << apu.email\n end\n mail( :to => list,\n :subject => 'There is an update in your user area.' )\n end",
"def send_acceptance_email\n # UserMailer.delay.send_accepted_email(user_id)\n end",
"def complete_post_processing_tasks\n process_incident_issues if process_issues?\n send_alert_email if send_email? && notifying_alert?\n end",
"def completed\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def item_added(item)\n @item = item\n\n mail subject: \"New item available!\",\n to: \"nobody@yardsale.com\",\n bcc: User.all.pluck(:email)\n end",
"def notify\n ActionMailer::Base.mail(:from => \"edgar-garcia@northwestern.edu\", :to => \"digitalcollections@northwestern.edu\", :cc => \"edgar-garcia@northwestern.edu\", :subject => \"DIL Upload permission request - \" + current_user.uid, :body => \"User \"+ current_user.uid + \" has requested to be added to the uploaders list. Is this approved?\\n\\n Their email address is: \" + current_user.email + \"\\n\\nThis email was generated by DIL.\").deliver\n flash[:notice] = \"Your inquiry has been submitted. Please come back and check later, you will be notified within a day as well.\"\n redirect_to \"/uploads\"\n end",
"def cust_success_redeemed(smb, customer, friend, campaign, sent)\n @smb = smb\n @customer = customer\n @friend = friend\n @campaign = campaign\n @sent = sent\n mail(:to => customer.email, :subject => \"Thanks for coming to #{smb.full_name}\", :from => \"#{smb.full_name} <#{smb.email}>\")\n end",
"def sent_verification_mail()\n @user= User.find(params[:id]);\n TweetsMailer.verification(@user).deliver_now;\n flash[:success]=\"Mail to #{@user.email} has been sended!\";\n redirect_to(verification_user_url(@user));\n end",
"def we_miss_you(student)\n @attendance_records = Attendance.where(:student_id => student.id)\n @last_seen = @attendance_records.last.created_at.strftime(\"%A,%B %y\")\n @dojo = Dojo.find(1)\n @student = student\n mail(:to => student.email, :subject => \"#{@student.first_name}, We Miss You!\")\n end",
"def user_success_email(order_id, email)\n @order = WholesaleOrder.find(order_id)\n mail to: email, subject: I18n.t('wholesale_order_mailer.user_success_email.subject', order_id: order_id)\n end",
"def new_match_report\n @trials = Trial.all\n @sites = Site.all\n @import = Import.last\n mail( :to => ClinicalTrialMatcher::Application.config.import_report_recipient,\n :subject => 'Clinial Trial Import Report: ' + Time.new.strftime(\"%m/%d/%Y\") )\n end",
"def process_entities(items_to_check, log)\n @items_list = []\n\n # Get all of the items that will be put into the contents of the alert sent.\n @items_list = gather_content_items(items_to_check)\n\n # send email to admins with the items of interest\n if !items_list.empty? && send_alert_this_day?(@timing, @config, nil)\n recipients.each do |admin|\n send_email(admin, log, [items_list])\n end\n end\n end",
"def create\n bgeigie_import.user = current_user\n if bgeigie_import.save\n bgeigie_import.delay.process\n @result = bgeigie_import\n else\n @result = bgeigie_import.errors\n end\n respond_with @result, :location => bgeigie_import\n end",
"def sync_products_and_erp_items\n subject \"RED.com/Sync Products Data Report\"\n recipients AppConfig.EXCEPTION_RECIPIENTS\n from AppConfig.ORDERS_FROM\n content_type \"text/html\"\n body :host => AppConfig.HOST_NAME\n end",
"def event_mail\n NoticePlannerMailer.delay.notice_planner_email('lumi.xperia@gmail.com', 'test', 'cron-test', 'https://yahoo.co.jp')\n end",
"def send_download_ext_notice\n UserMailer.send_download_ext_notice(self).deliver_now\n end",
"def failed_updates_present(event)\n error \"TariffSynchronizer found failed updates that need to be fixed before running: #{event.payload[:file_names]}\"\n\n Mailer.failures_reminder(event.payload[:file_names]).deliver\n end",
"def import\n if current_user.items.import(params[:file]) == false\n #False encountered means atleast one invalid item\n flash[:danger] = \"Error Encountered. No Items Imported. Please check CSV File.\"\n redirect_to spage3_path\n else \n #True means all valid items so save all of them\n current_user.items.import1(params[:file])\n flash[:success] = \"All Items Imported Successfully.\"\n redirect_to spage3_path\n end\n end",
"def send_account_notification\n @user = User.find_by_id(params[:id]) \n begin \n url = \"http://www.uncharted.net/account/activation/#{@user.activation_code}\" \n Emailer.deliver_admin_accountactivation(@user.email,url)\t\n end\n flash[:notice] = \"Email has been sent to #{@user.email} to active his account.\"\n redirect_to :action => 'index'\n end",
"def send_emails\n # p \"job_exists?: #{job_exists?}\"\n return if job_exists?\n\n AbsenceJob.set(wait_until: email_wait_time)\n .perform_later(semester_id, date.to_s)\n\n # return unless absent? && date == Date.today\n #\n # # always send email to student\n # email_student\n #\n # # if the absence was consecutive?\n # if consecutive?\n # email_director\n # else\n # email_teacher_assistant\n # end\n end",
"def study_upload_complete(user, num_successful, problem_lines, warning_lines)\n\t\tfrom \t\t\t\"Systematic Review Data Repository <nhadar@tuftsmedicalcenter.org>\"\n\t\treply_to \t\t\"nira_hadar@brown.edu\"\n\t\tsubject \t\t\"Your SRDR Study Upload\"\n\t\trecipients \t\tuser.email\n\t\tsent_on \t\tTime.now\n\t\t@num_successful = num_successful\n\t\t@problem_lines = problem_lines\n\t\t@warning_lines = warning_lines\n\tend",
"def cust_success(temp_final_thx, code, smb, customer, friend, campaign, sent)\n @temp_final_thx = temp_final_thx\n @sent = sent\n @code = code\n @smb = smb\n @customer = customer\n @friend = friend\n @campaign = campaign\n mail(:to => customer.email, :subject => campaign.final_thx_subject.gsub(/\\[Friend Full Name\\]/, friend.fullname), :from => \"#{smb.full_name} <#{smb.email}>\")\n end",
"def finish_import(success)\n relinquish_claim(success)\n end",
"def sendQuestionnaire\n email=params[:email]\n emails=email.split(\",\")\n description=params[:description]\n questionnaire_id = params[:questionnaire_id]\n emails.each do |one|\n ReviewerInviter.task_invitation(one, description, \"http://localhost:3000/questionnaires/answer_show?id=\"+questionnaire_id).deliver()\n end\n respond_to do |format|\n format.html { redirect_to(:back) } #, flash[:success] = \"holder updated\") \n end\n end",
"def send_email(is_success)\n user_email = User.using_client_shard(client: @client).get_from_memcache(@edit_kyc_request.user_id).email\n\n admin_emails_for_notification = GlobalConstant::Admin.get_all_admin_emails_for(\n @user_kyc_detail.client_id,\n GlobalConstant::Admin.open_case_request_outcome_notification_type\n )\n current_admin = Admin.get_from_memcache(@edit_kyc_request.admin_id)\n\n admin_emails_for_notification << current_admin.email if current_admin.status == GlobalConstant::Admin.active_status\n admin_emails_for_notification.uniq!\n\n admin_emails_for_notification.each do |email_id|\n Email::HookCreator::SendTransactionalMail.new(\n client_id: Client::OST_KYC_CLIENT_IDENTIFIER,\n email: email_id,\n template_name: GlobalConstant::PepoCampaigns.open_case_request_outcome_template,\n template_vars: {success: is_success.to_i, email: user_email, reason_failure: \"UnWhitelist Transaction has failed\",\n case_id: @user_kyc_detail.id}\n ).perform\n end\n\n # Send internal email in case of failure\n unless is_success\n ApplicationMailer.notify(\n to: GlobalConstant::Email.default_to,\n body: \"UnWhitelist Transaction has failed\",\n data: {case_id: @edit_kyc_request.case_id, edit_kyc_table_id: @edit_kyc_request.id},\n subject: \"Exception::Something went wrong while opening case of Unwhitelisted Edit KYC request.\"\n ).deliver\n end\n end",
"def alert\n Confirmer.delay.emergency(@order.id, @this_user.id)\n redirect_to @this_user\n flash[:notice] = \"Email on route!\"\n end",
"def upload\n upload_file = ApplicationUpload.new(params[:file])\n upload_msgs = upload_file.import(Garbage)\n\n flash[:notice] = t(:success_imported, :msg => upload_msgs) unless upload_msgs.blank?\n redirect_to(garbages_url)\n end",
"def error_occured(error)\n @error = error\n mail :to => '846190988@qq.com', subject: 'Depot Exception Warning'\n end",
"def cost_analysis\n AdminMailer.cost_analysis.deliver_now\n end",
"def show\n ReportMailer.MailReports(params[:export][:email]).deliver\n flash[:success] = \"Email sent\"\n redirect_to reports_path\n end",
"def send_progress_tracker_email(email)\n UserMailer.progress_tracker(self, email).deliver_now\n end",
"def send_test\n @bulletin = @project.bulletins.find(params[:id]) \n \n if request.post?\n addr = params[:recipient][:email]\n recip = @project.recipients.find_by_email(addr)\n if ! recip\n recip = Recipient.new(:email => addr, :firstname => 'Sample', :surname => 'User')\n subscription = Subscription.new( :project => @project, :recipient => recip )\n else\n subscription = @project.subscriptions.find_by_recipient_id( recip.id )\n end\n \n #begin \n BulkMailer::deliver_bulletin(@bulletin, subscription)\n flash[:notice] = _(\"Test e-mail sent successfully!\")\n redirect_to :action => 'index'\n #rescue\n # flash[:error] = \"Unable to send the test email! \" + $!\n #end\n end\n end",
"def transaction_complete\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end",
"def sent_success me, member\n @by_member = member\n @amount = me.amount\n @me = me\n @currency = me.account.currency\n subjects = \"Money sent success\"\n mail to: me.sender.email, subject: subjects\n end",
"def notify_error(error)\n @error = error\n\n mail to: \"admin@example.org\", subject: \"Depot App Error\"\n end",
"def binding_prediction_mail(pred, emails)\n @pred = pred\n\n mail ({to: emails, subject: \"[XBindR]Binding Site Prediction Result, sid: #{pred.id}\"})\n end",
"def email_action documents\n mail = RecordMailer.email_record(documents, { to: params[:to], message: params[:message], config: blacklight_config }, url_options)\n if mail.respond_to? :deliver_now\n mail.deliver_now\n else\n mail.deliver\n end\n end",
"def send_admin_email\n AdminMailer.new_user_waiting_for_approval.deliver\n end",
"def perform user\n puts \"Should send email to #{user.email}\"\n end",
"def error_occured(error)\n @error = error\n mail to: \"869027168@qq.com\",\n subject: 'Depot App出现了错误' \n end",
"def completed\n SignaturesMailer.completed\n end",
"def in_process\n to = params[:patron_email] + ', ' + params[:staff_email]\n from = \"Request Services <#{params[:staff_email]}>\"\n title = params[:bib_record].title\n subject = \"On Order / In Process Request [#{title}]\"\n mail(to: to, from: from, subject: subject)\n end",
"def perform\n User.where(id: @bug.notify_on_deploy).each do |user|\n NotificationMailer.deploy(@bug, user).deliver\n end\n end",
"def alert(annc, user)\n\t\t@greeting = annc.company.name.upcase + \" (#{annc.company.hk_ticker}) has posted an announcement at #{annc.datetime.to_formatted_s(:short)}: #{annc.message}.\"\n\t\t@url = annc.url\n\n\t\tmail to: user.email, subject: \"HK Equities Alert (#{annc.company.hk_ticker})\"\n\tend",
"def admin_success_email(order_id, email)\n @order = WholesaleOrder.find(order_id)\n mail to: email, subject: I18n.t('wholesale_order_mailer.admin_success_email.subject', order_id: order_id)\n end",
"def send_email(user_info)\n \t@user_info = user_info\n @users = User.all\n\n @users.each do |user|\n\t mail(\n\t to: user.email,\n\t subject: \"BrightHearts notification\",\n\t from: \"BrightHearts <admin@sensoriumhealth.com>\",\n\t return_path: \"contact@sensoriumhealth.com\",\n\t date: Time.now,\n\t content_type: \"text/html\"\n\t )\n\tend\n end",
"def invoice_is_ready invoice = Invoice.first\n @invoice = invoice\n mail(to: @invoice.user.email, subject: \"You Invoice is ready\") do |format|\n format.text\n format.mjml\n end\n end",
"def run_schedule_works\n # TODO list\n puts \"send email\"\n user_list = User.includes(:goods_stores).where('goods_stores.goods_expire_date < ?', Time.now.strftime(\"%Y-%m-%d\")).references(:goods_stores)\n\n\n user_list.each{|user|\n if user.goods_stores.length == 0\n next\n end\n\n email_content = \"\"\n email_content += \"<h1>Alert! Some Item in Your Fridge were expired</h1>\"\n email_content += \"<p>Hello #{user.username}</p>\"\n email_content += \"<p>The following item in your fridge is expired</p>\"\n email_content += \"<ul>\"\n\n user.goods_stores.each{|goods|\n email_content += \"<li>food name: #{goods.goods_info.goods_name} food expire date: #{goods.goods_expire_date} fridge: #{goods.fridge.fridge_name}</li>\"\n }\n\n email_content += \"</ul>\"\n puts email_content\n\n from = Email.new(email: 'hiby.90hou@gmail.com')\n to = Email.new(email: user.email)\n subject = \"Alert! Some Item in Your Fridge were expired\"\n content = Content.new(type: 'text/html', value: email_content)\n mail = Mail.new(from, subject, to, content)\n\n sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])\n response = sg.client.mail._('send').post(request_body: mail.to_json)\n puts response.status_code\n puts response.body\n puts response.headers\n }\n\n end",
"def team_upload(wrestler_array)\n @user = wrestler_array[0]\n @wrestlers = wrestler_array[1]\n mail(to: [\"scottalankatz@gmail.com\", \"lhkatz@pacbell.net\"], subject: \"#{@wrestlers[0].school.name} Imported Roster\")\n end",
"def notify_devs\n ApplicationMailer.notify(\n data: @failed_logs,\n body: {manager_id: @manager_id},\n subject: 'Exception in PostTestEconomySetupJob'\n ).deliver if @failed_logs.present?\n end",
"def submitted\n @user = @receiver\n @notification = @user.notifications.find_by(path: \"/products/#{@product.id}\")\n mail to: @user.email, subject: \"[bootcamp] #{@message}\"\n end"
] |
[
"0.6828059",
"0.6817229",
"0.65598416",
"0.6248235",
"0.613114",
"0.60800695",
"0.59730613",
"0.59607154",
"0.5936173",
"0.59326285",
"0.58989424",
"0.5888067",
"0.58783627",
"0.58548117",
"0.5841181",
"0.58194315",
"0.581422",
"0.58033085",
"0.5798732",
"0.57891613",
"0.57674366",
"0.5747009",
"0.5739053",
"0.57367927",
"0.57289714",
"0.5726945",
"0.5720996",
"0.5719835",
"0.57182986",
"0.571667",
"0.569816",
"0.56933033",
"0.56929135",
"0.56759036",
"0.5629014",
"0.5619133",
"0.56088406",
"0.5608333",
"0.55985457",
"0.55866086",
"0.5578441",
"0.55582124",
"0.55457145",
"0.55343956",
"0.55219483",
"0.55219215",
"0.5516728",
"0.5512349",
"0.55109733",
"0.5510741",
"0.5498469",
"0.54982024",
"0.5495962",
"0.5484265",
"0.5481594",
"0.5465952",
"0.54611033",
"0.5456173",
"0.5455812",
"0.5454443",
"0.54519403",
"0.54330695",
"0.5431876",
"0.5430905",
"0.5428133",
"0.5427422",
"0.54177326",
"0.5415381",
"0.5409493",
"0.5409472",
"0.5403774",
"0.5403136",
"0.54021424",
"0.5397572",
"0.53969747",
"0.5387325",
"0.5385828",
"0.53848815",
"0.53843206",
"0.53830653",
"0.5382931",
"0.53766835",
"0.5365423",
"0.53616166",
"0.5356749",
"0.53539467",
"0.53375775",
"0.533704",
"0.5335867",
"0.53338367",
"0.53334224",
"0.5333322",
"0.5331287",
"0.5328932",
"0.5319015",
"0.5315348",
"0.5313942",
"0.5307504",
"0.5305651",
"0.53019893"
] |
0.8169935
|
0
|
Usage: Google::Reader::Label.new('friends') Google::Reader::Label.new('friends', false) Google::Reader::Label.new('friends', false, 3)
|
def initialize(name, shared=false, count=0)
self.name = name
self.shared = shared
self.count = count
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_label label\n @labels[label] = true\n\n label\nend",
"def label; end",
"def label; end",
"def labels\n all.select { |c| c.google_id =~ /^user/ }.collect { |c| Label.new(c.google_id, nil, c.count) }\n end",
"def label(lname)\n $labels[lname] = $iptr\nend",
"def create_label(node)\n if node.attributes['id'] and @labels[node.attributes['id']]\n label = @labels[node.attributes['id']]\n else\n label = @factory.new_label\n @labels[node.attributes['id']] = label\n end\n \n # Read all defined data fields\n label.id = node.attributes['id']\n if node.attributes['type']\n label.type = Utils.add_namespace(node.attributes['type'])\n end\n \n label.name = node.elements['name'].text if node.elements['name']\n label.sort_name = node.elements['sort-name'].text if node.elements['sort-name']\n label.code = node.elements['label-code'].text if node.elements['label-code']\n label.disambiguation = node.elements['disambiguation'].text if node.elements['disambiguation']\n label.country = node.elements['country'].text if node.elements['country']\n \n if life_span = node.elements['life-span']\n label.begin_date = read_date_attribute(life_span, 'begin')\n label.end_date = read_date_attribute(life_span, 'end')\n end\n \n # Read the alias list\n read_alias_list(node.elements['alias-list'], label.aliases)\n \n # Read the release list\n read_release_list(node.elements['release-list'], label.releases)\n \n # Read the relation list\n if node.elements['relation-list']\n node.elements.each('relation-list') {|relation_node|\n read_relation_list(relation_node) {|relation|\n label.add_relation relation\n }\n }\n end\n \n # Read the tag list\n read_tag_list(node.elements['tag-list'], label.tags)\n \n return label \n end",
"def OPRLabel(text:)\n {\n type: \"label\",\n text: text\n }\nend",
"def label\n label = \"#{number}: #{name}\"\n end",
"def set_label(l); end",
"def label\n end",
"def label name\n UnknownLabel.new(name)\n end",
"def labels; end",
"def generate_object_label\n \t\tlabel = \"\"\n label_names = \" - \"\n\t\tbegin\n\t\t\tnames = self.get_values_from_datastream(\"descMetadata\", [:name, :namePart], {})\n\t\t\troles = self.get_values_from_datastream(\"descMetadata\", [:name, :role, :text], {}) \n\t\t\t#'zip' name into role array\n\t\t\trole_name = roles.zip(names)\n\t role_name.each do |person|\n\t\t\t role = person[0].to_s.downcase\n\t\t\t \tif role == 'creator' || role == 'author'\n\t\t\t\t\tlabel_names = label_names + person[1] + '; '\n\t\t\t\tend\t\t\n\t end\n\t\trescue OM::XML::Terminology::BadPointerError => e\n\t\t\t#Assume that its an object without author (Set or alike)\n\t\t\tlabel_names = \"\"\n\t\tend\n\t\ttitle = self.get_values_from_datastream(\"descMetadata\", [:title], {}).to_s\n\n\t\t#truncate the title if its too long (over 100 chars)\n\t\ttitle = title.length > 100 ? title[0..100] <<'...': title unless title.nil?\n\t\tlabel = title + label_names\n \n #255 character limit for labels, we'll limit to 200 to be on the safe-side...\n label = label.length > 200 ? label[0..197] << '...' : label\t\n\n #When the label has any leading/trailing spaces strip them off...\n label = label.strip!.nil? ? label : label.strip\n\t\treturn label\n\n end",
"def create_labels(labels)\n initialize\n labels.each do |l|\n @client.add_label(@targetRepo, l.name, l.color)\n end\n end",
"def to_label(label)\n return unless label\n label.draw_multi_text(type.name, {:font_reverse => true})\n label.draw_multi_text(observations.collect{|obs|obs.to_short_s}.join(\", \"), {:font_reverse => false})\n end",
"def label() @positive end",
"def new_dummy_label\n @dummy_label_index ||= 0\n @dummy_labels ||= (\"a\"..\"aaaaaa\").to_a\n dummy_label = @dummy_labels[@dummy_label_index]\n @dummy_label_index += 1\n dummy_label\n end",
"def label(label = nil)\n @label = label if label\n @label\n end",
"def labeled?\r\n false\r\n end",
"def initialize( label, options )\n\n @label = label\n @options = options\n @current_option = 0\n end",
"def label\n nome\n end",
"def default_label?\n true\n end",
"def initialize(label = nil, &b)\n self.label = label if label\n @parser = b\n end",
"def initialize(labels)\n @score = [0,0,0,0]\n @started = [false,false,false,false]\n @labels = [] \n \n @players = []\n @playing =[]\n @labels = labels\n @winner = nil\n \n end",
"def initialize(label = nil, &block)\n @label = label\n block.call(self) if block\n end",
"def labels() = @labels ||= labels_hash",
"def label label = nil\n @label = label if label\n @label\n end",
"def how_to_render_a_label args\n # NOTE: Text is aligned from the TOP LEFT corner\n\n # Render an EXTRA LARGE/XL label (remove the \"#\" in front of each line below)\n args.nokia.labels << { x: 0, y: 46, text: \"Hello World\",\n size_enum: NOKIA_FONT_XL,\n r: 0, g: 0, b: 0, a: 255,\n font: NOKIA_FONT_PATH }\n\n # Render a LARGE/LG label (remove the \"#\" in front of each line below)\n args.nokia.labels << { x: 0, y: 29, text: \"Hello World\",\n size_enum: NOKIA_FONT_LG,\n r: 0, g: 0, b: 0, a: 255,\n font: NOKIA_FONT_PATH }\n\n # Render a MEDIUM/MD label (remove the \"#\" in front of each line below)\n args.nokia.labels << { x: 0, y: 16, text: \"Hello World\",\n size_enum: NOKIA_FONT_MD,\n r: 0, g: 0, b: 0, a: 255,\n font: NOKIA_FONT_PATH }\n\n # Render a SMALL/SM label (remove the \"#\" in front of each line below)\n args.nokia.labels << { x: 0, y: 7, text: \"Hello World\",\n size_enum: NOKIA_FONT_SM,\n r: 0, g: 0, b: 0, a: 255,\n font: NOKIA_FONT_PATH }\n\n # You are provided args.nokia.default_label which returns a Hash that you\n # can ~merge~ properties with\n # Example 1\n args.nokia.labels << args.nokia\n .default_label\n .merge(text: \"Default\")\n\n # Example 2\n args.nokia.labels << args.nokia\n .default_label\n .merge(x: 31,\n text: \"Default\")\nend",
"def labels\n [label()]\n end",
"def create_label(name, description, types, color) \n data = {\n 'name' => name,\n 'description' => description,\n 'types' => types,\n 'color' => color\n }\n\n result = @access_token.post(\n \"#{SITE}/api/v2/labels\", \n data.to_json, \n {'Accept'=>'application/json', 'Content-Type' => 'application/json'}\n )\n\n JSON.parse(result.body)\n end",
"def labeled_checkbox(label, name, value, options={})\n id = options.delete(:id) || name\n\n attrs = options.map { |(k, v)| \" #{h k}='#{h v}'\" }.join('')\n\n [ \"<label#{attrs} class='checkbox' for='#{id}'>\",\n checkbox(name, value, :id => id),\n \"<span>#{h label}</span>\",\n \"</label>\"\n ].join(\"\\n\")\n\n end",
"def labeled_checkbox(label, name, value, options={})\n id = options.delete(:id) || name\n\n attrs = options.map { |(k, v)| \" #{h k}='#{h v}'\" }.join('')\n\n [ \"<label#{attrs} class='checkbox' for='#{id}'>\",\n checkbox(name, value, :id => id),\n \"<span>#{h label}</span>\",\n \"</label>\"\n ].join(\"\\n\")\n\n end",
"def initialize(label:, value:, is_valid:, is_owner:)\n @label = label\n @value = value\n @is_valid = is_valid\n @is_owner = is_owner\n end",
"def initialize( source , label )\n super(source)\n @return_label = label\n end",
"def label(label_name)\n @labels ||= []\n @labels << label_name.to_sym\n self\n end",
"def label\n @label || \"unknown\"\n end",
"def add_label(label)\n @api.do_request(\"PUT\", label.get_base_api_path() + \"/messages/\" + get('id'));\n @label_ids_set[label.id] = true\n end",
"def add_label(label)\n @api.do_request(\"PUT\", label.get_base_api_path() + \"/messages/\" + get('id'));\n @label_ids_set[label.id] = true\n end",
"def label\n read_attr :label\n end",
"def initialize(label, bit, type)\n fail 'Label has to be a String' unless label.is_a?(String)\n fail 'Bit has to be a String' unless bit.is_a?(String)\n\n @label = label\n @bit = bit\n @type = type\n end",
"def add_label\n self.rdfs_label = preflabel if preflabel.present?\n self.preflabel = rdfs_label if rdfs_label.present?\n end",
"def initialize(label)\n @label = label.to_f\n @features = [1.0] # First feature is always the bias value\n end",
"def createLabel(content)\n\t\tlabel = Gtk::Label.new\n\t\tlabel.set_markup(content)\n\t\treturn label\n\tend",
"def initialize(*label, expiration: Goalkeeper.expiration)\n @label = label.join(\":\")\n @expiration = expiration\n end",
"def label=(value)\n @label = value\n end",
"def label(operate, label, number)\n Giic::Core.label(:user => @project.user, :repo => @project.repo, :number => number,\n :operate => operate, :label => label,\n :params => authentication_data)\n end",
"def label_tag(name = T.unsafe(nil), content_or_options = T.unsafe(nil), options = T.unsafe(nil), &block); end",
"def conversation_label(conversation, options={})\n label = Mailboxer::Label.find(conversation.mailboxer_label_id)\n content_tag :span, class: \"lbl--small lbl--chip lbl lbl--#{label.color} #{options[:class]}\" do\n end\n end",
"def add_label\n label = ''\n label += \", #{name}\" if name.present?\n label += \", #{dates}\" if dates.present?\n label += \", #{qualifier}\" if qualifier.present?\n label = label.sub(', ', '') if label.starts_with? ', '\n self.rdfs_label = label\n add_preflabel\n end",
"def initialize(label, values)\n @label = label\n @name = label.name\n @values = values\n @formats = Formats.new\n @drawings = Drawings.new\n\n add_commands(values)\n end",
"def createLabel\n @labelField = NSTextField.alloc.initWithFrame(LABEL_FRAME).tap do |obj|\n obj.autoresizingMask = NSViewWidthSizable | NSViewMinYMargin\n obj.bordered = false\n obj.drawsBackground = false\n obj.font = NSFont.boldSystemFontOfSize(12) # systemFontOfSize 13\n obj.editable = false\n obj.selectable = true\n obj.alignment = NSNaturalTextAlignment\n end\n end",
"def label\r\n\t\t''\r\n\tend",
"def labels_tech_demo\n outputs.labels << [grid.left.shift_right(5), grid.top.shift_down(5), \"This is a label located at the top left.\"]\n outputs.labels << [grid.left.shift_right(5), grid.bottom.shift_up(30), \"This is a label located at the bottom left.\"]\n outputs.labels << [ 5, 690, \"Labels (x, y, text, size, align, r, g, b, a)\"]\n outputs.labels << [ 5, 660, \"Smaller label.\", -2]\n outputs.labels << [ 5, 630, \"Small label.\", -1]\n outputs.labels << [ 5, 600, \"Medium label.\", 0]\n outputs.labels << [ 5, 570, \"Large label.\", 1]\n outputs.labels << [ 5, 540, \"Larger label.\", 2]\n outputs.labels << [300, 660, \"Left aligned.\", 0, 2]\n outputs.labels << [300, 640, \"Center aligned.\", 0, 1]\n outputs.labels << [300, 620, \"Right aligned.\", 0, 0]\n outputs.labels << [175, 595, \"Red Label.\", 0, 0, 255, 0, 0]\n outputs.labels << [175, 575, \"Green Label.\", 0, 0, 0, 255, 0]\n outputs.labels << [175, 555, \"Blue Label.\", 0, 0, 0, 0, 255]\n outputs.labels << [175, 535, \"Faded Label.\", 0, 0, 0, 0, 0, 128]\n end",
"def add_label\n self.rdfs_label = name if name.present?\n add_preflabel\n end",
"def initialize(label=false, value = false, vid)\n if !label\n @label = self.__id__\n else\n @label = label\n end\n @vid = vid\n @value = value\n @adj_v = Array.new\n @in_edges = Array.new\n @edges = Hash.new\n end",
"def add_label(label)\n \n if (@labels.has_key?(label))\n # Just read one more line with the same label. No problem, keep reading\n if (@labels[label] == @current_value)\n \n elsif (@labels[label] == @next_value)\n # Reading next label\n @current_value = @next_value\n @next_value = (@next_value + 1) % (@max_value + 1)\n elsif (@labels[label] < @current_value && @labels[label] == 0)\n # reached the last label and going back to the first one\n reset\n return true\n else\n # Label read is out of order. Expected value is either 0 (starting over) or\n # the next value. Although we raise an exception, we allow the calling method\n # to catch the exception and let the program still run.\n expected_value = (@labels[label] < @current_value)? 0 : @next_value\n reset if @labels[label] < @current_value\n @current_value = @labels[label] + 1\n @next_value = @current_value + 1\n raise \"Missing data: next expected label was '#{@labels.key(expected_value)}' but read '#{label}'.\"\n end\n else\n @current_value = @labels[label] = @next_value\n @next_value += 1\n # Trying to add a label when the dimension is frozen raises an exception\n raise \"Dimension '#{@name}' is frozen when adding label '#{label}'.\" if frozen\n end\n\n false\n \n end",
"def truth_label(is_true, true_label = 'true', false_label = 'false')\n content_tag(:span, is_true ? true_label : false_label,\n class: ['label', is_true ? 'label-success' : 'label-danger'])\n end",
"def initialize(type = LABEL_DETECTION)\n @type = type\n end",
"def label(opts = {})\n label_for(@page, opts)\n end",
"def tag_label(name)\r\n if @labels.key? name\r\n raise \"repeated label #{name} within section #{@name}\"\r\n else\r\n @labels[name] = @origin+@cursor+@org_offset\r\n end\r\n end",
"def build_label(text)\n shading = false\n\n label = Magick::Image.new(@options[:width], @options[:height])\n image = Magick::Draw.new\n image.gravity = Magick::CenterGravity\n image.pointsize = @options[:width] / 4\n image.font = 'Helvetica'\n image.font_weight = Magick::NormalWeight\n image.stroke = 'none'\n image.annotate(label, 0, 0, 0, 0, text)\n label = label.shade(shading, 310, 30)\n\n return label\n end",
"def labeled\r\n attrs.fetch(:labeled, {})\r\n end",
"def add_label(label, number)\n label 'add', label, number\n end",
"def labels(label = nil)\n @labels ||= Hash.new{|h,k| h[k] = PolicyHelper.new }\n label.nil? ? @labels : @labels[label]\n end",
"def initialize label = nil, *parts\n @label = label\n @parts = []\n @parts.concat parts\n end",
"def labels\n return \"Title: #{@title}; Description: #{@desc}; #{@complete}\"\n end",
"def label=(val)\n @label << val\n end",
"def initialize(name)\n @instr_type = LABEL_HOME\n @label_name = name \n @label_addr = UNINITIALIZED\n end",
"def generate_label\n self.label||= SecureRandom.urlsafe_base64(nil, false)\n end",
"def label(name)\n @labels << Label.new( [now, name, nil, {}] )\n end",
"def l(text=\"\", name=\"\")\n JLabel.new(text) #.tap{|jl| jl.name = name }\n end",
"def true_label(is_true, true_label = 'true')\n content_tag(:span, true_label, class: %w[label label-success]) if is_true\n end",
"def label(icon_name, opts={})\n opts[:size] ||= 18\n label = icons[icon_name.to_sym].uilabel\n label.font = IonIcons.fontWithSize(opts[:size])\n if opts[:color]\n opts[:color] = color_from_string(opts[:color]) if opts[:color].is_a? String\n end\n label.textColor = opts[:color].nil? ? :black.uicolor : opts[:color]\n label.text = icons[icon_name.to_sym]\n return label\n end",
"def initialize( name, permit_duplicate_status = false )\n if name.is_a? String then\n @label = name\n else\n raise ArgumentError.new( 'name must be a String' )\n end\n unless permit_duplicate_status.is_a?( TrueClass ) || permit_duplicate_status.is_a?( FalseClass ) then\n raise ArgumentError.new( 'permit_duplicate_status must be a Boolean' )\n end\n\n @terminated = false\n @role_list = []\n @flow_list = []\n @status_list = []\n @task_list = Array.new( 1, WorkFlowTask.new( 0, '<start new workflow>' ))\n @permit_duplicate_status = permit_duplicate_status\n end",
"def label(label, options = {})\n run_command(\"label/#{label}/values\", options)\n end",
"def label\n @label ||= self.new.class.to_s.underscore.gsub('/', '.')\n end",
"def label_as label\n @label = label\n end",
"def required_label_text; end",
"def label\n \"\"\n end",
"def label\n return @label\n end",
"def label value\n @grpc.apply_label_transformer = value\n self\n end",
"def initialize(site, label)\n @site = site\n @label = sanitize_label(label)\n @metadata = extract_metadata\n end",
"def %(name)\n self.label = name\n self\n end",
"def label(attribute_name, *args); end",
"def add_label(label)\n d = [label, AS::LabelObject.new]\n @table << d\n d[1]\n end",
"def next_label\n ret = @labels\n @labels += 1\n ret\n end",
"def use_label_printer\n show do\n title \"Use label printer to label new 1.5 mL tubes\"\n check \"Ensure that the B33-143-492 labels are loaded in the printer. This number should be displayed on the printer. If not, check with a lab manager.\"\n check \"Open the LabelMark 6 software.\"\n check \"Select \\\"Open\\\" --> \\\"File\\\" --> \\\"Serialized data top labels\\\"\"\n note \"If an error about the printer appears, press \\\"Okay\\\"\"\n check \"Select the first label graphic, and click on the number in the middle of the label graphic.\"\n check \"On the toolbar on the left, select \\\"Edit serialized data\\\"\"\n if operations.first.output(OUTPUT).item != nil\n check \"Enter #{operations.first.output(OUTPUT).item.id} for the Start number and #{operations.length} for the Total number, and select \\\"Finish\\\"\"\n else\n check \"No start number found.\"\n end\n check \"Select \\\"File\\\" --> \\\"Print\\\" and select \\\"BBP33\\\" as the printer option.\"\n check \"Press \\\"Print\\\" and collect the labels.\"\n image \"purify_gel_edit_serialized_data\"\n image \"purify_gel_sequential\"\n end \n end",
"def create_label_if_missing(label:, colour:, description:)\n Octokit.label(ENV.fetch(\"GITHUB_REPO\"),label)\nrescue Octokit::NotFound\n Octokit.add_label(ENV.fetch(\"GITHUB_REPO\"), label, colour, description: description)\nend",
"def add_label!( n, primary=:false )\n save if add_label( n, primary )\n end",
"def create_label(project, name, color, options = {})\n post(\"/projects/#{url_encode project}/labels\", body: options.merge(name: name, color: color))\n end",
"def initialize_or_create_labels(labels)\n @post.labels = []\n labels.split(\",\").map { |i| i.strip }.uniq.each do |name|\n label = Label.find_or_initialize_by(name: name.strip)\n label.save!\n @post.labels << label\n end\n end",
"def initialize(label, field, options = {})\n @name = label.parameterize.to_s.gsub(\"-\", \"_\")\n @label = label\n @field = field\n @options = default_options.merge(options.to_options)\n reset\n end",
"def add_label\n self.rdfs_label = name if name.present?\n self.rdfs_label += \" (id: #{identifier.join})\" if identifier.present?\n add_preflabel\n end",
"def label=(_arg0); end",
"def label\n raise 'answer the list label'\n end",
"def name\n label\n end",
"def label; Common.label(@handle); end",
"def create_labels_api\n InfluxDB2::API::LabelsApi.new(@api_client)\n end",
"def createlabel\n if !params[:labelname].nil? and !params[:labelname].empty? and !params[:labelcolor].nil? and !params[:labelcolor].empty?\n label = Label.new\n label.labelname = params[:labelname]\n label.labelcolor = params[:labelcolor]\n label.project = get_project\n label.status = \"Active\"\n label.created_by=session[:username]\n if label.save\n @manage_label =false\n @notice = \"Label created Successfully\"\n else\n @notice = \"Error creating label\"\n end\n redirect_to bugs_url\n else\n redirect_to bugs_url\n end\n end",
"def initialize(pos_start, pos_end, label)\n @label = label\n super(pos_start, pos_end)\n end",
"def get_label(label_id)\n query_and_build \"labels/#{label_id}\"\n end"
] |
[
"0.6032051",
"0.5854021",
"0.5854021",
"0.5767846",
"0.56982565",
"0.5677998",
"0.5655394",
"0.5633246",
"0.5605168",
"0.55450964",
"0.5473122",
"0.54662097",
"0.54630727",
"0.54626113",
"0.54202855",
"0.5412316",
"0.5397839",
"0.5357275",
"0.53293896",
"0.53003687",
"0.5287049",
"0.52788156",
"0.5271015",
"0.5261828",
"0.5261121",
"0.52485937",
"0.52480215",
"0.5243859",
"0.52245563",
"0.5222085",
"0.52168965",
"0.52168965",
"0.5215067",
"0.52141994",
"0.5205129",
"0.5198058",
"0.51888895",
"0.51888895",
"0.5187863",
"0.51853293",
"0.5180979",
"0.5173329",
"0.51694643",
"0.51681226",
"0.5167148",
"0.51593065",
"0.51550996",
"0.51415855",
"0.5136684",
"0.51245904",
"0.5112965",
"0.51104456",
"0.5087208",
"0.5085392",
"0.5082341",
"0.508156",
"0.5079265",
"0.5076968",
"0.5076948",
"0.5076621",
"0.5070326",
"0.50620145",
"0.5061918",
"0.5061142",
"0.50582933",
"0.50533015",
"0.5051842",
"0.50512356",
"0.5039659",
"0.5027429",
"0.5025593",
"0.5017273",
"0.50164455",
"0.49988678",
"0.49870926",
"0.4970494",
"0.49650332",
"0.49635488",
"0.49607873",
"0.49587646",
"0.4953402",
"0.4951519",
"0.49494433",
"0.4948159",
"0.49481422",
"0.49423176",
"0.49414802",
"0.4938618",
"0.4935179",
"0.49345857",
"0.4934401",
"0.49329403",
"0.49317747",
"0.4930868",
"0.49205092",
"0.49196944",
"0.49181882",
"0.49150878",
"0.49131617",
"0.4901344",
"0.48947337"
] |
0.0
|
-1
|
Returns name; converts broadcast label to shared to be consistent with google
|
def name
@name == 'broadcast' ? 'shared' : @name
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def normalized_name\n @normalized_name ||= if self.name.start_with?(ClientConstants::GLOBAL_PLAYLIST_PREFIX)\n self.name[2..-1]\n else\n self.name\n end\n end",
"def human_name\n \"reverse UDP\"\n end",
"def label_name(product)\n return product.label_override unless product.label_override.nil?\n Google::StringUtils.underscore(product.name)\n .split('_')\n .map { |x| x[0] }\n .join\n .concat('_label')\n end",
"def shared_name(shared_name = nil)\n @shared_name = shared_name.to_s if shared_name\n @shared_name\n end",
"def name label\n label(label)\n end",
"def get_full_name\n \"#{get_event_type}: #{relay_order}, #{get_swimmer_name}\"\n end",
"def network_name\n \"Polkadot\"\n end",
"def name\n @label || self.class.to_s.rpartition('::').last\n end",
"def activity_name\n @prefix_name\n end",
"def human_to_name; end",
"def name()\n if bound?\n return bound_name\n end\n if label && label.match(/[a-zA-Z][a-zA-Z0-9_]*/) != nil\n return label\n end\n return uri.split(/(\\/|#)/).last\n end",
"def full_name\n if name == event.full_name\n name\n elsif event.full_name[name]\n event.full_name\n else\n \"#{event.full_name}: #{name}\"\n end\n end",
"def shared_name(sharedname)\n @recipe.shared_name(sharedname.to_s)\n end",
"def label\n key.sub('fullname', 'full name').capitalize\n end",
"def network_name\n return self.class.generate_network_name(@configuration_id) unless use_existing_network?\n\n @gcp_config['network']\n end",
"def network_label\n network == \"users\" ? \"\" : network\n end",
"def to_label\n nick\n end",
"def common_event_name(id)\n name($data_common_events[id].name)\n end",
"def predict_group_name(cluster)\n first_val = cluster[0][:val]\n # find longest common substring\n group_name = cluster.inject(first_val) do |intersection, point|\n find_longest_common_substring(intersection, point[:val])\n end\n # take the longest word possibly joined with '&' or '-'\n if (group_name != '')\n group_name = group_name.scan(/[[:alnum:]|&|-[:alnum]]+/).sort_by(&:length).last\n else\n puts group_name.class\n group_name = 'Person'\n end\n group_name\n end",
"def get_full_name\n \"#{get_meeting_session_name} #{get_event_name}\"\n end",
"def _display_name\n respond_to?(:service_name) ? service_name : name.split(\"::\").last\n end",
"def external_name\n to_external(name)\n end",
"def label(name)\n @labels[name.to_sym]\n end",
"def on_broadcast(name)\n (action, argument) = name.split('_')\n case action\n when \"undefined_broadcast_1\"\n # do something\n when \"undefined_broadcast_2\"\n # do something else\n end\n end",
"def human_from_name; end",
"def plausible_common_name\n parse('creature.bird.plausible_common_names').capitalize\n end",
"def name\n @grpc.name.split(\"/\")[5]\n end",
"def get_name\n return \"#{name}\"\n end",
"def format_name\n name.observation_name\n end",
"def implausible_common_name\n parse('creature.bird.implausible_common_names').capitalize\n end",
"def folder_name(version)\n version == 'ga' ? 'google' : \"google-#{version}\"\n end",
"def notename\n self.class.notename_s(notename_i)\n end",
"def get_socket_name(socket)\n case socket\n when 1\n return text_get(15, 0)\n when 2\n return \"Pokéball\"\n when 3\n return text_get(15, 2)\n when 4\n return text_get(15, 3)\n when 5\n return text_get(15, 4)\n when 6\n return text_get(15, 1)\n end\n return text_get(15, 0)\n end",
"def name\n @gapi[\"friendlyName\"]\n end",
"def name\n self.title.downcase.split(' ').join(\"_\")\n end",
"def series_name(chart, game)\n \"#{game.meta_data.name}: #{ COUNTRIES[chart.country] } #{ KINDS_TO_SHORTCUTS[chart.kind] } #{ chart.genre || \"apps\" }\"\n end",
"def get_full_name\n \"#{get_scheduled_date} #{get_event_type}: #{rank}) #{athlete_name}, #{get_timing}\"\n end",
"def human_name\n cn = name\n\n if respond_to?(:is_dynamic_model) && is_dynamic_model || respond_to?(:is_activity_log) && is_activity_log\n cn = cn.split('::').last\n end\n\n cn.underscore.humanize.captionize\n end",
"def get_full_name\n \"#{get_scheduled_date} #{get_event_type}: #{start_list_number}) #{swimmer.get_full_name}, #{get_timing}\"\n end",
"def service_name\n self[:name].gsub(/\\.|,/, '_').gsub(/\\s/, '').underscore.to_sym if self[:name]\n end",
"def plausible_common_name; end",
"def to_s() name end",
"def to_s\n short_name\n end",
"def get_full_name\n \"#{get_scheduled_date}, #{get_event_type}: #{rank}) #{get_team_name}, #{get_timing}\"\n end",
"def fqdn\n \"#{to_label}.example.com\"\n end",
"def title_for_google\n google_title.present? ? google_title : name\n end",
"def to_label\n \"#{name}\"\n end",
"def name\n if (@replace_wildcards)\n return AvahiServiceFile.replace_wildcards(@name)\n end\n return @name\n end",
"def name\n @grpc.display_name\n end",
"def to_label\n publisher_namespace.to_s + '/' + type_path.to_s + ' (' + title.to_s + ')'\n end",
"def activity_name=(value)\n @prefix_name = value\n end",
"def name\n label\n end",
"def full_name()\n if @flow.nil?\n ':' + @name.to_s\n else\n @flow.full_name() + ':' + @name.to_s\n end\n end",
"def get_name\r\n return nil if @t2flow_model.nil?\r\n if @t2flow_model.annotations.name.empty? || @t2flow_model.annotations.name=~/^(workflow|dataflow)\\d*$/i\r\n if @t2flow_model.annotations.titles.nil? || @t2flow_model.annotations.titles.empty?\r\n return \"[untitled]\"\r\n else\r\n @t2flow_model.annotations.titles[0]\r\n end\r\n else\r\n @t2flow_model.annotations.name\r\n end\r\n end",
"def name = (name)",
"def name\n @gapi[\"displayName\"]\n end",
"def cluster_name(cluster)\n server_flavor = cluster[\"flavor\"]\n server_plan = cluster[\"plan\"] || \"free\"\n cluster_name = \"#{service_name}_#{server_flavor}_#{server_plan}\"\n cluster_name.gsub!(/\\W+/, '_')\n cluster_name\n end",
"def slack_name\n \"<@#{self.slack_id}>\"\n end",
"def attach_to_name(name)\n if preferred_form == Prefix\n s= [prefix,name].compact.join(\" \")\n else\n s = [name,suffix].compact.join(\" \")\n end\n s.strip\n end",
"def human_name\n Helpers.underscore(@name)\n end",
"def schedule_name(user)\n Rails.cache.fetch(\"#{__method__}/ver2/#{user.schedule_id}\") do\n name = user.schedule.name.gsub('schedule', 'Schedule') # fix for NTC custom schedule\n name.include?(\"Schedule\") ? name : name + \" \" + \"Schedule\"\n end\n end",
"def interface_name\n case @interface\n when nil then 'nil'\n when DNSSD::InterfaceAny then 'any'\n when DNSSD::InterfaceLocalOnly then 'local'\n when DNSSD::InterfaceUnicast then 'unicast'\n else @interface\n end\n end",
"def name\n \"#{self[:interface]} #{self[:sid]}\"\n end",
"def to_name; @name; end",
"def name\n return service_name if info.nil?\n info[:name]\n end",
"def label\n raise \"Label provider key :label must be set to produce the text of the message!\" unless @data[:label]\n @data[:label]\n end",
"def broadcast_messages\n @info = ['Gol', 'Zmiana','Żółta Kartka','Druga Żółta Kartka','Czerwona Kartka',]\n end",
"def get_basic_name(linker, bb)\n prefix = bb.get_output_prefix(linker)\n return \"#{prefix}#{bb.name}#{bb.shared_suffix(linker)}\"\n end",
"def download_label(value)\n value.tr(\"-\", \" \").capitalize\n end",
"def name\n name_parts.compact.join(' ')\n end",
"def format_name\n name ? name.observation_name : \"\"\n end",
"def name\n @gapi ? @gapi[\"name\"] : @name\n end",
"def unique_name\n return nil if ignoring_request?\n\n @unique_name ||= begin\n scope_layer = LayerConverters::FindLayerByType.new(self).scope\n if scope_layer\n scope_layer.legacy_metric_name\n else\n :unknown\n end\n end\n end",
"def name\n @gapi[\"name\"]\n end",
"def name\n @gapi[\"name\"]\n end",
"def format_name\n @site_name ? @site_name : \"\"\n end",
"def name\n \"#{self[:asn]} #{self[:vrf]} #{self[:neighbor]} #{self[:afi]} \" \\\n \"#{self[:safi]}\"\n end",
"def channel_id_to_name(data)\n channel = nil\n if @@channel_list\n channel = @@channel_list.select {|channel| channel.id == data.channel}.first\n end\n channel_name = channel != nil ? channel.name : \"nil\"\n end",
"def name\n \tself.marker_synonyms.collect{|ms| ms.name}.join(',')\n end",
"def name\n\t\tif name_source.present?\n\t\t\tproviders = [\"twitter\",\"facebook\",\"google_oauth2\",\"lastfm\",\"vimeo\"]\n\t\t\tp,v = name_source.split(\"::\",2)\n\t\t\treturn name_source unless p.in? providers\n\t\t\tl = self.links.find_by(provider: p)\n\t\t\tif l\n\t\t\t\tnames = l.names\n\t\t\t\treturn names[v.to_sym] if names.is_a? Hash and v and names[v.to_sym]\n\t\t\tend\n\t\tend\n\t\t\n\t\treturn custom_name if custom_name.present?\n\t\treturn email.split('@')[0].titleize if email.present?\n\t\tUser.default_name\n\tend",
"def name\n \"#{self[:afi]} #{self[:type]} #{self[:grp_name]}\"\n end",
"def name\n grpc.name\n end",
"def app_display_name\n CONFIG[:display_name] || \"Multigroup Events\" \n end",
"def app_display_name\n CONFIG[:display_name] || \"Multigroup Events\" \n end",
"def bus_stop_name\n bus_stop.try(:name)\n end",
"def to_s\n human_name\n end",
"def displayed_name_for(watchman)\n conns = watchman.friend_connections.where(friend: self)\n conns.present? ? conns.first.name : displayed_name\n end",
"def get_label(t)\n labels = t.counterplayers(:atype => @base_locator+\"/association/scoping\", :rtype=>@base_locator+\"/types/named_topic_type\", :otype => @base_locator+\"/types/displaylabel\" )\n for label in labels\n if $current_lang\n return get_label_in_scope(t,$current_lang)\n else\n return get_default_label(label)\n end\n end\n return get_default_label(t)\n end",
"def name\n @game_info['name']\n end",
"def nickname\n Blogical::Application.nickname\n end",
"def workflow_name(postfix)\n \"#{@obj.getName}_#{postfix.to_s.upcase}\"\n end",
"def name(type=:short)\n if type == :short && !nickname.blank?\n nickname\n elsif type == :short && displayName\n first, last = displayName.split\n \"#{first} #{last[0]}\"\n elsif type == :full && displayName\n displayName\n else\n umbcusername\n end\n end",
"def name\n @service.name.to_s\n end",
"def unique_format_name\n string_with_id(name.observation_name)\n rescue StandardError\n \"\"\n end",
"def get_tap_name(noko)\n noko.css('span')\n .first\n .children\n .first\n .to_s\n .match(/[\\w ]+\\:/)\n .to_s\n .sub(/\\:$/, '')\n end",
"def format_name(name)\n name.split(' ').join('_')\n end",
"def format_name(name)\n name.split(' ').join('_')\n end",
"def human_name\n \"reverse TCP\"\n end",
"def name\n return (@event != nil ? @event.name : '')\n end",
"def name\n @name ||= to_s.split(\"#\").last.delete(\">\")\n end"
] |
[
"0.5969148",
"0.59362423",
"0.59199756",
"0.57583636",
"0.5734359",
"0.5624824",
"0.5557625",
"0.5550942",
"0.55457973",
"0.55219597",
"0.55169463",
"0.55048835",
"0.5504671",
"0.54974896",
"0.54896873",
"0.54806745",
"0.5469429",
"0.54642653",
"0.5458646",
"0.54083604",
"0.5403388",
"0.53999317",
"0.53871745",
"0.5362655",
"0.5361839",
"0.5345998",
"0.53428465",
"0.5333414",
"0.53315663",
"0.5322339",
"0.5319152",
"0.5314247",
"0.5313598",
"0.53036815",
"0.5302767",
"0.53009003",
"0.5300526",
"0.5293893",
"0.52909124",
"0.5286733",
"0.5269955",
"0.5269698",
"0.52675724",
"0.5266935",
"0.5265122",
"0.52646214",
"0.52626246",
"0.5256223",
"0.52483577",
"0.5247914",
"0.52373964",
"0.5236153",
"0.52244234",
"0.5223954",
"0.52173924",
"0.52014405",
"0.5194486",
"0.5193946",
"0.5193249",
"0.5187244",
"0.51856184",
"0.5185132",
"0.5183622",
"0.51697224",
"0.5165685",
"0.5165614",
"0.51580167",
"0.5157736",
"0.51565623",
"0.51513875",
"0.51513153",
"0.51469433",
"0.5145275",
"0.5143206",
"0.5143206",
"0.51383746",
"0.51380014",
"0.5135404",
"0.5133845",
"0.5131126",
"0.513052",
"0.5130133",
"0.51166874",
"0.51166874",
"0.51160985",
"0.5111363",
"0.51104665",
"0.5100862",
"0.51005435",
"0.50989115",
"0.5098717",
"0.5098335",
"0.5089773",
"0.5089001",
"0.5088881",
"0.5088578",
"0.5088578",
"0.5082106",
"0.50788933",
"0.50788677"
] |
0.7227313
|
0
|
Usage: Google::Reader::Label.new('friends').entries Google::Reader::Label.new('friends').entries(:all, :n => 25) Google::Reader::Label.new('friends').entries(:unread) Google::Reader::Label.new('friends').entries(:unread, :n => 25) To use with continuations: unread = Google::Reader::Label.new('friends').entries(:unread) next_unread = Google::Reader::Label.new('friends').entries(:unread, :c => unread.continuation) The examples above would grab the first 15 unread entries and then using google reader's continuations, the next 15 unread after the first 15.
|
def entries(which=nil, o={})
options = {:n => 15,}.merge(o)
query_str = valid_keys_to_query_string(o)
url = case which.to_s
when 'unread'
sprintf(LABEL_URL, @name) + "?xt=#{State::READ}&#{query_str}"
else
sprintf(LABEL_URL, @name)
end
self.class.get_entries(url, :continuation => true)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_entries(limit = nil)\n limit ||= -1\n prepare_entries(LiveJournal::Request::GetFriendsPage.new(@user, :recent => limit, :strict => false).run)\n rescue exception_block\n end",
"def get_next_entry; end",
"def initial_unread_entries\n update unread_entries: feed.entries.count\n end",
"def read(count = limit)\n docs = redis.lrange(name, 0, count - 1)\n docs.collect { |json| entry_from_json(json) }\n end",
"def feed_entries(feed, include_read: false, page: nil)\n EntriesPagination.feed_entries feed, self, include_read: include_read, page: page\n end",
"def get_posted_news(user_id,start,count)\n numitems = $r.zcard(\"user.posted:#{user_id}\").to_i\n news_ids = $r.zrevrange(\"user.posted:#{user_id}\",start,start+(count-1))\n return get_news_by_id(news_ids),numitems\nend",
"def retrieve_notifications\n\tunread = self.notifications.where(\"read = ?\", false).order(\"created_at DESC\")\n\t\n\tif unread.count < 10\n\t\tread = self.notifications.where(\"read = ?\", true).order(\"created_at DESC\").limit(10 - unread.count)\n\t\t\n\t\tunread = unread.concat(read)\n\tend\n\t\n\treturn unread\n end",
"def li_request(n=nil,*_)\n ct = n ? convert_integer(n, \"line count\") : 1\n force_break\n ct.times do \n next_line = get_line\n put_line_paginated(next_line) if next_line\n end\n end",
"def get_latest_news(start=0,count=LatestNewsPerPage)\n numitems = $r.zcard(\"news.cron\")\n news_ids = $r.zrevrange(\"news.cron\",start,start+(count-1))\n return get_news_by_id(news_ids,:update_rank => true),numitems\nend",
"def followers(options={})\n # Not avaiable since 30.04.2015\n return []\n\n limit = options[:limit] || 5000\n fetch_all = options[:fetch_all] || false\n iteration = 0\n\n _followers = collection = user.subscribers(:limit => limit)\n max_iteration = _followers.total_count / limit + 1\n\n if fetch_all\n while iteration < max_iteration\n iteration += 1\n collection = collection.next\n _followers += collection\n end\n end\n\n _followers\n end",
"def get_followers(screen_name, page=1, per_page=20)\n result = self.class.get(\"/users/#{screen_name}/followers\", :headers => @headers)\n puts \"#{result.headers['x-ratelimit-remaining']} requests left!\"\n JSON.parse(result.body)\n end",
"def activities(start = 0, limit = 100)\n redis.call 'LRANGE', key[:activities], start, start + limit\n end",
"def show\n @entries = @feed.entries.for_user(current_user.id, @@per_page).paginate(page: params[:page], per_page: @@per_page).set_read_attribute\n @unread_entries_count = @feed.entries.for_user(current_user.id,nil).where(reads: {read: false}).count\n end",
"def more_messages\n log \"Getting more_messages\"\n log \"Old start_index: #@start_index\"\n max = @start_index - 1\n @start_index = [(max + 1 - @limit), 1].max\n log \"New start_index: #@start_index\"\n fetch_ids = search_query? ? @ids[@start_index..max] : (@start_index..max).to_a\n log fetch_ids.inspect\n message_ids = fetch_and_cache_headers(fetch_ids)\n res = get_message_headers message_ids\n with_more_message_line(res)\n end",
"def get_saved_news(user_id,start,count)\n numitems = $r.zcard(\"user.saved:#{user_id}\").to_i\n news_ids = $r.zrevrange(\"user.saved:#{user_id}\",start,start+(count-1))\n return get_news_by_id(news_ids),numitems\nend",
"def followers_history; counter_per_day(:followers); end",
"def followers(page=1)\n return get(\"/statuses/followers.json?page=#{page}\") if page == 1\n ids = []\n cursor = \"-1\"\n page.times do \n return [] if cursor == 0 \n json = get(\"/statuses/followers.json?cursor=#{cursor}\")\n cursor = json[\"next_cursor\"]\n ids = json[\"ids\"]\n end\n ids\n end",
"def entries(n=Readline::HISTORY.size)\n size=Readline::HISTORY.size\n Readline::HISTORY.to_a[(size - n)..size-1]\n end",
"def batch_messages_for_page messages, filter, request_format\n logger.info \"Getting a new page of messages\"\n\n messages.each do |message|\n filter.add(api_method: $gmail_api.users.messages.get,\n parameters: {userId: 'me', id: message.id, format: request_format})\n end\n\n begin\n filtered_message_list(filter) unless messages.empty?\n rescue StandardError => error\n puts \"*** Error : #{error.message}\"\n puts \"*** #{error.backtrace.join(\"\\n\")}\"\n\n retry if retry_it?\n end\n end",
"def index\n @feeds = current_user.subscriptions.ordered_by_title\n @entries = current_user.entries.for_user(current_user.id, @@per_page).paginate(page: params[:page], per_page: @@per_page).set_read_attribute\n @unread_entries_count = current_user.reads.where(read: false).count \n end",
"def folder_entries(folder, include_read: false, page: nil)\n EntriesPagination.folder_entries folder, self, include_read: include_read, page: page\n end",
"def decorate(n)\n size=Readline::HISTORY.size\n n_avail=[ n, size ].min\n ((size - n_avail)..size-1).zip(entries(n_avail)).map {|e| e.join(\" \")}\n end",
"def index\n @notifications = current_user.notifications.unread.page(params[:page]).per(20)\n end",
"def new_judgings(n = 100)\n\t\tresult = api_get('judgings', cid: contest_id, limit: n,\n\t\t fromid: last_judging)\n\t\tself.last_judging = result.last['id'] + 1 unless result.empty?\n\t\tresult\n\tend",
"def recent\n num_recent = 5\n entries = @@ledgers.find(\"owner\" => @sender).first['entries']\n\n if(entries.length < num_recent)\n num_recent = entries.length\n end\n\n reply = [\"Most recent ledger entries:\"]\n \n for n in 1..num_recent\n entry = entries[-n]\n reply.push(\"#{entry['action']}, #{entry['description']}, #{entry['value']}\")\n end\n\n @t.say(reply.join(\"\\n\"))\nend",
"def latest_tweets(k=5)\n\n # Get the tweets\n response = make_response(\"statuses\",\"user_timeline\")\n timeline = JSON.parse(response.body)\n tweets = timeline[0..k-1]\n\nend",
"def get_stories(stories_number=10)\n# querying the related stories to the passed interest and take only the number given in the method\n self.stories [0..stories_number-1]\n end",
"def get_stories(stories_number=10)\n# querying the related stories to the passed interest and take only the number given in the method\n self.stories [0..stories_number-1]\n end",
"def get_followers( id, login=@login, password=@password, type='json' )\n http = Net::HTTP.new('twitter.com', 80)\n $stdout.sync = true\n puts \"Trying without paging first.\"\n begin\n json_data = http.start do |http_inst|\n path = \"/statuses/followers/#{id}.#{type}\"\n print \"#{page} \"\n req = Net::HTTP::Get.new(path)\n # we make an HTTP basic auth by passing the\n # username and password\n req.basic_auth login, password\n resp, data = http_inst.request(req)\n data\n end \n results = JSON.parse( json_data )\n rescue\n puts $!.inspect\n puts \"Switching to paging.\"\n results = []\n page = 1\n loop do\n print \"Getting Followers. Page \"\n json_data = http.start do |http_inst|\n path = \"/statuses/followers/#{id}.#{type}?page=#{page}\"\n print \"#{page} \"\n req = Net::HTTP::Get.new(path)\n # we make an HTTP basic auth by passing the\n # username and password\n req.basic_auth login, password\n resp, data = http_inst.request(req)\n data\n end \n page_results = JSON.parse( json_data )\n break if page_results.length == 0\n results += page_results\n page += 1\n end\n end\n puts \n puts \n results\n end",
"def whoIsNext(names, r)\n n = -1\n while (r > 0) do\n n += 1\n section_size = 5 * (2 ** n)\n r -= section_size\n end\n section_location = section_size + r\n index = (section_location / (2 ** n).to_f).ceil - 1\n names[index]\nend",
"def following_entries\n tree.all_data[(index + 1)..-1]\n end",
"def followers(options={})\n options = {\n :count => 1000,\n :offset => 0,\n :fields => \"screen_name\"\n }.merge(options)\n\n fetch_all_method_items(:fetch_followers, options)\n end",
"def unread\n @notifications = current_user.notifications.unread.page(params[:page]).per(5)\n end",
"def index\n @entries = @wall.entries.limit(15)\n end",
"def get_messages( page=0 )\n\t result = []\n\t if page > 0\n\t response = self.class.get( '/message_threads', body: { page: page }, headers: {'authorization' => @auth_token} )\n\t JSON.parse( response.body )\n\t else\n\t response = self.class.get( '/message_threads', body: { page: 1 }, headers: {'authorization' => @auth_token} )\n for page in 1..(response[\"count\"]/10 + 1)\n response = self.class.get( '/message_threads', body: { page: page }, headers: {'authorization' => @auth_token} )\n result << JSON.parse(response.body)\n end\n result\n\t end\n\tend",
"def page_entries_info(collection, entry_name: nil)\n entry_name = if entry_name\n entry_name.pluralize(collection.size, I18n.locale)\n else\n collection.entry_name(count: collection.size).to_s.downcase\n end\n\n entry_name = entry_name.pluralize unless collection.total_count == 1\n\n # grouped response objects need special handling\n end_num = if collection.respond_to?(:groups) && view_context.render_grouped_response?(collection)\n collection.groups.length\n else\n collection.limit_value\n end\n\n end_num = if collection.offset_value + end_num <= collection.total_count\n collection.offset_value + end_num\n else\n collection.total_count\n end\n\n case collection.total_count\n when 0\n t('search_across.pagination_info.no_items_found', entry_name: entry_name).html_safe\n when 1\n t('search_across.pagination_info.single_item_found', entry_name: entry_name).html_safe\n else\n t('search_across.pagination_info.pages', entry_name: entry_name,\n current_page: collection.current_page,\n num_pages: collection.total_pages,\n start_num: view_context.number_with_delimiter(collection.offset_value + 1),\n end_num: view_context.number_with_delimiter(end_num),\n total_num: view_context.number_with_delimiter(collection.total_count),\n count: collection.total_pages).html_safe\n end\n end",
"def followers(num)\n last_followers = @client.followers\n\n end",
"def fetch_with_pagination(connection, entity, per_page)\n offset = 0\n records = []\n\n begin\n set = handle_timeouts(MAX_TIMEOUTS, \"loading tasks (offset: #{offset})\") { connection.send(entity, offset, \"yes\", \"owner,coworker,reporter\") }\n\n records += set\n offset += per_page\n end until set.empty?\n\n records\nend",
"def last_n_entries(user_id, days_request)\n id = user_id\n number = days_request\n results = $BP.execute(\n \"SELECT * FROM (SELECT * FROM bloodpressure WHERE user_id = (?)ORDER BY bp_id DESC LIMIT (?))\n ORDER BY bp_id ASC\", [id, number])\n puts \"Last #{number} entries:\"\n puts \"---------------------------------\"\n puts\n results.each do |entry|\n puts \"#{entry['date']} SYS: #{entry['systolic']} DIA: #{entry['diastolic']}\"\n end\n puts\n puts \"---------------------------------\"\n puts\nend",
"def list_entries\n\nend",
"def followers(id, page_options = default_paging_options, scope = Amico.default_scope_key)\n members(\"#{Amico.namespace}:#{Amico.followers_key}:#{scope}:#{id}\", page_options)\n end",
"def entries(limit=nil)\n limit ||= -1\n LiveJournal::Request::GetEvents.new(@user, :recent => limit, :strict => false).run\n end",
"def next_interval_index\n unread_notifications_since_last_read.count\n end",
"def get_more_users(l=1,n = nil)\n\t #u is a User in the database\n\t\t#n is the number we want to had \n\t\t#l is the level of recursivity\n\t\tif l != 0\n #call the API\n\t\t\t#fws = self.get_followers\n\t\t\tfi = self.get_following\n\t\t\t#from the API objects create databases objects \n\t users = User.set_users_from_twitter_users(fi,n)\n\t\t\tself.save!\n self.add_followings(users)\n\t users.each{|f|\n\t\t\t f.get_more_users(l-1, n)\n\t\t\t}\n\t\tend\n\t\treturn users\n end",
"def fetch(id, client, conn, cursor)\n tputs \"making a request for #{id} cursor: #{cursor}\"\n begin\n fs = client.follower_ids(id, {:cursor => cursor})\n store(fs.ids, id, conn)\n tputs \"Sleeping, length was #{fs.ids.length}\"\n sleep(60)\n rescue Twitter::Error::TooManyRequests => e\n tputs \"Rate limit exceeded, sleeping for #{e.rate_limit.reset_in}\"\n sleep(e.rate_limit.reset_in) \n retry\n end\n if fs.nil?\n return -1\n end\n return fs.next_cursor\nend",
"def get_landing_page_feeds(network, current_ids)\n # get messages from nearby area\n # messages = Undercover::CheckDistance.new(\n # params[:post_code],\n # params[:lng],\n # params[:lat],\n # current_user,\n # params[:is_landing_page]\n # ).perform\n #\n # messageIds = messages.map(&:id)\n\n if params[:is_landing_page] == 'true'\n # on landing page display only public messages within distance 15 miles.\n # Private and semi public should be hide for 15 miles\n # Display followed lines + owned lines\n # Display Joined Lines\n=begin\n messages.each { |message|\n if message.public == false\n messageIds.delete(message.id)\n end\n }\n=end\n\n # Get own lines ids\n own_messages = Message.where(user_id: current_user)\n .by_messageable_type('Network')\n .by_not_deleted\n own_message_ids = own_messages.map(&:id)\n\n # Get followed lines ids\n followed_messages = FollowedMessage.where(user_id: current_user)\n followed_message_ids = followed_messages.map(&:message_id)\n\n # Get joined lines ids\n joined_lines_ids = []\n joined_line_rooms = Room.includes(:rooms_users).where(:rooms_users => {:user_id => current_user.id})\n joined_lines_ids = joined_line_rooms.map(&:message_id)\n\n total_line_ids = followed_message_ids + own_message_ids + joined_lines_ids\n total_line_ids = total_line_ids.uniq\n\n total_messages = Message.by_ids(total_line_ids)\n .by_not_deleted\n\n #if message is line and it is type of NCL then remove total line ids\n total_messages.each { |message|\n if message.message_type == 'NONCUSTOM_LOCATION' && total_line_ids.include?(message.custom_line_id)\n ##remove message.id from followed_message ids\n followed_message_ids.delete(message.id)\n own_message_ids.delete(message.id)\n joined_lines_ids.delete(message.id)\n end\n }\n\n # messageIds = messageIds + followed_message_ids + own_message_ids + joined_lines_ids\n messageIds = followed_message_ids + own_message_ids + joined_lines_ids\n messageIds = messageIds.uniq\n end\n\n # Fetch conversation + Lines(own) + Lines(followed) + Lines(within distance even if not followed)\n # Do not show messages on Line at landing page\n # Removed messages of conversation from LP\n undercover_messages = Message\n .include_room\n .by_ids(messageIds)\n .by_not_deleted\n .without_blacklist(current_user)\n .without_deleted(current_user)\n .by_messageable_type('Network')\n .where(\"\n ((expire_date IS NULL OR expire_date > :current_date) and (message_type != 'LOCAL_MESSAGE' OR message_type is null))\n OR\n (message_type = 'LOCAL_MESSAGE' AND (updated_at > :local_message_expiry_date OR expire_date > :current_date))\",\n {\n current_date: DateTime.now,\n local_message_expiry_date: DateTime.now - 3.days\n })\n .with_images\n .with_videos\n .with_non_custom_lines\n .sort_by_last_messages(params[:limit], params[:offset])\n\n undercover_messages, ids_to_remove = Messages::CurrentIdsPresent.new(\n current_ids: current_ids,\n undercover_messages: undercover_messages,\n with_network: network.present?,\n user: current_user,\n is_undercover: params[:undercover]\n ).perform\n\n render json: {\n messages: undercover_messages, ids_to_remove: ids_to_remove\n }\n end",
"def fetch_urls_from_feedly\n yaml = YAML.load_file('env.yaml')\n client = Feedlr::Client.new(oauth_access_token: yaml['account']['feedly']['access_token'])\n client.user_subscriptions.map{|m|\n # puts m.id\n hotentries = client.stream_entries_contents(m.id, :count => 5 ).items\n return hotentries\n };\nend",
"def entries() end",
"def get_more\n @options = {\n :includeFirst => false, :limit => 10, :fetch_mode => 'normal', :fetch_focus_id => 0,\n :handle => \".endless_scroll_inner_wrap\" \n }\n\n if params.has_key? :includeFirst then\n @options[:includeFirst] = params[:includeFirst] == 'true' ? true : false \n end\n\n if params.has_key? :fetch_mode then\n if params[:fetch_mode] == 'following' then\n @options[:fetch_mode] = 'following'\n elsif params[:fetch_mode] == 'followers' then\n @options[:fetch_mode] = 'followers'\n end\n end\n\n if params.has_key? :fetch_focus_id then\n @options[:fetch_focus_id] = params[:fetch_focus_id].to_i\n end\n\n if params.has_key? :handle then\n @options[:handle] = params[:handle]\n end\n\n upper = @options[:includeFirst] ? 0..params[:last_id].to_i : 0..(params[:last_id].to_i - 1)\n\n if @options[:fetch_mode] == 'normal' then\n @next_personas = Persona.where( :id => upper).order('id desc').limit(@options[:limit])\n elsif @options[:fetch_mode] == 'following' then\n persona = Persona.find(@options[:fetch_focus_id])\n @next_personas = Persona.where(\n :id => persona.followers.where(:tracked_object_type => 'persona', \n :tracked_object_id => upper ).pluck(:tracked_object_id) \n ).order('id desc').limit(@options[:limit])\n elsif @options[:fetch_mode] == 'followers' then\n persona = Persona.find(@options[:fetch_focus_id])\n @next_personas = Persona.where(:id => Follower.where(\n :tracked_object_id => persona.id, :tracked_object_type => 'persona').pluck(:persona_id)\n ).order('id desc').group(:id).having(:id => upper)\n end\n end",
"def follow(user)\n client.search(\"#bonjour_monde\", result_type: \"recent\").take(20).collect.each {|name| client.follow(name.user.screen_name)}\nend",
"def process(limit = 10)\n i = 0\n while i < limit && (entry = pop_next_available)\n process_entry(entry)\n i += 1\n end\n i\n end",
"def unreadlist(*values)\n values.inject(self) { |res, val| res._unreadlist(val) }\n end",
"def group_feed(group_id, limit)\n Enumerator.new do |y|\n processed = 0\n current_page = group_raw_feed(group_id, @page_size)\n\n until current_page.empty? || (processed >= limit)\n current_page.each do |element|\n y << element\n processed = processed + 1\n end\n current_page = current_page.next_page\n end\n end\n end",
"def direct_messages( since_id = nil, max_id = nil , count = nil, page = nil )\n\t\tparams = (\n\t\t\t{ :since_id => since_id, :max_id => max_id, :count => count, :page => page }.collect { |n| \"#{n[0]}=#{n[1]}\" if n[1] }\n\t\t).compact.join('&')\n\t\tresponse = access_token.get('/direct_messages.json' + ( params.empty? ? '' : '?' + params ) )\n\t\tcase response\n\t\twhen Net::HTTPSuccess\n\t\t\tmessages=JSON.parse(response.body)\n\t\t\traise TwitterOauth::UnexpectedResponse unless messages.is_a? Array\n\t\t\tmessages\n\t\telse\n\t\t\traise TwitterOauth::APIError\n\t\tend\n\trescue => err\n\t\tputs \"Exception in direct_messages: #{err}\"\n\t\traise err\n\tend",
"def list(offset = 0, limit = 100)\n api.get('', offset: offset, limit: limit)\n end",
"def list(offset = 0, limit = 100)\n api.get('', offset: offset, limit: limit)\n end",
"def list(offset = 0, limit = 100)\n api.get('', offset: offset, limit: limit)\n end",
"def list(offset = 0, limit = 100)\n api.get('', offset: offset, limit: limit)\n end",
"def fetch_api_followers\n client = api_client\n\n next_cursor = nil\n api_followers = Hash[1.step(self.followers_count,20).inject([]) do |acc, a|\n options = {count: 20}\n {cursor: next_cursor}.merge!(options) if next_cursor\n response = client.user_followed_by(self.uid, options)\n next_cursor = response.fetch('pagination', {}).fetch('next_cursor', nil)\n acc + response['data'].map {|u| [u['id'], u]}\n end]\n end",
"def get_friends(req, opts)\n\tpages_of_friends = Array.new\n\ta_page_of_friends = get_a_page_of_friends(req, opts)\n\tpages_of_friends = Marshal.load(Marshal.dump(a_page_of_friends[\"data\"]))\t# Deep copy\n\twhile true do\n\t\tnext_page = a_page_of_friends[\"pagination\"][\"next\"]\n\t\tif next_page.nil?\n\t\t\tbreak\n\t\telse\n\t\t\ta_page_of_friends = get_a_page_of_friends(next_page, opts)\n\t\t\tpages_of_friends += Marshal.load(Marshal.dump(a_page_of_friends[\"data\"]))\n\t\tend\n\tend\n\tpages_of_friends\nend",
"def get_a_page_of_friends(req, opts)\n\tfriends_got = JSON.parse(Net::HTTP.get(URI(\"#{req}&access_token=#{opts[:token]}\")))\n\tunless friends_got[\"error\"].nil?\n\t\thandle_error friends_got[\"error\"]\n\tend\n\tif opts[:verbose]\n\t\tfriends_got[\"data\"].each do |f|\n\t\t\tprint \"#{f[\"display_name\"]}, \"\n\t\tend\n\tend\n\tfriends_got\nend",
"def fetch_more\n $limit += 5\n $offset_counter = ($offset_counter >= 5? $offset_counter - 5: 0)\n @room_messages = (@room.room_messages.includes(:user).order(:id).limit($limit).offset($offset_counter)).to_a.reverse()\n end",
"def fetch_followers\n cache(:expire_in => 2.hours).following\n end",
"def fetch_entries(quantity=30)\n logger.info \"#{SERVICE_NAME}: Fetching #{quantity} most recent tweets by #{self.twitter_login}\"\n Twitter::Search.new.\n from(self.twitter_login).\n per_page(quantity).\n fetch.\n results\n rescue Timeout::Error => tme\n logger.warn \"#{SERVICE_NAME}: Error fetching posts (timeout error): #{tme}\"\n []\n rescue => e\n logger.warn \"#{SERVICE_NAME}: Error fetching posts: #{e}\"\n []\n end",
"def following(id, page_options = default_paging_options, scope = Amico.default_scope_key)\n members(\"#{Amico.namespace}:#{Amico.following_key}:#{scope}:#{id}\", page_options)\n end",
"def find_entries_in_batches(options={}, &block)\n options[:count] ||= :all\n options = validate_options(options)\n mailbox = options[:mailbox]\n batch_size = options.delete(:batch_size) || 5000\n\n start do |imap|\n info \"find_entries_in_batches block\"\n info \"imap.examine #{mailbox}\"\n imap.examine(mailbox)\n info \"imap.responses #{\"UIDVALIDITY\"}\"\n validity = imap.responses[\"UIDVALIDITY\"].first\n info \"imap.examine #{options[:keys]}\"\n uids = imap.uid_search(options[:keys])\n uids.replace(options[:what].to_sym == :last ? uids.last(options[:count]) : uids.first(options[:count])) if options[:count].is_a?(Integer)\n\n if block_given?\n uids.each_slice(batch_size) do |batch|\n results = []\n info \"imap.uid_fetch #{batch} #{\"(UID FLAGS RFC822.SIZE INTERNALDATE BODY.PEEK[HEADER.FIELDS (MESSAGE-ID)])\"}\"\n imap.uid_fetch(batch, \"(UID FLAGS RFC822.SIZE INTERNALDATE BODY.PEEK[HEADER.FIELDS (MESSAGE-ID)])\").each do |data|\n uid = data.attr['UID'].to_i\n flags = data.attr['FLAGS'].map {|flag| flag.to_s.downcase.to_sym}\n message_size = data.attr['RFC822.SIZE'].to_i\n message_date = Time.parse(data.attr['INTERNALDATE'])\n all, message_id = *(data.attr['BODY[HEADER.FIELDS (MESSAGE-ID)]'].match(/.*<(.*)>.*/))\n results << Entry.new(folder: mailbox, validity: validity, uid: uid, flags: flags, message_size: message_size, message_date: message_date, message_id: message_id)\n end\n yield results\n end\n end\n end\n end",
"def entries user_id, num = 1, offset = 0, day = 30000000\n ActivityEntry.recent_most user_id, self.id, num, offset, day\n end",
"def followers_by_page( user=nil, page = 1 )\n\t\twarn \"[DEPRECATION] the page parameter ot the twitter API has been deprecated as of 26-Oct-2009. use 'followers_by_cursor' method instead.\"\n\t\tparams = (\n\t\t\t{ :screen_name => user, :page => page }.collect { |n| \"#{n[0]}=#{n[1]}\" if n[1] }\n\t\t).compact.join('&')\n\t\turl = \"/statuses/followers.json?#{params}\"\n\t\tresponse = access_token.get( url )\n\t\tcase response\n\t\twhen Net::HTTPSuccess\n\t\t\tfriends=JSON.parse(response.body)\n\t\t\traise TwitterOauth::UnexpectedResponse unless friends.is_a? Array\n\t\t\tfriends\n\t\telse\n\t\t\traise TwitterOauth::APIError\n\t\tend\n\trescue => err\n\t\tputs \"Exception in followers_by_page: #{err}\"\n\t\traise err\n\tend",
"def get_all_entries\n entries = []\n\n page_number = 0\n while true\n page_entries = get_entries_by_page(page_number)\n entries.concat(page_entries)\n\n # give up once we get a non-full page\n break if page_entries.length < PAGE_SIZE\n\n # continue to the next page\n page_number += 1\n end\n\n entries.map { |e| normalize_entry(e) }\nend",
"def page_entries_info(collection, options = {})\n entry_name = I18n.t('layout.search.result')\n if collection.total_pages < 2\n case collection.size\n when 0; I18n.t('general.common_word.no1').capitalize+\" #{entry_name}\"\n when 1; \"<b>1</b> #{entry_name}\"\n else; I18n.t('layout.search.displaying').capitalize+\" <b>#{collection.size}</b> #{entry_name.pluralize}\"\n end\n else\n %{#{I18n.t('layout.search.displaying').capitalize} #{entry_name.pluralize} <b>%d - %d</b> #{I18n.t('general.common_word.of')} <b>%d</b> #{I18n.t('general.common_word.found')}} % [\n collection.offset + 1,\n collection.offset + collection.length,\n collection.total_entries\n ]\n end\nend",
"def get_follower_ids( id, login=@login, password=@password, type='json' )\n http = Net::HTTP.new('twitter.com', 80)\n \n begin\n json_data = http.start do |http_inst|\n if id.class == Fixnum\n path = \"/followers/ids/ids.#{type}?user_id=#{id}\"\n else \n path = \"/followers/ids/#{id}.#{type}\"\n end\n req = Net::HTTP::Get.new(path)\n \n # we make an HTTP basic auth by passing the\n # username and password\n req.basic_auth login, password\n \n resp, data = http_inst.request(req)\n data\n end\n # puts data\n hash_data = JSON.parse( json_data )\n if hash_data.class == Hash && hash_data[\"error\"]\n return []\n end\n results = hash_data\n rescue\n puts \"Switching to paging.\"\n results = []\n page=1\n loop do\n json_data = http.start do |http_inst|\n if id.class == Fixnum\n path = \"/followers/ids/ids.#{type}?user_id=#{id}&page=#{page}\"\n else \n path = \"/followers/ids/#{id}.#{type}?page=#{page}\"\n end\n req = Net::HTTP::Get.new(path)\n \n # we make an HTTP basic auth by passing the\n # username and password\n req.basic_auth login, password\n \n resp, data = http_inst.request(req)\n data\n end\n # puts data\n hash_data = JSON.parse( json_data )\n if hash_data.class == Hash && hash_data[\"error\"]\n return []\n end\n puts \"page #{page} (5000 per page)\"\n results += hash_data\n break if hash_data.length == 0\n page += 1\n end\n \n end\n results \n end",
"def get_latest_activity_paged(reference_index, page = 1, page_size = 10)\n return nil unless activity_count > 0\n start_index = reference_index - (page * page_size)\n start_index += page_size if start_index <= 0\n end_index = start_index - (page * page_size) + 1\n end_index = 1 if end_index < 1\n\n # generate list of keys for the activity range (i.e. latest 10)\n keys = []\n start_index.downto(end_index) do |i|\n keys.push(DOCS[:latest_activity_stub] + i.to_s)\n end\n\n Rails.logger.debug(intense_red(\"activity: #{start_index}..#{end_index}\"))\n\n # retrieve the all activity documents in one call\n activity_docs = DocumentStore.get_documents(keys)\n\n Rails.logger.debug(intense_red(activity_docs.inspect))\n # now take all the uid's from activities and create an array of uid's\n keys = []\n activity_docs.each do |activity|\n keys.push(activity[:uid])\n end\n\n # load the users into an array\n users = get_multiple_users_by_uid(keys)\n\n # finally, combine the users into the activity docs and the item_indexes based on page\n # i'm using the index with activity_docs to avoid confusion,\n # I could also use \"activity\" in the do loop: activity[:user] = users[i]\n activity_docs.each_with_index do |activity, i|\n activity_docs[i][:item_index] = (page * i) + i # page_size == 10 : page = 1 => 1, 2, 3,... page = 2 => 10, 11, 12\n activity_docs[i][:user] = users[i]\n end\n\n activity_docs\n end",
"def pluralize(locale, entry, count); end",
"def get_top_news(start=0,count=TopNewsPerPage)\n numitems = $r.zcard(\"news.top\")\n news_ids = $r.zrevrange(\"news.top\",start,start+(count-1))\n result = get_news_by_id(news_ids,:update_rank => true)\n # Sort by rank before returning, since we adjusted ranks during iteration.\n return result.sort_by(&:rank), numitems\nend",
"def get_followers(auth = auth_http())\n TwBot.followers_of(auth)\n end",
"def get_next_friends_batch\n # Get all friends & sort by their user IDs.\n DaemonKit.logger.debug \"All friends: #{sorted_friend_ids.inspect}\"\n \n # Check Redis for last friend processed\n idx = 0\n if last_friend = @redis.get(last_friend_processed_key_name)\n DaemonKit.logger.debug \"Got value from Redis cache: #{last_friend}\"\n # If last processed friend found, start at the next index\n if idx = sorted_friend_ids.index(last_friend.to_i)\n idx += 1\n else\n idx = 0\n end\n end\n idx = 0 if idx >= (sorted_friend_ids.size - 1)\n \n DaemonKit.logger.debug \"Returning friends from index #{idx}\"\n # Return at most MAX_FRIENDS_PER_POSTS_BACKUP friends - don't wrap for now\n sorted_friend_ids.slice(idx, MAX_FRIENDS_PER_POSTS_BACKUP)\n end",
"def fetch_timeline(screen_name)\n return [] if screen_name.to_s.empty?\n @requests += 1\n timeline = client.user_timeline(screen_name, tweet_mode: 'extended', count: 200)\n return timeline if timeline.empty?\n timeline = fetch_older_tweets(timeline, screen_name)\n puts \"Fetched #{screen_name}'s timeline\"\n timeline\n end",
"def get_more\n @reserve = get_chain\n last_link = @reserve\n count = @page_size / 100\n count = 15 if count < 15\n while(count > 0)\n last_link = get_next_for(last_link)\n count -= 1\n end\n @next_object = get_next_for(last_link)\n set_next_for( last_link , nil )\n self\n end",
"def get_next_entry(lines)\n entry_lines = lines.take_while {|line| line.size > 0 }\n newlines = lines[entry_lines.size..-1]\n newlines.shift # the space\n [entry_lines.join(\" \"), newlines]\nend",
"def fetch_unread_items(folder)\n item_view = ItemView.new(10) # FIXME: some huge number like 5000, but the JS app is too slow for that\n item_view.property_set = EMAIL_SUMMARY_PROPERTY_SET\n folder.find_items(SearchFilter::IsEqualTo.new(EmailMessageSchema::IsRead, false), item_view).items.to_a\n end",
"def latest_entries\n unless @latest_entries\n @latest_entries = Rails.cache.fetch([@account.cache_key, '/latest_entries'], :expires_in => 10.minutes) do\n Entry.paginate(:all, :from => \"/accounts/#{@account.account_resource_id.to_s}/entries.xml\", :params => { :page => 1, :per_page => 5}) \n end\n end\n @latest_entries\n end",
"def get_entries_by_page(page_number)\n key = ENTRIES_CACHE_KEY_PREFIX + page_number.to_s\n cached_response = REDIS.get(key)\n\n # decompress and return the cached response if it's already in redis\n if cached_response != nil\n return JSON.parse(gunzip(cached_response))\n end\n\n # otherwise, fetch and cache it\n resp = HTTParty.get(FORM_URL_BASE + \"entries.json\", query: {\n pageSize: PAGE_SIZE,\n pageStart: PAGE_SIZE * page_number,\n }, basic_auth: WUFOO_AUTH)\n\n # make sure we got a good response\n throw \"Wufoo response error: #{resp.code}\" if resp.code != 200\n\n # cache the response value\n entries = []\n REDIS.multi do\n entries = resp[\"Entries\"] || entries\n\n # compress the entry data with GZip to increase the amount we can store in\n # our free Redis instance. it seems to compress _extremely_ well, down to 4%\n # of its original size in one instance!\n data = JSON.generate(entries)\n REDIS.set(key, gzip(data))\n\n # if the page was not full, expire the key after a short time so we'll\n # re-fetch the page in the future to check for new entries. this also\n # protects against constantly re-polling for the latest page.\n if entries.length < PAGE_SIZE\n REDIS.expire(key, PARTIAL_PAGE_CACHE_TIME)\n else\n # expire full pages after a while too, to ensure that we have relatively\n # up-to-date data at all times.\n REDIS.expire(key, FULL_PAGE_CACHE_TIME)\n end\n end\n\n entries\nend",
"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 more_messages(message_id, limit=100)\n log \"More_messages: message_id #{message_id}\"\n message_id = message_id.to_i\n if @all_search \n x = [(message_id - limit), 0].max\n y = [message_id - 1, 0].max\n\n res = fetch_row_text((x..y))\n add_more_message_line(res, x)\n else # filter search query\n log \"@start_index #@start_index\"\n x = [(@start_index - limit), 0].max\n y = [@start_index - 1, 0].max\n @start_index = x\n res = fetch_row_text(@ids[x..y]) \n add_more_message_line(res, @ids[x])\n end\n end",
"def mail_unread\n initialize_mocks if @fake\n\n service = Google::Apis::Core::BaseService.new('https://mail.google.com/', 'mail/feed/atom/')\n service.authorization = user_authorization\n service.http(:get, 'https://mail.google.com/mail/feed/atom/')\n end",
"def get_following_page(username, page, per_page, auth_user = nil, auth_token = nil)\n github_get_paginated(username, GITHUB_FOLLOWING_USERS_ENDPOINT, page, per_page, auth_user, auth_token)\n end",
"def fetch_previous_entries\n batch_id = BatchRegistries.where(replay_name: @current_package.title).first.id\n BatchEntries.where(batch_registries_id: batch_id)\n end",
"def collect_followers twitter_id\n while @@client.application.rate_limit_status?.resources.followers.send(\"/followers/ids\").remaining == 0\n puts \"collect friends waiting...\"\n sleep(60) \n end\n \n begin\n puts \"COLLECTING Follower IDS OF #{twitter_id}\"\n result = @@client.followers.ids? :id => twitter_id, :cursor => -1\n follower_ids = result.ids\n old_cursor = 0\n next_cursor = result.next_cursor\n while old_cursor != next_cursor and next_cursor != 0\n old_cursor = next_cursor\n result = @@client.followers.ids? :id => twitter_id, :cursor => next_cursor\n follower_ids += result.ids\n next_cursor = result.next_cursor\n end \n rescue\n follower_ids = []\n tmp_person = @@client.users.show? :id => twitter_id\n SystemMessage.add_message(\"error\", \"Collect Followers\", \"Followers of Person with twitter id: \" + tmp_person.screen_name + \" could be not found.\") \n end\n if follower_ids != [] \n follower_ids_hash = Hash.new(0)\n store = PStore.new(FOLLOWER_IDS_PATH + twitter_id.to_s)\n store.transaction{store[twitter_id] = follower_ids_hash} #empty store if updating\n follower_ids.each do |follower_id|\n follower_ids_hash[follower_id] = 1 \n end\n store.transaction{store[twitter_id] = follower_ids_hash} #store values\n end\n end",
"def followers_count(id, scope = Amico.default_scope_key)\n Amico.redis.zcard(\"#{Amico.namespace}:#{Amico.followers_key}:#{scope}:#{id}\")\n end",
"def unread_count( params={} )\n unread_count = get_connections(\"unread_count\", params)\n return map_connections unread_count, :to => Facebook::Graph::Generic\n end",
"def sync_paged_history(channel, page, limit, include_token, callback, timetokens)\n envelopes = []\n page.times do |_i|\n envelope = history(\n channel: channel,\n include_token: include_token,\n http_sync: true,\n count: limit,\n start: timetokens[:start],\n end: timetokens[:end]\n )\n\n break if envelope.result[:data][:messages].empty?\n\n envelopes.push envelope\n timetokens[:start] = envelope.result[:data][:start].to_i\n # No need to iterate further if there is no more messages.\n break if envelope.result[:data][:messages].length < limit\n end\n\n call_callback(envelopes, callback)\n end",
"def rl_beginning_of_history(count, key)\r\n rl_get_previous_history(1 + where_history(), key)\r\n end",
"def nextIngredients\n @searchItems = Item.nextItems params[:start], params[:page], 9\n render template: 'common/search/js/nextSearchIngredients.js'\n end",
"def getEmails\n begin\n puts 'attempting to connect to ' + @username + '@gmail.com'\n Gmail.new(@username, @password) do |gmail|\n puts 'connection established'\n #use peek to make emails not be automatically marked as read\n gmail.peek = (@peek === 'true' ? true : false)\n\n if @label == \"none\"\n inbox = gmail.inbox\n boxname = 'inbox'\n else\n inbox = gmail.mailbox(@label)\n boxname = @label + ' box'\n end\n number_unread = inbox.count(:unread)\n if number_unread < 1\n abort(\"There are no new messages in the \" + boxname)\n end\n p \"there are \" + number_unread.to_s + \" unread emails in the \" + boxname\n inbox.emails(:unread).each do |email|\n puts parser(email)\n end\n end\n\n rescue Net::IMAP::NoResponseError\n puts 'connection failed, check your config file for incorrect credentials'\n puts 'perhaps you opted to use a label that doesn\\'t exist, try \"none\" instead'\n end\nend",
"def get_entries\n @page.all(input_elements[:entries])\n end",
"def last_cmds(n=1)\n puts Readline::HISTORY.entries[-(n+1)..-2].join(\"\\n\")\nend",
"def list_of_messages()\n\t\t\n\t\t#Create a new request\n\t\trequest_url = \"https://www.googleapis.com/gmail/v1/users/#{@email}/messages?labelIds=Label_1&access_token=#{@access_token}\"\n\n\t\t#GET REQUEST\n\t\tresponse = RestClient.get request_url\n\t\tresponse_body = JSON.parse(response.body)\n\n\t\t#Looping through all the Messages and grabbing id\n\t\tmessages= Array.new\n\n\t\ttemp = response_body['messages']\n\t\ttemp.each do |item|\n\t\t\tmessages.push(item['id'])\n\t\tend \n\t\n\t\treturn messages\n\tend",
"def list_items(o)\n aux = \"\"\n o[:start] = 0 if o[:start] < 0\n items,count = o[:get].call(o[:start],o[:perpage])\n items.each{|n|\n aux << o[:render].call(n)\n }\n last_displayed = o[:start]+o[:perpage]\n if last_displayed < count\n nextpage = o[:link].sub(\"$\",\n (o[:start]+o[:perpage]).to_s)\n aux << H.a(:href => nextpage,:class=> \"more\") {\"[more]\"}\n end\n aux\nend",
"def index\n @reader_requests = BookRequest.get_holder_requests_by_account(@account).paginate(page: params[:page])\n end",
"def offset(count)\n Fetcher.new(self).offset(count)\n end"
] |
[
"0.54353607",
"0.53896016",
"0.5341011",
"0.5337799",
"0.5326041",
"0.51987106",
"0.5083683",
"0.5060455",
"0.5052474",
"0.5021779",
"0.5020245",
"0.49735343",
"0.4968922",
"0.4966228",
"0.49256212",
"0.49205467",
"0.49009368",
"0.48384634",
"0.48378083",
"0.4820481",
"0.48199722",
"0.47963488",
"0.47901994",
"0.47856182",
"0.47725648",
"0.47682506",
"0.47625884",
"0.47625884",
"0.47469154",
"0.4741975",
"0.47258487",
"0.4725802",
"0.47229823",
"0.4706368",
"0.46834284",
"0.46833238",
"0.46829927",
"0.46822825",
"0.4679526",
"0.46758553",
"0.46754298",
"0.46702284",
"0.4665659",
"0.46642452",
"0.4658016",
"0.46361753",
"0.46306822",
"0.46253785",
"0.46099478",
"0.46097702",
"0.4591925",
"0.45895526",
"0.45831707",
"0.45746097",
"0.45733374",
"0.45733374",
"0.45733374",
"0.45733374",
"0.45671564",
"0.45585993",
"0.45582584",
"0.45354742",
"0.45353106",
"0.45207757",
"0.45185533",
"0.451801",
"0.45167577",
"0.45163518",
"0.45057067",
"0.45035228",
"0.44943765",
"0.4487086",
"0.44843158",
"0.44827187",
"0.44752494",
"0.44715476",
"0.44715363",
"0.44713768",
"0.44689426",
"0.44672087",
"0.4463734",
"0.44541985",
"0.4453252",
"0.4451662",
"0.44456777",
"0.44418335",
"0.44384044",
"0.44309402",
"0.44233382",
"0.44213966",
"0.44205987",
"0.44196558",
"0.4415598",
"0.4415146",
"0.44148743",
"0.44125363",
"0.44081497",
"0.44065613",
"0.44033897",
"0.44033238"
] |
0.6037697
|
0
|
Converts a hash to a query string but only keys that are valid
|
def valid_keys_to_query_string(o)
str = ''
o.each { |k,v| str << "#{k}=#{v}&" if VALID_KEYS.include?(k) }
str
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def hash_to_query_string(hash)\n hash.delete \"password\"\n hash.delete \"password_confirmation\"\n hash.collect {|k,v| \"#{k}=#{v}\"}.join(\"&\")\n end",
"def hash_to_query_string(hash)\n hash.delete \"password\"\n hash.delete \"password_confirmation\"\n hash.collect {|k,v| \"#{k}=#{v}\"}.join(\"&\")\n end",
"def hash_to_query_string(hash)\n hash.delete 'password'\n hash.delete 'password_confirmation'\n hash.collect { |k, v| \"#{k}=#{v}\" }.join('&')\n end",
"def hash_to_querystring(hash)\n hash.keys.inject('') do |query_string, key|\n query_string << '&' unless key == hash.keys.first\n query_string << \"#{URI.encode(key.to_s)}=#{URI.encode(hash[key])}\"\n end\n end",
"def to_query_string(hash)\n hash.map do |key, value|\n \"#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}\"\n end.join(\"&\")[/.+/]\n end",
"def querinize(hash)\n \"?\" + hash.map { |k, v| \"#{k}=#{URI.encode(v.to_s)}\" }.join(\"&\")\n end",
"def hash_to_query_string(h)\n if qs = URI.escape(h.to_a.map{|e| e.join('=') }.join('&'))\n '?' + qs\n else\n ''\n end\n end",
"def build_query_string(hash)\n elements = []\n query_string = \"\"\n\n hash.each do |key, value|\n\t key = CGI.escape key\n\t key += '[]' if value.class == Array\n\t value = [ value ] unless value.class == Array\n\t value.each { |val| elements << \"#{key}=#{CGI.escape(val.to_s)}\" }\n\tend\n unless elements.empty? then query_string << (\"?\" + elements.join(\"&\")) end\n \n return query_string\n end",
"def format_hash_as_query_string(query_params)\n # replace Ruby => assignment operators with JSON standard colons (:)\n sanitized_params = query_params.to_s.gsub(/=>/, ':')\n CGI.escape(sanitized_params)\n end",
"def hash_query hash\n\t\t\tx = []\n\t\t\thash.each {|l,m| Array(m).each {|a| x << \"#{l}=#{a}\"}}\n\t\t\t\"?#{x.join(\"&\")}\"\n\t\tend",
"def to_query(hash)\n query = []\n hash.each do |key, value|\n query << \"#{key.to_s}=#{value.to_s}\"\n end\n query.join('&')\n end",
"def create_query_string(hash)\n parts = hash.map {|key,value| \"#{CGI.escape(key)}=#{CGI.escape(value)}\"}\n return parts.join('&')\n end",
"def sanitize_hash(hash)\n Hash[hash.collect { |k, v| [k.to_s, v.is_a?(Hash) ? sanitize_hash(v) : v] }]\n end",
"def parameterize(hash)\n hash.map { |key, value| \"#{key}=#{value}\" }.join \"&\"\n end",
"def format_param_hash(param_hash)\n param_str = ''\n param_hash.each do |key, value|\n param_str << \"#{key.shellescape}=#{value.shellescape} \"\n end\n param_str.strip\n end",
"def hash2cgiString(h)\r\n # Order the keys alphabetically. It's not strictly necessary but makes\r\n # output easier to determine (helps testing)\r\n # This requires that the keys be strings, since symbols aren't sortable\r\n h2 = {}\r\n h.each {|key, value| h2[key.to_s] = value}\r\n alpha_keys = h2.keys.sort\r\n \r\n # Escape all the values first\r\n alpha_keys.each {|key| h2[key] = CGI::escape(h2[key].to_s) if (h2[key])}\r\n \r\n # Create the string\r\n alpha_keys.collect {|key| \"#{key}=#{h2[key]}\"}.join('&')\r\n end",
"def correct_hashed_params\n params = {}\n @params.each do |key, value|\n if key.scan(/([a-zA-Z]*)\\[([a-zA-Z]*)\\]/).size > 0\n r = key.scan(/([a-zA-Z]*)\\[([a-zA-Z]*)\\]/).first\n params[r.first] = {} if params[r.first].nil?\n params[r.first][r.last] = value\n else\n params[key] = value\n end\n end\n return params\n end",
"def qs_to_hash(query)\n keyvals = query.split('&').inject({}) do |result, q|\n k,v = q.split('=')\n if !v.nil?\n result.merge({k => v})\n elsif !result.key?(k)\n result.merge({k => true})\n else\n result\n end\n end\n keyvals\n end",
"def from_query_to_hash\n hash = CGI::parse(self)\n hash.each do |key, val|\n hash[key] = val[0] if val and val.length == 1\n end\n hash\n end",
"def query_formatter(hash)\n params_str = []\n \n hash.each do |key, value|\n params_str << key.to_s + \"=\" + value.to_s\n end\n\n yield params_str\n end",
"def params_string(params_hash)\n params_hash.keys.map do |k|\n [ Rack::Utils.escape(k.to_s),\n Rack::Utils.escape(params_hash[k].to_s)\n ] * '='\n end * '&'\n end",
"def form_encoded(hash)\n encoded = []\n hash.each do |key, value|\n encoded << CGI.escape(key) + '=' + CGI.escape(value)\n end\n return encoded.join('&')\n end",
"def escape_hash( hash )\n hash.each_pair {\n |k, v|\n hash[k] = escape( hash[k] ) if hash[k].is_a?( String )\n hash[k] = escape_hash( v ) if v.is_a? Hash\n }\n\n return hash\n end",
"def parameters_as_string(hash)\n hash.keys.sort.map{|key| %{#{key}=#{hash[key]}}} * '&'\n end",
"def query_string_to_hash query_string\n Hash[*query_string.scan(/(.+?)=(.*?)(?:&|$)/).flatten].each_value {|v|\n v.gsub!('+', ' ')\n v.gsub!(/%([0-9a-f]{2})/i) { [$1.hex].pack 'C' }\n }\nend",
"def uri_query(h)\n a = Array.new()\n h.each_pair {|key, val| a.push(URI.escape(key) + \"=\" + URI.escape(val)) }\n return a.join(\"&\")\n end",
"def stringify_hash_keys(hash); end",
"def validate_query_hash(query, hash)\n validate_query(query)\n validate_hash(hash)\n end",
"def encode(hash)\n return hash.collect do |key, value|\n CGI.escape(key) + \"=\" + CGI.escape(value.to_s)\n end.join(\"&\")\n end",
"def encode(hash)\n return hash.collect do |key, value|\n CGI.escape(key) + \"=\" + CGI.escape(value.to_s)\n end.join(\"&\")\n end",
"def encode(hash)\n return hash.collect do |key, value|\n CGI.escape(key) + \"=\" + CGI.escape(value.to_s)\n end.join(\"&\")\n end",
"def sanitize_hash(hash)\n return {} if hash.nil? \n Hash.from_xml(hash.to_xml)['hash']\n end",
"def normalize_params(h = nil)\n h = params unless h.is_a?(Hash)\n hn = {}\n re = /.+_id$/i\n \n h.each do |hk, hv|\n case hv\n when ActionController::Parameters\n hv = normalize_params(hv.to_h)\n when Hash\n hv = normalize_params(hv)\n end\n\n hn[hk.to_sym] = hv\n shk = hk.to_s\n hn[\"_#{shk}\".to_sym] = (hv.is_a?(String) ? hv.dup : hv) if (shk == 'id') || (shk =~ re)\n end\n\n hn\n end",
"def to_query(key)\n \"#{CGI.escape(key.to_param)}=#{CGI.escape(to_param.to_s)}\"\n end",
"def query_values\n CGI.parse(parsed_url.query || \"\").inject({}) do |hash, (key, values)|\n hash.merge!(key.to_sym => values.first)\n end\n end",
"def parse_query_string(query)\n Hash[CGI.parse(query).map {|key,values| [key, values[0]]}]\n end",
"def params(query_string)\n begin\n params_prime = query_string.split('&').inject({}) { |h,(k,v)|\n values = k.split('=')\n # Drop any query params that have blank values\n h[values[0].downcase.intern] = (CGI.unescape(values[1])).downcase if values.length == 2 \n h\n }\n rescue NoMethodError => e\n params_prime = Hash.new\n end\n params_prime\n end",
"def hash_to_urlencoded_str(hash = {}, delim, join_with)\n\t\t\t\thash.map{|k,v| \n\t\t\t\t\t\"#{urlencode(k)}#{delim}#{urlencode(v)}\"}.join(\"#{join_with}\")\n\t\t\tend",
"def convert_parameters_into_suitable_url_query_string\n exclude_list = [\n 'controller',\n 'action',\n 'locale',\n 'format'\n ]\n\n converted_params = ActionController::Parameters.new\n\n self.map do |key, map|\n unless exclude_list.include?(key)\n converted_params[key] = map\n end\n end\n\n query_string = converted_params.to_query\n\n return query_string\n end",
"def clean_hash hash\n hash ||= {}\n hash = hash.map do |k,v|\n if v.is_a? Hash\n [k,clean_hash(v)]\n else\n [k,v]\n end\n end\n hash = Hash[hash]\n Hash[hash.select do |k,v|\n if v.is_a? Hash\n v.size > 0\n else\n v.present?\n end\n end]\n end",
"def clean_unwanted_keys(hash)\r\n ignored_keys = [:only_path, :use_route]\r\n hash.dup.delete_if{|key,value| ignored_keys.include?(key)}\r\n end",
"def param_hash_to_link_hash hash\n hash = hash.dup\n if klass = hash[:model] && model( hash[:model] )\n if hash[:filter]\n f = hash[:filter].dup\n defaults = klass.filter_defaults\n f.delete_if {|k,v| defaults[k] == v }\n hash[:filter] = f\n end\n if hash[:sort].to_s == klass.sort_column.to_s && hash[:sort_reverse] == klass.sort_reverse\n hash.delete :sort\n hash.delete :sort_reverse\n end\n end\n hash.stringify_keys!\n # FIXME: This should handle deeper hash hierarchies, and arrays.\n hash.select {|k,v| v.is_a? Hash }.each do |k,v|\n hash.delete k\n v.each { |k2,v2| hash[\"#{k}[#{k2}]\"] = v2 }\n end\n hash\n end",
"def to_s\n params.reduce([]) do |memo, obj|\n key, value = obj\n memo.push(\"#{key}=#{value}\") if value.present?\n memo\n end.join('&')\n end",
"def query_to_hash(query)\n Hash[CGI.parse(query).map {|key,values| [key, values[0]||true]}]\n end",
"def clean_params(params)\n params.each_with_object({}) do |(param, value), acc|\n next if param.nil? || value.nil?\n next unless param.respond_to?(:to_sym) && value.respond_to?(:to_s)\n acc[param.to_sym] = value.to_s\n end\n end",
"def to_query(params)\n params.to_query.gsub(\"=\", \"%3D\").gsub(\"&\", \"%26\")\n end",
"def sanitize_keys(hash)\n new_hash = Hash.new\n hash.each do |key,value|\n sanitized_key = key.downcase.tr(\" \", \"_\")\n\n if value.is_a? Hash\n new_hash[sanitized_key] = sanitize_keys(value)\n else\n new_hash[sanitized_key] = value\n end\n end\n return new_hash\n end",
"def comparable_query_params\n @query_parameters.each_with_object({}) do |(k,v),hash| \n hash[k.to_s] = v.nil? ? v : v.to_s\n end\n end",
"def normalize(params)\n params.sort.map do |k, values|\n if values.is_a?(Array)\n # make sure the array has an element so we don't lose the key\n values << nil if values.empty?\n # multiple values were provided for a single key\n values.sort.collect do |v|\n [escape(k),escape(v)] * \"=\"\n end\n elsif values.is_a?(Hash)\n normalize_nested_query(values, k)\n else\n [escape(k),escape(values)] * \"=\"\n end\n end * \"&\"\n end",
"def query_string\n pairs = []\n @params.sort.each { | key, val | \n pairs.push( \"#{ percent_encode( key ) }=#{ percent_encode( val.to_s ) }\" )\n }\n pairs.join '&'\n end",
"def clean_query_string(q)\n ERB::Util.url_encode(q.gsub(/-|\\(|\\)|:/, \"\"))\n end",
"def to_query_string(params)\n params.map do |key, value|\n \"#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}\"\n end.join('&')\n end",
"def extract_parameters( queryhash, key=nil )\n\t\tprofile = @applet.signature.validator_profiles[ @action ] ||\n\t\t\t@applet.signature_profiles[ :__default__ ]\n\t\tvalidator = Arrow::FormValidator.new( profile )\n\t\t\n\t\tvalidator.validate( queryhash )\n\n\t\tif key\n\t\t\treturn validator.valid[ key ]\n\t\telse\n\t\t\treturn validator.valid\n\t\tend\n\tend",
"def parse_params\n params_str.empty? ? BLANK_HASH : CGI::parse(params_str).inject({}) do |hash, (param, value)|\n hash[param] = if value.is_a?(Array) and value.size == 1 and param !~ /\\[\\d*\\]$/\n value[0]\n else\n value\n end\n hash\n end\n end",
"def get_real_qs_and_hash_fragment(params, escape)\n raise TypeError, 'params must be a Hash or respond to #to_h or #to_hash' unless params.is_a?(Hash) || params.respond_to?(:to_h) || params.respond_to?(:to_hash)\n params = params.to_h rescue params.to_hash\n \n query_params = params.dup\n query_params.delete('_escaped_fragment_')\n query_params = query_params.to_a\n \n query_string = ''\n unless query_params.empty?\n query_params.collect! { |key, value| [ Addressable::URI.escape(key), Addressable::URI.escape(value) ] } if escape\n query_params.collect! { |key, value| \"#{key}=#{value}\" }\n \n query_string = \"?#{ query_params.join(?&) }\"\n end\n \n hash_fragment = params['_escaped_fragment_']\n hash_fragment_string = ''\n hash_fragment_string = \"#!#{hash_fragment}\" unless hash_fragment.nil?\n \n {\n 'qs' => query_string,\n 'hash' => hash_fragment_string\n }\n end",
"def query_string\n pairs = []\n @params.sort.each { | key, val |\n pairs.push( \"#{ percent_encode( key ) }=#{ percent_encode( val.to_s ) }\" )\n }\n pairs.join '&'\n end",
"def extract_query_attributes(hash)\n query = hash.select{ |key, value| !link_attributes.include?key }.flatten\n Hash[*query] unless query.empty?\n end",
"def sanitize_params(params = params)\n params = walk_hash(params) if params\n end",
"def unsigned_query_string_stripped\n @query_params_text ||= obj_to_stripped_string(query_params)\n end",
"def secure_hash\r\n params['secureHash']\r\n end",
"def build_param_string(param_hash)\n return \"\" if param_hash.nil?\n sorted = param_hash.sort do |a,b|\n a.to_s <=> b.to_s\n end\n params = \"\"\n sorted.each do |key,val|\n params += key.to_s + val.to_s\n end\n params\n end",
"def params_to_hidden(*keys)\n required = params.symbolize_keys\n required = required.slice(*keys) unless keys.empty?\n\n return '' if required.empty?\n\n hash_to_hidden(required)\n end",
"def to_str_form(hash)\n hash.inject({}) do |h, (k, v)|\n h.merge((k.is_a?(Symbol) ? k.to_s : k) => (v.is_a?(Symbol) ? v.to_s : v))\n end\n end",
"def stringify_hash hash, options = {}\n (raise ExpectationFailedError.new(\"stringify_hash called without a hash\")) unless hash.is_a?(Hash)\n hash.inject({}) do |result, (k,v)|\n key = options[:downcase] ? k.to_s.downcase : k.to_s\n if v.is_a?(Hash) then\n result[key] = stringify_hash(v)\n elsif v.is_a?(Regexp) && options[:rewrite_regex] then\n result[key] = v.inspect[1..-2]\n else\n result[key] = v\n end\n result\n end\n end",
"def compact_hash(hash)\n hash.delete_if { |key, value| value.blank? }\n end",
"def normalize_request_param(params_hash, get_post_params_hash)\n normalized_request_param = \"\"\n total_params_hash = {}\n params_hash.each_pair{|key, value|\n total_params_hash[key.to_s] = value.to_s\n }\n get_post_params_hash.each_pair{|key, value|\n total_params_hash[key.to_s] = value.to_s\n }\n total_params_hash.sort.each{|token|\n next if token[0] == \"realm\"\t# skip 'realm' parameter\n normalized_request_param += \"&\" if normalized_request_param.length > 0\n normalized_request_param += \"#{token[0].urlencode}=#{token[1].urlencode}\"\n }\n\n return normalized_request_param\n end",
"def hide_sensitive_params(params_hash, hide_keys = %w(password password_confirmation))\n return if params_hash.nil?\n\n params_hash.each_key do |key|\n if params_hash[key].is_a?(Hash)\n hide_sensitive_params(params_hash[:key], hide_keys)\n elsif hide_keys.include?(key)\n params_hash[key] = '(hidden)'\n end\n end\n end",
"def url_escape_hash(hash)\n\thash.each do |k,v|\n\t\tv = CGI::escapeHTML(v)\n\t\t\n if v\n\t\t\t# convert bullets\n\t\t\tv = v.gsub(\"*-\",\"<bullet>\")\n\t\t\tv = v.gsub(\"-*\",\"</bullet>\")\n\n\t\t\t#convert h4\n\t\t\tv = v.gsub(\"[==\",\"<h4>\")\n\t\t\tv = v.gsub(\"==]\",\"</h4>\")\n\n \t\t#convert indent text\n\t\t\tv = v.gsub(\"[--\",\"<indented>\")\n\t\t\tv = v.gsub(\"--]\",\"</indented>\")\n\n\t\t\t#convert indent text\n\t\t\tv = v.gsub(\"[~~\",\"<italics>\")\n\t\t\tv = v.gsub(\"~~]\",\"</italics>\")\n end\n\n\t\t# replace linebreaks with paragraph xml elements\n\t\tif v =~ /\\r\\n/\n\t\t\tnew_v = \"\"\n\t\t\tbrs = v.split(\"\\r\\n\")\n\t\t\tbrs.each do |br|\n\t\t\t\tnew_v << \"<paragraph>\"\n\t\t\t\tnew_v << br\n\t\t\t\tnew_v << \"</paragraph>\"\n\t\t\tend\n\n\t\t\tv = new_v\n\t\telsif k == \"remediation\" or k == \"overview\" or k == \"poc\" or k == \"affected_hosts\" or k == \"references\"\n\t\t\tnew_v = \"<paragraph>#{v}</paragraph>\"\n\t\t\tv = new_v\n\t\tend\n\n\t\thash[k] = v\n\tend\n\n\treturn hash\nend",
"def to_query(params)\n params.map{|k,v| \"#{CGI::escape(k.to_s)}=#{CGI::escape(v.to_s)}\"}.join('&')\n end",
"def canonical_query_string\n params.sort\n .map { |key, value| \"#{uri_escape(key)}=#{uri_escape(value)}\" }\n .join('&')\n end",
"def sanitize_params(params = params)\n params = walk_hash(params) if params\n end",
"def normalize_hash(h)\n h.map do |k,v|\n v = v.strip if v.respond_to?(:strip)\n v = v.gsub(/[^[[:ascii:]]]/, \"\") if v.respond_to?(:gsub)\n [k, v]\n end.to_h\n end",
"def to_query_options(options)\n return '' if !options.is_a?(Hash) || options.empty?\n \"?#{options.map{ |k,v| \"#{k}=#{v}\" }.join('&')}\"\n end",
"def param_string\n keys.collect do |p|\n \"#{ p }=#{ CGI.escape(@params[:\"#{ p }\"].to_s) }\"\n end.join('&')\n end",
"def to_query(params)\n params.map do |key,value|\n \"#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}\"\n end * '&'\n end",
"def sanitize_parameters(param)\n return param.map { |p| String(p) } if param.is_a?(Array)\n return param.map { |k, v| [String(k), String(v)] }.to_h if param.is_a?(Hash)\n return String(param)\n end",
"def parse_query(query_string)\n\t query = {}\n if !query_string.nil? && !query_string.empty?\n query_string.split('&').each { |opt|\n k, v = opt.split('=')\n # TBD convert %xx to char\n query[k] = v\n }\n end\n # Detect numbers (others later)\n query.each_pair { |k,v|\n i = Utils.attempt_key_to_int(v)\n query[k] = i unless i.nil?\n # TBD how about float\n }\n\tend",
"def stringify_keys!(hash)\n transform_keys!(hash){ |key| key.to_s }\n end",
"def query_string(**params)\n params.map { |k, v| [k, v].join('=') }.join('&')\n end",
"def stringify_keys!(hash)\n hash.keys.each {|key| hash[key.to_s] = hash.delete(key)}\n end",
"def serialize_query\n @query.map { |k,v| \"#{k}=#{v}\" }.join(\"&\")\n end",
"def to_params\n params = {}\n\n split(/[&;]/).each do |pairs|\n key, value = pairs.split('=',2).collect { |v| CGI.unescape(v) }\n\n if key and value\n params[key] ||= []\n params[key] << value\n end\n end\n\n params.map_values { |v| v.size > 1 ? v : v.first }\n end",
"def string_hash(hash)\n hash.map { |k, v| [k.to_s, v.to_s] }.to_h\n end",
"def to_params\n elements = []\n keys.size.times do |i|\n elements << \"#{CGI::escape keys[i].to_s}=#{CGI::escape values[i].to_s}\"\n end\n elements.join('&')\n end",
"def hashify_query_string\n if request.query_string && request.query_string.length > 0\n redirect_to request.url.gsub('?', '#')\n return true\n end\n return false\n end",
"def normalize(hash)\n hash.symbolize_keys if hash\n end",
"def redirect_hash_facet_params\n if params[:f].respond_to?(:transform_values) && params[:f].values.any? { |x| x.is_a?(Hash) }\n original_f_params = params[:f].to_unsafe_h\n corrected_params = {}\n\n corrected_params[:f] = original_f_params.transform_values do |value|\n value.is_a?(Hash) ? value.values : value\n end\n\n redirect_to helpers.safe_params_merge_url(corrected_params), :status => :moved_permanently\n end\n end",
"def get_params_hash(params)\n params_hash = {}\n\n if !params.nil? && !params.empty?\n params = percent_decode(params)\n params.split('&').each do |param|\n param_pair = param.split('=')\n params_hash[percent_encode(param_pair[0])] = percent_encode(param_pair[1])\n end\n end\n\n params_hash\n end",
"def checked_keys(params_hash)\n params_hash.reject{ |key, value| value.blank? || value == '0' }.keys\n end",
"def to_http_params\n params = ''\n stack = []\n\n each do |k, v|\n if v.is_a?(Hash)\n stack << [k,v]\n elsif v.is_a?(Array)\n stack << [k,Hash.from_array(v)]\n else\n params << \"#{k}=#{v}&\"\n end\n end\n\n stack.each do |parent, hash|\n hash.each do |k, v|\n if v.is_a?(Hash)\n stack << [\"#{parent}[#{k}]\", URI::Escape.escape(v)]\n else\n params << \"#{parent}[#{k}]=#{URI::Escape.escape(v)}&\"\n end\n end\n end\n\n params.chop!\n params\n end",
"def add_query(hash)\n @query ||= {}\n\n @query.merge!(sanitize(hash))\n end",
"def key2str(hash)\n return hash unless hash.is_a? Hash\n hash.each_value.select { |h| h.is_a? Hash }.each do |subh|\n sv = {}\n subh.each { |k, v| sv[k.to_s] = v }\n subh.replace sv\n end\n hash\n end",
"def auth_values_as_query_string( parsed_url )\n \n @params = {\n 'oauth_version' => @oauth_version,\n 'oauth_consumer_key' => @consumer_key,\n 'oauth_token' => @token,\n 'oauth_timestamp' => Time.now.to_i.to_s,\n 'oauth_nonce' => nonce,\n 'oauth_signature_method' => @sig_method,\n }\n\n # if url has query, merge key/values into params obj overwriting defaults\n if parsed_url.query\n CGI.parse( parsed_url.query ).each do |k,v|\n if v.is_a?(Array) && v.count == 1\n @params[k] = v.first\n else\n @params[k] = v\n end\n end\n end\n \n # @ref http://oauth.net/core/1.0/#rfc.section.9.1.2\n @req_url = parsed_url.scheme + '://' + parsed_url.host + parsed_url.path\n \n # create base str. make it an object attr for ez debugging\n # ref http://oauth.net/core/1.0/#anchor14\n @base_str = [ \n @req_method, \n percent_encode( req_url ), \n \n # normalization is just x-www-form-urlencoded\n percent_encode( query_string ) \n \n ].join( '&' )\n\n # add signature\n @params[ 'oauth_signature' ] = signature\n \n percent_encode(@params.to_json)\n # return self\n end",
"def parse_query(qs, d = nil)\n params = {}\n (qs || '').split(d ? /[#{d}] */n : /[&;] */n).each do |p|\n k, v = p.split('=', 2).map { |x| CGI::unescape(x) }\n if (cur = params[k])\n if cur.class == Array\n params[k] << v\n else\n params[k] = [cur, v]\n end\n else\n params[k] = v\n end\n end\n\n params\n end",
"def stringify_hash(input)\n input.inject({}){|h,(k,v)| h[k.to_s] = v.to_s; h}\n end",
"def hash_correct(hash)\n\tHash[hash.map {|k,v| [(v[0].to_sym), v]}]\nend",
"def normalize_param(key, value)\n param = ''\n stack = []\n\n if value.is_a?(Array)\n param << value.map { |element| normalize_param(\"#{key}[]\", element) }.join\n elsif value.is_a?(Hash)\n stack << [key,value]\n else\n param << \"#{key}=#{CGI::escape(value.to_s)}&\" \n end\n\n stack.each do |parent, hash|\n hash.each do |key, value|\n if value.is_a?(Hash)\n stack << [\"#{parent}[#{key}]\", value]\n else\n param << normalize_param(\"#{parent}[#{key}]\", value)\n end\n end\n end\n\n param\n end",
"def param_hash(*keys)\n params.to_unsafe_h\n .deep_symbolize_keys\n .then { |hash| keys.empty? ? hash : hash.slice(*keys) }\n .compact\n end",
"def strip_params_before_orm(hash)\n new_hash = hash.dup\n new_hash.delete(\"route_properties\")\n new_hash.delete(\"data_object\")\n\n return new_hash\n end",
"def __to_params__\n map { |k,v| \"#{k.to_s}=#{URI.escape(v.to_s)}\" }.join('&')\n end"
] |
[
"0.7981429",
"0.7981429",
"0.79270375",
"0.77264994",
"0.7410117",
"0.73919785",
"0.7303997",
"0.7223133",
"0.7199999",
"0.7146574",
"0.7029694",
"0.6998005",
"0.6940396",
"0.66855156",
"0.6548372",
"0.65437925",
"0.6480525",
"0.6457247",
"0.6440795",
"0.63848615",
"0.6346777",
"0.63260376",
"0.6313635",
"0.625154",
"0.6240661",
"0.6230878",
"0.6180333",
"0.6177664",
"0.61104333",
"0.61104333",
"0.61104333",
"0.6095513",
"0.60867447",
"0.6084473",
"0.6067678",
"0.6057752",
"0.60478824",
"0.6039198",
"0.60358614",
"0.6019423",
"0.59859324",
"0.59661406",
"0.5952823",
"0.59364164",
"0.589837",
"0.58923626",
"0.58908963",
"0.58854675",
"0.5871098",
"0.58648884",
"0.58465636",
"0.5846068",
"0.58368564",
"0.58362293",
"0.5833633",
"0.5826656",
"0.58037513",
"0.58010316",
"0.57964706",
"0.5791759",
"0.5790892",
"0.57830983",
"0.5776173",
"0.577375",
"0.57568085",
"0.5754208",
"0.5750724",
"0.5745264",
"0.5740904",
"0.57359093",
"0.57357824",
"0.5722833",
"0.5722083",
"0.57198286",
"0.57197237",
"0.5714933",
"0.5705757",
"0.568744",
"0.5674129",
"0.56661683",
"0.56572276",
"0.5656222",
"0.5654713",
"0.5648488",
"0.5626684",
"0.56186044",
"0.5614716",
"0.5607992",
"0.5607944",
"0.5591572",
"0.5590843",
"0.5577043",
"0.55769485",
"0.557358",
"0.5571656",
"0.55587375",
"0.55565625",
"0.5552485",
"0.55481523",
"0.5535783"
] |
0.73448867
|
6
|
before_filter :authenticate_user! prepend_before_filter :authenticate_user!
|
def index
# current_user.cdg_id
@@users = SoapConnection::ChoferUsers.users( (1 rescue 1) ).compact rescue []
@users = @@users
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def before_filter\n if current_user\n true\n end\n end",
"def login_required\n authenticate_user! \n end",
"def authenticate_user!\n redirect_to '/login' unless current_user\n end",
"def authenticate\n redirect_to :login unless user_signed_in?\n end",
"def before_filter; end",
"def authenticate!\n unless current_user\n redirect \"/login\"\n end\nend",
"def before_request\n self.login if require_login? && !@authenticating\n end",
"def authenticate_user\n redirect_to login_path unless logged_in_user?\n end",
"def authenticate!\n redirect_to login_path unless current_user\n end",
"def authenticate_user\n redirect_to \"/login\" unless logged_in?\n end",
"def authenticate\n\n redirect_to_login if current_user.nil?\n \n end",
"def authenticate_user!\n \tif user_signed_in?\n \t super\n else\n redirect_to new_user_session_path, notice: 'Debes iniciar sesión'\n end\n end",
"def authenticate_user!\n redirect_to new_user_path unless user_signed_in?\n end",
"def authenticate_user\n redirect_to root_path unless signed_in?\n end",
"def authenticate_user\n\t\trender_unauthorized unless current_user\n\tend",
"def signed_in_user_filter\n if signed_in?\n redirect_to root_path, notice: \"Already logged in\"\n end\n end",
"def authenticate_user!\n if user_signed_in?\n super\n else\n redirect_to new_user_registration_path\n end\n end",
"def authenticate_user\n unauthorized unless current_user\n end",
"def authenticate!\r\n\tif !current_user\r\n\t\tredirect \"/login\"\r\n\tend\r\nend",
"def authenticate\n redirect_to(root_path) unless session[:username]\n end",
"def authenticate!\n redirect_to login_path unless session[:username]\n end",
"def authenticate_user\n# save current page for redirection after login\n redirect_to controller: :user, action: :login unless logged_in? \n current_user\n end",
"def authenticate_user!\n \tunless current_user?\n \trender status: :unauthorized\n \tend\n end",
"def authentication_required\n if !logged_in?\n redirect_to login_path\n end\n end",
"def authenticate_user\n unless signed_in?\n redirect_to login_url, notice: \"Please log in first\"\n end\n end",
"def authenticate_user!\n redirect_to new_session_path unless user_signed_in?\n end",
"def authenticate\n if logged_in_user\n redirect_to root_url unless current_user?(find_user)\n end\n end",
"def authenticate!\n\tif !current_user\n\t\tredirect \"/login\"\n\tend\nend",
"def authenticate!\n\tif !current_user\n\t\tredirect \"/login\"\n\tend\nend",
"def authenticate!\n\tif !current_user\n\t\tredirect \"/login\"\n\tend\nend",
"def authenticate!\n\tif !current_user\n\t\tredirect \"/login\"\n\tend\nend",
"def authorize\n redirect_to :login unless user_signed_in?\n end",
"def authenticate_user\n \tif !logged_in?\n \tredirect_to login_url\n \tend\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authenticate!\n\t\t\tunless signed_in? or params[:controller].include?\"devise\"\n\t\t\t\tflash[:notice] = \"You're not logged in!\"\n\t\t\t\tredirect_to :root\n\t\t\tend\n\t\tend",
"def authenticate!\n not_authorized() unless logged_in?()\n end",
"def authenticate_user\n render_403 'Invalid user.' if @user.blank? || !@user.active?\n end",
"def authorized_user!\n unless user_logged_in?\n redirect_to root_path\n end\n end",
"def auth_user\n redirect_to new_user_session_url unless user_signed_in?\n end",
"def authenticate!\n redirect '/sessions/new' unless logged_in?\nend",
"def authenticate_user\n if session[:user_id].blank?\n redirect_to root_path\n end\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def login_required\n not_authorized unless current_user\n end",
"def authenticate\n unauthorized unless current_user\n end",
"def authenticate\n deny_access unless signed_in? \n end",
"def user_authentication\n end",
"def is_user_authenticate\r\n redirect_to '/users/sign_in' if current_user.nil?\r\n end",
"def is_user_authenticate\r\n redirect_to '/users/sign_in' if current_user.nil?\r\n end",
"def authorize\n redirect_to('/login') unless @current_user\n end",
"def authenticate\n redirect_to '/login' unless current_user\n end",
"def authenticate\n unless logged_in?\n redirect_to login_url\n end\n end",
"def authenticate\n redirect_to login_path if !logged_in\n end",
"def authenticate\n\tdeny_access unless signed_in?\n end",
"def auth_user\n redirect_to new_user_registration_url unless user_signed_in?\n end",
"def require_auth\n redirect_to login_path unless authenticated?\n end",
"def authenticate\n\t\tdeny_access unless signed_in?\n\tend",
"def require_user \n redirect_to '/login' unless current_user \n end",
"def require_user \n redirect_to '/login' unless current_user \n end",
"def authenticate_user!\n redirect_to sign_up_path unless current_user.present?\n end",
"def authenticate\n redirect_to login_url, alert: 'Please log in first' if current_user.nil?\n end",
"def authenticate\n if not current_user\n redirect_to signin_path, notice: 'Not logged in'\n end\n end",
"def authorized\n redirect_to \"/login\" unless logged_in? \n end",
"def authenticate_user\n if !current_user\n redirect_to login_path\n end\n end",
"def authenticate_user\n if !current_user\n redirect_to login_path\n end\n end",
"def require_user\n redirect_to '/login' unless current_user\n end",
"def require_user\n redirect_to '/login' unless current_user\n end",
"def authenticate_scope!\n super\n end",
"def require_authentication\n\n # No matter what the app does a user can always login, forgot\n # password and register. The controllers provided by this\n # plugin alreaddy have these controllers/actions on an\n # exception list but this prevents a mistake an overridden\n # controller from preventing the normal login behavior.\n %w(session password user).each do |c|\n \t %w(new create).each do |a|\n return if (controller_name == c) && (action_name == a)\n end\n \t end\n\n # If we cannot get the current user store the requested page\n # and send them to the login page.\n if current_user.nil? or current_user.anonymous?\n redirect_to login_url(:return_to => request.url) and false\n end\n end",
"def authenticate_user!(options = {})\n head :unauthorized unless signed_user_in?\n end",
"def auth_user\n if !current_user\n redirect_to root_url\n end\n end",
"def auth_user\n if !current_user\n redirect_to root_url\n end\n end",
"def auth_user\n if !current_user\n redirect_to root_url\n end\n end",
"def require_user\n unless current_user or controller_name == 'passwords'\n redirect_to login_url\n end\n end",
"def authenticate_user!\n token, options = ActionController::HttpAuthentication::Token.token_and_options(request)\n\n super unless token == 'rbMmEeoH8RxRDyN24PQv'\n end",
"def authenticate!\n if @user != current_user\n redirect_to root_url, flash: { danger: \"不正なアクセス\" }\n end\n end",
"def authorize\n redirect_to '/login' unless current_user\n end",
"def authenticate_user!\n # unless current_user.present? && current_user.admin?\n # flash.now.alert = \"You are not an admin!\"\n # redirect_to root_path\n # end\n end",
"def auth_user!(opts = {})\n if admin_signed_in?\n \tauthenticate_admin!\n else\n \tauthenticate_user!\n end\nend",
"def authenticate_user!\n unless @current_user\n head :unauthorized\n end\n end",
"def authenticate_user!\n unless current_user?\n render status: :unauthorized\n end\n end",
"def authenticate_user!(*args)\n if request.get? && !logged_in?\n session[:return_to] = request.fullpath\n session[:return_to_for_new_user] = request.fullpath\n end\n super\n end",
"def authenticate!\n\t #when we solve the require relative problem write the line: unless session[:user_id] && User.where(id: session[:user_id])\n\n\t\tif session[:user_id] && User.where(id: session[:user_id]).exists? #if the user id saved in session does not belong to any user, also direct to general homepage\n\t\t\ttrue\n\t\telse\n\t\t\tsession[:original_request] = request.path_info\n\t\t\tfalse\n\t\tend\nend",
"def authenticate_user!\n redirect_to login_path, alert: \"You must be logged in to access this page\" if current_user.nil?\n end",
"def first_login\n if params[:controller] != 'registrations' &&\n params[:controller] != 'devise/sessions' &&\n user_signed_in? &&\n !current_user.activated\n\n return redirect_to edit_user_registration_path\n end\n end",
"def authenticate!\n unauthorized! unless current_user\n end",
"def authorize\n redirect_to new_session_path unless current_user #call method curent_user in sessions_helper\n end",
"def no_authentication_required(*options)\n skip_before_filter :require_authentication, options\n end",
"def authenticate\n deny_access unless signed_in?\n end",
"def authenticate\n deny_access unless signed_in?\n end",
"def authorize\n\t\tredirect_to '/login' unless current_user\n\tend",
"def auth_controller?\n false\n end",
"def authenticate_current_user\n unless current_user.admin == true\n unless current_user == User.find(params[:id]) \n flash[:danger] = \"Impossible d'aller sur cette page.\"\n redirect_to root_path\n end\n end\n end",
"def authenticate\n CASClient::Frameworks::Rails::Filter.before(self)\n update_current_user(User.eager_load(*eager_loads).find_by(cas_directory_id: session[:cas_user]))\n\n return unless session[:cas_user] && !allow_access\n render(file: File.join(Rails.root, 'public/403.html'), status: :forbidden, layout: false)\n end",
"def authenticate\n if sesssion[:user_id].nil?\n redirect_to login_path, notice: \"You must log in first.\"\n end\n end"
] |
[
"0.72244203",
"0.7221027",
"0.7173562",
"0.71080893",
"0.70743805",
"0.7024973",
"0.70062715",
"0.7003767",
"0.69978774",
"0.6995932",
"0.6945002",
"0.6909033",
"0.6888564",
"0.68350834",
"0.68184316",
"0.68169814",
"0.67796487",
"0.67745125",
"0.67631346",
"0.67573726",
"0.6741446",
"0.6740423",
"0.67335534",
"0.6730225",
"0.6729958",
"0.67281747",
"0.67231476",
"0.67061144",
"0.67061144",
"0.67061144",
"0.67061144",
"0.67060995",
"0.6704003",
"0.6678061",
"0.66689605",
"0.6658727",
"0.6657892",
"0.6653982",
"0.6646067",
"0.6645428",
"0.66114897",
"0.6598818",
"0.6598818",
"0.6598818",
"0.6598818",
"0.6598818",
"0.6598818",
"0.6598818",
"0.6598818",
"0.6594877",
"0.6589518",
"0.65729874",
"0.6555958",
"0.65525365",
"0.65525365",
"0.6543027",
"0.6538042",
"0.6536477",
"0.6531028",
"0.65258753",
"0.65193355",
"0.6516501",
"0.6514988",
"0.6514727",
"0.6514727",
"0.6502046",
"0.6481011",
"0.6471298",
"0.6464531",
"0.6460414",
"0.6460414",
"0.6459865",
"0.6459865",
"0.6458562",
"0.6458403",
"0.6458003",
"0.6456609",
"0.6456609",
"0.6456609",
"0.64455634",
"0.6442506",
"0.64404535",
"0.64364135",
"0.6434246",
"0.6433451",
"0.64333665",
"0.64232945",
"0.64222664",
"0.6417",
"0.6413354",
"0.6410262",
"0.64037025",
"0.64003557",
"0.6389355",
"0.638033",
"0.638033",
"0.6377926",
"0.6374364",
"0.63720083",
"0.63499856",
"0.63467824"
] |
0.0
|
-1
|
GET /multi_boards/1 GET /multi_boards/1.json
|
def show
@multi_board = MultiBoard.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @multi_board }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n\n respond_to do |format|\n format.html { @boards = Board.where network_id: current_user.network_id }\n format.json { @boards = Board.where network_id: current_user.network_id }\n \n end\n end",
"def index\n @boards = Board.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boards }\n end\n end",
"def index\n @boards = Board.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boards }\n end\n end",
"def new\n @multi_board = MultiBoard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @multi_board }\n end\n end",
"def boards\n return @boards if @boards\n @boards = Client.get(\"/organizations/#{id}/boards/all\").json_into(Board)\n end",
"def index\n @boards = Board.all\n data = []\n @boards.each do |i|\n data.push({\"name\" => i.name, \"id\" =>i.id.to_s})\n end\n\n render json: data\n #render \"boards/index\"\n end",
"def index\r\n set_data_from_param\r\n @page_info = resources_with_pagination(@boards)\r\n render formats: :json\r\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: @boards }\n end\n end",
"def index\n @boards = Board.all\n end",
"def index\n @boards = Board.all\n end",
"def index\n @boards = Board.all\n end",
"def index\n @boards = Board.all\n end",
"def index\n @boards = Board.all\n end",
"def index\n @boards = Board.all\n end",
"def index\n @boards = Board.all\n end",
"def index\n @boards = Board.all\n end",
"def index\n @boards = Board.all\n end",
"def boards\n return @boards unless @boards.empty?\n\n endpoint = \"/1/members/#{username}/boards?\"\n response = Client.get(endpoint)\n\n @boards = response.map do |board|\n Board.new(id: board['id'], name: board['name'])\n end\n end",
"def show\n render json: UserBoards.find(params[\"id\"])\n end",
"def index\n @boards = Board.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @boards }\n end\n end",
"def board(project, id)\n get(\"/projects/#{url_encode project}/boards/#{id}\")\n end",
"def index\n\n\t\t\t\toffset = params[:offset] || 0\n\t\t\t\tlimit = params[:limit] || 12\n\n\t\t\t\t@boards = Board.order(\"created_at DESC\").offset(offset).limit(limit)\n\n\t\t\t\trespond_to do |format|\n\t\t\t\t\t#format.html # index.html.erb\n\t\t\t\t\tformat.json \n\t\t\t\tend\n\t\t\tend",
"def index\n @man_boards = ManBoard.all\n end",
"def index\n @boards = Board.root_boards\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @boards }\n end\n end",
"def show\n @board = Board.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @board }\n end\n end",
"def index\n @boards = current_user.boards.all\n end",
"def index\n render json: UserBoards.all\n end",
"def index\n @my_boards = current_user.boards\n @organization_boards = current_user.organization&.boards\n end",
"def show\n return\n @board = Board.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @board }\n end\n end",
"def create\n @multi_board = MultiBoard.new(params[:multi_board])\n\n respond_to do |format|\n if @multi_board.save\n format.html { redirect_to @multi_board, notice: 'Multi board was successfully created.' }\n format.json { render json: @multi_board, status: :created, location: @multi_board }\n else\n format.html { render action: \"new\" }\n format.json { render json: @multi_board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def boards(fields: nil)\n get_boards_collection(\"/me/boards/\", nil, fields)\n end",
"def user_boards\n boards = Trello::Board.all\n end",
"def get_boards\n @courses = []\n if request.xhr? and params[:q].present?\n @boards = if params[:institution_id].present?\n #@boards = Institution.find(params[:institution_id]).publishers.map{|pub| pub.boards.where('name like ?',\"%#{params[:q]}%\").select('id,name')}.flatten.uniq\n Institution.find(params[:institution_id]).try(:boards).select('id,name').where('name like ?',\"%#{params[:q]}%\")\n elsif params[:center_id].present?\n Center.find(params[:center_id]).try(:boards).select('id,name').where('name like ?',\"%#{params[:q]}%\")\n elsif params[:academic_class_id].present?\n AcademicClass.find(params[:academic_class_id]).try(:boards).select('id,name').where('name like ?',\"%#{params[:q]}%\")\n end\n respond_to do |format|\n format.json { render json: @boards }\n end\n elsif request.xhr? and !params[:q].present? #used in teacher_class_rooms fields partial\n @boards = Center.find(params[:center_id]).try(:boards).select('id,name')\n respond_to do |format|\n format.json { render json: @boards.map{|b| Hash[value: b.id ,name: b.name]} }\n end\n end\n\n\n end",
"def index\n json_response(@board.lists)\n end",
"def yast_boards\n Trello::Organization.find(\"yastteam\").boards.map(&:id)\nend",
"def show\n @board_info = BoardInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @board_info }\n end\n end",
"def board_lists(project, id)\n get(\"/projects/#{url_encode project}/boards/#{id}/lists\")\n end",
"def index\n render template: 'boards/index.html.erb', locals: {\n boards: Board.all\n }\n end",
"def set_boards\n\t\t\t@boards = @intranet.boards\n\t\tend",
"def index\n @messageboards = Messageboard.all\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: @board }\n end\n end",
"def show\n @board = Board.find(params[:id])\n @content_years = @board.content_years.page(params[:page])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @board }\n end\n end",
"def show\n @boards = Board.order(:created_at).all\n end",
"def new\n @board = Board.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board }\n end\n end",
"def new\n @board = Board.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board }\n end\n end",
"def new\n @board = Board.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board }\n end\n end",
"def new\n @board = Board.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @board }\n end\n end",
"def set_board\n @board = current_user.boards.find_by(id: params[:board_id])\n render(json: {error: \"Board Not Found\"}, status: 404) if !@board\n end",
"def new\n @board = Board.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board }\n end\n end",
"def destroy\n @multi_board = MultiBoard.find(params[:id])\n @multi_board.destroy\n\n respond_to do |format|\n format.html { redirect_to multi_boards_url }\n format.json { head :no_content }\n end\n end",
"def index\n cards_per_page = 12\n\n @boards = Board.order(\"created_at DESC\").page(params[:page]).per_page(cards_per_page)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boards }\n format.js\n end\n end",
"def fetch_board\n @board ||= Board.includes(columns: :visible_issue_stats).find_by(github_full_name: params_github_full_name)\n authorize!(:read, @board)\n # FIX : Create attribute 'bag' for @board.\n @board_bag = BoardBag.new(current_user, @board)\n end",
"def board\n Board.from_response client.get(\"/actions/#{action_id}/board\")\n end",
"def board_list(project, board_id, id)\n get(\"/projects/#{url_encode project}/boards/#{board_id}/lists/#{id}\")\n end",
"def index\n @boards = Board.where(public:true).order(:name)\n end",
"def index\n @lists = @board.lists\n render json: @lists.as_json(include: [cards: {methods: [:user_ids]}])\n end",
"def show\n @moodboards = current_user.moodboards.find(params[:id])\n @project = Project.find params[:project_id]\n\n respond_to do |format|\n format.html\n format.json { render json: @image }\n end\n end",
"def show\n @board_list = Board.all\n @board = Board.find(params[:id])\n @board_nodes = @board.nodes.all\n # Пагинация, аттеншн - располагание тредов по убыванию даты последнего коммента происходит здесь,\n # поэтому нефиг пирать реверс в board/show\n @nodes = @board.nodes.paginate(:page => params[:page], :per_page => $nodes_per_page, :order => 'last_comment DESC')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @board }\n end\n end",
"def index\n @boards = Board.all\n # render 'boards/index'\n # render html: \"aaa\"\n end",
"def index\n @boards = Board.where(user_id: current_user.id) + Board.joins(:board_pinners).where(board_pinners: {user_id: current_user.id})\n end",
"def index\n @cubboards = Cubboard.all\n end",
"def index\n @dash_boards = DashBoard.all\n end",
"def index\n @g_game_boards = GGameBoard.all\n end",
"def new\n @board_info = BoardInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board_info }\n end\n end",
"def update\n @multi_board = MultiBoard.find(params[:id])\n\n respond_to do |format|\n if @multi_board.update_attributes(params[:multi_board])\n format.html { redirect_to @multi_board, notice: 'Multi board was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @multi_board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @games_leaderboards = Games::Leaderboard.all\n\n render json: @games_leaderboards\n end",
"def index\n @boards = Board.all.order(\"created_at DESC\")\n @lates_boards = Board.all.order(\"created_at DESC\").limit(5)\n end",
"def show\n # @board = Board.find(params[:id])\n @lates_boards = Board.all.order(\"created_at DESC\").limit(5)\n @opinions = @board.opinions\n end",
"def show\n @test_board = TestBoard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_board }\n end\n end",
"def get_leaderboard\n\t\trender :json=>{:success=>false, :msg=>'Stage not specified.'} and return if (!params.has_key?(:id))\n\t\t\n\t\tstage = Stage.find_by_id(params[:id])\n\t\trender :json=>{:success=>false, :msg=>'Invalid stage.'} and return if (stage.nil?)\n\t\t\n\t\tleaderboard = LeaderboardModule::get_global_stage_leaderboard(params[:id], @scope)\n\t\t\n\t\trender :json=>{:leaderboard=>leaderboard, :stage=>{:name=>stage.name}} and return\n\tend",
"def index\n @side_boards = SideBoard.all\n end",
"def show\n # @article = Article.find(params[:id])\n @board = Board.find(params[:board_id])\n @article = @board.articles.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n return\n @board = Board.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @board }\n end\n end",
"def get_widget_by_id(id, board_id)\n if id == nil\n raise 'Widget ID not found!'\n end\n widgets_url = URI(\"https://api.miro.com/v1/boards/#{board_id}/widgets/#{id}\")\n result = send_get(widgets_url)\n widget = JSON.parse(result)\n puts CIGREEN + \"GOT WIDGET: \" + CEND + \"#{result}\"\n return widget\nend",
"def index\n @bulleting_boards = BulletingBoard.all\n end",
"def recruit_boards\n default_recruit_boards[program.id.to_s].map { |id| program.recruit_boards.where(:_id => id).first }.compact || []\n end",
"def board\n @board ||= Board.find(params[:id])\n end",
"def show\n @bingo_hall = BingoHall.find(params[:id])\n @bingo_boards = @bingo_hall.bingo_boards\n end",
"def index\n @score_boards = ScoreBoard.all\n end",
"def get_board\n @board = Trello::Board.find(\"558b0e12f2e6f4aa751abe4d\")\n return @board\nend",
"def new\n # @article = Article.new\n\n @board = Board.find(params[:board_id])\n @article = @board.articles.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def show\n if Board.exists?(params[:id].to_i)\n @board = Board.find_user_board(params[:id])\n @board.page = params[:page].to_i unless params[:page].blank?\n \n unless is_temporary?(@board)\n authorize! :show, @board\n end\n else\n render :json => { :errors => {:board => \"Ce board n'est pas accessible\"}}, :status => 422\n end\n end",
"def index\n @boards = Board.order('updated_at DESC')\n\n if stale?(:last_modified => @boards.first.updated_at.utc, :etag => @boards)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @boards }\n end\n end\n end",
"def show\n @storyboard = Storyboard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @storyboard }\n end\n end",
"def set_board\n @board =current_user.boards.find(params[:id])\n end",
"def load_board\n @board = Board.find_from( params )\n end",
"def set_board\n @board = current_user.boards.find(@list[:board_id])\n end",
"def show\n render json: @games_leaderboard\n end",
"def set_board\n @board = Board.find(params[:id])\n end",
"def index\n @billboards = Billboard.all\n end",
"def set_board\n @board = Board.find(params[:id])\n end",
"def set_board\n @board = Board.find(params[:id])\n end",
"def set_board\n @board = Board.find(params[:id])\n end",
"def get_temporary_boards\n return @boards unless @boards.blank?\n @boards = ((session[\"temporary_board_id\"].blank?) ? nil : Board.where( :id => session[\"temporary_board_id\"].to_i))\n end",
"def show\n @project = Project.find(params[:id])\n\n @grupos = []\n if @project.group_confirm\n @grupos = Member.find_all_by_project_id(@project.id)\n \n end\n \n \n @board_members = BoardMember.find_all_by_project_id(@project.id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n \n\n \n end",
"def new\n @gameboard = Gameboard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gameboard }\n end\n end",
"def index\n @freeboards = Freeboard.all\n end",
"def index\n @builds = current_application.builds\n @build = current_application.builds.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @builds }\n end\n end",
"def load_game_board\n @game = Game.find(params[:game_id])\n @board = Board.find(params[:id])\n end",
"def show\n @dartboard = Dartboard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dartboard }\n end\n end"
] |
[
"0.717086",
"0.71656495",
"0.71656495",
"0.7125509",
"0.70815754",
"0.6953657",
"0.68549836",
"0.67742854",
"0.6758978",
"0.6758978",
"0.6758978",
"0.6758978",
"0.6758978",
"0.6758978",
"0.6758978",
"0.67567176",
"0.67567176",
"0.6660346",
"0.6653679",
"0.66397345",
"0.66242766",
"0.66092646",
"0.66076773",
"0.65591574",
"0.6510031",
"0.6472128",
"0.6410582",
"0.6396985",
"0.6379315",
"0.63766295",
"0.633397",
"0.633073",
"0.6320105",
"0.62900585",
"0.6268639",
"0.623443",
"0.62030536",
"0.6188397",
"0.61301947",
"0.61237377",
"0.6119825",
"0.61138374",
"0.6113556",
"0.6083008",
"0.6083008",
"0.6083008",
"0.6082193",
"0.60816324",
"0.6075368",
"0.60727054",
"0.6067457",
"0.6048195",
"0.60265464",
"0.6014017",
"0.5992747",
"0.59919566",
"0.5977553",
"0.59672517",
"0.59575146",
"0.59364694",
"0.5928022",
"0.5896549",
"0.58809596",
"0.5880137",
"0.5877987",
"0.58771825",
"0.587286",
"0.5860689",
"0.58553743",
"0.5851084",
"0.5820809",
"0.5809866",
"0.57970655",
"0.5787045",
"0.5774592",
"0.5765939",
"0.57635766",
"0.57583416",
"0.57568985",
"0.5751592",
"0.5732627",
"0.57166886",
"0.57164085",
"0.5693716",
"0.5693524",
"0.5663117",
"0.5650937",
"0.5630405",
"0.5609804",
"0.5609579",
"0.56090367",
"0.56090367",
"0.56090367",
"0.5596362",
"0.55852824",
"0.5583593",
"0.5582037",
"0.55710024",
"0.5566196",
"0.5550934"
] |
0.77802366
|
0
|
GET /multi_boards/new GET /multi_boards/new.json
|
def new
@multi_board = MultiBoard.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @multi_board }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @multi_board = MultiBoard.new(params[:multi_board])\n\n respond_to do |format|\n if @multi_board.save\n format.html { redirect_to @multi_board, notice: 'Multi board was successfully created.' }\n format.json { render json: @multi_board, status: :created, location: @multi_board }\n else\n format.html { render action: \"new\" }\n format.json { render json: @multi_board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @board = Board.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board }\n end\n end",
"def new\n @board = Board.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board }\n end\n end",
"def new\n @board = Board.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board }\n end\n end",
"def new\n @board = Board.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board }\n end\n end",
"def new\n return\n @board = Board.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @board }\n end\n end",
"def new\n @board = Board.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @board }\n end\n end",
"def new\n @board = Board.new_with_initial_items\n @template = Template.find(1)\n session[:board] = @board\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board }\n end\n end",
"def new\n @board_info = BoardInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board_info }\n end\n end",
"def new\n # @article = Article.new\n\n @board = Board.find(params[:board_id])\n @article = @board.articles.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def new\n @test_board = TestBoard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_board }\n end\n end",
"def new\n @gameboard = Gameboard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gameboard }\n end\n end",
"def create\n @board = Board.new(params[:board])\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to @board, :notice => 'Board was successfully created.' }\n format.json { render :json => @board, :status => :created, :location => @board }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @board.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\n #figure out what type of board we need to make\n if params[:board_type] == 'SpecificBoard'\n @board = SpecificBoard.new(params[:board])\n else\n @board = GenericBoard.new(params[:board])\n end\n \n respond_to do |format|\n if @board.save\n flash[:notice] = 'Board listing was successfully created.'\n format.html { redirect_to(root_path) }\n else\n @existing_locations = current_user.board_locations.ordered_by_desc_creation\n (Board::MAX_IMAGES - @board.images.length).times {@board.images.build}\n format.html { render :action => \"new\" }\n end\n end\n end",
"def create\n return\n #Board.generate()\n #@board = Board.new(params[:board])\n\n respond_to do |format|\n #if @board.save\n #format.html { redirect_to @board, :notice => 'Board was successfully created.' }\n #format.json { render :json => @board, :status => :created, location: @board }\n #else\n format.html { render :action => \"new\" }\n format.json { render :json => @board.errors, :status => :unprocessable_entity }\n #end\n end\n end",
"def new\n @dartboard = Dartboard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dartboard }\n end\n end",
"def create\n @board = Board.new(params[:board])\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to @board, notice: 'board was successfully created.' }\n format.json { render json: @board, status: :created, location: @board }\n else\n format.html { render action: \"new\" }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @board = Board.new(params[:board])\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to @board, notice: 'Board was successfully created.' }\n format.json { render json: @board, status: :created, location: @board }\n else\n format.html { render action: \"new\" }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @board = Board.new(params[:board])\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to @board, notice: 'Board was successfully created.' }\n format.json { render json: @board, status: :created, location: @board }\n else\n format.html { render action: \"new\" }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @storyboard = Storyboard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @storyboard }\n end\n end",
"def new\n @board = Board.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @board }\n end\n end",
"def new\n @board = Board.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @board }\n end\n end",
"def new\n @leaderboard = Leaderboard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @leaderboard }\n end\n end",
"def new\n @card = Card.new\n @board = Board.find_by_id(params[:board_id])\n render :new\n end",
"def new\n @board = Board.new\n respond_to do |format|\n format.js\n end\n end",
"def create\n @board = Board.new(board_params)\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to @board, notice: 'Board was successfully created.' }\n format.json { render :show, status: :created, location: @board }\n else\n format.html { render :new }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @board = Board.new(board_params)\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to @board, notice: 'Board was successfully created.' }\n format.json { render :show, status: :created, location: @board }\n else\n format.html { render :new }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @board = Board.new(board_params)\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to @board, notice: 'Board was successfully created.' }\n format.json { render :show, status: :created, location: @board }\n else\n format.html { render :new }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @board = current_user.boards.build(board_params)\n if @board.save\n redirect_to boards_path , notice: 'Task was successfully created.'\n else\n render 'new'\n end\n end",
"def create\n @board = Board.new(board_params)\n\n if @board.save\n render :show, status: :created\n else\n render json: @board.errors, status: :unprocessable_entity\n end\n end",
"def create\n @board = Board.new(board_params)\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to @board, notice: \"Board was successfully created.\" }\n format.json { render :show, status: :created, location: @board }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # render json: params\n render json: UserBoards.create(params[\"user_board\"])\n end",
"def create\n @board = Board.new(board_params)\n last_board = Board.last\n @board.order = if last_board then last_board.order + 1 else 1 end\n\n if @board.save\n update_boards(true)\n else\n respond_to do |format|\n format.js { render :new }\n end\n end\n end",
"def create\n @board_info = BoardInfo.new(params[:board_info])\n\n respond_to do |format|\n if @board_info.save\n format.html { redirect_to @board_info, notice: 'Board info was successfully created.' }\n format.json { render json: @board_info, status: :created, location: @board_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @board_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t\t\tif params[:image]\n\t\t\t\t\tif params[:board] #android\n\t\t\t\t\t\tboard_params = JSON.parse(params[:board]) \n\t\t\t\t\t\t@board = @user.boards.new({user_id: @user.id, title: board_params['title'], description: board_params['description'], picture_attributes: {image: params[:image]}}) \n\t\t\t\t\telse\n\t\t\t\t\t\t@board = @user.boards.new({user_id: @user.id, title: params[:title], description: params[:description], picture_attributes: {image: params[:image]}}) \n\t\t\t\t\tend\t\t\t\t\t\n\t\t\t\telse\n\t\t\t\t\t@board = @user.boards.create({title: params[:board][:title], description: params[:board][:description]})\t\n\t\t\t\tend\n\n\t\t\t\trespond_to do |format|\n\t\t\t\t\tif @board.save\n\t\t\t\t\t\t@user.add_role :author, @board\n\t\t\t\t\t\tformat.html { redirect_to @board, notice: 'Board was successfully created.' }\n\t\t\t\t\t\tformat.json { render json: @board, status: :created, location: @board }\n\t\t\t\t\telse\n\t\t\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\t\t\tformat.json { render json: @board.errors, status: :unprocessable_entity }\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend",
"def create\n @board = current_user.boards.build(board_params)\n if @board.save\n flash[:success] = \"Board created!\"\n redirect_to [@current_user, @board]\n else\n error = ''\n @board.errors.full_messages.each do |m|\n error += m\n end\n flash[:danger] = error\n redirect_to @current_user\n end\n end",
"def new\n @team = @competition.teams.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n \t@item = Item.new\n \t@cupboards = Cupboard.all\n end",
"def new\n\t\t@pin = Pin.new\n\t\t@pin.user = current_user\n\n\t\t@boards = Board.all\n\tend",
"def new\n params_hash = {board_id: params[:board_id],content_year_id: params[:content_year_id]}\n @subject = Subject.new(params_hash)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subject }\n end\n end",
"def create\n\t\t@board = current_user.boards.create(params[:board])\n current_user.add_role :author, @board\n\t\t#@board = Beautorial.new(params[:board])\n\n\t\trespond_to do |format|\n\t\t\tif @board.save\n\t\t\t\tformat.html { redirect_to @board, notice: 'Board was successfully created.' }\n\t\t\t\tformat.json { render json: @board, status: :created, location: @board }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @board.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @board = Board.new(board_params)\n @board.user_id = current_user.id\n\n if @board.name\n @board.board_slug = @board.name.downcase.gsub(\" \", '-')\n end\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to back_to_board, notice: 'Board was successfully created.' }\n format.json { render :show, status: :created, location: back_to_board }\n else\n format.html { render :new }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @rows = []\n if params[:board_entry]\n @rows << PartNum.new( :use => \"pcb\", :revision => \"a\" )\n @rows << PartNum.new( :use => \"pcba\", :revision => \"a\" )\n @rows << PartNum.new( :use => \"pcba\", :revision => \"a\" )\n @rows << PartNum.new( :use => \"pcba\", :revision => \"a\" )\n @rows << PartNum.new( :use => \"pcba\", :revision => \"a\" )\n else\n @rows << PartNum.new\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rows }\n end\n end",
"def create\n @board = Board.create(params[:board])\n\n respond_to do |format|\n if @board.persisted?\n format.html { redirect_to @board, notice: 'Board was successfully created.' }\n format.json { render json: @board, status: :created, location: @board }\n else\n format.html { render action: \"new\" }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @storyboard_cell = StoryboardCell.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @storyboard_cell }\n end\n end",
"def new\n @club = Club.find_by_slug(params[:club_id])\n @team = @club.teams.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def create\n @board = Board.new(board_params)\n @board.network_id = current_user.network_id\n @board.user = current_user\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to @board, notice: 'Board was successfully created.' }\n format.json { render :show, status: :created, location: @board }\n else\n format.html { render :new }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @multi_board = MultiBoard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @multi_board }\n end\n end",
"def create\n @board = Board.new(params[:board])\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to(categories_path, :notice => 'Board was successfully created.') }\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"def create\n @modboard = current_user.moodboards.new(params[:moodboard])\n\n respond_to do |format|\n if @moodboard.save\n format.html { redirect_to @moodboard, notice: 'Moodboard was successfully created.' }\n format.json { render action: 'show', status: :created, location: @moodboard }\n else\n format.html { render action: 'new' }\n format.json { render json: @moodboard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @team = Team.new\n @sports = Sport.all\n @levels = Level.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @team }\n end\n end",
"def new\n @gitto = Gitto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gitto }\n end\n end",
"def create\n @board = Board.new(board_params)\n @board.user_id = current_user.id\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to user_board_path(current_user.id, @board), notice: 'Board was successfully created.' }\n format.json { render :show, status: :created, location: @board }\n else\n format.html { render :new }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n response.headers['Content-Type'] = 'text/javascript'\n\n attributes = params.require(:board).permit(:name)\n @board = Board.create!(attributes)\n $redis.publish('boards:create', @board.to_json)\n render nothing: true\n end",
"def create\n @board = Board.new(board_params)\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to @board }\n else\n format.html { render :new }\n end\n end\n end",
"def create\r\n # データを作成する。\r\n ActiveRecord::Base.transaction do\r\n board_param = params[:board]\r\n if board_param[\"image\"].present?\r\n @image_path = Imgur.new('97261fb9958613a').anonymous_upload(board_param[\"image\"])\r\n end\r\n @board = Board.new(\r\n title: board_param[:title],\r\n description: board_param[:description],\r\n image_path: @image_path,\r\n tag_list: board_param[:tagList],\r\n contents: board_param[:contents],\r\n contents_html: board_param[:contentsHtml],\r\n author: @current_user.username\r\n )\r\n @board.save!\r\n end\r\n render :index, formats: :json, status: :created\r\n end",
"def create\n @board = session[:board]\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to @board, notice: 'Board was successfully created.' }\n format.json { render json: @board, status: :created, location: @board }\n else\n format.html { render action: \"new\" }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @man_board = ManBoard.new(man_board_params)\n\n respond_to do |format|\n if @man_board.save\n format.html { redirect_to @man_board, notice: 'Man board was successfully created.' }\n format.json { render :show, status: :created, location: @man_board }\n else\n format.html { render :new }\n format.json { render json: @man_board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @club = Club.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @club }\n end\n end",
"def new\n @computer = Computer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @computer }\n end\n end",
"def new\n @computer = Computer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @computer }\n end\n end",
"def new\n @comp = Comp.new\n\t@games = Game.find_all_by_comp_id(nil)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comp }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html { render \"new\", :layout=>false}\n format.json { render json: @team }\n end\n end",
"def create\n @gameboard = Gameboard.new(params[:gameboard])\n\n respond_to do |format|\n if @gameboard.save\n format.html { redirect_to @gameboard, notice: 'Gameboard was successfully created.' }\n format.json { render json: @gameboard, status: :created, location: @gameboard }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gameboard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @tile = Tile.new\n @grid_id = params[:grid_id]\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 @club = Club.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @club }\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 @boardmember = Boardmember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @boardmember }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @nightclub = Nightclub.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nightclub }\n end\n end",
"def new\n\n\n @goal_id = params[:id]\n @milestone = Milestone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @milestone }\n end\n end",
"def new\n @site = Site.new \n puts \"Got here\"\n #2.times { @site.connections.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end",
"def new\n populate_players\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @game }\n end\n end",
"def new\n @mtb_among_card_type = MtbAmongCardType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mtb_among_card_type }\n end\n end",
"def new\n @swim_team = SwimTeam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @swim_team }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @forum }\n end\n end",
"def new\n (kick and return) if not is_god?\n @team = Team.new\n @mode = :new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @team }\n end\n end",
"def new\n @colleague = Colleague.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @colleague }\n end\n end",
"def new\n @colleague = Colleague.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @colleague }\n end\n end",
"def new\n @story = Story.new\n @roles = Role.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end",
"def new\n @teams = Team.find(:all, :order => 'name ASC').collect {|t| [ t.name, t.id ] }\n @game = Game.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @game }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @team }\n end\n end",
"def new\n @community = Community.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @community }\n end\n end",
"def new\n @missionmaker = Missionmaker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @missionmaker }\n end\n end",
"def create\n @board = Board.new(board_params)\n @board.user_id = current_user.id\n @board.topic = params[:board][:topic]\n\n respond_to do |format|\n if @board.save\n flash[:success] = t(\"boards.flash.success.create\")\n format.html { redirect_to @board }\n format.json { render :show, status: :created, location: @board }\n else\n format.html { render :new }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @freeboard = Freeboard.new(freeboard_params)\n\n respond_to do |format|\n if @freeboard.save\n format.html { redirect_to @freeboard, notice: 'Freeboard was successfully created.' }\n format.json { render action: 'show', status: :created, location: @freeboard }\n else\n format.html { render action: 'new' }\n format.json { render json: @freeboard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def multiple_new\n @customer_set = CustomerSet.new\n\n respond_to do |format|\n format.html # multiple_new.html.erb\n format.json { render json: @customer_set }\n end\n end",
"def new\n @story = Story.find(params[:story_id])\n @frame = @story.frames.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @frame }\n end\n end",
"def new\n @board = Board.new\n end",
"def new\n @bl = Bl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bl }\n end\n end",
"def new\n @sudoku = Sudoku.new\n 9.times do\n detail = @sudoku.details.build\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sudoku }\n end\n end"
] |
[
"0.765537",
"0.73813117",
"0.7373626",
"0.7373626",
"0.7373626",
"0.7358786",
"0.73242414",
"0.72853667",
"0.71558535",
"0.68685913",
"0.67852145",
"0.67022324",
"0.66908336",
"0.6659409",
"0.6654111",
"0.662626",
"0.6616006",
"0.6602182",
"0.6602182",
"0.65454155",
"0.65227604",
"0.65227604",
"0.64963734",
"0.6431591",
"0.6427122",
"0.642598",
"0.642598",
"0.642598",
"0.6402507",
"0.6401023",
"0.63661",
"0.6364236",
"0.6356919",
"0.63566273",
"0.63562965",
"0.6350385",
"0.63406736",
"0.6326424",
"0.6317607",
"0.63030094",
"0.6298996",
"0.6296557",
"0.6231303",
"0.6230096",
"0.62277514",
"0.62275374",
"0.62241405",
"0.6213494",
"0.6206938",
"0.61953944",
"0.61949176",
"0.6184272",
"0.6174296",
"0.6168985",
"0.6168792",
"0.61664194",
"0.61635613",
"0.61601526",
"0.6154292",
"0.6148344",
"0.6148344",
"0.6140772",
"0.611189",
"0.61080694",
"0.6105061",
"0.6102832",
"0.61010367",
"0.6099246",
"0.6090812",
"0.6090546",
"0.6090546",
"0.6090546",
"0.6090546",
"0.6090546",
"0.6090546",
"0.6090546",
"0.6088298",
"0.6084722",
"0.6081339",
"0.607649",
"0.60714823",
"0.60706025",
"0.60664403",
"0.60643035",
"0.60546035",
"0.60546035",
"0.604573",
"0.6045413",
"0.60424924",
"0.60424924",
"0.60424924",
"0.60353065",
"0.6019562",
"0.6018132",
"0.60079026",
"0.60028255",
"0.600026",
"0.59936494",
"0.5980134",
"0.59793043"
] |
0.8042196
|
0
|
POST /multi_boards POST /multi_boards.json
|
def create
@multi_board = MultiBoard.new(params[:multi_board])
respond_to do |format|
if @multi_board.save
format.html { redirect_to @multi_board, notice: 'Multi board was successfully created.' }
format.json { render json: @multi_board, status: :created, location: @multi_board }
else
format.html { render action: "new" }
format.json { render json: @multi_board.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @multi_board = MultiBoard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @multi_board }\n end\n end",
"def create\n # render json: params\n render json: UserBoards.create(params[\"user_board\"])\n end",
"def create\n\n #figure out what type of board we need to make\n if params[:board_type] == 'SpecificBoard'\n @board = SpecificBoard.new(params[:board])\n else\n @board = GenericBoard.new(params[:board])\n end\n \n respond_to do |format|\n if @board.save\n flash[:notice] = 'Board listing was successfully created.'\n format.html { redirect_to(root_path) }\n else\n @existing_locations = current_user.board_locations.ordered_by_desc_creation\n (Board::MAX_IMAGES - @board.images.length).times {@board.images.build}\n format.html { render :action => \"new\" }\n end\n end\n end",
"def create\n\t\t\t\tif params[:image]\n\t\t\t\t\tif params[:board] #android\n\t\t\t\t\t\tboard_params = JSON.parse(params[:board]) \n\t\t\t\t\t\t@board = @user.boards.new({user_id: @user.id, title: board_params['title'], description: board_params['description'], picture_attributes: {image: params[:image]}}) \n\t\t\t\t\telse\n\t\t\t\t\t\t@board = @user.boards.new({user_id: @user.id, title: params[:title], description: params[:description], picture_attributes: {image: params[:image]}}) \n\t\t\t\t\tend\t\t\t\t\t\n\t\t\t\telse\n\t\t\t\t\t@board = @user.boards.create({title: params[:board][:title], description: params[:board][:description]})\t\n\t\t\t\tend\n\n\t\t\t\trespond_to do |format|\n\t\t\t\t\tif @board.save\n\t\t\t\t\t\t@user.add_role :author, @board\n\t\t\t\t\t\tformat.html { redirect_to @board, notice: 'Board was successfully created.' }\n\t\t\t\t\t\tformat.json { render json: @board, status: :created, location: @board }\n\t\t\t\t\telse\n\t\t\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\t\t\tformat.json { render json: @board.errors, status: :unprocessable_entity }\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend",
"def index\n @boards = Board.all\n data = []\n @boards.each do |i|\n data.push({\"name\" => i.name, \"id\" =>i.id.to_s})\n end\n\n render json: data\n #render \"boards/index\"\n end",
"def create\n @board = current_user.boards.build(board_params)\n if @board.save\n flash[:success] = \"Board created!\"\n redirect_to [@current_user, @board]\n else\n error = ''\n @board.errors.full_messages.each do |m|\n error += m\n end\n flash[:danger] = error\n redirect_to @current_user\n end\n end",
"def board_params\n params.require(:board).permit(:network_id, :name, :group_id_for_yammer_post)\n end",
"def create\n @board = Board.new(params[:board])\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to @board, :notice => 'Board was successfully created.' }\n format.json { render :json => @board, :status => :created, :location => @board }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @board.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\r\n # データを作成する。\r\n ActiveRecord::Base.transaction do\r\n board_param = params[:board]\r\n if board_param[\"image\"].present?\r\n @image_path = Imgur.new('97261fb9958613a').anonymous_upload(board_param[\"image\"])\r\n end\r\n @board = Board.new(\r\n title: board_param[:title],\r\n description: board_param[:description],\r\n image_path: @image_path,\r\n tag_list: board_param[:tagList],\r\n contents: board_param[:contents],\r\n contents_html: board_param[:contentsHtml],\r\n author: @current_user.username\r\n )\r\n @board.save!\r\n end\r\n render :index, formats: :json, status: :created\r\n end",
"def destroy\n @multi_board = MultiBoard.find(params[:id])\n @multi_board.destroy\n\n respond_to do |format|\n format.html { redirect_to multi_boards_url }\n format.json { head :no_content }\n end\n end",
"def create\n @board = Board.new(params[:board])\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to @board, notice: 'board was successfully created.' }\n format.json { render json: @board, status: :created, location: @board }\n else\n format.html { render action: \"new\" }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @board = Board.new(params[:board])\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to @board, notice: 'Board was successfully created.' }\n format.json { render json: @board, status: :created, location: @board }\n else\n format.html { render action: \"new\" }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @board = Board.new(params[:board])\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to @board, notice: 'Board was successfully created.' }\n format.json { render json: @board, status: :created, location: @board }\n else\n format.html { render action: \"new\" }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @board = Board.new(board_params)\n @board.user_id = current_user.id\n @board.organization_id = current_user.organization_id\n # update subscription\n subscription = current_user.subscription || current_user.organization.subscription\n Subscription.update(subscription.id, num_of_board: subscription.num_of_board + 1)\n respond_to do |format|\n if @board.save\n format.html { redirect_to root_path, notice: 'Board was successfully created.' }\n format.json { render :show, status: :created, location: @board }\n else\n format.html { render :new }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @board = Board.new(board_params)\n @board.user_id = current_user.id\n\n if @board.name\n @board.board_slug = @board.name.downcase.gsub(\" \", '-')\n end\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to back_to_board, notice: 'Board was successfully created.' }\n format.json { render :show, status: :created, location: back_to_board }\n else\n format.html { render :new }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n response.headers['Content-Type'] = 'text/javascript'\n\n attributes = params.require(:board).permit(:name)\n @board = Board.create!(attributes)\n $redis.publish('boards:create', @board.to_json)\n render nothing: true\n end",
"def create\n @board = Board.new(board_params)\n\n @generator = GenerateBoard.new(width: @board.width, height: @board.height, number_of_mines: @board.number_of_mines)\n @hidden_array = @generator.board\n @blank_array = @generator.blank_board\n\n @board.array = @hidden_array\n @board.blank = @blank_array\n\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to @board, notice: \"Board was successfully created.\" }\n format.json { render :show, status: :created, location: @board }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n return\n #Board.generate()\n #@board = Board.new(params[:board])\n\n respond_to do |format|\n #if @board.save\n #format.html { redirect_to @board, :notice => 'Board was successfully created.' }\n #format.json { render :json => @board, :status => :created, location: @board }\n #else\n format.html { render :action => \"new\" }\n format.json { render :json => @board.errors, :status => :unprocessable_entity }\n #end\n end\n end",
"def create_board(project, name)\n body = { name: name }\n post(\"/projects/#{url_encode project}/boards\", body: body)\n end",
"def create\n @board = Board.new(board_params)\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to @board, notice: \"Board was successfully created.\" }\n format.json { render :show, status: :created, location: @board }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @multi_board = MultiBoard.find(params[:id])\n\n respond_to do |format|\n if @multi_board.update_attributes(params[:multi_board])\n format.html { redirect_to @multi_board, notice: 'Multi board was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @multi_board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def boards\n return @boards if @boards\n @boards = Client.get(\"/organizations/#{id}/boards/all\").json_into(Board)\n end",
"def create\n @board = Board.new(board_params)\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to @board, notice: 'Board was successfully created.' }\n format.json { render :show, status: :created, location: @board }\n else\n format.html { render :new }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @board = Board.new(board_params)\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to @board, notice: 'Board was successfully created.' }\n format.json { render :show, status: :created, location: @board }\n else\n format.html { render :new }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @board = Board.new(board_params)\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to @board, notice: 'Board was successfully created.' }\n format.json { render :show, status: :created, location: @board }\n else\n format.html { render :new }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@board = current_user.boards.create(params[:board])\n current_user.add_role :author, @board\n\t\t#@board = Beautorial.new(params[:board])\n\n\t\trespond_to do |format|\n\t\t\tif @board.save\n\t\t\t\tformat.html { redirect_to @board, notice: 'Board was successfully created.' }\n\t\t\t\tformat.json { render json: @board, status: :created, location: @board }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @board.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\n @board = current_user.boards.build(board_params)\n if @board.save\n redirect_to boards_path , notice: 'Task was successfully created.'\n else\n render 'new'\n end\n end",
"def create\n @board = Board.new(board_params)\n\n if @board.save\n render :show, status: :created\n else\n render json: @board.errors, status: :unprocessable_entity\n end\n end",
"def create\n @board = Board.new(board_params)\n @board.network_id = current_user.network_id\n @board.user = current_user\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to @board, notice: 'Board was successfully created.' }\n format.json { render :show, status: :created, location: @board }\n else\n format.html { render :new }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @board = Board.new(board_params)\n @board.user_id = current_user.id\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to user_board_path(current_user.id, @board), notice: 'Board was successfully created.' }\n format.json { render :show, status: :created, location: @board }\n else\n format.html { render :new }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @board = Board.new(board_params)\n last_board = Board.last\n @board.order = if last_board then last_board.order + 1 else 1 end\n\n if @board.save\n update_boards(true)\n else\n respond_to do |format|\n format.js { render :new }\n end\n end\n end",
"def index\n @boards = Board.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boards }\n end\n end",
"def index\n @boards = Board.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boards }\n end\n end",
"def show\n @multi_board = MultiBoard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @multi_board }\n end\n end",
"def boards\n return @boards unless @boards.empty?\n\n endpoint = \"/1/members/#{username}/boards?\"\n response = Client.get(endpoint)\n\n @boards = response.map do |board|\n Board.new(id: board['id'], name: board['name'])\n end\n end",
"def create\n @board = Board.create(params[:board])\n\n respond_to do |format|\n if @board.persisted?\n format.html { redirect_to @board, notice: 'Board was successfully created.' }\n format.json { render json: @board, status: :created, location: @board }\n else\n format.html { render action: \"new\" }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_boards\n\t\t\t@boards = @intranet.boards\n\t\tend",
"def update_boards\n selected_board_id = params[:board_id]\n photo_id = params[:image_id]\n message = \"\"\n #Category is having many to many relationship\n\n #checking if the board already contains this image or not \n if Category.find_by(board_id: selected_board_id, image_id: photo_id).present?\n message = \"already\"\n else\n cat = Category.new(board_id: selected_board_id, image_id: photo_id)\n if cat.save\n message = \"success\"\n else\n message = \"failed\"\n end\n end\n render :json => {message: message}\n end",
"def create\n @board = Board.new(board_params)\n @board.user_id = current_user.id\n @board.topic = params[:board][:topic]\n\n respond_to do |format|\n if @board.save\n flash[:success] = t(\"boards.flash.success.create\")\n format.html { redirect_to @board }\n format.json { render :show, status: :created, location: @board }\n else\n format.html { render :new }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def board_params\n params.require(:board).permit(:name, :description, project_ids: [])\n end",
"def create\n @board = Board.new(board_params)\n\n respond_to do |format|\n if @board.name!=\"all notes\" and @board.name!=\"without board\" and @board.save \n format.html { redirect_to \"/dynamics/#{@board.dynamic_id}\"}\n format.json { render :show, status: :created, location: @board }\n else\n format.html { redirect_to \"/dynamics/#{@board.dynamic_id}\" }\n format.json { render :show, status: :created, location: @board }\n end\n end\n if @board.name==\"\"\n @board.name=\"undefined\"\n @board.save\n end\n end",
"def index\r\n set_data_from_param\r\n @page_info = resources_with_pagination(@boards)\r\n render formats: :json\r\n end",
"def create\n @modboard = current_user.moodboards.new(params[:moodboard])\n\n respond_to do |format|\n if @moodboard.save\n format.html { redirect_to @moodboard, notice: 'Moodboard was successfully created.' }\n format.json { render action: 'show', status: :created, location: @moodboard }\n else\n format.html { render action: 'new' }\n format.json { render json: @moodboard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @man_board = ManBoard.new(man_board_params)\n\n respond_to do |format|\n if @man_board.save\n format.html { redirect_to @man_board, notice: 'Man board was successfully created.' }\n format.json { render :show, status: :created, location: @man_board }\n else\n format.html { render :new }\n format.json { render json: @man_board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @board = session[:board]\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to @board, notice: 'Board was successfully created.' }\n format.json { render json: @board, status: :created, location: @board }\n else\n format.html { render action: \"new\" }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @board = Board.new(params[:board])\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to(categories_path, :notice => 'Board was successfully created.') }\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"def index\n @boards = Board.all\n end",
"def index\n @boards = Board.all\n end",
"def index\n @boards = Board.all\n end",
"def index\n @boards = Board.all\n end",
"def index\n @boards = Board.all\n end",
"def index\n @boards = Board.all\n end",
"def index\n @boards = Board.all\n end",
"def index\n @boards = Board.all\n end",
"def index\n @boards = Board.all\n end",
"def index\n\n respond_to do |format|\n format.html { @boards = Board.where network_id: current_user.network_id }\n format.json { @boards = Board.where network_id: current_user.network_id }\n \n end\n end",
"def create\n @board_thread = BoardThread.new(board_thread_params)\n\n respond_to do |format|\n if @board_thread.save\n format.html { redirect_to action: \"index\", notice: 'Board thread was successfully created.' }\n format.json { render action: 'show', status: :created, location: @board_thread }\n else\n format.html { render action: 'new' }\n format.json { render json: @board_thread.errors, status: :unprocessable_entity }\n end\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: @boards }\n end\n end",
"def create\n @board_info = BoardInfo.new(params[:board_info])\n\n respond_to do |format|\n if @board_info.save\n format.html { redirect_to @board_info, notice: 'Board info was successfully created.' }\n format.json { render json: @board_info, status: :created, location: @board_info }\n else\n format.html { render action: \"new\" }\n format.json { render json: @board_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @board = Board.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board }\n end\n end",
"def create\n @board = Board.new(board_params)\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to @board }\n else\n format.html { render :new }\n end\n end\n end",
"def new\n @board = Board.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board }\n end\n end",
"def new\n @board = Board.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board }\n end\n end",
"def new\n @board = Board.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board }\n end\n end",
"def create\n @board = Board.new(params[:board])\n\n respond_to do |format|\n if @board.save\n @board.id = @board.country_id\n format.html { redirect_to board_list_path(@board), action: :list, notice: 'Board was successfully created.' }\n format.json { render json: @board, params => {:country_id => params[:country_id]}, action: :list, status: :created, location: @board }\n else\n #format.html { render action: \"new\" }\n @board.id = params[:board][:country_id]\n format.html { redirect_to board_list_path(@board), action: :list, notice: 'Board was NOT created.' }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gameboard = Gameboard.new(params[:gameboard])\n\n respond_to do |format|\n if @gameboard.save\n format.html { redirect_to @gameboard, notice: 'Gameboard was successfully created.' }\n format.json { render json: @gameboard, status: :created, location: @gameboard }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gameboard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_multiple\n puts params\n\n @ticker_activities = params[\"_json\"].map do |params_hash|\n # ToDo => whitelisted_params einbauen. Siehe mein Beitrag bei stackoverflow unter http://stackoverflow.com/questions/35082478/handling-json-array-from-android-in-rails\n ticker = TickerActivity.create!(params_hash) \n end\n\n respond_to do |format|\n # Check that all the ticker_activities are valid and can be saved\n if @ticker_activities.all? { |ticker_activity| ticker_activity.valid? }\n # Now we know they are valid save each ticker_activity\n @ticker_activities.each do |ticker_activity|\n ticker_activity.save\n end\n\n # Respond with the json versions of the saved ticker_activites\n format.json { render json: @ticker_activities, status: :created, location: multiple_ticker_locations_url }\n \n else\n # We can't save *all* the ticker_activities so we\n # respond with the corresponding validation errors for the ticker_activities\n @errors = @ticker_activities.map { |ticker_activity| ticker_activity.errors }\n format.json { render json: @errors, status: :unprocessable_entity }\n end\n end\nend",
"def create\n @board = Board.where(game_id: 47).first\n puts \"here\"\n @move = Move.new(move_params)\n puts @move\n puts params[:move][:squares]\n puts \"after\"\n\n #@move.squares = []\n #@move.squares.push(params[:move][:squares].split(','))\n\n\n puts @move.squares\n @move.created_at = Date.new\n @move.piece_id = 9\n puts @move.inspect\n\n\n\n puts \"after build\"\n puts @board.moves\n\n #respond_to do |format|\n if @board.moves.create(move_params)\n render json: @board.moves\n #flash[:notice] = 'Move was successfully created.'\n\n else\n format.html { render :new }\n format.json { render json: @move.errors, status: :unprocessable_entity }\n end\n #end\n end",
"def new\n @board = Board.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @board }\n end\n end",
"def create\n @boardgame =Boardgame.new(boardgame_params)\n\n respond_to do |format|\n if @boardgame.save\n current_user.boardgames << @boardgame\n format.html { redirect_to @boardgame, notice: 'Boardgame was successfully created.' }\n format.json { render :show, status: :created, location: @boardgame }\n else\n format.html { render :new }\n format.json { render json: @boardgame.errors, status: :unprocessable_entity }\n end\n end\n end",
"def board_params\n params.require(:board).permit(:name, :user_id, board_pinners_attributes: [:user_id, :board_id])\n end",
"def new\n @sudoku = SudokuTopic.new\n\n\n 9.times do\n row = @sudoku.sudoku_rows.build\n 9.times { row.sudoku_columns.build }\n end\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sudoku }\n end\n end",
"def board_params\n params.require(:board).permit(:email, :width, :height, :number_of_mines, :name, :array, :blank)\n end",
"def create\n @messageboard = Messageboard.new(messageboard_params)\n\n respond_to do |format|\n if @messageboard.save\n format.html { redirect_to @messageboard, notice: 'Messageboard was successfully created.' }\n format.json { render :show, status: :created, location: @messageboard }\n else\n format.html { render :new }\n format.json { render json: @messageboard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def board_params\n params.require(:board).permit(:name, :organization_id, :user_id)\n end",
"def create\n @board = Board.new(board_params)\n @size = Size.new\n @accessory = Accessory.new\n\n @user = current_user\n respond_to do |format|\n if @board.save\n format.html { redirect_to @board, notice: 'Board was successfully created.' }\n format.json { render :show, status: :created, location: @board }\n else\n format.html { render :new }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n # BoardMailer.new_board(@board).deliver_now\n @user.tokens += -2\n @user.save\n end\n end",
"def board_params\n params.require(:board).permit(:name, :user_id, :board_id, :image_id)\n end",
"def boards(fields: nil)\n get_boards_collection(\"/me/boards/\", nil, fields)\n end",
"def create\n name, board_id = params[:name], params[:board_id]\n @list = List.new\n @list.name = name\n @list.board_id = board_id\n @list.order = List.get_max_order board_id\n @lists_size = List.get_size board_id\n respond_to do |format|\n if @lists_size < 6 && @list.save\n @lists_size += 1\n format.js { render action: 'create', status: :created, location: @list}\n else\n format.js { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @storyboard = Storyboard.new(params[:storyboard])\n\n respond_to do |format|\n if @storyboard.save\n format.html { redirect_to @storyboard, notice: 'Storyboard was successfully created.' }\n format.json { render json: @storyboard, status: :created, location: @storyboard }\n else\n format.html { render action: \"new\" }\n format.json { render json: @storyboard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_board\n @board = {'a1'=>' ','a2'=>' ','a3'=>' ','b1'=>' ','b2'=>' ','b3'=>' ','c1'=>' ','c2'=>' ','c3'=>' '}\n end",
"def create\n @board = Board.friendly.find(params[:board_id])\n @discussion = @board.discussions.build(discussion_params)\n\n respond_to do |format|\n if @discussion.save\n format.html { redirect_to board_discussion_path(@board, @discussion), flash: {success: 'Discussion was successfully created.' } }\n format.json { render action: 'show', status: :created, location: @discussion }\n else\n format.html { redirect_to @board, alert: \"Discussion could not be created.\" }\n format.json { render json: @discussion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def board_params\n params.require(:board).permit(:title, :body, :user_id, :category)\n end",
"def create_story(board, params)\n params[\"position\"] = board.stories.empty? ? 1 : board.stories.length + 1\n return new_story(board.id, params).merge({\"id\" => get_uuids.first})\n end",
"def set_board\n @board = current_user.boards.find_by(id: params[:board_id])\n render(json: {error: \"Board Not Found\"}, status: 404) if !@board\n end",
"def board_params\n params.require(:board).permit({:card_order => []})\n end",
"def new\n return\n @board = Board.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @board }\n end\n end",
"def create\n @score_board = ScoreBoard.new(score_board_params)\n\n respond_to do |format|\n if @score_board.save\n format.html { redirect_to @score_board, notice: 'Score board was successfully created.' }\n format.json { render :show, status: :created, location: @score_board }\n else\n format.html { render :new }\n format.json { render json: @score_board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def leaderboard\n result = service.save(params.permit!.to_h[:leaderboard])\n render json: {success: true}\n end",
"def board_params\n params.require(:board).permit(:name, :tweet)\n end",
"def index\n @man_boards = ManBoard.all\n end",
"def index\n\n\t\t\t\toffset = params[:offset] || 0\n\t\t\t\tlimit = params[:limit] || 12\n\n\t\t\t\t@boards = Board.order(\"created_at DESC\").offset(offset).limit(limit)\n\n\t\t\t\trespond_to do |format|\n\t\t\t\t\t#format.html # index.html.erb\n\t\t\t\t\tformat.json \n\t\t\t\tend\n\t\t\tend",
"def create\n @post = Post.new(params.permit(:title, :content, :board_id))\n @post.user = @user\n if (@post.save)\n render json: @post, status: :created\n else\n render json: @post.errors, status: 422\n end\n end",
"def create\n\n @board, starting_plot, starting_plot_id = Board.create_new_board\n\n respond_to do |format|\n @board.transaction do\n if @board.save\n add_players_to_board\n\n # GameData::LocationsMonsters.new.fill_board(@board)\n\n @board.create_monster( :mouth_of_sauron, :dol_guldur )\n @board.create_monster( :black_serpent, :near_harad )\n\n @board.log( nil, 'setup.set_starting_plot', { plot_card: starting_plot_id } )\n @board.log( nil, 'setup.set_influence_in_shadow_pool', { count: starting_plot.influence.shadow_pool } )\n\n starting_plot.influence.init.each do |key, value|\n @board.log( nil, 'setup.set_influence_in_location', { count: value, location: key.to_s.humanize } )\n end\n\n @board.set_plot nil, 1, starting_plot_id, starting_plot\n\n format.html { redirect_to boards_path, notice: 'Board was successfully created.' }\n format.json { render :show, status: :created, location: @board }\n else\n format.html { render :new }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def new\n # @article = Article.new\n\n @board = Board.find(params[:board_id])\n @article = @board.articles.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end",
"def index\n @boards = Board.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @boards }\n end\n end",
"def create_board_list(project, board_id, label_id)\n post(\"/projects/#{url_encode project}/boards/#{board_id}/lists\", body: { label_id: label_id })\n end",
"def create_board(name, description = \"\", fields: nil)\n # Validate name\n ensure_param(name, \"You have to specify the board name.\")\n\n # Ensure only valid fields are used\n fields = ensure_board_fields(fields)\n\n # Create the board\n data = perform_network_request(\n method: \"POST\", url: versioned_url(\"/boards/\"),\n query: cleanup_params({fields: fields.join(\",\")}),\n body: cleanup_params({name: name, description: description})\n )\n\n # Wrap in a object\n ::Pinterest::Board.create(data.body[\"data\"])\n end",
"def create\n @board = Board.new(params[:board])\n\n respond_to do |format|\n if @board.save\n flash[:notice] = 'Board was successfully created.'\n format.html { redirect_to(@board) }\n format.xml { render :xml => @board, :status => :created, :location => @board }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @board.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def get_boards\n @courses = []\n if request.xhr? and params[:q].present?\n @boards = if params[:institution_id].present?\n #@boards = Institution.find(params[:institution_id]).publishers.map{|pub| pub.boards.where('name like ?',\"%#{params[:q]}%\").select('id,name')}.flatten.uniq\n Institution.find(params[:institution_id]).try(:boards).select('id,name').where('name like ?',\"%#{params[:q]}%\")\n elsif params[:center_id].present?\n Center.find(params[:center_id]).try(:boards).select('id,name').where('name like ?',\"%#{params[:q]}%\")\n elsif params[:academic_class_id].present?\n AcademicClass.find(params[:academic_class_id]).try(:boards).select('id,name').where('name like ?',\"%#{params[:q]}%\")\n end\n respond_to do |format|\n format.json { render json: @boards }\n end\n elsif request.xhr? and !params[:q].present? #used in teacher_class_rooms fields partial\n @boards = Center.find(params[:center_id]).try(:boards).select('id,name')\n respond_to do |format|\n format.json { render json: @boards.map{|b| Hash[value: b.id ,name: b.name]} }\n end\n end\n\n\n end"
] |
[
"0.65558285",
"0.6052207",
"0.6017639",
"0.5955247",
"0.5944999",
"0.589071",
"0.5879683",
"0.58716166",
"0.5822776",
"0.58199686",
"0.58197665",
"0.5805861",
"0.5805861",
"0.5792975",
"0.5789303",
"0.5780078",
"0.5767066",
"0.57580215",
"0.5733862",
"0.57283384",
"0.5728132",
"0.5716627",
"0.5714832",
"0.5714832",
"0.5714832",
"0.57089216",
"0.5698224",
"0.5682512",
"0.5645951",
"0.56256026",
"0.560515",
"0.5579359",
"0.5579359",
"0.55748326",
"0.5554871",
"0.5531171",
"0.54993105",
"0.5484809",
"0.54739106",
"0.5466783",
"0.5463536",
"0.5458679",
"0.54040164",
"0.53695154",
"0.53636974",
"0.53249085",
"0.5320265",
"0.5320265",
"0.5320265",
"0.5320265",
"0.5320265",
"0.5320265",
"0.5320265",
"0.53177416",
"0.53177416",
"0.53153557",
"0.52997553",
"0.5298562",
"0.5287262",
"0.5275051",
"0.5274238",
"0.5255471",
"0.5255471",
"0.5255471",
"0.525253",
"0.52431947",
"0.52413166",
"0.5233163",
"0.5231783",
"0.5225747",
"0.522041",
"0.521056",
"0.5197986",
"0.519415",
"0.51904875",
"0.5183354",
"0.5181912",
"0.5158227",
"0.515358",
"0.5149641",
"0.5147441",
"0.5147297",
"0.509502",
"0.5093194",
"0.50783867",
"0.50763464",
"0.5067182",
"0.50651026",
"0.50631976",
"0.50572884",
"0.50559163",
"0.5046924",
"0.50467044",
"0.5044831",
"0.5043877",
"0.50377494",
"0.50374424",
"0.5030266",
"0.5027406",
"0.50259674"
] |
0.72645885
|
0
|
PUT /multi_boards/1 PUT /multi_boards/1.json
|
def update
@multi_board = MultiBoard.find(params[:id])
respond_to do |format|
if @multi_board.update_attributes(params[:multi_board])
format.html { redirect_to @multi_board, notice: 'Multi board was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @multi_board.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @user = User.find(params[:user_id])\n @board = @user.boards.find(params[:id])\n @board.update_column(:content, params[:board].as_json)\n respond_to do |format|\n format.json { render json: @board }\n end\n end",
"def update\n render json: UserBoards.update(params[\"id\"], params[\"user_board\"])\n end",
"def create\n @multi_board = MultiBoard.new(params[:multi_board])\n\n respond_to do |format|\n if @multi_board.save\n format.html { redirect_to @multi_board, notice: 'Multi board was successfully created.' }\n format.json { render json: @multi_board, status: :created, location: @multi_board }\n else\n format.html { render action: \"new\" }\n format.json { render json: @multi_board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_board\n @board = current_user.boards.find_by(id: params[:board_id])\n render(json: {error: \"Board Not Found\"}, status: 404) if !@board\n end",
"def update\n @board = Board.find(params[:id])\n\n respond_to do |format|\n if @board.update_attributes(params[:board])\n format.html { redirect_to @board, notice: 'board was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @multi_board = MultiBoard.find(params[:id])\n @multi_board.destroy\n\n respond_to do |format|\n format.html { redirect_to multi_boards_url }\n format.json { head :no_content }\n end\n end",
"def update\n @board = Board.find(params[:id])\n\n respond_to do |format|\n if @board.update_attributes(params[:board])\n format.html { redirect_to @board, :notice => 'Board was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @board.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @board = Board.find(params[:id])\n \n fields = params[:board]\n \n respond_to do |format|\n if @board.update_attributes(fields)\n format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @board = Board.find(params[:id])\n\n respond_to do |format|\n if @board.update_attributes(params[:board])\n format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @board = Board.find(params[:id])\n\n respond_to do |format|\n if @board.update_attributes(params[:board])\n format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_boards\n selected_board_id = params[:board_id]\n photo_id = params[:image_id]\n message = \"\"\n #Category is having many to many relationship\n\n #checking if the board already contains this image or not \n if Category.find_by(board_id: selected_board_id, image_id: photo_id).present?\n message = \"already\"\n else\n cat = Category.new(board_id: selected_board_id, image_id: photo_id)\n if cat.save\n message = \"success\"\n else\n message = \"failed\"\n end\n end\n render :json => {message: message}\n end",
"def set_board\n @board =current_user.boards.find(params[:id])\n end",
"def update\n @board.update(params[:board].permit(:name))\n #respond_to do |format|\n # if\n # format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: 'edit' }\n # format.json { render json: @board.errors, status: :unprocessable_entity }\n # end\n #end\n end",
"def set_boards\n\t\t\t@boards = @intranet.boards\n\t\tend",
"def update\n if @board.update(board_params)\n render :show, status: :ok\n else\n render json: @board.errors, status: :unprocessable_entity\n end\n end",
"def set_board\n @board = Board.find(params[:id]||params[:board_id])\n end",
"def update\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to @board, notice: 'Board updated' }\n format.json { render :show, status: :ok, location: @board }\n else\n format.html { render :edit }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @multi_board = MultiBoard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @multi_board }\n end\n end",
"def new\n @multi_board = MultiBoard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @multi_board }\n end\n end",
"def update\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to @board, notice: \"Board was successfully updated.\" }\n format.json { render :show, status: :ok, location: @board }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to @board, notice: \"Board was successfully updated.\" }\n format.json { render :show, status: :ok, location: @board }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to @board}\n format.json { render :show, status: :ok, location: @board }\n else\n format.html { render :edit }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_board\n @board = current_user.boards.find(@list[:board_id])\n end",
"def update\n @board = Board.find_by_slug(params[:id])\n\n respond_to do |format|\n if @board.update_attributes(params[:board])\n format.html { redirect_to(categories_path, :notice => 'Board was successfully updated.') }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end",
"def update\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n format.json { render :show, status: :ok, location: @board }\n else\n format.html { render :edit }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n format.json { render :show, status: :ok, location: @board }\n else\n format.html { render :edit }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n format.json { render :show, status: :ok, location: @board }\n else\n format.html { render :edit }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n format.json { render :show, status: :ok, location: @board }\n else\n format.html { render :edit }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @board\n respond_to do |format|\n if @board.update(board_params)\n flash[:success] = t(\"boards.flash.success.update\")\n format.html { redirect_to @board }\n format.json { render :show, status: :ok, location: @board }\n else\n format.html { render :edit }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_board\n @board = Board.find(params[:id])\n end",
"def set_board\n @board = Board.find(params[:id])\n end",
"def set_board\n @board = Board.find(params[:id])\n end",
"def set_board\n @board = Board.find(params[:id])\n end",
"def set_board\n @board = Board.find(params[:board_id])\n end",
"def update\n @board = Board.find(params[:id])\n \n if @board.update(board_params)\n update_boards(true)\n else\n respond_to do |format|\n format.js { render :edit }\n end\n end\n end",
"def set_board\n @board = Board.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to user_board_path(current_user.id, @board), notice: 'Board was successfully updated.' }\n format.json { render :show, status: :ok, location: @board }\n else\n format.html { render :edit }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_board\n @board = Board.find(params[:id])\n end",
"def set_board\n @board = Board.find(params[:id])\n end",
"def set_board\n @board = Board.find(params[:id])\n end",
"def set_board\n @board = Board.find(params[:id])\n end",
"def set_board\n @board = Board.find(params[:id])\n end",
"def set_board\n @board = Board.find(params[:id])\n end",
"def set_board\n @board = Board.find(params[:id])\n end",
"def set_board\n @board = Board.find(params[:id])\n end",
"def set_board\n @board = Board.find(params[:id])\n end",
"def set_board\n @board = Board.find(params[:id])\n end",
"def set_board\n @board = Board.find(params[:id])\n end",
"def set_board\n @board = Board.find(params[:id])\n end",
"def set_board\n @board = Board.find(params[:id])\n end",
"def set_board\n @board = Board.find(params[:id])\n end",
"def set_board\n @board = Board.find(params[:id])\n end",
"def set_board\n @board = Board.find(params[:id])\n end",
"def set_board\n @board = Board.find(params[:id])\n end",
"def set_board\n @board = Board.find(params[:id])\n end",
"def set_board\n @board = Board.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to back_to_board, notice: 'Board was successfully updated.' }\n format.json { render :show, status: :ok, location: back_to_board }\n else\n format.html { render :edit }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @board = Board.new(board_params)\n @board.user_id = current_user.id\n @board.organization_id = current_user.organization_id\n # update subscription\n subscription = current_user.subscription || current_user.organization.subscription\n Subscription.update(subscription.id, num_of_board: subscription.num_of_board + 1)\n respond_to do |format|\n if @board.save\n format.html { redirect_to root_path, notice: 'Board was successfully created.' }\n format.json { render :show, status: :created, location: @board }\n else\n format.html { render :new }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_board\n @board = Board.find(params[:board_id])\n end",
"def set_board\n @board = Board.find(params[:board_id])\n end",
"def update\n @board_info = BoardInfo.find(params[:id])\n\n respond_to do |format|\n if @board_info.update_attributes(params[:board_info])\n format.html { redirect_to @board_info, notice: 'Board info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @board_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @test_board = TestBoard.find(params[:id])\n\n respond_to do |format|\n if @test_board.update_attributes(params[:test_board])\n format.html { redirect_to \"/test_boards\" , notice: 'Test board was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n ActiveRecord::Base.transaction do\r\n board_param = params[:board]\r\n\r\n if board_param[\"image_path\"].present?\r\n @image_path = board_param[\"image_path\"]\r\n end\r\n if board_param[\"image\"].present?\r\n @image_path = Imgur.new('97261fb9958613a').anonymous_upload(board_param[\"image\"])\r\n end\r\n\r\n @board = @board.update(\r\n title: board_param[:title],\r\n description: board_param[:description],\r\n image_path: @image_path,\r\n tag_list: board_param[:tagList],\r\n contents: board_param[:contents],\r\n contents_html: board_param[:contentsHtml]\r\n )\r\n end\r\n render :index, formats: :json, status: :created\r\n end",
"def set_board\n @board = Board.find(params[:id])\n end",
"def update\n @board = Board.find_by_short_form(params[:id])\n\n respond_to do |format|\n if @board.update_attributes(params[:board])\n format.html { redirect_to @board, notice: 'Discussion created.' }\n format.json { head :no_content }\n else\n format.html { redirect_to @board, notice: 'Failed to create new discussion.' }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @message_board = MessageBoard.find(params[:id])\n\n respond_to do |format|\n if @message_board.update_attributes(params[:message_board])\n format.html { redirect_to @message_board, notice: 'Message board was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message_board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @board.update(board_params) && \\\n @board.update(card_order: params[:card_order])\n format.html { redirect_to @board, notice: 'Board was successfully updated.' }\n format.json { render :show, status: :ok, location: @board }\n else\n format.html { render :edit }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to @board }\n else\n format.html { render :edit }\n end\n end\n end",
"def set_board\n @board = Board.find_by_link(params[:id])\n end",
"def update\n @storyboard = Storyboard.find(params[:id])\n\n respond_to do |format|\n if @storyboard.update_attributes(params[:storyboard])\n format.html { redirect_to @storyboard, notice: 'Storyboard was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @storyboard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @man_board.update(man_board_params)\n format.html { redirect_to @man_board, notice: 'Man board was successfully updated.' }\n format.json { render :show, status: :ok, location: @man_board }\n else\n format.html { render :edit }\n format.json { render json: @man_board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @board_in_project.update(board_in_project_params)\n\n else\n\n end\n end\n end",
"def create\n\t\t\t\tif params[:image]\n\t\t\t\t\tif params[:board] #android\n\t\t\t\t\t\tboard_params = JSON.parse(params[:board]) \n\t\t\t\t\t\t@board = @user.boards.new({user_id: @user.id, title: board_params['title'], description: board_params['description'], picture_attributes: {image: params[:image]}}) \n\t\t\t\t\telse\n\t\t\t\t\t\t@board = @user.boards.new({user_id: @user.id, title: params[:title], description: params[:description], picture_attributes: {image: params[:image]}}) \n\t\t\t\t\tend\t\t\t\t\t\n\t\t\t\telse\n\t\t\t\t\t@board = @user.boards.create({title: params[:board][:title], description: params[:board][:description]})\t\n\t\t\t\tend\n\n\t\t\t\trespond_to do |format|\n\t\t\t\t\tif @board.save\n\t\t\t\t\t\t@user.add_role :author, @board\n\t\t\t\t\t\tformat.html { redirect_to @board, notice: 'Board was successfully created.' }\n\t\t\t\t\t\tformat.json { render json: @board, status: :created, location: @board }\n\t\t\t\t\telse\n\t\t\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\t\t\tformat.json { render json: @board.errors, status: :unprocessable_entity }\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend",
"def update\n @gameboard = Gameboard.find(params[:id])\n\n respond_to do |format|\n if @gameboard.update_attributes(params[:gameboard])\n format.html { redirect_to @gameboard, notice: 'Gameboard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gameboard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit_board_list(project, board_id, id, position)\n put(\"/projects/#{url_encode project}/boards/#{board_id}/lists/#{id}\", body: { position: position })\n end",
"def update\n respond_to do |format|\n if @cubboard.update(cubboard_params)\n format.html { redirect_to @cubboard, notice: \"Cubboard was successfully updated.\" }\n format.json { render :show, status: :ok, location: @cubboard }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @cubboard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_board\n if params[:id].present?\n @board = Board.find(params[:id])\n else\n @user = User.find_by_username(params[:username])\n @board = Board.find_by_user_id_and_board_slug(@user.id, params[:board_slug])\n end\n end",
"def update\n respond_to do |format|\n if @live_aboard.update(live_aboard_params)\n format.html { redirect_to @live_aboard, notice: 'Live aboard was successfully updated.' }\n format.json { render :show, status: :ok, location: @live_aboard }\n else\n format.html { render :edit }\n format.json { render json: @live_aboard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_board\r\n #ページに表示するデータを取得する。\r\n @board = Board.find(params[:id])\r\n end",
"def board_params\n params.require(:board).permit(:network_id, :name, :group_id_for_yammer_post)\n end",
"def index\n @boards = Board.all\n data = []\n @boards.each do |i|\n data.push({\"name\" => i.name, \"id\" =>i.id.to_s})\n end\n\n render json: data\n #render \"boards/index\"\n end",
"def update\n respond_to do |format|\n if @side_board.update(side_board_params)\n format.html { redirect_to @side_board, notice: 'Side board was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @side_board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def boards\n return @boards if @boards\n @boards = Client.get(\"/organizations/#{id}/boards/all\").json_into(Board)\n end",
"def update_board\n board = current_user.user_chessboard || current_user.build_user_chessboard\n board.update_attributes! board_params\n redirect_to \"/\"\n end",
"def create\n @board = Board.new(board_params)\n @board.user_id = current_user.id\n\n if @board.name\n @board.board_slug = @board.name.downcase.gsub(\" \", '-')\n end\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to back_to_board, notice: 'Board was successfully created.' }\n format.json { render :show, status: :created, location: back_to_board }\n else\n format.html { render :new }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n team_name = params[:name]\n team_description = params[:description]\n team_id = params[:id]\n\n respond_to do |format|\n if OkrTeam.where(id: team_id).update_all(name: team_name, description: team_description)\n format.json { render json: 'Team is updated successfully!', status: :ok }\n else\n format.json { render json: 'Error!', status: :unprocessable_entity }\n end\n end\n end",
"def index\n @boards = Board.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boards }\n end\n end",
"def index\n @boards = Board.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boards }\n end\n end",
"def set_boardgame\n @boardgame = Boardgame.find(params[:id])\n end",
"def set_boardgame\n @boardgame = Boardgame.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @board.update(board_params)\n format.html { redirect_to(@board, :notice => '更新しました') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @board.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @board_thread.update(board_thread_params)\n format.html { redirect_to @board_thread, notice: 'Board thread was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @board_thread.errors, status: :unprocessable_entity }\n end\n end\n end",
"def UpdateForum id,params = {}\n \n APICall(path: \"forums/#{id}.json\",method: 'PUT',payload: params.to_json)\n \n end",
"def update\n @games_leaderboard = Games::Leaderboard.find(params[:id])\n\n if @games_leaderboard.update(games_leaderboard_params)\n head :no_content\n else\n render json: @games_leaderboard.errors, status: :unprocessable_entity\n end\n end",
"def create\n\t\t@board = current_user.boards.create(params[:board])\n current_user.add_role :author, @board\n\t\t#@board = Beautorial.new(params[:board])\n\n\t\trespond_to do |format|\n\t\t\tif @board.save\n\t\t\t\tformat.html { redirect_to @board, notice: 'Board was successfully created.' }\n\t\t\t\tformat.json { render json: @board, status: :created, location: @board }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @board.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n @mobile = Story.find(params[:id])\n @mobile.update(mobile_params)\n\n redirect_to mobile_path(@mobile)\n end",
"def board(project, id)\n get(\"/projects/#{url_encode project}/boards/#{id}\")\n end",
"def update\n @storyboard_cell = StoryboardCell.find(params[:id])\n\n respond_to do |format|\n if @storyboard_cell.update_attributes(params[:storyboard_cell])\n format.html { redirect_to @storyboard_cell, notice: 'Storyboard cell was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @storyboard_cell.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @boards = Board.all\n end"
] |
[
"0.63786983",
"0.6290787",
"0.6277463",
"0.61961484",
"0.61092675",
"0.6101314",
"0.609912",
"0.60944223",
"0.60743004",
"0.60743004",
"0.607125",
"0.5998887",
"0.5965327",
"0.5960679",
"0.59169346",
"0.5907754",
"0.5899616",
"0.5879339",
"0.587101",
"0.5866627",
"0.5866627",
"0.5862246",
"0.58617353",
"0.5859735",
"0.5840631",
"0.5831693",
"0.5831693",
"0.5831693",
"0.5831693",
"0.5819275",
"0.5808564",
"0.5808564",
"0.5808564",
"0.580791",
"0.57992387",
"0.57989967",
"0.5788555",
"0.57619226",
"0.5750633",
"0.5750633",
"0.5750633",
"0.5750633",
"0.5750633",
"0.5750633",
"0.5750633",
"0.5750633",
"0.5750633",
"0.5750633",
"0.5750633",
"0.5750633",
"0.5750633",
"0.5750633",
"0.5750633",
"0.5750633",
"0.5750633",
"0.5750633",
"0.5750633",
"0.57437027",
"0.57370937",
"0.57288575",
"0.57288575",
"0.5722861",
"0.5719167",
"0.5685659",
"0.55822843",
"0.5537398",
"0.55343956",
"0.55129635",
"0.5510837",
"0.5495118",
"0.54466116",
"0.543624",
"0.5414295",
"0.5403412",
"0.54026484",
"0.5387801",
"0.5368997",
"0.53657675",
"0.5334465",
"0.5327149",
"0.53234917",
"0.5293432",
"0.5287311",
"0.52849454",
"0.5278759",
"0.5271589",
"0.5270207",
"0.524131",
"0.524131",
"0.52330303",
"0.52330303",
"0.52320826",
"0.52254313",
"0.520675",
"0.52051586",
"0.5199516",
"0.51945543",
"0.5193404",
"0.51815116",
"0.5176719"
] |
0.738697
|
0
|
DELETE /multi_boards/1 DELETE /multi_boards/1.json
|
def destroy
@multi_board = MultiBoard.find(params[:id])
@multi_board.destroy
respond_to do |format|
format.html { redirect_to multi_boards_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @board = Board.find(params[:id])\n @board.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_boards_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: UserBoards.delete(params[\"id\"])\n end",
"def destroy\n @board.destroy\n respond_to do |format|\n format.html { redirect_to boards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board.destroy\n respond_to do |format|\n format.html { redirect_to boards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board.destroy\n respond_to do |format|\n format.html { redirect_to boards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board = Board.find(params[:id])\n @board.destroy\n\n respond_to do |format|\n format.html { redirect_to boards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board = Board.find(params[:id])\n @board.destroy\n\n respond_to do |format|\n format.html { redirect_to boards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board = Board.find(params[:id])\n @board.destroy\n\n respond_to do |format|\n format.html { redirect_to boards_url }\n format.json { head :ok }\n end\n end",
"def destroy\r\n # データを削除する。\r\n @board.destroy\r\n respond_to do |format|\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @board = Board.find_by_short_form(params[:id])\n @board.destroy\n\n respond_to do |format|\n format.html { redirect_to boards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_board = TestBoard.find(params[:id])\n @test_board.destroy\n\n respond_to do |format|\n format.html { redirect_to test_boards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board.destroy\n respond_to do |format|\n format.html { redirect_to user_boards_url, notice: 'Board was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n return\n @board = Board.find(params[:id])\n @board.destroy\n\n respond_to do |format|\n format.html { redirect_to boards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board.destroy\n respond_to do |format|\n format.html { redirect_to boards_url, notice: 'Board destroyed' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board = Board.find_by_slug(params[:id])\n @board.destroy\n\n respond_to do |format|\n format.html { redirect_to(boards_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n\n @board.destroy\n respond_to do |format|\n format.html { redirect_to boards_url, notice: 'Board was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board.destroy\n respond_to do |format|\n format.html { redirect_to boards_url, notice: 'Board was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board.destroy\n respond_to do |format|\n format.html { redirect_to boards_url, notice: 'Board was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board.destroy\n respond_to do |format|\n format.html { redirect_to boards_url, notice: 'Board was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board.destroy\n respond_to do |format|\n format.html { redirect_to boards_url, notice: 'Board was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board.destroy\n respond_to do |format|\n format.html { redirect_to boards_url, notice: \"Board was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board.destroy\n respond_to do |format|\n format.html { redirect_to boards_url, notice: \"Board was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board.destroy\n respond_to do |format|\n format.html { redirect_to \"/dynamics/#{@board.dynamic_id}\" }\n format.json { head :no_content }\n end\n end",
"def destroy \n #binding.pry\n @bulletin = Bulletin.find(params[:id]) \n @board = Board.find(@bulletin.board_id)\n @bulletin.destroy\n render json: @board\n end",
"def destroy\n @board.destroy\n respond_to do |format|\n format.html { redirect_to boards_url }\n end\n end",
"def destroy\n @board_info = BoardInfo.find(params[:id])\n @board_info.destroy\n\n respond_to do |format|\n format.html { redirect_to board_infos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @side_board.destroy\n respond_to do |format|\n format.html { redirect_to side_boards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board = Board.find_by_permalink(params[:id])\n @board.destroy\n\n respond_to do |format|\n format.html { redirect_to(boards_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dartboard = Dartboard.find(params[:id])\n @dartboard.destroy\n\n respond_to do |format|\n format.html { redirect_to dartboards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gameboard = Gameboard.find(params[:id])\n @gameboard.destroy\n\n respond_to do |format|\n format.html { redirect_to gameboards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @man_board.destroy\n respond_to do |format|\n format.html { redirect_to man_boards_url, notice: 'Man board was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize @board\n\n @board.destroy\n respond_to do |format|\n flash[:success] = t(\"boards.flash.success.destroy\")\n format.html { redirect_to boards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board.destroy\n\n respond_to do |format|\n format.html { redirect_to(boards_url, notice: \"削除しました\") }\n format.xml { head :ok }\n end\n end",
"def destroy\n @storyboard = Storyboard.find(params[:id])\n @storyboard.destroy\n\n respond_to do |format|\n format.html { redirect_to storyboards_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @board = Board.friendly.find(params[:board_id])\n @discussion.destroy\n respond_to do |format|\n format.html { redirect_to @board }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board.destroy\n respond_to do |format|\n format.html { redirect_to user_path(current_user.id), notice: 'Board was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @moodboard.destroy\n respond_to do |format|\n format.html { redirect_to moodboards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cubboard.destroy\n respond_to do |format|\n format.html { redirect_to cubboards_url, notice: \"Cubboard was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board = Board.find(params[:id])\n @board.destroy\n\n respond_to do |format|\n format.js {render :nothing => true}\n format.html { redirect_to boards_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @board_thread.destroy\n respond_to do |format|\n format.html { redirect_to board_threads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @freeboard.destroy\n respond_to do |format|\n format.html { redirect_to freeboards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dash_board.destroy\n respond_to do |format|\n format.html { redirect_to dash_boards_url, notice: 'Dash board was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @live_aboard.destroy\n respond_to do |format|\n format.html { redirect_to live_aboards_url, notice: 'Live aboard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board_in_project.destroy\n respond_to do |format|\n format.html { redirect_to board_in_projects_url, notice: 'Board was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @messageboard.destroy\n respond_to do |format|\n format.html { redirect_to messageboards_url, notice: 'Messageboard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board.destroy\n respond_to do |format|\n format.html { redirect_to boards_url, notice: 'Board was successfully destroyed.' }\n format.json { head :no_content }\n format.js {render :js => \"window.location.reload();\"}\n end\n end",
"def destroy\n @score_board.destroy\n respond_to do |format|\n format.html { redirect_to score_boards_url, notice: 'Score board was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @daily_board.destroy\n respond_to do |format|\n format.html { redirect_to daily_boards_url, notice: 'Daily board was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bulleting_board.destroy\n respond_to do |format|\n format.html { redirect_to bulleting_boards_url, notice: 'Bulleting board was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board = Board.find(params[:id])\n begin\n Board.transaction do\n @board.messages.to_a.each do |message|\n message.destroy!\n end\n @board.destroy!\n end\n rescue\n flash[:error] = I18n.t(\"board.failure.deleted\")\n ensure\n update_boards\n end\n \n end",
"def destroy\n @boardgame.destroy\n respond_to do |format|\n format.html { redirect_to boardgames_url, notice: 'Boardgame was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @storyboard_cell = StoryboardCell.find(params[:id])\n @storyboard_cell.destroy\n\n respond_to do |format|\n format.html { redirect_to storyboard_cells_url }\n format.json { head :ok }\n end\n end",
"def destroy\n Clenum.destroy params[:ids].split(',')\n\n respond_to do |format|\n format.html { redirect_to(clenums_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @leaderboard = Leaderboard.find(params[:id])\n @leaderboard.destroy\n\n respond_to do |format|\n format.html { redirect_to leaderboards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @billboard.destroy\n respond_to do |format|\n format.html { redirect_to billboards_url, notice: 'Billboard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @del_review = @review.destroy\n @boardgame = Boardgame.find(@del_review.boardgame_id)\n render json: @boardgame \n end",
"def destroy\n @board_game.destroy\n respond_to do |format|\n format.html { redirect_to board_games_url, notice: \"Board game was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bla = Bla.find(params[:id])\n @bla.destroy\n\n respond_to do |format|\n format.html { redirect_to blas_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{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 @etapa.destroy\n respond_to do |format|\n format.html { redirect_to board_url(@etapa.board), notice: 'Etapa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board_document = BoardDocument.find(params[:id])\n @board_document.destroy\n\n respond_to do |format|\n format.html { redirect_to board_documents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @bill_quorum = BillQuorum.find(params[:id])\n @bill_quorum.destroy\n\n respond_to do |format|\n format.html { redirect_to bill_quorums_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 destroy\n @card_in_column.destroy\n respond_to do |format|\n format.html { redirect_to card_in_columns_url, notice: 'Board was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @id = @step.board_id\n @step.destroy\n respond_to do |format|\n format.html { redirect_to board_url(@id), notice: 'Step was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bloom = Bloom.find(params[:id])\n @bloom.destroy\n\n respond_to do |format|\n format.html { redirect_to blooms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n Material.destroy_all(:id => @dashboard_material.id)\r\n @dashboard_material.destroy\r\n respond_to do |format|\r\n flash[:success] = \"Material removido com sucesso.\"\r\n format.html { redirect_to dashboard_materials_path }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @paygrade_board.destroy\n respond_to do |format|\n format.html { redirect_to latest_paygrade_board_url, notice: 'Paygrade board was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board_game.destroy\n respond_to do |format|\n format.html { redirect_to [@board_game_category], notice: 'Board game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @batch.destroy\n render json: @batch, status: :ok\n end",
"def delete_board_list(project, board_id, id)\n delete(\"/projects/#{url_encode project}/boards/#{board_id}/lists/#{id}\")\n end",
"def destroy\n @post.destroy\n respond_to do |format|\n backurl = \"/boards/\"+ @post.boardtype.to_s\n format.html { redirect_to backurl, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @matrix.destroy\r\n respond_to do |format|\r\n format.html { redirect_to matrices_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @snowboard.destroy\n respond_to do |format|\n format.html { redirect_to snowboards_url, notice: \"Snowboard was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @message_board = MessageBoard.find(params[:id])\n @message_board.destroy if @is_admin\n redirect_to home_message_boards_path(@current_home)\n end",
"def destroy\n @games_leaderboard.destroy\n\n head :no_content\n end",
"def destroy\n @scrobble = Scrobble.find(params[:id])\n @scrobble.destroy\n\n respond_to do |format|\n format.html { redirect_to scrobbles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boardmember = Boardmember.find(params[:id])\n @boardmember.destroy\n\n respond_to do |format|\n format.html { redirect_to(boardmembers_url) }\n format.xml { head :ok }\n end\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 @mobile = Story.find(params[:id])\n @mobile.destroy\n\n redirect_to mobiles_path\n end",
"def destroy\n @matrixspecy.destroy\n respond_to do |format|\n format.html { redirect_to matrixspecies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @combine.destroy\n respond_to do |format|\n format.html { redirect_to combines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @makrana_marble.destroy\n respond_to do |format|\n format.html { redirect_to makrana_marbles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @match.destroy\n render json: {success: true}\n end",
"def destroy\n @climb = Climb.find(params[:id])\n @climb.destroy\n\n respond_to do |format|\n format.html { redirect_to climbs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @g4_dongal_board_social.destroy\n respond_to do |format|\n format.html { redirect_to g4_dongal_board_socials_url, notice: 'G4 dongal board social was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @database = Database.find(params[:id])\n path = @database.path\n delete = %x[rm -R #{path}]\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @g_game_board.destroy\n respond_to do |format|\n format.html { redirect_to g_game_boards_url, notice: 'G game board was successfully destroyed.' }\n end\n end",
"def destroy\n @board.destroy\n end",
"def destroy\n @club = Club.find(params[:id])\n @club.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @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 @lab = Lab.find(params[:lab_id])\n @machine = @lab.machines.find(params[:id])\n @machine.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_path(@lab) }\n format.json { head :no_content }\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.json { head :ok }\n end\n end",
"def destroy\n @team = @club.teams.find(params[:id])\n @team.destroy\n\n respond_to do |format|\n format.html { redirect_to club_teams_url(@club.id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n \n respond_to do |format|\n RestClient.delete 'localhost:3001/colores/'+@color.id.to_s, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'}\n format.html { redirect_to colors_url, notice: \"Color was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bus_boarding.destroy\n respond_to do |format|\n format.html { redirect_to bus_boardings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end",
"def destroy\n # @article = Article.find(params[:id])\n # @article.destroy\n @board = Board.find(params[:board_id])\n @article = @board.articles.find(params[:id])\n # @article = current_user.articles.find(params[:id])\n @article.destroy\n @conditionUrl = \"boards/\"+@board.id.to_s()+\"/articles/\"+@article.id.to_s()\n @facebook = getFacebook(@conditionUrl)\n @facebook.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_board_path(@board) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bdm.destroy\n respond_to do |format|\n format.html { redirect_to bdms_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7401453",
"0.73394424",
"0.7290816",
"0.7290816",
"0.7290816",
"0.72545016",
"0.72545016",
"0.7245085",
"0.721105",
"0.71041125",
"0.7101037",
"0.7099692",
"0.70849425",
"0.70300865",
"0.70039123",
"0.69742435",
"0.69690216",
"0.69690216",
"0.69690216",
"0.69690216",
"0.69683415",
"0.6968143",
"0.6945806",
"0.69385564",
"0.69002813",
"0.6881504",
"0.68812484",
"0.688066",
"0.68600446",
"0.68259674",
"0.682364",
"0.68116844",
"0.6764422",
"0.6748459",
"0.67418575",
"0.6731315",
"0.6725947",
"0.67047876",
"0.6689198",
"0.6642358",
"0.66333824",
"0.66268516",
"0.6561251",
"0.6516289",
"0.65069354",
"0.64630306",
"0.64473546",
"0.6438634",
"0.6432173",
"0.6430258",
"0.6352836",
"0.63497424",
"0.6339711",
"0.63299435",
"0.6321714",
"0.6319875",
"0.6311328",
"0.62936616",
"0.6255285",
"0.62524444",
"0.623709",
"0.62252265",
"0.62210053",
"0.62159437",
"0.6209415",
"0.62055665",
"0.61961603",
"0.619219",
"0.6185879",
"0.6185746",
"0.6172973",
"0.6172941",
"0.6162586",
"0.6153583",
"0.614015",
"0.6139344",
"0.6134498",
"0.6134063",
"0.61276984",
"0.6119611",
"0.6113007",
"0.61080235",
"0.6106514",
"0.60946864",
"0.6094367",
"0.6090258",
"0.6089867",
"0.60885674",
"0.60882926",
"0.60877115",
"0.6079553",
"0.6077374",
"0.60628283",
"0.6058285",
"0.60578203",
"0.605153",
"0.60480714",
"0.6047818",
"0.6043959",
"0.60436714"
] |
0.8229748
|
0
|
Zellen als Zeilen aufrufen
|
def rows
cells_ordered = cells.order(:y => :desc)
(0..height).map { |row_id| cells.where(y: row_id) }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def zuruecksetzen()\n end",
"def unsichtbar_machen()\n @fuss.unsichtbar_machen()\n @stiel.unsichtbar_machen()\n @schirm.unsichtbar_machen()\n @leuchtstrahl1.unsichtbar_machen()\n @leuchtstrahl2.unsichtbar_machen()\n @leuchtstrahl3.unsichtbar_machen()\n @leuchtstrahl4.unsichtbar_machen()\n end",
"def unsichtbar_machen\n @fuss.unsichtbar_machen\n @stiel.unsichtbar_machen\n @schirm.unsichtbar_machen\n @leuchtstrahl1.unsichtbar_machen\n @leuchtstrahl2.unsichtbar_machen\n @leuchtstrahl3.unsichtbar_machen\n @leuchtstrahl4.unsichtbar_machen\n end",
"def entries() end",
"def sichtbar_machen()\n @fuss.sichtbar_machen()\n @stiel.sichtbar_machen()\n @schirm.sichtbar_machen()\n @leuchtstrahl1.sichtbar_machen()\n @leuchtstrahl2.sichtbar_machen()\n @leuchtstrahl3.sichtbar_machen()\n @leuchtstrahl4.sichtbar_machen()\n end",
"def fire_the_list(path)\n @output = <<-END\n\n END\n dir = absolute_path(path).force_encoding(\"UTF-8\")\n begin \n @file_names = Dir.entries(dir)\n @file_names.each do |file|\n file = file.force_encoding(\"UTF-8\")\n # puts_message \"테스트 아웃풋 : \" + file\n end\n \n rescue\n @file_name = \"error\"\n end\n \n \n if not @file_names == nil\n # puts_message \"잘라낸 주소!!\" + path[0,7]\n if path[0,8] == \"/images/\"\n if path == \"/images/\" or path == \"/images/basic_photo/\"\n @file_names.delete_if{|f| f =~ /^(\\.)(.*)/}\n @file_names.each{|f| @output << f.force_encoding(\"UTF-8\") + \"\\n\"}\n @file_names = @output \n @access_url = \"\"\n \n else\n # puts_message \"폴더명 ===>\" + path.gsub(\"/images/\",\"\").gsub(\"/\",\"\") + \"::인코딩::\"+path.encoding.to_s\n @file_names = Myimage.all(:user_id => current_user.id, :folder_name => path.gsub(\"/images/\",\"\").gsub(\"/\",\"\"))\n @file_names.each{|f| @output << f.image_filename.force_encoding(\"UTF-8\") + \"\\n\"; puts_message f.image_filename}\n @file_names = @output \n @access_url = \"\"\n \n end\n else\n @file_names.delete_if{|f| f =~ /^(\\.)(.*)/}\n @file_names.each{|f| @output << f + \"\\n\"}\n @file_names = @output \n @access_url = \"\"\n end\n else\n @file_names = \"error\"\n @access_url = \"\"\n end \n end",
"def filenames; end",
"def unsichtbar_machen()\n end",
"def entries; end",
"def entries; end",
"def entries; end",
"def entries; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def files; end",
"def _zeichnen(n,kl)\n\n end",
"def sichtbar_machen()\n @dach.sichtbar_machen\n @gebaedekoerpe.sichtbar_machen\n @fenster.sichtbar_machen\n @tuer.sichtbar_machen\n end",
"def file_list\n end",
"def index\n @trennzeichen_liste = [\",\",\";\"]\n end",
"def sichtbar_machen\n @fuss.sichtbar_machen\n @stiel.sichtbar_machen\n @schirm.sichtbar_machen\n unless @tag\n @leuchtstrahl1.sichtbar_machen\n @leuchtstrahl2.sichtbar_machen\n @leuchtstrahl3.sichtbar_machen\n @leuchtstrahl4.sichtbar_machen\n end\n end",
"def folge_berechnen(tn,jahr)\n folge = [ \"\" ]\n ges_einsaetze = \"28.12.#{jahr}\".to_date.cweek\n ger_schalter = 1\n namen = prio_bilden(tn,folge,ges_einsaetze,ger_schalter)\n zaehler = 0\n while folge.size <= ges_einsaetze\n namen.each do |name|\n unless tn[name].find_index(folge.size) || folge.size > ges_einsaetze\n folge << name\n zaehler += 1\n end\n end\n if zaehler == 0\n if namen.size < tn.size && ger_schalter == 1\n ger_schalter = 0\n else\n folge << \"nicht besetzt!\"\n ger_schalter = 1\n end\n end\n zaehler = 0\n namen = prio_bilden(tn,folge,ges_einsaetze,ger_schalter)\n end\n return folge \n end",
"def initialize\n @rechnungen = []\n end",
"def initialize\n @rechnungen = []\n end",
"def initialize \n @rechnungen = []\n end",
"def sichtbar_machen()\n end",
"def sichtbar_machen\n @backgrund.sichtbar_machen\n @baum1.sichtbar_machen\n @baum2.sichtbar_machen\n @baum3.sichtbar_machen\n @haus1.sichtbar_machen\n @haus2.sichtbar_machen\n @haus3.sichtbar_machen\n @hund1.sichtbar_machen\n @hund2.sichtbar_machen\n end",
"def all_files; end",
"def all_files; end",
"def blocklists; end",
"def sub_listing switch\n path = ::File.join(@source.base_dir,switch)\n folders = folders_listing path\n folders = folders_filtering folders\n files = []\n folders.each do |folder|\n files += files_listing folder\n end\n files\n end",
"def loop une_main, tierce_franche = false, level = 0\n main = une_main.clone\n # Pour totaliser l'apport de chaque combinaison\n chemins = []\n # Retrouve toutes les combinaisons possibles avec la main\n combinaisons = combinaisons(main)\n #\n combinaisons.each do |combinaison|\n # Valeurs apportées par la combinaison\n chemin = Chemin.new\n chemin.visuel = combinaison.to_s\n chemin.combinaison = combinaison.clone\n chemin.franche = if combinaison.type != :suite\n false\n elsif combinaison.avec_joker?\n false\n elsif combinaison.cartes.size != 3\n false\n else\n true # suite sans joker de 3 cartes\n end\n chemin.nb_points = combinaison.points\n chemin.nb_cartes = combinaison.cartes.size\n # Passe à la suite si besoin d'une tierce franche et que ce n'en est pas une\n if tierce_franche\n next unless chemin.franche\n end\n # Enlève les cartes utilisées par la combinaison de la main\n nouvelle_main = enlever_cartes_utilisees main, combinaison\n #\n nouvelles_combinaisons = combinaisons(nouvelle_main)\n #\n if nouvelles_combinaisons.size > 0\n sous_chemins = loop(nouvelle_main, false, level + 1)\n sous_chemins.each do |nb|\n c = chemin.clone\n c.visuel += \" \" + nb.visuel\n c.nb_points += nb.nb_points\n c.nb_cartes += nb.nb_cartes\n chemins << c\n end\n else\n chemins << chemin\n end\n\n end\n\n chemins\n end",
"def sichtbar_machen\n @sichtbar = true\n zeichnen()\n puts(self) \n end",
"def cargar_noticias (ruta_noticias)\n\n Find.find(ruta_noticias) do |ruta| # Iteramos por todo lo que hay en esa ruta.\n ruta_fichero = case\n # Comprobamos que lo que se encuentra en el directorio es un fichero.\n when File.file?(ruta) then ruta\n when File.directory?(ruta) then nil\n else nil \n end\n if (ruta_fichero!=nil) && (!File.zero?(ruta_fichero)) then # Si el archivo existe y no es vacío.\n noticia = IO.readlines(ruta_fichero)\n @hemeroteca.insertar!(leer_noticia(noticia))\n end \n end\n end",
"def sichtbar_machen()\n # TODO\n end",
"def LoteDeCarga()\n print \" #=============================================================================#\\n\"\n print \"\\tLote de carga en ejecucion...\\n\"\n print \" #-----------------------------------------------------------------------------#\\n\"\n print \"\\tDetectando Cuits...\\n\"\n print \" #-----------------------------------------------------------------------------#\\n\"\n aux = []\n cont = 0\n Dir.chdir(\"C:\\\\SFTP\\\\Tickets\")\n Dir.foreach('.') do |item|\n next if item == '.' or item == '..'\n if File.directory?(item)\n print \"\\tCuit encontrado -> \" + item + \"...\\n\"\n aux[cont] = item\n cont += 1\n end\n end\n return aux\nend",
"def grouped(files); end",
"def berlioz; end",
"def malts; end",
"def lines; end",
"def lines; end",
"def karte_drucken()\n if !tarif_gewaehlt?()\n puts (\"Es wurde noch kein Tarif gewählt. Bitte wählen Sie zuerst einen Tarif aus.\")\n elsif @tarif - @eingeworfen > 0\n offener_betrag = @tarif - @eingeworfen\n puts (\"Sie müssen noch \" + offener_betrag.to_s() + \" Euro einzahlen.\")\n else\n kartenpreis = @tarif\n\n puts(\"------------------\")\n puts(\"- Cinema Magico -\")\n puts(\"- Phantastische Tierwesen\")\n # TODO diese Zeile ändern\n puts(\"- Preis \" + @tarif.to_s + \" Euro\")\n puts(\"- Bezahlt \" + @eingeworfen.to_s + \" Euro\")\n puts(\"------------------\")\n # die Gesamtsumme, mit dem der Automat nach der letzten Leerung\n # gefuettert wurde\n wechsel_geld()\n @summe_automat += kartenpreis\n @tarif = nil\n return\n end\n end",
"def files\n i = 0\n @@arr_path.each do |path|\n if path.include?(params[:fold])\n # Remove path from current path\n @@arr_path = @@arr_path[0..i]\n @path = ''\n\n @@arr_path.each do |e| # Put path from array to @path\n @path = @path + e + ' >> '\n end\n @@temp_path = @path\n\n # Get content: folders, file, count\n @content = BrowsingFile.bind_folder params[:fold]\n @file = BrowsingFile.bind_files params[:fold]\n\n render 'index' # Reload index page\n return\n end\n i += 1\n end\n end",
"def list; end",
"def list; end",
"def list; end",
"def list; end",
"def list; end",
"def elements; end",
"def elements; end",
"def elements; end",
"def list\n \tputs \"The list of backups for #{self.name}\"\n \tself.each do |bck|\n \t puts bck.filepath\n \tend\n end",
"def vertikal_bewegen(anzahl_punkte)\n @fuss.vertikal_bewegen(anzahl_punkte)\n @stiel.vertikal_bewegen(anzahl_punkte)\n @schirm.vertikal_bewegen(anzahl_punkte)\n @leuchtstrahl1.vertikal_bewegen(anzahl_punkte)\n @leuchtstrahl2.vertikal_bewegen(anzahl_punkte)\n @leuchtstrahl3.vertikal_bewegen(anzahl_punkte)\n @leuchtstrahl4.vertikal_bewegen(anzahl_punkte)\n end",
"def letzte_komponente\n \n end",
"def karte_drucken()\n # TODO ÄNDERN\n if !tarif_gewaehlt?\n puts \"Kein Tarif wurde gewählt.\"\n else\n if @eingeworfen <= @tarif.betrag\n puts \"Der offener Betrag: #{@tarif.betrag - @eingeworfen }\"\n else\n puts(\"------------------\")\n puts(\"- Cinema Magico -\")\n puts(\"- Phantastische Tierwesen\")\n # TODO diese Zeile ändern\n puts(\"- Preis \" + @tarif.betrag().to_s + \" Euro\") # vordefiniert to_s , von Integer zum String wandeln\n puts(\"- Bezahlt \" + @eingeworfen.to_s + \" Euro\") # vordefiniert to_s , von Integer zum String wandeln\n puts(\"------------------\")\n # die Gesamtsumme, mit dem der Automat nach der letzten Leerung\n # gefuettert wurde\n @eingeworfen -= @tarif.betrag\n @summe_automat = @summe_automat + @tarif.betrag\n @tarif = nil\n return\n end\n end\n\n end",
"def imprimirInsumos()\n\t for i in (0..insumos.size-1)\n\t print @insumos[i],\"\\t\", @cantidadInsumos[i],\"\\n\"\n\t end\n end",
"def unsichtbar_machen\n loeschen()\n @sichtbar = false \n end",
"def horizontal_bewegen(anzahl_punkte)\n @fuss.horizontal_bewegen(anzahl_punkte)\n @stiel.horizontal_bewegen(anzahl_punkte)\n @schirm.horizontal_bewegen(anzahl_punkte)\n @leuchtstrahl1.horizontal_bewegen(anzahl_punkte)\n @leuchtstrahl2.horizontal_bewegen(anzahl_punkte)\n @leuchtstrahl3.horizontal_bewegen(anzahl_punkte)\n @leuchtstrahl4.horizontal_bewegen(anzahl_punkte)\n end",
"def liste()\n puts(\"LISTE DES ORDRES\\n\");\n printf(\"%8s %8s %5s %10s\\n\",\n \"ID\", \"DEBUT\", \"DUREE\", \"PRIX\")\n printf(\"%8s %8s %5s %10s\\n\",\n \"--------\", \"-------\", \"-----\", \"----------\")\n @listOrdre = @listOrdre.sort{ |a,b| a.debut <=> b.debut } \n @listOrdre.each { |ordre| afficherOrdre(ordre) }\n printf(\"%8s %8s %5s %10s\\n\",\n \"--------\", \"-------\", \"-----\", \"----------\");\n end",
"def each_filename; end",
"def gesendete_lesen\r\n @postausgang.each{|x| puts x}\r\n end",
"def filtered(files); end",
"def nitems() end",
"def subgenres; end",
"def avec_fichier( nom_fichier, lignes = [], conserver = nil )\n # On cree le fichier.\n File.open( nom_fichier, \"w\" ) do |fich|\n lignes.each do |ligne|\n fich.puts ligne\n end\n end\n\n # On execute le bloc.\n yield\n\n # On supprime le fichier sauf si indique autrement, auquel cas on\n # retourne son contenu.\n if conserver\n contenu_fichier( nom_fichier )\n else\n FileUtils.rm_f nom_fichier\n end\nend",
"def avec_fichier( nom_fichier, lignes = [], conserver = nil )\n # On cree le fichier.\n File.open( nom_fichier, \"w\" ) do |fich|\n lignes.each do |ligne|\n fich.puts ligne\n end\n end\n\n # On execute le bloc.\n yield\n\n # On supprime le fichier sauf si indique autrement, auquel cas on\n # retourne son contenu.\n if conserver\n contenu_fichier( nom_fichier )\n else\n FileUtils.rm_f nom_fichier\n end\nend",
"def extraer_inicio()\n @tail=tail.next\n \n end",
"def start(_files); end",
"def avec_fichier( nom_fichier, contenu )\n # On cree le fichier.\n File.open( nom_fichier, \"w\" ) do |fich|\n contenu.each do |ligne|\n fich.puts ligne\n end\n end\n\n # On execute le bloc.\n yield\n\n # On supprime le fichier.\n FileUtils.rm_f nom_fichier\nend",
"def otrzymane_wiadomosci\n\twiadomosci=[]\n\twhile(!@kolejka_wiadomosci.empty?)\n\t\twiadomosc=@kolejka_wiadomosci.pop(true) rescue nil\n\t\tbreak if wiadomosc.nil?\n\t\twiadomosci << wiadomosc\n\t\tyield wiadomosc if block_given?\n\tend\n\twiadomosci\n end",
"def intelligenter_zug(spielfeld, aktueller_spieler)\n zug = nil\n\n spieler = spielfeld.spieler\n gegner = nil\n for s in spieler\n if s.name != aktueller_spieler.name\n gegner = s\n break\n end\n end\n\n # 1. Regel: Zuerst nach einer Gewinnsituation suchen\n for reihe in Spielfeld::reihen\n besetzt, frei = spielfeld.reihen_status(reihe)\n\n # Wenn der aktuelle Spieler in einer Reihe bereits zwei Felder\n # besetzt hält und das dritte frei ist, dann natürlich das nehmen\n if (frei.size == 1) and (besetzt[aktueller_spieler].size == 2)\n zug = Zug.new(aktueller_spieler, frei[0])\n break # nicht weitersuchen\n end\n end\n\n if zug.nil?\n # 2. Regel: Suche dann nach den Reihen, in denen der Gegner bereits\n # genau 2 Felder besetzt hat und das dritte Feld noch frei ist.\n for reihe in Spielfeld::reihen\n besetzt, frei = spielfeld.reihen_status(reihe)\n\n # Gefährlich, wenn Gegner zwei besetzt hält. Wie in der vorherigen\n # Lektion gelernt, erhält man zum Index des aktuellen Spielers\n # in der Spielerliste den Index des Gegners mit der Bitoperation 1^wer\n if (frei.size == 1) and (besetzt[gegner].size == 2)\n # Jetzt muss der Spieler unbedingt das eine freie Feld besetzen!\n # Andernfalls kann der Gegner im nächsten Zug gewinnen.\n zug = Zug.new(aktueller_spieler, frei[0])\n break # nicht weitersuchen\n end\n end\n end\n\n # Eckensituation bestimmen\n ecken = {\n 1 => 0, # links oben\n 3 => 0, # rechts oben\n 7 => 0, # links unten\n 9 => 0 # rechts unten\n }\n gegen_ecken = [[1, 9], [9, 1], [3, 7], [7, 3]]\n for z in spielfeld.zuege\n feld = z.nummer\n # Gegner besetzt die Ecke, wenn:\n # feld ist eine Ecke und Gegner besetzt sie\n if (ecken[feld] != nil) and (z.spieler == gegner)\n # Markiere Ecke als vom Gegner besetzt\n ecken[feld] = 1\n end\n end\n\n # 3. Regel: Immer in die Mitte setzten, falls dort frei ist\n # Vorsicht vor der XOX Situation an der Diagonale!\n if zug.nil?\n frei = spielfeld.freie_felder\n mitte = 5\n if frei.include?(mitte)\n zug = Zug.new(aktueller_spieler, mitte)\n else\n # Aha, Mitte ist bereits besetzt.\n # Sofern sie vom aktuellen Spieler besetzt ist, dann nach der XOX\n # Situation Ausschau halten und den nächsten Zug nicht in eine Ecke setzen.\n # XOX (oder OXO) Situation besteht, wenn\n # Ecke 1 und 9 vom Gegner besetzt und aktueller Spieler auf 5 oder\n # Ecke 3 und 7 vom Gegner besetzt und aktueller Spieler auf 5.\n for ecken_paar in gegen_ecken\n besetzt, frei_ecken = spielfeld.reihen_status([ecken_paar[0], mitte, ecken_paar[1]])\n if besetzt[gegner].include?(ecken_paar[0]) and besetzt[gegner].include?(ecken_paar[1])\n if besetzt[aktueller_spieler].include?(mitte)\n # Jetzt also nicht in eine freie Ecke setzen, sondern auf\n # die Felder 2, 4, 6 oder 8, sofern sie frei sind.\n xox_felder = [2, 4, 6, 8]\n for f in xox_felder\n if !frei.include?(f)\n xox_felder.delete(f)\n end\n end\n # Von den freien Ausweichfeldern zufällig eines nehmen\n feld = zufalls_feld(xox_felder)\n if feld != nil\n zug = Zug.new(aktueller_spieler, feld)\n break\n end\n end\n end\n end\n\n end\n end\n\n # 4. Regel: Verteidige gegenüberliegende Ecke\n frei = spielfeld.freie_felder\n if zug.nil?\n # Wenn Ecke 1 besetzt, dann setze auf 9, oder umgekehrt (sofern frei).\n # Wenn Ecke 3 besetzt, dann setze auf 7, oder umgekehrt (sofern frei).\n for ecken_paar in gegen_ecken\n if (ecken[ecken_paar[0]] > 0) and (frei.include?(ecken_paar[1]))\n zug = Zug.new(aktueller_spieler, ecken_paar[1])\n break # nicht weitersuchen\n end\n end\n end\n\n # 5. Regel: Setze in irgendeine freie Ecke.\n # Verwende Variablen 'frei' und 'ecken' von oben\n if zug.nil?\n for ecke in ecken.keys\n if frei.include?(ecke)\n zug = Zug.new(aktueller_spieler, ecke)\n break # nicht weitersuchen\n end\n end\n end\n\n # Andernfalls Zufallszug machen\n if zug.nil?\n zug = zufalls_zug(spielfeld, aktueller_spieler)\n end\n\n zug\n end",
"def parts; end",
"def parts; end",
"def parts; end",
"def print_menu\n Dir.glob('*.mz').sort.each_with_index{|f,i|puts\"#{(i+1).to_s.rjust(2)} - #{f}#{\"\\n\"+(i+2).to_s.rjust(2)+' - exit'if i==Dir.glob('*.mz').size-1}\"}\nend",
"def lista(contatos)\n\tfor i in 0..contatos.size-1\n\t\tputs (\"#{i+1}. #{contatos[i].nome}\")\n\t\ti = i + 1\n\tend\nend",
"def line(katz_deli)\n\n if katz_deli.length == 0\n puts \"The line is currently empty.\"\n else\n current_line = []\n katz_deli.each.with_index(1) do |name,index|\n current_line << \"#{index}. #{name}\"\n end\n puts \"The line is currently: #{current_line.join(\" \")}\"\n\n\n end\n end",
"def sort_abschnitte_and_umschlaege_by_date start_liste\n abschnitt_umschlag_list = []\n mit_end_datum = start_liste.select{|element| element.end_datum }\n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Mit Ende #{mit_end_datum.to_s}\" }\n abschnitt_umschlag_list.concat(mit_end_datum.sort_by{|element| element.end_datum} )\n ohne_end_datum = start_liste.select{|element| element.end_datum.nil? }\n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Ohne Ende: #{ohne_end_datum.to_s}\" }\n abschnitt_umschlag_list.concat(ohne_end_datum)\n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Liste bei Date #{abschnitt_umschlag_list.to_s}\" }\n abschnitt_umschlag_list\n end",
"def afficherIndices(grid)\n\t\ti = 1\n\t\tgrid.each{|g|\n\t\t\tprint i,\" : \", g, \"\\n\"\n\t\t\ti += 1\n\t\t}\n\tend",
"def make_all_pages_tei\n @pages = Page.where(\"id > 0\")\n @pages.each do |p|\n dopagetei(p.id)\n end\n\n end",
"def read_anlagen\n # Logger ist für Debugging-Zwecke im log-Verzeichnis\n @logger = File.new(Rails.root.join(\"log\",\"upload.log\"), \"w\")\n file_path = params[:file_path]\n session[:file_path] = file_path\n @spalte_nr1 = params[:start]\n @spalte_nr2 = params[:ziel]\n @spalte_stoff = params[:stoff]\n session[:spalte_start] = @spalte_nr1\n session[:spalte_ziel] = @spalte_nr2\n session[:spalte_stoff] = @spalte_stoff\n @logger.puts \"Anlagen sind in #{@spalte_nr1} und #{@spalte_nr2}\"\n # Erstelle @anlagen_liste als Liste von Namen, die in den Spalten auftauchen.\n @anlagen_liste = []\n @stoff_liste = []\n csv_text = File.read(file_path) \n csv = CSV.parse(csv_text, :headers => true, :col_sep => session[:csv_trennzeichen])\n csv.each do |row|\n row_as_hash = row.to_hash\n @anlagen_liste << row_as_hash[@spalte_nr1]\n @anlagen_liste << row_as_hash[@spalte_nr2]\n @stoff_liste << row_as_hash[@spalte_stoff]\n @logger.puts \"Anlage Start #{row_as_hash[@spalte_nr1]}\"\n end \n # Duplikate rauswerfen\n @anlagen_liste.uniq!\n @stoff_liste.uniq!\n @logger.puts \"Stoffliste #{@stoff_liste}\"\n # Für jeden Anlagennamen ein Synonym erstellen und speichern.\n create_anlagen_synonyme(@anlagen_liste) \n create_stoff_synonyme(@stoff_liste)\n \n @all_anlagen = Anlage.get_anlagen_for_selection_field\n @logger.puts \"all Anlagen #{@all_anlagen}\"\n # Für das neue-Anlage-Formular\n @anlage = Anlage.new\n @redirect_params = upload_anlagen_zuordnung_path\n # Zu jedem dieser Synonyme muss manuell eine Anlage zugeordnet werden,\n # alternativ eine neue angelegt werden, die dann mit dem Synonym verbunden wird. \n # Hierzu wird weiter geleitet, da die Zuordnung iterativ passiert\n # zur Vermeidung von Code-Doppelungen.\n @logger.close\n redirect_to upload_anlagen_zuordnung_path\n end",
"def sort_abschnitte_and_umschlaege\n abschnitt_umschlag_list = []\n # Hilfsmethode, baut einen nach Orten sortierten Hash auf.\n ort_to_detail = sort_abschnitte_and_umschlaege_by_ort\n File.open(\"log/transport.log\",\"w\"){|f| f.puts \"Ort to detail #{ort_to_detail}\" }\n unless self.start_anlage.nil?\n if self.start_anlage.ort\n ort_aktuell = self.start_anlage.ort\n if ort_aktuell.nil? || ort_to_detail[ort_aktuell.id].nil?\n ort_aktuell = abschnitt_only_start_ort(ort_to_detail.keys) \n end \n counter = 0\n while not (ort_aktuell.nil? || ort_to_detail.empty? || counter > 100)\n counter += 1\n next_ort = nil\n ort_aktuell_id = ort_aktuell.nil? ? 0 : ort_aktuell.id \n unless ort_to_detail[ort_aktuell_id].nil?\n ort_to_detail[ort_aktuell_id].each do |abschnitt_umschlag|\n File.open(\"log/transport.log\",\"a\"){|f| f.puts abschnitt_umschlag.attributes }\n abschnitt_umschlag_list << abschnitt_umschlag\n next_ort = abschnitt_umschlag.end_ort if abschnitt_umschlag.kind_of? Transportabschnitt \n end\n ort_to_detail.delete(ort_aktuell_id) \n ort_aktuell = next_ort\n end\n end \n # Rest nach Datum sortieren\n unless ort_to_detail.empty?\n File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Rest nach Datum\" }\n abschnitt_umschlag_list = abschnitt_umschlag_list.concat(sort_abschnitte_and_umschlaege_by_date(ort_to_detail.values.flatten))\n end\n else \n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Alles nach Datum\" }\n abschnitt_umschlag_list = abschnitt_umschlag_list.concat(sort_abschnitte_and_umschlaege_by_date(ort_to_detail.values.flatten))\n end \n end\n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Transport #{id}: #{abschnitt_umschlag_list.to_s}\" }\n abschnitt_umschlag_list\n end",
"def dirs; end",
"def dirs; end",
"def folds\n\t\t@lines.map{|l| l.folded_lines}\n\tend",
"def get_each\n\t\t@in_files.each do |in_file|\n\t\t\tlines = []\n\t\t\tFile.foreach(in_file) {|line| lines << line.chomp}\n\t\t\talbum_items = yield lines\n\t\t\tif !album_items.empty?\n\t\t\t\t@out_items += album_items\n\t\t\t\t@log_lines << to_log(album_items) \n\t\t\tend\n\t\tend\n\tend",
"def sort_files!; end",
"def each\n\t\tyield \"piaza\"\n\t\tyield \"spaghetti\"\n\t\tyield \"salad\"\n\t\tyield \"water\"\n\tend",
"def run_list; end",
"def directories; end",
"def directories; end",
"def suivre; end",
"def prio_bilden(tn,folge,ges_einsaetze,ger_schalter)\n namen = []\n tln = {}\n einsaetze_pp = folge.each_with_object(Hash.new(0)) { |name,anzahl| anzahl[name] += 1}\n durchschnt_eins = folge.size * 1.0 / tn.size\n if ger_schalter == 0\n durchschnt_eins += 1\n end\n tn.keys.each do |person|\n if einsaetze_pp[person] <= durchschnt_eins && einsaetze_pp[person] <= ges_einsaetze / tn.size\n tln[person] = tn[person].size * 20 + einsaetze_pp[person] * 100 / durchschnt_eins\n end\n end\n tln = Hash[tln.sort_by{ |n,bw| bw }.reverse]\n tln.keys.each do |n|\n namen << n\n end\n return namen\n end",
"def list_objects\n list_names.each_with_object([]) do |name, objects|\n begin\n objects << restore(name)\n rescue\n end\n end\n end",
"def test_foreach\n\t\tOle::Storage.open(@io) {\n\t\t\t|zf|\n\n\t\t\tblockCalled = false\n\t\t\tassert_raise(Errno::ENOENT, \"No such file or directory - noSuchDir\") {\n\t\t\t\tzf.dir.foreach(\"noSuchDir\") { |e| blockCalled = true }\n\t\t\t}\n\t\t\tassert(! blockCalled)\n\n\t\t\tassert_raise(Errno::ENOTDIR, \"Not a directory - file1\") {\n\t\t\t\tzf.dir.foreach(\"file1\") { |e| blockCalled = true }\n\t\t\t}\n\t\t\tassert(! blockCalled)\n\n\t\t\tentries = []\n\t\t\tzf.dir.foreach(\".\") { |e| entries << e }\n\t\t\tassert_equal(['.', '..', \"dir1\", \"dir2\", \"file1\"].sort, entries.sort)\n\n\t\t\tentries = []\n\t\t\tzf.dir.foreach(\"dir1\") { |e| entries << e }\n\t\t\tassert_equal(['.', '..', \"dir11\", \"file11\", \"file12\"], entries.sort)\n\t\t}\n\tend",
"def line(katz_deli)\n if katz_deli.size == 0\n puts \"The line is currently empty.\"\n else\n in_line = \"The line is currently:\"\n \n katz_deli.each do |name|\n in_line = in_line + \" \" + (katz_deli.index(name)+1).to_s + \". \" + name \n end\n puts in_line \n end\nend",
"def file_list tree_root=nil\n tree_root ||= self.tree_root\n file_list = []\n current_dir = tree_root\n visit_entries self.files do |type, name|\n case type\n when :directory\n current_dir = current_dir + \"/\" + name\n when :file\n file_list.push(current_dir + \"/\" + name)\n else\n throw \"BAD VISIT TYREE TYPE. #{type}\"\n end\n end\n file_list\n end",
"def skips; end",
"def keys() end"
] |
[
"0.6275166",
"0.5999008",
"0.5922941",
"0.58124447",
"0.5674678",
"0.56488335",
"0.5548447",
"0.5519281",
"0.54978114",
"0.54978114",
"0.54978114",
"0.54978114",
"0.54675776",
"0.54675776",
"0.54675776",
"0.54675776",
"0.54675776",
"0.54675776",
"0.5404478",
"0.53855246",
"0.53635025",
"0.5346229",
"0.53299874",
"0.52881175",
"0.5281459",
"0.5281459",
"0.526692",
"0.524223",
"0.52400565",
"0.5206135",
"0.5206135",
"0.5185092",
"0.5176201",
"0.517518",
"0.5158576",
"0.51538146",
"0.51521194",
"0.51510495",
"0.5144516",
"0.51274806",
"0.5108542",
"0.5104513",
"0.5104513",
"0.50816876",
"0.5078625",
"0.50581294",
"0.50581294",
"0.50581294",
"0.50581294",
"0.50581294",
"0.50425166",
"0.50425166",
"0.50425166",
"0.5028527",
"0.5022529",
"0.50175285",
"0.50143313",
"0.5012734",
"0.50030524",
"0.5000469",
"0.4985125",
"0.4976022",
"0.49695757",
"0.49605107",
"0.49595478",
"0.4954153",
"0.49519706",
"0.49519706",
"0.49513662",
"0.49392214",
"0.4931923",
"0.4919496",
"0.49028242",
"0.49021903",
"0.49021903",
"0.49021903",
"0.48969942",
"0.48926067",
"0.48837605",
"0.48821247",
"0.48788178",
"0.48668703",
"0.4861983",
"0.48527336",
"0.48479468",
"0.48479468",
"0.4845466",
"0.48207587",
"0.48110926",
"0.48100647",
"0.48038146",
"0.47993165",
"0.47993165",
"0.47986907",
"0.4798625",
"0.47879407",
"0.47876966",
"0.47670546",
"0.47665066",
"0.47632593",
"0.47628456"
] |
0.0
|
-1
|
Baut das Spielfeld neu auf
|
def build_field
return unless random_build
(0..height).each do |row_id|
build_row(row_id)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def schubert; end",
"def zuruecksetzen()\n end",
"def suivre; end",
"def private; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def probers; end",
"def refutal()\n end",
"def terpene; end",
"def schumann; end",
"def verdi; end",
"def placebo?; false end",
"def formation; end",
"def eplore\n end",
"def letzte_komponente\n \n end",
"def sichtbar_machen()\n end",
"def sn\n end",
"def who_we_are\r\n end",
"def stderrs; end",
"def feruchemist; end",
"def sichtbar_machen()\n # TODO\n end",
"def unsichtbar_machen()\n end",
"def singular_siegler; end",
"def celebration; end",
"def weber; end",
"def sld; end",
"def delelte\n\n end",
"def berlioz; end",
"def bellini; end",
"def under_construction\n end",
"def strain; end",
"def guct\n end",
"def isolated; end",
"def isolated; end",
"def offences_by; end",
"def set; end",
"def set; end",
"def sichtbar_machen\n @sichtbar = true\n zeichnen()\n puts(self) \n end",
"def custom; end",
"def custom; end",
"def scf\n end",
"def malts; end",
"def deter\n \n end",
"def flag; end",
"def hiss; end",
"def rossini; end",
"def spice; end",
"def incomplete\r\n\r\n end",
"def surge; end",
"def sub_e\n end",
"def spouse; end",
"def implementation; end",
"def implementation; end",
"def invention; end",
"def sea; end",
"def gounod; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def state; end",
"def villian; end",
"def private_method\n end",
"def used?; end",
"def bs; end",
"def trd; end",
"def scientist; end",
"def dh; end",
"def buzzword; end",
"def buzzword; end",
"def hd\n \n end",
"def internship_passed; end",
"def sitemaps; end",
"def mi_carrera\n\n\tend",
"def entry; end",
"def entry; end",
"def entry; end",
"def entry; end",
"def intelligenter_zug(spielfeld, aktueller_spieler)\n zug = nil\n\n spieler = spielfeld.spieler\n gegner = nil\n for s in spieler\n if s.name != aktueller_spieler.name\n gegner = s\n break\n end\n end\n\n # 1. Regel: Zuerst nach einer Gewinnsituation suchen\n for reihe in Spielfeld::reihen\n besetzt, frei = spielfeld.reihen_status(reihe)\n\n # Wenn der aktuelle Spieler in einer Reihe bereits zwei Felder\n # besetzt hält und das dritte frei ist, dann natürlich das nehmen\n if (frei.size == 1) and (besetzt[aktueller_spieler].size == 2)\n zug = Zug.new(aktueller_spieler, frei[0])\n break # nicht weitersuchen\n end\n end\n\n if zug.nil?\n # 2. Regel: Suche dann nach den Reihen, in denen der Gegner bereits\n # genau 2 Felder besetzt hat und das dritte Feld noch frei ist.\n for reihe in Spielfeld::reihen\n besetzt, frei = spielfeld.reihen_status(reihe)\n\n # Gefährlich, wenn Gegner zwei besetzt hält. Wie in der vorherigen\n # Lektion gelernt, erhält man zum Index des aktuellen Spielers\n # in der Spielerliste den Index des Gegners mit der Bitoperation 1^wer\n if (frei.size == 1) and (besetzt[gegner].size == 2)\n # Jetzt muss der Spieler unbedingt das eine freie Feld besetzen!\n # Andernfalls kann der Gegner im nächsten Zug gewinnen.\n zug = Zug.new(aktueller_spieler, frei[0])\n break # nicht weitersuchen\n end\n end\n end\n\n # Eckensituation bestimmen\n ecken = {\n 1 => 0, # links oben\n 3 => 0, # rechts oben\n 7 => 0, # links unten\n 9 => 0 # rechts unten\n }\n gegen_ecken = [[1, 9], [9, 1], [3, 7], [7, 3]]\n for z in spielfeld.zuege\n feld = z.nummer\n # Gegner besetzt die Ecke, wenn:\n # feld ist eine Ecke und Gegner besetzt sie\n if (ecken[feld] != nil) and (z.spieler == gegner)\n # Markiere Ecke als vom Gegner besetzt\n ecken[feld] = 1\n end\n end\n\n # 3. Regel: Immer in die Mitte setzten, falls dort frei ist\n # Vorsicht vor der XOX Situation an der Diagonale!\n if zug.nil?\n frei = spielfeld.freie_felder\n mitte = 5\n if frei.include?(mitte)\n zug = Zug.new(aktueller_spieler, mitte)\n else\n # Aha, Mitte ist bereits besetzt.\n # Sofern sie vom aktuellen Spieler besetzt ist, dann nach der XOX\n # Situation Ausschau halten und den nächsten Zug nicht in eine Ecke setzen.\n # XOX (oder OXO) Situation besteht, wenn\n # Ecke 1 und 9 vom Gegner besetzt und aktueller Spieler auf 5 oder\n # Ecke 3 und 7 vom Gegner besetzt und aktueller Spieler auf 5.\n for ecken_paar in gegen_ecken\n besetzt, frei_ecken = spielfeld.reihen_status([ecken_paar[0], mitte, ecken_paar[1]])\n if besetzt[gegner].include?(ecken_paar[0]) and besetzt[gegner].include?(ecken_paar[1])\n if besetzt[aktueller_spieler].include?(mitte)\n # Jetzt also nicht in eine freie Ecke setzen, sondern auf\n # die Felder 2, 4, 6 oder 8, sofern sie frei sind.\n xox_felder = [2, 4, 6, 8]\n for f in xox_felder\n if !frei.include?(f)\n xox_felder.delete(f)\n end\n end\n # Von den freien Ausweichfeldern zufällig eines nehmen\n feld = zufalls_feld(xox_felder)\n if feld != nil\n zug = Zug.new(aktueller_spieler, feld)\n break\n end\n end\n end\n end\n\n end\n end\n\n # 4. Regel: Verteidige gegenüberliegende Ecke\n frei = spielfeld.freie_felder\n if zug.nil?\n # Wenn Ecke 1 besetzt, dann setze auf 9, oder umgekehrt (sofern frei).\n # Wenn Ecke 3 besetzt, dann setze auf 7, oder umgekehrt (sofern frei).\n for ecken_paar in gegen_ecken\n if (ecken[ecken_paar[0]] > 0) and (frei.include?(ecken_paar[1]))\n zug = Zug.new(aktueller_spieler, ecken_paar[1])\n break # nicht weitersuchen\n end\n end\n end\n\n # 5. Regel: Setze in irgendeine freie Ecke.\n # Verwende Variablen 'frei' und 'ecken' von oben\n if zug.nil?\n for ecke in ecken.keys\n if frei.include?(ecke)\n zug = Zug.new(aktueller_spieler, ecke)\n break # nicht weitersuchen\n end\n end\n end\n\n # Andernfalls Zufallszug machen\n if zug.nil?\n zug = zufalls_zug(spielfeld, aktueller_spieler)\n end\n\n zug\n end",
"def expanded; end",
"def lsi; end",
"def original; end",
"def jack_handey; end",
"def anchored; end",
"def england\n end",
"def funktionsname\n\tanweisung\nend",
"def details=(_); end",
"def mark; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def probers=(_arg0); end",
"def position; end"
] |
[
"0.7522723",
"0.7405135",
"0.7240292",
"0.70891947",
"0.68321526",
"0.68321526",
"0.68321526",
"0.68321526",
"0.6577367",
"0.6471559",
"0.64487016",
"0.6403181",
"0.6259375",
"0.62580353",
"0.623741",
"0.6232886",
"0.62283695",
"0.62240726",
"0.6213474",
"0.60875255",
"0.6059964",
"0.60485655",
"0.6023609",
"0.60024667",
"0.5930362",
"0.5913501",
"0.5898409",
"0.5892241",
"0.5882495",
"0.588008",
"0.587751",
"0.58712816",
"0.58564115",
"0.58549565",
"0.58495826",
"0.58495826",
"0.5842747",
"0.5835638",
"0.5835638",
"0.58272946",
"0.5826762",
"0.5826762",
"0.5825177",
"0.582247",
"0.58043545",
"0.58006173",
"0.57974434",
"0.5794559",
"0.57848376",
"0.57735574",
"0.5770879",
"0.5767813",
"0.57627964",
"0.5753378",
"0.5753378",
"0.5746867",
"0.5743479",
"0.5740174",
"0.5724131",
"0.5724131",
"0.5724131",
"0.5724131",
"0.5724131",
"0.5724131",
"0.5724131",
"0.5724131",
"0.57228726",
"0.5712362",
"0.569611",
"0.56903523",
"0.5668319",
"0.5664939",
"0.5663946",
"0.56581986",
"0.56581986",
"0.5657382",
"0.56532353",
"0.5652779",
"0.56486374",
"0.5647975",
"0.5647975",
"0.5647975",
"0.5647975",
"0.56343794",
"0.56328577",
"0.56316805",
"0.56254935",
"0.561861",
"0.56129533",
"0.56033856",
"0.5595186",
"0.55844337",
"0.55785084",
"0.5576912",
"0.5576912",
"0.5576912",
"0.5576912",
"0.5576912",
"0.5576912",
"0.5576542",
"0.55762714"
] |
0.0
|
-1
|
Initieren der Zellen beim Erstellen
|
def build_row(row_id)
(0..width).each do |col_id|
cells.create(y: row_id, x: col_id, random_alive: true)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def init; end",
"def init; end",
"def init; end",
"def init; end",
"def init\n end",
"def init\n end",
"def init\n end",
"def at_init\n\n\t\tend",
"def initialize\n init\n end",
"def initialize\n\t\t\n\tend",
"def init\n\n end",
"def initialize\n \n end",
"def initialize() end",
"def initialize\r\n\r\n end",
"def initialize\n initialize!\n end",
"def initialize\n initialize!\n end",
"def initialize\n end",
"def initialize\n super()\n init_data()\n end",
"def initialize\n\n\tend",
"def initialize\n\n\tend",
"def initialize()\n\t\tend",
"def initialize\n\n\n\n end",
"def initialize()\n end",
"def init; end",
"def Init()\n end",
"def post_init\n end",
"def initialize()\r\n\r\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end",
"def initialize()\n super\n end"
] |
[
"0.8108058",
"0.8108058",
"0.8108058",
"0.8108058",
"0.8010954",
"0.8010954",
"0.8010954",
"0.7883829",
"0.7875984",
"0.7782124",
"0.777664",
"0.7717486",
"0.7697641",
"0.7611498",
"0.7565829",
"0.7565829",
"0.7550641",
"0.752312",
"0.75176054",
"0.75176054",
"0.75051475",
"0.74914557",
"0.74900806",
"0.7477315",
"0.7427771",
"0.7333875",
"0.7333679",
"0.73021513",
"0.73021513",
"0.73021513",
"0.73021513",
"0.73021513",
"0.73021513",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204",
"0.72824204"
] |
0.0
|
-1
|
starting value ending value step value output: nil rules/constraints: test input/output algorithm/data structure:
|
def step(value, end_value, step)
loop do
yield(value)
break if value + step > end_value
value += step
end
value
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def est\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 4 )\n\n begin\n # at line 42:11: ( dclr | asign | comp | prt | red )\n # at line 42:11: ( dclr | asign | comp | prt | red )\n alt_4 = 5\n case look_4 = @input.peek( 1 )\n when T__44, T__45, T__46, T__47 then alt_4 = 1\n when ID then look_4_2 = @input.peek( 2 )\n\n if ( look_4_2 == EQLS )\n look_4_6 = @input.peek( 3 )\n\n if ( look_4_6 == MINUS || look_4_6 == LPAR || look_4_6.between?( ID, STRING ) )\n alt_4 = 2\n elsif ( look_4_6 == IN )\n alt_4 = 5\n else\n raise NoViableAlternative( \"\", 4, 6 )\n end\n elsif ( look_4_2.between?( PLUS, DIV ) || look_4_2 == RPAR || look_4_2.between?( GRTH, OR ) || look_4_2 == T__42 )\n alt_4 = 3\n else\n raise NoViableAlternative( \"\", 4, 2 )\n end\n when MINUS, LPAR, NUMBER, FLOAT, BOOL, STRING then alt_4 = 3\n when OUT, OUTS then alt_4 = 4\n when IN then alt_4 = 5\n else\n raise NoViableAlternative( \"\", 4, 0 )\n end\n case alt_4\n when 1\n # at line 42:12: dclr\n @state.following.push( TOKENS_FOLLOWING_dclr_IN_est_231 )\n dclr\n @state.following.pop\n\n when 2\n # at line 42:19: asign\n @state.following.push( TOKENS_FOLLOWING_asign_IN_est_235 )\n asign\n @state.following.pop\n\n when 3\n # at line 42:27: comp\n @state.following.push( TOKENS_FOLLOWING_comp_IN_est_239 )\n comp\n @state.following.pop\n\n when 4\n # at line 42:34: prt\n @state.following.push( TOKENS_FOLLOWING_prt_IN_est_243 )\n prt\n @state.following.pop\n\n when 5\n # at line 42:40: red\n @state.following.push( TOKENS_FOLLOWING_red_IN_est_247 )\n red\n @state.following.pop\n\n end\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__, 4 )\n\n end\n \n return \n end",
"def specification\n 0.upto(radix ** @target - 1).each do |target|\n 0.upto(radix ** number_of_inputs - 1).map do |i|\n term = \"%s%s\" % [to_radix(i), to_radix(target, @target)]\n truth = i >= target ? 1 : 0\n @output << \"%s %s\" % [term, truth]\n end\n end\n @output\n end",
"def makeIter(stuff, changing_params, param_to_change)\n # if syntax provides enumeration\n if stuff.has_key?('values') then\n if stuff['values'].class == String\n stuff['values'].split(' ').each do |value|\n changing_params[param_to_change] = value.to_s\n deepestFork(stuff, changing_params)\n end\n else\n changing_params[param_to_change] = stuff['values'].to_s\n deepestFork(stuff, changing_params)\n end\n # on the other case do enumeration manually\n else\n # if range is linear\n if stuff['type'] == 'line' then\n bndrs = stuff['range'].split('..')\n bndrs[0].to_s.match(/\\.|e/) ? bndrs[0] = bndrs[0].to_f : bndrs[0] = bndrs[0].to_i\n bndrs[1].to_s.match(/\\.|e/) ? bndrs[1] = bndrs[1].to_f : bndrs[1] = bndrs[1].to_i\n stuff['step'].to_s.match(/\\.|e/) ? step = stuff['step'].to_f : step = stuff['step'].to_i\n if step.to_f < 0 then\n bndrs[0], bndrs[1] = bndrs[1], bndrs[0]\n step = - step\n end\n (bndrs[0]..bndrs[1]).step(step) do |value|\n changing_params[param_to_change] = value.to_s\n deepestFork(stuff, changing_params)\n end\n # if range is exponetial\n else\n bndrs = []\n step = stuff['step']\n stuff['range'].split('..').each_with_index do |value, i|\n bndrs[i] = value.split('e')\n end\n if step < 0 then\n bndrs[0], bndrs[1] = bndrs[1], bndrs[0]\n step = - step\n end\n (bndrs[0][1]..bndrs[1][1]).step(step) do |exp|\n changing_params[param_to_change] = bndrs[0][0] + 'e' + exp.to_s\n deepestFork(stuff, changing_params)\n end\n end\n end\n\n changing_params.delete(param_to_change)\n end",
"def step_result; end",
"def testInput inputArray\n testDimensionBaseNumber inputArray\n\n dim = inputArray[0][0]\n puts \"Dimensions: \" + dim\n nOfSetNumbers = inputArray[1][0]\n puts \"Number of given numbers: \" + nOfSetNumbers\n \n testMaxValueEach(inputArray,1)\n \n lineOfNumberConstraints = (2 + nOfSetNumbers.to_i)\n \n testPositionOfAdditionalConstraints(inputArray, lineOfNumberConstraints)\n\n testMaxValueEach(inputArray, lineOfNumberConstraints)\n \n numberOfAdditionalConstraints = inputArray[lineOfNumberConstraints][0]\n \n puts \"Number of given constraints: \" + numberOfAdditionalConstraints\n \n if inputArray.length != (numberOfAdditionalConstraints.to_i+nOfSetNumbers.to_i+3)\n puts \"wrong input file - number of lines is not matching with given numbers of constraints\"\n end\n \n (2..(nOfSetNumbers.to_i+1)).each do |i|\n testNumberOfElements(inputArray,i,3)\n end\n\n (lineOfNumberConstraints+1..(numberOfAdditionalConstraints.to_i+lineOfNumberConstraints)).each do |i|\n testNumberOfElements(inputArray,i,4)\n end\n\n testValueOfElements(inputArray,dim, nOfSetNumbers,numberOfAdditionalConstraints)\n\n return dim\nend",
"def output(data_size: \"small\")\n count = 1\n\n get_inputs(data_size).each do |input|\n output = solve(input.to_i)\n puts \"Case ##{count}: #{output}\"\n count += 1\n end\n end",
"def run_tests\n check_solution(1, (100..200).to_a, 135, 35)\n check_solution(2, [13, 19, 24, 29, 32, 37, 43], 35, -1)\nend",
"def output(data_size: \"small\")\n count = 1\n get_inputs(data_size).each do |input|\n output = solve(input)\n puts \"Case ##{count}: #{output}\"\n count += 1\n end\n end",
"def solution4(input)\n end",
"def output(data_size: \"small\")\n count = 1\n\n get_inputs(data_size).each do |input|\n output = solve(input)\n puts \"Case ##{count}: #{output}\"\n count += 1\n end\n end",
"def output(data_size: \"small\")\n count = 1\n\n get_inputs(data_size).each do |input|\n output = solve(input)\n puts \"Case ##{count}: #{output}\"\n count += 1\n end\n end",
"def create_steps(value, expected)\n temp = []\n st_count = 0\n\n value.each do |x|\n temp[st_count] = {}\n temp[st_count][:step_number] = \"#{st_count+1}\"\n temp[st_count][:actions] = \"<p>#{x.strip}</p>\"\n temp[st_count][:expected_results] = expected unless expected.nil?\n temp[st_count][:execution_type] = \"1\"\n temp[st_count][:active] = \"1\"\n st_count += 1\n end\n return temp\n end",
"def rule\n @rule || @distribution.inject([]){|result, elm| result << [(result.empty? ? 0.0 : result.last[0]) + elm[0], elm[1]]}\\\n .tap{|array| array.last[0] = 1.0 } # make sure the last element's cdf is 1.0\n end",
"def get_all_steps range, step\n values = []\n value = range.first\n while value <= range.last\n values.push value\n value += step\n end\n return values\nend",
"def test_step_on_examples\n assert_equal([], @small_dfa.step(0,'b'))\n @small_dfa.each_state do |s|\n s.out_edges.each do |e|\n assert_equal([e.target], @small_dfa.step(s,e.symbol))\n end\n end\n\n assert_equal([], @small_nfa.step(0, 'b'))\n assert_equal(@small_nfa.ith_states(1), @small_nfa.step(0, 'a'))\n assert_equal(@small_nfa.ith_states(2,3), @small_nfa.step(1, 'b'))\n assert_equal(@small_nfa.ith_states(1), @small_nfa.step(1, nil))\n end",
"def alg; end",
"def _reduce_501(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend",
"def _reduce_501(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend",
"def _reduce_501(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend",
"def _reduce_501(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend",
"def main\n # Make each run\n RUNS.each do |name, data|\n # skip run?\n if data[:skip]\n puts \"Skipped '#{name}'\"\n next\n end\n\n # Process data\n target = data[:input]\n board = Board.new\n side_length = 1\n x = y = 0\n current_value = 1\n board[x, y] = current_value\n\n while current_value <= target\n # side of new ring is 2 more than previous\n side_length += 2\n # move cursor to first corner of new ring\n x += 1\n y -= 1\n # add elements for each side of the whole ring\n [[0, 1], [-1, 0], [0, -1], [1, 0]].each do |mod|\n (side_length - 1).times do\n x += mod[0]\n y += mod[1]\n current_value = board.neighbors(x, y).sum\n board[x, y] = current_value\n break if current_value > target\n end\n break if current_value > target\n end\n end\n\n # Print result\n res = board.cell_count\n success_msg = res == data[:target] ? 'succeeded' : 'failed'\n puts \"AOC17-#{PUZZLE}/#{name} #{success_msg}: #{res}, #{current_value} (Target: #{data[:target]})\"\n end\nend",
"def passes; end",
"def passes; end",
"def test_doe_latin_hypercube_method_should_return_evenly_distributed_points_across_parameter_space_5_param_case\n @experiment_with_multiple_params.doe_info = [[\"latinHypercube\", [\"param-0\", \"param-1\", \"param-2\", \"param-3\", \"param-4\"]]]\n\n\n doe_method_result = @experiment_with_multiple_params.apply_doe_methods.first\n\n\n\n assert_equal \"latinHypercube\", doe_method_result[0]\n assert_equal [\"param-0\", \"param-1\", \"param-2\", \"param-3\", \"param-4\"], doe_method_result[1]\n assert_equal 6, doe_method_result[2].size\n\n level_counters = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]\n\n doe_method_result[2].each do |input_parameter_space_point|\n input_parameter_space_point.each_with_index do |value, index|\n level_counters[index][value / 20] += 1\n end\n end\n\n level_counters.each { |counter| assert_equal [1, 1, 1, 1, 1, 1], counter }\n end",
"def descend\n if @termination_type == :epoch\n epoch_count.times do \n @vals = @vals - @learning_rate * yield(@vals)\n end\n else\n delta = Float::INFINITY\n while delta > @termination_criteria\n old_vals = @vals\n @vals = @vals - @learning_rate * yield(@vals)\n i = 0\n delta = @vals.reduce(0) do |mem, el|\n row = i / @vals.column_count\n col = i % @vals.column_count\n i += 1\n mem + (el - old_vals[row, col]).abs\n end\n # puts delta\n end\n end\n @vals\n end",
"def outputcase \n for i in 0...@records.recordsArr.length do\n\n isfit = checkMustHaveNotLimit @records.recordsArr[i]\n \n\n for j in 0...@records.recordsArr[i].valuesArr.length do\n print parameters.paramsArr[j].elementsArr[@records.recordsArr[i].valuesArr[j]].value\n print ' '\n end\n puts ' '\n \n end\n end",
"def test_range(r)\n yield [r.min-1, false]\n yield [r.min, true]\n yield [r.max, true]\n yield [r.max+1, false]\nend",
"def calculate_table(target_num)\n # this is our \"table\"\n minimum_num_of_steps = [0]\n\n (1..target_num).each do |num|\n # set an initial value in our table to weigh against\n minimum_num_of_steps[num] = Float::INFINITY\n\n if num == 1\n minimum_num_of_steps[num] = 0\n else\n # calculate values then get rid of decimals since they wouldn't make sense as indices\n # consider that we're starting with integers anyway so float results don't really work\n values = OPERATIONS.map { |op| self.send(op[0], num, op[1]) }\n values.reject! { |v| v % 1 != 0 }\n # for each valid operation's value, look at the number of steps for the index/number we're at\n # and if it's lower than the current step count in the table overwrite it\n values.each do |value|\n # current_num_steps = minimum_num_of_steps[num - value] + 1\n current_num_steps = minimum_num_of_steps[value] + 1\n\n if current_num_steps < minimum_num_of_steps[num]\n minimum_num_of_steps[num] = current_num_steps\n end\n end\n end\n end\n\n minimum_num_of_steps\nend",
"def end_traction(step_name, start_time)\n\n if ($transactions_iterations[step_name].nil?) then\n $transactions_iterations[step_name] = 0\n end\n\n $transactions_iterations[step_name] += 1\n\n # This uses the value from start_traction() and finds how long the test took.\n transaction_duration = (Time.now - start_time) * 1000\n\n # If the current transaction have no results, lets define their arrays\n if ($results_transactions[step_name].nil?) then\n $results_transactions[step_name] = []\n $results_transactions_graph[step_name] = {}\n end\n\n # Add the duration of the test to an array so we can work our max/min/avg etc...\n $results_transactions[step_name] << transaction_duration\n\n # For each second we need to build up an average, so need to build up another array\n # based on the current time\n current_time_id = $duration - (($starttime + $duration) - Time.new.to_i) + 1\n\n # If the array doesn't exist for the current time, then lets define it\n if($results_transactions_graph[step_name][current_time_id].nil? == true) then\n $results_transactions_graph[step_name][current_time_id] = Array.new()\n end\n\n # Add the value to the array\n $results_transactions_graph[step_name][current_time_id].push(transaction_duration)\n\nend",
"def divide\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 32 )\n divide_start_index = @input.index\n\n success = false # flag used for memoization\n\n begin\n # rule memoization\n if @state.backtracking > 0 and already_parsed_rule?( __method__ )\n success = true\n return \n end\n # at line 311:9: ( 'D' | 'd' ) ( 'I' | 'i' ) ( 'V' | 'v' ) ( 'I' | 'i' ) ( 'D' | 'd' ) ( 'E' | 'e' )\n if @input.peek( 1 ).between?( T__42, T__43 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__24, T__25 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__44, T__45 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__24, T__25 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__42, T__43 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n if @input.peek( 1 ).between?( T__28, T__29 )\n @input.consume\n @state.error_recovery = false\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n mse = MismatchedSet( nil )\n raise mse\n end\n\n\n\n success = true\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 32 )\n memoize( __method__, divide_start_index, success ) if @state.backtracking > 0\n\n end\n \n return \n end",
"def run(lower, upper, validator)\n count = 0\n current_value = lower - 1\n\n # Each iteration, we skip to the next valid number in range and check whether\n # it satisfies the validator.\n while (current_value = step(current_value)) <= upper\n count += 1 if validator.call(current_value)\n end\n\n count\nend",
"def process_output(output)\n raise ArgumentError unless output and output.is_a? Array\n\n begin # parse failing scenarios (between FailingScenarios and BlankLine)\n if i = output.find_index {|line| line =~ Regex::FailingScenarios}\n temp = output[i+1..-1]\n i = temp.find_index {|line| line =~ Regex::BlankLine}\n @scenarios[:failed] = temp.first(i)\n end\n rescue => e\n raise\n end\n\n begin # parse result counts\n #result_lines = output.grep Regex::StepResult\n #unless result_lines.count == 1\n # log output\n # raise TestFailedError, \"invalid cucumber results\" + output.collect{|l| \"#{l}\\n\"}.inspect\n #end\n #num_steps, num_passed = result_lines.first.scan(Regex::StepResult).first\n\n result_lines = output.grep Regex::StepResultFull \n unless result_lines.count == 1\n log output\n raise TestFailedError, \"invalid cucumber results\" + output.collect{|l| \"#{l}\\n\"}.inspect\n end\n num_steps, num_failed, num_skipped, num_undefined, num_passed = result_lines.first.scan(Regex::StepResultFull).first\n num_passed ||= 0\n num_skipped ||= 0\n num_failed ||= 0\n num_undefined ||= 0\n num_passed = num_passed.to_i\n num_skipped = num_skipped.to_i\n num_failed = num_failed.to_i\n num_steps = num_steps.to_i\n num_undefined = num_undefined.to_i\n # FIXME: This is terrible\n #puts \"#{num_steps}: #{num_failed} #{num_skipped} #{num_passed} #{num_undefined}\"\n if num_failed + num_undefined > 0 or num_passed < num_steps\n log output\n end\n num_steps -= num_skipped\n @scenarios[:steps] = {:total => num_steps, :passed => num_passed}\n raise FastReturn.new(@scenarios[:steps], output)\n rescue => e\n raise\n end\n\n end",
"def iteration_parameters\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 73 )\n return_value = IterationParametersReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal352 = nil\n char_literal354 = nil\n parameters353 = nil\n\n tree_for_char_literal352 = nil\n tree_for_char_literal354 = nil\n stream_PIPE = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token PIPE\" )\n stream_parameters = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule parameters\" )\n begin\n # at line 737:3: ( '|' ( parameters )? '|' -> ^( PARAMS ( parameters )? ) | -> ^( PARAMS ) )\n alt_90 = 2\n look_90_0 = @input.peek( 1 )\n\n if ( look_90_0 == PIPE )\n alt_90 = 1\n elsif ( look_90_0 == GENERAL || look_90_0 == GET || look_90_0 == ARROW || look_90_0 == IF || look_90_0 == REGEX || look_90_0 == INCR || look_90_0 == BREAK || look_90_0 == RETURN || look_90_0 == IS_DEFINED || look_90_0 == LBRACE || look_90_0 == LBRACK || look_90_0.between?( SEMI, CONST ) || look_90_0.between?( SET, LET ) || look_90_0 == DDOC || look_90_0.between?( DECR, LPAREN ) || look_90_0 == DELETE || look_90_0.between?( DGENERAL, DO ) || look_90_0 == THROW || look_90_0 == TILDE || look_90_0 == TRUE || look_90_0 == TRY || look_90_0.between?( TYPEOF, NEW ) || look_90_0.between?( EACH, UNDEFINED ) || look_90_0.between?( NULL, UNLESS ) || look_90_0 == UNTIL || look_90_0 == FALSE || look_90_0 == VAR || look_90_0.between?( VOID, FOR ) || look_90_0 == WHILE || look_90_0.between?( WITH, YIELD ) || look_90_0.between?( IS_UNDEFINED, DOC ) || look_90_0.between?( T__148, T__150 ) )\n alt_90 = 2\n else\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n raise NoViableAlternative( \"\", 90, 0 )\n end\n case alt_90\n when 1\n # at line 737:5: '|' ( parameters )? '|'\n char_literal352 = match( PIPE, TOKENS_FOLLOWING_PIPE_IN_iteration_parameters_5207 )\n if @state.backtracking == 0\n stream_PIPE.add( char_literal352 )\n end\n # at line 737:9: ( parameters )?\n alt_89 = 2\n look_89_0 = @input.peek( 1 )\n\n if ( look_89_0 == GET || look_89_0 == SET || look_89_0 == STAR || look_89_0 == MACRO || look_89_0 == EACH || look_89_0.between?( DEF, OBJECT_DEF ) || look_89_0 == ID || look_89_0.between?( T__148, T__150 ) )\n alt_89 = 1\n end\n case alt_89\n when 1\n # at line 737:9: parameters\n @state.following.push( TOKENS_FOLLOWING_parameters_IN_iteration_parameters_5209 )\n parameters353 = parameters\n @state.following.pop\n if @state.backtracking == 0\n stream_parameters.add( parameters353.tree )\n end\n\n end\n char_literal354 = match( PIPE, TOKENS_FOLLOWING_PIPE_IN_iteration_parameters_5212 )\n if @state.backtracking == 0\n stream_PIPE.add( char_literal354 )\n end\n # AST Rewrite\n # elements: parameters\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 # 737:25: -> ^( PARAMS ( parameters )? )\n # at line 737:28: ^( PARAMS ( parameters )? )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create_from_type( PARAMS, \"PARAMS\" ), root_1 )\n\n # at line 737:38: ( parameters )?\n if stream_parameters.has_next?\n @adaptor.add_child( root_1, stream_parameters.next_tree )\n\n end\n\n stream_parameters.reset();\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n when 2\n # at line 738:5: \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 # 738:5: -> ^( PARAMS )\n # at line 738:8: ^( PARAMS )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create_from_type( PARAMS, \"PARAMS\" ), root_1 )\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n 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__, 73 )\n\n end\n \n return return_value\n end",
"def backpropagate(expected_output_values)\n check_output_dimension(expected_output_values.length)\n calculate_output_deltas(expected_output_values)\n calculate_internal_deltas\n update_weights\n end",
"def test_dfa_step_on_examples\n assert_equal(nil, @small_dfa.dfa_step(0,'b'))\n @small_dfa.each_state do |s|\n s.out_edges.each do |e|\n assert_equal(e.target, @small_dfa.dfa_step(s,e.symbol))\n end\n end\n end",
"def get_to(options={})\n options = {\n :goal => 100,\n :digits => '123456789',\n :ops => %w[- - +],\n :verbose => false,\n :return_counts => false\n } .merge(options)\n digits= options[:digits]\n goal, digits, ops, verbose, return_counts = *options.values_at(:goal, :digits, :ops, :verbose, :return_counts)\n operators = Permutation.for(ops).map{|perm| perm.project}.uniq\n puts \"Looking for #{goal}, digits=#{digits}, operators=#{ops.inspect}\"\n counts = Hash.new(0)\n found_in_a_row = 0\n digits.each_partition(ops.size + 1) do |numbers|\n operators.each do |ops|\n op_index = -1\n eqn = numbers.zip(ops).flatten.compact.join(' ')\n val = eval(eqn)\n counts[val] += 1 if return_counts\n found = val == goal\n puts \"********************************\" if found_in_a_row == 0 && found\n puts \"********************************\" unless found_in_a_row == 0 || found\n puts \"#{eqn} = #{val}\" if verbose || goal == val\n found_in_a_row = found ? found_in_a_row + 1 : 0\n end\n end\n return_counts ? counts.select {|key,value| value > 1} : nil\nend",
"def parameters\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 31 )\n return_value = ParametersReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n\n _last = _first_0 = nil\n __PARAMS259__ = nil\n parameter260 = nil\n\n tree_for_PARAMS259 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 215:5: ^( PARAMS ( parameter )* )\n _save_last_1 = _last = @input.look\n _first_1 = nil\n root_1 = @adaptor.create_flat_list\n _last = @input.look\n __PARAMS259__ = match( PARAMS, TOKENS_FOLLOWING_PARAMS_IN_parameters_1582 )\n\n tree_for_PARAMS259 = @adaptor.copy_node( __PARAMS259__ )\n\n root_1 = @adaptor.become_root( tree_for_PARAMS259, root_1 )\n\n\n\n if @input.peek == DOWN\n match( DOWN, nil )\n # at line 215:15: ( parameter )*\n while true # decision 35\n alt_35 = 2\n look_35_0 = @input.peek( 1 )\n\n if ( look_35_0 == ASGN || look_35_0 == SPLAT || look_35_0 == ID )\n alt_35 = 1\n\n end\n case alt_35\n when 1\n # at line 215:15: parameter\n _last = @input.look\n @state.following.push( TOKENS_FOLLOWING_parameter_IN_parameters_1584 )\n parameter260 = parameter\n @state.following.pop\n\n @adaptor.add_child( root_1, parameter260.tree )\n\n\n else\n break # out of loop for decision 35\n end\n end # loop for decision 35\n\n match( UP, nil )\n end\n @adaptor.add_child( root_0, root_1 )\n _last = _save_last_1\n\n\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 31 )\n\n end\n \n return return_value\n end",
"def _reduce_436(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend",
"def next_step\n\t\t# choose the next step based on the lowest absolute delta\n\t\tnext_step = [ delta_right_top, delta_right_mid, delta_right_bot ].min_by { |i| i[1].abs }\n\n\t\t# increase tot_elavation with the delta between current and next step\n\t\t@tot_elavation += next_step[1].abs\n\n\t\treturn next_step[0]\n\tend",
"def parametros\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 28 )\n\n\n return_value = ParametrosReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n root_0 = nil\n\n __COMA135__ = nil\n valor134 = nil\n valor136 = nil\n\n\n tree_for_COMA135 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 143:4: valor ( COMA valor )*\n @state.following.push( TOKENS_FOLLOWING_valor_IN_parametros_634 )\n valor134 = valor\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, valor134.tree )\n end\n\n # at line 143:10: ( COMA valor )*\n while true # decision 17\n alt_17 = 2\n look_17_0 = @input.peek( 1 )\n\n if ( look_17_0 == COMA )\n alt_17 = 1\n\n end\n case alt_17\n when 1\n # at line 143:11: COMA valor\n __COMA135__ = match( COMA, TOKENS_FOLLOWING_COMA_IN_parametros_637 )\n if @state.backtracking == 0\n tree_for_COMA135 = @adaptor.create_with_payload( __COMA135__ )\n @adaptor.add_child( root_0, tree_for_COMA135 )\n\n end\n\n @state.following.push( TOKENS_FOLLOWING_valor_IN_parametros_639 )\n valor136 = valor\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, valor136.tree )\n end\n\n\n else\n break # out of loop for decision 17\n end\n end # loop for decision 17\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n if @state.backtracking == 0\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\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\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 28 )\n\n\n end\n\n return return_value\n end",
"def exercise2\n parse_data PositionalValidator\n validators.count(&:valid?)\n end",
"def test_exercise_115\n verify_method :exercise_115,\n :with => [{param: [0.8, 0.8], expect: true},\n {param: [0.1, 0.1], expect: true},\n {param: [0.9, 0.9], expect: true},\n {param: [1, 1], expect: false},\n {param: [0, 0], expect: false}]\n end",
"def steps\n find_solution\n end",
"def steps\n\t\tres = calc_steps @start, []\n\t\t# Always includes step for A, thus minumal value if solution exists is 2\t\n\t\tres > 0 ? res-1 : 0\n\tend",
"def value_anneal_iteration(iteration)\n @value_anneal_start / iteration\n end",
"def run_tests\n check_solution(1, [6, 29, 18, 2, 72, 19, 18, 10, 37], 18, 2)\n check_solution(2, [6, 29, 18, 2, 72, 19, 18, 10, 37], 9, -1)\nend",
"def test_step_by_step_middle\n assert_equal [0, Time.at(0), 0], stream.step\n assert_equal [2, Time.at(0, 500), 0], stream.step\n assert_equal [0, Time.at(1), 1], stream.step\n assert_equal [1, Time.at(1, 500), 10000], stream.step\n assert_equal [0, Time.at(1), 1], stream.step_back\n assert_equal [2, Time.at(0, 500), 0], stream.step_back\n assert_equal [0, Time.at(1), 1], stream.step\n assert_equal [1, Time.at(1, 500), 10000], stream.step\n end",
"def float!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 34 )\n\n \n # - - - - main rule block - - - -\n # at line 344:5: ( ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( EXPONENT )? | '.' ( '0' .. '9' )+ ( EXPONENT )? | ( '0' .. '9' )+ EXPONENT )\n alt_12 = 3\n alt_12 = @dfa12.predict( @input )\n case alt_12\n when 1\n # at line 344:9: ( '0' .. '9' )+ '.' ( '0' .. '9' )* ( EXPONENT )?\n # at file 344:9: ( '0' .. '9' )+\n match_count_6 = 0\n while true\n alt_6 = 2\n look_6_0 = @input.peek( 1 )\n\n if ( look_6_0.between?( 0x30, 0x39 ) )\n alt_6 = 1\n\n end\n case alt_6\n when 1\n # at line 344:10: '0' .. '9'\n match_range( 0x30, 0x39 )\n\n else\n match_count_6 > 0 and break\n eee = EarlyExit(6)\n\n\n raise eee\n end\n match_count_6 += 1\n end\n\n match( 0x2e )\n # at line 344:25: ( '0' .. '9' )*\n while true # decision 7\n alt_7 = 2\n look_7_0 = @input.peek( 1 )\n\n if ( look_7_0.between?( 0x30, 0x39 ) )\n alt_7 = 1\n\n end\n case alt_7\n when 1\n # at line 344:26: '0' .. '9'\n match_range( 0x30, 0x39 )\n\n else\n break # out of loop for decision 7\n end\n end # loop for decision 7\n # at line 344:37: ( EXPONENT )?\n alt_8 = 2\n look_8_0 = @input.peek( 1 )\n\n if ( look_8_0 == 0x45 || look_8_0 == 0x65 )\n alt_8 = 1\n end\n case alt_8\n when 1\n # at line 344:37: EXPONENT\n exponent!\n\n end\n\n when 2\n # at line 345:9: '.' ( '0' .. '9' )+ ( EXPONENT )?\n match( 0x2e )\n # at file 345:13: ( '0' .. '9' )+\n match_count_9 = 0\n while true\n alt_9 = 2\n look_9_0 = @input.peek( 1 )\n\n if ( look_9_0.between?( 0x30, 0x39 ) )\n alt_9 = 1\n\n end\n case alt_9\n when 1\n # at line 345:14: '0' .. '9'\n match_range( 0x30, 0x39 )\n\n else\n match_count_9 > 0 and break\n eee = EarlyExit(9)\n\n\n raise eee\n end\n match_count_9 += 1\n end\n\n # at line 345:25: ( EXPONENT )?\n alt_10 = 2\n look_10_0 = @input.peek( 1 )\n\n if ( look_10_0 == 0x45 || look_10_0 == 0x65 )\n alt_10 = 1\n end\n case alt_10\n when 1\n # at line 345:25: EXPONENT\n exponent!\n\n end\n\n when 3\n # at line 346:9: ( '0' .. '9' )+ EXPONENT\n # at file 346:9: ( '0' .. '9' )+\n match_count_11 = 0\n while true\n alt_11 = 2\n look_11_0 = @input.peek( 1 )\n\n if ( look_11_0.between?( 0x30, 0x39 ) )\n alt_11 = 1\n\n end\n case alt_11\n when 1\n # at line 346:10: '0' .. '9'\n match_range( 0x30, 0x39 )\n\n else\n match_count_11 > 0 and break\n eee = EarlyExit(11)\n\n\n raise eee\n end\n match_count_11 += 1\n end\n\n exponent!\n\n end\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 34 )\n\n end",
"def step\n log_iteration_start\n\n\n @current_task = tasks_list.shift\n status.no_tasks! and return unless current_task #empty tasks list\n\n solve_current_task\n\n return unless current_basis_plan # no optimal plan, so we don't change record and continue\n\n if current_target_function <= record # not interested as previsous record is higher\n status.target_less_than_record!\n elsif task.satisfies_integer?(current_basis_plan)\n change_record\n else\n split_current_task\n end\n log_status\n end",
"def findBestIn(x, n, h, step, loops)\n #set initial\n best = trainAndValidate(x, n, h, step)\n for i in 2..loops\n trained = trainAndValidate(x, n, h, step)\n if trained.ann < best.ann\n best = trained\n end\n end\n best\nend",
"def process(opts) \n valid_file = File.open(opts[:valid_file], opts[:mode])\n valid_values = []\n\n invalid_file = File.open(opts[:invalid_file], 'w')\n invalid_values = []\n \n skip_counter = 0\n\n File.open(opts[:infile], 'r') do |file|\n while line = file.gets\n line.chomp.split(opts[:delimiter]).each do |value|\n \n match = value.match(opts[:pattern])\n\n if match.nil? \n if opts[:fix]\n result = fix value, opts[:pattern] \n case result[:answer]\n when 'v'\n valid_values << result[:value]\n when 'i'\n invalid_values << result[:value]\n when 'd'\n skip_counter += 1\n when 's'\n value.scan(opts[:scan_pattern]).each do |value|\n valid_values << value\n end\n end\n else\n invalid_values << value\n end\n else\n valid_values << match.to_s\n end\n end\n end\n end\n\n valid_counter = valid_values.size\n\n valid_values.uniq! {|value| value.downcase } if opts[:individualize]\n valid_values.sort! {|a,b| a.downcase <=> b.downcase } if opts[:sort]\n\n valid_values.each do |value|\n valid_file.puts value\n end\n\n invalid_counter = invalid_values.size\n\n invalid_values.uniq! {|value| value.downcase} if opts[:individualize]\n invalid_values.sort! if opts[:sort]\n\n invalid_values.each do |value|\n invalid_file.puts value\n end\n\n valid_file.close\n invalid_file.close\n \n double_counter = valid_counter - valid_values.size +\n invalid_counter - invalid_values.size\n\n opts[:valid_counter] = valid_values.size \n opts[:invalid_counter] = invalid_values.size \n opts[:skip_counter] = skip_counter\n opts[:double_counter] = double_counter\n if (invalid_values.size > 0 and not opts[:fix])\n opts[:note] = \" You can fix invalid values and append \" + \n \"to valid with: $ sycspector -fa\"\n end\n\n end",
"def prt\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 5 )\n\n begin\n # at line 43:9: ( ( OUT LPAR ( comp )? RPAR ) | ( OUTS LPAR ( comp )? RPAR ) )\n alt_7 = 2\n look_7_0 = @input.peek( 1 )\n\n if ( look_7_0 == OUT )\n alt_7 = 1\n elsif ( look_7_0 == OUTS )\n alt_7 = 2\n else\n raise NoViableAlternative( \"\", 7, 0 )\n end\n case alt_7\n when 1\n # at line 43:11: ( OUT LPAR ( comp )? RPAR )\n # at line 43:11: ( OUT LPAR ( comp )? RPAR )\n # at line 43:12: OUT LPAR ( comp )? RPAR\n match( OUT, TOKENS_FOLLOWING_OUT_IN_prt_261 )\n match( LPAR, TOKENS_FOLLOWING_LPAR_IN_prt_263 )\n # at line 43:21: ( comp )?\n alt_5 = 2\n look_5_0 = @input.peek( 1 )\n\n if ( look_5_0 == MINUS || look_5_0 == LPAR || look_5_0.between?( ID, STRING ) )\n alt_5 = 1\n end\n case alt_5\n when 1\n # at line 43:21: comp\n @state.following.push( TOKENS_FOLLOWING_comp_IN_prt_265 )\n comp\n @state.following.pop\n\n end\n match( RPAR, TOKENS_FOLLOWING_RPAR_IN_prt_268 )\n # --> action\n agc_3('out')\n # <-- action\n\n\n when 2\n # at line 43:48: ( OUTS LPAR ( comp )? RPAR )\n # at line 43:48: ( OUTS LPAR ( comp )? RPAR )\n # at line 43:49: OUTS LPAR ( comp )? RPAR\n match( OUTS, TOKENS_FOLLOWING_OUTS_IN_prt_274 )\n match( LPAR, TOKENS_FOLLOWING_LPAR_IN_prt_276 )\n # at line 43:59: ( comp )?\n alt_6 = 2\n look_6_0 = @input.peek( 1 )\n\n if ( look_6_0 == MINUS || look_6_0 == LPAR || look_6_0.between?( ID, STRING ) )\n alt_6 = 1\n end\n case alt_6\n when 1\n # at line 43:59: comp\n @state.following.push( TOKENS_FOLLOWING_comp_IN_prt_278 )\n comp\n @state.following.pop\n\n end\n match( RPAR, TOKENS_FOLLOWING_RPAR_IN_prt_281 )\n # --> action\n agc_3('outln')\n # <-- action\n\n\n end\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__, 5 )\n\n end\n \n return \n end",
"def _reduce_478(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend",
"def exercise1\n parse_data MinMaxValidator\n validators.count(&:valid?)\n end",
"def getDecision(output, data_source)\r\n key = data_source.to_sym\r\n\r\n # Last sold check\r\n idx = output[key][:metricsNames].index(\"Last Sold History\")\r\n output[:reason][0] = \"Sold too recently\" if !output[key][:metricsPass][idx]\r\n\r\n # Rurality Checks\r\n rs_idx = output[:Census][:metricsNames].index(\"Rurality Score\")\r\n vol_idx = output[key][:metricsNames].index(\"St. Dev. of Historical Home Price\")\r\n\r\n if output[:region] == \"East\"\r\n output[:reason][1] = \"Too rural\" if (!output[:Census][:metricsPass][rs_idx] || !output[key][:metricsPass][vol_idx]) \r\n end\r\n\r\n if output[:region] == \"West\"\r\n output[:reason][1] = \"Too rural\" if !output[:Census][:metricsPass][rs_idx]\r\n end\r\n\r\n # Typicality\r\n typ_idx = output[key][:metricsUsage].each_index.select { |i| output[key][:metricsUsage][i] == \"Typicality\" }\r\n typ_fail_cnt = typ_idx.inject([]) { |tot, a| tot << output[key][:metricsPass][a] }.count(false)\r\n\r\n if data_source == \"Zillow\"\r\n neigh_idx = output[key][:metricsNames].index(\"Neighbors Available\")\r\n sqft_idx = output[key][:metricsNames].index(\"SqFt Typicality - Comps\")\r\n est_idx = output[key][:metricsNames].index(\"Estimate Typicality - Comps\")\r\n\r\n if output[key][:metrics][neigh_idx] >= 4\r\n sqfi_nb_idx = output[key][:metricsNames].index(\"SqFt Typicality - Neighbors\")\r\n est_nb_idx = output[key][:metricsNames].index(\"Estimate Typicality - Neighbors\")\r\n\r\n output[:reason][2] = \"Atypical property\" if typ_fail_cnt >= 3\r\n output[:reason][2] = \"Atypical property\" if typ_fail_cnt >= 1 && (output[key][:metrics][sqft_idx] > 65.0 || output[key][:metrics][est_idx] > 65.0)\r\n output[:reason][2] = \"Atypical property\" if !output[key][:metricsPass][sqft_idx] && !output[key][:metricsPass][sqfi_nb_idx]\r\n output[:reason][2] = \"Atypical property\" if !output[key][:metricsPass][est_idx] && !output[key][:metricsPass][est_nb_idx]\r\n else\r\n output[:reason][2] = \"Atypical property\" if typ_fail_cnt >= 2\r\n output[:reason][2] = \"Atypical property\" if typ_fail_cnt >= 1 && (output[key][:metrics][sqft_idx] > 60.0 || output[key][:metrics][est_idx] > 60.0)\r\n end\r\n else\r\n output[:reason][2] = \"Atypical property\" if typ_fail_cnt >= 2\r\n output[:reason][2] = \"Atypical property\" if typ_fail_cnt >= 1 && (output[key][:metrics][sqft_idx] > 60.0 || output[key][:metrics][est_idx] > 60.0)\r\n end\r\n\r\n # Liquidity (allow one false)\r\n liq_idx = output[key][:metricsUsage].each_index.select { |i| output[key][:metricsUsage][i] == \"Liquidity\" }\r\n liq_fail_cnt = liq_idx.inject([]) { |tot, a| tot << output[key][:metricsPass][a] }.count(false)\r\n output[:reason][3] = \"Illiquidity\" if liq_fail_cnt >= 2\r\n\r\n # Investment Guidelines\r\n est_idx = output[key][:metricsNames].index(\"Estimated Value\")\r\n type_idx = output[key][:metricsNames].index(\"Property Use\")\r\n build_idx = output[key][:metricsNames].index(\"Build Date\")\r\n msa_idx = output[key][:metricsNames].index(\"Pre-approval\")\r\n\r\n output[:reason][4] = \"Out of $ Range\" if !output[key][:metricsPass][est_idx]\r\n output[:reason][5] = \"Not Prop Type\" if !output[key][:metricsPass][type_idx]\r\n output[:reason][6] = \"New Construction\" if !output[key][:metricsPass][build_idx]\r\n output[:reason][7] = \"Not in MSAs\" if !output[key][:metricsPass][msa_idx]\r\n\r\n # Volatility (allow one false)\r\n vol_idx = output[key][:metricsUsage].each_index.select { |i| output[key][:metricsUsage][i] == \"Volatility\" }\r\n vol_fail_cnt = vol_idx.inject([]) { |tot, a| tot << output[key][:metricsPass][a] }.count(false)\r\n output[:reason][8] = \"Price Vol\" if vol_fail_cnt >= 2\r\n\r\n # Combo Rural (if applicable)\r\n cr_idx = output[:Census][:metricsNames].index(\"Combo Rural\")\r\n output[:reason][9] = \"Combo Rural\" if !output[:Census][:metricsPass][cr_idx]\r\n\r\n # Distance\r\n output[:reason][10] = \"MSA Distance\" if !output[:Google][:metricsPass].any?\r\n\r\n # Approve if not issues\r\n output[:reason][11] = \"Approved\" if output[:reason].compact.size == 0\r\n end",
"def _reduce_479(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend",
"def step!\n @new_cells = []\n # Regard the endings as false.\n ([false] + @cells + [false]).each_cons(3) do |neighbourhood|\n @new_cells << @rules[neighbourhood]\n end\n @cells = @new_cells\n end",
"def initial_cut_values\n end",
"def test_doe_latin_hypercube_method_should_return_evenly_distributed_points_across_parameter_space_2_param_case\n @experiment_with_multiple_params.doe_info = [[\"latinHypercube\", [\"param-0\", \"param-1\"]]]\n\n\n doe_method_result = @experiment_with_multiple_params.apply_doe_methods.first\n\n\n assert_equal \"latinHypercube\", doe_method_result[0]\n assert_equal [\"param-0\", \"param-1\"], doe_method_result[1]\n assert_equal 6, doe_method_result[2].size\n\n level_counters = [ [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0] ]\n\n doe_method_result[2].each do |input_parameter_space_point|\n input_parameter_space_point.each_with_index do |value, index|\n level_counters[index][value / 20] += 1\n end\n end\n\n level_counters.each{|counter| assert_equal [1, 1, 1, 1, 1, 1], counter}\n end",
"def stepper(nums)\n table = Array.new(nums.length).fill(false)\n table[0]= true;\n\n table.each_with_index do |entry, idx|\n if entry == true\n maxRange = nums[idx]\n (1..maxRange).each do |step|\n if step < table.length\n table[step] = true\n end\n end\n end\n end\n table.last\nend",
"def get_test_cases()\n test_cases = []\n test_cases.push(\"\"\"\n X|X|O|O|X|X|*\n O|O|X|O|X|O|X\n X|O|O|X|O|X|O\n O|O|X|X|X|O|X\n X|X|O|O|X|O|O\n O|O|X|X|O|X|X\n \"\"\")\n test_cases.push(\"\"\"\n X|X|O|O|X|X|*\n O|O|X|O|X|O|X\n X|O|O|X|O|X|O\n O|O|X|X|X|O|X\n X|X|O|O|X|O|O\n O|O|X|X|O|X|X\n \"\"\")\n test_cases.push(\"\"\"\n X|X|X|O|X|O|*\n X|O|O|O|X|O|X\n X|O|O|X|O|X|O\n O|O|X|X|X|O|X\n X|X|O|O|X|O|X\n O|O|X|X|O|X|X\n \"\"\"\n )\n test_cases.push(\"\"\"\n *|*|*|*|*|*|*\n *|*|*|*|*|*|*\n *|*|X|*|*|*|*\n *|O|X|*|*|*|X\n O|O|O|O|*|*|X\n O|O|X|X|X|O|X\n \"\"\")\n test_cases.push(\"\"\"\n *|*|*|*|*|*|*\n O|X|*|*|*|*|*\n X|X|*|O|*|*|O\n O|X|*|O|*|*|X\n X|O|X|X|*|O|O\n X|O|O|X|*|O|X\n \"\"\")\n test_cases.push(\"\"\"\n *|*|*|*|*|*|*\n *|*|*|*|*|*|*\n *|*|*|*|*|*|*\n X|*|*|*|*|*|*\n X|*|*|*|*|*|*\n X|*|O|O|O|O|*\n \"\"\")\n\n return test_cases\n\n end",
"def solution(a)\n # [1, -INFINITY, -INFINITY, -INFINITY, -INFINITY, -INFINITY]\n # [1,-1, 1, 10, 0, -1] row = 1. start_val = 1\n # [1,-1, 1, 10, 0, -1] row = 2. start_val = -1\n # [1,-1, 1, 10, 0, -1] row = 3. start_val = 1\n # [1,-1, 1, 10, 9, 8] row = 4. start_val = 10\n # [1,-1, 1, 10, 9, 8] row = 5. start_val = 9\n\n dp = [a[0]] + [MININT] * (a.size - 1)\n (1..a.size - 1).each do |row|\n start_index = row - 1\n start_val = dp[start_index]\n\n # we may only move forward up to 6 spots\n end_col = [a.size - 1, start_index + 6].min\n puts \"start_val: #{start_val}. Inner loop start_col: #{row} / end_col: #{end_col}\"\n\n (row..end_col).each do |col|\n puts \"row: #{row}, col: #{col}\"\n dp[col] = [dp[col], start_val + a[col]].max\n end\n p dp\n puts\n end\n\n \"Answer: #{dp.last}\"\nend",
"def schedule(start = 0, stop = 100)\n\n # Sort intervals by end point asc\n # iterate from left to right\n # at each endpoint find the max weight from the start to that endpoint\n # Make a comparison if the start of the interval is after the end of the previous \"checkpoint\"\n # add the weight adn that is the new checkpoint\n # if it overlaps then select the larger of the two endpoints\n # This is almost right but not quite\n # we want to break up at previously weighed sectionif we need to\n # we shodul get keep the list of all endpoints weights\n\n # x---x\n # x----x\n # x-------x\n\n # 1,4,3\n # 5,9,4\n # 7,12,5\n\n # Keep the checkpoints here\n # [4:3, 9:7]\n # then see 7,12,5\n # choose 5 or 7 we'd say 7 and may want to do say 7 is max from 0<=>12\n # but if we split it up\n # [4:3, 9:7, 12:8]\n # we could get max 8 if we exclude the middle one\n\n endpoints = []\n interval_list = sort(@interval_list)\n\n interval_list.each do |interval|\n max_weight = interval.weight\n steps = []\n\n # endpoint list is sorted so ya konw we could just do binary search here\n # woudl bring the whoel thing down to nlgn\n endpoints.reverse.each do |endpoint|\n if interval.start > endpoint.stop\n max_weight += endpoint.best_weight\n steps = endpoint.steps.clone\n break\n end\n end\n\n # If we do better by ignoring this interval than record that\n if endpoints.last && endpoints.last.best_weight > max_weight\n max_weight = endpoints.last.best_weight\n steps = endpoints.last.steps\n else\n steps << interval\n end\n\n endpoints << EndpointWeight.new(interval.stop, max_weight, steps)\n end\n\n # endpoints is non-decrasing with each entry. Last must be max\n puts endpoints.last\n endpoints.last.best_weight\n end",
"def make_step\n @result\n end",
"def test\n\t\t##\n\t\t# Possible outcomes for each test. Do all tests and count the outcome\n\t\t##\n\t\twinLoss = {win: 0, loss: 0, sorted: 0, unsorted: 0}\n\t\t@xData[:test].each{|test|\n\t\t\t#Get the truth\n\t\t\tsorted \t\t= test.sort{|a,b| a <=> b}\n\t\t\t#Take an educated guess\n\t\t\tprediction\t= @machine.run(test).first.round\n\t\t\t##\n\t\t\t# Record outcomes\n\t\t\t##\n\t\t\t#If it is classed as sorted and is sorted\n\t\t\tif prediction == 1 && test == sorted \n\t\t\t\twinLoss[:win] \t\t+= 1\n\t\t\t\twinLoss[:sorted]\t+= 1\n\t\t\t#If it's classed as unsorted and is unsorted\n\t\t\telsif prediction == 0 && test != sorted\n\t\t\t\twinLoss[:win] \t\t+= 1\n\t\t\t\twinLoss[:unsorted]\t+= 1\n\t\t\t#A loos. You've broke something somewhere (probably)\n\t\t\telse\n\t\t\t\twinLoss[:loss] \t\t+= 1\n\t\t\tend\n\t\t}\n\t\t#Print the results\n\t\tputs \"Iterations: #{@iterations}\\nMAX_MSE: #{@maxError}\\n\\t#{winLoss}\" # proof\n\tend",
"def before_validate\n self.initial_output :alias => 'PREVOUT' unless self.initial_output\n self.previous_input :alias => 'PREVIN' unless self.previous_input\n self.previous_output :alias => 'PREVOUT' unless self.previous_output\n self.outputs<< output(0) if self.outputs.empty?\n super\n end",
"def prepare_to_check_solve(fake_value = 0.01)\n 2.times do\n find_max_values(end_layer_sum).each do |max_value|\n log format('faking values: %d-%x', end_layer_sum, max_value)\n vbyte_reader = VByteReader.new(\n layer_part_pathname(end_layer_sum, max_value)\n )\n @solver.generate_values_for_check(\n vbyte_reader,\n fake_value,\n new_solution(end_layer_sum, max_value).values.to_s\n )\n end\n @end_layer_sum -= 2\n end\n end",
"def process_input()\n\n if (@input_type == 'STRING')\n\n if (@inp[@start, @increment] == 'PLACE')\n return [true, @increment, 0, 0]\n else\n return [false, @increment, 0, 0]\n end\n\n elsif (@input_type == 'INTEGER')\n\n if ((@inp[@start, @increment].to_i).to_s == @inp[@start, @increment])\n return [true, @increment, @inp[@start, @increment].to_i, 0]\n else\n return [false, @increment, @inp[@start, @increment].to_i, 0]\n end\n\n elsif (@input_type === 'ORIENTATION')\n\n orientation_array = ['N', 'E', 'S', 'W']\n orientation_num = nil\n h = 0\n while (h < 4) && (orientation_num == nil)\n if orientation_array[h] == @inp[@start, @increment]\n orientation_num = h\n end\n h = h + 1\n end\n if @increment == 1\n if orientation_num != nil\n return [true, @increment, orientation_num, 0]\n end\n end\n return [false, 0, 0, 0]\n end\n\n return nil\n end",
"def propertyValueCheck(output, prop_data, data_source)\r\n output[data_source.to_sym][:dataSource] << data_source.to_s\r\n output[data_source.to_sym][:metricsNames] << \"Estimated Value\"\r\n output[data_source.to_sym][:metricsUsage] << \"Price Range\"\r\n\r\n if prop_data[:estimate].nil?\r\n output[data_source.to_sym][:metrics] << \"N/A\"\r\n output[data_source.to_sym][:metricsPass] << true\r\n output[data_source.to_sym][:metricsComments] << \"Data Not Available\"\r\n return\r\n end\r\n\r\n # Perform check\r\n value = prop_data[:estimate]\r\n pass = (value <= PRICE_MAX && value >= PRICE_MIN)\r\n comment = \"< #{PRICE_MAX} & > #{PRICE_MIN}\"\r\n\r\n # Save values\r\n output[data_source.to_sym][:metrics] << value\r\n output[data_source.to_sym][:metricsPass] << pass\r\n output[data_source.to_sym][:metricsComments] << comment\r\n end",
"def break_down(&blk)\n klass = granularity.pred\n iter = if klass.nil?\n []\n else\n klass.new(start)..klass.new(finish - 1)\n end\n iter.each(&blk)\n end",
"def condicion\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 23 )\n\n\n return_value = CondicionReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n root_0 = nil\n\n __OP_REL114__ = nil\n valor113 = nil\n valor115 = nil\n\n\n tree_for_OP_REL114 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 123:4: valor OP_REL valor\n @state.following.push( TOKENS_FOLLOWING_valor_IN_condicion_545 )\n valor113 = valor\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, valor113.tree )\n end\n\n __OP_REL114__ = match( OP_REL, TOKENS_FOLLOWING_OP_REL_IN_condicion_547 )\n if @state.backtracking == 0\n tree_for_OP_REL114 = @adaptor.create_with_payload( __OP_REL114__ )\n @adaptor.add_child( root_0, tree_for_OP_REL114 )\n\n end\n\n @state.following.push( TOKENS_FOLLOWING_valor_IN_condicion_549 )\n valor115 = valor\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, valor115.tree )\n end\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n if @state.backtracking == 0\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\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\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 23 )\n\n\n end\n\n return return_value\n end",
"def test_ranges\r\n assert_equal(@range.begin.to_f, @p2.to_f)\r\n assert(@range.cover?(@p5))\r\n assert(@range.end == @p8)\r\n assert(@range2.exclude_end?)\r\n assert_false(@range.exclude_end?)\r\n assert(@range.include?(@p3))\r\n assert(@range.max == @p8)\r\n assert(@range2.max == @p7)\r\n assert(@range.last(3) == [@p6, @p7, @p8])\r\n assert(@range.size == nil)\r\n end",
"def expresion\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 44 )\n\n\n return_value = ExpresionReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n\n root_0 = nil\n\n __OP_ARI237__ = nil\n valor236 = nil\n valor238 = nil\n\n\n tree_for_OP_ARI237 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 208:4: valor ( OP_ARI valor )*\n @state.following.push( TOKENS_FOLLOWING_valor_IN_expresion_1013 )\n valor236 = valor\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, valor236.tree )\n end\n\n # at line 208:10: ( OP_ARI valor )*\n while true # decision 32\n alt_32 = 2\n look_32_0 = @input.peek( 1 )\n\n if ( look_32_0 == OP_ARI )\n alt_32 = 1\n\n end\n case alt_32\n when 1\n # at line 208:11: OP_ARI valor\n __OP_ARI237__ = match( OP_ARI, TOKENS_FOLLOWING_OP_ARI_IN_expresion_1016 )\n if @state.backtracking == 0\n tree_for_OP_ARI237 = @adaptor.create_with_payload( __OP_ARI237__ )\n @adaptor.add_child( root_0, tree_for_OP_ARI237 )\n\n end\n\n @state.following.push( TOKENS_FOLLOWING_valor_IN_expresion_1018 )\n valor238 = valor\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, valor238.tree )\n end\n\n\n else\n break # out of loop for decision 32\n end\n end # loop for decision 32\n\n\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n\n if @state.backtracking == 0\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\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\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 44 )\n\n\n end\n\n return return_value\n end",
"def _reduce_578(val, _values, result)\n yyerrok \n result\nend",
"def construct_solution\n path = [@root]\n tabu_list = [@root]\n until @ends.include?(last = path.last)\n step = next_step last, tabu_list\n path << step\n end\n path\n end",
"def steps(n)\nend",
"def _reduce_45(val, _values, result)\n case val[0]\n when 'even'\n result = Node.new(:NTH, ['2','n','+','0'])\n when 'odd'\n result = Node.new(:NTH, ['2','n','+','1'])\n when 'n'\n result = Node.new(:NTH, ['1','n','+','0'])\n else\n result = val\n end\n\n result\nend",
"def linearAccuracy\n wrong = 0\n correct = 0\n tp = 0\n tn = 0\n fp = 0\n fn = 0\n\n @label = Array.new(@total_line) {0.00}\n @evaluate = Array.new(@total_line) {0.00}\n @bayes_part = Array.new(@total_line) {0.00}\n\n t_file = File.open(\"./true_label.txt\", \"r\").to_enum\n e_file = File.open(\"./p_zh.txt\", \"r\").to_enum\n b_file = File.open(\"./decision_label.txt\", \"r\").to_enum\n\n array_count = 0\n loop do\n #access next line in each file with .next\n line_t = t_file.next.to_f\n line_e = e_file.next.to_f\n line_b = b_file.next.to_f\n\n if line_e != 0.0\n if line_t == 1.0\n if line_e == 1.0\n tp += 1\n elsif line_e == -1.0\n fp += 1\n else\n puts \"what?\"\n end\n elsif line_t == -1.0\n if line_e == 1.0\n fn += 1\n elsif line_e == -1.0\n tn += 1\n else\n puts \"what??\"\n end\n else\n puts \"what???\"\n end \n\n @evaluate[array_count] = line_e\n @label[array_count] = line_t\n @bayes_part[array_count] = line_b\n array_count += 1\n end\n end\n\n # write best results in simple linear to file\n File.open('true_label_linear.txt', 'w') do |f1| \n # use \"\\n\" for two lines of text \n @label.each do |line|\n f1.puts line\n end\n end\n\n File.open('decision_label_linear.txt', 'w') do |f2| \n # use \"\\n\" for two lines of text \n @evaluate.each do |line|\n f2.puts line\n end\n end\n\n File.open('decision_label_bayes_part.txt', 'w') do |f3| \n # use \"\\n\" for two lines of text \n @bayes_part.each do |line|\n f3.puts line\n end\n end\n\n puts (\"#{@label.size} lines\")\n correct = tp + tn\n wrong = fp + fn\n @Accuracy = 0.0\n @Accuracy = correct.to_f * 100 / (correct + wrong)\n puts \"Simple Accuracy #{@Accuracy}%\"\n tpr = tp.to_f / (tp + fn)\n fpr = fp.to_f / (fp + tn)\n puts \"fp: #{fp} fn: #{fn} tp: #{tp} tn: #{tn}\"\n puts \"tpr #{tpr} fpr: #{fpr}\"\n\n print \"linear \"\n system('./calc_auc ./true_label_linear.txt ./decision_label_linear.txt')\n\n print \"bayes part accordingly \"\n system('./calc_auc ./true_label_linear.txt ./decision_label_bayes_part.txt')\nend",
"def expected_value; end",
"def expected_value; end",
"def outputs\n constructions = [\n 'floor_fin_ins_unfin_attic', # unfinished attic floor\n 'floor_fin_ins_unfin', # interzonal or cantilevered floor\n 'floor_fin_unins_fin', # floor between 1st/2nd story living spaces\n 'floor_unfin_unins_unfin', # floor between garage and attic\n 'floor_fnd_grnd_fin_b', # finished basement floor\n 'floor_fnd_grnd_unfin_b', # unfinished basement floor\n 'floor_fnd_grnd_fin_slab', # finished slab\n 'floor_fnd_grnd_unfin_slab', # garage slab\n 'floor_unfin_b_ins_fin', # unfinished basement ceiling\n 'floor_cs_ins_fin', # crawlspace ceiling\n 'floor_pb_ins_fin', # pier beam ceiling\n 'floor_fnd_grnd_cs', # crawlspace floor\n 'roof_unfin_unins_ext', # garage roof\n 'roof_unfin_ins_ext', # unfinished attic roof\n 'roof_fin_ins_ext', # finished attic roof\n 'wall_ext_ins_fin', # living exterior wall\n 'wall_ext_ins_unfin', # attic gable wall under insulated roof\n 'wall_ext_unins_unfin', # garage exterior wall or attic gable wall under uninsulated roof\n 'wall_fnd_grnd_fin_b', # finished basement wall\n 'wall_fnd_grnd_unfin_b', # unfinished basement wall\n 'wall_fnd_grnd_cs', # crawlspace wall\n 'wall_int_fin_ins_unfin', # interzonal wall\n 'wall_int_fin_unins_fin', # wall between two finished spaces\n 'wall_int_unfin_unins_unfin', # wall between two unfinished spaces\n 'living_space_footing_construction', # living space footing construction\n 'garage_space_footing_construction', # garage space footing construction\n # \"window_construction\", # exterior window\n 'door', # exterior door\n 'res_furniture_construction_living_space', # furniture in living\n 'res_furniture_construction_living_space_story_2', # furniture in living, second floor\n 'res_furniture_construction_unfinished_basement_space', # furniture in unfinished basement\n 'res_furniture_construction_finished_basement_space', # furniture in finished basement\n 'res_furniture_construction_garage_space', # furniture in garage\n 'living_zone', # living space air\n 'garage_zone', # garage space air\n 'unfinished_basement_zone', # unfinished basement space air\n 'finished_basement_zone', # finished basement space air\n 'crawl_zone', # crawl space air\n 'unfinished_attic_zone' # unfinished attic space air\n ]\n\n result = OpenStudio::Measure::OSOutputVector.new\n metrics.each do |metric|\n constructions.each do |construction|\n result << OpenStudio::Measure::OSOutput.makeDoubleOutput(\"#{metric}_#{construction}\")\n end\n end\n return result\n end",
"def _reduce_784(val, _values, result)\n yyerrok\n result\nend",
"def step(machine)\n # @todo: when segment_id is :ISA, :GS, or :ST, use the correct values?\n machine.successors.head.constraints.each do |segment_id, table|\n case table\n when Stupidedi::Builder::ConstraintTable::Shallowest,\n Stupidedi::Builder::ConstraintTable::Deepest\n segment_tok =\n mksegment_tok(@reader.segment_dict, segment_id, @elements[segment_id], nil)\n\n op = table.matches(segment_tok, false).head\n as = machine.execute(op, machine.active.head, @reader, segment_tok)\n enqueue(as)\n\n when Stupidedi::Builder::ConstraintTable::Stub\n if table.instructions.length == 1\n segment_tok =\n mksegment_tok(@reader.segment_dict, segment_id, @elements[segment_id], nil)\n\n op = table.matches(nil, false).head\n as = machine.execute(op, machine.active.head, @reader, segment_tok)\n enqueue(as)\n else\n raise Exceptions::InvalidSchemaError,\n \"proceeding from [#{pp_machine(machine)}], there are no \" +\n \"constraints on segment #{segment_id} to choose between:\\n\" +\n table.instructions.map{|x| pp_instruction(x) }.join\n end\n\n when Stupidedi::Builder::ConstraintTable::ValueBased\n disjoint, distinct = table.basis(table.instructions)\n\n if disjoint.empty?\n # We're definitely going to throw an error now, but we need to\n # get more information to make a useful error message. First\n # check that interesting elements are required\n designators = optional_elements(distinct, table.instructions)\n\n case designators.length\n when 0\n when 1\n raise Exceptions::InvalidSchemaError,\n \"proceeding from [#{pp_machine(machine)}], the element \" +\n \"#{designators.join(\", \")} is designated optional, but \" +\n \"is necessary to choose between:\\n\" +\n table.instructions.map{|x| pp_instruction(x) }.join\n else\n raise Exceptions::InvalidSchemaError,\n \"proceeding from [#{pp_machine(machine)}], the elements \" +\n \"#{designators.join(\", \")} are designated optional, but \" +\n \"at least one is necessary to choose between:\\n\" +\n table.instructions.map{|x| pp_instruction(x) }.join\n end\n\n # Next report cases of element values that cause ambiguity\n designators, ex_designator, ex_value, ex_instructions =\n distinct_elements(distinct, table.instructions)\n\n case designators.length\n when 0\n raise Exceptions::InvalidSchemaError,\n \"proceeding from [#{pp_machine(machine)}], there are no \" +\n \"constraints on segment #{segment_id} to choose \" +\n \"between:\\n\" + table.instructions.map{|x| pp_instruction(x) }.join\n when 1\n raise Exceptions::InvalidSchemaError,\n \"proceeding from [#{pp_machine(machine)}], the element \" +\n \"#{ex_designator} has overlapping values among possible \" +\n \"choices; for example when it has value the #{ex_value}, \"+\n \"it is not possible to choose between:\\n\" +\n ex_instructions.map{|x| pp_instruction(x) }.join\n else\n raise Exceptions::InvalidSchemaError,\n \"proceeding from [#{pp_machine(machine)}], the elements \" +\n \"#{designators.join(\", \")} each have overlapping values \" +\n \"among choices; for example when #{ex_designator} has \" +\n \"the value #{ex_value}, it is not possible to choose \" +\n \"between:\\n\" + ex_instructions.map{|x| pp_instruction(x) }.join\n end\n else\n # It's possible there is no ambiguity here, but we need to check\n designators = optional_elements(disjoint, table.instructions)\n\n case designators.length\n when 0\n when 1\n raise Exceptions::InvalidSchemaError,\n \"proceeding from [#{pp_machine(machine)}], the element \" +\n \"#{designators.join(\", \")} is designated optional in at \" +\n \"least one case, but is necessary to choose between:\\n\" +\n table.instructions.map{|x| pp_instruction(x) }.join\n else\n raise Exceptions::InvalidSchemaError,\n \"proceeding from [#{pp_machine(machine)}], the elements \" +\n \"#{designators.join(\", \")} are designated optional in at \" +\n \"least one case each, but at least one is necessary to \" +\n \"choose between:\\n\" +\n table.instructions.map{|x| pp_instruction(x) }.join\n end\n\n mksegments(table).each do |op, segment_tok|\n enqueue(machine.execute(op, machine.active.head, @reader, segment_tok))\n end\n end\n else\n raise \"unexpected kind of constraint table: #{constraint_table.class}\"\n end\n end\n end",
"def _reduce_508(val, _values, result)\n result = @builder.range_inclusive(nil, val[0], val[1])\n \n result\nend",
"def value_anneal\n value_anneal_iteration(@iteration)\n end",
"def main\n north_south = 0\n east_west = 0\n rotation = 0\n\n standard_rotations = {\n 0 => { north_south: 0, east_west: 1 },\n 90 => { north_south: 1, east_west: 0 },\n 180 => { north_south: 0, east_west: -1 },\n 270 => { north_south: -1, east_west: 0 },\n }\n input_lines.map do |line|\n [line[0], line[1..-1].to_i]\n end.each do |instruction, value|\n #binding.pry if instruction == \"F\" && value == 11\n\n case instruction\n when 'F'\n north_south += value * standard_rotations[rotation][:north_south]\n east_west += value * standard_rotations[rotation][:east_west]\n when 'N'\n north_south += value\n when 'S'\n north_south -= value\n when 'E'\n east_west += value\n when 'W'\n east_west -= value\n when 'L'\n rotation += value\n when 'R'\n rotation -= value\n else\n raise \"bad instruction. oh no.\"\n end\n\n rotation += 360 while rotation < 0\n rotation -= 360 while rotation >= 360\n end\n\n distance = north_south.abs + east_west.abs\n\n puts distance\nend",
"def exercise2\n slope = Slope.new\n value = exercise1 slope\n\n slope = Slope.new right: 3\n value *= exercise1 slope\n\n slope = Slope.new right: 5\n value *= exercise1 slope\n\n slope = Slope.new right: 7\n value *= exercise1 slope\n\n slope = Slope.new right: 1, down: 2\n value *= exercise1 slope\n\n value\n end",
"def input\n lines = File.new('day12_input.txt').readlines()\n initial_state = lines[0].match('initial state:\\s*([^\\n]*)')[1]\n .chars\n .each_with_index\n .map { |x, i| [i, x] }\n rules = lines[2...lines.length].map { |item|\n item.strip.split(\" => \")\n }\n return initial_state, rules\nend",
"def step\n case\n when check( /program\\s+/ )\n start_group :keyword, scan( /program\\s+/ )\n start_group :function, scan_until( /(?=[;(\\s]|#{EOL})/ )\n when check( /subroutine\\s+/ )\n start_group :keyword, scan( /subroutine\\s+/ )\n start_group :function, scan_until( /(?=[;(\\s]|#{EOL})/ )\n when check( /function\\s+/ )\n start_group :keyword, scan( /function\\s+/ )\n start_group :function, scan_until( /(?=[;(\\s]|#{EOL})/ )\n when check( /module\\s+/ )\n start_group :keyword, scan( /module\\s+/ )\n start_group :function, scan_until( /(?=[;\\s]|#{EOL})/ )\n when check( /\\.true\\.|\\.false\\.|\\.TRUE\\.|\\.FALSE\\./ )\n start_group :constant,\n scan(/\\.true\\.|\\.false\\.|\\.TRUE\\.|\\.FALSE\\./)\n when scan( /(\\d+\\.?\\d*|\\d*\\.?\\d+)([eEdDqQ][+-]?\\d+)?(_\\w+)?/ )\n start_group :number, matched\n when scan( /[bB]\\'[01]+\\'|[oO]\\'[0-7]+\\'|[zZ]\\'[0-9a-fA-F]+\\'/ )\n start_group :number, matched\n else\n case peek(1)\n when /[\\n\\r]/\n start_group :normal, scan( /\\s+/ )\n when /\\s/\n start_group :normal, scan( /\\s+/ )\n when \"!\"\n start_group :comment, scan( /![^\\n\\r]*/ )\n when /[A-Za-z]/\n word = scan( /\\w+/ )\n if KEYWORDS.include?(word)\n start_group :keyword, word\n elsif TYPES.include?(word)\n start_group :type, word\n elsif INTRINSICS.include?(word)\n start_group :function, word\n elsif\n start_group :ident, word\n end\n when '\"'\n # allow for continuation characters within strings\n start_group :string, scan(/\"([^\"]*(&[ ]*[\\n\\r]+)?)*\"/)\n when \"'\"\n # allow for continuation characters within strings\n start_group :string, scan(/'([^']*(&[ ]*[\\n\\r]+)?)*'/)\n when /[-!?*\\/+=<>()\\[\\]\\{}:;,&|%]/\n start_group :punct, scan(/./)\n else\n # pass everything else through\n append getch\n end\n end\n end",
"def initialize(min_value_range, max_value_range, min_output, max_output, round)\n @min_value_range = min_value_range\n @max_value_range = max_value_range\n @min_output = min_output\n @max_output = max_output\n @round = round\n end",
"def run_tests()\n check_solution(1, [1, 4, 10, 13, 15], true)\n check_solution(2, [1, 4, 10, 10, 13, 15], true)\n check_solution(3, [1, 2, 5, 3, 4 ], false)\nend",
"def run_tests()\n check_solution(1, [1, 4, 10, 13, 15], true)\n check_solution(2, [1, 4, 10, 10, 13, 15], true)\n check_solution(3, [1, 2, 5, 3, 4 ], false)\nend",
"def run_til_none_left_to_run(test_number, start_set)\n r = run_recursive_loop { divide_and_find_prime_results(test_number,start_set) }\n puts \"#{@count.to_s} Wave TEST_NUMBER: #{test_number.to_s}\\nRESULTS SET: #{r['set'].inspect}\\nPrime Factors: #{r['prime_factors'].inspect}\"\nend",
"def run( current, positions, iterations, num_values )\n iterations.times do \n slice_start = current.next\n current.next = current.next.next.next.next\n destination = nil\n backoff = 1\n \n while ! destination \n search_for_label = current.value - backoff\n if search_for_label < 1\n search_for_label += num_values\n end \n destination = positions[search_for_label]\n if destination.value == slice_start.value ||\n destination.value == slice_start.next.value ||\n destination.value == slice_start.next.next.value \n destination = nil\n backoff += 1\n end\n end\n \n after_slice = destination.next\n destination.next = slice_start\n slice_start.next.next.next = after_slice\n current = current.next\n end\nend",
"def _reduce_525(val, _values, result)\n result = @builder.range_inclusive(nil, val[0], val[1])\n \n result\nend",
"def range(input); end",
"def transit_to_stop_iteration(e)\n if not(@inputs.empty?) or not(@generator.stream?)\n write(TupleSpace::CommandTuple.new(\"start-root-rule\", nil))\n end\n end",
"def m85\n a = [0, 1, source(85)]\n a.one? do |x|\n sink x # $ hasValueFlow=85\n end\nend",
"def write_one_problem(data, num_items, num_metrics)\n max_weight = data[\"max_weight\"]\n weights = data[\"weights\"]\n values = data[\"values\"]\n\n items = []\n num_items.times do |index|\n items << {\n \"weight\" => weights[index],\n \"metrics\" => values[index][0...num_metrics]\n }\n end\n\n metric_ids = (0...num_metrics).to_a.map{|index| \"metric#{index}\" }\n\n # Calculate the bit width required\n metric_sums = Array.new(num_metrics, 0)\n weight_sum = 0\n items.each do |item|\n item[\"metrics\"].each_with_index do |metric_value, index|\n metric_sums[index] += metric_value\n end\n weight_sum += item[\"weight\"]\n end\n\n max_integer = (metric_sums + [max_weight, weight_sum]).max\n bit_width = (Math.log(max_integer, 2)).ceil + 1\n\n template_string = <<-eos\nopen util/integer\npred show {}\n\nabstract sig Item {\n weight : one Int,\n<% metric_ids.each do |metric| %>\n <%= metric %> : one Int<%= \",\" unless metric_ids[-1] == metric %>\n<% end %>\n}\n\none sig Knapsack {\n items : set Item,\n max_weight : one Int,\n current_weight : one Int,\n<% metric_ids.each do |metric| %>\n <%= metric %> : one Int<%= \",\" unless metric_ids[-1] == metric %>\n<% end %>\n}\n{\n max_weight = <%= max_weight %>\n\n // Metric of the knapsack is sum of item metrics\n<% metric_ids.each do |metric| %>\n <%= metric %> = (sum i : items | i.<%= metric %>)\n<% end %>\n\n // Weight of knapsack is sum of item weights\n current_weight = (sum i : items | i.weight)\n\n // Weight of knapsack must be less than the max weight\n current_weight <= max_weight\n}\n\n// Define concrete items\n<% items.each_with_index do |item, index| %>\none sig Item<%= index %> extends Item {} {\n weight = <%= item[\"weight\"] %>\n<% metric_ids.each_with_index do |metric, index2| %>\n <%= metric %> = <%= item[\"metrics\"][index2] %>\n<% end %>\n}\n<% end %>\n\ninst KnapsackProblem {\n <%= bit_width %> Int\n}\n\nobjectives o_global {\n<% metric_ids.each_with_index do |id, index| %>\n maximize Knapsack.<%= id %><%= \",\" unless metric_ids[-1] == id %>\n<% end %>\n}\n\nrun show for KnapsackProblem optimize o_global\neos\n\n template = ERB.new( template_string, 0, \"<>\" )\n\n File.open(\"knapsack_#{num_items}_metrics_#{num_metrics}.als\", \"w\") do |f|\n f.puts template.result(binding)\n end\n\n puts \"Created Alloy file for knapsack_#{num_items}_metrics_#{num_metrics}\"\nend",
"def input; end",
"def input; end"
] |
[
"0.5693527",
"0.5612068",
"0.5602636",
"0.5546726",
"0.55125064",
"0.5491885",
"0.5484975",
"0.5476097",
"0.5472598",
"0.54617155",
"0.54609925",
"0.5454319",
"0.5422423",
"0.5390473",
"0.53625304",
"0.5347475",
"0.53046364",
"0.53046364",
"0.53046364",
"0.53046364",
"0.5284917",
"0.52847636",
"0.52847636",
"0.52734685",
"0.52657235",
"0.5256598",
"0.52451915",
"0.52350944",
"0.52293384",
"0.52214456",
"0.521935",
"0.5217321",
"0.52093965",
"0.520477",
"0.5195259",
"0.51932794",
"0.51920223",
"0.5184684",
"0.51704806",
"0.5163119",
"0.51628536",
"0.51627463",
"0.5159758",
"0.5156841",
"0.5152482",
"0.51518375",
"0.5148619",
"0.513698",
"0.5131071",
"0.51208",
"0.51195014",
"0.5117367",
"0.510878",
"0.51050866",
"0.5100842",
"0.5094105",
"0.50756496",
"0.5065588",
"0.50654304",
"0.506194",
"0.5057741",
"0.50575924",
"0.50566226",
"0.50523216",
"0.5042797",
"0.5040958",
"0.50281787",
"0.5026401",
"0.50239414",
"0.50236464",
"0.50215083",
"0.50197136",
"0.5015736",
"0.500288",
"0.50003654",
"0.4995177",
"0.498993",
"0.49775",
"0.49745893",
"0.49745893",
"0.49736804",
"0.49656504",
"0.4963844",
"0.4957914",
"0.49433658",
"0.4940735",
"0.49379098",
"0.4934148",
"0.4931314",
"0.49306852",
"0.49294862",
"0.49294862",
"0.49287692",
"0.4928475",
"0.49172148",
"0.49087018",
"0.49073327",
"0.4907239",
"0.49045795",
"0.4903964",
"0.4903964"
] |
0.0
|
-1
|
Retrieve the client vpn config for current user Returns the client vpn config for the currently loggedin user.
|
def find_current_user_vpn_config(code, opts = {})
data, _status_code, _headers = find_current_user_vpn_config_with_http_info(code, opts)
data
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def selected_config\n config[client_name]\n end",
"def vpn_configuration_id\n return @vpn_configuration_id\n end",
"def client_id\n ENV['VIPPS_CLIENT_ID']\n end",
"def get_current_user_options\n response = get_current_user_meta('options')\n ret = {}\n response['query']['userinfo']['options'].each { |k, v| ret[k] = v }\n end",
"def get_resource_configurations(user_id)\n self.class.available_hosts.map do |host|\n {name: short_name.to_sym, params: {plgrid_host: host}}\n end\n end",
"def user\n return @user ? @user : Dotfu.config_user\n end",
"def current_client_settings\n client.symbolize_keys.reverse_merge(CLIENT.dup)\n end",
"def client_configuration\n return @client_configuration\n end",
"def config\n $VHOST.config\n end",
"def remote_database_config(db)\n remote_config = capture(\"cat #{shared_path}/config/#{fetch(:db_file, 'mongoid.yml')}\")\n database = YAML::load(remote_config)\n return database[\"#{db}\"]['clients']['default']['username'], database[\"#{db}\"]['clients']['default']['password'], database[\"#{db}\"]['clients']['default']['database'], database[\"#{db}\"]['clients']['default']['hosts'][0]\n end",
"def config\n @gnip_config\n end",
"def get_config()\n return @api.do_request(\"GET\", get_base_api_path() + \"/config\")\n end",
"def client\n @config.send(\"#{config_prefix}_client\")\n end",
"def show\n @vpn = current_user.try(:vpn)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vpn }\n end\n end",
"def find_current_user_vpn_config_with_http_info(code, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VPNApi.find_current_user_vpn_config ...'\n end\n # verify the required parameter 'code' is set\n if @api_client.config.client_side_validation && code.nil?\n fail ArgumentError, \"Missing the required parameter 'code' when calling VPNApi.find_current_user_vpn_config\"\n end\n # verify enum value\n allowable_values = [\"ewr1\", \"scj1\", \"arm1\", \"nrt1\"]\n if @api_client.config.client_side_validation && !allowable_values.include?(code)\n fail ArgumentError, \"invalid value for \\\"code\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/user/vpn'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'code'] = code\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] || 'VPNConfig'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['x_auth_token']\n\n new_options = opts.merge(\n :operation => :\"VPNApi.find_current_user_vpn_config\",\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: VPNApi#find_current_user_vpn_config\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_resource_configurations(user_id)\n hosts = self.class.available_hosts\n grant_ids = PlGridFacade.retrieve_grants(GridCredentials.find_by_user_id(user_id))\n\n hosts.flat_map do |host|\n grant_ids.flat_map do |grant_identifier|\n {name: short_name.to_sym, params: {plgrid_host: host, grant_identifier: grant_identifier}}\n end\n end\n end",
"def config_path\n NginxStage.pun_config_path(user: user)\n end",
"def config( untrusted: false )\n\t\toptions = { untrusted: untrusted }\n\t\tconfig = self.server.run_with_json_template( :showconfig, **options )\n\t\treturn Hglib::Config.new( config )\n\tend",
"def current_client\n @current_client ||= Replica.user_model.find(session[:user])\n @current_client\n end",
"def user_credentials\n {\n :VERSION => ENV['PP_VERSION'],\n :USER => ENV['PP_USER'],\n :PWD => ENV['PP_PWD'],\n :SIGNATURE => ENV['PP_SIGNATURE']\n }\n end",
"def global_config\n # This entire VM Pooler config\n @config\n end",
"def user\n return config[:user] unless config[:user].nil?\n\n require \"train/transports/ssh\"\n Train::Transports::SSH.default_options[:user][:default]\n end",
"def get_config(key)\n\t\t@conn.config.get_property(key, '')\n\tend",
"def remote_database_config( db )\n remote_config = capture(\"cat #{shared_path}/config/database.yml\")\n database = YAML::load( remote_config )\n return database[\"#{db}\"]['username'], database[\"#{db}\"]['password'], database[\"#{db}\"]['database'], database[\"#{db}\"]['host']\n end",
"def for_user(user_id)\n request(:get, \"/users/#{user_id}/connections\")\n end",
"def get_serv_config\n\t\taction = \"configuration\"\n\t\tresponse = call_api(action)\n\tend",
"def read_guest_ip\n execute(:get_network_config, VmId: vm_id)\n end",
"def user\n conf['api']['user']\n end",
"def users_id_user_config_get(id_user, opts = {})\n data, _status_code, _headers = users_id_user_config_get_with_http_info(id_user, opts)\n data\n end",
"def vcenter_configuration\n clusters = settings.provider.datacenter.clusters\n clusters = clusters.split(\",\") if clusters.is_a?(String)\n {\n \"host\"=>settings.provider.credentials.host,\n \"user\"=>settings.provider.credentials.user,\n \"password\"=>settings.provider.credentials.password,\n \"datacenters\"=>[{\n \"name\"=>settings.provider.datacenter.name,\n \"vm_folder\"=>settings.provider.datacenter.vm_folder,\n \"template_folder\"=>settings.provider.datacenter.template_folder,\n \"disk_path\"=>settings.provider.datacenter.disk_path,\n \"datastore_pattern\"=>settings.provider.datacenter.datastore_pattern,\n \"persistent_datastore_pattern\"=>settings.provider.datacenter.persistent_datastore_pattern,\n \"allow_mixed_datastores\"=>settings.provider.datacenter.allow_mixed_datastores,\n \"clusters\"=>clusters\n }]\n }\n end",
"def client_public_key\n return ENV[\"MCOLLECTIVE_SSL_PUBLIC\"] if ENV.include?(\"MCOLLECTIVE_SSL_PUBLIC\")\n\n raise(\"No plugin.ssl_client_public configuration option specified\") unless @config.pluginconf.include?(\"ssl_client_public\")\n\n return @config.pluginconf[\"ssl_client_public\"]\n end",
"def turn_on_current_user_vpn(opts = {})\n turn_on_current_user_vpn_with_http_info(opts)\n nil\n end",
"def current_vk_user\n @current_vk_user ||= fetch_current_vk_user\n end",
"def get_client\n config.client.new(self)\n end",
"def get_current_service_config\n return RaisEcs::ServiceConfig.new({\n service_instance_id: self.get_service_arn,\n cluster: @cluster,\n service: self,\n desired_count: self.get_desired_count,\n container_config: self.get_primary_container_config\n })\n end",
"def client_private_key\n return ENV[\"MCOLLECTIVE_SSL_PRIVATE\"] if ENV.include?(\"MCOLLECTIVE_SSL_PRIVATE\")\n\n raise(\"No plugin.ssl_client_private configuration option specified\") unless @config.pluginconf.include?(\"ssl_client_private\")\n\n return @config.pluginconf[\"ssl_client_private\"]\n end",
"def database_config(db)\n database = YAML::load_file(\"config/#{fetch(:db_file, 'mongoid.yml')}\")\n return database[\"#{db}\"]['clients']['default']['username'], database[\"#{db}\"]['clients']['default']['password'], database[\"#{db}\"]['clients']['default']['database'], database[\"#{db}\"]['clients']['default']['hosts'][0]\n end",
"def current_user\n get_from_options_or_controller(:current_user)\n end",
"def client_config\n cc = Settings.dig(:connection, connection_type)\n return cc unless host\n\n uhost = URI(host)\n cc.host = uhost.hostname\n cc.port = uhost.port\n cc.scheme = uhost.scheme\n cc\n end",
"def fetch_network_configurations_for_vapp(vapp_id)\n require 'fog/vcloud_director'\n begin\n # fog-vcloud-director now uses a more user-friendly parser that yields vApp instance. However, vapp networking\n # is not parsed there yet so we need to fallback to basic ToHashDocument parser that only converts XML to hash.\n # TODO(miha-plesko): update default parser to do the XML parsing for us.\n data = connection.get_vapp(vapp_id, :parser => Fog::ToHashDocument).body\n rescue Fog::VcloudDirector::Errors::ServiceError => e\n $vcloud_log.error(\"#{log_header} could not fetch network configuration for vapp #{vapp_id}: #{e}\")\n return []\n end\n Array.wrap(data.dig(:NetworkConfigSection, :NetworkConfig))\n end",
"def config\n PrcLib.runtime_fail 'No config object loaded.' unless @config\n @config\n end",
"def user_configuration\n @user_configuration ||=\n begin\n path = File.join(::Rails.root, 'config', 'sunspot.yml')\n if File.exist?(path)\n File.open(path) do |file|\n YAML.load(file)[::Rails.env]\n end\n end\n end\n end",
"def get\n @retain_user_connection_parameters\n end",
"def user_configuration\n @user_configuration ||=\n begin\n path = File.join(::Rails.root, 'config', 'sunspot.yml')\n if File.exist?(path)\n File.open(path) do |file|\n processed = ERB.new(file.read).result\n YAML.load(processed)[::Rails.env]\n end\n else\n {}\n end\n end\n end",
"def get_client_settings\n cp = ClientPlan.get_client_plan_from_memcache(@client_id)\n pepo_campaign = ClientPepoCampaignDetail.get_from_memcache(@client_id)\n web_host = ClientWebHostDetail.get_from_memcache_by_client_id(@client_id)\n token_sale_detail = ClientTokenSaleDetail.get_from_memcache(@client_id)\n kyc_config_detail = @client.client_kyc_config_detail\n super_admins = Admin.where(default_client_id: @client_id, role: GlobalConstant::Admin.super_admin_role).not_deleted.all\n\n super_admins_data = super_admins.map {|x|\n {\n email: x.email,\n password: SecureRandom.hex,\n name: x.name\n }\n }\n\n @client_setting = {\n client_plan: {\n add_ons: cp.add_ons_array,\n kyc_submissions_count: cp.kyc_submissions_count\n },\n super_admins: super_admins_data,\n double_opt_in: @client.is_verify_page_active_for_client?,\n client_name: @client.name,\n pepo_campaign: {\n api_key: pepo_campaign.api_key,\n api_secret: decrypted_value(pepo_campaign.api_secret)\n },\n token_sale_details: {\n token_name: token_sale_detail.token_name,\n token_symbol: token_sale_detail.token_symbol,\n sale_start_timestamp: token_sale_detail.sale_start_timestamp,\n registration_end_timestamp: token_sale_detail.registration_end_timestamp,\n sale_end_timestamp: token_sale_detail.sale_end_timestamp,\n },\n kyc_config: {\n kyc_fields: kyc_config_detail.kyc_fields_array,\n residency_proof_nationalities: kyc_config_detail.residency_proof_nationalities,\n blacklisted_countries: kyc_config_detail.blacklisted_countries,\n auto_send_kyc_emails: kyc_config_detail.auto_send_kyc_emails_array\n }\n }\n\n if web_host.present?\n @client_setting[:web_host] = {\n domain: web_host.domain\n }\n\n r = SandboxManagement::CmsConfigurator::GetPublishedDraft.new(\n {decoded_token_data: {uuid: @uuid}}).perform\n return r unless r.success?\n\n @client_setting[:entity_type_and_data_hash] = r.data[:entity_type_and_data_hash]\n end\n\n success\n\n end",
"def app_config\n values = {}\n\n GCLOUD_OPTIONS_LIST.each do |option|\n values[option] = ENV[option.to_s.upcase] || self.send(option)\n end\n\n return values\n end",
"def get_actual_config\n @config\n end",
"def user_configuration\n @user_configuration ||= begin\n path = File.join(::Rails.root, 'config', 'piwik.yml')\n if File.exist?(path)\n File.open(path) do |file|\n processed = ERB.new(file.read).result\n YAML.load(processed)[::Rails.env]['piwik']\n end\n else\n {}\n end\n end\n end",
"def email\n connect\n user = self.class.query('CMD_API_SHOW_USER_CONFIG',\n :user => resource[:username]\n )\n return user[\"email\"]\n end",
"def getCfg(snap = nil)\n mor = snap ? getSnapMor(snap) : @vmMor\n cfgProps = @invObj.getMoProp(mor, \"config\")\n raise MiqException::MiqVimError, \"Failed to retrieve configuration information for VM\" if cfgProps.nil?\n cfgProps = cfgProps[\"config\"]\n\n cfgHash = {\n 'displayname' => cfgProps['name'],\n 'guestos' => cfgProps['guestId'].downcase.chomp(\"guest\"),\n 'uuid.bios' => cfgProps['uuid'],\n 'uuid.location' => cfgProps['locationId'],\n 'memsize' => cfgProps['hardware']['memoryMB'],\n 'cpu_cores_per_socket' => cfgProps['hardware']['numCoresPerSocket'],\n 'numvcpu' => cfgProps['hardware']['numCPU'],\n 'config.version' => cfgProps['version'],\n }\n\n controllerKeyHash = {}\n\n 1.upto(2) do |_i|\n cfgProps['hardware']['device'].each do |dev|\n case dev.xsiType\n when 'VirtualIDEController'\n tag = \"ide#{dev['busNumber']}\"\n dev['tag'] = tag\n controllerKeyHash[dev['key']] = dev\n\n when 'VirtualLsiLogicController', 'VirtualLsiLogicSASController', 'ParaVirtualSCSIController'\n tag = \"scsi#{dev['busNumber']}\"\n dev['tag'] = tag\n controllerKeyHash[dev['key']] = dev\n cfgHash[\"#{tag}.present\"] = \"true\"\n cfgHash[\"#{tag}.virtualdev\"] = \"lsilogic\"\n\n when 'VirtualBusLogicController'\n tag = \"scsi#{dev['busNumber']}\"\n dev['tag'] = tag\n controllerKeyHash[dev['key']] = dev\n cfgHash[\"#{tag}.present\"] = \"true\"\n cfgHash[\"#{tag}.virtualdev\"] = \"buslogic\"\n\n when 'VirtualDisk'\n controller_tag = controllerKeyHash.fetch_path(dev['controllerKey'], 'tag')\n next if controller_tag.nil?\n tag = \"#{controller_tag}:#{dev['unitNumber']}\"\n cfgHash[\"#{tag}.present\"] = \"true\"\n cfgHash[\"#{tag}.devicetype\"] = \"disk\"\n cfgHash[\"#{tag}.filename\"] = dev['backing']['fileName']\n cfgHash[\"#{tag}.mode\"] = dev['backing']['diskMode']\n when \"VirtualCdrom\"\n controller_tag = controllerKeyHash.fetch_path(dev['controllerKey'], 'tag')\n next if controller_tag.nil?\n tag = \"#{controller_tag}:#{dev['unitNumber']}\"\n cfgHash[\"#{tag}.present\"] = \"true\"\n if dev['backing']['fileName'].nil?\n cfgHash[\"#{tag}.devicetype\"] = \"cdrom-raw\"\n cfgHash[\"#{tag}.filename\"] = dev['backing']['deviceName']\n else\n cfgHash[\"#{tag}.devicetype\"] = \"cdrom-image\"\n cfgHash[\"#{tag}.filename\"] = dev['backing']['fileName']\n end\n cfgHash[\"#{tag}.startconnected\"] = dev['connectable']['startConnected']\n when \"VirtualFloppy\"\n tag = \"floppy#{dev['unitNumber']}\"\n cfgHash[\"#{tag}.present\"] = \"true\"\n if dev['backing']['fileName'].nil?\n cfgHash[\"#{tag}.filename\"] = dev['backing']['deviceName']\n else\n cfgHash[\"#{tag}.filename\"] = dev['backing']['fileName']\n end\n cfgHash[\"#{tag}.startconnected\"] = dev['connectable']['startConnected']\n when \"VirtualPCNet32\", \"VirtualE1000\"\n tag = \"ethernet#{dev['unitNumber'].to_i - 1}\"\n cfgHash[\"#{tag}.present\"] = \"true\"\n cfgHash[\"#{tag}.networkname\"] = dev['backing']['deviceName']\n cfgHash[\"#{tag}.generatedaddress\"] = dev['macAddress']\n cfgHash[\"#{tag}.startconnected\"] = dev['connectable']['startConnected']\n cfgHash[\"#{tag}.type\"] = dev['deviceInfo']['label']\n end\n end\n end\n\n cfgHash\n end",
"def get_rs_config\n result = admin_client.database.command(replSetGetConfig: 1)\n doc = result.reply.documents.first\n if doc['ok'] != 1\n raise 'Failed to get RS config'\n end\n doc['config']\n end",
"def database_config( db )\n database = local_database_config_hash\n return database[\"#{db}\"]['username'], database[\"#{db}\"]['password'], database[\"#{db}\"]['database'], database[\"#{db}\"]['host']\n end",
"def getclient\n return @client\n end",
"def current_remote_client\n return nil unless session[:client_id]\n @remote_client ||= RemoteClient.find_by_client_id(session[:client_id])\n @remote_client\n end",
"def current_user\n @current_user ||= User.find_by(client_token: params[:client_token])\n end",
"def current_user\n abort \"You have no current user set!\".yellow unless current_user_exists?\n config.current_user\n end",
"def options_for_klient(options = {})\n user_tenant_options = Kaui.current_tenant_user_options(current_user, session)\n user_tenant_options.merge(options)\n user_tenant_options\n end",
"def get_config\n global_config = {\n 'pubnub_subscribe_key'=> Settings.pubnub.subscribe_key\n }\n\n static_config = {\n 'name'=> self.name\n }\n\n #Manually inject the analytics from the account into the unit\n if self.admo_account and not self.admo_account.analytics.empty?\n #We hide the secret away from the clients for now.\n static_config['analytics'] = self.admo_account.analytics\n static_config['analytics'].delete(:mixpanel_api_secret)\n end\n\n account_config = self.admo_account.try(:config) || {}\n global_config.merge(account_config).merge(self.config).merge(static_config)\n end",
"def peer_vdc\n config_get('itd_service', 'peer_vdc', @get_args)\n end",
"def client_configuration=(value)\n @client_configuration = value\n end",
"def new\n\tif signed_in?\n\t\t@current_client = current_user.username\n\t\tif current_user.username == 'admin'\n\t\t\t@clientconfig = Clientconfig.new\n\t\t\t@clients = Client.all.collect {|c| [c.name, c.id]}\n\t\telse\n\t\t\tredirect_to home_path\n\t\tend\n\telse\n\t\tredirect_to signin_path\n\tend\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clientconfig }\n end\n end",
"def client_class_config\n return @client_class_config if @client_class_config\n\n @client_class_config = Netzke::Core::ClientClassConfig.new(self, called_from)\n\n (@configure_blocks || []).each do |block, dir|\n @client_class_config.dir = dir\n block&.call(@client_class_config)\n end\n\n @client_class_config\n end",
"def remote_database_config(db)\n env = rails_env || db\n config = capture \"cat #{latest_release}/config/database.yml\"\n database = YAML::load(config)\n return database[\"#{env}\"]['username'], database[\"#{env}\"]['password'], database[\"#{env}\"]['database'], database[\"#{env}\"]['host']\n end",
"def get_client_id\n @client_id\n end",
"def get_config(project)\n branch = get_release(project)\n YAML.load(get_github_file(project, branch, 'config/config.yml'))\n end",
"def global_config\n @@global_config\n end",
"def client\n @client ||= begin\n config(file: true) if !user_id\n User.new(user_id, password, security_code)\n end\n end",
"def config\n @config ||= read_config\n end",
"def get_settings\n return @client.raw(\"get\", \"/config/settings\")\n end",
"def get_user_conf(name, profile = 'default')\n return @config.find(name, profile) if @config\n @config = make_user_conf\n msg = 'Run the command `configure`'\n raise Idcf::Cli::CliError, msg unless @config\n\n @config.find(name, profile)\n end",
"def get_config\n\t\tend",
"def getvespaconfig(config_name, config_id, vespa_version=nil, hostname=nil, port=nil, debug=nil)\n cmd = \"vespa-get-config -j -n #{config_name} -i #{config_id}\"\n cmd += \" -s #{get_configserver_hostname}\" if hostname\n cmd += \" -p #{port}\" if port\n cmd += \" -V #{vespa_version}\" if vespa_version\n cmd += \" -d\" if debug\n (exitcode, output) = vespa.adminserver.execute(cmd, :noecho => true, :exitcode => true, :nostderr => true)\n if exitcode.to_i == 0\n output = print_and_remove_debug_output_from_getvespaconfig(output) if debug\n JSON.parse(output)\n else\n raise \"Could not get config: #{output}\"\n end\n end",
"def user\n conf['dashboard']['user']\n end",
"def config\n @options[:config]\n end",
"def get_server_base_config\n backend_conf = @opts['backend_conf'] || {}\n return backend_conf\n end",
"def user\n return ENV['USER']\n end",
"def users_id_user_config_get_with_http_info(id_user, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersManagementApi.users_id_user_config_get ...'\n end\n # verify the required parameter 'id_user' is set\n if @api_client.config.client_side_validation && id_user.nil?\n fail ArgumentError, \"Missing the required parameter 'id_user' when calling UsersManagementApi.users_id_user_config_get\"\n end\n # resource path\n local_var_path = '/users/{id_user}/config'.sub('{' + 'id_user' + '}', id_user.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/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']\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 => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersManagementApi#users_id_user_config_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def user_config_dir\n File.expand_path('~/.vgh')\n end",
"def remote_user\n frontend.remote_user\n end",
"def uv_config\n v = visibility_lookup(resource_id_param)\n config = if v == \"open\"\n uv_config_liberal\n elsif v == \"authenticated\" && user_signed_in?\n uv_config_liberal\n elsif v == \"emory_low\" && user_signed_in?\n uv_config_liberal_low\n else\n default_config\n end\n\n respond_to do |format|\n format.json { render json: config }\n end\n end",
"def owncloud_config\n @owncloud_config ||= OwncloudCookbook::Config.new(owncloud_config_file)\n end",
"def activeConfig\n return @active_config\n end",
"def config\n App.instance.load_project_config\n App.instance.config\n end",
"def current_client\n #@current_client ||= session[:client_id] unless @current_client == false\n @current_client ||= Client.find_by_id session[:client_id]\n end",
"def get_client\n @client\n end",
"def uservoice_configuration\n @@uservoice_configuration ||= begin\n config = ERB.new(IO.read(uservoice_configuration_file)).result\n configuration = YAML::load(config)\n HashWithIndifferentAccess.new(configuration)\n end\n end",
"def app_config_key_value\n return @app_config_key_value\n end",
"def get_recommended_value\n if os_value.empty?\n if ip = @config_items.fetch( 'cli::network::ipaddress', nil )\n [ip.value]\n else\n ['8.8.8.8 (CHANGE THIS)']\n end\n else\n os_value\n end\n end",
"def getclconfig\n #@creds = @current_user.clouds.all.sort_by(&:provider)\n @stack = Appman.find_by_uuid(params[:uuid])\n @creds = @stack.clouds.all.sort_by(&:provider)\n #@creds = Cloud.all.sort_by(&:provider)\n @azure = false\n @google = false\n @kubernetes = false\n @openstack = false\n @dockerregistry = false\n @aws = false\n @creds.each do |c|\n case c.provider\n when \"azure\"\n @azure = true\n when \"google\"\n @google = true\n when \"kubernetes\"\n @kubernetes = true\n when \"openstack\"\n @openstack = true\n when \"dockerregistry\"\n @dockerregistry = true\n when \"aws\"\n @aws = true\n end\n end\n @appmenid = params[:uuid]\n render \"clouds/getclconfig\", layout: false\n end",
"def current_user\n appctrl_set_user()\n return @current_user\n end",
"def find_user_setting\n\t\t# find the user setting\n\t\t@user = devise_current_user.profile_setting\n\tend",
"def user_setting_page\n\t\t@notification_settings = current_user.notification_setting\n\n\tend",
"def client_webhook_settings\n @client_webhook_settings ||= ClientWebhookSetting.get_active_from_memcache(@client_id)\n end",
"def fetch_remote_config\n response_body = Afterpay.client.get(\"/v2/configuration\").body\n @minimum_amount = response_body.dig(:minimumAmount, :amount).to_f\n @maximum_amount = response_body.dig(:maximumAmount, :amount).to_f\n end",
"def get_current_client\n get_current_hub&.current_client\n end",
"def connection_for_user\n BeaconClient.logger.debug([user.email.inspect, user.password.inspect].join(' : '))\n oauth_client.password.get_token(\n user.email, user.password,\n email: user.email\n )\n end",
"def current_user\n @req.env['REMOTE_USER']\n end",
"def show\n @clientconfig = Clientconfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientconfig }\n end\n end",
"def user_id\n config.present? ? config[:user_id] : ''\n end",
"def project_config_file\n config_file = {}\n\n if ::File.exists?(@config_file)\n config_file = @global.load_ruby_config(@config_file)\n else\n @task.say_error \"Could not find the config file!\", \"Are you sure you're in a marv project directory?\", false\n abort\n end\n\n return config_file\n end"
] |
[
"0.6358495",
"0.573225",
"0.5680149",
"0.5658015",
"0.5591358",
"0.5542105",
"0.5481544",
"0.54781246",
"0.5419859",
"0.53983325",
"0.5335912",
"0.53180736",
"0.53159946",
"0.528733",
"0.52699834",
"0.52698797",
"0.5264542",
"0.5219623",
"0.520557",
"0.5197233",
"0.5182343",
"0.51486474",
"0.5141425",
"0.51223433",
"0.5107884",
"0.5103859",
"0.5101248",
"0.50885916",
"0.5087563",
"0.50762385",
"0.50675195",
"0.50601715",
"0.50516874",
"0.50491935",
"0.5047875",
"0.5037908",
"0.5033623",
"0.5020158",
"0.50171936",
"0.5017106",
"0.5009656",
"0.49510056",
"0.49458122",
"0.4937389",
"0.49120697",
"0.49058732",
"0.48998168",
"0.48702765",
"0.48672834",
"0.48670748",
"0.48637348",
"0.4861762",
"0.48488724",
"0.48468",
"0.48404935",
"0.48371038",
"0.48307607",
"0.48305976",
"0.48261482",
"0.48177198",
"0.48083982",
"0.48054665",
"0.47983372",
"0.4797461",
"0.47953057",
"0.47886753",
"0.47835335",
"0.47806904",
"0.47765544",
"0.47669882",
"0.47580472",
"0.47491917",
"0.47447166",
"0.47433868",
"0.47417805",
"0.47405332",
"0.4739794",
"0.47372308",
"0.47345078",
"0.47330943",
"0.47296965",
"0.47286546",
"0.47285578",
"0.47245094",
"0.4721754",
"0.4716647",
"0.47103938",
"0.47042924",
"0.4701159",
"0.46972585",
"0.46962646",
"0.46899235",
"0.46895784",
"0.46887645",
"0.4688587",
"0.46865535",
"0.46846324",
"0.4681596",
"0.46767822",
"0.46733114"
] |
0.65783453
|
0
|
Retrieve the client vpn config for current user Returns the client vpn config for the currently loggedin user.
|
def find_current_user_vpn_config_with_http_info(code, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: VPNApi.find_current_user_vpn_config ...'
end
# verify the required parameter 'code' is set
if @api_client.config.client_side_validation && code.nil?
fail ArgumentError, "Missing the required parameter 'code' when calling VPNApi.find_current_user_vpn_config"
end
# verify enum value
allowable_values = ["ewr1", "scj1", "arm1", "nrt1"]
if @api_client.config.client_side_validation && !allowable_values.include?(code)
fail ArgumentError, "invalid value for \"code\", must be one of #{allowable_values}"
end
# resource path
local_var_path = '/user/vpn'
# query parameters
query_params = opts[:query_params] || {}
query_params[:'code'] = code
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'VPNConfig'
# auth_names
auth_names = opts[:debug_auth_names] || ['x_auth_token']
new_options = opts.merge(
:operation => :"VPNApi.find_current_user_vpn_config",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: VPNApi#find_current_user_vpn_config\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_current_user_vpn_config(code, opts = {})\n data, _status_code, _headers = find_current_user_vpn_config_with_http_info(code, opts)\n data\n end",
"def selected_config\n config[client_name]\n end",
"def vpn_configuration_id\n return @vpn_configuration_id\n end",
"def client_id\n ENV['VIPPS_CLIENT_ID']\n end",
"def get_current_user_options\n response = get_current_user_meta('options')\n ret = {}\n response['query']['userinfo']['options'].each { |k, v| ret[k] = v }\n end",
"def get_resource_configurations(user_id)\n self.class.available_hosts.map do |host|\n {name: short_name.to_sym, params: {plgrid_host: host}}\n end\n end",
"def user\n return @user ? @user : Dotfu.config_user\n end",
"def current_client_settings\n client.symbolize_keys.reverse_merge(CLIENT.dup)\n end",
"def client_configuration\n return @client_configuration\n end",
"def config\n $VHOST.config\n end",
"def remote_database_config(db)\n remote_config = capture(\"cat #{shared_path}/config/#{fetch(:db_file, 'mongoid.yml')}\")\n database = YAML::load(remote_config)\n return database[\"#{db}\"]['clients']['default']['username'], database[\"#{db}\"]['clients']['default']['password'], database[\"#{db}\"]['clients']['default']['database'], database[\"#{db}\"]['clients']['default']['hosts'][0]\n end",
"def config\n @gnip_config\n end",
"def get_config()\n return @api.do_request(\"GET\", get_base_api_path() + \"/config\")\n end",
"def client\n @config.send(\"#{config_prefix}_client\")\n end",
"def show\n @vpn = current_user.try(:vpn)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vpn }\n end\n end",
"def get_resource_configurations(user_id)\n hosts = self.class.available_hosts\n grant_ids = PlGridFacade.retrieve_grants(GridCredentials.find_by_user_id(user_id))\n\n hosts.flat_map do |host|\n grant_ids.flat_map do |grant_identifier|\n {name: short_name.to_sym, params: {plgrid_host: host, grant_identifier: grant_identifier}}\n end\n end\n end",
"def config_path\n NginxStage.pun_config_path(user: user)\n end",
"def config( untrusted: false )\n\t\toptions = { untrusted: untrusted }\n\t\tconfig = self.server.run_with_json_template( :showconfig, **options )\n\t\treturn Hglib::Config.new( config )\n\tend",
"def current_client\n @current_client ||= Replica.user_model.find(session[:user])\n @current_client\n end",
"def user_credentials\n {\n :VERSION => ENV['PP_VERSION'],\n :USER => ENV['PP_USER'],\n :PWD => ENV['PP_PWD'],\n :SIGNATURE => ENV['PP_SIGNATURE']\n }\n end",
"def global_config\n # This entire VM Pooler config\n @config\n end",
"def user\n return config[:user] unless config[:user].nil?\n\n require \"train/transports/ssh\"\n Train::Transports::SSH.default_options[:user][:default]\n end",
"def get_config(key)\n\t\t@conn.config.get_property(key, '')\n\tend",
"def remote_database_config( db )\n remote_config = capture(\"cat #{shared_path}/config/database.yml\")\n database = YAML::load( remote_config )\n return database[\"#{db}\"]['username'], database[\"#{db}\"]['password'], database[\"#{db}\"]['database'], database[\"#{db}\"]['host']\n end",
"def for_user(user_id)\n request(:get, \"/users/#{user_id}/connections\")\n end",
"def get_serv_config\n\t\taction = \"configuration\"\n\t\tresponse = call_api(action)\n\tend",
"def read_guest_ip\n execute(:get_network_config, VmId: vm_id)\n end",
"def user\n conf['api']['user']\n end",
"def users_id_user_config_get(id_user, opts = {})\n data, _status_code, _headers = users_id_user_config_get_with_http_info(id_user, opts)\n data\n end",
"def vcenter_configuration\n clusters = settings.provider.datacenter.clusters\n clusters = clusters.split(\",\") if clusters.is_a?(String)\n {\n \"host\"=>settings.provider.credentials.host,\n \"user\"=>settings.provider.credentials.user,\n \"password\"=>settings.provider.credentials.password,\n \"datacenters\"=>[{\n \"name\"=>settings.provider.datacenter.name,\n \"vm_folder\"=>settings.provider.datacenter.vm_folder,\n \"template_folder\"=>settings.provider.datacenter.template_folder,\n \"disk_path\"=>settings.provider.datacenter.disk_path,\n \"datastore_pattern\"=>settings.provider.datacenter.datastore_pattern,\n \"persistent_datastore_pattern\"=>settings.provider.datacenter.persistent_datastore_pattern,\n \"allow_mixed_datastores\"=>settings.provider.datacenter.allow_mixed_datastores,\n \"clusters\"=>clusters\n }]\n }\n end",
"def client_public_key\n return ENV[\"MCOLLECTIVE_SSL_PUBLIC\"] if ENV.include?(\"MCOLLECTIVE_SSL_PUBLIC\")\n\n raise(\"No plugin.ssl_client_public configuration option specified\") unless @config.pluginconf.include?(\"ssl_client_public\")\n\n return @config.pluginconf[\"ssl_client_public\"]\n end",
"def turn_on_current_user_vpn(opts = {})\n turn_on_current_user_vpn_with_http_info(opts)\n nil\n end",
"def current_vk_user\n @current_vk_user ||= fetch_current_vk_user\n end",
"def get_client\n config.client.new(self)\n end",
"def get_current_service_config\n return RaisEcs::ServiceConfig.new({\n service_instance_id: self.get_service_arn,\n cluster: @cluster,\n service: self,\n desired_count: self.get_desired_count,\n container_config: self.get_primary_container_config\n })\n end",
"def client_private_key\n return ENV[\"MCOLLECTIVE_SSL_PRIVATE\"] if ENV.include?(\"MCOLLECTIVE_SSL_PRIVATE\")\n\n raise(\"No plugin.ssl_client_private configuration option specified\") unless @config.pluginconf.include?(\"ssl_client_private\")\n\n return @config.pluginconf[\"ssl_client_private\"]\n end",
"def database_config(db)\n database = YAML::load_file(\"config/#{fetch(:db_file, 'mongoid.yml')}\")\n return database[\"#{db}\"]['clients']['default']['username'], database[\"#{db}\"]['clients']['default']['password'], database[\"#{db}\"]['clients']['default']['database'], database[\"#{db}\"]['clients']['default']['hosts'][0]\n end",
"def current_user\n get_from_options_or_controller(:current_user)\n end",
"def client_config\n cc = Settings.dig(:connection, connection_type)\n return cc unless host\n\n uhost = URI(host)\n cc.host = uhost.hostname\n cc.port = uhost.port\n cc.scheme = uhost.scheme\n cc\n end",
"def fetch_network_configurations_for_vapp(vapp_id)\n require 'fog/vcloud_director'\n begin\n # fog-vcloud-director now uses a more user-friendly parser that yields vApp instance. However, vapp networking\n # is not parsed there yet so we need to fallback to basic ToHashDocument parser that only converts XML to hash.\n # TODO(miha-plesko): update default parser to do the XML parsing for us.\n data = connection.get_vapp(vapp_id, :parser => Fog::ToHashDocument).body\n rescue Fog::VcloudDirector::Errors::ServiceError => e\n $vcloud_log.error(\"#{log_header} could not fetch network configuration for vapp #{vapp_id}: #{e}\")\n return []\n end\n Array.wrap(data.dig(:NetworkConfigSection, :NetworkConfig))\n end",
"def config\n PrcLib.runtime_fail 'No config object loaded.' unless @config\n @config\n end",
"def user_configuration\n @user_configuration ||=\n begin\n path = File.join(::Rails.root, 'config', 'sunspot.yml')\n if File.exist?(path)\n File.open(path) do |file|\n YAML.load(file)[::Rails.env]\n end\n end\n end\n end",
"def get\n @retain_user_connection_parameters\n end",
"def user_configuration\n @user_configuration ||=\n begin\n path = File.join(::Rails.root, 'config', 'sunspot.yml')\n if File.exist?(path)\n File.open(path) do |file|\n processed = ERB.new(file.read).result\n YAML.load(processed)[::Rails.env]\n end\n else\n {}\n end\n end\n end",
"def get_client_settings\n cp = ClientPlan.get_client_plan_from_memcache(@client_id)\n pepo_campaign = ClientPepoCampaignDetail.get_from_memcache(@client_id)\n web_host = ClientWebHostDetail.get_from_memcache_by_client_id(@client_id)\n token_sale_detail = ClientTokenSaleDetail.get_from_memcache(@client_id)\n kyc_config_detail = @client.client_kyc_config_detail\n super_admins = Admin.where(default_client_id: @client_id, role: GlobalConstant::Admin.super_admin_role).not_deleted.all\n\n super_admins_data = super_admins.map {|x|\n {\n email: x.email,\n password: SecureRandom.hex,\n name: x.name\n }\n }\n\n @client_setting = {\n client_plan: {\n add_ons: cp.add_ons_array,\n kyc_submissions_count: cp.kyc_submissions_count\n },\n super_admins: super_admins_data,\n double_opt_in: @client.is_verify_page_active_for_client?,\n client_name: @client.name,\n pepo_campaign: {\n api_key: pepo_campaign.api_key,\n api_secret: decrypted_value(pepo_campaign.api_secret)\n },\n token_sale_details: {\n token_name: token_sale_detail.token_name,\n token_symbol: token_sale_detail.token_symbol,\n sale_start_timestamp: token_sale_detail.sale_start_timestamp,\n registration_end_timestamp: token_sale_detail.registration_end_timestamp,\n sale_end_timestamp: token_sale_detail.sale_end_timestamp,\n },\n kyc_config: {\n kyc_fields: kyc_config_detail.kyc_fields_array,\n residency_proof_nationalities: kyc_config_detail.residency_proof_nationalities,\n blacklisted_countries: kyc_config_detail.blacklisted_countries,\n auto_send_kyc_emails: kyc_config_detail.auto_send_kyc_emails_array\n }\n }\n\n if web_host.present?\n @client_setting[:web_host] = {\n domain: web_host.domain\n }\n\n r = SandboxManagement::CmsConfigurator::GetPublishedDraft.new(\n {decoded_token_data: {uuid: @uuid}}).perform\n return r unless r.success?\n\n @client_setting[:entity_type_and_data_hash] = r.data[:entity_type_and_data_hash]\n end\n\n success\n\n end",
"def app_config\n values = {}\n\n GCLOUD_OPTIONS_LIST.each do |option|\n values[option] = ENV[option.to_s.upcase] || self.send(option)\n end\n\n return values\n end",
"def get_actual_config\n @config\n end",
"def user_configuration\n @user_configuration ||= begin\n path = File.join(::Rails.root, 'config', 'piwik.yml')\n if File.exist?(path)\n File.open(path) do |file|\n processed = ERB.new(file.read).result\n YAML.load(processed)[::Rails.env]['piwik']\n end\n else\n {}\n end\n end\n end",
"def email\n connect\n user = self.class.query('CMD_API_SHOW_USER_CONFIG',\n :user => resource[:username]\n )\n return user[\"email\"]\n end",
"def getCfg(snap = nil)\n mor = snap ? getSnapMor(snap) : @vmMor\n cfgProps = @invObj.getMoProp(mor, \"config\")\n raise MiqException::MiqVimError, \"Failed to retrieve configuration information for VM\" if cfgProps.nil?\n cfgProps = cfgProps[\"config\"]\n\n cfgHash = {\n 'displayname' => cfgProps['name'],\n 'guestos' => cfgProps['guestId'].downcase.chomp(\"guest\"),\n 'uuid.bios' => cfgProps['uuid'],\n 'uuid.location' => cfgProps['locationId'],\n 'memsize' => cfgProps['hardware']['memoryMB'],\n 'cpu_cores_per_socket' => cfgProps['hardware']['numCoresPerSocket'],\n 'numvcpu' => cfgProps['hardware']['numCPU'],\n 'config.version' => cfgProps['version'],\n }\n\n controllerKeyHash = {}\n\n 1.upto(2) do |_i|\n cfgProps['hardware']['device'].each do |dev|\n case dev.xsiType\n when 'VirtualIDEController'\n tag = \"ide#{dev['busNumber']}\"\n dev['tag'] = tag\n controllerKeyHash[dev['key']] = dev\n\n when 'VirtualLsiLogicController', 'VirtualLsiLogicSASController', 'ParaVirtualSCSIController'\n tag = \"scsi#{dev['busNumber']}\"\n dev['tag'] = tag\n controllerKeyHash[dev['key']] = dev\n cfgHash[\"#{tag}.present\"] = \"true\"\n cfgHash[\"#{tag}.virtualdev\"] = \"lsilogic\"\n\n when 'VirtualBusLogicController'\n tag = \"scsi#{dev['busNumber']}\"\n dev['tag'] = tag\n controllerKeyHash[dev['key']] = dev\n cfgHash[\"#{tag}.present\"] = \"true\"\n cfgHash[\"#{tag}.virtualdev\"] = \"buslogic\"\n\n when 'VirtualDisk'\n controller_tag = controllerKeyHash.fetch_path(dev['controllerKey'], 'tag')\n next if controller_tag.nil?\n tag = \"#{controller_tag}:#{dev['unitNumber']}\"\n cfgHash[\"#{tag}.present\"] = \"true\"\n cfgHash[\"#{tag}.devicetype\"] = \"disk\"\n cfgHash[\"#{tag}.filename\"] = dev['backing']['fileName']\n cfgHash[\"#{tag}.mode\"] = dev['backing']['diskMode']\n when \"VirtualCdrom\"\n controller_tag = controllerKeyHash.fetch_path(dev['controllerKey'], 'tag')\n next if controller_tag.nil?\n tag = \"#{controller_tag}:#{dev['unitNumber']}\"\n cfgHash[\"#{tag}.present\"] = \"true\"\n if dev['backing']['fileName'].nil?\n cfgHash[\"#{tag}.devicetype\"] = \"cdrom-raw\"\n cfgHash[\"#{tag}.filename\"] = dev['backing']['deviceName']\n else\n cfgHash[\"#{tag}.devicetype\"] = \"cdrom-image\"\n cfgHash[\"#{tag}.filename\"] = dev['backing']['fileName']\n end\n cfgHash[\"#{tag}.startconnected\"] = dev['connectable']['startConnected']\n when \"VirtualFloppy\"\n tag = \"floppy#{dev['unitNumber']}\"\n cfgHash[\"#{tag}.present\"] = \"true\"\n if dev['backing']['fileName'].nil?\n cfgHash[\"#{tag}.filename\"] = dev['backing']['deviceName']\n else\n cfgHash[\"#{tag}.filename\"] = dev['backing']['fileName']\n end\n cfgHash[\"#{tag}.startconnected\"] = dev['connectable']['startConnected']\n when \"VirtualPCNet32\", \"VirtualE1000\"\n tag = \"ethernet#{dev['unitNumber'].to_i - 1}\"\n cfgHash[\"#{tag}.present\"] = \"true\"\n cfgHash[\"#{tag}.networkname\"] = dev['backing']['deviceName']\n cfgHash[\"#{tag}.generatedaddress\"] = dev['macAddress']\n cfgHash[\"#{tag}.startconnected\"] = dev['connectable']['startConnected']\n cfgHash[\"#{tag}.type\"] = dev['deviceInfo']['label']\n end\n end\n end\n\n cfgHash\n end",
"def get_rs_config\n result = admin_client.database.command(replSetGetConfig: 1)\n doc = result.reply.documents.first\n if doc['ok'] != 1\n raise 'Failed to get RS config'\n end\n doc['config']\n end",
"def database_config( db )\n database = local_database_config_hash\n return database[\"#{db}\"]['username'], database[\"#{db}\"]['password'], database[\"#{db}\"]['database'], database[\"#{db}\"]['host']\n end",
"def getclient\n return @client\n end",
"def current_remote_client\n return nil unless session[:client_id]\n @remote_client ||= RemoteClient.find_by_client_id(session[:client_id])\n @remote_client\n end",
"def current_user\n @current_user ||= User.find_by(client_token: params[:client_token])\n end",
"def current_user\n abort \"You have no current user set!\".yellow unless current_user_exists?\n config.current_user\n end",
"def get_config\n global_config = {\n 'pubnub_subscribe_key'=> Settings.pubnub.subscribe_key\n }\n\n static_config = {\n 'name'=> self.name\n }\n\n #Manually inject the analytics from the account into the unit\n if self.admo_account and not self.admo_account.analytics.empty?\n #We hide the secret away from the clients for now.\n static_config['analytics'] = self.admo_account.analytics\n static_config['analytics'].delete(:mixpanel_api_secret)\n end\n\n account_config = self.admo_account.try(:config) || {}\n global_config.merge(account_config).merge(self.config).merge(static_config)\n end",
"def options_for_klient(options = {})\n user_tenant_options = Kaui.current_tenant_user_options(current_user, session)\n user_tenant_options.merge(options)\n user_tenant_options\n end",
"def peer_vdc\n config_get('itd_service', 'peer_vdc', @get_args)\n end",
"def client_configuration=(value)\n @client_configuration = value\n end",
"def new\n\tif signed_in?\n\t\t@current_client = current_user.username\n\t\tif current_user.username == 'admin'\n\t\t\t@clientconfig = Clientconfig.new\n\t\t\t@clients = Client.all.collect {|c| [c.name, c.id]}\n\t\telse\n\t\t\tredirect_to home_path\n\t\tend\n\telse\n\t\tredirect_to signin_path\n\tend\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clientconfig }\n end\n end",
"def client_class_config\n return @client_class_config if @client_class_config\n\n @client_class_config = Netzke::Core::ClientClassConfig.new(self, called_from)\n\n (@configure_blocks || []).each do |block, dir|\n @client_class_config.dir = dir\n block&.call(@client_class_config)\n end\n\n @client_class_config\n end",
"def remote_database_config(db)\n env = rails_env || db\n config = capture \"cat #{latest_release}/config/database.yml\"\n database = YAML::load(config)\n return database[\"#{env}\"]['username'], database[\"#{env}\"]['password'], database[\"#{env}\"]['database'], database[\"#{env}\"]['host']\n end",
"def get_client_id\n @client_id\n end",
"def get_config(project)\n branch = get_release(project)\n YAML.load(get_github_file(project, branch, 'config/config.yml'))\n end",
"def global_config\n @@global_config\n end",
"def client\n @client ||= begin\n config(file: true) if !user_id\n User.new(user_id, password, security_code)\n end\n end",
"def config\n @config ||= read_config\n end",
"def get_settings\n return @client.raw(\"get\", \"/config/settings\")\n end",
"def get_user_conf(name, profile = 'default')\n return @config.find(name, profile) if @config\n @config = make_user_conf\n msg = 'Run the command `configure`'\n raise Idcf::Cli::CliError, msg unless @config\n\n @config.find(name, profile)\n end",
"def get_config\n\t\tend",
"def getvespaconfig(config_name, config_id, vespa_version=nil, hostname=nil, port=nil, debug=nil)\n cmd = \"vespa-get-config -j -n #{config_name} -i #{config_id}\"\n cmd += \" -s #{get_configserver_hostname}\" if hostname\n cmd += \" -p #{port}\" if port\n cmd += \" -V #{vespa_version}\" if vespa_version\n cmd += \" -d\" if debug\n (exitcode, output) = vespa.adminserver.execute(cmd, :noecho => true, :exitcode => true, :nostderr => true)\n if exitcode.to_i == 0\n output = print_and_remove_debug_output_from_getvespaconfig(output) if debug\n JSON.parse(output)\n else\n raise \"Could not get config: #{output}\"\n end\n end",
"def user\n conf['dashboard']['user']\n end",
"def config\n @options[:config]\n end",
"def get_server_base_config\n backend_conf = @opts['backend_conf'] || {}\n return backend_conf\n end",
"def user\n return ENV['USER']\n end",
"def users_id_user_config_get_with_http_info(id_user, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersManagementApi.users_id_user_config_get ...'\n end\n # verify the required parameter 'id_user' is set\n if @api_client.config.client_side_validation && id_user.nil?\n fail ArgumentError, \"Missing the required parameter 'id_user' when calling UsersManagementApi.users_id_user_config_get\"\n end\n # resource path\n local_var_path = '/users/{id_user}/config'.sub('{' + 'id_user' + '}', id_user.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/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']\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 => 'Object')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersManagementApi#users_id_user_config_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def user_config_dir\n File.expand_path('~/.vgh')\n end",
"def remote_user\n frontend.remote_user\n end",
"def uv_config\n v = visibility_lookup(resource_id_param)\n config = if v == \"open\"\n uv_config_liberal\n elsif v == \"authenticated\" && user_signed_in?\n uv_config_liberal\n elsif v == \"emory_low\" && user_signed_in?\n uv_config_liberal_low\n else\n default_config\n end\n\n respond_to do |format|\n format.json { render json: config }\n end\n end",
"def activeConfig\n return @active_config\n end",
"def owncloud_config\n @owncloud_config ||= OwncloudCookbook::Config.new(owncloud_config_file)\n end",
"def config\n App.instance.load_project_config\n App.instance.config\n end",
"def current_client\n #@current_client ||= session[:client_id] unless @current_client == false\n @current_client ||= Client.find_by_id session[:client_id]\n end",
"def get_client\n @client\n end",
"def uservoice_configuration\n @@uservoice_configuration ||= begin\n config = ERB.new(IO.read(uservoice_configuration_file)).result\n configuration = YAML::load(config)\n HashWithIndifferentAccess.new(configuration)\n end\n end",
"def app_config_key_value\n return @app_config_key_value\n end",
"def get_recommended_value\n if os_value.empty?\n if ip = @config_items.fetch( 'cli::network::ipaddress', nil )\n [ip.value]\n else\n ['8.8.8.8 (CHANGE THIS)']\n end\n else\n os_value\n end\n end",
"def getclconfig\n #@creds = @current_user.clouds.all.sort_by(&:provider)\n @stack = Appman.find_by_uuid(params[:uuid])\n @creds = @stack.clouds.all.sort_by(&:provider)\n #@creds = Cloud.all.sort_by(&:provider)\n @azure = false\n @google = false\n @kubernetes = false\n @openstack = false\n @dockerregistry = false\n @aws = false\n @creds.each do |c|\n case c.provider\n when \"azure\"\n @azure = true\n when \"google\"\n @google = true\n when \"kubernetes\"\n @kubernetes = true\n when \"openstack\"\n @openstack = true\n when \"dockerregistry\"\n @dockerregistry = true\n when \"aws\"\n @aws = true\n end\n end\n @appmenid = params[:uuid]\n render \"clouds/getclconfig\", layout: false\n end",
"def current_user\n appctrl_set_user()\n return @current_user\n end",
"def find_user_setting\n\t\t# find the user setting\n\t\t@user = devise_current_user.profile_setting\n\tend",
"def user_setting_page\n\t\t@notification_settings = current_user.notification_setting\n\n\tend",
"def client_webhook_settings\n @client_webhook_settings ||= ClientWebhookSetting.get_active_from_memcache(@client_id)\n end",
"def fetch_remote_config\n response_body = Afterpay.client.get(\"/v2/configuration\").body\n @minimum_amount = response_body.dig(:minimumAmount, :amount).to_f\n @maximum_amount = response_body.dig(:maximumAmount, :amount).to_f\n end",
"def get_current_client\n get_current_hub&.current_client\n end",
"def connection_for_user\n BeaconClient.logger.debug([user.email.inspect, user.password.inspect].join(' : '))\n oauth_client.password.get_token(\n user.email, user.password,\n email: user.email\n )\n end",
"def current_user\n @req.env['REMOTE_USER']\n end",
"def show\n @clientconfig = Clientconfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientconfig }\n end\n end",
"def user_id\n config.present? ? config[:user_id] : ''\n end",
"def project_config_file\n config_file = {}\n\n if ::File.exists?(@config_file)\n config_file = @global.load_ruby_config(@config_file)\n else\n @task.say_error \"Could not find the config file!\", \"Are you sure you're in a marv project directory?\", false\n abort\n end\n\n return config_file\n end"
] |
[
"0.6579705",
"0.63586915",
"0.573316",
"0.5678917",
"0.56588316",
"0.5591889",
"0.55420953",
"0.54815334",
"0.54779655",
"0.541976",
"0.53990734",
"0.5336294",
"0.5319451",
"0.53161216",
"0.5288751",
"0.5269949",
"0.5264615",
"0.522074",
"0.52051604",
"0.51969177",
"0.5183194",
"0.5148228",
"0.51423293",
"0.5123024",
"0.51082337",
"0.51041734",
"0.51019174",
"0.50887424",
"0.5087422",
"0.50748855",
"0.50674826",
"0.5060818",
"0.50513566",
"0.50491583",
"0.5048379",
"0.5038679",
"0.5034048",
"0.5020921",
"0.50172746",
"0.5016537",
"0.5010882",
"0.49499893",
"0.49462396",
"0.49363124",
"0.49115416",
"0.49056163",
"0.4900193",
"0.48698443",
"0.48681894",
"0.486656",
"0.48651564",
"0.48623326",
"0.48480394",
"0.48473173",
"0.4840291",
"0.48376265",
"0.48315653",
"0.48312795",
"0.48258463",
"0.4815729",
"0.480812",
"0.4805046",
"0.47986877",
"0.4796746",
"0.47950846",
"0.47893482",
"0.47828177",
"0.47812384",
"0.47773778",
"0.4767586",
"0.47586817",
"0.47496635",
"0.4745044",
"0.47446933",
"0.47425738",
"0.47400174",
"0.47397313",
"0.47356054",
"0.4734837",
"0.47326952",
"0.4730203",
"0.47294065",
"0.47290578",
"0.47241208",
"0.47211143",
"0.47158438",
"0.47100124",
"0.4702482",
"0.47012672",
"0.46971574",
"0.46963882",
"0.46899372",
"0.4689669",
"0.46887153",
"0.46885863",
"0.46866083",
"0.46852687",
"0.46817484",
"0.4676982",
"0.4673157"
] |
0.52711064
|
15
|
Turn off vpn for the current user Turns off vpn for the currently loggedin user.
|
def turn_off_current_user_vpn(opts = {})
turn_off_current_user_vpn_with_http_info(opts)
nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def turn_off_current_user_vpn_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VPNApi.turn_off_current_user_vpn ...'\n end\n # resource path\n local_var_path = '/user/vpn'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['x_auth_token']\n\n new_options = opts.merge(\n :operation => :\"VPNApi.turn_off_current_user_vpn\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VPNApi#turn_off_current_user_vpn\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def deactivate!(user)\n return false unless self.active?\n\n @user = user\n\n remove_hook!\n\n self.active = false\n self.save!\n end",
"def deactivate_user(user_id)\n post(\"/users/#{user_id}/deactivate\")\n end",
"def unprovision\n cfg = ServiceConfig.find_by_user_id_and_name(user.id, params['id'])\n raise CloudError.new(CloudError::SERVICE_NOT_FOUND) unless cfg\n raise CloudError.new(CloudError::FORBIDDEN) unless cfg.provisioned_by?(user)\n\n cfg.unprovision\n\n render :json => {}\n end",
"def untrust!\n MTurkUtils.untrust_user self\n end",
"def disable_two_factor(user_id)\n patch(\"/users/#{user_id}/disable_two_factor\")\n end",
"def turn_off!\n set_power!(:off)\n end",
"def log_off_user\n session.delete(:user_id)\n @current_user = nil\n end",
"def deactivate\n @user = User.find(params[:id])\n @user.deactivate\n redirect_to :back\n end",
"def stop_impersonating\n stop_impersonating_user\n redirect_to root_path\n end",
"def stop_impersonating\n stop_impersonating_user\n redirect_to root_path and return\n end",
"def unblock\n current_user.unblock_user(@user.id)\n render json: {ok: 1}\n end",
"def disable_user(handle)\n request(Net::HTTP::Delete, \"/api/#{API_VERSION}/user/#{handle}\", nil, nil, false)\n end",
"def abandon!\n @user = nil\n session.clear\n end",
"def abandon!\n @user = nil\n session.delete\n end",
"def abandon!\n @user = nil\n session.delete\n end",
"def deactivate_user(login, options = {})\n post('/api/users/deactivate', body: { login: login }.merge!(options))\n end",
"def turn_on_current_user_vpn(opts = {})\n turn_on_current_user_vpn_with_http_info(opts)\n nil\n end",
"def unblock_user\n current_user.unblock_user!(params[:user_id])\n redirect_to :back, notice: \"#{User.find(params[:user_id]).full_name(false)} has been successfully unblocked\"\n end",
"def vip_user\n redirect_to(root_url) unless current_user.vip?\n end",
"def unban!\n MTurkUtils.unban_user self\n end",
"def network_disable(vid)\n perform_request(action: 'vserver-network-disable', vserverid: vid)\n end",
"def unvote_for_option(option)\n option.unvote(self)\n end",
"def disable\n\t\tif user = check_admin\n\t\t\ttarget_user = User.find_by(id: params[:id])\n\t\t\ttarget_user.toggle!(:enabled)\n\t\t\tredirect_back fallback_location: '/home'\n\t\tend\n\tend",
"def tun_disable(vid)\n perform_request(action: 'vserver-tun-disable', vserverid: vid)\n end",
"def unblock_user\n SecurityService.unblock_user(params[:id])\n redirect_to '/users/', notice: \"Käyttäjän blokkaus poistettu. Hän voi taas luoda kursseja.\"\n end",
"def cancel_user user\n execute { GoGoGibbon::Commands.cancel_user user }\n end",
"def deactivate\n @client.delete(\"paypal_accounts/#{id}\")\n @attributes['active'] = false\n true\n end",
"def turn_off\n self.class._end_session\n end",
"def deactivate\n @this_user.update_attributes(:active => false)\n redirect_to :controller => 'user', :action => 'view', :display_name => params[:display_name]\n end",
"def deactivate\n @manage_sieve.set_active(nil)\n end",
"def vpn_down\n vpn_sw = params[:vpn_sw]\n vpn_status = VpnStatus.DOWN\n Node.all.each do |node|\n node.update_vpn_status vpn_status,\"0.0.0.0\",vpn_sw\n end\n render status: :created, :text => \"\"\n end",
"def check_active_user\n if !current_user.active?\n current_user.plan = nil\n end\n end",
"def deactivate\n\t @user.update(:active => false)\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def unblock_user!(_user_id)\n blocked_users_relationships.where(user_id: _user_id).destroy_all\n end",
"def disable_smart_proxy\n params = {:enabled => false}\n smart_proxy(params)\n end",
"def stop_impersonating\n authorize :impersonation, policy_class: DmUniboCommon::ImpersonationPolicy\n stop_impersonating_user\n redirect_to main_app.root_path and return\n end",
"def unvolunteer(user)\n if self.volunteering_allowed? && self.volunteered_for?(user) then\n v = self.volunteers.find_by_user_id(user.id)\n v.destroy unless v.nil?\n end\n end",
"def unblock_user(user_id)\n post(\"/users/#{user_id}/unblock\")\n end",
"def toggle_vote(user)\n if self.voting_allowed? then\n if !self.voted_on?(user)\n self.ratings.create(:user_id => user.id)\n else\n v = self.ratings.find_by_user_id(user.id)\n v.destroy\n end\n end\n end",
"def revoke_session(user)\n\t\t@sessions.delete user\n\tend",
"def logoff\n end",
"def disable\n authorize! @user\n @user.enabled = false\n @user.save\n @user.owned_extensions.update_all(enabled: false)\n redirect_to root_path, notice: t(\"user.disabled\", name: @user.username)\n end",
"def revert_impersonate\n return unless current_impersonator\n sign_out(current_user)\n sign_in(current_impersonator)\n session[:impersonator_user_id] = nil\n end",
"def disable\n run \"#{try_sudo} /sbin/chkconfig puppet off\"\n end",
"def unblock_user(id)\n delete(\"UserBlock/#{id}\")\n end",
"def disable!(current_user: nil, force_save: false)\n force_save! if force_save\n self.current_user ||= current_user\n update! disabled: true\n end",
"def disable\n user = User.find_by_username params[:username]\n raise ActiveRecord::RecordNotFound unless user\n\n command = DisableUserCommand.new(user, current_user, request.remote_ip)\n begin\n command.execute\n rescue => e\n flash['error'] = \"#{e}\"\n else\n flash['success'] = \"User #{user.username} disabled.\"\n ensure\n redirect_back fallback_location: user_url(user)\n end\n end",
"def deactivate!\n self.status = 'Inactive'\n nil\n end",
"def unpause\n @service.context.post(@control_path, :action => 'unpause')\n self\n end",
"def destroy_guest_user\n\n\n guest_user(with_retry = false).try(:reload).try(:destroy)\n session[:guest_user_id] = nil\n end",
"def unconfirm_user(user)\n confirmed_interpreter_requests.find_by(user_id: user.id).destroy\n end",
"def unregister\n VirtualBox.run_command ['VBoxManage', 'unregistervm', uid, '--delete']\n self\n end",
"def cancel_user_at_remote_domain\n if is_cms_configured?\n if is_drupal?\n Users::CancelUserRemoteDomainJob.perform_later(user_id: id)\n elsif is_spree?\n Users::SyncToRemoteDomainJob.perform_later(user_id: id)\n end\n end\n end",
"def downvote\n @solution = Solution.find(params[:id])\n if @solution.profiles_voted.include?(current_user.profile)\n @solution.profiles_voted.delete(current_user.profile)\n @solution.save\n @solution.up_votes -= 1\n @solution.save\n else\n flash[:error] = \"You have already voted on this solution.\"\n end\n redirect_to :back\n end",
"def downvote_for(user)\n return unless vote_weight_for_user(user) > -1\n vote_for(user, -1)\n end",
"def deactivate\n \n end",
"def disable_user_v2(user_id, opts = {})\n disable_user_v2_with_http_info(user_id, opts)\n nil\n end",
"def unpause\n @server.make_json_request('show.pause', tvdbid: @tvdbid)['message']\n end",
"def signoff\n delete_user\n redirect_to home_url\n end",
"def deactivate!\n update(status: false)\n end",
"def off\n set_power(\"off\", \"smooth\",1000)\n end",
"def user_log_out\n forget_user(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def user_log_out\n user_forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def downvote(current_user)\n if current_user && current_user.voted_down_on?(self)\n self.undisliked_by current_user\n else\n self.downvote_by current_user\n end\n end",
"def unmute()\n self.mute()\n end",
"def disable_two_factor!\n update!(\n otp_required_for_login: false,\n otp_secret: nil,\n otp_backup_codes: nil)\n end",
"def power_off!\n delegate(provider, :power_off!)\n end",
"def discard_suspend_state_vapp(vAppId)\n discard_suspended_state_action(vAppId, :vapp)\n end",
"def destroy\n @user = User.find(params[:id])\n if @user.update_attribute(:enabled, false)\n flash[:notice] = \"User disabled\"\n else\n flash[:error] = \"There was a problem disabling this user.\"\n end\n redirect_to users_url\n end",
"def down_vote\n if current_user\n answer_id = params[:answer_id]\n can_vote = Vote.can_vote(answer_id, current_user.uid)\n if not can_vote\n answer = Answer.find_by_id(answer_id)\n answer.vote -= 1\n answer.save!\n \n Vote.delete_vote(answer_id, current_user.uid)\n end\n end\n end",
"def disable\n Heroku::Auth.safe_ask_for_password\n api.request(\n :expects => 200,\n :method => :delete,\n :path => \"/account/two-factor\",\n :headers => { \"Heroku-Password\" => Heroku::Auth.current_session_password }\n )\n display \"Disabled two-factor authentication.\"\n end",
"def deactivate\r\n items = Marketplace::Database.instance.items_by_user(self)\r\n items.each{ |item| item.deactivate }\r\n\r\n buy_orders = Marketplace::Database.instance.buy_orders_by_user(self)\r\n buy_orders.each{ |buy_order| buy_order.delete }\r\n\r\n Marketplace::Database.instance.add_deactivated_user(self)\r\n Marketplace::Database.instance.delete_user(self)\r\n Marketplace::Activity.create(Activity.USER_DEACTIVATE, self, \"#{self.name} has been deactivated\")\r\n end",
"def sign_out\n @current_user = nil\n end",
"def disable_two_factor!\n update!(\n otp_required_for_login: false,\n otp_secret: nil,\n otp_backup_codes: nil)\n end",
"def disable_two_factor!\n update!(\n otp_required_for_login: false,\n otp_secret: nil,\n otp_backup_codes: nil)\n end",
"def deactivate()\n end",
"def clear_current_user\n User.current_user = nil\n end",
"def abandon!\n authentication.abandon!\n end",
"def disable_flip\n # TODO: force a login\n begin\n jwt_payload = JWT.decode(params[:token], Rails.application.secrets.secret_key_base).first\n current_user_id = jwt_payload[\"id\"]\n Flipper[:beta_button].disable current_user if current_user && current_user.id == current_user_id\n rescue JWT::ExpiredSignature, JWT::VerificationError, JWT::DecodeError\n # head :unauthorized\n end\n redirect_to root_path\n end",
"def destroy\n @vpn = current_user.vpn\n @vpn.destroy\n\n respond_to do |format|\n format.html { redirect_to dashboard_url }\n format.json { head :no_content }\n end\n end",
"def stop(target_ip)\n deactivate target_ip\n remove target_ip\n end",
"def pae_disable(vid)\n perform_request(action: 'vserver-pae', vserverid: vid, pae: \"off\")\n end",
"def halt\n execute(\"controlvm\", @uuid, \"poweroff\")\n end",
"def unauthorize_member\n @user = User.find(params[:user_id])\n @group = Group.find(params[:group_id])\n auth_or_unauth_member(\"unauth\", @user, @group)\n end",
"def clear_current_user; end",
"def deactivate_user(email_ids)\n options = {\n :query => {\n 'ZOHO_ACTION' => 'DEACTIVATEUSER',\n 'ZOHO_EMAILS' => email_ids,\n }\n }\n\n send_request get_user_uri, 'post', options\n end",
"def destroy\n __log_activity(\"LOGOUT #{current_user}\")\n __debug_route\n __debug_request\n user = current_user&.account&.dup\n opt = BS_AUTH ? { no_revoke: true?(params[:no_revoke]) } : {}\n delete_auth_data(**opt)\n super\n api_clear(user: user)\n set_flash_notice(user: user, clear: true)\n rescue => error\n auth_failure_redirect(message: error)\n end",
"def forget(user)\n user.forget\n cookies.delete(:investor_id)\n cookies.delete(:remember_token)\n end",
"def deactivate\n admin = Administrator.find_by_user_id(params[:id])\n admin.status = false\n admin.save\n @users = User.all\n render 'index'\n end",
"def reactivate(user)\n if !user.account_active?\n user.reactivate!\n end\n end",
"def log_out\n\t\tsuper\n\t\t@current_user = nil\n\tend",
"def deactivate_user(user, pid)\n\n headers = {:x_storageapi_token => @kbc_api_token, :accept => :json, :content_type => :json}\n\n resource = (\"#{@api_endpoint}/project-users?writerId=#{@writer_id}&pid=#{pid}&email=#{user}\")\n\n resource.gsub!(\"+\", \"%2B\")\n\n response = RestClient.delete resource, headers\n\n return response\n\n end",
"def deactivate\n @user = User.find(params[:id])\n @user.deactivate!\n\n UserMailer.delay({ run_at: 1.minutes.from_now }).user_deactivated(@user) \n\n respond_to do |format|\n format.html { redirect_to :users, notice: 'Пользователь успешно деактивирован.' }\n end\n end",
"def forget_user(user)\n user.forget_user\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget_user(user)\n user.forget_user\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def deactivate_profile\n \t@user = User.find_by_id(params[:id])\n \tif @user.nil?\n render :json => {:success => false, :message => \"User not exists\"}, :status => :not_acceptable\n else\n \tbegin\n\t @user.is_activate = false\n\t @user.save!\n\t render :json => {:success => true,:message => \"User profile deactivated\", :user =>@user}, :status => :ok\n\t rescue Exception => e\n\t \tp e.backtrace\n\t render :json => {:success => false, :message => e.backtrace}, :status => :not_acceptable\n\t end\n end\n end",
"def disable_two_factor!\n update!(otp_required_for_login: false, otp_secret: nil, otp_backup_codes: nil)\n end",
"def deactivate(target_ip)\n @arp_packets.delete target_ip\n if @arp_packets.empty?\n @spoof_thread.kill\n @spoof_thread = nil\n else\n @queue << @arp_packets.values\n end\n @targets[target_ip][:active] = false\n end",
"def unignore_user(user)\n @ignored_ids.delete(user.resolve_id)\n end"
] |
[
"0.6947038",
"0.6082682",
"0.599128",
"0.5936998",
"0.5935822",
"0.59238344",
"0.5907025",
"0.58545583",
"0.584242",
"0.5832911",
"0.5825407",
"0.57688993",
"0.5741067",
"0.57284874",
"0.57183874",
"0.57183874",
"0.5712141",
"0.5710035",
"0.568161",
"0.565093",
"0.56494325",
"0.5624042",
"0.5609578",
"0.55827945",
"0.55644",
"0.55588704",
"0.555424",
"0.5540303",
"0.54967046",
"0.54721034",
"0.5471768",
"0.547167",
"0.5453561",
"0.5446922",
"0.5432159",
"0.543213",
"0.5431136",
"0.5423262",
"0.541412",
"0.5402799",
"0.53990614",
"0.5397747",
"0.5389442",
"0.53840584",
"0.53835106",
"0.5377116",
"0.5369641",
"0.53660166",
"0.5356134",
"0.5355458",
"0.5348554",
"0.5347921",
"0.5344543",
"0.5342593",
"0.5340552",
"0.53387403",
"0.53365856",
"0.53348905",
"0.5328954",
"0.5324436",
"0.53174657",
"0.530456",
"0.53027385",
"0.53013474",
"0.5299839",
"0.5298301",
"0.52966064",
"0.5290803",
"0.5289759",
"0.5282801",
"0.5281305",
"0.5280999",
"0.52682924",
"0.52569735",
"0.52557665",
"0.52557665",
"0.52554595",
"0.52455056",
"0.52425903",
"0.5241495",
"0.5235782",
"0.5232381",
"0.5220263",
"0.52165854",
"0.52124625",
"0.52114516",
"0.5210818",
"0.5206808",
"0.52042615",
"0.518733",
"0.5186714",
"0.51853776",
"0.51784843",
"0.5177385",
"0.5172741",
"0.5172741",
"0.5168141",
"0.5164515",
"0.51618695",
"0.51605004"
] |
0.80374235
|
0
|
Turn off vpn for the current user Turns off vpn for the currently loggedin user.
|
def turn_off_current_user_vpn_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: VPNApi.turn_off_current_user_vpn ...'
end
# resource path
local_var_path = '/user/vpn'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['x_auth_token']
new_options = opts.merge(
:operation => :"VPNApi.turn_off_current_user_vpn",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: VPNApi#turn_off_current_user_vpn\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def turn_off_current_user_vpn(opts = {})\n turn_off_current_user_vpn_with_http_info(opts)\n nil\n end",
"def deactivate!(user)\n return false unless self.active?\n\n @user = user\n\n remove_hook!\n\n self.active = false\n self.save!\n end",
"def deactivate_user(user_id)\n post(\"/users/#{user_id}/deactivate\")\n end",
"def unprovision\n cfg = ServiceConfig.find_by_user_id_and_name(user.id, params['id'])\n raise CloudError.new(CloudError::SERVICE_NOT_FOUND) unless cfg\n raise CloudError.new(CloudError::FORBIDDEN) unless cfg.provisioned_by?(user)\n\n cfg.unprovision\n\n render :json => {}\n end",
"def untrust!\n MTurkUtils.untrust_user self\n end",
"def disable_two_factor(user_id)\n patch(\"/users/#{user_id}/disable_two_factor\")\n end",
"def turn_off!\n set_power!(:off)\n end",
"def log_off_user\n session.delete(:user_id)\n @current_user = nil\n end",
"def deactivate\n @user = User.find(params[:id])\n @user.deactivate\n redirect_to :back\n end",
"def stop_impersonating\n stop_impersonating_user\n redirect_to root_path\n end",
"def stop_impersonating\n stop_impersonating_user\n redirect_to root_path and return\n end",
"def unblock\n current_user.unblock_user(@user.id)\n render json: {ok: 1}\n end",
"def disable_user(handle)\n request(Net::HTTP::Delete, \"/api/#{API_VERSION}/user/#{handle}\", nil, nil, false)\n end",
"def abandon!\n @user = nil\n session.clear\n end",
"def abandon!\n @user = nil\n session.delete\n end",
"def abandon!\n @user = nil\n session.delete\n end",
"def deactivate_user(login, options = {})\n post('/api/users/deactivate', body: { login: login }.merge!(options))\n end",
"def turn_on_current_user_vpn(opts = {})\n turn_on_current_user_vpn_with_http_info(opts)\n nil\n end",
"def unblock_user\n current_user.unblock_user!(params[:user_id])\n redirect_to :back, notice: \"#{User.find(params[:user_id]).full_name(false)} has been successfully unblocked\"\n end",
"def vip_user\n redirect_to(root_url) unless current_user.vip?\n end",
"def unban!\n MTurkUtils.unban_user self\n end",
"def network_disable(vid)\n perform_request(action: 'vserver-network-disable', vserverid: vid)\n end",
"def unvote_for_option(option)\n option.unvote(self)\n end",
"def disable\n\t\tif user = check_admin\n\t\t\ttarget_user = User.find_by(id: params[:id])\n\t\t\ttarget_user.toggle!(:enabled)\n\t\t\tredirect_back fallback_location: '/home'\n\t\tend\n\tend",
"def tun_disable(vid)\n perform_request(action: 'vserver-tun-disable', vserverid: vid)\n end",
"def unblock_user\n SecurityService.unblock_user(params[:id])\n redirect_to '/users/', notice: \"Käyttäjän blokkaus poistettu. Hän voi taas luoda kursseja.\"\n end",
"def cancel_user user\n execute { GoGoGibbon::Commands.cancel_user user }\n end",
"def deactivate\n @client.delete(\"paypal_accounts/#{id}\")\n @attributes['active'] = false\n true\n end",
"def turn_off\n self.class._end_session\n end",
"def deactivate\n @this_user.update_attributes(:active => false)\n redirect_to :controller => 'user', :action => 'view', :display_name => params[:display_name]\n end",
"def deactivate\n @manage_sieve.set_active(nil)\n end",
"def vpn_down\n vpn_sw = params[:vpn_sw]\n vpn_status = VpnStatus.DOWN\n Node.all.each do |node|\n node.update_vpn_status vpn_status,\"0.0.0.0\",vpn_sw\n end\n render status: :created, :text => \"\"\n end",
"def check_active_user\n if !current_user.active?\n current_user.plan = nil\n end\n end",
"def deactivate\n\t @user.update(:active => false)\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",
"def unblock_user!(_user_id)\n blocked_users_relationships.where(user_id: _user_id).destroy_all\n end",
"def disable_smart_proxy\n params = {:enabled => false}\n smart_proxy(params)\n end",
"def stop_impersonating\n authorize :impersonation, policy_class: DmUniboCommon::ImpersonationPolicy\n stop_impersonating_user\n redirect_to main_app.root_path and return\n end",
"def unvolunteer(user)\n if self.volunteering_allowed? && self.volunteered_for?(user) then\n v = self.volunteers.find_by_user_id(user.id)\n v.destroy unless v.nil?\n end\n end",
"def unblock_user(user_id)\n post(\"/users/#{user_id}/unblock\")\n end",
"def toggle_vote(user)\n if self.voting_allowed? then\n if !self.voted_on?(user)\n self.ratings.create(:user_id => user.id)\n else\n v = self.ratings.find_by_user_id(user.id)\n v.destroy\n end\n end\n end",
"def revoke_session(user)\n\t\t@sessions.delete user\n\tend",
"def logoff\n end",
"def disable\n authorize! @user\n @user.enabled = false\n @user.save\n @user.owned_extensions.update_all(enabled: false)\n redirect_to root_path, notice: t(\"user.disabled\", name: @user.username)\n end",
"def revert_impersonate\n return unless current_impersonator\n sign_out(current_user)\n sign_in(current_impersonator)\n session[:impersonator_user_id] = nil\n end",
"def disable\n run \"#{try_sudo} /sbin/chkconfig puppet off\"\n end",
"def unblock_user(id)\n delete(\"UserBlock/#{id}\")\n end",
"def disable!(current_user: nil, force_save: false)\n force_save! if force_save\n self.current_user ||= current_user\n update! disabled: true\n end",
"def disable\n user = User.find_by_username params[:username]\n raise ActiveRecord::RecordNotFound unless user\n\n command = DisableUserCommand.new(user, current_user, request.remote_ip)\n begin\n command.execute\n rescue => e\n flash['error'] = \"#{e}\"\n else\n flash['success'] = \"User #{user.username} disabled.\"\n ensure\n redirect_back fallback_location: user_url(user)\n end\n end",
"def deactivate!\n self.status = 'Inactive'\n nil\n end",
"def unpause\n @service.context.post(@control_path, :action => 'unpause')\n self\n end",
"def destroy_guest_user\n\n\n guest_user(with_retry = false).try(:reload).try(:destroy)\n session[:guest_user_id] = nil\n end",
"def unconfirm_user(user)\n confirmed_interpreter_requests.find_by(user_id: user.id).destroy\n end",
"def unregister\n VirtualBox.run_command ['VBoxManage', 'unregistervm', uid, '--delete']\n self\n end",
"def cancel_user_at_remote_domain\n if is_cms_configured?\n if is_drupal?\n Users::CancelUserRemoteDomainJob.perform_later(user_id: id)\n elsif is_spree?\n Users::SyncToRemoteDomainJob.perform_later(user_id: id)\n end\n end\n end",
"def downvote\n @solution = Solution.find(params[:id])\n if @solution.profiles_voted.include?(current_user.profile)\n @solution.profiles_voted.delete(current_user.profile)\n @solution.save\n @solution.up_votes -= 1\n @solution.save\n else\n flash[:error] = \"You have already voted on this solution.\"\n end\n redirect_to :back\n end",
"def downvote_for(user)\n return unless vote_weight_for_user(user) > -1\n vote_for(user, -1)\n end",
"def deactivate\n \n end",
"def disable_user_v2(user_id, opts = {})\n disable_user_v2_with_http_info(user_id, opts)\n nil\n end",
"def unpause\n @server.make_json_request('show.pause', tvdbid: @tvdbid)['message']\n end",
"def signoff\n delete_user\n redirect_to home_url\n end",
"def deactivate!\n update(status: false)\n end",
"def off\n set_power(\"off\", \"smooth\",1000)\n end",
"def user_log_out\n forget_user(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def user_log_out\n user_forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def downvote(current_user)\n if current_user && current_user.voted_down_on?(self)\n self.undisliked_by current_user\n else\n self.downvote_by current_user\n end\n end",
"def unmute()\n self.mute()\n end",
"def disable_two_factor!\n update!(\n otp_required_for_login: false,\n otp_secret: nil,\n otp_backup_codes: nil)\n end",
"def power_off!\n delegate(provider, :power_off!)\n end",
"def discard_suspend_state_vapp(vAppId)\n discard_suspended_state_action(vAppId, :vapp)\n end",
"def destroy\n @user = User.find(params[:id])\n if @user.update_attribute(:enabled, false)\n flash[:notice] = \"User disabled\"\n else\n flash[:error] = \"There was a problem disabling this user.\"\n end\n redirect_to users_url\n end",
"def down_vote\n if current_user\n answer_id = params[:answer_id]\n can_vote = Vote.can_vote(answer_id, current_user.uid)\n if not can_vote\n answer = Answer.find_by_id(answer_id)\n answer.vote -= 1\n answer.save!\n \n Vote.delete_vote(answer_id, current_user.uid)\n end\n end\n end",
"def disable\n Heroku::Auth.safe_ask_for_password\n api.request(\n :expects => 200,\n :method => :delete,\n :path => \"/account/two-factor\",\n :headers => { \"Heroku-Password\" => Heroku::Auth.current_session_password }\n )\n display \"Disabled two-factor authentication.\"\n end",
"def deactivate\r\n items = Marketplace::Database.instance.items_by_user(self)\r\n items.each{ |item| item.deactivate }\r\n\r\n buy_orders = Marketplace::Database.instance.buy_orders_by_user(self)\r\n buy_orders.each{ |buy_order| buy_order.delete }\r\n\r\n Marketplace::Database.instance.add_deactivated_user(self)\r\n Marketplace::Database.instance.delete_user(self)\r\n Marketplace::Activity.create(Activity.USER_DEACTIVATE, self, \"#{self.name} has been deactivated\")\r\n end",
"def sign_out\n @current_user = nil\n end",
"def disable_two_factor!\n update!(\n otp_required_for_login: false,\n otp_secret: nil,\n otp_backup_codes: nil)\n end",
"def disable_two_factor!\n update!(\n otp_required_for_login: false,\n otp_secret: nil,\n otp_backup_codes: nil)\n end",
"def deactivate()\n end",
"def clear_current_user\n User.current_user = nil\n end",
"def abandon!\n authentication.abandon!\n end",
"def disable_flip\n # TODO: force a login\n begin\n jwt_payload = JWT.decode(params[:token], Rails.application.secrets.secret_key_base).first\n current_user_id = jwt_payload[\"id\"]\n Flipper[:beta_button].disable current_user if current_user && current_user.id == current_user_id\n rescue JWT::ExpiredSignature, JWT::VerificationError, JWT::DecodeError\n # head :unauthorized\n end\n redirect_to root_path\n end",
"def destroy\n @vpn = current_user.vpn\n @vpn.destroy\n\n respond_to do |format|\n format.html { redirect_to dashboard_url }\n format.json { head :no_content }\n end\n end",
"def stop(target_ip)\n deactivate target_ip\n remove target_ip\n end",
"def pae_disable(vid)\n perform_request(action: 'vserver-pae', vserverid: vid, pae: \"off\")\n end",
"def halt\n execute(\"controlvm\", @uuid, \"poweroff\")\n end",
"def unauthorize_member\n @user = User.find(params[:user_id])\n @group = Group.find(params[:group_id])\n auth_or_unauth_member(\"unauth\", @user, @group)\n end",
"def clear_current_user; end",
"def deactivate_user(email_ids)\n options = {\n :query => {\n 'ZOHO_ACTION' => 'DEACTIVATEUSER',\n 'ZOHO_EMAILS' => email_ids,\n }\n }\n\n send_request get_user_uri, 'post', options\n end",
"def destroy\n __log_activity(\"LOGOUT #{current_user}\")\n __debug_route\n __debug_request\n user = current_user&.account&.dup\n opt = BS_AUTH ? { no_revoke: true?(params[:no_revoke]) } : {}\n delete_auth_data(**opt)\n super\n api_clear(user: user)\n set_flash_notice(user: user, clear: true)\n rescue => error\n auth_failure_redirect(message: error)\n end",
"def forget(user)\n user.forget\n cookies.delete(:investor_id)\n cookies.delete(:remember_token)\n end",
"def deactivate\n admin = Administrator.find_by_user_id(params[:id])\n admin.status = false\n admin.save\n @users = User.all\n render 'index'\n end",
"def reactivate(user)\n if !user.account_active?\n user.reactivate!\n end\n end",
"def log_out\n\t\tsuper\n\t\t@current_user = nil\n\tend",
"def deactivate_user(user, pid)\n\n headers = {:x_storageapi_token => @kbc_api_token, :accept => :json, :content_type => :json}\n\n resource = (\"#{@api_endpoint}/project-users?writerId=#{@writer_id}&pid=#{pid}&email=#{user}\")\n\n resource.gsub!(\"+\", \"%2B\")\n\n response = RestClient.delete resource, headers\n\n return response\n\n end",
"def deactivate\n @user = User.find(params[:id])\n @user.deactivate!\n\n UserMailer.delay({ run_at: 1.minutes.from_now }).user_deactivated(@user) \n\n respond_to do |format|\n format.html { redirect_to :users, notice: 'Пользователь успешно деактивирован.' }\n end\n end",
"def forget_user(user)\n user.forget_user\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def forget_user(user)\n user.forget_user\n cookies.delete(:user_id)\n cookies.delete(:remember_token)\n end",
"def deactivate_profile\n \t@user = User.find_by_id(params[:id])\n \tif @user.nil?\n render :json => {:success => false, :message => \"User not exists\"}, :status => :not_acceptable\n else\n \tbegin\n\t @user.is_activate = false\n\t @user.save!\n\t render :json => {:success => true,:message => \"User profile deactivated\", :user =>@user}, :status => :ok\n\t rescue Exception => e\n\t \tp e.backtrace\n\t render :json => {:success => false, :message => e.backtrace}, :status => :not_acceptable\n\t end\n end\n end",
"def disable_two_factor!\n update!(otp_required_for_login: false, otp_secret: nil, otp_backup_codes: nil)\n end",
"def deactivate(target_ip)\n @arp_packets.delete target_ip\n if @arp_packets.empty?\n @spoof_thread.kill\n @spoof_thread = nil\n else\n @queue << @arp_packets.values\n end\n @targets[target_ip][:active] = false\n end",
"def unignore_user(user)\n @ignored_ids.delete(user.resolve_id)\n end"
] |
[
"0.80374235",
"0.6082682",
"0.599128",
"0.5936998",
"0.5935822",
"0.59238344",
"0.5907025",
"0.58545583",
"0.584242",
"0.5832911",
"0.5825407",
"0.57688993",
"0.5741067",
"0.57284874",
"0.57183874",
"0.57183874",
"0.5712141",
"0.5710035",
"0.568161",
"0.565093",
"0.56494325",
"0.5624042",
"0.5609578",
"0.55827945",
"0.55644",
"0.55588704",
"0.555424",
"0.5540303",
"0.54967046",
"0.54721034",
"0.5471768",
"0.547167",
"0.5453561",
"0.5446922",
"0.5432159",
"0.543213",
"0.5431136",
"0.5423262",
"0.541412",
"0.5402799",
"0.53990614",
"0.5397747",
"0.5389442",
"0.53840584",
"0.53835106",
"0.5377116",
"0.5369641",
"0.53660166",
"0.5356134",
"0.5355458",
"0.5348554",
"0.5347921",
"0.5344543",
"0.5342593",
"0.5340552",
"0.53387403",
"0.53365856",
"0.53348905",
"0.5328954",
"0.5324436",
"0.53174657",
"0.530456",
"0.53027385",
"0.53013474",
"0.5299839",
"0.5298301",
"0.52966064",
"0.5290803",
"0.5289759",
"0.5282801",
"0.5281305",
"0.5280999",
"0.52682924",
"0.52569735",
"0.52557665",
"0.52557665",
"0.52554595",
"0.52455056",
"0.52425903",
"0.5241495",
"0.5235782",
"0.5232381",
"0.5220263",
"0.52165854",
"0.52124625",
"0.52114516",
"0.5210818",
"0.5206808",
"0.52042615",
"0.518733",
"0.5186714",
"0.51853776",
"0.51784843",
"0.5177385",
"0.5172741",
"0.5172741",
"0.5168141",
"0.5164515",
"0.51618695",
"0.51605004"
] |
0.6947038
|
1
|
Turn on vpn for the current user Turns on vpn for the currently loggedin user.
|
def turn_on_current_user_vpn(opts = {})
turn_on_current_user_vpn_with_http_info(opts)
nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def vip_user\n redirect_to(root_url) unless current_user.vip?\n end",
"def turn_on_current_user_vpn_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VPNApi.turn_on_current_user_vpn ...'\n end\n # resource path\n local_var_path = '/user/vpn'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['x_auth_token']\n\n new_options = opts.merge(\n :operation => :\"VPNApi.turn_on_current_user_vpn\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VPNApi#turn_on_current_user_vpn\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def activate\n @user.activate! if @user.pending?\n redirect_to root_url\n end",
"def activate_user(user_id)\n post(\"/users/#{user_id}/activate\")\n end",
"def activate_user(user)\n user.status_id=0\n user.save\n end",
"def activate\n if @user.inactive? && @user.created_by_admin?\n if @user.is_regular? && @user.profile.penultimate_step_complete?\n @user.activate!\n @user.save_profinda_profile\n render json: { status: 'active' }\n elsif @user.is_external? && @user.profile.first_step_completed?\n @user.activate!\n render json: { status: 'active' }\n else\n render json: { status: 'user can\\'t be activate' }\n end\n else\n render json: { status: 'user is active' }\n end\n end",
"def set_user_tasking_mode_on\r\n if @current_user.facebook_user?\r\n @current_user.is_tasking = true\r\n @current_user.save(false)\r\n else\r\n @current_user.update_attribute(:is_tasking, true)\r\n end\r\n end",
"def activate!(user)\n return false if self.active?\n\n @user = user\n\n create_hook!\n\n self.active = true\n self.save!\n end",
"def vote_up(user_ip)\n if user_already_voted?(user_ip)\n false\n else\n if self.votes.create(:user_ip => user_ip)\n true\n else\n false\n end\n end\n end",
"def change_state!(_ctx, user:, **)\n role(user).activate!\n end",
"def impersonate!(user)\n self.class.start(controller, :user => user, :parent => self)\n end",
"def activate_if_invited\n invited_user = Invite.find_by_invited_user_email(self.email)\n if ! invited_user.nil?\n invited_user.update_attribute(:invited_user_id, self.id)\n self.account_active = 1\n self.save!\n end\n end",
"def user_onoff_flag\n @requested_user = User.find_by_account_number(params[:id])\n if @requested_user.is_active?\n @requested_user.update_columns(:is_active => false)\n redirect_to admin_index_path, :flash => {:notice => \"Requested user(#{@requested_user.first_name} #{@requested_user.last_name}) account successfully de-activated.\"}\n else\n @requested_user.update_columns(:is_active => true)\n redirect_to admin_index_path, :flash => {:notice => \"Requested user(#{@requested_user.first_name} #{@requested_user.last_name}) account successfully activated.\"}\n end\n end",
"def set_user\n\t\t@active = \"user\"\n\t\t@user = current_user\n\tend",
"def connect\n self.current_user = find_verified_user\n end",
"def connect\n self.current_user = find_verified_user\n end",
"def connect\n self.current_user = find_verified_user\n end",
"def connect\n self.current_user = find_verified_user # define current_user property once user sucessfully connected\n end",
"def enable\n user = User.find_by_username params[:username]\n raise ActiveRecord::RecordNotFound unless user\n\n command = EnableUserCommand.new(user, current_user, request.remote_ip)\n begin\n command.execute\n rescue => e\n flash['error'] = \"#{e}\"\n else\n flash['success'] = \"User #{user.username} enabled.\"\n ensure\n redirect_back fallback_location: user_url(user)\n end\n end",
"def switch_on(active_user, tag = nil)\n update(status: :active,current_user: active_user.id)\n mqtt_control_on\n socket_usage = SocketUsage.create!(user: active_user,\n el_socket: self, start_time: Time.now.utc,\n date: Date.today, start_tag: tag)\n\n active_user.last_usage = socket_usage.id\n active_user.save\n end",
"def approve_user\n # set the enabled flag to true for the user\n # send out approval notification\n end",
"def enable\n account = Account.for(\"github\").with_username(params[:id]).first!\n @user = User.unscoped.where(id: account.user_id).first\n authorize! @user\n @user.enabled = true\n @user.save\n redirect_back fallback_location: root_path, notice: t(\"user.enabled\", name: @user.username)\n end",
"def turn_on!\n set_power!(:on)\n end",
"def user_on\n session[:user_id] = '3980284084'\n end",
"def activate_account!\n update_attribute :is_active, true\n end",
"def show\n @user = current_user\n @user.assign_attributes online: true\n @user.save(validate: false)\n end",
"def change_state!(_ctx, user:, **)\n role(user).update!(state: 'active')\n end",
"def toggle_vote(user)\n if self.voting_allowed? then\n if !self.voted_on?(user)\n self.ratings.create(:user_id => user.id)\n else\n v = self.ratings.find_by_user_id(user.id)\n v.destroy\n end\n end\n end",
"def approve_user(user_id)\n post(\"/users/#{user_id}/approve\")\n end",
"def logging_in(id)\n guest_votes = Vote.where(gamer_id: guest_gamer.id)\n guest_votes.each do |vote|\n vote.gamer_id = id\n vote.save!\n end\n end",
"def activate\n current_user = params[:activation_code].blank? ? false : User.find_by_activation_code(params[:activation_code])\n if current_user && !user_signed_in? && !current_user.account_active?\n current_user.activate\n # current_user.save_ip(request.remote_ip)\n redirect_to new_user_session_path,:notice => \"Congratulations! Your account has now been activated!\"\n else\n redirect_to :root\n end\n end",
"def update_pip\n @user.on_pip = !@user.on_pip\n @user.save\n redirect_to show_user_path(@user)\n end",
"def activate\n @user = User.find(params[:id])\n @user.activate\n redirect_to :back\n end",
"def activate_user\n self.save\n self.send_user_notification_email\n end",
"def admin_approve_user\n @user.update(approved: true)\n redirect_to admin_path, notice: \"User Approved\"\n end",
"def connect\n self.user_id = find_verified_user\n end",
"def set_user_as_current_user\n @user = @current_user\n end",
"def up\n vote_status = $redis.hget(\"#{@instance_type}:#{@instance.id}:votes\", current_user.id).to_i\n same_vote = vote_status != 1\n \n if current_user.credit > Settings.vote_up_limit and current_user.vote_per_day > 0 and same_vote\n if vote_status == -1\n @instance.update_attribute(:votes_count, @instance.votes_count + 1)\n @instance.user.update_attribute(:credit, @instance.user.credit + Settings.vote_down)\n current_user.update_attribute(:credit, current_user.credit + Settings.answer_voter_down) if @instance_type == \"answer\"\n current_user.update_attribute(:vote_per_day, current_user.vote_per_day + 1)\n end\n $redis.hset(\"#{@instance_type}:#{@instance.id}:votes\", current_user.id, 1)\n @instance.update_attribute(:votes_count, @instance.votes_count + 1)\n \n case @instance_type\n when \"question\"\n @instance.user.update_attribute(:credit, @instance.user.credit + Settings.question_vote_up)\n when \"answer\"\n @instance.user.update_attribute(:credit, @instance.user.credit + Settings.answer_vote_up)\n end\n \n current_user.update_attribute(:vote_per_day, current_user.vote_per_day - 1)\n \n case @instance_type\n when \"question\"\n record = Vote.where(:user_id => current_user.id, :question_id => @instance.id).first\n if record\n record.update_attribute(:value, 1)\n else\n Vote.create(:user_id => current_user.id, :question_id => @instance.id, :value => 1)\n end\n when \"answer\"\n record = Vote.where(:user_id => current_user.id, :answer_id => @instance.id).first\n if record\n record.update_attribute(:value, 1)\n else\n Vote.create(:user_id => current_user.id, :answer_id => @instance.id, :value => 1)\n end\n end\n end\n end",
"def set_vip\n @vip = Vip.find(params[:id])\n end",
"def activate\n @user = User.find(params[:format])\n @user.update(:active_flag => true)\n flash[:info] = \"User Activated\"\n ## email user and line management to indicate the profile has been activated\n UserMailer.activated_user_email(@user).deliver\n redirect_to users_path\n end",
"def connect\n self.current_user = find_verified_user #efine the current_user property once a user successfully connected. Only then the identified_by line before will actually work.\n end",
"def change_is_enabled\n member = Member.find params[:id]\n user = User.find(member.user_id)\n Member.change_student_status(member)\n if member.is_enabled == true\n redirect_to users_url, :flash => { :success => \"#{user.first_name} #{user.last_name} has been enabled.\" }\n else\n redirect_to users_url, :flash => { :success => \"#{user.first_name} #{user.last_name} has been disabled.\" }\n end\n end",
"def approve!\n self.update_attribute(:status, ConfigCenter::User::APPROVED)\n end",
"def network_enable(vid)\n perform_request(action: 'vserver-network-enable', vserverid: vid)\n end",
"def activate\n user = User.find_by_token(params[:token])\n unless user.nil?\n unless user.activated?\n user.activate\n user.save\n #notify admins\n UserMailer.deliver_notify_admins_signup(User.admins, user)\n #login\n self.current_user = user\n flash[:notice] = 'Account successfuly activated.'\n redirect_to profile_path(user.login)\n else\n render :partial => '/sessions/already_activated', :layout => true\n end\n else\n render :text => '<strong>Invalid Request!</strong>', :layout => true\n end\n end",
"def voted\n\t\tcurrent_user = User.current_user\n\t\tunless current_user.blank?\n\t\t\tcurrent_user.voted?(self)\n\t\telse\n\t\t\tfalse\n\t\tend \n\tend",
"def activate\n @user = User.find(params[:id])\n @user.activate!\n\n UserMailer.delay({ run_at: 1.minutes.from_now }).user_activated(@user) \n\n respond_to do |format|\n format.html { redirect_to :users, notice: 'Пользователь успешно активирован.' }\n end\n end",
"def reactivate(user)\n if !user.account_active?\n user.reactivate!\n end\n end",
"def call(user)\n return unless user.invite_token\n invite = Invite.find_by_invite_token(user.invite_token)\n invite.update!(grader_id: user.id) if invite\n end",
"def poweron_vapp(vAppId)\n power_action(vAppId, 'powerOn')\n end",
"def turn_on\n self.class._start_session\n end",
"def switch_user\n volunteer = Volunteer.find(params[:volunteer_id].to_i)\n volunteer_region_ids = volunteer.regions.pluck(:id)\n admin_region_ids =\n current_volunteer.assignments.collect do |assignment|\n assignment.admin ? assignment.region.id : nil\n end.compact\n\n unless current_volunteer.super_admin? || (volunteer_region_ids & admin_region_ids).length > 0\n flash[:error] = \"You're not authorized to switch to that user!\"\n return redirect_to(root_path)\n end\n\n sign_out(current_volunteer)\n sign_in(volunteer)\n flash[:notice] = \"Successfully switched to user #{current_volunteer.name}.\"\n home\n end",
"def started_viewing(user = nil, dont_notify: false)\n if user && !viewing?(user)\n Cache.set_add(viewing_cache_key, collaborator_json_stringified(user))\n end\n received_changes(num_viewers_changed: true) unless dont_notify\n end",
"def turn_off_current_user_vpn(opts = {})\n turn_off_current_user_vpn_with_http_info(opts)\n nil\n end",
"def activate\r\n Marketplace::Database.instance.delete_deactivated_user(self)\r\n Marketplace::Database.instance.add_user(self)\r\n Marketplace::Activity.create(Activity.USER_REACTIVATE, self, \"#{self.name} has been reactivated\")\r\n end",
"def activate\n @this_user.update_attributes(:active => true)\n redirect_to :controller => 'user', :action => 'view', :display_name => params[:display_name]\n end",
"def on_online(m, user)\n user.send \"Hello #{m.user.nick}\"\n end",
"def vote_on\n if Vote.voteOn(params[:activity_id], params[:user_id], params[:rating])\n\t\t\t@activity = Activity.find(params[:activity_id])\n\t\t\t@activity.viewer = User.find_by_id(params[:user_id])\n render :json=>@activity\n end\n return :text=>'There was an error voting for this activity', :status=>:service_unavailable\n end",
"def upvote\n\t\t@pin.upvote_by current_user\n\t\tredirect_to :back\n\tend",
"def activate\n @membership.activate!\n @membership.generate_dues_invoice!\n _user = @membership.user\n _user.roles = [:member]\n _user.save\n flash[:success] = \"Successfully activated #{ @membership.user.full_name }\"\n redirect_to '/'\n end",
"def set_virtual_user\n @virtual_user = VirtualUser.find(params[:id])\n end",
"def record_login(user)\n self.current_site_visitor = GreenFlag::SiteVisitor.for_user!(user, current_site_visitor)\n end",
"def activate_first_user\n return if User.any?\n\n assign_attributes(\n confirmed_at: Time.current,\n point_of_contact: true\n )\n end",
"def activate_first_user\n return if User.any?\n\n assign_attributes(\n confirmed_at: Time.current,\n point_of_contact: true\n )\n end",
"def set_user\n logger.debug 'In set_user, session[:uid]=' + session[:uid].to_s\n logger.debug 'In set_user, params[:vk_id]' + params[:vk_id].to_s\n if !session[:uid].nil?\n logger.debug 'Searching for player with vk_id ' + session[:uid].to_s\n @user = User.find_by_vk_id session[:uid]\n elsif !params[:vk_id].nil?\n logger.debug 'Searching for player with vk_id ' + params[:vk_id].to_s\n @user = User.find_by_vk_id params[:vk_id]\n else\n logger.error 'User is not logged in'\n end\n end",
"def propose\n response = CoachClient::Request.put(url, username: @user1.username,\n password: @user1.password,\n payload: payload,\n content_type: :xml)\n unless response.code == 200 || response.code == 201\n fail CoachClient::NotProposed.new(self), 'Could not propose partnership'\n end\n set_user_confirmed(response.to_h)\n self\n end",
"def change\n @user = current_user\n end",
"def turn_networkmode_on\n # Create and login mobile user\n user = log_mobile_user_in\n \n # Update mobile preferences\n find(\".cog\").click\n page.should have_select('network_mode', :selected => 'Off') # network_mode == off\n select(\"On\", :from => \"network_mode\") # network_mode == on\n fill_in \"signature\", :with => \"this is my awesome intro\" # modify signature\n click_button \"start networking\" # save changes\n\n # Ensure that this worked\n find(\".cog\").click\n page.should have_select('network_mode', :selected => 'On') # network_mode == on\n page.should have_content(\"this is my awesome intro\") # new signature\n find('#counter').should have_content('0') # contact counter == 0\n\n return user\n end",
"def set_current_user\n Member.current = current_user unless current_user.nil?\n end",
"def upvote_for(user)\n return unless vote_weight_for_user(user) < 1\n vote_for(user, 1)\n end",
"def set_current_user\n @user = current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def activate\n user = User.find_by_username params[:username]\n if user && user.activation == params[:activation]\n user.activation = \"ACTIVATION_ACTIVE\"\n user.save()\n render status: 200, json: {error: false}\n else\n render status: 403, json: {error: true}\n end\n end",
"def set_xp_user\n @xp_user = XpUser.find(params[:id])\n end",
"def update_current_user(user)\n @current_user = user\n @current_user\n end",
"def approve_user\n @user = User.find(params[:id])\n\n @user.approved_torcida = true\n @user.save(validate: false)\n redirect_to root_path\n end",
"def set_public_network(vm_name, vm_config, ip) \n \n require_string(vm_name)\n require_vagrant_config(vm_config)\n\n if ip.to_s.empty?\n log_info(\" - skipping public network ip setup\") \n return\n else \n log_info(\" - public network: ip: #{ip}\") \n end\n\n vm_config.vm.network :public_network, ip: ip\n end",
"def current_vk_user\n @current_vk_user ||= fetch_current_vk_user\n end",
"def switch_user(user_id_to_switch)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'userIdToSwitch', user_id_to_switch)\n\t\t\tclient.queue_service_action_call('session', 'switchUser', 'KalturaLoginSession', 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 is_require_accepting_user_to_match_invited_user_enabled=(value)\n @is_require_accepting_user_to_match_invited_user_enabled = value\n end",
"def impersonate\n impersonate_user(@user)\n redirect_to root_url\n end",
"def update_current_user_points\n current_user.update_attributes(:points => User.update_points(current_user.id))\n end",
"def set_current_user\n User.current = current_user\n end",
"def upvote\n @pin.upvote_by current_user\n redirect_to :back, notice: 'Pin was upvoted!'\n # redirect_to request.referer || root_path, notice:'Link upvoted!'\n end",
"def upvote(current_user)\n if current_user && current_user.voted_up_on?(self)\n self.unliked_by current_user\n else\n self.liked_by current_user\n end\n end",
"def update_current_user(user)\n @current_user = user if user\n end",
"def set_user\n @user = current_user \n end",
"def enable_otp\n current_user.otp_secret = User.generate_otp_secret\n current_user.otp_required_for_login = true\n current_user.save!\n redirect_back(fallback_location: '/')\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end"
] |
[
"0.6372449",
"0.593669",
"0.573794",
"0.55957085",
"0.55560887",
"0.55357134",
"0.55208737",
"0.55129844",
"0.5454473",
"0.54213685",
"0.5414204",
"0.5395543",
"0.538463",
"0.5373731",
"0.53193337",
"0.53193337",
"0.53193337",
"0.5308838",
"0.52956516",
"0.5282667",
"0.5258304",
"0.52576244",
"0.5232855",
"0.5230153",
"0.52196354",
"0.5217087",
"0.51937014",
"0.51774424",
"0.5157592",
"0.5148506",
"0.5135906",
"0.51352996",
"0.512844",
"0.51061374",
"0.50841105",
"0.50775045",
"0.5077247",
"0.5073608",
"0.50688297",
"0.50574726",
"0.5049082",
"0.50365764",
"0.50365394",
"0.50130063",
"0.5009845",
"0.5003932",
"0.49919018",
"0.49814048",
"0.49736446",
"0.4971569",
"0.49632925",
"0.49566168",
"0.4948885",
"0.49481857",
"0.49255207",
"0.49197856",
"0.49109545",
"0.49084944",
"0.49068046",
"0.49049622",
"0.49034727",
"0.49008167",
"0.48935473",
"0.48935473",
"0.48866066",
"0.48828575",
"0.48813525",
"0.48799834",
"0.48742244",
"0.48725757",
"0.48639983",
"0.48639983",
"0.48639983",
"0.48639983",
"0.4863286",
"0.486114",
"0.4858492",
"0.48397577",
"0.48392954",
"0.4836897",
"0.48331428",
"0.48311198",
"0.48301405",
"0.483009",
"0.48191762",
"0.4817132",
"0.48152912",
"0.48124588",
"0.48113492",
"0.4810211",
"0.48000577",
"0.48000577",
"0.48000577",
"0.48000577",
"0.48000577",
"0.48000577",
"0.48000577",
"0.48000577",
"0.48000577",
"0.48000577"
] |
0.71412027
|
0
|
Turn on vpn for the current user Turns on vpn for the currently loggedin user.
|
def turn_on_current_user_vpn_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: VPNApi.turn_on_current_user_vpn ...'
end
# resource path
local_var_path = '/user/vpn'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['x_auth_token']
new_options = opts.merge(
:operation => :"VPNApi.turn_on_current_user_vpn",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: VPNApi#turn_on_current_user_vpn\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def turn_on_current_user_vpn(opts = {})\n turn_on_current_user_vpn_with_http_info(opts)\n nil\n end",
"def vip_user\n redirect_to(root_url) unless current_user.vip?\n end",
"def activate\n @user.activate! if @user.pending?\n redirect_to root_url\n end",
"def activate_user(user_id)\n post(\"/users/#{user_id}/activate\")\n end",
"def activate_user(user)\n user.status_id=0\n user.save\n end",
"def activate\n if @user.inactive? && @user.created_by_admin?\n if @user.is_regular? && @user.profile.penultimate_step_complete?\n @user.activate!\n @user.save_profinda_profile\n render json: { status: 'active' }\n elsif @user.is_external? && @user.profile.first_step_completed?\n @user.activate!\n render json: { status: 'active' }\n else\n render json: { status: 'user can\\'t be activate' }\n end\n else\n render json: { status: 'user is active' }\n end\n end",
"def set_user_tasking_mode_on\r\n if @current_user.facebook_user?\r\n @current_user.is_tasking = true\r\n @current_user.save(false)\r\n else\r\n @current_user.update_attribute(:is_tasking, true)\r\n end\r\n end",
"def activate!(user)\n return false if self.active?\n\n @user = user\n\n create_hook!\n\n self.active = true\n self.save!\n end",
"def vote_up(user_ip)\n if user_already_voted?(user_ip)\n false\n else\n if self.votes.create(:user_ip => user_ip)\n true\n else\n false\n end\n end\n end",
"def change_state!(_ctx, user:, **)\n role(user).activate!\n end",
"def impersonate!(user)\n self.class.start(controller, :user => user, :parent => self)\n end",
"def activate_if_invited\n invited_user = Invite.find_by_invited_user_email(self.email)\n if ! invited_user.nil?\n invited_user.update_attribute(:invited_user_id, self.id)\n self.account_active = 1\n self.save!\n end\n end",
"def user_onoff_flag\n @requested_user = User.find_by_account_number(params[:id])\n if @requested_user.is_active?\n @requested_user.update_columns(:is_active => false)\n redirect_to admin_index_path, :flash => {:notice => \"Requested user(#{@requested_user.first_name} #{@requested_user.last_name}) account successfully de-activated.\"}\n else\n @requested_user.update_columns(:is_active => true)\n redirect_to admin_index_path, :flash => {:notice => \"Requested user(#{@requested_user.first_name} #{@requested_user.last_name}) account successfully activated.\"}\n end\n end",
"def set_user\n\t\t@active = \"user\"\n\t\t@user = current_user\n\tend",
"def connect\n self.current_user = find_verified_user\n end",
"def connect\n self.current_user = find_verified_user\n end",
"def connect\n self.current_user = find_verified_user\n end",
"def connect\n self.current_user = find_verified_user # define current_user property once user sucessfully connected\n end",
"def enable\n user = User.find_by_username params[:username]\n raise ActiveRecord::RecordNotFound unless user\n\n command = EnableUserCommand.new(user, current_user, request.remote_ip)\n begin\n command.execute\n rescue => e\n flash['error'] = \"#{e}\"\n else\n flash['success'] = \"User #{user.username} enabled.\"\n ensure\n redirect_back fallback_location: user_url(user)\n end\n end",
"def switch_on(active_user, tag = nil)\n update(status: :active,current_user: active_user.id)\n mqtt_control_on\n socket_usage = SocketUsage.create!(user: active_user,\n el_socket: self, start_time: Time.now.utc,\n date: Date.today, start_tag: tag)\n\n active_user.last_usage = socket_usage.id\n active_user.save\n end",
"def approve_user\n # set the enabled flag to true for the user\n # send out approval notification\n end",
"def enable\n account = Account.for(\"github\").with_username(params[:id]).first!\n @user = User.unscoped.where(id: account.user_id).first\n authorize! @user\n @user.enabled = true\n @user.save\n redirect_back fallback_location: root_path, notice: t(\"user.enabled\", name: @user.username)\n end",
"def turn_on!\n set_power!(:on)\n end",
"def user_on\n session[:user_id] = '3980284084'\n end",
"def activate_account!\n update_attribute :is_active, true\n end",
"def show\n @user = current_user\n @user.assign_attributes online: true\n @user.save(validate: false)\n end",
"def change_state!(_ctx, user:, **)\n role(user).update!(state: 'active')\n end",
"def toggle_vote(user)\n if self.voting_allowed? then\n if !self.voted_on?(user)\n self.ratings.create(:user_id => user.id)\n else\n v = self.ratings.find_by_user_id(user.id)\n v.destroy\n end\n end\n end",
"def approve_user(user_id)\n post(\"/users/#{user_id}/approve\")\n end",
"def logging_in(id)\n guest_votes = Vote.where(gamer_id: guest_gamer.id)\n guest_votes.each do |vote|\n vote.gamer_id = id\n vote.save!\n end\n end",
"def activate\n current_user = params[:activation_code].blank? ? false : User.find_by_activation_code(params[:activation_code])\n if current_user && !user_signed_in? && !current_user.account_active?\n current_user.activate\n # current_user.save_ip(request.remote_ip)\n redirect_to new_user_session_path,:notice => \"Congratulations! Your account has now been activated!\"\n else\n redirect_to :root\n end\n end",
"def update_pip\n @user.on_pip = !@user.on_pip\n @user.save\n redirect_to show_user_path(@user)\n end",
"def activate\n @user = User.find(params[:id])\n @user.activate\n redirect_to :back\n end",
"def activate_user\n self.save\n self.send_user_notification_email\n end",
"def admin_approve_user\n @user.update(approved: true)\n redirect_to admin_path, notice: \"User Approved\"\n end",
"def connect\n self.user_id = find_verified_user\n end",
"def set_user_as_current_user\n @user = @current_user\n end",
"def up\n vote_status = $redis.hget(\"#{@instance_type}:#{@instance.id}:votes\", current_user.id).to_i\n same_vote = vote_status != 1\n \n if current_user.credit > Settings.vote_up_limit and current_user.vote_per_day > 0 and same_vote\n if vote_status == -1\n @instance.update_attribute(:votes_count, @instance.votes_count + 1)\n @instance.user.update_attribute(:credit, @instance.user.credit + Settings.vote_down)\n current_user.update_attribute(:credit, current_user.credit + Settings.answer_voter_down) if @instance_type == \"answer\"\n current_user.update_attribute(:vote_per_day, current_user.vote_per_day + 1)\n end\n $redis.hset(\"#{@instance_type}:#{@instance.id}:votes\", current_user.id, 1)\n @instance.update_attribute(:votes_count, @instance.votes_count + 1)\n \n case @instance_type\n when \"question\"\n @instance.user.update_attribute(:credit, @instance.user.credit + Settings.question_vote_up)\n when \"answer\"\n @instance.user.update_attribute(:credit, @instance.user.credit + Settings.answer_vote_up)\n end\n \n current_user.update_attribute(:vote_per_day, current_user.vote_per_day - 1)\n \n case @instance_type\n when \"question\"\n record = Vote.where(:user_id => current_user.id, :question_id => @instance.id).first\n if record\n record.update_attribute(:value, 1)\n else\n Vote.create(:user_id => current_user.id, :question_id => @instance.id, :value => 1)\n end\n when \"answer\"\n record = Vote.where(:user_id => current_user.id, :answer_id => @instance.id).first\n if record\n record.update_attribute(:value, 1)\n else\n Vote.create(:user_id => current_user.id, :answer_id => @instance.id, :value => 1)\n end\n end\n end\n end",
"def set_vip\n @vip = Vip.find(params[:id])\n end",
"def activate\n @user = User.find(params[:format])\n @user.update(:active_flag => true)\n flash[:info] = \"User Activated\"\n ## email user and line management to indicate the profile has been activated\n UserMailer.activated_user_email(@user).deliver\n redirect_to users_path\n end",
"def connect\n self.current_user = find_verified_user #efine the current_user property once a user successfully connected. Only then the identified_by line before will actually work.\n end",
"def change_is_enabled\n member = Member.find params[:id]\n user = User.find(member.user_id)\n Member.change_student_status(member)\n if member.is_enabled == true\n redirect_to users_url, :flash => { :success => \"#{user.first_name} #{user.last_name} has been enabled.\" }\n else\n redirect_to users_url, :flash => { :success => \"#{user.first_name} #{user.last_name} has been disabled.\" }\n end\n end",
"def approve!\n self.update_attribute(:status, ConfigCenter::User::APPROVED)\n end",
"def network_enable(vid)\n perform_request(action: 'vserver-network-enable', vserverid: vid)\n end",
"def activate\n user = User.find_by_token(params[:token])\n unless user.nil?\n unless user.activated?\n user.activate\n user.save\n #notify admins\n UserMailer.deliver_notify_admins_signup(User.admins, user)\n #login\n self.current_user = user\n flash[:notice] = 'Account successfuly activated.'\n redirect_to profile_path(user.login)\n else\n render :partial => '/sessions/already_activated', :layout => true\n end\n else\n render :text => '<strong>Invalid Request!</strong>', :layout => true\n end\n end",
"def voted\n\t\tcurrent_user = User.current_user\n\t\tunless current_user.blank?\n\t\t\tcurrent_user.voted?(self)\n\t\telse\n\t\t\tfalse\n\t\tend \n\tend",
"def activate\n @user = User.find(params[:id])\n @user.activate!\n\n UserMailer.delay({ run_at: 1.minutes.from_now }).user_activated(@user) \n\n respond_to do |format|\n format.html { redirect_to :users, notice: 'Пользователь успешно активирован.' }\n end\n end",
"def reactivate(user)\n if !user.account_active?\n user.reactivate!\n end\n end",
"def call(user)\n return unless user.invite_token\n invite = Invite.find_by_invite_token(user.invite_token)\n invite.update!(grader_id: user.id) if invite\n end",
"def poweron_vapp(vAppId)\n power_action(vAppId, 'powerOn')\n end",
"def turn_on\n self.class._start_session\n end",
"def switch_user\n volunteer = Volunteer.find(params[:volunteer_id].to_i)\n volunteer_region_ids = volunteer.regions.pluck(:id)\n admin_region_ids =\n current_volunteer.assignments.collect do |assignment|\n assignment.admin ? assignment.region.id : nil\n end.compact\n\n unless current_volunteer.super_admin? || (volunteer_region_ids & admin_region_ids).length > 0\n flash[:error] = \"You're not authorized to switch to that user!\"\n return redirect_to(root_path)\n end\n\n sign_out(current_volunteer)\n sign_in(volunteer)\n flash[:notice] = \"Successfully switched to user #{current_volunteer.name}.\"\n home\n end",
"def turn_off_current_user_vpn(opts = {})\n turn_off_current_user_vpn_with_http_info(opts)\n nil\n end",
"def started_viewing(user = nil, dont_notify: false)\n if user && !viewing?(user)\n Cache.set_add(viewing_cache_key, collaborator_json_stringified(user))\n end\n received_changes(num_viewers_changed: true) unless dont_notify\n end",
"def activate\r\n Marketplace::Database.instance.delete_deactivated_user(self)\r\n Marketplace::Database.instance.add_user(self)\r\n Marketplace::Activity.create(Activity.USER_REACTIVATE, self, \"#{self.name} has been reactivated\")\r\n end",
"def activate\n @this_user.update_attributes(:active => true)\n redirect_to :controller => 'user', :action => 'view', :display_name => params[:display_name]\n end",
"def on_online(m, user)\n user.send \"Hello #{m.user.nick}\"\n end",
"def vote_on\n if Vote.voteOn(params[:activity_id], params[:user_id], params[:rating])\n\t\t\t@activity = Activity.find(params[:activity_id])\n\t\t\t@activity.viewer = User.find_by_id(params[:user_id])\n render :json=>@activity\n end\n return :text=>'There was an error voting for this activity', :status=>:service_unavailable\n end",
"def upvote\n\t\t@pin.upvote_by current_user\n\t\tredirect_to :back\n\tend",
"def activate\n @membership.activate!\n @membership.generate_dues_invoice!\n _user = @membership.user\n _user.roles = [:member]\n _user.save\n flash[:success] = \"Successfully activated #{ @membership.user.full_name }\"\n redirect_to '/'\n end",
"def set_virtual_user\n @virtual_user = VirtualUser.find(params[:id])\n end",
"def record_login(user)\n self.current_site_visitor = GreenFlag::SiteVisitor.for_user!(user, current_site_visitor)\n end",
"def activate_first_user\n return if User.any?\n\n assign_attributes(\n confirmed_at: Time.current,\n point_of_contact: true\n )\n end",
"def activate_first_user\n return if User.any?\n\n assign_attributes(\n confirmed_at: Time.current,\n point_of_contact: true\n )\n end",
"def set_user\n logger.debug 'In set_user, session[:uid]=' + session[:uid].to_s\n logger.debug 'In set_user, params[:vk_id]' + params[:vk_id].to_s\n if !session[:uid].nil?\n logger.debug 'Searching for player with vk_id ' + session[:uid].to_s\n @user = User.find_by_vk_id session[:uid]\n elsif !params[:vk_id].nil?\n logger.debug 'Searching for player with vk_id ' + params[:vk_id].to_s\n @user = User.find_by_vk_id params[:vk_id]\n else\n logger.error 'User is not logged in'\n end\n end",
"def propose\n response = CoachClient::Request.put(url, username: @user1.username,\n password: @user1.password,\n payload: payload,\n content_type: :xml)\n unless response.code == 200 || response.code == 201\n fail CoachClient::NotProposed.new(self), 'Could not propose partnership'\n end\n set_user_confirmed(response.to_h)\n self\n end",
"def change\n @user = current_user\n end",
"def turn_networkmode_on\n # Create and login mobile user\n user = log_mobile_user_in\n \n # Update mobile preferences\n find(\".cog\").click\n page.should have_select('network_mode', :selected => 'Off') # network_mode == off\n select(\"On\", :from => \"network_mode\") # network_mode == on\n fill_in \"signature\", :with => \"this is my awesome intro\" # modify signature\n click_button \"start networking\" # save changes\n\n # Ensure that this worked\n find(\".cog\").click\n page.should have_select('network_mode', :selected => 'On') # network_mode == on\n page.should have_content(\"this is my awesome intro\") # new signature\n find('#counter').should have_content('0') # contact counter == 0\n\n return user\n end",
"def set_current_user\n Member.current = current_user unless current_user.nil?\n end",
"def upvote_for(user)\n return unless vote_weight_for_user(user) < 1\n vote_for(user, 1)\n end",
"def set_current_user\n @user = current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def set_current_user\n @user = current_user\n end",
"def activate\n user = User.find_by_username params[:username]\n if user && user.activation == params[:activation]\n user.activation = \"ACTIVATION_ACTIVE\"\n user.save()\n render status: 200, json: {error: false}\n else\n render status: 403, json: {error: true}\n end\n end",
"def set_xp_user\n @xp_user = XpUser.find(params[:id])\n end",
"def update_current_user(user)\n @current_user = user\n @current_user\n end",
"def approve_user\n @user = User.find(params[:id])\n\n @user.approved_torcida = true\n @user.save(validate: false)\n redirect_to root_path\n end",
"def set_public_network(vm_name, vm_config, ip) \n \n require_string(vm_name)\n require_vagrant_config(vm_config)\n\n if ip.to_s.empty?\n log_info(\" - skipping public network ip setup\") \n return\n else \n log_info(\" - public network: ip: #{ip}\") \n end\n\n vm_config.vm.network :public_network, ip: ip\n end",
"def current_vk_user\n @current_vk_user ||= fetch_current_vk_user\n end",
"def switch_user(user_id_to_switch)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'userIdToSwitch', user_id_to_switch)\n\t\t\tclient.queue_service_action_call('session', 'switchUser', 'KalturaLoginSession', 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 update_current_user_points\n current_user.update_attributes(:points => User.update_points(current_user.id))\n end",
"def is_require_accepting_user_to_match_invited_user_enabled=(value)\n @is_require_accepting_user_to_match_invited_user_enabled = value\n end",
"def impersonate\n impersonate_user(@user)\n redirect_to root_url\n end",
"def set_current_user\n User.current = current_user\n end",
"def upvote\n @pin.upvote_by current_user\n redirect_to :back, notice: 'Pin was upvoted!'\n # redirect_to request.referer || root_path, notice:'Link upvoted!'\n end",
"def upvote(current_user)\n if current_user && current_user.voted_up_on?(self)\n self.unliked_by current_user\n else\n self.liked_by current_user\n end\n end",
"def update_current_user(user)\n @current_user = user if user\n end",
"def set_user\n @user = current_user \n end",
"def enable_otp\n current_user.otp_secret = User.generate_otp_secret\n current_user.otp_required_for_login = true\n current_user.save!\n redirect_back(fallback_location: '/')\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = current_user\n end"
] |
[
"0.71401227",
"0.6372117",
"0.5737986",
"0.55936664",
"0.5555818",
"0.5535226",
"0.5520048",
"0.5512347",
"0.5454351",
"0.54221505",
"0.5414128",
"0.53955466",
"0.5384912",
"0.5373507",
"0.5319554",
"0.5319554",
"0.5319554",
"0.5309335",
"0.5292948",
"0.5282744",
"0.5257364",
"0.52555245",
"0.52316946",
"0.52289504",
"0.5219608",
"0.5215999",
"0.51947874",
"0.5177054",
"0.5155655",
"0.5148068",
"0.513656",
"0.51354086",
"0.51286465",
"0.5104995",
"0.50829625",
"0.50773126",
"0.5077121",
"0.5074099",
"0.50693226",
"0.50566435",
"0.50497234",
"0.50363535",
"0.5035952",
"0.50124884",
"0.50086087",
"0.5003833",
"0.49910006",
"0.49814063",
"0.49733707",
"0.49718067",
"0.49619004",
"0.49572295",
"0.49486762",
"0.49476108",
"0.49246144",
"0.49197388",
"0.49098977",
"0.49079615",
"0.490733",
"0.4905424",
"0.4903648",
"0.49010247",
"0.48919392",
"0.48919392",
"0.48855615",
"0.48828593",
"0.4881483",
"0.48810288",
"0.48746082",
"0.4871692",
"0.48640925",
"0.48640925",
"0.48640925",
"0.48640925",
"0.4863035",
"0.48602092",
"0.4859361",
"0.48388278",
"0.4838291",
"0.48365495",
"0.48333666",
"0.48307458",
"0.48294708",
"0.4829243",
"0.4819392",
"0.4817426",
"0.48160708",
"0.4813138",
"0.48110357",
"0.48087814",
"0.479949",
"0.479949",
"0.479949",
"0.479949",
"0.479949",
"0.479949",
"0.479949",
"0.479949",
"0.479949",
"0.479949"
] |
0.5937526
|
2
|
Resets state of line inspection.
|
def reset
@block_type = nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def reset\n @p = 0\n @line = 1\n @char_position_in_line = 0\n @mark_depth = 0\n end",
"def reset()\n raise NotImplementedError\n @lineno = 1\n\t\t@line_offset = 0\n @token_pos = 0\n end",
"def reset\n @line_no, @last_lexeme = 0, [\"\\n\"]\n super\n end",
"def reset!\n @cursor = cursor.reset!\n\n @lines = defaults[:data]\n\n refresh\n end",
"def reset(view)\n # This variable keeps track of which point we are currently getting\n @state = 0\n @x1=0\n @x2=0\n @y1=0\n @y2=0\n\n # Display a prompt on the status bar\n Sketchup::set_status_text((\"Draw cut line through geometry. CTRL=Cut Nested Geometry\"), SB_PROMPT)\n\n # clear the InputPoints\n @ip1.clear\n @ip2.clear\n\n if view\n view.tooltip = nil\n view.invalidate if @drawn\n end\n @drawn = false\n @dragging = false\n end",
"def clear_line\n CLEAR_LINE\n end",
"def reset\n @last_eval_line = nil\n @process_queue.clear\n end",
"def reset\n @registry = {}\n @logging = false\n @line_item_limit = 1000\n end",
"def clear\n @lines.clear\n end",
"def reset_state\n @state = nil\n end",
"def reset()\n @x\n \n end",
"def reset\n @state = :entry\n end",
"def reset\n dup.reset!\n end",
"def reset\n @rows = nil\n end",
"def clear_line_items\n @line_items = []\n end",
"def reset_states\n #called by return to clear internal block stack\n callchain.each do |c|\n c.instance_exec do\n # go to the front of the line!\n @command_block = @previous_command_blocks.first || @command_block\n @previous_command_blocks = []\n @current_state = nil\n end\n end\n nil\n end",
"def reset(view)\n # This variable keeps track of which point we are currently getting\n @state = 0\n\n # Display a prompt on the status bar\n Sketchup::set_status_text($exStrings.GetString(\"Select first end\"), SB_PROMPT)\n\n # clear the InputPoints\n @ip1.clear\n @ip2.clear\n\n if( view )\n view.tooltip = nil\n view.invalidate if @drawn\n end\n\n @drawn = false\n @dragging = false\n end",
"def reset() end",
"def reset_reading\n @line_temp = {\n reading: false,\n from: nil,\n to: nil,\n lines: []\n }\n end",
"def reset!\n end",
"def reset!\n end",
"def reset\n end",
"def reset\n end",
"def reset(view)\n # This variable keeps track of which point we are currently getting\n @state = 0\n \n # Display a prompt on the status bar\n Sketchup::set_status_text($exStrings.GetString(\"Select first end\"), SB_PROMPT)\n \n # clear the InputPoints\n @ip1.clear\n @ip2.clear\n \n if( view )\n view.tooltip = nil\n view.invalidate if @drawn\n end\n \n @drawn = false\n @dragging = false\nend",
"def reset(view)\n # This variable keeps track of which point we are currently getting\n @state = 0\n \n # Display a prompt on the status bar\n Sketchup::set_status_text(\"Select Stretch Start Point\", SB_PROMPT)\n \n # clear the InputPoints\n @ip1.clear\n @ip2.clear\n \n if( view )\n view.tooltip = nil\n view.invalidate if @drawn\n end\n \n @drawn = false\n @dragging = false\n \tSketchup.active_model.commit_operation\n \tif @initial_comp_selected == false \n \t\tSketchup.active_model.selection.clear()\n \t\t@ci = nil\n \tend\t\n end",
"def do_reset\n\t\t\n\t\t\t# Mark state as reset\n\t\t\t@reset = true\n\t\t\t\n\t\t\t# Revert text and palette\n\t\t\tself.text = nil \n\t\t\tself.palette = @palette_normal\t\t\t\n\t\tend",
"def reset\n # Empty, but subclasses will override this.\n end",
"def reset\n end",
"def reset\n end",
"def reset\n end",
"def reset\n end",
"def reset()\n #This is a stub, used for indexing\n end",
"def reset()\n #This is a stub, used for indexing\n end",
"def reset()\n end",
"def reset_visit_state\n @maze = @maze.map do |line|\n line.sub('V', '_')\n end\n end",
"def reset ; end",
"def resets; end",
"def reset!; end",
"def reset!; end",
"def reset!; end",
"def reset!; end",
"def reset\n @deepest_cause = nil\n @label_pos = -1\n end",
"def reset\n set InitialPosition\n end",
"def clear\n trace.elegibility.transform_values { |_| 0 }\n trace.extended.each_value do |ext|\n ext.transform_values { |_| 0 }\n end\n\n error.responsibility = error.projected = error.gated = 0\n end",
"def reset\n clear\n @position = 0\n @current_index = 0\n end",
"def reset\n timeline.clear\n end",
"def refresh(lines)\n @prompt.clear_lines(lines) +\n @prompt.cursor.clear_screen_down\n end",
"def reset()\n \n end",
"def reset\n # TODO\n end",
"def reset\n self\n end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset; end",
"def reset\n @pc_x = 0\n @pc_y = 0\n @step_no = 0\n @dir = RIGHT\n # The stack is an INTEGER stack. Any characters are pushed as their ASCII value\n @stack = Stack.new\n @stringmode = false\n @running = true\n end",
"def reset!\n #binding.pry\n @cells = Array.new(9, \" \")\n end",
"def clear\n # clear the lineage\n @lineage.clear\n # if the visited hash is not shared, then clear it\n @visited.clear unless @options.has_key?(:visited)\n end",
"def reset\n\n end",
"def reset\n @current = nil\n @pos = 0\n end",
"def reset\n end",
"def reset\n end",
"def reset\n\n end",
"def reset(view)\n## puts \"reset called\" \n @state = 0 \n ## clear the InputPoints\n @ip1.clear\n @ip2.clear\n @ip.clear\n\n if( view )\n view.tooltip = nil\n view.refresh if @drawn\n end\n\n @drawn = false\n @dragging = false\n end",
"def reset\n each(&:reset)\n self\n end",
"def reset!\n @path_stack = []\n @stack = []\n @stacks = Hash.new { |hsh, k| hsh[k] = Stack.new }\n @text = nil\n end",
"def clearState()\n\t\t\t@_previous_state = @_state\n\t\t\t@_state = nil\n\t\tend",
"def reset\n raise \"Not implemented\"\n end",
"def reset!\n @blocks = []\n @single_block = []\n end",
"def reset\n @blocks = @original_blocks\n end",
"def restore_state\n unless @state_stack.empty?\n state = @state_stack.pop\n @current_fill_color = state.fill_color\n @current_stroke_color = state.stroke_color\n @current_text_render_style = state.text_render_style\n @current_stroke_style = state.stroke_style\n stroke_style!\n end\n add_content(\"\\nQ\")\n end",
"def reset()\r\n\t\t@time.reset\r\n\t\t@penalty.reset\r\n\t\t@usedHelp = 0\r\n\t\t@numberOfStars = 0\r\n\t\t@isFinished = false\r\n\t\t@nbClick = 0\r\n\t\treturn self\r\n\tend",
"def interpreter_reset\r\n @data_stack = Array.new\r\n @ctrl_stack = Array.new\r\n @start_time = Time.now\r\n end",
"def reset\n @offset = 0\n end",
"def rl_maybe_unsave_line()\r\n if (@_rl_saved_line_for_history)\r\n # Can't call with `1' because rl_undo_list might point to an undo\r\n # list from a history entry, as in rl_replace_from_history() below.\r\n rl_replace_line(@_rl_saved_line_for_history.line, false)\r\n @rl_undo_list = @_rl_saved_line_for_history.data\r\n @_rl_saved_line_for_history = nil\r\n @rl_point = @rl_end # rl_replace_line sets rl_end\r\n else\r\n rl_ding()\r\n end\r\n 0\r\n end",
"def reset!\n @x = @init_x\n @y = @init_y\n end",
"def reset!\n self.command = :reset\n end",
"def reset\n \n end",
"def reset\n @equations = nil\n @results = nil\n end",
"def reset!\n executions.reset\n end",
"def reset\n @hand = []\n @value = nil\n @status = \"unfinished\"\n end",
"def reset\n @grid.reset_pulses\n end",
"def reset\n\t\tend",
"def empty!\n @line_items = []\n end",
"def reset\n getok 'RSET'\n end",
"def reset\n API.finalize( @vm )\n commence\n @eof = false\n end",
"def reset\n @sets = {}\n self\n end",
"def clear_line; print \"\\e[2K\" end"
] |
[
"0.699162",
"0.67800814",
"0.6779406",
"0.67112875",
"0.67058814",
"0.6602612",
"0.64711004",
"0.6467084",
"0.6465414",
"0.64157337",
"0.63423526",
"0.6337497",
"0.63093483",
"0.6307712",
"0.6302177",
"0.6296336",
"0.62727237",
"0.6235075",
"0.62163764",
"0.6158546",
"0.6158546",
"0.6157831",
"0.6157831",
"0.6134879",
"0.61071736",
"0.61015254",
"0.60912865",
"0.60836506",
"0.60836506",
"0.60836506",
"0.60836506",
"0.6083133",
"0.6083133",
"0.60802406",
"0.6073025",
"0.60700953",
"0.60681796",
"0.60677105",
"0.60677105",
"0.60677105",
"0.60677105",
"0.6065816",
"0.6056168",
"0.6056026",
"0.6046587",
"0.6044707",
"0.60410166",
"0.6037077",
"0.603299",
"0.60238475",
"0.6004878",
"0.6004878",
"0.6004878",
"0.6004878",
"0.6004878",
"0.6004878",
"0.6004878",
"0.6004878",
"0.6004878",
"0.6004878",
"0.6004878",
"0.6004878",
"0.6004878",
"0.6004878",
"0.6004878",
"0.6004878",
"0.6004878",
"0.6004878",
"0.6003484",
"0.59974265",
"0.59940624",
"0.59898895",
"0.59897006",
"0.59851605",
"0.59851605",
"0.59843487",
"0.59623444",
"0.5954935",
"0.5927073",
"0.5918324",
"0.5913453",
"0.5894976",
"0.58933324",
"0.58914816",
"0.5891017",
"0.5887479",
"0.5883136",
"0.5874578",
"0.5862836",
"0.5852605",
"0.5837678",
"0.5825574",
"0.58209074",
"0.58193636",
"0.58152676",
"0.5809696",
"0.58089495",
"0.5808449",
"0.58049566",
"0.5802503",
"0.57995856"
] |
0.0
|
-1
|
Returns the handler's current type.
|
def current_type
@block_type
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def current_type\n @type\n end",
"def current_handler\n @current_handler || @default_handler\n end",
"def type; Common.type(@handle); end",
"def type\n self.class.type\n end",
"def type\n self.class.type\n end",
"def type\n self.class.type\n end",
"def type\n @type ||= self.class.name.split('::').last\n end",
"def type\n self.class.type\n end",
"def type\n self.class.type\n end",
"def type\n self.class.type\n end",
"def type\n self_class.to_s.to_sym\n end",
"def _type\n self.class.to_s\n end",
"def type\n self.class\n end",
"def type\n return @type\n end",
"def type\n self.class::TYPE\n end",
"def type\n types.first\n end",
"def type\n types.first\n end",
"def type\n\t\tself.class.type\n\tend",
"def type\n\t\tself.class.type\n\tend",
"def handler_base_class; end",
"def type\n return @type\n end",
"def type\n return @type\n end",
"def type\n return @type\n end",
"def type\n return @type\n end",
"def type\n return @type\n end",
"def type\n return @type\n end",
"def type\n return @type\n end",
"def type\n self.class.type\n end",
"def type\n self.class.type\n end",
"def type\n self.class.type\n end",
"def type\n TYPES[@type_id]\n end",
"def handler\n @handler ||= Type.for(type).new(type_options)\n rescue StandardError => ex\n raise ex, \"#{name}: #{ex.message}\"\n end",
"def type\n return @type if @type != \"unknown\"\n info\n @type\n end",
"def type\n self.class.name.split(':').last.downcase\n end",
"def get_type()\n res = super(context,self)\n return res\n end",
"def type\n self.class.type(self)\n end",
"def type\n @type\n end",
"def type\n @type\n end",
"def type\n @type\n end",
"def type\n @type\n end",
"def for(type_name)\n raise NameError, \"No handler for type #{type_name}\" unless types[type_name]\n types[type_name]\n end",
"def type\n _type\n end",
"def type\n @type.name\n end",
"def type\n object.class.name\n end",
"def type\n object.class.name\n end",
"def type\n object.class.name\n end",
"def current_type\n @token_type[@current_tok]\n end",
"def type\n _type rescue nil\n end",
"def current\n send current_type\n end",
"def type\n self.class.to_s.split('::').last.downcase.to_sym\n end",
"def type\n @type\n end",
"def type; self._type; end",
"def type\n return @type if defined? @type\n\n @type = self.to_s.gsub(/.*::/, '')\n end",
"def type\n return @type if defined? @type\n @type = self.to_s.gsub(/.*::/, '')\n end",
"def get_type\n\n end",
"def type\n self[:type]\n end",
"def type; self.class.name.split('::').last.to_sym; end",
"def type\n self.class.class_name.downcase\n end",
"def type\n @type\n end",
"def type\n self[:type]\n end",
"def type\n @@type\n end",
"def type\n @@type\n end",
"def type\n self['type']\n end",
"def type_value\n master_class.base_class.name if polymorphic_type\n end",
"def type\n trigger.first\n end",
"def context_type\n self.class.name.to_s\n end",
"def type\n obj_name = self.class.name.split('::').last\n obj_name.gsub!(/Object$/, '')\n obj_name.downcase!\n obj_name.to_sym\n end",
"def type\n _type.split(\"::\").last.downcase\n end",
"def receiver_type\n @callable.self_type\n end",
"def type\n memoized_info[:type]\n end",
"def type\n @type ||= \"#{as}_type\" if polymorphic?\n end",
"def type\n t = get(TYPE)\n\n raise \"binding codes not contain a type\" if t.nil?\n\n t\n end",
"def type\n self.class.name.downcase\n end",
"def handler_name\n module_info['HandlerName']\n end",
"def type_name\n self.class.name.split('::').last.upcase\n end",
"def type\n klass = self.class.name\n if sep = klass.rindex('::')\n klass[(sep+2)..-1]\n else\n klass\n end.underscore.to_sym\n end",
"def type\n if @type.is_a?(Proc)\n # lazy-eval it\n @type = @type.call\n end\n @type\n end",
"def type\n @type.to_s\n end",
"def model_type\n self.class.name[/(.*)Controller/,1].singularize.constantize\n end",
"def model_type\n self.class.name[/(.*)Controller/,1].singularize.constantize\n end",
"def get_type(item)\n \t\t\treturn item.class.name.split(\":\").last\n \t\tend",
"def get_class()\n l = get_type()\n #puts \"Type #{l.class} in #{self.class} , #{self}\"\n l.object_class()\n end",
"def get_class()\n l = get_type()\n #puts \"Type #{l.class} in #{self.class} , #{self}\"\n l.object_class()\n end",
"def type\n @type ||= @method[(@method.rindex('/') + 1)..-1]\n end",
"def type\n munson.type\n end",
"def type_name\n self['type_name']\n end",
"def type\n `#@native.nodeName`.downcase\n end",
"def type\n @payload['type']\n end",
"def find_handler_class location\n @@archive_handlers.each do |h|\n return h if h.handles?(location)\n end\n return nil\n end",
"def type\n self.class.name.split(/#{NSEP}/).last.gsub(/Object$/, '').downcase.to_sym\n end",
"def type\n @type || @document.root.attributes[\"type\"] || @document.root.name\n end",
"def type\n\t\t@type\n\tend",
"def target_type\n RssLog.all_types.each do |type|\n return type.to_sym if send(\"#{type}_id\".to_sym)\n end\n nil\n end",
"def target_type\n return @target_type\n end",
"def type\n @type ||= IDS_TYPES[type_id]\n end",
"def type\n @type ||= calculate_type\n end",
"def type\n read_attr :type, :to_sym\n end",
"def type\n `if (#{@type} !== #{nil}) return #{@type};\n var match, type = #{self}.__event__.type;\n if (match = type.match(/^(mouse|key|touch)(.*)$/)) {\n type = match[1] + \"_\" + match[2];\n }\n return #{@type = `#{self}.Y(type)`};`\n end",
"def klass\n class_name = self[\"_type\"]\n class_name ? class_name.constantize : nil\n end",
"def type\n self.attributes[:type]\n end"
] |
[
"0.7365137",
"0.7020336",
"0.6899231",
"0.68119264",
"0.68119264",
"0.68119264",
"0.67949414",
"0.67746633",
"0.67746633",
"0.67746633",
"0.6773439",
"0.6723491",
"0.6718016",
"0.66653603",
"0.66577977",
"0.6641242",
"0.6638806",
"0.6631179",
"0.6631179",
"0.66249025",
"0.661871",
"0.661871",
"0.661871",
"0.661871",
"0.661871",
"0.661871",
"0.661871",
"0.65968907",
"0.65968907",
"0.65968907",
"0.65617156",
"0.6550446",
"0.65471137",
"0.65464175",
"0.6545595",
"0.6537433",
"0.65268916",
"0.65259063",
"0.65259063",
"0.65259063",
"0.6509248",
"0.6507061",
"0.65010786",
"0.6483011",
"0.64810044",
"0.64810044",
"0.6475183",
"0.64674026",
"0.64606977",
"0.645764",
"0.645721",
"0.64469105",
"0.6441166",
"0.6440786",
"0.6413825",
"0.6413197",
"0.639858",
"0.63651776",
"0.63528895",
"0.63375235",
"0.6315021",
"0.6315021",
"0.6269969",
"0.6262456",
"0.6247119",
"0.6231616",
"0.6206649",
"0.61911225",
"0.6169172",
"0.6139494",
"0.6123768",
"0.6103338",
"0.61013514",
"0.6098796",
"0.6095674",
"0.60811925",
"0.6050059",
"0.60378337",
"0.6036925",
"0.6036925",
"0.6026918",
"0.6011968",
"0.6011968",
"0.60059935",
"0.6002509",
"0.60016364",
"0.5994364",
"0.59792227",
"0.59779286",
"0.5974138",
"0.5972682",
"0.5966916",
"0.5962011",
"0.5957968",
"0.5957712",
"0.59575605",
"0.59512216",
"0.59417826",
"0.5928905",
"0.59256846"
] |
0.63673043
|
57
|
Useful for pipeline chains in the form `blockmacroblock`. This checks if the current block handler/type is equivalent to the block that's being pipelined.
|
def equal?(handler, type)
false
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def block?\n !!block\n end",
"def is_block?\n get_metadata(:for_block)\n end",
"def block_is_type?(block)\n is_type? || (block && eval('defined?(__in_erb_template)', block.binding))\n end",
"def block_is_haml?(block)\n eval('_hamlout', block.binding)\n true\n rescue\n false\n end",
"def block_pass?\n block? && block.kind_of?(Rubinius::AST::BlockPass19)\n end",
"def block_valid?(block)\n # ...\n end",
"def pipelining?\n pipeline\n end",
"def code_block?\n @code_block\n end",
"def block_is_template?(block) \n block && (erb_block?(block) || \n (self.respond_to?(:block_is_haml?) && block_is_haml?(block)))\n end",
"def block_is_template?(block) \n block && (block_is_erb?(block) || (self.respond_to?(:block_is_haml?) && block_is_haml?(block)))\n end",
"def block?\n block_tag? || block_body? || document?\n end",
"def block_is_template?(block)\n block && (block_is_erb?(block) || (self.respond_to?(:block_is_haml?) && block_is_haml?(block)))\n end",
"def block_body?\n @value.is_a?(Liquid::BlockBody)\n end",
"def is_cms_block?\n %w(page field collection).member?(self.class.to_s.demodulize.underscore.split(/_/).first)\n end",
"def iterating_block?(node); end",
"def blocks?\n !@blocks.empty?\n end",
"def block_checker\n block_given?\nend",
"def is_block_processed?(hash)\n # we try to reprocess orphans\n Toshi::Models::Block.where(hsh: hash).exclude(branch: Toshi::Models::Block::ORPHAN_BRANCH).any?\n end",
"def block_is_template?(_)\n false\n end",
"def candidate_block(block)\n return unless (my_index = block.parent.blocks.find_index block)\n\n next_block = block.parent.blocks[my_index + 1]\n return unless next_block && next_block.context == :pass\n\n next_block\n end",
"def verify_block(&blk)\n begin\n return true if yield\n rescue\n false\n end\n end",
"def last_block?\n return @last_block\n end",
"def matches?\n return @block.call(@actual) if @block\n\n false\n end",
"def pipelining?\n !!@pipelining\n end",
"def is(&block)\n [:is, block]\n end",
"def is(&block)\n [:is, block]\n end",
"def engine_matches?(block)\n block.binding.eval('defined? __in_erb_template')\n end",
"def mix?(mode = nil)\n # Check if different from mode block if any.\n return true if mode && self.type != mode\n # No difference with the upper block, maybe there is one within.\n # Check each statement.\n self.each_statement.any? { |stmt| stmnt.mix?(mode) }\n end",
"def contested?(block_number)\n @block_stacks[block_number].count > 1\n end",
"def block_given?() end",
"def lambda?\n block_literal? && method?(:lambda)\n end",
"def block_is_erb?(block)\n has_erb_buffer? || block && eval('defined? __in_erb_template', block)\n end",
"def is_block?(pnl)\n x = pnl[0]\n y = pnl[1]\n empty?([x, y]) && empty?([x+1, y]) && empty?([x, y+1]) && empty?([x+1, y+1])\n end",
"def were_we_given_a_block?\n\tif block_given?\n\t\t\"WE GOT A BLOCK\"\n\telse\n\t\t\"WE DIDN'T GET A BLOCK\"\n\tend\nend",
"def block_normalize\n return @block_opts_stack.last[\"normalize\"] == \"yes\"\n end",
"def next_block_will_be_binary\n @block_arity = 2\n end",
"def same_line_bracket_block?(result, iter, call_sexp)\n call_sexp.shift # discard the sexp_type, as the processor would\n syntactic = !Call.new(processor).arguments?(call_sexp) || iter.end_with?(\")\")\n stylistic = result !~ /\\n/ && result.size < LINE_LENGTH\n syntactic && stylistic\n end",
"def has_block(name)\n @blocks.key?(name.to_s)\n end",
"def block?; end",
"def iterating_block?(node)\n name = block_method_name(node)\n name && iterating_method?(name)\n end",
"def raise_if_block(obj, name, has_block, type)\n return unless has_block\n\n puts \"Type passed in: #{type}\"\n puts \"#{obj.class}##{name} does not accept blocks\"\n\n raise Appom::UnsupportedBlockError\n end",
"def block\n true\n end",
"def is_platform_block?(key)\n raise 'No key given'.red unless key\n\n return false if (self.runner.blocks[nil][key.to_sym] rescue false)\n return true if self.runner.blocks[key.to_sym].kind_of?Hash\n\n raise \"Could not find '#{key}'. Available lanes: #{self.runner.available_lanes.join(', ')}\".red\n end",
"def call_block?\n raise \"called\"\n return false unless codes.last.is_a?(CallInstruction)\n return false unless codes.last.opcode == :call\n codes.dup.reverse.find{ |c| c.is_a? StackInstruction }\n end",
"def has_block(blk_hash)\n raise \"Not implemented\"\n end",
"def knows_block(blockhash)\n return true if @chain.include?(blockhash)\n @block_queue.queue.any? {|(block, proto)| block.header.full_hash == blockhash }\n end",
"def applies_to?(&block)\n @applies_to_proc = block\n end",
"def process_complex_block_opener(tk)\n return unless OPEN_BLOCK_TOKENS.include?(tk.class)\n\n @current_block = tk.class\n @state = :block_statement\n\n true\n end",
"def supports_block_expectations?\n true\n end",
"def process_block(block, raise_errors=false, current_time=nil)\n result = false\n Toshi::Utils.synchronized(Toshi::Lock::PROCESS_BLOCK) do\n @output_cache.flush\n @storage.current_block = nil\n accepted_parents = []\n begin\n result = process_block_internal(block, raise_errors, current_time)\n if result && @storage.is_block_valid?(block.hash)\n # this block is a valid parent\n accepted_parents = [ block.hash ]\n end\n if !result\n logger.debug {\"process_block_internal false for block: #{block.hash}\"}\n end\n rescue ValidationError\n @storage.current_block = nil\n raise if raise_errors\n return result\n end\n\n # consume the array of parents from beginning to the end.\n while accepted_parent_hash = accepted_parents.shift\n # Try to accept the orphan and remove it from the database.\n @storage.orphan_blocks_with_parent(accepted_parent_hash).each do |orphan|\n accepted_parents += accept_orphan(orphan)\n end\n end # end checking orphans recursively.\n\n @storage.current_block = nil\n\n end # synchronized\n result\n end",
"def at_block_delimiter? line\n @block_delimiters.each do |delimiter, name|\n if delimiter.is_a? Proc\n if delimiter.call(line)\n return name\n end\n else\n if line.match(delimiter)\n return name\n end\n end\n end\n false\n end",
"def what_i_am(&block)\n\t\tblock.class\n\tend",
"def matches?(block)\n old_to = @stream.dup\n\n # Obtain a filehandle to replace (works with Readline)\n @stream.reopen File.open(File.join(Dir.tmpdir, \"should_output_#{$$}\"), \"w+\")\n\n # Execute\n block.call\n\n # Restore\n out = @stream.dup\n @stream.reopen old_to\n\n # Grab the data\n out.rewind\n @data = out.read\n\n # Match up\n case @expected\n when Regexp\n @data.should =~ @expected\n else\n @data.should == @expected\n end\n\n # Clean up\n ensure\n out.close if out and !out.closed?\n\n # STDIO redirection will break else\n begin\n @stream.seek 0, IO::SEEK_END\n rescue Errno::ESPIPE, Errno::EPIPE\n # Ignore\n end\n\n FileUtils.rm out.path if out\n end",
"def current_type\n\t\t@block_type\n\tend",
"def next_is? &block\n last? ? nil : yield(element, self.next)\n end",
"def block_proc(&block)\n block.class\nend",
"def chain?\r\n @chain\r\n end",
"def blockPresent(stage)\n\tmap = stage[0]\n\tlocation = stage[1]\n\tdirection = stage[2]\n\thasBlock = stage[3]\n\tif hasBlock == false\n\t\tcase direction\n\t\twhen 0\n\t\t\tif location < map.length-1 && map[location+1][0] == map[location][0]+1 && map[location+1][1] > 0\n\t\t\t\treturn true\n\t\t\tend\n\t\twhen 1\n\t\t\tif location > 0 && map[location-1][0] == map[location][0]+1 && map[location-1][1] > 0\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\telsif hasBlock == true\n\t\tcase direction\n\t\twhen 0\n\t\t\tif location < map.length-1 && map[location+1][0] <= map[location][0]+1\n\t\t\t\treturn true\n\t\t\tend\n\t\twhen 1\n\t\t\tif location > 0 && map[location-1][0] <= map[location][0]+1\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\tend\n\treturn false\nend",
"def check_block name\n raise \"No such block: #{name}\" unless @source.key? name\n end",
"def colliding?(block)\n x2 > block.x1 &&\n x1 < block.x2 &&\n y2 > block.y1 &&\n y1 < block.y2 &&\n z2 > block.z1 &&\n z1 < block.z2\n end",
"def for?\n block.kind_of?(Rubinius::AST::For19)\n end",
"def is_block_valid?(hash)\n if @block_index.block_header_in_index?(hash)\n return true\n end\n !Toshi::Models::Block.main_or_side_branch.where(hsh: hash).empty?\n end",
"def block_it?(tp)\n if @cond.track_params\n return true if negative_check(tp)\n if positives_check(tp)\n return !tp.binding.eval('local_variables').any? do |v|\n tp.binding.local_variable_get(v).object_id == @cond.track_params\n end\n end\n else\n return true if negative_check(tp)\n return false if positives_check(tp)\n end\n true # default is blocked the tp\n end",
"def captured_by_block?; end",
"def block_valid?(args = {})\n block = Block.find_by(id: args[:block_id])\n previous_block = block.previous_block\n neighbor_blocks_valid?(block, previous_block)\n end",
"def stabby_lambda?\n target.type.equal?(:lambda)\n end",
"def block\n blockable.blocks.detect{|b| b.identifier == self.identifier.to_s} || \n blockable.blocks.build(:identifier => self.identifier.to_s)\n end",
"def block_checker(param) \n [ param , block_given? ]\nend",
"def check_block\n finished = @finishable.nil? or @finishable.is_finished?\n puts finished\n if finished\n @finishable, @blocked = nil, false\n return @blocked\n end\n \n @blocked = !finished\n end",
"def block_tile?\n BLOCK_SIZES.has_key?(kind)\n end",
"def defined?(name)\n !blocks[name].nil?\n end",
"def xhtml_block?(method, arguments); end",
"def pipe?() end",
"def handle_block(block_info) # :nodoc:\n if block_info.type == CONTROL_BLOCK\n read_control_block\n elsif block_info.type == DATA_BLOCK\n if !declared_stream?(block_info.index)\n Pocolog.warn \"found data block for stream #{block_info.index} but this stream has never been declared, seems Logfile is Corrupted. Skipping...\"\n end\n elsif block_info.type == STREAM_BLOCK\n read_stream_declaration\n end\n block_info.type\n end",
"def nested_handle?(context)\n (handle?(context.description) || nested_handle?(context.parent)) if context.respond_to?(:description)\n end",
"def before_block_boundary?; end",
"def infeasible_block?(block, context = Context.empty)\n dict = @infeasible[block]\n return false unless dict\n dict[Context.empty] || (! context.empty? && dict[context])\n end",
"def i_check_if_block\n if block_given?\n yield\n else\n puts \"no block\"\n end\nend",
"def primitive?\n Proc === @body\n end",
"def expression_or_block(sexp)\n if block?(sexp)\n handle_block(sexp)\n else\n sexp\n end\n end",
"def after?(prev_block)\n (index - prev_block.index) == 1 && prev_block.time <= time && prev_block.hash == prev_hash\n end",
"def defined?(name)\n !blocks[name.to_sym].nil?\n end",
"def check_block_id(block_id)\n return @block_id == block_id\n end",
"def process_simple_block_opener(tk)\n return unless [TkLBRACE, TkDO, TkBEGIN, TkELSE].include?(tk.class) &&\n # Make sure hashes are parsed as hashes, not as blocks\n (@last_ns_tk.nil? || @last_ns_tk.lex_state != EXPR_BEG)\n\n @level += 1\n @state = :block\n @block_num += 1\n if @block.nil?\n @block = TokenList.new\n tokens = [tk, TkStatementEnd.new(tk.line_no, tk.char_no)]\n tokens = tokens.reverse if TkBEGIN === tk.class\n @statement.concat(tokens)\n else\n @statement << tk\n end\n\n true\n end",
"def examine_block\n if accepted?\n worker && worker.report_accepted_block(self)\n end\n true\n end",
"def block?(other_user)\n blocks_user.include?(other_user)\n end",
"def is_target?\n not is_source? and @next.nil? and @chain.size > 1\n end",
"def mix?(mode = nil)\n # Check each sub block.\n # If block.\n return true if self.yes.mix?(mode)\n # Elsif blocks\n self.each_noif do |cond, stmnt|\n return true if stmnt.mix?(mode)\n end\n # Else block if any.\n true if self.no && self.no.mix?(mode)\n end",
"def content_for?(symbol)\n !content_blocks[symbol].empty?\n end",
"def block_class() Block; end",
"def skip_or_pending_inside_block?(param0 = T.unsafe(nil)); end",
"def ready?(&block)\n `$(#{ block })` if block\n end",
"def blockFun2(arg1, &aBlock)\n if aBlock\n aBlock.call(arg1)\n \"HAVE BLOCK\"\n else\n \"NO BLOCK\"\n end\nend",
"def be_proc(&block)\n block.call\n puts block.class\nend",
"def called_with_block?\n if block_given?\n p \"You called me with a block\"\n end\nend",
"def outcome_is(&block)\n raise ArgumentError, \"Missing block\" unless block\n raise \"outcome_is already called on this experiment\" if defined?(@outcome_is)\n\n @outcome_is = block\n end",
"def control_frame?(frame_type)\n !%i(text binary continuation).include?(frame_type)\n end",
"def my_any?\n if block_given?\n self.my_each{|item| return true if yield(item)}\n # return false unless one is true\n false\n else\n # if no block given return true\n true\n end\n end",
"def hit!\n # state machine implementation\n @type = case @type\n when BlockType::BLACK\n BlockType::GRAY\n when BlockType::GRAY\n BlockType::RED\n when BlockType::RED\n BlockType::ORANGE\n when BlockType::ORANGE\n BlockType::YELLOW\n else\n BlockType::NONE\n end\n res = @type == BlockType::NONE ? true : false\n possible_bonus! if res\n res\n end",
"def preprocess(&block) #:nodoc:\n return false if block && !block[self]\n server_list.each { |server| server.preprocess }\n block.nil? || block[self]\n end",
"def ==(other)\n equal?(other) || other.is_a?(Block) && @name == other.name &&\n @body == other.body && @location == other.location\n end"
] |
[
"0.6830338",
"0.6803576",
"0.6703911",
"0.6393082",
"0.6378061",
"0.63617224",
"0.63480777",
"0.6319698",
"0.6313633",
"0.622716",
"0.61516833",
"0.6140495",
"0.6138688",
"0.6066277",
"0.6015716",
"0.6008356",
"0.6000517",
"0.5985821",
"0.5980963",
"0.59389806",
"0.591415",
"0.5905585",
"0.5904417",
"0.5849292",
"0.58485806",
"0.58485806",
"0.58351785",
"0.582482",
"0.5775717",
"0.575212",
"0.57483286",
"0.57427496",
"0.5742422",
"0.57307947",
"0.57263476",
"0.5714799",
"0.56871617",
"0.56851315",
"0.56817365",
"0.56757915",
"0.5650046",
"0.56363344",
"0.56235516",
"0.56207407",
"0.5610512",
"0.56076354",
"0.56028914",
"0.5554918",
"0.55417657",
"0.55333716",
"0.551622",
"0.5492803",
"0.5488855",
"0.54759306",
"0.54495287",
"0.5443829",
"0.54266185",
"0.5420675",
"0.5419239",
"0.5409885",
"0.5408216",
"0.5407017",
"0.5399953",
"0.5398176",
"0.53942096",
"0.53938836",
"0.53854007",
"0.5382449",
"0.53349805",
"0.5332026",
"0.5304782",
"0.5297924",
"0.5297177",
"0.5288878",
"0.5277179",
"0.5269733",
"0.5260169",
"0.52554315",
"0.5254001",
"0.5251434",
"0.52493536",
"0.524093",
"0.5236702",
"0.5205432",
"0.5192621",
"0.5188858",
"0.5182147",
"0.51734596",
"0.517097",
"0.5161839",
"0.5149882",
"0.5136315",
"0.512959",
"0.512836",
"0.5116819",
"0.51053554",
"0.50813216",
"0.5075985",
"0.5068083",
"0.5064429",
"0.5061004"
] |
0.0
|
-1
|
Sets the default parameters for a block type.
|
def set_block_params(name, params)
params = {} if !params.is_a?(Hash)
@vars[:block_params][name] = params
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_block_type\n @block_type = BlockType.find(params[:id])\n end",
"def set_block_typ\n @block_type = BlockType.find(params[:id])\n end",
"def block_type_params\n params.require(:block_type).permit(:name)\n end",
"def default\n @type = :default\n end",
"def block_type_params\n params.require(:block_type).permit(:show_name, :name)\n end",
"def configuration_defaults(&block)\n @configuration_defaults = block\n end",
"def block_params\n params.require(required_params).permit(default_permitted_attributes)\n end",
"def default_handler(&block)\n type_handles.default = (block || lambda {|*args, &block| })\n end",
"def defaults_for(type)\n default_parameters = defaults.fetch type.to_s, {}\n fail \"Default for the type: #{type} should be a hash of parameters. Got: #{default_parameters.inspect}\" unless default_parameters.is_a? Hash\n default_parameters\n end",
"def set_default_params\n self.difficulty = 0\n self.result = \"active\"\n self.board_size = 3\n end",
"def initialize(&block)\n load_defaults!\n\n instance_eval(&block) if block_given?\n\n set_defaults!\n end",
"def block_class_params\n params.fetch(:block_class, {})\n end",
"def cp_block_params\n params.require(:block).permit(:name, :text, :title, :description, :keywords)\n end",
"def default(&block)\n if block_given?\n @default = block\n else\n @default\n end\n end",
"def initialize(type = :message, &block)\n @type = type\n @block = block if block_given?\n end",
"def set_defaults\n end",
"def set_defaults\n end",
"def set_default_options\n end",
"def init_parameters\n pts = @base_type.type_parameters(true)\n if pts.size > 2\n @parameters\n else\n result = pts.values.map do |tp|\n pn = tp.name\n @parameters.include?(pn) ? @parameters[pn] : :default\n end\n # Remove trailing defaults\n result.pop while result.last == :default\n result\n end\n end",
"def param(name, type = nil, **opts, &block)\n raise ArgumentError, \"Default value for param not allowed - #{name}\" if opts.key? :default\n raise ArgumentError, \"Optional params not supported - #{name}\" if opts.fetch(:optional, false)\n\n super\n end",
"def set_default\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_defaults\n\n end",
"def set_default_params params\n set_default_params_status(params)\n set_default_params_type(params)\n set_default_params_content(params)\n return params\n end",
"def block_params\n params.require(:block).permit(:height, :native_id, :account, :payload_size_bytes, :total_amount_nqt, :total_fee_nqt, :total_pos_nqt)\n end",
"def block_params\n params.require(:block).permit(:name, :left, :top, :width, :height, :space_id, :block_type, :parent_id, :is_floor, :max_head_cap, :footage, :equipment, :fee, :photo, :start_at, :end_at, :image, :intro, :user_id, :registration_id, :color, :unit_id)\n end",
"def reset\n\t\t@block_type = nil\n\tend",
"def block_params\n params.require(:block).permit(:result_no, :generate_no, :block_no, :e_no)\n end",
"def block_params\n if(params[:block].present?)\n\t params.require(:block).permit(:name, :block_code, :district_id, :partner_id, manager_attributes: [:id, :user_id, :start_date, :end_date], director_attributes: [:id, :user_id, :start_date, :end_date])\n end\n end",
"def initializeDefaultParams()\n @fcName = nil # Flowcell name\n @baseCallsDir = nil # BaseCalls dir of the flowcell\n @useBasesMask = nil # Custom value to provide to BCL->FastQ convertor\n @sampleSheet = nil # Path to SampleSheet.csv\n yamlConfigFile = File.dirname(File.expand_path(File.dirname(__FILE__))) +\n \"/config/config_params.yml\" \n @configReader = YAML.load_file(yamlConfigFile)\n @queue = \"high\" # The processing queue on the cluster\n end",
"def set_default\n cmd = \"{\\\"id\\\":8,\\\"method\\\":\\\"set_default\\\",\\\"params\\\":[]}\\r\\n\"\n request(cmd)\n end",
"def set_block &b\n @block = b\n end",
"def set_blocks hash\n\t\t\t@blocks = hash\n\t\tend",
"def block_params\n params.require(:block).permit(:cover_id, :font_size ,:font_family ,:content, :number, :remove_main_image, \n :main_image, :bottom_padding, :id, :font_weight, :text_align, \n :text_style, :image_block, :blank, other_images: [])\n end",
"def set_defaults( name, *args, &block )\n clear_defaults( name )\n @aliases[ name ] = args.shift if args.first.is_a? Symbol\n @defaults[ name ] = args.pop if args.last.is_a? Hash\n @callbacks[ name ] = block\n fail( ArgumentError, \"invalid defaults for #{name}\" ) unless args.empty?\n self\n end",
"def block_params\n params.require(:block).permit(:date, :description)\n end",
"def block_params\n params.require(:block).permit(:template_id, :firstres_id, :firstres_type, :secondres_id, :secondres_type)\n end",
"def initializeDefaultParams()\n @fcName = nil # Flowcell name\n @baseCallsDir = nil # BaseCalls dir of the flowcell\n @useBasesMask = nil # Custom value to provide to BCL->FastQ convertor\n @sampleSheet = nil # Path to SampleSheet.csv\n\n yamlConfigFile = PathInfo::CONFIG_DIR + \"/config_params.yml\" \n @configReader = YAML.load_file(yamlConfigFile)\n @queue = SchedulerInfo::CASAVA_QUEUE # The processing queue on the cluster\n end",
"def default_body_type=(body_type)\n @body_type = body_type\n end",
"def initialize(&block)\n load_defaults!\n\n instance_eval(&block)\n end",
"def set_defaults(options = T.unsafe(nil)); end",
"def set_block_break_type(type)\n @block_break_type_stack[@block_break_type_stack.size-1] = type\n end",
"def set_block_class\n @block_class = BlockClass.find(params[:id])\n end",
"def configure(&block)\n default_values!\n yield self\n end",
"def default(&ruby_block)\n @default_codes << ruby_block\n end",
"def block_params\n params.require(:block).permit(:previous_block, :nonce, :prev_timestamp, :success)\n end",
"def default(default)\n @default = default\n end",
"def default_parameters\n {}\n end",
"def set_block_params(item)\n if block_params.blank?\n commands.object = item\n elsif item.is_a?(Array) && item.size > 1\n # split item into block variables\n # the # of @block_params may be < the # of subitems, so put it first\n block_params.zip(item).each {|param, subitem| commands.set(param, subitem) }\n else\n # now this item is available thru the block variable\n commands.set(block_params.first, item)\n end\n end",
"def block_params\n\t\tparams.require(:block).permit(:fecha, :precio, :estado, :adjudicado, :residence_id, :adjudicadoid)\n\tend",
"def contact_blocker_params\n\t\tparams.require(:contact_blocker).permit(*ContactBlocker::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def set_default_options(iParameters)\n @DefaultOptions.merge!(iParameters)\n end",
"def initialize(name, default_value = nil, &block)\n raise ArgumentError, \"Waw variables accept a default value or a block, but not both\"\\\n unless default_value.nil? or block.nil?\n @name, @default_value = name, (block ? block : default_value)\n end",
"def default=(new_default)\n @default_proc = nil\n @default = new_default\n end",
"def set_blocks(x0,y0,z0,x1,y1,z1,block)\n @api.send(\"world.setBlocks(#{x0},#{y0},#{z0},#{x1},#{y1},#{z1},#{block.as_parameter_list})\")\n end",
"def create_defaults\n @parameters[:date] = Time.parse(\"00:00\").to_s\n @parameters[:period] = \"24\"\n @parameters[:default] = true\n end",
"def setdefault_params\n params.require(:setdefault).permit(:chef, :runner, :user_id)\n end",
"def set_defaults\n\n unless self.credits.present?\n Credit.default_credits.each do |item|\n @credit = self.user_credits.new\n @credit.credit_id = item.id\n end\n end\n\n self.video_type ||= ENUMERATIONS[:video_type].first\n self.title = \"Untitled\"\n self.description = \"This video needs a description\"\n self.duration = 60\n end",
"def init (&block)\n @init_block = block\n end",
"def id=(id)\n return if id == id\n @blockType = BlockType.get id\n end",
"def set_block\n @block = Block.find(params[:id])\n end",
"def set_block\n @block = Block.find(params[:id])\n end",
"def set_block\n @block = Block.find(params[:id])\n end",
"def set_block\n @block = Block.find(params[:id])\n end",
"def set_block\n @block = Block.find(params[:id])\n end",
"def set_type\n end",
"def config(name, types: nil, type: nil, required: false, default: nil, &block)\n attribute = self.class.new\n attribute.name = name\n attribute.types = types || type\n attribute.required = required\n attribute.value = default\n attribute.instance_exec(&block) if block\n\n children << attribute\n end",
"def configure(hash = nil, &_block)\n if block_given?\n carrier = Surrealist::Carrier.new\n yield(carrier)\n @default_args = carrier.parameters\n else\n @default_args = hash.nil? ? Surrealist::HashUtils::EMPTY_HASH : hash\n end\n end",
"def voting_block_params\n params.require(:voting_block).permit(:random)\n end",
"def default_to(&block)\n raise ArgumentError, _('must be passed a block') unless block_given?\n @default_to = block\n end",
"def defaults_for( name, &block )\n ::Loquacious::Configuration.defaults_for(name, &block)\n end",
"def init_default_attributes\n self.config_params ||= DEFAULT_CONFIG_PARAMS\n self.has_inventory = true\n end",
"def defaults(hash)\n default_params.update(hash)\n end",
"def set_block\n @block = Block.find(params[:id])\n\n\n end",
"def block_params\n params.require(:block).permit(:row, :first_tree, :last_tree, :tree_number, :planting_date, :pullout_date, :collection_id, :accession_id)\n end",
"def set_defaults\n if chore_type\n self.action = chore_type.action\n self.points = chore_type.points\n end\n end",
"def default_params\n @default_params ||= {\n id: nil,\n class: name.gsub(/.*::/, '').downcase,\n width: nil,\n height: nil,\n border: nil,\n borders: nil,\n border_style: nil\n }\n end",
"def initialize(options={}, &block)\n set_defaults\n apply_options(options, &block)\n end",
"def default_task_type_params\n params.require(:default_task_type).permit(:name, :color_code)\n end",
"def set_defaults\n super\n self.expected_useful_miles ||= 0\n self.asset_type_id ||= AssetType.where(class_name: self.name).pluck(:id).first\n end",
"def guess_block_type(type)\n BLOCK_TYPES.key?(type.to_i) ? BLOCK_TYPES[type.to_i] : UnknownBlock\n end",
"def create\n @block_type = BlockType.new(block_type_params)\n\n respond_to do |format|\n if @block_type.save\n format.html { redirect_to @block_type, notice: 'Block typ was successfully created.' }\n format.json { render action: 'show', status: :created, location: @block_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @block_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def content_block_params\n params.require(:content_block).permit(:content, :headline, :avatar)\n end",
"def set_default_values\n # Ethernet configuration\n self.network_1_id ||= 1\n self.ethernet_ip_assignment_method_id ||=1\n # GRPS\n self.gprs_mtu ||= 1450\n # PSTN\n self.pstn_mtu ||= 1500\n # Time configuration\n self.time_zone ||= 'UTC'\n # Interval configuration\n self.configuration_update_interval ||= 3600\n self.status_interval ||= 3600\n self.send_data_interval ||= 86400\n # Software update configuration\n self.auto_update ||= false\n self.software_update_interval ||= 604800\n self.repo_type ||= 'stable'\n # Log configuration\n self.send_log_files ||= false\n # State XML\n self.state_xml ||= \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n<modified>true</modified>\\n\"\n end",
"def normal=(block)\n raise ArgumentError, \"normal expects a block, not a #{block.class}\" unless block.is_a?(Proc)\n @normal = block\n end",
"def set_defaults\n super\n end",
"def set_defaults\n super\n end",
"def create\n @block_type = BlockType.new(block_type_params)\n\n respond_to do |format|\n if @block_type.save\n format.html { redirect_to block_types_url, notice: 'Block type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @block_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @block_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_default(name, *args, &block)\n set(name, *args, &block) unless exists?(name)\nend",
"def set_default(name, *args, &block)\n set(name, *args, &block) unless exists?(name)\nend",
"def cfexdefaulttemplateparams(_)\n {\n _type: :CFExDefaultTemplateParams,\n }\n end",
"def initialise(params = nil)\n super(params)\n self.compound ||= 1\n end",
"def set_block(x,y,z,block)\n @api.send(\"world.setBlock(#{x},#{y},#{z},#{block.as_parameter_list})\")\n end",
"def initialize(argument_types, block)\n @argument_types = argument_types\n @number_of_arguments = argument_types.size\n @block = block\n end",
"def defaults\n super\n end",
"def set_default_options(options = {})\n if options.is_a?(Hash)\n options = TemplateOptions.new.tap do |o|\n o.reset_defaults\n o.update(options)\n end\n end\n options.type ||= options.object.type if options.object\n options\n end"
] |
[
"0.6814038",
"0.6716204",
"0.6655171",
"0.64248866",
"0.6312512",
"0.6199047",
"0.6159597",
"0.6049608",
"0.60355854",
"0.6024647",
"0.6003059",
"0.60009146",
"0.60008955",
"0.5960026",
"0.59460604",
"0.5945341",
"0.5945341",
"0.5945148",
"0.5943789",
"0.594148",
"0.5936704",
"0.5926883",
"0.5926883",
"0.5926883",
"0.5926883",
"0.5926883",
"0.5926883",
"0.59219664",
"0.5876007",
"0.58517885",
"0.5833981",
"0.5815755",
"0.57835364",
"0.57756025",
"0.5758026",
"0.5732027",
"0.5720984",
"0.5716949",
"0.5715189",
"0.57036024",
"0.5701617",
"0.56890625",
"0.5647111",
"0.56309825",
"0.56146336",
"0.561403",
"0.56101346",
"0.560461",
"0.56034404",
"0.5599008",
"0.5594076",
"0.5588658",
"0.5587794",
"0.5585599",
"0.5582592",
"0.5564007",
"0.5551457",
"0.5544129",
"0.5535094",
"0.5532903",
"0.55183387",
"0.5513404",
"0.5499242",
"0.54900175",
"0.54898417",
"0.54898417",
"0.54898417",
"0.54898417",
"0.54898417",
"0.5488166",
"0.5468167",
"0.5453664",
"0.5451646",
"0.5447249",
"0.5437671",
"0.54372674",
"0.54322857",
"0.5430874",
"0.54258233",
"0.5409131",
"0.54048127",
"0.5404546",
"0.5401858",
"0.5384754",
"0.53819084",
"0.53592896",
"0.53543776",
"0.53359216",
"0.53347564",
"0.53338116",
"0.53338116",
"0.5328899",
"0.5309695",
"0.5309695",
"0.530773",
"0.5302023",
"0.5294565",
"0.5289716",
"0.52893263",
"0.52876663"
] |
0.6247218
|
5
|
Define breakfast, lunch and dinner methods that return the meal choice passed into them. If nothing is passed in, it shoud default to the foods on the readme (frosted flake, grilled cheese, salmon)
|
def meal(breakfast = "frosted flakes", lunch = "grilled cheese", dinner = "salmon")
puts "Morning is the best time for #{breakfast}!"
puts "Noon is the best time for #{lunch}!"
puts "Evening is the best time for #{dinner}!"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def meal_choice( food = \"meat\") \n return food\nend",
"def meal_choice(food_type = \"meat\")\n food_type\nend",
"def meal_choice(choice = \"meat\")\n return choice\nend",
"def meal_choice(choice = \"meat\")\n return choice #meal choice that was passed into it \nend",
"def meal_choice(vegan = \"meat\")\n vegan\nend",
"def meal_choice(meal = \"meat\") #assigning a default value\n return \"#{meal}\" #returns the argument\nend",
"def food_and_drink; end",
"def rate_my_food(food)\n case food\n when \"Steak\"\n \"Pass the steak sauce!\"\n when \"Sushi\"\n \"Great choice!\"\n when \"Pizza\"\n \"My favorite food\"\n when \"Tacos\", \"Burritos\", \"Quesadillas\"\n # o lo uno o lo otro\n \"Cheesy and filling!\"\n when \"Tofu\", \"Brussel Sprouts\"\n \"Disguisting!\"\n else\n \"I don't know about that food\"\n end\nend",
"def meal_choice(meat = \"meat\")\n puts \"what kind of #{meat} would you like?\"\nend",
"def meal_choice(meal=\"meat\") #meal is argument, default argument is \"meat\"\n \"#{meal}\" #method returns #{meal}\nend",
"def meal_choice(arg1 = \"meat\")\n return arg1\nend",
"def myfood(food)\r\n case food\r\n when \"Steak\"\r\n \"Pass the Steak sauce! That's delicious\"\r\n when \"Sushi\"\r\n \"Thats raw. I don't eat raw food\"\r\n when \"Tacos\", \"Burrito\", \"Quesadillas\"\r\n \"The perfect Combination!\"\r\n when \"Tofu\", \"Brussel Sprouts\"\r\n puts \"No Thanks\"\r\n else\r\n \"I don't know that food\"\r\n end\r\nend",
"def meal_choice(name =\"meat\")\n puts \"The meal choice is #{name}!\"\nend",
"def rate_my_food(food)\n case food\n when \"Steak\" #if food is eq to Steak\n \"Pass the sauce!\"\n when \"Sushi\"\n \"Great choice!\"\n when \"Tacos\", \"Burritos\", \"Strawhat\"\n \"That all is great\"\n when \"Tofu\", \"Brussels\"\n \"Yuck!\"\n else\n \"I dont know about this\"\n end\n\nend",
"def rate_my_food(food)\r\n case food\r\n when \"Steak\"\r\n \"Pass the steak sauce! That's delicious\"\r\n when \"Sushi\"\r\n \"Great choice! My favorite food\"\r\n when \"Tacos\", \"Burritos\", \"Quesadillas\" # operator or\r\n \"Cheesy and filling! The perfect combination\"\r\n when \"Tofu\", \"Brussel Sprouts\"\r\n \"Disgusting! Yuck!\"\r\n else\r\n \"I don't know about that food!\"\r\n end\r\nend",
"def meal_choice(protein = \"meat\")\n protein\nend",
"def food(food)\n case food\n when \"burger\"\n \"bad food\"\n when \"apple\"\n \"good\"\n else\n \"nice\"\n end\nend",
"def meal_choice(meal = \"meat\")\n meal_choice = (meal)\n meal_choice\nend",
"def meal\n 'Evening'\nend",
"def meal\n 'Evening'\nend",
"def meal\n 'Evening'\nend",
"def meal\n 'Evening'\nend",
"def meal\n 'Evening'\nend",
"def meal\n 'Evening'\nend",
"def meal\n 'Evening'\nend",
"def meal\n return 'breakfast'\nend",
"def meal_choice(op1, op2, op3 = \"tofu\")\n puts\"What a nutritious meal!\"\n meal = \"A plate of #{op3} with #{op1} and #{op2}.\"\n puts meal\n meal\nend",
"def rate_food(food)\n case food\n when \"Steak\"\n \"Pass the stack sause! Delicious!\"\n when \"Sushi\"\n \"Great choise, my favouirete food!\"\n when \"egss\", \"pizza\", \"barbecue\"\n \"even better! yep!\"\n when \"tofu\", \"pasulj\"\n \"yuck!\"\n else\n \"#{food} is not a food!!\"\n end\nend",
"def meal\n\treturn 'Breakfast'\n\t'Dinner'\nend",
"def meal\n return 'Breakfast'\nend",
"def meal\n return 'Breakfast'\nend",
"def meal\n return 'Breakfast'\nend",
"def meal\n return 'Breakfast'\nend",
"def rate_my_food(food)\n case food\n when 'Githeri'\n 'pass the pilipili'\n when 'Mukimo'\n 'pass the thukuma'\n when 'ngima', 'muchere', 'ngacii'\n 'pass maziwa mala'\n else\n 'Nilale njaa'\n end\nend",
"def meal \n return 'Breakfast'\n 'Dinner'\nend",
"def meal \n 'Evening'\nend",
"def meal \n 'Evening'\nend",
"def meal_choice(phrase = \"meat\")\n puts \"meat\"\n return phrase\nend",
"def meal_choice(arg1 = \"meat\")\n \"#{arg1}\"\nend",
"def meal\n return 'Breakfast'\n end",
"def option\n puts \"\\#1. Search for drink based on a specific ingredient.\"\n puts \"\\#2. Take a chance on a random drink.\"\n puts \"\\#3. Get the recipe when you know the name of the drink already.\"\n puts \"\"\n puts \"\\#0. or type 'exit' to Exit\"\n puts \"=====================================\"\n puts \"Please enter a number to choose an option:\"\n\n options = gets.chomp.to_i\n # def\n\n case options\n when 1\n #will accept a liqupr type and display the available drinks to make\n #where the user can accept one to see the ingredients\n puts \"Input ingredient type:\"\n liquor_type = gets.chomp\n drinks_list = search_by_name(liquor_type)\n drinks_list.each do|drink|\n drink.map do |key, value|\n if key == 'strDrink'\n print \"#{value}, \"\n end\n end\n end\n choose_again\n\n when 2\n # puts \"Your random drink is the...\"\n random_drink\n # puts \"Save drink?\"\n # User.like_drink(randomdrink)\n choose_again\n\n when 3\n puts \"Know the name of the drink you want?\"\n drink_name = gets.chomp.to_s\n getting_recipe(drink_name)\n\n choose_again\n\n when 0 || 'exit'\n puts \"Maybe next time, friend. Bye-bye\"\n\n else\n puts \"\\n\\n!!! Sorry but that appears to be an invalid input. Please try again!!! \\n\\n\"\n options\n end\nend",
"def meal\n return 'Breakfast'\n 'Dinner'\nend",
"def meal\n return 'Breakfast'\n 'Dinner'\nend",
"def meal\n return 'Breakfast'\n 'Dinner'\nend",
"def meal\n return 'Breakfast'\n 'Dinner'\nend",
"def meal\n return 'Breakfast'\n 'Dinner'\nend",
"def meal\n return 'Breakfast'\n 'Dinner'\nend",
"def meal\n return 'Breakfast'\n 'Dinner'\nend",
"def meal\n return 'Breakfast'\n 'Dinner'\nend",
"def breakfast(food = \"Granola\")\n puts \"Wake up with the best #{food} in the world!\"\nend",
"def meal_generator(food)\n food\nend",
"def meal_choice(var=\"meat\")\n var\nend",
"def meal_choice(order = \"meat\")\n return \"#{order}\"\nend",
"def meal_choice(veg1, veg2, protein = \"meat\")\n greeting = \"What a nutritious meal!\"\n puts greeting\n meal = \"A plate of #{protein} with #{veg1} and #{veg2}.\" \n puts meal\n return \"A plate of #{protein} with #{veg1} and #{veg2}.\"\nend",
"def favourite_food name\r\n\tif name == \"Lister\"\r\n\t\treturn \"vindaloo\"\r\n\tend\r\n\r\n\tif name == \"Rimmer\"\r\n\t\treturn \"mashed potatoes\"\r\n\tend\r\n\r\n\t\"hard to say...maybe fired plantain?\"\r\nend",
"def breakfast(food=\"oatmeal\")\n \"The most important meal of the day could always be #{food}!\"\nend",
"def meal\n return \"Breakfast\"\n \"Dinner\"\nend",
"def meal_choice(element = \"meat\")\n element \nend",
"def meal\n\t'Evening'\nend",
"def food_types(category_name)\n case category_name\n when \"Fruit\"\n Faker::Food.fruit\n when \"Spice\"\n Faker::Food.herb_or_spice\n when \"Ingredient\"\n Faker::Food.ingredient\n when \"Meat\"\n Faker::Food.meat\n when \"Vegetable\"\n Faker::Food.vegetable\n else\n Faker::Product.product\n end\nend",
"def meal_plan(time_of_week, time_of_day)\n if time_of_week == \"weekday\"\n if time_of_day == \"breakfast\"\n \"Cereal\"\n elsif time_of_day == \"lunch\"\n \"Sandwich\"\n elsif time_of_day == \"dinner\"\n \"Chicken nuggets\"\n end \n elsif time_of_week == \"weekend\"\n if time_of_day == \"breakfast\"\n \"French Toast\"\n elsif time_of_day == \"lunch\"\n \"BBQ Chicken\"\n elsif time_of_day == \"dinner\"\n \"Steak\"\n end\n end\nend",
"def meal_plan(week_time, week_day) #this is Ruby method\n if week_time == 'weekday'\n if week_day == 'breakfest'\n 'egss and cheese'\n elsif week_day == 'lunch'\n \"soup and potatos\"\n elsif week_day == 'dinner'\n \"Chicken nuggets\"\n end\n elsif week_time == 'weekend'\n if week_day == 'breakfest'\n \"French tost\"\n elsif week_day == 'lunch'\n \"2 pizza\"\n elsif week_day == 'dinner'\n \"meal stack\"\n end\n end\nend",
"def meal_choice (veg1, veg2, protein = \"tofu\")\n\nstatement_1 = \"What a nutritious meal!\"\nstatement_2 = \"A plate of #{protein} with #{veg1} and #{veg2}.\"\n\nputs statement_1\nputs statement_2\nstatement_2\n\nend",
"def pick_meal(menu)\n puts \"1.#{menu[1][:name]} $#{menu[1][:price]}\"\n puts \"2.#{menu[2][:name]} $#{menu[2][:price]}\"\n puts \"3.#{menu[3][:name]} $#{menu[3][:price]}\"\n puts \"4.See Descriptions\"\n puts \"5.Clear order OR '0' to quit\"\n print \"> \"\n @menu_pick = gets.to_i\n\n case @menu_pick\n when 0\n puts \"Goodbye\"\n exit(0)\n when 4\n description(menu)\n when 5\n clear_order\n else\n order_meal(menu)\n end\n end",
"def favorite_food name\n\tif name == \"Lister\"\n\t\treturn \"vindaloo\"\n\tend\n\n\tif name == \"Rimmer\"\n\t\treturn \"mashed potatoes\"\n\tend\n\n\t\"hard to say...maybe fried plantain?\"\nend",
"def favorite_food name\n\tif name == 'Lister'\n\t\treturn 'vindaloo'\n\tend\n\n\tif name == 'Rimmer'\n\t\treturn 'mashed potatoes'\n\tend\n\n\t'hard to say...maybe fried plantain?'\nend",
"def favorite_food name\n\tif name == 'Lister'\n\t\treturn 'vindaloo'\n\tend\n\n\tif name == 'Rimmer'\n\t\treturn 'mashed potatoes'\n\tend\n\n\t'hard to say...maybe fried plantain?'\nend",
"def meal\n\treturn 'Breakfast'\n\t'Dinner'\n\tputs 'Dinner'\nend",
"def bear_choice(choice) # here we took all the oprions we're just making a funtion with all of them that we can call later\n if choice == \"1\"\n \tputs \"The bear eats your face off. Good job!\"\n elsif choice == \"2\"\n \tputs \"The bear eats your legs off. Good job!\"\n else\n \tputs \"Well doing %s is probably better. The bear runs away and leaves the cake behind.\" %bear\n end\nend",
"def meal \n\treturn 'Breakfast'\n\t'Dinner'\n\tputs 'Dinner'\nend",
"def breakfast(food=\"frosted flakes\")\n \"Morning is the best time for #{food}!\"\nend",
"def say_fav_food(food)\n puts \"One of your favorite foods is #{food}\"\n menu_favorite_foods\nend",
"def meal_plan(time_of_week, time_of_day)\n if time_of_week == \"weekday\"\n if time_of_day == \"breakfast\"\n \"Cereal\"\n elsif time_of_day == \"lunch\"\n \"Sandwitch\"\n elsif time_of_day == \"dinner\"\n \"Lasagna\"\n end\n elsif time_of_week == \"weekend\"\n if time_of_day == \"breakfast\"\n \"Toast\"\n elsif time_of_day == \"lunch\"\n \"Salad\"\n elsif time_of_day == \"dinner\"\n \"Steak\"\n end\n end\nend",
"def meow\n puts \"My name is #{name} and i eat #{preferred_food} at #{eats_at}\"\n end",
"def breakfast(food=\"Frosted flakes\")\n puts \"#{food} is a great meal for breakfast!\"\nend",
"def cats_favorite_food\n prompt = TTY::Prompt.new\n choices = {\n \" 1 - See which type of food you'll to put out to attract a specific cat\" => 1,\n \" 2 - View all of the cats that prefer wet food\" => 2,\n \" 3 - View all of the cats that prefer dry food\" => 3,\n \" 4 - Return to the Main Menu\" => 4 }\n choice = prompt.select(\"\\nIf you're lonely and want a cat, here's the info you'll need to attract one!\\n\", choices, per_page: 4)\n case (choice.to_i)\n when 1\n puts \"\\nWhich cat would you like to attract?\"\n cat_food_name = gets.chomp\n cat_fav_food = Cat.find_by(name: cat_food_name).favorite_food\n puts \"\\n#{cat_food_name} prefers #{cat_fav_food} food.\"\n when 2\n puts \"\\nCats that prefer wet food:\"\n Cat.where(:favorite_food => \"wet\").select {|cat| puts cat.name}\n when 3\n puts \"\\nCats that prefer dry food:\"\n Cat.where(:favorite_food => \"dry\").select {|cat| puts cat.name}\n when 4\n main_menu\n end\n end",
"def meow\n puts \"My name is #{@name} and I eat #{@preferred_food} at #{eats_at}.\"\n end",
"def meal_choice(veggie, carb, protein = \"meat\")\n order = \"A plate of #{protein} with #{veggie} and #{carb}.\"\n puts \"What a nutritious meal!\" \n puts order\n return order\nend",
"def meal\n puts \"Dinner\"\n return \"Breakfast\"\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def meal\n puts 'Dinner'\n return 'Breakfast'\nend",
"def lunch(value=\"cheese\")\n value\nend",
"def meal_choice veg, carb, protein='tofu'\n puts \"What a nutritious meal!\"\n string = \"A plate of #{protein} with #{veg} and #{carb}.\"\n puts string\n return string\nend",
"def meal \n puts 'Dinner'\n return 'Breakfast'\nend",
"def meow\n return \"My name is #{@name} and I eat #{@preferred_food} at #{eats_at}\"\n end",
"def food?; @food; end",
"def food?; @food; end",
"def food?; @food; end",
"def favorite_food(name)\n formatted_name = name.capitalize\n\n return 'vindaloo' if formatted_name == 'Lister'\n return 'mashed potatoes' if formatted_name == 'Rimmer'\n\n 'hard to say...maybe fried plantain?'\nend"
] |
[
"0.7704664",
"0.74114716",
"0.73323464",
"0.7279166",
"0.7224172",
"0.71477914",
"0.707415",
"0.7061001",
"0.70384383",
"0.7017799",
"0.7001092",
"0.69718695",
"0.6878549",
"0.68420815",
"0.6826327",
"0.680343",
"0.6801603",
"0.67776394",
"0.6737181",
"0.6737181",
"0.6737181",
"0.6737181",
"0.6737181",
"0.6737181",
"0.6737181",
"0.6728344",
"0.6723101",
"0.67155975",
"0.6705928",
"0.6699766",
"0.6699766",
"0.6699766",
"0.6699766",
"0.66929495",
"0.6687016",
"0.66645306",
"0.66645306",
"0.6664182",
"0.6641805",
"0.6640103",
"0.6631863",
"0.6614104",
"0.6614104",
"0.6614104",
"0.6614104",
"0.6614104",
"0.6614104",
"0.6614104",
"0.6614104",
"0.66048235",
"0.6602755",
"0.65964687",
"0.6557054",
"0.65365994",
"0.64775693",
"0.6462884",
"0.641956",
"0.6396107",
"0.6375589",
"0.63557625",
"0.62967676",
"0.62697005",
"0.62397164",
"0.6222844",
"0.6221851",
"0.62116194",
"0.62116194",
"0.6192092",
"0.6188022",
"0.61861867",
"0.6185539",
"0.6166291",
"0.61518174",
"0.60800123",
"0.60564935",
"0.6035167",
"0.6034",
"0.5997226",
"0.5993172",
"0.59792423",
"0.59792423",
"0.59792423",
"0.59792423",
"0.59792423",
"0.59792423",
"0.59792423",
"0.59792423",
"0.59792423",
"0.59792423",
"0.59792423",
"0.59792423",
"0.59792423",
"0.59760064",
"0.5966274",
"0.59594226",
"0.5937652",
"0.5931826",
"0.5931826",
"0.5931826",
"0.59284264"
] |
0.7449021
|
1
|
When modifying the context, also update GraphqlControllercontext if needed so that we have similar context when executing queries, mutations, and subscriptions Objects added to the context may also need to be reloaded in `Subscriptions::BaseSubscription` so that they are not stale
|
def context
# is_sessionless_user is always false because we only support cookie auth in ActionCable
{ channel: self, current_user: current_user, is_sessionless_user: false }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def context\n init\n @context\n end",
"def context\n unless @instance_context\n @instance_context = UserDefinedMessageSubscriptionContext.new(@version , @params['account_sid'], @params['call_sid'], @params['sid'])\n end\n @instance_context\n end",
"def set_context\n @context = Monitoring::Context.find(params[:context_id])\n end",
"def context_renew\n @context&.abort\n @context = org.dspace.core.Context.new\n end",
"def context\n unless @instance_context\n @instance_context = NotificationContext.new(@version, @params['chat_service_sid'], )\n end\n @instance_context\n end",
"def context\n @context ||= {}\n end",
"def context\n @context ||= {}\n end",
"def context\n unless @instance_context\n @instance_context = NotificationContext.new(@version , @params['chat_service_sid'])\n end\n @instance_context\n end",
"def save_context(context)\n message_context_session[:context] = context\n end",
"def set_context\n @context = Context.find(params[:id])\n end",
"def set_context\n @context = Monitoring::Context.find(params[:id])\n end",
"def context\n unless @instance_context\n @instance_context = ChannelContext.new(@version , @params['service_sid'], @params['sid'])\n end\n @instance_context\n end",
"def context\n\t\t\told_context = @current_context\n\t\t\t@current_context = Context.new(@project, old_context)\n\t\t\tyield\n\t\t\t@current_context = old_context\n\t\tend",
"def context\n @context ||= Context.new(self)\n end",
"def execution_context\n initialize_context!(Object.new)\n end",
"def context\n unless @instance_context\n @instance_context = ChannelContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def usage_tracker_context(data)\n self.usage_tracker_context = data\n end",
"def usage_tracker_context(data)\n self.usage_tracker_context = data\n end",
"def for_context context\n @current_context << context\n yield\n @current_context.pop\n end",
"def update!(**args)\n @child_contexts = args[:child_contexts] if args.key?(:child_contexts)\n end",
"def update!(**args)\n @child_contexts = args[:child_contexts] if args.key?(:child_contexts)\n end",
"def _prepare_context; end",
"def context\n unless @instance_context\n @instance_context = ConfigurationContext.new(@version , @params['chat_service_sid'])\n end\n @instance_context\n end",
"def context\n @context ||= Context.new(self)\n end",
"def modifyContext\n\n begin\n\n # @context_owner = params[:username] ? User.find_by_username(params[:username]) : nil\n # @context = @context_owner ? @context_owner.contexts.find(:first, :conditions => ['name = ?', params[:contextname]]) : nil\n # if not @context_owner or not @context\n # render :text => \"Context: #{params[:contextname]} not found! \\n\", :status => 404\n # return\n # end\n \n if params[:contexthash] && params[:contexthash] != nil\n \n @context = Context.find_by_context_hash(params[:contexthash])\n\n elsif params[:username] && params[:contextname] && params[:username] != nil && params[:contextname] != nil\n\n ctx_name = ContextName.find_by_username_and_name(params[:username].downcase, params[:contextname].downcase)\n if ctx_name == nil\n render :text => \"Context:not found! \\n\", :status => 404\n return\n end\n \n @context_id = ctx_name.context_id\n \n # Get context with context_hash\n @context = Context.find_by_id(@context_id)\n \n else\n render :text => \"Context: not found! \\n\", :status => 404\n return\n \n end\n \n if @context == nil\n render :text => \"Context: not found! \\n\", :status => 404\n return\n end\n\n @context_id = @context.id\n\n # user-object who is signed in, if not signed in has nil\n @user = whoIsSignedIn\n\n # Checks that user is authorized to modify context\n if not authorizedToContext(@context.context_hash)\n render :text => \"Not authorized to modify this context\", :status => 409\n return\n end\n \n \n \n # If uri for file is given -> adds file to context\n if params[:file_uri]\n addFileToContext(@context)\n puts \"file was added to context!\"\n end\n \n # Modifying other stuff \n modifyContextInformations\n \n\n rescue Exception => ex\n putsE(ex)\n render :text => \"Error in modifying context! \\n\", :status => 409\n return\n end\n\n\n render :text => \"Context: #{params[:contextname]} modified successfully! \\n\", :status => 200\n return\n end",
"def context=(ctx)\n @context = ctx\n end",
"def in_context\n old_context = self.context\n self.context = self\n yield\n self.context = old_context\n end",
"def context(payload = nil)\n @context.merge! payload if payload\n @context\n end",
"def update!(**args)\n @mutation_context = args[:mutation_context] if args.key?(:mutation_context)\n end",
"def update!(**args)\n @mutation_context = args[:mutation_context] if args.key?(:mutation_context)\n end",
"def update!(**args)\n @mutation_context = args[:mutation_context] if args.key?(:mutation_context)\n end",
"def context_methods\n super + [:context]\n end",
"def context\n unless @instance_context\n @instance_context = ApplicationContext.new(@version , @params['account_sid'], @params['sid'])\n end\n @instance_context\n end",
"def context\n Context.instance\n end",
"def with_context\n self.context_cache = {}\n yield\n ensure\n self.context_cache = nil\n end",
"def getContext\n \n query_processing_time_begin = Time.now\n # In web-ui query processing time is only shown if asked. In atom-feed, it is always shown.\n if params[\"query_processing_time\"] && params[\"query_processing_time\"].downcase == \"true\"\n @query_processing = true\n end\n if params[:qoption] && params[:qoption][\"query_processing_time\"] == \"true\"\n @query_processing = true\n end\n \n \n if params[:contexthash] != nil\n \n @context = Context.find_by_context_hash(params[:contexthash])\n \n else\n \n user = User.find_by_username(params[:username])\n if user == nil\n render :text => \"Owner of context not found!\", :status => 409\n return\n end\n \n ctxName = ContextName.find_by_user_id_and_name(user.id, params[:contextname])\n if ctxName == nil\n render :text => \"Contextname was not found for this user!\", :status => 404\n return\n end\n \n @context = Context.find_by_id(ctxName.context_id) \n end\n \n # If requested context wasn't found\n if @context == nil\n render :text => \"Context not found!\", :status => 404\n return\n end\n \n sql = \"SELECT users.* \n FROM context_group_permissions, groups, usersingroups, users \n WHERE context_group_permissions.context_id=#{@context.id} AND \n context_group_permissions.group_id = groups.id AND \n groups.id=usersingroups.group_id AND usersingroups.user_id=users.id;\"\n @members = User.find_by_sql(sql)\n \n @owner = User.find_by_id(@context.user_id)\n if @owner == nil\n render :text => \"Owner of the context could not be found\", :status => 409\n return\n end\n \n # User-object who is signed in, if not signed in it's nil\n @user = whoIsSignedIn \n \n # If user is not authorized to see context\n if not authorizedToContext(@context.context_hash)\n render :text => \"You don't have permission to see this context\", :status => 401\n return\n end\n\n ## Context is found and user is authorized to view it. We may proceed.\n \n \n @context_metadatas = ContextMetadata.find_by_sql(\"SELECT context_metadatas.context_id as id, \n context_metadatas.value as value, \n metadata_types.name as type_name,\n metadata_types.value_type as value_type\n FROM context_metadatas, metadata_types\n WHERE context_metadatas.metadata_type_id = metadata_types.id AND \n context_metadatas.context_id = #{@context.id}\") \n \n @context_named_by_user = @context.name\n \n @metadatatypes = MetadataType.find(:all, :order => \"name ASC\" )\n \n # Find if user that is signed in, has named the context\n if @user != nil\n tmp_ctx_name = ContextName.find_by_user_id_and_context_id(@user.id, @context.id)\n if tmp_ctx_name != nil\n # Signed in user has named the context\n @context_named_by_user = tmp_ctx_name.name\n end\n end\n \n \n \n if query_processing_time_begin != nil\n query_processing_time_end = Time.now\n @query_processing_time = query_processing_time_end - query_processing_time_begin\n puts \"Time used for processing query: #{@query_processing_time}\"\n end\n \n \n #Create atom feed\n @host = @@http_host\n respond_to do |format|\n if params[:format] == nil\n format.html {render :getcontext, :layout=>true }\n else\n format.html {render :getcontext, :layout=>true }\n format.atom {render :getcontext, :layout=>false }\n end\n end \n end",
"def context(status, header, body, request)\n @context = context_retriever(request)&.call(status, header, body)\n @data[:request_context] = @context[:context_id] \\\n if @context && @context[:context_id]\n @context\n end",
"def alter_context(context = T.unsafe(nil)); end",
"def with_context(context_data)\n push_context(context_data)\n yield\n ensure\n # remove context\n pop_context\n end",
"def build_context(context: Context.current)\n builder = Builder.new(correlations_for(context).dup)\n yield builder\n context.set_value(CORRELATION_CONTEXT_KEY, builder.entries)\n end",
"def describe_context(context)\n @current_context = context\n end",
"def context\n @context ||= Contexts.context_for(self, embedded)\n end",
"def context\n {}\n end",
"def context\n {}\n end",
"def push_context(context_data)\n if context_data.is_a?(Class)\n context << context_data.new\n else\n context << context_data\n end\n end",
"def context\n unless @instance_context\n @instance_context = TriggerContext.new(@version, @params['account_sid'], @params['sid'],)\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = WorkersRealTimeStatisticsContext.new(@version , @params['workspace_sid'])\n end\n @instance_context\n end",
"def contexts\n @contexts ||= @contexts = {}\n end",
"def update!(**args)\n @context_id = args[:context_id] if args.key?(:context_id)\n end",
"def reset_context\n @context = nil\n end",
"def in_context(context); end",
"def context\n unless @instance_context\n @instance_context = CallContext.new(@version , @params['account_sid'], @params['sid'])\n end\n @instance_context\n end",
"def context=(ctx)\n @context.local = ctx\n end",
"def context=(value)\n if value\n if value.is_a?(UIViewController)\n @context = RubyMotionQuery::RMQ.weak_ref(value)\n elsif value.is_a?(UIView)\n @context = value\n #else\n #debug.log_detailed('Invalid context', objects: {value: value})\n end\n else\n @context = nil\n end\n @context\n end",
"def contexts\n @contexts ||= {}\n end",
"def context\n { controller: self, current_user: current_user }\n end",
"def context\n unless @instance_context\n @instance_context = CompositionContext.new(@version, @params['sid'], )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = CompositionHookContext.new(@version, @params['sid'], )\n end\n @instance_context\n end",
"def save_context(context)\n session[:context] = context\n end",
"def context_methods; end",
"def context\n unless @instance_context\n @instance_context = AnonymizeContext.new(@version , @params['room_sid'], @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = CallContext.new(@version, @params['account_sid'], @params['sid'],)\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = LinkshorteningMessagingServiceDomainAssociationContext.new(@version , @params['messaging_service_sid'])\n end\n @instance_context\n end",
"def management\n prepareBaseContext\n end",
"def context\n unless @instance_context\n @instance_context = WorkspaceContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def context\n self.current_custom_context || self.default_context\n end",
"def context\n unless @instance_context\n @instance_context = ServiceContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = ServiceContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def initialize context\n @context = context\n @store = context.store\n\n @seen = {}\n end",
"def context=(context)\n context = Zuul::Context.parse(context)\n self.context_type = context.klass\n self.context_id = context.id\n end",
"def add_context(context)\n return unless context.present?\n @current_context ||= []\n @current_context << context.strip\n end",
"def context\n { current_user: current_user }\n end",
"def context\n unless @instance_context\n @instance_context = EngagementContextContext.new(@version , @params['flow_sid'], @params['engagement_sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = DomainContext.new(@version , @params['account_sid'], @params['sid'])\n end\n @instance_context\n end",
"def context=(context)\n @context = context\n @source.context = context\n end",
"def access_context(context = {}) \n default_access_context.merge(context)\n end",
"def access_context(context = {}) \n default_access_context.merge(context)\n end",
"def client_context=(value)\n @client_context = value\n end",
"def context\n unless @instance_context\n @instance_context = ConferenceContext.new(@version , @params['conference_sid'])\n end\n @instance_context\n end",
"def context; { user: current_user } end",
"def context\n unless @instance_context\n @instance_context = InteractionChannelContext.new(\n @version,\n @params['interaction_sid'],\n @params['sid'],\n )\n end\n @instance_context\n end",
"def context=(value); end",
"def change_context(args, cmd=[])\n begin\n # check if we are doing switch context\n if args.join(\"\").match(/\\A\\-\\Z/)\n revert_context()\n return\n end\n\n # remember current context\n @previous_context = @active_context.clone_me()\n\n # jump to root\n reset if args.join('').match(/^\\//)\n\n # begin\n # hack: used just to avoid entering assembly/id/node or workspace/node context (remove when include this contexts again)\n first_c, warning_message = nil, nil\n first_c = @active_context.context_list().first.name unless @active_context.context_list().empty?\n tmp_active_context = @active_context.clone_me\n restricted = is_restricted_context(first_c, args, tmp_active_context)\n\n args = restricted[:args]\n warning_message = restricted[:message]\n node_specific = restricted[:node_specific]\n\n DTK::Client::OsUtil.print_warning(warning_message) if warning_message\n # end\n\n # Validate and change context\n @active_context, error_message = prepare_context_change(args, @active_context, node_specific, cmd, true)\n\n load_context(active_context.last_context_name)\n\n if error_message\n revert_context()\n raise DTK::Client::DtkValidationError, error_message\n end\n rescue DTK::Client::DtkValidationError => e\n DTK::Client::OsUtil.print(e.message, :yellow)\n rescue DTK::Shell::Error, Exception => e\n DtkLogger.instance.error_pp(e.message, e.backtrace)\n ensure\n return shell_prompt()\n end\n end",
"def context\n unless @instance_context\n @instance_context = CallContext.new(@version , @params['sid'])\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = InsightsQuestionnairesContext.new(@version , @params['questionnaire_sid'])\n end\n @instance_context\n end",
"def user_context\n YodleeApi.deep_copy(@user_context)\n end",
"def user_context\n YodleeApi.deep_copy(@user_context)\n end",
"def context\n unless @instance_context\n @instance_context = WorkersStatisticsContext.new(@version , @params['workspace_sid'])\n end\n @instance_context\n end",
"def switch_context!( zone, app, stage )\n session[:context] = \"#{zone}.#{app}.#{stage}\" \n Wackamole::Control.current_db( zone, app, stage, true )\n end",
"def set_context(spark)\n # store in thread_store for later use\n sent_to spark[:sender]\n previous_sender spark[:sender]\n context_params({ reply_to: spark[:previous_sender], spark_uid: spark[:spark_uid]})\n end",
"def context\n unless @instance_context\n @instance_context = TrunkContext.new(@version , @params['sip_trunk_domain'])\n end\n @instance_context\n end",
"def update!(**args)\n @debug_context = args[:debug_context] if args.key?(:debug_context)\n @feedback_context = args[:feedback_context] if args.key?(:feedback_context)\n @find_document_suggestion = args[:find_document_suggestion] if args.key?(:find_document_suggestion)\n @serialized_suggestions = args[:serialized_suggestions] if args.key?(:serialized_suggestions)\n @session_context = args[:session_context] if args.key?(:session_context)\n end",
"def context\n unless @instance_context\n @instance_context = WorkflowRealTimeStatisticsContext.new(\n @version,\n @params['workspace_sid'],\n @params['workflow_sid'],\n )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = CpsContext.new(@version, )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = RatePlanContext.new(@version, @params['sid'], )\n end\n @instance_context\n end",
"def add_context( object=nil, **fields )\n\t\tself.log.debug \"Adding context from %p\" % [ object || fields ]\n\t\tcurrent_context = @context_stack.value.last or return\n\n\t\tif object\n\t\t\tobject_fields = self.fields_from_object( object )\n\t\t\tfields = fields.merge( object_fields )\n\t\tend\n\n\t\tcurrent_context.merge!( fields )\n\tend",
"def set_user_context(options)\n Raven.user_context(options)\n end",
"def context\n unless @instance_context\n @instance_context = CampaignContext.new(@version, @params['sid'], )\n end\n @instance_context\n end",
"def context\n unless @instance_context\n @instance_context = WorkflowRealTimeStatisticsContext.new(@version , @params['workspace_sid'], @params['workflow_sid'])\n end\n @instance_context\n end",
"def context\n Zuul::Context.new context_type, context_id\n end",
"def contexts\n @store.contexts\n end"
] |
[
"0.6208964",
"0.61923033",
"0.60022753",
"0.58857155",
"0.5856376",
"0.5847113",
"0.5847113",
"0.5842006",
"0.58317757",
"0.58150333",
"0.58085984",
"0.57728934",
"0.5766288",
"0.5725633",
"0.57165337",
"0.57136184",
"0.5697591",
"0.5697591",
"0.56969374",
"0.56852114",
"0.56852114",
"0.56785536",
"0.56634885",
"0.56631297",
"0.56612647",
"0.5650695",
"0.5629246",
"0.56276214",
"0.5617839",
"0.5617839",
"0.5617839",
"0.5593073",
"0.55685484",
"0.55648744",
"0.5558073",
"0.5549794",
"0.5528718",
"0.5508044",
"0.5505375",
"0.55003947",
"0.54978675",
"0.54947764",
"0.54735744",
"0.54735744",
"0.5467173",
"0.5452401",
"0.5448491",
"0.54465854",
"0.5439684",
"0.543947",
"0.542529",
"0.5412604",
"0.54118395",
"0.5407946",
"0.5405205",
"0.54024345",
"0.54007924",
"0.5398129",
"0.539546",
"0.5381248",
"0.5379484",
"0.53746486",
"0.536694",
"0.53465354",
"0.5346142",
"0.5330888",
"0.532641",
"0.532641",
"0.53190804",
"0.53101987",
"0.530698",
"0.53052455",
"0.5300651",
"0.5300025",
"0.529616",
"0.52941966",
"0.52941966",
"0.5280805",
"0.52771914",
"0.5271465",
"0.5266016",
"0.5263766",
"0.5261327",
"0.5260838",
"0.52579796",
"0.5251551",
"0.5251551",
"0.5249417",
"0.5249335",
"0.52480173",
"0.52413785",
"0.52412426",
"0.5236364",
"0.52338034",
"0.52250683",
"0.5215016",
"0.5212376",
"0.5211715",
"0.52102953",
"0.519986",
"0.5197747"
] |
0.0
|
-1
|
=begin Dado un alfabeto, hace un corrimiento de n lugares regresando el alfabeto recorrido y ciclico =end
|
def recorre(alfabeto, corrimiento)
i = 0
while i < corrimiento
c = alfabeto[i]
alfabeto << c
i= i+1
end
alfabeto.slice!(0...i)
return alfabeto
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def activar()\n\n i=0\n\n print \"Inicio planta\\n\"\n\n cantidadCervezas = 0\n while(i < @ciclos)\n\n i+=1;\n print \"---------->Ciclo numero\",i,\"<---------------\\n\"\n\n #Inicio de procesamiento\n @silosCebada.producir(@almacen)\n @silosCebada.imprimir()\n @molino.producir(@almacen)\n @molino.imprimir()\n @pailaMezcla.producir(@almacen)\n @pailaMezcla.imprimir()\n @cuba.producir(@almacen)\n @cuba.imprimir()\n @pailaCoccion.producir(@almacen)\n @pailaCoccion.imprimir()\n @tanquePreclarif.producir(@almacen)\n @tanquePreclarif.imprimir()\n @enfriador.producir(@almacen)\n @enfriador.imprimir()\n @tcc.producir(@almacen)\n @tcc.imprimir()\n @filtroCerveza.producir(@almacen)\n @filtroCerveza.imprimir()\n @tanqueFiltroCerveza.producir(@almacen)\n @tanqueFiltroCerveza.imprimir()\n @llenadora.producir(@almacen) \n @llenadora.imprimir() \n\n #Verifica si hubo cambios en la cantidad de cervezas\n #en el ciclo\n cervezasCiclo = @almacen.obtener_insumo(\"cerveza\")\n if (cantidadCervezas != cervezasCiclo)\n print \"Cervezas Salientes: \", (cervezasCiclo - cantidadCervezas), \"\\n\\n\"\n cantidadCervezas = cervezasCiclo\n end \n\n end\n\n #Despues de haber terminado de fabricar, imprimimos lo que haya quedado\n #en el almacen\n @almacen.imprimir()\n\n end",
"def ligar #iniciando o método ligar\n puts 'O carro está ligado...' #imprime na tela a ação do método\n end",
"def mi_carrera\n\n\tend",
"def ligar #Metodo/função da classe Carro\n puts 'O carro está pronto para iniciar o trajeto.'\n end",
"def suivre; end",
"def cicloInactiva\n \n #-- Se calcula la cantidad de insumo basico requerido por la maquina C \n insumoRequerido = @porcentajeIB * @cantidadMax\n \n #-- Unicamente si se tiene la cantidad requerida de insumo basico\n #-- en el contenedor, se procede a analizar el resto de la mezcla\n if @insumoBasico.cantidad >= insumoRequerido \n \n #-- Caso en el que la maquina posee un contenedor de enlace\n #-- con una maquina anterior.\n if @productoAnterior != nil\n \n\n \n #-- Se calcula la cantidad de producto anterior requerido\n #-- por la maquina Compleja\n productoAnteriorRequerido = @porcentajePA * @cantidadMax\n cantidadAObtener = productoAnteriorRequerido -\n @productoAnteriorRestante \n \n \n #-- Caso en el que el producto encontrado en el contenedor\n #-- es suficiente para comenzar el procesamiento de \n #-- la maquina\n if @productoAnterior.cantidad >= cantidadAObtener\n \n #-- Se resta la cantidad necesaria para comenzar a \n #-- procesar de la cantidad encontrada en el contenedor\n @productoAnterior.cantidad -= cantidadAObtener\n \n #-- Se disminuye la cantidad de insumo basico del \n #-- contenedor\n @insumoBasico.cantidad -= insumoRequerido\n @productoAnteriorRestante = 0.0\n \n #-- La maquina pasa al estado LLena\n @estado = \"Llena\"\n \n #-- Caso en el que el producto encontrado en el contenedor\n #-- no es el suficiente para comenzar el procesamiento de\n #-- de la maquina\n else\n #-- Se recolecta en su totalidad la fraccion restante \n #-- de producto anterior del contenedor\n @productoAnteriorRestante += @productoAnterior.cantidad\n @productoAnterior.cantidad = 0\n \n end\n \n #-- Caso en el que la maquina corresponde a la primera dentro\n #-- del proceso de produccion. Unicamente se verifica el insumo\n #-- basico, pues no se depende de ningun producto anterior.\n else\n @insumoBasico.cantidad -= insumoRequerido\n \n #-- La maquina pasa al estado LLena\n @estado = \"Llena\"\n end\n end\n end",
"def pantallaPuntosRondas\n\t\tpuntos = \"\"\n\t\trondas = \"\"\n\n\t\t# Limpiamos pantalla\n\t\t@app.clear\n\t\t@app.background \"fondo.jpg\"\n\n\t\t@boxes = @app.stack :top => \"180\", :left => \"330\"\n\t\t@boxes.para \"Rondas\"\n\t\t@r = @boxes.edit_line\n \t@boxes.para \"Puntos\"\n \t@pu = @boxes.edit_line\n \t@enviar = @boxes.button \"OK\"\n \t@enviar.click do\n\t \t@rondas = @r.text\n\t\t\t@puntos = @pu.text\n\t\t\tif (@rondas == \"\" and @puntos == \"\")\n\t\t\t\t@boxes.append \"Debe indicar un numero de rondas o puntos.\"\n\t\t\telse\n\t\t\t\tpantallaJuego\n\t\t\tend\n\t\tend\n \t\n\tend",
"def construir_ruta(a, b)\n # ...\n\n puts 'Context: Definiendo ruta con la estrategia (no estoy seguro cual es)'\n @estrategia.algoritmo(a, b)\n\n # ...\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 logica\n puts \"\\nObservado: Estoy haciendo algo importante\"\n # Con un random, podemos hacer reaccionar al ObservadorA o ObservadorB.\n # @estado = rand(0..10)\n\n # Con esto reaccionan ambos\n @estado = 0\n puts \"\\nObservado: mi estado cambio a #{@estado}\"\n notificar\n end",
"def cobrar_alquiler costeAlquiler\n @propietario.modificar_saldo(costeAlquiler) \n end",
"def painel(ltChutes, numTentativas, numErros, totalAjudas, drawForca = 0)\n\n system \"clear\"\n puts \"\\n\"\n chute = []\n chute = ltChutes\n ajd = []\n ajd = listarAjudas(totalAjudas)\n countAjuda = 1\n\n puts \"Chutes: \".rjust(20) << chute.join(\" - \")\n puts \"Dica: \".rjust(20) << @plvDica\n puts \"\\n\"\n\n ajd.each do |aj|\n if countAjuda == 0\n puts \"Ajudas: \".rjust(20)\n elsif countAjuda == 1\n puts \"Ajudas: \".rjust(20) << \"#{countAjuda} - \" << aj\n countAjuda += 1\n else\n puts \" \".rjust(20) << \"#{countAjuda} - \" << aj\n countAjuda += 1\n end\n end\n\n puts \"\\n\"\n puts \"Tentativas: \".rjust(20) << numTentativas.to_s\n puts \"Erros: \".rjust(20) << numErros.to_s\n puts \"\\n\\n\"\n\n if drawForca == 0\n forcaVazia\n elsif drawForca == 1\n cabeca\n elsif drawForca == 2\n tronco1\n elsif drawForca == 3\n tronco2\n elsif drawForca == 4\n braco1\n elsif drawForca == 5\n braco2\n elsif drawForca == 6\n perna1\n elsif drawForca == 7\n enforcado\n end\n end",
"def discursarnolocal(pessoa, lugar)\n \"#{pessoa} discursou no #{lugar}\"\nend",
"def aplicar_a_jugador_salir_carcel(actual,todos)\r\n if jugador_correcto(actual,todos)\r\n informe(actual,todos)\r\n alguien_tiene_s_carcel = false\r\n indice = 0\r\n # preguntamos al resto de jugadores si tienen la carta que les libra de la carcel\r\n while indice < todos.length and not alguien_tiene_s_carcel\r\n if indice != actual\r\n alguien_tiene_s_carcel = todos.at(indice).tiene_salvoconducto\r\n end\r\n indice +=1\r\n end\r\n if not alguien_tiene_s_carcel\r\n todos.at(actual).obtener_salvoconducto\r\n salir_del_mazo\r\n end\r\n end\r\n end",
"def excede_control_de_pago_x_ticket_x_parlay(last_tickect_current_user, entrada) # define el monto maximo a sacar por parlay, ej. pago max para tripletas, cuartetas etc.. no por ticket sino por tipo de ticket parlay ok\n @sumatoria_posible_pago_todos_tickets_de_hoy_ese_parlay = 0 # inicializacion de variable de sumatoria en cero ok.\n #verificar tipo de parlay de ese ticket:\n parlay_count = Jugadalot.where(:ticket_id => last_tickect_current_user).count\n #parlay_count\n\n #switch case para asignar tipo de jugada segun tipo de parlay para buscar en control de pago:\n tipo_jugada = \"default\" # valor vacio para posible uso fuera de contexto de septimetas en adelante, hacer que retorne false la funcion ok. (no encontrado)\n \n #el switch case lo haremos de modo simple con el if statement por ahora ok:\n if parlay_count.to_i == 1\n tipo_jugada = \"directo\" \n end\n\n if parlay_count.to_i == 2\n tipo_jugada = \"pale\" \n end\n\n if parlay_count.to_i == 3\n tipo_jugada = \"tripleta\" \n end\n\n if parlay_count.to_i == 4\n tipo_jugada = \"cuarteta\" \n end\n\n if parlay_count.to_i == 5\n tipo_jugada = \"quinteta\" \n end\n\n if parlay_count.to_i == 6\n tipo_jugada = \"sexteta\" \n end\n\n if parlay_count.to_i == 7\n tipo_jugada = \"septimeta\" \n end\n\n if parlay_count.to_i == 8\n tipo_jugada = \"octaveta\" \n end\n\n control_monto_max_pago = Controldepagogt.where(:tipojugada => tipo_jugada ).first.limiteglobal.to_i\n\n #acabo de conseguir el limite global de ese parlay en curso, ahora buscar la sumatoria de todos las jugadalots.posiblepago de los ticket activo de hoy y ver si no sbobrepara ese limiet ok\n t_ids = Ticket.today.where(:activo => \"si\", :parlay => tipo_jugada.to_s ).ids # todos los ticket actio de hoy con ese parlay ok\n \n @listado_jugadas_a_sumar = Jugadalot.where(:ticket_id => t_ids)# POstgres casting sum string error ok..sum(:posiblepago).to_i\n \n if not @listado_jugadas_a_sumar.nil?\n @listado_jugadas_a_sumar.each do |jugada|\n @sumatoria_posible_pago_todos_tickets_de_hoy_ese_parlay += jugada.posiblepago.to_i\n end\n end\n\n \n\n #Sumar posible pago de esas jugadas de cada ticket parlay ok.\n #@sumatoria_posible_pago_todos_tickets_de_hoy_ese_parlay = 0\n #t.each do |ticket|\n # @sumatoria_posible_pago_todos_tickets_de_hoy_ese_parlay += Jugadalot.where(:ticket_id => ticket.id).last.posiblepago.to_i\n #end\n\n if @sumatoria_posible_pago_todos_tickets_de_hoy_ese_parlay.to_i <= control_monto_max_pago.to_i\n # si es menor todo ok\n false # no excede\n else\n true #si excede \n end\n\n\n end",
"def excede_control_de_pago_global()\n @sumatoria_posible_pago_todos_tickets_de_hoy_todos_parlay_global = 0 # inicializacionn de variable sumatoria en cero ok\n #La idea aqui es verificar si la sumatoria de posible pago de todas las jugadas de todos los tipos de tickets activos de hoy no excede el limite globar de riesgo del sistema ok\n \n #limite GLOBAL = 1 ADMINISTRATIVO OK Y TIPOJUGADA TAMBIEN MANUAL = GLOBAL OK TED. POPULATE IT IN DATABASE PRODUCTION OK:\n control_monto_max_pago_global = Controldepagogt.where(:tipojugada => \"global\" ).first.limiteglobal.to_i || 1 # setear un valor default ok \n\n t_ids = Ticket.today.where(:activo => \"si\").ids # todos los ticket actio de hoy con ese parlay ok\n \n @listado_sumatoria_posible_pago = Jugadalot.where(:ticket_id => t_ids)# postrges casting erro string ok .sum(:posiblepago).to_i\n \n if not @listado_sumatoria_posible_pago.nil?\n @listado_sumatoria_posible_pago.each do |jugada|\n @sumatoria_posible_pago_todos_tickets_de_hoy_todos_parlay_global += jugada.posiblepago.to_i\n end\n \n end\n \n \n #Sumar posible pago de esas jugadas de cada ticket parlay ok.\n# @sumatoria_posible_pago_todos_tickets_de_hoy_todos_parlay_global = 0\n# t.each do |ticket|\n# @sumatoria_posible_pago_todos_tickets_de_hoy_todos_parlay_global += Jugadalot.where(:ticket_id => ticket.id).last.posiblepago.to_i\n# end\n\n if @sumatoria_posible_pago_todos_tickets_de_hoy_todos_parlay_global.to_i <= control_monto_max_pago_global.to_i\n # si es menor todo ok\n false # no excede\n else\n true #si excede \n end\n\n\n end",
"def comer\r\n # @image = Image[\"pez2.png\"]\r\n # Al comer, un pez tendrá x segundos mas de vida, y queda libre para buscar mas comida\r\n @vida_inicio += 2\r\n @libre = true\r\n end",
"def recolectar_una\n\t\test = \"\"\n\t\tif @estado == ESTADO::MUERTE\n\t\t\test = \"El árbol está muerto\"\n\t\telse\n\t\t\tif @contador == 0\n\t\t\t\test = \"No hay más naranjas\"\n\t\t\telse\n\t\t\t\test = \"La naranja estaba deliciosa\"\n\t\t\t\t@contador -= 1\n\t\t\tend\n\t\tend\n\t\test\n\tend",
"def grasa(sexo,peso,talla)\n\t\t@grasa = 1.2*imc(peso,talla)+0.23*@edad-10.8*sexo-5.4\n\tend",
"def cabecera\n puts \"\"\n puts \"\"\n puts \"El examen va a comenzar.\"\n puts \" Debe responder poniendo solo el caracter de la respuesta elegida.\"\n print \" El examen consta de \"\n print @numeroPreguntas\n puts \" preguntas.\"\n end",
"def aplicar_efecto(objeto_espacial_generador_de_choque, objeto_espacial_receptor_de_choque)\n porcentaje_de_masa_actual = @porcentaje_de_masa\n if(porcentaje_de_masa_actual.to_s.include? \"%\")\n porcentaje_de_masa_actual.gsub!(/%/, \"\")\n end\n objeto_espacial_generador_de_choque.masa = objeto_espacial_generador_de_choque.masa + ((porcentaje_de_masa_actual.to_f/100) * objeto_espacial_receptor_de_choque.masa) \n end",
"def setear_fijos_arbol\n # @incisos = Inciso.all\n # @partidas_principales = PartidaPrincipal.all\n # @partidas_parciales = PartidaParcial.all \n @clases = Clase.where(\"fecha_de_baja IS NULL\")\n @bienes_de_consumo = BienDeConsumo.where(\"fecha_de_baja IS NULL\")\n end",
"def aplicar_a_jugador_ir_a_casilla(actual,todos)\r\n casilla = -1\r\n if jugador_correcto(actual,todos)\r\n informe(actual,todos)\r\n casilla = todos.at(actual).get_num_casilla_actual\r\n tirada = @tablero.calcular_tirada(casilla,@valor)\r\n nueva = @tablero.nueva_posicion(casilla,tirada)\r\n todos.at(actual).mover_a_casilla(nueva)\r\n @tablero.get_casilla(nueva).recibe_jugador(actual,todos)\r\n end\r\n end",
"def jeuTermine\n\t\tlancementAventure(@tailleGrille+1)\n\tend",
"def extraer_inicio()\n @cola=@cola.next\n\n end",
"def turno!\r\n\t\t#CICLO PARA PASAR POR EL ARREGLO HASTA ENCONTRAR LAS CELDAS VIVAS O LAS CELULAS MUERTAS QUE CUMPLEN CON LA REGLA 4\r\n\t\tfor f in 0..@y1-1\r\n\t\t\tfor c in 0..@x1-1\r\n\r\n\t\t\t\tif @matriz[f][c] == true\r\n\t\t\t\t\tVecinos(@matriz,f,c) #checo cuantos vecinos tengo alrededor\r\n\t\t\t\t\tReglas(@matriz,@matrizTMP,@cuantos,f,c)#verifico si cumple alguna regla de conway\r\n\r\n\t\t\t\t\t\t\r\n\t\t\t\telse # de lo contrario la celda esta en false y debo comprobar la regla 4\r\n\t\t\t\t\t\r\n\t\t\t\t\tVecinos(@matriz,f,c) #regreso cuantos vecinos tiene vivos\r\n\t\t\t\t\t#REGLA 4. Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.\r\n\t\t\t\t\tif @cuantos == 3\r\n\t\t\t\t\t\t@matrizTMP[f][c] = true\r\n\t\t\t\t\tend\r\n\t\t\t\tend #cierra if\r\n\t\t\tend #cierra ciclo for\r\n\t\tend #cierra ciclo for \r\n\r\n\t\t#ACTUALIZO LA MATRIZ CON LA TEMPORAL QUE ES COMO DEBE QUEDAR AHORA EL JUEGO\r\n\t\tfor f in 0..@y1-1\r\n\t\t\tfor c in 0..@x1-1\r\n\t\t \t\t@matriz[f][c]=@matrizTMP[f][c]\r\n\t\t\tend\r\n\t\tend\r\n\r\n\tend",
"def secuenciasugerida \n #recupera los hijos del padre de la cuenta a crear \n\t\thijos = Catalogo.where(\"padre_id = ? AND activo = ?\", idcuenta, true)\n\n #configuracion del nivel a crear\n\t\tidnivel = Catalogo.find_by(id: idcuenta).nivel_id\n\t\tnivelh = Nivel.find_by(id: idnivel).numnivel + 1\n\n nivel = Nivel.find_by(numnivel: nivelh)\n nrodigitos = nivel.nrodigitos\n nrodigitostotal = nivel.nrodigitostotal\n digito = 0\n aux = 0\n\n hijos.each do |e|\n \taux = e.codigo.last(nrodigitos).to_i\n \t\tif digito < aux\n\t\t\t\tdigito = aux\n \t\tend\n \tend\n \tdigito = digito + 1\n \tc =\"\"\n \tnrodigitos.times { c = c + \"0\" }\n \tc = c.to_s + digito.to_s \t\n \t\t\n #codigo sugerido\n \treturn c.last(nrodigitos).to_s\n\tend",
"def llamar() #imprimira marca y color este metodo, ese metodo usa las variables de instancia\n puts @marca + \"-\"+ @color + \" esta llamando...\"\n end",
"def limpar\n\t\tfor ct in (0..($CarrinhoCompras.size - 1))\n\t\t\t$CarrinhoCompras[ct] = \"\"\n\t\tend\n\t\tfor ct in (0..($CarrinhoComprasQuant.size - 1))\n\t\t\t$CarrinhoComprasQuant[ct] = 0\n\t\tend\n\t\t\n\t\t\t$CarrinhoCompras.delete(\"\")\t\t# APAGANDO ITENS DO CARRINHO\n\t\t\t$CarrinhoComprasQuant.delete(0)\t\t# APAGANDO Quantidade referente a item\n\t\tredirect_to \"/compras?pd=\" + Admloja.first.mcab.to_s\n\tend",
"def producir(almacen)\n \n #Si la maquina esta inactiva, se intenta traer los insumos que requiere\n #del almacen. Si obtiene lo que desea, pasa al estado de llena.\n if (@estado == \"inactiva\")\n for i in (0..insumos.size-1)\n c = (@porcentaje[i]*@cant_max - @cantidadInsumos[i])\n if (c!=0)\n r = almacen.traer_insumo(@insumos[i],c)\n @cantidadInsumos[i] += r\n end\n end\n #Revisa si se lleno la maquina\n total = 0\n for i in (0..insumos.size-1)\n total += @cantidadInsumos[i]\n end\n if (total == @cant_max)\n @estado = \"llena\"\n end\n \n #Si la maquina esta llena, se pasa al estado de procesando.\n elsif (@estado == \"llena\")\n @estado = \"procesando\"\n\n #Si la maquina esta procesando, se mantiene en este estado hasta que sus\n #ciclos de iteracion hayan finalizado.\n elsif (@estado == \"procesando\")\n if (@ciclos == @ciclos_realizados)\n @estado = \"en espera\"\n else\n @ciclos -= 1\n end\n\n #Si la maquina esta en espera, es decir, termino de procesar, deposita\n #lo fabricado en el almacen y cambia a estado de inactiva solo si en el\n #almacen ya se ha consumido lo que produjo.\n elsif (@estado == \"en espera\")\n \n total=0\n #ciclo para reiniciar mis insumos en 0 y contabilizar.\n for i in (0..insumos.size-1)\n\t total+=@cantidadInsumos[i]\n @cantidadInsumos[i] = 0\n end\n #Depositare\n #Obtengo mi insumo creado\n n=mapear(@nombre)\n almacen.sumar_insumo(n,total*(1-@desecho))\n\n\n #Si ya no hay insumos de la maquina, pasa a inactiva\n #En caso \n t = almacen.obtener_insumo(n)\n if (t == 0 || n == \"cerveza\")\n @estado = \"inactiva\"\n @ciclos_realizados = 0 \n end \n end\n end",
"def adivinarfecha(fecha_control)\r\n puts \"Adivine la fecha, por favor :\"\r\n contador=0\r\n begin\r\n puts \"Ingrese la fecha:\"\r\n fecha_ing=ingresgar_fecha()\r\n acierto_parcial(fecha_ing,fecha_control)\r\n contador=contador+1\r\n end until(son_iguales_fechas(fecha_control,fecha_ing))\r\n puts \"Exito.Se realizaron #{contador} intentos antes de poder acertar la fecha\"\r\nend",
"def get_alco\n @_100=((@alco*100)/@peso)\n #@ir_100=(@_100/90)*100\n @porcion=((@alco*@gramos_porciones)/@peso)\n #@ir_porcion=(@porcion/90)*100\n [ @alco , @_100 , 0 , @porcion , 0 ]\n end",
"def auto_recibir\n g = Guia.find(params[:id])\n carpeta = 188\n buzones = g.copias.collect{|c| c.buzon_id}.uniq\n carpetas = g.copias.collect{|c| c.carpeta_id}.compact\n if buzones === [95] and carpetas.length == 0\n #FIXME falta filtrar solo los docs = oficio\n Guia.find(2863).copias.each{|c| c.recibir_auto(current_user) unless c.estado_id == 5; c.archivar_auto(current_user,carpeta); c.save}\n end\n end",
"def relatorios\n end",
"def corrigir_mensagem\n\n @responsavel_envio = \"VERONIQUE\"\n corrigir_pasta.click\n numero_mensagem_corrigir.click\n corrigir_button.click\n responsavel_envio_select2.select(@responsavel_envio)\n assinatura_radio2[0].click\n sleep(0.5)\n providencia_textarea.set(@providencia)\n salvar_button.click\n end",
"def rla\n end",
"def changerEnRouge\n\t\t@couleur=1\n\tend",
"def pantallaInicial\n\n\t\t@app.clear\n\t\t@app.background \"fondo.jpg\"\n\t\t@inicio = @app.stack :top => \"180\", :left => \"330\"\n\t\t@inicio.caption \"Bienvenido al Juego\"\n\t\t@inicio.tagline \"Piedra Papel Tijeras Lagarto Spock\"\n\t\t@botonInicio = @inicio.button \"Empezar\"\n\t\t@botonFinal = @inicio.button \"Salir\"\n\t\t\n\t\t@botonInicio.click do\n\t\t\tpantallaEstrategias \"1\"\n\n\t\t\t@sig = @estrategias.button \"Siguiente\"\n\t\t\t@sig.click do\n\t\t\t\tpantallaEstrategias \"2\"\n\t\t\t\t@sig2 = @estrategias.button \"Siguiente\"\n\t\t\t\t@sig2.click do\n\t\t\t\t\t\n\t\t\t\t\tpantallaPuntosRondas\n\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\n\t\tend\n\n\t\t@botonFinal.click do\n\t\t\t@app.close\n\t\tend\n\tend",
"def ordenar_cola(array=[])\n size = array.size\n for i in 0..size-1\n @paso.push(\"ingresar #{array[i]}\")#paso..\n nodo = {\n valor: array[i],\n siguiente: nil\n }\n if @cola[:esta_vacia]\n @cola[:tope]=nodo\n @cola[:fondo]=nodo\n @cola[:esta_vacia]=false\n @cola[:size]+=1\n\n else\n if array[i]>@cola[:fondo][:valor]\n fondo = @cola[:fondo]\n fondo[:siguiente]=nodo\n @cola[:fondo]=nodo\n @cola[:size]+=1\n @paso.push(mostrar_cola())\n else\n vaciar(nodo,array[i])\n end\n end\n end\n end",
"def atacar(enemigo)\n enemigo.lose_salud(@fuerza) #'@fuerza' es una variable del objeto que llama a 'atacar'\nend",
"def moverPrimasADespacho(cantidad_lotes)\n\t\n\nend",
"def concadenar \n\t\tcadena = \"hola\"\n\t\tcadena << \"mundo xd\" #el signo << agrega la cadena entre comillas a la variable cadena con el dato \"hola\"\n\n\t\tcadenados = 2+1\n\t\tcadena.concat(33) #otra forma de concadenar y el significado del numero 33 es un signo de exclamacion luego de la cadena ya concadenada previamente\n\t\tprint \"Resultado de la suma de 2 mas 1 es #{cadenados} jaja brigido\"\n\t\tprint \" \"\n\t\tprint cadena \t\n\tend",
"def relacion_cc\n\t\t(ccintura / ccadera).round(2)\n\tend",
"def planilla\n move_down(@@interlineado)\n # parte 1\n indent(@@margin) do\n table_info = [\n [ {image: \"#{Rails.root}/public/Barcodes/Code128B_#{@solicitud.numero_planilla}.png\"},\n {content: \"\\nNúmero de Planilla: #{sprintf '%013d', @solicitud.numero_planilla }\"}]\n ]\n width_columns = [260, 260]\n draw_table_two_columns(table_info, width_columns)\n end\n # parte 2\n indent(@@margin) do\n table_info = [\n ['Datos del Solicitante']\n ]\n width_columns = [520]\n\n # Aplica el formato de la tabla creada anteriormente\n draw_table_titulos_columns(table_info, width_columns)\n end\n indent(@@margin) do\n table_info = [\n [ {content:\"Nombre y Apellido: #{@usuario_sput.nombre + ' ' + @usuario_sput.apellido}\", colspan: 2},\n {content:\"Identificación: #{@usuario_sput.nacionalidad + ' ' + @usuario_sput.numero_doc}\",\n colspan: 2}],\n [{content:\"Teléfonos: #{telefono @usuario_sput.telefono_local}\", colspan: 2},{content:\"Correo Electrónico: #{@usuario_sput.session_user.email} \", colspan: 2}],\n [{ content:\"Dirección: #{@representante_legal.direccion}\", colspan: 4}]\n ]\n width_columns = [130, 130, 130, 130]\n\n # Aplica el formato de la tabla creada anteriormente\n draw_table_four_columns(table_info, width_columns)\n end\n # parte 3\n indent(@@margin) do\n table_info = [\n ['Datos de la Escuela de Transporte']\n ]\n width_columns = [520]\n\n # Aplica el formato de la tabla creada anteriormente\n draw_table_titulos_columns(table_info, width_columns)\n end\n indent(@@margin) do\n table_info = [\n [ {content:\"Nombre: #{@escuela_transporte.razonSocial}\", colspan: 2},\n {content:\"Nombre Comercial: #{@escuela_transporte.razonSocial}\", colspan: 2}],\n [ {content:\"Tipo de Escuela: #{@escuela_transporte.tipo_escuela.nombre} \", colspan: 2},\n {content:\"Rif: #{@escuela_transporte.tipo_rif+@escuela_transporte.rif.to_s+ @escuela_transporte.digito_rif.to_s} \", colspan: 2}],\n [{content:\"Teléfono: #{telefono @escuela_transporte.telefono} \", colspan: 2},\n {content:\"Teléfono Móvil: #{telefono @escuela_transporte.movil}\", colspan: 2}],\n [{content:\"Email: #{@escuela_transporte.email} \", colspan: 2},\n {content:\"Dirección Web: #{@escuela_transporte.url}\", colspan: 2}],\n\n ]\n width_columns = [130, 130, 130, 130]\n\n # Aplica el formato de la tabla creada anteriormente\n draw_table_four_columns(table_info, width_columns)\n end\n\n indent(@@margin) do\n table_info = [\n ['Dirección Fiscal']\n ]\n width_columns = [520]\n\n # Aplica el formato de la tabla creada anteriormente\n draw_table_titulos_columns(table_info, width_columns)\n end\n\n indent(@@margin) do\n table_info = [\n [{content:\"Estado: #{@escuela_transporte.ciudad.estado.nombre}\", colspan: 1, :size => 6},\n {content:\"Ciudad: #{@escuela_transporte.ciudad.nombre} \", colspan: 1, :size => 6},\n {content:\"Municipio: #{@escuela_transporte.parroquia.municipio.nombre}\", colspan: 1, :size => 6},\n {content:\"Parroquia: #{@escuela_transporte.parroquia.nombre}\", colspan: 1, :size => 6}],\n [{content:\"Sector/Urbanización: #{@escuela_transporte.direccion}\", colspan: 4}]\n\n ]\n width_columns = [130, 130, 130, 130]\n\n # Aplica el formato de la tabla creada anteriormente\n draw_table_four_columns(table_info, width_columns)\n\n end\n # parte 4\n\n indent(@@margin) do\n table_info = [\n ['Trámites']\n ]\n width_columns = [520]\n draw_table_titulos_columns(table_info, width_columns)\n end\n indent(@@margin) do\n table_info = [\n [ {content: \"Trámite: Autorización para la construcción y adecuación \", colspan: 2, :size => 6},\n {content: \"Número de Trámite: #{sprintf '%012d',@solicitud.id}\", colspan: 2, :size => 6}]\n ]\n width_columns = [130,130,130,130]\n draw_table_four_columns(table_info, width_columns)\n end\n\n # parte 5\n flota(@solicitud.vehiculo_pres)\n\n # parte 6\n start_new_page if cursor <= 200\n indent(@@margin) do\n table_info = [\n [ 'Funcionario Receptor', 'Solicitante']\n ]\n width_columns = [260, 260]\n\n # Aplica el formato de la tabla creada anteriormente\n draw_table_pie_columns(table_info, width_columns)\n pie_planilla\n end\n\n end",
"def calculo \n self.minutos_reales = 5 * 480 #cantidad de OPERARIOS * Jornada de Trabajo(Turnos)\n self.costo_minuto = 89 #Costo Real por minuto\n self.otros_costos = 540 * 89 #Tiempo Total(Minutos) * Costo Real por Minutos\n self.costo_mano_obra = 420 * 5 * 89 # Jornada Minutos * Cantidad Operarios * Costo Real por minutos \n self.manoObraPlaneada = 650.000 * 5 # Salario Total * Cantidad de operarios \n end",
"def correr\n puts MENU\n print \"Que Deseas Hacer? \\n>> \"\n opcion = gets.chomp.to_i\n if opcion == 0\n puts \"GOD BYE....\"\n return opcion\n elsif opcion > 6\n puts \"Opcion no registrada.\"\n return 0 \n end\n salida = 0\n puts \"Indicar ruta del archivo\"\n ruta = gets.chomp\n #puts ruta\n managment = Manejador.new(ruta)\n if opcion == 1\n grals = Generales.new(managment)\n grals.frecuencias(true)\n salida = 1\n elsif opcion == 2\n puts \"Pendiente......\"\n salida = 2\n elsif opcion == 3\n cesar = Cesar.new(managment, true)\n puts \"Dame el desplazamiento. \"\n desplazamiento = gets.chomp.to_i\n cesar.cifrar_Cesar(desplazamiento)\n system(\"rm texto_limpio.txt\")\n salida = 3\n elsif opcion == 4\n cesar = Cesar.new(managment, false)\n puts \"Dame el desplazamiento. \"\n desplazamiento = gets.chomp.to_i\n cesar.des_encriptar_cesar(desplazamiento)\n salida = 4\n elsif opcion == 5\n vigen = Vigenere.new(managment, true)\n puts \"Dame la llave del cifrado.\"\n _key = gets.chomp.upcase\n vigen.cifra_vigenere(_key)\n system(\"rm texto_limpio.txt\")\n salida = 5\n elsif opcion == 6\n vigen = Vigenere.new(managment, false)\n puts \"Dame la llave del cifrado.\"\n _key = gets.chomp.upcase\n vigen.des_cifra_vigenere(_key)\n salida = 6\n end\n return salida\n end",
"def porc_grasa\n\t\t(1.2 * self.indice_masa_corporal + 0.23 * edad - 10.8 * sexo - 5.4).round(1)\n\tend",
"def rlca\n end",
"def huella\n huella = @alimentos.inject([0,0,0]) do |acc, i|\n if i.kcal_total < 670\n acc[0] += (1.0 * (@gramos[acc[1]].valor / (i.proteinas + i.lipidos + i.carbohidratos)))\n elsif i.kcal_total > 830\n acc[0] += (3.0 * (@gramos[acc[1]].valor / (i.proteinas + i.lipidos + i.carbohidratos)))\n else acc[0] += (2.0 * (@gramos[acc[1]].valor / (i.proteinas + i.lipidos + i.carbohidratos)))\n end\n if (i.gases * 1000.0) < 800\n acc[0] += (1.0 * (@gramos[acc[1]].valor / (i.proteinas + i.lipidos + i.carbohidratos)))\n elsif (i.gases * 1000.0) > 1200\n acc[0] += (3.0 * (@gramos[acc[1]].valor / (i.proteinas + i.lipidos + i.carbohidratos)))\n else\n acc[0] += (2.0 * (@gramos[acc[1]].valor / (i.proteinas + i.lipidos + i.carbohidratos)))\n\t\t\tend\n\n\t\t\tacc[2] += (@gramos[acc[1]].valor / (i.proteinas + i.lipidos + i.carbohidratos))\n acc[1] += 1\n acc\n\t\tend\n\n\t\treturn (huella[0] / (2.0 * huella[2])).round(2)\n\tend",
"def extraer_inicio()\n @cola=@cola.next\n end",
"def IniciaArea\n\t\t@Lojaq = Admloja.all\n\t\tif @Lojaq.size != 1\t# Se não houver exatamente um registro\n\t\t\t@loja = Admloja.all\n\t\t\t# @loja.delete.all\n\t\t\t# Admloja.delete\n\t\t\t@Novo = Admloja.new\n\t\telse\n\t\t\treturn\n\t\tend\n\n\t\t@Novo.nome = \"MINI LOJA VIRTUAL\"\n\t\t@Novo.cnpj = \"33014556000196\"\n\t\t@Novo.endereco = \"Rua José Dias, 1024\"\n\t\t@Novo.cidade = \"São José dos Campos\"\n\t\t@Novo.bairro = \"Jd. Aquarius\"\n\t\t@Novo.estado = \"SP\"\n\t\t@Novo.tel = \"1212341234\"\n\t\t@Novo.fax = \"1243214321\"\n\t\t@Novo.cel = \"1212345678\"\n\t\t@Novo.email = \"lojavirtual@modelo.com\"\n\t\t@Novo.password = \"175a6350f1f49ed49ab438ab6b2e0e45f6d3b8f9\"\t# senha\n\t\t@Novo.pagadm = 6\n\t\t@Novo.pagloja = 12\n\t\t@Novo.mcab = 1\n\t\t@Novo.maxsec = 0\n\t\t@Novo.maxdep = 0\n\t\t@Novo.upreco = 1\n\t\t@Novo.udesconto = 0\n\t\t@Novo.ufrete = 1\n\t\t@Novo.freefrete = 150\n\t\t@Novo.rodape = \"<strong> ESTE É O RODAPÉ DA LOJA VIRTUAL </STRONG>\"\n\t\t@Novo.cabecalho = '<div class=\"destaque\"><center>Aproveite as promoções da Loja Virtual! <br>Todos os produtos foram cuidadosamente selecionados pra você!<br>Conforto, Segurança e Tecnologia, <br>agora você encontra aqui!!!<br></div>'\n\t\t@Novo.cep = \"12345691\"\n\t\t@Novo.complemento = \"\"\n\t\t@Novo.cpostal = \"\"\t\t\n\t\t@Novo.save\n\t\treturn\n\tend",
"def get_importe_cancelar_hipoteca()\n \n \n cantidad_recibida = (@precio_hipoteca_base*(1+(@num_casas*0.5)+(@num_hoteles*2.5)));\n return cantidad_recibida*@@FACTORINTERESESHIPOTECA;\n \n end",
"def aplicar_a_jugador_por_casa_hotel(actual,todos)\r\n if jugador_correcto(actual,todos)\r\n informe(actual,todos)\r\n todos.at(actual).modificar_saldo(@valor*todos.at(actual).cantidad_casas_hoteles)\r\n end\r\n end",
"def visualizar_previa_carteira(tipo_finalizacao)\n if (wait_until_aba_previa_carteira_visible)\n @tipo_finalizacao = tipo_finalizacao\n\n if (@tipo_finalizacao == \"Concluir\" && @periferico == \"Sem Periferico\")\n puts \"Visualizando e Encerrando Previa da carteira\"\n concluir_btn.click\n page.assert_text(\"Dados salvos com sucesso\")\n encerrar_btn.click\n elsif (@tipo_finalizacao == \"Suspender\")\n @justificativa_suspensao = \"Suspendendo Solicitacao\"\n\n puts \"Clicando para suspender solicitacao\"\n suspender_btn.click\n puts \"Preenchendo justificativa de suspensao: #{@justificativa_suspensao}\"\n justificativa_suspensao_textarea.click.set(@justificativa_suspensao)\n puts \"Clicando para gerar termo de suspensao\"\n # VINICIUS_VERIFICAR PORQUE ESTA 1X\n gerar_termo_suspensao_btn.click\n aguardar_carregamento_load\n\n # VINICIUS_VERIFICAR PORQUE ESTA 2X\n puts \"Clicando para gerar termo de suspensao segunda vez\"\n gerar_termo_suspensao_btn.click\n aguardar_carregamento_load\n switch_to_window(windows.last)\n has_div_processo_suspenso?(wait: 10)\n\n sleep(0.1)\n\n # VINICIUS_VERIFICAR VERIFICAR MELHORIA DE PROCESSO DE ABAS\n page.execute_script \"window.close();\"\n switch_to_window(windows.last)\n page.execute_script \"window.close();\"\n switch_to_window(windows.first)\n elsif (@tipo_finalizacao == \"Concluir\" && @periferico == \"Com Periferico\")\n avancar_proximo_processar_atendimento\n impossibilidade_digital_btn.click\n impossibilidade_digital_textarea.click.set(\"Impossibilitado para impressão de digital\")\n impossibilidade_assinatura_btn.click\n impossibilidade_assinatura_textarea.click.set(\"Impossibilitado para assinatura\")\n concluir_btn.click\n page.assert_text(\"Dados salvos com sucesso\")\n encerrar_btn.click\n end\n else\n puts \"Aba previa da carteira não localizada\"\n end\n end",
"def reactivacion\r\n\t\tif session[:usuario_id]\r\n\t\t\tenti = Usuarioentidad.where(usuario_id: session[:usuario_id]).take\r\n\t\tend\r\n\t\t#Solamente el consejo de facultad tiene la posibilidad de reactivar instructores\r\n\t\tif session[:usuario_id] && session[:entidad] == true && enti.entidad_id == 13\r\n\t\t\tsession[:adecuacion_id] = nil\r\n\t\t\tsession[:plan_id] = nil\r\n\t\t\tsession[:instructorName] = nil\r\n\t\t\tsession[:informe_id]=nil\r\n\t\t\t@cjpTipo=Usuario.find(session[:usuario_id]).tipo\r\n\t\t\t@nombre = session[:nombre_usuario]\r\n\t\t\t@usu=Usuarioentidad.where(entidad_id: session[:entidad_id]).take\r\n\t\t\t@entidad_escuela_id= @usu.escuela_id\r\n\t\t\t@usuarios = Usuario.where(activo: 0).all\r\n\t\t\t@instructores = []\r\n\t\t\tcpcontador = 0\r\n\t\t\t@instructores[cpcontador] = Array.new(2) { |i| }\r\n\t\t\t@instructores[cpcontador][0] = \"Seleccione el instructor\"\r\n\t\t\t@instructores[cpcontador][1] = 0\r\n\t\t\tcpcontador = cpcontador + 1\r\n\r\n\t\t\t@usuarios.each do |usuari|\t\t#Arreglo con los usuarios inahibilitados\r\n\t\t\t\tcppersona = Persona.find_by usuario_id: usuari.id\r\n\t\t\t\t@instructores[cpcontador] = Array.new(2) { |i| }\r\n\t\t\t\t@instructores[cpcontador][0] = cppersona.nombres.to_s.split.map(&:capitalize).join(' ') + \" \" + cppersona.apellidos.to_s.split.map(&:capitalize).join(' ')\r\n\t\t\t\t@instructores[cpcontador][1] = usuari.id\r\n\t\t\t\tcpcontador = cpcontador + 1\r\n\t\t\tend\r\n\r\n\t\t\ti = 1\r\n\t\t\tj = 1\r\n\t\t\tnombre = \"hola\"\r\n\t\t\tcpid = 1\r\n\r\n\t\t\t#Ordena los nombres por orden alfabetico (Ordenamiento Burbuja)\r\n\t\t\twhile i < cpcontador do\r\n\t\t\t\tnombre = @instructores[i][0]\r\n\t\t\t\tcpid = @instructores[i][1]\r\n\t\t\t\tj = i + 1\r\n\t\t\t\twhile j < cpcontador do\r\n\r\n\t\t\t\t\tif @instructores[j][0] < nombre\r\n\t\t\t\t\t\t@instructores[i][0] = @instructores[j][0]\r\n\t\t\t\t\t\t@instructores[i][1] = @instructores[j][1]\r\n\t\t\t\t\t\t@instructores[j][0] = nombre\r\n\t\t\t\t\t\t@instructores[j][1] = cpid\r\n\t\t\t\t\t\tnombre = @instructores[i][0]\r\n\t\t\t\t\t\tcpid = @instructores[i][1]\r\n\t\t\t\t\tend\r\n\r\n\t\t\t\t\tj +=1\r\n\t\t\t\tend\r\n\t\t\t\ti +=1\r\n\t\t\tend\r\n\r\n\t\telse\r\n\t\t\tredirect_to controller:\"forminst\", action: \"index\"\r\n\t\tend\r\n\tend",
"def anulacion \n @solicitud=Solicitud.find(params[:id])\n @causal_select=CausalesAnulacionRevocatoria.find(:all,:conditions=>\"anulacion=true\",:order=>\"causa asc\")\n @width_layout = '660'\n end",
"def rever(artigo, pessoa, nota)\n atual = State.new(anterior: self)\n\n #precondicao\n raise \"artigo_nao_submetido\" unless atual.submetidos.include? artigo\n\n #liveness\n artigo.avaliar! pessoa, nota\n\n atual\n end",
"def grafico_area_oferta(modalidad, offer_title = nil, real_data = true)\n # VERIFICAR SI FUNCIONA PARA CASOS EN QUE NO SE TIENE SUFICIENTE INFORMACION\n aux = modalidad == SALE ? \"venta\" : \"arriendo\"\n title = @num_title.to_s + \".\" + @num_subtitle.to_s + \" Área promedio (#{aux.capitalize})\"\n legend = \"<b>Área promedio</b> de cada propiedad en <b>\" + aux + \"</b>\"\\\n \" en relación a la cantidad de habitaciones.\"\n space_points = 0\n parts = []\n\n # Titulo oferta y subtitulo.\n parts << {type: :offer_title, content: offer_title}\n parts << {type: :sub_title, content: title}\n\n if real_data\n # CONSULTAS BD\n rooms_area = []\n zero_count = 0\n min_rooms = @type_of_property == [HOUSE] ? HOUSE_MIN_ROOMS : 1\n for rooms in min_rooms..(min_rooms + 3)\n room_area = @stats.properties_mean_area(modalidad, rooms, @type_of_property)\n zero_count += 1 if room_area == 0\n rooms_area << room_area\n end\n\n if zero_count == rooms_area.size\n # No hay datos\n legend = NO_MESSAGE\n\n else\n # Hay datos\n # Grafico\n parts << {type: :graph}\n end\n\n # texto.\n parts << {type: :text, content: legend}\n\n # CHECKEAR ESPACIO EN LA PAGINA\n space_points += getTotalHeight(parts)\n checkPageSkip(space_points)\n\n # TITULO OFERTA\n drawOfferTitle(offer_title)\n\n # TITULO\n drawSubTitle(title, :oferta)\n\n # TEXTO\n drawText(legend)\n\n # GRAFICO\n if zero_count != rooms_area.size\n g = Gruff::Bar.new\n g.theme = GRAPH_STYLE\n g.title = \"Área promedio en \" + aux\n g.y_axis_label = \"Área en m^2\"\n g = formatDecimalLabels(aux, g)\n # la funcion acontinuacion retorna un string de error si lo hay y pone la\n # data en el grafico\n errores = data_por_habitacion(rooms_area, g, OFFER)\n g.minimum_value = 0\n g.show_labels_for_bar_values = true\n pad_bottom(PADDING * 2) do \n image StringIO.new(g.to_blob), GRAPH_POS\n end\n\n printErrors(errores)\n end\n\n else\n # parts << {type: :text, content: legend}\n # space_points += getTotalHeight(parts)\n\n png_path = Rails.root.join('app', 'pdfs', 'placeholders', 'area_promedio_arriendo_placeholder.jpg')\n drawFakeData(space_points, png_path, title, :oferta, offer_title)\n\n end\n end",
"def realizar_cuestionario\n @paciente = Paciente.find(params[:id])\n @accionPerfilamiento = \"Cuestionario Tipo Frustraciones\"\n end",
"def lentille_miroir\n if o.lentille\n return \"\n % Dessin de la lentille et des points focaux\n \\\\draw [ultra thick] (-0.5,#{-HAUTEUR+o.fpsign*0.5}) -- (0,-#{HAUTEUR}) -- (0.5,#{-HAUTEUR+o.fpsign*0.5})\n (-0.5,#{ HAUTEUR-o.fpsign*0.5}) -- (0, #{HAUTEUR}) -- (0.5,#{ HAUTEUR-o.fpsign*0.5}) ;\n \\\\filldraw [black] (#{ o.fp},0) circle (2pt) node [above #{right(o.fpsign)}] {$F'$};\n \\\\filldraw [black] (#{-o.fp},0) circle (2pt) node [above #{left(o.fpsign)}] {$F$} ;\n \\\\filldraw [black] (0,0) circle (2pt) node [above right] {$O$} ;\n \"\n else\n return \"\n \\\\draw [ultra thick] (#{-0.5*o.fpsign},#{-HAUTEUR-0.5}) -- (0,-#{HAUTEUR}) \n (#{-0.5*o.fpsign},#{ HAUTEUR+0.5}) -- (0, #{HAUTEUR}) ;\n \\\\filldraw [black] (#{-o.fp},0) circle (2pt) node [above #{right(o.fpsign)}] {$F$};\n \\\\filldraw [black] (#{-2*o.fp},0) circle (2pt) node [above #{left(o.fpsign)}] {$C$} ;\n \\\\filldraw [black] (0,0) circle (2pt) node [above right] {$S$} ;\n \" + (0..(2*HAUTEUR-1)).to_a.map{|e| \"\\\\draw [ultra thick] (0,#{-HAUTEUR+0.5+e}) -- (0.5,#{-HAUTEUR+0.5+e+0.5});\"}.join(\"\\n\")\n end\n end",
"def mostrar_saldo_ca\n if @c_ahorro>0\n puts \"El saldo de tu cuenta de ahorro es: $#{@s_ahorro}\"\n else\n puts \"No tienes cuenta de ahorro\"\n end\n self\n end",
"def aplicar_a_jugador_ir_carcel(actual,todos)\r\n if jugador_correcto(actual,todos)\r\n informe(actual,todos)\r\n jugador.encarcelar\r\n end\r\n end",
"def excede_control_de_pago_x_ticket(last_tickect_current_user, entrada)\n #verificar tipo de parlay de ese ticket:\n parlay_count = Jugadalot.where(:ticket_id => last_tickect_current_user).count\n #parlay_count\n\n #switch case para asignar tipo de jugada segun tipo de parlay para buscar en control de pago:\n tipo_jugada = \"default\" # valor vacio para posible uso fuera de contexto de septimetas en adelante, hacer que retorne false la funcion ok. (no encontrado)\n \n #el switch case lo haremos de modo simple con el if statement por ahora ok:\n if parlay_count.to_i == 1\n tipo_jugada = \"directo\" \n end\n\n if parlay_count.to_i == 2\n tipo_jugada = \"pale\" \n end\n\n if parlay_count.to_i == 3\n tipo_jugada = \"tripleta\" \n end\n\n if parlay_count.to_i == 4\n tipo_jugada = \"cuarteta\" \n end\n\n if parlay_count.to_i == 5\n tipo_jugada = \"quinteta\" \n end\n\n if parlay_count.to_i == 6\n tipo_jugada = \"sexteta\" \n end\n\n if parlay_count.to_i == 7\n tipo_jugada = \"septimeta\" \n end\n\n if parlay_count.to_i == 8\n tipo_jugada = \"octaveta\" \n end\n\n control_monto_max_pago = Controldepagogt.where(:tipojugada => tipo_jugada ).first.limitexticket.to_i\n\n #verificar posible pago: riesgo\n entrada = entrada[1..(entrada.size-1)] # \"SOBREESCRIBO ESTO ASI: ..250 => .250\" ESTO PARA QUE LUEGO SE TRANSFORME DE .250 A 250 DENTRO DE LA FUNCION. REUCUERDA QUE EN ESTA SECCION DE CODIGO ENTRADA DE DE COBRO FINAL NO DE EVALUACION DE PAGO: ..250 ES DE COBRO FINAL. OK. TED.\n riesgo = procesar_posible_pago(last_tickect_current_user, entrada)# procesar_posible_pago retorna array ok ted.\n\n if (riesgo != nil) # esto para evitar errores de nil. ya no necesario porue depuramos no jugadas vacias para computar pero lo dejaremos ok. ted\n if (riesgo[1].to_i <= control_monto_max_pago)\n false # no excede ok\n else\n true # execede\n end\n end\n\n end",
"def ano_eleicao\n puts \"esta eleição esta acontecendo no ano de #{@ano}\"\n \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 calculCouleur(cellule,clique)\n #Gestion du clique gauche\n if clique == CLIQUEGAUCHE\n couleur = cellule.clicGauche\n #Gestion duclique droit\n elsif clique == CLIQUEDROIT\n couleur = cellule.clicDroit\n #Aucune gestion pour tout les autres boutons de la souris\n else\n couleur = nil\n puts \"Aucun evenement lié au bouton\"+clique.to_s\n end\n return couleur\n end",
"def agc_4(estatuto=nil)\n @pilaS << (@cuadruplos.count )\n @cuadruplos << Cuadruplo.new(\"GoF\",@pilaO.pop,[]) if estatuto == 'if'\n @cuadruplos << Cuadruplo.new(\"Go\",[],[]) if estatuto == 'else'\n @cuadruplos << Cuadruplo.new(\"GoF\",@pilaO.pop,[]) if estatuto == 'while'\nend",
"def imprimir_parciales1\n\n #aqui guardo todos los datos que necesito para imprimirlos en las variable\n\n @width_layout = '955'\n @form_title = ''\n @imprimo='1'\n\n @factura_orden_despacho_otra= FacturaOrdenDespacho.find(:all, :conditions=>\"id in #{params[:parciales_id]}\")\n\n factura_orden_despacho_count=FacturaOrdenDespacho.count(:all, :conditions=>\"id in #{params[:parciales_id]}\")\n\n @factura_orden_despacho=FacturaOrdenDespacho.find(:first, :conditions=>\"id in #{params[:parciales_id]}\")\n\n contw=0\n \n while contw < factura_orden_despacho_count\n @factura_orden_despacho_otra[contw].update_column(:emitida, true)\n #@factura_orden_despacho_otra[contw].emitida=true\n #@factura_orden_despacho_otra[contw].send(:update_without_callbacks)\n contw+=1\n\n end\n\n solicitu=OrdenDespacho.find(OrdenDespachoDetalle.find(@factura_orden_despacho.orden_despacho_detalle_id).orden_despacho_id).solicitud_id\n\n @solicitudes = Solicitud.find(:all,:conditions => ['id = ?', solicitu])\n\n unless @solicitudes[0].nil?\n if !@solicitudes[0].cliente.persona_id.nil? \n \t@es_no=1\n \t@datos_cliente=Persona.find(@solicitudes[0].cliente.persona_id) unless @solicitudes[0].nil?\n else\n \t@es_no=2\n \t@datos_cliente=Empresa.find(@solicitudes[0].cliente.empresa_id) unless @solicitudes[0].nil?\n end\n end\n @numero_desembolso=OrdenDespachoDetalle.find(@factura_orden_despacho.orden_despacho_detalle_id).orden_despacho_id\n\n @orden_despacho= OrdenDespacho.find(:all,:conditions => ['solicitud_id = ?', solicitu])\n\n\n @oficina= Oficina.find(:all,:conditions => ['id = ?', @solicitudes[0].oficina_id]) unless @solicitudes[0].nil?\n\n\n @parametros_general=ParametroGeneral.find(:first)\n\n @condition = \" orden_despacho_id = #{@factura_orden_despacho.orden_despacho_detalle.orden_despacho_id} and cantidad > 0\"\n @total = OrdenDespachoDetalle.count(:conditions=>@condition)\n @list = OrdenDespachoDetalle.find(:all, :conditions => ['orden_despacho_id = ? and cantidad > 0', @factura_orden_despacho.orden_despacho_detalle.orden_despacho_id])\n\n @total_saldo_entregar=0\n @total_precio_total=0\n cont=0\n diferencia=0.00\n @total_monto_confirmado=0.00\n \n while cont< @total\n\n #if OrdenDespacho.find(@numero_desembolso).estatus_id==20000 || OrdenDespacho.find(@numero_desembolso).estatus_id==20010 || OrdenDespacho.find(@numero_desembolso).estatus_id==20020\n \t \n # codigo nuevo al 3/9/2013 \n if ( ((@list[cont].cantidad * @list[cont].costo_real)!=@list[cont].monto_financiamiento) and (@list[cont].monto_recomendado!=0))\n @total_saldo_entregar+=@list[cont].monto_recomendado\n diferencia=@list[cont].monto_recomendado - @list[cont].monto_facturacion \n else\n @total_saldo_entregar+=@list[cont].monto_financiamiento\n diferencia=@list[cont].monto_financiamiento - @list[cont].monto_facturacion\n end\n #codigo nuevo al 3/9/2013 \n \n \n #else\n \t #@total_saldo_entregar+=@list[cont].monto_recomendado\n #diferencia=@list[cont].monto_recomendado - @list[cont].monto_facturacion \n #end\n @total_monto_confirmado+=@list[cont].monto_facturacion\n \n logger.debug \"monto financiamiento = \" << @list[cont].monto_financiamiento.to_s\n logger.debug \"monto facturacion = \" << @list[cont].monto_facturacion.to_s\n logger.debug \"diferencia = \" << diferencia.to_s\n if diferencia < 0\n diferencia=diferencia * -1 \n\n end\n \n @total_precio_total+=diferencia\n\n #@total_precio_total+=@list[cont].monto_facturacion\n \tcont+=1\t\n end\n @vista = 'view_factura_orden_despacho_parciales'\n\nend",
"def pantallaResultado resultado\n\t\t@app.clear\n\t\t@app.background \"versus.jpg\"\n\t\t@app.para \"juego terminado con #{resultado[\"rondas\"]} rondas\"\n\n\t\t# Continuar con el juego si aun hay puntos o rondas que jugar\n\t\t# esto sucede si el usuario lleno los dos cuadros de rondas y puntos\n\t\tif resultado[\"1\"] > resultado[\"2\"]\n\t\t\t@app.para \"El ganador es el jugador 1 con #{resultado[\"1\"]} puntos\"\n\t\telsif resultado[\"1\"] < resultado[\"2\"]\n\t\t\t@app.para \"El ganador es el jugador 2 con #{resultado[\"2\"]} puntos\"\n\t\telse\n\t\t\t@app.para \"Empate!\"\n\t\tend\n\n\t\t@app.button \"Continuar\" do\n\t\t\tif @puntos != \"\"\n\t\t\t\talcanzar(@puntos.to_i)\n\t\t\telsif @rondas != \"\"\n\t\t\t\trondas(@rondas.to_i)\n\t\t\t\t\n\t\t\telse\n\t\t\t\t@app.button \"Jugar Otra Vez\" do\n\t\t\t\t\t@puntos = \"\"\n\t\t\t\t\t@rondas = \"\"\n\t\t\t\t\tpantallaPuntosRondas\n\t\t\t\tend\n\n\t\t\t\t@app.button \"Reiniciar Juego\" do\n\t\t\t\t\treset\n\t\t\t\t\tpantallaInicial\n\t\t\t\tend\n\n\t\t\t\t@app.button \"Salir\" do\n\t\t\t\t\t@app.close\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\tend",
"def pantallaEstrategias nombre\n\t\t\n\t\t# Esr¿trategia a escoger por el usuario\n\t\testrategia = \"\"\n\t\t\n\t\t# Limpiamos pantalla\n\t\t@app.clear\n\t\t@app.background \"fondo.jpg\"\n\n\t\t# stack de botones\n\t\t@estrategias = @app.stack :top => \"130\", :left => \"400\"\n\t\t\n\t\t@estrategias.caption \"Jugador #{nombre}\"\n\t\t@estrategias.caption \"Escoge una estrategia de juego\"\n\t\t\n\t\t# Estrategia manual\n\t\t@manual = @estrategias.button \"Manual\"\n\t\t@manual.click do\n\t\t\testrategia = \"manual\"\n\t\t\tif (nombre == \"1\")\n\t\t\t\t@s1 = estrategia\n\t\t\telse\n\t\t\t\t@s2 = estrategia\n\t\t\tend\n\t\tend\n\n\t\t# EStrategia uniforme\n\t\t@uni = @estrategias.button \"Uniforme\"\n\t\t@uni.click do\n\t\t\testrategia = \"uniforme\"\n\t\t\tif (nombre == \"1\")\n\t\t\t\t@s1 = estrategia\n\t\t\telse\n\t\t\t\t@s2 = estrategia\n\t\t\tend\n\t\tend\n\n\t\t# Estrategia sesgada\n\t\t@ses = @estrategias.button \"Sesgada\"\n\t\t@ses.click do\n\t\t\testrategia = \"sesgada\"\n\t\t\tif (nombre == \"1\")\n\t\t\t\t@s1 = estrategia\n\t\t\telse\n\t\t\t\t@s2 = estrategia\n\t\t\tend\n\t\tend\n\n\t\t# Estrategia copiar\n\t\t@copiar = @estrategias.button \"Copiar\"\n\t\t@copiar.click do\n\t\t\testrategia = \"copiar\"\n\t\t\tif (nombre == \"1\")\n\t\t\t\t@s1 = estrategia\n\t\t\telse\n\t\t\t\t@s2 = estrategia\n\t\t\tend\n\t\tend\n\n\t\t# Estrategia pensar\n\t\t@pensar = @estrategias.button \"Pensar\"\n\t\t@pensar.click do\n\n\t\t\testrategia = \"pensar\"\n\t\t\tif (nombre == \"1\")\n\t\t\t\t@s1 = estrategia\n\t\t\telse\n\t\t\t\t@s2 = estrategia\n\t\t\tend\n\t\tend\n\n\t\t\n\t\t\n\tend",
"def programa ()\n puts (\"Introduceti numarul a:\")\n a=gets.chomp.to_f\n puts(\"Introduceti numarul b:\")\n b=gets.chomp.to_f\n puts(\"Introduceti eroarea\")\n eps=gets.chomp.to_f\n\n if ((functia(a)*functia(b))>0) #daca produsul este mai mare ca 0 datele nu sunt introduse corect si trebuie introduse din nou\n programa()\n else\n #apelarea functiilor ce calculeaza radacina\n inj_x, inj_f, inj_i =injumatatire(a,b,eps)\n tan_x, tan_f, tan_i =tangenta(a,b,eps)\n sec_x, sec_f, sec_i= secanta(a,b,eps)\n#afisarea rezultatului\n puts(\"Metoda injumatatirii: radacina functiei este #{inj_x}\",\"valoarea functiei este #{inj_f}\",\"a fost executat in #{inj_i} pasi\")\n puts(\"Metoda tangentei: radacina functiei este #{tan_x}\",\"valoarea functiei este #{tan_f}\",\"a fost executat in #{tan_i} pasi\")\n puts(\"Metoda tangentei: radacina functiei este #{sec_x}\",\"valoarea functiei este #{sec_f}\",\"a fost executat in #{sec_i} pasi\")\n#introducerea unui nou segment sau finisarea programei\n puts(\"doriti sa mai introduceti un segment? y/n\")\n rasp=gets.chomp\n while(rasp !=\"y\"&& rasp !=\"n\")\n puts \" introduceti sau y sau n\"\n rasp=gets.chomp\n end\n if rasp==\"y\"\n programa()\n else rasp==\"n\"\n puts \"La revedere\"\n end\n end\nend",
"def regolamento (message)\n saluto = \"Ciao, \" + b(nome(message))+\", hai chiesto il regolamento: \\n\\n\"\n head = \"\"\n\nheaddevs = \"Questo gruppo nasce per lo studio dei linguaggi per le tecniche di programmazione e per lo scambio di informazioni e di codice.\"\nheadruby = \"Questo gruppo nasce per lo studio del linguaggio RUBY, per le tecniche di programmazione e per lo scambio di informazioni e di codice.\"\nheadlinux = \"Lo scopo del canale pubblico LINUX HELP ITALIA e' di creare un punto di ritrovo fra esperti e meno esperti ,per discutere delle problematiche o proporre soluzioni attraverso le proprie esperienze riguardo il noto sistema operativo Linux e di tutte le sue distribuzioni comunemente chiamate 'derivate'.\"\n\ncorpo =\n\"\\n\\nRegolamento:\n\n- In questo gruppo, non e' tollerato ne' lo spamming ne' il flooding ne' l'OT (offtopic) di ogni genere chi floodda verra' segnalato.\n- Sono severamente vietate le bestemmie, gli insulti ed ogni forma di volgarita'.\n- Non creare per nessun motivo ne' diatribe personali ne' guerre di opinione per futili motivi.\n- Non essere mai sgradevoli con gli altri per nessun motivo.\n- Il bullismo non sara' tollerato in nessun caso. Ed i bulli vengono sempre segnalati alle autorita' competenti.\n- Il supergenio di turno non sara' tollerato! L'umilta' e' una grande virtu'! PRATICARLA FA BENE!\n- Non pubblicare ne' su questo gruppo ne' su altri informazioni provenienti da chat personali.\n\n<b>- NE' IL GRUPPO NE' I SUOI AMMINISTRATORI SONO RESPONSABILI DIRETTAMENTE O INDIRETTAMENTE PER EVENTUALI CONDOTTE SCORRETTE O INDECENTI DEGLI UTENTI.</b>\n\n- Chiunque viola il regolamento verra' bannato senza alcun preavviso ed ogni sua conversazione molesta verra' cancellata. Sara' come se non fosse mai esistito.\"\n\ninc = \"\"\n\nincdevs =\n\"\\n\\n* E' gradito ed e' incoraggiato lo scambio di informazioni relative ad ogni linguaggio di programmazione.\n\n* Incoraggiamo ogni membro a parlare di ogni aspetto inerente ad un dato linguaggio e ad eventuali framework ad esso collegati.\"\n\nincruby =\n\"\\n\\n* E' gradito ed e' incoraggiato lo scambio di informazioni relative al linguaggio RUBY.\n\n* Incoraggiamo ogni membro a parlare di ogni aspetto inerente al linguaggio ed ai framework collegati come Ror (ruby on rails) ed altri.\"\n\ninclinux =\n\"\\n\\n* E' gradito ed e' incoraggiato lo scambio di informazioni relative ad ogni distribuzione di Linux senza nessuna forma di preferenza\"\n\npiede =\n\"\\n\\n* Anche la goliardia se e' civile e divertente, viene incoraggiata. Non siamo bacchettoni. Ci piace scherzare ed amiamo le compagnie gradevoli e brillanti.\n\n* Vogliamo evitare ad ogni costo i flame violenti, ma lo scambio di opinioni anche se e' forte non ci spaventa.\n\nPer la buona e civile convivenza su questo gruppo abbiamo deciso di utilizzare come regolamento la <b>netiquette</b>.\n\nAltre info:\n- Per le richieste di aiuto e' necessario utilizzare i tag. L'utilizzo dei tag permette ad altri membri di cercare argomenti o problemi eventualmente gia' trattati.\"\n\ntag = \"\"\n\ntagruby =\n\"\\n\\nEsempio con tag #solved: dal menu con 3 puntini in alto a destra si fa la ricerca con il tag #solved.\nPer post su un dato argomento(topic) mettendo il tag all'inizio del post #classe #singleton ecc....\"\n\ntaglinux =\n\"\\n\\nEsempio con tag #solved: dal menu con 3 puntini in alto a destra si fa la ricerca con il tag #solved.\nPer post su archilinux problema xorg mettiamo ainizio post #archlinux #xorg.\"\n\nbase =\n\"\\n\\n* Il buongiorno e' sempre gradito come tutte le buone maniere.\n\n<b>QUESTO GRUPPO NASCE CON L'INTENTO E LA VISIONE: CHE OGNI PERSONA HA IL DIRITTO DI ACCEDERE ALLA CONOSCENZA.\nCHI LA POSSIEDE HA IL DOVERE MORALE ED ETICO DI AIUTARE IL PROSSIMO A CRESCERE E MIGLIORARE!</b>\"\n\nchatid = chatid(message).to_s\n\n# QUESTO PASSAGGIO ADATTA IL REGOLAMENTO AL GRUPPO IN CUI VIENE RICHIESTO.\n# PER IL MOMENTO SONO PIENAMENTE SUPPORTATI DUE GRUPPI SUI QUALI IL BOT OPERA.\n\nchatruby = \"\" # INSERISCI QUI L'ID DELLA CHAT\nchatdevs = \"\" # INSERISCI QUI L'ID DELLA CHAT\nchatlinux = \"\" # INSERISCI QUI L'ID DELLA CHAT\n\n if chatid == chatruby\n head = headruby\n inc = incruby\n tag = tagruby # stesso per devs e ruby\n end\n\n if chatid == chatdevs\n head = headdevs\n inc = incdevs\n tag = tagruby # stesso per devs e ruby\n end\n \n if chatid == chatlinux\n head = headlinux\n inc = inclinux\n tag = taglinux\n end\n\n msg = saluto + head + corpo + inc + piede + tag + base\nend",
"def huellaAmbiental\r\n if (menuValido == true)\r\n gei = 0.0\r\n terreno = 0.0\r\n @menu.each do |i|\r\n gei += i.gei\r\n terreno += i.terreno\r\n end\r\n return \"GEI: #{gei}, Uso de terreno: #{terreno}\"\r\n else\r\n return \"El sujeto no es valido pues no consume la cantidad diaria reomendada\"\r\n end\r\n end",
"def initialize(ciclos, lupula, cebada, mezcla, levadura)\n\n @ciclos = ciclos\n @almacen = Almacen.new(lupula,cebada,mezcla,levadura)\n @silosCebada = Silos_Cebada.new\n @molino = Molino.new\n @pailaMezcla = Paila_Mezcla.new\n @cuba = Cuba_Filtracion.new\n @pailaCoccion = Paila_Coccion.new\n @tanquePreclarif = Tanque_Preclarificador.new \n @enfriador = Enfriador.new\n @tcc = TCC.new\n @filtroCerveza = Filtro_Cerveza.new\n @tanqueFiltroCerveza = Tanque_Cerveza.new\n @llenadora = Llenadora.new\n\n end",
"def bilan\n raise \"Il faut lancer l'étude avec Etude::start avant de construire le bilan\" if @data.nil?\n @bilan ||= begin\n c = []\n # Largeur : 26 (sans les \"|\")\n titre = \"Exercices #{from_exercice} à #{to_exercice}\"\n gauche = ((26 - titre.length).to_f / 2).floor - 1\n droite = \" \" * (26 - (gauche + titre.length))\n gauche = \" \" * gauche\n entete = <<-TXT\n----------------------------\n|#{gauche}#{titre}#{droite}|\n----------------------------\n| Doigté | Nombre de fois |\n TXT\n c << entete.strip\n titre_section = <<-TXT\n----------------------------\n| Par quantité |\n----------------------------\n TXT\n c << titre_section.strip\n nombre_max = nil\n nombre_min = nil\n nb_courant = nil\n @data.sort_by{|c, e| e[:nombre]}.reverse.each do |combi, data_combi|\n nb_courant = data_combi[:nombre]\n nombre_max = nb_courant if nombre_max.nil?\n nb = (\" \" * 5) << nb_courant.to_s # 16\n nb << \" \" * (16 - nb.length) \n c << \"| #{combi} | #{nb}|\"\n end\n nombre_min = nb_courant\n \n titre_section = <<-TXT\n----------------------------\n| Par premier doigt |\n----------------------------\n TXT\n c << titre_section.strip\n @data.sort_by{|combi, e| combi[0..0]}.each do |combi, data_combi|\n nb = data_combi[:nombre]\n nb = \"#{nb} (max)\" if nb == nombre_max\n nb = \"#{nb} (min)\" if nb == nombre_min\n nb = (\" \" * 5) << nb.to_s\n nb << \" \" * (16 - nb.length) \n c << \"| #{combi} | #{nb}|\"\n end\n \n titre_section = <<-TXT\n----------------------------\n| Par second doigt |\n----------------------------\n TXT\n c << titre_section.strip\n @data.sort_by{|combi, e| combi[2..2]}.each do |combi, data_combi|\n nb = data_combi[:nombre]\n nb = \"#{nb} (max)\" if nb == nombre_max\n nb = \"#{nb} (min)\" if nb == nombre_min\n nb = (\" \" * 5) << nb.to_s # 16\n nb << \" \" * (16 - nb.length) \n c << \"| #{combi} | #{nb}|\"\n end\n c << \"-\" * 28\n c << \"\\n\"\n c.join(\"\\n\")\n end\n end",
"def get_almidon\n @_100=((@almidon*100)/@peso)\n #@ir_100=(@_100/90)*100\n @porcion=((@almidon*@gramos_porciones)/@peso)\n #@ir_porcion=(@porcion/90)*100\n [ @almidon , @_100 , 0 , @porcion , 0 ]\n end",
"def calcula_tramos(proyecto_id)\n proyecto = Proyecto.find(params[:proyecto_id].to_i) \n dretmax = proyecto.dretmax\n vanomax = proyecto.vanomax\n pant = nil\n tant = nil\n \n Tramo.where(:proyecto_id => proyecto_id).each {|t|\n t.reltramovanos.destroy_all\n if (t.dimgeom!=nil )\n t.dimgeom.destroy\n end \n t.destroy\n } \n Vano.where(:proyecto_id => proyecto_id).destroy_all\n \n \n puntos = Punto.where(:proyecto_id => proyecto_id).order(:secuencia)\n n = 0\n m = puntos.count-1\n \n puntos.each {|p|\n if (n==0)\n tramo = Tramo.new\n tramo.ttramo_id = 1 #arranque\n tramo.cantidad = 1\n tramo.angulo = 0\n tramo.hlibre = proyecto.hlibre\n tramo.secuencia = Tramo.where(:proyecto_id =>proyecto_id).maximum(:secuencia).to_i+10\n tramo.nombre = \"Arranque en \" + p.punto\n tramo.proyecto_id = proyecto_id\n tramo.save\n tant = tramo\n \n elsif (n<m) #desvios intermedios\n vano = Vano.new\n vano.nombre = \"Vanos entre \" + pant.punto + ' y ' + p.punto\n if (p.distancia < vanomax)\n vano.vano = p.distancia\n else\n vano.vano = p.distancia / (( p.distancia/vanomax).to_i + 1 )\n end \n vano.proyecto_id = proyecto_id\n vano.cond_e_id = proyecto.cond_e_id\n vano.cond_g_id = proyecto.cond_g_id\n vano.save\n vano.calcvano\n vant = vano\n \n if (p.distancia > dretmax)\n tramo = Tramo.new\n tramo.ttramo_id = 4 #retension\n tramo.cantidad = (p.distancia/dretmax).to_i\n tramo.angulo = 0\n tramo.hlibre = proyecto.hlibre\n tramo.secuencia = Tramo.where(:proyecto_id =>proyecto_id).maximum(:secuencia).to_i+10\n tramo.nombre = \"Retensiones entre \" + pant.punto + ' y ' + p.punto\n tramo.proyecto_id = proyecto_id\n tramo.save\n rel = Reltramovano.new\n rel.vano_id = vano.id\n rel.tramo_id = tramo.id\n rel.angulo = 0\n rel.save\n end\n if (p.distancia > vanomax)\n tramo = Tramo.new\n tramo.ttramo_id = 5 #alineacion\n tramo.cantidad =(p.distancia/vanomax).to_i - (p.distancia/dretmax).to_i\n tramo.angulo = 0\n tramo.hlibre = proyecto.hlibre\n tramo.secuencia = Tramo.where(:proyecto_id =>proyecto_id).maximum(:secuencia).to_i+10\n tramo.nombre = \"Alineaciones entre \" + pant.punto + ' y ' + p.punto\n tramo.proyecto_id = proyecto_id\n tramo.save\n rel = Reltramovano.new\n rel.vano_id = vano.id\n rel.tramo_id = tramo.id\n rel.angulo = 0\n rel.save\n end\n tramo = Tramo.new\n tramo.ttramo_id = 2 #desvio\n tramo.cantidad = 1\n tramo.angulo = p.angulo\n tramo.hlibre = proyecto.hlibre\n tramo.secuencia = Tramo.where(:proyecto_id =>proyecto_id).maximum(:secuencia).to_i+10\n tramo.nombre = \"Desvio de \" + p.angulo.to_i.to_s + \"° en \" + p.punto\n tramo.proyecto_id = proyecto_id\n tramo.save\n rel = Reltramovano.new\n rel.vano_id = vano.id\n rel.tramo_id = tramo.id\n rel.angulo = 0\n rel.save\n rel = Reltramovano.new\n rel.vano_id = vano.id\n rel.tramo_id = tant.id\n rel.angulo = pant.angulo\n rel.save\n tant = tramo\n \n else #terminal\n vano = Vano.new\n vano.nombre = \"Vanos entre \" + pant.punto + ' y ' + p.punto \n if (p.distancia < vanomax)\n vano.vano = p.distancia\n else\n vano.vano = p.distancia / (( p.distancia/vanomax).to_i + 1 )\n end \n vano.proyecto_id = proyecto_id\n vano.cond_e_id = proyecto.cond_e_id\n vano.cond_g_id = proyecto.cond_g_id\n vano.save\n vano.calcvano\n\n if (p.distancia > dretmax)\n tramo = Tramo.new\n tramo.ttramo_id = 4 #retension\n tramo.cantidad = (p.distancia/dretmax).to_i\n tramo.angulo = 0\n tramo.hlibre = proyecto.hlibre\n tramo.secuencia = Tramo.where(:proyecto_id =>proyecto_id).maximum(:secuencia).to_i+10\n tramo.nombre = \"Retensiones entre \" + pant.punto + ' y ' + p.punto\n tramo.proyecto_id = proyecto_id\n tramo.save\n rel = Reltramovano.new\n rel.vano_id = vano.id\n rel.tramo_id = tramo.id\n rel.angulo = 0\n rel.save\n end\n if (p.distancia > vanomax)\n tramo = Tramo.new\n tramo.ttramo_id = 5 #alineacion\n tramo.cantidad =(p.distancia/vanomax).to_i - (p.distancia/dretmax).to_i\n tramo.angulo = 0\n tramo.hlibre = proyecto.hlibre\n tramo.secuencia = Tramo.where(:proyecto_id =>proyecto_id).maximum(:secuencia).to_i+10\n tramo.nombre = \"Alineaciones entre \" + pant.punto + ' y ' + p.punto\n tramo.proyecto_id = proyecto_id\n tramo.save\n rel = Reltramovano.new\n rel.vano_id = vano.id\n rel.tramo_id = tramo.id\n rel.angulo = 0\n rel.save\n end\n tramo = Tramo.new\n tramo.ttramo_id = 3 #terminal\n tramo.cantidad = 1\n tramo.angulo = 0\n tramo.hlibre = proyecto.hlibre\n tramo.secuencia = Tramo.where(:proyecto_id =>proyecto_id).maximum(:secuencia).to_i+10\n tramo.nombre = \"Terminal en \" + p.punto\n tramo.proyecto_id = proyecto_id\n tramo.save\n rel = Reltramovano.new\n rel.vano_id = vano.id\n rel.tramo_id = tramo.id\n rel.angulo = p.angulo\n rel.save\n rel = Reltramovano.new\n rel.vano_id = vano.id\n rel.tramo_id = tant.id\n rel.angulo = pant.angulo\n rel.save\n \n end\n \n n+=1\n pant = p\n }\n \n Tramo.where(:proyecto_id=>proyecto_id).each { |t|\n t.calcabezal\n }\n end",
"def nombre_y_apellido \n primer_nombre + ' ' + primer_apellido\n end",
"def ordenar_paso_a_paso(pila,array=[],cola,lista,ordenamientof)\n if ordenamientof[:ordenar]\n begin\n limpiar_pantalla\n tabla = Terminal::Table.new do |a|\n a.title= 'ORDEN PASO A PASO'\n a.headings = [{value:'No.', alignment: :center},{value:'ESTRUCTURA', alignment: :center}]\n a.add_row([{value:'1', alignment: :center},'COLA' ])\n a.add_row([{value:'2', alignment: :center},'PILA'])\n a.add_row([{value:'3', alignment: :center},'LISTA'])\n a.add_row([{value:'4', alignment: :center},'SALIR' ])\nend\n puts tabla\n print \"INGRESE UNA ESTRUCTURA \"\n opc = gets.chomp\n limpiar_pantalla()\n \n if opc == '1'\n if array.size!=0\n array_anterior=array.join(',')\n cola.mostrar_paso(array_anterior)\n gets\n else\n puts 'INGRESE DATOS A ORDENAR'\n gets\n end\nelsif opc == '2'\n if array.size!=0\n array_anterior=array.join(',')\n pila.mostrar_pasos(array_anterior)\n gets\n else\n puts 'INGRESE DATOS A ORDENAR'\n gets\n end\nelsif opc == '3'\n if array.size!=0\n array_anterior=array.join(',')\n lista.mostrar_paso(array_anterior)\n gets\n else\n puts 'INGRESE DATOS A ORDENAR'\n gets\n end\n else\n 'OPCION INVALIDA'\n gets\n end\nend while opc!='4'\nelse\n array_anterior=array.join(',')\n pila.ordenar_pila(array)\n cola.ordenar_cola(array)\n lista.ordenar_lista(array)\n ordenamientof[:ordenar]=true\n begin\n limpiar_pantalla\n tabla = Terminal::Table.new do |a|\n a.title= 'ORDEN PASO A PASO'\n a.headings = [{value:'No.', alignment: :center},{value:'ESTRUCTURA', alignment: :center}]\n\n a.add_row([{value:'1', alignment: :center},'COLA' ])\n a.add_row([{value:'2', alignment: :center},'PILA'])\n a.add_row([{value:'3', alignment: :center},'LISTA'])\n a.add_row([{value:'4', alignment: :center},'SALIR' ])\nend\n puts tabla\n print \"INGRESE UNA ESTRUCTURA: \"\n opc = gets.chomp\n limpiar_pantalla()\n \n if opc == '1'\n if array.size!=0\n array_anterior=array.join(',')\n cola.mostrar_paso(array_anterior)\n gets\n else\n puts 'INGRESE DATOS'\n gets\n end\nelsif opc == '2'\n if array.size!=0\n array_anterior=array.join(',')\n pila.mostrar_pasos(array_anterior)\n gets\n else\n puts 'INGRESE DATOS'\n gets\n end\nelsif opc == '3'\n if array.size!=0\n array_anterior=array.join(',')\n lista.mostrar_paso(array_anterior)\n gets\n else\n puts 'INGRESE DATOS'\n gets\n end\n else\n 'OPCION INVALIDA'\n gets\n end\nend while opc!='4'\nend\nend",
"def nombre_completo\n\tprimer_nombre+\" \"+primer_apellido\n#fin del metodo\nend",
"def revisa_deuda\n if com_compra.adeudos[:cuentas_con_deuda] == 0\n com_compra.pagado!\n else\n com_compra.pendiente!\n end\n end",
"def saluda()\n\t\tputs \"-------------------\"\n\t\tputs \"hola mundo dos\"\n\tend",
"def proximo_historial\n historial = HistorialAcademico.new\n historial.usuario_ci = usuario_ci\n historial.tipo_categoria_id = tipo_categoria_id\n historial.idioma_id = idioma_id\n periodo_actual = ParametroGeneral.periodo_inscripcion\n historial.periodo_id = periodo_actual.id\n historial.tipo_convenio_id = tipo_convenio_id \n historial.tipo_estado_calificacion_id = \"SC\"\n historial.tipo_estado_inscripcion_id = \"PRE\"\n historial.nota_final = -2\n historial.numero_deposito = \"\"\n ultimo = ultimo_historial\n historial.seccion_numero = nil\n inicial = Curso.where(:idioma_id => idioma_id,\n :tipo_categoria_id => tipo_categoria_id,\n :grado => 1).limit(1).first\n \n\n estado = tipo_estudiante\n if estado == REGULAR || estado == MODIFICACION\n if ultimo.aprobo_curso?\n grado = ultimo.curso.grado+1\n prox = Curso.where(:idioma_id => idioma_id,\n :tipo_categoria_id => tipo_categoria_id,\n :grado => grado).limit(1).first\n if prox \n historial.tipo_nivel_id = prox.tipo_nivel_id\n historial.seccion_numero = ultimo.seccion_numero\n if !ultimo || !ultimo.seccion || !historial || !historial.seccion || ultimo.seccion.horario != historial.seccion.horario\n historial.seccion_numero = nil\n end\n else \n if ultimo.tipo_categoria_id == \"NI\" && ultimo.tipo_nivel_id == \"CI\"\n historial.tipo_nivel_id = \"BI\"\n historial.tipo_categoria_id = \"TE\"\n \n ec1 = EstudianteCurso.where(:usuario_ci => historial.usuario_ci,\n :tipo_categoria_id => \"TE\",\n :idioma_id => \"ID\") \n \n unless ec1\n ec1 = EstudianteCurso.new\n ec1.tipo_categoria_id = historial.tipo_categoria_id\n ec1.usuario_ci = historial.usuario_ci\n ec1.idioma_id = historial.idioma_id\n ec1.tipo_convenio_id = historial.tipo_convenio_id\n ec1.save\n end \n \n historial.seccion_numero = nil\n else\n raise Exception.new \"Ya se graduo en #{tipo_curso.descripcion}\"\n end\n end\n else #reprobado\n historial.tipo_convenio_id = \"REG\"\n self.tipo_convenio_id = \"REG\"\n self.save\n historial.tipo_nivel_id = ultimo.tipo_nivel_id\n end\n elsif estado == REINTEGRO\n ultimo_aprobado = ultimo_historial_aprobado\n if ultimo_aprobado\n historial.tipo_nivel_id = ultimo_aprobado.tipo_nivel_id\n else\n historial.tipo_nivel_id = inicial.tipo_nivel_id\n end\n elsif estado == REINICIO\n historial.tipo_nivel_id = inicial.tipo_nivel_id\n end \n historial.cuenta_bancaria_id = historial.cuenta_nueva\n return historial\n end",
"def cifra_vigenere(llave)\n cifrado = \"\"\n longitud = @texto.length\n 0.upto(longitud-1) do |j|\n i = j % (llave.size)\n alfabeto_ver = corrimiento(llave[i])\n car_cifrar = \"\" << @texto[j]\n posicion = MINUSCULAS.index(car_cifrar)\n a = alfabeto_ver[posicion]\n cifrado.concat(a)\n end\n @manejador.guardar_archivo(\"#{VIG_EN}\", cifrado)\n puts cifrado\n end",
"def modelo_carne_build_data_right(doc, boleto, colunas, linhas)\n # LOGOTIPO do BANCO\n doc.image boleto.logotipo, x: (colunas[2] - 0.11), y: linhas[0]\n\n # Numero do banco\n doc.moveto x: colunas[4], y: linhas[0]\n doc.show \"#{boleto.banco}-#{boleto.banco_dv}\", tag: :grande\n\n # linha digitavel\n doc.moveto x: colunas[6], y: linhas[0]\n doc.show boleto.codigo_barras.linha_digitavel, tag: :media\n\n # local de pagamento\n doc.moveto x: colunas[2], y: linhas[1]\n doc.show boleto.local_pagamento\n\n # vencimento\n doc.moveto x: colunas[11], y: linhas[1]\n doc.show boleto.data_vencimento.to_s_br\n\n # cedente\n doc.moveto x: colunas[2], y: linhas[2]\n doc.show boleto.cedente\n\n # agencia/codigo cedente\n doc.moveto x: colunas[11], y: linhas[2]\n doc.show boleto.agencia_conta_boleto\n\n # data do documento\n doc.moveto x: colunas[2], y: linhas[3]\n doc.show boleto.data_documento.to_s_br if boleto.data_documento\n\n # numero documento\n doc.moveto x: colunas[3], y: linhas[3]\n doc.show boleto.documento_numero\n\n # especie doc.\n doc.moveto x: colunas[8], y: linhas[3]\n doc.show boleto.especie_documento\n\n # aceite\n doc.moveto x: colunas[9], y: linhas[3]\n doc.show boleto.aceite\n\n # dt processamento\n doc.moveto x: colunas[10], y: linhas[3]\n doc.show boleto.data_processamento.to_s_br if boleto.data_processamento\n\n # nosso numero\n doc.moveto x: colunas[11], y: linhas[3]\n doc.show boleto.nosso_numero_boleto\n\n # uso do banco\n ## nada...\n\n # carteira\n doc.moveto x: colunas[3], y: linhas[4]\n doc.show boleto.carteira\n\n # especie\n doc.moveto x: colunas[5], y: linhas[4]\n doc.show boleto.especie\n\n # quantidade\n doc.moveto x: colunas[7], y: linhas[4]\n doc.show boleto.quantidade\n\n # valor documento\n doc.moveto x: colunas[8], y: linhas[4]\n doc.show boleto.valor_documento.to_currency\n\n # valor do documento\n doc.moveto x: colunas[11], y: linhas[4]\n doc.show boleto.valor_documento.to_currency\n\n # Instruções\n doc.moveto x: colunas[2], y: linhas[5]\n doc.show boleto.instrucao1\n doc.moveto x: colunas[2], y: linhas[6]\n doc.show boleto.instrucao2\n doc.moveto x: colunas[2], y: linhas[7]\n doc.show boleto.instrucao3\n doc.moveto x: colunas[2], y: linhas[8]\n doc.show boleto.instrucao4\n doc.moveto x: colunas[2], y: linhas[9]\n doc.show boleto.instrucao5\n doc.moveto x: colunas[2], y: linhas[10]\n doc.show boleto.instrucao6\n\n # Sacado\n doc.moveto x: colunas[2], y: linhas[11]\n if boleto.sacado && boleto.sacado_documento\n doc.show \"#{boleto.sacado} - #{boleto.sacado_documento.formata_documento}\"\n end\n\n # Sacado endereço\n doc.moveto x: colunas[2], y: linhas[12]\n doc.show boleto.sacado_endereco.to_s\n\n # codigo de barras\n # Gerando codigo de barra com rghost_barcode\n if boleto.codigo_barras\n doc.barcode_interleaved2of5(boleto.codigo_barras, width: '10.3 cm', height: '1.2 cm', x: colunas[2],\n y: linhas[14])\n end\n end",
"def lancement(i)\nif i == 10\n puts \"Bravo vous avez gagné la partie!\"\n else\n puts \"Veuillez taper un caractère pour lancer le dé\" \n lancer_de=gets.chomp\n \nif lancer_de.empty?\n puts proba(i)\n else \n puts \"Il faut juste appuyer sur entrée!!!\"\n puts lancement(i)\n #dé_actuel=rand(1..6)\n \nend\nend \nend",
"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 afficher()\n 0.upto(@largeur + 1) do\n print(\"$\")\n end\n print(\"\\n$\")\n @table.each{|c|\n if((c.y)+1 >= @largeur)\n c.afficher\n print(\"$\\n$\")\n else\n c.afficher\n end\n }\n 0.upto(@largeur - 1) do\n print(\"$\")\n end\n puts(\"$\")\n end",
"def grasa\n\t\t1.2 * imc + 0.23 * @edad - 10.8 * ( sexo ? 1 : 0) - 5.4\n\tend",
"def comisiones_asignadas\n asunto.comisiones if asunto\n end",
"def rescatar\n self.estado_id = 1 #salida si lo creo, entrada/foliado si lo redirijo\n self.estado_id = 3 if self.trazas.count(:conditions => 'movimiento_id in (2,7,8)') > 0\n if self.origen.externo\n RAILS_DEFAULT_LOGGER.info \"devolviendo de origen externo #{self.origen.to_label} a #{self.documento.buzon}\"\n self.buzon_id = self.documento.buzon_id\n else\n self.buzon_id = self.origen_id\n end\n self.add_traza(current_user.id, 14, current_user.puesto.buzon_id)\n self.save!\n end",
"def fila_siguiente\n @color.avanzar(@fila)\n end",
"def analise\n unless possui_acesso?()\n return\n end\n @matricula = Matricula.find(params[:id])\n @teste = params[:matricula]\n \n if @matricula.update_attributes(params[:matricula])\n UserMailer.analise_matricula(@matricula).deliver\n if @matricula.parecer == \"Aprovado\"\n @matricula.status = 1\n else\n @matricula.status = -1\n end\n \n @matricula.save\n flash[:notice] = t(:analise_realizada)\n\n \n else \n flash[:erro] = t(:erro_analise)\n end\n redirect_to :back\n end",
"def uno_mas\n\t\t@edad += 1\n\t\tif @edad < EDAD_MAXIMA\n\t\t\t@altura += @inc_alt\n\t\t\t@contador += prod_nar if @edad >= @ini_fru\n\t\telse\n\t\t\tmuere\n\t\tend\n\t\t@edad\n\tend",
"def adjourn_points_giocataend\r\n # at the end of the game remain to calculate the primiera\r\n player1 = @players[0]\r\n player2 = @players[1]\r\n hand1 = @carte_prese[player1.name]\r\n hand2 = @carte_prese[player2.name]\r\n prim_res_arr = calculate_primiera(hand1, hand2)\r\n @log.debug(\"Primiera of #{player1.name}:#{prim_res_arr[0]}, #{player2.name}: #{prim_res_arr[1]}\")\r\n # update points on all players\r\n ix = 0\r\n [player1, player2].each do |pl|\r\n points_info = @points_curr_segno[pl.name]\r\n points_info[:primiera] = prim_res_arr[ix]\r\n #calculate total\r\n tot = 0\r\n points_info.each do |k,v|\r\n next if k == :tot\r\n tot += v\r\n end\r\n points_info[:tot] = tot\r\n ix += 1\r\n end\r\n end",
"def test_cruzado_datos\n Metodos.refresh()\n #point\n w_=Metodos.nuevo(0,\"point\")\n h_=Metodos.nuevo(0,\"point\")\n wP_=Metodos.nuevo(0,\"point\")\n hP_=Metodos.nuevo(216,\"mm\")\n nX=Metodos.nuevo(2,nil)\n nY=Metodos.nuevo(1,nil)\n nPaginas=\"\"\n nPliegos=\"\"\n cuadernillos=false\n #\n esperados=[]\n esperados.push(Clases::Mensaje.new(1))#h real\n esperados.push(Clases::Mensaje.new(2))#wP calculado\n esperados.push(Clases::Mensaje.new(11))#h calculado\n esperados.push(Clases::Mensaje.new(5))#todas pdf\n esperados.push(Clases::Mensaje.new(7))#no impares\n esperados.push(Clases::Mensaje.new(6))#pliegos\n esperados.push(Clases::Mensaje.new(8))#MensajeVars\n esperados.push(Clases::Mensaje.new(9))#tiempo cut&Stack\n #\n respuestas=[]\n respuestas.push([Clases::PreguntaEscalado.new(\"verticalmente\"),true])#id:2\n #\n resultado=nUp(w_,h_,wP_,hP_,nX,nY,nPaginas,nPliegos,cuadernillos,esperados,nil,respuestas)\n assert(resultado.yn,resultado.msg)\n ensure\n #limpio todo, aunque se caiga\n if File.dirname($temp)!=nil then\n `rm -r #{File.dirname($temp)}`\n end\n end",
"def slogan\n # 'A maneira mais fácil de pré-qualificar ao Atlas.'\n ''\n end",
"def informacion_cuenta\n puts \"---------------------------------\"\n puts \"N° cuenta: #{@id}\"\n puts \"Saldo total: #{@s_corriente + @s_ahorro}\"\n puts \"Saldo cuenta de ahorro: #{@s_ahorro}\"\n puts \"Saldo cuenta corriente: #{@s_corriente}\"\n puts \"Tasa de interes: #{@tasa}\"\n puts \"---------------------------------\"\n self\n end",
"def combat_2ennemi(user_nameP, barret, ennemi1, ennemi2)\n puts ' _________ ________ _____ __________ ________________ '\n puts ' \\_ ___ \\ \\_____ \\ / \\\\______ \\ / _ \\__ ___/ '\n puts ' / \\ \\/ / | \\ / \\ / \\| | _/ / /_\\ \\| | '\n puts ' \\ \\____/ | \\/ Y \\ | \\/ | \\ | '\n puts ' \\______ /\\_______ /\\____|__ /______ /\\____|__ /____| '\n puts ' \\/ \\/ \\/ \\/ \\/ '\n numero_tour = 0\n\n\n while ennemi1.personnage_alive && ennemi2.personnage_alive\n if ennemi1.personnage_hp <= 0\n puts \"\"\n puts \"--------------------------------\"\n puts \"Le #{ennemi1.name} est mort !\"\n puts \"--------------------------------\"\n puts \"\"\n end\n if ennemi2.personnage_hp <= 0\n puts \"\"\n puts \"--------------------------------\"\n puts \"Le #{ennemi2.name} est mort !\"\n puts \"--------------------------------\"\n puts \"\"\n end\n if ennemi1.personnage_hp <= 0 && ennemi2.personnage_hp <= 0\n puts \"\"\n puts \"--------------------------------\"\n puts \"Les ennemis sont morts !\"\n puts \"--------------------------------\"\n total_xp = ennemi1.xp + ennemi2.xp\n puts \"Vous gagnez #{total_xp} points d'XP !\"\n ennemi1.personnage_alive = false\n ennemi2.personnage_alive = false\n\n if ennemi1.loot == '1po'\n $mon_inventaire.addpotion\n puts \"--------------------------------\"\n puts \"1x Potion ajoutée à votre inventaire.\"\n puts \"--------------------------------\"\n\n elsif ennemi1.loot == '1gre'\n $mon_inventaire.addgrenade\n puts \"--------------------------------\"\n puts \"1x Grenade ajoutée à votre inventaire.\"\n puts \"--------------------------------\"\n\n elsif ennemi1.loot == '1po1gre'\n $mon_inventaire.addpotion\n $mon_inventaire.addgrenade\n puts \"--------------------------------\"\n puts \"1x Potion ajoutée à votre inventaire.\"\n puts \"1x Grenade ajoutée à votre inventaire.\"\n puts \"--------------------------------\"\n\n elsif ennemi2.loot == '1po'\n puts \"--------------------------------\"\n puts \"1x Potion ajoutée à votre inventaire.\"\n puts \"--------------------------------\"\n $mon_inventaire.addpotion\n\n elsif ennemi2.loot == '1gre'\n puts \"--------------------------------\"\n puts \"1x Grenade ajoutée à votre inventaire.\"\n puts \"--------------------------------\"\n $mon_inventaire.addgrenade\n end\n\n puts \"\"\n elsif ennemi1.personnage_hp > 0 || ennemi2.personnage_hp > 0\n\n numero_tour += 1\n puts \"----------------------------------\"\n puts \"Tour n°#{numero_tour}\"\n puts \"Ennemis : #{ennemi1.name} ET #{ennemi2.name}\"\n puts \"TIRENT A DISTANCE\"\n if ennemi1.personnage_hp > 0\n puts \"POINTS DE VIE : #{ennemi1.name} #{ennemi1.personnage_hp} HP\"\n end\n if ennemi1.personnage_hp <= 0\n puts \"#{ennemi1.name} : mort.\"\n end\n if ennemi2.personnage_hp > 0\n puts \"POINTS DE VIE : #{ennemi2.name} #{ennemi2.personnage_hp} HP\"\n end\n if ennemi2.personnage_hp <= 0\n puts \"#{ennemi2.name} : mort.\"\n end\n puts \"\"\n puts \"Que faites-vous ?\"\n puts \"1. Attaquer\"\n puts \"2. Défendre\"\n puts \"3. Utiliser un objet\"\n user_choice_4 = $stdin.gets.chomp\n if user_choice_4 == \"1\"\n puts \"Qui attaquer ?\"\n if ennemi1.personnage_hp > 0\n puts \"1. #{ennemi1.name}\"\n end\n if ennemi2.personnage_hp > 0\n puts \"2. #{ennemi2.name}\"\n end\n print \"> \"\n user_choice_4_fight = $stdin.gets.chomp\n if user_choice_4_fight == \"1\" && ennemi1.personnage_hp > 0\n puts \"\"\n puts \"BIM !\"\n puts \"Vous attaquez le #{ennemi1.name}.\"\n puts \"Le #{ennemi1.name} réduit les dégats de #{ennemi1.personnage_defense}.\"\n degats_totaux = user_nameP.personnage_attaque - ennemi1.personnage_defense\n puts \"Le #{ennemi1.name} subit #{(user_nameP.personnage_attaque - ennemi1.personnage_defense)} points de dégats !\"\n\n #On fait attaquer Barret\n\n puts \"Barret attaque le #{ennemi1.name}.\"\n puts \"Le #{ennemi1.name} réduit les dégats de #{ennemi1.personnage_defense}.\"\n degats_barret_1 = barret.personnage_attaque - ennemi1.personnage_defense\n puts \"Le #{ennemi1.name} subit #{(barret.personnage_attaque - ennemi1.personnage_defense)} points de dégats !\"\n\n if ennemi1.personnage_hp > 0\n\n ennemi1.personnage_hp -= degats_totaux\n puts \"\"\n puts \"Le #{ennemi1.name} vous attaque !\"\n puts \"Vous réduisez ses dégats de #{user_nameP.personnage_defense} !\"\n degats_encaisses = ennemi1.personnage_attaque - user_nameP.personnage_defense\n puts \"Vous perdez #{degats_encaisses} points de vie !\"\n user_nameP.personnage_hp -= degats_encaisses\n puts \"Il vous reste #{user_nameP.personnage_hp} points de vie.\"\n\n puts \"Le #{ennemi2.name} attaque Barret !\"\n degats_barret_encaiss = ennemi2.personnage_attaque - barret.personnage_defense\n puts \"Barret perd #{degats_barret_encaiss} points de vie !\"\n barret.personnage_hp -= degats_barret_encaiss\n puts \"Barret a #{barret.personnage_hp} points de vie.\"\n\n if ennemi1.personnage_hp > 0 || ennemi2.personnage_hp > 0\n puts \"Que faites-vous ?\"\n end\n elsif ennemi1.personnage_hp <= 0 || ennemi2.personnage_hp <= 0\n puts \"\"\n puts \"Le #{ennemi1.name} est mort !\"\n ennemi1.personnage_alive = false\n end\n elsif user_choice_4_fight == \"2\" && ennemi2.personnage_hp > 0\n puts \"\"\n puts \"BIM !\"\n puts \"Vous attaquez le #{ennemi2.name}.\"\n puts \"Le #{ennemi2.name} réduit les dégats de #{ennemi2.personnage_defense}.\"\n degats_totaux = user_nameP.personnage_attaque - ennemi2.personnage_defense\n puts \"Le #{ennemi2.name} subit #{(user_nameP.personnage_attaque - ennemi2.personnage_defense)} points de dégats !\"\n if ennemi2.personnage_hp > 0\n\n ennemi2.personnage_hp -= degats_totaux\n puts \"\"\n puts \"Le #{ennemi2.name} vous attaque !\"\n puts \"Vous réduisez ses dégats de #{user_nameP.personnage_defense} !\"\n degats_encaisses = ennemi2.personnage_attaque - user_nameP.personnage_defense\n puts \"Vous perdez #{degats_encaisses} points de vie !\"\n user_nameP.personnage_hp -= degats_encaisses\n puts \"Il vous reste #{user_nameP.personnage_hp} points de vie.\"\n\n puts \"Le #{ennemi2.name} attaque Barret !\"\n degats_barret_encaiss = ennemi2.personnage_attaque - barret.personnage_defense\n puts \"Barret perd #{degats_barret_encaiss} points de vie !\"\n barret.personnage_hp -= degats_barret_encaiss\n puts \"Barret a #{barret.personnage_hp} points de vie.\"\n\n if ennemi1.personnage_hp > 0 || ennemi2.personnage_hp > 0\n puts \"Que faites-vous ?\"\n end\n elsif ennemi1.personnage_hp <= 0 || ennemi2.personnage_hp <= 0\n puts \"\"\n puts \"Le #{ennemi2.name} est mort !\"\n ennemi2.personnage_alive = false\n end\n end\n elsif user_choice_4 == \"2\"\n puts \"Vous gagnez de la défense !\"\n puts \"Barret gagne de la défense !\"\n user_nameP.personnage_defense += 3\n barret.personnage_defense += 3\n puts \"\"\n puts \"Le #{ennemi1.name} vous attaque !\"\n puts \"Vous réduisez ses dégats de #{user_nameP.personnage_defense} !\"\n degats_encaisses = ennemi1.personnage_attaque - user_nameP.personnage_defense\n puts \"Vous perdez #{degats_encaisses} points de vie !\"\n user_nameP.personnage_hp -= degats_encaisses\n puts \"Le #{ennemi1.name} attaque Barret !\"\n degats_barret_encaiss = ennemi2.personnage_attaque - barret.personnage_defense\n puts \"Barret perd #{degats_barret_encaiss} points de vie !\"\n barret.personnage_hp -= degats_barret_encaiss\n puts \"Barret a #{barret.personnage_hp} points de vie.\"\n\n elsif user_choice_4 ==\"3\"\n if $mon_inventaire.show_potion > 0 || $mon_inventaire.show_grenade > 0\n puts \"Potions : #{$mon_inventaire.show_potion}\"\n puts \"Grenades : #{$mon_inventaire.show_grenade}\"\n puts \"Que voulez-vous utiliser ?\"\n if $mon_inventaire.show_potion > 0\n puts \"1. Une potion.\"\n puts \"2. Rien finalement.\"\n combat2_potion_simple = $stdin.gets.chomp\n\n if combat2_potion_simple == \"1\"\n puts \"Sur qui la lancer ?\"\n puts \"1. Sur vous-même.\"\n puts \"2. Sur Barret.\"\n user_potion_fight = $stdin.gets.chomp\n\n if user_potion_fight == \"1\"\n puts \"Vous regagnez #{50 - user_nameP.personnage_hp} points de vie.\"\n user_nameP.personnage_hp = 50\n $mon_inventaire.removpotion\n elsif user_potion_fight ==\"2\"\n puts \"Barret regagne #{60 - barret.personnage_hp} points de vie.\"\n barret.personnage_hp = 60\n $mon_inventaire.removpotion\n else\n \"Merci d'indiquer un bon chiffre.\"\n end\n puts \"Le #{ennemi1.name} vous attaque !\"\n puts \"Vous réduisez ses dégats de #{user_nameP.personnage_defense} !\"\n degats_encaisses = ennemi1.personnage_attaque - user_nameP.personnage_defense\n puts \"Vous perdez #{degats_encaisses} points de vie !\"\n user_nameP.personnage_hp -= degats_encaisses\n puts \"Que faites-vous ?\"\n elsif combat2_potion_simple == \"2\"\n numero_tour -= 1\n else\n puts \"Merci d'indiquer un nombre pertinent.\"\n numero_tour -=1\n end\n\n elsif $mon_inventaire.show_grenade > 0\n puts \"1. Une grenade !\"\n puts \"2. Rien finalement.\"\n combat2_grenade_simple = $stdin.gets.chomp\n if combat2_grenade_simple == \"1\"\n \"Le #{ennemi1.name} subit 30 points de dégats.\"\n garde1.personnage_hp -= 30\n $mon_inventaire.removgrenade\n elsif combat2_grenade_simple == \"2\"\n numero_tour -= 1\n else\n numero_tour -= 1\n end\n else\n puts \"1. Une potion.\"\n puts \"2. Une grenade !\"\n puts \"3. Rien finalement.\"\n combat2_grenade_ou_potion = $stdin.gets.chomp\n if combat2_grenade_ou_potion == \"1\"\n puts \"Sur qui la lancer ?\"\n puts \"1. Sur #{user_name}.\"\n puts \"2. Sur Barret.\"\n user_potion_fight1 = $stdin.gets.chomp\n\n if user_potion_fight1 == \"1\"\n puts \"Vous regagnez #{50 - user_nameP.personnage_hp} points de vie.\"\n user_nameP.personnage_hp = 50\n $mon_inventaire.removpotion\n elsif user_potion_fight1 ==\"2\"\n puts \"Barret regagne #{60 - barret.personnage_hp} points de vie.\"\n barret.personnage_hp = 60\n $mon_inventaire.removpotion\n else\n \"Merci d'indiquer un bon chiffre.\"\n end\n puts \"Le #{ennemi1.name} vous attaque !\"\n puts \"Vous réduisez ses dégats de #{user_nameP.personnage_defense} !\"\n degats_encaisses = ennemi1.personnage_attaque - user_nameP.personnage_defense\n puts \"Vous perdez #{degats_encaisses} points de vie !\"\n user_nameP.personnage_hp -= degats_encaisses\n puts \" Que faites-vous ?\"\n elsif combat2_grenade_ou_potion == \"2\"\n \"Le #{ennemi1.name} subit 30 points de dégats.\"\n garde1.personnage_hp -= 30\n $mon_inventaire.removgrenade\n elsif combat2_grenade_ou_potion == \"3\"\n numero_tour -= 1\n else\n numero_tour -= 1\n end\n\n\n end\n else\n puts \"Vous n'avez pas d'objet !\"\n numero_tour -= 1\n end\n\n elsif user_choice_4 ==\"i\" || user_choice_4 ==\"I\" && $mon_inventaire.show_potion > 0 || $mon_inventaire.show_grenade > 0\n puts \"\"\n puts '|' + '-'*20 + '|'\n puts \"|INVENTAIRE |\"\n puts '|' + '-'*20 + '|'\n puts \"|Potions : #{$mon_inventaire.show_potion} |\"\n puts \"|Grenades : #{$mon_inventaire.show_grenade} |\"\n puts '|' + '-'*20+ '|'\n numero_tour -= 1\n elsif user_choice_4 ==\"i\" || user_choice_4 ==\"I\"\n puts \"Vous n'avez pas d'objets dans votre inventaire pour l'instant.\"\n numero_tour -= 1\n else\n puts \"\"\n puts \"Je n'ai pas compris. Que faites-vous ?\"\n puts \"\"\n numero_tour -= 1\n end\n end\n end\n\n def afficher_inventaire\n#à compléter\n\n end\nend",
"def anular\n self.estado = Cancelacion::ESTADOS[:anulada]\n end",
"def alRomia(nombro)\n\n romiajLiteroj = [\"M\", \"CM\", \"D\", \"CD\", \"C\", \"XC\", \"L\", \"XL\", \"X\", \"IX\", \"V\", \"IV\", \"I\"]\n arabajLiteroj = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]\n \n romia = \"\"\n komenca = nombro\n \n for j in 0..romiajLiteroj.count - 1\n \n romiaLitero = romiajLiteroj[j] \n arabaSumo = arabajLiteroj[j]\n div = komenca / arabaSumo\n \n if div > 0\n \n for i in 0..div-1\n romia += romiaLitero\n end\n \n komenca -= arabaSumo * div\n end\n end\n\n return romia\nend"
] |
[
"0.67087585",
"0.66166407",
"0.65287495",
"0.6429256",
"0.6249654",
"0.6235706",
"0.6201119",
"0.61923677",
"0.6153229",
"0.61350083",
"0.61311436",
"0.61049783",
"0.6093661",
"0.60761464",
"0.6058017",
"0.60579515",
"0.6051392",
"0.60140836",
"0.60090864",
"0.5994895",
"0.59889275",
"0.59818065",
"0.597899",
"0.5975025",
"0.5964674",
"0.59589654",
"0.5954998",
"0.59526974",
"0.5951197",
"0.59441674",
"0.5941202",
"0.5922015",
"0.592179",
"0.5891223",
"0.58880234",
"0.5887955",
"0.5873537",
"0.58729523",
"0.58663696",
"0.5865362",
"0.5864286",
"0.58565795",
"0.58552384",
"0.58515877",
"0.5844647",
"0.5841594",
"0.58290535",
"0.5828673",
"0.5820516",
"0.5802897",
"0.57994175",
"0.57979435",
"0.57841974",
"0.5782838",
"0.5766622",
"0.5752144",
"0.575071",
"0.5749845",
"0.5748083",
"0.5745388",
"0.57430106",
"0.57385916",
"0.5736201",
"0.5731734",
"0.57220775",
"0.5720313",
"0.5718503",
"0.5714769",
"0.5708907",
"0.57049084",
"0.5693004",
"0.5691255",
"0.56908333",
"0.568578",
"0.5685118",
"0.5683389",
"0.56805986",
"0.56761336",
"0.5669347",
"0.56682575",
"0.5666353",
"0.5665466",
"0.56610996",
"0.5660641",
"0.5655458",
"0.56529284",
"0.56524813",
"0.5651785",
"0.5638887",
"0.5632248",
"0.5632036",
"0.56290555",
"0.56271565",
"0.5626666",
"0.56243813",
"0.5624005",
"0.56019723",
"0.5596917",
"0.55924326",
"0.5587415",
"0.5586864"
] |
0.0
|
-1
|
=begin dada una palabra clave(llave) construlle una tabla tipo vigenere polialfabetica. =end
|
def crea_tabla(llave)
renglon = Array.new
tam = llave.length
tam.times do |i|
tmp = "" << llave[i]
if ALFABETO.include? tmp
renglon.push(tmp)
ALFABETO.delete! tmp
end
end
ALFABETO.chars{|c| renglon.push(c)}
tabla = Array.new
tabla.push(renglon.to_s)
for i in (1...26)
aux = recorre(renglon.to_s, i)
tabla.push(aux)
end#for
return tabla
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def publicaEnPantalla(tabla,resultados)\n\t\tentrada=0\n\t\ti=0\n\t\trenglonesDeResultado=[]\n\t\twhile resultados.length > entrada\n\t\t\tif (resultados[entrada].to_s==tabla.getItemText(i,4).to_s)\n\t\t\t\tentrada=1+entrada\n\t\t\t\trenglonesDeResultado.push(i)\n\t\t\t\ti=0\n\t\t\telse\n\t\t\t\ti=1+i\n\t\t\tend\n\t\tend\n\t\tk=0\n\t\twhile tabla.numRows > k\n\t\t\tif renglonesDeResultado.include?(k)\n\t\t\t\ttabla.setRowHeight(k,20)\n\t\t\telse\n\t\t\t\ttabla.setRowHeight(k,0)\n\t\t\tend\n\t\t\tk=k+1\n\t\tend\n\tend",
"def createTable\n\t\tstm = @db.prepare \"CREATE TABLE IF NOT EXISTS leituras (\n\t\t\t\tIDCLIENTE INT NOT NULL,\n\t\t\t\tIDSENSOR INT NOT NULL,\n\t\t\t\tVALUE INT NOT NULL,\n\t\t\t\tGPSX INT NOT NULL,\n\t\t\t\tGPSY INT NOT NULL,\n\t\t\t\tTIMESTAMP TEXT NOT NULL\n\t\t\t);\"\n\n\t\trs = stm.execute\n\t\trs.close\n\tend",
"def tabla_pasos(contador,array_anterior)\n aux=0\n tabla = Terminal::Table.new do |a|\n a.title= \"ELEMENTOS A ORDENAR: #{array_anterior}\"\n a.headings = [{value:'DATO', alignment: :center},{value:'ESTRUCTURA', alignment: :center}]\n for i in 0..contador-1\n a.add_row([\n aux+=1,\n @pasoL[i]\n ])\nend\n end\n return tabla\n end",
"def getTable\r\n return @pila_t.last #puedes hacer getTable sucesivos sin modificar nada en lo absoluto.\r\n end",
"def reconstruir_palabras\n palabras = []\n @trie.reconstruir_palabras_nodo('', palabras)\n palabras\n end",
"def initialize_table; end",
"def table; end",
"def table; end",
"def table; end",
"def table; end",
"def to_tabla\n\t\t\t\"#{@nombre}#{' ' * (15-@nombre.size)} #{@proteinas.round(1)} #{@glucidos.round(1)} #{@lipidos.round(1)} #{valor_energetico.round(2)}\"\n\t\tend",
"def tabla_flota(list_flota)\n data = Array.new\n encabezado = make_table([ [{content: 'Placa', :width => 100, :size => 7},\n {content: 'Modelo', :width => 100, :size => 7},\n {content: 'Marca', :width => 100, :size => 7},\n {content: 'Año', :width => 60, :size => 7},\n {content: 'Serial de Carroceria', :width => 100, :size => 7}] ])\n table([\n [{content: \"\", :colspan => 7, :border_bottom_width => 0} ],\n [{content: \"\", :colspan => 1, :border_top_width => 0, :border_bottom_width => 0, :width => 30},\n {content: encabezado, :colspan => 5, :width => 460, background_color: 'd7d7d7'},\n {content: \"\", :colspan => 1,:border_top_width => 0, :border_bottom_width => 0, :width => 30}]\n ])\n list_flota.each_with_index do |vehiculos,index|\n data = make_table([ [{content: vehiculos.placa,:width => 100, :size => 7 },\n {content: vehiculos.modelo, :width => 100, :size => 7},\n {content: vehiculos.marca, :width => 100, :size => 7},\n {content: vehiculos.ano.to_s, :width => 60, :size => 7},\n {content: vehiculos.s_carroceria,:width => 100, :size => 7 }] ])\n\n table([\n [{content: \"\", :colspan => 1, :border_top_width => 0, :border_bottom_width => 0, :width => 30},\n {content: data, :colspan => 5, :width => 460},\n {content: \"\", :colspan => 1, :border_top_width => 0, :border_bottom_width => 0, :width => 30} ]\n\n ])\n if cursor <= 40\n table([\n [{content: \"\", :colspan => 7, :border_top_width => 0, :width => 520}]\n ])\n start_new_page\n flota list_flota.slice(index+1,list_flota.length), true if index+1 <= list_flota.length\n return\n end\n end\n\n table([\n [{content: \"\", :colspan => 7, :border_top_width => 0, :width => 520}]\n ])\n\n end",
"def preenche_parcelas_recorrencia\n return unless recorrencia\n \n if recorrencia.tipo == 'por'\n recorrencia.data_inicial = data\n recorrencia.parcelas = recorrencia.descobre_parcelas\n else\n recorrencia.parcelas = nil\n end\n end",
"def planilla\n move_down(@@interlineado)\n # parte 1\n indent(@@margin) do\n table_info = [\n [ {image: \"#{Rails.root}/public/Barcodes/Code128B_#{@solicitud.numero_planilla}.png\"},\n {content: \"\\nNúmero de Planilla: #{sprintf '%013d', @solicitud.numero_planilla }\"}]\n ]\n width_columns = [260, 260]\n draw_table_two_columns(table_info, width_columns)\n end\n # parte 2\n indent(@@margin) do\n table_info = [\n ['Datos del Solicitante']\n ]\n width_columns = [520]\n\n # Aplica el formato de la tabla creada anteriormente\n draw_table_titulos_columns(table_info, width_columns)\n end\n indent(@@margin) do\n table_info = [\n [ {content:\"Nombre y Apellido: #{@usuario_sput.nombre + ' ' + @usuario_sput.apellido}\", colspan: 2},\n {content:\"Identificación: #{@usuario_sput.nacionalidad + ' ' + @usuario_sput.numero_doc}\",\n colspan: 2}],\n [{content:\"Teléfonos: #{telefono @usuario_sput.telefono_local}\", colspan: 2},{content:\"Correo Electrónico: #{@usuario_sput.session_user.email} \", colspan: 2}],\n [{ content:\"Dirección: #{@representante_legal.direccion}\", colspan: 4}]\n ]\n width_columns = [130, 130, 130, 130]\n\n # Aplica el formato de la tabla creada anteriormente\n draw_table_four_columns(table_info, width_columns)\n end\n # parte 3\n indent(@@margin) do\n table_info = [\n ['Datos de la Escuela de Transporte']\n ]\n width_columns = [520]\n\n # Aplica el formato de la tabla creada anteriormente\n draw_table_titulos_columns(table_info, width_columns)\n end\n indent(@@margin) do\n table_info = [\n [ {content:\"Nombre: #{@escuela_transporte.razonSocial}\", colspan: 2},\n {content:\"Nombre Comercial: #{@escuela_transporte.razonSocial}\", colspan: 2}],\n [ {content:\"Tipo de Escuela: #{@escuela_transporte.tipo_escuela.nombre} \", colspan: 2},\n {content:\"Rif: #{@escuela_transporte.tipo_rif+@escuela_transporte.rif.to_s+ @escuela_transporte.digito_rif.to_s} \", colspan: 2}],\n [{content:\"Teléfono: #{telefono @escuela_transporte.telefono} \", colspan: 2},\n {content:\"Teléfono Móvil: #{telefono @escuela_transporte.movil}\", colspan: 2}],\n [{content:\"Email: #{@escuela_transporte.email} \", colspan: 2},\n {content:\"Dirección Web: #{@escuela_transporte.url}\", colspan: 2}],\n\n ]\n width_columns = [130, 130, 130, 130]\n\n # Aplica el formato de la tabla creada anteriormente\n draw_table_four_columns(table_info, width_columns)\n end\n\n indent(@@margin) do\n table_info = [\n ['Dirección Fiscal']\n ]\n width_columns = [520]\n\n # Aplica el formato de la tabla creada anteriormente\n draw_table_titulos_columns(table_info, width_columns)\n end\n\n indent(@@margin) do\n table_info = [\n [{content:\"Estado: #{@escuela_transporte.ciudad.estado.nombre}\", colspan: 1, :size => 6},\n {content:\"Ciudad: #{@escuela_transporte.ciudad.nombre} \", colspan: 1, :size => 6},\n {content:\"Municipio: #{@escuela_transporte.parroquia.municipio.nombre}\", colspan: 1, :size => 6},\n {content:\"Parroquia: #{@escuela_transporte.parroquia.nombre}\", colspan: 1, :size => 6}],\n [{content:\"Sector/Urbanización: #{@escuela_transporte.direccion}\", colspan: 4}]\n\n ]\n width_columns = [130, 130, 130, 130]\n\n # Aplica el formato de la tabla creada anteriormente\n draw_table_four_columns(table_info, width_columns)\n\n end\n # parte 4\n\n indent(@@margin) do\n table_info = [\n ['Trámites']\n ]\n width_columns = [520]\n draw_table_titulos_columns(table_info, width_columns)\n end\n indent(@@margin) do\n table_info = [\n [ {content: \"Trámite: Autorización para la construcción y adecuación \", colspan: 2, :size => 6},\n {content: \"Número de Trámite: #{sprintf '%012d',@solicitud.id}\", colspan: 2, :size => 6}]\n ]\n width_columns = [130,130,130,130]\n draw_table_four_columns(table_info, width_columns)\n end\n\n # parte 5\n flota(@solicitud.vehiculo_pres)\n\n # parte 6\n start_new_page if cursor <= 200\n indent(@@margin) do\n table_info = [\n [ 'Funcionario Receptor', 'Solicitante']\n ]\n width_columns = [260, 260]\n\n # Aplica el formato de la tabla creada anteriormente\n draw_table_pie_columns(table_info, width_columns)\n pie_planilla\n end\n\n end",
"def start_table\r\n n = @char_set.length\r\n t_size = @size\r\n create_table(@char_set, '', n, t_size)\r\n end",
"def tabla_legacy\n @equivalencia_tablas[@nombre_tabla]\n end",
"def set_tabla\n @objeto = Tabla.find(params[:id])\n end",
"def table=(_arg0); end",
"def initialize(primary_key, uuid, uti, note)\n # Set this objects's variables\n super(primary_key, uuid, uti, note)\n\n # This will hold our reconstructed table\n @reconstructed_table = Array.new\n\n # These variables hold different parts of the protobuf\n @row_items = Array.new\n @table_objects = Array.new\n @uuid_items = Array.new\n @type_items = Array.new\n\n @total_rows = 0\n @total_columns = 0\n\n # This will hold a mapping of UUID index number to row Array index in @reconstructed_table\n @row_indices = Hash.new\n\n # This will hold a mapping of UUID index number to column Array index in @reconstructed_table\n @column_indices = Hash.new\n\n # This will hold the table's direction, it defaults to left-to-right, will be changed during rebuild_table if needed\n @table_direction = LEFT_TO_RIGHT_DIRECTION\n rebuild_table\n end",
"def tabla\n @nombre_tabla\n end",
"def initTableaux\n @meilleursJoueursScore = [[],[],[]]\n for i in 1..4\n @meilleursJoueursScore.push([])\n for j in 0..4\n @meilleursJoueursScore[i][j]=0\n end\n end\n @meilleursJoueursPseudo = [[],[],[]]\n for i in 1..4\n @meilleursJoueursPseudo.push([])\n for j in 0..4\n @meilleursJoueursPseudo[i][j]=\"---\"\n end\n end\n end",
"def botonMinarAccion(tabla)\n\t\ts=ControlDeBase.new\n\t\ts.creaBase()\n\t\telementos=Minero.new.cuentaElementos()\n\t\tMinero.new.registraElementos()\n\t\ttitulos=s.tablaGeneralTitulos\n\t\tartistas=s.tablaGeneralArtistas\n\t\talbums=s.tablaGeneralAlbum\n\t\tgenero=s.tablaGeneralGenero\n\t\tpath=s.tablaGeneralPath\n\t\ti=0\n\t\te=0\n\t\tcount=0.0\n\t\twhile i<path.length\n\t\t\twhile e<tabla.numRows\n\t\t\t\tif path[i].to_s==tabla.getItemText(e,4).to_s and path[i].to_s!=\"\" and tabla.getItemText(e,4).to_s!= \"\"\n\t\t\t\t\te=0\n\t\t\t\t\ti=i+1\n\t\t\t\t\tnext\n\t\t\t\telse\n\t\t\t\t\te=e+1\n\t\t\t\tend\n\t\t\tend\n\t\t\tif(!path[i].nil?)\n\t\t\t\ttabla.appendRows(1)\n\t\t\t\ttabla.setItemText(i,0,titulos[i][0].to_s)\n\t\t\t\ttabla.setItemText(i,1,artistas[i][0].to_s)\n\t\t\t\ttabla.setItemText(i,2,albums[i][0].to_s)\n\t\t\t\ttabla.setItemText(i,3,genero[i][0].to_s)\n\t\t\t\ttabla.setItemText(i,4,path[i].to_s)\n\t\t\t\ttabla.setItemJustify(i,0,FXTableItem::LEFT)\n\t\t\t\ttabla.setItemJustify(i,1,FXTableItem::LEFT)\n\t\t\t\ttabla.setItemJustify(i,2,FXTableItem::LEFT)\n\t\t\t\ttabla.setItemJustify(i,3,FXTableItem::LEFT)\n\t\t\t\ti=i+1\n\t\t\t\te=0\n\t\t\tend\n\t\tend\n\tend",
"def _table; @table end",
"def columnas\n case tabla\n when 'users'\n 'id,login,nombre_usuario, activo,email,encrypted_password,reset_password_token,reset_password_sent_at,remember_created_at,sign_in_count,current_sign_in_at,last_sign_in_at,current_sign_in_ip,last_sign_in_ip,password_salt,failed_attempts,unlock_token,locked_at,password_changed_at,created_at,updated_at,tc_dependencia_codigo,tc_unidad_codigo,tc_area_codigo,observacion'\n when 'tc_estados'\n 'id,codigo,nombre,created_at,updated_at'\n when 'tc_agencias'\n 'id,codigo,nombre,tc_estado_codigo,tc_tipo_agencia_codigo,tc_region_codigo,estatus_agencia_activa,created_at,updated_at'\n when 'rn_registros_riesgos'\n columnas_comunes + ',user_id'\n when 'rr_registros_riesgos'\n columnas_comunes + ',user_id'\n when 'ro_frecuencias_ro_impactos'\n 'id,valor,ro_frecuencia_id,ro_impacto_id'\n when 'rn_frecuencias_rn_impactos'\n 'id, valor, rn_frecuencia_id, rn_impacto_id'\n when 'rr_frecuencias_rr_impactos'\n 'id, valor, rr_frecuencia_id, rr_impacto_id'\n when 'rn_mitigantes'\n 'id, descripcion, procedimiento, recurso, fecha_ejecucion, mandatorio, costo_implantacion, programa_gestion, comentarios_responsable, sugerencias_riesgo, observaciones, rn_detalle_riesgo_id, rn_control_id, created_at, updated_at, ro_tipo_mitigante_id, ro_tipo_control_fase_id, ro_tipo_control_frecuencia_id, ro_tipo_control_implementacion_id, ro_tipo_control_reduccion_id, ro_tipo_control_diseno_id, tc_dependencia_codigo'\n when 'rr_mitigantes'\n 'id, descripcion, procedimiento, recurso, fecha_ejecucion, mandatorio, programa_gestion, comentarios_responsable, sugerencias_riesgo, observaciones, rr_detalle_riesgo_id, rr_control_id, created_at, updated_at, ro_tipo_mitigante_id, ro_tipo_control_fase_id, ro_tipo_control_frecuencia_id, ro_tipo_control_implementacion_id, ro_tipo_control_reduccion_id, ro_tipo_control_diseno_id, tc_dependencia_codigo'\n when 'rn_detalles_riesgos'\n columnas_comunes + ',rn_frecuencia_id,rn_nivel_riesgo_id,rn_impacto_id'\n when 'rr_detalles_riesgos'\n columnas_comunes + ',rr_frecuencia_id,rr_nivel_riesgo_id,rr_impacto_id'\n when 'rr_registros_riesgos'\n columnas_comunes + ',codigo,user_id'\n when 'rr_seguimientos'\n columnas_comunes + ',rr_mitigante_id'\n when 'rn_seguimientos'\n columnas_comunes + ',rn_mitigante_id'\n when 'rr_detalles_riesgos_residuales'\n columnas_comunes + ',rr_frecuencia_id,rr_nivel_riesgo_id,rr_impacto_id'\n when 'rn_detalles_riesgos_residuales'\n columnas_comunes + ',rn_frecuencia_id,rn_nivel_riesgo_id,rn_impacto_id'\n when 'fechas_cargadas'\n columnas_comunes\n else\n\n columnas_comunes\n end\n end",
"def printTabla(nivel)\n\t\tprintNivel(nivel)\n\t\tputs \"SYMBOL TABLE\"\n\n\t\t@tabla.each do |identificador, valor|\n\t\t\tprintNivel(nivel+1)\n\t\t\tputs \"Name: #{identificador}, Type: #{valor.str}\"\n\t\tend\n\tend",
"def head_table(opcoes = {})\n font_size 8\n #Config do campo Datas e a Linha horizontal\n bounding_box([0, 470], :width => 2200, :font_style => :bold) do\n # vertical_line 0, -40, :at => 225\n # #horizontal_line 240, 640, :at => -31\n # rotate(90, :origin => [00, 00]) do\n # draw_text \"Datas\", :at => [-32,-235], :font_style => :bold\n # end\n #fim Config\n \n #Tabela de Cabecalho\n \n #Controle das datas das aulas\n qtd_aulas = @discipline.discipline_class_exams.count\n repeticoes = qtd_aulas.div 12\n ite = opcoes[:iteracao]\n \n #Iteracoes para o controle das datas de aulas\n if !@preenchido.blank?\n dates_classes = [] \n for i in (ite*12)..(12*(ite+1))-1\n !@discipline.discipline_class_exams[i].blank? ? dates_classes << I18n.l(@discipline.discipline_class_exams[i].applied_at, :format => \"%d/%b\") : dates_classes << \" \"\n end \n data_head = [[\"Nº\",\"Matrícula\",\"Aluno\"] + dates_classes + [\"Total de Presenças\",\"Total de Faltas\",\"% de Faltas\",\"Média\"]]\n else\n data_head = [[\"Nº\",\"Matrícula\",\"Aluno\"] + [\" \"]*12 + [\"Total de Presenças\",\"Total de Faltas\",\"% de Faltas\",\"Média\"]]\n end\n #Fim da Iteraca\n #Fim do controle das datas de aulas\n \n # Definição e Desenho da Tabela Cabecalho\n \n \n table(data_head, :header => true) do\n row(0).height = (40)\n row(0).align = :center\n row(0).font_style = :bold\n row(0).columns(0).padding = [15,0,0,0]\n row(0).columns(1).padding = [15,0,0,0]\n row(0).columns(2).padding = [15,0,0,0]\n row(0).columns(23).padding = [10,0,0,0]\n row(0).columns(24).padding = [10,0,0,0]\n row(0).columns(25).padding = [10,0,0,0]\n columns(3..34).width = 30\n columns(0).width = 25\n columns(1).width = 90\n columns(2).width = 125\n columns(15).width = 60\n columns(16).width = 35\n columns(17).width = 35\n columns(18).width = 35\n \n row(0).column(3..14).rotate = 90\n #influencia -> [esquerda, cima, direita, baixo]\n row(0).column(3..14).padding = [45,-35,-35,10]\n end\n \n \n end\n end",
"def cifra_vigenere(llave)\n cifrado = \"\"\n longitud = @texto.length\n 0.upto(longitud-1) do |j|\n i = j % (llave.size)\n alfabeto_ver = corrimiento(llave[i])\n car_cifrar = \"\" << @texto[j]\n posicion = MINUSCULAS.index(car_cifrar)\n a = alfabeto_ver[posicion]\n cifrado.concat(a)\n end\n @manejador.guardar_archivo(\"#{VIG_EN}\", cifrado)\n puts cifrado\n end",
"def load_table_schema(conn, builder, table)\n builder.relvar(table){\n primary_key_columns = load_table_heading(conn, builder, table)\n load_table_constraints(conn, builder, table, primary_key_columns)\n }\n end",
"def align_local(protein)\n # Vytvoreni tabulky\n x = protein.sequence.size\n y = @genome.sequence.size\n tab = Array.new(x+1) { Array.new(y+1) }\n\n # Vyplnime prvni radek a sloupec\n for i in 0..x\n tab[i][0] = 0\n end\n for j in 0..y\n tab[0][j] = 0\n end\n\n for i in 1..x\n for j in 1..y\n match = tab[i-1][j-1] + match(i, j, protein)\n delete = tab[i-1][j] + @@d\n insert = tab[i][j-1] + @@d\n\n tab[i][j] = [match, delete, insert, 0].max\n end\n end\n\n @table = tab\n value = 0\n @lok_max_coordinates = [0,0]\n for i in 1..x\n for j in 1..y\n if tab[i][j] >= value\n value = tab[i][j]\n @lok_max_coordinates = [i, j]\n end\n end\n end\n EvaluatedProtein.new(protein, value)\n end",
"def ordenar_paso_a_paso(pila,array=[],cola,lista,ya_ordeno)\n if ya_ordeno[:ordenar]\n begin\n limpiar_pantalla\n tabla = Terminal::Table.new do |a|\n a.title= 'Ordenar paso a paso'\n a.headings = [{value:'No.', alignment: :center},{value:'Estructura', alignment: :center}]\n a.add_row([{value:'1', alignment: :center},'Cola.' ])\n a.add_row([{value:'2', alignment: :center},'Pila.'])\n a.add_row([{value:'3', alignment: :center},'Lista.'])\n a.add_row([{value:'4', alignment: :center},'Salir.' ])\nend\n puts tabla\n print \"Ingrese una estructura: \"\n opc = gets.chomp\n limpiar_pantalla()\n case opc\n when '1'\n if array.size!=0\n array_antes=array.join(',')\n cola.mostrar_paso(array_antes)\n gets\n else\n puts 'Ingrese nuevos datos para ordenar'\n gets\n end\n when '2'\n if array.size!=0\n array_antes=array.join(',')\n pila.mostrar_pasos(array_antes)\n gets\n else\n puts 'Ingrese nuevos datos para ordenar'\n gets\n end\n when '3'\n if array.size!=0\n array_antes=array.join(',')\n lista.mostrar_paso(array_antes)\n gets\n else\n puts 'Ingrese nuevos datos para ordenar'\n gets\n end\n else\n 'La opcion no es valida vuelva a ingresar'\n gets\n end\nend while opc!='4'\nelse\n array_antes=array.join(',')\n pila.ordenar_pila(array)\n cola.ordenar_cola(array)\n lista.ordenar_lista(array)\n ya_ordeno[:ordenar]=true\n begin\n limpiar_pantalla\n tabla = Terminal::Table.new do |a|\n a.title= 'Ordenar paso a paso'\n a.headings = [{value:'No.', alignment: :center},{value:'Estructura', alignment: :center}]\n\n a.add_row([{value:'1', alignment: :center},'Cola.' ])\n a.add_row([{value:'2', alignment: :center},'Pila.'])\n a.add_row([{value:'3', alignment: :center},'Lista.'])\n a.add_row([{value:'4', alignment: :center},'Salir.' ])\nend\n puts tabla\n print \"Ingrese una estructura: \"\n opc = gets.chomp\n limpiar_pantalla()\n case opc\n when '1'\n if array.size!=0\n array_antes=array.join(',')\n cola.mostrar_paso(array_antes)\n gets\n else\n puts 'Ingrese nuevos datos para ordenar'\n gets\n end\n when '2'\n if array.size!=0\n array_antes=array.join(',')\n pila.mostrar_pasos(array_antes)\n gets\n else\n puts 'Ingrese nuevos datos para ordenar'\n gets\n end\n when '3'\n if array.size!=0\n array_antes=array.join(',')\n lista.mostrar_paso(array_antes)\n gets\n else\n puts 'Ingrese nuevos datos para ordenar'\n gets\n end\n else\n 'La opcion no es valida vuelva a ingresar'\n gets\n end\nend while opc!='4'\nend\nend",
"def ordenar_paso_a_paso(pila,array=[],cola,lista,ya_ordeno)\n if ya_ordeno[:ordenar]\n begin\n limpiar_pantalla\n tabla = Terminal::Table.new do |a|\n a.title= 'Ordenar paso a paso'\n a.headings = [{value:'No.', alignment: :center},{value:'Estructura', alignment: :center}]\n a.add_row([{value:'1', alignment: :center},'Cola.' ])\n a.add_row([{value:'2', alignment: :center},'Pila.'])\n a.add_row([{value:'3', alignment: :center},'Lista.'])\n a.add_row([{value:'4', alignment: :center},'Salir.' ])\nend\n puts tabla\n print \"Ingrese una estructura: \"\n opc = gets.chomp\n limpiar_pantalla()\n case opc\n when '1'\n if array.size!=0\n array_antes=array.join(',')\n cola.mostrar_paso(array_antes)\n gets\n else\n puts 'Ingrese nuevos datos para ordenar'\n gets\n end\n when '2'\n if array.size!=0\n array_antes=array.join(',')\n pila.mostrar_pasos(array_antes)\n gets\n else\n puts 'Ingrese nuevos datos para ordenar'\n gets\n end\n when '3'\n if array.size!=0\n array_antes=array.join(',')\n lista.mostrar_paso(array_antes)\n gets\n else\n puts 'Ingrese nuevos datos para ordenar'\n gets\n end\n else\n 'La opcion no es valida vuelva a ingresar'\n gets\n end\nend while opc!='4'\nelse\n array_antes=array.join(',')\n pila.ordenar_pila(array)\n cola.ordenar_cola(array)\n lista.ordenar_lista(array)\n ya_ordeno[:ordenar]=true\n begin\n limpiar_pantalla\n tabla = Terminal::Table.new do |a|\n a.title= 'Ordenar paso a paso'\n a.headings = [{value:'No.', alignment: :center},{value:'Estructura', alignment: :center}]\n\n a.add_row([{value:'1', alignment: :center},'Cola.' ])\n a.add_row([{value:'2', alignment: :center},'Pila.'])\n a.add_row([{value:'3', alignment: :center},'Lista.'])\n a.add_row([{value:'4', alignment: :center},'Salir.' ])\nend\n puts tabla\n print \"Ingrese una estructura: \"\n opc = gets.chomp\n limpiar_pantalla()\n case opc\n when '1'\n if array.size!=0\n array_antes=array.join(',')\n cola.mostrar_paso(array_antes)\n gets\n else\n puts 'Ingrese nuevos datos para ordenar'\n gets\n end\n when '2'\n if array.size!=0\n array_antes=array.join(',')\n pila.mostrar_pasos(array_antes)\n gets\n else\n puts 'Ingrese nuevos datos para ordenar'\n gets\n end\n when '3'\n if array.size!=0\n array_antes=array.join(',')\n lista.mostrar_paso(array_antes)\n gets\n else\n puts 'Ingrese nuevos datos para ordenar'\n gets\n end\n else\n 'La opcion no es valida vuelva a ingresar'\n gets\n end\nend while opc!='4'\nend\nend",
"def ordenar_paso_a_paso(pila,array=[],cola,lista,ordenamientof)\n if ordenamientof[:ordenar]\n begin\n limpiar_pantalla\n tabla = Terminal::Table.new do |a|\n a.title= 'ORDEN PASO A PASO'\n a.headings = [{value:'No.', alignment: :center},{value:'ESTRUCTURA', alignment: :center}]\n a.add_row([{value:'1', alignment: :center},'COLA' ])\n a.add_row([{value:'2', alignment: :center},'PILA'])\n a.add_row([{value:'3', alignment: :center},'LISTA'])\n a.add_row([{value:'4', alignment: :center},'SALIR' ])\nend\n puts tabla\n print \"INGRESE UNA ESTRUCTURA \"\n opc = gets.chomp\n limpiar_pantalla()\n \n if opc == '1'\n if array.size!=0\n array_anterior=array.join(',')\n cola.mostrar_paso(array_anterior)\n gets\n else\n puts 'INGRESE DATOS A ORDENAR'\n gets\n end\nelsif opc == '2'\n if array.size!=0\n array_anterior=array.join(',')\n pila.mostrar_pasos(array_anterior)\n gets\n else\n puts 'INGRESE DATOS A ORDENAR'\n gets\n end\nelsif opc == '3'\n if array.size!=0\n array_anterior=array.join(',')\n lista.mostrar_paso(array_anterior)\n gets\n else\n puts 'INGRESE DATOS A ORDENAR'\n gets\n end\n else\n 'OPCION INVALIDA'\n gets\n end\nend while opc!='4'\nelse\n array_anterior=array.join(',')\n pila.ordenar_pila(array)\n cola.ordenar_cola(array)\n lista.ordenar_lista(array)\n ordenamientof[:ordenar]=true\n begin\n limpiar_pantalla\n tabla = Terminal::Table.new do |a|\n a.title= 'ORDEN PASO A PASO'\n a.headings = [{value:'No.', alignment: :center},{value:'ESTRUCTURA', alignment: :center}]\n\n a.add_row([{value:'1', alignment: :center},'COLA' ])\n a.add_row([{value:'2', alignment: :center},'PILA'])\n a.add_row([{value:'3', alignment: :center},'LISTA'])\n a.add_row([{value:'4', alignment: :center},'SALIR' ])\nend\n puts tabla\n print \"INGRESE UNA ESTRUCTURA: \"\n opc = gets.chomp\n limpiar_pantalla()\n \n if opc == '1'\n if array.size!=0\n array_anterior=array.join(',')\n cola.mostrar_paso(array_anterior)\n gets\n else\n puts 'INGRESE DATOS'\n gets\n end\nelsif opc == '2'\n if array.size!=0\n array_anterior=array.join(',')\n pila.mostrar_pasos(array_anterior)\n gets\n else\n puts 'INGRESE DATOS'\n gets\n end\nelsif opc == '3'\n if array.size!=0\n array_anterior=array.join(',')\n lista.mostrar_paso(array_anterior)\n gets\n else\n puts 'INGRESE DATOS'\n gets\n end\n else\n 'OPCION INVALIDA'\n gets\n end\nend while opc!='4'\nend\nend",
"def palabras\n\tend",
"def puede_enrocar?(columna, fila)\n false\n end",
"def contenido_de_la_posicion(posicion)\n @tablero.contenido_de_la_posicion posicion\n end",
"def init_safegenda_file\n text = [TableFormat.create_table(\"ATIVIDADE\", \"HORARIO\")]\n write(text)\n end",
"def initialize(longueur, largeur)\n @longueur = longueur\n @largeur = largeur\n @table = Matrix.build(@longueur, @largeur){|row, col| Case.new(row, col)}\n @sommets = Array.new()\n @aretes = Array.new()\n end",
"def initialize(longueur, largeur)\n @longueur = longueur\n @largeur = largeur\n @table = Matrix.build(@longueur, @largeur){|row, col| Case.new(row, col)}\n @sommets = Array.new()\n @aretes = Array.new()\n end",
"def rebuild(table); end",
"def create_table(table_name)\n # translate into pinyin, then to symbol\n table = trans_pinyin(table_name).to_sym\n DB.create_table table do\n primary_key :id\n String :mid, :unique=>true\n DateTime :created_timestamp\n String :content, :text => true\n String :source\n String :user_id\n String :user_name\n String :user_gender\n Integer :user_status_count\n Integer :user_fansNum\n end\n return table\nend",
"def modelo_carne_build_data_left(doc, boleto, colunas, linhas)\n # LOGOTIPO do BANCO\n doc.image boleto.logotipo, x: (colunas[0] - 0.11), y: linhas[0]\n\n # Dados\n\n # Numero do banco\n doc.moveto x: colunas[1], y: linhas[0]\n doc.show \"#{boleto.banco}-#{boleto.banco_dv}\"\n\n # vencimento\n doc.moveto x: colunas[0], y: linhas[1]\n doc.show boleto.data_vencimento.to_s_br\n\n # agencia/codigo cedente\n doc.moveto x: colunas[0], y: linhas[2]\n doc.show boleto.agencia_conta_boleto\n\n # nosso numero\n doc.moveto x: colunas[0], y: linhas[3]\n doc.show boleto.nosso_numero_boleto\n\n # valor do documento\n doc.moveto x: colunas[0], y: linhas[4]\n doc.show boleto.valor_documento.to_currency\n\n # numero documento\n doc.moveto x: colunas[0], y: linhas[11]\n doc.show boleto.documento_numero\n\n # sacado\n doc.moveto x: colunas[0], y: linhas[13]\n doc.show boleto.sacado.to_s\n end",
"def schema_table_projets\n <<-MYSQL\nCREATE TABLE projets\n (\n # ID\n # --\n # IDentifiant du projet, pas forcément le même que l'ID\n # du programme auquel il est associé.\n id INTEGER AUTO_INCREMENT,\n\n # TITRE\n # ------\n # Titre du projet\n # Il n'est pas obligatoire et, surtout, il n'est pas encore\n # défini à la création du projet. Par défaut, on met \"sans titre\"\n titre VARCHAR(255) DEFAULT 'Sans titre',\n\n # AUTEUR_ID\n # ---------\n # ID de l'auteur du projet\n auteur_id INTEGER NOT NULL,\n\n # PROGRAM_ID\n # ----------\n # ID du programme auquel est associé le projet.\n # C'est une valeur non nulle car un projet ne peut pas\n # être dissocié d'un programme ÉCRIRE UN ROMAN/FILM EN UN AN\n program_id INTEGER NOT NULL,\n\n # RÉSUMÉ\n # ------\n # Le résumé (littéraire) du projet\n resume TEXT,\n\n # SPECS\n # -----\n # Spécificités du projet, comme le fait que ce soit un\n # roman, etc.\n # Chaque bit représente une spécificité. Cf. le fichier\n # ./objet/unan/lib/required/projet/specs.rb pour le détail.\n specs VARCHAR(32),\n\n # CREATED_AT\n # ----------\n # Timestamp de la création du projet\n created_at INTEGER(10),\n\n # UPDATED_AT\n # ----------\n # Timestamp de la modification de cette donnée\n updated_at INTEGER(10),\n\n\n PRIMARY KEY (id)\n );\n MYSQL\nend",
"def casino_table_fields\n [ :title, :city, :county, :state, :district, :owner_type, :comments ]\n end",
"def mostrar_una_venta(venta)\n if venta[:tope] == nil\n puts 'No hay ventas en el sistemas'\n else\n print 'Ingrese el cogido de la venta: '\n codigo = gets.chomp\n nodo_venta = buscar_una_venta_en_cola(venta,codigo)\n if nodo_venta == 'La venta no existe en el sistema'\n puts nodo_venta\n else\n tabla = Terminal::Table.new do |t|\n t.title = 'BUSCAR UNA VENTA'\n t.headings=['codigo','subtotal','descuento','total de venta','libros vendidos']\n t.add_row([\n nodo_venta[:codigo],\n nodo_venta[:subtotal],\n nodo_venta[:descuento],\n nodo_venta[:total_venta],\n nodo_venta[:size]\n ])\nend\n tabla2 = Terminal::Table.new do |a|\n a.title = 'Lista de libros vendidos'\n a.headings = ['Autor', 'Nombre', 'Precio','ISBN']\n\n aux = nodo_venta[:tope]\n loop do\n a.add_row([\n aux[:autor],\n aux[:nombre],\n aux[:precio],\n aux[:ISBN]\n ])\n if aux[:siguiente] == nil\n break\n end\n aux = aux[:siguiente]\n end\n end\n puts tabla\n puts tabla2\n end\nend#fin primer if\ngets\nend",
"def create log_batalha\n\t\tvencedor_username = log_batalha.vencedor.username\n\t\tturnos = log_batalha.turnos\n\t\tid = gerador_de_id\n\t\tjogadores = log_batalha.jogadores\n\n\t\t# Preenche tabela batalhas\n\t\tCONNECTION.exec( \"INSERT INTO batalhas (id,turnos, vencedor) values (#{id}, #{turnos}, '#{vencedor_username}')\" )\n\n\t\t# Preenche tabela batalha_usuario (dependência de id com batalhas)\n\t\tjogadores.each do |usuario|\n\t\t\tusername = usuario.username\n\t\t\tCONNECTION.exec( \"INSERT INTO batalha_usuario (username, batalha_id) values ('#{username}', #{id})\")\n\t\tend\n\tend",
"def initialize(id = nil)\n\t\t@id = id\n\t\t@tabla = Hash.new\n\t\t@tamanio = Hash.new\n\t\t@asignacion = Hash.new\n\t\t@modificable = Hash.new\n\tend",
"def des_cifra_vigenere(llave)\n claro = \"\"\n longitud = @texto.length\n @texto.chomp!\n 0.upto(longitud - 2) do |i|\n j = i % (llave.size)\n alfabeto_ver = corrimiento(llave[j])\n car_cifrado = \"\" << @texto[i]\n posicion = alfabeto_ver.index(car_cifrado)\n b = MINUSCULAS[posicion]\n claro.concat(b)\n end\n @manejador.guardar_archivo(\"#{VIG_DES}\", claro)\n puts claro\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 tabla_params\n params.require(:tabla).permit(:tabla, :padre_id, :padre_class, :archivo, :orden, :archivos, :imagenes)\n end",
"def tnTableCreation(tableName)\n pk_list = @pkList.join(',')\n pk_list = \"#{pk_list},branch_name,node_name\"\n q = QueryBuilder.create_tbl(tableName, pk_list, \"select #{@pkSelect}, 0 as test_id,''::varchar(30) as node_name, ''::varchar(30) as branch_name, ''::varchar(5) as type from #{@fTable} f where 1 = 0\")\n # pp q\n DBConn.exec(q)\n\n # q=\"ALTER TABLE #{tableName} add column test_id int, add column node_name varchar(30), add column branch_name varchar(30), add column type varchar(5);\"\n # DBConn.exec(q)\n # pk=@pkList.join(',')\n # # add index\n # q=\"create index ix_#{tableName}t on #{tableName} (#{pk},branch_name);\"\n # pp q\n # DBConn.exec(q)\n end",
"def rcp_table(row,column); det.table(:id, 'rcpTable')[row][column];end",
"def make_tabula_recta\n letters = @letter_set.dup\n table = []\n letters.length.times do\n table.push letters.dup\n letters.push letters.shift\n end\n indices = {}\n letters = letters.each_with_index { |letter, i| indices[letter] = i }\n [table, indices]\n end",
"def show_create_table(db, table)\n end",
"def setTable(x)\r\n @pila_t.pop\r\n @pila_t.push x\r\n end",
"def modelo_carne_build_data_right(doc, boleto, colunas, linhas)\n # LOGOTIPO do BANCO\n doc.image boleto.logotipo, x: (colunas[2] - 0.11), y: linhas[0]\n\n # Numero do banco\n doc.moveto x: colunas[4], y: linhas[0]\n doc.show \"#{boleto.banco}-#{boleto.banco_dv}\", tag: :grande\n\n # linha digitavel\n doc.moveto x: colunas[6], y: linhas[0]\n doc.show boleto.codigo_barras.linha_digitavel, tag: :media\n\n # local de pagamento\n doc.moveto x: colunas[2], y: linhas[1]\n doc.show boleto.local_pagamento\n\n # vencimento\n doc.moveto x: colunas[11], y: linhas[1]\n doc.show boleto.data_vencimento.to_s_br\n\n # cedente\n doc.moveto x: colunas[2], y: linhas[2]\n doc.show boleto.cedente\n\n # agencia/codigo cedente\n doc.moveto x: colunas[11], y: linhas[2]\n doc.show boleto.agencia_conta_boleto\n\n # data do documento\n doc.moveto x: colunas[2], y: linhas[3]\n doc.show boleto.data_documento.to_s_br if boleto.data_documento\n\n # numero documento\n doc.moveto x: colunas[3], y: linhas[3]\n doc.show boleto.documento_numero\n\n # especie doc.\n doc.moveto x: colunas[8], y: linhas[3]\n doc.show boleto.especie_documento\n\n # aceite\n doc.moveto x: colunas[9], y: linhas[3]\n doc.show boleto.aceite\n\n # dt processamento\n doc.moveto x: colunas[10], y: linhas[3]\n doc.show boleto.data_processamento.to_s_br if boleto.data_processamento\n\n # nosso numero\n doc.moveto x: colunas[11], y: linhas[3]\n doc.show boleto.nosso_numero_boleto\n\n # uso do banco\n ## nada...\n\n # carteira\n doc.moveto x: colunas[3], y: linhas[4]\n doc.show boleto.carteira\n\n # especie\n doc.moveto x: colunas[5], y: linhas[4]\n doc.show boleto.especie\n\n # quantidade\n doc.moveto x: colunas[7], y: linhas[4]\n doc.show boleto.quantidade\n\n # valor documento\n doc.moveto x: colunas[8], y: linhas[4]\n doc.show boleto.valor_documento.to_currency\n\n # valor do documento\n doc.moveto x: colunas[11], y: linhas[4]\n doc.show boleto.valor_documento.to_currency\n\n # Instruções\n doc.moveto x: colunas[2], y: linhas[5]\n doc.show boleto.instrucao1\n doc.moveto x: colunas[2], y: linhas[6]\n doc.show boleto.instrucao2\n doc.moveto x: colunas[2], y: linhas[7]\n doc.show boleto.instrucao3\n doc.moveto x: colunas[2], y: linhas[8]\n doc.show boleto.instrucao4\n doc.moveto x: colunas[2], y: linhas[9]\n doc.show boleto.instrucao5\n doc.moveto x: colunas[2], y: linhas[10]\n doc.show boleto.instrucao6\n\n # Sacado\n doc.moveto x: colunas[2], y: linhas[11]\n if boleto.sacado && boleto.sacado_documento\n doc.show \"#{boleto.sacado} - #{boleto.sacado_documento.formata_documento}\"\n end\n\n # Sacado endereço\n doc.moveto x: colunas[2], y: linhas[12]\n doc.show boleto.sacado_endereco.to_s\n\n # codigo de barras\n # Gerando codigo de barra com rghost_barcode\n if boleto.codigo_barras\n doc.barcode_interleaved2of5(boleto.codigo_barras, width: '10.3 cm', height: '1.2 cm', x: colunas[2],\n y: linhas[14])\n end\n end",
"def initialize(color, columna, fila, tablero)\n @se_movio = false\n @color = color\n @columna = columna\n @fila = fila\n @tablero = tablero\n @tablero[@columna][@fila] = self\n end",
"def palabras\n end",
"def initialize key , valor, linea, columna\n @key = key \n @valor = valor\n @linea = linea\n @columna = columna\n end",
"def criaParcela(dataVenda, numeroParcela)\n\n novaParcela = Vendaplano.new(vendaplano_params)\n novaParcela.dt_baixa = nil\n novaParcela.recebido_por = nil\n novaParcela.dt_pagto = dataVenda >> numeroParcela\n\n return novaParcela\n end",
"def addTableEntries( symTab )\r\n\t\t@tablaSimbolos.clearItems\r\n\t\t@tablaSimbolos.rowHeaderMode = LAYOUT_FIX_WIDTH\r\n\t\t@tablaSimbolos.rowHeaderWidth = 0\r\n\t\t@tablaSimbolos.setTableSize(0, 5)\r\n\t\t@tablaSimbolos.font = @defaultFont\r\n\t\t@tablaSimbolos.tableStyle |= TABLE_COL_SIZABLE\r\n\t\t@tablaSimbolos.setColumnText(0, \"Nombre Variable\")\r\n\t\t@tablaSimbolos.setColumnText(1, \"Localidad\")\r\n\t\t@tablaSimbolos.setColumnText(2, \"No. de línea\")\r\n\t\t@tablaSimbolos.setColumnText(3, \"Valor\")\r\n\t\t@tablaSimbolos.setColumnText(4, \"Tipo\")\r\n\t\t@tablaSimbolos.columnHeader.setItemJustify(0, FXHeaderItem::CENTER_X)\r\n\t\t@tablaSimbolos.columnHeader.setItemJustify(1, FXHeaderItem::CENTER_X)\r\n\t\t@tablaSimbolos.columnHeader.setItemJustify(2, FXHeaderItem::CENTER_X)\r\n\t\t@tablaSimbolos.columnHeader.setItemJustify(3, FXHeaderItem::CENTER_X)\r\n\t\t@tablaSimbolos.columnHeader.setItemJustify(4, FXHeaderItem::CENTER_X)\r\n\t\t@tablaSimbolos.setColumnWidth( 0, 300)\r\n\t\t@tablaSimbolos.setColumnWidth( 1, 300)\r\n\t\t@tablaSimbolos.setColumnWidth( 2, 230)\r\n\t\t@tablaSimbolos.setColumnWidth( 3, 219)\r\n\t\t@tablaSimbolos.setColumnWidth( 4, 300)\r\n\t\t@NUM_FILAS = 0\r\n\t\tsymTab.each{ |llave, entrada|\r\n\t\t\t@tablaSimbolos.appendRows(1)\r\n\t\t\t@tablaSimbolos.setItemText(@NUM_FILAS, 0, symTab[llave].nombre)\r\n\t\t\t@tablaSimbolos.setItemText(@NUM_FILAS, 1, symTab[llave].direccionMem.to_s)\r\n\t\t\t@tablaSimbolos.setItemText(@NUM_FILAS, 2, symTab[llave].numsLinea)\r\n\t\t\t@tablaSimbolos.setItemText(@NUM_FILAS, 3, symTab[llave].valor.to_s)\r\n\t\t\t@tablaSimbolos.setItemText(@NUM_FILAS, 4, symTab[llave].tipo)\r\n\t\t\t@tablaSimbolos.setItemJustify(@NUM_FILAS, 0, FXTableItem::CENTER_X)\r\n\t\t\t@tablaSimbolos.setItemJustify(@NUM_FILAS, 1, FXTableItem::CENTER_X)\r\n\t\t\t@tablaSimbolos.setItemJustify(@NUM_FILAS, 2, FXTableItem::CENTER_X)\r\n\t\t\t@tablaSimbolos.setItemJustify(@NUM_FILAS, 3, FXTableItem::CENTER_X)\r\n\t\t\t@tablaSimbolos.setItemJustify(@NUM_FILAS, 4, FXTableItem::CENTER_X)\r\n\t\t\t@NUM_FILAS += 1\r\n\t\t}\r\n\tend",
"def tabla(reporte_marca)\n data = datos(reporte_marca)\n table( [ encabezado ] + data, :header => true) do\n row(0).style( :background_color => 'cccccc', :style => :bold, :align => :center, :valign => :center)\n cells.style(:size => 8, :inline_format => true)\n column(0..5).style(:width => 80)\n column(0).style(:width => 120)\n column(5).style(:width => 250)\n column(5).style(:width => 100)\n end\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 hacer_tablero\n tablero_vacio = Array.new(8) { Array.new(8)}\n piezas = [\"torre\",\"caballo\",\"alfil\",\"reyna\",\"rey\", \"alfil\", \"caballo\",\"torre\", \"peon\"]\n color = [\"blanco\", \"negro\"]\n for i in 0..7\n for j in 0..7\n if i == 0 \n tablero_vacio[i][j] = piezas[j] + \"-\" + color[0]\n printf \"%-16s\",tablero_vacio[i][j]\n puts if j == 7 \n elsif i == 1\n tablero_vacio[i][j] = piezas[-1] + \"-\" + color[0]\n printf \"%-16s\",tablero_vacio[i][j]\n puts if j == 7 \n elsif i % 2 == 0 && i < 6\n if j % 2 == 0\n tablero_vacio[i][j] = color[0]\n else\n tablero_vacio[i][j] = color[1]\n end\n printf \"%-16s\",tablero_vacio[i][j]\n puts if j == 7 \n elsif i % 2 != 0 && i < 6\n if j % 2 == 0\n tablero_vacio[i][j] = color[1]\n else\n tablero_vacio[i][j] = color[0]\n end\n printf \"%-16s\",tablero_vacio[i][j]\n puts if j == 7 \n elsif i == 6\n tablero_vacio[i][j] = piezas[-1] + \"-\" + color[1]\n printf \"%-16s\",tablero_vacio[i][j]\n puts if j == 7 \n else\n tablero_vacio[i][j] = piezas[j] + \"-\" + color[1]\n printf \"%-16s\",tablero_vacio[i][j]\n puts if j == 7 \n end\n end\n end\n \nend",
"def m_tabla_fields(objeto)\n\t\tobjeto.class::TABLA_FIELDS\n\tend",
"def init_table(layer, stat) # returns self\n tbl = Table.new(layer, stat)\n if stat[:data_ver].to_i > 0\n ___create_tbl(tbl)\n ___real_mode(stat, tbl)\n else\n ___dummy_mode(stat, tbl)\n end\n self\n end",
"def migrate\n db.create_table? table_name do\n primary_key :id\n String :ptype\n String :v0\n String :v1\n String :v2\n String :v3\n String :v4\n String :v5\n end\n end",
"def informacoes_da_conta(local)\n\t\t\t\t\traise NotImplementedError.new('Sobreescreva este método na classe referente ao banco que você esta criando')\n\t\t\t\tend",
"def monta_header_lote(nro_lote)\n raise Brcobranca::NaoImplementado, 'Sobreescreva este método na classe referente ao banco que você esta criando'\n end",
"def palavraSecreta(info = @info)\n\n sorteio = info[rand(info.size)]\n @plvSorteada = sorteio['Palavra'].upcase\n @plvDica = sorteio['Dica']\n @plvAjudas = sorteio['Ajuda']\n @plvSecreta = @plvSorteada.chars\n @qtdLetras = @plvSorteada.size\n end",
"def tablero_params\n params.require(:tablero).permit(:nombre, :descripcion, :horainicio, :horafin, :puntos, :abierto, :e1, :e2, :e3, :cronometro)\n \n end",
"def print_tabla(indentacion)\n\t\ts = \"\"\n\t\tif @tabla.empty?\n\t\t\ts += \"#{indentacion}none \\n\"\n\t\telse\n\t\t\t@tabla.each do | clave, token, tipo |\n\t\t\t\ts += \"#{indentacion}#{clave}: #{token[:tipo]} \\n\"\n\t\t\tend\n\t\tend\n\t\tprint s\n\tend",
"def setear_fijos_arbol\n # @incisos = Inciso.all\n # @partidas_principales = PartidaPrincipal.all\n # @partidas_parciales = PartidaParcial.all \n @clases = Clase.where(\"fecha_de_baja IS NULL\")\n @bienes_de_consumo = BienDeConsumo.where(\"fecha_de_baja IS NULL\")\n end",
"def ligar #iniciando o método ligar\n puts 'O carro está ligado...' #imprime na tela a ação do método\n end",
"def initialize(cliente_ruc_o_cedula, tarifa_servicio)\n\n super()\n unless cliente_ruc_o_cedula.blank?\n if cliente_ruc_o_cedula.include?\"RUC\"\n @t_cliente = TEmpresa.find_by_rif(cliente_ruc_o_cedula).t_cliente\n else\n @t_cliente = TPersona.find_by_cedula(cliente_ruc_o_cedula).t_cliente\n end\n end\n @tarifa_servicio = TTarifaServicio.find_by_codigo(tarifa_servicio) unless tarifa_servicio.blank?\n @cliente_ruc_o_cedula = cliente_ruc_o_cedula\n @tarifa_servicio = tarifa_servicio\n @i = 1\n # @t_recibo = t_recibo\n # @t_factura = t_factura\n # @t_resolucion = @t_factura.t_resolucion\n # @t_cliente = t_cliente\n # @t_empresa = @t_cliente.persona.try(:rif) ? @t_cliente.persona : nil\n # @t_persona = @t_cliente.persona.try(:cedula) ? @t_cliente.persona : nil\n # @t_otro = @t_cliente.persona.try(:identificacion) ? @t_cliente.persona : nil\n @meses = [1 => \"Enero\", 2 => \"Febrero\", 3 => \"Marzo\", 4 => \"Abril\", 5 => \"Mayo\", 6 => \"Junio\", 7 => \"Julio\", 8 => \"Agosto\", 9 => \"Septiembre\", 10 => \"Octubre\", 11 => \"Noviembre\", 12 => \"Diciembre\"]\n font_size 10\n document_content\n end",
"def rebuild_table\n @database.execute(\"SELECT ZICCLOUDSYNCINGOBJECT.ZMERGEABLEDATA1 \" +\n \"FROM ZICCLOUDSYNCINGOBJECT \" +\n \"WHERE ZICCLOUDSYNCINGOBJECT.ZIDENTIFIER=?\",\n @uuid) do |row|\n\n # Extract the blob\n gzipped_data = row[\"ZMERGEABLEDATA1\"]\n zlib_inflater = Zlib::Inflate.new(Zlib::MAX_WBITS + 16)\n gunzipped_data = zlib_inflater.inflate(gzipped_data)\n\n # Read the protobuff\n mergabledata_proto = MergableDataProto.decode(gunzipped_data)\n\n # Build list of key items\n @key_items = Array.new\n mergabledata_proto.mergable_data_object.mergeable_data_object_data.mergeable_data_object_key_item.each do |key_item|\n @key_items.push(key_item)\n end\n\n # Build list of type items\n @type_items = Array.new\n mergabledata_proto.mergable_data_object.mergeable_data_object_data.mergeable_data_object_type_item.each do |type_item|\n @type_items.push(type_item)\n end\n\n # Build list of uuid items\n @uuid_items = Array.new\n mergabledata_proto.mergable_data_object.mergeable_data_object_data.mergeable_data_object_uuid_item.each do |uuid_item|\n @uuid_items.push(uuid_item)\n end\n\n # Build Array of objects\n @table_objects = Array.new\n mergabledata_proto.mergable_data_object.mergeable_data_object_data.mergeable_data_object_entry.each do |mergeable_data_object_entry|\n @table_objects.push(mergeable_data_object_entry)\n\n # Best way I've found to set the table direction\n if mergeable_data_object_entry.custom_map\n if mergeable_data_object_entry.custom_map.map_entry.first.key == @key_items.index(\"crTableColumnDirection\") + 1 #Oddly seems to correspond to 'self'\n @table_direction = mergeable_data_object_entry.custom_map.map_entry.first.value.string_value\n end\n end\n end\n\n # Find the first ICTable, which shuld be the root, and execute\n mergabledata_proto.mergable_data_object.mergeable_data_object_data.mergeable_data_object_entry.each do |mergeable_data_object_entry|\n if mergeable_data_object_entry.custom_map and @type_items[mergeable_data_object_entry.custom_map.type] == \"com.apple.notes.ICTable\"\n parse_table(mergeable_data_object_entry)\n end\n end\n end\n end",
"def generar_llave\n cadena = [('a'..'z'), ('A'..'Z')].map { |i| i.to_a }.flatten\n llave = (0...6).map{ cadena[rand(cadena.length)] }.join\n llave\n end",
"def new_table(name, field_defs, encrypt, record_class)\r\n # Header rec consists of last record no. used, delete count, and\r\n # all field names/types. Here, I am inserting the 'recno' field\r\n # at the beginning of the fields.\r\n header_rec = ['000000', '000000', record_class, 'recno:Integer',\r\n field_defs].join('|')\r\n\r\n header_rec = 'Z' + encrypt_str(header_rec) if encrypt\r\n\r\n begin\r\n fptr = open(File.join(@db.path, name.to_s + @db.ext), 'w')\r\n fptr.write(header_rec + \"\\n\")\r\n ensure\r\n fptr.close\r\n end\r\n end",
"def load_table_heading(conn, builder, table)\n primary_key_columns = []\n builder.heading{\n columns = conn.schema(table, {:reload => true})\n columns.each do |name, info|\n #puts info.inspect\n \n # find attribute definition\n defn = {:domain => dbtype_to_ruby_type(info),\n :mandatory => !info[:allow_null] }\n unless info[:ruby_default].nil?\n defn[:default] = info[:ruby_default]\n end\n \n # mark primary key columns\n if primary_key_columns and info[:primary_key]\n primary_key_columns << name \n end\n \n # build the attribute\n builder.attribute(name, defn)\n end\n }\n primary_key_columns\n end",
"def ordenar_todos_los_datos(pila,array=[],cola,lista,ordenamientof)\n if ordenamientof[:ordenar]\n array_anterior=array.join(',')\n array_rendi = rendimientof(pila,cola,lista)\n tabla = Terminal::Table.new do |a|\n a.title= \"ORDENAR TODO #{array_anterior} \"\n a.headings = [{value:'PASOS', alignment: :center},{value:'ESTRUCTURA', alignment: :center},{value:'% RENDIMIENTO', alignment: :center},{value:'Ordenada', alignment: :center}]\n a.add_row([pila.pasos_pila(),{value:'PILA', alignment: :center},{value:array_rendi[0], alignment: :center},pila.mostrar_pila()])\n a.add_row([cola.pasos_cola(),{value:'COLA', alignment: :center},{value:array_rendi[1], alignment: :center},cola.mostrar_cola()])\n a.add_row([lista.pasos_lista(),{value:'KISTA', alignment: :center},{value:array_rendi[2], alignment: :center},lista.mostrar_lista()])\n end\n puts tabla\n gets\nelse\n array_anterior=array.join(',')\n pila.ordenar_pila(array)\n cola.ordenar_cola(array)\n lista.ordenar_lista(array)\n array_rendi = rendimientof(pila,cola,lista)\n tabla = Terminal::Table.new do |a|\n a.title= \"ORDENAR TODO #{array_anterior} \"\n a.headings = [{value:'N. PASOS', alignment: :center},{value:'ESTRUCTURA', alignment: :center},{value:'% RENDIMIENTO', alignment: :center},{value:'Ordenada', alignment: :center}]\n a.add_row([pila.pasos_pila(),{value:'PILA', alignment: :center},{value:array_rendi[0], alignment: :center},pila.mostrar_pila()])\n a.add_row([cola.pasos_cola(),{value:'COLA', alignment: :center},{value:array_rendi[1], alignment: :center},cola.mostrar_cola()])\n a.add_row([lista.pasos_lista(),{value:'LISTA', alignment: :center},{value:array_rendi[2], alignment: :center},lista.mostrar_lista()])\n end\n puts tabla\n ordenamientof[:ordenar]=true\n gets\nend\nend",
"def initialize(ciclos, lupula, cebada, mezcla, levadura)\n\n @ciclos = ciclos\n @almacen = Almacen.new(lupula,cebada,mezcla,levadura)\n @silosCebada = Silos_Cebada.new\n @molino = Molino.new\n @pailaMezcla = Paila_Mezcla.new\n @cuba = Cuba_Filtracion.new\n @pailaCoccion = Paila_Coccion.new\n @tanquePreclarif = Tanque_Preclarificador.new \n @enfriador = Enfriador.new\n @tcc = TCC.new\n @filtroCerveza = Filtro_Cerveza.new\n @tanqueFiltroCerveza = Tanque_Cerveza.new\n @llenadora = Llenadora.new\n\n end",
"def suivre; end",
"def align_global(protein)\n # Vytvoreni tabulky\n x = protein.sequence.size\n y = @genome.sequence.size\n tab = Array.new(x+1) { Array.new(y+1) }\n\n # Vyplnime prvni radek a sloupec\n for i in 0..x\n tab[i][0] = @@d * i\n end\n for j in 0..y\n tab[0][j] = @@d * j\n end\n\n for i in 1..x\n for j in 1..y\n match = tab[i-1][j-1] + match(i, j, protein)\n delete = tab[i-1][j] + @@d\n insert = tab[i][j-1] + @@d\n\n tab[i][j] = [match, delete, insert].max\n end\n end\n\n @table = tab\n value = tab[x][y]\n EvaluatedProtein.new(protein, value)\n end",
"def set_precio_boleto\n\t@precio_boleto = PrecioBoleto.find(params[:id])\n\tend",
"def create_tables\n self.conn.exec(\n File.read(\"./lib/creating_tables.txt\")\n \n )\n end",
"def lov_params\n params.require(:lov).permit(:tbl, :col, :val)\n end",
"def ordenar_todos_los_datos(pila,array=[],cola,lista,ya_ordeno)\n if ya_ordeno[:ordenar]\n array_antes=array.join(',')\n tabla = Terminal::Table.new do |a|\n a.title= \"Ordenar todos los datos: #{array_antes} \"\n a.headings = [{value:'Estructura', alignment: :center},{value:'Ordenada', alignment: :center}]\n a.add_row([{value:'pila', alignment: :center},pila.mostrar_pila()])\n a.add_row([{value:'cola', alignment: :center},cola.mostrar_cola()])\n a.add_row([{value:'lista', alignment: :center},lista.mostrar_lista()])\n end\n puts tabla\n gets\nelse\n array_antes=array.join(',')\n pila.ordenar_pila(array)\n cola.ordenar_cola(array)\n lista.ordenar_lista(array)\n tabla = Terminal::Table.new do |a|\n a.title= \"Ordenar todos los datos: #{array_antes} \"\n a.headings = [{value:'Estructura', alignment: :center},{value:'Ordenada', alignment: :center}]\n a.add_row([{value:'pila', alignment: :center},pila.mostrar_pila()])\n a.add_row([{value:'cola', alignment: :center},cola.mostrar_cola()])\n a.add_row([{value:'lista', alignment: :center},lista.mostrar_lista()])\n end\n puts tabla\n ya_ordeno[:ordenar]=true\n gets\nend\nend",
"def table\n end",
"def hash\n [id_conta, id_pessoa, id_cartao, id_bandeira, id_tipo_cartao, numero_cartao, nome_plastico, cvv2, data_geracao, data_validade, cpf, tipo_portador, trilha1, trilha2, trilha_cvv1, trilha_cvv2, flag_virtual, nome_bandeira, flag_titular, sequencial_cartao, id_status, descricao_status_cartao, data_status, id_estagio, descricao_estagio, data_estagio, numero_bin, id_produto, descricao_produto, id_status_conta, descricao_status_conta, data_embossing, codigo_desbloqueio, nome_pessoa, tipo_pessoa, data_nascimento, id_endereco, id_tipo_endereco, descricao_tipo_endereco, cep, logradouro, numero_endereco, complemento_endereco, bairro, cidade, uf, pais, senha_criptografada, icvv, id_status_impressao].hash\n end",
"def print_board\n @tablero.row_vectors().each_with_index { |row, i|\n print \"#{row.component(i)}\\n\"\n }\n #Imprime los numeros de las columnas\n (1..@tablero.row_vectors.size).each { |n|\n print \" #{n} \"\n }\n puts\n #Imprime las letras de las filas\n letras = (\"A\"..\"Z\").to_a\n (0...@tablero.row_vectors.size).each do |i|\n print \"#{letras[i]} \"\n @tablero.row_vectors()[i].each do |fila|\n print \" #{fila} | \"\n end\n puts\n print \" ----\" * @tablero.row_count\n puts\n end\n end",
"def initialize(table = Table.new([4, 4]))\n @table = table\n end",
"def create_table\n puts \"Creating table >> PEOPLE\"\n $db.execute %q{\n CREATE TABLE people(\n id integer primary key,\n name varchar(50),\n job varchar(50),\n gender varchar(6),\n age integer\n )\n }\nend",
"def ordenar_todos_los_datos(pila,array=[],cola,lista,ya_ordeno)\n if ya_ordeno[:ordenar]\n array_antes=array.join(',')\n array_rendi = obtener_rendimiento(pila,cola,lista)#obtener array con el rendimiento\n tabla = Terminal::Table.new do |a|\n a.title= \"Ordenar todos los datos: #{array_antes} \"\n a.headings = [{value:'Pasos', alignment: :center},{value:'Estructura', alignment: :center},{value:'Rendimiento %', alignment: :center},{value:'Ordenada', alignment: :center}]\n a.add_row([pila.pasos_pila(),{value:'pila', alignment: :center},{value:array_rendi[0], alignment: :center},pila.mostrar_pila()])\n a.add_row([cola.pasos_cola(),{value:'cola', alignment: :center},{value:array_rendi[1], alignment: :center},cola.mostrar_cola()])\n a.add_row([lista.pasos_lista(),{value:'lista', alignment: :center},{value:array_rendi[2], alignment: :center},lista.mostrar_lista()])\n end\n puts tabla\n gets\nelse\n array_antes=array.join(',')\n pila.ordenar_pila(array)\n cola.ordenar_cola(array)\n lista.ordenar_lista(array)\n array_rendi = obtener_rendimiento(pila,cola,lista)#obtener array con el rendimiento\n tabla = Terminal::Table.new do |a|\n a.title= \"Ordenar todos los datos: #{array_antes} \"\n a.headings = [{value:'Pasos', alignment: :center},{value:'Estructura', alignment: :center},{value:'Rendimiento %', alignment: :center},{value:'Ordenada', alignment: :center}]\n a.add_row([pila.pasos_pila(),{value:'pila', alignment: :center},{value:array_rendi[0], alignment: :center},pila.mostrar_pila()])\n a.add_row([cola.pasos_cola(),{value:'cola', alignment: :center},{value:array_rendi[1], alignment: :center},cola.mostrar_cola()])\n a.add_row([lista.pasos_lista(),{value:'lista', alignment: :center},{value:array_rendi[2], alignment: :center},lista.mostrar_lista()])\n end\n puts tabla\n ya_ordeno[:ordenar]=true\n gets\nend\nend",
"def vieditable_init_tabular\n $log.debug \" inside vieditable_init tabular\"\n @editable = true\n #bind_key( ?C, :edit_line)\n #bind_key( ?o, :insert_line)\n #bind_key( ?O) { insert_line(@current_index-1) } \n #bind_key( ?o) { insert_line(@current_index+1) } \n #bind_key( ?O) { insert_line(@current_index) } \n bind_key( [?d, ?d] , :delete_line ) \n #bind_key( ?\\C-_ ) { @undo_handler.undo if @undo_handler }\n #bind_key( ?u ) { @undo_handler.undo if @undo_handler }\n #bind_key( ?\\C-r ) { @undo_handler.redo if @undo_handler }\n bind_key( [?y, ?y] , :kill_ring_save ) \n bind_key( ?p, :yank ) # paste after this line\n bind_key( ?P ) { yank(@current_index - 1) } # should be before this line\n bind_key(?\\M-y, :yank_pop)\n bind_key(?\\M-w, :kill_ring_save)\n @_events.push :CHANGE # thru vieditable\n end",
"def versao_layout_lote\n raise Brcobranca::NaoImplementado, 'Sobreescreva este método na classe referente ao banco que você esta criando'\n end",
"def verdi; end",
"def set_clafe\n @clafe = Clave.find(params[:id])\n end",
"def pedir_jugada(tablero)\r\n\tbandera=0#esta bandera sirve para contar el numero de jugadas que se llevan\r\n\tbandera_ganador=false#y esta para saber si hay o no un ganador aun\r\n\twhile bandera<9 or bandera_ganador==false#inicio un while donde pongo dos condicionantes para que se repita\r\n\t\tcontadorX=2#este contador sirve para que en caso de que X se equivoque en las cordenadas pueda volver a ingresarlas \r\n\t\twhile contadorX!=1#aplico el contador anterior con este while\r\n\t\t\tputs \"Jugador X, dame tu jugada, empezando por la fila: \"#pido las coordenadas\r\n\t\t\tfilaX=validar\r\n\t\t\tputs \"Ahora dame en la columna: \"\r\n columnaX=validar\r\n jugadorX=\"X\"#doy el valor de jugador X\r\n\t\t\tif filaX>=0 and filaX<=2 and columnaX>=0 and columnaX<=2#este if sirve para verificar que las cordenadas esten dentro del limite que se esta dando\r\n\t\t\t\tif tablero[filaX][columnaX]==\"-\"#para saber si hay una linea dentro de las cordenadas dadas anteriormente\r\n tablero[filaX][columnaX]=jugadorX;#si hay una linea añado en las cordenas el valor de jugador X\r\n mostrar_tablero(tablero);#muestro el tablero\r\n contadorX=1;#aumento mi contador para que se rompa el segundo while\r\n\t\t\t\telse\r\n\t\t\t\t\tputs \"Esta casilla esta ocupada, vuelve a ingresar las cordenadas\"#si no se cumple el if anterior manda este mensaje de error\r\n\t\t\t\t\tcontadorX=2#para que se vuelva a repetir el while de X\r\n\t\t\t\tend\r\n\t\t\telse#en caso de que las cordenadas no esten dentro del rango manda el siguiente mensaje de errro\r\n\t\t\t\tputs \"Opciones invalidas, por favor ingresa valores del 0-2\"#mensaje de error\r\n\t\t\t\tcontadorX=2#contador para que se repita el while de X\r\n\t\t\tend \r\n\t\tend\r\n\t\tbandera=bandera+1#si se cumplio exitosamente el while anteriro, ya se hizo una jugada, asi que el contador de las jugadas aumenta en 1\r\n bandera_ganador=mostrar_ganador(tablero)#verifico si hay o no ganador\r\n puts \"\\n Numero de pocisiones ocupadas: \", bandera#muestro las pocisiones ocupadas hasta el momento\r\n\t\tif bandera_ganador==true#si ya hay un gandor rompo el programa con el break\r\n\t\t\tbreak\r\n\t\telse#de lo contrario continua el ciclo\r\n\t\t\tif bandera==9#ahora, si el contador de las jugadas llega a 9 digo que no hay ganador y rompo el programa\r\n\t\t\t\tputs \"Juego terminado, no hay ganador\"\r\n\t\t\t\tbreak\r\n\t\t\tend\r\n\t\t\t#si no se cumple el if anterior pasa a las siguientes lineas de codigo donde se realiza exatamente lo mismo que lo que se hizo con el jugador X, pero cambiando algunos valores por O\r\n\t\t\tcontadorO=2\r\n\t\t\twhile contadorO!=1\r\n\t\t\t\tputs\"Jugador 0, dame tu jugada, empezando por la fila: \"\r\n\t\t\t\tfilaO=validar\r\n\t\t\t\tputs \"Ahora dame en la columna: \"\r\n columnaO=validar\r\n jugadorO=\"O\"\r\n\t\t\t\tif filaO>=0 and filaO<=2 and columnaO>=0 and columnaO<=2\r\n\t\t\t\t\tif tablero[filaO][columnaO]==\"-\"\r\n tablero[filaO][columnaO]=jugadorO\r\n mostrar_tablero(tablero)\r\n contadorO=1\r\n else\r\n puts \"Esta ocupada la casilla que solicitas, vuelve a ingresar las cordenadas\"\r\n contadorO=2\r\n\t\t\t\t\tend\r\n\t\t\t\telse\r\n\t\t\t\t\tputs \"Numeros invalidos, porfavor, vuelva a ingresar las cordenadas\"\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\tbandera=bandera+1#como se hizo una jugada aumenta el contador de las jugadas\r\n bandera_ganador=mostrar_ganador(tablero)#verifico si hay o no ganador\r\n puts \"\\n Numero de pocisiones ocupadas: \", bandera#muestro las pocisiones ocupadas\r\n\t\t\tnext#este es el equivalente a continue en python, es para que se vuelva a \"repetir\" el ciclo principla\r\n\t\tend\r\n\t\tbreak#rompo mi programa\r\n\tend\r\nend",
"def initialize(a,b,c,arbol,tabla)\r\n unless (arbol.is_a?(AST)) then raise ArgumentError, \"El valor del valor del arbol de un procedimiento debe ser un AST.\" end\r\n unless (tabla.is_a?(SymTable)) then raise ArgumentError, \"El valor del valor de la tabla de un procedimiento debe ser un SymTable.\" end\r\n @arbol = arbol\r\n @tabla = tabla\r\n @pila_a = []\r\n @pila_t = []\r\n super(a,b,c)\r\n end",
"def ligar #Metodo/função da classe Carro\n puts 'O carro está pronto para iniciar o trajeto.'\n end",
"def create\n @palabras_clafe = PalabrasClave.new(params[:palabras_clafe])\n\n respond_to do |format|\n if @palabras_clafe.save\n format.html { redirect_to @palabras_clafe, notice: 'Palabras clave was successfully created.' }\n format.json { render json: @palabras_clafe, status: :created, location: @palabras_clafe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @palabras_clafe.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.61291707",
"0.5964928",
"0.58517224",
"0.569821",
"0.559974",
"0.55498147",
"0.55345196",
"0.55345196",
"0.55345196",
"0.55345196",
"0.54677457",
"0.54645467",
"0.5439441",
"0.5423002",
"0.540165",
"0.53390056",
"0.5324846",
"0.531647",
"0.52941746",
"0.52847576",
"0.52779716",
"0.5275207",
"0.5272833",
"0.52682173",
"0.5253741",
"0.52503633",
"0.5250119",
"0.5248007",
"0.52287865",
"0.5215802",
"0.5215802",
"0.5211893",
"0.5208899",
"0.5207633",
"0.5193174",
"0.5190446",
"0.51866114",
"0.51859975",
"0.5183547",
"0.5165725",
"0.51583236",
"0.51569164",
"0.5152746",
"0.51430964",
"0.5137183",
"0.5131192",
"0.51254225",
"0.5124367",
"0.5118514",
"0.5117083",
"0.5112499",
"0.5108869",
"0.5094278",
"0.50813574",
"0.50742346",
"0.5073632",
"0.5060137",
"0.50486976",
"0.50481826",
"0.50267965",
"0.5023477",
"0.5021596",
"0.5015782",
"0.50132716",
"0.50112724",
"0.50083226",
"0.5003261",
"0.49939117",
"0.49936593",
"0.49921137",
"0.49862468",
"0.49814665",
"0.49789196",
"0.49653372",
"0.49646473",
"0.4964621",
"0.49616882",
"0.496103",
"0.4952031",
"0.49471003",
"0.49408945",
"0.49394473",
"0.4935719",
"0.49353188",
"0.4932706",
"0.49293694",
"0.49233767",
"0.4921533",
"0.4921135",
"0.49178204",
"0.49090457",
"0.49059924",
"0.49049062",
"0.49039572",
"0.49019158",
"0.48949412",
"0.48922774",
"0.48904708",
"0.4889833",
"0.48772347"
] |
0.6340806
|
0
|
List all unsubscribes for the domain
|
def list(options={})
Mailgun.submit(:get, unsubscribe_url, options)["items"]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def all\n get(\"#{domain}/unsubscribes\")\n end",
"def unsubscribed\n end",
"def unsubscribed\n end",
"def unsubscribed\n\tend",
"def unsubscribed; end",
"def unsubscribed\n @attributes[:unsubscribed]\n end",
"def unsubscribe_all\n send_action('unsubscribe_all')\n end",
"def unsubscribed # :doc:\n # Override in subclasses\n end",
"def unsubscribes(date, page=1, page_size=1000, order_field=\"date\", order_direction=\"asc\")\n options = { :query => { \n :date => date,\n :page => page,\n :pagesize => page_size,\n :orderfield => order_field,\n :orderdirection => order_direction } }\n response = get \"unsubscribes\", options\n Hashie::Mash.new(response)\n end",
"def unsubscribe_all(domain, jid)\n jid = JID.new(jid)\n redis.smembers(\"pubsub:#{domain}:subscriptions_#{jid}\") do |nodes|\n nodes.each do |node|\n unsubscribe(domain, node, jid)\n end\n end\n end",
"def get_unsubscribers(opts = {})\n data, _status_code, _headers = get_unsubscribers_with_http_info(opts)\n data\n end",
"def unsubscribe_from_all(id_or_email)\n make_json_api_request :post, \"v2/#{account_id}/subscribers/#{CGI.escape id_or_email}/unsubscribe_all\"\n end",
"def find(address)\n get(\"#{domain}/unsubscribes/#{address}\")\n end",
"def unsubscribed\n stop_all_streams\n end",
"def unsubscribes(options={})\n Resources::Unsubscribes.new(self, options)\n end",
"def unsubscrible\n NewsletterMailer.unsubscrible\n end",
"def unsubscribe_all_pubsub(domain, jid)\n @pubsub.unsubscribe_all(domain, jid)\n end",
"def unsubscribe_all\n # Get an array of all the email addresses accociated with this devise class.\n emails = all.map(&:email).select {|e| Devise::Models::Campaignable.valid_campaign_email? e}\n\n # Ask the list managed to subscibe all of these emails.\n list_manager.batch_unsubscribe(emails) \n end",
"def unsubscribed(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Recipients/Unsubscribed\", params: params)\n end",
"def all_subscriptions\n get(url_(\"subscription\"))\n end",
"def index\n @unsubscriptions = Unsubscription.all\n end",
"def unsubscribe()\n end",
"def unsubscribed\n super\n # TODO: abort any pending lookup requests\n end",
"def unsubscribed\n puts \"#{current_user.displayname} left!\"\n end",
"def unsubscribe; end",
"def calculate_recipients\n # binding.pry\n # SUBSCRIBERS - UNSUBSCRIBED\n SUBSCRIBERS.select { |subscriber| !UNSUBSCRIBED.include?(subscriber) }\n # Using the SUBSCRIBERS and UNSUBSCRIBED arrays,\n # write a method that will return an array of only the subscribers who haven't unsubscribed\nend",
"def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n stop_all_streams\n end",
"def unsubscribed\n # Any cleanup needed when channel is unsubscribed\n stop_all_streams\n end",
"def unsubscribe\n end",
"def get options = {}\n unsubscribe_url = \"suppression/unsubscribes\"\n query_api(unsubscribe_url, process_header_options(options))\n end",
"def unsubscribe()\n \n end",
"def unsubscribe_from_list(user, list)\n delete(\"/#{user}/#{list}/subscribers.json\")\n end",
"def unsubscribe\n @entry.subscribers.delete(current_user)\n end",
"def subscribed_types\n subscribable_types - unsubscribed_types\n end",
"def unsubscribed?\n self.type == :unsubscribed\n end",
"def subscribes\n @subscribes ||= user_data_as_array('subscribe')\n @subscribes\n end",
"def unsubscribe(cls)\n @subscribers.delete(name)\n end",
"def deactivate_unsubscribers\n active_subscribers = Subscriber.active\n active_subscribers.each do |active_subscriber|\n mc_sub_infos = self.fetch_subscriber_mc_infos(active_subscriber)\n if !mc_sub_infos[0] || mc_sub_infos[1][\"data\"][\"status\"] == \"unsubscribed\"\n puts \"\\nSuccessful update to is_active: false for : #{active_subscriber.firstname} - ID: #{active_subscriber.id}\\n\\n\"\n active_subscriber.update(is_active: false)\n end\n end\n end",
"def list_subscribed(&block)\n @driver.list_subscribed(&block)\n end",
"def unsubscribe\n subscriptions.values.each(&:unsubscribe)\n @on_unsubscribe.call(self) if @on_unsubscribe\n end",
"def list_my_subscriptions() path = \"/api/v2/utilities/subscriptions\"\n get(path, {}, AvaTax::VERSION) end",
"def unsubscribing_subscribers_from_account(format, apikey, body, opts = {})\n data, _status_code, _headers = unsubscribing_subscribers_from_account_with_http_info(format, apikey, body, opts)\n return data\n end",
"def unapply_on_subscribing\n @apply_on_subscribing = false\n return self\n end",
"def punsubscribe(*channels); end",
"def unsubscribe\n @conn.send_data :opcode => UNSUBSCRIBE, :channel => @name\n end",
"def subscriptions!\n @subscriptions = nil\n subscriptions\n end",
"def unsubscribe(*channels); end",
"def on_unsubscribed(event, total)\n client.debug({context: :monitor, action: :punsubscribe, event: event, total: total}.to_json)\n end",
"def unsubscribe_url(address=nil)\n \"#{@mailgun.base_url}/#{@domain}/unsubscribes#{'/' + address if address}\"\n end",
"def unsubscribed\n # This will broadcast that user unsubscribed but the frontend will not receive the final broadcast\n p '**** ChatChannel unsubscribed'\n notification = {notification: 'User X has dropped off'}\n # ActionCable.server.broadcast(params[:room], notification)\n send_broadcast(params[:room], notification)\n end",
"def delete_subscriptions\n end",
"def unsubscribe(host)\n pubsub.subscriptions(host) do |m|\n m[:subscribed] && m[:subscribed].each do |s|\n pubsub.unsubscribe(s[:node], nil, s[:subid], host, &callback_logging(__method__, s[:node], s[:subid]))\n end\n end\n end",
"def getAllSubscriptions\n if @subscriptionLists.hasKey(\"subscriptions\")\n return @subscriptionLists.getRepositoryObject(\"subscriptions\").getObject\n end\n end",
"def unobserve_all_observables\n registrations.values.dup.each do |registration|\n registration.deregister\n registrations.delete([registration.observable.object_id, registration.args])\n end\n end",
"def list_subs\n \t@subs = instagram_client.subscriptions\n end",
"def unsubscribe\n raise UnsubscribedError\n end",
"def subscriptions\n @subscriptions ||= {}\n end",
"def unsubscribe_subscribers(subscribers)\n url = \"v2/#{account_id}/unsubscribes/batches\"\n make_json_api_request :post, url, private_generate_resource(\"batches\", { \"subscribers\" => subscribers })\n end",
"def subscriptions\n # subscriber entries are embedded in subscriptions inside of an\n # org. We'll flip this, so that we only return subscriber entries\n # for the account\n orgs = Org.all(:conditions=>{ \"subscriptions.subscribers.account_id\"=> self.id})\n subscribers = []\n orgs.each do |org|\n org.subscriptions.each do |subscription|\n subscribers += subscription.subscribers.select { |subscriber| subscriber.account_id.to_s == self.id.to_s }\n end\n end\n subscribers.flatten!\n subs = []\n subscribers.each do |subscriber|\n subscript = subscriber.subscription\n org = subscript.org\n subs << AccountSubscription.new(org.id.to_s, org.name, subscript.product, subscript.billing_level, subscriber.role)\n end\n subs\n end",
"def mark_unsubscribed!\n return unless with_states?\n # todo: move to callback\n user.unsubscribe! if user.subscribed?\n end",
"def unsubscribe( publication )\n subscriptions.by_publication( publication ).delete_all\n end",
"def all_subscriptions(&block)\n subscriptions.list(&block)\n end",
"def successful_unsubscribe\n end",
"def testUnsubscribe2()\n topic = \"_UnubscribeString2\"\n conn = Scalaris::PubSub.new()\n \n # first subscribe all test \"urls\"...\n (0..($_TEST_DATA.length - 1)).each do |i|\n conn.subscribe(@testTime.to_s + topic, $_TEST_DATA[i])\n end\n \n # ... then unsubscribe every second url:\n (0..($_TEST_DATA.length - 1)).step(2) do |i|\n conn.unsubscribe(@testTime.to_s + topic, $_TEST_DATA[i])\n end\n \n # check whether the subscribers were successfully saved:\n subscribers = conn.get_subscribers(@testTime.to_s + topic)\n subscribers_expected = []\n (1..($_TEST_DATA.length - 1)).step(2) do |i|\n subscribers_expected << $_TEST_DATA[i]\n assert(subscribers.include?($_TEST_DATA[i]),\n \"Subscriber \\\"\" + $_TEST_DATA[i] + \"\\\" does not exist for topic \\\"\" + topic + \"\\\"\")\n end\n \n # check whether the unsubscribed urls were unsubscribed:\n (0..($_TEST_DATA.length - 1)).step(2) do |i|\n assert(!(subscribers.include?($_TEST_DATA[i])),\n \"Subscriber \\\"\" + $_TEST_DATA[i] + \"\\\" should have been unsubscribed from topic \\\"\" + topic + \"\\\"\")\n end\n \n assert_equal(nil, self.class._getDiffElement(subscribers, subscribers_expected),\n \"unexpected subscriber of topic \\\"\" + topic + \"\\\"\")\n \n conn.close_connection()\n end",
"def unsubscribe_all(listener)\n if @subscriptions\n @subscriptions.keys.each do |event|\n unsubscribe(event, listener)\n end\n end\n end",
"def get_subscribers\n @subscriptions = subscribers(@nodename)\n end",
"def prune_subscriptions\n exisiting_subscription_ids = Spree::Subscription.where(order: self).pluck :id\n needed_ids = self.line_items.pluck(:subscription_id).uniq\n to_delete = exisiting_subscription_ids - needed_ids\n\n # kaboom!\n Spree::Subscription.where(id: to_delete).destroy_all\n end",
"def unsubscribed\n if current_user.is_a?(User)\n\n # if @userType == \"known\"\n ActionCable.server.broadcast \"AppearanceChannel\", { user: current_user.email, user_id: current_user.id, online: :off }\n # else\n # reject\n end\n # stop_all_streams\n # Any cleanup needed when channel is unsubscribed\n end",
"def calculate_recipients\n # TODO (Step 3) - Fix, not working\n SUBSCRIBERS.filter do |email|\n !UNSUBSCRIBED.include?(email)\n end\nend",
"def subscriptions; end",
"def subscriptions; end",
"def subscriptions; end",
"def remove(address_or_id)\n delete(\"#{domain}/unsubscribes/#{address_or_id}\")\n end",
"def subscribers\r\n @subscribers.clone\r\n end",
"def unconnected_venues\n unconnected = []\n Venue.all.each do |venue|\n unconnected << venue if venues.exclude? venue\n end\n return unconnected\n end",
"def subscribed_surveys\n if self.has_access?(:survey_show_all)\n s = Survey.all(:order => :position)\n # s.delete_if {|s| s.title =~ /Test/}\n # s\n elsif self.has_access?(:survey_show_subscribed)\n self.center.subscribed_surveys\n elsif self.has_access?(:survey_show_login)\n surveys = []\n journal_entry = JournalEntry.find_by_user_id(self.id)\n surveys << journal_entry.survey if journal_entry.survey\n else\n surveys = []\n end\n end",
"def subscribed_surveys\n if self.has_access?(:survey_show_all)\n s = Survey.all(:order => :position)\n # s.delete_if {|s| s.title =~ /Test/}\n # s\n elsif self.has_access?(:survey_show_subscribed)\n self.center.subscribed_surveys\n elsif self.has_access?(:survey_show_login)\n surveys = []\n journal_entry = JournalEntry.find_by_user_id(self.id)\n surveys << journal_entry.survey if journal_entry.survey\n else\n surveys = []\n end\n end",
"def clear_subs\n instagram_client.subscriptions.each do |sub|\n instagram_client.delete_subscription(id: sub.id)\n end\n\n redirect_to list_subs_path\n end",
"def calculate_recipients\n # Using the SUBSCRIBERS and UNSUBSCRIBED arrays,\n # Returns an array of only the subscribers who haven't unsubscribed\n SUBSCRIBERS.find_all do |unsubscribed_readers|\n !UNSUBSCRIBED.include? unsubscribed_readers\n end\nend",
"def unsubscribed\n location_id = params[:location_id].to_i\n @@locations_with_subscribers.delete(location_id)\n end",
"def get_subscriptions\n subscriptions = []\n\n # Load the checks\n file = File.read(CHECKS)\n checks = JSON.parse(file)\n\n for check in checks\n subscriptions |= check[\"subscribers\"]\n end\n\n return subscriptions\nend",
"def unapply_publishing_and_subscribing\n unapply_on_subscribing\n unapply_on_publishing\n return self\n end",
"def index\n @q = ::Pushar::Core::Subscription.unscoped.search(params[:q])\n @q.sorts = 'created_at desc' if @q.sorts.empty?\n @subscriptions = @q.result(distinct: true).page(params[:page]).per(50)\n end",
"def subscriptions\n @channels\n end",
"def delete(\n start_date: nil, end_date: nil, email: nil)\n res = connection.post(\n '/api/unsubscribes.delete.json',\n default_params(\n start_date: start_date,\n end_date: end_date,\n email: email))\n craft_response(res)\n end",
"def punsubscribe(*channels)\n _subscription(:punsubscribe, 0, channels, nil)\n end",
"def unsubscribed?\n preminum? ? false : true\n #subscribed? ? false : true\n end",
"def get_subscriptions\n get_subscriptions_from(@nodename)\n end",
"def unsubscribed\n User.find(current_user.id).update(online: false)\n ActionCable.server.broadcast(\n 'appearance_channel',\n user_id: current_user.id,\n is_online: false\n )\n end",
"def unsubscribe\n unregister\n end",
"def create(params)\n params[:tag] ||= '*'\n post(\"#{domain}/unsubscribes\", params)\n end",
"def unsubscribe request\r\n return unless @requests.find{|req| req==request }\r\n synchronize do\r\n request.num_subscribes-=1\r\n @requests.delete request\r\n end \r\n end",
"def clear_domains\n clear_all_dependencies\n puts \"All domains removed from the monitoring list\"\n end",
"def unsubscribe_from_channel; end",
"def unsubscribed?\n @subscription.nil?\n end",
"def subscribed_surveys\n if self.has_access?(:survey_show_all)\n s = Survey.all.order(:position)\n # s.delete_if {|s| s.title =~ /Test/}\n # s\n elsif self.has_access?(:survey_show_subscribed)\n self.center.subscribed_surveys\n elsif self.has_access?(:survey_show_login)\n surveys = []\n journal_entry = JournalEntry.find_by_user_id(self.id)\n surveys << journal_entry.survey if journal_entry.survey\n else\n surveys = []\n end\n end",
"def testUnsubscribe_NotExistingUrl()\n topic = \"_Unsubscribe_NotExistingUrl\"\n conn = Scalaris::PubSub.new()\n \n # first subscribe test \"urls\"...\n conn.subscribe(@testTime.to_s + topic, $_TEST_DATA[0])\n conn.subscribe(@testTime.to_s + topic, $_TEST_DATA[1])\n \n # then unsubscribe another \"url\":\n assert_raise( Scalaris::NotFoundError ) { conn.unsubscribe(@testTime.to_s + topic, $_TEST_DATA[2]) }\n \n # check whether the subscribers were successfully saved:\n subscribers = conn.get_subscribers(@testTime.to_s + topic)\n assert(subscribers.include?($_TEST_DATA[0]),\n \"Subscriber \\\"\" + $_TEST_DATA[0] + \"\\\" does not exist for topic \\\"\" + topic + \"\\\"\")\n assert(subscribers.include?($_TEST_DATA[1]),\n \"Subscriber \\\"\" + $_TEST_DATA[1] + \"\\\" does not exist for topic \\\"\" + topic + \"\\\"\")\n \n # check whether the unsubscribed urls were unsubscribed:\n assert(!(subscribers.include?($_TEST_DATA[2])),\n \"Subscriber \\\"\" + $_TEST_DATA[2] + \"\\\" should have been unsubscribed from topic \\\"\" + topic + \"\\\"\")\n \n assert_equal(2, subscribers.length,\n \"Subscribers of topic (\" + topic + \") should only be [\\\"\" + $_TEST_DATA[0] + \"\\\", \\\"\" + $_TEST_DATA[1] + \"\\\"], but is: \" + subscribers.to_s)\n \n conn.close_connection()\n end",
"def unsubscribe_pubsub(jid)\n @pubsubs.values.each do |pubsub|\n pubsub.unsubscribe_all(jid)\n end\n end",
"def unsubscribe_url\n nil\n end",
"def unsubscribe(name)\n id = @subs[name]\n\n self.send(msg: 'unsub', id: id)\n end"
] |
[
"0.861392",
"0.7337089",
"0.7337089",
"0.720435",
"0.7147215",
"0.7093557",
"0.700932",
"0.69384354",
"0.69024134",
"0.68970585",
"0.68882036",
"0.68441564",
"0.6813133",
"0.6778833",
"0.676144",
"0.6633737",
"0.651101",
"0.65095407",
"0.64840287",
"0.63847935",
"0.63548714",
"0.63173896",
"0.6293795",
"0.6269859",
"0.6256919",
"0.62510407",
"0.6226404",
"0.6226404",
"0.6221031",
"0.62079346",
"0.6162161",
"0.6137358",
"0.61111575",
"0.6090074",
"0.6056108",
"0.6014847",
"0.6014509",
"0.6001237",
"0.59978396",
"0.59882116",
"0.59834945",
"0.59707147",
"0.5965817",
"0.5955225",
"0.59513044",
"0.59478945",
"0.59330267",
"0.5919331",
"0.5913437",
"0.5912904",
"0.58958524",
"0.58832306",
"0.58641744",
"0.58588785",
"0.5857768",
"0.58445823",
"0.5841299",
"0.58168805",
"0.58164424",
"0.5809781",
"0.57967836",
"0.5791898",
"0.57847464",
"0.5764234",
"0.5762939",
"0.5760283",
"0.57555544",
"0.5754567",
"0.57538784",
"0.5746513",
"0.5746513",
"0.5746513",
"0.5734875",
"0.57289714",
"0.57259995",
"0.57132316",
"0.5710896",
"0.57106155",
"0.5708135",
"0.5703153",
"0.56841904",
"0.56834227",
"0.56820714",
"0.56774956",
"0.5677408",
"0.5670384",
"0.5668979",
"0.56688607",
"0.5660209",
"0.5659029",
"0.5654457",
"0.56502825",
"0.56497073",
"0.56468767",
"0.56459314",
"0.56434655",
"0.5640672",
"0.56182605",
"0.5610877",
"0.560539"
] |
0.6490696
|
18
|
Helper method to generate the proper url for Mailgun unsubscribe API calls
|
def unsubscribe_url(address=nil)
"#{@mailgun.base_url}/#{@domain}/unsubscribes#{'/' + address if address}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def unsubscribe_url\n nil\n end",
"def unsubscribe_url(id:, email:)\n token =\n Base64.encode64(\"#{id}:#{email}\")\n\n \"#{connection.url_prefix}unsubscribe?token=#{token}\"\n end",
"def unsubscribe(uuid)\n post_json(\"#{endpoint}/unsubscribe/#{uri_encode(uuid)}\")\n end",
"def unsubscribe(uuid)\n post_json(\"#{endpoint}/unsubscribe/#{uri_encode(uuid)}\")\n end",
"def subscribe_url\n nil\n end",
"def successful_unsubscribe\n end",
"def unsubscribe\n end",
"def unsubscribe_to_email\n @subscription.unsubscribe_to_email\n return_back_or_ajax\n end",
"def unsubscribe(email)\n # Raise an error to warn it isn't implemented.\n raise NotImplementedError.new\n end",
"def unsubscribe\n logger.info \"Loading MemberSubscriber unsubscribe action - remote\"\n @subscriber = @current_resource\n logger.debug \"Subscriber attributes hash: #{@subscriber.attributes.inspect}\" if @subscriber\n @merchant_store = MerchantStore.find(@subscriber.merchant_store.id)\n logger.debug \"Merchant-store attributes hash: #{@merchant_store.attributes.inspect}\" if @merchant_store\n if @subscriber.present? && @merchant_store.present?\n logger.debug \"Subscriber found in database. Starting unsubscribe process: #{@subscriber.attributes}\"\n if @subscriber.destroy\n logger.debug \"Unsubscribe completed successfully: #{@subscriber.attributes}\"\n #Send opt-out e-mail to member\n MemberMailer.delay.web_opt_out(@subscriber.member.id, @merchant_store.id)\n logger.debug \"Sending delayed unsubscribe email to member\"\n else\n logger.debug \"Error unsubscribing via Google Maps\" \n logger.fatal \"Error unsubscribing via Google Maps\" \n end\n end\n respond_to do |format|\n format.html { redirect_to root_path }\n format.js \n end\n end",
"def unsubscribe\n @subscriber = MailchimpSubscriber.new params[:mailchimp_subscriber]\n\n if @subscriber.valid?\n GoGoGibbon::Commands.unsubscribe @subscriber, GoGoGibbon::Config.subscribed\n end\n\n respond_to do |format|\n format.html { redirect_to(mailchimp_subscribers_url, :notice => 'User was successfully unsubscribed.') }\n end\n end",
"def unsubscribe(email)\n\t # Logic for mailchimp unsubscription.\n\t api.lists(@campaignable_list_id).members(subscriber_hash(email)).update(body: { status: \"unsubscribed\" })\n rescue Gibbon::MailChimpError => e\n # Reraise any non 404 errors.\n raise unless e.status_code == 404\n # Log rails errors into the rails logger.\n Rails.logger.warn \"unsubscribe: User #{email} not found!\"\n end",
"def unsubscribe!\n self.type = :unsubscribe\n reply_if_needed!\n end",
"def unsubscribe\n email = Base64.decode64(params[:token])\n Subscription.where(email: email).destroy_all\n end",
"def list(options={})\n Mailgun.submit(:get, unsubscribe_url, options)[\"items\"]\n end",
"def unsubscribe; end",
"def unsubscribe\n mailchimp = Gibbon::API.new\n result = mailchimp.lists.unsubscribe({\n :id => ENV[\"MAILCHIMP_LIST_ID\"],\n :email => {:email => self.email},\n :delete_member => true, # this is NOT the default value\n :send_notify => true,\n :send_goodbye => true\n })\n Rails.logger.info(\"Unsubscribed #{self.email} from MailChimp\") if result\n end",
"def unsubscribe()\n end",
"def base_url\n \"#{Mailgun.protocol}://api:#{Mailgun.api_key}@#{Mailgun.mailgun_host}/#{Mailgun.api_version}\"\n end",
"def unsubscribe(url, id = nil, opts = {}, &block)\n feed_id = \"#{id ? id : Base64.urlsafe_encode64(url)}\"\n if block\n @verifications[feed_id] ||= {}\n @verifications[feed_id]['unsubscribe'] = block\n end\n @response = http_post(SUPERFEEDR_ENDPOINT,\n opts.merge({\n :params => {\n :'hub.mode' => 'unsubscribe',\n :'hub.verify' => @params[:async] ? 'async' : 'sync',\n :'hub.topic' => url,\n :'hub.callback' => generate_callback(url, feed_id)\n },\n :userpwd => \"#{@params[:login]}:#{@params[:password]}\"\n }))\n @error = @response.to_s\n @params[:async] && @response.code == '202' || @response.code == '204' # We return true to indicate the status.\n end",
"def unsubscribe(subscriber)\n @subscriber = subscriber\n mail to: subscriber.email, subject: \"Unsubscribed from ML@B\"\n end",
"def unsubscribe(email)\n\t # Logic for mailchimp unsubscription.\n\t api.unsubscribe({\n\t \t:id => @campaignable_list_id,\n\t :email => {\n\t :email => email\n\t }, \n\t :send_goodbye => false, # Don't send a goodbye email.\n\t :send_notify => false # Don't notify the user of the unsubscription.\n\t })\n end",
"def get options = {}\n unsubscribe_url = \"suppression/unsubscribes\"\n query_api(unsubscribe_url, process_header_options(options))\n end",
"def unsubscribe(id_or_email, options = {})\n url = \"v2/#{account_id}/subscribers/#{CGI.escape id_or_email}/remove\"\n url += options[:campaign_id] ? \"?campaign_id=#{options[:campaign_id]}\" : \"\"\n make_json_api_request :post, url\n end",
"def unsubscribe_subscriber(id)\n delete_json(\"#{endpoint}/subscribers/#{uri_encode(id)}\")\n end",
"def unsubscribe_subscriber(id)\n delete_json(\"#{endpoint}/subscribers/#{uri_encode(id)}\")\n end",
"def unsubscribe\n if request.post?\n @recipient = Recipient.find_by_email( params[:recipient][:email] )\n if (! @recipient)\n flash.now[:error] = _(\"Email address not found in the database!\")\n elsif Subscription.unsubscribe( @recipient, @project )\n render :text => @project.templets.find_by_name('PAGE_UNSUBSCRIBE_OK').render( @project ), :layout => true\n return\n end\n end\n render :text => @project.templets.find_by_name('PAGE_UNSUBSCRIBE').render( @project ), :layout => true\n end",
"def unsubscribe_from_newsletter\n email = current_user ? current_user.email : ''\n @newsletter = Newsletter.find_newsletter(params['token'])\n\n if @newsletter\n result = @newsletter.unsubscribe(email)\n respond_to do |format|\n if result\n msg = I18n.t('nms.unsubscribe_successuful')\n format.html { redirect_back fallback_location: main_app.index_url, notice: msg }\n format.json { render json: { success: true, msg: msg } }\n else\n msg = I18n.t('nms.Email_NotExists')\n format.html { redirect_back fallback_location: main_app.index_url, alert: msg }\n format.json { render json: { success: false, msg: msg } }\n end\n end\n end\n end",
"def unsubscribe()\n \n end",
"def unsubscribing_subscribers_from_mailing_list_with_http_info(format, apikey, mailing_list_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SubscribersApi.unsubscribing_subscribers_from_mailing_list ...\"\n end\n # verify the required parameter 'format' is set\n if @api_client.config.client_side_validation && format.nil?\n fail ArgumentError, \"Missing the required parameter 'format' when calling SubscribersApi.unsubscribing_subscribers_from_mailing_list\"\n end\n # verify enum value\n if @api_client.config.client_side_validation && !['json', 'xml'].include?(format)\n fail ArgumentError, \"invalid value for 'format', must be one of json, xml\"\n end\n # verify the required parameter 'apikey' is set\n if @api_client.config.client_side_validation && apikey.nil?\n fail ArgumentError, \"Missing the required parameter 'apikey' when calling SubscribersApi.unsubscribing_subscribers_from_mailing_list\"\n end\n # verify the required parameter 'mailing_list_id' is set\n if @api_client.config.client_side_validation && mailing_list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'mailing_list_id' when calling SubscribersApi.unsubscribing_subscribers_from_mailing_list\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling SubscribersApi.unsubscribing_subscribers_from_mailing_list\"\n end\n # resource path\n local_var_path = \"/subscribers/{MailingListID}/unsubscribe.{Format}\".sub('{' + 'Format' + '}', format.to_s).sub('{' + 'MailingListID' + '}', mailing_list_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'apikey'] = apikey\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = []\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 => 'UnsubscribingSubscribersFromMailingListResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SubscribersApi#unsubscribing_subscribers_from_mailing_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def unsubscribing_subscribers_from_account_with_http_info(format, apikey, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SubscribersApi.unsubscribing_subscribers_from_account ...\"\n end\n # verify the required parameter 'format' is set\n if @api_client.config.client_side_validation && format.nil?\n fail ArgumentError, \"Missing the required parameter 'format' when calling SubscribersApi.unsubscribing_subscribers_from_account\"\n end\n # verify enum value\n if @api_client.config.client_side_validation && !['json', 'xml'].include?(format)\n fail ArgumentError, \"invalid value for 'format', must be one of json, xml\"\n end\n # verify the required parameter 'apikey' is set\n if @api_client.config.client_side_validation && apikey.nil?\n fail ArgumentError, \"Missing the required parameter 'apikey' when calling SubscribersApi.unsubscribing_subscribers_from_account\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling SubscribersApi.unsubscribing_subscribers_from_account\"\n end\n # resource path\n local_var_path = \"/subscribers/unsubscribe.{Format}\".sub('{' + 'Format' + '}', format.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'apikey'] = apikey\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = []\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 => 'UnsubscribingSubscribersFromAccountResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SubscribersApi#unsubscribing_subscribers_from_account\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def unsubscribe\n user = User.where(email: params[:md_email]).first\n user.unsubscribe!\n\n redirect_to root_path, notice: t(\"unsubscribed\")\n end",
"def batch_unsubscribe(email)\n # Raise an error to warn it isn't implemented.\n raise NotImplementedError.new\n end",
"def unsubscribe! (user_id)\n check_auth :unsubscribe\n \n response = connection.post do |req|\n req.url \"/user/unsubscribe/#{user_id}\"\n req.body = { :format => @format }\n end\n response\n end",
"def unsubscribe\n debug [self.name, \"terminated\"]\n unsubscribe_request\n end",
"def unsubscribe_to_optional_target\n @subscription.unsubscribe_to_optional_target(params[:optional_target_name])\n return_back_or_ajax\n end",
"def unsubscribe_all\n send_action('unsubscribe_all')\n end",
"def unsubscribe\n CampaignMonitorWrapper.unsubscribe(user.email)\n end",
"def unsubscribe!(reason = nil)\n update!(unsubscribed_at: ::Caffeinate.config.time_now, unsubscribe_reason: reason)\n\n caffeinate_campaign.to_dripper.run_callbacks(:on_unsubscribe, self)\n end",
"def webhook_url(id=nil)\n \"#{@mailgun.base_url}/domains/#{domain}/webhooks#{'/' + id if id}\"\n end",
"def unsubscribed(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Recipients/Unsubscribed\", params: params)\n end",
"def unsubscribe\n raise UnsubscribedError\n end",
"def unsubscribe\n respond_to do |format|\n if @contact.unsubscribe(params[:list_id])\n # format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n flash.now[:notice] = 'Unsubscribe successful.'\n format.html { render :show }\n format.json { render :show, status: :created, location: @contact }\n else\n @allow_change_to_email = true\n flash.now[:notice] = 'Unsubscribe successful.'\n redirect_to request.referer\n end\n end\n end",
"def unsubscribe(*args)\n (@client ||= connect).unsubscribe(*args)\n end",
"def unsubscribe_from_all(id_or_email)\n make_json_api_request :post, \"v2/#{account_id}/subscribers/#{CGI.escape id_or_email}/unsubscribe_all\"\n end",
"def pubsubhubbub_callback_url\n ENV['PUBSUBHUBBUB_CALLBACK_URL'].presence || Rails.application.routes.url_helpers\n .url_for(controller: 'curry/pull_request_updates', action: 'create',\n host: ENV['FQDN'], protocol: ENV['PROTOCOL'], port: ENV['PORT'])\n end",
"def unsubscribe(recipient_id)\n @api.delete(\"#{@api.path}/List/#{@id}/Unsubscribe/#{recipient_id}\")\n end",
"def unsubscribe_notifications\n authorize resource\n redirect_to user_path(current_user, anchor: 'unsubscribes')\n end",
"def unsubscribe_link(tag)\n whether_hidden = !current_user.subscribed?(tag) ? \" hidden\" : \"\";\n link_to_remote t(\"winnow.tags.main.unsubscribe\"),\n :url => unsubscribe_tag_path(tag),\n :method => 'put',\n :confirm => t(tag.public? ? \"winnow.tags.main.unsubscribe_confirm\" : \"winnow.tags.main.unsubscribe_not_public_tag_confirm\", :tag => tag.name),\n :html => {\n :title => t(\"winnow.tags.main.unsubscribe_tooltip\", :tag => tag.name),\n :class => \"unsubscribe\" + whether_hidden,\n :id => dom_id(tag, 'unsubscribe')\n }\n end",
"def unsubscribe\n @subscription.unsubscribe\n return_back_or_ajax\n end",
"def unsubscribe(user_name, email, plan)\n @user_name = user_name\n @plan = plan\n @email = email\n\n mail to: \"Susie Ye <susie@baserails.com>\", subject: \"#{user_name} unsubscribed from the #{plan} plan\"\n end",
"def unsubscribe2\n if Spree::Chimpy::Subscriber.where(email:self.email).first\n self.unsubscribe\n end\n end",
"def unsubscribe_client_id(*args)\n raise_unsupported\n end",
"def unsubscribe_from_channel; end",
"def unsubscribe\n @issue.skip_email_notifications = true\n @issue.unsubscribe(current_user)\n render 'issues/update.js.erb', locals: {project: @project, key: @key, translation: @translation, issue: @issue }\n end",
"def unsubscribe_member_table\n logger.info \"Loading MemberSubscriber unsubscribe_member_table action\"\n @subscriber = @current_resource\n logger.debug \"Subscriber attributes hash: #{@subscriber.attributes.inspect}\" if @subscriber\n @merchant_store = MerchantStore.find(@subscriber.merchant_store.id)\n logger.debug \"Merchant-store attributes hash: #{@merchant_store.attributes.inspect}\" if @merchant_store\n error = false\n if @subscriber.present? && @merchant_store.present?\n logger.debug \"Subscriber found in database. Starting unsubscribe process: #{@subscriber.attributes}\"\n if @subscriber.destroy\n logger.debug \"Unsubscribe completed successfully\"\n \n #Send opt-out e-mail to member\n MemberMailer.delay.web_opt_out(@subscriber.member.id, @merchant_store.id)\n logger.debug \"Sending delayed unsubscribe email to member\"\n flash[:success] = t( :unsubscribe_confirmation, store_name: @merchant_store.store_name, :scope => [:business_messages, :subscriber])\n redirect_to favorites_path(current_member_user)\n return\n else\n error = true\n logger.debug \"Error when deleting subscriber record\"\n end\n else\n error = true\n logger.debug \"Error: Invalid unsubscribe request. Missing attributes\"\n logger.fatal \"Error: Invalid unsubscribe request. Missing attributes\"\n end\n if error\n flash[:error] = t( :unsubscribe_error, store_name: @merchant_store.store_name, :scope => [:business_messages, :subscriber])\n redirect_to favorites_path(current_member_user)\n end\n end",
"def delete(\n start_date: nil, end_date: nil, email: nil)\n res = connection.post(\n '/api/unsubscribes.delete.json',\n default_params(\n start_date: start_date,\n end_date: end_date,\n email: email))\n craft_response(res)\n end",
"def unsubscribe(id:, email:)\n request do\n response =\n connection.post(\"#{id}/unsubscribe\", 'email' => email)\n\n parse(response.body)\n end\n end",
"def unsubscribe(recipient_id)\n @api.delete(\"#{@api.path}/Group/#{@id}/Unsubscribe/#{recipient_id}\")\n end",
"def newsletter_unsubscribe_alert(subscription, email)\n\t\t@list_name = User.human_attribute_name subscription\n\t\t@email = email\n\t\tsendgrid_category 'Newsletter Unsubscribe Alert'\n\t\tmail subject: \"User with email #{email} has unsubscribed from \\\"#{@list_name}\\\" newsletters\", to: ADMIN_EMAIL\n\tend",
"def endpoint_url\n protocol = @secure ? 'https' : 'http'\n endpoint_host = SmsNotify::Api.endpoint_host\n \"#{protocol}://#{endpoint_host}/\"\n end",
"def bulk_unsubscribe(slug:, govuk_request_id: nil, body: nil, sender_message_id: nil)\n post_json(\n \"#{endpoint}/subscriber-lists/#{slug}/bulk-unsubscribe\",\n {\n body: body,\n sender_message_id: sender_message_id,\n }.compact,\n {\n \"Govuk-Request-Id\" => govuk_request_id,\n }.compact,\n )\n end",
"def unsubscribed\n end",
"def unsubscribed\n end",
"def customer_mailchimp_unsubscribed\n {\n :list_id => data['list_id'],\n :fired_at => params['fired_at'],\n :mailchimp_id => data['id'],\n :email => data['email'],\n :email_type => data['email_type'],\n :merges => data['merges'],\n :ip_opt => params['ip_opt'],\n :campaign_id => data['campaign_id'],\n :human => \"#{data['email']} unsubscribed from Mailchimp list with ID #{data['list_id']}\"\n }\n end",
"def subid\n unsubscribe[:subid]\n end",
"def get_url endpoint\n url = @url\n if !url.end_with? \"/\"\n url = \"#{url}/\"\n end\n\n \"#{url}wc-api/#{@version}/#{endpoint}\"\n end",
"def unsubscribe_from_list(user, list)\n delete(\"/#{user}/#{list}/subscribers.json\")\n end",
"def api_delete_url(id)\n \"#{self.name.split(\"::\").last.downcase}s/#{id}\"\n end",
"def unsubscribe(mailbox)\n tagged_response(\"UNSUBSCRIBE\", to_utf7(mailbox))\n end",
"def url\n URI.parse(endpoint).join(path.to_s).to_s\n end",
"def unsubscribe_from(id)\n post(ROOT_URI + '/a/unsubscribe', 'stream' => id)\n end",
"def unsubscribe_from(id)\n post(ROOT_URI + '/a/unsubscribe', 'stream' => id)\n end",
"def unsubscribe\n @subscription_reference.unsubscribe\n end",
"def unsubscribe\n @entry.subscribers.delete(current_user)\n end",
"def unsubscribe_to_email(options = {})\n unsubscribed_to_email_at = options[:unsubscribed_to_email_at] || Time.current\n update(subscribing_to_email: false, unsubscribed_to_email_at: unsubscribed_to_email_at)\n end",
"def destroy\n Mailer.deliver_unsubscribe_report(@fan)\n @fan.deactivate\n flash[:notice] = \"#{@fan.email} was successfully unsubscribed.\"\n\n if logged_in?\n redirect_to fans_path\n else\n redirect_to home_path\n end\n end",
"def unsubscribe(topic, callback)\n options = {\n :\"hub.mode\" => \"unsubscribe\",\n :\"hub.topic\" => topic,\n :\"hub.callback\" => callback,\n }\n post(\"/hub\", options, 3, true, true, true)\n true\n end",
"def unsubscribe(params)\n web_id = params[\"web_id\"]\n\n subscriber = nil\n enabled_models.each { |model| subscriber ||= model.constantize.find_by_mail_chimp_id(web_id) }\n\n subscriber.subscribed_to_list = false\n subscriber.save_without_update_list_member(:validate => false)\n end",
"def unsubscribed\n\tend",
"def endpoint\n @endpoint ||= 'https://api.emailcampaigns.net/2/REST/'\n end",
"def removing_a_subscriber_with_http_info(format, apikey, mailing_list_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: SubscribersApi.removing_a_subscriber ...\"\n end\n # verify the required parameter 'format' is set\n if @api_client.config.client_side_validation && format.nil?\n fail ArgumentError, \"Missing the required parameter 'format' when calling SubscribersApi.removing_a_subscriber\"\n end\n # verify enum value\n if @api_client.config.client_side_validation && !['json', 'xml'].include?(format)\n fail ArgumentError, \"invalid value for 'format', must be one of json, xml\"\n end\n # verify the required parameter 'apikey' is set\n if @api_client.config.client_side_validation && apikey.nil?\n fail ArgumentError, \"Missing the required parameter 'apikey' when calling SubscribersApi.removing_a_subscriber\"\n end\n # verify the required parameter 'mailing_list_id' is set\n if @api_client.config.client_side_validation && mailing_list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'mailing_list_id' when calling SubscribersApi.removing_a_subscriber\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling SubscribersApi.removing_a_subscriber\"\n end\n # resource path\n local_var_path = \"/subscribers/{MailingListID}/remove.{Format}\".sub('{' + 'Format' + '}', format.to_s).sub('{' + 'MailingListID' + '}', mailing_list_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'apikey'] = apikey\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = []\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 => 'RemovingASubscriberResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SubscribersApi#removing_a_subscriber\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def find(address)\n get(\"#{domain}/unsubscribes/#{address}\")\n end",
"def marketing_tool_sync_unsubscription(with_delay = true)\n case(club.marketing_tool_client)\n when 'exact_target'\n if defined?(SacExactTarget::MemberModel)\n with_delay ? exact_target_unsubscribe : exact_target_unsubscribe_without_delay \n end\n when 'mailchimp_mandrill'\n if defined?(SacMailchimp::MemberModel)\n with_delay ? Mailchimp::UserUnsubscribeJob.perform_later(self.id) : Mailchimp::UserUnsubscribeJob.perform_now(self.id)\n end\n end\n rescue Exception => e\n logger.error \"* * * * * #{e}\"\n Auditory.report_issue(\"User::unsubscribe\", e, { user: self.id })\n end",
"def all\n get(\"#{domain}/unsubscribes\")\n end",
"def unsubscribed\n location_id = params[:location_id].to_i\n @@locations_with_subscribers.delete(location_id)\n end",
"def unsubscribe(subreddit)\n full_name = extract_full_name subreddit\n parameters = { :action => 'unsub', :sr => full_name }\n\n post('api/subscribe', parameters)\n end",
"def unsubscribe(options = {})\n unsubscribed_at = options[:unsubscribed_at] || Time.current\n new_attributes = { subscribing: false, unsubscribed_at: unsubscribed_at,\n subscribing_to_email: false, unsubscribed_to_email_at: unsubscribed_at,\n optional_targets: optional_targets }\n optional_target_names.each do |optional_target_name|\n new_attributes[:optional_targets] = new_attributes[:optional_targets].merge(\n Subscription.to_optional_target_key(optional_target_name) => false,\n Subscription.to_optional_target_unsubscribed_at_key(optional_target_name) => Subscription.convert_time_as_hash(subscribed_at))\n end\n update(new_attributes)\n end",
"def testUnsubscribe_NotExistingUrl()\n topic = \"_Unsubscribe_NotExistingUrl\"\n conn = Scalaris::PubSub.new()\n \n # first subscribe test \"urls\"...\n conn.subscribe(@testTime.to_s + topic, $_TEST_DATA[0])\n conn.subscribe(@testTime.to_s + topic, $_TEST_DATA[1])\n \n # then unsubscribe another \"url\":\n assert_raise( Scalaris::NotFoundError ) { conn.unsubscribe(@testTime.to_s + topic, $_TEST_DATA[2]) }\n \n # check whether the subscribers were successfully saved:\n subscribers = conn.get_subscribers(@testTime.to_s + topic)\n assert(subscribers.include?($_TEST_DATA[0]),\n \"Subscriber \\\"\" + $_TEST_DATA[0] + \"\\\" does not exist for topic \\\"\" + topic + \"\\\"\")\n assert(subscribers.include?($_TEST_DATA[1]),\n \"Subscriber \\\"\" + $_TEST_DATA[1] + \"\\\" does not exist for topic \\\"\" + topic + \"\\\"\")\n \n # check whether the unsubscribed urls were unsubscribed:\n assert(!(subscribers.include?($_TEST_DATA[2])),\n \"Subscriber \\\"\" + $_TEST_DATA[2] + \"\\\" should have been unsubscribed from topic \\\"\" + topic + \"\\\"\")\n \n assert_equal(2, subscribers.length,\n \"Subscribers of topic (\" + topic + \") should only be [\\\"\" + $_TEST_DATA[0] + \"\\\", \\\"\" + $_TEST_DATA[1] + \"\\\"], but is: \" + subscribers.to_s)\n \n conn.close_connection()\n end",
"def unsubscrible\n NewsletterMailer.unsubscrible\n end",
"def publish_messages_url(address=nil)\n \"#{@mailgun.base_url}/#{@domain}/messages\"\n end",
"def remove_user_from_mailchimp\n unless self.email.include?('@example.com')\n mailchimp = Hominid::API.new(AppConstants.mailchimp_key)\n list_id = mailchimp.find_list_id_by_name AppConstants.mailchimp_list\n result = mailchimp.list_unsubscribe(list_id, self.email, true, false, true) \n Rails.logger.info(\"Mailchimp unsubscribed for email id #{self.email}\")\n end\n end",
"def generate_email_unsubscriptions_report(generate_email_unsubscriptions_report, opts = {})\n data, _status_code, _headers = generate_email_unsubscriptions_report_with_http_info(generate_email_unsubscriptions_report, opts)\n data\n end",
"def unsubscribe_webhook\n if @redis\n @redis.pubsub.unsubscribe(subscribed_channel)\n @redis.close_connection\n end\n end",
"def unsubscribe\n unregister\n end",
"def unsubscribeCollection\n if !session[:user_id]\n flash[:notice] = \"Need to login first\"\n redirect_to :action=> 'login'\n end\n\n roomname = params[:unsubscribecollection][\"roomname\"]\n collectionnodename = params[:unsubscribecollection][\"collectionnodename\"]\n\n begin\n am = session[:am]\n acc = Account.find_by_username(session[:user_id])\n if(acc.nil?)\n flash[:notice] = \"Need to login first\"\n redirect_to :action=> 'login'\n return\n end\n am.keepalive(acc.username, acc.password)\n\n result = am.unsubscribeCollection(roomname, collectionnodename)\n flash[:result] = \"subscribeCollection result success: \" + result\n redirect_to :action => 'accountManager'\n rescue Exception => msg\n flash[:notice] = msg\n end\n\n end",
"def unsubscribe(name)\n id = @subs[name]\n\n self.send(msg: 'unsub', id: id)\n end",
"def batch_unsubscribe(emails=[])\n # Do this using a batch call to the MailChimp API for performance rather than lots of single API calls.\n api.batch_unsubscribe({\n \t:id => @campaignable_list_id,\n :batch => emails.map {|email| {:email => { :email => email }} }, # Map all users in the system into a mailchimp collcation.\n :send_goodbye => false, # Don't send a goodbye email.\n :send_notify => false # Don't notify the user of the unsubscription. \n })\n end",
"def deactivate\n customer_ref = params[:SubscriptionReferrer]\n subscription_ref = params[:SubscriptionReference]\n status = params[:SubscriptionStatus].to_s.downcase.strip\n\n user = User.find(customer_ref)\n \n subscription = user.active_subscription\n raise \"Received subscription deactivation for #{user.id} but the active subscription (#{subscription.reference}) doesn't match the notification (#{subscription_ref})\" unless subscription.reference == subscription_ref\n \n # set the new status\n subscription.status = status\n subscription.save!\n \n # move to default plan\n user.plan = Plan.default_plan\n user.save!\n \n # de-activate all channels\n user.deactivate_excess_channels!\n \n render nothing: true, status: 200\n end",
"def unsubscribe\n user = Subscriber.find_by_unique_identifier(params[:id])\n user.update_attribute(:is_subscribed, false)\n user.save!\n render\n end"
] |
[
"0.7956396",
"0.7790017",
"0.66825646",
"0.66825646",
"0.6421595",
"0.64120543",
"0.6399402",
"0.62976885",
"0.6285101",
"0.62684",
"0.62666005",
"0.6224547",
"0.61930853",
"0.61874294",
"0.61724144",
"0.6149331",
"0.61451983",
"0.61103004",
"0.6095919",
"0.6062818",
"0.6059401",
"0.60582143",
"0.6028578",
"0.60214907",
"0.60088426",
"0.60088426",
"0.60048836",
"0.59833115",
"0.59750605",
"0.59372133",
"0.592266",
"0.5895734",
"0.5893935",
"0.5892158",
"0.5892141",
"0.58734566",
"0.5869727",
"0.58588845",
"0.5838979",
"0.5827353",
"0.58142054",
"0.58095753",
"0.58090645",
"0.5806594",
"0.5806114",
"0.57718223",
"0.5770994",
"0.57260245",
"0.57113653",
"0.5699372",
"0.5680447",
"0.56801915",
"0.5669438",
"0.5665992",
"0.56590736",
"0.56559324",
"0.56513643",
"0.5635485",
"0.562472",
"0.5613573",
"0.55899185",
"0.5579293",
"0.55693865",
"0.55693865",
"0.5566617",
"0.55630934",
"0.55599487",
"0.55531025",
"0.5551089",
"0.55409336",
"0.5537433",
"0.55158067",
"0.55158067",
"0.55126846",
"0.5509077",
"0.55055743",
"0.5502432",
"0.5501917",
"0.5500649",
"0.54978275",
"0.54927975",
"0.5489513",
"0.5473311",
"0.5471306",
"0.54679406",
"0.54672307",
"0.54616696",
"0.54599696",
"0.5455872",
"0.54536504",
"0.54424495",
"0.5441662",
"0.5432869",
"0.54050606",
"0.5404337",
"0.5402025",
"0.5391755",
"0.53915256",
"0.5390641",
"0.5387424"
] |
0.82254606
|
0
|
Given a nested list of integers, return the sum of all integers in the list weighted by their depth. Each element is either an integer, or a list whose elements may also be integers or other lists. Example 1: Given the list [[1,1],2,[1,1]], return 10. (four 1's at depth 2, one 2 at depth 1)
|
def sum_depth ( x, weight = 1 )
sum = 0
x = [ x ] if x.is_a? Integer
x.each do | n |
if n.is_a? Array
sum += sum_depth( n, weight + 1 )
else
sum += n * weight
end
end
return sum
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def sum_nested_collection\n nested_numbers = [[1,2,3], [5,6,7,5], [9,10,13,6], [1]]\nend",
"def list_depth(list, depth = 0)\n return depth if !list.is_a?(Array)\n list.empty? ? depth + 1 : list.map { |l| list_depth(l, depth + 1) }.max\n end",
"def two_d_sum(arr)\n\ttotal = 0\n\n\t# 1st Level: Looking at each element (these are also arrays)\n\tarr.each do |sub_arr|\n\t\t# 2nd Level: Looking at each elements of these arrays\n\t\tsub_arr.each do |ele|\n\t\t\t# add each element to the total\n\t\t\ttotal += ele\n\t\tend\n\tend\n\n\treturn total\nend",
"def sum(list)\n\tif list.empty?\n\t\treturn 0\n\telsif (list.first.class == Array) == true\n\t\tfirst, *rest = list\n\t\treturn sum(first) + sum(rest)\n\telse\n\t\tfirst, *rest = list\n\t\treturn first + sum(rest)\n\tend\nend",
"def sum_numbers(root)\n return 0 if root.nil?\n nums = []\n inner_sum_numbers(root, 0, nums)\n nums.reduce(:+) #OR (&:+)\n#(5..10).reduce(:+) => 45\n# Same using a block and inject (5..10).inject { |sum, n| sum + n } => 45\n# Multiply some numbers(5..10).reduce(1, :*) => 151200\nend",
"def multi_dimensional_sum(arr)\n arr.flatten.sum\nend",
"def sum\n flatten.compact.inject(:+)\n end",
"def multi_dimensional_sum(arr)\n return arr.flatten.sum\nend",
"def multi_dimensional_sum(array)\n \n sum = 0\n\n # Make the array one dimensional, loop over the elements and add each of\n # them together into a counter.\n array.flatten.each do |num| \n sum += num\n end \n\n # Implicit return.\n sum\nend",
"def multi_dimensional_sum(array)\n array.flatten.sum\nend",
"def multi_dimensional_sum(array)\n array.flatten.sum\nend",
"def multi_dimensional_sum(array)\n result = array.flatten.inject { |single, ele| single + ele}\n result\nend",
"def deep_count(arr)\n count = 0\n arr.each do |el|\n if el.class != Array\n count += 1\n else\n count += 1 + deep_count(el)\n end\n end\n count\nend",
"def largestParentSum( node, depth )\n depth -= 1\n\n if node != nil \n sum = node.to_int\n else\n return 0\n end\n\n if depth <= 0\n return sum\n end\n \n if node.parents.size == 1\n sum + largestParentSum( node.parents.first, depth )\n else\n sum + [ largestParentSum( node.parents.first, depth ), largestParentSum( node.parents.last, depth ) ].max\n end\nend",
"def two_d_sum(arr)\n total = 0\n\n arr.each do |sub_array|\n sub_array.each do |num|\n total += num\n end\n end\n\n return total\nend",
"def two_d_sum(array)\n sum = 0 \n array.each do |sub_array|\n sub_array.each do |num|\n sum += num \n end\n end\n\n sum\nend",
"def two_d_sum(arr)\n\tsum = 0\n arr.each do |subArray|\n subArray.each do |i|\n sum += i\n end\n end\n return sum\nend",
"def two_d_sum(arr)\r\n totalSum = 0\r\n arr.each do |ele|\r\n partialSum = 0\r\n ele.each do |num|\r\n partialSum += num\r\n end\r\n totalSum += partialSum\r\n end\r\n return totalSum\r\nend",
"def traverse_json(item, ignored=nil)\n if item.is_a? Array\n item.map {|i| traverse_json(i, ignored)}.reduce(:+)\n elsif item.is_a? Hash\n item.values.include?(ignored) ? 0 : traverse_json(item.values, ignored)\n elsif item.is_a? Fixnum\n item\n else\n 0\n end\nend",
"def sumList(num)\n\tnum.inject(:+)\nend",
"def depth_helper(node, arr, depth)\n if node.left.nil? && node.right.nil? \n arr << depth\n return\n else \n depth += 1 \n if node.left\n depth_helper(node.left, arr, depth) \n end \n if node.right\n depth_helper(node.right, arr, depth)\n end \n end \n end",
"def sum_recurse(num)\n return 0 if num == 0\n num[0] + sum_recurse(num.delete(1))\nend",
"def recursive_sum(nums)\n return 0 if nums.empty?\n\n return nums.pop + recursive_sum(nums)\nend",
"def sum_recursion(arr)\n return 0 if arr.empty?\n sum = arr.shift\n sum += sum_of_array(arr)\n # 2 + sum_of_array([3])\n #3 + sum_of_array([])\n\n\nend",
"def total_depth(node, depth = 0)\n @d = depth\n @d = @d + 1 if node.children.size > 0\n node.children.map{|c| x = total_depth(c,@d) - 1; @d = x if x > @d }\n return @d\nend",
"def multi_dimensional_sum(array)\n array.flatten\nend",
"def sum_recursive(num)\n # can also compute sum with symbol (1..5).inject(:+)\n (1..num).inject { |sum, n| sum + n }\nend",
"def two_d_sum(arr)\ntotal = 0\n\narr.each do |sub_array|\n sub_array.each do |num|\n total += num\n end\nend\n\nreturn total\nend",
"def multi_dimensional_sum(array)\n\n puts \"With the built-in flatten method:\"\n puts array.flatten.inject { |acc, num| acc + num }\n\n puts \"With my flatten method:\"\n puts my_flatten(array).inject { |acc, num| acc + num}\n\n return \"----\"\n\nend",
"def two_d_sum(arr)\n sum = 0\n arr.each do | el1 |\n el1.each do | el2|\n sum = sum + el2\n end\n end\n puts\n return sum\nend",
"def flatten_array(arr)\n arr.each_with_object([]) do |item, flat|\n if item.is_a? Integer\n flat << item\n else\n flatten_array(item).each do |num|\n flat << num\n end\n end\n end\nend",
"def path_sum(root, sum)\n return [] if root.nil?\n result = []\n helper(root, sum, result)\n result\nend",
"def path_sum(root, sum)\n return [] unless root\n res = []\n path_sum_helper(root, sum, [], res)\n res\nend",
"def flatten(nested_array, result = [])\n nested_array.each do |integer|\n if integer.class == Array\n flatten(integer, result)\n else\n result << integer\n end\n end\n result\nend",
"def node_depths(root)\n sum_of_depths = 0\n stack = [{\"node\"=> root, \"depth\"=> 0}]\n\n while stack.length > 0\n node_info = stack.pop()\n node, depth = node_info[\"node\"], node_info[\"depth\"]\n if node.nil?\n next\n end\n sum_of_depths += depth\n stack.append({\"node\"=> node.left, \"depth\"=> depth + 1})\n stack.append({\"node\"=> node.right, \"depth\"=> depth + 1})\n end\n return sum_of_depths\n\nend",
"def multi_dimensional_sum(array)\n array.flatten! #convert 2d array into 1d array [[4,3,1][8,1][2]] -> [4,3,1,8,1,2]\n sum = 0\n i = 0\n while i < array.length\n sum+=array[i] #add and store array numbers into sum\n i+=1\n end\n return sum\nend",
"def sum_recur(array)\n#for array = []\n return 0 if array == []\n\n first_el = array.shift\n recursive_call = sum_recur(array)\n first_el + recursive_call\n\nend",
"def sum_children(records, parent, total = 0)\n return 0 if records[parent].nil?\n\n records[parent].each do |child, how_many|\n total += how_many\n total += how_many * sum_children(records, child)\n end\n total\nend",
"def multi_dimensional_sum(array)\n while !array.all? { |el| el.is_a?(Numeric) }\n array = unpack(array)\n end\n return array.sum\nend",
"def num_of_sums(num, list)\n # => divide and conquer\n helper(num, list, 0)\nend",
"def recursive_min_sum(head)\n current = head\n current.sum = current.value.to_i\n current.path = [current.value]\n\n unless current.left && current.right\n current.sum = current.value.to_i\n current.path = [current.value]\n current\n else\n left_child = recursive_min_sum(current.left)\n right_child = recursive_min_sum(current.right)\n min_child = left_child.sum < right_child.sum ? left_child : right_child\n current.sum += min_child.sum\n current.path += min_child.path\n current\n end\nend",
"def node_depths(root, depth = 0)\n if root.nil?\n return 0\n end\n\n return depth + node_depths(root.left, depth + 1) + node_depths(root.right, depth + 1)\nend",
"def sum(list1)\n list1.inject do |sum, ele|\n sum + ele\n end\n # sum\nend",
"def sum n\n\tbegin\n\tn.reduce(:+)\n\trescue \n\t\tn.map!{|x| x.is_a?(Array) ? x.reduce(:+) : x }\n\t\tsum n\n\tend\n\tp n.reduce(:+)\nend",
"def sum(list)\n sum = 0\n list.map do |item| \n sum += item\n end\n sum\nend",
"def total(list)\n list.reduce(:+)\nend",
"def recursive_sum(array)\n return array[0] if array.length == 1\n\n array[0] + recursive_sum(array[1..-1])\nend",
"def depth(ast, acc=1)\n if null?(ast)\n acc\n elsif pair?(car(ast))\n v = depth(car(ast), 1 + acc)\n depth(cdr(ast), [acc, v].max)\n else\n depth(cdr(ast), acc)\n end\nend",
"def flatten(data, level = 0)\n return [data] unless data.is_a?(Array) \n flat = []\n data.each do |ele|\n if ele.is_a?(Array)\n flat += flatten(ele, level + 1)\n else\n flat << ele\n end\n end\n flat\nend",
"def sum_recursively(num)\n return num if num == 0\n sum_recursively(num-1) + num\nend",
"def sum_recur(array)\n return 0 if array.empty?\n array.pop + sum_recur(array)\nend",
"def dfs(root, depth)\n return if root.nil?\n @f[depth] = @f[depth].to_i + root.val\n dfs(root.left, depth + 1) if root.left\n dfs(root.right, depth + 1) if root.right\nend",
"def digital_root(n)\n # Return number if it can't be reduced further\n return n if n.size == 1\n # Evaluate the sum of digits use recursion on the sum\n digital_root(n.to_s.chars.inject {|sum, n| sum.to_i + n.to_i })\nend",
"def path_sum(root, sum)\n path_sum_helper([], root, sum)\nend",
"def average_of_levels(root)\n level_values(root).map do |level|\n level.reduce(:+) / level.size.to_f\n end\nend",
"def total_of_array(array)\n array.inject(&:+)\nend",
"def find_weights(node_name,node_hash)\n node = node_hash[node_name]\n if(node[\"children\"])\n node[\"total_weight\"] = node[\"weight\"] + node[\"children\"].map{|c| find_weights(c,node_hash)}.inject(:+)\n else\n node[\"total_weight\"] = node[\"weight\"]\n end\n node[\"total_weight\"]\nend",
"def sum(list)\n\ttotal = 0\n list.each { |ele| total += ele }\n total\nend",
"def look_deeper contexts, deep, max_item_depth = 9, max_aspect_depth = 9, item_depth = 0\n unless item_depth == 0\n deep = look_wider contexts, deep, max_aspect_depth, 0\n deep[:row] += 1\n end\n deep[:indents] ||= []\n # deep[:numberings] ||= []\n deep[:indents ][deep[:row]] = item_depth || 0\n # deep[:numberings][deep[:row]] = self.class.numbering_list || []\n self.class.numbering_push\n unless (item_depth += 1) >= max_item_depth\n items.each do |item|\n self.class.numbering_increment\n deep = (item.recursive_ref || item).look_deeper contexts, deep, max_item_depth, max_aspect_depth, item_depth\n end\n end\n self.class.numbering_pop\n item_depth -= 1\n deep\n end",
"def my_sum(arr)\n arr.inject(:+)\nend",
"def sum_of_array(array)\n sum = 0\n array.each do |item|\n if item.is_a?(Integer) == true\n sum = sum + item\n else\n sum = sum + num_value(item)\n end\n end\n sum\nend",
"def inject_deep_flat(list, remaining_path, multiplicity)\n return inject_deep(list, remaining_path) if multiplicity == 0\n\n flat_input = list.flat_map { |v| v.nil? ? [] : v }\n flat_output = inject_deep_flat(flat_input, remaining_path, multiplicity - 1)\n item_index = -1\n list.map { |v| v&.map { flat_output[item_index += 1] } }\n end",
"def depth(ast, acc=1)\n if null?(ast)\n acc\n elsif pair?(car(ast))\n depth(cdr(ast), [acc, depth(car(ast), 1 + acc)].max)\n else\n depth(cdr(ast), acc)\n end\n end",
"def recursive_sum(array)\n if array.length == 0\n return 0\n end\n recursive_sum(array[1..-1]) + array.first\nend",
"def path_sum(root, sum)\n res = []\n dfs(root, res, [], sum)\n res\nend",
"def sums_all_elements(input)\n input.inject(:+)\n end",
"def sum_of_sums(int_arr)\n sum = 0\n current_numbers = []\n int_arr.each { |int|\n current_numbers << int\n sum += current_numbers.sum\n }\n sum\nend",
"def sub_sums(list)\n num = []\n list.length.times do |start|\n (start...list.length).each do |length|\n sub_array = list[start..(start + length)]\n num << sub_array.inject(:+)\n end\n end\n num.max\n end",
"def sum(arr)\n arr.inject(:+)\nend",
"def sum_of_arr(arr)\n arr.inject(:+)\nend",
"def sum_of_sums(ary)\r\n counter = 1\r\n ary.each_with_object([]) do |_, empty_ary|\r\n empty_ary << ary.first(counter).sum\r\n counter += 1\r\n end.sum\r\nend",
"def sub_sum(list)\n array = []\n (0...list.length).each do |idx1|\n (idx1...list.length).each do |idx2|\n array << list[idx1..idx2] #O(n)\n end\n end \n array.map {|sub| sub.length > 1 ? sub.sum : sub.first}.max\nend",
"def total(list)\n\n p list.reduce(:+)\n \nend",
"def total(nums)\n nums.inject(:+)\nend",
"def total(list)\n sum = 0\n for i in list\n sum += i\n end\n sum\nend",
"def sum_recur(array)\n sum = 0\n if array.empty?\n 0\n else\n sum = array.first\n sum += sum_recur(array.drop(1))\n sum\n end\nend",
"def find_smallest_sum(node)\n # traverse entire tree and keep track of smallest sums and return that sum\n # DFS\n return node.value if node.children.empty? # base case\n\n min_sum = Integer::MAX\n\n node.children.each do |child|\n sum = node.value + find_smallest_sum(child)\n min_sum = Math.min(sum, min_sum)\n end\n\n return min_sum\n\nend",
"def sum_rec(numbers)\n # base case\n return 0 if numbers.empty?\n # inductive step\n numbers[0] + sum_rec(numbers[1..-1])\nend",
"def sum_rec(numbers)\n return 0 if numbers.empty?\n num = numbers.pop\n num + sum_rec(numbers)\nend",
"def total_bags_inside\n children.size + children.map(&:total_bags_inside).sum\n end",
"def depth\n return 0 if nil?\n\n @accumulator_depth = 1\n depth_aux(self, @accumulator_depth)\n @accumulator_depth\n end",
"def sum(i) \n i.inject(:+)\nend",
"def sum_of array\n# add the numbers of the array, these are three different ways I found\n array.inject{ |sum, value| sum += value}\n # or\n # array.map(&:to_i).reduce(0, :+)\n # or\n # array.sum\nend",
"def sum_recur(array)\n #base case\n return 0 if array.empty?\n #iterative step\n array.first + sum_recur(array[1..-1])\nend",
"def children(target, rules)\n rule = rules[target]\n return 1 if rule.empty?\n\n sum = 1\n rule.each do |k, v|\n child_count = children(k, rules)\n sum += v * child_count\n end\n sum\nend",
"def sum_recur(array)\n return 0 if array.empty?\n dup = array.dup\n return dup[0] if dup.length == 1\n sum = dup.pop + sum_recur(dup)\n\nend",
"def sum_rec(nums)\n return 0 if nums.empty?\n nums[0] + sum_rec(nums[1..-1])\nend",
"def my_flatten_recursive \n results = []\n self.my_each do |ele|\n if ele.is_a? Array \n results.concat(ele.my_flatten_recursive)\n else \n results<< ele\n end\n end\n results\n\n end",
"def sum_items(array)\n # total = 0\n # array.each do |number|\n # total += number\n # end\n # total\n array.inject { |sum, num| sum + num }\nend",
"def sum(array_of_integers)\n # TODO\nend",
"def total(arr)\n arr.inject(:+)\nend",
"def two_d_sum(arr)\n i = 0\n sum=0\n while i < arr.length\n arr[i].each do |num|\n sum += num\n end\n\n i += 1\n end\n return sum\n\nend",
"def sum_array_iterative(arr)\n arr.inject(0) {|sum, el| sum + el}\nend",
"def sum(element)\n element.reduce(:+)\nend",
"def sum(nums)\n\treturn 0 if nums == []\n\tnums.reduce(:+)\nend",
"def sum_recur(array)\n return 0 if array.empty?\n array.first + sum_recur(array.drop(1))\nend",
"def sum(nums)\n nums.reduce(&:+)\nend",
"def sum_of_sums(array)\n total = 0\n loop do\n break if array.size == 0\n total += array.flatten.sum\n array.pop\n end\n total\nend",
"def RecursiveSum(arrayofNumbers) \n \n # Base Case: If the array is empty, return 0. \n \n if arrayofNumbers? \n return 0\n \n # Recursive code: Adding each element to the variable by calling the method. \n \n else\n Sum = arrayofNumbers.pop \n return Sum + RecursiveSum(arrayofNumbers) \n end\nend",
"def my_controlled_flatten(n)\n flattened = []\n\n self.each do |el|\n depth = 0\n if el.is_a?(Array)\n depth += 1\n flattened += el.my_flatten\n else\n flattened << el\n end\n end\n flattened\n end"
] |
[
"0.7259541",
"0.6403564",
"0.6190413",
"0.61393106",
"0.61237186",
"0.6052727",
"0.60513127",
"0.6027382",
"0.59915495",
"0.5952943",
"0.5952943",
"0.584366",
"0.58356076",
"0.5814014",
"0.5787257",
"0.57775086",
"0.5742661",
"0.5713105",
"0.57107484",
"0.57060844",
"0.5692195",
"0.56913656",
"0.5671996",
"0.56667477",
"0.5647783",
"0.56397194",
"0.56232166",
"0.56079143",
"0.5595875",
"0.55559903",
"0.55350983",
"0.55332977",
"0.55177885",
"0.5491277",
"0.54864174",
"0.5483186",
"0.54464716",
"0.54189694",
"0.54186004",
"0.5415555",
"0.54044163",
"0.5390063",
"0.5381705",
"0.53683096",
"0.53582865",
"0.5325078",
"0.53040165",
"0.5285498",
"0.527656",
"0.52701306",
"0.52529603",
"0.5248178",
"0.5224532",
"0.52203524",
"0.5205341",
"0.5193803",
"0.5193788",
"0.5184867",
"0.5181194",
"0.51719147",
"0.5170156",
"0.51642025",
"0.5153891",
"0.5151261",
"0.5151049",
"0.5149734",
"0.5144729",
"0.5143486",
"0.5130355",
"0.512447",
"0.51208496",
"0.5120523",
"0.5098869",
"0.5090025",
"0.50860196",
"0.5082578",
"0.5074426",
"0.5060013",
"0.505074",
"0.5048033",
"0.50470805",
"0.5043235",
"0.504279",
"0.5042043",
"0.5035594",
"0.5034603",
"0.50309956",
"0.50245225",
"0.50204504",
"0.5018414",
"0.5013063",
"0.5000578",
"0.49934638",
"0.49859208",
"0.49855706",
"0.4983188",
"0.4981693",
"0.4980186",
"0.49773973",
"0.49727243"
] |
0.8158782
|
0
|
This would save the user object with entered params in the DB
|
def create
@user = User.new(username: params[:username], email: params[:email], password: params[:password])
if @user.save
render json: {status: 'SUCCESS', message: 'Account successfully created', accessToken: @user.access_token}.to_json
else
render json: {errors: ["Sign up failed!"], status: 422}.to_json
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def save_obj params\r\n paramsh = {\r\n :user_id => params[:user_id],\r\n :name => params[:name], \r\n :subject => params[:subject],\r\n :tenant_uid => params[:tenant_uids]\r\n }\r\n update_attributes(paramsh)\r\n save!\r\n end",
"def save_user( args )\n user_id = args.delete( :user_id ) if args.has_key?( :user_id )\n user_name = args.delete( :user_name ) if args.has_key?( :user_name )\n \n row = {}\n if user_id and user_name\n row = { min_field( :user_id ) => user_id, min_field( :user_name ) => user_name }\n else\n row = { min_field( :user_name ) => user_name }\n end\n \n user = users.find_one( row, :fields => ['_id'] )\n return user['_id'] if user\n\n now = args[:created_at]\n row[min_field(:date_id)] = \"%4d%02d%02d\" % [now.year, now.month, now.day]\n \n users.save( row )\n end",
"def save(user)\n if valid?\n user.update(Hash[ATTRIBUTES.map { |attribute_name| [attribute_name, send(attribute_name.to_sym)] }])\n end\n end",
"def storeUser(param) \n @Handle.execute(\"INSERT INTO User(email,name,surname,nickname)\" +\n \" values ('#{param.Email}','#{param.Name}','#{param.Surname}','#{param.Nickname}')\")\n end",
"def save\n\t\t\tis_new = params[:user][:id].blank?\n\n # Get user\n\t\t\tuser = is_new ? User.new : User.find(params[:user][:id])\n\n # Author\n if is_new\n authorize! :create, User\n else\n authorize! :edit, user\n end\n\n # Save\n\t\t\tresult = user.save_with_params params[:user]\n\t\t\t\n\t\t\t# If error\n\t\t\treturn render json: result if result[:status] != 0\n\n\t\t\t# If signup\n\t\t\tif is_new\n\t\t\t\t# session_info = SessionInfo.find session[:session_info_id]\n\t\t\t\t# session_info.leave_infos ||= []\n\t\t\t\t# session_info.leave_infos << ['user', user.id]\n\t\t\t\t# session_info.save\n\n\t\t\t\t# Log\n\t\t\t\tLog.create(\n\t\t\t\t\tobject_type: 'user',\n\t\t\t\t\tobject_id: user.id,\n\t\t\t\t\taction: 'create'\n\t\t\t\t)\n\t\t\t\t\n\t\t\t\t# Delete contact\n\t\t\t\t# if contact.present?\n\t\t\t\t# \tcontact.update is_deleted: true\n\t\t\t\t# end\n\t\t\tend\n\n\t\t\t# Send active mail\n\t\t\tcase user.active_status\n\t\t\twhen 1\n\t\t\t\tUserMailer.active_account(user).deliver_later\n\t\t\twhen 2\n\t\t\t\tUserMailer.active_old_email(user).deliver_later\n\t\t\tend\n\n\t\t\trender json: { status: 0, result: user.id, email_changed: result[:email_changed] }\n\t\tend",
"def create\n @user = User.new(user_params)\n if @user.save\n redirect_to '/enter'\n puts \"User created & saved to db\"\n else\n redirect_to '/enter'\n puts \"User not saved\"\n end\n end",
"def signup!(params)\n self.email = params[:user][:email]\n self.name = params[:user][:name]\n self.password = params[:user][:password]\n #save_without_session_maintenance\n end",
"def save\n data = request.subset(:username, :password)\n id = request.params['id']\n\n if !id.nil? and !id.empty?\n user = User[id]\n\n if user.nil?\n flash[:error] = 'The specified user is invalid'\n redirect_referrer\n end\n\n success = 'The user has been updated'\n error = 'The user could not be updated'\n else\n user = User.new\n success = 'The user has been added'\n error = 'The user could not be added'\n end\n\n begin\n user.update(data)\n\n flash[:success] = success\n redirect(Users.r(:edit, user.id))\n rescue => e\n Ramaze::Log.error(e)\n\n flash[:error] = error\n flash[:form_errors] = user.errors\n flash[:form_data] = user\n\n redirect_referrer\n end\n end",
"def saveUser(name,description,email,phone,address)\n self.checkConnectMySQL() \n @connect.query(\"INSERT INTO users(name, description, email, phone, address) VALUES ( '#{name}', '#{description}', '#{email}','#{phone.to_s}','#{address}' )\") \n end",
"def create\n\t params[:user][:login] = params[:user][:email_work] if params[:user][:login].blank?\n user = params[:user]\n @user = User.create(user)\n @user.valid? ? after_save(user) : error_responds(@user)\n end",
"def save_user\n client = create_db_client\n client.query(\"INSERT INTO users(name, email, password, bio) VALUES('#{@name}', '#{@email}', '#{@password}', '#{@bio}')\")\n \n id = client.last_id\n rawData = client.query(\"SELECT * FROM users WHERE id='#{id}'\")\n users = Array.new\n rawData.each do |data|\n user = {:id => data[\"id\"], :name => data[\"name\"] ,:email => data[\"email\"], :password => data[\"password\"], :bio => data[\"bio\"]}\n users << user\n end\n response = Response.new('success', 'success input user', users)\n return response.response_api\n end",
"def save_user(user)\n contact = find(user.id)\n\n mapper.save(contact, user.attributes)\n end",
"def submit\r\n\t\t@user = @first_name, @last_name, @username, @password, @email\r\n\tend",
"def create\n @user = User.create(user_params)\n # @user.save ??\n redirect_to @user\n\n end",
"def signup!(params)\n self.username = params[:user][:username]\n self.email = params[:user][:email]\n save_without_session_maintenance\n end",
"def signup!(params)\n self.username = params[:user][:username]\n self.email = params[:user][:email]\n save_without_session_maintenance\n end",
"def create\n @user = User.new(user_params)\n puts(\"before looop\")\n respond_to do |format|\n if @user.save\n puts(\"inside looop\")\n #below not working for some reason\n # id = @user.id\n # puts (id)\n # puts(\"new user created\")\n # @band = Band.new\n # @band.update(:user_id => @user.id, :value => \"0.05\")\n format.html { redirect_to :show, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n fname = \"#{self.class.name}.#{__method__}\"\n super\n user=User.find_by_email(reg_params[:email])\n pars={}\n unless user.nil?\n pars[:name]=params[:user][:name]\n pars[:role]=params[:user][:role]\n user.update(pars) \n else\n user=User.new(params[:user])\n end\n LOG.debug(fname) {\"************************ current_user=#{user.inspect}\"}\n end",
"def user_obj\n puts \"\\nPlease enter your name: \\n \".colorize(:green).bold\n user_name = gets.strip.capitalize\n User.find_or_create_by(name: user_name)\n end",
"def create\n @user = User.new(user_params)\n @user[:points] = 100\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user = User.create( user_params )\nend",
"def create\n object={\n :name=>params[:name],\n :email=>params[:email],\n :uid=>params[:uid]\n }\n newUser=User.create(object)\n cookies[:current_user]=newUser.id\n redirect_to \"/home\"\n end",
"def submit\n if(session[:user_id] != nil)\n user = User.find_by_id(session[:user_id])\n \n user.update({\n email: params[:user][:email],\n zipcode: params[:user][:zipcode],\n bio: params[:user][:bio]\n })\n \n if user.errors.any?\n flash[:warning] = user.errors.full_messages.uniq\n redirect_to profile_edit_path and return\n else\n user.save!\n end\n \n redirect_to profile_path\n else\n redirect_to login_path\n end\n end",
"def create\n #@user = User.create(params[:user])\nend",
"def save_user(user)\n raise 'subclass must implement'\n end",
"def user_params #este metodo SE PUEDE LLAMAR COMO QUIERAS, pero es necesario para que al crear un objeto se autorice su creacion (porque si no nos podrían meter codigo malicioso)\n\t\tparams.require(:user).permit(:name, :email, :password)\n\tend",
"def add_to_database\n if self.valid?\n User.add({\"name\" => \"#{self.name}\"})\n else\n false\n end\n end",
"def user_params\n params.require(:user).permit(:name, :age, :email, :real_user)\n end",
"def save\n\t\t\tr = Episodey::DB::User.create(\n\t\t\t\t:name => self.name,\n\t\t\t\t:email => self.email\n\t\t\t)\n\t\t\t@id = r.id\n\t\t\treturn self\n\t\tend",
"def signup!(params)\n self.login = params[:user][:login]\n self.email = params[:user][:email]\n save_without_session_maintenance\n end",
"def set_user\n # @user = User.find_by_name create_params[:user_name]\n @user = User.find_by_name session_params[:user_name]\n end",
"def create\n @user = User.new(user_params)\n @user.owner_id = current_owner.id\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: '情報を登録しました' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def user_params\n params.require(:user).permit(:name, :surname, :position, :email, :town_id, :is_admin)\n end",
"def user_params\n params.require(:user).permit(:admin, :user_name, :email, :password, :password_confirmation, :pseudo, :age, :sexe, :pays, :description, :tournoi_id, :points, :win, :tie, :loose, :latitude, :longitude, :current_sign_in_ip, :ville, :adresse)\n end",
"def update\n\t\tthe_user_id = params[\"id\"]\n \tuser = User.find_by(:id => the_user_id)\n \tuser.first = params[\"first\"]\n \tuser.last = params[\"last\"]\n \tuser.email = params[\"email\"]\n user.phone = params[\"phone\"]\n user.add_l1 = params[\"add1\"]\n \tuser.city = params[\"city\"]\n \tuser.state = params[\"state\"]\n \tuser.zip = params[\"zip\"]\n \tuser.age = params[\"age\"]\n \tuser.save\n \tredirect_to show_lobbys_url\n\tend",
"def update\n user = User.find(params[:id])\n\n user.attributes = {\n name: params[:name]\n }\n\n user_save user\n end",
"def save(&block)\n Logger.d \"Saving user\"\n\n params = {\n :user => {\n :name => get(:name),\n :email => get(:email),\n :gcm_token => get(:gcm_token)\n }\n }\n\n # Merge any future params if they exist\n params.merge!(@future_params) if not @future_params.empty?\n\n Logger.d(\"Params for /user POST => #{params.to_json}\", \"#\")\n\n network_post(CONFIG.get(:user_save), nil, params.to_json, @on_api_call_failed) do |user_object|\n if is_valid_network_user_object?(user_object)\n empty_out_future_params\n @data = user_object\n Logger.d(\"Success in @user.save => \" + user_object.to_s)\n serialiaze() # Write the object to persistent storage\n after_save_actions() # Collection of util methods which need to execute when the user is saved on the server\n block.call(@data) \n end\n end\n end",
"def create\n @user = User.new(user_params)\n if @user.save \n Individual.create({:login => @user.login, :name => @user.name}).save \n log_in @user\n flash[:notice] = \"#{@user.name}, welcome to Objective Hiring\"\n redirect_to user_path @user\n else\n flash[:warning] = @user.errors.full_messages\n render 'new'\n end\n\n end",
"def add_profile(userinput)\n profile = Profile.create(name:userinput)\n profile.user_id = self.id\n profile.save\n profile\n end",
"def create\n @user = User.new(user_params)\n\n # save was requested by either current_user or else must be a new registration\n if @user.save(current_user)\n redirect_to users_path\n else\n render('new', status: :unprocessable_entity)\n end\n end",
"def store_user\n data = load_data\n user_details = {\n 'id' => @user.uid.to_s,\n 'username' => @user.username,\n 'password' => @user.password,\n 'playlist' => @user.playlist,\n 'mylist' => @user.mylist\n }\n data << user_details\n write_user(data)\n end",
"def create\n \n @user = User.new(params[:user])\n @user.committee=(params[:committee])\n @user.phone=0\n @user.area=(params[:area])\n @user.role=(params[:role])\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n \n end",
"def create\n \t# puts('********')\n \t# puts(params)\n \t\n \tUser.create(user_params)\n\n \tredirect_to action: 'index'\n end",
"def register\n @user = User.new(user_id: params[:user_id], password: params[:password])\n @user.save\n end",
"def create\n # AR model which will interact with our database and create a new user\n user = User.new(user_params)\n saveUser = user.save\n \n if saveUser\n session[:user_id] = user.id\n redirect_to '/'\n else\n redirect_to '/signup'\n end\n end",
"def user_params\n params.require(:user).permit(:user_name, :password, :email, :name, :address, :dob, :age, :points, :admin)\n end",
"def add_user params\n validate_and_store :user, {:state => 'user'}.merge(params)\n end",
"def save\n CONNECTION.execute(\"UPDATE users SET name = '#{self.name}' WHERE id = #{self.id};\")\n end",
"def user_params\n params.require(:user).permit(:id, :first_name, :last_name, :email, :username)\n end",
"def user_params_upd\n params.require(:user).permit(:name, :date_of_birth, :bio, :has_muggle_relatives, :password,\n :password_confirmation)\n end",
"def user_params #defines what user attributes can be edited and accessed by the user\n params.require(:user).permit(:name, :email, :password, :password_confirmation)\n end",
"def create\n # creates a new user with attributes params[:user]\n @user = User.create params[:user]\n\n # redirect to show action\n redirect_to @user\n end",
"def create\n\n #.create is a method we get from AR.\n #it returns a new object in local memory with the specified params\n #it then saves the hash object in the database.\n @user = User.create user_params\n if @user.save\n session[:user_id] = @user.id.to_s\n flash['alert-success'] = \"You have been registered #{@user.username}, please login.\"\n redirect_to new_session_path\n else\n flash['alert-warning'] = 'Unable to create a user account.'\n redirect_to new_user_path\n end\n end",
"def user_params\n params.require(:user).permit(:name, :last_name, :age, :email, :notes)\n end",
"def set_user\n @user = User.find_by_external_id(params[:id])\n @user = User.create!(name: params[:name], email: params[:email], external_id: params[:external_id]) unless @user\n end",
"def update\n params[\"user\"].each do |key, value| \n value.strip!\n if value == \"\"\n params[\"user\"].delete(key)\n end\n end\n \n params[\"user\"][\"email\"].downcase!\n \n @prev_user_info = User.find_by_id(params[\"user\"][\"id\"])\n existing_user = User.find_by_id(params[\"user\"][\"id\"])\n \n if !params[\"user\"][\"password_hash\"].blank?\n existing_user.password = params[\"user\"][\"password_hash\"]\n end\n\n if existing_user.update_attributes(params[\"user\"])\n @object = existing_user\n \n render \"user_success\"\n\n else\n @error_messages = existing_user.errors.to_a\n @user = User.new\n @new_item = User.find_by_id(params[\"id\"])\n\n render \"edit\"\n end\n end",
"def create\n return request_sreg unless params[:user][:identity_url].blank? || !params[:commit].eql?('Load from OpenID')\n logout_keeping_session! unless logged_in? && current_user.is_administrator?\n @object = User.new(params[:user])\n # Add attributes not available to mass-assign\n login = params[:user][:login]\n identity_url = params[:user][:identity_url]\n @object.login = (login.blank? ? nil : login)\n @object.identity_url = (identity_url.blank? ? nil : identity_url)\n success = @object && @object.valid?\n @object.save! if success\n # the normal case of user signup\n @object.register! if success && params[:activate].to_i != 1\n # special case for administrators creating accounts\n if success && params[:activate].to_i == 1 && (logged_in? && current_user.is_administrator?)\n @object.activate!\n create_change_log_entry(@object.id, nil, 'activate', 'Automatic user activation on create.')\n end\n respond_to do |format|\n if success && @object.errors.empty?\n if logged_in? && current_user.is_administrator?\n flash[:notice] = 'The account has been created!'\n create_change_log_entry\n format.html { redirect_to(users_path) }\n format.xml { render :xml => @object, :status => :created, :location => @object }\n else\n flash[:notice] = 'Your account has been created! Please check your email, to complete the activation process.'\n create_change_log_entry(@object.id, @object.id)\n format.html { redirect_to(login_path) }\n format.xml { render :xml => @object, :status => :created, :location => @object }\n end\n else\n flash.now[:error] = \"We couldn't set up your account, sorry. Please try again, or contact the site administrator.\"\n format.html { render :action => 'new', :template => 'users/form' }\n format.xml { render :xml => @object.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def user_params\n params.require(:user).permit(:name, :email, :password, :cellphone, :landphone, :address, :bonus, :gender, :current_order_id)\n end",
"def create_user\n # provide the interface asking for name, destination and duration\n # then, create and store the User object\n end",
"def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n @user.update(:points => \"100\", :points_at_stake => \"0\")\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_user(user_hash={})\n @user = User.new(user_hash)\n @user.save\n end",
"def create_user(user_hash={})\n @user = User.new(user_hash)\n @user.save\n end",
"def create\n house = House.new(house_params)\n current_user.house = house\n current_user.save\n redirect_to root_path\n end",
"def user_params\n params.require(:user).permit(:nickname, :headimgurl, :sex, :birthday, :desc, :area)\n end",
"def create\n\t\t\t\t@user = User.create!(create_user_params)\n\t\t\tend",
"def user_params\n params.require(:user).permit(:surname, :name,\n :patronymic, :date_employment,\n :phone, :login,\n :password, :email,\n :position_id)\n end",
"def user_params\n params.require(:user).permit(:firstName, :lastName, :email, :password, :password_confirmation, :userType, :dob, :bio)\n end",
"def create\n @user = User.new(\n first_name: params[:first_name],\n last_name: params[:last_name],\n birth_date: params[:birth_date],\n height: params[:height],\n weight: params[:weight],\n user_name: params[:user_name],\n password: params[:password],\n password_confirmation: params[:password_confirmation],\n facebook_url: params[:facebook_url],\n twitter_url: params[:twitter_url],\n instagram_url: params[:instagram_url],\n address: params[:address],\n email: params[:email]\n ) \n if @user.save!\n render 'successful.json.jb', status: :created\n else\n render 'unsuccessful.json.jb', status: :bad_request\n end\n end",
"def user_params\n params.require(:user).permit(:email, :password, :name, :username, :user_data_type, :user_data_id, :birth, :gender, :cellphone, :scorepunctuality, :scorefairplay, :scorepunctuality, :score_skill)\n end",
"def user_params\n params.require(:user).permit(:username, :password, :role, :session_key, dato_attributes:[:nombre, :apellido, :mail, :edad, :user_id] )\n end",
"def create\n @user = User.new(user_params)\n\n\n respond_to do |format|\n if @user.save\n require 'pg'\n conn = PG::Connection.open(ENV['DATABASE_URL'])\n @res = conn.exec_params(\"INSERT INTO salesforce.contact (lastname, hd_password__c, email, birthdate) VALUES ('#{@user.name}','#{@user.password}','#{@user.email}','#{@user.birthday}')\")\n conn.close\n\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save\n CONNECTION.execute(\"UPDATE users SET email = '#{self.email}', password = '#{self.password}' WHERE id = #{self.id};\")\n \n return self\n end",
"def user_params\n params.require(:user).permit(:email, :name, :birthday,:address, :postal_code, :password)\n end",
"def create\n p params\n @user = User.create(user_params)\n redirect_to @user\n end",
"def create\n p params\n @user = User.create(user_params)\n redirect_to @user\n end",
"def user_params\n params.permit(:fname, :lname, :email, :username, :birthday, :type_id,:password)\n end",
"def user_params\n params.require(:user).permit(:id, :name, :user_id)\n end",
"def user_params\n params.require(:user).permit(:classificacion, :status, :dateofbirth, :email, :active, :anonymous, :webmaster, :userid, :lastname, :name, :address1, :address2, :address3, :geo_address, :longitude, :latitude, :phone1, :phone2, :avatar )\n end",
"def user_params\n params.require(:user).permit(:nome, :registro, :cargo, :email, :pin)\n end",
"def update_user(user_params)\n @user.update(user_params)\n create_return_object()\n end",
"def updateUserNew\n user = current_user\n name = params[:name]\n phone = params[:phone]\n address = params[:address]\n user.update(name: name, phone: phone, address: address)\n redirect_to students_path\n end",
"def update\n super\n\n @user = current_user\n @user.latitude = params[:user][:latitude]\n @user.longitude = params[:user][:longitude]\n @user.save\n end",
"def user_params\r\n params.require(:user).permit(:user_id, :title, :body, :password_confirmation, :password, :perimission_level,:email,:name,:score)\r\n end",
"def user_params\n params.require(:user).permit(:name, :lastname, :email, :password, :city, :password_confirmation, :phone , :set , :aup, :tos)\n end",
"def create\n @user = User.new(params[:user])\n redirect_to @user if @user.save\n end",
"def save\n\t\tbegin\n\t\t\tuser_profile = self.profile\n\t\t\tUser.create(\n\t\t\t\t:user_id => id,\n\t\t\t\t:login_name => username,\n\t\t\t\t:email => email,\n\t\t\t\t:join_tsz => created,\n\t\t\t\t:transaction_buy_count => user_profile.transaction_buy_count,\n\t\t\t\t:transaction_sold_count => user_profile.transaction_sold_count,\n\t\t\t\t:is_seller => user_profile.is_seller,\n\t\t\t\t:location => user_profile.lon ? [user_profile.lon, user_profile.lat] : nil,\n\t\t\t\t:image_url => user_profile.image,\n\t\t\t\t:country_id => user_profile.country_id,\n\t\t\t\t:gender => user_profile.gender,\n\t\t\t\t:oauth_token => nil,\n\t\t\t\t:oauth_token_secret => nil,\n\t\t\t\t:authenticated => false,\n\t\t\t\t:shop_id => @shop_id\n\t\t\t)\n\t\trescue NoMethodError\n\t\t\t# fairly rare at this point.\n\t\t\tputs \"associated_profile bug\"\n\t\tend\n\tend",
"def create\n\t\t\t\t@user = User.new(user_params)\n\t\t\t\t@user.date_created = Time.now\n \n\t\t\t\t@user.creator= session[:user_id]\n\t\t\t\t@user.save\n\t\t\t\t @active = User.find(session[:user_id]).try :touch\n\t\t\t\t@system = System.all\n\t\t\t\t@creator = User.all\n\t\t\t\t@person = Person.all\n respond_to do |format|\n if @user.save\n\n format.html { redirect_to @user, adduser: \"User #{(@user.username).capitalize} was successfully created.\" }\n format.json { render :show, status: :created, location: @user }\n else\n\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def user_params\n params.require(:user).permit(:id, :first_name, :last_name, :email, :password, :password_confirmation, :username, :date, :assay_mat, :role_id, :company_id, :parent_id)\n end",
"def update\n \n @user = User.find(params[:id])\n \n bSave = true\n \n if(bSave)\n bSave = @user.update_attribute(:bio,params[:user][:bio])\n end\n \n if(bSave)\n bSave = @user.update_attribute(:location,params[:user][:location])\n end\n \n if(bSave)\n bSave = @user.update_attribute(:first_name,params[:user][:first_name])\n end\n \n if(bSave)\n bSave = @user.update_attribute(:last_name,params[:user][:last_name])\n end\n if(bSave)\n bSave = @user.update_attribute(:name,params[:user][:name])\n end\n \n if(bSave)\n bSave = @user.update_attribute(:email,params[:user][:email])\n #@user.email = params[:user][:email]\n #bSave = @user.save\n end\n \n #debugger\n respond_to do |format|\n if bSave\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def addUser #POST\n if params[:type].present? && params[:name].present? && params[:email].present? && params[:dob].present? \n if params[:type]==\"addUser\"\n @user = User.new\n @user.name = params[:name]\n @user.email = params[:email]\n @user.dob = params[:dob]\n @user.gender = params[:gender]\n @user.fb_token = params[:fb_token]\n @user.fb_id = params[:fb_id]\n @user.token_expiry = params[:token_expiry]\n if @user.save\n # Success Message\n print \"Sucess!\"\n render :json => { :status => :ok, :message => \"Success!\", :description => \"Saved\"}\n else\n # Fail-Save Error\n print \"Fail!\"\n render :json => { :status => :ok, :message => \"Fail!\", :description => \"Unable to save\"}\n end\n else\n # Wrong Type Error\n render :json => { :status => :ok, :message => \"Fail!\", :description => \"Wrong Type\"}\n print \"Wrong Type!\"\n \n end\n else\n # Missing Attribute Error\n render :json => { :status => :ok, :message => \"Fail!\", :description => \"Missing Attribute\"}\n print \"Missing Attribute!\"\n end\n end",
"def user_new_params\n\t\tparams.require(:user).permit(:email, :displayName, :oauth, :password, :setting_id)\n\tend",
"def save(user: nil)\n Driver::Helpers.required_arguments %i[user], binding\n Driver::Exceptions.raise_unless_argument_error? user, User\n\n p = Driver::Page.create entries: [fields.to_h], xmlns: fields.xmlns\n\n if id\n response = Services::Data.put user: user, service: service, endpoint: endpoint, page: p\n else\n raise ArgumentError, \"service is a required keyword\" unless service\n raise ArgumentError, \"endpoint is a required keyword\" unless endpoint\n\n response = Services::Data.post user: user, service: service, endpoint: endpoint, page: p\n end\n\n response\n end",
"def user_params(parameters)\n params.require(:user).permit(:firstname, :lastname, :phone, :address, :enable, :weight, :latitude, :longitude, :alone, :description)\n end",
"def create\n user = User.new( first: params[:first],\n last: params[:last],\n username: params[:username],\n password: params[:password])\n if user.save\n flash[:notice] = \"Good job!\"\n redirect_to :root\n else\n flash[:alert] = \"Oops, no bueno\"\n redirect_to :back\n end\n end",
"def user_params\n params.require(:user).permit(:id, :firstName, :lastName, :email)\n end",
"def create\n @user = User.new(user_params)\n @user.user_id = current_user.id\n\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'user was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def user_params\n params.require(:user).permit(:id, :name, :sex, :year, :date, \n :password, :password_confirmation, :email)\n end",
"def create\n @user = User.new(params.require(:user).permit(:first_name,:last_name,:email,:password,:password_confirmation,:profile_pic))\n if @user.save\n redirect_to '/mainpage'\n else\n redirect_to '/signup' \n end\n end",
"def save\n vals = to_h\n vals.delete(:username)\n vals.delete_if { |_k, v| v.nil? || v.to_s.empty? }\n vals[:password] = vals.delete(:newpassword) if vals[:newpassword]\n payload = Gyoku.xml(user: vals)\n response = CoachClient::Request.put(url, username: @username,\n password: @password,\n payload: payload,\n content_type: :xml)\n unless response.code == 200 || response.code == 201\n fail CoachClient::NotSaved.new(self), 'Could not save user'\n end\n @password = vals[:password]\n @newpassword = nil\n self\n end",
"def user_params\n params.require(:user).permit(:first_name, :last_name, :email, :password, :phone_number, :player_id, :remarks, :isactive, :deleted_at, :role_id, :user_type_id)\n end",
"def user_params\n params.require(:user).permit(:email, :name, :birthdate, :address, :postal_code, :password)\n end"
] |
[
"0.760077",
"0.7200834",
"0.7035687",
"0.7007495",
"0.68859005",
"0.68464035",
"0.68027",
"0.67970026",
"0.67680115",
"0.67669207",
"0.6752035",
"0.6732302",
"0.6708863",
"0.67057824",
"0.6704783",
"0.6704783",
"0.659785",
"0.6595161",
"0.65949905",
"0.65863216",
"0.65788954",
"0.6570514",
"0.6569161",
"0.6552632",
"0.65443087",
"0.6539429",
"0.6524158",
"0.6510943",
"0.6507196",
"0.6481326",
"0.64772075",
"0.6476973",
"0.64720225",
"0.6468374",
"0.6465948",
"0.6459071",
"0.64541537",
"0.64519066",
"0.64474815",
"0.6446826",
"0.6444184",
"0.64351064",
"0.64290565",
"0.6427353",
"0.6420467",
"0.6409925",
"0.6402639",
"0.63954854",
"0.63934046",
"0.63882726",
"0.638697",
"0.6385896",
"0.6380274",
"0.63789785",
"0.6378028",
"0.6375636",
"0.63722664",
"0.6369554",
"0.63683444",
"0.6367449",
"0.63661206",
"0.63661206",
"0.6363918",
"0.63617384",
"0.6358787",
"0.63576275",
"0.634922",
"0.63483953",
"0.6348223",
"0.6346303",
"0.63462394",
"0.6344295",
"0.6342931",
"0.6342892",
"0.6342892",
"0.6340535",
"0.63397276",
"0.63353866",
"0.63322645",
"0.6329242",
"0.63270855",
"0.6325491",
"0.63246506",
"0.6322119",
"0.6320607",
"0.63184386",
"0.6316834",
"0.6309486",
"0.6308707",
"0.6308631",
"0.6306372",
"0.6305066",
"0.6298302",
"0.62968445",
"0.629171",
"0.6291681",
"0.62908083",
"0.6283637",
"0.62813896",
"0.6278981",
"0.62783444"
] |
0.0
|
-1
|
This updates user params
|
def update
if @user.update(username: params[:username], email: params[:email], password: params[:password])
render json: {status: 'SUCCESS', message: 'Account successfully updated', accessToken: @user.access_token}.to_json
else
render json: { errors: ['Update unsuccessful!'], status: 422 }.to_json
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def user_params_upd\n params.require(:user).permit(:name, :date_of_birth, :bio, :has_muggle_relatives, :password,\n :password_confirmation)\n end",
"def modify_user_params(attrs)\n attrs\n end",
"def update\n puts \"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\"\n puts params\n puts \"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\"\n @user = current_user\n @user.update_attributes(user_params)\n current_user.save\n render_wizard @user\n end",
"def update\n @current_user.update user_params\n redirect_to root_path\n end",
"def update_user(username, params)\n\t\t\t\tif @session['datastore'].has_key?(username)\n\t\t\t\t\t@session['datastore'][username] = params\n\t\t\t\tend\n\t\t\tend",
"def update!(**args)\n @user_info = args[:user_info] if args.key?(:user_info)\n end",
"def update\n @user = User.find(params[:id])\n ####\n @user.status = params[:user][:status] if is_admin?\n params[:user].delete(:status )\n #pp = params[:user].merge(:password => '1' )\n \n logger.info(params[:user])\n #####\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n modified_params = user_params\n modified_params.delete(\"password\") if modified_params[\"password\"].empty?\n if @user.update(modified_params)\n @users = current_user.users\n end\n end",
"def update\n\t\t@user = User.find(params(:id))\n\t\t@user.update(user_params)\n\tend",
"def user_params_update\n params.permit(:name, :profile_id)\n end",
"def update\n params[\"user\"].each do |key, value| \n value.strip!\n if value == \"\"\n params[\"user\"].delete(key)\n end\n end\n \n params[\"user\"][\"email\"].downcase!\n \n @prev_user_info = User.find_by_id(params[\"user\"][\"id\"])\n existing_user = User.find_by_id(params[\"user\"][\"id\"])\n \n if !params[\"user\"][\"password_hash\"].blank?\n existing_user.password = params[\"user\"][\"password_hash\"]\n end\n\n if existing_user.update_attributes(params[\"user\"])\n @object = existing_user\n \n render \"user_success\"\n\n else\n @error_messages = existing_user.errors.to_a\n @user = User.new\n @new_item = User.find_by_id(params[\"id\"])\n\n render \"edit\"\n end\n end",
"def update_user\n end",
"def update\n @update_success = @user.update(user_params)\n super\n end",
"def user_params_upd_for_admins\n params.require(:user).permit(:name, :email, :date_of_birth, :bio, :has_muggle_relatives, :house, :password,\n :password_confirmation)\n end",
"def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end",
"def conditionally_update\n return true unless params[:user]\n @user.update(user_params)\n end",
"def update\n @user = User.update(user_params)\n end",
"def update\n @user = User.find(params[:id])\n\n update_protected_attrs_from_params(:user, :login, :active) do |p|\n @user.attributes = p\n @user\n end\n \n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to([:admin, @user]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def updateUser\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/\"+@current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end",
"def update\n @user.update_attributes!(user_params)\n \n render nothing: true, status: :no_content\n end",
"def update\n # check_user \n get_preferences\n include_role_name\n if @user.update(user_params)\n render json: {\n status: \"Success\",\n message: \"User updated.\",\n data: {\n user: @user,\n preferences: { \n city: @cities,\n rent: @rents,\n stay_period: @stay_periods,\n property_type: @property_types\n },\n role: @role\n }\n }, status: :ok\n else\n render json: {\n status: \"Error\",\n message: \"User not updated.\",\n data: @user.errors\n }, status: :unprocessable_entity\n end\n end",
"def update\n \tnew_params = user_params.delete_blanks!\n\n \trespond_to do |format|\n if @user.update_attributes(new_params)\n \tformat.html { redirect_to edit_user_path(@user.id), notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\nend",
"def update_user_params(params)\n if params[:reassign_user].present?\n if (params[:user_type] == \"CommonPoolAgent\" or params[:user_type] == \"ClusterUsers\") and params[:task][:assigned_to_user_id] ==\"\"\n params[:task].delete(:assigned_to_user_id)\n elsif (params[:user_type] == \"CommonPool\")\n params[:task].merge!(:assigned_to_user_id => \"\")\n end\n unless params[:task][:assigned_to_user_id].blank?\n params[:task][:assigned_by_user_id] = current_user.id\n end\n else\n params[:task].delete(:assigned_to_user_id)\n end\n params\n end",
"def update_params\n raise 'Sovrascrivi in figli'\n end",
"def update\n @user = current_user\n @user.update_attributes(user_params)\n redirect_to root_path\n end",
"def update\n # only update the values that have things filled in\n updatedValues = params[:user]\n updatedValues.keep_if { |key, value| !value.blank? }\n\n respond_to do |format|\n if @user.update_attributes(updatedValues)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def user_params\n params.permit(User::UPDATABLE_ATTRIBUTES)\n end",
"def update\n @current_user = User.find( params[:id] )\n @current_user.update!( user_params )\n redirect_to user_path( @current_user.id )\n end",
"def process_params!(params)\n #params.dup.update(user: current_user)\n params.merge!(current_user: current_user)\n end",
"def update\n if @user.update(user_params)\n redirect_to root_path\n else\n flash[:error] = \"bad params\"\n end\n end",
"def update!(**args)\n @user_name = args[:user_name] if args.key?(:user_name)\n end",
"def update!(**args)\n @user_name = args[:user_name] if args.key?(:user_name)\n end",
"def update_user(**params)\n params.merge!(id: existing_user.id)\n api_query(query, variables: params)\n end",
"def update\n respond_to do |format|\n\n # below line calls a function, user_param(). user_param() does the validation. it sees whether the user entered the correct params. We dont't want the current user to put any params and do a request. only correct params should be allowed\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def updated_profile\n \n @user = User.find_by_id(session[:user_id])\n \n @user.name = params[:user][:name]\n @user.email = params[:user][:email]\n @user.address = params[:user][:address]\n @user.city = params[:user][:city]\n @user.pincode = params[:user][:pincode]\n @user.state = params[:user][:state]\n @user.contact_no = params[:user][:contact_no]\n\n if @user.save\n flash[:notice] = \"Changes Updated Successfully\"\n redirect_to :action => \"admin_profile\"\n else\n flash[:notice] = \"Changes are not updated\"\n end # if @user.save\n\n end",
"def update\n @user = current_user\n @user.status = params[:user][:status]\n @user.save\n redirect_to :root\n end",
"def update\n\t\tparams[:user][:email] = params[:user][:email].strip\n\t\tparams[:user][:name] = params[:user][:name].strip\n\t\tputs params\n\t\tif @user.update_attributes(user_params)\n\t\t\tflash[:success] = \"Profile updated\"\n\t\t\tredirect_to edit_user_path\n\t\telse\n\t\t\trender 'edit'\n\t\tend\n\tend",
"def update_user(user_params)\n @user.update(user_params)\n create_return_object()\n end",
"def update_user_params\n\t\tparams.require(:user).permit(:email,:first_name,:last_name)\n\tend",
"def update_user_params\n\t\tparams.require(:user).permit(:email,:first_name,:last_name)\n\tend",
"def update\n super\n\n @user = current_user\n @user.latitude = params[:user][:latitude]\n @user.longitude = params[:user][:longitude]\n @user.save\n end",
"def update!(**args)\n @user_id = args[:user_id] if args.key?(:user_id)\n end",
"def update!(**args)\n @user_id = args[:user_id] if args.key?(:user_id)\n end",
"def update!(**args)\n @user_id = args[:user_id] if args.key?(:user_id)\n end",
"def update\n\t\tthe_user_id = params[\"id\"]\n \tuser = User.find_by(:id => the_user_id)\n \tuser.first = params[\"first\"]\n \tuser.last = params[\"last\"]\n \tuser.email = params[\"email\"]\n user.phone = params[\"phone\"]\n user.add_l1 = params[\"add1\"]\n \tuser.city = params[\"city\"]\n \tuser.state = params[\"state\"]\n \tuser.zip = params[\"zip\"]\n \tuser.age = params[\"age\"]\n \tuser.save\n \tredirect_to show_lobbys_url\n\tend",
"def update\n @user.update(user_params_update)\n json_response(@user)\n end",
"def update!(**args)\n @deleted_user = args[:deleted_user] if args.key?(:deleted_user)\n @known_user = args[:known_user] if args.key?(:known_user)\n @unknown_user = args[:unknown_user] if args.key?(:unknown_user)\n end",
"def user_params\r\n end",
"def update\n # this finds the current user\n @user = User.find params[:id]\n # just setting the variable 'p' to user_params\n p = user_params\n # here we are checking to see if the user updated some\n # part of their info, but didn't enter anything for password.\n # we infer from this that they weren't trying to update their\n # password, and so this method removes the password from the\n # params that we pass into the update method.\n if user_params[:password].blank?\n p.delete(:password)\n p.delete(:password_confirmation)\n end\n # this updates what the user changed?\n @user.update! p\n # flash message after they have updated info\n flash[:notice] = \"Successful update\"\n # redirects the user to their newly update profile?\n redirect_to user_path(@user)\n end",
"def update \n @current_user.update(user_params)\n render json: @current_user\n end",
"def update\n user = User.find(params[:id])\n\n user.attributes = {\n name: params[:name]\n }\n\n user_save user\n end",
"def update\n @user = current_user\n @user.attributes = params[:user]\n render_wizard @user\n end",
"def user_params\n if (params[:action] == \"update\")\n params.require(:user).permit(:email, :level, :name, :gravatar_email, :lang, :change_password)\n elsif (params[:action] == \"save_preferences\")\n # Password update\n if (params[:mode] == \"password\")\n params.require(:user).permit(:password, :password_confirmation, :current_password)\n else # General preferences update\n params.require(:user).permit(:email, :name, :gravatar_email, :lang, :current_password)\n end\n else\n params.require(:user).permit(:email, :level, :name, :gravatar_email, :lang)\n end\n end",
"def update\n if not params[:id]\n redirect_to root_path\n end\n user = User.find(params[:id])\n # update fields\n user.first_name = user_params[:first_name]\n user.last_name = user_params[:last_name]\n user.age = user_params[:age]\n user.education = user_params[:education]\n user.school = user_params[:school]\n user.expertise = user_params[:expertise]\n user.description = user_params[:description]\n user.availability = user_params[:availability]\n user.save\n \n # update complete flag\n if not user.complete\n all_fields_filled = true\n user_params.each do |k, v|\n if v.blank?\n all_fields_filled = false\n end\n end\n if all_fields_filled \n user.complete = true\n user.save\n else\n flash[:warning] = \"Some profile information is still missing. Please fill out the missing fields so that we can determine the best projects for you!\"\n end\n\n if not flash[:warning]\n flash[:notice] = \"Profile was successfully updated.\"\n end\n end\n\n redirect_to user_path(params[:id])\n end",
"def update_user(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'UpdateUser'\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? :new_comments\n\t\t\targs[:query]['NewComments'] = optional[:new_comments]\n\t\tend\n\t\tif optional.key? :new_display_name\n\t\t\targs[:query]['NewDisplayName'] = optional[:new_display_name]\n\t\tend\n\t\tif optional.key? :new_email\n\t\t\targs[:query]['NewEmail'] = optional[:new_email]\n\t\tend\n\t\tif optional.key? :new_mobile_phone\n\t\t\targs[:query]['NewMobilePhone'] = optional[:new_mobile_phone]\n\t\tend\n\t\tif optional.key? :new_user_name\n\t\t\targs[:query]['NewUserName'] = optional[:new_user_name]\n\t\tend\n\t\tif optional.key? :user_name\n\t\t\targs[:query]['UserName'] = optional[:user_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def update\n\t\tif current_user._id == user_params[:id]\n\t\t\t@user = User.find_by(:id => user_params[:id])\n\t\t\t@user.update({\n\t\t\t\tfirst_name: user_params[:first_name],\n\t\t\t\tlast_name: user_params[:last_name],\n\t\t\t\tphone_number: user_params[:phone_number],\n\t\t\t\tfacebook_link: user_params[:facebook_link],\n\t\t\t\tcar_model: user_params[:car_model],\n\t\t\t\tlicense_plate: user_params[:license_plate]\n\t\t\t})\n\t\t\t@user.save!\n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\tuser: @user\n\t\t\t}, status: 200\n\t\telse\n\t\t\trender json: {\n\t\t\t\tstatus: 'error',\n\t\t\t\tmessage: 'You are not authorized to edit this field!'\n\t\t\t}, status: 422\n\t\tend\n\tend",
"def updateUserNew\n user = current_user\n name = params[:name]\n phone = params[:phone]\n address = params[:address]\n user.update(name: name, phone: phone, address: address)\n redirect_to students_path\n end",
"def custom_update\n user = User.find(params[:id])\n user.update_attributes(params[:user])\n render :text => true\n end",
"def update\n user = find_user\n user.update!(user_params)\n render json: user\n end",
"def update\n @user = User.find(params[:id])\n if @user.update_attributes(params.require(:user).permit(:username, :email))\n redirect_to users_path\n else\n render 'edit'\n end\n end",
"def update\n @user = @current_user\n\n if user_params[:name].strip.empty?\n @user.name = \"Murakami\"\n end\n\n if @user.update user_params\n if user_params[:image_url]\n req = Cloudinary::Uploader.upload( user_params[:image_url])\n @user.image_url = req[\"url\"]\n end\n @user.save\n redirect_to root_path\n else\n render :edit\n end\n end",
"def set_params\n params[:user] = params[:account]\n end",
"def update\n @user = User.find(params[:id])\n redirect_to user_path @user if @user.update(permit_update_params)\n end",
"def update\n @user = User.find(params[:id])\n logger.tagged(\"update current user: \") {logger.debug @current_user.attributes}\n can_edit_hash = Permissions.currentLoggedInOrHasMorePermissions(@current_user,@user)\n logger.tagged(\"update user perm hash: \") {logger.debug can_edit_hash}\n if can_edit_hash[:has_permission]\n user_params = params[:user]\n logger.tagged(\":user\") {logger.debug user_params}\n @user.first_name = user_params[:first_name]\n @user.last_name = user_params[:last_name]\n @user.email = user_params[:email]\n @user.phone_number = user_params[:phone_number]\n @user.password_confirmation = @user.password\n\n can_change_roles_hash = Permissions.hasMorePermissions(@current_user,@user)\n @can_change_roles = can_change_roles_hash[:has_permission]\n if @can_change_roles\n @user.role = user_params[:role]\n else\n flash[:warning] = \"Don't have permission to promote/demote\"\n end\n\n if @user.save\n redirect_to user_path(@user)\n else\n\n @user.errors.full_messages.each do |msg|\n logger.tagged(\"error: \") {logger.debug msg}\n end\n flash[:warning] = \"Couldn't save changes\"\n redirect_to user_path(@user)\n end\n else\n flash[:warning] = can_edit_hash[:permission_message]\n redirect_to user_path(@user)\n end\n end",
"def update\n @user = User.update(params[:user])\n end",
"def update\n \n @user = User.find(params[:id])\n \n bSave = true\n \n if(bSave)\n bSave = @user.update_attribute(:bio,params[:user][:bio])\n end\n \n if(bSave)\n bSave = @user.update_attribute(:location,params[:user][:location])\n end\n \n if(bSave)\n bSave = @user.update_attribute(:first_name,params[:user][:first_name])\n end\n \n if(bSave)\n bSave = @user.update_attribute(:last_name,params[:user][:last_name])\n end\n if(bSave)\n bSave = @user.update_attribute(:name,params[:user][:name])\n end\n \n if(bSave)\n bSave = @user.update_attribute(:email,params[:user][:email])\n #@user.email = params[:user][:email]\n #bSave = @user.save\n end\n \n #debugger\n respond_to do |format|\n if bSave\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @user = current_user\n @user.update(user_params)\n render_wizard @user\n end",
"def update\n edited_user = User.find(params[:id])\n edited_user.update( params.require(:user).permit(:username) )\n redirect_to \"/users/#{edited_user.id}\"\nend",
"def update\n if @current_user && @current_user.update(user_params)\n flash[:success] = \"Saved\"\n redirect_to edit_user_path(@current_user.id)\n else\n flash.now[:warning] = 'Please fill in all fields.'\n render :edit, status: :bad_request\n end\n end",
"def user_params\n end",
"def update\n if @user.update_attributes(user_params)\n head :ok\n else\n head :internal_server_error\n end\n end",
"def update \n user = User.find(params[:id])\n # byebug\n user.update(user_params)\n\n render json: user\n end",
"def user_params\n if params[:user][:password].blank? && action_name == 'update'\n params[:user].delete(:password)\n params[:user].delete(:password_confirmation)\n end\n params.require(:user).permit(\n :username, :gruppen, :sn, :givenname, :displayname, \n :telephone, :email, :password, :password_confirmation,\n :title, :position, :department, :company\n )\n end",
"def update\n if current_user.update_attributes(user_params)\n redirect_to current_user, notice: 'Profile successfully updated.'\n else\n render 'edit'\n end\n end",
"def update\n \n if current_user.update(user_params)\n Rails.cache.write(current_user.id,current_user)\n redirect_to users1_got_profile_path\n\n end\n end",
"def update\n @user = User.find(params[:id])\n @user.assign_attributes(user_params(params))\n if @user.save\n render :show\n else\n render json: @user.errors\n end\n end",
"def update!(**args)\n @is_current_user = args[:is_current_user] if args.key?(:is_current_user)\n @person_name = args[:person_name] if args.key?(:person_name)\n end",
"def update\n # finds user with id of params[:id]\n @user = User.find params[:id]\n\n # updates the attributes of this user to whatever values are stored in\n # params[:user]\n @user.update params[:user]\n\n # redirect to edit action\n redirect_to edit_user_path\n end",
"def update\n if current_user.update(user_params)\n set_tags current_user\n redirect_to current_user, notice: 'User was successfully updated.'\n else\n render :edit\n end\n end",
"def update_user_status\n @user = User.find params[:id]\n @user.update(user_status: params[:status])\n end",
"def status_update\n current_user.gold = params[:gold]\n current_user.lives = params[:lives]\n current_user.income = params[:income]\n\n # Send out the updated user list to all clients\n update_user_list(current_game.id)\n end",
"def update\n @user = current_user\n if @user.update(user_params)\n redirect_to root_url\n else\n render 'edit'\n end\n end",
"def update\n\n @user = self.current_user\n @user.update_attributes(params)\n \n rescue => ex\n @user.reload\n handle_exception(ex)\n ensure\n respond_to do |format|\n format.json \n end\n end",
"def update\n if current_user.id == params[:id].to_i\n @user = User.find(params[:id])\n @user.update(user_params)\n redirect_to root_path\n else\n redirect_to :back\n end\n end",
"def update\n\n\t\t@user = User.find(params[:id])\n\t\t# @user.assign_attributes(user_params)\n\n\t\t# Only try to save attributes that have been updated\n\t\tparams[:user].delete(:password) if params[:user][:password].blank?\n\t\t\n\t\tif @user.update_attributes(user_params)\n\n\t\t\t\trender json: @user, status: 200\n\n\t\telse\n\t\t\tprint(\"error updating user #{@user.errors.messages.inspect}\")\n\t\t\trender json: { errors: @user.errors.messages.inspect }, status: 422\n\t\tend\n\n\tend",
"def update\n if @user.update(user_params)\n flash[:success] = \"Dados do chief atualizados com sucesso!\"\n redirect_to @user\n else\n render :edit\n end\n end",
"def update\n check_user\n if @user.update(user_params)\n redirect_to @user, notice: 'User was successfully updated.' and return\n end\n end",
"def update!(**args)\n @gaia_id = args[:gaia_id] if args.key?(:gaia_id)\n @user_name = args[:user_name] if args.key?(:user_name)\n end",
"def update!(**args)\n @gaia_id = args[:gaia_id] if args.key?(:gaia_id)\n @user_name = args[:user_name] if args.key?(:user_name)\n end",
"def update\n\n authorize! :manage, @user\n \n respond_to do |format|\n\n if (current_user.id == @user.id) \n # Don't let a non-administrator assign themselves admin/download/viewing priviledges.\n # (Also) Don't let the current user disable their own admin account!\n params[:user].delete \"is_administrator\"\n if ! current_user.is_administrator\n params[:user].delete \"is_data_downloader\"\n params[:user].delete \"is_data_viewer\"\n end\n end \n \n\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n # format.json { render :show, status: :ok, location: @user }\n format.json { respond_with_bip(@user) }\n else\n format.html { render :edit }\n # format.json { render json: @user.errors, status: :unprocessable_entity }\n format.json { respond_with_bip(@user) }\n end\n end\n end",
"def update\n @user_allergen.update(user_allergen_params)\n end",
"def update\n @user = find_user(params[:username])\n\n if @user.update(user_params, current_user)\n redirect_to users_path\n else\n render('edit', status: :unprocessable_entity)\n end\n end",
"def update\n if @user.update(user_params)\n redirect_to edit_user_path (@user)\n end\n end",
"def update_user_preferences(params)\n\n raise ArgumentError.new(format('wrong type. \\'params\\' must be an Hash, given \\'%s\\'', params.class.to_s)) unless( params.is_a?(Hash) )\n raise ArgumentError.new('missing \\'params\\'') if( params.size.zero? )\n\n endpoint = '/api/user/preferences'\n @logger.debug(\"update current user preferences (GET #{endpoint})\") if @debug\n\n update_preferences( endpoint, params )\n end",
"def update\n @user = current_user\n if @user.update_attributes(user_params)\n flash[:success] = \"Pomyślnie zmieniono\"\n redirect_to edit_profile_path\n else\n flash[:danger] = \"Nie udalo się edytować\"\n redirect_to edit_profile_path\n end\n end",
"def update\n #@user = User.find(params[:id])\n \n #@update_pass = 0\n #puts @change_password\n if @user.update_attributes(params[:user])\n # :name => params[:user][:name],\n # :surname => params[:user][:surname],\n # :nif => params[:user][:nif],\n # :address => params[:user][:address],\n # :email => params[:user][:email],\n # :phone => params[:user][:phone])\n #if @user.valid?\n flash[:success] = \"Profile updated.\"\n redirect_to @user\n else\n @title = \"Edit user\"\n render 'edit'\n end\n end",
"def update\n respond_to do |format|\n # Controller should handle attribute whitelisting, not the Model.\n params[:user].slice!(:email, :password, :password_confirmation)\n\n if current_user.update_attributes params[:user]\n format.html { redirect_to current_user }\n format.json { head :ok }\n format.xml { head :ok }\n else\n format.html { render :action => :edit }\n format.json { render :json => current_user.errors, :status => :unprocessable_entity }\n format.xml { render :xml => current_user.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @all_users = args[:all_users] if args.key?(:all_users)\n @domain_users = args[:domain_users] if args.key?(:domain_users)\n @membership = args[:membership] if args.key?(:membership)\n @person = args[:person] if args.key?(:person)\n end",
"def update\n # if @user.update_attributes(user_params)\n @user.name = params[:user][:name]\n @user.department = params[:user][:department]\n @user.favorite_subject = params[:user][:favorite_subject]\n @user.email = params[:user][:email]\n @user.self_introduction = params[:user][:self_introduction]\n @user.password = params[:user][:password]\n if params[:user][:image]\n @user.image = \"user_#{@user.id}.png\"\n File.binwrite(\"public/user_images/#{@user.image}\", params[:user][:image].read)\n end \n if @user.save\n flash[:success] = \"ユーザー情報を更新しました\"\n redirect_to @user\n else\n render :edit\n end\n end",
"def update_user\n user = current_user\n if user.update(update_params)\n render json: { status: { updated: \"Ok\" } }\n else\n render json: user.errors.full_messages\n end\n end",
"def update\n @user = current_user_or_guest\n respond_to do |format|\n if @user.update_attributes(user_params)\n format.html { redirect_to(edit_options_path, notice: t('options.edit.updated')) }\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @user.errors, status: :unprocessable_entity }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7841783",
"0.7787112",
"0.7510326",
"0.74635",
"0.7458976",
"0.7456601",
"0.73789066",
"0.7376452",
"0.7363599",
"0.7357148",
"0.73554677",
"0.73341537",
"0.73073184",
"0.730612",
"0.727584",
"0.72503674",
"0.7236379",
"0.7235486",
"0.7191905",
"0.71840703",
"0.718202",
"0.7168782",
"0.7131528",
"0.7127097",
"0.71196043",
"0.7113137",
"0.7111139",
"0.7109122",
"0.7097787",
"0.7094808",
"0.70917296",
"0.70917296",
"0.7089693",
"0.70665514",
"0.70319086",
"0.7024444",
"0.70124036",
"0.70096177",
"0.7008979",
"0.7008979",
"0.7003531",
"0.7002376",
"0.7002376",
"0.7002376",
"0.6993071",
"0.6991502",
"0.6978496",
"0.6976293",
"0.69737315",
"0.6968803",
"0.6965906",
"0.6942456",
"0.69347644",
"0.6925466",
"0.6922776",
"0.6916561",
"0.6916378",
"0.69153893",
"0.6915225",
"0.69074184",
"0.69051516",
"0.69050634",
"0.6904151",
"0.68907243",
"0.68900394",
"0.68787205",
"0.6870628",
"0.6869521",
"0.6856114",
"0.6855702",
"0.68538326",
"0.6851621",
"0.68499655",
"0.6842089",
"0.684044",
"0.6839756",
"0.682791",
"0.68255645",
"0.68209577",
"0.6812507",
"0.68111974",
"0.681039",
"0.68073297",
"0.6806166",
"0.6802659",
"0.67987853",
"0.6797651",
"0.6793844",
"0.6793844",
"0.6791316",
"0.6783398",
"0.6776263",
"0.67761177",
"0.6775163",
"0.67703694",
"0.67688185",
"0.67663693",
"0.6755722",
"0.67502743",
"0.6740144",
"0.6738731"
] |
0.0
|
-1
|
Checks if the user is the author of a reply
|
def reply_author(reply)
logged_in? && current_user.id == reply.user_id
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def reply_author(reply)\n user_signed_in? && current_user.id == reply.user_id\n end",
"def answered_by?(user)\n replies.exists?(:user_id => user)\n end",
"def author?(user)\n user && author.id == user.id\n end",
"def author?(user)\n self.user == user\n end",
"def is_author?\n Response.joins(question: :poll).where(\"polls.user_id = ?\", self.user_id).exists?\n end",
"def author?(user)\n authors.member?(user)\n end",
"def current_user_is_author?\n current_user && current_user.is_author\n end",
"def reply?\n !self.in_reply_to.nil?\n end",
"def reply?\n !self.in_reply_to.nil?\n end",
"def reply?\n !!in_reply_to_status_id\n end",
"def is_message?\n in_reply_to && self.private\n end",
"def in_reply_to_user\n previous_tweet.try(:author).try(:screen_name) || params[:in_reply_to_user]\n end",
"def is_reply?\n\t\tthis.is_reply\n\tend",
"def respondent_is_not_author_poll?\n #\n # respondend.id == author.id\n\n if question.poll.author.id == user.id\n errors[:user_id] << 'author should not answer to his/her poll'\n end\n end",
"def participates?(user)\n author == user || receiver == user\n end",
"def invitable_to?(user)\n return false unless pending?\n return false if authors.include?(user)\n end",
"def is_user_potential_author?(user, author)\n\n is_user_not_already_author = self.authors.all? { user.author != author }\n\n user_author_name = \"#{user.last_name}\"\n matching_names = author.name.include?(user_author_name)\n\n matching_names && is_user_not_already_author\n end",
"def author?\n !author.nil? && !author.empty?\n end",
"def replied_conv? usr\n if @conv.posts.count > 1 && @conv.posts.last.user_id != usr.id\n @conv.posts.each do |post|\n return true if post.user_id == usr.id\n end\n end\n false\n end",
"def is_author_of?(item)\n if item.respond_to?(:user)\n self == item.user\n elsif item.respond_to?(:pseud)\n self.pseuds.include?(item.pseud)\n elsif item.respond_to?(:pseuds)\n !(self.pseuds & item.pseuds).empty? \n else\n false\n end\n end",
"def is_author_of?(item)\n if item.respond_to?(:user)\n self == item.user\n elsif item.respond_to?(:pseud)\n self.pseuds.include?(item.pseud)\n elsif item.respond_to?(:pseuds)\n !(self.pseuds & item.pseuds).empty?\n elsif item.respond_to?(:author)\n self == item.author\n else\n false\n end\n end",
"def editable_by?(user)\n\t\tuser && user == author\n\tend",
"def replyable?\n true\n end",
"def can_be_replied_by?(attempting_user)\n if attempting_user\n published? && (is_public? || is_protected? || member?(attempting_user) || attempting_user.is_admin? ||\n (is_subscription_only? && attempting_user.is_paid_subscriber?))\n else\n false # must be logged in to make a reply\n end\n end",
"def is_the_author_of_the_post(post)\n post.author_id == current_author.id\n end",
"def user_can_reply user \n \n if Connection.exists?(self.connection_id)\n return connection.is_active\n end\n false\n end",
"def not_author_response\n if author_respondent?\n errors[:author] << 'cannot answer their own poll'\n end\n end",
"def check_author\n if person_signed_in?\n @is_author = Author.where(\"person_id = ? AND document_id = ?\", current_person.id, @document.id).present?\n else\n @is_author = false\n end\n end",
"def is_reply?\n !self.is_root?\n end",
"def poll_author?\n self.answer_choice.question.poll.author_id\n end",
"def is_author?( author = '' )\n return false unless @is_author\n\n return true if author.blank?\n\n author_obj = get_queried_object\n\n author = [author].map {|a| a.to_s}\n\n if author.include?(author_obj.id.to_s)\n return true\n elsif author.include?(author_obj.nickname)\n return true\n elsif author.include?(author_obj.user_nicename)\n return true\n end\n false\n end",
"def sent_by?(user)\n from_user_id == user&.id\n end",
"def replyable?\n @replyable ||= !flags.include?(:more_to_come)\n end",
"def completed_by? author\n response = responses.find_by(author: author)\n if ::Tasuku.config.update_answers && response && response.is_a?(::Tasuku::Taskables::Question::Answer)\n response.correct?\n else\n !!response\n end\n end",
"def replied_conv? usr\n ConversationProcessor.new(self).replied_conv? usr\n end",
"def has_author?(author)\n ret = false\n @authors.each{ |auth| ret = true if auth == author }\n ret\n end",
"def notify_only_author?(user)\n for_commit? && commit_author &&\n commit_author.email != user.email\n end",
"def hasOwner? \n\t\tunless self.author_id.nil? || self.author_id == 0\n\t\t\tUser.find(self.author_id)\n\t\tend\n\n\tend",
"def thread_member?(user)\n user == self.user || (messagable_type == \"User\" && messagable_id == user.id) || self.replies.map(&:user).include?(user)\n end",
"def valid_reply?\n # People can send multiple replies to the same message, in which case\n # the recipient is the same as the parent recipient.\n # For most replies, the message recipient should be the parent sender.\n # We use Set to handle both cases uniformly.\n Set.new([sender, recipient]) == Set.new([parent.sender, parent.recipient])\n end",
"def sender? usr\n usr.id == user_id\n end",
"def reply?\n (!parent.nil? or !parent_id.nil?) and valid_reply?\n end",
"def authentication_reply?\n return true if (self.kind_of?(AuthenticationReply))\n return false\n end",
"def whose?(user, object)\n case object\n when Post\n owner = object.author\n when Comment\n owner = object.user\n else\n owner = nil\n end\n if user and owner\n if user.id == owner.id\n \"his\"\n else\n \"#{owner.nickname}'s\"\n end\n else\n \"\"\n end\n end",
"def is_author?\n !self.authorships.empty?\n end",
"def check_author\n if self.author.blank?\n self.author = 'anon'\n end\n end",
"def is_reply_allowed?(comment)\n if comment.parent_id.nil?\n true\n # redirect_to(post, :alert => \"You are not allowed man to reply a reply! Don't even try boy, it could cost you the life!\")\n end\n end",
"def replyable?\n false\n end",
"def authored_replies\n Reply.find_by_user_id(self.id)\n end",
"def is_author_of?(name)\n self.is_author? and !self.programs.find_by_name(name).nil?\n end",
"def owned_by?(user_id)\n user_id = user_id.id if user_id.is_a?(User)\n has_role(user_id, :creator)\n end",
"def accounting_reply?\n return true if (self.kind_of?(AccountingReply))\n return false\n end",
"def author\n if @subject.user_id > 0\n unless (current_user.sk == @subject.user || (current_user.sk.admin && !@subject.user.admin) || current_user.sk.root)\n render 'errors/access_refused' and return\n end\n else # Message automatique\n unless current_user.sk.root\n render 'errors/access_refused' and return\n end\n end\n end",
"def mentioned?(user)\n @mentions.include?(user)\n end",
"def author_username\n anonymous? ? Reply.human_attribute_name(:anonymous) : user.username\n end",
"def top_level?\n !self.reply_comment?\n end",
"def valid_to_reply_to?\n # check validity of email\n if self.mail.from_addrs.nil? || self.mail.from_addrs.size == 0\n return false\n end\n email = self.mail.from_addrs[0].spec\n if !MySociety::Validate.is_valid_email(email)\n return false\n end\n\n # reject postmaster - authorities seem to nearly always not respond to\n # email to postmaster, and it tends to only happen after delivery failure.\n # likewise Mailer-Daemon, Auto_Reply...\n prefix = email\n prefix =~ /^(.*)@/\n prefix = $1\n if !prefix.nil? && prefix.downcase.match(/^(postmaster|mailer-daemon|auto_reply|donotreply)$/)\n return false\n end\n\n return true\n end",
"def can_reply_to?(topic) false end",
"def owned_by? a_user\n a_user == user\n end",
"def owned_by?(u)\n self.user == u\n end",
"def replying_to\n return nil unless self.reply?\n user = self.text[0...self.text.index(\" \")]\n return nil unless user[0...1] == \"@\"\n user\n end",
"def replying_to\n return nil unless self.reply?\n user = self.text[0...self.text.index(\" \")]\n return nil unless user[0...1] == \"@\"\n user\n end",
"def following?(other_author)\n following.include?(other_author)\n end",
"def owned_by? a_user\n a_user == program.moderator\n end",
"def create_post_owner_notification_of_reply(reply)\n return if reply.user.id == self.user.id # don't notify user of his own replies..\n if self.user.role == \"Poster\"\n url = \"wall_expert/#{self.id}\"\n else\n url = \"wall/#{self.id}\"\n end\n notify(self.user, \"Your post was commented on!\", \"#{reply.user.profile.full_name} commented on your post!\", :from => reply.user, :key => post_reply_notification_key(reply), :link => '#{url}?reply=#{reply.id}')\n end",
"def can_reply_to(conversation)\n true\n end",
"def author\n if @submission.user != current_user.sk\n render 'errors/access_refused' and return\n end\n end",
"def owner?(post_owner) # <= User object\n current_user == post_owner\n end",
"def check_if_reply_and_not_already_read(tweet)\n\n puts tweet.text\n if tweet.text.match(/^@partyprinter.*/) && tweet.user.id != 1678701920 && Tweet.exists?(tweet.id.to_i) == nil\n puts \"new\"\n return true\n end\n\n end",
"def unread_by?(user)\n received_message.try(:unread?) || replies.map { |r|\n r.received_message if r.recipient == user\n }.compact.any?(&:unread?)\n end",
"def authorized_by(user)\n user.id == self.sender_id\n end",
"def replies?\n !replies.empty?\n end",
"def replies?\n !replies.empty?\n end",
"def correct_user\n check_owner_of(@micropost)\n end",
"def authed?(irc)\n if !$user.caps(irc, 'phrases', 'op', 'owner').any?\n irc.reply \"You aren't allowed to use this command\"\n return false\n end\n true\n end",
"def authorized_user? comment\n comment.user_id == current_user.id || comment.post.user_id == current_user.id\n end",
"def user_comment?(user_id)\n @current_user.id == user_id\n end",
"def authored_replies\n Replies.find_by_user_id(@id)\n end",
"def any_unread? usr\n @conv.posts.each do |post| \n if post.unread?(usr) && post.recipient_id == usr.id\n return true\n end\n end\n return false\n end",
"def author_worthy?\n notes?\n end",
"def in_reply_to\n return @in_reply_to\n end",
"def is_my_post?(userid)\n #if someone is logged in\n if @current_user\n #if the user id of the post is the user id of the person logged in => it is my post\n if @current_user.id == userid\n return true\n # it isn't my post\n else\n return false\n end\n #It isn't my post because I'm not logged in\n else\n return false\n end\n end",
"def acknowledged?\n !!@replies\n end",
"def self_signup?\n user_id == author_id\n end",
"def participates?(user)\n \tsender == user || recipient == user\n\tend",
"def owned?\n user.present?\n end",
"def owned?(user_to_check = current_user)\n user_to_check ? self.creator == user_to_check : false\n end",
"def is_the_user_the_owner(scrollz, user)\n if scrollz.user_id != user.id\n flash[:notice] = \"?\"\n redirect_to scrollz_path(@scrollz)\n end\n end",
"def commentable_by?(user_id)\n user_id = user_id.id if user_id.is_a?(User)\n has_role(user_id, :commenter)\n end",
"def managed_by? a_user\n owned_by? a_user || program.moderator == a_user\n end",
"def reply?\n self.operation == OP_REPLY\n end",
"def takendown?\n author_linked_account_id && Takedown.linked_account_id_has_takedown?(author_linked_account_id)\n end",
"def isCurrentUserAuthorOrAdmin(id, session)\n\tunless session == nil\n\t\treturn id == session || User.find(session).group == 1 # TODO: if admin naj bo tudi true\n\tend\n\t\n\treturn false\n end",
"def owner? usr\n user_id == usr.id\n end",
"def is_sole_author_of?(item)\n other_pseuds = item.pseuds.find(:all) - self.pseuds\n self.is_author_of?(item) && other_pseuds.blank?\n end",
"def user_owner_entry?\n user_entry? && principle == \"OWNER\"\n end",
"def preview_only?(user)\n !listed && !author?(user)\n end",
"def in_reply_to\n headers['In-Reply-To']\n end",
"def notifies_commenter? # ...of direct responses to this comment\n wants_notifications?\n end",
"def is_logged_in?\n !session[:author_id].nil?\n end"
] |
[
"0.84007716",
"0.75702244",
"0.7307788",
"0.7227496",
"0.71521413",
"0.7040628",
"0.6997446",
"0.6984886",
"0.6984886",
"0.6929768",
"0.6856324",
"0.6832867",
"0.6771362",
"0.67612094",
"0.674855",
"0.67419815",
"0.66817474",
"0.6679152",
"0.66348916",
"0.66151196",
"0.6610905",
"0.6608401",
"0.6603096",
"0.660233",
"0.65692276",
"0.65466845",
"0.6518027",
"0.65119714",
"0.6506077",
"0.6504162",
"0.6465979",
"0.6451887",
"0.64048773",
"0.6399238",
"0.6398138",
"0.6395475",
"0.6392404",
"0.6387942",
"0.6351149",
"0.6344547",
"0.6340914",
"0.6325805",
"0.63075155",
"0.63023615",
"0.6300998",
"0.6288426",
"0.62839985",
"0.6266261",
"0.6261232",
"0.6257136",
"0.6253184",
"0.62387127",
"0.6226821",
"0.6210604",
"0.6194674",
"0.6190194",
"0.6159962",
"0.61433667",
"0.6142411",
"0.61277544",
"0.6127105",
"0.6127105",
"0.61255467",
"0.6121144",
"0.6113578",
"0.6112759",
"0.6105986",
"0.60926604",
"0.6080658",
"0.6079806",
"0.60771364",
"0.6072774",
"0.6072774",
"0.60723025",
"0.60703856",
"0.60631907",
"0.60619944",
"0.6052935",
"0.60455173",
"0.6039423",
"0.60380834",
"0.6003611",
"0.6000777",
"0.5989321",
"0.59755987",
"0.5966589",
"0.5961669",
"0.59522116",
"0.59450555",
"0.5929475",
"0.5923095",
"0.59199536",
"0.5919426",
"0.59093654",
"0.59046865",
"0.59025294",
"0.589556",
"0.58881",
"0.5871273",
"0.586092"
] |
0.8284275
|
1
|
Add an SGE user
|
def add
Tempfile.open do |tmpfile|
tmpfile.puts render(Templates::User::ERB)
tmpfile.flush
system("qconf -Auser #{tmpfile.path}")
sleep 5
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_user(name)\n\t@users << {:name => name}\n end",
"def _user_add argv = {}\n\t\tf\t\t\t\t= {}\n\t\tf[:tag]\t\t\t= argv[:tag] if argv.include?(:tag)\n\t\tf[:salt] \t\t= _random 5\n\n\t\t#username\n\t\t_throw Sl[:'the user is existing'] if _user? f[:name]\n\t\tf[:name] \t\t= argv[:name]\n\n\t\t#password\n\t\trequire \"digest/sha1\"\n\t\tf[:pawd] \t\t= Digest::SHA1.hexdigest(argv[:pawd] + f[:salt])\n\n# \t\tSdb[:user].insert(f)\n\t\t_submit :_user, :fkv => f, :uniq => true\n\t\tuid = Sdb[:_user].filter(:name => f[:name]).get(:uid)\n\t\tuid ? uid : 0\n\tend",
"def user_add argv = {}\n\t\tfkv\t\t\t= {}\n\t\tfkv[:name]\t= argv[:name]\n\t\tfkv[:level]\t= argv[:level]\n\t\tfkv[:tag]\t= argv[:tag] if argv[:tag]\n\n\t\t# if the username is existed\n\t\t_throw Sl[:'the user is existed'] if user_has? fkv[:name]\n\n\t\t# password\n\t\trequire \"digest/sha1\"\n\t\tfkv[:salt] \t= _random 5\n\t\tfkv[:pawd] \t= Digest::SHA1.hexdigest(argv[:pawd] + fkv[:salt])\n\n# \t\tSdb[:user].insert(f)\n\t\tdata_submit :user_info, :fkv => fkv, :uniq => true\n\n\t\tuid = Sdb[:user_info].filter(:name => fkv[:name]).get(:uid)\n\t\tuid ? uid : 0\n\tend",
"def user(*args)\n @users << User.add(*args)\n end",
"def add_user(user)\n @users[user.name] = user\n end",
"def addUser(stat,typ,email,pwhash)\n @conn.exec_prepared(\"add_user\",[stat,typ,email,pwhash])\n end",
"def add_user(user)\n @users << user\n end",
"def add_user(user)\n self.users.create(id: user.id)\n end",
"def _user_add f = {}\n\t\tf[:salt] \t\t= _random_string 5\n\t\tf[:created] \t= Time.now\n\n\t\trequire \"digest/sha1\"\n\t\tf[:pawd] \t\t= Digest::SHA1.hexdigest(f[:pawd] + f[:salt])\n\n\t\t_throw L[:'the user is existing'] if _user? f[:name]\n\n\t\tDB[:_user].insert(f)\n\t\tuid = DB[:_user].filter(:name => f[:name]).get(:uid)\n\t\tuid ? uid : 0\n\tend",
"def add_user(name, value)\n self.class.post(\"/users/#{name}\",\n body: value,\n headers: {\n 'Content-Type' => 'application/json; charset=UTF-8',\n Connection: 'keep-alive',\n Accept: 'application/json, text/plain, */*'\n })\n end",
"def registerUser(name, usernumber)\n # puts (\"adding user\")\n @users.store(name, usernumber)\n end",
"def create_new_user\r\n touch(\"* id:'#{add}'\")\r\n end",
"def create_user\n command = compile_command(\"useradd\") do |useradd|\n useradd << universal_options\n useradd << useradd_options\n end\n\n run_command(:command => command)\n\n # SmartOS locks new users by default until password is set\n # unlock the account by default because password is set by chef\n if check_lock\n unlock_user\n end\n end",
"def adduser(email, password, first_name, last_name, slug)\n @user = User.invite!(:email => email, :slug => slug) do |u|\n u.skip_invitation = true\n end\n token = @user.instance_variable_get(:@raw_invitation_token)\n User.accept_invitation!(:invitation_token => token,\n :password => password,\n :password_confirmation => password,\n :first_name => first_name,\n :last_name => last_name,\n :slug => slug)\n\n puts \"Created User #{email} with password #{password}\"\n @user\n end",
"def add_user(opts)\n opts[:domain] = name\n GoodData::Domain.add_user(opts)\n end",
"def add_user!( user )\n raise TypeError.new('not a user') unless user.is_a?(Ecore::User)\n user.add_group!(self)\n end",
"def add_user(username, params)\n\t\t\t\t@session['datastore'][username] = params\n\t\t\tend",
"def add_user(user)\r\n\t\tsend(\"ADC\",\"FL N=#{user.name} F=#{user.safenick}\")\r\n\t\tsend(\"ADC\",\"AL N=#{user.name} F=#{user.safenick}\")\r\n\t\t## XXX changes recorded locally by ADD msg back\r\n\t\treturn 1\r\n\tend",
"def add_user(login, password)\n GoodData::Domain.add_user(name, login, password)\n end",
"def add_user( user )\n raise TypeError.new('not a user') unless user.is_a?(Ecore::User)\n user.add_group(self)\n end",
"def add_new_user()\n new_user_link.click\n end",
"def addUser(id, username)\n @conn.exec_prepared(\"insert_user\", [id, username])\n end",
"def add(name, ugid, homedir)\n fail 'user already exists' if include?(name)\n syscmd(\"groupadd -g #{ugid} #{name}\")\n syscmd(\"useradd -u #{ugid} -g #{ugid} -d #{homedir} -c #{COMMENT} #{name}\")\n exclusively { users[name] = ugid }\n end",
"def add_user(newuser)\n @group_users.push(newuser)\n end",
"def add_user!( user, update_user = true )\n puts \"add_user\"\n unless @users.include?( user )\n @users << user\n user.add_badge!( self, false ) if update_user\n end\n return @users\n end",
"def add username\n @members.add username\n end",
"def add user, pin = nil\n command = aqhbci <<-CMD\n adduser \\\n --tokentype=#{user.tokentype} \\\n --context=#{user.context} \\\n --bank=#{user.bank} \\\n --user=#{user.userid} \\\n --server=#{user.server} \\\n --username=#{user.name} \\\n --hbciversion=#{user.hbciversion}\n CMD\n stdin, stdout, stderr, wait_thr = Open3.popen3(command.strip)\n success = wait_thr.value.success?\n\n if pin && success\n with_secure_pin user, pin do |f|\n sysid_command = aqhbci(\"getsysid --user=#{user.userid}\", \"--pinfile=#{f.path.strip}\").strip\n stdin, stdout, stderr, wait_thr = Open3.popen3(sysid_command)\n wait_thr.join\n success = success && wait_thr.value.success?\n end\n end\n return success\n end",
"def add_user(db, name, age, current_weight, goal_weight, max_mile)\n\tdb.execute(\"INSERT INTO users (name, age, current_weight, goal_weight, max_mile) \n\tVALUES (?, ?, ?, ?, ?);\", [name, age, current_weight, goal_weight, max_mile]\n\t)\nend",
"def add_user(data, opts = {})\n # data[:domain] = name\n GoodData::Domain.add_user(data, name, { client: client }.merge(opts))\n end",
"def add_user\n if @experiment.add_user(params[:user_id].to_i)\n redirect_to sti_experiment_path(@project.id, @phase.id, @experiment.type, @experiment), notice: 'User was successfully added'\n else\n redirect_to sti_experiment_path(@project.id, @phase.id, @experiment.type, @experiment), notice: 'User cannot be added'\n end\n end",
"def backend_addUser(param) \n @Users.push(param) \n end",
"def add_user params\n validate_and_store :user, {:state => 'user'}.merge(params)\n end",
"def add nick, email, jid\n\t\t@users.create Hash[\n\t\t\t'nick' => nick,\n\t\t\t'email' => email,\n\t\t\t'jid' => jid,\n\t\t\t'role' => 'user',\n\t\t\t'password' => 'NOTSET']\n\tend",
"def add_user(user)\n self.users << user unless self.users.include?(user)\n end",
"def add_user(user)\n @usernames[user] = get_color unless @usernames.has_key?(user)\n end",
"def add_user(user)\n user_hash[user.nick]=user unless user_hash.has_key?(user.nick)\n end",
"def add_user(user) # rubocop:disable Metrics/AbcSize\n cmd_args = [\"'#{user.name}'\"]\n cmd_args.unshift \"--home '#{user.homedir}'\" if user.homedir\n if user.shell\n cmd_args.unshift \"--shell '#{user.shell}'\"\n elsif user.is_system\n cmd_args.unshift \"--shell '/usr/sbin/nologin'\"\n end\n cmd_args.unshift \"--gid '#{user.group}'\" if user.group\n cmd_args.unshift '--system' if user.is_system\n\n # Collapse the cmd_args array into a string that can be used\n # as an argument to `useradd`\n useradd_args = cmd_args.join \"\\s\"\n\n # Collapse the cmd_args array into a string that can be used\n # as an argument to `usermod`; If this is a system account,\n # then specify it as such for user addition only (strip\n # --system from usermod_args)\n usermod_args = (cmd_args - [\"--system\"]).join \"\\s\"\n\n return <<-HERE.undent\n if getent passwd '#{user.name}' > /dev/null 2>&1; then\n /usr/sbin/usermod #{usermod_args}\n else\n /usr/sbin/useradd #{useradd_args}\n fi\n HERE\n end",
"def add\n @user = User.new\n end",
"def user_add(username, password,\n config = Hash.new)\n default_config = {\n :add_user => true,\n :password => password,\n :comment => \"\",\n :use_mail => true,\n :use_ftp => false,\n :use_file_sharing => false,\n :mail_quota => 200, # in MB\n :virus_check => false,\n :spam_filter => false\n }\n\n user_setting(username,\n default_config.merge(config))\n end",
"def add_user(user,role = 'Member')\n self.users.create(id: user.id, role: role)\n end",
"def add_user(user)\n # NB: system users aren't supported on solaris 10\n # Solaris 10 also doesn't support long flags\n cmd_args = [\"'#{user.name}'\"]\n cmd_args.unshift \"-g '#{user.group}'\" if user.group\n cmd_args.unshift \"-d '#{user.homedir}'\" if user.homedir\n if user.shell\n cmd_args.unshift \"-s '#{user.shell}'\"\n elsif user.is_system\n # Even though system users aren't a thing, we can still disable the shell\n cmd_args.unshift \"-s '/usr/bin/false'\"\n end\n\n user_args = cmd_args.join(\"\\s\")\n\n return <<-HERE.undent\n if getent passwd '#{user.name}' > /dev/null 2>&1; then\n /usr/sbin/usermod #{user_args}\n else\n /usr/sbin/useradd #{user_args}\n fi\n HERE\n end",
"def addUser(course_id, name, slug, course_site, instructors, partners, homepage, counter, url_photo, summary)\n @conn.exec_prepared(\"insert_user\", [course_id, name, slug, course_site, instructors, partners, homepage, counter, url_photo, summary])\n end",
"def add_user(organization, user)\n organization.add_user user\n end",
"def add_user\n stage = Stage.find(params[:id])\n user = AssetUser.find(params[:user][:id])\n stage.asset_users << user\n \n if stage.save\n redirect_to :back, :notice => \"#{user.username} was added to #{stage.title}\"\n else\n redirect_to :back, :alert => \"Action could not be completed\"\n end\n end",
"def add_user(user)\n super.tap do |org_user|\n class_name = (users.count == 1) ? JudgeTeamLead : DecisionDraftingAttorney\n class_name.create!(organizations_user: org_user)\n end\n end",
"def add_user(api_level, username, password, type, pin = nil, options = nil)\n payload = { username: username, password: password, type: type }\n\n payload[:pin] = pin if pin\n payload[:options] = options.is_a?(Hash) ? JSON.generate(options) : options if options\n\n res = Connection.post(api_level, payload)\n User.build(res, api_level)\n end",
"def addUser\n id = params[:id] # retrieve project ID from URI route\n proj = Project.find(id)\n if proj.add_user(params[:username],params[:rolename])\n head :no_content\n else\n render_error(:unprocessable_entity, \"Could not add user\")\n end\n end",
"def createUser(nickname) \n usr = User.new(nickname)\n backend_addUser(usr) \n end",
"def register()\n\tentry = {\"userid\" => @userid, \"username\" => @username, \"email\" => @email, \"password\" => @password}\n\tDATABASE.newEntry(\"users\", entry)\n\tend",
"def add_user(user_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'AddUser'\n\t\targs[:query]['UserName'] = user_name\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? :comments\n\t\t\targs[:query]['Comments'] = optional[:comments]\n\t\tend\n\t\tself.run(args)\n\tend",
"def add\n # ask the user for the user name\n new_user_name = @view.ask_user_for(:username)\n # ask the user for the user continent\n new_user_continent = @view.ask_user_for(:password)\n # create an instance of `Country` based on what the user said\n new_user = User.new(username: new_user_name, password: new_user_continent)\n # adding in to the user_repository\n @user_repository.add(new_user)\n end",
"def add_user(email, options={})\n raise NotImplementedError, \"Please implement this in your concrete class\"\n end",
"def add\n # ask the user for the user name\n new_user_name = @view.ask_user_for(:username)\n # ask the user for the user continent\n new_user_continent = @view.ask_user_for(:password)\n # create an instance of `Country` based on what the user said\n new_user = User.new(username: new_user_name, password: new_user_continent)\n # adding in to the repo\n @repo.add(new_user)\n end",
"def sign_up(name:, user_name:)\n user_name = user_name.downcase\n return SYNTAX_ERROR if include_punctuation?(user_name)\n return TOO_LONG_ERROR if too_long?(user_name)\n return TOO_SHORT_ERROR if too_short?(user_name)\n\n @user_class.add(name: name, user_name: user_name)\n end",
"def add_user(user)\n UserGroup.create(user_id: user.id, group_id: id)\n end",
"def add_user(user)\n Role.add_user role_id: id, user_id: user.id\n end",
"def create_user(options = {})\n post :create, {:user => { :name => 'quire', :point_value => \"2\", :login => 'quire', :email => 'quire@example.com',\n :password => 'quire', :password_confirmation => 'quire' }.merge(options)}, {:user_id => \"1\"}\n end",
"def add_user(name, is_admin, building_id, notify_new_request= false, notify_new_listing=false)\n user_id = User.create(\n first_name: name,\n last_name: 'LNU',\n email: 'jack+' + name + '@jackmgill.com',\n password: 'foo',\n is_admin: is_admin,\n building_id: building_id,\n notify_new_request: notify_new_request,\n notify_new_listing: notify_new_listing\n ).id\n return user_id\nend",
"def add_user(user, opts={})\n return false if self.user?(user, opts)\n unh = self._user_and_host(user, opts[:host])\n self.interpreter.log.info(PNOTE+\"Added MySQL user: #{unh}\")\n sql = \"create user #{unh}\"\n sql << \" identified by '#{opts[:password]}'\" if opts[:password]\n fetch(sql) if self.interpreter.writing?\n return true\n end",
"def create_new_user\n name = @prompt.ask(\"what is your name?\".red)\n @user = User.find_by(name: name)\n\n if @user\n # User.exists?(@user.name)\n puts \"Welcome back #{@user.name}\"\n show_current_series\n current_series \n remove_from_series_list\n\n else\n @user= User.create(name: name)\n puts\"Welcome #{@user.name}, to Tv series App\".green\n input = get_user_input\n \n series_id = get_series_information(input)\n puts \"\"\n # binding.pry\n end\n end",
"def add_user(username, password, email)\n password_hash = make_pw_hash(password)\n user = { _id: username, password: password_hash }\n user['email'] = email unless email.empty?\n begin\n # You need to insert the user into the users collection.\n @users.insert_one(user)\n p 'This space intentionally left blank.'\n rescue\n p 'Error MongoDB'\n return nil\n end\n true\n end",
"def add_user(username, password, attributes = {})\n @users[username] = {}\n @users[username][:password] = password\n if attributes.empty?\n @users[username][:attributes] = {\n 'User-Name' => username,\n 'Filter-Id' => 60\n }\n else\n @users[username][:attributes] = attributes\n end\n end",
"def add_member\n @group = Group.find(params[:id])\n @user = User.find_by_username(params[:username])\n\n unless @user.nil? || @group.users.include?(@user)\n @group.users << @user\n flash[:notice] = \"Miembro añadido exitosamente.\" if @group.save\n else\n flash[:error] = \"No se pudo añadir a este usuario. Verifique que el usuario a añadir sea el correcto.\"\n end\n\n redirect_to group_path(@group)\n end",
"def add_user_to_db(screen_name)\n user = github.get_user(screen_name)\n Cheepcreep::GithubUser.create(:login => json['login'],\n :name => json['name'],\n :blog => json['blog'],\n :followers => json['followers'],\n :following => json['following'],\n :public_repos => json['public_repos'])\n\nend",
"def add(user)\n\t\t\tkparams = {}\n\t\t\t# The new user\n\t\t\tclient.add_param(kparams, 'user', user);\n\t\t\tclient.queue_service_action_call('user', '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 create\n\n @new_user = User.new\n\n new_user = @new_user.add(params['user_name'], params['pswd1'], params['email'], params['full_name'])\n\n if new_user.errors.any?\n redirect_to \"/\", :flash => { :error => 'User already exists'}\n else\n redirect_to \"/main\"\n end\n end",
"def add_user(user)\n group_members.create(group: self, user: user, accepted: DateTime.now)\n end",
"def add_user(opts)\n generated_pass = rand(10E10).to_s\n data = {\n :login => opts[:login] || opts[:email],\n :firstName => opts[:first_name] || 'FirstName',\n :lastName => opts[:last_name] || 'LastName',\n :password => opts[:password] || generated_pass,\n :verifyPassword => opts[:password] || generated_pass,\n :email => opts[:email] || opts[:login]\n }\n\n # Optional authentication modes\n tmp = opts[:authentication_modes]\n if tmp\n if tmp.is_a? Array\n data[:authenticationModes] = tmp\n elsif tmp.is_a? String\n data[:authenticationModes] = [tmp]\n end\n end\n\n # Optional company\n tmp = opts[:company_name]\n tmp = opts[:company] if tmp.nil? || tmp.empty?\n data[:companyName] = tmp if tmp && !tmp.empty?\n\n # Optional country\n tmp = opts[:country]\n data[:country] = tmp if tmp && !tmp.empty?\n\n # Optional phone number\n tmp = opts[:phone]\n tmp = opts[:phone_number] if tmp.nil? || tmp.empty?\n data[:phoneNumber] = tmp if tmp && !tmp.empty?\n\n # Optional position\n tmp = opts[:position]\n data[:position] = tmp if tmp && !tmp.empty?\n\n # Optional sso provider\n tmp = opts[:sso_provider]\n data['ssoProvider'] = tmp if tmp && !tmp.empty?\n\n # Optional timezone\n tmp = opts[:timezone]\n data[:timezone] = tmp if tmp && !tmp.empty?\n\n c = client(opts)\n\n # TODO: It will be nice if the API will return us user just newly created\n url = \"/gdc/account/domains/#{opts[:domain]}/users\"\n response = c.post(url, :accountSetting => data)\n\n url = response['uri']\n raw = c.get url\n\n # TODO: Remove this hack when POST /gdc/account/domains/{domain-name}/users returns full profile\n raw['accountSetting']['links'] = {} unless raw['accountSetting']['links']\n raw['accountSetting']['links']['self'] = response['uri'] unless raw['accountSetting']['links']['self']\n\n c.create(GoodData::Profile, raw)\n end",
"def []=(name, data)\n system.run(:add, \"user\", name, data, data.length, @keyring)\n end",
"def create_user\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n post(\"users.json\", params)\n end",
"def add_member(user)\n update_membership(user, true)\n end",
"def add(user)\n GroupMembers.new(:id => id).post(user)\n end",
"def create_user\n user new_resource.user do\n comment \"Service user for #{new_resource.name}\"\n gid new_resource.group if new_resource.group\n home new_resource.home\n shell '/bin/false'\n system true\n uid new_resource.uid\n end\n end",
"def fAddPunter (name, email, pwd)\n @users.addPunter(name,email,pwd)\n end",
"def add_user(db, user_name)\n db.execute(\"INSERT INTO users (user_name) VALUES (?),\" [user_name])\nend",
"def add_user(username, reload = false, update_default = false)\n until username\n print \"User name >\"\n STDOUT.flush\n username = STDIN.gets.chomp\n return if username.empty?\n redo unless username =~ /\\A[0-9A-Z_a-z]+\\z/\n end\n \n if !reload && user_registered?(username)\n puts \"The user \\\"#{username}\\\" is already registered.\"\n return\n end\n \n auth = auth_http(:user => username, :reload => reload, :browser => true)\n if auth != nil\n puts \"User \\\"#{username}\\\" is successfully registered.\"\n if update_default || @config[\"login/\"] == nil\n @config[\"login/\"] = username\n puts \"Default user is set to @#{username}.\"\n end\n end\n save_config\n end",
"def create_user(db, user_name)\n\tdb.execute(\"INSERT INTO users (user_name) VALUES (?)\", [user_name])\n\tputs \"added new user\"\nend",
"def add_user(user_data, name = nil, opts = { :client => GoodData.connection })\n generated_pass = rand(10E10).to_s\n domain_name = name || user_data[:domain]\n user_data = user_data.to_hash\n data = {\n :login => user_data[:login] || user_data[:email],\n :firstName => user_data[:first_name] || 'FirstName',\n :lastName => user_data[:last_name] || 'LastName',\n :password => user_data[:password] || generated_pass,\n :verifyPassword => user_data[:password] || generated_pass,\n :email => user_data[:email] || user_data[:login]\n }\n\n # Optional authentication modes\n tmp = user_data[:authentication_modes]\n if tmp\n if tmp.is_a? Array\n data[:authenticationModes] = tmp\n elsif tmp.is_a? String\n data[:authenticationModes] = [tmp]\n end\n end\n\n # Optional company\n tmp = user_data[:company_name]\n tmp = user_data[:company] if tmp.nil? || tmp.empty?\n data[:companyName] = tmp if tmp && !tmp.empty?\n\n # Optional country\n tmp = user_data[:country]\n data[:country] = tmp if tmp && !tmp.empty?\n\n # Optional phone number\n tmp = user_data[:phone]\n tmp = user_data[:phone_number] if tmp.nil? || tmp.empty?\n data[:phoneNumber] = tmp if tmp && !tmp.empty?\n\n # Optional position\n tmp = user_data[:position]\n data[:position] = tmp if tmp && !tmp.empty?\n\n # Optional sso provider\n tmp = user_data[:sso_provider]\n data['ssoProvider'] = tmp if tmp && !tmp.empty?\n\n # Optional timezone\n tmp = user_data[:timezone]\n data[:timezone] = tmp if tmp && !tmp.empty?\n\n c = client(opts)\n\n # TODO: It will be nice if the API will return us user just newly created\n begin\n url = \"/gdc/account/domains/#{domain_name}/users\"\n response = c.post(url, :accountSetting => data)\n rescue RestClient::BadRequest\n raise GoodData::UserInDifferentDomainError, \"User #{data[:login]} is already in different domain\"\n end\n\n url = response['uri']\n raw = c.get url\n\n # TODO: Remove this hack when POST /gdc/account/domains/{domain-name}/users returns full profile\n raw['accountSetting']['links'] = {} unless raw['accountSetting']['links']\n raw['accountSetting']['links']['self'] = response['uri'] unless raw['accountSetting']['links']['self']\n c.create(GoodData::Profile, raw)\n end",
"def add_user(rating)\n @user_list[rating.user_id] ||= User.new\n @user_list[rating.user_id].add(rating)\n end",
"def adduser(aNewUser,aPassword,aGroup=nil)\n\t\trun \"#{sudo} adduser --gecos '' #{aGroup ? '--ingroup '+aGroup : ''} #{aNewUser}\" do |ch, stream, out|\n\t\t\tch.send_data aPassword+\"\\n\" if out =~ /UNIX password:/\n\t\tend\n\tend",
"def add(user_id, tag)\n @_client.post(\"/users/#{user_id}/tags\", value: tag)\n end",
"def add(response)\n toggle_membership(response, :add_user_to_group, \"user_added\", \"user_already_in\")\n end",
"def adduser(journal)\n\tputs \"What is the username that you want to add?\"\n\tuser_name = gets.chomp.capitalize\n\tjournal.execute(\"INSERT INTO users (name) VALUES (?)\", [user_name])\nend",
"def register!(user)\n raise \"Already registred\" if user and not user.guest?\n self.user = user and save!\n end",
"def add_user_name(username)\n\t\tuser_name_input.set(username)\n\tend",
"def add_user_to_org(org_id, app_id, user_id)\n app_user = Application\n end",
"def add_user_to_group(user, group)\n\t\t\tend",
"def add_users(resource, users)\n users.each do |u|\n begin\n resource.add_user({ :user_name => u })\n rescue Aws::IAM::Errors::NoSuchEntity\n puts Colors.red(\"\\tNo such user #{u}!\")\n end\n end\n end",
"def add_user_to_template(opts)\n path = \"/template/add_user/#{opts[:template_id]}\"\n opts.delete(:template_id)\n HelloSign::Resource::Template.new post(path, body: opts)\n end",
"def add_user(args = {})\r\n clean_args(args)\r\n success = true\r\n\r\n # Opening in read/write so that we can make the changes to the file\r\n # while under protection of the system r/w lock.\r\n File.open(args[:file] || PASSWORDS_FILE, \"a+\") do |file|\r\n success = write_to_file(file, args[:username], args[:password],\r\n args[:environment], args[:override])\r\n end\r\n\r\n return success\r\n end",
"def create user_name\n response = @client.action \"RegisterUser\", \"Name\" => user_name\n\n Response::User.new response.body['RegisterUserResponse']\n end",
"def add_user(uid, user_set, provider = \"database\")\n user = ::User.find_by(provider: provider, uid: uid)\n user = create_user(uid, provider) if user.nil?\n user_set << user\n user\n end",
"def add_user(member)\n user = @member_class.new :name => member, :node => self.node\n raise unless user.exists?\n self[:users] << member\n self[:users].uniq!\n end",
"def add_user(db, user_name)\r\nadd_user = '\r\n\r\n\tINSERT INTO users \r\n\r\n\t(name, cache, expected_income, actual_income, expenses, month)\r\n\tVALUES (?,0,0,0,0,1)'\r\n\tdb.execute(add_user, [user_name]) \r\nend",
"def add_user(username, password, read_only = false)\n users = self[SYSTEM_USER_COLLECTION]\n user = users.find_one({:user => username}) || {:user => username}\n user['pwd'] = Mongo::Support.hash_password(username, password)\n user['readOnly'] = true if read_only;\n users.save(user)\n user\n end",
"def createNewUser(userName, initialGroup, userEmail, fname, lname, password)\n\n password = password.encrypt\n user = {\"login\" => userName,\n \"group0\" => initialGroup,\n \"email\" => userEmail,\n \"fname\" => fname,\n \"lname\" => lname,\n \"password\" => password,\n \"orga\" => \"0\"}\n saveUser(userName, user)\n end",
"def add_user(username, password)\n response = RequestResponse.new\n user_resp = self.collection(SYSTEM_USER_COLLECTION).first({:user => username})\n user_resp.callback do |res|\n user = res || {:user => username}\n user['pwd'] = EM::Mongo::Support.hash_password(username, password)\n response.succeed self.collection(SYSTEM_USER_COLLECTION).save(user)\n end\n user_resp.errback { |err| response.fail err }\n response\n end",
"def add\n @user = User.new(params[:user])\n \n if @user.save\n redirect_to @user, notice: 'User was successfully created.'\n else\n render action: \"new\"\n end\n end",
"def add_user_player(user)\n @player = Player.new({:ai => '', :game_id => self.id, :user_id => user.id, :money => 100, :username => user.username, :location => self.get_empty_location(), :in_pot_hand => 0, :in_pot_current => 0})\n self.players << @player\n self.save\n end",
"def add_user_to_group(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'AddUserToGroup'\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? :group_name\n\t\t\targs[:query]['GroupName'] = optional[:group_name]\n\t\tend\n\t\tif optional.key? :user_name\n\t\t\targs[:query]['UserName'] = optional[:user_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def create_user(**data)\n create_object(type: 'User', data: { enabled: true }.merge(data))\n end"
] |
[
"0.7603849",
"0.751478",
"0.72711176",
"0.72103393",
"0.7151666",
"0.70998955",
"0.70451564",
"0.7040385",
"0.7026924",
"0.70248336",
"0.69597894",
"0.6925",
"0.69011736",
"0.6880364",
"0.6874549",
"0.68716866",
"0.68665946",
"0.6850294",
"0.68425024",
"0.6792965",
"0.6786671",
"0.6771534",
"0.6761015",
"0.67360246",
"0.6721207",
"0.6718493",
"0.6714284",
"0.66488683",
"0.6621292",
"0.65866494",
"0.6582901",
"0.65758157",
"0.65688956",
"0.65612763",
"0.6551446",
"0.6549176",
"0.6543976",
"0.65384924",
"0.65241164",
"0.65215135",
"0.6499122",
"0.64793605",
"0.6472755",
"0.6470877",
"0.6464373",
"0.64511",
"0.6416567",
"0.6399182",
"0.6398728",
"0.639218",
"0.6380754",
"0.63670015",
"0.6361949",
"0.63602895",
"0.635957",
"0.6332409",
"0.6324202",
"0.63112056",
"0.63102835",
"0.62976867",
"0.62899196",
"0.62737626",
"0.6271586",
"0.6267822",
"0.6258906",
"0.62491506",
"0.6239107",
"0.62388307",
"0.6230426",
"0.6220636",
"0.621182",
"0.62066853",
"0.6199126",
"0.61921597",
"0.6188723",
"0.61688423",
"0.6155879",
"0.6154024",
"0.615007",
"0.6146608",
"0.6143512",
"0.61431277",
"0.6128916",
"0.6119898",
"0.6112132",
"0.6107259",
"0.6105071",
"0.6101572",
"0.60993975",
"0.60993814",
"0.6098902",
"0.6091591",
"0.6070199",
"0.60634273",
"0.6057854",
"0.6057674",
"0.6056996",
"0.6056333",
"0.6047158",
"0.60334367",
"0.60289836"
] |
0.0
|
-1
|
Remove an SGE user
|
def remove
system("qconf -duser #{name}")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def remove_user\n query_api \"/rest/user\", nil, \"DELETE\"\n end",
"def remove_user\n create_user.tap do |r|\n r.action(:remove)\n end\n end",
"def remove_user\n query_api '/rest/user', nil, 'DELETE'\n end",
"def remove_user(user)\n self.users.destroy(user)\n end",
"def remove(name)\n syscmd(\"userdel -f #{name}\")\n syscmd(\"groupdel #{name}\", valid_rcs: [6])\n exclusively { users.delete(name) }\n end",
"def remove_user_by_id(user_id)\n # ........\n end",
"def remove_user(user)\n self.users.destroy(id: user.id)\n end",
"def remove_user(user)\n self.users.destroy(id: user.id)\n end",
"def delete_user(username, removehome=false)\n\t\t\tend",
"def remove_user(jid)\n users.delete(jid.to_s.downcase)\n end",
"def delete_user\n client.delete(user)\n end",
"def remove_user!( user )\n user.remove_group!( self )\n end",
"def delete_user nick\n $log.debug(\"Users.add_user\") { \"Removing user #{nick} on #{@connection.name}\" }\n\n delete nick\n end",
"def remove_user( user )\n raise TypeError.new('not a user') unless user.is_a?(Ecore::User)\n user.remove_group(self)\n end",
"def delete_user\n end",
"def delete(name)\n handle = system.run!(:search, \"user\", name, nil, @keyring)\n system.run!(:unlink, handle, @keyring)\n end",
"def delete_user(id)\n elektron_identity.delete(\"users/#{id}\")\n end",
"def remove_user(username)\n TestLogger.info(\"Remove user #{username}...\")\n user_id = get_user_id(username)\n\n raise(Exception.new(\"User_id for #{username} not found\")) if user_id.nil?\n\n remove_user_by_id(user_id)\n end",
"def deleteUser(id) \n user_to_remove = getUserByID(id)\n\n if user_to_remove != nil \n @Users.delete(user_to_remove)\n else\n puts \"No such user.\"\n end \n end",
"def remove_user(user_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'RemoveUser'\n\t\targs[:query]['UserName'] = user_name\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\tself.run(args)\n\tend",
"def delete_user(user)\n users = roles\n existing = users[\"cloudant\"]\n \n existing.delete(user) if existing\n update_roles(users)\n end",
"def rm_user(member)\n self[:users].delete member\n end",
"def delete nick\n\t\t@users.delete ['nick', nick]\n\tend",
"def remove_user(user)\n group_members.find_by(group: self, user: user).destroy\n end",
"def remove(user)\n GroupMember.new(:group_id => id, :member_id => user.id).delete\n end",
"def remove_user_with_custom_field()\r\n remove_user_without_custom_field\r\n GroupsUserIndexed.find_by_group_id_and_user_id(@group.id, params[:user_id]).try!(&:destroy)\r\n end",
"def remove(opts)\n user = fetch(opts)\n if user\n @data = @data.reject { |u| u == user }\n persist\n end\n user\n end",
"def delete_user(user_name:)\n validate_user_name(:user_name, user_name)\n\n wrap_response(@connection.delete(user_path(user_name))).fmap { |r| SftpgoClient::ApiResponse.new(r.body) }\n end",
"def remove_student(user)\n user = User.find(user) unless user.is_a?(User)\n students.delete(user)\n return 1\n\n rescue\n return 0\n end",
"def remove_user(user)\n @in_room = false if user == @bot\n @users.delete(user)\n end",
"def snmp_user_destroy(opts = {})\n group = [*opts[:roles]].first\n version = opts[:version].to_s.sub('v2', 'v2c')\n cmd = \"no snmp-server user #{opts[:name]} #{group} #{version}\"\n configure cmd\n {}\n end",
"def local_remove(body)\n key_hash = _user_keyhash(body)\n raise \"Invalid username\" unless key_hash\n raise \"That user is signed in!\" if @var[:presence][key_hash]\n @connection.comm.rsa_keys.delete(body)\n @connection.comm.names.delete(key_hash)\n @var[:user_keys].delete body\n _save_env\n _notice \"User '#{body}' has been removed from your key repository\"\nend",
"def remove(response)\n toggle_membership(response, :remove_user_from_group, \"user_removed\", \"user_not_in\")\n end",
"def remove_user(username)\n if self[SYSTEM_USER_COLLECTION].find_one({:user => username})\n self[SYSTEM_USER_COLLECTION].remove({:user => username}, :w => 1)\n else\n false\n end\n end",
"def del_user login\n Command.new(\"deluser #{login} --remove-home -q\", check_file('/home/login', false))\n end",
"def removeWorkingUser user\n @workingUsers.delete user\n end",
"def delete_user(user_name)\n request(\n 'Action' => 'DeleteUser',\n 'UserName' => user_name,\n :parser => Fog::Parsers::AWS::IAM::Basic.new\n )\n end",
"def remove_member(user)\n update_membership(user, false)\n end",
"def delete_user(deluser_id)\n @group_users.delete_if { |item| item.user_id == deluser_id }\n end",
"def delete_user\n begin\n if @kernel_version_major < 11\n guid = @user['generateduid'][0].to_ruby\n password_hash_file = \"#{@@password_hash_dir}/#{guid}\"\n FileUtils.rm_rf(password_hash_file)\n end\n FileUtils.rm_rf(@file)\n rescue Puppet::ExecutionFailure => detail\n fail(\"Could not destroy the user account #{resource[:name]}: #{detail}\")\n end\n end",
"def delete_user(user_id)\n Result.new(call(CMD_DEL_USER % user_id))\n end",
"def remove_user\n @project = Yogo::Project.get(params[:project_id])\n @user = User.get(params[:user_id].to_i)\n if @user.memberships.first(:project_id=> @project.id).destroy\n flash[:notice] = \"#{@user.first_name} #{@user.last_name} has been removed from this project.\"\n else\n flash[:error] = \"Failed to add user! Errors: \" + @user.errors.full_messages.join(', ')\n end\n redirect_to :back\n end",
"def delete_user(user)\n delete user_path(user)\n end",
"def remove_user(user)\n\t\traise Exceptions::InvalidParameter unless user.kind_of? User\n\t\t$redis.multi do\n\t\t\tusers.delete(user.guid)\n\t\t\tuser.events.delete(@guid)\n\t\t\t$redis.publish(kify(:topic, :user, user.guid), {:notification => :user_left_event, :user => user.guid, :event => @guid }.to_json)\n\t\tend\n\tend",
"def delete_user (db, user_name)\n\tdb.execute(\"DELETE FROM users WHERE user_name=?\", [user_name])\nend",
"def remove\n zoomus_client = Zoomus.new\n zoomus_client.user_delete(id: self.zoom_id)\n end",
"def destroy\n\t\t@user.delete\n\tend",
"def delete_user(username)\n\t\t\t\t@session['datastore'][username] = nil\n\t\t\tend",
"def destroy user_name\n response = @client.action \"DeregisterUser\", \"Name\" => user_name\n\n Response::Return.new response.body['DeregisterUserResponse']\n end",
"def delete_old_user(user_id = nil)\n unless user_id.nil?\n user = User.find(user_id)\n user.delete\n end\n end",
"def destroy\n userToBeRemoved = User.find(params[:id])\n userToBeRemoved.destroy\n respond_to do |format|\n format.html { redirect_to users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def remove\n user = User.find_by_username params[:username]\n if @team.name.eql?( Team::A_OWNERS ) && @team.members.count == 1\n flash[:error] = \"There must be at least 1 user at the #{Team::A_OWNERS} team!\"\n else\n @team.remove_member user\n end\n redirect_to organisation_team_path( @organisation, @team )\n end",
"def remove_user!(current_user, user)\n if(!user_exists?(current_user))\n raise SecurityError.new \"No Permissions\"\n end\n\n current_user_role = participants.find_by(user_id: current_user.id)\n if super_admin == current_user || current_user_role.member_type == Course.roles[\"admin\"]\n user = participants.find_by(user_id: user.id)\n if(user != nil)\n user.destroy\n end\n #participants.find_by(user_id: user.id).destroy\n return true\n end\n\n raise SecurityError.new \"No Permissions\"\n end",
"def remove_user(user_id)\n\t\treturn if is_admin?(user_id)\n\t\tparty_list.delete(user_id)\n\t\tself.update_attribute(:party_list, party_list)\n\tend",
"def delete_user(user)\n res1 = remove_filtered_grouping_policy(0, user)\n res2 = remove_filtered_policy(0, user)\n res1 || res2\n end",
"def destroy\n user.destroy\n end",
"def remove(user)\n if(self.isIn(user))\n @mysqlHelper.deleteDisConUser(user.getI, @id)\n @userList.remove(user)\n @userList.getcontents.each { |users|\n users.userChangeFromChannel(\"205\", @id, user.getId)\n }\n end\n end",
"def delete_user(user, removehome=false)\n\t\t\t\tusername = nil\n\t\t\t\tif(user.respond_to?(:username))\n\t\t\t\t\tusername = user.username\n\t\t\t\telse\n\t\t\t\t\tusername = user.to_s\n\t\t\t\tend\n\t\t\t\tCfruby.controller.attempt(\"Removing user \\\"#{username}\\\"\", 'nonreversible', 'destructive') {\n\t\t\t\t\tif(removehome == true)\n\t\t\t\t\t\t`pw userdel #{username} -r`\n\t\t\t\t\telse\n\t\t\t\t\t\t`pw userdel #{username}`\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\tend",
"def remove_user\n\t\troom = Room.find(params[:room_id].to_i)\n\t\tuser = current_user\n\t\troom.users.delete(user) # Deletes user from room when they leave the browser window\n\t\t# --- If no users remain in room, all data about the room deletes itself ---\n\t\tif room.users.length == 0 \n\t\t\troom.songs.each do |song|\n\t\t\t\tsong.destroy\n\t\t\tend\n\t\t\troom.destroy\n\t\tend\n\t\t# --- end ---\n\t\t# Remove user from user-list\n\t\t$redis.publish(\"remove_user_#{room.id}\", {user: current_user.username, id: current_user.id}.to_json) \n\t\t# --- end ---\n\t\trender nothing: true\n\tend",
"def destroy_user(id)\n #TODO:\n # ADD SOME USER LEVEL TO AVOID THESE\n end",
"def del_member(_user_id)\n update!(del_members: [_user_id])\n end",
"def remove_retailer\n user_id = params[:user_id]\n remove_user(user_id)\n render json: { result: 'success' }, status: 200\n end",
"def unlink_user\n user and update(email: user.email, user_id: nil)\n end",
"def delete_user(id)\n @user = User.destroy(id)\n end",
"def delete\n @linked_user.delete(@uri)\n end",
"def remove_member(user)\n members.delete user if has_member? user\n end",
"def remove_user(user)\n self.users.delete(user.user_id)\n user.databases.delete(self._id)\n self.save\n user.save\n end",
"def destroy_user\n if !user.blank?\n user.destroy\n end\n end",
"def delete_user(id)\n get_user_byid(id).destroy\n end",
"def parse_user_remove(msg_details)\n username = msg_details\n @userlist_table[username] = nil\n return username\n end",
"def remove_user(user_id)\n user = User.find(user_id)\n unless user.blank?\n Consumption.where(user_id: user_id, action_status: Consumption::ActionStatusPending).destroy_all#.delete_all\n Arrangement.where(user_id: user_id, action_status: Consumption::ActionStatusPending).destroy_all#.delete_all\n user.email = string_for_user_value(user.email)\n user.company_unique_entity_number = string_for_user_value(user.company_unique_entity_number)\n user.company_license_number = string_for_user_value(user.company_license_number)\n user.is_deleted = 1\n user.approval_status = User::ApprovalStatusRemoved\n user.deleted_at = DateTime.current\n user.save!\n end\n user\n end",
"def remove_user_from_group(user, group)\n\t\t\tend",
"def remove_user_from_template(opts)\n path = \"/template/remove_user/#{opts[:template_id]}\"\n opts.delete(:template_id)\n HelloSign::Resource::Template.new post(path, body: opts)\n end",
"def destroy\n @user.destroy\n\n head :no_content\n end",
"def destroy\n @user.destroy\n\n head :no_content\n end",
"def destroy\n @user.destroy\n head :no_content\n end",
"def delete\n connection.delete_user id\n nil\n end",
"def remove_user(user)\n Role.remove_user role_id: id, user_id: user.id\n end",
"def delete_user_route(user)\n self.client.delete(\"gh.storage.user.#{user}\")\n end",
"def center_stage_remove\n user_id = params[:user_id]\n session_id = params[:id]\n session_user_record = SessionUser.where(\"session_id = ? and user_id = ?\",\n session_id, user_id)[0]\n if session_user_record.update(center_stage: false)\n render json: {message: \"#{user_id} removed from center stage of session #{session_id}\"},\n status: 200\n else\n render json: { errors: session_user_record.errors.to_json }, status: 500\n end\n end",
"def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to(admin_users_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted user #{@user.name}\")\n end",
"def remove_member(auth, server_id, user_id, reason = nil)\n MijDiscord::Core::API.request(\n :guilds_sid_members_uid,\n server_id,\n :delete,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/members/#{user_id}\",\n Authorization: auth,\n content_type: :json,\n 'X-Audit-Log-Reason': reason\n )\n end",
"def user_absent(name, &block)\n execute(\"if dscl . -list /Users/#{name}; then dscl . -delete /Users/#{name}; fi\", {}, &block)\n end",
"def delete_user(username = nil)\n # Check that user has authenticated\n @local_auth_error = local_auth_error\n return Hash[@error => @local_auth_error] if @local_auth_error\n\n unless username\n return Hash[@error =>\n 'missing username; please add to method call']\n end\n\n delete_object('users', username)\n end",
"def remove_member(id, user)\n client.delete(\"#{path}/#{id}/members\", user)\n end",
"def remove_user\n if !params[:user_ids].nil?\n stage = Stage.find(params[:id])\n params[:user_ids].each do |user_id|\n user = AssetUser.find(user_id.to_i)\n stage.asset_users.delete(user)\n end\n if stage.save\n redirect_to :back, :notice => \"Users successfully were removed from #{stage.title}\"\n else\n redirect_to :back, :alert => \"Action could not be completed\"\n end\n else\n redirect_to :back, :alert => \"No users were selected\"\n end\n end",
"def delete(context, name)\n res = context.transport.delete_request(context, \"security/users/#{name}\")\n\n context.err(name, res.body) unless res.success?\n end",
"def destroy\n @user = User.find(params[:id])\n @user.destroy\n \n flash[:notice] = \"User #{@user.login} deleted\"\n \n respond_to do |format|\n format.html { redirect_to(space_users_path(@space)) }\n format.xml { head :ok }\n format.atom { head :ok }\n end\n end",
"def remove(name, key)\n issueKey_test(key)\n fetch({:method => :delete, :body_to_params => true, :body => {:username => name}, :parent => parent_name, :parent_key => key})\n end",
"def remove_user(user, opts={})\n return false unless user?(user, opts)\n unh = self._user_and_host(user, opts[:host])\n self.interpreter.log.info(PNOTE+\"Removed MySQL user: #{unh}\")\n self.fetch(\"delete from mysql.user where User = ? and Host = ?\", user, opts[:host] || \"%\") if self.interpreter.writing?\n return true\n end",
"def remove_member(user)\n if (self.members.include?(user))\n self.memberships.find_by_user_id(user.id).destroy\n else\n raise GroupsManagement::UserIsNotMember, \"The user \" + user.email + \" is not a member of the group '\" + self.name + \"'.\"\n end\n \n end",
"def remove_user_from_group(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'RemoveUserFromGroup'\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? :group_name\n\t\t\targs[:query]['GroupName'] = optional[:group_name]\n\t\tend\n\t\tif optional.key? :user_name\n\t\t\targs[:query]['UserName'] = optional[:user_name]\n\t\tend\n\t\tself.run(args)\n\tend",
"def remove_user\n group_id_param = params[:group_id]\n user_id_param = params[:user_id]\n\n if group_id_param.nil? || group_id_param.blank?\n render json: { error: 'group_id not specified.' }, status: :bad_request\n return\n end\n\n if user_id_param.nil? || user_id_param.blank?\n render json: { error: 'user_id not specified.' }, status: :bad_request\n return\n end\n\n user = User.find_by_id(user_id_param)\n if user.nil?\n render json: { error: \"Remove failed. Can't find user #{user_param}.\" }, status: :bad_request\n return\n end\n\n group = CanvasSpaces.GroupCategory.groups.find_by_id(group_id_param)\n if group.nil?\n render json: { error: 'No such group found.' }, status: :bad_request\n else\n if @current_user.account.site_admin? || group.leader_id == @current_user.id || @current_user.id == user.id\n if group.leader_id == user.id\n render json: { error: \"Can't remove user that is the leader of the group.\" }, status: :bad_request\n return\n end\n\n membership = group.group_memberships.where(user_id: user).first\n membership.workflow_state = 'deleted'\n membership.save\n render json: { message: 'Successfully removed user.' }, status: :ok\n else\n # doesn't have access to the group\n render json: { error: \"Can't remove user. Not owner or not adding self.\" }, status: :forbidden\n end\n end\n end",
"def destroy(user)\n unless user.id\n self.class.invalid_object!(\"Cannot save user #{user.username} without a valid id\")\n end\n\n unless execute_sql(:validate, :user) { table.select(:id).filter(:id => user.id).any? }\n raise RecordNotFound, \"Can't delete user #{user.username} because it doesn't exist\"\n end\n\n execute_sql(:delete, :user) { table.filter(:id => user.id).delete }\n end",
"def delete user_id, options={}, headers={}\n @connection.delete \"users/#{user_id}.json\", options, headers\n end",
"def delete\n appctrl_delete( 'User' )\n end",
"def destroy\n @user_allergen.destroy\n end",
"def remove_user_from_quick_invoicing\n company.saved_invoice_users.delete(User.find(params[:user_id]))\n\n head :ok\n end",
"def remove_member(_team, _user)\n # stub\n end",
"def delete_user(userid) \n $db.execute('DELETE FROM users WHERE userid=?', userid)\n end",
"def delete_user(username)\n groups = Avalon::RoleControls.user_roles username\n User.where(Devise.authentication_keys.first => username).destroy_all\n groups.each do |group|\n Avalon::RoleControls.remove_user_role(username, group)\n end\n end"
] |
[
"0.7692844",
"0.76537216",
"0.7575168",
"0.73951584",
"0.73552257",
"0.73220086",
"0.72247833",
"0.72247833",
"0.7114189",
"0.71008396",
"0.7027343",
"0.6995356",
"0.69880724",
"0.69820684",
"0.696862",
"0.6931495",
"0.6920463",
"0.69049597",
"0.68771243",
"0.68620926",
"0.68363905",
"0.68313694",
"0.6813347",
"0.67670006",
"0.6765244",
"0.67560863",
"0.67457527",
"0.6741195",
"0.6733151",
"0.6726436",
"0.6724402",
"0.6709957",
"0.66968304",
"0.667372",
"0.6659587",
"0.665194",
"0.6642971",
"0.663856",
"0.6631804",
"0.6616951",
"0.66164625",
"0.6602254",
"0.65901875",
"0.65836483",
"0.65826094",
"0.6571413",
"0.6565431",
"0.6547981",
"0.6540545",
"0.6539826",
"0.65381545",
"0.6534581",
"0.653437",
"0.65238476",
"0.65217686",
"0.6519313",
"0.6518964",
"0.6517737",
"0.64997363",
"0.64970773",
"0.6482051",
"0.6474844",
"0.64667684",
"0.6464141",
"0.645887",
"0.6447738",
"0.64412904",
"0.6422401",
"0.64183897",
"0.64183134",
"0.64089006",
"0.64057183",
"0.64039904",
"0.639612",
"0.639612",
"0.63933516",
"0.6382825",
"0.6378131",
"0.63709235",
"0.63627964",
"0.63606125",
"0.63602424",
"0.63572973",
"0.63415563",
"0.6341364",
"0.6340813",
"0.6329813",
"0.63214946",
"0.63209677",
"0.63202",
"0.6314235",
"0.6309225",
"0.63091785",
"0.6299573",
"0.6295178",
"0.6290969",
"0.62890196",
"0.6280787",
"0.6273698",
"0.62696344",
"0.62692523"
] |
0.0
|
-1
|
GET /tipo_venta GET /tipo_venta.json
|
def index
@tipo_venta = TipoVentum.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @ventas = Venta.order(\"fecha desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas }\n end\n end",
"def show\n\n @evento = Evento.find(params[:id])\n @comentarios = Comentario.where(:comentavel_id => @evento.id, :comentavel_type => \"Evento\").order('created_at DESC')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evento }\n end\n end",
"def show\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_vehiculo }\n end\n end",
"def show\n @tipo_atendimento = TipoAtendimento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_atendimento }\n end\n end",
"def show\n @ventas_seguimiento = Ventas::Seguimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ventas_seguimiento }\n end\n end",
"def show\n @tipo_contrato = TipoContrato.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_contrato }\n end\n end",
"def show\n @articulo = Articulo.find(params[:id])\n @noticias = Articulo.where(\"tipo = 'noticia'\").order(\"created_at desc\")\n @title = @articulo.titulo\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end",
"def show\n @tipo_negocio = TipoNegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_negocio }\n end\n end",
"def show\n @venta = Venta.find(params[:id])\n\n @domicilios = Domicilio.where(usuario_id: @venta.usuario.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venta }\n end\n end",
"def show\n render json: @dia_evento\n end",
"def show\n @depoevento = Depoevento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @depoevento }\n end\n end",
"def show\n @tipo_alerta = TipoAlerta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_alerta }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def index\n\n if params[:ventas_seguimiento]\n cliente_id = params[:ventas_seguimiento][:cliente_id]\n @ventas_seguimientos = Ventas::Seguimiento.where(\"cliente_id = ?\",cliente_id).order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new(:cliente_id => cliente_id)\n else\n @ventas_seguimientos = Ventas::Seguimiento.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas_seguimientos }\n end\n end",
"def show\n @tipo_pensum = TipoPensum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_pensum }\n end\n end",
"def show\n render json: @itemtipo\n end",
"def show\n @evento = Evento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evento }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tecnico }\n end\n end",
"def show\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @servicio }\n end\n end",
"def index\n @ofertas = Oferta.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ofertas }\n end\n end",
"def show\n @tipo_actividad = TipoActividad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_actividad }\n end\n end",
"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 show\n @tipo_convenio = TipoConvenio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_convenio }\n end\n end",
"def show\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @veiculo }\n end\n end",
"def show\n @estatuto = Estatuto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estatuto }\n end\n end",
"def show\n @tipo_usuario = TipoUsuario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_usuario }\n end\n end",
"def get_ponto\n render json: Usuario.ultimo_ponto(params[:user_id], params[:evento_id]).to_json\n end",
"def show\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @solicitud_servicio }\n end\n end",
"def new\n @venta = Venta.new(:fecha => Date.today, confirmada: true)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @venta }\n end\n end",
"def show\n @etnia = Etnia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etnia }\n end\n end",
"def show\n @conta = Conta.find(params[:id])\n respond_to do |format|\n format.html { render :show }\n format.json { render json: @conta, :include => {\n :movimentos => {\n :include => [:nota, :pessoa],\n :methods => [:favorecido],\n :except => [:created_at, :updated_at]\n }\n },\n :methods => [:saldo]\n }\n end\n end",
"def show\n @tipo_pregunta = TipoPregunta.find(params[:id])\n\n render json: @tipo_pregunta\n end",
"def index\n @itemtipos = Itemtipo.all\n\n render json: @itemtipos\n end",
"def show\n @tipo_item = TipoItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_item }\n end\n end",
"def show\n @territorio = Territorio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @territorio }\n end\n end",
"def index\n @formatoventa = Formatoventum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @formatoventa }\n end\n end",
"def show\n @tipo_product = TipoProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_product }\n end\n end",
"def new\n @servicio = Servicio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @servicio }\n end\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def index\n @tipo_usuarios = TipoUsuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tipo_usuarios }\n end\n end",
"def show\n @denuncia_tipo = DenunciaTipo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @denuncia_tipo }\n end\n end",
"def index\n @tipo_veiculos = TipoVeiculo.all\n end",
"def etiquetas_por_aluno\n logger.info(params)\n @etiquetas_aluno = Etiqueta.all.where(aluno_id: params[:aluno_id])\n respond_with @etiquetas_aluno\n end",
"def show\n @empresa_servicio = EmpresaServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @empresa_servicio }\n end\n end",
"def show\n @entrada_inventario = EntradaInventario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entrada_inventario }\n end\n end",
"def index\n @dia_eventos = DiaEvento.all\n render json: @dia_eventos\n end",
"def estaciones\n\n param_estacion = params[:estacion]\n param_fecha = params[:fecha].to_i\n @info_polens = InfoPolen.where({\"ESTACIONES\" => param_estacion, \"FECHA\" => param_fecha}).order_by(:TIPOS_POLINICOS.asc)\n\n respond_to do |format|\n format.html #{ redirect_to info_polens_url }\n format.json { render json: @info_polens }\n end\n end",
"def show\n @sitio_entrega = SitioEntrega.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio_entrega }\n end\n end",
"def show\n @tipo_documento = TipoDocumento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_documento }\n end\n end",
"def index\n @tipo_vendas = TipoVenda.all\n end",
"def show\n @ventas_presupuesto = Ventas::Presupuesto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ventas_presupuesto }\n end\n end",
"def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end",
"def show\n @serv_adicionale = ServAdicionale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serv_adicionale }\n end\n end",
"def show\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @oferta }\n end\n end",
"def show\n @utente = Utente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @utente }\n end\n end",
"def show\n @observacao_vocacionada = ObservacaoVocacionada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @observacao_vocacionada }\n end\n end",
"def show\n @tipo_tel = TipoTel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_tel }\n end\n end",
"def show\n @categorias_tipo = CatTipo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @categorias_tipo }\n end\n end",
"def show\n @trabalho = Trabalho.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trabalho }\n end\n end",
"def index\n @formatos = Formato.where(ativo: true)\n \t\n render json: @formatos\n end",
"def show\n @calificacion_servicio = CalificacionServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @calificacion_servicio }\n end\n end",
"def new\n @evento = Evento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @evento }\n end\n end",
"def show\n @core_tipo_unidade = Core::TipoUnidade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @core_tipo_unidade }\n end\n end",
"def index\n @ventas = Venta.all\n end",
"def index\n @ventas = Venta.all\n end",
"def index\n @antecedentes = Antecedente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @antecedentes }\n end\n end",
"def show\n @estudiante = Estudiante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estudiante }\n end\n end",
"def index\n @tipo_de_servicios = TipoDeServicio.all\n end",
"def show\n @asiento = Asiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @asiento }\n end\n end",
"def show\n # Mostra la descrizione di un evento (magari su una finestrella)\n render json: @event\n end",
"def index\n @plan_de_venta = PlanDeVentum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plan_de_venta }\n end\n end",
"def new\n @peticion_servicio_ti = Peticion::ServicioTi.new\n load_data\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @peticion_servicio_ti }\n end\n end",
"def index\n @tipo_products = TipoProduct.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tipo_products }\n end\n end",
"def show\n @ativo_outro = AtivoOutro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ativo_outro }\n end\n end",
"def new\n @tipo_vehiculo = TipoVehiculo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_vehiculo }\n end\n end",
"def show\n @agenda_type = AgendaType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @agenda_type }\n end\n end",
"def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end",
"def show\n @tipomedalla = Tipomedalla.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipomedalla }\n end\n end",
"def index\n @territorios = Territorio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @territorios }\n end\n end",
"def show\n @estacionamiento = Estacionamiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estacionamiento }\n end\n end",
"def show\n @statuspagamento = Statuspagamentoe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @statuspagamento }\n end\n end",
"def new\n @depoevento = Depoevento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @depoevento }\n end\n end",
"def new\n @veiculo = Veiculo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @veiculo }\n end\n end",
"def show\n @event_type = EventType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event_type }\n end\n end",
"def show\n @local_deportivo = LocalDeportivo.find(params[:id], :conditions=> \"estado = 'C' OR estado is NULL\")\n \n @espacio_deportivos = @local_deportivo.espacio_deportivos.find(:all)\n \n \n respond_to do |format|\n format.html \n format.json { render json: {:espacio_deportivos =>@espacio_deportivos, :local_deportivo => @local_deportivo }}\n end\n \n end",
"def show\n @leito = Leito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leito }\n end\n end",
"def show\n render json: @departamento\n end",
"def show\n @apunte = Apunte.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apunte }\n end\n end",
"def index\n @subcategorias = Subcategoria.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @subcategorias }\n end\n end",
"def show\n render json: @formato\n end",
"def show\n @tipocliente = Tipocliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @tipocliente }\n end\n end",
"def show\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @peso }\n end\n end",
"def new\n @tipo_alerta = TipoAlerta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_alerta }\n end\n end",
"def new\n @tipo_atendimento = TipoAtendimento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_atendimento }\n end\n end",
"def index\n @categorias = Categoria.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @categorias }\n end\n end",
"def index\n @tipoapreensoes = Tipoapreensao.all\n end",
"def new\n @tecnico = Tecnico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def index\n #Cada user puede ver los eventos en los que ha sido elegido como responsable\n #El admin puede verlos todos\n if current_user.admin or current_user.ingeniero\n @gestion_eventos= Gestion::Evento.all if current_user.admin or current_user.ingeniero\n elsif\n @gestion_eventos= Gestion::Evento.where(:usuario_id => current_user.perfil_id) \n end\n respond_to do |format|\n format.html\n format.xml { render xml: @gestion_eventos}\n format.json { render json: @gestion_eventos.map{|u| [\"title\" => \"#{u.titulo} (#{u.descripcion})\", \"url\" => gestion_evento_path(u)]}.flatten}\n end\n end",
"def new\n @tecnico = Tecnico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @tecnico }\n end\n end"
] |
[
"0.6942735",
"0.6925548",
"0.6880988",
"0.6825113",
"0.67987573",
"0.67135465",
"0.66853625",
"0.6684955",
"0.6644784",
"0.6624199",
"0.66174984",
"0.6594518",
"0.65875727",
"0.65875727",
"0.65865386",
"0.6560805",
"0.65582186",
"0.6553839",
"0.65499914",
"0.65404946",
"0.6527922",
"0.6502528",
"0.65022707",
"0.6481361",
"0.64690304",
"0.64559305",
"0.64227873",
"0.6400608",
"0.6368093",
"0.63434094",
"0.6327769",
"0.6327551",
"0.6313598",
"0.6313177",
"0.631128",
"0.6308092",
"0.6307627",
"0.62962735",
"0.62831485",
"0.62822986",
"0.6279959",
"0.62793696",
"0.62760115",
"0.6267878",
"0.62614286",
"0.62551665",
"0.6242613",
"0.62167317",
"0.62107134",
"0.6192808",
"0.6186805",
"0.61775583",
"0.6159932",
"0.6151763",
"0.61451983",
"0.6142764",
"0.6137174",
"0.6135175",
"0.61232114",
"0.61226714",
"0.6119434",
"0.61113566",
"0.61105615",
"0.61060923",
"0.6103604",
"0.6103604",
"0.60989165",
"0.6096965",
"0.60901654",
"0.6088723",
"0.6084177",
"0.6079095",
"0.6079074",
"0.60726637",
"0.6069514",
"0.60669225",
"0.60662997",
"0.6056512",
"0.6052233",
"0.6046192",
"0.60445917",
"0.60435724",
"0.6042524",
"0.60413563",
"0.6039462",
"0.6035873",
"0.6034177",
"0.60313797",
"0.60313225",
"0.60275495",
"0.60233665",
"0.6019501",
"0.601948",
"0.6018937",
"0.6017331",
"0.6013993",
"0.60133433",
"0.60091805",
"0.5999265",
"0.599765"
] |
0.67536235
|
5
|
GET /tipo_venta/1 GET /tipo_venta/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_vehiculo }\n end\n end",
"def index\n @ventas = Venta.order(\"fecha desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas }\n end\n end",
"def show\n @tipo_atendimento = TipoAtendimento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_atendimento }\n end\n end",
"def show\n @tipo_contrato = TipoContrato.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_contrato }\n end\n end",
"def show\n\n @evento = Evento.find(params[:id])\n @comentarios = Comentario.where(:comentavel_id => @evento.id, :comentavel_type => \"Evento\").order('created_at DESC')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evento }\n end\n end",
"def show\n @ventas_seguimiento = Ventas::Seguimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ventas_seguimiento }\n end\n end",
"def show\n @tipo_negocio = TipoNegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_negocio }\n end\n end",
"def index\n @tipo_venta = TipoVentum.all\n end",
"def show\n @articulo = Articulo.find(params[:id])\n @noticias = Articulo.where(\"tipo = 'noticia'\").order(\"created_at desc\")\n @title = @articulo.titulo\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articulo }\n end\n end",
"def show\n @tipo_pensum = TipoPensum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_pensum }\n end\n end",
"def show\n @venta = Venta.find(params[:id])\n\n @domicilios = Domicilio.where(usuario_id: @venta.usuario.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venta }\n end\n end",
"def show\n @tipo_alerta = TipoAlerta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_alerta }\n end\n end",
"def index\n @ofertas = Oferta.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ofertas }\n end\n end",
"def show\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @servicio }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def index\n\n if params[:ventas_seguimiento]\n cliente_id = params[:ventas_seguimiento][:cliente_id]\n @ventas_seguimientos = Ventas::Seguimiento.where(\"cliente_id = ?\",cliente_id).order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new(:cliente_id => cliente_id)\n else\n @ventas_seguimientos = Ventas::Seguimiento.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas_seguimientos }\n end\n end",
"def show\n @tipo_convenio = TipoConvenio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_convenio }\n end\n end",
"def show\n @depoevento = Depoevento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @depoevento }\n end\n end",
"def show\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @veiculo }\n end\n end",
"def show\n @tipo_actividad = TipoActividad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_actividad }\n end\n end",
"def show\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @tecnico }\n end\n end",
"def show\n render json: @itemtipo\n end",
"def show\n @evento = Evento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evento }\n end\n end",
"def show\n @estatuto = Estatuto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estatuto }\n end\n end",
"def 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 show\n @tipo_usuario = TipoUsuario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_usuario }\n end\n end",
"def show\n render json: @dia_evento\n end",
"def show\n @tipo_item = TipoItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_item }\n end\n end",
"def show\n @tipo_pregunta = TipoPregunta.find(params[:id])\n\n render json: @tipo_pregunta\n end",
"def show\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @solicitud_servicio }\n end\n end",
"def show\n @tipo_product = TipoProduct.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_product }\n end\n end",
"def show\n @territorio = Territorio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @territorio }\n end\n end",
"def index\n @itemtipos = Itemtipo.all\n\n render json: @itemtipos\n end",
"def new\n @venta = Venta.new(:fecha => Date.today, confirmada: true)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @venta }\n end\n end",
"def show\n @denuncia_tipo = DenunciaTipo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @denuncia_tipo }\n end\n end",
"def index\n @formatoventa = Formatoventum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @formatoventa }\n end\n end",
"def show\n @etnia = Etnia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etnia }\n end\n end",
"def show\n @empresa_servicio = EmpresaServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @empresa_servicio }\n end\n end",
"def new\n @servicio = Servicio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @servicio }\n end\n end",
"def show\n @entrada_inventario = EntradaInventario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entrada_inventario }\n end\n end",
"def show\n @tipo_documento = TipoDocumento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_documento }\n end\n end",
"def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end",
"def show\n @conta = Conta.find(params[:id])\n respond_to do |format|\n format.html { render :show }\n format.json { render json: @conta, :include => {\n :movimentos => {\n :include => [:nota, :pessoa],\n :methods => [:favorecido],\n :except => [:created_at, :updated_at]\n }\n },\n :methods => [:saldo]\n }\n end\n end",
"def show\n @serv_adicionale = ServAdicionale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serv_adicionale }\n end\n end",
"def show\n @sitio_entrega = SitioEntrega.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio_entrega }\n end\n end",
"def index\n @tipo_veiculos = TipoVeiculo.all\n end",
"def index\n @tipo_usuarios = TipoUsuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tipo_usuarios }\n end\n end",
"def show\n @observacao_vocacionada = ObservacaoVocacionada.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @observacao_vocacionada }\n end\n end",
"def show\n @tipo_tel = TipoTel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_tel }\n end\n end",
"def get_ponto\n render json: Usuario.ultimo_ponto(params[:user_id], params[:evento_id]).to_json\n end",
"def show\n @core_tipo_unidade = Core::TipoUnidade.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @core_tipo_unidade }\n end\n end",
"def show\n @trabalho = Trabalho.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trabalho }\n end\n end",
"def show\n @ventas_presupuesto = Ventas::Presupuesto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ventas_presupuesto }\n end\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def show\n @utente = Utente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @utente }\n end\n end",
"def show\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @oferta }\n end\n end",
"def index\n @subcategorias = Subcategoria.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @subcategorias }\n end\n end",
"def index\n @tipo_vendas = TipoVenda.all\n end",
"def show\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @peso }\n end\n end",
"def show\n @categorias_tipo = CatTipo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @categorias_tipo }\n end\n end",
"def show\n @leito = Leito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leito }\n end\n end",
"def show\n @estudiante = Estudiante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estudiante }\n end\n end",
"def index\n @formatos = Formato.where(ativo: true)\n \t\n render json: @formatos\n end",
"def index\n @dia_eventos = DiaEvento.all\n render json: @dia_eventos\n end",
"def show\n @calificacion_servicio = CalificacionServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @calificacion_servicio }\n end\n end",
"def show\n @statuspagamento = Statuspagamentoe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @statuspagamento }\n end\n end",
"def new\n @tipo_vehiculo = TipoVehiculo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_vehiculo }\n end\n end",
"def show\n @tipomedalla = Tipomedalla.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipomedalla }\n end\n end",
"def index\n @tipo_products = TipoProduct.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tipo_products }\n end\n end",
"def show\n @ativo_outro = AtivoOutro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ativo_outro }\n end\n end",
"def index\n @categorias = Categoria.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @categorias }\n end\n end",
"def index\n @plan_de_venta = PlanDeVentum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plan_de_venta }\n end\n end",
"def show\n @tipocliente = Tipocliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @tipocliente }\n end\n end",
"def show\n @asiento = Asiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @asiento }\n end\n end",
"def index\n @ventas = Venta.all\n end",
"def index\n @ventas = Venta.all\n end",
"def show\n @tipo_vinculo = TipoVinculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tipo_vinculo }\n end\n end",
"def etiquetas_por_aluno\n logger.info(params)\n @etiquetas_aluno = Etiqueta.all.where(aluno_id: params[:aluno_id])\n respond_with @etiquetas_aluno\n end",
"def index\n @antecedentes = Antecedente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @antecedentes }\n end\n end",
"def new\n @veiculo = Veiculo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @veiculo }\n end\n end",
"def show\n @indicativo = Indicativo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @indicativo }\n end\n end",
"def new\n @peticion_servicio_ti = Peticion::ServicioTi.new\n load_data\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @peticion_servicio_ti }\n end\n end",
"def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end",
"def show\n @status_de_la_inscripcion = StatusDeLaInscripcion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_de_la_inscripcion }\n end\n end",
"def show\n @core_status_selo_fiscal_tipo = Core::StatusSeloFiscalTipo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @core_status_selo_fiscal_tipo }\n end\n end",
"def show\n @apunte = Apunte.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @apunte }\n end\n end",
"def show\n @fulcliente = Fulcliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fulcliente }\n end\n end",
"def show\n @vano = Vano.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vano }\n end\n end",
"def show\n @agenda_type = AgendaType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @agenda_type }\n end\n end",
"def new\n @tipo_alerta = TipoAlerta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_alerta }\n end\n end",
"def index\n @tipo_de_servicios = TipoDeServicio.all\n end",
"def show\n @cliente = Cliente.find(params[:cliente_id])\n @pago = @cliente.pagos.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pago }\n end\n end",
"def show\n @trnodo = Trnodo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trnodo }\n end\n end",
"def show\n @event_type = EventType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event_type }\n end\n end",
"def show\n @estacionamiento = Estacionamiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estacionamiento }\n end\n end",
"def index\n @territorios = Territorio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @territorios }\n end\n end",
"def new\n @evento = Evento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @evento }\n end\n end",
"def show\n @activo = Activo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @activo }\n end\n end",
"def new\n @tipo_atendimento = TipoAtendimento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_atendimento }\n end\n end",
"def show\n @movimentacao_de_estoque = MovimentacaoDeEstoque.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @movimentacao_de_estoque }\n end\n end"
] |
[
"0.70174927",
"0.6898491",
"0.6890585",
"0.6844534",
"0.68257654",
"0.6825207",
"0.67990077",
"0.6754393",
"0.67279553",
"0.6721315",
"0.6688154",
"0.6686874",
"0.6658056",
"0.66360027",
"0.6633383",
"0.6633383",
"0.66331726",
"0.66279227",
"0.6605922",
"0.6605021",
"0.65989596",
"0.65926206",
"0.6571619",
"0.65267444",
"0.65182865",
"0.65019804",
"0.64908785",
"0.6489249",
"0.64889866",
"0.647102",
"0.64501286",
"0.64413667",
"0.6364693",
"0.63584316",
"0.63542795",
"0.63520104",
"0.63421005",
"0.6338114",
"0.6337482",
"0.63263506",
"0.6320393",
"0.631335",
"0.63111156",
"0.631061",
"0.628959",
"0.62859935",
"0.62849593",
"0.6281776",
"0.6273512",
"0.6273301",
"0.6258562",
"0.62355614",
"0.6230841",
"0.62221533",
"0.6221394",
"0.62188554",
"0.6213362",
"0.61963236",
"0.6183165",
"0.6180087",
"0.6175527",
"0.6172088",
"0.61692345",
"0.6164691",
"0.6161161",
"0.6156168",
"0.6150693",
"0.6146586",
"0.6143572",
"0.6141994",
"0.61419123",
"0.6134117",
"0.613133",
"0.613036",
"0.61230457",
"0.6122805",
"0.6122805",
"0.61156976",
"0.6114192",
"0.61113846",
"0.6108388",
"0.61062634",
"0.6101531",
"0.6099803",
"0.60966784",
"0.6093568",
"0.6089057",
"0.6088314",
"0.60875183",
"0.6084863",
"0.6083644",
"0.6082985",
"0.60625315",
"0.60619074",
"0.6058833",
"0.60563064",
"0.6050117",
"0.6047632",
"0.6042877",
"0.60356945",
"0.60356486"
] |
0.0
|
-1
|
POST /tipo_venta POST /tipo_venta.json
|
def create
@tipo_ventum = TipoVentum.new(tipo_ventum_params)
respond_to do |format|
if @tipo_ventum.save
format.html { redirect_to @tipo_ventum, notice: 'Tipo ventum was successfully created.' }
format.json { render :show, status: :created, location: @tipo_ventum }
else
format.html { render :new }
format.json { render json: @tipo_ventum.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @servico_evento = Servico::Evento.new(servico_evento_params)\n\n respond_to do |format|\n if @servico_evento.save\n format.html { redirect_to @servico_evento, notice: 'Evento was successfully created.' }\n format.json { render action: 'show', status: :created, location: @servico_evento }\n else\n format.html { render action: 'new' }\n format.json { render json: @servico_evento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_venda = TipoVenda.new(tipo_venda_params)\n\n respond_to do |format|\n if @tipo_venda.save\n format.html { redirect_to @tipo_venda, notice: 'Tipo venda was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_venda }\n else\n format.html { render :new }\n format.json { render json: @tipo_venda.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @venta = Venta.new(params[:venta])\n\n respond_to do |format|\n if @venta.save\n format.html { redirect_to @venta, notice: 'Venta was successfully created.' }\n format.json { render json: @venta, status: :created, location: @venta }\n else\n format.html { render action: \"new\" }\n format.json { render json: @venta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_de_servicio = TipoDeServicio.new(tipo_de_servicio_params)\n\n respond_to do |format|\n if @tipo_de_servicio.save\n format.html { redirect_to @tipo_de_servicio, notice: 'Tipo de servicio was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_de_servicio }\n else\n format.html { render :new }\n format.json { render json: @tipo_de_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @venta = Venta.new(venta_params)\n\n respond_to do |format|\n if @venta.save\n format.html { redirect_to @venta, notice: 'Venta was successfully created.' }\n format.json { render :show, status: :created, location: @venta }\n else\n format.html { render :new }\n format.json { render json: @venta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dia_evento = DiaEvento.new(dia_evento_params)\n\n if @dia_evento.save\n render json: @dia_evento, status: :created, location: @dia_evento\n else\n render json: @dia_evento.errors, status: :unprocessable_entity\n end\n end",
"def create\n @empresa = Empresa.find(params[:empresa_id])\n\n @tipo_de_imposto = TipoDeImposto.new(tipo_de_imposto_params)\n @tipo_de_imposto.empresa_id = @empresa.id\n\n respond_to do |format|\n if @tipo_de_imposto.save\n format.html { redirect_to @empresa, notice: 'Tipo de imposto adicionado com sucesso.' }\n format.json { render :show, status: :created, location: @tipo_de_imposto }\n else\n format.html { render :new }\n format.json { render json: @tipo_de_imposto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_veiculo = TipoVeiculo.new(tipo_veiculo_params)\n\n respond_to do |format|\n if @tipo_veiculo.save\n format.html { redirect_to @tipo_veiculo, notice: 'Tipo veiculo was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_veiculo }\n else\n format.html { render :new }\n format.json { render json: @tipo_veiculo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @estadia = Estadia.new(estadia_params)\n\n #Quando cria uma estadia nova, seta a data como a hora corrente\n @estadia.data_entrada = Time.now\n #ocupa a vaga\n @estadia.vaga.ocupada = true\n\n respond_to do |format|\n if @estadia.vaga.save && @estadia.save\n format.html { redirect_to @estadia, notice: 'Estadia was successfully created.' }\n format.json { render :show, status: :created, location: @estadia }\n else\n format.html { render :new }\n format.json { render json: @estadia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipoapreensao = Tipoapreensao.new(tipoapreensao_params)\n\n respond_to do |format|\n if @tipoapreensao.save\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tipoapreensao }\n else\n format.html { render action: 'new' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_atendimento = TipoAtendimento.new(params[:tipo_atendimento])\n\n respond_to do |format|\n if @tipo_atendimento.save\n format.html { redirect_to @tipo_atendimento, notice: \"Tipo de atendimento: #{@tipo_atendimento.descricao}, foi criado com sucesso,\" }\n format.json { render json: @tipo_atendimento, status: :created, location: @tipo_atendimento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_atendimento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize! :create, Tipo\n @tipo = Tipo.new(tipo_params)\n log(\"Se ha creado la nomina #{@lt}\", 0)\n\n respond_to do |format|\n if @tipo.save\n format.html { redirect_to tipos_path, notice: 'La nómina fue creada exitosamente.' }\n format.json { render :show, status: :created, location: @tipo }\n else\n format.html { render :new }\n format.json { render json: @tipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tipo_ventum_params\n params.require(:tipo_ventum).permit(:tipoVenta)\n end",
"def new\n @venta = Venta.new(:fecha => Date.today, confirmada: true)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @venta }\n end\n end",
"def create\n @tipoenvolvido = Tipoenvolvido.new(tipoenvolvido_params)\n\n respond_to do |format|\n if @tipoenvolvido.save\n format.html { redirect_to @tipoenvolvido, notice: 'Tipoenvolvido was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tipoenvolvido }\n else\n format.html { render action: 'new' }\n format.json { render json: @tipoenvolvido.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_aposta = TipoAposta.new(tipo_aposta_params)\n\n respond_to do |format|\n if @tipo_aposta.save\n format.html { redirect_to @tipo_aposta, notice: 'Tipo aposta was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_aposta }\n else\n format.html { render :new }\n format.json { render json: @tipo_aposta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @evolucao_tipo = EvolucaoTipo.new(evolucao_tipo_params)\n\n respond_to do |format|\n if @evolucao_tipo.save\n format.html { redirect_to @evolucao_tipo, notice: 'Evolucao tipo was successfully created.' }\n format.json { render action: 'show', status: :created, location: @evolucao_tipo }\n else\n format.html { render action: 'new' }\n format.json { render json: @evolucao_tipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_vehiculo = TipoVehiculo.new(params[:tipo_vehiculo])\n\n respond_to do |format|\n if @tipo_vehiculo.save\n format.html { redirect_to @tipo_vehiculo, notice: 'Tipo vehiculo was successfully created.' }\n format.json { render json: @tipo_vehiculo, status: :created, location: @tipo_vehiculo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_vehiculo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ventum = Ventum.new(ventum_params)\n @ventum.estado =false\n respond_to do |format|\n if @ventum.save\n format.html { redirect_to @ventum, notice: 'Ventcreada satisfactoriamente.' }\n format.json { render :show, status: :created, location: @ventum }\n else\n format.html { render :new }\n format.json { render json: @ventum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tecnico = Tecnico.new(params[:tecnico])\n\n respond_to do |format|\n if @tecnico.save\n format.html { redirect_to @tecnico, notice: 'Tecnico criado com sucesso.' }\n format.json { render json: @tecnico, status: :created, location: @tecnico }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tecnico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tiposveiculo = Tiposveiculo.new(tiposveiculo_params)\n\n respond_to do |format|\n if @tiposveiculo.save\n format.html { redirect_to tiposveiculos_url, notice: 'Tipo de Veículo criado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :new }\n format.json { render json: @tiposveiculo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @depoevento = Depoevento.new(params[:depoevento])\n\n respond_to do |format|\n if @depoevento.save\n format.html { redirect_to @depoevento, notice: 'Depoevento was successfully created.' }\n format.json { render json: @depoevento, status: :created, location: @depoevento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @depoevento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tecnico = Tecnico.new(params[:tecnico])\n\n respond_to do |format|\n if @tecnico.save\n format.html { redirect_to @tecnico, :notice => 'Tecnico was successfully created.' }\n format.json { render :json => @tecnico, :status => :created, :location => @tecnico }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @tecnico.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @evento = Evento.new(params[:evento])\n\n respond_to do |format|\n if @evento.save\n format.html { redirect_to @evento, notice: 'Evento fue creado con exito.' }\n format.json { render json: @evento, status: :created, location: @evento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @evento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @estatuto = Estatuto.new(params[:estatuto])\n\n respond_to do |format|\n if @estatuto.save\n format.html { redirect_to @estatuto, notice: 'Estatuto was successfully created.' }\n format.json { render json: @estatuto, status: :created, location: @estatuto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @estatuto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_entidade = TipoEntidade.new(tipo_entidade_params)\n\n respond_to do |format|\n if @tipo_entidade.save\n format.html { redirect_to @tipo_entidade, notice: 'Tipo entidade was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_entidade }\n else\n format.html { render :new }\n format.json { render json: @tipo_entidade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_negocio = TipoNegocio.new(params[:tipo_negocio])\n\n respond_to do |format|\n if @tipo_negocio.save\n format.html { redirect_to @tipo_negocio, notice: 'Tipo negocio was successfully created.' }\n format.json { render json: @tipo_negocio, status: :created, location: @tipo_negocio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_negocio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @solicitacao_tipo = SolicitacaoTipo.new(solicitacao_tipo_params)\n\n respond_to do |format|\n if @solicitacao_tipo.save\n format.html { redirect_to @solicitacao_tipo, notice: 'Solicitacao tipo was successfully created.' }\n format.json { render action: 'show', status: :created, location: @solicitacao_tipo }\n else\n format.html { render action: 'new' }\n format.json { render json: @solicitacao_tipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n authorize! :create, Tipo\n @tipo = Tipo.new(tipo_params)\n\n\n respond_to do |format|\n if @tipo.save\n format.html { redirect_to tipos_path, notice: '<i class=\"fa fa-check-square fa-lg\"></i> La nómina fue creada exitosamente.' }\n format.json { render :show, status: :created, location: @tipo }\n else\n format.html { render :new }\n format.json { render json: @tipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @venta = Venta.new(venta_params)\n @venta.libro_venta_id = @l_ventas.id\n\n respond_to do |format|\n if @venta.save\n format.html { redirect_to new_venta_path, notice: 'Venta was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @cliente = Cliente.new\n if params[:type] == \"PessoaFisica\"\n @cliente.pessoa = PessoaFisica.new\n else\n @cliente.pessoa = PessoaJuridica.new\n end\n @cliente.assign_attributes(cliente_params)\n respond_to do |format|\n if @cliente.save\n format.html { redirect_to action: \"index\"}\n format.json { render json: @cliente.to_json(include: [:pessoa]) }\n else\n format.html { render :new }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_pregunta = TipoPregunta.new(params[:tipo_pregunta])\n\n if @tipo_pregunta.save\n render json: @tipo_pregunta, status: :created, location: @tipo_pregunta\n else\n render json: @tipo_pregunta.errors, status: :unprocessable_entity\n end\n end",
"def create\n params[:orgao][:tipo_atendimento_ids] ||= []\n\trespond_to do |format|\n if @orgao.save\n format.html { redirect_to @orgao, notice: \"Local de atendimento: #{@orgao.nome}, foi criado com sucesso.\" }\n format.json { render json: @orgao, status: :created, location: @orgao }\n else\n format.html { render action: \"new\" }\n format.json { render json: @orgao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @estado_persona = EstadoPersona.new(estado_persona_params)\n @estado_persona.estado_id = params[:estado_persona][:estado_id]\n @estado_persona.vendedor_id = params[:estado_persona][:vendedor_id]\n @estado_persona.fecha_inicio = params[:estado_persona][:fecha_inicio]\n\n respond_to do | format|\n if @estado_persona.save\n format.html { redirect_to @estado_persona, notice: 'Estado creado con exito.' }\n format.json { render :show, status: :created, location: @estado_persona }\n else\n format.html { render :new }\n format.json { render json: @estado_persona.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @os_tarefa = OsTarefa.new(os_tarefa_params)\n\n respond_to do |format|\n if @os_tarefa.save\n if @os_tarefa.ordem_servico.id!=nil\n format.html { redirect_to \"/ordem_servicos/\"+@os_tarefa.ordem_servico.id.to_s, notice: 'A Tarefa foi criado(a)' }\n format.json { head :no_content }\n else\n format.html { redirect_to @os_tarefa, notice: 'A Tarefa foi criado(a)' }\n format.json { render :show, status: :created, location: @os_tarefa }\n end\n else\n format.html { render :new }\n format.json { render json: @os_tarefa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @peticion_servicio_ti = Peticion::ServicioTi.new(params[:peticion_servicio_ti])\n\n respond_to do |format|\n if @peticion_servicio_ti.save\n format.html { redirect_to edit_peticion_servicio_ti_path(@peticion_servicio_ti), notice: 'Guardado Correctamente.' }\n format.json { render json: @peticion_servicio_ti, status: :created, location: @peticion_servicio_ti }\n else\n format.html { render action: \"new\" }\n format.json { render json: @peticion_servicio_ti.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @evento = Evento.new(params[:evento])\n @evento.data_hora = Time.now\n @evento.foto = @evento.foto.read if !@evento.foto.nil?\n\n respond_to do |format|\n if @evento.save\n trocar_foto_por_url @evento\n format.html { redirect_to(@evento, :notice => 'Evento was successfully created.') }\n format.xml { render :xml => @evento, :status => :created, :location => @evento }\n format.json { render :json => @evento, :status => :created, :location => @evento }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @evento.errors, :status => :unprocessable_entity }\n format.json { render :json => @evento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n obtener_datos()\n @ventum = current_user.ventum.new(cliente:@cliente, clave:@clave, fecha:@fecha, iva:@iva, subtotal:@preciofinal ,total:@totalcosto, descuentogeneral: @descglobal, distribuidor: @distribuidor, status: \"En proceso\")\n respond_to do |format|\n if(@ventum.save)\n salvar()\n format.html { redirect_to @ventum, notice: 'Venta almacenada exitosamente!.' }\n else\n format.html { redirect_to eventos_path, notice: 'Fallo el almacenamiento de la venta.' }\n end\n \n end\n end",
"def create\n @tipo_actividad = TipoActividad.new(params[:tipo_actividad])\n\n respond_to do |format|\n if @tipo_actividad.save\n format.html { redirect_to @tipo_actividad, notice: 'Tipo actividad was successfully created.' }\n format.json { render json: @tipo_actividad, status: :created, location: @tipo_actividad }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_actividad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tipo_venda_params\n params.require(:tipo_venda).permit(:tipo)\n end",
"def create\n @folevent = Folevent.new(folevent_params)\n\n respond_to do |format|\n if @folevent.save\n format.html { redirect_to :back, notice: 'Vous suivez desormais cette événement' }\n format.json { render :show, status: :created, location: @folevent }\n else\n format.html { render :back }\n format.json { render json: @folevent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n\t\t@tienda_cliente = @cliente.tiendas_clientes.build(tienda_cliente_params)\n\n respond_to do |format|\n if @tienda_cliente.save\n format.html { redirect_to @tienda_cliente, notice: 'La tienda se creó exitosamente.' }\n format.json { render :show, status: :created, location: @tienda_cliente }\n else\n format.html { render :new }\n format.json { render json: @tienda_cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tarifas_servicio = TarifasServicio.new(tarifas_servicio_params)\n\n respond_to do |format|\n if @tarifas_servicio.save\n format.html { redirect_to tarifas_servicios_url, notice: 'Tarifas servicio Se creó correctamente.' }\n format.json { render :show, status: :created, location: @tarifas_servicio }\n else\n format.html { render :new }\n format.json { render json: @tarifas_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @asiento_de_servicio = AsientoDeServicio.new(asiento_de_servicio_params)\n\n respond_to do |format|\n if @asiento_de_servicio.save\n format.html { redirect_to @asiento_de_servicio, notice: 'Asiento de servicio was successfully created.' }\n format.json { render :show, status: :created, location: @asiento_de_servicio }\n else\n format.html { render :new }\n format.json { render json: @asiento_de_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_de_pago = TipoDePago.new(tipo_de_pago_params)\n\n respond_to do |format|\n if @tipo_de_pago.save\n format.html { redirect_to @tipo_de_pago, notice: 'Tipo de pago fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @tipo_de_pago }\n else\n format.html { render :new }\n format.json { render json: @tipo_de_pago.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @etnia = Etnia.new(params[:etnia])\n\n respond_to do |format|\n if @etnia.save\n format.html { redirect_to @etnia, notice: 'Etnia was successfully created.' }\n format.json { render json: @etnia, status: :created, location: @etnia }\n else\n format.html { render action: \"new\" }\n format.json { render json: @etnia.errors, status: :unprocessable_entity }\n end\n end\n end",
"def resource_params\n params.require(:tratamiento).permit(:tipo)\n end",
"def create\n @ventas_seguimiento = Ventas::Seguimiento.new(params[:ventas_seguimiento])\n @ventas_seguimiento.usuario = current_user.name\n @ventas_seguimiento.user = current_user\n\n respond_to do |format|\n if @ventas_seguimiento.save\n format.html { redirect_to @ventas_seguimiento, notice: 'Seguimiento was successfully created.' }\n format.json { render json: @ventas_seguimiento, status: :created, location: @ventas_seguimiento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ventas_seguimiento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n #@sitio = Sitio.find(params[:id]) \n @evento = Evento.create(params[:evento])\n @sitio=@evento.sitio\n\n #@evento = Evento.new(params[:evento])\n respond_to do |format|\n if @evento.save\n format.html { redirect_to(@evento, :notice => t('exito') ) }\n format.xml { render :xml => @evento, :status => :created, :location => @evento }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @evento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def invent_params\n params.require(:invent).permit(:tipo, :nota)\n end",
"def create\n @tipo_de_imovel = TipoDeImovel.new(tipo_de_imovel_params)\n\n respond_to do |format|\n if @tipo_de_imovel.save\n format.html { redirect_to @tipo_de_imovel, notice: 'Tipo de imovel was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_de_imovel }\n else\n format.html { render :new }\n format.json { render json: @tipo_de_imovel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @evento = Evento.new(params[:evento])\n @evento.user = current_user\n @evento.residencial = current_user.apartamento.residencial\n\n respond_to do |format|\n if @evento.save\n format.html { redirect_to @evento, notice: 'Evento foi criado com sucesso.' }\n format.json { render json: @evento, status: :created, location: @evento }\n\n comentario = Comentario.new\n comentario.user = current_user\n comentario.comentavel_id = @evento.id\n comentario.comentavel_type = \"Evento\"\n comentario.conteudo = \"Novo evento\"\n comentario.titulo = \"Novo evento\"\n\n comentario.save\n\n else\n format.html { render action: \"new\" }\n format.json { render json: @evento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @evento = Evento.new(evento_params)\n\n respond_to do |format|\n if @evento.save\n format.html { redirect_to eventos_url, notice: 'El evento fue exitosamente creado.' }\n format.json { render :show, status: :created, location: @evento }\n else\n format.html { render :new }\n format.json { render json: @evento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @venda = Venda.new(venda_params)\n\n respond_to do |format|\n if @venda.save\n format.html { redirect_to @venda, notice: t('.sucesso') }\n format.json { render :show, status: :created, location: @venda }\n else\n format.html { render :new }\n format.json { render json: @venda.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @utente = Utente.new(params[:utente])\n @calendario = Calendario.create(:descrizione => \"calendario di #{@utente.nome}\")\n respond_to do |format|\n if @utente.save\n @calendario = Calendario.create(:descrizione => \"calendario di #{@utente.nome}\", :utente_id => @utente.id)\n format.html { redirect_to @utente, notice: 'Utente was successfully created with his agend' }\n format.json { render json: @utente, status: :created, location: @utente }\n else\n format.html { render action: \"new\" }\n format.json { render json: @utente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @evento = Evento.new(evento_params)\n @evento.usuario_curso_id = @perfil.id\n respond_to do |format|\n if @evento.save\n ApplicationMailer.novo_evento(@evento).deliver \n format.html { redirect_to @evento, notice: 'Evento cadastrado com sucesso!' }\n format.json { render :show, status: :created, location: @evento }\n else\n format.html { render :new }\n format.json { render json: @evento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_orden = TipoOrden.new(tipo_orden_params)\n\n respond_to do |format|\n if @tipo_orden.save\n format.html { redirect_to @tipo_orden, notice: 'Tipo orden was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_orden }\n else\n format.html { render :new }\n format.json { render json: @tipo_orden.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_pensum = TipoPensum.new(params[:tipo_pensum])\n\n respond_to do |format|\n if @tipo_pensum.save\n format.html { redirect_to @tipo_pensum, notice: 'Tipo pensum was successfully created.' }\n format.json { render json: @tipo_pensum, status: :created, location: @tipo_pensum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_pensum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Crear nuevo voto\n @voto = Voto.new(params[:voto])\n\n # Asociarlo con el usuario\n @voto.usuario_id = current_usuario.id\n\n # Asociarlo con la Pregunta o Respuesta\n votable_type = params[:voto][:votable_type]\n votable_id = params[:voto][:votable_id]\n if votable_type=='Pregunta'\n @voto.votable = Pregunta.find(votable_id)\n else\n @voto.votable = Respuesta.find(votable_id)\n end\n\n respond_to do |format|\n if @voto.save\n resp = {\n :votos_total => @voto.votable.votos_total,\n :votos_menos => @voto.votable.votos_menos,\n :votos_mas => @voto.votable.votos_mas\n }\n format.json { render json: resp, status: :created, location: @voto }\n else\n format.json { render json: @voto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def tipoapreensao_params\n params.require(:tipoapreensao).permit(:ttpcodigo, :ttpatualiza)\n end",
"def create\n #Parámetros permitidos.\n pago_params\n\n #Asignación de variables.\n fact = params[:pago][:factura_id]\n fecha = params[:pago][:fechapago]\n factura = Factura.find_by(id: fact)\n\n #Editar pago.\n @pago = Pago.new\n @pago.factura_id = fact\n @pago.fechapago = fecha\n @pago.monto = factura.total\n\n respond_to do |format|\n if @pago.save\n #Inserción en la cuenta corriente cliente por el haber.\n ctactecli = Ctactecli.find_by(cliente_id: factura.cliente_id)\n detallectactecli = Detallectactecli.new\n detallectactecli.ctactecli_id = factura.cliente_id\n detallectactecli.fechadetalle = Date.today\n detallectactecli.tipodetalle = 'Crédito por factura'\n detallectactecli.haber = factura.total\n detallectactecli.save\n ctactecli.saldo = ctactecli.saldo - factura.total\n ctactecli.save\n\n format.json { render :show, status: :created, location: @pago }\n puts'Pago guardado'\n #format.html { redirect_to @pago, notice: 'Pago was successfully created.' }\n else\n format.json { render json: @pago.errors, status: :unprocessable_entity }\n puts'Pago no guardado'\n #format.html { render :new }\n end\n end\n end",
"def create\n @tipo_alerta = TipoAlerta.new(params[:tipo_alerta])\n\n respond_to do |format|\n if @tipo_alerta.save\n format.html { redirect_to @tipo_alerta, notice: 'Tipo alerta was successfully created.' }\n format.json { render json: @tipo_alerta, status: :created, location: @tipo_alerta }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_alerta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_actividad = TipoActividad.new(tipo_actividad_params)\n\n respond_to do |format|\n if @tipo_actividad.save\n format.html { redirect_to @tipo_actividad, notice: 'Tipo actividad se creó correctamente.' }\n format.json { render :show, status: :created, location: @tipo_actividad }\n else\n format.html { render :new }\n format.json { render json: @tipo_actividad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @servicio = Servicio.new(params[:servicio])\n\n respond_to do |format|\n if @servicio.save\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully created.' }\n format.json { render :json => @servicio, :status => :created, :location => @servicio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def venta_params\n params.require(:venta).permit(:fecha_hora, :nombre_cliente, :precio_total, :comentario_perdida, :numero_de_caja, :estado_venta, :tiempo_terminado_venta)\n end",
"def create\n @ativo = Ativo.new(ativo_params)\n\n respond_to do |format|\n if @ativo.save\n format.html { redirect_to @ativo, notice: \"#{type} was successfully created.\" }\n format.json { render :show, status: :created, location: @ativo }\n else\n format.html { render :new }\n format.json { render json: @ativo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @os_entregavel = OsEntregavel.new(os_entregavel_params)\n\n respond_to do |format|\n if @os_entregavel.save\n if @os_entregavel.ordem_servico.id!=nil\n format.html { redirect_to \"/os_entregavels/new?os_id=\"+@os_entregavel.ordem_servico.id.to_s, notice: 'Entregável criado com sucesso na O.S.' }\n format.json { render :show, status: :created, location: @os_entregavel }\n else\n format.html { redirect_to @os_entregavel, notice: 'Entregável criado com sucesso na O.S' }\n format.json { render :show, status: :created, location: @os_entregavel }\n end\n else\n format.html { render :new }\n format.json { render json: @os_entregavel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @evento = Evento.new(evento_params)\n\n respond_to do |format|\n if @evento.save\n format.html { redirect_to @evento, notice: 'Evento criado com sucesso.' }\n format.json { render :show, status: :created, location: @evento }\n else\n format.html { render :new }\n format.json { render json: @evento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_exame = TipoExame.new(tipo_exame_params)\n\n respond_to do |format|\n if @tipo_exame.save\n format.html { redirect_to @tipo_exame, notice: 'Tipo exame was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_exame }\n else\n format.html { render :new }\n format.json { render json: @tipo_exame.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contenu_vente = ContenuVente.new(contenu_vente_params)\n\n respond_to do |format|\n if @contenu_vente.save\n format.html { redirect_to @contenu_vente, notice: 'Contenu vente was successfully created.' }\n format.json { render :show, status: :created, location: @contenu_vente }\n else\n format.html { render :new }\n format.json { render json: @contenu_vente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @oferta = Oferta.new(params[:oferta])\n\n respond_to do |format|\n if @oferta.save\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully created.' }\n format.json { render :json => @oferta, :status => :created, :location => @oferta }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @oferta.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @veiculo = Veiculo.new(params[:veiculo])\n\n respond_to do |format|\n if @veiculo.save\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully created.' }\n format.json { render :json => @veiculo, :status => :created, :location => @veiculo }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @reuniao = Reuniao.new(reuniao_params)\n @pautum=Pautum.new\n @reuniao.pautum =@pautum\n @reuniao.atum=Atum.new\n @reuniao.status=\"Preparação\"\n @pautum.status=\"Preparação\"\n \n respond_to do |format|\n if @reuniao.save\n @pautum.titulo=@reuniao.titulo\n @pautum.save\n format.html { redirect_to @reuniao, notice: 'Reuniao was successfully created.' }\n format.json { render :show, status: :created, location: @reuniao }\n else\n format.html { render :new }\n format.json { render json: @reuniao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def evento_params\n params.require(:evento).permit(:sintoma)\n end",
"def create\n @tipo_usuario = TipoUsuario.new(params[:tipo_usuario])\n\n respond_to do |format|\n if @tipo_usuario.save\n format.html { redirect_to tipo_usuarios_path, notice: 'Tipo usuario fue creado exitosamente.' }\n format.json { render json: @tipo_usuario, status: :created, location: @tipo_usuario }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_usuario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def gestion_evento_params\n params.require(:gestion_evento).permit(:titulo, :descripcion, :fecha, :email, :direccion, :coordenadas, :type )\n end",
"def create\n @persona_punto_ventum = PersonaPuntoVentum.new(persona_punto_ventum_params)\n\n respond_to do |format|\n if @persona_punto_ventum.save\n format.html { redirect_to @persona_punto_ventum.punto_venta, notice: 'Persona punto ventum was successfully created.' }\n format.json { render :show, status: :created, location: @persona_punto_ventum }\n else\n format.html { render :new }\n format.json { render json: @persona_punto_ventum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @aviso = Aviso.new(aviso_params)\n \n @aviso.dataDeInsercao = Time.now\n @aviso.inseridoPor = \"Gustavo Soares\" #adicionar gem devise\n\n @aviso.atualizadoPor = \"Gustavo Soares\" #adicionar gem devise\n @aviso.dataDeAtualizacao = Time.now\n\n respond_to do |format|\n if @aviso.save\n format.html { redirect_to @aviso, notice: 'Aviso was successfully created.' }\n format.json { render :show, status: :created, location: @aviso }\n else\n format.html { render :new }\n format.json { render json: @aviso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event_typology = EventTypology.new(event_typology_params)\n\n respond_to do |format|\n if @event_typology.save\n format.html { redirect_to @event_typology, notice: 'La tipologia è stata creata correttamente.' }\n format.json { render :show, status: :created, location: @event_typology }\n else\n format.html { render :new }\n format.json { render json: @event_typology.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @titulacao = Titulacao.new(titulacao_params)\n\n respond_to do |format|\n if @titulacao.save\n format.html { redirect_to titulacaos_path, notice: 'Titulo criado com successo.' }\n format.json { render :index, status: :created, location: titulacaos_path }\n else\n format.html { render :new }\n format.json { render json: @titulacao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inventario = Inventario.new(inventario_params)\n\n respond_to do |format|\n if @inventario.save\n format.html { redirect_to @inventario, notice: 'Inventario was successfully created.' }\n format.json { render :show, status: :created, location: @inventario }\n else\n format.html { render :new }\n format.json { render json: @inventario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_persona = TipoPersona.new(tipo_persona_params)\n\n respond_to do |format|\n if @tipo_persona.save\n format.html { redirect_to @tipo_persona, notice: 'Tipo persona was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_persona }\n else\n format.html { render :new }\n format.json { render json: @tipo_persona.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sitio_entrega = SitioEntrega.new(params[:sitio_entrega])\n\n respond_to do |format|\n if @sitio_entrega.save\n format.html { redirect_to @sitio_entrega, notice: 'Sitio entrega was successfully created.' }\n format.json { render json: @sitio_entrega, status: :created, location: @sitio_entrega }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sitio_entrega.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @visto = Visto.new(visto_params)\n\n\n respond_to do |format|\n if @visto.save\n format.html { redirect_to @visto, notice: 'Visto was successfully created.' }\n format.json { render :show, status: :created, location: @visto }\n else\n format.html { render :new }\n format.json { render json: @visto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @imposto = Imposto.new(imposto_params)\n\n respond_to do |format|\n if @imposto.save\n format.html { redirect_to @imposto, notice: 'Imposto criado com sucesso.' }\n format.json { render :show, status: :created, location: @imposto }\n else\n format.html { render :new }\n format.json { render json: @imposto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @asiento = Asiento.new(params[:asiento])\n\n respond_to do |format|\n if @asiento.save\n format.html { redirect_to @asiento, :notice => 'El apunte fue creado.' }\n format.json { render :json => @asiento, :status => :created, :location => @asiento }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @asiento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @inventario_cosa = InventarioCosa.new(inventario_cosa_params)\n\n respond_to do |format|\n if @inventario_cosa.save\n format.html { redirect_to @inventario_cosa, notice: 'Inventario cosa was successfully created.' }\n format.json { render :show, status: :created, location: @inventario_cosa }\n else\n format.html { render :new }\n format.json { render json: @inventario_cosa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_consulta = TipoConsulta.new(tipo_consulta_params)\n\n respond_to do |format|\n if @tipo_consulta.save\n format.html { redirect_to @tipo_consulta, notice: 'Tipo consulta was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_consulta }\n else\n format.html { render :new }\n format.json { render json: @tipo_consulta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pregoestitulo = Pregoestitulo.new(pregoestitulo_params)\n\n pregao = Pregao.where('data = ?', @pregoestitulo.date).first\n\n if pregao.blank?\n pregao = Pregao.new\n pregao.data = @pregoestitulo.date\n pregao.flagativo = true\n pregao.save\n end\n\n @pregoestitulo.pregao_id = pregao.id\n\n respond_to do |format|\n if @pregoestitulo.save\n format.html { redirect_to @pregoestitulo, notice: 'Título incluído com sucesso.' }\n format.json { render :show, status: :created, location: @pregoestitulo }\n else\n format.html { render :new }\n format.json { render json: @pregoestitulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n respond_to do |format|\n if @especialidad.save\n format.html { redirect_to @especialidad, notice: 'Servicio creado exitosamente.' }\n format.json { render :show, status: :created, location: @especialidad }\n else\n format.html { render :new }\n format.json { render json: @especialidad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def servico_evento_params\n params.require(:servico_evento).permit(:dataInicio, :dataRetorno, :destino, :localSaida, :nomeTrans, :veiculo, :cnpjTrans, :precoTrans, :descEvento, :nomeEvento, :precoConvite, :nroLugares, :precoTotal, :internacional, :status)\n end",
"def create\n @solicitacoes_avaliacoes_servico = SolicitacoesAvaliacoesServico.new(solicitacoes_avaliacoes_servico_params)\n\n respond_to do |format|\n if @solicitacoes_avaliacoes_servico.save\n format.html { redirect_to @solicitacoes_avaliacoes_servico, notice: 'Solicitacoes avaliacoes servico was successfully created.' }\n format.json { render action: 'show', status: :created, location: @solicitacoes_avaliacoes_servico }\n else\n format.html { render action: 'new' }\n format.json { render json: @solicitacoes_avaliacoes_servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ventaganancium = Ventaganancium.new(ventaganancium_params)\n\n respond_to do |format|\n if @ventaganancium.save\n format.html { redirect_to @ventaganancium, notice: 'Ventaganancium was successfully created.' }\n format.json { render :show, status: :created, location: @ventaganancium }\n else\n format.html { render :new }\n format.json { render json: @ventaganancium.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @objeto = Etiqueta.new(etiqueta_params)\n\n respond_to do |format|\n if @objeto.save\n format.html { redirect_to @objeto, notice: 'Etiqueta was successfully created.' }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @os_nivel_servico = OsNivelServico.new(os_nivel_servico_params)\n\n respond_to do |format|\n if @os_nivel_servico.save\n format.html { redirect_to @os_nivel_servico, notice: 'Os nivel servico foi criado(a)' }\n format.json { render :show, status: :created, location: @os_nivel_servico }\n else\n format.html { render :new }\n format.json { render json: @os_nivel_servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_propiedad = TipoPropiedad.new(tipo_propiedad_params)\n\n respond_to do |format|\n if @tipo_propiedad.save\n format.html { redirect_to @tipo_propiedad, notice: 'Tipo propiedad was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_propiedad }\n else\n format.html { render :new }\n format.json { render json: @tipo_propiedad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @situacao_reserva = SituacaoReserva.new(situacao_reserva_params)\n @situacao_reservas = SituacaoReserva.all.paginate(page: params[:page], per_page: 5)\n @action = { title: \"Nova\", button: \"Salvar\"}\n\n respond_to do |format|\n if @situacao_reserva.save\n format.html { redirect_to action: \"new\", notice: 'Situação reserva criada com sucesso..' }\n format.json { render :show, status: :created, location: @situacao_reserva }\n else\n format.html { render :new }\n format.json { render json: @situacao_reserva.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @denuncia_tipo = DenunciaTipo.new(params[:denuncia_tipo])\n\n respond_to do |format|\n if @denuncia_tipo.save\n format.html { redirect_to @denuncia_tipo, notice: 'Denuncia tipo was successfully created.' }\n format.json { render json: @denuncia_tipo, status: :created, location: @denuncia_tipo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @denuncia_tipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @servico_pacote = Servico::Pacote.new(servico_pacote_params)\n\n respond_to do |format|\n if @servico_pacote.save\n format.html { redirect_to @servico_pacote, notice: 'Pacote was successfully created.' }\n format.json { render action: 'show', status: :created, location: @servico_pacote }\n else\n format.html { render action: 'new' }\n format.json { render json: @servico_pacote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_agressor = TipoAgressor.new(tipo_agressor_params)\n\n respond_to do |format|\n if @tipo_agressor.save\n format.html { redirect_to @tipo_agressor, notice: @@msgs }\n format.json { render :show, status: :created, location: @tipo_agressor }\n else\n format.html { render :new }\n format.json { render json: @tipo_agressor.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6867",
"0.6817968",
"0.68127877",
"0.67253333",
"0.66842735",
"0.66657007",
"0.6665518",
"0.6631251",
"0.6573862",
"0.65716714",
"0.65370315",
"0.65320987",
"0.6525978",
"0.65173113",
"0.64755213",
"0.6468274",
"0.64443547",
"0.6443177",
"0.64382386",
"0.64375365",
"0.6435939",
"0.64318836",
"0.6425864",
"0.6422669",
"0.64068556",
"0.63993204",
"0.6393553",
"0.6392845",
"0.6387947",
"0.6387756",
"0.63823634",
"0.6379657",
"0.63624835",
"0.63614005",
"0.6334419",
"0.63341427",
"0.6324345",
"0.6318864",
"0.6302714",
"0.630215",
"0.6295557",
"0.6293803",
"0.6290205",
"0.6289158",
"0.6285545",
"0.6283026",
"0.6271254",
"0.62702006",
"0.62692964",
"0.6267749",
"0.6257239",
"0.62502366",
"0.62496394",
"0.6248757",
"0.62397385",
"0.62392324",
"0.6233512",
"0.62312436",
"0.6224223",
"0.6224176",
"0.6217802",
"0.6217342",
"0.6216241",
"0.6213892",
"0.61906374",
"0.61855835",
"0.6175792",
"0.61701155",
"0.6168413",
"0.61603534",
"0.616006",
"0.61553836",
"0.61552936",
"0.6153181",
"0.6147692",
"0.614272",
"0.6140297",
"0.6138334",
"0.6135798",
"0.61233675",
"0.6118332",
"0.61177313",
"0.61135554",
"0.6112083",
"0.61087096",
"0.6108636",
"0.6108516",
"0.61046475",
"0.60988355",
"0.6097827",
"0.60898525",
"0.60886943",
"0.60863334",
"0.60841876",
"0.6082825",
"0.60823315",
"0.6075649",
"0.6075556",
"0.60748065",
"0.60715204"
] |
0.6920562
|
0
|
PATCH/PUT /tipo_venta/1 PATCH/PUT /tipo_venta/1.json
|
def update
respond_to do |format|
if @tipo_ventum.update(tipo_ventum_params)
format.html { redirect_to @tipo_ventum, notice: 'Tipo ventum was successfully updated.' }
format.json { render :show, status: :ok, location: @tipo_ventum }
else
format.html { render :edit }
format.json { render json: @tipo_ventum.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n authorize! :update, Tipo\n respond_to do |format|\n if @tipo.update(tipo_params)\n log(\"Se ha editado la nomina #{@lt}\", 1)\n format.html { redirect_to tipos_path, notice: 'Los datos de la nómina fueron actualizados exitosamente.' }\n format.json { head :no_content }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipoapreensao.update(tipoapreensao_params)\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, Tipo\n respond_to do |format|\n if @tipo.update(tipo_params)\n format.html { redirect_to tipos_path, notice: '<i class=\"fa fa-check-square fa-lg\"></i> Los datos de la nómina fueron actualizados exitosamente.' }\n format.json { head :no_content }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tiposveiculo.update(tiposveiculo_params)\n format.html { redirect_to tiposveiculos_url, notice: 'Tipo de Veículo editado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @tiposveiculo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_de_servicio.update(tipo_de_servicio_params)\n format.html { redirect_to @tipo_de_servicio, notice: 'Tipo de servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_de_servicio }\n else\n format.html { render :edit }\n format.json { render json: @tipo_de_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @venta = Venta.find(params[:id])\n\n respond_to do |format|\n if @venta.update_attributes(params[:venta])\n format.html { redirect_to @venta, notice: 'Venta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @venta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @venta.update(venta_params)\n format.html { redirect_to @venta, notice: 'Venta was successfully updated.' }\n format.json { render :show, status: :ok, location: @venta }\n else\n format.html { render :edit }\n format.json { render json: @venta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @solicitacao_tipo.update(solicitacao_tipo_params)\n format.html { redirect_to @solicitacao_tipo, notice: 'Solicitacao tipo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @solicitacao_tipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @evolucao_tipo.update(evolucao_tipo_params)\n format.html { redirect_to @evolucao_tipo, notice: 'Evolucao tipo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @evolucao_tipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_venda.update(tipo_venda_params)\n format.html { redirect_to @tipo_venda, notice: 'Tipo venda was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_venda }\n else\n format.html { render :edit }\n format.json { render json: @tipo_venda.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_negocio = TipoNegocio.find(params[:id])\n\n respond_to do |format|\n if @tipo_negocio.update_attributes(params[:tipo_negocio])\n format.html { redirect_to @tipo_negocio, notice: 'Tipo negocio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_negocio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_veiculo.update(tipo_veiculo_params)\n format.html { redirect_to @tipo_veiculo, notice: 'Tipo veiculo was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_veiculo }\n else\n format.html { render :edit }\n format.json { render json: @tipo_veiculo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipoenvolvido.update(tipoenvolvido_params)\n format.html { redirect_to @tipoenvolvido, notice: 'Tipoenvolvido was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoenvolvido.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_de_imposto.update(tipo_de_imposto_params)\n format.html { redirect_to @empresa, notice: 'Tipo de imposto actualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @tipo_de_imposto }\n else\n format.html { render :edit }\n format.json { render json: @tipo_de_imposto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_contrato = TipoContrato.find(params[:id])\n\n respond_to do |format|\n if @tipo_contrato.update_attributes(params[:tipo_contrato])\n format.html { redirect_to tipo_contratos_path, notice: 'Tipo de contrato atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_contrato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n if @oferta.update_attributes(params[:oferta])\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @oferta.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tapioca.update(tapioca_params)\n format.html { redirect_to @tapioca, notice: 'Tapioca was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tapioca.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @servico_evento.update(servico_evento_params)\n format.html { redirect_to @servico_evento, notice: 'Evento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @servico_evento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @servico_pacote.update(servico_pacote_params)\n format.html { redirect_to @servico_pacote, notice: 'Pacote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @servico_pacote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n\n respond_to do |format|\n if @tipo_vehiculo.update_attributes(params[:tipo_vehiculo])\n format.html { redirect_to @tipo_vehiculo, notice: 'Tipo vehiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_vehiculo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_aposta.update(tipo_aposta_params)\n format.html { redirect_to @tipo_aposta, notice: 'Tipo aposta was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_aposta }\n else\n format.html { render :edit }\n format.json { render json: @tipo_aposta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @peticion_servicio_ti = Peticion::ServicioTi.find(params[:id])\n\n respond_to do |format|\n if @peticion_servicio_ti.update_attributes(params[:peticion_servicio_ti])\n format.html { redirect_to edit_peticion_servicio_ti_path(@peticion_servicio_ti), notice: 'Actualizado Correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @peticion_servicio_ti.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n\n if @os_tarefa.update(os_tarefa_params)\n #se as situacao da tarefa nao for aceita, altera a ordem_servico_pagamento para null\n if(@os_tarefa.situacao!=OsTarefa.situacoes[0] && @os_tarefa.situacao!=OsTarefa.situacoes[1])\n\n @os_tarefa.ordem_servico_pagamento=nil\n @os_tarefa.save\n end\n\n if @os_tarefa.ordem_servico.id!=nil\n format.html { redirect_to \"/ordem_servicos/\"+@os_tarefa.ordem_servico.id.to_s, notice: 'A Tarefa foi atualizado(a)' }\n format.json { head :no_content }\n else\n format.html { redirect_to @os_tarefa, notice: 'A Tarefa foi atualizado(a)' }\n format.json { render :show, status: :ok, location: @os_tarefa }\n end\n else\n format.html { render :edit }\n format.json { render json: @os_tarefa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_alerta = TipoAlerta.find(params[:id])\n\n respond_to do |format|\n if @tipo_alerta.update_attributes(params[:tipo_alerta])\n format.html { redirect_to @tipo_alerta, notice: 'Tipo alerta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_alerta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, Concepto\n if params[:concepto][:tipo_ids]\n params[:concepto][:tipo_ids] = params[:concepto][:tipo_ids].map { |k, _v| k }\n else\n params[:concepto][:tipo_ids] = []\n end\n\n respond_to do |format|\n if @concepto.update(concepto_params)\n\n\n format.html { redirect_to @concepto, notice: '<i class=\"fa fa-check-square fa-lg\"></i> Los datos del concepto fueron actualizados exitosamente.' }\n format.json { render :show, status: :ok, location: @concepto }\n else\n format.html { render :edit } if params[:concepto][:tipo_ids]\n format.json { render json: @concepto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_persona.update(tipo_persona_params)\n format.html { redirect_to @tipo_persona, notice: 'Tipo persona was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_persona }\n else\n format.html { render :edit }\n format.json { render json: @tipo_persona.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activo_update\n respond_to do |format|\n activo = params[:producto][:activo]\n id = params[:id]\n Producto.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def update\n @persona_tipo = PersonaTipo.find(params[:id])\n\n respond_to do |format|\n if @persona_tipo.update_attributes(params[:persona_tipo])\n format.html { redirect_to @persona_tipo, notice: 'Tipo de participante actualizado correctamente.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @persona_tipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tb_servicio.update(tb_servicio_params)\n format.html { redirect_to @tb_servicio, notice: 'Tb servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @tb_servicio }\n else\n format.html { render :edit }\n format.json { render json: @tb_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @os_entregavel.update(os_entregavel_params)\n if @os_entregavel.ordem_servico.id!=nil\n format.html { redirect_to \"/ordem_servicos/\"+@os_entregavel.ordem_servico.id.to_s, notice: 'Os entregavel foi atualizado(a)' }\n format.json { head :no_content }\n else\n format.html { redirect_to @os_entregavel, notice: 'Os entregavel foi atualizado(a)' }\n format.json { render :show, status: :ok, location: @os_entregavel }\n end\n else\n format.html { render :edit }\n format.json { render json: @os_entregavel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n if @tecnico.update_attributes(params[:tecnico])\n format.html { redirect_to @tecnico, notice: 'Tecnico atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tecnico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_usuario = TipoUsuario.find(params[:id])\n\n respond_to do |format|\n if @tipo_usuario.update_attributes(params[:tipo_usuario])\n format.html { redirect_to @tipo_usuario, notice: 'Tipo usuario fue actualizado existosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_usuario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @venta.update(venta_params)\n format.html { redirect_to @l_ventas, notice: 'Venta was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end",
"def update\n respond_to do |format|\n if @servico.update(servico_params)\n format.html { redirect_to servicos_url, notice: 'Serviço atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @servico }\n else\n format.html { render :edit }\n format.json { render json: @servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tatoo.update(tatoo_params)\n format.html { redirect_to tatoos_path, notice: 'Tatoo was successfully updated.' }\n format.json { render :show, status: :ok, location: @tatoo }\n else\n format.html { render :edit }\n format.json { render json: @tatoo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipoveiculo.update(tipoveiculo_params)\n format.html { redirect_to @tipoveiculo, notice: 'Tipoveiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoveiculo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(etiqueta_params)\n format.html { redirect_to @objeto, notice: 'Etiqueta was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n obtener_datos()\n @status = params[:statusproyect]\n @cliente = params[:cliente] + \" \" +params[:cliente_apellido]\n respond_to do |format|\n if @ventum.update(cliente: @cliente, clave:@clave, fecha:@fecha, iva:@iva,subtotal:@preciofinal ,total:@totalcosto, descuentogeneral: @descglobal , distribuidor: @distribuidor, status: @status)\n @detail.each do |x|\n x.destroy\n end\n salvar()\n format.html { redirect_to @ventum, notice: 'Venta actualizada correctamente.' }\n format.json { render :show, status: :ok, location: @ventum }\n else\n format.html { render :edit }\n format.json { render json: @ventum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @solicitacoes_avaliacoes_servico.update(solicitacoes_avaliacoes_servico_params)\n format.html { redirect_to @solicitacoes_avaliacoes_servico, notice: 'Solicitacoes avaliacoes servico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @solicitacoes_avaliacoes_servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @topico.update(topico_params)\n format.html { redirect_to set_path, notice: 'Tópico atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @topico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_atendimento = TipoAtendimento.find(params[:id])\n\n respond_to do |format|\n if @tipo_atendimento.update_attributes(params[:tipo_atendimento])\n format.html { redirect_to @tipo_atendimento, notice: \"Tipo de atendimento: #{@tipo_atendimento.descricao}, foi atualizado com sucesso.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_atendimento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @orgao = Orgao.find(params[:id])\n\n params[:orgao][:tipo_atendimento_ids] ||= []\n respond_to do |format|\n if @orgao.update_attributes(params[:orgao])\n\t\tformat.html { redirect_to @orgao, notice: \"Local de atendimento: #{@orgao.nome}, foi atualizado com sucesso.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @orgao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tienda_cliente.update(tienda_cliente_params)\n format.html { redirect_to @tienda_cliente, notice: 'La tienda se actualizó exitosamente.' }\n format.json { render :show, status: :ok, location: @tienda_cliente }\n else\n format.html { render :edit }\n format.json { render json: @tienda_cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tarifas_servicio.update(tarifas_servicio_params)\n format.html { redirect_to tarifas_servicios_url, notice: 'Tarifas servicio Se ha actualizado correctamente..' }\n format.json { render :show, status: :ok, location: @tarifas_servicio }\n else\n format.html { render :edit }\n format.json { render json: @tarifas_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_documento = TipoDocumento.find(params[:id])\n\n respond_to do |format|\n if @tipo_documento.update_attributes(params[:tipo_documento])\n format.html { redirect_to @tipo_documento, notice: 'Tipo documento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_documento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\n respond_to do |format|\n if @solicitud_servicio.update_attributes(params[:solicitud_servicio])\n format.html { redirect_to @solicitud_servicio, notice: 'Solicitud servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @solicitud_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_vinculo = TipoVinculo.find(params[:id])\n\n respond_to do |format|\n if @tipo_vinculo.update_attributes(params[:tipo_vinculo])\n flash[:notice] = 'TipoVinculo was successfully updated.'\n format.html { redirect_to(@tipo_vinculo) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_vinculo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_nota = TipoNota.find(params[:id])\n\n respond_to do |format|\n if @tipo_nota.update_attributes(params[:tipo_nota])\n format.html { redirect_to(@tipo_nota, :notice => 'TipoNota was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tipo_nota.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n if @tecnico.update_attributes(params[:tecnico])\n format.html { redirect_to @tecnico, :notice => 'Tecnico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @tecnico.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @inventario_cosa.update(inventario_cosa_params)\n format.html { redirect_to @inventario_cosa, notice: 'Inventario cosa was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventario_cosa }\n else\n format.html { render :edit }\n format.json { render json: @inventario_cosa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_comunicacao.update(tipo_comunicacao_params)\n format.html { redirect_to @tipo_comunicacao, notice: 'Tipo comunicacao was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_comunicacao }\n else\n format.html { render :edit }\n format.json { render json: @tipo_comunicacao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def update\n respond_to do |format|\n if @os_nivel_servico.update(os_nivel_servico_params)\n format.html { redirect_to @os_nivel_servico, notice: 'Os nivel servico foi atualizado(a)' }\n format.json { render :show, status: :ok, location: @os_nivel_servico }\n else\n format.html { render :edit }\n format.json { render json: @os_nivel_servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ventum.update(ventum_params)\n format.html { redirect_to @ventum, notice: 'Venta fue modificado satisfactoriamente.' }\n format.json { render :show, status: :ok, location: @ventum }\n else\n format.html { render :edit }\n format.json { render json: @ventum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tarefa.update(tarefa_params)\n format.html { redirect_to @tarefa, notice: 'Tarefa editada com sucesso.' }\n format.json { render :show, status: :ok, location: @tarefa }\n else\n format.html { render :edit }\n format.json { render json: @tarefa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_de_imovel.update(tipo_de_imovel_params)\n format.html { redirect_to @tipo_de_imovel, notice: 'Tipo de imovel was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_de_imovel }\n else\n format.html { render :edit }\n format.json { render json: @tipo_de_imovel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_entidade.update(tipo_entidade_params)\n format.html { redirect_to @tipo_entidade, notice: 'Tipo entidade was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_entidade }\n else\n format.html { render :edit }\n format.json { render json: @tipo_entidade.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tiposervico.update(tiposervico_params)\n format.html { redirect_to @tiposervico, notice: 'Tiposervico was successfully updated.' }\n format.json { render :show, status: :ok, location: @tiposervico }\n else\n format.html { render :edit }\n format.json { render json: @tiposervico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_pensum = TipoPensum.find(params[:id])\n\n respond_to do |format|\n if @tipo_pensum.update_attributes(params[:tipo_pensum])\n format.html { redirect_to @tipo_pensum, notice: 'Tipo pensum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_pensum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n set_funcionario\n if @ordem_servico.update(ordem_servico_params)\n format.html { redirect_to @ordem_servico, notice: t('messages.cadastro_atualizado') }\n format.json { render :show, status: :ok, location: @ordem_servico }\n else\n format.html { render :edit }\n format.json { render json: @ordem_servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipos_contato.update(tipos_contato_params)\n format.html { redirect_to @tipos_contato, notice: 'Tipos contato was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipos_contato }\n else\n format.html { render :edit }\n format.json { render json: @tipos_contato.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_exame.update(tipo_exame_params)\n format.html { redirect_to @tipo_exame, notice: 'Tipo exame was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_exame }\n else\n format.html { render :edit }\n format.json { render json: @tipo_exame.errors, status: :unprocessable_entity }\n end\n end\n end",
"def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end",
"def update\n @tipo_pregunta = TipoPregunta.find(params[:id])\n\n if @tipo_pregunta.update(params[:tipo_pregunta])\n head :no_content\n else\n render json: @tipo_pregunta.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @protocolo.update(protocolo_params)\n addlog(\"Protocolo alterado\")\n format.html { redirect_to @protocolo, notice: 'Protocolo foi atualizado.' }\n format.json { render :show, status: :ok, location: @protocolo }\n else\n format.html { render :edit }\n format.json { render json: @protocolo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_funcionario.update(tipo_funcionario_params)\n format.html { redirect_to @tipo_funcionario, notice: 'Tipo funcionario was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipo_funcionario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @titulacao.update(titulacao_params)\n format.html { redirect_to titulacaos_path, notice: 'Titulo atualizado com successo.' }\n format.json { render titulacaos_path, status: :ok, location: titulacaos_path }\n else\n format.html { render :edit }\n format.json { render json: @titulacao.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 @nota_tecnica.update(nota_tecnica_params)\n format.html { redirect_to @nota_tecnica, notice: 'Nota tecnica was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @nota_tecnica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_compra.update(tipo_compra_params)\n format.html { redirect_to @tipo_compra, notice: 'Tipo compra was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_compra }\n else\n format.html { render :edit }\n format.json { render json: @tipo_compra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_consulta.update(tipo_consulta_params)\n format.html { redirect_to @tipo_consulta, notice: 'Tipo consulta was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_consulta }\n else\n format.html { render :edit }\n format.json { render json: @tipo_consulta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @empresa_servicio = EmpresaServicio.find(params[:id])\n respond_to do |format|\n if @empresa_servicio.update_attributes(params[:empresa_servicio])\n\n format.html { redirect_to empresa_empresa_servicios_path, notice: \"Los datos del servicio fueron actualizados para la empresa #{@empresa_servicio.empresa.nombre_empresa}\"}\n \n else\n format.html { render action: \"edit\" }\n format.json { render json: @empresa_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n @lancamentorapido = Lancamentorapido.find(params[:id]) \n \n #Validações padrão\n @lancamentorapido.tipo = :receita if @lancamentorapido.tipo.blank?\n @lancamentorapido.valor = 0 if @lancamentorapido.valor.blank? \n \n\n respond_to do |format|\n if @lancamentorapido.update_attributes(params[:lancamentorapido])\n format.html { redirect_to lancamentorapidos_path, notice: 'Lancamento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lancamentorapido.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @todoa.update(todoa_params)\n format.html { redirect_to todoas_url }\n format.json { render :show, status: :ok, location: @todoa }\n else\n format.html { render :edit }\n format.json { render json: @todoa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_actividad = TipoActividad.find(params[:id])\n\n respond_to do |format|\n if @tipo_actividad.update_attributes(params[:tipo_actividad])\n format.html { redirect_to @tipo_actividad, notice: 'Tipo actividad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_actividad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipocosto.update(tipocosto_params)\n format.html { redirect_to @tipocosto, notice: 'Tipocosto was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipocosto }\n else\n format.html { render :edit }\n format.json { render json: @tipocosto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @compra_venta_normal.update(compra_venta_normal_params)\n format.html { redirect_to @compra_venta_normal, notice: 'Compra venta normal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @compra_venta_normal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_convenio = TipoConvenio.find(params[:id])\n\n respond_to do |format|\n if @tipo_convenio.update_attributes(params[:tipo_convenio])\n format.html { redirect_to @tipo_convenio, notice: 'Tipo convenio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_convenio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @taco.update(taco_params)\n format.html { redirect_to @taco, notice: 'Taco was successfully updated.' }\n format.json { render :show, status: :ok, location: @taco }\n else\n format.html { render :edit }\n format.json { render json: @taco.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_unidad.update(tipo_unidad_params)\n format.html { redirect_to @tipo_unidad, notice: 'Tipo unidad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipo_unidad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sitio_entrega = SitioEntrega.find(params[:id])\n\n respond_to do |format|\n if @sitio_entrega.update_attributes(params[:sitio_entrega])\n format.html { redirect_to @sitio_entrega, notice: 'Sitio entrega was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sitio_entrega.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #parametros_autocomplete!(params[:estudiante][:persona])\n @estudiante = Estudiante.find(params[:id])\n \n begin\n @estudiante.persona_id = params[:persona][:id]\n rescue\n end\n\n respond_to do |format|\n if @estudiante.update_attributes(params[:estudiante])\n format.html { redirect_to @estudiante, notice: 'Estudiante actualizado' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estudiante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recurso = Recurso.find(params[:id])\n\n respond_to do |format|\n if @recurso.update_attributes(params[:recurso])\n format.html { redirect_to @recurso, notice: 'O recurso de auto de infração foi atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recurso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n pai = params[:pai] ? Conta.find_by_id(params[:pai]): nil\n \n respond_to do |format|\n if @conta.update(nome: conta_params[:nome], status: conta_params[:status], pai: pai) \n #format.json { render :show, status: :ok, location: @conta }\n format.json { render json: @conta.to_json, status: :ok }\n else \n format.json { render json: @conta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @asiento_de_servicio.update(asiento_de_servicio_params)\n format.html { redirect_to @asiento_de_servicio, notice: 'Asiento de servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @asiento_de_servicio }\n else\n format.html { render :edit }\n format.json { render json: @asiento_de_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(tipo_referencia_base_params)\n format.html { redirect_to @objeto, notice: \"Tipo referencia base was successfully updated.\" }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tecido.update(tecido_params)\n format.html { redirect_to @tecido, notice: 'Tecido was successfully updated.' }\n format.json { render :show, status: :ok, location: @tecido }\n else\n format.html { render :edit }\n format.json { render json: @tecido.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(objeto_params)\n format.html { redirect_to @objeto, notice: 'Objeto was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(objeto_params)\n format.html { redirect_to @objeto, notice: 'Objeto was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ativo.update(ativo_params)\n format.html { redirect_to @ativo, notice: \"#{type} was successfully updated.\" }\n format.json { render :show, status: :ok, location: @ativo }\n else\n format.html { render :edit }\n format.json { render json: @ativo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tipo_product = TipoProduct.find(params[:id])\n\n respond_to do |format|\n if @tipo_product.update_attributes(params[:tipo_product])\n format.html { redirect_to @tipo_product, notice: 'Tipo product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @contenu_vente.update(contenu_vente_params)\n format.html { redirect_to @contenu_vente, notice: 'Contenu vente was successfully updated.' }\n format.json { render :show, status: :ok, location: @contenu_vente }\n else\n format.html { render :edit }\n format.json { render json: @contenu_vente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tservicio = Tservicio.find(params[:id])\n\n respond_to do |format|\n if @tservicio.update_attributes(params[:tservicio])\n format.html { redirect_to(@tservicio, :notice => 'Tservicio was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tservicio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @registro_servicio.update(registro_servicio_params)\n format.html { redirect_to @registro_servicio, notice: 'Servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @registro_servicio }\n else\n format.html { render :edit }\n format.json { render json: @registro_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @atracao = Atracao.find(params[:id])\n\n respond_to do |format|\n if @atracao.update_attributes(params[:atracao])\n format.html { redirect_to @atracao, :notice => 'Atracao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @atracao.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ventas_presupuesto = Ventas::Presupuesto.find(params[:id])\n\n respond_to do |format|\n if @ventas_presupuesto.update_attributes(params[:ventas_presupuesto])\n format.html { redirect_to @ventas_presupuesto, notice: 'Presupuesto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ventas_presupuesto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @estatuto = Estatuto.find(params[:id])\n\n respond_to do |format|\n if @estatuto.update_attributes(params[:estatuto])\n format.html { redirect_to @estatuto, notice: 'Estatuto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estatuto.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6921154",
"0.6763069",
"0.6710749",
"0.66690814",
"0.6646843",
"0.66117394",
"0.6593076",
"0.65821415",
"0.65633976",
"0.65546733",
"0.65273225",
"0.65213495",
"0.6511184",
"0.64955443",
"0.6490847",
"0.646394",
"0.6463841",
"0.6455664",
"0.64451206",
"0.64234304",
"0.64180106",
"0.64151573",
"0.6388774",
"0.6365003",
"0.6364478",
"0.6355726",
"0.6316039",
"0.6313164",
"0.6310249",
"0.62951523",
"0.62778354",
"0.6271143",
"0.62685996",
"0.6262382",
"0.62609446",
"0.62595224",
"0.6258302",
"0.6252511",
"0.62503505",
"0.6245013",
"0.6244616",
"0.6242558",
"0.62397236",
"0.6237843",
"0.62270194",
"0.6220324",
"0.62144923",
"0.62120664",
"0.62020904",
"0.6201524",
"0.6191235",
"0.61895406",
"0.61853456",
"0.61815804",
"0.61793643",
"0.61785865",
"0.61781484",
"0.6178116",
"0.6175923",
"0.6172966",
"0.6169574",
"0.61695486",
"0.61688834",
"0.61647457",
"0.61635345",
"0.61476576",
"0.6144144",
"0.61403257",
"0.6140001",
"0.61389005",
"0.6136529",
"0.6130131",
"0.6124049",
"0.6113359",
"0.61106366",
"0.61061513",
"0.61043626",
"0.6102354",
"0.610084",
"0.609808",
"0.6090649",
"0.6090301",
"0.60823435",
"0.60719454",
"0.6071598",
"0.60651124",
"0.6053252",
"0.6050644",
"0.6048455",
"0.6047687",
"0.6046868",
"0.6046868",
"0.60456324",
"0.60452384",
"0.60445505",
"0.6043962",
"0.6043097",
"0.6042311",
"0.6042307",
"0.60414064"
] |
0.66976964
|
3
|
DELETE /tipo_venta/1 DELETE /tipo_venta/1.json
|
def destroy
@tipo_ventum.destroy
respond_to do |format|
format.html { redirect_to tipo_venta_url, notice: 'Tipo ventum was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @venta = Venta.find(params[:id])\n @venta.destroy\n\n respond_to do |format|\n format.html { redirect_to ventas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipoapreensao.destroy\n respond_to do |format|\n format.html { redirect_to tipoapreensoes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @servico_evento.destroy\n respond_to do |format|\n format.html { redirect_to servico_eventos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_de_imposto.destroy\n respond_to do |format|\n format.html { redirect_to @empresa, notice: 'Tipo de imposto removido com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n @tipo_vehiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_vehiculos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estatuto = Estatuto.find(params[:id])\n @estatuto.destroy\n\n respond_to do |format|\n format.html { redirect_to estatutos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipoenvolvido.destroy\n respond_to do |format|\n format.html { redirect_to tipoenvolvidos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitacao_tipo.destroy\n respond_to do |format|\n format.html { redirect_to solicitacao_tipos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_contrato = TipoContrato.find(params[:id])\n @tipo_contrato.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_contratos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evolucao_tipo.destroy\n respond_to do |format|\n format.html { redirect_to evolucao_tipos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_de_servicio.destroy\n respond_to do |format|\n format.html { redirect_to tipo_de_servicios_url, notice: 'Tipo de servicio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_alerta = TipoAlerta.find(params[:id])\n @tipo_alerta.destroy\n\n respond_to do |format|\n format.html { redirect_to tipos_alertas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_unidad.destroy\n respond_to do |format|\n format.html { redirect_to tipo_unidades_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @veiculo = Veiculo.find(params[:id])\n @veiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to veiculos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_veiculo.destroy\n respond_to do |format|\n format.html { redirect_to tipo_veiculos_url, notice: 'Tipo veiculo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tiposveiculo.destroy\n respond_to do |format|\n format.html { redirect_to tiposveiculos_url, notice: 'Tipo de Veículo excluído com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipoveiculo.destroy\n respond_to do |format|\n format.html { redirect_to tipoveiculos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ventum.destroy\n respond_to do |format|\n format.html { redirect_to venta_url, notice: 'Venteliminada satisfactoriamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_plan.destroy\n respond_to do |format|\n msg = { :status => \"ok\", :message => \"Eliminado!\" }\n format.json { render :json => msg }\n end\n end",
"def destroy\n @tipo_negocio = TipoNegocio.find(params[:id])\n @tipo_negocio.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_negocios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @depoevento = Depoevento.find(params[:id])\n @depoevento.destroy\n\n respond_to do |format|\n format.html { redirect_to depoeventos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @ventum.destroy\n respond_to do |format|\n format.html { redirect_to venta_url, notice: 'Se ha eliminado la venta exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_convenio = TipoConvenio.find(params[:id])\n @tipo_convenio.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_convenios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @servicio = Servicio.find(params[:id])\n @servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to servicios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @servico_pacote.destroy\n respond_to do |format|\n format.html { redirect_to servico_pacotes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_funcionario.destroy\n respond_to do |format|\n format.html { redirect_to tipo_funcionarios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nota_tecnica.destroy\n respond_to do |format|\n format.html { redirect_to nota_tecnicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @venta.destroy\n respond_to do |format|\n format.html { redirect_to ventas_url, notice: 'Venta was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dato = Dato.find(params[:id])\n @dato.destroy\n\n respond_to do |format|\n format.html { redirect_to datos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @persona_tipo = PersonaTipo.find(params[:id])\n @persona_tipo.destroy\n\n respond_to do |format|\n format.html { redirect_to persona_tipos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @datos_insumos_reactivo.destroy\n respond_to do |format|\n format.html { redirect_to datos_insumos_reactivos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @entrada_inventario = EntradaInventario.find(params[:id])\n @entrada_inventario.destroy\n\n respond_to do |format|\n format.html { redirect_to entrada_inventarios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_aposta.destroy\n respond_to do |format|\n format.html { redirect_to tipo_apostas_url, notice: 'Tipo aposta was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tarifas_servicio.destroy\n respond_to do |format|\n format.html { redirect_to tarifas_servicios_url, notice: 'Tarifas servicio Fue destruido con éxito.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_de_imovel.destroy\n respond_to do |format|\n format.html { redirect_to tipo_de_imovels_url, notice: 'Tipo de imovel was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_consulta.destroy\n respond_to do |format|\n format.html { redirect_to tipo_consultas_url, notice: 'Tipo consulta was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ordem_servico.destroy\n respond_to do |format|\n format.html { redirect_to ordem_servicos_url, notice: t('messages.cadastro_removido') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @os_nivel_servico.destroy\n respond_to do |format|\n format.html { redirect_to os_nivel_servicos_url, notice: 'Os nivel servico foi excluído(a)' }\n format.json { head :no_content }\n end\n end",
"def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end",
"def destroy\n @tapioca.destroy\n respond_to do |format|\n format.html { redirect_to tapiocas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_actividad = TipoActividad.find(params[:id])\n @tipo_actividad.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_actividads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_agressor.destroy\n respond_to do |format|\n format.html { redirect_to tipo_agressores_url, notice: @@msgs }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @denuncia_tipo = DenunciaTipo.find(params[:id])\n @denuncia_tipo.destroy\n\n respond_to do |format|\n format.html { redirect_to denuncia_tipos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @ativo.destroy\n respond_to do |format|\n format.html { redirect_to ativos_url, notice: \"#{type} was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evento = Evento.find(params[:id])\n @evento.destroy\n\n respond_to do |format|\n format.html { redirect_to eventos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @sitio_entrega = SitioEntrega.find(params[:id])\n @sitio_entrega.destroy\n\n respond_to do |format|\n format.html { redirect_to sitio_entregas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_todo.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_actividad.destroy\n respond_to do |format|\n format.html { redirect_to tipo_actividads_url, notice: 'Tipo actividad se elimino correctamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_trabajador.destroy\n respond_to do |format|\n format.html { redirect_to tipo_trabajadors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @etiquetum.destroy\n respond_to do |format|\n format.html { redirect_to etiqueta_url, notice: 'Etiqueta borrada!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @etnia = Etnia.find(params[:id])\n @etnia.destroy\n\n respond_to do |format|\n format.html { redirect_to etnias_url }\n format.json { head :no_content }\n end\n end",
"def delete\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.find(params[:id])\n @aviso.destroy\n\n respond_to do |format|\n format.html { redirect_to avisos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evento = Evento.find(params[:id])\n @comentarios = Comentario.where(:comentavel_id => @evento.id).order('created_at DESC')\n\n if @comentarios\n @comentarios.delete_all\n end\n @evento.destroy\n\n respond_to do |format|\n format.html { redirect_to eventos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_vinculo = TipoVinculo.find(params[:id])\n @tipo_vinculo.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_vinculos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @evento.destroy\n respond_to do |format|\n format.html { redirect_to eventos_url, notice: 'Evento apagado com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @serv_adicionale = ServAdicionale.find(params[:id])\n @serv_adicionale.destroy\n\n respond_to do |format|\n format.html { redirect_to serv_adicionales_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_persona.destroy\n respond_to do |format|\n format.html { redirect_to tipos_personas_url, notice: 'Tipo persona was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipocosto.destroy\n respond_to do |format|\n format.html { redirect_to tipocostos_url, notice: 'Tipocosto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_unidad.destroy\n respond_to do |format|\n format.html { redirect_to tipo_unidads_url, notice: 'Tipo unidad was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_pensum = TipoPensum.find(params[:id])\n @tipo_pensum.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_pensums_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datoscontacto = Datoscontacto.find(params[:id])\n @datoscontacto.destroy\n\n respond_to do |format|\n format.html { redirect_to datoscontactos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_documento = TipoDocumento.find(params[:id])\n @tipo_documento.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_documentos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventario.destroy\n respond_to do |format|\n format.html { redirect_to inventarios_url, notice: 'Inventario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventario.destroy\n respond_to do |format|\n format.html { redirect_to inventarios_url, notice: 'Inventario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tecnico = Tecnico.find(params[:id])\n @tecnico.destroy\n\n respond_to do |format|\n format.html { redirect_to tecnicos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tecnico = Tecnico.find(params[:id])\n @tecnico.destroy\n\n respond_to do |format|\n format.html { redirect_to tecnicos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tecnico = Tecnico.find(params[:id])\n @tecnico.destroy\n\n respond_to do |format|\n format.html { redirect_to tecnicos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n @solicitud_servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to solicitudes_servicios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @observacao_vocacionada = ObservacaoVocacionada.find(params[:id])\n @observacao_vocacionada.destroy\n\n respond_to do |format|\n format.html { redirect_to observacao_vocacionadas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventario_cosa.destroy\n respond_to do |format|\n format.html { redirect_to inventario_cosas_url, notice: 'Inventario cosa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_entidade.destroy\n respond_to do |format|\n format.html { redirect_to tipo_entidades_url, notice: 'Tipo entidade was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to tipo_referencia_bases_url, notice: \"Tipo referencia base was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_distribucion.destroy\n respond_to do |format|\n format.html { redirect_to tipos_distribuciones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gestacao.destroy\n respond_to do |format|\n format.html { redirect_to gestacaos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aactio = Aactio.find(params[:id])\n @aactio.destroy\n\n respond_to do |format|\n format.html { redirect_to aactios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ventaganancium.destroy\n respond_to do |format|\n format.html { redirect_to ventaganancia_url, notice: 'Ventaganancium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n self.validar_admin\n @inventario.destroy\n respond_to do |format|\n format.html { redirect_to inventarios_url, notice: 'Inventario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visitante.destroy\n respond_to do |format|\n format.html { redirect_to visitantes_url, notice: 'Visitante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_orden.destroy\n respond_to do |format|\n format.html { redirect_to tipo_ordens_url, notice: 'Tipo orden was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asiento = Asiento.find(params[:id])\n @asiento.destroy\n\n respond_to do |format|\n format.html { redirect_to asientos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @titulacion.destroy\n respond_to do |format|\n format.html { redirect_to titulaciones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datosgenerale.destroy\n respond_to do |format|\n format.html { redirect_to datosgenerales_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estado_remate.destroy\n respond_to do |format|\n format.html { redirect_to estado_remates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @oficio.destroy\n respond_to do |format|\n format.html { redirect_to oficios_url, notice: 'Oficio eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @oferta = Oferta.find(params[:id])\n @oferta.update_attributes :status => Status.find_by_descricao('Inativo')\n\n respond_to do |format|\n format.html { redirect_to admin_ofertas_path }\n format.json { head :ok }\n end\n end",
"def destroy\n @contenu_vente.destroy\n respond_to do |format|\n format.html { redirect_to contenu_ventes_url, notice: 'Contenu vente was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @core_tipo_unidade = Core::TipoUnidade.find(params[:id])\n @core_tipo_unidade.destroy\n\n respond_to do |format|\n format.html { redirect_to core_tipo_unidades_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n @tipo_vehiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to(tipo_vehiculos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tipo_exame.destroy\n respond_to do |format|\n format.html { redirect_to tipo_exames_url, notice: 'Tipo exame was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @veiculo.destroy\n respond_to do |format|\n format.html { redirect_to veiculos_url, notice: 'Veiculo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente.destroy\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_usuario = TipoUsuario.find(params[:id])\n @tipo_usuario.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_usuarios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @atracao = Atracao.find(params[:id])\n @atracao.destroy\n\n respond_to do |format|\n format.html { redirect_to atracaos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @especialidad.destroy\n respond_to do |format|\n format.html { redirect_to especialidads_url, notice: 'Servicio eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @evento.destroy\n respond_to do |format|\n format.html { redirect_to eventos_url, notice: 'El evento fue eliminado.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asiento_de_servicio.destroy\n respond_to do |format|\n format.html { redirect_to asiento_de_servicios_url, notice: 'Asiento de servicio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datos_estudiante.destroy\n respond_to do |format|\n format.html { redirect_to datos_estudiantes_url, notice: 'Datos estudiante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.73050547",
"0.7288937",
"0.72860026",
"0.7260907",
"0.72545373",
"0.72513586",
"0.72424674",
"0.7212556",
"0.72034216",
"0.7199657",
"0.7173166",
"0.715502",
"0.7154095",
"0.71462303",
"0.71372104",
"0.71292514",
"0.712569",
"0.712216",
"0.7115263",
"0.71151876",
"0.7109451",
"0.7103683",
"0.710095",
"0.71001333",
"0.7095115",
"0.7094733",
"0.7086586",
"0.70779425",
"0.70738095",
"0.7066413",
"0.70592684",
"0.70529276",
"0.7051485",
"0.7039914",
"0.7033418",
"0.7031443",
"0.7027259",
"0.7023329",
"0.7019872",
"0.7018383",
"0.701732",
"0.7015702",
"0.7014447",
"0.7013001",
"0.70086974",
"0.69947624",
"0.6988868",
"0.6986968",
"0.69836074",
"0.69771373",
"0.69755316",
"0.6972276",
"0.69719285",
"0.6971012",
"0.6964227",
"0.69620913",
"0.69614434",
"0.69609565",
"0.69588643",
"0.6956024",
"0.6955166",
"0.69547516",
"0.69519424",
"0.69501114",
"0.6948123",
"0.69451046",
"0.69451046",
"0.69443643",
"0.69443643",
"0.69443643",
"0.6943616",
"0.6942989",
"0.69418305",
"0.6941685",
"0.69358265",
"0.6934471",
"0.6933347",
"0.69295853",
"0.6929056",
"0.69209534",
"0.6917507",
"0.69174874",
"0.6914884",
"0.6913526",
"0.6913045",
"0.69121546",
"0.69117284",
"0.69112825",
"0.69071376",
"0.69047713",
"0.6904502",
"0.69012463",
"0.6899205",
"0.6898225",
"0.68928427",
"0.6892107",
"0.689181",
"0.6888474",
"0.6887428",
"0.68836963"
] |
0.7411644
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_tipo_ventum
@tipo_ventum = TipoVentum.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def tipo_ventum_params
params.require(:tipo_ventum).permit(:tipoVenta)
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
|
I worked on this challenge with Jessie Richardson I spent [2.5] hours on this challenge. Complete each step below according to the challenge directions and include it in this file. Also make sure everything that isn't code is commented in the file. 0. Pseudocode What is the input? an array of any size greater than or equal to zero What is the output? (i.e. What should the code return?) for pad!: output = if array length is greater than or equal to the minimum size, then the original array is outputted. If array is less than the minimum size, then the output will be an array with all of the contents of the original array plus padding to make the array longer. for pad: output = Same as above but a new array will be outputted and original array still exists. What are the steps needed to solve the problem? PSEUDOCODE FOR "pad!": 1) define a method called pad! 2) IF minimum size is less than or equal to the length of "array", return "array" 3) If minimum size is greater than the length of "array", "array" needs to be padded with x number of elements (where x = min_size array length) whose value is equal to "value" (nil). PSEUDOCODE FOR "pad" : 1) define a method called "pad" 2) IF minimum size is less than or equal to the length of "array", return "array" 3) If minimum size is greater than the length of "array", a copy of "array" is created and then padded with x number of elements ( where x = min_size array length) whose value is equal to "value" (nil). EXAMPLE: array = [1,2,3,4], min_size = 6 1. Initial Solution
|
def pad!(array, min_size, value = nil) #destructive
if min_size <= array.length
return array
else
until array.length == min_size
array << value
end
array
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def pad!(array, min_size, value = nil) #destructive\n solution_array = []\n if min_size <= array.length\n #p array\n return array\n elsif min_size > array.length\n solution_array = array\n times_to_pad = min_size - array.length\n #p times_to_pad\n times_to_pad.times do\n solution_array << value\n #p solution_array\n end\n end\n return solution_array\nend",
"def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n end\n if min_size > array.length\n remainder = min_size - array.length\n remainder.times do array << value\n end\n end\n p array\nend",
"def pad!(array, min_size, value = nil) #destructive\n # Your code here\n if min_size <= array.length\n return array\n else\n padding = array.length - min_size\n counter = array.length\n while counter < min_size\n array << value\n counter += 1\n end\n return array\n end\n\nend",
"def pad!(array, min_size, value = nil) #destructive\n if array.length < min_size\n padding_needed = min_size - array.length\n padding_needed.times { array.push value }\n end\n array\nend",
"def pad!(array, min_size, value = nil) #destructive\n \n if min_size <= array.length\n p array\n else \n p array << array + [value] * (min_size - array.length) \n end\nend",
"def pad!(array, min_size, value = nil) #destructive\n # Your code here\n if array.length >= min_size\n return array\n else\n padding = min_size - array.length\n padding.times do |x|\n array.push(value)\n end\n end\n return array\nend",
"def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n else\n pad_size = min_size - array.length\n counter = 0\n while counter < pad_size\n array << value\n counter+=1\n end\n return array\n end\nend",
"def pad!(array, min_size, value = nil) #destructive\r\n if min_size > array.size \r\n pad_array = Array.new(min_size - array.size, value) \r\n pad_array.each do |x|\r\n array << x \r\n end \r\n else\r\n array \r\n end\r\n p array\r\nend",
"def pad!(array, min_size, value = nil) #destructive\n if(min_size <= array.length)\n return array\n else\n counter = min_size - array.length\n while counter > 0\n array << value\n counter -= 1\n end \n return array\n end\nend",
"def pad!(array, min_size, value = nil) #destructive\n\tif min_size <= array.length || min_size == 0\n\t\t\n\t\treturn array\n\n\telse\n\t\t(min_size - array.length).times {\n\n\t\t\t\tarray.push(value)\n\t\t}\n\t\t\n\t\treturn array\n\n\tend\n\nend",
"def pad!(array, min_size, value = nil) #destructive\n if min_size < array.length || min_size == array.length \n return array\n else \n x = min_size - array.length\n x.times do\n array.push(value)\n end\n return array\n end\nend",
"def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n else\n diff = min_size - array.length\n diff.times do\n array << value\n end\n return array\n end\nend",
"def pad!(array, min_size, value=nil) #destructive\n if min_size == 0 || array.length >= min_size\n return array\n else (min_size - array.length).times { |array, x| array << value.to_i } \n return array\n end\nend",
"def pad!(array, min_size, value = nil) #destructive\n difference = min_size - array.length\n if min_size <= array.length\n p array\n elsif min_size == 0\n p array\n elsif min_size > 0\n difference.times do |x|\n array.push(value) \n end\n end\n p array\nend",
"def pad!(array, min_size, value = nil) #destructive\n if min_size <= array.length\n return array\n else\n size = min_size - array.length\n counter = 0\n while counter < size\n array << value\n counter += 1\n end\n end\n return array\nend",
"def pad!(array, min_size, value = nil)\n if min_size <= array.length\n return array\n else\n difference = min_size - array.length\n array.fill(value, array.length, difference)\n end\nend",
"def pad!(array, min_size, value = nil) #destructive\n difference = min_size - array.length\n #array.length #the variable len = array.length\n if difference > 0\n # puts positive amount of difference into array through default value\n difference.times { |x| array.push value }\n end\n return array\nend",
"def pad!(array, min_size, value = nil) #destructive\n if min_size <= array.length \n return array\n else \n x = min_size - array.length\n x.times do\n array.push(value)\n end\n return array\n end\nend",
"def pad!(array, min_size, value = nil)\n if min_size <= array.length\n return array\n else\n while min_size - array.length > 0\n array << value\n end\n return array\n end\nend",
"def pad!(array, min_size, value = nil) #destructive\n difference = min_size - array.length\n while difference > 0 do\n array << value\n difference-=1\n end\n array\nend",
"def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n else\n difference = min_size - array.length\n for i in 1..difference\n array.push(value)\n end\n end\n return array\nend",
"def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n else\n diff = min_size - array.length\n while diff > 0\n array.push(value)\n diff -= 1\n end\n return array\n end\nend",
"def pad!(array, min_size, value = nil)\n#destructive\n\n length = array.length\n\n if length >= min_size\n return p array\n\n elsif min_size == 0\n p array = []\n return p array = []\n\n else\n\n while array.length < min_size\n if value != nil\n array << value\n else\n array << nil\n end\n end\n return p array\n end\nend",
"def pad!(array, min_size, value = nil) #destructive\r\n\treturn array << value if array.length <= min_size\r\n\treturn array\r\n # #size_difference = min_size - array.length\r\n # (min_size - array.length).times do\r\n # array << value\r\n # end \r\n # array\r\nend",
"def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n else\n index = array.length\n while index < min_size\n array[index] = value\n index += 1\n end\n end\n return array\nend",
"def pad!(array, min_size, value = nil) #destructive\n if array.length < min_size\n i = array.length\n while i < min_size\n array[i] = value\n i += 1\n end\n end\n p array\nend",
"def pad!(array, min_size, value = nil) #destructive\n if array.length < min_size\n (min_size - array.length).times { array.push(value) }\n end\n return array\nend",
"def pad!(array, min_size, value = nil) #destructive\n if array.length < min_size\n for i in 1..(min_size - array.length)\n array << value\n end\n end\n return array\nend",
"def pad!(array, min_size, value = nil) #destructive\n \n if array.length >= min_size \n p array\n else\n \n while array.length < min_size\n array = array.push(value)\n end \n \n p array\n end\n \nend",
"def pad!(array, min_size, value = nil) #destructive\n if array.size >= min_size\n \treturn array\n else\n \ti = min_size - array.size\n \ti.times { array << value }\n \tarray\n end\nend",
"def pad!(array, min_size, value = nil) #destructive\n if array.length > min_size || min_size == 0\n return array\n else\n while array.length < min_size do\n array.push(value)\n end\n return array\n end\nend",
"def pad!(array, min_size, value = nil) #destructive\n difference = min_size - array.length\n if difference <= 0\n return array\n else\n return array.concat(Array.new(difference, value))\n end\nend",
"def pad!(array, min_size, value = nil) #destructive\n if array.length - min_size < 0\n difference = array.length - min_size\n difference = difference.abs\n for i in 0..difference - 1\n array.push(value)\n end\n end\n return array\nend",
"def pad!(array, min_size, value = nil)\n if array.length >= min_size\n return array\n else\n x = array.length\n until x == min_size; array.push value; x += 1\n end\n p array\n end\nend",
"def pad!(array, min_size, value = nil)\n if min_size==0\n return array\n else\n num_things=min_size-array.length\n num_things.times do\n array << value\n end\n end\n array\nend",
"def pad(arr, min_size, value = nil) #non-destructive\n array = arr.dup\n if array.length < min_size\n padding_needed = min_size - array.length\n padding_needed.times { array.push value }\n end\n array\nend",
"def pad!(array, min_size, value = nil) #destructive\n # Your code here\n if array.length < min_size\n x = min_size - array.length\n x.times do array << value\n end\n end\n return array\nend",
"def pad!(array, min_size, value = nil) #destructive\n diff = min_size - array.length\n times = 0 if diff < 0\n diff.times do\n array << value\n end\n array\nend",
"def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n else\n while array.length < min_size\n array.push(value)\n end\n return array\n end\nend",
"def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n else\n loop do array.push(value)\n break if array.length >= min_size\n end\n p array\n return array\n end\nend",
"def pad!(array, min_size, value = nil) #destructive\n array.keep_if{ |a| a <= array.length}\n difference = min_size - array.length\n counter = 0\n while counter < difference\n array << value\n counter += 1\n end\n p array\n # self = ans_array\nreturn array\nend",
"def pad!(array, min_size, value = nil) #destructive\n difference = min_size - array.length\n new_array = Array.new(difference, value)\n padded_array = array.push(new_array)\n array = padded_array.flatten!\n p array\nend",
"def pad!(array, min_size, value = nil) #destructive\n if array.count >= min_size\n return array\n else\n (min_size - array.count).times do\n array << value\n end\n return array\n end\nend",
"def pad!(array, min_size, value = nil) #destructive\r\n iter = min_size - array.length\r\n if min_size <= array.length\r\n return array\r\n else\r\n iter.times {array << value}\r\n end\r\n return array\r\nend",
"def pad!(array, min_size, value = nil) \n array.fill(value, array.length...min_size) unless min_size <= array.length\n array\nend",
"def pad!(array, min_size, value = nil) #destructive\n # Your code here\n if array.length >= min_size \n \treturn array\n else \n \t(min_size-array.length).times do\n \t\tarray.push(value)\n \tend\n \treturn array\n end\nend",
"def pad(input_array, min_size, value = nil) #non-destructive\n array = []\n input_array.each do |x|\n array << x\n end\n if array.length < min_size\n i = array.length\n while i < min_size\n array[i] = value\n i += 1\n end\n end\n p array\nend",
"def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n end\n until min_size <= array.length\n array << value\n end\n array\nend",
"def pad!(array, min_size, value = nil) #destructive\n# Your code here\n\nif array.length == min_size || min_size == 0\n return array\nend\n\nif min_size > array.length\n until array.length == min_size\n array.push(value)\n end\n end\n array\nend",
"def pad!(array, min_size, value = nil) #destructive\n difference = array.length - min_size\n difference = difference.abs\n if array.length - min_size < 0\n for i in 0..difference - 1\n array.push(value)\n end\n end\n return array\nend",
"def pad!(array, min_size, value = nil) #destructive\n # Your code here\n if array.size == min_size\n return array\n else\n while min_size > array.size\n array << value\n end\n end\n return array\nend",
"def pad!(array, min_size, value = nil) #destructive\n difference = (min_size - array.length)\n difference.times {\n array << value}\n return array\nend",
"def pad!(array, min_size, value = nil) #destructive\n # Your code here\n difference = min_size - array.length\n if difference <= 0\n return array\n else\n difference.times do\n array.push(value)\n end\n end\n\n return array\nend",
"def pad!(array, min_size, value = nil) #destructive\n (min_size <= array.length || min_size == 0)? array:array.fill(value, array.length..min_size-1)\nend",
"def pad!(array, min_size, value = nil)\n\tif min_size <= array.length\n\t\treturn array\n\telse\n\t\twhile min_size - array.length > 0\n\t\t\tarray << value\n\t\tend\n\t\treturn array\n\tend\nend",
"def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n \treturn array\n else\n \tuntil array.length == min_size\n \t\tarray.push(value)\n \tend\n \treturn array\n end\nend",
"def pad!(array, min_size, value = nil) #destructive\n length = array.length\n if length >= min_size\n return array\n else\n until array.length == min_size\n return array.push(value = nil)\n end\n end \nend",
"def pad!(array, min_size, value = nil)\n\treturn array if min_size <= array.length\n\tneeded_pads = min_size - array.length\n\tpadding = Array.new(needed_pads, value)\n\tpadding.each { |item| array << item }\n\treturn array\nend",
"def pad!(array, min_size, value = nil)\nreturn array.fill(value, array.length..(min_size-1))\nend",
"def pad!(array, min_size, value = nil) #destructive\n # Your code here\n if min_size <= array.size\n return array\n else\n new_array_size = (min_size - array.size)\n while new_array_size > 0\n array.push(value)\n new_array_size = (new_array_size - 1)\n end\n end\n return array\nend",
"def pad!(array, min_size, value = nil) #destructive\n # Your code here\n return array if min_size <= array.length\n while min_size > array.length\n array.push(value)\n end\n array\nend",
"def pad!(array, min_size, value = nil) #destructive\n if array.size >= min_size\n return array\n end\n while array.size < min_size do\n array << value\n end\n return array\nend",
"def pad!(array, min_size, value = nil) #destructive\n if array.size >= min_size\n return array\n end\n while array.size < min_size do\n array << value\n end\n return array\nend",
"def pad(array, min_size, value = nil) #non - destructive\n array_modified = []\n if min_size <= array_modified.length\n array_modified = array.map { |x| x }\n elsif min_size == 0\n array_modified = array.map { |x| x }\n else\n array_modified = array.map { |x| x }\n (min_size - array_modified.length).times {\n array_modified.push(value)\n }\n return array_modified\n end\nend",
"def pad!(array, min_size, value = nil) #destructive\n if min_size <= array.length\n return array\n end\n \n until array.length == min_size do\n array.push(value)\n end\n array\nend",
"def pad!(array, min_size, value = nil) #destructive\n\n if array.length >= min_size\n return array\n else\n array.push(value) until array.length == min_size\n end\n array\nend",
"def pad!(array, min_size, value = nil) #destructive\n if array.length < min_size \n \tarray.push(value)\n else \n return array \nend \t\nend",
"def pad!(array, min_size, value = nil) #destructive\n # Your code here\n if array.length < min_size\n while array.length < min_size\n array << value\n end\n end\n return array\nend",
"def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n else\n for i in array.length...min_size\n array[i] = value\n end\n end\nend",
"def pad!(array, min_size, value = nil)\n array.fill(value, array.length, min_size-array.length)\nend",
"def pad!(array, min_size, value = nil) #destructive \n\tarray\nend",
"def pad!(array, min_size, value = nil) #destructive\r\n (array.length..min_size - 1).each { |i| array[i] = value}\r\n array\r\nend",
"def pad!(array, min_size, value = nil) #destructive\n i = min_size - array.length\n\n i.times {array.push(value)} if array.length < min_size\n array\nend",
"def pad!(array, min_size, value = nil) #destructive\n while array.length < min_size\n array << value\n end\n return array\nend",
"def pad!(array, min_size, value = nil) #destructive\n while array.length < min_size\n array << value\n end\n array\nend",
"def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n end\n # refactor for a cooler method than while loop\n # use an index for looping\n i = array.length\n while i < min_size\n array.push value\n i += 1\n end\n array\nend",
"def pad!(array, min_size, value = nil)\n size_difference = min_size - array.length\n size_difference.times do\n array << value\n end\n array\nend",
"def pad(array, min_size, value = nil) #non-destructive\n \n new_array = [].concat(array)\n # array.each { |el| new_array << el } \n \n difference = min_size - array.length\n #array.length #the variable len = array.length\n if difference > 0\n # puts positive amount of difference into array through default value\n difference.times { |el| new_array << value }\n end\n \n \n return new_array\n \nend",
"def pad!(array, min_size, value = nil) #destructive\n # Your code here\n if min_size > array.length\n array << value\n return array\n else\n return array\n end\nend",
"def pad_array(array, min_size, pad_with)\nend",
"def pad!(array, min_size, value = nil) #destructive\n while min_size > array.length\n array.push(value)\n end\n array\nend",
"def pad!(array, min_size, value = nil) #destructive\n # Your code here\n return array if min_size <= array.length\n while min_size > array.length\n \tarray.push(value)\n end\n array\nend",
"def pad(array, min_size, value = nil) #non - destructive\n\n\tarray_modified = []\n\n\tif min_size <= array_modified.length || min_size == 0\n\t\t\n\t\tarray_modified = array.map { |x| x}\n\n\telse\n\t\tarray_modified = array.map { |x| x}\n\n\t\t(min_size - array_modified.length).times {\n\n\t\t\t\tarray_modified.push(value)\n\t\t}\n\n\t\treturn array_modified\n\n\tend\n \nend",
"def pad(array, min_size, value = nil) #non-\n other_array=[]\n if min_size==0\n other_array << array\n other_array.flatten!\n else\n num_things=min_size-array.length\n if array == []\n num_things.times do\n other_array << value\n end\n else\n other_array << array\n other_array.flatten!\n num_things.times do\n other_array << value\n end\n end\n end\n other_array\nend",
"def pad!(array, min_size, value = nil) #destructive\n array << value while min_size > array.length\n array\nend",
"def pad(array, min_size, value = nil) \n arr_len = array.length\n array_copy = Array.new(array)\n\n if arr_len < min_size \n padding_size = min_size - arr_len\n\n padding_size.times do \n array_copy.push(value) \n end \n end \n\n return array_copy\nend",
"def pad!(array, min_size, value = nil) #destructive\n array.fill(value, array.length...min_size)\nend",
"def pad!(array, min_size, value = nil) #destructive\n while array.length < min_size\n array.push(value)\n end\n array\nend",
"def pad!(array, min_size, value = nil) #destructive\n array << value while array.length < min_size\n array\nend",
"def pad!(array, min_size, value = nil) #destructive\r\n # Your code here\r\n if array.length >= min_size \r\n return array\r\n else \r\n until array.length == min_size\r\n array.push value\r\n end\r\n return array\r\n end\r\nend",
"def pad!(array, min_size, value = nil) #destructive\n # Your code here\n array_size = array.count\n if min_size > array_size\n \tfor i in 0...(min_size - array_size)\n \t\tarray.push(value)\n \tend\n \treturn array\n else\n \treturn array\n end\nend",
"def pad!(array, min_size, value = nil) #destructive\n # Your code here\n if array.length >= min_size \n return array\n else \n until array.length == min_size\n array.push value\n end\n return array\n end\nend",
"def pad!(array, min_size, value = nil) #non-destructive\n # Your code here\n array_length = array.length\n array2 = array\n\n if array_length < min_size\n\n while array_length < min_size do\n array2.push(value)\n array_length +=1\n end\n end\n return array2\nend",
"def pad!(array, min_size, value = nil) #destructive\n size = array.length\n if min_size > size\n additions = min_size - size\n additions.times do\n array.push(value)\n end\n end\n # Your code here\n return array\nend",
"def pad!(array, min_size, value = nil) #destructive\n\n # Your code here\narray.fill(value, array.length..(min_size-1))\nend",
"def pad!(array, min_size, value = nil) #destructive\n array_size = array.size\n until array_size >= min_size\n array << value\n array_size += 1\n end\n return array\nend",
"def pad!(array, min_size, value = nil) #destructive\n # Your code here\n new_array = array\n x = array.length\n\n def greater?(x, min_size)\n if x >= min_size\n return true\n else\n return false\n end\n end\n\n if greater?(x, min_size) ||\n min_size.times do |x|\n new_array.push(array[x])\n end\n return new_array\n\n else\n min_size.times do |x|\n if array[x] == nil\n self.push(value)\n else\n new_array.push(array[x])\n end\n end\n return new_array\n end\nend",
"def pad(array, min_size, value = nil) #non-destructive\n arrayCopy = array.dup\n\n if arrayCopy.length >= min_size\n return arrayCopy\n\n else\n while arrayCopy.length < min_size\n arrayCopy[arrayCopy.length] = value\n # p arrayCopy\n end\n return arrayCopy\n end\nend",
"def pad(array, min_size, value = nil) \n arr_len = array.length\n array_copy =Array.new(array)\n\n if arr_len < min_size \n padding_size = min_size - arr_len\n\n padding_size.times do \n array_copy.push(value) \n end \n end \n\n return array_copy\nend",
"def pad(array, min_size, value = nil)\n array_new = [ ]\n array.each do |x|\n array_new.push(x)\n end\n while array_new.length < min_size\n array_new.push(value)\n end\n return array_new\nend"
] |
[
"0.8601387",
"0.8491136",
"0.84425193",
"0.84000564",
"0.83731455",
"0.8342784",
"0.8309159",
"0.83052385",
"0.83029413",
"0.82975966",
"0.8293706",
"0.82908595",
"0.82867765",
"0.82847285",
"0.8284431",
"0.82768124",
"0.8273952",
"0.82601684",
"0.825275",
"0.8251968",
"0.82498324",
"0.8239013",
"0.82375836",
"0.82230365",
"0.8222317",
"0.8205725",
"0.82050925",
"0.8200547",
"0.81978905",
"0.81958234",
"0.8193058",
"0.819301",
"0.8184725",
"0.8184297",
"0.8181767",
"0.8178849",
"0.8177085",
"0.8176135",
"0.8173514",
"0.81729645",
"0.8166014",
"0.8164407",
"0.81607634",
"0.8157493",
"0.81433994",
"0.8138829",
"0.81343555",
"0.8132552",
"0.81323767",
"0.8129461",
"0.8129005",
"0.8121331",
"0.8120352",
"0.8113763",
"0.8104988",
"0.81038535",
"0.80997205",
"0.8096953",
"0.8095993",
"0.8084675",
"0.80766636",
"0.8071803",
"0.8071803",
"0.8070112",
"0.8067322",
"0.80650014",
"0.8050358",
"0.80477923",
"0.80449843",
"0.803661",
"0.80221736",
"0.8019256",
"0.80174184",
"0.8017072",
"0.80138594",
"0.8009547",
"0.8005362",
"0.79982525",
"0.7998048",
"0.79801375",
"0.79683506",
"0.79637706",
"0.79635364",
"0.79552966",
"0.7940106",
"0.7937507",
"0.7929824",
"0.79291177",
"0.7926104",
"0.7917506",
"0.791099",
"0.79010946",
"0.78993106",
"0.7887268",
"0.78752434",
"0.78686005",
"0.7865549",
"0.78601503",
"0.7858781",
"0.7858096"
] |
0.8189274
|
32
|
Fetches number of followers and number of lists
|
def twitter_stats
# would be nice to use the twitter gem here, but twitter
# doesn't expose list counts on user info.
doc = Nokogiri::HTML(open("http://twitter.com/#@twitter"))
followers = doc.css("#follower_count").first.content.to_i
lists = doc.css("#lists_count").first.content.to_i
"followers: #{followers}; lists #{lists}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def number_of_followers\n return_list_of_followers.size\n end",
"def number_of_followees\n return_list_of_followed_users.size\n end",
"def followers_count\n follow_count_for_a(:follower)\n end",
"def num_followers\n follower_ids = Following.where(:followed_id => self.id).pluck(:follower_id)\n follower_ids.size - 1 #don't count yourself\n end",
"def followers\n json[\"entry_data\"][\"ProfilePage\"].first[\"graphql\"][\"user\"][\"edge_followed_by\"][\"count\"]\n end",
"def followers_count\n @target.followers_count.to_i\n end",
"def follower_count\n sql = \"SELECT count(guid) FROM buddy WHERE relationship=#{Model::Buddy::FOLLOWER} or relationship=#{Model::Buddy::BOTH};\";\n result = @db.execute(sql)\n result[0][0].to_i\n end",
"def followers(num)\n last_followers = @client.followers\n\n end",
"def followers_count\n\t\tself.followers.count\n\tend",
"def followees_count\n follow_count_for_a(:followee)\n end",
"def count_user\n count = 0\n @f_net.each do |followees|\n count += 1 unless !followees or followees.empty?\n end\n count\n end",
"def following_users_count\n following_users.count\n end",
"def count_item\n count = 0\n @g_net.each do |followers|\n count += 1 unless !followers or followers.empty?\n end\n count\n end",
"def count_follower\n\t\t#relationships.count - count_followed\n\n\tend",
"def cult_population\n followers_list.size\n end",
"def followers(pr)\n q = <<-QUERY\n select count(f.follower_id) as num_followers\n from pull_requests pr, followers f, pull_request_history prh\n where prh.actor_id = f.user_id\n and prh.pull_request_id = pr.id\n and prh.action = 'opened'\n and f.created_at < prh.created_at\n and pr.id = ?\n QUERY\n db.fetch(q, pr[:id]).first[:num_followers]\n end",
"def followers\n client = Twitter::Client.new.configure do |config|\n config.consumer_key = ENV['CONSUMER_KEY']\n config.consumer_secret = ENV['CONSUMER_SECRET']\n config.oauth_token = ENV['OAUTH_TOKEN']\n config.oauth_token_secret = ENV['OAUTH_TOKEN_SECRET']\n end\n\n client.user(@login).followers_count\n end",
"def followers(pr_id)\n q = <<-QUERY\n select count(f.follower_id) as num_followers\n from pull_requests pr, followers f, pull_request_history prh\n where pr.user_id = f.user_id\n and prh.pull_request_id = pr.id\n and prh.action = 'opened'\n and f.created_at < prh.created_at\n and pr.id = ?\n QUERY\n if_empty(db.fetch(q, pr_id).all, :num_followers)\n end",
"def follow_count\n\t\t\t\tFollow.active.for_follower( self ).count\n \t\t\tend",
"def count_followed\n\t\t#relationships.where(follower_id: self.id).count\n\tend",
"def Listfollowers\n follower= Following.where(\"followingid =:followingId\",{followingId:getUserId[0]['userId']}).count\n render json: {follower:follower}, status: :ok\n end",
"def my_count\n count = my_followers.count\n end",
"def get_counts\n #1 - @friend_count -> gets the number of current friends you have.\n @friend_count = current_user.active_friends.size\n \n #2 - @pending_count -> gets the number of pending friend requests you have.\n @pending_count = current_user.pending_friend_requests_to.map(&:friend).size\n end",
"def getCount()\n\t\t#begin\n\t\t\tcounter = 0\n\t\t\t@accounts.each do |username|\n\t\t\t\tcounter = counter + TwitterClient.user(username).followers_count\n\t\t\tend\n\t\t\tcounter\n\t\t#rescue\n\t\t#\t-1\n\t\t#end\n\tend",
"def followers(options={})\n options = {\n :count => 1000,\n :offset => 0,\n :fields => \"screen_name\"\n }.merge(options)\n\n fetch_all_method_items(:fetch_followers, options)\n end",
"def following_profiles_count\n stream_ids = favorites.streams.pluck(:favable_id).uniq\n return Stream.where(:id => stream_ids).pluck(:profile_id).uniq.count\n end",
"def followers_even_indirectly_count\n Rails.redis.sunion(redis_name__followed_by, user.redis_name__followed_by).count\n end",
"def followed_by_profiles_count\n return Favorite.where(favable_type: 'Stream', favable_id: stream_ids).pluck(:profile_id).uniq.count\n end",
"def following_count\n sql = \"SELECT count(guid) FROM buddy WHERE relationship=#{Model::Buddy::FOLLOWING} or relationship=#{Model::Buddy::BOTH};\";\n result = @db.execute(sql)\n result[0][0].to_i\n end",
"def followers(options={})\n # Not avaiable since 30.04.2015\n return []\n\n limit = options[:limit] || 5000\n fetch_all = options[:fetch_all] || false\n iteration = 0\n\n _followers = collection = user.subscribers(:limit => limit)\n max_iteration = _followers.total_count / limit + 1\n\n if fetch_all\n while iteration < max_iteration\n iteration += 1\n collection = collection.next\n _followers += collection\n end\n end\n\n _followers\n end",
"def active_followed_users\n @user.following.limit(FRESH_FETCH_SIZE)\n end",
"def followers\n list = service.find_followers(user).map {|data| build_object(data)}\n followers = list.map {|follower| follower.login}\n end",
"def follower_ids\n follows.try(:[], 'followers') || []\n end",
"def return_list_of_followers\n @followers = []\n #Find the list of users following the current user by searching the followed_user_id\n #We need to add each user to the array - otherwise we return an array of object Follow\n Follow.find(:all, :conditions => {:follow_user_id => self.id}).each {|f| @followers << f.user}\n @followers\n end",
"def collect_followers twitter_id\n while @@client.application.rate_limit_status?.resources.followers.send(\"/followers/ids\").remaining == 0\n puts \"collect friends waiting...\"\n sleep(60) \n end\n \n begin\n puts \"COLLECTING Follower IDS OF #{twitter_id}\"\n result = @@client.followers.ids? :id => twitter_id, :cursor => -1\n follower_ids = result.ids\n old_cursor = 0\n next_cursor = result.next_cursor\n while old_cursor != next_cursor and next_cursor != 0\n old_cursor = next_cursor\n result = @@client.followers.ids? :id => twitter_id, :cursor => next_cursor\n follower_ids += result.ids\n next_cursor = result.next_cursor\n end \n rescue\n follower_ids = []\n tmp_person = @@client.users.show? :id => twitter_id\n SystemMessage.add_message(\"error\", \"Collect Followers\", \"Followers of Person with twitter id: \" + tmp_person.screen_name + \" could be not found.\") \n end\n if follower_ids != [] \n follower_ids_hash = Hash.new(0)\n store = PStore.new(FOLLOWER_IDS_PATH + twitter_id.to_s)\n store.transaction{store[twitter_id] = follower_ids_hash} #empty store if updating\n follower_ids.each do |follower_id|\n follower_ids_hash[follower_id] = 1 \n end\n store.transaction{store[twitter_id] = follower_ids_hash} #store values\n end\n end",
"def followers\n @followers ||= get(\"/user/show/#{login}/followers\")['users'].map { |u| User.new(connection, :login => u) }\n end",
"def followers_page_count(id, page_size = Amico.page_size, scope = Amico.default_scope_key)\n total_pages(\"#{Amico.namespace}:#{Amico.followers_key}:#{scope}:#{id}\", page_size)\n end",
"def cult_population\n my_followers.count\n end",
"def followers\n scrape_for(:followers, :get_followers)\n end",
"def followers_history; counter_per_day(:followers); end",
"def get_more_users(l=1,n = nil)\n\t #u is a User in the database\n\t\t#n is the number we want to had \n\t\t#l is the level of recursivity\n\t\tif l != 0\n #call the API\n\t\t\t#fws = self.get_followers\n\t\t\tfi = self.get_following\n\t\t\t#from the API objects create databases objects \n\t users = User.set_users_from_twitter_users(fi,n)\n\t\t\tself.save!\n self.add_followings(users)\n\t users.each{|f|\n\t\t\t f.get_more_users(l-1, n)\n\t\t\t}\n\t\tend\n\t\treturn users\n end",
"def followers\n @hot_topics = Topic.hot_topics(5)\n @interviewee = User.where(:nickname => params[:id]).first\n @is_same_user = @interviewee.is_same_user?(@current_user)\n \n @followers = @interviewee.followers\n @current_user.refresh_notifications(\"new_followers_count\")\n end",
"def followers_count(id, scope = Amico.default_scope_key)\n Amico.redis.zcard(\"#{Amico.namespace}:#{Amico.followers_key}:#{scope}:#{id}\")\n end",
"def followers\n @followers = Follower.where(:friend_id => @current_user.id)\n end",
"def following\n json[\"entry_data\"][\"ProfilePage\"].first[\"graphql\"][\"user\"][\"edge_follow\"][\"count\"]\n end",
"def followers\n if @activity.user_type == 'User' && @activity.key == 'vote.create'\n ids = (@actor.followers_ids.union(@activity.recipient.voters_ids) - [@activity.recipient_user.id.to_s])\n elsif @activity.user_type == 'School'\n ids = (@actor.followers_ids.union(@activity.recipient.followers_ids) + @actor.users.pluck(:id).map(&:to_s) - [@activity.recipient_user.id.to_s])\n else\n ids = (@actor.followers_ids.members - [@activity.recipient_user.id.to_s])\n end\n User.find(ids.uniq)\n end",
"def follow_unfollowing_user\n # Following new users\n # followers - following = need to follow\n begin\n followers = get_followers\n followings = get_followings\n need_to_follow = followers - followings\n rescue\n error_log 'error in follow_unfollowing_user'\n end\n\n log \"need to follow: \"\n for id in need_to_follow do\n log \" #{id}\"\n end\n\n for id in need_to_follow do\n follow_user id\n end\n\n return followings.size + need_to_follow.size\n end",
"def follower_ids(options={})\n perform_get(\"followers/ids.#{Twitter.format}\", options)\n end",
"def following_count\n $redis.scard(self.redis_key(:following))\n end",
"def count_edge\n count = 0\n @f_net.each_with_index do |followees, follower|\n count += followees_of(follower).count\n end\n count\n end",
"def followers\n @followers = @other_user.followers.paginate(:page => params[:page], :per_page => 20)\n end",
"def followers\n @followers ||= refresh_followers\n end",
"def followers(page=1)\n return get(\"/statuses/followers.json?page=#{page}\") if page == 1\n ids = []\n cursor = \"-1\"\n page.times do \n return [] if cursor == 0 \n json = get(\"/statuses/followers.json?cursor=#{cursor}\")\n cursor = json[\"next_cursor\"]\n ids = json[\"ids\"]\n end\n ids\n end",
"def followerss\n followers = relationships.find_by_followed_id(self.id)\n return followers\n end",
"def number_to_follow(user_limit)\n # 20% more followers or 2000 as estimated follow limit\n max_followers = [(follower_count / 20).floor + follower_count, 10000].max\n # Prevent negative #'s, Max at 12 follows at a time for rate limiting\n max_following_limit = [0, max_followers - following_count].max\n # Twitter limits 1000 follows per day: 10 follows per 15 minutes = 960\n max_day_limit = [user_limit, 10].min\n # Find the least to follow to not exceed max limit and day limit\n num_to_follow = [max_following_limit, max_day_limit].min\n # TODO check rate limit for adding friends and do 'min'\n p \"**** To Follow for #{self.username} --> #{num_to_follow}\"\n p \"Followers: #{self.follower_count}, Following: #{self.following_count}\"\n num_to_follow\n end",
"def followers \r\n\tlovers = []\r\n\tself.likes.each do |l|\r\n\t\tlovers << l.user\r\n\tend\r\n\tself.feature_groups.each do |fg|\r\n\t\tfg.features.each do |f|\r\n\t\t\tf.likes.each do |l|\r\n\t\t\t\tlovers << l.user\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\n\treturn lovers.unique\r\n end",
"def followers\n result = connection.get(\n \"/users/#{CGI.escape(login)}/followers\"\n )\n\n result.map do |follower|\n self.class.new(follower, connection)\n end\n end",
"def followers\n\t Friendship.findFriends(self,\"follow\",\"from\")\n end",
"def get_all_followers\n followers = []\n self.follower_ids.each do |id|\n unless Person.find_by_twitter_id(id).nil?\n followers << Person.find_by_twitter_id(id) \n end \n end\n return followers\n end",
"def followers(user=nil)\n\t\tcursor = -1\n\t\tpage = 0\n\t\tfollowers = []\n\t\tbegin\n\t\t\tfollowerspage = followers_by_cursor( user, cursor )\n\t\t\tpage += 1\n\t\t\tputs \"page #{page}/cursor #{cursor} - found #{followerspage[\"users\"].size} followers. Next cursor: #{followerspage[\"next_cursor\"]}\"\n\t\t\tfollowers += followerspage[\"users\"] if followerspage[\"users\"]\n\t\t\tcursor = followerspage[\"next_cursor\"]\n\t\tend until cursor == 0\n\t\tfollowers\n\trescue => err\n\t\tputs \"Exception in followers: #{err}\"\n\t\traise err\n\tend",
"def followers\n @followers = current_user.followers.order(\"username\").page(params[:page]).per(10)\n end",
"def followers(user_id = nil)\n twitter_request do\n logger.info \"Get followers of #{user_id || 'me'}\"\n client.follower_ids(user_id).take(5000)\n end\n end",
"def followers_info\n followers = []\n self.followers.each do |follower|\n followers << follower.attributes.merge(avatar: follower.avatar.url)\n end\n response = {\n message: \"Successfully fetch #{ self.username } followers\",\n relations: followers\n }\n end",
"def followers(options={})\n perform_get(\"statuses/followers.#{Twitter.format}\", options)\n end",
"def follow_count\n Follow.unblocked.approved.for_follower(self).count\n end",
"def return_list_of_followed_users\n @followees = []\n #We need to add each user to the array - otherwise we return an array of object Follow\n self.follows.each {|f| @followees << f.followed_user}\n @followees\n end",
"def get_friend_count\n response = twitter_user.request(:get, configatron.api_call_url + \"account/totals.json\")\n \n if response.is_a?(Net::HTTPSuccess)\n body = JSON.parse(response.body)\n body[\"friends\"]\n end\n end",
"def number_for_profile\n # byebug\n # @user=User.where(username: count_params[:username])\n @user = User.find(decode_jwt(cookies.signed[:jwt])[\"user_id\"])\n numfollowers=Follow.where(followee_id: @user.id).count \n numblocked=Block.where(blockee_id: @user.id).count\n render json: {followers: numfollowers, blocked: numblocked}\n end",
"def followers\n optional! :offset, type: Integer, default: 0\n optional! :limit, type: Integer, default: 20, values: 1..150\n\n @users = @user.follow_by_users.fields_for_list.order(\"actions.id asc\").offset(params[:offset]).limit(params[:limit])\n end",
"def get_follower_ids( id, login=@login, password=@password, type='json' )\n http = Net::HTTP.new('twitter.com', 80)\n \n begin\n json_data = http.start do |http_inst|\n if id.class == Fixnum\n path = \"/followers/ids/ids.#{type}?user_id=#{id}\"\n else \n path = \"/followers/ids/#{id}.#{type}\"\n end\n req = Net::HTTP::Get.new(path)\n \n # we make an HTTP basic auth by passing the\n # username and password\n req.basic_auth login, password\n \n resp, data = http_inst.request(req)\n data\n end\n # puts data\n hash_data = JSON.parse( json_data )\n if hash_data.class == Hash && hash_data[\"error\"]\n return []\n end\n results = hash_data\n rescue\n puts \"Switching to paging.\"\n results = []\n page=1\n loop do\n json_data = http.start do |http_inst|\n if id.class == Fixnum\n path = \"/followers/ids/ids.#{type}?user_id=#{id}&page=#{page}\"\n else \n path = \"/followers/ids/#{id}.#{type}?page=#{page}\"\n end\n req = Net::HTTP::Get.new(path)\n \n # we make an HTTP basic auth by passing the\n # username and password\n req.basic_auth login, password\n \n resp, data = http_inst.request(req)\n data\n end\n # puts data\n hash_data = JSON.parse( json_data )\n if hash_data.class == Hash && hash_data[\"error\"]\n return []\n end\n puts \"page #{page} (5000 per page)\"\n results += hash_data\n break if hash_data.length == 0\n page += 1\n end\n \n end\n results \n end",
"def followers\n super[:total]\n end",
"def followers\n follower_ids = Following.where(:followed_id => self.id).order(:follower_id).pluck(:follower_id)\n ret_val = []\n follower_ids.each do |follower_id|\n ret_val << User.find(follower_id)\n end\n ret_val\n end",
"def followers\n fids = followers_ids\n fids.count < 1 ? [] : User.where('id IN (?)', fids)\n # fids.count < 1 ? [] : User.where('id IN (?)', fids)\n end",
"def fetch_api_followers\n client = api_client\n\n next_cursor = nil\n api_followers = Hash[1.step(self.followers_count,20).inject([]) do |acc, a|\n options = {count: 20}\n {cursor: next_cursor}.merge!(options) if next_cursor\n response = client.user_followed_by(self.uid, options)\n next_cursor = response.fetch('pagination', {}).fetch('next_cursor', nil)\n acc + response['data'].map {|u| [u['id'], u]}\n end]\n end",
"def all_follower_ids(username = false)\n ids = []\n cursor = \"-1\"\n while cursor != 0 do \n json = get(\"/followers/ids.json?cursor=#{cursor}#{username ? \"&screen_name=#{username}\" : ''}\")\n cursor = json[\"next_cursor\"]\n ids += json[\"ids\"]\n end\n ids\n end",
"def follower_ids\n followers.map(&:id)\n end",
"def following_posts_count\n count_sql=<<-SQL\n SELECT COUNT(*) AS num FROM posts p\n INNER JOIN follows f ON f.followable_id = p.user_id \n INNER JOIN visit_journals v ON v.user_id = p.user_id\n\t WHERE f.follower_id = #{self.id} AND p.created_at > v.last_visited_at\n\tGROUP BY p.user_id\n SQL\n User.find_by_sql(count_sql)\n end",
"def followers\n rels = Relationship.where(followed_id: self.id)\n followers = []\n rels.each do |rel|\n followers << User.find(rel.follower_id)\n end\n followers\n end",
"def followers\n config = create_or_find_config\n \n puts\n Twitter::Base.new(config['email'], config['password']).followers.each do |u|\n puts \"#{u.name} (#{u.screen_name})\"\n puts \"#{u.status.text} at #{u.status.created_at}\" unless u.status.nil?\n end\n end",
"def follows_count_by_model(model)\n self.follows.where(:followable_type => model).count\n end",
"def following_count(object_type = User)\n $redis.scard(self.following_redis_key(\"#{object_type.to_s.downcase}:following\"))\n end",
"def followers\n\t\t@unique_followers_set = Set.new\n\n\t\tself.comments.each do |c|\n\t\t\tnext if c.user == c.commentable.user\n\t\t\t@unique_followers_set << c.user\n\t\tend\n\n\t\tself.offers.each do |o|\n\t\t\t@unique_followers_set << o.user\n\t\tend\n\n\t\tif @unique_followers_set.empty? == true\n\t\t\treturn nil\n\t\tend\n\n\t\treturn @unique_followers_set\n\tend",
"def followers_ids\n Following.where(followed_id: self.id).pluck(:follower_id)\n end",
"def get_no_of_users\n\t\tusers.select(:id).count\n\tend",
"def increment_counters\n if followable_type == \"User\"\n user = User.find(followable_id)\n follower = User.find(follower_id)\n user.update_attribute(:followers_count_cache, user.followers_count)\n follower.update_attribute(:following_count_cache, follower.following_users_count)\n end\n end",
"def get_followers_ids(auth = auth_http())\n TwBot.followers_ids(auth)\n end",
"def refresh_friends_count\n update_attributes(\n followers_count: follower_tracker.target_count,\n following_count: following_tracker.target_count\n )\n end",
"def followers\n @followers = @user.followers.order(created_at: :desc) # order the followers(the people that follows current_user) according to when they follow current_user, with the most recent follower at the top.\n end",
"def Listfollowing\n following= Following.where(\"userid =:userId\",{userId:getUserId[0]['userId']}).count\n render json: {following:following}, status: :ok\n end",
"def follower_ids\n self.follower_ids_hash.keys rescue []\n end",
"def top_10_followers\n users_array = UserLeague.all.collect{|user| user.user_id}\n most_common_value = users_array.uniq.sort_by{ |i| users_array.count( i ) }.reverse\n biggest_followers = most_common_value.map {|user| User.find(user).name}[0..9]\n users_league_count = most_common_value.map {|user| User.find(user).leagues.count}[0..9]\n counter = 0\n return_hash = {}\n until counter == biggest_followers.length do\n return_hash[biggest_followers[counter].to_s] = users_league_count[counter].to_s\n counter += 1\n end\n return_hash\nend",
"def number_of_people\n\t\tusers.length\n\tend",
"def followers\n QuestionFollower.followers_for_question_id(@id)\n end",
"def followers\n Follow.where(\"following_id = ?\", self.id)\n end",
"def getTotalFollowers\r\n @responseObject = OpenStruct.new({\r\n status: true,\r\n errors: [],\r\n code: API_CODE_ERRORS['Services']['Global']['success'],\r\n objectData: OpenStruct.new({ total: UsersFollows.followers(session[:user].id).uniq.size }),\r\n timestamp: (Date.new).to_time.to_i.abs\r\n })\r\n \trender :template => 'api/v1/users/members/total' ,:handlers => [:rabl], :formats => [:json]\r\n\tend",
"def followers\n @client.followers.ids?\n end",
"def followee_ids(user)\n expect! user => [Integer, String]\n \n benchmark :warn, \"Fetching followee_ids\" do |bm|\n r = client.friend_ids(user).all\n bm.message = \"Fetching #{r.length} followee_ids\"\n r\n end\n rescue StandardError\n $!.log \"TwitterAPI.followee_ids\"\n []\n end",
"def followers\n user_ids = $redis.smembers(self.redis_key(:followers))\n User.where(:id => user_ids)\n end",
"def followers\n @title = \"Followers\"\n @user = User.find(params[:id])\n @usersList = @user.followers.paginate(page: params[:page])\n render 'show_follow'\n end",
"def test_get_users_who_follow_user\r\n get \"/users/1/follows.json?type=followers&api_key=testapikey\"\r\n assert_response :success\r\n follows = JSON.parse(response.body)\r\n assert follows.size == 3, 'Incorrect number of followees'\r\n assert follows[0]['id'] == 7\r\n assert follows[0]['follower_id'] == 9\r\n assert follows[1]['id'] == 8\r\n assert follows[1]['follower_id'] == 10\r\n assert follows[2]['id'] == 9\r\n assert follows[2]['follower_id'] == 11\r\n end"
] |
[
"0.8433614",
"0.8087633",
"0.7930892",
"0.77348393",
"0.7483281",
"0.74686164",
"0.74124014",
"0.7402562",
"0.7387989",
"0.7377384",
"0.73005885",
"0.72520506",
"0.71130013",
"0.70904374",
"0.7036449",
"0.6996078",
"0.69950974",
"0.6938961",
"0.6932235",
"0.69162554",
"0.68959975",
"0.68929034",
"0.6873424",
"0.6869947",
"0.68542916",
"0.6831252",
"0.6795466",
"0.6792396",
"0.6774461",
"0.6730904",
"0.66955876",
"0.66675603",
"0.6648317",
"0.6646312",
"0.66345215",
"0.6628894",
"0.66220844",
"0.66060907",
"0.6599657",
"0.65877426",
"0.65846056",
"0.657122",
"0.65705884",
"0.6537681",
"0.6530929",
"0.6524063",
"0.65208787",
"0.65159446",
"0.6514401",
"0.6507061",
"0.6504493",
"0.6496731",
"0.6487186",
"0.6480855",
"0.6477784",
"0.64750165",
"0.64617234",
"0.64449245",
"0.6434947",
"0.63950485",
"0.6389602",
"0.6385971",
"0.63852733",
"0.63824064",
"0.63772726",
"0.63765323",
"0.63678306",
"0.6358972",
"0.63501227",
"0.63489753",
"0.6346622",
"0.6344247",
"0.6340618",
"0.63382983",
"0.6338145",
"0.6335539",
"0.6317932",
"0.6303869",
"0.629624",
"0.6278055",
"0.6267161",
"0.6260177",
"0.6252401",
"0.62495404",
"0.6244406",
"0.6243391",
"0.6236903",
"0.6234323",
"0.62300986",
"0.6228406",
"0.6214194",
"0.6211347",
"0.6208266",
"0.62067175",
"0.61863476",
"0.61795366",
"0.6177332",
"0.61759037",
"0.61733395",
"0.6170572"
] |
0.6583598
|
41
|
TODO: implement the same functionality without method_missing
|
def method_missing(*attributes)
if (attributes[0][/_safe$/])
html_safe_string = send(attributes[0].to_s.gsub(/_safe$/,"").intern).html_safe
CGI::unescapeElement( CGI::escapeHTML(html_safe_string), "BR" )
else
super
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def private; end",
"def method_missing(code, *args, &blk); end",
"def method_missing(code, *args, &blk); end",
"def method_missing(method, *args, &blk); end",
"def method_missing(method, *args, &block); end",
"def method_missing(method_name, *args); end",
"def method_missing(method_name, *args); end",
"def method_missing(*args, &block); end",
"def method_missing(meth, *args); end",
"def method_missing(*rest) end",
"def method_missing(method, *arguments, &block); end",
"def method_missing(method_name, *args) self end",
"def method_missing(method_name, *args) self end",
"def method_missing(*)\n return nil\n end",
"def method_missing(meth, *args, &block); end",
"def method_missing(meth, *args, &block); end",
"def method_missing(meth, *args, &block); end",
"def method_missing(name, *args); end",
"def method_missing(name, *args); end",
"def method_missing(mth, *args, &block); end",
"def method_missing(name, *args, &block); end",
"def method_missing(name, *args, &block); end",
"def method_missing(name, *args, &block); end",
"def method_missing(name, *args, &block); end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def method_missing(meth, *args, &block)\n\n end",
"def method_missing(method)\n\t\t self[method]\n\t\tend",
"def reflection; end",
"def reflection; end",
"def method_missing(id, *attr, &block); end",
"def reflector; end",
"def reflector; end",
"def method_missing(*)\n invertable nil\n end",
"def implementation; end",
"def implementation; end",
"def probers; end",
"def custom; end",
"def custom; end",
"def get(object); end",
"def method_missing(method, *args)\r\n self.class.method_missing(method, *args)\r\n end",
"def instance_method(p0) end",
"def method_missing(*)\n nil\n end",
"def method_undefined(*) end",
"def method_missing(selector, *args, &block); end",
"def method_missing(method, *args)\n self[method]\n end",
"def overrides; end",
"def method_missing(m, *args, &block)\n end",
"def overload; end",
"def method_missing(sym, *args)\n # don't screen other things that operate via method_missing\n return super if [:to_ary, :to_json, :to_yaml, :to_xml].include? sym\n key = sym.to_s\n return self[key] if self.has_key? key\n raise NoSuchKey.new(\"#{self.class} has no key #{sym}: #{self.inspect}\")\n end",
"def delegating_method; end",
"def method_missing(method, *args)\n args[0]\n end",
"def delegate_object_reader_method; end",
"def invoke\r\n # TODO: rename to more appropriate one 2007/05/10 by shino\r\n raise 'must be implemented in subclasses'\r\n end",
"def schubert; end",
"def method_missing( sym, *args, &block )\n\t\treturn self.prop[ sym.to_s ] || super\n\tend",
"def method_missing(method_name, *args, &block)\n if attrs.keys.include? method_name.to_s\n attrs[method_name.to_s]\n else\n super(method_name)\n end\nend",
"def extended(*) end",
"def methods() end",
"def implemented_in; end",
"def magic\n self.class.magic(self)\n end",
"def method_missing(*a)\n end",
"def method_missing(meth, *args, &block)\n Interrogate.is_interrogatory?(meth) ? Interrogate.interrogate(meth, *args, &block) : super\n end",
"def method_missing(method, *args) #:nodoc:\n self[method]\n end",
"def missing; end",
"def macro; raise NotImplementedError; end",
"def macro; raise NotImplementedError; end",
"def macro; raise NotImplementedError; end",
"def __getobj__\n end",
"def method_missing(name)\n return nil\n end",
"def wrapper; end",
"def method_missing(m, *a, &b)\n\ta.empty? ? m : super\nend",
"def __getobj__; end",
"def lookup(obj, pos); end",
"def method_731(base); end",
"def method_missing(m,*a)\n self[m]\n end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def identify; end",
"def method_missing(meth, options = T.unsafe(nil)); end",
"def method_missing(method_name, *method_args)\n get(method_name) || super.method_missing(method_name, *method_args)\n end",
"def method_missing(:name, *args)\nend",
"def method_of_instance; end",
"def method_of_instance; end",
"def method_of_instance; end",
"def method_of_instance; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end",
"def object; end"
] |
[
"0.6878782",
"0.66829175",
"0.66829175",
"0.65917856",
"0.64612764",
"0.64221305",
"0.64221305",
"0.6388353",
"0.636361",
"0.6336306",
"0.62625515",
"0.62147874",
"0.62147874",
"0.6214437",
"0.61579806",
"0.61579806",
"0.61579806",
"0.6133621",
"0.6133621",
"0.6129515",
"0.6127799",
"0.6127799",
"0.6127799",
"0.6127799",
"0.61239374",
"0.61239374",
"0.61239374",
"0.61239374",
"0.6050001",
"0.60215247",
"0.60078704",
"0.60078704",
"0.6006788",
"0.597363",
"0.597363",
"0.5889593",
"0.5879323",
"0.5879323",
"0.58518285",
"0.58385706",
"0.58385706",
"0.58375216",
"0.5801557",
"0.57748735",
"0.5758212",
"0.57197964",
"0.5719166",
"0.5717699",
"0.5703988",
"0.5698039",
"0.5690654",
"0.56776863",
"0.5675236",
"0.56619406",
"0.5655941",
"0.56551385",
"0.56372035",
"0.563688",
"0.5625653",
"0.5623307",
"0.56165",
"0.56076556",
"0.55751055",
"0.5573357",
"0.5568802",
"0.5560885",
"0.55570406",
"0.55554354",
"0.55554354",
"0.55554354",
"0.5539012",
"0.55295944",
"0.55257744",
"0.5519063",
"0.5515787",
"0.55141306",
"0.5506301",
"0.5504749",
"0.54972625",
"0.54972625",
"0.54972625",
"0.54972625",
"0.54865015",
"0.5477428",
"0.5474774",
"0.5453502",
"0.5452237",
"0.5452237",
"0.5452237",
"0.5452237",
"0.5450763",
"0.5450763",
"0.5450763",
"0.5450763",
"0.5450763",
"0.5450763",
"0.5450763",
"0.5450763",
"0.5450763",
"0.5450763",
"0.5450763"
] |
0.0
|
-1
|
Checks if other period is inside this period. This means that both starts_at and ends_at of other period have to be included in this period.
|
def include?(other_period)
inside?(other_period.starts_at) && inside?(other_period.ends_at)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def cover?(other_period)\n inside?(other_period.starts_at) || inside?(other_period.ends_at)\n end",
"def overlaps?(other)\n start <= other.end_date && other.start <= self.end_date\n end",
"def overlaps?(other)\n\t\tself.start_date < other.end_date && other.start_date < self.end_date\n\tend",
"def overlaps?(another)\n (start_date - another.end_date) * (another.start_date - end_date) >= 0\n end",
"def overlaps?(other)\n \t((start_date - other.end_date) * (other.start_date - end_date)) >= 0\n \tend",
"def overlaps(other_date_range)\n if contains(other_date_range.start_date) || contains(other_date_range.end_date)\n true\n elsif other_date_range.contains(@start_date) && other_date_range.contains(@end_date)\n true\n else\n false\n end\n end",
"def overlaps?(other)\n # overlap == start < finish' AND start' < finish\n self.first <= other.actual_last and other.first <= self.actual_last\n end",
"def meeting_conflict?(other)\n return false if self.start_time.nil? or other.start_time.nil?\n section_days = other.days.split(\"\")\n section_days.each do |day|\n if( self.days.include?(day) )\n if (self.start_time.to_i >= other.start_time.to_i and self.start_time.to_i <= other.end_time.to_i) or \n (other.start_time.to_i >= self.start_time.to_i and other.start_time.to_i <= self.end_time.to_i)\n return true\n end \n end\n end\n return false\n end",
"def overlaps\n siblings.overlaps date, date_ended\n end",
"def valid_start_and_end_dates?\n return false unless start.present? && self.end.present?\n start <= self.end\n end",
"def between?(first_day, last_day)\n ((self.ends_at.to_date >= first_day) && (self.ends_at.to_date <= last_day)) || ((self.starts_at.to_date >= first_day) && (self.starts_at.to_date <= last_day))\n end",
"def overlaps?\n self.class.all.any? do |other|\n (start_hour > other.start_hour && start_hour < other.end_hour) ||\n (end_hour > other.start_hour && end_hour < other.end_hour)\n end\n end",
"def overlap(dates)\n (out_date <= dates.in_date || in_date >= dates.out_date)\n end",
"def within_time_period?\n return true unless start_time || end_time\n\n if start_time && end_time\n (start_time..end_time).cover? Time.current\n elsif start_time\n Time.current >= start_time\n elsif end_time\n Time.current <= end_time\n end\n end",
"def overlaps?(other)\n a, b = [self, other].map(&:range)\n #\n # Although a Shift which passes through midnight is stored\n # internally as lasting more than TimeOfDay::NUM_SECONDS_IN_DAY\n # seconds from midnight, that's not how it is meant to be\n # handled. Rather, it consists of two chunks:\n #\n # range.first => Midnight\n # Midnight => range.last\n #\n # The second one is *before* the first. None of it is more than\n # TimeOfDay::NUM_SECONDS_IN_DAY after midnight. We thus need to shift\n # each of our ranges to cover all overlapping possibilities.\n #\n one_day = TimeOfDay::NUM_SECONDS_IN_DAY\n ashifted =\n Range.new(a.first + one_day, a.last + one_day, a.exclude_end?)\n bshifted =\n Range.new(b.first + one_day, b.last + one_day, b.exclude_end?)\n #\n # For exclusive ranges we need:\n #\n # a.ending > b.beginning && b.ending > a.beginning\n #\n # and for inclusive we need:\n #\n # a.ending >= b.beginning && b.ending >= a.beginning\n #\n aop = a.exclude_end? ? :> : :>=\n bop = b.exclude_end? ? :> : :>=\n #\n (a.last.send(aop, b.first) && b.last.send(bop, a.first)) ||\n (ashifted.last.send(aop, b.first) && b.last.send(bop, ashifted.first)) ||\n (a.last.send(aop, bshifted.first) && bshifted.last.send(bop, a.first))\n end",
"def overlaps_with?(other_meeting) \n if day == other_meeting.day\n if (other_meeting.start_time < end_time) && (other_meeting.end_time > start_time)\n return true\n end\n end\n return false\n end",
"def during?(other)\n if other.is_a? Numeric\n other_begin = other_end = other\n else\n other_begin, other_end = other.begin, other.end\n end\n\n self_begin, self_end = self.begin, self.end\n\n # Check if either of the two items begins during the\n # span of the other\n other_begin <= self_begin && self_begin <= other_end ||\n self_begin <= other_begin && other_begin <= self_end\n end",
"def overlaps_with?(other_obj) \n self.meetings.each do |self_meeting|\n other_obj.meetings.each do |other_meeting|\n return true if self_meeting.overlaps_with? other_meeting\n end\n end\n return false\n end",
"def overlaps_with?(other_obj) \n self.meetings.each do |self_meeting|\n other_obj.meetings.each do |other_meeting|\n return true if self_meeting.overlaps_with? other_meeting\n end\n end\n return false\n end",
"def overlap?(new_start_date, new_end_date)\n return(start_date <= new_end_date && end_date >= new_start_date) \n end",
"def date_range_overlap?(start_date_one, end_date_one, start_date_two, end_date_two)\n if start_date_one < end_date_two && start_date_two < end_date_one\n return true\n else\n return false\n end\n end",
"def include?(tod)\n if ending >= beginning\n tod >= beginning && tod <= ending\n else\n start_of_day = TimeOfDay.new(0,0,0)\n end_of_day = TimeOfDay.new(23,59,59)\n (tod >= beginning && tod <= end_of_day) || (tod >= start_of_day && tod <= ending)\n end\n end",
"def correct?\n starts_at < ends_at && starts_at.to_date == ends_at.to_date\n end",
"def intersection_with(other)\n r1,r2 = matched_range_types(self, other)\n max_begin = [r1.begin,r2.begin].max\n min_end = [r1.end, r2.end ].min\n excl = ( r1.end == min_end && \n r1.respond_to?(:exclude_end?) && r1.exclude_end?\n ) ||\n ( r2.end == min_end && \n r2.respond_to?(:exclude_end?) && r2.exclude_end?\n )\n unless max_begin > min_end\n Range.new(max_begin, min_end, excl).extend(DateTimeRange)\n end\n end",
"def contains?(date_or_time)\n starts_on <= date_or_time && date_or_time < ends_on\n end",
"def overlaps(first, second)\n return first.start.between?(second.start, second.end) ||\n first.end.between?(second.start, second.end) ||\n second.start.between?(first.start, first.end) ||\n second.end.between?(first.start, first.end)\nend",
"def overlap?(input_range)\n a = self.start_date >= input_range.end_date\n b = self.end_date <= input_range.start_date\n return a || b ? false : true \n end",
"def within?(other_slice)\r\n if ! other_slice.class == Slice\r\n raise RuntimeError, \"The Slice#overlaps? method takes a Slice object as its arguments.\"\r\n end\r\n if self.seq_region.coord_system != other_slice.seq_region.coord_system\r\n raise RuntimeError, \"The argument slice of Slice#overlaps? has to be in the same coordinate system, but were \" + self.seq_region.coord_system.name + \" and \" + other_slice.seq_region.coord_system.name\r\n end\r\n\r\n self_range = self.start .. self.stop\r\n other_range = other_slice.start .. other_slice.stop\r\n\r\n if other_range.include?(self.start) and other_range.include?(self.stop)\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"def overlapping\n return unless start_date && end_date && room && program.try(:tracks)\n\n (program.tracks.accepted + program.tracks.confirmed - [self]).each do |existing_track|\n next unless existing_track.room == room && existing_track.start_date && existing_track.end_date\n\n if start_date >= existing_track.start_date && start_date <= existing_track.end_date ||\n end_date >= existing_track.start_date && end_date <= existing_track.end_date ||\n start_date <= existing_track.start_date && end_date >= existing_track.end_date\n errors.add(:track, 'has overlapping dates with a confirmed or accepted track in the same room')\n break\n end\n end\n end",
"def within?(other_slice)\n if ! other_slice.class == Slice\n raise RuntimeError, \"The Slice#overlaps? method takes a Slice object as its arguments.\"\n end\n if self.seq_region.coord_system != other_slice.seq_region.coord_system\n raise RuntimeError, \"The argument slice of Slice#overlaps? has to be in the same coordinate system, but were \" + self.seq_region.coord_system.name + \" and \" + other_slice.seq_region.coord_system.name\n end\n\n self_range = self.start .. self.stop\n other_range = other_slice.start .. other_slice.stop\n\n if other_range.include?(self.start) and other_range.include?(self.stop)\n return true\n else\n return false\n end\n end",
"def validate_for_another_reservation\n if start_at && end_at && BUSY_STATUSES.include?(self.status)\n errors.add(:start_at, 'Another reservation already exists for these dates.') if exists_other_reservations_in_same_period?\n end\n end",
"def cover?(other)\n return false unless other.is_a?(Date)\n\n other = other.day_precision\n\n case\n when unknown_start?\n max.day_precision! == other\n when unknown_end?\n min.day_precision! == other\n when open_end?\n min.day_precision! <= other\n else\n min.day_precision! <= other && other <= max.day_precision!\n end\n end",
"def ==(other)\n other.class == self.class &&\n other.start_date == @start_date &&\n other.end_date == @end_date\n end",
"def ongoing?\n Time.now > start_at && Time.now < end_at\n end",
"def within?(other)\n range_within_other?(self,other)\n end",
"def between_dates(sd, es)\n return true if sd <= self.start_date && es >= self.end_date \n return false\n end",
"def overlaps?(other); end",
"def overlaps?(other); end",
"def overlaps?(other); end",
"def period_ended_after_start\n invalid = false\n if period_started_at.present? and period_ended_at.present? and not period_ended_at > period_started_at\n errors.add( :period_ended_at, :end_before_start )\n invalid = true\n end\n invalid\n end",
"def check_overlap\n appointments = Appointment.all\n current_start = DateTime.strptime(self.start_time,\"%m/%d/%y %H:%M\").to_time\n current_end = DateTime.strptime(self.end_time,\"%m/%d/%y %H:%M\").to_time\n\n appointments.each do |appt|\n appt_start = DateTime.strptime(appt.start_time,\"%m/%d/%y %H:%M\").to_time\n appt_end = DateTime.strptime(appt.end_time,\"%m/%d/%y %H:%M\").to_time\n\n ## if the appointment being checked is a new appointment ##\n if @new_appt\n if current_start >= appt_start && current_start <= appt_end\n @valid = false\n elsif current_end >= appt_start && current_end <= appt_end\n @valid = false\n end\n\n ## if the appointment being checked is an old appointment being updated ##\n else\n if current_start > appt_start && current_start < appt_end\n @valid = false\n elsif current_end > appt_start && current_end < appt_end\n @valid = false\n end\n end\n\n end\n @valid\n p @valid\n end",
"def check_overlapping_dates\n # compare this new reservation againsts existing reservations\n if start_date.present? and end_date.present?\n listing.reservations.each do |old_reservation|\n if overlap?(self, old_reservation)\n return errors.add(:The_dates_are_not_available, \"\")\n end\n end\n end\n end",
"def in_time_window?\n self.starts_at <= Time.now && self.ends_at >= Time.now\n end",
"def overlaps_with(other_billing_record, min_proximity = 0)\n return true if start_time == other_billing_record.start_time\n first, second = nil, nil # Which record started first?\n if start_time < other_billing_record.start_time\n first, second = self, other_billing_record\n else\n first, second = other_billing_record, self\n end\n second.start_time - first.stop_time <= min_proximity\n end",
"def overlaps?(other_slice)\r\n if ! other_slice.class == Slice\r\n raise RuntimeError, \"The Slice#overlaps? method takes a Slice object as its arguments.\"\r\n end\r\n if self.seq_region.coord_system != other_slice.seq_region.coord_system\r\n raise RuntimeError, \"The argument slice of Slice#overlaps? has to be in the same coordinate system, but were \" + self.seq_region.coord_system.name + \" and \" + other_slice.seq_region.coord_system.name\r\n end\r\n\r\n self_range = self.start .. self.stop\r\n other_range = other_slice.start .. other_slice.stop\r\n\r\n if self_range.include?(other_slice.start) or other_range.include?(self.start)\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"def overlaps?(other)\n (self.check_in - other.check_out) * (other.check_in - self.check_out) >= 0\n end",
"def overlaps?(other_slice)\n if ! other_slice.class == Slice\n raise RuntimeError, \"The Slice#overlaps? method takes a Slice object as its arguments.\"\n end\n if self.seq_region.coord_system != other_slice.seq_region.coord_system\n raise RuntimeError, \"The argument slice of Slice#overlaps? has to be in the same coordinate system, but were \" + self.seq_region.coord_system.name + \" and \" + other_slice.seq_region.coord_system.name\n end\n\n self_range = self.start .. self.stop\n other_range = other_slice.start .. other_slice.stop\n\n if self_range.include?(other_slice.start) or other_range.include?(self.start)\n return true\n else\n return false\n end\n end",
"def intersect(other_interval)\n if self.end <= other_interval.start || other_interval.end <= start\n nil\n else\n Interval.new([start, other_interval.start].max, [self.end, other_interval.end].min)\n end\n end",
"def availability?(start_date, end_date)\n start_date = Date.parse(start_date)\n end_date = Date.parse(end_date)\n bookings = self.get_bookings(id: self.id)\n if bookings.length > 0\n bookings.each do |booking|\n if (start_date > booking.start_date && start_date < booking.end_date) || (end_date > booking.start_date && end_date < booking.end_date)\n false\n end\n end\n true\n end\n end",
"def include?(new_date)\n return start_date <= new_date && end_date > new_date\n end",
"def ==(other)\n (other.is_a? Interval) && (@start == other.start && @end == other.end)\n end",
"def ensure_starts_at_is_before_ends_at\n if starts_at && ends_at && starts_at >= ends_at\n errors.add(:ends_at, :is_before_starts_at)\n end\n end",
"def vet_overlap\n this_start = self.start_time\n this_end = self.end_time\n return if this_end < this_start\n overlap = veterinarian.appointments.any? do |appointment|\n other_start = appointment.start_time\n other_end = appointment.end_time\n other_start < this_end && this_end < other_end || other_start < this_start && this_start < other_end\n end\n if overlap\n errors.add(:veterinarian, 'has a conflicting appointment')\n end\n end",
"def overlapping\n return unless calendar && sibling_overlappings?\n errors.add(:base, :overlapping)\n end",
"def available?(span_start, span_end)\n if span_start.class != Date \n start_date = Date.parse(span_start) \n else \n start_date = span_start\n end\n if span_end.class != Date\n end_date = Date.parse(span_end)\n else\n end_date = span_end\n end\n if self.reservations.any?{ |reservation| reservation.checkout > start_date && reservation.checkout < end_date || reservation.checkin > start_date && reservation.checkout < end_date || reservation.checkin > start_date && reservation.checkin < end_date } === false\n return true\n else \n false\n end\n end",
"def active?\n starts_at < Time.now && Time.now < ends_at\n end",
"def overlaps?(other)\n cover?(other.begin) || other.cover?(first)\n end",
"def overlaps?(start_time, end_time)\n unless @talks.reduce(true) {|outcome, talk| outcome && !talk.overlaps?(start_time, end_time) }\n handle_validation_fail \"Overlaps with existing talks in the #{self.name} event!\"\n return true\n end\n return false\n end",
"def overlap?(interval_start, interval_end, ride)\n raise \"Invalid interval\" if interval_start>=interval_end\n if (ride.start_time > interval_end) || (ride.end_time<interval_start)\n return false \n else \n return true\n end \n\n end",
"def overlaps?(other)\n !disjoint?(other)\n end",
"def overlaps?(other)\n !disjoint?(other)\n end",
"def check_overlap\n bookings = @parking_space.booking.all\n booking = booking_params.values\n for currentBooking in bookings\n if booking.at(3).to_i < currentBooking.finish_time.to_i && currentBooking.start_time.to_i < booking.at(4).to_i\n return true\n end \n end\n return false\n end",
"def date_within(d)\n\t\treturn (start_date <= d) && (d <= stop_date)\n\tend",
"def relevant_time?\n\t\tself.start < Time.now && self.end >Time.now \n\tend",
"def dates_within_conference_dates\n return unless start_date && end_date && program.try(:conference).try(:start_date) && program.try(:conference).try(:end_date)\n\n errors.add(:start_date, \"can't be outside of the conference's dates (#{program.conference.start_date}-#{program.conference.end_date})\") unless (program.conference.start_date..program.conference.end_date).cover?(start_date)\n errors.add(:end_date, \"can't be outside of the conference's dates (#{program.conference.start_date}-#{program.conference.end_date})\") unless (program.conference.start_date..program.conference.end_date).cover?(end_date)\n end",
"def ends_before_it_begins?\n end_on? && end_on <= start_on\n end",
"def check_overlapping_dates\n #compare this new reservation against existing reservations\n listing.reservations.each do |old_booking|\n if overlap?(self, old_booking)\n return errors.add(:overlapping_dates, \"The booking dates are not available\")\n end\n end\n\n end",
"def specific?\n starts_at.is_a?(Time) && ends_at.is_a?(Time)\n end",
"def intersects?(*args)\n other = coerce_range(*args)\n raise ArgumentError, \"#{self.begin.class} expected, received #{other.begin.class}\" unless other.begin.kind_of?(self.begin.class)\n\n if other.instant?\n self.begin <= other.begin and other.end < self.end\n else\n other.begin < self.end and self.begin < other.end\n end\n end",
"def covers?(*args)\n other = coerce_range(*args)\n\n if other.instant?\n self.begin <= other.begin and other.end < self.end\n else\n self.begin <= other.begin and other.end <= self.end\n end\n end",
"def conflicts_with_date?(date)\n date.between(self.start_date, self.end_date)\n end",
"def include?(object)\n object.start >= @start && object.end <= @end\n end",
"def check_overlapping_dates\n # compare this new booking againsts existing bookings\n listing.bookings.each do |old_booking|\n if overlap?(self, old_booking)\n return errors.add(:overlapping_dates, \"The booking dates conflict with existing bookings\") \n end\n end\n\n end",
"def is_date_range?\n start_time.present? && end_time.present?\n end",
"def pet_overlap\n this_start = self.start_time\n this_end = self.end_time\n overlap = veterinarian.appointments.any? do |appointment|\n other_start = appointment.start_time\n other_end = appointment.end_time\n other_start < this_end && this_end < other_end || other_start < this_start && this_start < other_end\n end\n if overlap\n errors.add(:pet, 'has a conflicting appointment')\n end\n end",
"def contains?(date_or_time)\n \t# TODO We need to make sure time zones are properly handled, probably!\n\n \tstarts_on <= date_or_time && date_or_time < ends_on\n end",
"def overlaps?(start_minute, end_minute)\n raise \"start must be less than end\" if start_minute >= end_minute\n\n ((start_minute >= @day_start_minute && start_minute < @day_end_minute) ||\n (end_minute <= @day_end_minute && end_minute > @day_start_minute))\n end",
"def before?(other)\n time = other.is_a?(Numeric) ? other : other.begin\n self.end <= time\n end",
"def active?\n (start_date <= DateTime.now) and (DateTime.now <= end_date)\n end",
"def same?(other)\n (from_end == other.from_end and\n to_end == other.to_end and\n overlap == other.overlap)\n end",
"def same?(other)\n (from_end == other.from_end and\n to_end == other.to_end and\n overlap == other.overlap)\n end",
"def overlap?(self_range, other_range)\n return true if self_range == other_range \n overlap_helper(self_range, other_range) || overlap_helper(other_range, self_range)\n end",
"def contains?(other)\n (other.begin_pos <=> @begin_pos) + (@end_pos <=> other.end_pos) >= (other.empty? ? 2 : 1)\n end",
"def check_overlapping_dates\n\t # compare this new booking againsts existing bookings\n\t listing.reservations.each do |old_reservation|\n\t if overlap?(self, old_reservation)\n\t return errors.add(:overlapping_dates, \"The booking dates conflict with existing bookings\") \n\t end\n\t end\n\tend",
"def start_and_end_set?\n [start, self.end].map(&:present?).uniq.length == 1\n end",
"def include?(shift_start_time, shift_end_time)\n shift_start_time < shift_end_time &&\n include_start_time?(shift_start_time) &&\n include_end_time?(shift_end_time)\n end",
"def relevant_time?\n\t\tself.start <= DateTime.now && self.end >= DateTime.now\n\t\t# (self.start.hour <= DateTime.now.hour) (self.start.minute <= DateTime.now.minute) && (self.end.hour >\tDateTime.now.hour) \n\tend",
"def crossing?(other)\n return false unless overlaps?(other)\n (@begin_pos <=> other.begin_pos) * (@end_pos <=> other.end_pos) == 1\n end",
"def between(start_dt, end_date)\n wrap(\n @inner.select do |event|\n stamp = Time.parse(event['created_at'])\n stamp >= start_dt && stamp <= end_date\n end,\n )\n end",
"def active?(date=Time.now)\n date < self.end_date && date > self.start_date\n end",
"def test_range_overlap_for_intersecting_ranges\n segment = basic_segment\n segment.instance_variable_set(:@start_time, 1.0)\n segment.instance_variable_set(:@end_time, 3.0)\n\n assert_in_delta(1.0, segment.send(:range_overlap, 2.0..4.0))\n end",
"def include?(tod)\n second = tod.to_i\n second += TimeOfDay::NUM_SECONDS_IN_DAY if second < @range.first\n @range.cover?(second)\n end",
"def date_overlap?(date_range)\n #(@checkin_date - end_date) * (start_date - @checkout_date) >= 0\n # Will this method work?\n start_date = date_range.checkin_date\n end_date = date_range.checkout_date\n\n if (start_date <= @checkout_date) && (end_date > @checkin_date)\n return true\n else\n return false\n # raise ArgumentError.new(\"#{start_date} and #{end_date} are outside the date range\")\n end\n end",
"def date_is_occupied \n events = Event.where(\"worker_id = ?\", self.worker_id).where(\"(start_at BETWEEN '#{self.start_at}' AND '#{self.end_at}' ) OR (end_at BETWEEN '#{self.start_at}' AND '#{self.end_at}')\")\n if !events.empty?\n errors.add(:start_at, \"Ten termin jest już zajęty.\")\n end\n end",
"def can_procreate_during?(period)\n fertility_range.overlaps? period if (period and fertility_range)\n end",
"def available?(start_date, end_date)\n unless self.reservations.any? { |res| start_date.to_date.between?(res.checkin, res.checkout) || end_date.to_date.between?(res.checkin, res.checkout)} \n true\n end\n end",
"def check_overlaps_cargo_department\n\t\t# if some day of availabilityes overlaps whith new period availability.\t\n\t\tav=Availability.where(:department_id => department_id).where('upper(cargo) like ?',\"#{cargo.upcase}\")\n\t\t\t.where(\"((desde - ?) * (? - hasta)) >= 0\", hasta, desde).where(:status => true)\n\n\t\tif av.count>0 # availabilit\n\t\t\t\t\terrors.add(:cargo,\" Ya existe un periodo de disponibilidad mínima para el cargo: '#{cargo}' cuyas fechas coinciden.\")\t\n\t\tend\n\tend",
"def <=>(other)\n self_start = self.start_date\n other_start = other.start_date\n self_end = self.end_date \n other_end = other.end_date\n return self_start <=> other_start if self_start && other_start\n return self_end <=> other_end if self_end && other_end\n return self_start <=> other_end if self_start && other_end\n return self_end <=> other_start if self_end && other_start\n return 0\n end",
"def operational?\n if start_date.blank?\n true\n else\n if end_date.blank? or end_date < start_date\n false\n else\n today = Date.today\n (start_date <= today and end_date >= today)\n end\n end\n end",
"def intersect(other)\n begin_at = self.begin >= other.begin ? self.begin : other.begin\n end_at = self.end <= other.end ? self.end : other.end\n\n begin_at <= end_at ? self.class.new(begin_at..end_at) : nil\n end"
] |
[
"0.84127146",
"0.79092336",
"0.775272",
"0.7748917",
"0.7659067",
"0.7430443",
"0.70193183",
"0.69477475",
"0.6879989",
"0.68794787",
"0.68765366",
"0.68664837",
"0.68364984",
"0.6810467",
"0.68038625",
"0.6779065",
"0.6754526",
"0.6729548",
"0.6729548",
"0.6723803",
"0.6706077",
"0.6651157",
"0.6637688",
"0.65986776",
"0.65557814",
"0.65389466",
"0.6535871",
"0.65307045",
"0.649986",
"0.6499318",
"0.6471871",
"0.64594775",
"0.6439546",
"0.64249617",
"0.64245754",
"0.64097923",
"0.63704854",
"0.63704854",
"0.63704854",
"0.63677955",
"0.63659465",
"0.63547605",
"0.63501996",
"0.6343655",
"0.63018167",
"0.6268152",
"0.62628734",
"0.6248185",
"0.6230176",
"0.6222919",
"0.6215882",
"0.620543",
"0.6195439",
"0.61925757",
"0.6187475",
"0.6176157",
"0.61737216",
"0.6168537",
"0.6156124",
"0.6145724",
"0.6145724",
"0.6137531",
"0.6135508",
"0.61304796",
"0.61267257",
"0.6124625",
"0.6097197",
"0.6090634",
"0.6087641",
"0.6087279",
"0.60761976",
"0.6067456",
"0.60582495",
"0.6057824",
"0.60561883",
"0.6053189",
"0.604226",
"0.6038012",
"0.6037399",
"0.6025593",
"0.6025593",
"0.6022482",
"0.600784",
"0.6005983",
"0.5980701",
"0.5964574",
"0.5959365",
"0.5941263",
"0.59061056",
"0.5900182",
"0.5894809",
"0.5890265",
"0.5885119",
"0.586623",
"0.58637154",
"0.5855212",
"0.5849918",
"0.58449936",
"0.58318394",
"0.58217305"
] |
0.8659968
|
0
|
Checks if other period overlaps with this period. Returns true when either other_period.starts_at or other_period.ends_at is included this period.
|
def cover?(other_period)
inside?(other_period.starts_at) || inside?(other_period.ends_at)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def overlaps(other_date_range)\n if contains(other_date_range.start_date) || contains(other_date_range.end_date)\n true\n elsif other_date_range.contains(@start_date) && other_date_range.contains(@end_date)\n true\n else\n false\n end\n end",
"def overlaps?(other)\n\t\tself.start_date < other.end_date && other.start_date < self.end_date\n\tend",
"def overlaps?(other)\n start <= other.end_date && other.start <= self.end_date\n end",
"def include?(other_period)\n inside?(other_period.starts_at) && inside?(other_period.ends_at)\n end",
"def overlaps?(other)\n \t((start_date - other.end_date) * (other.start_date - end_date)) >= 0\n \tend",
"def overlaps?(another)\n (start_date - another.end_date) * (another.start_date - end_date) >= 0\n end",
"def overlaps?(other)\n # overlap == start < finish' AND start' < finish\n self.first <= other.actual_last and other.first <= self.actual_last\n end",
"def overlaps?(other)\n a, b = [self, other].map(&:range)\n #\n # Although a Shift which passes through midnight is stored\n # internally as lasting more than TimeOfDay::NUM_SECONDS_IN_DAY\n # seconds from midnight, that's not how it is meant to be\n # handled. Rather, it consists of two chunks:\n #\n # range.first => Midnight\n # Midnight => range.last\n #\n # The second one is *before* the first. None of it is more than\n # TimeOfDay::NUM_SECONDS_IN_DAY after midnight. We thus need to shift\n # each of our ranges to cover all overlapping possibilities.\n #\n one_day = TimeOfDay::NUM_SECONDS_IN_DAY\n ashifted =\n Range.new(a.first + one_day, a.last + one_day, a.exclude_end?)\n bshifted =\n Range.new(b.first + one_day, b.last + one_day, b.exclude_end?)\n #\n # For exclusive ranges we need:\n #\n # a.ending > b.beginning && b.ending > a.beginning\n #\n # and for inclusive we need:\n #\n # a.ending >= b.beginning && b.ending >= a.beginning\n #\n aop = a.exclude_end? ? :> : :>=\n bop = b.exclude_end? ? :> : :>=\n #\n (a.last.send(aop, b.first) && b.last.send(bop, a.first)) ||\n (ashifted.last.send(aop, b.first) && b.last.send(bop, ashifted.first)) ||\n (a.last.send(aop, bshifted.first) && bshifted.last.send(bop, a.first))\n end",
"def overlaps_with?(other_meeting) \n if day == other_meeting.day\n if (other_meeting.start_time < end_time) && (other_meeting.end_time > start_time)\n return true\n end\n end\n return false\n end",
"def overlap?(self_range, other_range)\n return true if self_range == other_range \n overlap_helper(self_range, other_range) || overlap_helper(other_range, self_range)\n end",
"def overlaps?(other)\n !disjoint?(other)\n end",
"def overlaps?(other)\n !disjoint?(other)\n end",
"def overlaps?\n self.class.all.any? do |other|\n (start_hour > other.start_hour && start_hour < other.end_hour) ||\n (end_hour > other.start_hour && end_hour < other.end_hour)\n end\n end",
"def date_range_overlap?(start_date_one, end_date_one, start_date_two, end_date_two)\n if start_date_one < end_date_two && start_date_two < end_date_one\n return true\n else\n return false\n end\n end",
"def meeting_conflict?(other)\n return false if self.start_time.nil? or other.start_time.nil?\n section_days = other.days.split(\"\")\n section_days.each do |day|\n if( self.days.include?(day) )\n if (self.start_time.to_i >= other.start_time.to_i and self.start_time.to_i <= other.end_time.to_i) or \n (other.start_time.to_i >= self.start_time.to_i and other.start_time.to_i <= self.end_time.to_i)\n return true\n end \n end\n end\n return false\n end",
"def overlaps?(other_slice)\n if ! other_slice.class == Slice\n raise RuntimeError, \"The Slice#overlaps? method takes a Slice object as its arguments.\"\n end\n if self.seq_region.coord_system != other_slice.seq_region.coord_system\n raise RuntimeError, \"The argument slice of Slice#overlaps? has to be in the same coordinate system, but were \" + self.seq_region.coord_system.name + \" and \" + other_slice.seq_region.coord_system.name\n end\n\n self_range = self.start .. self.stop\n other_range = other_slice.start .. other_slice.stop\n\n if self_range.include?(other_slice.start) or other_range.include?(self.start)\n return true\n else\n return false\n end\n end",
"def overlaps_with?(other_obj) \n self.meetings.each do |self_meeting|\n other_obj.meetings.each do |other_meeting|\n return true if self_meeting.overlaps_with? other_meeting\n end\n end\n return false\n end",
"def overlaps_with?(other_obj) \n self.meetings.each do |self_meeting|\n other_obj.meetings.each do |other_meeting|\n return true if self_meeting.overlaps_with? other_meeting\n end\n end\n return false\n end",
"def overlaps?(other_slice)\r\n if ! other_slice.class == Slice\r\n raise RuntimeError, \"The Slice#overlaps? method takes a Slice object as its arguments.\"\r\n end\r\n if self.seq_region.coord_system != other_slice.seq_region.coord_system\r\n raise RuntimeError, \"The argument slice of Slice#overlaps? has to be in the same coordinate system, but were \" + self.seq_region.coord_system.name + \" and \" + other_slice.seq_region.coord_system.name\r\n end\r\n\r\n self_range = self.start .. self.stop\r\n other_range = other_slice.start .. other_slice.stop\r\n\r\n if self_range.include?(other_slice.start) or other_range.include?(self.start)\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"def overlaps(first, second)\n return first.start.between?(second.start, second.end) ||\n first.end.between?(second.start, second.end) ||\n second.start.between?(first.start, first.end) ||\n second.end.between?(first.start, first.end)\nend",
"def overlaps?(other)\n cover?(other.begin) || other.cover?(first)\n end",
"def overlap?(input_range)\n a = self.start_date >= input_range.end_date\n b = self.end_date <= input_range.start_date\n return a || b ? false : true \n end",
"def within?(other_slice)\n if ! other_slice.class == Slice\n raise RuntimeError, \"The Slice#overlaps? method takes a Slice object as its arguments.\"\n end\n if self.seq_region.coord_system != other_slice.seq_region.coord_system\n raise RuntimeError, \"The argument slice of Slice#overlaps? has to be in the same coordinate system, but were \" + self.seq_region.coord_system.name + \" and \" + other_slice.seq_region.coord_system.name\n end\n\n self_range = self.start .. self.stop\n other_range = other_slice.start .. other_slice.stop\n\n if other_range.include?(self.start) and other_range.include?(self.stop)\n return true\n else\n return false\n end\n end",
"def overlaps?(other); end",
"def overlaps?(other); end",
"def overlaps?(other); end",
"def same?(other)\n (from_end == other.from_end and\n to_end == other.to_end and\n overlap == other.overlap)\n end",
"def same?(other)\n (from_end == other.from_end and\n to_end == other.to_end and\n overlap == other.overlap)\n end",
"def within?(other_slice)\r\n if ! other_slice.class == Slice\r\n raise RuntimeError, \"The Slice#overlaps? method takes a Slice object as its arguments.\"\r\n end\r\n if self.seq_region.coord_system != other_slice.seq_region.coord_system\r\n raise RuntimeError, \"The argument slice of Slice#overlaps? has to be in the same coordinate system, but were \" + self.seq_region.coord_system.name + \" and \" + other_slice.seq_region.coord_system.name\r\n end\r\n\r\n self_range = self.start .. self.stop\r\n other_range = other_slice.start .. other_slice.stop\r\n\r\n if other_range.include?(self.start) and other_range.include?(self.stop)\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"def crossing?(other)\n return false unless overlaps?(other)\n (@begin_pos <=> other.begin_pos) * (@end_pos <=> other.end_pos) == 1\n end",
"def overlap?(new_start_date, new_end_date)\n return(start_date <= new_end_date && end_date >= new_start_date) \n end",
"def intersection_with(other)\n r1,r2 = matched_range_types(self, other)\n max_begin = [r1.begin,r2.begin].max\n min_end = [r1.end, r2.end ].min\n excl = ( r1.end == min_end && \n r1.respond_to?(:exclude_end?) && r1.exclude_end?\n ) ||\n ( r2.end == min_end && \n r2.respond_to?(:exclude_end?) && r2.exclude_end?\n )\n unless max_begin > min_end\n Range.new(max_begin, min_end, excl).extend(DateTimeRange)\n end\n end",
"def overlaps\n siblings.overlaps date, date_ended\n end",
"def overlapping\n return unless start_date && end_date && room && program.try(:tracks)\n\n (program.tracks.accepted + program.tracks.confirmed - [self]).each do |existing_track|\n next unless existing_track.room == room && existing_track.start_date && existing_track.end_date\n\n if start_date >= existing_track.start_date && start_date <= existing_track.end_date ||\n end_date >= existing_track.start_date && end_date <= existing_track.end_date ||\n start_date <= existing_track.start_date && end_date >= existing_track.end_date\n errors.add(:track, 'has overlapping dates with a confirmed or accepted track in the same room')\n break\n end\n end\n end",
"def within?(other)\n range_within_other?(self,other)\n end",
"def overlaps_with(other_billing_record, min_proximity = 0)\n return true if start_time == other_billing_record.start_time\n first, second = nil, nil # Which record started first?\n if start_time < other_billing_record.start_time\n first, second = self, other_billing_record\n else\n first, second = other_billing_record, self\n end\n second.start_time - first.stop_time <= min_proximity\n end",
"def overlaps?(start_time, end_time)\n unless @talks.reduce(true) {|outcome, talk| outcome && !talk.overlaps?(start_time, end_time) }\n handle_validation_fail \"Overlaps with existing talks in the #{self.name} event!\"\n return true\n end\n return false\n end",
"def during?(other)\n if other.is_a? Numeric\n other_begin = other_end = other\n else\n other_begin, other_end = other.begin, other.end\n end\n\n self_begin, self_end = self.begin, self.end\n\n # Check if either of the two items begins during the\n # span of the other\n other_begin <= self_begin && self_begin <= other_end ||\n self_begin <= other_begin && other_begin <= self_end\n end",
"def valid_start_and_end_dates?\n return false unless start.present? && self.end.present?\n start <= self.end\n end",
"def overlapping\n return unless calendar && sibling_overlappings?\n errors.add(:base, :overlapping)\n end",
"def vet_overlap\n this_start = self.start_time\n this_end = self.end_time\n return if this_end < this_start\n overlap = veterinarian.appointments.any? do |appointment|\n other_start = appointment.start_time\n other_end = appointment.end_time\n other_start < this_end && this_end < other_end || other_start < this_start && this_start < other_end\n end\n if overlap\n errors.add(:veterinarian, 'has a conflicting appointment')\n end\n end",
"def contains?(other)\n (other.begin_pos <=> @begin_pos) + (@end_pos <=> other.end_pos) >= (other.empty? ? 2 : 1)\n end",
"def intersect(other_interval)\n if self.end <= other_interval.start || other_interval.end <= start\n nil\n else\n Interval.new([start, other_interval.start].max, [self.end, other_interval.end].min)\n end\n end",
"def check_overlap\n appointments = Appointment.all\n current_start = DateTime.strptime(self.start_time,\"%m/%d/%y %H:%M\").to_time\n current_end = DateTime.strptime(self.end_time,\"%m/%d/%y %H:%M\").to_time\n\n appointments.each do |appt|\n appt_start = DateTime.strptime(appt.start_time,\"%m/%d/%y %H:%M\").to_time\n appt_end = DateTime.strptime(appt.end_time,\"%m/%d/%y %H:%M\").to_time\n\n ## if the appointment being checked is a new appointment ##\n if @new_appt\n if current_start >= appt_start && current_start <= appt_end\n @valid = false\n elsif current_end >= appt_start && current_end <= appt_end\n @valid = false\n end\n\n ## if the appointment being checked is an old appointment being updated ##\n else\n if current_start > appt_start && current_start < appt_end\n @valid = false\n elsif current_end > appt_start && current_end < appt_end\n @valid = false\n end\n end\n\n end\n @valid\n p @valid\n end",
"def between?(first_day, last_day)\n ((self.ends_at.to_date >= first_day) && (self.ends_at.to_date <= last_day)) || ((self.starts_at.to_date >= first_day) && (self.starts_at.to_date <= last_day))\n end",
"def overlaps?(other)\n (self.check_in - other.check_out) * (other.check_in - self.check_out) >= 0\n end",
"def overlap(dates)\n (out_date <= dates.in_date || in_date >= dates.out_date)\n end",
"def pet_overlap\n this_start = self.start_time\n this_end = self.end_time\n overlap = veterinarian.appointments.any? do |appointment|\n other_start = appointment.start_time\n other_end = appointment.end_time\n other_start < this_end && this_end < other_end || other_start < this_start && this_start < other_end\n end\n if overlap\n errors.add(:pet, 'has a conflicting appointment')\n end\n end",
"def within_time_period?\n return true unless start_time || end_time\n\n if start_time && end_time\n (start_time..end_time).cover? Time.current\n elsif start_time\n Time.current >= start_time\n elsif end_time\n Time.current <= end_time\n end\n end",
"def cover?(other)\n return false unless other.is_a?(Date)\n\n other = other.day_precision\n\n case\n when unknown_start?\n max.day_precision! == other\n when unknown_end?\n min.day_precision! == other\n when open_end?\n min.day_precision! <= other\n else\n min.day_precision! <= other && other <= max.day_precision!\n end\n end",
"def overlaps?(start_minute, end_minute)\n raise \"start must be less than end\" if start_minute >= end_minute\n\n ((start_minute >= @day_start_minute && start_minute < @day_end_minute) ||\n (end_minute <= @day_end_minute && end_minute > @day_start_minute))\n end",
"def intersects?(other)\n @origin.keys.each do |axis|\n return false unless min_lte_max(axis, other) && max_gte_min(axis, other)\n end\n true\n end",
"def overlap(compare)\n if((@start <= compare.end && @start >= compare.start) ||\n (@end <= compare.end && @end >= compare.start) ||\n (compare.end <= @end && compare.end >= @start) ||\n (compare.start <= @end && compare.start >= @start))\n return true\n else\n return false\n end\n end",
"def disjoint?(other)\n if empty? && other.empty?\n @begin_pos != other.begin_pos\n else\n @begin_pos >= other.end_pos || other.begin_pos >= @end_pos\n end\n end",
"def overlap?(interval_start, interval_end, ride)\n raise \"Invalid interval\" if interval_start>=interval_end\n if (ride.start_time > interval_end) || (ride.end_time<interval_start)\n return false \n else \n return true\n end \n\n end",
"def ==(other)\n (other.is_a? Interval) && (@start == other.start && @end == other.end)\n end",
"def validate_for_another_reservation\n if start_at && end_at && BUSY_STATUSES.include?(self.status)\n errors.add(:start_at, 'Another reservation already exists for these dates.') if exists_other_reservations_in_same_period?\n end\n end",
"def overlaps?(another_geometry)\n raise Error::UnsupportedOperation, \"Method Geometry#overlaps? not defined.\"\n end",
"def complement?(other)\n (from_end == other.to_end and\n to_end == other.from_end and\n overlap == other.complement_overlap)\n end",
"def ==(other)\n other.class == self.class &&\n other.start_date == @start_date &&\n other.end_date == @end_date\n end",
"def overlaps!( other_group, options={} )\n if self.overlaps? other_group, options\n if @start_time <= other_group.start_time\n other_group.overlapped_by += 1\n self.overlapping += 1\n else\n end\n\n end\n end",
"def overlap? range\n !(self & range).nil?\n end",
"def check_overlapping_dates\n # compare this new reservation againsts existing reservations\n if start_date.present? and end_date.present?\n listing.reservations.each do |old_reservation|\n if overlap?(self, old_reservation)\n return errors.add(:The_dates_are_not_available, \"\")\n end\n end\n end\n end",
"def merge(other)\n if include?(other.begin) || other.include?(self.begin)\n cmp = self.begin <=> other.begin\n if cmp < 0\n min = self.begin\n excl_begin = exclude_begin?\n elsif cmp > 0\n min = other.begin\n excl_begin = other.exclude_begin?\n else\n min = self.begin\n excl_begin = exclude_begin? && other.exclude_begin?\n end\n\n cmp = self.end <=> other.end\n if cmp > 0\n max = self.end\n excl_end = self.exclude_end?\n elsif cmp < 0\n max = other.end\n excl_end = other.exclude_end?\n else\n max = self.end\n excl_end = exclude_end && other.exclude_end?\n end\n\n MinMaxRange.create(excl_begin ? GtRange.new(min) : GtEqRange.new(min), excl_end ? LtRange.new(max) : LtEqRange.new(max))\n elsif exclude_end? && !other.exclude_begin? && self.end == other.begin\n # Adjacent, self before other\n from_to(self, other)\n elsif other.exclude_end? && !exclude_begin? && other.end == self.begin\n # Adjacent, other before self\n from_to(other, self)\n elsif !exclude_end? && !other.exclude_begin? && self.end.next(:patch) == other.begin\n # Adjacent, self before other\n from_to(self, other)\n elsif !other.exclude_end? && !exclude_begin? && other.end.next(:patch) == self.begin\n # Adjacent, other before self\n from_to(other, self)\n else\n # No overlap\n nil\n end\n end",
"def overlapping?(left, right)\n (tuples(left) & tuples(right)).any?\n end",
"def check_overlapping_dates\n\t # compare this new booking againsts existing bookings\n\t listing.reservations.each do |old_reservation|\n\t if overlap?(self, old_reservation)\n\t return errors.add(:overlapping_dates, \"The booking dates conflict with existing bookings\") \n\t end\n\t end\n\tend",
"def intersects?(*args)\n other = coerce_range(*args)\n raise ArgumentError, \"#{self.begin.class} expected, received #{other.begin.class}\" unless other.begin.kind_of?(self.begin.class)\n\n if other.instant?\n self.begin <= other.begin and other.end < self.end\n else\n other.begin < self.end and self.begin < other.end\n end\n end",
"def doctor_double_booked\n this_start = self.start_time\n this_end = self.end_time\n conflict = doctor.appointments.any? do |appointment|\n other_start = appointment.start_time \n other_end = appointment.end_time\n other_start < this_end && this_end < other_end || other_start < this_start && this_start < other_end\n end\n if conflict\n errors.add(:doctor, 'has a conflicting appointment')\n end\n end",
"def overlaps?(range)\n !(completely_left_of?(range) || completely_right_of?(range))\n end",
"def check_overlap\n bookings = @parking_space.booking.all\n booking = booking_params.values\n for currentBooking in bookings\n if booking.at(3).to_i < currentBooking.finish_time.to_i && currentBooking.start_time.to_i < booking.at(4).to_i\n return true\n end \n end\n return false\n end",
"def ==(other)\n return true if equal? other\n\n other.kind_of?(Range) and\n self.first == other.first and\n self.last == other.last and\n self.exclude_end? == other.exclude_end?\n \n end",
"def include_range? other_range\n case other_range\n when Range\n if other_range.first >= self.first && other_range.last <= self.last\n return true\n else\n return false\n end\n else\n raise \"unsupported type\"\n end\n end",
"def touching?(range)\n range.end == self.start || self.end == range.start\n end",
"def check_overlapping_dates\n # compare this new booking againsts existing bookings\n listing.bookings.each do |old_booking|\n if overlap?(self, old_booking)\n return errors.add(:overlapping_dates, \"The booking dates conflict with existing bookings\") \n end\n end\n\n end",
"def subsume?(other)\n range_within_other?(other,self)\n end",
"def <=>(other)\n self_start = self.start_date\n other_start = other.start_date\n self_end = self.end_date \n other_end = other.end_date\n return self_start <=> other_start if self_start && other_start\n return self_end <=> other_end if self_end && other_end\n return self_start <=> other_end if self_start && other_end\n return self_end <=> other_start if self_end && other_start\n return 0\n end",
"def covers?(*args)\n other = coerce_range(*args)\n\n if other.instant?\n self.begin <= other.begin and other.end < self.end\n else\n self.begin <= other.begin and other.end <= self.end\n end\n end",
"def correct?\n starts_at < ends_at && starts_at.to_date == ends_at.to_date\n end",
"def overlaps_with(other_groups, options = {})\n return [] if other_groups.nil?\n matching_groups = []\n for other in other_groups\n match = false\n matching_groups << other if other == self && options[:include_self]\n next if other == self\n next if other.day_of_week != day_of_week\n next if other.depart_time.nil? || other.return_time.nil?\n self_range = (depart_time.to_time.to_i..return_time.to_time.to_i) \n other_range = (other.depart_time.to_time.to_i..other.return_time.to_time.to_i) \n match = self_range.intersection(other_range)\n matching_groups << other if match\n end\n matching_groups\n end",
"def conflicts_with_date?(date)\n date.between(self.start_date, self.end_date)\n end",
"def contains?(date_or_time)\n starts_on <= date_or_time && date_or_time < ends_on\n end",
"def intersect(other)\n begin_at = self.begin >= other.begin ? self.begin : other.begin\n end_at = self.end <= other.end ? self.end : other.end\n\n begin_at <= end_at ? self.class.new(begin_at..end_at) : nil\n end",
"def date_overlap?(date_range)\n #(@checkin_date - end_date) * (start_date - @checkout_date) >= 0\n # Will this method work?\n start_date = date_range.checkin_date\n end_date = date_range.checkout_date\n\n if (start_date <= @checkout_date) && (end_date > @checkin_date)\n return true\n else\n return false\n # raise ArgumentError.new(\"#{start_date} and #{end_date} are outside the date range\")\n end\n end",
"def period_ended_after_start\n invalid = false\n if period_started_at.present? and period_ended_at.present? and not period_ended_at > period_started_at\n errors.add( :period_ended_at, :end_before_start )\n invalid = true\n end\n invalid\n end",
"def time_overlap(event)\n (event.start < self.end && event.start > self.start) or\n (self.start < event.end && self.start > event.start)\n end",
"def include?(tod)\n if ending >= beginning\n tod >= beginning && tod <= ending\n else\n start_of_day = TimeOfDay.new(0,0,0)\n end_of_day = TimeOfDay.new(23,59,59)\n (tod >= beginning && tod <= end_of_day) || (tod >= start_of_day && tod <= ending)\n end\n end",
"def fully_includes?(other)\n overlaps?(other) && other == intersection(other)\n end",
"def doctor_double_booked #We check this against all of the doctors appointments \n this_start = self.start_time #Instance methods that are called on a particular doctor's appointment \n this_end = self.end_time \n conflict = doctor.appointments.any? do |appointment| \n #Look through all of the doctors appointments and checks if there are any overlapping appointments (start_time, end_time). \n #any? returns true or false. \n \n other_start = appointment.start_time \n other_end = appointment.end_time\n other_start < this_end && this_end < other_end || other_start < this_start && this_start < other_end\n # other_start < this_end && this_end < other_end \n #This means that this appointment ends in the middle of an existing appointment.\n \n # other_start < this_start && this_start < other_end \n #This means that this appointment starts in the middle of an existing appointment. \n end\n if conflict #true or false \n errors.add(:doctor, 'has a conflicting appointment') \n # Adds an error message to the appointment with an error message about the doctor. The doctor is the key, the message is the value. \n end\n end",
"def overlaps?\n overlaps.exists?\n end",
"def overlapping_payment\n num = PaymentService.get_overlapping_payments(merchant_id, start_date, months)\n if num > 0\n true\n else\n false\n end\n end",
"def ongoing?\n Time.now > start_at && Time.now < end_at\n end",
"def availability?(start_date, end_date)\n start_date = Date.parse(start_date)\n end_date = Date.parse(end_date)\n bookings = self.get_bookings(id: self.id)\n if bookings.length > 0\n bookings.each do |booking|\n if (start_date > booking.start_date && start_date < booking.end_date) || (end_date > booking.start_date && end_date < booking.end_date)\n false\n end\n end\n true\n end\n end",
"def check_overlapping_dates\n #compare this new reservation against existing reservations\n listing.reservations.each do |old_booking|\n if overlap?(self, old_booking)\n return errors.add(:overlapping_dates, \"The booking dates are not available\")\n end\n end\n\n end",
"def ==(other)\n return false unless other\n return false unless other.respond_to?(:frequency) && other.frequency == frequency\n return false unless other.respond_to?(:day_of_week) && other.day_of_week == day_of_week\n return false unless time_attribute_equal(other, :start_at)\n return false unless time_attribute_equal(other, :end_on)\n true\n end",
"def is_date_range?\n start_time.present? && end_time.present?\n end",
"def join(other)\n return nil unless self.frequency == other.frequency\n\n expanded_datetimes = self.datetimes.map { |datetimes_within_an_interval|\n back_one = datetimes_within_an_interval.first - frequency.duration\n forward_one = datetimes_within_an_interval.last + frequency.duration\n\n [back_one] + datetimes_within_an_interval + [forward_one]\n }\n\n joint_ranges = []\n\n # Look for overlaps, where an overlap may be 'off by 1' -- hence the 'expanded_datetimes'\n # ...but start with other and join to each of it's intervals.\n #\n # Remember that 'pattern.datetimes' returns a list of datetimes per interval\n other.datetimes.each do |other_datetimes_within_an_interval|\n\n joinable_datetimes = expanded_datetimes.find { |expanded_datetimes_within_an_interval|\n other_datetimes_within_an_interval.any? { |d|\n expanded_datetimes_within_an_interval.include?(d)\n }\n }\n break unless joinable_datetimes\n\n # Joint ranges should be those that overlap\n #\n # This is buggy, because joinable_datetimes is a list of datetimes per interval that overlap\n # Excluding the first doesn't make sense\n #\n # Instead, we should exclude the first AND last for each element within joinable_datetimes \n joint_datetimes = (other_datetimes_within_an_interval + joinable_datetimes[1...-1]).sort\n joint_ranges << (joint_datetimes.first..joint_datetimes.last)\n end\n\n # This seems to be trying to say \"Only join when we got one for each interval of self\"\n # ...it also seems too restrictive...\n #\n # What if other includes multiple intervals of self?\n # Then we don't need same number of intervals\n #\n # Also might be wrong in other ways, it's tricky to tell\n if joint_ranges.size == self.intervals.size\n Pattern.new(joint_ranges, frequency.duration)\n end\n end",
"def succeeds?(other)\n range_precedes(other, self)\n end",
"def reverse?(other)\n (from_end == other.to_end and\n to_end == other.from_end and\n overlap == other.reverse_overlap)\n end",
"def precedes?(other)\n range_precedes(self, other)\n end",
"def intersects?(other)\n raise \"NOT A CUBOID\" unless other.is_a? Cuboid \n self_range = range_finder\n other_range = other.range_finder\n\n self_range.each do |k,_|\n return false unless overlap?(self_range[k], other_range[k])\n end \n\n true \n end"
] |
[
"0.81052905",
"0.81040674",
"0.8060988",
"0.80536056",
"0.7708344",
"0.7657693",
"0.75019264",
"0.7323826",
"0.707367",
"0.70308346",
"0.7016181",
"0.7016181",
"0.70065284",
"0.6978261",
"0.69742537",
"0.6895147",
"0.6872097",
"0.6872097",
"0.6854419",
"0.67827016",
"0.6781242",
"0.6754718",
"0.6750749",
"0.67334586",
"0.67334586",
"0.67334586",
"0.67266715",
"0.67266715",
"0.6711696",
"0.66636956",
"0.66504425",
"0.65825397",
"0.6511277",
"0.6497808",
"0.64890766",
"0.6420384",
"0.6369785",
"0.6365235",
"0.6361304",
"0.63276696",
"0.63218075",
"0.6304131",
"0.6255993",
"0.6247977",
"0.62186176",
"0.62090445",
"0.6197926",
"0.61854804",
"0.6149427",
"0.6128285",
"0.61257124",
"0.61204237",
"0.61058176",
"0.60959804",
"0.6067545",
"0.60624367",
"0.60614085",
"0.60596246",
"0.6052247",
"0.6044058",
"0.60165155",
"0.6006018",
"0.5970938",
"0.5967526",
"0.5960866",
"0.5958323",
"0.59545577",
"0.5950144",
"0.59418577",
"0.593013",
"0.59284794",
"0.5920215",
"0.5876239",
"0.58713233",
"0.5866139",
"0.5858212",
"0.5850289",
"0.58038497",
"0.5801727",
"0.5799481",
"0.57835203",
"0.5777489",
"0.57737315",
"0.5768819",
"0.5763486",
"0.57613283",
"0.5757609",
"0.5746006",
"0.57384515",
"0.57379943",
"0.57368016",
"0.5729948",
"0.57198876",
"0.5718967",
"0.57174635",
"0.571554",
"0.57121646",
"0.56726795",
"0.56628996",
"0.56495637"
] |
0.7849455
|
4
|
We can't serialize the explainer, so clear it before we transmit
|
def prepare_to_send
statement.explainer = nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def reset\n\t\tself.raw = ''\n\t\tself.hdr_length_left = 8\n\t\tself.payload_length_left = 0\n\tend",
"def clear_body; end",
"def clear\n @raw.clear\n self\n end",
"def reset\n @id = nil\n @strands = []\n @suggested_topic = nil\n end",
"def clear() end",
"def clear() end",
"def reset!\n # this should be overridden by concrete adapters\n end",
"def clear; end",
"def clear; end",
"def clear; end",
"def clear; end",
"def clear; end",
"def clear; end",
"def clear; end",
"def clear\n messages.clear\n details.clear\n end",
"def clear ; @data.clear ; end",
"def message mess\n @message = mess\n @keys_to_clear = 2 if mess\nend",
"def clear!\n @output = ''\n @verbose = false\n end",
"def reset\n @debug_indent = 0\n @uri_to_term_or_curie = {}\n @uri_to_prefix = {}\n @references = Hash.new{|h,k| h[k] = 0}\n @prefixes = {}\n @serialized = {}\n @subjects = {}\n @ordered_subjects = []\n @titles = {}\n @doc_title = \"\"\n end",
"def clear!; end",
"def clear!; end",
"def clear!; end",
"def reset()\n #This is a stub, used for indexing\n end",
"def reset()\n #This is a stub, used for indexing\n end",
"def clean\n public_send strategy\n end",
"def clear_data!\n @data = ''\n end",
"def discard!\n # This should be overridden by concrete adapters.\n end",
"def clear\n raise \"not implemented\"\n end",
"def report_stolen\n # binding.pry\n self.vhs.sample.destroy\n puts \"THANK YOU FOR YOUR REPORT. WE WILL LAUNCH AN INVESTIGATION.\"\n end",
"def clear\n self.request = nil\n end",
"def clear!\n set_ds_field \"\"\n end",
"def clear!\n set_ds_field \"\"\n end",
"def clear; @docs[] = {} end",
"def reset\n @data = nil\n end",
"def do_nothing\n z = @z.content\n @z.content = z\n end",
"def clear\n @data = nil\n end",
"def reset_fields\n self.sender_doc_id_version = nil\n self.receiver_doc_id_version = nil\n self.project_doc_id_version = nil\n self.submission_receiver_doc_id = nil\n self.submission_project_doc_id = nil\n self.response_sender_doc_id = nil\n self.response_project_doc_id = nil\n self.plnd_submission = nil\n self.actl_submission = nil\n self.xpcd_response = nil\n self.actl_response = nil\n self.response_status = nil\n end",
"def clear\n return\n end",
"def reset!\n @buffer = ''\n end",
"def clear\n @topics.clear\n @consumer_groups.clear\n @data.clear\n end",
"def clear\n json = parse({})\n\n super(json, { compression: false })\n\n json\n end",
"def reset\n @payload_object = nil\n end",
"def clear\n\t\tend",
"def clear\n end",
"def hijacked; end",
"def clear\n do_clear\n end",
"def clear_builder\n TransactionState.get.transaction_sample_builder = nil\n end",
"def reset!\n @sentence = Mikrotik::Protocol::Sentence.new\n end",
"def reset!\n @content = @value.to_s\n end",
"def clear\n @server.clear_data\n end",
"def acknowledge\n # do nothing\n end",
"def clear\n end",
"def clear\n end",
"def clear\n end",
"def clear\n render({})\n end",
"def clear\n # self\n end",
"def flush\n data = {}\n end",
"def free_article\n\t\tif self.article\n\t\t\tputs self.article\n\t\t\tself.article.status = \"\"\n\t\t\tself.article.save()\n\t\t\tputs self.article\n\t\tend\t\n\tend",
"def suppress; @write = false end",
"def reconsume; end",
"def clean_post_fetch\n @base = nil\n end",
"def set_body\n self.body = \"\" unless self.body\n end",
"def reset()\n \n end",
"def clear()\n shutdown()\n @flows = {}\n _clear()\n end",
"def initialize\n clear\n end",
"def clear\n initialize\n end",
"def clear\n initialize\n end",
"def DataReset()\n @xml_data = \"\"\n end",
"def initialize\n clear\n end",
"def initialize\n clear\n end",
"def initialize\n clear\n end",
"def clear\n end",
"def clear\n end",
"def prevent_tampering\n self.empathy_level = 0\n self.inner_comments_count = 0\n end",
"def initialize\n clear\n end",
"def reset!\n self.words_for_last = []\n self.corpus_dfs = {}\n self.block_list = []\n self.single_block = []\n end",
"def reset_stream_statistics\n super\n end",
"def emits_none\n @emittable = {}\n nil\n end",
"def clear\n @data = \"O\" * size\n end",
"def clear\n ''\n end",
"def clear\n @que.clear\n end",
"def clear\n @que.clear\n end",
"def clear\n raise NotImplementedError\n end",
"def clear\n raise NotImplementedError\n end",
"def clear\n self.failure_occurred = false\n self.message = nil\n self.time = Float::NAN\n end",
"def clear\n initialize\n self\n end",
"def reset_oneconnect_statistics\n super\n end",
"def clear\n @buffer.clear\n end",
"def reset_fancyness\n self.plain_text\n end",
"def reset\n super\n end",
"def clear_comment\n @comment = ''\n end",
"def clear\n @que.clear\n end",
"def clear\n @hash.clear\n self\n end",
"def reset\n self.explicit_arch = nil\n self.explicit_platform = nil\n self.actual_payload = nil\n end",
"def clear!\n end",
"def initialize\n clear\n super\n end",
"def reset! # :nodoc:\n @params = nil\n @request = nil\n @headers = nil\n end",
"def reset_response\n self.instance_variable_set(:@_response_body, nil)\n end",
"def remove_all_raws!\n @raws = {}\n end",
"def reset\n @printed = false\n @structs.each(&:reset)\n end"
] |
[
"0.5777639",
"0.5725918",
"0.5681908",
"0.56193465",
"0.54777956",
"0.54777956",
"0.5457249",
"0.5455802",
"0.5455802",
"0.5455802",
"0.5455802",
"0.5455802",
"0.5455802",
"0.5455802",
"0.54160935",
"0.5398351",
"0.53931236",
"0.537337",
"0.5359569",
"0.53531617",
"0.53531617",
"0.53531617",
"0.5346516",
"0.5346516",
"0.5336712",
"0.5302107",
"0.52979606",
"0.52903277",
"0.5284486",
"0.5283137",
"0.5276146",
"0.5276146",
"0.52749836",
"0.52712214",
"0.5261774",
"0.5241646",
"0.52276814",
"0.52228457",
"0.522092",
"0.52035606",
"0.5203242",
"0.520318",
"0.5191126",
"0.5185996",
"0.5184378",
"0.51788217",
"0.5176605",
"0.5175426",
"0.51722455",
"0.5154896",
"0.5144112",
"0.5139297",
"0.5139297",
"0.5139297",
"0.5139168",
"0.51376617",
"0.51265764",
"0.5125912",
"0.5124716",
"0.5123666",
"0.51219887",
"0.5119909",
"0.5115778",
"0.51021343",
"0.51018405",
"0.5096525",
"0.5096525",
"0.5091224",
"0.5087263",
"0.5087263",
"0.5087263",
"0.5086682",
"0.5086682",
"0.5083533",
"0.5080579",
"0.50770605",
"0.50728285",
"0.50710195",
"0.50686854",
"0.50645983",
"0.5061465",
"0.5061465",
"0.5057672",
"0.5057672",
"0.5054401",
"0.5053763",
"0.50481844",
"0.50471467",
"0.5047063",
"0.50463617",
"0.504628",
"0.5038754",
"0.5035051",
"0.5034697",
"0.502506",
"0.5024352",
"0.50172526",
"0.5017228",
"0.5013936",
"0.5012283"
] |
0.6434746
|
0
|
I thinks this action should be a POST
|
def update_employee_leave_reset_all
EmployeeLeave.reset_all
notice = t('leave_count_reset_sucessfull')
render :update do |page|
page.replace_html "main-reset-box", :text => "<p class='flash-msg'>#{notice}</p>"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def POST; end",
"def post\r\n end",
"def post; end",
"def post(action, **args); end",
"def post\n end",
"def post_data; end",
"def post_request(object)\n end",
"def submit; end",
"def post\n raise NotImplementedError\n end",
"def api_post(action, data)\n api_request(action, data, 'POST')\n end",
"def submit\n end",
"def post!\n request! :post\n end",
"def post\n resource.post(request, response)\n end",
"def submits; end",
"def post #:doc:\n end",
"def submit\n\t\tset_post_data\n get_response @url\n parse_response\n\tend",
"def poteti_post(action, parameters = nil, session = nil, flash = nil)\n process_action(action, parameters, session, flash, 'POST')\n end",
"def action args = {}\n\t\tend",
"def submit!\n\tend",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def create\n post\n end",
"def post(path, **args); end",
"def _eval_post\n _eval_action('post')\n end",
"def action\n end",
"def post(*args)\n request :post, *args\n end",
"def post(request)\n # sure thing!\n json_response(200, { message: \"This dummy POST endpoint didn't do anything.\" })\n end",
"def post(action, params = T.unsafe(nil), header = T.unsafe(nil), query = T.unsafe(nil)); end",
"def post(data = \"\")\n submit :Post, data\n end",
"def post\n if phase.has_key?('post')\n execute(\"post\", phase['post'])\n end\n end",
"def action\n end",
"def post(action, params={}, options={})\n request(:post, action, params, options)\n end",
"def post(request, response)\n NotImplemented\n end",
"def post(request, response)\n NotImplemented\n end",
"def raw_post; end",
"def post\n Rentlinx.client.post(self)\n end",
"def post(action, parameters = nil, session = nil, flash = nil)\n process_action(action, parameters, session, flash, 'POST')\n end",
"def post(action, parameters = nil, session = nil, flash = nil)\n process_action(action, parameters, session, flash, \"POST\")\n end",
"def post(action, parameters = nil, session = nil, flash = nil)\n process_action(action, parameters, session, flash, \"POST\")\n end",
"def process_post\n true\n end",
"def post data\n commit data\n end",
"def post\n request_object.post_query\n end",
"def api_post(action, data, binary_key = nil)\n api_request(action, data, 'POST', binary_key)\n end",
"def post(request)\n request.method = :post\n request.call\n end",
"def post(*args)\n request(:post, *args)\n end",
"def post_data=(_arg0); 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 new\n render :json => { }, :status => 405\n end",
"def alchemy_post(action, parameters = nil, session = nil, flash = nil)\n process_alchemy_action(action, parameters, session, flash, \"POST\")\n end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def request; end",
"def post(*args)\n execute(:post, *args)\n end",
"def post(data = {})\n call data, method: :post\n end",
"def action\n self.params[:action]\n end",
"def post(*args)\n Request.post(*args)\n end",
"def process\n send_request @action\n end",
"def post(*args, &block); end",
"def post(params = nil)\n request.method = :post\n execute(params)\n end",
"def post_act(act, params)\n Cloudflare::Util::Component.parse_response(HTTParty.post(Cloudflare::Util::Config.get('host.base_url'), body: get_body(act, params)))\n end",
"def update\n @request.accept\n redirect_to posts_url\n end",
"def create\n\n\tend",
"def post\n frm.button(:value=>\"Post\").click\n AssignmentsList.new(@browser)\n end",
"def post\n frm.button(:name=>\"post\").click\n AssignmentsList.new(@browser)\n end",
"def handle_post()\n make_response(201, \"New resource created\")\nend",
"def action_params\n params.require(:new_action).permit(:action_type, :ship_id)\n end",
"def create\r\n end",
"def post_data\n case params[:oper]\n when 'add'\n @message = {}\n @message[\"status\"] = ''\n create\n when 'edit'\n update\n when 'del'\n destroy\n end\n end",
"def save_action; end",
"def create\r\n\r\n\r\n end",
"def create\n #raise params.inspect\n \n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_reader; end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end",
"def create\n end"
] |
[
"0.83094245",
"0.79514235",
"0.78566706",
"0.7554529",
"0.75429296",
"0.7153567",
"0.68442225",
"0.67842406",
"0.67479104",
"0.6721777",
"0.6695921",
"0.66037005",
"0.6600933",
"0.6589217",
"0.6576679",
"0.64968795",
"0.647774",
"0.6469792",
"0.6452513",
"0.64426273",
"0.64426273",
"0.64426273",
"0.64426273",
"0.64426273",
"0.64330757",
"0.6432178",
"0.642953",
"0.6423412",
"0.6421102",
"0.641319",
"0.64039403",
"0.6370124",
"0.6368409",
"0.6347594",
"0.63467413",
"0.6341333",
"0.6341333",
"0.62672144",
"0.6218834",
"0.6206158",
"0.6200886",
"0.6188089",
"0.6157952",
"0.61524683",
"0.6147251",
"0.61267054",
"0.6106781",
"0.60937023",
"0.6087294",
"0.6074344",
"0.6011986",
"0.6001215",
"0.5970096",
"0.5970096",
"0.5970096",
"0.5970096",
"0.5970096",
"0.5970096",
"0.5970096",
"0.5970096",
"0.5970096",
"0.5970096",
"0.5970096",
"0.5965476",
"0.5955441",
"0.5942159",
"0.5925539",
"0.5917739",
"0.5905177",
"0.5895084",
"0.5885423",
"0.588278",
"0.58753824",
"0.5871385",
"0.5868485",
"0.5849226",
"0.58370095",
"0.5834905",
"0.5829117",
"0.58201516",
"0.58159786",
"0.58042914",
"0.5801337",
"0.57937896",
"0.57937896",
"0.57937896",
"0.57937896",
"0.57937896",
"0.57937896",
"0.57937896",
"0.57937896",
"0.57937896",
"0.57937896",
"0.57937896",
"0.57937896",
"0.57937896",
"0.57937896",
"0.57937896",
"0.57937896",
"0.57937896",
"0.57937896"
] |
0.0
|
-1
|
`Paginatedlast_page(count)` Compute the maximum page number which could be meaningfully displayed.
|
def last_page(count)
(count / PER_PAGE.to_f).ceil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def last_page_number\n number_of_pages\n end",
"def bound_last(last, count)\n if last > last_page(count) then last_page(count) else last end\n end",
"def last_page\n (max_matches.to_f / per_page).ceil\n end",
"def max_page(per_page = 10)\n count_hint / per_page + (count_hint % per_page == 0 ? 0 : 1)\n end",
"def page_count\n pages.last\n end",
"def last_page_index\n num_pages() - 1\n end",
"def last_page\n @last_page ||= WillPaginate::ViewHelpers.total_pages_for_collection(@collection)\n end",
"def last_page\n @last_page ||= WillPaginate::ViewHelpers.total_pages_for_collection(@collection)\n end",
"def last_page\n return nil if total_pages < 1\n return total_pages\n end",
"def page_last(current_page, page_size, total_number)\n [current_page * page_size, total_number].min\n end",
"def last_page\n count = posts.count\n per_page = KmForum::POSTS_PER_PAGE\n if count < per_page\n # If there are less posts than per_page limit then last page is first page\n # In such case we have to pass nil as a page because in other case we get\n # unexpected behavior.\n nil\n elsif (count % per_page).zero?\n count / per_page\n else\n count / per_page + 1\n end\n end",
"def last_page_number\n Hash(last_page_params).fetch('page', {}).fetch('number', nil)\n end",
"def last_in_page\n return total if current_page == total_pages\n\n current_page * per_page\n end",
"def last_page_number(conditions=nil)\n total = Comment.count(:conditions => conditions)\n [((total - 1) / per_page) + 1, 1].max\n end",
"def last_page_num(cards)\n (cards.count / 8.to_f).ceil\n end",
"def page_count\n @collection.max + 1\n end",
"def max_page\n (Post.count(@tag).to_f / Post.page_size.to_f).ceil\n end",
"def last_page\n @links['last']\n end",
"def max_page(doc)\n last_page_link = doc.css(\"span.pagelinks a\").last['href']\n Integer(last_page_link[/p=(\\d+)&/,1])\nend",
"def max_page(doc)\n last_page_link = doc.css(\"span.pagelinks a\").last['href']\n Integer(last_page_link[/p=(\\d+)&/,1])\nend",
"def get_last_page\n query = URI.parse(request.referrer).query\n @last_page = query.nil? ? 0 : CGI.parse(query)[\"page\"].first.to_i\n end",
"def last_page?\n current_page == page_count\n end",
"def page_count_from_end(current_page, total_pages)\n (total_pages.to_i - current_page.to_i) + 1\n end",
"def last_page(url = onliner_url)\n JSON(Net::HTTP.get(URI(url)))['page']['last']\n #Net::HTTP.get(URI(url)).scan(/\\\"last\\\"\\:\\d{1,}/).to_s.scan(/\\d+/).first.to_i\n end",
"def max_pages() 1 end",
"def page_count_for(record_count)\n return 0 if record_count.to_i < 1\n\n size = (page_params['size'] || page_params['limit']).to_i\n size = JSONAPI.configuration.default_page_size unless size.nonzero?\n (record_count.to_f / size).ceil\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 page_count\n page_size.zero? ? 1 : (count.to_f / page_size).ceil\n end",
"def last_page?\n page_number < last_page_number\n end",
"def last_page?\n current_page_number == total_pages\n end",
"def last_page?\n page == total_pages\n end",
"def page_count\n # Integer arithmetic is simpler and faster.\n @page_count ||= item_count > 0 ? (item_count - 1) / items_per_page + 1 : 1\n end",
"def num_pages\n (count.to_f / options[:limit]).ceil\n end",
"def page_count\n (unpaged_count.to_f / @entries_per_page).ceil\n end",
"def last_page?\n current_page == total_pages\n end",
"def max_per_page\n nil\n end",
"def last_page?\n return true\n # hack to remove this call so we don't do any counting\n #current_page >= total_pages\n end",
"def max_numbered_pages\n 1_000\n end",
"def last\n goto(last_page_index())\n end",
"def page_count\n @page_count = notices_count/30 + 1\n @page_count = max_pages if @page_count > max_pages\n @page_count\n end",
"def last_page?\n current_page >= num_pages\n end",
"def last_page?\n current_page >= num_pages\n end",
"def max_per_page\n 200\n end",
"def prev_page_number\n [page_number - 1, first_page_number].max\n end",
"def page_count(doc)\n doc.at_css('.pagination') && doc.at_css('.pagination')\n .css('b')\n .map(&:text)\n .map(&:to_i)\n .max\n end",
"def limit\n pagination.fetch(:limit, 10).to_i\n end",
"def num_pages\n (@limit / 10.0).ceil\n end",
"def page_count\n @page_count ||= get_page_count\n end",
"def num_pages\n (total_count.to_f / limit_value).ceil\n end",
"def num_pages\n (total_count.to_f / limit_value).ceil\n end",
"def last_page?\n current_page == total_pages - 1\n end",
"def last_page?\n current_page >= num_pages\n end",
"def current_page_record_count\n return 0 if @current_page > @page_count\n \n a = 1 + (@current_page - 1) * @page_size\n b = a + @page_size - 1\n b = @pagination_record_count if b > @pagination_record_count\n b - a + 1\n end",
"def is_on_last_page(collection)\n collection.total_pages && (collection.current_page < collection.total_pages)\n end",
"def is_on_last_page(collection)\n collection.total_pages && (collection.current_page < collection.total_pages)\n end",
"def total_pages\n count_without_padding = total_count\n count_without_padding -= @_padding if defined?(@_padding) && @_padding\n count_without_padding = 0 if count_without_padding < 0\n\n total_pages_count = (count_without_padding.to_f / limit_value).ceil\n max_pages && (max_pages < total_pages_count) ? max_pages : total_pages_count\n rescue FloatDomainError\n raise ZeroPerPageOperation, \"The number of total pages was incalculable. Perhaps you called .per(0)?\"\n end",
"def last_item\n if @paginator.items_per_page.kind_of?(Array) \n [offset + (@number <= @paginator.items_per_page.size ? @paginator.items_per_page[@number-1] : @paginator.items_per_page.last),@paginator.item_count].min\n else\n [@paginator.items_per_page * @number, @paginator.item_count].min\n end\n end",
"def number_of_reviews_pages (reviews_count)\n\tif reviews_count <= 10\n\t\tpages_count = 1\n\telse \n\t\tnumber_of_review_last_page = reviews_count % 10\n\t\tpages_count = (reviews_count-number_of_review_last_page)/10\n\t\tif number_of_review_last_page > 0\n\t\t\tpages_count = pages_count +1\n\t\telse\n\t\t\tpages_count = pages_count +0\n\t\tend\n\tend\nend",
"def last_page\n self.pages.order('sequence_id').last\n end",
"def num_pages\n (except(:offset, :limit).count.to_f / limit_value).ceil\n end",
"def page_item_count(page_index)\n return -1 if page_index < 0 || page_index > page_count-1 \n return @per_page if page_index < page_count-1 \n return item_count - ((page_count-1) * @per_page) \n end",
"def total_pages(games_count)\n (games_count % GAMES_PER_PAGE == 0 ? games_count / GAMES_PER_PAGE : games_count / GAMES_PER_PAGE + 1).to_i\n end",
"def page_count\n @page_counter\n end",
"def page_count\n file_groups\n @highest_page_count\n end",
"def total_pages\n current_page+4\n # hack to remove this count dependency\n #(total_count.to_f / limit_value).ceil\n end",
"def next_page\n if pages.any? && pages_count > pages.last\n pages.last + 1\n end\n end",
"def page_count\n 1\n end",
"def page_item_count(page_index)\n return -1 if page_index < 0\n return -1 if page_index >= page_count\n if page_index < (page_count-1)\n @items_per_page\n else\n this_page = item_count % @items_per_page\n this_page == 0 ? @items_per_page : this_page\n end\n end",
"def max_pages() Pages.keys.size end",
"def last_page?\n return true if total_pages < 1\n return (page == total_pages)\n end",
"def last_page?\n current_page == pages.end\n end",
"def last_page?\n last_page_number.nil?\n end",
"def page_count\n @page_count ||= ( @total_results / @query.page_size.to_f ).ceil\n end",
"def get_validated_page_num(page_num)\n if page_num.nil? || page_num <= 0\n return 1\n end\n max_page_num = get_num_pages\n if max_page_num.zero?\n return 1\n end\n if page_num > max_page_num\n return max_page_num\n end\n page_num\n end",
"def page_count\n if item_count % @items_per_page == 0\n item_count / @items_per_page\n else\n 1 + (item_count / @items_per_page)\n end\n end",
"def page_item_count(page_index)\n if (page_index + 1 < page_count)\n page_size\n elsif page_index + 1 > page_count\n -1\n else\n item_count % page_size\n end\n end",
"def pages_count\n @pages_count ||= (items_count / @per_page.to_f).ceil\n end",
"def page_count\n @page_count\n end",
"def total_pages\n -1\n end",
"def pager( page_count, page_current )\n display = [10, page_count].min\n return (1..display) if display < 10\n return (1..10) if page_current < 6\n return ((page_count-10)..page_count) if (page_count - page_current) < 5\n return ((page_current-5)..page_current+5)\n end",
"def current_page\n return 0 if current_limit.blank? || current_limit.zero?\n (current_offset / current_limit) + 1\n end",
"def current_page\n [(params[:page] || @default_page || 1).to_i, 1].max # ensure positive integer\n end",
"def page_count\n @total_pages\n end",
"def current_is_last_page?\n @current_page.next_page == 0\n end",
"def pagination_to(collection)\n collection.last_page? ? collection.total_count : collection.offset_value + collection.limit_value\n end",
"def go_to_last_page\n to_last_page.click\n end",
"def num_pages\n (total_count.to_f / per_page).ceil\n end",
"def last_page\n !last_page? ? updated_collection(last_page_params.merge(from: from)) : self\n end",
"def next_page_number\n last_page? ? nil : current_page_number + 1\n end",
"def trailing\n (@total_pages > 0) ? @total_pages : nil\n end",
"def max_pages\n if Kaminari.config.respond_to? :max_pages\n nil\n else\n super\n end\n end",
"def last_page?\n\t\t\t!next_page_url if paginated?\n\t\tend",
"def page_count\n (item_count / @items_per_page.to_f).ceil\n end",
"def page_count\n if collection.length < page_size\n 1\n else\n (collection.length / page_size) + 1\n end\n end",
"def next_page\n current_page < page_count ? (current_page + 1) : nil\n end",
"def current_page_number\n @pageset.size\n end",
"def get_max_results\n @max_results\n end",
"def total_pages\n ( total_results.to_f / limit ).ceil\n end",
"def total_pages\n (items.size - 1) / max_items + 1\n end",
"def num_pages\n n, rest = @num_entries.divmod(@entries_per_page)\n if rest > 0 then n + 1 else n end\n end"
] |
[
"0.77618897",
"0.7652974",
"0.7541254",
"0.7479644",
"0.74753183",
"0.7469814",
"0.73419493",
"0.73419493",
"0.7279868",
"0.7231671",
"0.71892387",
"0.7136886",
"0.7101307",
"0.7081131",
"0.7075225",
"0.6987154",
"0.6924625",
"0.6673539",
"0.6664465",
"0.6664465",
"0.66098636",
"0.65832615",
"0.655791",
"0.6491995",
"0.6482341",
"0.643814",
"0.64327383",
"0.6394711",
"0.63888913",
"0.6363013",
"0.6361081",
"0.63568264",
"0.6344097",
"0.633148",
"0.628957",
"0.62772334",
"0.62690705",
"0.62640655",
"0.6245865",
"0.6242347",
"0.6235965",
"0.6235965",
"0.62327963",
"0.6212829",
"0.6210441",
"0.6180378",
"0.6174303",
"0.6159342",
"0.6157438",
"0.6157438",
"0.61570036",
"0.6156763",
"0.6150617",
"0.61429906",
"0.61429906",
"0.61255836",
"0.610626",
"0.60589755",
"0.6040557",
"0.6013868",
"0.6007235",
"0.59969777",
"0.59945774",
"0.59720886",
"0.59705186",
"0.596755",
"0.5921172",
"0.5920803",
"0.59134305",
"0.5904967",
"0.5903747",
"0.58927304",
"0.5891145",
"0.58809686",
"0.5873796",
"0.58670986",
"0.58665",
"0.5857035",
"0.5852791",
"0.58476865",
"0.58461434",
"0.58361906",
"0.5828008",
"0.58176136",
"0.5802455",
"0.5801994",
"0.57921946",
"0.57723445",
"0.57558393",
"0.5749272",
"0.5736026",
"0.57358986",
"0.5735021",
"0.57346946",
"0.57271653",
"0.5722818",
"0.57065946",
"0.5700753",
"0.5698825",
"0.5690484"
] |
0.8702603
|
0
|
`Paginatedpage(req)` Retrieve the current page out of the `req` instance.
|
def page(req)
req.params.fetch('page', default='1').to_i
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def page\n @request.params[:page] ? @request.params[:page].to_i : 1\n end",
"def page\n @page ||= params[:page] || 1\n end",
"def current_page\n unless @page\n @page = params[:page].to_i\n @page = 1 unless @page\n @page = 1 if @page < 1\n end\n return @page\n end",
"def current_page\n (params[:page].blank? ? 1 : params[:page]).to_i\n end",
"def current_page\n params[:page]\n end",
"def next_page\n return nil unless paginated?\n return nil unless (total_pages - current_page) > 0\n request_with(page: current_page + 1)\n end",
"def current_page\n @current_page ||= (params[:page] || 1).to_s.to_i.abs\n end",
"def page\n Integer(params[:page] || 1)\n end",
"def page\n if !@page || @page < 1\n 1\n elsif @page > total_pages\n total_pages\n else\n @page\n end\n end",
"def paginate(current_page, request = nil)\n changed\n @page_criteria = dbi.paginate(current_page,@per_page,:request => request, :pagination_method => @pagination_method)\n notify_observers(:paginate,self,request)\n @page_criteria\n end",
"def paginate\n paginated?? self : page(1)\n end",
"def page\n _page = params[:page].to_i\n return (_page == 0) ? 1 : _page\n end",
"def page_request(path, params={})\n if params[PARAM_PAGE] && params[PARAM_PAGE] == NOT_FOUND\n params[PARAM_PAGE] = default_page\n end\n\n current_api.get_request(path, ParamsHash.new(params))\n end",
"def current_page\n params[:page] && params[:page].match(/\\d+/) ? params[:page].to_i : 1\n end",
"def current_page\n [(params[:page] || @default_page || 1).to_i, 1].max # ensure positive integer\n end",
"def page\r\n\t\t\t\tparams[:page].to_i || 1\r\n\t\t\tend",
"def current_page\n return 1 if start < 1\n per_page_normalized = per_page < 1 ? 1 : per_page\n @current_page ||= (start / per_page_normalized).ceil + 1\n end",
"def pagination_page\n @pagination_page\n end",
"def current_page\n self.page ||= 0\n self.page + 1\n end",
"def get_page\n case page = params[:page].to_i\n when 0; 1\n when (1..POST_PAGES); page\n else POST_PAGES\n end\n end",
"def current_page\n return unless response.headers['PaginationCurrentPage']\n response.headers['PaginationCurrentPage'].to_i\n end",
"def page\n # extract :page from defaults? no need using default page?\n @params[:page].to_i > 0 ? @params[:page] : @cfg[:default][:page]\n end",
"def page_param\n if params[:page].is_a? ActionController::Parameters\n params[:page][:number]\n else\n params[:page]\n end\n end",
"def paginate!(curr_page)\n return if !hard_paginate?\n @page = curr_page.to_i\n raise ArgumentError if @page < 1 || @page > total_pages\n adj_page = @page - 1 > 0 ? @page - 1 : 0 \n @prev_page = adj_page > 0 ? adj_page : nil\n @next_page = page < total_pages ? (@page + 1) : nil\n @data.only!(adj_page * per_page..(@page * per_page - 1))\n end",
"def current_page\n @page\n end",
"def paginate!\n paginated?? nil : page!(1)\n end",
"def page\r\n @page || 1\r\n end",
"def page_number\n (params[:page] || 1).to_i\n end",
"def page\n @page ||= retrieve_page\n end",
"def page\n @page ||= retrieve_page\n end",
"def page\n @page ||= Page.new(order_by: order_by, per_page: params[:per_page])\n end",
"def page_number\n query_params&.dig(:page)\n end",
"def page_number\n query_params&.dig(:page)\n end",
"def pa_request(*args)\n bp_request\n @page_number = convert_expression(@page_number, args, \"page number\") - 1 # Becaue it will be incremented\n end",
"def set_current_page\n @current_page = params[:page] || 1\n end",
"def paginate(opts)\n resource\n end",
"def page(page)\n params['page'] = page\n end",
"def request_for_page page, pageinfo=nil\n (page.to_i > 1) ? self.class.new(identifier, page) : self\n end",
"def current_page\n @options[:page].blank? ? 1 : @options[:page].to_i\n end",
"def page(pagenum = 1, options = {})\n per = options[:per] || client.config[:pagination_page_size]\n response = client.get(base_path, { page: pagenum, per: per }.merge(options))\n\n return parse(response) unless block_given?\n\n yield response\n end",
"def page\n [[params[:page].to_i, 1].max, total_pages].min\n end",
"def next_page\n num = current_page + 1\n num if total_pages >= num\n end",
"def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"def paginated_request(*args, **options, &block)\n initial_response = request *args, **options\n yield initial_response\n\n # Calculate pages\n total = initial_response.headers['Total'].to_i\n per_page = initial_response.headers['Per-Page'].to_i\n pages = begin\n (total.to_f / per_page.to_f).ceil\n rescue FloatDomainError\n 0\n end\n\n # Ignoring first page because that was the initial response\n (2..pages).each do |page|\n options[:params] ||= {}\n options[:params][:page] = page\n yield request *args, **options\n end\n end",
"def current_page( page = nil )\n @current_page = page if page.present?\n @current_page\nend",
"def page_from_params\n page_num = params[:page].to_i\n\n page_num.zero? ? DEFAULT_PAGE : page_num\n end",
"def current_page\n @current_page\n end",
"def __page\n @_page || 1\n end",
"def next_page\n current_page + 1 unless last_page? || out_of_range?\n end",
"def paginate opts = {}\n @paginator = true\n page = (opts[:page] || 1).to_i\n per_page = (opts[:per_page] || 20).to_i\n page = 1 if page < 1\n limit( per_page, ( page - 1 ) * per_page )\n end",
"def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"def next_page\n current_page < total_pages ? (current_page + 1) : nil\n end",
"def page (page = 1)\n\t \tdiff = (page - 1) * 10\n\t \tall.offset(diff).limit(10)\n\t end",
"def next_page\n return nil if total_pages == -1\n return nil if page == total_pages\n return page + 1\n end",
"def next_page\n return if page >= total_pages\n page + 1\n end",
"def current_page\n response[\"current_page\"]\n end",
"def next_page\n current_page >= total_pages ? nil : current_page + 1\n end",
"def current_page\n return 0 if current_limit.blank? || current_limit.zero?\n (current_offset / current_limit) + 1\n end",
"def next_page\n if next_page?\n @query[:startPage] += 1\n fetch\n end\n end",
"def current_page=(page)\n number = page.to_i\n unless number.to_s == page.to_s && number.between?(1, page_count)\n raise PageNotFound, \"Unknown page #{page}, expected 1..#{page_count}\"\n end\n @current_page = number\n end",
"def paginate(query)\n paginatable =\n params[:page] || params[:per] || request.format.symbol == :html\n paginatable ? current_model_service.paginate(query, params) : query\n end",
"def pagination_page_param\n WillPaginate::ViewHelpers.pagination_options[:param_name]\n end",
"def page(page)\n limit(owner.default_per_page).skip(owner.default_per_page * ([page.to_i, 1].max - 1))\n end",
"def page_url\n page_value = @current_page == 1 ? 0 : @current_page\n \"#{URL}?page=#{page_value}\"\n end",
"def next_page\n current_page < page_count ? (current_page + 1) : nil\n end",
"def current_page\n collection.current_page\n end",
"def page(pagenum)\n CGPDFDocumentGetPage(@pdf, pagenum) # => CGPDFPageRef\n end",
"def page(pg = 1, opts = {})\n opts[:per_page] ||= 20\n opts[:skip] = (pg.to_i - 1) * opts[:per_page].to_i\n skip(opts[:skip]).limit(opts[:per_page])\n end",
"def next_page\n page = @current_page + 1\n get_page(page)\n end",
"def paginate(options={})\n page = [options[:page].to_i, 1].max\n per_page = (options[:per_page] || per_page).to_i\n request[:args].update(start: (page - 1) * per_page, hit: per_page)\n self\n end",
"def get_page(params)\n raw = params.delete('page')\n return 1 unless raw\n page = raw.to_i\n if page < 1\n error 400, convert(body_for(:errors, \"page must be >= 1\"))\n end\n page\n end",
"def next_page\n @current_page + 1 if has_next_page?\n end",
"def extract_next_page(pagination)\n return nil if pagination[:next].nil?\n\n CGI.parse(URI.parse(pagination[:next]).query)[\"page\"].first\n rescue\n nil\n end",
"def page\n get_page\n nil\n end",
"def current_page\n [results.current_page, results.total_pages].min\n end",
"def next_page\n current_page < page_count ? (current_page + 1) : nil\n end",
"def next_page\n current_page < page_count ? (current_page + 1) : nil\n end",
"def get_page_number\n if page_parameters_defined?\n @query_params[:page] = params[:document_counter].to_i==1 ? 1 : ((params[:document_counter].to_f-1)/current_per_page).ceil\n end\n end",
"def next_page\n @next_page ||= (current_page == total_pages) ? total_pages : current_page+1\n end",
"def next_page\n @page = info(@page[:next_page])\n end",
"def current_page\n @collection.current_page\n end",
"def current_page\n @collection.current_page\n end",
"def paginate(page: nil, per: nil)\n page = (page.to_i > 0) ? page.to_i : 1\n per = (per.to_i > 0) ? per.to_i : DEFAULT_PER_PAGE\n\n offset = (page - 1) * per\n\n query do\n offset(offset).limit(per)\n end\n end",
"def paginate!(*args) # @private :nodoc:\n options = args.extract_options!\n self.items_per_page = options[:per_page] || 50\n self.current_page = args.first || 1\n self.limit_value = items_per_page\n self.offset_value = items_per_page * (current_page - 1)\n end",
"def current_page=(page)\n p = page.to_i\n @current_page = session[:\"#{controller_name}_current_page\"] = (p.zero? ? 1 : p)\n end",
"def go_to_page(page)\n get_total_pages unless @total_pages\n return nil if page.to_i < 1 || page.to_i > @total_pages\n ISBNdb::ResultSet.new(\"#{@uri}&page_number=#{page}\", @collection, page)\n end",
"def page_url(page)\n \"#{request.path}?page=#{page}\"\n end",
"def paginate(extra_parameters = {})\n klass.paginate(params(extra_parameters))\n end",
"def page\n\t\tparams[:iDisplayStart].to_i/per_page + 1\n\tend",
"def next; pager.page(page + 1); end",
"def to_page\n page\n end",
"def page(p = 1)\n @query[:startPage] = p\n return self\n end",
"def next_page\n pagination_adapter.next_page\n end",
"def paginate(path, options={})\n per_page = options[:per_page] || options[\"per_page\"] || @per_page\n page = options[:page] || options[\"page\"]\n response = get(path+\"?page=1&per_page=#{per_page}\")\n\n # return one page results without pagination.\n return response if !@auto_paginate\n\n # return all results when enabled auto paginate\n last_response = response.dup\n data = response[\"data\"]\n while last_response[\"next_page_url\"]\n last_response = get(last_response[\"next_page_url\"] + \"&per_page=#{per_page}\")\n data.concat(last_response[\"data\"]) if last_response[\"data\"].is_a?(Array)\n end\n\n return data\n end",
"def page request\n logger.info \"Pager starting:\"\n # page all other pages as long as they're required\n response = false\n has_run = false\n while true\n # prepare the request, allowing the first run even if no setup if provided\n setup, fields = read_fields_and_setup(response)\n break if has_run && @continue == false\n \n request.setup(setup)\n request.fields.merge!(fields)\n response = yield request.run\n \n has_run = true\n end\n \n logger.info \"Pager finished.\"\n end"
] |
[
"0.7167881",
"0.7017142",
"0.6912711",
"0.6870681",
"0.68435025",
"0.6779926",
"0.67683566",
"0.67608017",
"0.66719925",
"0.6671466",
"0.6610503",
"0.6595616",
"0.65521616",
"0.65460056",
"0.6499224",
"0.6487493",
"0.6485147",
"0.64834034",
"0.648218",
"0.64777994",
"0.64458",
"0.6390539",
"0.63751334",
"0.63679487",
"0.6359336",
"0.63357997",
"0.6264973",
"0.62277246",
"0.61901355",
"0.61901355",
"0.6189787",
"0.6170698",
"0.6170698",
"0.6164384",
"0.6158646",
"0.61562586",
"0.6151842",
"0.61500317",
"0.6148001",
"0.61469156",
"0.61195916",
"0.61189",
"0.6096648",
"0.6096648",
"0.6096648",
"0.6096168",
"0.6088844",
"0.6039447",
"0.6032659",
"0.60308814",
"0.6028705",
"0.60152537",
"0.60144675",
"0.6003082",
"0.6003082",
"0.60002774",
"0.60002774",
"0.5993023",
"0.59888923",
"0.5985687",
"0.5983174",
"0.5953916",
"0.59513164",
"0.5950417",
"0.5947254",
"0.593619",
"0.59340477",
"0.5930358",
"0.5919229",
"0.59158885",
"0.59055865",
"0.58977133",
"0.58912486",
"0.5869957",
"0.58641475",
"0.58631015",
"0.58627665",
"0.58591753",
"0.58529633",
"0.58348453",
"0.58330953",
"0.58330953",
"0.5825303",
"0.5815656",
"0.58076376",
"0.58056456",
"0.58056456",
"0.5805549",
"0.5805412",
"0.5805158",
"0.58046573",
"0.58003247",
"0.5798086",
"0.5778683",
"0.5764143",
"0.57621473",
"0.5762052",
"0.5758148",
"0.57570034",
"0.57358754"
] |
0.79003173
|
0
|
`Paginatedpage_nums(req, count)` Compute the range of page numbers to display based on the current `req` and the total `count` of items contained in the paginated collection.
|
def page_nums(req, count)
first = page(req) - SPREAD
last = bound_first(first) + (SPREAD * 2)
first = bound_last(last, count) - (SPREAD * 2) if bound_last(last, count) == last_page(count)
bound_first(first)..bound_last(last, count)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def page_count\n (unpaged_count.to_f / @entries_per_page).ceil\n end",
"def num_pages\n (count.to_f / options[:limit]).ceil\n end",
"def pages_count\n @pages_count ||= (items_count / @per_page.to_f).ceil\n end",
"def page_count\n if item_count % @items_per_page == 0\n item_count / @items_per_page\n else\n 1 + (item_count / @items_per_page)\n end\n end",
"def page_count(arg)\n @pages = arg\n end",
"def page_count\n (item_count / @items_per_page.to_f).ceil\n end",
"def page_count\n page_size.zero? ? 1 : (count.to_f / page_size).ceil\n end",
"def page_count\n # Integer arithmetic is simpler and faster.\n @page_count ||= item_count > 0 ? (item_count - 1) / items_per_page + 1 : 1\n end",
"def num_pages\n (total_count.to_f / per_page).ceil\n end",
"def compute_pages(count = 1, page = 1, pagesize = PAGE_SIZE)\n pages = [(count.to_f / pagesize).ceil, 1].max\n page = page > pages ? pages : (page < 1 ? 1 : page)\n offset = (page - 1) * pagesize\n { page: page, pages: pages, offset: offset }\nend",
"def page_count\n if collection.length < page_size\n 1\n else\n (collection.length / page_size) + 1\n end\n end",
"def num_pages\n (except(:offset, :limit).count.to_f / limit_value).ceil\n end",
"def num_pages\n (total_count.to_f / limit_value).ceil\n end",
"def num_pages\n (total_count.to_f / limit_value).ceil\n end",
"def page_count=(num)\n @page_count = num\n end",
"def paginate(collection, page_num, per_page=5)\n num_pages = (collection.count.to_f / per_page).ceil\n page_num = page_num.to_i\n\n # fix wonky client requests\n page_num = 1 if page_num.nil? || page_num <= 0\n page_num = num_pages if page_num > num_pages\n\n collection.slice((page_num - 1) * per_page, per_page)\nend",
"def total_pages\n current_page+4\n # hack to remove this count dependency\n #(total_count.to_f / limit_value).ceil\n end",
"def page_count \n (item_count / @per_page.to_f).ceil \n end",
"def total_pages\n (count / per_page.to_f).ceil\n end",
"def page_count\n load_page(1) if @num_records.nil? # load pagination metadata\n @num_pages\n end",
"def pager( page_count, page_current )\n display = [10, page_count].min\n return (1..display) if display < 10\n return (1..10) if page_current < 6\n return ((page_count-10)..page_count) if (page_count - page_current) < 5\n return ((page_current-5)..page_current+5)\n end",
"def page_count\n @page_count ||= ( @total_results / @query.page_size.to_f ).ceil\n end",
"def page_count_for(record_count)\n return 0 if record_count.to_i < 1\n\n size = (page_params['size'] || page_params['limit']).to_i\n size = JSONAPI.configuration.default_page_size unless size.nonzero?\n (record_count.to_f / size).ceil\n end",
"def num_pages\n (@total_entries.to_i / per_page.to_f).ceil\n end",
"def pagination_numbers(pages, args = {})\n result = safe_empty\n if pages && pages.num_pages > 1\n params = args[:params] ||= {}\n if pages.letter_arg && pages.letter\n params[pages.letter_arg] = pages.letter\n end\n\n num = pages.num_pages\n arg = pages.number_arg\n this = pages.number\n this = 1 if this < 1\n this = num if this > num\n size = args[:window_size] || 5\n from = this - size\n to = this + size\n\n result = []\n pstr = \"« #{:PREV.t}\"\n nstr = \"#{:NEXT.t} »\"\n result << pagination_link(pstr, this - 1, arg, args) if this > 1\n result << pagination_link(1, 1, arg, args) if from > 1\n if from > 2\n result << content_tag(:li, content_tag(:span, \"...\"), class: \"disabled\")\n end\n (from..to).each do |n|\n if n == this\n result << content_tag(:li, content_tag(:span, n), class: \"active\")\n elsif n.positive? && n <= num\n result << pagination_link(n, n, arg, args)\n end\n end\n if to < num - 1\n result << content_tag(:li, content_tag(:span, \"...\"), class: \"disabled\")\n end\n result << pagination_link(num, num, arg, args) if to < num\n result << pagination_link(nstr, this + 1, arg, args) if this < num\n\n result = content_tag(:ul,\n result.safe_join(\" \"),\n class: \"pagination pagination-sm\")\n end\n result\n end",
"def num_pages\n (@limit / 10.0).ceil\n end",
"def paginate(num)\n l = sorted_articles\n npages = (l.length - 1) / num\n\n for i in 1..(npages)\n create_old_page \"/page/\", i, npages, num\n end\n end",
"def page_count; pages.count; end",
"def pagination_number_list \n (0...page_button_count).to_a.map do |n|\n link_number = n + page_number_offset\n number_span(link_number)\n end.join(' ')\n end",
"def get_num_pages\n record_count = @model_class.count\n if record_count % @items_per_page == 0\n (record_count / @items_per_page)\n else\n (record_count / @items_per_page) + 1\n end\n end",
"def num_pages\n n, rest = @num_entries.divmod(@entries_per_page)\n if rest > 0 then n + 1 else n end\n end",
"def get_view_pages(dbname, view)\n pages = {\n :perpage => get_view_pages_perpage(dbname),\n :current => params[:page].nil? ? 1 : params[:page].to_i,\n :items => view.extras[:auth_count]\n }\n if pages[:items] && pages[:perpage]\n pages[:total] = (pages[:items] + pages[:perpage] - 1) / pages[:perpage]\n end\n pages\n end",
"def pages!(collection, opts = {})\n return unless collection && is_paginated?(collection)\n\n options_query_parameters, original_params, original_url = handle_url(opts)\n\n if opts.fetch(:no_count, false)\n pages_without_count(collection, options_query_parameters, original_params, original_url)\n elsif is_countable?(collection)\n pages_with_count(collection, options_query_parameters, original_params, original_url)\n else\n pages_without_count(collection, options_query_parameters, original_params, original_url)\n end\n end",
"def page_count\n @page_counter\n end",
"def total_pages(games_count)\n (games_count % GAMES_PER_PAGE == 0 ? games_count / GAMES_PER_PAGE : games_count / GAMES_PER_PAGE + 1).to_i\n end",
"def page_count\n @total_pages\n end",
"def number_pages\n pagenum = 1\n @sequence.each do |entry|\n entry.pagenum = pagenum\n next if (is_page? entry and entry.valid_repeat)\n pagenum += 1 if is_page?(entry)\n end\n end",
"def page_count\n @page_count ||= get_page_count\n end",
"def number_of_reviews_pages (reviews_count)\n\tif reviews_count <= 10\n\t\tpages_count = 1\n\telse \n\t\tnumber_of_review_last_page = reviews_count % 10\n\t\tpages_count = (reviews_count-number_of_review_last_page)/10\n\t\tif number_of_review_last_page > 0\n\t\t\tpages_count = pages_count +1\n\t\telse\n\t\t\tpages_count = pages_count +0\n\t\tend\n\tend\nend",
"def total_pages\n ( total_results.to_f / limit ).ceil\n end",
"def paginate(collection)\n page_size = params.dig(:page, :size)&.to_i\n page_number = params.dig(:page, :number)&.to_i\n return collection unless page_size && page_number\n\n Jaf::Pagination.filter(collection, size: page_size, number: page_number)\n end",
"def paginate(page = 1, per_page = 20, count = nil)\n define_singleton_method(:current_page) { page }\n define_singleton_method(:limit_value) { per_page }\n define_singleton_method(:total_results) { count || 0 }\n define_singleton_method(:total_pages) { ((count || size).to_f / per_page).ceil }\n\n self\n end",
"def page_item_count(page_index)\n if (page_index + 1 < page_count)\n page_size\n elsif page_index + 1 > page_count\n -1\n else\n item_count % page_size\n end\n end",
"def show_total_pages\n pages = show_total_hits / show_results_per_page\n return pages + 1\n end",
"def number_of_pages\n (total / page_size.to_f).ceil\n end",
"def total_pages\n total = total_items / page_size\n if total_items % page_size != 0\n total += 1\n end\n total\n end",
"def total_pages\n @total_pages ||= (count.to_f / per_page).ceil\n end",
"def page_item_count(page_index)\n return -1 if page_index < 0 || page_index > page_count-1 \n return @per_page if page_index < page_count-1 \n return item_count - ((page_count-1) * @per_page) \n end",
"def page_range\n 1..page_count\n end",
"def pagination_to(collection)\n collection.last_page? ? collection.total_count : collection.offset_value + collection.limit_value\n end",
"def page_item_count(page_index)\n return -1 if page_index < 0\n return -1 if page_index >= page_count\n if page_index < (page_count-1)\n @items_per_page\n else\n this_page = item_count % @items_per_page\n this_page == 0 ? @items_per_page : this_page\n end\n end",
"def page_count\n @collection.max + 1\n end",
"def total_pages\n populate\n return 0 if @results[:total].nil?\n \n @total_pages ||= (@results[:total] / per_page.to_f).ceil\n end",
"def total_pages\n (total_results / per_page.to_f).ceil\n end",
"def page(num)\n limit(default_per_page).offset(default_per_page * ([num.to_i, 1].max - 1))\n end",
"def total_pages\n collection.total_pages\n end",
"def total_pages\n (items.size - 1) / max_items + 1\n end",
"def num_pages\n if order_bw_pages && order_color_pages\n return 2 + order_bw_pages + order_color_pages\n end\n end",
"def paginate(*args)\n @list.paginate(*args)\n end",
"def total_pages\n (total_entries / per_page.to_f).ceil\n end",
"def total_pages\n (total / per_page.to_f).ceil\n end",
"def pagination(items_count, default_per_page: 20,\n maxium_per_page: 100,\n set_header: true)\n items_count = items_count.count if items_count.respond_to? :count\n\n @pagination_per_page = (params[:per_page] || default_per_page).to_i\n @pagination_per_page = maxium_per_page if @pagination_per_page > maxium_per_page\n @pagination_per_page = 1 if @pagination_per_page < 1\n\n items_count = 0 if items_count < 0\n pages_count = (items_count.to_f / @pagination_per_page).ceil\n pages_count = 1 if pages_count < 1\n\n @pagination_items_count = items_count\n @pagination_pages_count = pages_count\n\n @pagination_page = (params[:page] || 1).to_i\n @pagination_page = pages_count if @pagination_page > pages_count\n @pagination_page = 1 if @pagination_page < 1\n\n if current_page > 1\n @pagination_first_page_url = add_or_replace_uri_param(request.url, :page, 1)\n @pagination_prev_page_url = add_or_replace_uri_param(request.url, :page, (current_page > pages_count ? pages_count : current_page - 1))\n end\n\n if current_page < pages_count\n @pagination_next_page_url = add_or_replace_uri_param(request.url, :page, current_page + 1)\n @pagination_last_page_url = add_or_replace_uri_param(request.url, :page, pages_count)\n end\n\n if set_header\n link_headers ||= []\n\n if current_page > 1\n link_headers << \"<#{@pagination_first_page_url}>; rel=\\\"first\\\"\" if @pagination_first_page_url\n link_headers << \"<#{@pagination_prev_page_url}>; rel=\\\"prev\\\"\" if @pagination_prev_page_url\n end\n\n if current_page < pages_count\n link_headers << \"<#{@pagination_next_page_url}>; rel=\\\"next\\\"\" if @pagination_next_page_url\n link_headers << \"<#{@pagination_last_page_url}>; rel=\\\"last\\\"\" if @pagination_last_page_url\n end\n\n link_header = link_headers.join(', ')\n\n if self.respond_to?(:header)\n self.header('Link', link_header)\n self.header('X-Items-Count', items_count.to_s)\n self.header('X-Pages-Count', pages_count.to_s)\n end\n\n if defined?(response) && response.respond_to?(:headers)\n response.headers['Link'] = link_header\n response.headers['X-Items-Count'] = items_count.to_s\n response.headers['X-Pages-Count'] = pages_count.to_s\n end\n end\n end",
"def count\n load_page(1) if @num_records.nil? # load pagination metadata\n @num_records\n end",
"def page(num = nil, params = {})\n return current_page if num.nil?\n per = params[:limit] || params[:per_page] || limit\n per = per.to_i > 0 ? per.to_i : 1\n start = [num.to_i - 1, 0].max\n add_root from: start * per, size: per\n end",
"def total_pages\n f = total_results.to_f / RESULTS_PER_PAGE\n f.ceil\n end",
"def count_page\n num_pages = current_cookbook.num_pages\n render json: {num_pages: num_pages}\n end",
"def total_pages\n (posts.count + PER_PAGE - 1) / PER_PAGE # Taking advantage from integer division\n end",
"def page_count\n @page_count\n end",
"def number_of_pages=(value)\n @number_of_pages = value\n end",
"def page_start_for(page_num)\n page_size * (page_num - 1) + 1\n end",
"def pages\n results_per_page = 10.0 # make this float so when we compute pages, we get right value\n page = params[:id].to_i - 1 # for page 1, minus 1 to get records with 0 offset\n @tweets = Tweet.offset( results_per_page * page ).take( results_per_page ); # get records offset by page id\n @pages = (Tweet.count / results_per_page).ceil\n @page = params[:id].to_i\n end",
"def fleets_paginated_pages(current_page, total_pages)\n return (1..total_pages).to_a unless total_pages > 13\n\n paginated_pages(current_page, total_pages)\n end",
"def scim_pagination_info(total_count = nil)\n ::Scimitar::Lists::Count.new(\n start_index: params[:startIndex],\n limit: params[:count] || Scimitar.service_provider_configuration(location: nil).filter.maxResults,\n total: total_count\n )\n end",
"def getTotalPageCount()\n return @helper.getTotalPageCount()\n end",
"def pages\n return [*1..@_pages] if @_pages <= 10\n return [*1..8] + [@_pages] if @_page <= 5\n return [1] + [*(@_pages-7)..@_pages] if [*(@_pages-7)..@_pages].include? @_page\n\n [1]+[*(@_page-3)..(@_page+3)]+[@_pages]\n end",
"def number_of_pages\n return @number_of_pages\n end",
"def page_count\n @pages.count\n end",
"def total_pages\n per_page.zero? ? 0 : (total / per_page.to_f).ceil\n end",
"def get_total_pages\n list = @parsed_response[\"#{@collection}List\"]\n @total_pages = (list['total_results'].to_f/list['page_size'].to_f).ceil\n end",
"def get_page_number\n if page_parameters_defined?\n @query_params[:page] = params[:document_counter].to_i==1 ? 1 : ((params[:document_counter].to_f-1)/current_per_page).ceil\n end\n end",
"def page_count\n @page_count = notices_count/30 + 1\n @page_count = max_pages if @page_count > max_pages\n @page_count\n end",
"def pages_no_count!(collection, opts = {})\n return unless collection && is_paginated?(collection)\n\n options_query_parameters, original_params, original_url = handle_url(opts)\n\n pages_without_count(collection, options_query_parameters, original_params, original_url)\n end",
"def calculate_total_pages(entity_class, query_params = {}, items_per_page = 10)\n return nil unless !entity_class.nil? && entity_class.respond_to?(:where)\n query = entity_class.where(query_params)\n return nil unless !query.nil? && query.respond_to?(:count)\n count = query.count\n pages = count / items_per_page\n pages += 1 if (count % items_per_page) > 0\n pages\n end",
"def page_count_from_end(current_page, total_pages)\n (total_pages.to_i - current_page.to_i) + 1\n end",
"def getPageCount()\n return @helper.getPageCount()\n end",
"def getPageCount()\n return @helper.getPageCount()\n end",
"def getPageCount()\n return @helper.getPageCount()\n end",
"def getPageCount()\n return @helper.getPageCount()\n end",
"def pagy_get_vars(collection)\n # return the variables to initialize the pagy object\n { count: collection.count, page: params[:page] }\n end",
"def page(req)\n req.params.fetch('page', default='1').to_i\n end",
"def total_pages\n @total_pages ||= per_page > 0 ? (total / per_page.to_f).ceil : 1\n end",
"def page_number\n (params[:page] || 1).to_i\n end",
"def page_count\n 1\n end",
"def paginate(options={})\n page = [options[:page].to_i, 1].max\n per_page = (options[:per_page] || per_page).to_i\n request[:args].update(start: (page - 1) * per_page, hit: per_page)\n self\n end",
"def pagination_from(collection)\n collection.offset_value + 1\n end",
"def per_page_list\n [[\"10\"], [\"25\"],[\"50\"],[\"100\"],[\"200\"]]\n end",
"def page_count(doc)\n doc.at_css('.pagination') && doc.at_css('.pagination')\n .css('b')\n .map(&:text)\n .map(&:to_i)\n .max\n end",
"def set_pagination_info(page_no, page_size, record_count)\n @current_page = page_no\n @page_size = page_size\n @pagination_record_count = record_count\n @page_count = (record_count / page_size.to_f).ceil\n end",
"def count\n @document.page_count\n end",
"def max_numbered_pages\n 1_000\n end"
] |
[
"0.68033",
"0.6742234",
"0.67151403",
"0.6706579",
"0.6575172",
"0.6540593",
"0.65268904",
"0.65163493",
"0.6479631",
"0.64606625",
"0.6439652",
"0.6423903",
"0.6397344",
"0.6397344",
"0.6354994",
"0.6351529",
"0.6339063",
"0.6337159",
"0.63135064",
"0.629884",
"0.6276227",
"0.62747765",
"0.6269616",
"0.62674546",
"0.6253034",
"0.6243201",
"0.6206482",
"0.62019527",
"0.61804587",
"0.61300254",
"0.61194015",
"0.61129326",
"0.60941863",
"0.60919535",
"0.60637504",
"0.60587656",
"0.60563964",
"0.60506046",
"0.60460305",
"0.6041964",
"0.6033708",
"0.6030379",
"0.6028046",
"0.6000985",
"0.599927",
"0.5983381",
"0.597988",
"0.59768313",
"0.5975017",
"0.5973742",
"0.5948959",
"0.593341",
"0.5921303",
"0.59165204",
"0.59069395",
"0.58939976",
"0.5891609",
"0.588833",
"0.5881552",
"0.58665746",
"0.58618605",
"0.5861741",
"0.5855382",
"0.5831987",
"0.58218825",
"0.5811294",
"0.5801186",
"0.580067",
"0.57928044",
"0.5774788",
"0.5774354",
"0.5771385",
"0.5764272",
"0.5761384",
"0.5756566",
"0.5755546",
"0.5751355",
"0.57483363",
"0.57353103",
"0.5732836",
"0.5732524",
"0.57304895",
"0.57176334",
"0.57140046",
"0.5700867",
"0.5700867",
"0.5700867",
"0.5700867",
"0.57008666",
"0.5692002",
"0.56862503",
"0.56844825",
"0.56744426",
"0.56740063",
"0.56716406",
"0.5664752",
"0.56637985",
"0.5659778",
"0.56583965",
"0.56553376"
] |
0.8142675
|
0
|
`Paginatedbound_first(first)` Private method to calculate the first page based on the current value of `first` to display taking into account the lower display bound or minimum page number (1).
|
def bound_first(first)
if first < 1 then 1 else first end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def first_page\n return nil if total_pages < 1\n return 1\n end",
"def first_in_page\n ((current_page - 1) * per_page) + 1\n end",
"def first_page_number\n 1\n end",
"def first_page\n previous_page? ? updated_collection(from: from, page: { number: 1 }) : self\n end",
"def first_page?\n page_number > first_page_number\n end",
"def first_page\n @links['first']\n end",
"def first_page!\n first_page.tap { |page| update_self(page) }\n end",
"def first_page?\n return true if total_pages < 1\n return (page == 1)\n end",
"def getFirst\n first = \"\" \n if (@currentPage.to_i > 2)\n first = \"<a href=\\\"/pubmed/searchPubmed?method=get&term=#{@keywords}&page=1&resultsPerPage=#{@resultsPerPage}\\\" class=\\\"prev_page\\\">| « First</a>\"\n end \n first\n end",
"def first_page?\n page == 1\n end",
"def first_page\n Page.find(self.first_page_id)\n end",
"def leading\n (@total_pages > 0) ? 1 : nil\n end",
"def current_page\n [results.current_page, results.total_pages].min\n end",
"def first_page?\n current_page == 0\n end",
"def first_page_id\n # Some PageTurners use integers, others use GUIDs etc., \n # but page numbers are most common, so default to 1.\n 1\n end",
"def first_page?\n current_page == pages.begin\n end",
"def first_page?\n current_page == 1\n end",
"def first_page?\n current_page == 1\n end",
"def first_page?\n current_page == 1\n end",
"def first_page?\n current_page == 1\n end",
"def first(limit = 1)\n take(limit)\n end",
"def first\n @range.first\n end",
"def page_start_for(page_num)\n page_size * (page_num - 1) + 1\n end",
"def first\n return nil unless first_page_uri\n perform_request(first_page_uri)\n end",
"def page\n [[params[:page].to_i, 1].max, total_pages].min\n end",
"def first_page?\n current_page == 1\n end",
"def first_page?\n current_page == 1\n end",
"def first(amount = 1)\n return nil if @ids.empty?\n return @paging_block.call([@ids.first]).first if amount == 1\n\n @ids.first(amount).each_slice(@page_size).flat_map do |page_of_ids|\n @paging_block.call(page_of_ids)\n end\n end",
"def is_first_page?\n p_index.to_i == 1\n end",
"def next_page_number\n [page_number + 1, last_page_number].min\n end",
"def first\n perform_request(first_page_uri) if first_page_uri\n end",
"def from\n total.zero? ? total : (page_number - 1) * page_size + 1\n end",
"def first_page?\n\t\t\t!prev_page_url if paginated?\n\t\tend",
"def page\n params[:iDisplayStart].to_i/per_page + 1\n end",
"def to\n [page_number * page_size, total].min\n end",
"def page\n\t\tparams[:iDisplayStart].to_i/per_page + 1\n\tend",
"def first_value\r\n get(@first_index)\r\n end",
"def first(*args)\n last_arg = args.last\n\n limit = args.first if args.first.kind_of?(Integer)\n with_query = last_arg.respond_to?(:merge) && !last_arg.blank?\n\n query = with_query ? last_arg : {}\n query = scoped_query(query.merge(:limit => limit || 1))\n\n if !with_query && (loaded? || lazy_possible?(head, limit || 1))\n if limit\n new_collection(query, super(limit))\n else\n super()\n end\n else\n if limit\n all(query)\n else\n relate_resource(query.repository.read_one(query))\n end\n end\n end",
"def first_page?\n params[:page].nil?\n end",
"def range_start; range.first; end",
"def first() end",
"def page\n params[:iDisplayStart].to_i / per_page + 1\n end",
"def current_page\n return 1 if start < 1\n per_page_normalized = per_page < 1 ? 1 : per_page\n @current_page ||= (start / per_page_normalized).ceil + 1\n end",
"def first; end",
"def first; end",
"def first\n end",
"def paginate\n paginated?? self : page(1)\n end",
"def first(limit = 1)\n self[0..(limit - 1)]\n end",
"def calc_minimum_page_turn(\n pages:,\n page_no:\n )\n if page_no == pages-1 && pages.odd?\n # If no_of_pages is odd and the page we want to land is next to it?\n # then return 0\n return 0\n elsif page_no <= pages/2\n # If result page is before the middle of the book then return page / 2\n return page_no/2\n else\n # If result page is after the middle then return (total pages / 2) - (result page / 2)\n return (pages/2) - (page_no/2)\n end\nend",
"def setFirst(first)\n @first = first\n end",
"def first\n @head\n end",
"def first_page(ip)\n\t# query for ip list\n\tquery_url = BASE_DOMAIN + QUERY_VAR + ip\n\tdoc = open(query_url){|f| Hpricot(f)}\n\tcount = doc.search('//*[@id=\"count\"]').inner_text.gsub(' results','').to_i\n\t#pages = h.search('//*[@id=\"results_container\"]/div[2]/ul/li[2]/a')\n\tpagination = doc.search('//*[@id=\"results_container\"]/div[2]/ul/li/a')\n\treturn [doc,count,pagination]\nend",
"def current_start_index\n @current_page * @entries_per_page \n end",
"def fetch_starting_page\n case @source\n when 'site' then page_repository.root\n when 'parent' then page_repository.parent_of(current_page) || current_page\n when 'page' then current_page\n else\n page_repository.by_fullpath(@source)\n end\n end",
"def first(numbers, int)\n numbers.first(int)\nend",
"def current_results_first\n offset + 1\n end",
"def page\n if !@page || @page < 1\n 1\n elsif @page > total_pages\n total_pages\n else\n @page\n end\n end",
"def bsearch_first (range = 0 ... self.length, &block)\r\n boundary = bsearch_lower_boundary(range, &block)\r\n if boundary >= self.length || yield(self[boundary]) != 0\r\n return nil\r\n else \r\n return boundary\r\n end\r\n end",
"def bsearch_first (range = 0 ... self.length, &block)\n boundary = bsearch_lower_boundary(range, &block)\n if boundary >= self.length || yield(self[boundary]) != 0\n return nil\n else \n return boundary\n end\n end",
"def first\n limit(1).to_a.first\n end",
"def first(&block)\n args = limit(1).include_docs.query\n\n end",
"def first(limit = 1)\n if limit == 0\n ''\n elsif limit >= size\n self\n else\n to(limit - 1)\n end\n end",
"def current_page\n per_page.zero? ? 0 : (@solr_data[:start].to_i / per_page) + 1\n end",
"def custom_first(arr,num=0)\n l = arr.length\n if num==0\n arr[0]\n else\n (num<l)? arr[0...num] : arr[0...l]\n end\nend",
"def bsearch_first(range = 0...length, &block)\n boundary = bsearch_lower_boundary(range, &block)\n if boundary >= length || yield(self[boundary]) != 0\n return nil\n else\n return boundary\n end\n\n end",
"def first(*n) end",
"def current_page\n first(@raw_page['records'].size)\n end",
"def first(spec)\n spec.view_parameters = spec.view_parameters.merge({:limit => 1})\n view(spec).first\n end",
"def paged_nodes\n if first && last\n raise Gitlab::Graphql::Errors::ArgumentError.new(\"Can only provide either `first` or `last`, not both\")\n end\n\n if last\n sliced_nodes.last(limit_value)\n else\n sliced_nodes.limit(limit_value)\n end\n end",
"def first_index(object, min=0, max=length-1)\n\t\treturn [nil, nil] if empty?\n\t\tobject, found = @sort_by ? @sort_by.call(object) : object, nil\n\t\treturn [nil, max] if cmp2(at(max), object) == -1\n\t\treturn [nil, nil] if cmp2(at(min), object) == 1\n\t\tleft,right = min,max\n\t\twhile(left<right)\n\t\t\tcase cmp2(at(index=left+(right-left).div(2)), object)\n\t\t\t\twhen -1: left = index+1\n\t\t\t\twhen 0: right = index-1; found = true\n\t\t\t\twhen 1: right = index-1\n\t\t\t\telse raise \"Inalid returnvalue\"\n\t\t\tend\n\t\tend\n\t\tright = min if right < min\n\t\tcase cmp2(at(index=left+(right-left).div(2)), object)\n\t\t\twhen -1: found ? [found, index+1] : [found, index]\n\t\t\twhen 0: [true, index]\n\t\t\twhen 1: [found, index-1]\n\t\t\telse raise \"Inalid returnvalue\"\n\t\tend\n\tend",
"def begin; pager.offset page; end",
"def prev_page\n current_page - 1 unless first_page? || out_of_range?\n end",
"def first\n enumerator(:limit => 1).first \n end",
"def first(options = {})\n search(options.merge(:limit => true))\n end",
"def first\n @head.val\n end",
"def start_index(page)\n (page - 1) * @count + 1\n end",
"def first_offset; end",
"def first_offset; end",
"def better_my_min\n min = self.first\n self.each do |el|\n min = el if el < min\n end\n min\n end",
"def search_first(array, range=nil, &block)\n boundary = search_lower_boundary(array, range, &block)\n if boundary >= array.length || yield(array[boundary]) != 0\n return nil\n else \n return boundary\n end\n end",
"def first\n self['first']\n end",
"def __page\n @_page || 1\n end",
"def current_page\n return 0 if current_limit.blank? || current_limit.zero?\n (current_offset / current_limit) + 1\n end",
"def min\n @range.begin\n end",
"def custom_first(arr, num= 0)\n arr[0..num]\nend",
"def first\n # Modify the @next url to set the :limit to 1\n original_next = @next\n @next = @path\n fetch_next!(@options.merge(params: @options.fetch(:params, {}).merge({ limit: 1 })))\n # Restore the @next url to the original\n @next = original_next\n @data.first\n end",
"def calculate_next\n n = @current_page + 1\n n > @total_pages || n <= 0 ? nil : n\n end",
"def paginate!(*args) # @private :nodoc:\n options = args.extract_options!\n self.items_per_page = options[:per_page] || 50\n self.current_page = args.first || 1\n self.limit_value = items_per_page\n self.offset_value = items_per_page * (current_page - 1)\n end",
"def prev_page_number\n [page_number - 1, first_page_number].max\n end",
"def initialize_requested_page(prefix=\"\")\n (@search_params[prefix + \"page\"] || 1).to_i\n end",
"def page_last(current_page, page_size, total_number)\n [current_page * page_size, total_number].min\n end",
"def report_first_page(rr)\n rr.build_html_rows_for_legacy # Create the report result details for legacy reports\n @report = rr.report # Grab the report, not including table\n\n @sb[:pages] ||= {}\n @sb[:pages][:rr_id] = rr.id\n @sb[:pages][:items] = @report.extras[:total_html_rows]\n @sb[:pages][:perpage] = settings(:perpage, :reports)\n @sb[:pages][:current] = 1\n total = @sb[:pages][:items] / @sb[:pages][:perpage]\n total += 1 if @sb[:pages][:items] % @sb[:pages][:perpage] != 0\n @sb[:pages][:total] = total\n @title = @report.title\n if @report.extras[:total_html_rows].zero?\n add_flash(_(\"No records found for this report\"), :warning)\n html = nil\n else\n html = report_build_html_table(@report,\n rr.html_rows(:page => @sb[:pages][:current],\n :per_page => @sb[:pages][:perpage]).join)\n end\n html\n end",
"def page\r\n @page || 1\r\n end",
"def get_first\n raise NotImplementedError, \"Please implement get_first\"\n end",
"def first\n find.limit(1).next_document\n end",
"def first(n = T.unsafe(nil)); end",
"def first(n = T.unsafe(nil)); end",
"def my_min_once\n min = first\n each do |num|\n if num < min\n min = num\n end\n end\n min\n end",
"def first(options = {})\n opts = options.dup\n opts.merge!(:limit => [0, 1])\n\n if opts[:by]\n sort_by(opts.delete(:by), opts).first\n else\n sort(opts).first\n end\n end",
"def using_first(array)\narray.first\nend"
] |
[
"0.7377282",
"0.7195114",
"0.6836876",
"0.66712075",
"0.6499926",
"0.6460395",
"0.63195884",
"0.62161016",
"0.6181618",
"0.6150422",
"0.6137931",
"0.6100401",
"0.59770656",
"0.597066",
"0.59535486",
"0.59534216",
"0.5894904",
"0.5894904",
"0.5894904",
"0.5894904",
"0.5867713",
"0.58675486",
"0.5862331",
"0.58413255",
"0.5839569",
"0.58170986",
"0.58170986",
"0.5810772",
"0.58094144",
"0.57949346",
"0.57937294",
"0.5783593",
"0.5689822",
"0.56748974",
"0.5674404",
"0.564639",
"0.5640673",
"0.5637523",
"0.5617741",
"0.56007147",
"0.5597844",
"0.5591336",
"0.55889136",
"0.5567632",
"0.5567632",
"0.5564933",
"0.5564097",
"0.55542886",
"0.55453545",
"0.5519773",
"0.5508525",
"0.55082995",
"0.5499714",
"0.5497508",
"0.5497497",
"0.54945904",
"0.54917306",
"0.54905874",
"0.54822785",
"0.5478364",
"0.5461329",
"0.5439916",
"0.54322964",
"0.5414455",
"0.53982216",
"0.53974444",
"0.5383979",
"0.5382951",
"0.5378782",
"0.53773457",
"0.53750265",
"0.5367962",
"0.5358029",
"0.53535545",
"0.53423315",
"0.53381664",
"0.5337659",
"0.5337659",
"0.5332382",
"0.53315985",
"0.5326998",
"0.53230554",
"0.53175056",
"0.53164387",
"0.5302472",
"0.5294176",
"0.5288096",
"0.5281005",
"0.52736396",
"0.5270539",
"0.5257759",
"0.5257198",
"0.5255622",
"0.52425355",
"0.5240114",
"0.5237497",
"0.5237497",
"0.52357465",
"0.5235258",
"0.5232854"
] |
0.7515672
|
0
|
`Paginatedbound_last(last, count)` Private method to calculate the last page number to display accounting for the maximum page number display bound represented by `last_page`. Returns a value less than or equal to `last_page` based on the current value of `last` and the total `count` of items in the collection.
|
def bound_last(last, count)
if last > last_page(count) then last_page(count) else last end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def last_page(count)\n (count / PER_PAGE.to_f).ceil\n end",
"def last_page\n @last_page ||= WillPaginate::ViewHelpers.total_pages_for_collection(@collection)\n end",
"def last_page\n @last_page ||= WillPaginate::ViewHelpers.total_pages_for_collection(@collection)\n end",
"def page_last(current_page, page_size, total_number)\n [current_page * page_size, total_number].min\n end",
"def last_in_page\n return total if current_page == total_pages\n\n current_page * per_page\n end",
"def last_page_number\n number_of_pages\n end",
"def last_page\n (max_matches.to_f / per_page).ceil\n end",
"def last_page\n return nil if total_pages < 1\n return total_pages\n end",
"def page_count\n @collection.max + 1\n end",
"def page_count\n pages.last\n end",
"def last_page_index\n num_pages() - 1\n end",
"def last_item\n if @paginator.items_per_page.kind_of?(Array) \n [offset + (@number <= @paginator.items_per_page.size ? @paginator.items_per_page[@number-1] : @paginator.items_per_page.last),@paginator.item_count].min\n else\n [@paginator.items_per_page * @number, @paginator.item_count].min\n end\n end",
"def last_page_number(conditions=nil)\n total = Comment.count(:conditions => conditions)\n [((total - 1) / per_page) + 1, 1].max\n end",
"def max_page(per_page = 10)\n count_hint / per_page + (count_hint % per_page == 0 ? 0 : 1)\n end",
"def last_page\n count = posts.count\n per_page = KmForum::POSTS_PER_PAGE\n if count < per_page\n # If there are less posts than per_page limit then last page is first page\n # In such case we have to pass nil as a page because in other case we get\n # unexpected behavior.\n nil\n elsif (count % per_page).zero?\n count / per_page\n else\n count / per_page + 1\n end\n end",
"def pagination_to(collection)\n collection.last_page? ? collection.total_count : collection.offset_value + collection.limit_value\n end",
"def is_on_last_page(collection)\n collection.total_pages && (collection.current_page < collection.total_pages)\n end",
"def is_on_last_page(collection)\n collection.total_pages && (collection.current_page < collection.total_pages)\n end",
"def last(*args)\n last_arg = args.last\n\n limit = args.first if args.first.kind_of?(Integer)\n with_query = last_arg.respond_to?(:merge) && !last_arg.blank?\n\n query = with_query ? last_arg : {}\n query = scoped_query(query.merge(:limit => limit || 1)).reverse\n\n # tell the Query to prepend each result from the adapter\n query.update(:add_reversed => !query.add_reversed?)\n\n if !with_query && (loaded? || lazy_possible?(tail, limit || 1))\n if limit\n new_collection(query, super(limit))\n else\n super()\n end\n else\n if limit\n all(query)\n else\n relate_resource(query.repository.read_one(query))\n end\n end\n end",
"def last_page_number\n Hash(last_page_params).fetch('page', {}).fetch('number', nil)\n end",
"def last_page\n @links['last']\n end",
"def page_count_from_end(current_page, total_pages)\n (total_pages.to_i - current_page.to_i) + 1\n end",
"def last_page\n !last_page? ? updated_collection(last_page_params.merge(from: from)) : self\n end",
"def last_page?\n current_page == page_count\n end",
"def last_page_num(cards)\n (cards.count / 8.to_f).ceil\n end",
"def last_page?\n page == total_pages\n end",
"def last_page?\n current_page_number == total_pages\n end",
"def last_page?\n current_page == total_pages\n end",
"def last_page?\n page_number < last_page_number\n end",
"def last\n goto(last_page_index())\n end",
"def get_last_page\n query = URI.parse(request.referrer).query\n @last_page = query.nil? ? 0 : CGI.parse(query)[\"page\"].first.to_i\n end",
"def last_page?\n return true\n # hack to remove this call so we don't do any counting\n #current_page >= total_pages\n end",
"def last_page?\n current_page >= num_pages\n end",
"def last_page?\n current_page >= num_pages\n end",
"def total_pages\n count_without_padding = total_count\n count_without_padding -= @_padding if defined?(@_padding) && @_padding\n count_without_padding = 0 if count_without_padding < 0\n\n total_pages_count = (count_without_padding.to_f / limit_value).ceil\n max_pages && (max_pages < total_pages_count) ? max_pages : total_pages_count\n rescue FloatDomainError\n raise ZeroPerPageOperation, \"The number of total pages was incalculable. Perhaps you called .per(0)?\"\n end",
"def last_page(url = onliner_url)\n JSON(Net::HTTP.get(URI(url)))['page']['last']\n #Net::HTTP.get(URI(url)).scan(/\\\"last\\\"\\:\\d{1,}/).to_s.scan(/\\d+/).first.to_i\n end",
"def max_page\n (Post.count(@tag).to_f / Post.page_size.to_f).ceil\n end",
"def last_page?\n current_page >= num_pages\n end",
"def last\n @collection.size - 1\n end",
"def last_page?\n current_page == total_pages - 1\n end",
"def total_pages\n (items.size - 1) / max_items + 1\n end",
"def page_count\n # Integer arithmetic is simpler and faster.\n @page_count ||= item_count > 0 ? (item_count - 1) / items_per_page + 1 : 1\n end",
"def page_count\n (unpaged_count.to_f / @entries_per_page).ceil\n end",
"def page_count\n if collection.length < page_size\n 1\n else\n (collection.length / page_size) + 1\n end\n end",
"def last(limit = 1)\n reverse.take(limit).reverse\n end",
"def num_pages\n (count.to_f / options[:limit]).ceil\n end",
"def last_page?\n current_page == pages.end\n end",
"def get_upper_limit_of(range)\n\tn = 1..20\n\tn.last\nend",
"def get_upper_limit_of(range)\n range.last\nend",
"def current_page_record_count\n return 0 if @current_page > @page_count\n \n a = 1 + (@current_page - 1) * @page_size\n b = a + @page_size - 1\n b = @pagination_record_count if b > @pagination_record_count\n b - a + 1\n end",
"def last(limit = 1)\n from(-limit) || self\n end",
"def page_item_count(page_index)\n return -1 if page_index < 0 || page_index > page_count-1 \n return @per_page if page_index < page_count-1 \n return item_count - ((page_count-1) * @per_page) \n end",
"def trailing\n (@total_pages > 0) ? @total_pages : nil\n end",
"def last_page?\n return true if total_pages < 1\n return (page == total_pages)\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 max_page(doc)\n last_page_link = doc.css(\"span.pagelinks a\").last['href']\n Integer(last_page_link[/p=(\\d+)&/,1])\nend",
"def max_page(doc)\n last_page_link = doc.css(\"span.pagelinks a\").last['href']\n Integer(last_page_link[/p=(\\d+)&/,1])\nend",
"def num_pages\n (@limit / 10.0).ceil\n end",
"def total_pages\n current_page+4\n # hack to remove this count dependency\n #(total_count.to_f / limit_value).ceil\n end",
"def page_count\n if item_count % @items_per_page == 0\n item_count / @items_per_page\n else\n 1 + (item_count / @items_per_page)\n end\n end",
"def last(limit=1)\n limit(limit).reverse_order.load.first\n end",
"def num_pages\n (except(:offset, :limit).count.to_f / limit_value).ceil\n end",
"def num_pages\n (total_count.to_f / limit_value).ceil\n end",
"def num_pages\n (total_count.to_f / limit_value).ceil\n end",
"def page_item_count(page_index)\n if (page_index + 1 < page_count)\n page_size\n elsif page_index + 1 > page_count\n -1\n else\n item_count % page_size\n end\n end",
"def page_count\n (item_count / @items_per_page.to_f).ceil\n end",
"def page_count\n page_size.zero? ? 1 : (count.to_f / page_size).ceil\n end",
"def page_item_count(page_index)\n return -1 if page_index < 0\n return -1 if page_index >= page_count\n if page_index < (page_count-1)\n @items_per_page\n else\n this_page = item_count % @items_per_page\n this_page == 0 ? @items_per_page : this_page\n end\n end",
"def page_count(doc)\n doc.at_css('.pagination') && doc.at_css('.pagination')\n .css('b')\n .map(&:text)\n .map(&:to_i)\n .max\n end",
"def prev_page_number\n [page_number - 1, first_page_number].max\n end",
"def last_page\n self.pages.order('sequence_id').last\n end",
"def last(limit = 1)\n if limit == 0\n ''\n elsif limit >= size\n self\n else\n from(-limit)\n end\n end",
"def limit\n pagination.fetch(:limit, 10).to_i\n end",
"def max_pages() 1 end",
"def pages_tail(current_page, total_pages)\n tail = [total_pages - 2, total_pages - 1, total_pages]\n tail += [total_pages - 5, total_pages - 4, total_pages - 3] if current_page >= total_pages - 1\n tail\n end",
"def current_is_last_page?\n @current_page.next_page == 0\n end",
"def total_pages\n ( total_results.to_f / limit ).ceil\n end",
"def page_count_for(record_count)\n return 0 if record_count.to_i < 1\n\n size = (page_params['size'] || page_params['limit']).to_i\n size = JSONAPI.configuration.default_page_size unless size.nonzero?\n (record_count.to_f / size).ceil\n end",
"def last(*vars)\n result = Query.get params(:from => count-1, :size => 1), *vars\n docs = result.get_docs\n docs.is_a?(Array) ? docs.first : docs\n end",
"def last_page!\n last_page.tap { |page| update_self(page) }\n end",
"def last\n perform_request(last_page_uri) if last_page_uri\n end",
"def max_per_page\n 200\n end",
"def total_pages\n -1\n end",
"def last_page?\n last_page_number.nil?\n end",
"def last_page?\n !out_of_bounds? && next_page.nil?\n end",
"def total_pages\n collection.total_pages\n end",
"def page_count\n @page_count = notices_count/30 + 1\n @page_count = max_pages if @page_count > max_pages\n @page_count\n end",
"def page_count\n @page_counter\n end",
"def go_to_last_page\n to_last_page.click\n end",
"def per_page\n collection.limit_value\n end",
"def last(limit = nil)\n return find_last(limit) if loaded? || has_limit_or_offset?\n\n result = ordered_relation.limit(limit)\n result = result.reverse_order!\n\n limit ? result.reverse : result.first\n end",
"def last(number_of_entries = 1)\n find(nil, :sort => [:_id, :descending], :limit => number_of_entries).reverse\n end",
"def max_per_page\n nil\n end",
"def page_count\n @total_pages\n end",
"def bottom\n scoped_all.size + start - 1\n end",
"def pager( page_count, page_current )\n display = [10, page_count].min\n return (1..display) if display < 10\n return (1..10) if page_current < 6\n return ((page_count-10)..page_count) if (page_count - page_current) < 5\n return ((page_current-5)..page_current+5)\n end",
"def fetch(cursor: -1, count: 50, **options)\n cursor, count = cursor.to_i, count.to_i\n window = count + 2 # Fetch extra two elements for concrete next/prev links\n\n if cursor >= 0\n page = @scope.where(@cursor_key => -Float::INFINITY..cursor).limit(window)\n else\n cursor = cursor == -1 ? 0 : cursor.abs\n page = @scope.where(@cursor_key => cursor..Float::INFINITY).limit(window)\n end\n\n # Ensure result set is in correct order\n page = page.order(@cursor_key => :desc)\n\n Page.new(page, cursor, count: count)\n end",
"def pages_count\n @pages_count ||= (items_count / @per_page.to_f).ceil\n end",
"def end_index\n ei = self.current_page * self.results_per_page\n return (ei < self.total_results ? ei : self.total_results)\n end",
"def page_count\n @page_count\n end"
] |
[
"0.77432275",
"0.754022",
"0.754022",
"0.73383677",
"0.72729415",
"0.7152181",
"0.70715684",
"0.7006435",
"0.69542134",
"0.6946921",
"0.6859196",
"0.6797491",
"0.67929506",
"0.6724094",
"0.66747844",
"0.6551067",
"0.6513334",
"0.6513334",
"0.6503359",
"0.6484546",
"0.6471332",
"0.64552814",
"0.6377144",
"0.6214317",
"0.618194",
"0.6176484",
"0.6145841",
"0.61442554",
"0.60980177",
"0.6081706",
"0.6077397",
"0.6050345",
"0.60187036",
"0.60187036",
"0.59951234",
"0.5986132",
"0.59603745",
"0.59283036",
"0.59267324",
"0.5921502",
"0.59007835",
"0.58792317",
"0.58648777",
"0.58273333",
"0.57998145",
"0.57846475",
"0.57651293",
"0.57459474",
"0.5739248",
"0.57120556",
"0.5709678",
"0.5706219",
"0.56801766",
"0.5668632",
"0.56403184",
"0.56342405",
"0.56342405",
"0.5594698",
"0.55923826",
"0.559124",
"0.55825406",
"0.55796576",
"0.5578196",
"0.5578196",
"0.5568877",
"0.5559192",
"0.5553389",
"0.5549539",
"0.55474675",
"0.5534428",
"0.5526534",
"0.552336",
"0.5512075",
"0.5511183",
"0.55081385",
"0.55001354",
"0.54975396",
"0.5495065",
"0.54907763",
"0.5489776",
"0.548779",
"0.548361",
"0.5479819",
"0.54758304",
"0.5472351",
"0.54705966",
"0.5454749",
"0.54510796",
"0.54438955",
"0.54411113",
"0.5431938",
"0.5414396",
"0.540854",
"0.5404948",
"0.53909",
"0.5390295",
"0.53891075",
"0.5379939",
"0.5369007",
"0.53621817"
] |
0.84732765
|
0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.