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
This is a before_filter callback for registering new visitors admin users are ignored
def track_visitor return if ignore_funnel_tracking? register_funnel_visitor unless visitor_registered? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_user_is_registered\n unless( user_is_registered)\n redirect_to_login\n end\n end", "def admin_user\n render_forbidden unless current_user.admin?\n end", "def admin_restrictions\n unless AdminUser.find(:all).empty?\n redirect_to login_path, :notice => \"Admin user already exists\"\n end\n end", "def not_change_my_admin\n #今回、「一般ユーザーとする」として登録しようとしている場合\n if admin_status==0\n # if User.where.not(id: 1).size == 0\n if id == current_user_id\n errors.add(\" \",I18n.t(\"activerecord.errors.messages.restrict_change_admin\"))\n # errors.add(:cd, I18n.t(\"activerecord.errors.messages.restrict_dependent_destroy.myself\"))\n end\n end\n end", "def reg_only!\n\tif !current_user || current_user.pro || current_user.administrator\n\t\tredirect \"/\"\n\tend\nend", "def admin_only\n if !Volt.current_user.admin\n redirect_to '/login'\n end\n end", "def admin_only\n deny_access(\"Necesitas tener privilegios de administrador para entrar.\") unless signed_in_as_admin?\n end", "def before_filter\n if current_user\n true\n end\n end", "def admin_required\n if current_user && current_user.admin\n return\n end\n redirect_to \"/login\", notice: 'Logga in som administratör.'\n end", "def admin_user\n unless admin_user?\n redirect_to login_url\n end\n end", "def authorizeAdmin\n redirect_to '/adminlogin' unless admin_user\n end", "def admin_check\n render_401 && return unless current_user\n render_403 && return unless current_user.admin?\n end", "def min_up_members_action\n super\n end", "def users_only\n deny_access(\"Necesitas crear una cuenta para entrar a esta sección\") unless signed_in?\n end", "def admin\n check_admin_without_render(current_user)\n @users = User.find(:all, :order => \"updated_at\", :conditions => [\"junk is NOT NULL\", ])\n end", "def admin_in!\n access_denied! unless current_user.admin?\n end", "def admin_user\n\t\tredirect_to(root_url) unless current_user.admin? #NB il metodo \"admin?\" è stato aggiunto direttamente da Rails quando alla creazione ha visto che admin è un booleano\n\tend", "def before_filter; end", "def admin_user\n\t\tredirect_to(root_url) unless current_user.admin?\n\tend", "def admin_user\n\t\tredirect_to(root_url) unless current_user.admin?\n\tend", "def admin_user\n\t\tredirect_to(root_url) unless current_user.admin?\n\tend", "def should_register_first_admin?\n unless User.any?\n redirect_to controller: 'users/registrations', action: 'new_admin'\n end\n end", "def deny_admin_suicide\n raise 'admin suicided' if User.count(&:admin) <= 1\n end", "def deny_admin_suicide\n raise 'admin suicided' if User.count(&:admin) <= 1\n end", "def admin_user\n \t\tredirect_to(root_url) unless current_user.admin?\n \tend", "def make_first_user_admin\n return unless User.count.zero?\n\n self.is_admin = true\n self.approved = true\n end", "def admins_only\n if current_user.nil? or !current_user.is_admin?\n # Silently redirect, no need to tell anyone why. If they're\n # not an admin, they have no business here\n redirect_to root_path\n end\n end", "def require_admin\n unless current_user && current_user.admin?\n flash[:alert] = t 'registrations.new.flash.require_admin'\n redirect_to root_path\n end\n end", "def require_admin_login\n unless admin_signed_in?\n redirect_to login_url\n end\n end", "def admin_user\n redirect_to(root_url) unless user_signed_in? && current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless user_signed_in? && current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user && current_user.admin?\n end", "def admin_user\n redirect_to(news_index_path) unless is_admin?\n end", "def restrictToAdmin! ; redirect to('/login'),303 unless admin? ; end", "def admin_only!\n\tif !current_user || !current_user.administrator\n\t\tredirect \"/\"\n\tend\nend", "def admin_user\n redirect_to(admin_admins_path) unless current_user.admin?\n end", "def admin?\n if !ALLOWED_USERS.include? current_user.email\n redirect_to root_path\n end\n end", "def admin_user\n #redirect_to(root_url) unless\n current_user.admin?\n end", "def admin_user\n #redirect_to(root_url) unless\n current_user.admin?\n end", "def admin_user\n unless current_user && current_user.admin?\n redirect_to login_url, notice: \"admin can only do this action.\" \n end\n end", "def user_only\n redirect_back(fallback_location: admin_dashboards_path) if current_user.admin?\n end", "def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend", "def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend", "def authorize_admin!\n redirect_to login_path unless current_user\n end", "def allow_if_admin\n unless is_admin?\n flash[:danger] = \"Administration permissions needed to access to this page\"\n redirect_to new_user_session_path\n end\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n \n end", "def admin_only\n false\n end", "def admin_user\n redirect_to(login_path) unless current_user.is_admin?\n end", "def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t end", "def admin_user\n redirect_to(current_user) unless current_user.admin?\n end", "def admin_user\n\t\tredirect_to(root_path) unless current_user.admin?\n\tend", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def ensure_admin_user!\n redirect_to(news_path, :alert => \"You may not perform this action on News!\") and return unless user_signed_in? && current_user.admin?\n end", "def authorize_admin\n return if current_customer.admin?\n redirect_to root_path, alert: 'Admins only!' unless current_customer and current_customer.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless correct_user.admin? \n end", "def admin_user\n redirect_to(root_url) unless current_user.admin? || current_user.super_admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin? \n end", "def admin_user\n redirect_to(root_path) unless (current_user != nil && current_user.admin == true)\n end", "def admin_required\n if not admin?\n redirect \"/login?#{env[\"REQUEST_PATH\"]}\"\n end\n end", "def filter_user_is_admin\n # We aren't going to redirect on this one. Since it's an admin interface it's pretty sensitive so \n # we're going to give a \"not found\" response (security through obscurity anyone?)\n unless( user_is_admin)\n respond_to do |wants|\n wants.atom { head 404}\n wants.atomsvc { head 404}\n wants.html do\n render :file => \"#{RAILS_ROOT}/public/404.html\", :status => 404\n end\n end\n end\n end", "def require_admin \n if Affiliate.find(session[:id]).email != \"tech@trunkclub.com\"\n redirect_to root_url, :notice => 'Must be admin.'\n end\n end", "def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end", "def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end", "def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end", "def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end", "def allowedusers_only\n \n\t\tallowed_users=[VendorPortal::Application.config.operationadmin.to_s,VendorPortal::Application.config.operationuser.to_s,VendorPortal::Application.config.vendor.to_s]\n\t\n if !current_user.userrole.in?(allowed_users)\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def ensure_admin_user\n redirect_to dashboard_index_path unless is_admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end", "def admin_user\n unless ( logged_in? && current_user.admin? )\n store_location\n flash[:danger] = \"У Вас недостаточно прав для выполнения этой операции.\"\n redirect_to root_url\n end \n # redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\nend", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n\n end", "def admin_user\n redirect_to(root_path) unless current_user.admin?\n end", "def admin_user\n\t redirect_to user_path(current_user) unless current_user.admin?\n\tend", "def admin_required!\n if current_user.blank?\n redirect_to new_user_session_path, :flash => {:notice => \"Please login to access that page.\"}\n elsif !current_user.is_superadmin? && !current_user.is_admin?\n redirect_to root_path, :flash => {:notice => \"You are not authorized user to access that page.\"}\n end\n end", "def admin_authorize\n unless admin?\n unauthorized_access\n end\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end" ]
[ "0.6606229", "0.6525457", "0.63931304", "0.63324946", "0.6280296", "0.6217417", "0.617769", "0.61725754", "0.6136499", "0.6108576", "0.60830104", "0.60790104", "0.6058918", "0.604925", "0.60401785", "0.60363257", "0.6035207", "0.602145", "0.6017356", "0.6017356", "0.6017356", "0.6014849", "0.6011586", "0.6011586", "0.60088414", "0.60069954", "0.5994208", "0.598911", "0.5986307", "0.5981223", "0.5981223", "0.59796727", "0.59748966", "0.59720606", "0.596601", "0.59654903", "0.5961605", "0.59601635", "0.59601635", "0.59592724", "0.5952554", "0.59498924", "0.59498924", "0.5940661", "0.5937688", "0.5937422", "0.5937415", "0.59294856", "0.59268105", "0.5924154", "0.5913831", "0.5913008", "0.5911734", "0.59114933", "0.5909481", "0.5906936", "0.59052503", "0.589924", "0.589924", "0.589924", "0.589924", "0.589924", "0.589924", "0.589924", "0.589924", "0.589924", "0.589924", "0.589924", "0.589924", "0.589924", "0.589924", "0.589924", "0.58981365", "0.5897997", "0.5895593", "0.58919865", "0.5891827", "0.588366", "0.5880033", "0.5880033", "0.58782566", "0.58782566", "0.58782566", "0.58782566", "0.5875632", "0.5875632", "0.5875632", "0.5875632", "0.5875632", "0.5869015", "0.5867323", "0.5867323", "0.5867298", "0.58645076", "0.5853026", "0.58526224", "0.58500886", "0.5849937", "0.5846994", "0.5844477", "0.5842915" ]
0.0
-1
Workhorse utility method for logging funnel events (This is probably how MOST funnel events will be triggered) checks if we are an admin visitor first sends the funnel event msg to the current user, if we're logged in sets the url, referer, ua data automatically using the request otherwise, sends it to the current visitor if there is no valid current visitor, register one finally... logs an error if we have no current visitor (because that shouldn't happen!)
def log_funnel_event(event, data={}) return if ignore_funnel_tracking? register_funnel_visitor if current_visitor.nil? unless current_visitor.nil? data.reverse_merge!({ :url=>request.request_uri, :referer=>request.referer, :user_agent=>request.env["HTTP_USER_AGENT"].to_s }) current_visitor.log_funnel_event(event, data) return end logger.info "Couldn't Log FunnelCake Event: #{event} No Analytics::Visitor found!" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_funnel_page_visit\n log_funnel_event(:view_page)\n end", "def log_funnel_event(event, data={})\n unless self.valid_events.include?(event.to_sym)\n Rails.logger.info \"#{self.class.to_s} couldn't log FunnelCake event: #{event} This event is not valid for state: #{self.current_state}, ip: #{self.ip}\"\n return\n end\n self.send(event.to_s+\"!\", data)\n end", "def log_funnel_event(event, data={})\n unless self.valid_events.include?(event.to_sym)\n Rails.logger.info \"#{self.class.to_s} couldn't log FunnelCake event: #{event} This event is not valid for state: #{self.current_state}, ip: #{self.ip}\"\n return\n end\n self.send(event.to_s+\"!\", data)\n end", "def track_visitor\n return if ignore_funnel_tracking?\n register_funnel_visitor unless visitor_registered?\n end", "def log_visit\n session_id = request.session_options[:id]\n client = DeviceDetector.new(request.env[\"HTTP_USER_AGENT\"])\n client_os = client.os_name\n if !VisitorLog.find_by_session_id(session_id)\n VisitorLog.create(:session_id => session_id, :logged_in => false, :device_type => client_os)\n end\n\n if VisitorLog.find_by_session_id(session_id)\n log = VisitorLog.find_by_session_id(session_id)\n if !log.logged_in && logged_in?\n log.update_attribute(\"logged_in\", true)\n log.save\n end\n\n if logged_in? && current_user.department_id.present? && log.department_id.nil?\n log.update_attribute(\"department_id\", current_user.department_id)\n log.save\n end\n end\n\n end", "def sync_funnel_visitor\n return unless FunnelCake.enabled?\n\n if not logged_in?\n logger.info \"Couldn't sync Analytics::Visitor to nil User\"\n return\n end\n if current_visitor.nil?\n logger.info \"Couldn't sync nil Analytics::Visitor to current User: #{current_user.inspect}\"\n return\n end\n current_visitor.user_id = current_user.id\n current_visitor.save\n end", "def register_funnel_visitor\n @current_visitor = FunnelCake.engine.visitor_class.create(\n :ip=>request.remote_ip.to_s\n )\n @current_visitor.user_id = current_user.id if logged_in?\n @current_visitor.save\n cookies[self.class.read_inheritable_attribute(:cookie_name)] = {\n :value => @current_visitor.id,\n :expires => 1.year.from_now\n }\n end", "def access_logger\n Rails.application.config.another_logger.info(\"#{request.method} '#{request.path}' #{request.version} from: #{request.remote_ip}\")\n end", "def log_user_event(depositor)\n # log the event to the proxy depositor's profile\n proxy_depositor.log_profile_event(event)\n depositor.log_event(event)\n end", "def log_request(request)\n access = Access.new\n access.host = request.ip\n access.referrer = request.referer\n access.timestamp = DateTime.now\n\n access.method = request.request_method\n \n (request.get? ? request.GET : request.POST).each_pair do |key, value|\n pair = FormDataPair.new\n pair.name = key\n pair.value = value\n access.form_data_pairs << pair\n end\n\n access.save\n\n status 404\n 'No one here but us chickens.'\nend", "def request_log(request); end", "def log_request\n # REQUEST_LOG.info( {\n # time: Time.now.to_s,\n # ip: request.remote_ip,\n # path: request.path,\n # site: request.host,\n # user_agent: request.user_agent,\n # params: (request.request_parameters.blank? ? request.query_parameters : request.request_parameters),\n # device: sub_group_type,\n # referer_header: referer,\n # current_page_header: current_page,\n # landing_url_header: land_url,\n # visitor_id_header: request.env['HTTP_VISITOR_ID'],\n # session_id_header: request.env['HTTP_SESSION_ID'],\n # visitor_id: visitor_id,\n # session_id: session_id,\n # params: params\n # } )\n end", "def logVisit record=nil, rateable=false\n return if !valid_browser?(request.user_agent) or valid_robot?(request.user_agent)\n\n user_id = user_signed_in? ? current_user.id : nil\n record_class = record_id = nil\n record_class = record.class.to_s unless record.nil?\n record_id = record.id unless record.nil?\n LogVisitWorker.perform_async(request.user_agent, request.remote_ip, user_id, Time.now, record_class, record_id, rateable)\n \n# Thread.new do\n# #Wait 10 seconds to allow the request to be returned before starting. This saves the request some time.\n# #On development using Webrick, if we wait too long and another thread gets created this one gets killed.\n# #Should be good on production.\n# sleep 10\n\n# ip_address = logIpAddress #First log IpAddress\n \n# record.register_visit_by(ip_address)\n\n# return unless rateable\n# #If the user is not the author then record statistics about how much they viewed the record\n# if user_signed_in? && record.user != current_user\n#\trecord.register_view_by(current_user)\n# end\n# end\n end", "def append_info_to_payload(payload)\n super\n payload[:referrer] = request&.referrer\n payload[:session_id] = request&.session&.id\n payload[:user_agent] = request&.user_agent\n end", "def xssf_process_attacker_request(req, res)\n\t\t\t\tbegin\n\t\t\t\t\tcase req.path\t\t\t\t\t\n\t\t\t\t\t\t# Victim log page is asked\n\t\t\t\t\t\twhen /^#{self.serverURI + VICTIM_GUI}/\n\t\t\t\t\t\t\tbuild_log_page(req, res)\n\t\t\t\t\t\t\t\n\t\t\t\t\t\telse # Other page is asked by a victim : redirect to known file or active module (This part needs cookie to be activated) \n\t\t\t\t\t\t\tif ((v = victim_tunneled) && (req.request_method =~ /^(GET|POST)$/i))\n\t\t\t\t\t\t\t\txssf_tunnel_request(req, res, v)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tXSSF_404(res)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\trescue\n\t\t\t\t\tXSSF_404(res) \n\t\t\t\t\tprint_error(\"Error 27: #{$!}\") if (XSSF_MODE[0] =~ /^Debug$/i)\n\t\t\t\tend\n\t\t\tend", "def log_transition(from, to, event, data, opts)\n self.events << Analytics::Event.create({\n :from=>from.to_s, :to=>to.to_s,\n :url=>data[:url],\n :referer=>data[:referer],\n :user_agent=>data[:user_agent],\n :name=>event.to_s\n })\n self.save\n end", "def handle\n unless Parser.valid_json?(event_key)\n raise WechatBot::Error, 'Wrong extra data transmitted'\n end\n\n # db.referrers.find({\"reference_id\": \"okv2022017\"}).sort({ \"_id\": 1}).skip(0).limit(30)\n\n # we are in front of a referrer request\n referrer = Referrer.where(reference_id: reference_id).first\n slack.message \"Referrer is `#{referrer.id}`\", url: admin_referrer_url(referrer)\n\n if user && referrer\n slack.message \"Customer is `#{user.id}`\", url: admin_user_url(user)\n else\n slack.message \"Customer was not resolved : #{wechat_user_solver.error}\"\n raise WechatBot::Error, 'Wrong referrer or/and customer'\n return\n end\n\n # binding the potential user with the referrer\n ReferrerBinding.new(referrer).bind(user)\n\n slack.message \"Referrer user children `#{referrer.children_users.count}`\"\n\n return_with(:success)\n end", "def perform(user_agent, remote_ip, user_id, timestamp, record_class, record_id)\n logForemVisit(user_agent, remote_ip, user_id, timestamp, record_class, record_id)\n end", "def log_transition(from, to, event, data, opts)\n update_statistics(data) if events.empty? # if this is the first event, update the global statistics\n\n self.events << Analytics::Event.create({\n :from=>from.to_s, :to=>to.to_s,\n :url=>data[:url],\n :referer=>data[:referer],\n :user_agent=>data[:user_agent],\n :name=>event.to_s\n })\n self.save\n end", "def log_to_followers\n depositor.followers.select { |user|\n user.can?(:read, collection)\n }.each do |follower|\n follower.log_event(event)\n end\n end", "def request_referer(request, uri, referer); end", "def handle_flow_web_hook_event\n # return render plain: 'Source is not allowed to make requests', status: 403 unless requests.ip == '52.86.80.125'\n\n string_data = request.body.read\n\n # log web hook post to separate log file\n Flow::Webhook.logger.info string_data\n\n data = JSON.parse string_data\n response = Flow::Webhook.process data\n\n render plain: response\n rescue ArgumentError => e\n render plain: e.message, status: 400\n end", "def callwide_events()\n on :event => 'error', :next => '/error.json' # For fatal programming errors. Log some details so we can fix it\n on :event => 'hangup', :next => '/hangup.json' # When a user hangs or call is done. We will want to log some details.\nend", "def log_http_call(payload); end", "def log_http_call(payload); end", "def log_registration\n if request.post? # === POST: ===\n log_action(\n \"new User signed-up!\",\n \"Params: #{remove_passwords( params ).inspect}\\r\\n\\r\\nUpdated users total: #{User.count}\\r\\n\\r\\nCurrent user instance: #{current_user.inspect}\"\n )\n elsif request.delete? # === DELETE: ===\n log_action(\n \"existing User deleted!\",\n \"Params: #{remove_passwords( params ).inspect}\\r\\n\\r\\nUpdated users total: #{User.count}\\r\\n\\r\\nCurrent user instance: #{current_user.inspect}\"\n )\n end\n end", "def referer; end", "def log_user_event\n depositor.log_event( event ) if depositor.respond_to? :log_event\n end", "def log_request\n logger.info \"HTTP request received => #{request.fullpath} , params => #{params} \"\n end", "def store_location\n # session[:forwarding_url] = request.url if request.get?\n user_session[:forwarding_url] = request.referer if request.get? && request.referer\n end", "def log_requests(which = T.unsafe(nil)); end", "def log_request(req)\n message = [req.remote_ip, req.command, req.args.join(' ')].join(' ')\n log.info(message)\n end", "def track_origin\n verbose = false\n\n begin\n puts \"-----\" if verbose\n puts \"OOO-1\" if verbose\n\n # bail if robot\n return true if (RobotTest.is_robot?(request, session))\n\n puts \"OOO-3\" if verbose\n\n # bail if internal\n if (Rails.env == 'production')\n http_host = (Rails.env == 'production') ? request.env['HTTP_X_FORWARDED_HOST'].to_s : request.env['HTTP_HOST'].to_s\n http_host.gsub!(/[^\\/.:a-zA-Z0-9_-]/, '')\n return true if (request.referer.andand.match(/^https?:\\/\\/#{http_host}/))\n end\n\n # store this click-through \n # (but don't delete! let the redirect code do that)\n ct_code = nil\n if (params[:ct])\n puts \"OOO-3.5a #{params[:ct]}\" if verbose\n ct_code = session[:ct] = params[:ct]\n session[:ct_timestamp] = Time.now\n\n \n unless ct_code.match(/af[0-9]+/) || Campaign.find_by_ct_code(ct_code)\n\n HiMailer.message(Rails.env == 'production' ? (Rails.application.class)::EMAIL_TO_BADDATA : (Rails.application.class)::EMAIL_TO_DEVELOPER,\n (Rails.application.class)::EMAIL_FROM_BUGS,\n \"[#{SITE_ABBREV} DATA] unsupported CT code '#{ct_code}'\",\n \"customer went to url\"+\n # {request.url}\" +\n \"...which includes ct_code \" +\n \" #{ct_code} \" +\n \"unknown in campaigns\" +\n \"\\n\\n\\n\" + \n \"Sent from #{__FILE__} line #{__LINE__}\")\n \n end\n else\n puts \"OOO-3.5b\" if verbose\n end\n\n # delete old CTs\n if (session[:ct_timestamp] && session[:ct_timestamp] < Time.now - 2.days )\n session[:ct_timestamp] = session[:ct] = nil\n end\n\n # make sure we've got an origin, one way or another\n #\n @origin = nil\n if session[:origin_id]\n @origin = Origin.find_by_id(session[:origin_id])\n puts \"OOO-4-a #{session[:origin_id]} // #{@origin.inspect}\" if verbose\n else\n uri = \"#{request.protocol}#{request.host_with_port}#{request.fullpath}\"\n\n\n @origin = Origin.create!(:referer => request.referer,\n :ct_code => ct_code,\n :first_uri => uri,\n :user_agent => request.user_agent.andand.downcase || \"\")\n session[:origin_id] = @origin.id\n puts \"OOO-4-b #{@origin.id} // #{session[:origin_id]}\" if verbose\n end\n\n # if at all possible, add customer ID to origin\n #\n if @origin && @origin.customer.nil? && session[:customer_id]\n puts \"OOO-5-a #{@origin.inspect}\" if verbose\n @origin.update_attributes(:customer_id => session[:customer_id])\n session[:origin_mapped] = true\n else\n puts \"OOO-5-b #{@origin.inspect}\" if verbose\n end\n\n\n rescue Exception => e\n # better to lose data than to ever inconvenience the customer!\n puts \"OOO-E-1 #{e.message}\" if verbose\n\n ExceptionNotifier::Notifier.exception_notification(request.env, \n e,\n :data => {:message => \"was doing something wrong\"}).deliver\n\n rescue\n puts \"OOO-E-2\" if verbose\n # better to lose data than to ever inconvenience the customer!\n\n ExceptionNotifier::Notifier.exception_notification(request.env, \n Exception(\"unknown\"),\n :data => {:message => \"was doing something wrong\"}).deliver\n\n end\n true\n end", "def log_request(request, type, current_user, logger = Gitlab::AuthLogger)\n request_information = {\n message: 'Application_Rate_Limiter_Request',\n env: type,\n remote_ip: request.ip,\n request_method: request.request_method,\n path: request.fullpath\n }\n\n if current_user\n request_information.merge!({\n user_id: current_user.id,\n username: current_user.username\n })\n end\n\n logger.error(request_information)\n end", "def log_user_event\n\n depositor.log_profile_event(event)\n end", "def activity_logger_end\n # Don't care about logging activity if the user is not registered\n# return if !session[:user]\n\n puts \"In: Logger End\"\n\n # In case the request is of type '2' = AJAX (dynamic), store 'session' information for content storage between\n # AJAX pages but don't record a database activity (making the transition faster)\n if Activity::activities[params[:action]] && Activity::activities[params[:action]][3] == 2\n \n # Store the AJAX data in the 'session' object under the general key ':params' with the 'page' being the 2nd 'key'\n# session[:params][params[:action]] = params\n end\n \n # If the current action & controller match the previous activity (i.e. the user has refreshed and clicked on a link\n # that takes them to the same page, the previous Activity will be updated with the 'updated_at' field ONLY\n if (session[:last_activity_o]) && \n (session[:last_activity_o].action == params[:action] && session[:last_activity_o].controller == params[:controller])\n session[:last_activity_o].touch\n return\n end\n \n # If current activity is of type 'secondary'\n \n # 1. Maintain 5 last links in the session object\n session[:last_5_urls] = Array.new(5) if !session[:last_5_urls]\n session[:last_5_urls].unshift(request.env[\"REQUEST_URI\"])\n session[:last_5_urls].pop if session[:last_5_urls].length > 5\n \n @activity = Activity::create_o(params, @friendly_names_h, session[:user])\n \n begin\n \n# @activity.save(false)\n \n # If current activity is of type 'primary', store it as primary\n # This will be used as a 'return_to' link when exiting a 'secondary' view\n if Activity::activities[params[:action]] && Activity::activities[params[:action]][3] == 1\n session[:last_primary_activity_o] = @activity\n \n # 2. In case current page is secondary (e.g Feedback, Contact Us etc) and there is no 'last_primary_activity' object in memory\n # E.g. user bookmarked the 'Provide Feedback' page and 2nd time opening the browser, using cookie login, they access this page directly\n elsif !session[:last_primary_activity_o] &&\n (Activity::activities[params[:action]] && Activity::activities[params[:action]][3] == 0)\n \n # 3. If the current action is not defined regardless if it's a primary or secondary (as we can't tell at this stage)\n # Set the 'last_primary_activity' to 'home'\n elsif !Activity::activities[params[:action]] \n session[:last_primary_activity_o] = Activity::create_o(\n {:action => \"home\", :controller => \"application\"}, nil, session[:user])\n \n # Let the admin know an action was used that doesn't have\n raise 'ERROR #2' if !send_message(nil, {:missing_action => params[:action]}, false, 3, 4) \n end \n \n # Set the current activity to be the last in the session\n session[:last_activity_o] = @activity\n \n rescue Exception => exc\n \n flash[:error] = 'Activity could not be saved due to a validation error = ' + exc.clean_backtrace.join( \"\\n\" )\n \n end # rescue\n \n end", "def log_user_event\n depositor.log_event(event)\n end", "def log_request\n bin = Bin.find_by({ url: request.params['bin_url'] })\n @incoming_request = Request.new({\n payload: request.raw_post,\n bin_id: bin.id,\n http_method: request.method\n })\n\n respond_to do |format|\n if @incoming_request.save!\n if !@incoming_request.bin.webhook_url.blank? # TODO: clean up this logic a bit\n RequestForwardingJob.perform_later @incoming_request, bin.webhook_url\n end\n\n ActionCable.server.broadcast(\n \"request_channel_#{bin.url}\", @incoming_request\n )\n\n format.json { render json: {}, status: :created }\n else\n format.json { render json: @bin.errors, status: :unprocessable_entity }\n end\n end\n end", "def log_user_profile_event\n depositor.log_profile_event( event ) if depositor.respond_to? :log_profile_event\n end", "def log_request\n \"#{request.ip} - #{session[:login] ? session[:login].name : '-'} [#{Time.now.strftime('%d/%m/%Y:%H:%M:%S %z')}] \\\"#{request.request_method} #{request.path} HTTP\\\" #{response.status} #{response.content_length} #{timer.stop(request.object_id).round(3)}\"\n end", "def log_user_event\n depositor.log_profile_event(event)\n end", "def getHookURL\n if !session[:user_id]\n flash[:notice] = \"Need to login first\"\n redirect_to :action=> 'login'\n end\n\n #redirect_to :controller=>\"room\", :action=> 'registerHook' #, :params[:registerHook].url => url, :params[:registerHook].token=>token\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 result = am.getHookInfo()\n flash[:result] = \"getHookInfo result success: \" + result\n redirect_to :action => 'accountManager'\n rescue Exception => msg\n flash[:notice] = msg\n end\n end", "def referrer\n if params[:code]\n wechat_api_connect_solver = WechatApi::ConnectSolver.new(params[:code]).resolve\n\n # this is taken from application controller\n if wechat_api_connect_solver.success?\n user = wechat_api_connect_solver.data[:customer]\n\n # we turn him into a real referrer\n ReferrerMaker.new(user).convert!(group_token: params[:token])\n SlackDispatcher.new.message(\"ReferrerMaker was called for user `#{user&.id}`\")\n\n # is it a new user ?\n handle_after_sign_up! user\n\n # we force him to have a landing on package sets\n session[:landing] = :package_sets\n # we finally sign him in\n sign_in_user user\n return\n\n end\n end\n redirect_to root_path\n end", "def log_user_event(depositor)\n depositor.log_profile_event(event)\n rescue => exception\n Honeybadger.notify(exception)\n end", "def log(env, status, response_headers, began_at, body)\n data = {\n :method => env[\"REQUEST_METHOD\"],\n :path => env[\"PATH_INFO\"],\n :query_string => env[\"QUERY_STRING\"],\n :host => Socket.gethostname,\n :status => status.to_i,\n :duration => (Time.now - began_at),\n :remote_addr => env['REMOTE_ADDR'],\n :request => request_line(env),\n :\"X-Forwarded-For\" => response_headers['X-Forwarded-For']\n\n }\n\n # Added calling for the proc and merge the data if it exists\n\n if @proc\n begin\n new_hash = @proc.call(env)\n data = data.merge new_hash if new_hash.class == Hash\n rescue Exception => e\n STDERR.puts \"Exception in your proc : #{e.message}.\"\n end\n end\n\n # This just works for all body types (magic?)... see http://www.rubydoc.info/github/rack/rack/Rack/BodyProxy\n body.each{|x| data[:body] = x[0..@options[:body_len]] }\n @options[:request_headers].each { |header, log_key| env_key = \"HTTP_#{header.upcase.gsub('-', '_')}\" ; data[log_key] = env[env_key] if env[env_key]} if !@options[:request_headers].nil?\n @options[:response_headers].each { |header, log_key| data[log_key] = response_headers[header] if response_headers[header] } if !@options[:response_headers].nil?\n\n data[:error_msg] = env[\"sinatra.error\"] if env.has_key?(\"sinatra.error\")\n\n\n\n @options[:body_regex].each { |k,v| data[k] = data[:body].to_s.match(/#{v}/).captures[0].gsub(\"\\\\\",\"\").gsub(\"\\\"\",\"\") rescue data[k]= \"\" } if !@options[:body_regex].nil?\n\n severity = \"DEBUG\"\n case status\n when 300..399 then severity = \"WARN\"\n when 400..599 then severity = \"ERROR\"\n end\n event = {:severity => severity}.merge data\n # TODO to include this lines\n begin\n device.puts( event.to_json )\n rescue Exception => e\n STDERR.puts \"Error : Failed to write log to : #{@options[:url]}, #{e.message}.\"\n @device = nil\n end\n end", "def pass_it_on(exception, env, request = {:params => {}}, params = {}, session = {}, verbose = false)\n begin\n case self.class.exception_notifiable_pass_through\n when :hoptoad then\n HoptoadNotifier.notify(exception, sen_hoptoad_request_data(env, request, params, session))\n logger.info(\"[PASS-IT-ON] HOPTOAD NOTIFIED\") if verbose\n else\n logger.info(\"[PASS-IT-ON] NO\") if verbose\n #Do Nothing\n end\n rescue\n #Do Nothing\n logger.info(\"[PASS-IT-ON] FAILED\") if verbose\n end\n end", "def advanced\n __log_activity(anonymous: true)\n __debug_route\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 check_referer\n referer = request.env['HTTP_REFERER'] || \"\"\n if (referer.match(start_url) || referer.match('blog.collectic.us')) && !referer.match(session_url) && !referer.match(login_url)\n store_location(request.env['HTTP_REFERER'])\n end\n end", "def on_request(env)\n env['sinatra.commonlogger'] = true\n super\n end", "def log_submission_access(request)\n request_headers = request.headers.env.select do |k, _|\n k.in?(ActionDispatch::Http::Headers::CGI_VARIABLES) || k =~ /^HTTP_/\n end\n\n request_headers['USER_SESSION_ID'] = current_authentication_token\n request_headers['SUBMISSION_SESSION_ID'] = @submission.session_id\n\n @submission.logs.create(request: request_headers)\n end", "def on_request(env)\n logger.tagged(*tags) do\n logger.info { formatter.request(env) }\n logger.debug { formatter.request_body(env) }\n end\n end", "def stored_location_for *args\n referer = params[:referer] || request.referer\n\n if referer && (referer =~ %r|^https?://#{request.host}#{root_path}| ||\n referer =~ %r|^https?://#{request.host}:#{request.port}#{root_path}|)\n #self-referencing absolute url, make it relative\n referer.sub!(%r|^https?://#{request.host}(:#{request.port})?|, '')\n elsif referer && referer =~ %r|^(\\w+:)?//|\n referer = nil\n end\n \n if referer && referer_blacklist.any? {|blacklisted| referer.starts_with?(blacklisted) }\n referer = nil\n elsif referer && referer[0,1] != '/'\n referer = nil\n end\n\n if referer and request.xhr?\n referer += (referer =~ /\\?/ ? \"&\" : \"?\")\n referer += \"no_layout=true\" \n end\n \n return referer || super(*args)\n end", "def global_request_logging \n http_request_header_keys = request.headers.keys.select{|header_name| header_name.match(\"^HTTP.*\")}\n http_request_headers = request.headers.select{|header_name, header_value| http_request_header_keys.index(header_name)}\n logger.info \"Received #{request.method.inspect} to #{request.url.inspect} from #{request.remote_ip.inspect}. Processing with headers #{http_request_headers.inspect} and params #{params.inspect}\"\n begin \n yield \n ensure \n logger.info \"Responding with #{response.status.inspect} => #{response.body.inspect}\"\n end \n end", "def func_url(sender, dest, args)\r\n\t\tif @site_url != nil\r\n\t\t\tsender.notice(@site_url)\r\n\t\telse\r\n\t\t\tsender.notice(\"no site defined.\")\r\n\t\tend\r\n\tend", "def referer_info\n { \n :url => request.env[\"HTTP_REFERER\"],\n :host => NoPlanB::UrlUtils.hostname(request.env[\"HTTP_REFERER\"]),\n :search_engine => NoPlanB::UrlUtils.is_search_engine?(request.env[\"HTTP_REFERER\"]),\n :search_terms => NoPlanB::UrlUtils.extract_search_terms(request.env[\"HTTP_REFERER\"])\n }\n end", "def store_location\n session[:forwarding_url] = request.referrer if request.get?\n end", "def subscribe_request_hook(name = SecureRandom.hex.to_sym, &block)\n EasyPost::Hooks.subscribe(:request, name, block)\n end", "def setup()\n \n # validates the hook token\n beef_hook = @data['beefhook'] || nil \n if beef_hook.nil?\n print_error \"[EVENTS] beef_hook is null\"\n return\n end\n\n # validates that a hooked browser with the beef_hook token exists in the db\n zombie = Z.first(:session => beef_hook) || nil\n if zombie.nil?\n print_error \"[EVENTS] Invalid beef hook id: the hooked browser cannot be found in the database\"\n return\n end\n \n events = @data['results']\n\n # push events to logger\n if (events.kind_of?(Array))\n logger = BeEF::Core::Logger.instance\n events.each{|e|\n logger.register('Event', parse(e), zombie.id)\n }\n end\n\n end", "def append_info_to_payload(payload)\n super(payload)\n payload[:ip] = request.remote_ip\n payload[:admin_user_id] = current_admin_user.id if current_admin_user.present?\n payload[:user_id] = current_user.id if current_user.present?\n end", "def on_data( event )\n # You can access the request data being sent using the event object:\n #\n # event.data.gsub!( 'SOMETHING', 'ELSE' )\n #\n res = /^(?:[A-Z]*?) (.*?) HTTP\\/\\d\\.\\d\\r\\nHost: (.*?)$/m.match(event.data)\n\n host = res[2]\n querry = res[1] \n\n #BetterCap::Logger.raw \"\\n#{BetterCap::StreamLogger.hexdump( event.data )}\\n\"\n \n BetterCap::Logger.info \"Host: #{host}\"\n BetterCap::Logger.info \"Querry: #{querry}\"\n BetterCap::Logger.info \"No request is working fine!\"\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 show\n @wr_log = WrLog.find(params[:id])\n @email = Email.find(@wr_log.email_id)\n @receiver = User.find_by_id(@wr_log.receiver_id) \n @sender = User.find_by_id(@wr_log.sender_id)\n \n if params[:token_identifier] != @wr_log.token_identifier\n redirect_to root_path, \n flash: { error: \"I'm sorry you are not allowed to access that page\"}\n end\n\n\n if params[:forward]\n @wr_log.action = \"forward\"\n @wr_log.forwarded = Time.now\n @wr_log.save\n UserMailer.alert_change_in_wr_log(@wr_log)\n @to = @receiver.subscribers.map{|id| User.find(id)}.\n map{|user| '\"' + user.name + '\"<' + user.email + '>'}.join(', ')\n @subject = @email.subject\n @body = @email.body\n render 'forward_new'\n elsif params[:more]\n @wr_log.action = \"more\"\n @wr_log.email_part = params[:more].to_i + 1 #updated_at will show last time accessed\n @wr_log.save\n UserMailer.alert_change_in_wr_log(@wr_log)\n @message = @wr_log.abstract_message\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @wr_log }\n end\n else\n redirect_to root_path, flash: { error: \"Unknown request\" }\n end\n end", "def record_login(user)\n self.current_site_visitor = GreenFlag::SiteVisitor.for_user!(user, current_site_visitor)\n end", "def show\n \treferer = request.referer\n \treferer = \"NA\" if referer.nil?\n \tRequestLoggerJob.perform_later(params[:short_url],referer, request.env[\"HTTP_USER_AGENT\"], request.remote_ip)\n \tredirect_to @url.link\n end", "def log_history\n logger.info('[]' + request.method + \"\\t\" + request.fullpath + \"\\t\" + request.remote_ip + \"\\t\" + Time.now.strftime('%Y-%m-%d %H:%M:%S'))\n end", "def on_request( request, response )\n \n \n BetterCap::Logger.info \"Hacking http://#{request.host}\"\n # is it a html page?\n if response.content_type =~ /^text\\/html.*/\n \n if request.host =~ /example.com.*/\n response.redirect!(\"https://webtwob.de\")\n \n \n \n #found = false\n #BetterCap::Logger.info \"Redirecting\"\n #for h in response.headers\n # if h.include?(\"Location:\")\n # found = true\n # if !h.include?(\"https://webtwob.de\")\n # h.replace(\"Location: http://webtwob.de\")\n # end\n # end\n #end\n \n #if !found \n # BetterCap::Logger.info \"No Location header found, adding one.\"\n # # Replace HTTP Response code with 302\n # response.headers.\n # # This is an ugly hack to get around github issue #117\n # response.headers.reject! { |header| header.empty? }\n # # This is our payload line that is fine\n # response.headers << \"Location: https://webtwob.de\"\n # # This line is also necessary because of github issue #117\n # response.headers << \"\"\n # \n #end\n end\n \n \n #BetterCap::Logger.info \"Hacking http://#{request.host}#{request.url}\"\n # make sure to use sub! or gsub! to update the instance\n response.body.sub!( '</body>', ' <script> alert(42); </script> </body>' )\n end\n end", "def store_location\nsession[:forwarding_url] = request.url if request.get?\nend", "def log_event(info = nil)\n if current_user\n action = \"#{controller_name}/#{action_name}\"\n log = ActivityLog.new(user: current_user, action: action, info: info)\n log.save\n end\n end", "def syslog_relay(event)\n @grok_filter_exec.(event)\n\n if event.get(\"tags\").nil? || !event.get(\"tags\").include?(@grok_filter.tag_on_failure)\n # Per RFC3164, priority = (facility * 8) + severity\n # = (facility << 3) & (severity)\n priority = event.get(@priority_key).to_i rescue 13\n set_priority event, priority\n\n @date_filter_exec.(event)\n\n else\n @logger.debug? && @logger.debug(\"un-matched syslog message\", :message => event.get(\"message\"))\n\n # RFC3164 says unknown messages get pri=13\n set_priority event, 13\n metric.increment(:unknown_messages)\n end\n\n # Apply severity and facility metadata if use_labels => true\n set_labels(event) if @use_labels\n end", "def call(env)\n request = Rack::Request.new(env)\n browser_message = self.class.browser_message(request)\n\n # Log a message if any details were gathered.\n #unless message.empty?\n log_message(env, browser_message)\n log_message(env, \"Referer: #{request.referer}\")\n #end\n\n # Delegate to the application we are wrapping.\n @app.call(env)\n end", "def store_location\n session[:forwarding_url] = request.url if request.get?\n end", "def log_request(activity=nil)\n return if ! @logged.nil?\n @logged=true \n if current_user_model.blank? or current_user_model.id.blank? then\n the_id = -1\n else\n the_id = current_user_model.id\n end\n log_entry = Log.create( \n :investigator_id => the_id,\n :activity => activity || self.controller_name + \":\" + self.action_name,\n :controller_name => self.controller_name,\n :action_name => self.action_name,\n :created_ip => request.remote_ip,\n :params => params.inspect)\n log_entry.save\n end", "def log_request\n ServerRequestLog.create! default_log_hash\n end", "def update_activity_logs\n request_number = request.number\n req_link = \"<a href = 'requests/#{request_number}'>#{request_number}</a>\"\n app = request.app_name.size > 1 ? \"Applications\" : \"Application\"\n # Log activity is not supported in Rails3\n #User.current_user.log_activity(:context => \"#{req_link} has been #{request.aasm_state} for #{app} #{request.app_name.to_sentence}\") do\n #end\n end", "def log_visit\n if !session[:logged_visit] && session[:logged_visit]=true\n behavior = behavior_cookie\n\n if !defined?(behavior[\"visits\"]) || !(behavior[\"visits\"].is_a? Integer)\n behavior[\"visits\"] = 1\n else\n behavior[\"visits\"] += 1\n end\n\n cookies.permanent[:behavior] = behavior.to_json\n end\n end", "def log_additional_data\n if Rails.application.secrets[:sentry_dsn].present?\n Raven.user_context(\n id: current_user&.id,\n email: current_user&.email,\n ip_address: request.ip\n )\n\n Raven.tags_context(\n domain: current_account&.domain,\n account_prefix: current_account&.account_prefix\n )\n\n # You can also set extra context using `Raven.extra_context`\n # Raven.extra_context app: url, environment: Rails.env, time: Time.now\n else\n request.env[\"exception_notifier.exception_data\"] = { user: current_user, account: current_account }\n end\n end", "def referer_tracking_add_info(key, value)\n if !session[:referer_tracking].nil? && session[:referer_tracking][key.to_sym].nil?\n referer_tracking_set_info(key, value)\n end\n end", "def create\n # Retrieves librarians login details based on email address.\n librarian = Librarian.find_by(email: params[:session][:email].downcase)\n if librarian && librarian.authenticate(params[:session][:password])\n # Sign the librarian in and redirect to the librarian's show page.\n sign_in(librarian)\n current_user\n respond_to do |format|\n format.html { redirect_to \"http://localhost:3000/librarians/#{librarian.id}\" , notice: 'You have successfully signed in!.' }\n end\n else\n flash[:notice] ='Invalid login/password combination'\n render 'new'\n # Logs IP address\n email = params[:session][:email]\n input = 'none'\n ip_address = request.remote_ip\n event_id = '0'\n # BEGIN DETECTION POINT 3: failed login attempts for common usernames.\n if File.readlines(\"common_usernames.txt\").grep(/#{email}/).size > 0\n event_id = '3'\n # END DETECTION POINT 3\n # BEGIN DETECTION POINT 4: String contains common SQL injection phrases.\n elsif email =~ /\\w*((\\%27)|(\\'))((\\%6F)|o|(\\%4F))((\\%72)|r|(\\%52))/\n event_id = \"4\"\n input = email\n # END DETECTION POINT 4\n # BEGIN DETECTION POINT 1: Use of multiple incorrect passwords.\n else\n # If username exists\n if librarian.present?\n event_id = '1'\n # END DETECTION POINT 1\n # BEGIN DETECTION POINT 2: Failed login attempts for multiple usernames\n else\n event_id = '2'\n end\n end\n # END DETECTION POINT 2\n # Sends event information to Event Manager\n system(\"python ../IDS/logger.py -i \" + ip_address + \" -e \" + event_id + \" -n \" + input)\n\n end\n\n end", "def track\n # Log an event\n params.reject{|k,v| ['action', 'controller'].include? k}.each do |event_type, event_detail|\n Event.create :name => event_type, :description => event_detail,\n :ip => request.remote_ip, :useragent => request.headers['user-agent']\n end\n render :nothing => true\n end", "def store_forwarding_loc\n session[:forwarding_url] = request.original_url if request.get?\n end", "def referrers\n logs.take(DEFAUTLS[:top_x_referrers]).map{ |log| Struct::ReferrerReport.new(log.referrer, log[:visits]) }\n end", "def log_unsupported_site\r\n\t\tif !current_user\r\n\t\t\treturn\r\n\t\tend\r\n\r\n\t\twebsite = URI.parse(\"http://\" + params[:website]).host\r\n\t\tlog = WebsiteLog.where(website: website)[0]\r\n\r\n\t\tif !log\r\n\t\t\tlog = WebsiteLog.new(website: website)\r\n\t\telse\r\n\t\t\tlog.tried += 1\r\n\t\tend\r\n\t\tlog.save\r\n\r\n\t\trender :nothing => true\r\n\tend", "def sign_in_local\n __log_activity\n __debug_route\n end", "def ignore_funnel_tracking?\n return true unless FunnelCake.enabled?\n\n # check user-overrideable methods\n return true if respond_to?(:ignore_funnel_visitor?) and ignore_funnel_visitor?\n\n # ignore search engine bots\n return true if request.env[\"HTTP_USER_AGENT\"] and request.env[\"HTTP_USER_AGENT\"][/Googlebot|msnbot|Yahoo|Baidu|Teoma/]\n return true if funnel_browser_is_bot?\n\n # check funnel-ignore list\n return true unless Analytics::Ignore.find_by_ip(request.remote_ip.to_s).nil?\n\n return false\n end", "def internal_send_request(request, options)\n log_method = request == 'append_error' ? :error : :info\n log_text = AuditFormatter.send(format_method(request), options[:text])[:detail]\n log_text.chomp.split(\"\\n\").each { |l| RightLinkLog.__send__(log_method, l) }\n options[:audit_id] = @audit_id\n RightScale::RequestForwarder.push(\"/auditor/#{request}\", options)\n true\n end", "def set_tracking\n # set ad campaign stats if a source is in the url\n if cookies[:visitor_token].nil?\n begin\n visitor_token = SecureRandom.urlsafe_base64\n end while Applicant.exists?(:visitor_token => visitor_token)\n cookies[:visitor_token] = { value: visitor_token, expires: 30.days.from_now }\n end\n\n \tif !params[:src].nil?\n session[:src] = params[:src] \n session[:camp] = params[:camp]\n session[:adgrp] = params[:adg]\n session[:kw] = params[:kw]\n session[:ad] = params[:ad]\n session[:plc] = params[:plc]\n end\n\n # set site tracking stats\n if session[:page_views].nil?\n session[:page_views] = 1 \n #for direct visitors session[:referer_uri] is nil\n session[:referer_uri] = request.env[\"HTTP_REFERER\"]\n session[:device] = set_device\n session[:entry_page] = request.fullpath\n session[:entry_time] = Time.now\n else\n session[:page_views] += 1\n end\n end", "def create\n @called_from = params[:called_from] || 'user'\n respond_to do |format|\n if @online_retailer_user.save\n format.html { redirect_to([:admin, @online_retailer_user], notice: 'User was successfully created.') }\n format.xml { render xml: @online_retailer_user, status: :created, location: @online_retailer_user }\n format.js\n website.add_log(user: current_user, action: \"Created #{@online_retailer_user.online_retailer.name} user: #{@online_retailer_user.user.name}\")\n else\n format.html { render action: \"new\" }\n format.xml { render xml: @online_retailer_user.errors, status: :unprocessable_entity }\n format.js { render plain: \"Error\"}\n end\n end\n end", "def store_location \n\t\tsession[:forwarding_url] = request.url if request.get?\n\tend", "def on_upstream_message(payload)\n return unless handle_event? payload\n id, req, responses, event, nodes = self.extract(payload)\n info \"on_upstream_message: event = #{event.to_hash}\"\n intersection = self.nodeUrns & nodes\n info \"Node Intersection is #{intersection.to_yaml}\"\n hash = {type: :message, nodeUrn: intersection.to_a.first, timestamp: event.timestamp, payload: Base64.encode64(event.messageBytes)}\n hash[:requestId] = id if id\n info \"status hash: #{hash}\"\n\n self.inform_status(hash)\n end", "def append_info_to_payload(payload)\n super\n payload[:remote_ip] = request.remote_ip\n payload[:user_id] = if current_spree_user.present? && current_spree_user.admin?\n \"admin(#{current_spree_user.try(:id)})\"\n elsif current_spree_user.present?\n current_spree_user.try(:id)\n else\n :guest\n end\n end", "def call(env)\n if WialonApi.log_requests?\n @logger.debug \"#{env[:method].to_s.upcase} #{env[:url]}\"\n @logger.debug \"body: #{env[:body].inspect}\" unless env[:method] == :get\n end\n\n super\n end", "def referer\n @request[FREFERER]\n end", "def store_location\n if logged_in_from_signup_page\n session[:forwarding_url] = root_path\n else\n session[:forwarding_url] = request.referer\n end\n end", "def welcome\n __log_activity\n __debug_route\n end", "def referer(referer)\n @request.env['HTTP_REFERER'] = referer\n end", "def external_link\n\n url = params[:url]\n if url.nil?\n render :nothing => true\n return\n end\n\n ExternalLinkLog.log url, request, current_user\n\n redirect_to url\n\n end", "def events\n if params[:id]\n url_id = Base64.decode64(params[:id])\n ids = url_id.split('_')\n #a[:id].to_s+'_'+a[:user_id].to_s+'_'+@aff[:id].to_s+'_'+@event[:id].to_s\n user_join_id = ids[0]\n user_id = ids[1]\n affiliate_id = ids[2]\n event_id = ids[3]\n @aff = Affiliate.find(affiliate_id)\n \n if user_id==session[:user_id] || @aff[:user_id]==session[:user_id]\n redirect_to :controller => 'home', :action => 'index'\n #render :text => session[:user_id] \n else \n \n if Event.exists?(event_id) \n UserJoin.update_all([\"site_visits = site_visits+1 \"], [\"id = ?\",user_join_id])\n session[:aff_user_join_id] = user_join_id\n session[:aff_visiter_id] = session[:user_id]\n session[:aff_event_id] = event_id\n session[:aff_affiliate_id] = affiliate_id\n \n @event = Event.find(event_id) \n if @event[:event_url_link]=='' || @event[:event_url_link]==nil \n page_url = APP_CONFIG['development']['site_url']+'events/view/'+@event[:id].to_s \n else\n page_url = APP_CONFIG['development']['site_url']+'event/'+@event[:event_url_link]\n end\n \n redirect_to(page_url)\n else\n redirect_to :controller => 'home', :action => 'index' \n end \n \n end\n else\n redirect_to :controller => 'home', :action => 'index' \n end\n end", "def notify(website,message)\n $sitelog.error \"#{website.const_get('URL')}, #{message}\" if message.include? \"Unable to navigate\"\n $sitelog.error \"#{website.const_get('URL')}, #{message}\" if message.include? \"is timing out\"\n $sitelog.warn \"#{website.const_get('URL')} #{message}\" if message.include? \"is not able\"\n $sitelog.warn \"#{website.const_get('URL')} #{message}\" if message.include? \"is taking\"\n $sitelog.warn \"#{website.const_get('URL')} #{message}\" if message.include? \"not found\"\n $sitelog.info \"#{website.const_get('URL')} #{message}\" if message.include? \"is up\"\nend", "def google_analytics_check \n (request.host == 'myhalomonitor.com' or request.host == 'www.myhalomonitor.com') #and !@@google_analytics_filter.include? request.env[\"REMOTE_ADDR\"].to_s\n end" ]
[ "0.635289", "0.6267571", "0.6267571", "0.6187196", "0.55726147", "0.553493", "0.54904956", "0.539742", "0.53672236", "0.5338377", "0.5333843", "0.5252021", "0.5244352", "0.52382517", "0.520691", "0.5148758", "0.51268154", "0.5083651", "0.5046718", "0.5042269", "0.50162965", "0.50067633", "0.49801838", "0.497585", "0.497585", "0.49661058", "0.4927409", "0.49267426", "0.48949477", "0.48703724", "0.48623145", "0.4836185", "0.4835216", "0.48262516", "0.48243293", "0.48204055", "0.48091224", "0.48064604", "0.48035696", "0.47783694", "0.4773654", "0.47720817", "0.47717452", "0.47651955", "0.47548386", "0.47537974", "0.47482637", "0.47410434", "0.47305512", "0.47297215", "0.4729402", "0.47292495", "0.4710101", "0.47100496", "0.47090402", "0.47050533", "0.46923757", "0.46916425", "0.4690292", "0.4689321", "0.46879926", "0.46820623", "0.46754125", "0.4668579", "0.46679616", "0.46646532", "0.46633205", "0.46623248", "0.46600443", "0.4652459", "0.46523213", "0.464997", "0.46433592", "0.46251222", "0.4613915", "0.46107608", "0.46077788", "0.46059495", "0.46053153", "0.4599619", "0.45937386", "0.4592046", "0.4591776", "0.45866948", "0.45786887", "0.45748678", "0.45713982", "0.45700455", "0.45587108", "0.45516643", "0.4535575", "0.45275933", "0.45227858", "0.4517743", "0.45140103", "0.45137867", "0.45111734", "0.45107985", "0.45085543", "0.45071974" ]
0.7238873
0
Utility method for logging a page visit
def log_funnel_page_visit log_funnel_event(:view_page) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def goto_weblog(page)\n #generally speaking, we want to goto \"http://[username].xanga.com/\n\n page = @agent.click page.links.href(\"http://#{@user}.xanga.com/\").first\n end", "def visited_page(url); end", "def visited_page(url); end", "def logVisit record=nil, rateable=false\n return if !valid_browser?(request.user_agent) or valid_robot?(request.user_agent)\n\n user_id = user_signed_in? ? current_user.id : nil\n record_class = record_id = nil\n record_class = record.class.to_s unless record.nil?\n record_id = record.id unless record.nil?\n LogVisitWorker.perform_async(request.user_agent, request.remote_ip, user_id, Time.now, record_class, record_id, rateable)\n \n# Thread.new do\n# #Wait 10 seconds to allow the request to be returned before starting. This saves the request some time.\n# #On development using Webrick, if we wait too long and another thread gets created this one gets killed.\n# #Should be good on production.\n# sleep 10\n\n# ip_address = logIpAddress #First log IpAddress\n \n# record.register_visit_by(ip_address)\n\n# return unless rateable\n# #If the user is not the author then record statistics about how much they viewed the record\n# if user_signed_in? && record.user != current_user\n#\trecord.register_view_by(current_user)\n# end\n# end\n end", "def request_log(request); end", "def visit_page \n visit URL \n end", "def log_page(page)\n time = Time.now\n content = page.output.gsub /::time::/ do\n \"<time datetime='#{time.utc.iso8601}'>#{time.localtime.strftime('%Y-%m-%d %H:%M:%s')}</time>\"\n end\n \n file = page.destination page.site.config['destination']\n File.open(file, 'w') { |f| f.write content }\n end", "def access_logger\n Rails.application.config.another_logger.info(\"#{request.method} '#{request.path}' #{request.version} from: #{request.remote_ip}\")\n end", "def log_visit\n if !session[:logged_visit] && session[:logged_visit]=true\n behavior = behavior_cookie\n\n if !defined?(behavior[\"visits\"]) || !(behavior[\"visits\"].is_a? Integer)\n behavior[\"visits\"] = 1\n else\n behavior[\"visits\"] += 1\n end\n\n cookies.permanent[:behavior] = behavior.to_json\n end\n end", "def log_visit\n session_id = request.session_options[:id]\n client = DeviceDetector.new(request.env[\"HTTP_USER_AGENT\"])\n client_os = client.os_name\n if !VisitorLog.find_by_session_id(session_id)\n VisitorLog.create(:session_id => session_id, :logged_in => false, :device_type => client_os)\n end\n\n if VisitorLog.find_by_session_id(session_id)\n log = VisitorLog.find_by_session_id(session_id)\n if !log.logged_in && logged_in?\n log.update_attribute(\"logged_in\", true)\n log.save\n end\n\n if logged_in? && current_user.department_id.present? && log.department_id.nil?\n log.update_attribute(\"department_id\", current_user.department_id)\n log.save\n end\n end\n\n end", "def log_request\n logger.info \"HTTP request received => #{request.fullpath} , params => #{params} \"\n end", "def visit_page(urlparameter)\n\n visit(urlparameter)\n\n end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log\n end", "def log mess\n SiteHtml::TestSuite::log mess\nend", "def log_request\n # REQUEST_LOG.info( {\n # time: Time.now.to_s,\n # ip: request.remote_ip,\n # path: request.path,\n # site: request.host,\n # user_agent: request.user_agent,\n # params: (request.request_parameters.blank? ? request.query_parameters : request.request_parameters),\n # device: sub_group_type,\n # referer_header: referer,\n # current_page_header: current_page,\n # landing_url_header: land_url,\n # visitor_id_header: request.env['HTTP_VISITOR_ID'],\n # session_id_header: request.env['HTTP_SESSION_ID'],\n # visitor_id: visitor_id,\n # session_id: session_id,\n # params: params\n # } )\n end", "def log(path)\n case path\n when *Global.boring\n else\n Log.info(\"Dynamic request from #{request.ip}: #{request.request_uri}\")\n end\n end", "def log_entry(page_name)\n log_file = File.open(\"text_files/log.txt\", \"a\")\n log_file.puts(Time.now.to_s + \"<br>\")\n log_file.puts(\"Edit to page: \" + page_name + \"<br>\")\n log_file.puts(\"By User: <b>\" + $credentials[0] + \"</b>\" + \"<br>\")\n log_file.close\nend", "def log_request(request)\n access = Access.new\n access.host = request.ip\n access.referrer = request.referer\n access.timestamp = DateTime.now\n\n access.method = request.request_method\n \n (request.get? ? request.GET : request.POST).each_pair do |key, value|\n pair = FormDataPair.new\n pair.name = key\n pair.value = value\n access.form_data_pairs << pair\n end\n\n access.save\n\n status 404\n 'No one here but us chickens.'\nend", "def log_history\n logger.info('[]' + request.method + \"\\t\" + request.fullpath + \"\\t\" + request.remote_ip + \"\\t\" + Time.now.strftime('%Y-%m-%d %H:%M:%S'))\n end", "def visit(_visit_path)\n true\n end", "def log_request\n \"#{request.ip} - #{session[:login] ? session[:login].name : '-'} [#{Time.now.strftime('%d/%m/%Y:%H:%M:%S %z')}] \\\"#{request.request_method} #{request.path} HTTP\\\" #{response.status} #{response.content_length} #{timer.stop(request.object_id).round(3)}\"\n end", "def sign_in_local\n __log_activity\n __debug_route\n end", "def log_requests(which = T.unsafe(nil)); end", "def logme\n\t\tlogger.debug \"============Main ApplicationController get calls at #{Time.now}\"\n\tend", "def logged?; false end", "def logged?; false end", "def dump(a, page)\n return unless self.debug?\n\n url = a.current_page.uri.request_uri\n puts \"current page: #{url}\"\n\n md5 = Digest::MD5.new; md5 << url; md5 << Time.now.to_s\n path = File.join(Dir.tmpdir, md5.to_s + \".html\")\n out = open(path, \"w\") do |f|\n f << \"Current page: #{url}\"\n f << \"Headers: #{page.header}\"\n f << page.body\n end\n\n puts \"#{url} -> #{path}\"\n end", "def log\n @log || Mechanize.log\n end", "def advanced\n __log_activity(anonymous: true)\n __debug_route\n end", "def track_pageview\n\n # Get these from the keen.io website:\n project_id = \"4f5775ad163d666a6100000e\"\n auth_token = \"a5d4eaf432914823a94ecd7e0cb547b9\"\n\n # First you must setup the client:\n keen = Keen::Client.new(project_id, auth_token, :storage_mode => :redis)\n\n # Log the event with Keen:\n keen.add_event(\"pageviews\", {\n :params => params,\n :url => request.url,\n })\n\n end", "def record_login(user)\n self.current_site_visitor = GreenFlag::SiteVisitor.for_user!(user, current_site_visitor)\n end", "def perform(user_agent, remote_ip, user_id, timestamp, record_class, record_id)\n logForemVisit(user_agent, remote_ip, user_id, timestamp, record_class, record_id)\n end", "def visit_login_page\n raise \"UnimplementedFunctionality\"\n end", "def track_page_view()\n time_stamp = Time.now.to_s\n domain_name = ENV[\"SERVER_NAME\"]\n domain_name ||= \"\"\n\n #Get the referrer from the utmr parameter, this is the referrer to the\n #page that contains the tracking pixel, not the referrer for tracking\n #pixel.\n document_referer = $cgi[\"utmr\"]\n if document_referer != \"\" && document_referer != \"0\"\n document_referer = \"-\"\n else\n document_referer = CGI.unescape(document_referer)\n end\n\n document_path = $cgi[\"utmp\"]\n document_path ||= \"\"\n document_path = CGI.unescape(document_path)\n\n account = $cgi[\"utmac\"]\n user_agent = ENV[\"HTTP_USER_AGENT\"]\n user_agent ||= \"\"\n\n #Try and get visitor cookie from the request.\n cookie = $cgi.cookies[COOKIE_NAME]\n\n guid_header = ENV[\"HTTP_X_DCMGUID\"]\n guid_header ||= ENV[\"HTTP_X_UP_SUBNO\"]\n guid_header ||= ENV[\"HTTP_X_JPHONE_UID\"]\n guid_header ||= ENV[\"HTTP_X_EM_UID\"]\n\n visitor_id = get_visitor_id(guid_header, account, user_agent, cookie)\n\n utm_gif_location = \"http://www.google-analytics.com/__utm.gif\"\n\n #Construct the gif hit url.\n utm_url = utm_gif_location + \"?\" +\n \"utmwv=\" + GA_VERSION +\n \"&utmn=\" + get_random_number +\n \"&utmhn=\" + CGI::escape(domain_name) +\n \"&utmr=\" + CGI::escape(document_referer) +\n \"&utmp=\" + CGI::escape(document_path) +\n \"&utmac=\" + account +\n \"&utmcc=__utma%3D999.999.999.999.999.1%3B\" +\n \"&utmvid=\" + visitor_id +\n \"&utmip=\" + get_ip(ENV[\"REMOTE_ADDR\"])\n\n send_request_to_google_analytics(utm_url)\n\n #Finally write the gif data to the response.\n write_gif_data(utm_url, time_stamp, visitor_id)\nend", "def log_view(url, manual_expiration: false)\n record = {}\n\n # 0 - standard user view\n # 1 - manual expiration\n record[:kind] = manual_expiration ? 1 : 0\n\n record[:user_id] = current_user.id if user_signed_in?\n record[:ip] = request.env['HTTP_X_FORWARDED_FOR'].nil? ? request.env['REMOTE_ADDR'] : request.env['HTTP_X_FORWARDED_FOR']\n\n # Limit retrieved values to 256 characters\n record[:user_agent] = request.env['HTTP_USER_AGENT'].to_s[0, 255]\n record[:referrer] = request.env['HTTP_REFERER'].to_s[0, 255]\n\n record[:successful] = url.expired ? false : true\n\n url.views.create(record)\n url\n end", "def api_call_log(resource, page)\n log.log(\"Lever API #{resource} page=#{page}\") if log.verbose? && !resource.nil?\n result = yield\n log_if_api_error(result)\n result\n end", "def log_event(params)\n puts \"Log Details:\"\n puts \"<====================>\"\n puts \"Event Type: #{params['event']}\"\n puts \"Recepient: #{params['recipient']}\"\n puts \"City: #{params['city']}\"\n puts \"Country: #{params['country']}\"\n puts \"Client Type: #{params['client-type']}\"\n puts \"Client Name: #{params['client-name']}\"\n puts \"Device Type: #{params['device-type']}\"\n puts \"Client OS: #{params['client-os']}\"\n puts \"Url Clicked: #{params['url']}\" if params['event'] == \"clicked\"\n puts \"Logged at: #{Time.at(params['timestamp'].to_i).utc.to_datetime}\"\n puts \"<====================>\"\n end", "def visit_my_account\n\nend", "def logs\n end", "def logs\n\n end", "def welcome\n __log_activity\n __debug_route\n end", "def __log(method, path, params, body, url, response, json, took, duration)\n logger.info \"#{method.to_s.upcase} #{url} \" +\n \"[status:#{response.status}, request:#{sprintf('%.3fs', duration)}, query:#{took}]\"\n logger.debug \"> #{__convert_to_json(body)}\" if body\n logger.debug \"< #{response.body}\"\n end", "def log(message); logger.info(message); end", "def visit_page(url)\n logger.info { \"visit #{url}\" }\n WebPage.new(url, web[url.to_s])\n end", "def debug\n @current_page\n end", "def log(request, response)\n time = Time.new.strftime(\"%Y-%m-%d %H-%M-%S\")\n http_request = \"#{request.http_method} #{request.uri}\"\n http_response = \"#{response.code}\"\n @log_file.puts \"#{++@log_no} -- [#{time}] #{http_request} #{http_response}\"\n end", "def log_submission_access(request)\n request_headers = request.headers.env.select do |k, _|\n k.in?(ActionDispatch::Http::Headers::CGI_VARIABLES) || k =~ /^HTTP_/\n end\n\n request_headers['USER_SESSION_ID'] = current_authentication_token\n request_headers['SUBMISSION_SESSION_ID'] = @submission.session_id\n\n @submission.logs.create(request: request_headers)\n end", "def log_user_recent_route\n @sessions_current_user.add_page_to_recent(request.fullpath) if @sessions_current_user\n end", "def write( message )\n\t\t\tApache.request.server.log_debug( message )\n\t\tend", "def log(*args)\n\t\t\trouter.log(*args)\n\t\tend", "def track_web_analytics\r\n @web_analytics = WebAnalytics.new\r\n @web_analytics.request = request\r\n @web_analytics.page_reader = session_user.screen_name if session_user\r\n end", "def log_http_call(payload); end", "def log_http_call(payload); end", "def visit_static_page\n visiting = STATIC_LOCATIONS[Kernel.rand(STATIC_LOCATIONS.size)]\n puts \"Competitor #{@id} is visiting #{visiting}\"\n @browser.location = @base_url + visiting\n raise \"Visiting #{visiting} led to an error\" unless @browser.is200\n end", "def visit_page\n visit page_path('contact')\n self\n end", "def global_request_logging \n http_request_header_keys = request.headers.keys.select{|header_name| header_name.match(\"^HTTP.*\")}\n http_request_headers = request.headers.select{|header_name, header_value| http_request_header_keys.index(header_name)}\n logger.info \"Received #{request.method.inspect} to #{request.url.inspect} from #{request.remote_ip.inspect}. Processing with headers #{http_request_headers.inspect} and params #{params.inspect}\"\n begin \n yield \n ensure \n logger.info \"Responding with #{response.status.inspect} => #{response.body.inspect}\"\n end \n end", "def dump_page(page, name = \"debug#{Time.now.strftime(\"%Y-%m-%d %H-%M\")}\" )\n str = page.inner_html.to_s\n file = File.new(name, \"w+\")\n file.puts(str)\n file.close\n end", "def record_page(page)\n\t\t\t\turl = page.uri.to_s\n\t\t\t\trecord(url, content: page.content)\n\t\t\tend", "def goto_page(page)\n operation_delay\n dump_caller_stack\n @web_browser.goto_page(page) if @web_browser\n end", "def log()\n if user_signed_in?\n else\n \tredirect_to \"http://localhost:3000/users/sign_in\"\n end\n end", "def visit\n @browser.goto(URL)\n end", "def visit_my_account\n\tsleep 2\n\tvisit \"#{url_visit}/account/\"\nend", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def trace!\n request! :trace\n end", "def log()\n @log\n end", "def log_state\n #debug \"log_state: next controller is #{session[:next_controller]}, next action is #{session[:next_action]}\"\n end", "def show\n # logger.debug @site\n end", "def activity_logger_end\n # Don't care about logging activity if the user is not registered\n# return if !session[:user]\n\n puts \"In: Logger End\"\n\n # In case the request is of type '2' = AJAX (dynamic), store 'session' information for content storage between\n # AJAX pages but don't record a database activity (making the transition faster)\n if Activity::activities[params[:action]] && Activity::activities[params[:action]][3] == 2\n \n # Store the AJAX data in the 'session' object under the general key ':params' with the 'page' being the 2nd 'key'\n# session[:params][params[:action]] = params\n end\n \n # If the current action & controller match the previous activity (i.e. the user has refreshed and clicked on a link\n # that takes them to the same page, the previous Activity will be updated with the 'updated_at' field ONLY\n if (session[:last_activity_o]) && \n (session[:last_activity_o].action == params[:action] && session[:last_activity_o].controller == params[:controller])\n session[:last_activity_o].touch\n return\n end\n \n # If current activity is of type 'secondary'\n \n # 1. Maintain 5 last links in the session object\n session[:last_5_urls] = Array.new(5) if !session[:last_5_urls]\n session[:last_5_urls].unshift(request.env[\"REQUEST_URI\"])\n session[:last_5_urls].pop if session[:last_5_urls].length > 5\n \n @activity = Activity::create_o(params, @friendly_names_h, session[:user])\n \n begin\n \n# @activity.save(false)\n \n # If current activity is of type 'primary', store it as primary\n # This will be used as a 'return_to' link when exiting a 'secondary' view\n if Activity::activities[params[:action]] && Activity::activities[params[:action]][3] == 1\n session[:last_primary_activity_o] = @activity\n \n # 2. In case current page is secondary (e.g Feedback, Contact Us etc) and there is no 'last_primary_activity' object in memory\n # E.g. user bookmarked the 'Provide Feedback' page and 2nd time opening the browser, using cookie login, they access this page directly\n elsif !session[:last_primary_activity_o] &&\n (Activity::activities[params[:action]] && Activity::activities[params[:action]][3] == 0)\n \n # 3. If the current action is not defined regardless if it's a primary or secondary (as we can't tell at this stage)\n # Set the 'last_primary_activity' to 'home'\n elsif !Activity::activities[params[:action]] \n session[:last_primary_activity_o] = Activity::create_o(\n {:action => \"home\", :controller => \"application\"}, nil, session[:user])\n \n # Let the admin know an action was used that doesn't have\n raise 'ERROR #2' if !send_message(nil, {:missing_action => params[:action]}, false, 3, 4) \n end \n \n # Set the current activity to be the last in the session\n session[:last_activity_o] = @activity\n \n rescue Exception => exc\n \n flash[:error] = 'Activity could not be saved due to a validation error = ' + exc.clean_backtrace.join( \"\\n\" )\n \n end # rescue\n \n end", "def add_to_history(page); end", "def log_event(info = nil)\n if current_user\n action = \"#{controller_name}/#{action_name}\"\n log = ActivityLog.new(user: current_user, action: action, info: info)\n log.save\n end\n end", "def load_page\n page.visit('')\n end", "def log_dispatch(robot, route)\n robot.logger.debug I18n.t(\n \"lita.handler.dispatch\",\n handler: name,\n method: route.callback.method_name || \"(block)\"\n )\n end", "def log_dispatch(robot, route)\n robot.logger.debug I18n.t(\n \"lita.handler.dispatch\",\n handler: name,\n method: route.callback.method_name || \"(block)\"\n )\n end", "def log(*args); end" ]
[ "0.6675028", "0.66497064", "0.66497064", "0.6556473", "0.6507742", "0.6419096", "0.6418814", "0.6294446", "0.61958575", "0.6167854", "0.61454034", "0.61243266", "0.6122999", "0.6122999", "0.6122999", "0.6122999", "0.6122999", "0.6122999", "0.6122999", "0.6122999", "0.60728747", "0.6063713", "0.5940933", "0.5936733", "0.5935379", "0.5843147", "0.5833177", "0.5832194", "0.5812218", "0.5783071", "0.5779124", "0.5776427", "0.57556033", "0.57556033", "0.5744368", "0.57442534", "0.57199013", "0.5719756", "0.5717843", "0.5714328", "0.5693508", "0.56825393", "0.5675575", "0.5646174", "0.5589997", "0.5574094", "0.5572708", "0.556916", "0.55547756", "0.554102", "0.55348486", "0.5534743", "0.5534135", "0.552538", "0.5512892", "0.550651", "0.55021703", "0.5498611", "0.5492584", "0.5490955", "0.5490955", "0.5473912", "0.54620266", "0.5459137", "0.5444197", "0.544151", "0.5436407", "0.5434144", "0.54258823", "0.5423333", "0.5410829", "0.5410829", "0.5410829", "0.5410829", "0.5410829", "0.5410829", "0.5410829", "0.5410829", "0.5410829", "0.5410829", "0.5410829", "0.5410829", "0.5410829", "0.5410829", "0.5410829", "0.5410829", "0.5410829", "0.5410829", "0.5410829", "0.54013014", "0.5395523", "0.5394936", "0.5365143", "0.5353873", "0.53531325", "0.5352131", "0.5348806", "0.5335743", "0.5335743", "0.5327515" ]
0.75481397
0
Utility method for syncing the current visitor to the current user (This should be called when a user logs in!) Bails out if not logged in otherwise, sets the .user of the current_visitor
def sync_funnel_visitor return unless FunnelCake.enabled? if not logged_in? logger.info "Couldn't sync Analytics::Visitor to nil User" return end if current_visitor.nil? logger.info "Couldn't sync nil Analytics::Visitor to current User: #{current_user.inspect}" return end current_visitor.user_id = current_user.id current_visitor.save end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_current_user\n if logged_in?\n @current_user = current_user\n end\n end", "def set_current_user\n if logged_in?\n User.current_user = current_user\n else\n User.current_user = nil\n end\n end", "def set_current_user\n \t\tif session[:user_id]\n \t\t\tCurrent.user = User.find_by(id: session[:user_id])\n \t\tend\n \tend", "def set_user\n UserInfo.current_user = session[:user]\n end", "def set_current_user\n Member.current = current_user unless current_user.nil?\n end", "def set_current_user\n User.current = current_user\n end", "def set_current_user\n if logged_in?\n whodat = send(Lockdown::Configuration.who_did_it)\n Thread.current[:who_did_it] = whodat\n end\n end", "def set_user_as_current_user\n @user = @current_user\n end", "def set_current_user\n User.current = current_user\n end", "def set_user\n begin\n if user_signed_in?\n User.send :class_variable_set, :@@current, current_user\n end\n rescue Exception => exception\n logger.error \"Could not set User.current. Error was #{exception.to_s}\"\n end\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 set_user\r\n @user = current_user\r\n end", "def set_current_user\n User.current = 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_user\n @user = current_user \n end", "def set_current_user\n User.current = current_user\n end", "def set_global_current_user\n Current.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", "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", "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 visitor\n @visitor ||= user_signed_in? ? current_user : UserAnon.new(session)\n end", "def set_current_user(user)\n if user.new_record?\n set_unlogged_in_user(user)\n else\n set_logged_in_user(user)\n end\n end", "def set_current_user\n User.current_user = current_user\n end", "def set_current_user\n # we exploit the fact that the below query may return nil\n @current_user ||= Moviegoer.find_by(:id => session[:user_id])\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 record_login(user)\n self.current_site_visitor = GreenFlag::SiteVisitor.for_user!(user, current_site_visitor)\n end", "def set_current_user\n @current_user = User.find_by(id: session[:user_id])\n end", "def set_current_user\n if session[:user_id] \n @current_user = User.find(session[:user_id])\n end \n end", "def set_logged_in_user\n @logged_in_user = logged_in_user\n end", "def set_site_visitor\n ensure_code_cookie\n record_login(current_user) if current_user\n end", "def set_user\n @user = User.find(current_user)\n end", "def set_user\n @user = User.find(current_user)\n end", "def setup_current_user\n @current_user = User.find(session[:user_id]) unless session[:user_id].nil?\n end", "def set_user\n @user = session[:current_user]\n unless @user\n redirect_to home_path\n end\n end", "def set_user\n @user = User.find(current_user[:id])\n end", "def set_user\n @user = User.find(current_user[:id])\n end", "def set_current_user\n #Do we have a user_id in sessions? Yes? \n #then Now we can use this to query the user, set the instance variable \n #and now any method in our application just has to check if we have a current_user without checking tokens etc\n \n if session[:user_id]\n @current_user = User.find(session[:user_id])\n end\n end", "def update_current_user(user)\n @current_user = user if user\n end", "def set_current_user\n\t\t@current_user ||= Moviegoer.find_by_id(session[:user_id])\n\t\tredirect_to login_path and return unless @current_user #if @current_user is nil, redirect\n\tend", "def set_self_as_user\n @user = self.current_user\n end", "def set_user\n @user = User.find(current_user.id)\n end", "def set_user\n @user = User.find(current_user.id)\n end", "def set_user\n @user = User.find(current_user.id)\n end", "def set_user\n @user = User.find(current_user.id)\n end", "def set_user\n @user = User.find(current_user.id)\n end", "def set_user_session\n UserSession.current_user = current_user\n end", "def set_user\n @user = User.find(current_user.id)\n end", "def get_user\n @current_user = current_user\n end", "def me\n @user = current_user\n end", "def set_user\n @user = User.find(session[:user_id])\n if current_user.is_seeker\n @jobseeker = Jobseeker.find_by(user_id: current_user.id)\n end\n if current_user.is_biz\n @bizowner = Bizowner.find_by(user_id: current_user.id)\n end\n end", "def current_user=(user)\n @current_user = user \n end", "def current_user=(user)\n master.current_user = user\n end", "def current_user=(user)\r\n @current_user = user\r\n end", "def current_or_guest_user!\n if current_user\n if cookies[:uuid]\n\n # Called when a guest user is converted to current user\n promote_guest_to_user(current_user)\n\n # destroy the guest user and the session\n destroy_guest_user\n end\n current_user\n else\n find_or_create_guest_user\n end\n end", "def set_user\n require_logged_in\n @user = User.find_by(id: session[:user_id])\n end", "def set_current_user! #naming convention to have the !\n @current_user = User.find_by(id: session[:user_id])\n end", "def current_user=(user)\n @current_user = user\n end", "def set_current_user(current_user)\n @current_user = current_user\n end", "def set_current_user\n @current_user =\n if session.key? :user_id\n User.active.find_by id: session[:user_id]\n elsif request.env.key? 'fcIdNumber'\n User.active.find_by spire: request.env['fcIdNumber']\n end\n session[:user_id] = @current_user.id if @current_user.present?\n end", "def current_user=(user)\n\t\t@current_user = user\n \tend", "def set_current_user\n set_facebook_session\n # if the session isn't secured, we don't have a good user id\n if facebook_session and\n facebook_session.secured? and\n !request_is_facebook_tab?\n self.current_user =\n User.for(facebook_session.user.to_i, facebook_session)\n end\n end", "def get_current_user\n @current_user = current_or_guest_user\n end", "def check_and_set_current_user_if_logged_in\n\n if x = Services::PropsFromServer.props[:current_user]\n\n user = User.parse(x)\n\n CurrentUser.set_user_and_login_status(user, true)\n\n end\n\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end", "def current_user=(user)\n @current_user = user\n end" ]
[ "0.71031487", "0.7061895", "0.7033756", "0.701274", "0.6972991", "0.69189906", "0.69166034", "0.6909499", "0.68816924", "0.68760806", "0.6862525", "0.6862525", "0.6862525", "0.6862525", "0.6857685", "0.6856365", "0.6849019", "0.6849019", "0.68476367", "0.68375707", "0.6801216", "0.6781685", "0.6781685", "0.6781685", "0.6781685", "0.6781685", "0.6781685", "0.6781685", "0.6781685", "0.6781685", "0.6781685", "0.6781685", "0.6781685", "0.6781685", "0.6781685", "0.6781685", "0.6781685", "0.6781685", "0.6781685", "0.6781685", "0.6781685", "0.6781685", "0.67733586", "0.6757217", "0.6755408", "0.6729374", "0.6709611", "0.6704899", "0.6704899", "0.6704899", "0.6704899", "0.6704899", "0.6704899", "0.6704899", "0.6704899", "0.6704899", "0.66990393", "0.66951627", "0.66887295", "0.6657016", "0.66559243", "0.66014093", "0.66014093", "0.6588788", "0.65654004", "0.65382534", "0.65382534", "0.6537523", "0.65348583", "0.6528843", "0.65267503", "0.6518521", "0.6518521", "0.6518521", "0.6518521", "0.6518521", "0.65052253", "0.64764", "0.6467449", "0.64435834", "0.6424402", "0.6421276", "0.6407817", "0.6395556", "0.63938755", "0.6391766", "0.6387231", "0.6385283", "0.63834417", "0.6382485", "0.6379915", "0.63793164", "0.6378341", "0.6377409", "0.63656026", "0.63656026", "0.63656026", "0.63656026", "0.63656026", "0.63656026" ]
0.7564509
0
should we ignore this visitor?
def ignore_funnel_tracking? return true unless FunnelCake.enabled? # check user-overrideable methods return true if respond_to?(:ignore_funnel_visitor?) and ignore_funnel_visitor? # ignore search engine bots return true if request.env["HTTP_USER_AGENT"] and request.env["HTTP_USER_AGENT"][/Googlebot|msnbot|Yahoo|Baidu|Teoma/] return true if funnel_browser_is_bot? # check funnel-ignore list return true unless Analytics::Ignore.find_by_ip(request.remote_ip.to_s).nil? return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accept(visitor); end", "def accept(visitor); end", "def accept(_visitor)\n raise NotImplementedError\n end", "def visit_e(node)\n ignore_node(node)\n end", "def accept visitor\n visitor.accept_hard_break self\n end", "def accept visitor\r\n visitor.accept_hard_break self\r\n end", "def ignores; end", "def ignore; end", "def visit_i(node)\n ignore_node(node)\n end", "def accept visitor\n visitor.accept_raw self\n end", "def visit_s(node)\n ignore_node(node)\n end", "def ignore *node\n end", "def accept visitor\n visitor.accept_verbatim self\n end", "def information?\n not_a_visitor\n end", "def visit(&block)\n # block.call self\n yield self\n end", "def ignore_me\nend", "def excluded; end", "def foreign_visitor?\n not user\n end", "def exclude; end", "def accept_visitor(visitor)\n visit_method_name = \"visit#{basename(self.class.name.to_s.gsub(/::/, '/'))}\".to_sym\n visitor.send(visit_method_name, self) if visitor.respond_to?(visit_method_name)\n end", "def visit(_bytecode)\n raise NotImplementedError, 'subclass responsibility'\n end", "def visit(&block)\n block.call self\n end", "def accept(visitor)\n visitor.visit(self)\n end", "def accept(visitor)\n visitor.visit(self)\n end", "def actual_flow_control\n super\n end", "def ignore(*args); end", "def on_not_handled(ctx, ast)\n flush(ctx)\n ctx.result << ast\n end", "def discard; end", "def discard; end", "def accept visitor\n visitor.accept_blank_line self\n end", "def ignored?()\n #This is a stub, used for indexing\n end", "def handle_ast(ctx, ast)\n false\n end", "def unused\n end", "def ignore!\n self.ignored = true\n end", "def skipped; end", "def ignore\n @ignore = true\n end", "def ignore\n return unless @track_visibility\n\n @ignored = true\n\n stop_doc\n end", "def ignore!\n @should_ignore = true\n end", "def ignore_node(xn)\n @xn_context.process_children = false\n end", "def ignore\n @ignore = true\n end", "def ignore_parent_exclusion; end", "def tag; raise 'Override this method'; end", "def visit_without_context_change(k, v, parent)\n v\n end", "def nothing; end", "def unfiltered_content; end", "def unfiltered_content; end", "def unfiltered_content; end", "def skips; end", "def skipped!; end", "def nothing(_)\n end", "def on_ignored_request\n end", "def track_visitor\n return if ignore_funnel_tracking?\n register_funnel_visitor unless visitor_registered?\n end", "def specialty; end", "def visit(_visit_path)\n true\n end", "def visit_unary_node(node)\n visit(node.value) unless node.terminal?\n end", "def accept(*) end", "def accept(*) end", "def accept(*) end", "def visit_node(n); end", "def ignore\n @ignored = true\n self\n end", "def ignore_parent_exclusion?; end", "def dont_care\n each(&:dont_care)\n myself\n end", "def accept(aVisitor)\n aVisitor.visit_unary_expression(self)\n end", "def accept visitor\n visitor.accept_heading self\n end", "def silly_adjective; end", "def guard; end", "def skip\n ParsletOmission.new self.to_parseable\n end", "def accept; end", "def accept; end", "def accept(being) \n being.visit_cave(self)\n end", "def accept_nonblock\r\n end", "def visit(node)\n visitor = self.class.visitor(node.class)\n\n visitor.visit(self, node)\n end", "def possibly_include_hidden?; end", "def irrelevant_line(source_line); end", "def consume_node(t)\n raise NotImplementedError\n end", "def greibach_normal_form\n raise NotImplementedError\n end", "def accept(aVisitor)\n aVisitor.visit_nonterminal(self)\n end", "def accept(aVisitor)\n aVisitor.visit_nonterminal(self)\n end", "def visit_offerwall\n raise NotImplementedError\n end", "def pack_not_every_node(_fragments)\n fail 'Override this method in less general packer classes.'\n end", "def never?; end", "def no_op_method( * ) # :nodoc:\n\t\tyield if block_given?\n\tend", "def noreferrer?; end", "def accept_nonblock(*) end", "def accept_nonblock(*) end", "def accept_nonblock(*) end", "def accept visitor\n visitor.accept_list_start self\n\n @items.each do |item|\n item.accept visitor\n end\n\n visitor.accept_list_end self\n end", "def false a\n # catch cuts\n catch :rubylog_cut do\n a.prove { return }\n end\n yield\n end", "def ignore_children!\n @ignoring_children += 1\n end", "def i_dont_see(what)\n assert !i_see?(what), __last_because + \" (actually see #{what})\"\n end", "def do_nothing markup_item\n end", "def accept visitor\n visitor.start_accepting\n\n visitor.accept_document self\n\n visitor.end_accepting\n end", "def skip_actions; end", "def requested_flow_control\n super\n end", "def on_handled(ctx, ast)\n end", "def is_not a,b\n a = a.rubylog_resolve_function\n b = b.rubylog_resolve_function\n a.rubylog_unify(b) { return }\n yield\n end", "def ignore_parent_exclusion=(_arg0); end", "def special\n override\n end", "def skip_method container\n meth = RDoc::AnyMethod.new \"\", \"anon\"\n parse_method_parameters meth\n parse_statements container, false, meth\n end", "def discard!\n # This should be overridden by concrete adapters.\n end", "def ignore_if(&block)\n @@ignores << block\n end" ]
[ "0.71232104", "0.71232104", "0.7093048", "0.6725334", "0.67078125", "0.66341066", "0.65979755", "0.6550514", "0.6440139", "0.630984", "0.62488705", "0.6128646", "0.60373855", "0.6032037", "0.5984458", "0.5982569", "0.59121907", "0.58551115", "0.5832115", "0.5785707", "0.57541203", "0.5736128", "0.5735852", "0.57150024", "0.57140267", "0.5700318", "0.5641576", "0.56191367", "0.56191367", "0.561313", "0.559427", "0.5559363", "0.55508316", "0.55440766", "0.5537479", "0.5523922", "0.55237514", "0.5504845", "0.54738265", "0.5441597", "0.54415095", "0.54403555", "0.5439564", "0.5414449", "0.54009247", "0.54009247", "0.54009247", "0.53966975", "0.5387892", "0.5377611", "0.5368117", "0.53629297", "0.5354079", "0.5347437", "0.53449494", "0.5341896", "0.5341896", "0.5341896", "0.5336674", "0.53294003", "0.53037494", "0.5298062", "0.5294011", "0.5283337", "0.5278436", "0.52750516", "0.52733153", "0.527166", "0.527166", "0.52708966", "0.5269875", "0.5269222", "0.5261534", "0.52533853", "0.52512276", "0.5250104", "0.52442336", "0.52442336", "0.52412045", "0.5232934", "0.521997", "0.52190816", "0.52080446", "0.52036685", "0.52036685", "0.52036685", "0.52013934", "0.5201329", "0.51977116", "0.5178623", "0.51755065", "0.5171322", "0.5158827", "0.5156232", "0.5150404", "0.51502144", "0.51430184", "0.512622", "0.51249427", "0.51220256", "0.5113832" ]
0.0
-1
Is the current visitor registered? We check the cookie state to find out
def visitor_registered? cookies[self.class.read_inheritable_attribute(:cookie_name)].nil? == false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_cookie?\n \n cookie = request.cookies[\"kindle\"]\n \n # attempt to look up cookie in registration DB\n reg = Registration.first(:content => cookie)\n \n if $DEBUG\n puts \"Cookie: \" + (cookie.nil? ? \"nil\" : cookie.to_s )\n puts \"Registration: \" + (reg.nil? ? \"nil\" : reg.to_s )\n end\n \n return true if $DEBUG\n return !reg.nil?\n end", "def ever_logged_in?\n @data[:has_ever_logged_in]\n end", "def logged_in?\n\t\tcookies[:cookie_id] ? true : false\n\n\tend", "def registered?\n begin\n self.get_registration\n true\n rescue => e\n # any error should be treated as the user not being registered\n false\n end\n end", "def cookie_valid?\n cookies[:clickfunnels_auth].present? && session[:user_id].present? && cookies[:clickfunnels_auth].to_s == session[:user_id].to_s\n end", "def logged_in?\n if request.cookies['userid']\n true\n else\n false\n end\n end", "def registered(user)\n self.rsvped?(user) || self.isHost?(user)\n end", "def registered?\n !guest?\n end", "def registered?\n !new_record? && !anonymous?\n end", "def needs_new_cookie?\n @_new_cookie\n end", "def recurrent?\n # if there is no cookies access it is the user first time here\n return false if get_accesses_cookie.empty?\n\n # The user accessed some URL, but not this one\n return false if @access_data.nil?\n\n # If there is no access expression on the cookie\n get_accesses_cookie[access_expression].nil? ? false : true\n end", "def probably_authenticated?\n request.cookie_jar[:bk_logged_in] == \"true\"\n end", "def logged_in?\n !!(cookie && (cookie =~ /reddit_session/) != nil)\n end", "def is_returning_user\n if cookies[:intervac_user].nil?\n return false\n end\n return true\n end", "def valid_cookie?\n cookie = @handshake.headers['Cookie']\n puts \"Cookie: #{cookie}\"\n return false unless cookie\n end", "def if_can_register(url)\n event_page = @agent.get(url)\n matched_nodes = event_page.search(\"#normal_register > h3\")\n if matched_nodes.empty?\n return false\n elsif matched_nodes[0].text == \"Påmelding\"\n return true\n else\n return false\n end\n end", "def signed_in?\n !!@modhash and !!@cookie\n end", "def logged_in?\n session[:uid] != nil\n end", "def logged_in?\n session[:uid] != nil\n end", "def guest_user?\n !cookies[:uuid].nil? && !guest_user.nil?\n end", "def shib_session_exists?\n !cookies.detect { |key, val| key.include? SHIBBOLETH_COOKIE_PATTERN }.nil?\n end", "def registered_traveler?\n registered? && traveler?\n end", "def logged_in?\n return(logged_in_from_session? || logged_in_from_cookie?)\n end", "def user_signed_in?\n session[:userinfo].present?\n end", "def user_signed_in?\n session[:userinfo].present?\n end", "def logged_in?\n !session[Casual.session_key].nil?\n end", "def isLoggedIn?\n if session[:loggedIn] \n true \n else\n store_url\n false\n end\t\n end", "def is_registered?\n # keep track of where we are: if no password in db\n # it means we still are at the registration step\n\n # Note that we use the \"_was\" suffix here (AR::Dirty) to check\n # the value of the field before the update\n !crypted_password_was.blank?\n end", "def logged_in?\n session.has_key? :user\n end", "def fresh_visit?\n visit = current_visit\n visit && visit.updated_at + Constants::Config::VISIT_STALE_AFTER > Time.now\n end", "def logged_in?\n flag = session[:user_id]\n unless flag\n cookies.delete :user_id # delete the cookie for actioncable authorization\n end\n flag\n end", "def is_registered_true!\n self.is_registered = true\n end", "def has_auth_cookie?\n cookie = @request.cookies[TOKEN_COOKIE]\n !cookie.nil? && cookie.length == 32\n end", "def logged_in?\n client_id = request.cookies[\"salt\"]\n if client_id.nil?\n return false\n else\n @current_user = User.first(:salt => client_id)\n end\n end", "def has_auth_cookie?\n request = Rack::Request.new(@env)\n cookie = request.cookies[TOKEN_COOKIE]\n !cookie.nil? && cookie.length == 40\n end", "def person_logged_in?\n !session[:person_id].nil?\n end", "def alive?\n @session && @login_info\n end", "def cookies?\n cookies.length > 0\n end", "def logged_in? \n !!session[:skater_id]\n end", "def logged_in?\n !session[:name].nil?\n end", "def isRegistado?\n if session[:perm] == 0\n return true;\n else\n return false;\n end\n end", "def registered?\n self.class.registered_uids.include? uid\n end", "def current_user_signed_up?\n logged_in? && !current_user_is_host? && @game.players.include?(current_user)\n end", "def user_logged_in?\n session[:user_id].present?\n end", "def needs_new_cookie!\n @_new_cookie = true\n end", "def needs_new_cookie!\n @_new_cookie = true\n end", "def needs_new_cookie!\n @_new_cookie = true\n end", "def logged_in?\n #Dependiendo de lo que regrese current_user\n if current_user\n #Regresa true si el usuario existe\n true\n else\n #Si no existe regresa false\n false\n end\n end", "def logged_in?\n session['logged_in']\n #false\n end", "def logged_in?\n #! @auth_client_cookie.nil?\n ! @session_token.nil?\n end", "def has_auth_cookie?\n old_cookie = @request.cookies[OLD_TOKEN_COOKIE]\n new_cookie = @request.cookies[NEW_TOKEN_COOKIE]\n !old_cookie.nil? && !new_cookie.nil?\n end", "def session_exists?(env)\n value = current_session_id(env)\n value && !value.empty?\n end", "def user_signed_in?\n session.has_key? :user_id\n end", "def valid?\n !!cookie_content\n end", "def valid?\n !!cookie_content\n end", "def logged_in?\n\t\t!current_golfer.nil?\n\tend", "def visited_by?(visitor)\n if visitor.is_a?(String)\n return self.visits.find(:first, :conditions => {:uuid => visitor, :unique => true},\n :order => \"visits.created_at ASC\") unless visitor.blank?\n else\n return self.visits.find(:first, :conditions => {:visitor_id => visitor.id, :unique => true},\n :order => \"visits.created_at ASC\") unless visitor.new_record?\n end\n false\n end", "def remember_host?\n !!@remember_host\n end", "def logged_in?\n !!session[:current_token]\n end", "def ready?\n @connected && @logged_in\n end", "def logged_in?\n validate_token\n validate_cookie\n return true if !session[\"app_user\"].nil? && session[\"app_user\"] != false && session[\"app_user\"].id != -1 && session[\"app_user\"].id != User::LOGGED_OUT_USER_ID \n return false\n end", "def is_cookie_token_valid?\n return true if self.class.els_options.has_key? 'faker'\n raise \"No cookies instance found\" if cookies.nil?\n token = cookies[self.class.els_options['cookie']]\n if token.nil? || !Runner.is_token_valid?(token,self.class.els_options)\n false\n else\n true\n end\n end", "def vote_cookie_for?(question)\n cookies[\"voted_for_#{question.id}\"] == '1'\n end", "def local_cookie?\n if File.exist?($CONF['cookie'])\n return true\n end\n false\nend", "def registered?\n controller.registered?\n end", "def logged_in?\n cookies[:logged_in_identity_url] && valid_admin_open_id?(cookies[:logged_in_identity_url])\n end", "def logged_in?\n !current_baby.nil?\n end", "def user_logged?\n !session[:user_id].nil?\n end", "def logged_in?\n return session[:user_id].present?\n end", "def logged_in?\n !session[:email].nil?\n end", "def user_signed_in?\n if request.headers['sid'].present? && !request.headers['sid'].nil? && request.headers['utoken'].present? && !request.headers['utoken'].nil?\n if Session.active_sessions.find_by(id: request.headers['sid'], utoken: request.headers['utoken']).nil?\n return false\n else\n return true\n end\n else\n return false\n end\n end", "def user_signed_in?\n if request.headers['sid'].present? && !request.headers['sid'].nil? && request.headers['utoken'].present? && !request.headers['utoken'].nil?\n if Session.active_sessions.find_by(id: request.headers['sid'], utoken: request.headers['utoken']).nil?\n return false\n else\n return true\n end\n else\n return false\n end\n end", "def visited?(url); end", "def user?\n session.key? 'user'\nend", "def cookie_redirected?\n params[:cookies].present?\n end", "def cmssession?\n @context.registers[:cmssession?]\n end", "def ballot_registered?\n @ballot_registered\n end", "def logged_in?\n !session['userhash'].nil? &&\n $redis.get('userhash:'+session['userhash']) == session['user'] &&\n !User.get(session['user']).nil?\n end", "def user_logged_in?\n session[:user]\n end", "def has_auth_cookie?\n raise NotImplementedError\n end", "def has_auth_cookie?\n raise NotImplementedError\n end", "def allow_reg_modifications?\n cookies.signed[:user_permissions] == \"yes\"\n end", "def allow_reg_modifications?\n cookies.signed[:user_permissions] == \"yes\"\n end", "def is_logged_in?\n session[:user_id].present?\n end", "def cas_authed?\n !session[:cas_user].blank?\n end", "def logged_in?\n\n if session[:current_user_id]\n return true\n end\n \n #Default return false\n false\n \n end", "def one_user_registered?\n if User.count == 1\n if user_signed_in?\n redirect_to root_path\n else\n redirect_to new_user_session_path\n end\n end \n end", "def is_logged_in?\n session[:user_id].present?\n end", "def logged_in?\n session[:logged_in]\n end", "def logged_in?\n session[:logged_in]\n end", "def authenticated?\n @session != nil && !@session['session_expires'].nil? && @session['session_expires'] > Time.now && @session['auth'] == true && @session['ip'] == @cgi.remote_addr\n end", "def to_already_logged_in?\n return if already_logged_in?\n end", "def logged_in?\n session[:user_id]\n end", "def registered?(item)\n @clients.has_key?(item) or @clients.has_value?(item)\n end", "def user_reffered?\n if /#{root_url}/.match(request.referrer) then false else request.referrer end\n end", "def logged_in?\n\t session[:login] != nil\n\tend", "def signed_in?\n !!@me\n end", "def valid_remember_cookie?\n return nil unless @current_user\n (@current_user.remember_token?) && \n (cookies[:auth_token] == @current_user.remember_token)\n end", "def user_is_logged_in?\n !!session[:user_id]\n end", "def user_signed_in?\n session[:user_id].present?\n end" ]
[ "0.74209034", "0.6884273", "0.6788344", "0.6766331", "0.67409414", "0.6707545", "0.6691672", "0.6680515", "0.66242874", "0.66047823", "0.65944004", "0.6589199", "0.6554048", "0.6549198", "0.6504574", "0.6463556", "0.6415464", "0.639112", "0.639112", "0.63783354", "0.6376519", "0.6345595", "0.6336226", "0.63296366", "0.63296366", "0.62830025", "0.62696975", "0.6267045", "0.62405753", "0.6239767", "0.6222784", "0.6207454", "0.6190605", "0.6157579", "0.6154506", "0.61532825", "0.6152015", "0.6146505", "0.61358386", "0.61339116", "0.6127812", "0.6125327", "0.6123864", "0.6116752", "0.61130047", "0.61130047", "0.61130047", "0.6108754", "0.61070955", "0.61005044", "0.6100447", "0.6087106", "0.6086387", "0.6081946", "0.6081946", "0.607889", "0.6071879", "0.60593235", "0.6052514", "0.60388625", "0.6038649", "0.6037488", "0.6031463", "0.60273737", "0.6026282", "0.6023498", "0.6023197", "0.6022698", "0.6021352", "0.6015107", "0.60149735", "0.60149735", "0.6008584", "0.60072005", "0.60069215", "0.6002136", "0.60021067", "0.6000502", "0.60003585", "0.59937245", "0.59937245", "0.599231", "0.599231", "0.5984218", "0.5980776", "0.59797597", "0.59771407", "0.59753966", "0.5973009", "0.5973009", "0.5969616", "0.59679073", "0.5965894", "0.59594345", "0.59514105", "0.5950801", "0.5949745", "0.59444726", "0.5939979", "0.5939937" ]
0.87935054
0
Register the current visitor (without checking anything first, just do it) We create a new Analytics::Visitor here, using a new random hex key Set the cookie value for this visitor
def register_funnel_visitor @current_visitor = FunnelCake.engine.visitor_class.create( :ip=>request.remote_ip.to_s ) @current_visitor.user_id = current_user.id if logged_in? @current_visitor.save cookies[self.class.read_inheritable_attribute(:cookie_name)] = { :value => @current_visitor.id, :expires => 1.year.from_now } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def record_visit\n unless (visit_key = cookies[:id])\n visit_key = SecureRandom.urlsafe_base64(16)\n cookies.permanent[:id] = visit_key\n end\n VisitCounter.record(visit_key)\n end", "def track_visitor\n visitor_cookie_name = \"teaser.#{@teaser.id}.visitor\"\n if cookies[visitor_cookie_name].blank? || (@visitor = @teaser.visitors.find_by_cookie(cookies[visitor_cookie_name])).nil?\n @visitor = @teaser.visitors.create!\n install_persistent_cookie(visitor_cookie_name, @visitor.cookie)\n end\n \n if recent_visit = @visitor.visits.last(:conditions => ['visited_at > ?', 1.hour.ago])\n recent_visit.update_attribute(:visited_at, Time.now)\n else\n @visitor.visits.create!\n end\n end", "def register_visit\r\n if @debug\r\n puts \"REQUEST IN REGISTER VISIT: #{request}\"\r\n puts \"BODY REQUEST: #{request.body}\"\r\n puts \"AUTH REQUEST: #{request.authorization}\"\r\n puts \"LENGTH REQUEST: #{request.content_length}\"\r\n puts \"FORM DATA REQUEST: #{request.form_data?}\"\r\n puts \"FULLPATH REQUEST: #{request.fullpath}\"\r\n puts \"HEADERS REQUEST: #{request.headers}\"\r\n puts \"IP REQUEST: #{request.ip}\"\r\n puts \"REQUEST IP ADDRESS: #{request['ip_address']}\"\r\n puts \"REQUEST REMOTE IP: #{request['remote_ip']}\"\r\n end\r\n response = @mints_pub.register_visit(request)\r\n if @debug\r\n puts \"RESPONSE IN REGISTER VISIT: #{response}\"\r\n end\r\n @contact_token = response['contact_token'] ? response['contact_token'] : response['user_token']\r\n @visit_id = response['visit_id']\r\n if @debug\r\n puts \"VISIT ID: #{@visit_id}\"\r\n end\r\n cookies.permanent[:mints_contact_id] = { value: @contact_token, secure: true, httponly: true }\r\n cookies.permanent[:mints_visit_id] = { value: @visit_id, secure: true, httponly: true }\r\n end", "def set_site_visitor\n ensure_code_cookie\n record_login(current_user) if current_user\n end", "def log_visit\n if !session[:logged_visit] && session[:logged_visit]=true\n behavior = behavior_cookie\n\n if !defined?(behavior[\"visits\"]) || !(behavior[\"visits\"].is_a? Integer)\n behavior[\"visits\"] = 1\n else\n behavior[\"visits\"] += 1\n end\n\n cookies.permanent[:behavior] = behavior.to_json\n end\n end", "def new\n\t\tcookies[:sign_up] = { value: \"XJ-122\", expires: 1.hour.from_now }\n\t\tsuper\n\tend", "def register_visit_by(ip_address)\r\n return unless ip_address\r\n\r\n visit = visits.where(ip_address_id: ip_address.id).first_or_create\r\n visit.increment!(\"count\")\r\n\r\n # update current visited at if more than 15 minutes ago\r\n if visit.current_visited_at.nil?\r\n\tvisit.past_visited_at = visit.current_visited_at = Time.now\r\n end\r\n\r\n if visit.current_visited_at < 15.minutes.ago\r\n\tvisit.past_visited_at = visit.current_visited_at\r\n\tvisit.current_visited_at = Time.now\r\n\tvisit.save\r\n end\r\n end", "def set_uuid_cookie\n uuid = cookies[:uuid] || UUIDTools::UUID.random_create.to_s\n cookies[:uuid] = { value: uuid, expires: 5.years.from_now }\n end", "def get_visitor_id(guid, account, user_agent, cookie)\n\n #If there is a value in the cookie, don't change it.\n return cookie unless cookie\n\n message = \"\"\n if guid && guid != \"\"\n #Create the visitor id using the guid.\n message = guid + account\n else\n #otherwise this is a new user, create a new random id.\n message = user_agent + Digest::MD5.hexdigest(get_random_number)\n end\n\n md5_string = Digest::MD5.hexdigest(message)\n\n return \"0x\" + md5_string\nend", "def register(session_id)\n md5 = Digest::MD5::new\n now = Time::now\n md5.update(now.to_s)\n md5.update(String(now.usec))\n md5.update(String(rand(0)))\n md5.update(String($$))\n md5.update('foobar')\n md5.update(owner_id.to_s)\n md5.update(job_id.to_s)\n md5.update(server.to_s)\n key = md5.hexdigest\n \n Cache.put(\"#{session_id}_#{key}\", self )\n \n reverse_key = [owner_id, job_id, server].join(\"_\")\n Cache.put(\"#{session_id}_#{reverse_key}\", key )\n end", "def set_tracking\n # set ad campaign stats if a source is in the url\n if cookies[:visitor_token].nil?\n begin\n visitor_token = SecureRandom.urlsafe_base64\n end while Applicant.exists?(:visitor_token => visitor_token)\n cookies[:visitor_token] = { value: visitor_token, expires: 30.days.from_now }\n end\n\n \tif !params[:src].nil?\n session[:src] = params[:src] \n session[:camp] = params[:camp]\n session[:adgrp] = params[:adg]\n session[:kw] = params[:kw]\n session[:ad] = params[:ad]\n session[:plc] = params[:plc]\n end\n\n # set site tracking stats\n if session[:page_views].nil?\n session[:page_views] = 1 \n #for direct visitors session[:referer_uri] is nil\n session[:referer_uri] = request.env[\"HTTP_REFERER\"]\n session[:device] = set_device\n session[:entry_page] = request.fullpath\n session[:entry_time] = Time.now\n else\n session[:page_views] += 1\n end\n end", "def stash_cookie\n cookies[self.class.els_options['cookie']] = {\n :value => @els_identity.token_id,\n :domain => request.env[\"SERVER_NAME\"],\n :path => '/',\n :expires => Time.now + 24.hours\n }\n end", "def setup_analytics\n cookie_value = cookies[\"_ga\"].split(\".\").last(2).join(\".\") if cookies[\"_ga\"]\n cookie_value = nil if cookie_value.blank?\n session[:ga_client_id] ||= cookie_value || SecureRandom.uuid\n opts = {}\n opts[:user_id] = @current_user.id if @current_user\n @tracker = Staccato.tracker(ENV['GA_TRACKING_ID'], session[:ga_client_id], opts)\n end", "def add_visit\n self.increment!(:visits, 1)\n end", "def add_visit\n self.visits += 1\n self.date_last_visit = DateTime.now\n end", "def visit\n self.update(last_visit: DateTime.now);\n self.update(visit_count: (self.visit_count + 1));\n end", "def set_visit(id, params={})\n visits[id] = RoutificApi::Visit.new(id, params)\n end", "def generate_cookie\n cookies[:credit_request] = SecureRandom.hex(32)\n end", "def add(cookie)\n # self\n end", "def add_visitor(scope, visitor)\n cache = visitors[scope.to_s] ||= []\n cache << visitor\n end", "def referer_tracking_add_info(key, value)\n if !session[:referer_tracking].nil? && session[:referer_tracking][key.to_sym].nil?\n referer_tracking_set_info(key, value)\n end\n end", "def current_site_visitor\n @current_site_visitor ||= begin\n code = ensure_code_cookie\n GreenFlag::SiteVisitor.for_visitor_code!(code)\n end\n end", "def register_cookie_access\n # setup accesses attr on the cookie if it is not created, else check if is it to clear the cookie\n if cookies[:accesses].nil? || !get_accesses_cookie.is_a?(Hash)\n create_accesses_cookie\n else\n # Retrieve the access, based on it expression\n @access_data = get_accesses_cookie[access_expression]\n\n # Check if the date is today, if not, clear his cookie\n unless @access_data.nil?\n access_date = Date.parse(@access_data+\"/#{Time.now.year}\")\n clear_cookie if access_date < Date.today\n end\n end\n\n # The cookie[:accesses] is a Hash, retriUsing unshift (push in the begging of the array because if the user is recurrent it is more probably to be the last access)\n add_to_cookie(access_expression, \"#{Time.now.strftime('%d/%m')}-#{Time.now.strftime('%H:%M:%S')}\")\n end", "def create\n super\n if current_visit\n current_visit.started_at = Time.now\n current_visit.usuario_id = current_usuario.id\n current_visit.save\n end\n \n Ahoy.user_method = :current_usuario\n ahoy.authenticate(current_usuario)\n set_login_token\n end", "def add_to_cookie key, value\n cookie_hash = get_accesses_cookie\n cookie_hash[key] = value\n cookies[:accesses] = cookie_hash.to_json\n end", "def set(resource)\n @cookies.signed[cookie_name] = {value: [resource.id, Time.now.to_i]}.merge(cookie_options)\n end", "def regenerate\n self.session_id = Merb::SessionMixin::rand_uuid\n self.needs_new_cookie = true\n self.save\n end", "def regenerate \n \t @session_id = Merb::SessionMixin::rand_uuid \n \t self.needs_new_cookie=true \n \tend", "def regenerate\n update_attributes(:session_id => Merb::SessionMixin::rand_uuid)\n self.needs_new_cookie = true\n end", "def visitor_registered?\n cookies[self.class.read_inheritable_attribute(:cookie_name)].nil? == false\n end", "def add_token_to_cookie(cookies)\n token = SecureRandom.urlsafe_base64()\n @user.update(token: token)\n cookies['token'] = token\n create_return_object()\n end", "def set_cookie(response)\n response.set_cookie(Webmetrics::Config.cookie_name, {\n :value => self.id,\n :path => \"/\",\n :expires => Time.now+Webmetrics::Config.cookie_expiration\n })\n end", "def bake_vote_cookie_for(question)\n cookies[\"voted_for_#{question.id}\"] = {\n :value => '1',\n :expires => 1.year.from_now # Expire not anytime soon.\n }\n end", "def sign_in_static_cookie\n cookies[:fulcrum_signed_in_static] = true\n end", "def set_browser_id\n until cookies[:browser_id]\n proposed_browser_id = SecureRandom.uuid\n unless Session.where(:browser_id => proposed_browser_id).exists?\n cookies[:browser_id] = {:value => proposed_browser_id, :expires => 20.years.from_now}\n end\n end\n end", "def add_visitor(id, activity, time)\n\t\tvisitor = self.visitors.find{|v| v.id == id }\n\t\tif visitor\n\t\t\tvisitor.update(activity, time)\n\t\telse\n\t\t\tvisitor = Visitor.new(id)\n\t\t\tvisitor.update(activity, time)\n\t\t\tself.visitors << visitor\n\t\tend\n\tend", "def record_login(user)\n self.current_site_visitor = GreenFlag::SiteVisitor.for_user!(user, current_site_visitor)\n end", "def visit_country\n self.user_countries.create!(user_id: self.visitor_id)\n end", "def track_visitor\n return if ignore_funnel_tracking?\n register_funnel_visitor unless visitor_registered?\n end", "def register\n @is_registered = true\n self\n end", "def init_referrer_code\n self.referrer_code = UUIDTools::UUID.random_create.to_s if referrer_code.blank?\n end", "def set_visitor\n @visitor = Visitor.find(params[:id])\n end", "def set_visitor\n @visitor = Visitor.find(params[:id])\n end", "def track_web_analytics\r\n @web_analytics = WebAnalytics.new\r\n @web_analytics.request = request\r\n @web_analytics.page_reader = session_user.screen_name if session_user\r\n end", "def log_visit\n session_id = request.session_options[:id]\n client = DeviceDetector.new(request.env[\"HTTP_USER_AGENT\"])\n client_os = client.os_name\n if !VisitorLog.find_by_session_id(session_id)\n VisitorLog.create(:session_id => session_id, :logged_in => false, :device_type => client_os)\n end\n\n if VisitorLog.find_by_session_id(session_id)\n log = VisitorLog.find_by_session_id(session_id)\n if !log.logged_in && logged_in?\n log.update_attribute(\"logged_in\", true)\n log.save\n end\n\n if logged_in? && current_user.department_id.present? && log.department_id.nil?\n log.update_attribute(\"department_id\", current_user.department_id)\n log.save\n end\n end\n\n end", "def current_visitor\n return @current_visitor unless @current_visitor.nil?\n\n # Check if we're logged in first, set the current_visitor from the current_user\n if logged_in?\n @current_visitor = current_user.visitor\n end\n\n # If we are not logged in, or if the current_user has no visitor,\n # then try to find the visitor by the cookie key\n if @current_visitor.nil?\n cookie = cookies[self.class.read_inheritable_attribute(:cookie_name)].gsub(/[^0-9a-f]/,'')\n if cookie\n if cookie.length > '000000000000000000000000'.length\n @current_visitor = FunnelCake.engine.visitor_class.find_by_key(cookie)\n cookies[self.class.read_inheritable_attribute(:cookie_name)] = {\n :value => @current_visitor.id,\n :expires => 1.year.from_now\n } if @current_visitor\n else\n begin\n @current_visitor = FunnelCake.engine.visitor_class.find(cookie)\n rescue Mongo::InvalidObjectID => e\n Rails.logger.info e\n end\n end\n end\n end\n\n return @current_visitor\n end", "def track_page_view()\n time_stamp = Time.now.to_s\n domain_name = ENV[\"SERVER_NAME\"]\n domain_name ||= \"\"\n\n #Get the referrer from the utmr parameter, this is the referrer to the\n #page that contains the tracking pixel, not the referrer for tracking\n #pixel.\n document_referer = $cgi[\"utmr\"]\n if document_referer != \"\" && document_referer != \"0\"\n document_referer = \"-\"\n else\n document_referer = CGI.unescape(document_referer)\n end\n\n document_path = $cgi[\"utmp\"]\n document_path ||= \"\"\n document_path = CGI.unescape(document_path)\n\n account = $cgi[\"utmac\"]\n user_agent = ENV[\"HTTP_USER_AGENT\"]\n user_agent ||= \"\"\n\n #Try and get visitor cookie from the request.\n cookie = $cgi.cookies[COOKIE_NAME]\n\n guid_header = ENV[\"HTTP_X_DCMGUID\"]\n guid_header ||= ENV[\"HTTP_X_UP_SUBNO\"]\n guid_header ||= ENV[\"HTTP_X_JPHONE_UID\"]\n guid_header ||= ENV[\"HTTP_X_EM_UID\"]\n\n visitor_id = get_visitor_id(guid_header, account, user_agent, cookie)\n\n utm_gif_location = \"http://www.google-analytics.com/__utm.gif\"\n\n #Construct the gif hit url.\n utm_url = utm_gif_location + \"?\" +\n \"utmwv=\" + GA_VERSION +\n \"&utmn=\" + get_random_number +\n \"&utmhn=\" + CGI::escape(domain_name) +\n \"&utmr=\" + CGI::escape(document_referer) +\n \"&utmp=\" + CGI::escape(document_path) +\n \"&utmac=\" + account +\n \"&utmcc=__utma%3D999.999.999.999.999.1%3B\" +\n \"&utmvid=\" + visitor_id +\n \"&utmip=\" + get_ip(ENV[\"REMOTE_ADDR\"])\n\n send_request_to_google_analytics(utm_url)\n\n #Finally write the gif data to the response.\n write_gif_data(utm_url, time_stamp, visitor_id)\nend", "def register_pid\n redis = Redis.new\n c = redis.get('crawler_count')\n c = 1 if c == nil\n redis.set('crawler' + c.to_s, $$)\n redis.set('crawler_count', c.to_i + 1)\nend", "def visitor\n @visitor ||= user_signed_in? ? current_user : UserAnon.new(session)\n end", "def track!(*args)\n begin\n opts = args.extract_options!\n data = { v: 1, tid: Setting.google_analytics, cid: opts[:session] || SecureRandom.uuid[0,32], t: :pageview, dp: \"/#{self.code}\", dh: \"mycolor.today\", dt: self.title }\n data[:dr] = opts[:referrer] if opts[:referrer].present?\n data[:uid] = opts[:user] if opts[:user].present?\n resp = RestClient.post( 'http://www.google-analytics.com/collect', data )\n rescue\n nil\n end\n end", "def assign_user_cookie_or_register\n if !self.persisted?\n self.is_registered = true if !self.email.nil?\n if !self.is_registered\n self.user_cookie = User.generate_new_user_cookie if self.user_cookie.blank?\n end\n end\n end", "def set_visitor\n @visitor = Visitor.find(params[:id])\n end", "def set_visitor\n @visitor = Visitor.find(params[:id])\n end", "def set_visitor\n @visitor = Visitor.find(params[:id])\n end", "def add_cookie(key,value)\n $LOG.info \"adding cookie with key => #{key} and value => #{value}\"\n begin\n $driver.manage.add_cookie(:name => \"#{key}\", :value => \"#{value}\")\n rescue Exception => e\n $LOG.error \"Add Cookie can't be completed \"+e.message\n raise \"Add Cookie can't be completed \"+e.message\n end\n end", "def register(connection = nil)\n client_id = SecureRandom.uuid\n @clients[\"#{client_id}\"] = connection\n client_id.to_s\n end", "def cookie=(val)\n @xmlrpc.cookie = val\n end", "def view(visitor, options={})\n build_or_create_visit(visitor, {:unique => !visited_by?(visitor)}.merge(options))\n end", "def create(cookies, options = {})\n return nil if self.class.site_key.nil?\n expires = (options.delete(:expires) || 1.week.from_now).to_i # we want unix time\n cookies[:tender_email] = cookie_value(@user.email)\n cookies[:tender_expires] = cookie_value(expires)\n\n # Optionally set the user's name. This is also signed.\n if options[:name_field]\n options[:name] = @user.send(options[:name_field])\n end\n options.each do |key, value|\n cookies[:\"tender_#{key}\"] = cookie_value(value)\n end\n cookies[:tender_hash] = cookie_value(expiring_token(expires, options[:name]))\n cookies\n end", "def visit(visitor, options={})\n visited_by?(visitor) ? false : build_or_create_visit(visitor, {:unique => true}.merge(options))\n end", "def register_for(id); end", "def add_identity_to_log\n RequestLocals.store[:identity] = {\n vendor_api_token_id: @current_vendor_api_token&.id,\n provider_id: current_provider&.id,\n }\n end", "def set_visit\n @visit = Visit.find(params[:id])\n end", "def set_visit\n @visit = Visit.find(params[:id])\n end", "def set_visit\n @visit = Visit.find(params[:id])\n end", "def set_visit\n @visit = Visit.find(params[:id])\n end", "def add_visit(db_connection=nil)\n\t\t\t\tStats.add_visit(db_connection)\n\t\t\tend", "def set_data_in_cookie(data)\n cookies[:merged_response] = {\n :value => data,\n :expires => 1.hour.from_now,\n \n }\n end", "def show\n if @invite.first_viewed_at < Time.now - 1.year && @invite.created_at < Time.now - 1.hour\n @invite.first_viewed_at = Time.now\n end\n @invite.most_recently_viewed_at = Time.now\n @invite.save\n \n cookies[:user_url] = @invite.url\n end", "def cookie\n { :value => Crypt.encrypt(cookie_value), :expires => 1.year.from_now }\n end", "def register_view_by(user)\n if user\n view = view_for(user) \n if view.nil?\n view = views.build(user: user)\n end\n view.increment!(\"count\")\n view.save\n end\n end", "def insert_unlogged_uid\n \"Set-Cookie: uid=#{@unlogged_info[0][1]}\"\n end", "def added(model, index)\n # Save an added cookie\n end", "def initialize(ga_acct, domain, agent = Gabba::USER_AGENT)\n @utmwv = \"4.4sh\" # GA version\n @utmcs = \"UTF-8\" # charset\n @utmul = \"en-us\" # language\n\n @utmn = random_id\n @utmhid = random_id\n\n @utmac = ga_acct\n @utmhn = domain\n @user_agent = (agent && agent.length > 0) ? agent : Gabba::USER_AGENT\n\n @custom_vars = []\n end", "def initialize(request, response)\n @t = Time.now\n @redis_key_prefix = \"#{RedisAnalytics.redis_namespace}:\"\n @rack_request = request\n @rack_response = response\n @first_visit_seq = first_visit_info[0] || current_visit_info[0]\n @current_visit_seq = current_visit_info[1]\n\n @first_visit_time = first_visit_info[1]\n @last_visit_time = first_visit_info[2]\n\n @page_view_seq_no = current_visit_info[2] || 0\n @last_visit_start_time = current_visit_info[3]\n @last_visit_end_time = current_visit_info[4]\n end", "def set_visit\r\n @visit = Visit.find(params[:id])\r\n end", "def generate_token user_agent\n @browser_token_db.add user_agent\n end", "def set_token\n self.token = Digest::SHA2.hexdigest \"#{username}-#{lastvisitDate.to_i}\" if self.token.blank?\n end", "def new_session expire = 1.year\n init_redis\n begin\n name = SecureRandom.uuid.to_s.gsub('-', '')\n if @redis.set(name, Hash.new.to_json, ex: expire) == \"OK\"\n return name\n end\n rescue\n end\n end", "def current_registration_session_uuid=(uuid)\n candidates_registrations[current_urn] = uuid\n end", "def send_cookie(name, value = nil)\n @context.add_cookie(name, value)\n end", "def add_cookie(opts = {})\n driver.manage.add_cookie(opts)\n end", "def set_cookie_watcher\n @cookie_watcher = CookieWatcher.find(params[:id])\n end", "def install_persistent_cookie(name, cookie)\n cookies[name] = {\n :value => cookie,\n :expires => 10.years.from_now\n }\n end", "def fortune_cookie; end", "def create_visitor\n @visitor = FactoryGirl.build(:user)\nend", "def genAnalytics\n %{<script type=\"text/javascript\">\n var gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\");\n document.write(unescape(\"%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\"));\n </script>\n <script type=\"text/javascript\">\n try {\n var pageTracker = _gat._getTracker(\"UA-10612400-1\");\n pageTracker._trackPageview();\n } catch(err) {}</script>}\nend", "def create\n @city = City.new(city_params)\n @city.city_hash = generate_unique_hash\n cookies[:city_hash] = @city.city_hash\n cookies[:city_hash] = { :value => @city.city_hash, :expires => 168.hour.from_now }\n\n respond_to do |format|\n if @city.save\n format.html { redirect_to @city, notice: 'City was successfully created.' }\n format.json { render :show, status: :created, location: @city }\n else\n format.html { render :new }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end", "def session_generate_id(meta)\n return Digest::MD5.hexdigest(\"#{Time.now.to_f}_#{meta[\"HTTP_HOST\"]}_#{self.ip(:meta => meta)}_#{meta[\"HTTP_USER_AGENT\"]}\")\n end", "def index\n for i in 1..200\n #cookies[\"cookie \"+i.to_s] = { value: \"Guru \"+i.to_s, secure: true}\n end\n end", "def store_cookie variable_name\r\n command 'storeCookie', variable_name\r\n end", "def cookie_named(name); end", "def create\n @visitor = Analytics::Visitor.new(params[:visitor])\n\n respond_to do |format|\n if @visitor.save\n flash[:notice] = 'Analytics::Visitor was successfully created.'\n format.html { redirect_to(@visitor) }\n else\n format.html { render :action => \"new\" }\n end\n end\n end", "def save_cookie(requested_lang)\n cookies[:lang] = {\n :value => requested_lang,\n :expires => 1.month.from_now,\n :path => root_path\n }\n end", "def set_login_cookie(crawler_name=nil, crawler_password=nil, ip=nil, date=nil)\n crawler_name ||= @crawler_name\n crawler_password ||= @crawler_password\n ip ||= \"127.0.0.1\"\n date ||= 2.days.from_now\n\n cookie_jar = ActionDispatch::Request.new(Rails.application.env_config.deep_dup).cookie_jar\n cookie_jar.signed[AdsenseCrawlerForPrivate.cookie_name] =\n AdsenseCrawlerForPrivate.cookie_str(crawler_name, crawler_password, date, ip)\n\n cookies[AdsenseCrawlerForPrivate.cookie_name] = cookie_jar[AdsenseCrawlerForPrivate.cookie_name]\n end", "def set_cookie(name, value)\n test_cookies[name] = value\n end", "def store_visited_product\n id = @product.id\n unless cookies[:user_visited_products]\n cookies[:user_visited_products] = id\n else\n cookies_array = cookies[:user_visited_products].to_s.split(',')\n if cookies_array.size < 20\n cookies_array << id unless cookies_array.include?(\"#{id}\")\n cookies[:user_visited_products] = cookies_array.join(\",\")\n end\n end\n end", "def set_visit\n @visit = Visit.find(params[:id])\n end", "def set_visit\n @visit = Visit.find(params[:id])\n end", "def needs_new_cookie!\n @_new_cookie = true\n end" ]
[ "0.73304033", "0.66246873", "0.655579", "0.6404724", "0.6201737", "0.61668074", "0.60564953", "0.6044377", "0.60066134", "0.5912472", "0.58503366", "0.57785815", "0.5758547", "0.56748974", "0.5650055", "0.56169564", "0.5613965", "0.5577536", "0.556677", "0.5558418", "0.5538382", "0.55258274", "0.5513545", "0.5480674", "0.54449934", "0.5443118", "0.5436539", "0.5434404", "0.54249024", "0.5423372", "0.54175144", "0.5383728", "0.5363046", "0.53577214", "0.5353581", "0.5344765", "0.53447634", "0.5316442", "0.52915776", "0.52712995", "0.52571905", "0.5253082", "0.5253082", "0.5240961", "0.52354485", "0.52314", "0.5194331", "0.51934856", "0.5186819", "0.5183551", "0.516034", "0.51551545", "0.51551545", "0.51551545", "0.5143082", "0.5055273", "0.50543565", "0.50381273", "0.50376695", "0.5027687", "0.50249773", "0.49940005", "0.4986696", "0.4986696", "0.4986696", "0.4986696", "0.49799952", "0.49775603", "0.49758294", "0.4973903", "0.49725613", "0.49688074", "0.4959047", "0.4949844", "0.49419013", "0.49189484", "0.49142316", "0.49129337", "0.4908771", "0.49038672", "0.49011084", "0.49006674", "0.49005562", "0.4898986", "0.48976228", "0.48717314", "0.48673996", "0.4867268", "0.4860964", "0.48580524", "0.48540038", "0.48510772", "0.4850545", "0.48413944", "0.48385122", "0.48380744", "0.48274273", "0.4826358", "0.4826358", "0.48243752" ]
0.7774939
0
returns the current Analytics::Visitor object, using the visitor's cookie
def current_visitor return @current_visitor unless @current_visitor.nil? # Check if we're logged in first, set the current_visitor from the current_user if logged_in? @current_visitor = current_user.visitor end # If we are not logged in, or if the current_user has no visitor, # then try to find the visitor by the cookie key if @current_visitor.nil? cookie = cookies[self.class.read_inheritable_attribute(:cookie_name)].gsub(/[^0-9a-f]/,'') if cookie if cookie.length > '000000000000000000000000'.length @current_visitor = FunnelCake.engine.visitor_class.find_by_key(cookie) cookies[self.class.read_inheritable_attribute(:cookie_name)] = { :value => @current_visitor.id, :expires => 1.year.from_now } if @current_visitor else begin @current_visitor = FunnelCake.engine.visitor_class.find(cookie) rescue Mongo::InvalidObjectID => e Rails.logger.info e end end end end return @current_visitor end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_site_visitor\n @current_site_visitor ||= begin\n code = ensure_code_cookie\n GreenFlag::SiteVisitor.for_visitor_code!(code)\n end\n end", "def visitor\n @visitor ||= user_signed_in? ? current_user : UserAnon.new(session)\n end", "def track_visitor\n visitor_cookie_name = \"teaser.#{@teaser.id}.visitor\"\n if cookies[visitor_cookie_name].blank? || (@visitor = @teaser.visitors.find_by_cookie(cookies[visitor_cookie_name])).nil?\n @visitor = @teaser.visitors.create!\n install_persistent_cookie(visitor_cookie_name, @visitor.cookie)\n end\n \n if recent_visit = @visitor.visits.last(:conditions => ['visited_at > ?', 1.hour.ago])\n recent_visit.update_attribute(:visited_at, Time.now)\n else\n @visitor.visits.create!\n end\n end", "def get_cookie\n self.headers[\"Cookie\"]\n end", "def cookie\n @cookie ||= Coca::AuthCookie.new(cookies, scope)\n end", "def get_cookie\n cookies[GeventAnalysis::Application::CONSTS[:cookie_name]]\n end", "def getCookie()\n return @cookie\n\tend", "def cookies\n request.cookies\n end", "def cookies\n @request.cookies\n end", "def cookies\n request.cookies\n end", "def cookies\n request.cookies\n end", "def get_cookie_tracking\n dputs __method__.to_s\n track_req = setup_http_request($tracking, @cookie)\n res = @http.request(track_req)\n get_cookie(res)\n end", "def register_funnel_visitor\n @current_visitor = FunnelCake.engine.visitor_class.create(\n :ip=>request.remote_ip.to_s\n )\n @current_visitor.user_id = current_user.id if logged_in?\n @current_visitor.save\n cookies[self.class.read_inheritable_attribute(:cookie_name)] = {\n :value => @current_visitor.id,\n :expires => 1.year.from_now\n }\n end", "def current\n document = @db.max(\"session_cookies\", \"obtained_at\")\n SessionCookie.new(document) unless document.nil?\n end", "def record_visit\n unless (visit_key = cookies[:id])\n visit_key = SecureRandom.urlsafe_base64(16)\n cookies.permanent[:id] = visit_key\n end\n VisitCounter.record(visit_key)\n end", "def http_cookie\n http.cookie\n end", "def cookies() @_cookies ||= ::Merb::Cookies.new(request.cookies, @_headers) end", "def log_visit\n if !session[:logged_visit] && session[:logged_visit]=true\n behavior = behavior_cookie\n\n if !defined?(behavior[\"visits\"]) || !(behavior[\"visits\"].is_a? Integer)\n behavior[\"visits\"] = 1\n else\n behavior[\"visits\"] += 1\n end\n\n cookies.permanent[:behavior] = behavior.to_json\n end\n end", "def setup_analytics\n cookie_value = cookies[\"_ga\"].split(\".\").last(2).join(\".\") if cookies[\"_ga\"]\n cookie_value = nil if cookie_value.blank?\n session[:ga_client_id] ||= cookie_value || SecureRandom.uuid\n opts = {}\n opts[:user_id] = @current_user.id if @current_user\n @tracker = Staccato.tracker(ENV['GA_TRACKING_ID'], session[:ga_client_id], opts)\n end", "def get_cookies\n {\n method: \"Page.getCookies\"\n }\n end", "def cookies\n rack_request.cookies\n end", "def get(context = Context.current)\n if digest = context.cookies[Session.cookie_name]\n session = @cache[digest]\n end\n\n ensure\n unless session\n digest = generate_digest()\n session = Session.new\n session.instance_variable_set(\"@digest\", digest)\n @cache[digest] = session\n end\n\n return session\n end", "def cookie_info\n authenticated_crowd_call(:get_cookie_info)\n end", "def cookie\n self[HttpClient::SET_COOKIE]\n end", "def get_visitor_id(guid, account, user_agent, cookie)\n\n #If there is a value in the cookie, don't change it.\n return cookie unless cookie\n\n message = \"\"\n if guid && guid != \"\"\n #Create the visitor id using the guid.\n message = guid + account\n else\n #otherwise this is a new user, create a new random id.\n message = user_agent + Digest::MD5.hexdigest(get_random_number)\n end\n\n md5_string = Digest::MD5.hexdigest(message)\n\n return \"0x\" + md5_string\nend", "def cookie\n @xmlrpc.cookie\n end", "def cookies\n controller.send(:cookies)\n end", "def get_session_cookie(req)\n return req.cookies[SESSION_COOKIE]\n end", "def cookies\n call_once\n @cookies\n end", "def cookies\n @agent.cookie_jar.to_a\n end", "def cookie_jar\n @agent.cookie_jar\n end", "def inspect\n \"#<CGI::Cookie: #{self.to_s.inspect}>\"\n end", "def set_site_visitor\n ensure_code_cookie\n record_login(current_user) if current_user\n end", "def get_userid\n request.cookies['userid']\n end", "def cookies; @cookies ||= CookieJar.new; end", "def get_cookie(name)\n browser.cookie_named(name)\n end", "def ga_get_tracker\n return GoogleAnalytics::get_instance(@context).new_tracker(@property_id)\n end", "def auth_cookie\n cookies[:auth]\n end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def view(visitor, options={})\n build_or_create_visit(visitor, {:unique => !visited_by?(visitor)}.merge(options))\n end", "def track_web_analytics\r\n @web_analytics = WebAnalytics.new\r\n @web_analytics.request = request\r\n @web_analytics.page_reader = session_user.screen_name if session_user\r\n end", "def serialize_from_cookie(*args)\n id, token, generated_at = *args\n\n record = to_adapter.get(id)\n record if record && record.remember_me?(token, generated_at)\n end", "def log_visit\n session_id = request.session_options[:id]\n client = DeviceDetector.new(request.env[\"HTTP_USER_AGENT\"])\n client_os = client.os_name\n if !VisitorLog.find_by_session_id(session_id)\n VisitorLog.create(:session_id => session_id, :logged_in => false, :device_type => client_os)\n end\n\n if VisitorLog.find_by_session_id(session_id)\n log = VisitorLog.find_by_session_id(session_id)\n if !log.logged_in && logged_in?\n log.update_attribute(\"logged_in\", true)\n log.save\n end\n\n if logged_in? && current_user.department_id.present? && log.department_id.nil?\n log.update_attribute(\"department_id\", current_user.department_id)\n log.save\n end\n end\n\n end", "def cookies\n @controller.send(:cookies)\n end", "def collect_cookies_from_response; end", "def cookieMe\n if user_signed_in?\n cookies[:user_id] = current_user.id\n cookies[:user_token] = current_user.salt\n cookies[:user_username] = current_user.username\n cookies[:language] = current_user.language\n elsif !user_signed_in?()\n cookies.delete :user_id\n cookies.delete :user_token\n cookies.delete :user_username\n end\n end", "def cookies\n CookieJar.new(self)\n end", "def get_user_privacy_cookie\n @user_privacy_policy = cookies[:user_privacy_policy]\n end", "def retrieve_tag(cli, request)\n cookie = CGI::Cookie.parse(request.headers['Cookie'].to_s)\n tag = cookie.has_key?(cookie_name) && cookie[cookie_name].first\n\n if tag.blank?\n # Browser probably doesn't allow cookies, plan B :-/\n vprint_status(\"No cookie received for #{cli.peerhost}, resorting to headers hash.\")\n ip = cli.peerhost\n os = request.headers['User-Agent']\n tag = Rex::Text.md5(\"#{ip}#{os}\")\n else\n vprint_status(\"Received cookie '#{tag}' from #{cli.peerhost}\")\n end\n\n tag\n end", "def cookies # :doc:\n request.cookie_jar\n end", "def cookies\n controller.respond_to?(:cookies, true) ? controller.send(:cookies) : nil\n end", "def get_cookie(my_env,key)\r\n cookies = Hash.new\r\n if my_env.has_key?('rack.request.cookie_hash')\r\n if my_env['rack.request.cookie_hash'].has_key?(key)\r\n return(my_env['rack.request.cookie_hash'][key])\r\n else\r\n return(nil)\r\n end\r\n end\r\n end", "def stash_cookie\n cookies[self.class.els_options['cookie']] = {\n :value => @els_identity.token_id,\n :domain => request.env[\"SERVER_NAME\"],\n :path => '/',\n :expires => Time.now + 24.hours\n }\n end", "def find_verified_user\n if verified_user = env['warden'].user\n verified_user\n elsif cookies[:ahoy_visitor].present?\n verified_visit = Ahoy::Visit.where(visitor_token: cookies[:ahoy_visitor])\n puts '--------------------------'\n puts 'ApplicationCable visit: ' + verified_visit.inspect\n puts '--------------------------'\n verified_visit\n else\n reject_unauthorized_connection\n end\n end", "def cookies # :doc:\n request.cookie_jar\n end", "def browser_timezone\n cookies[:timezone]\n end", "def cookieMe\n if user_signed_in?\n cookies[:user_id] = current_user.id\n cookies[:user_token] = current_user.salt\n cookies[:user_username] = current_user.username\n cookies[:language] = current_user.language\n elsif !user_signed_in?()\n cookies.delete :user_id\n cookies.delete :user_token\n cookies.delete :user_username\n end\n end", "def [](name)\n cookie = @cookies[name.to_s]\n if cookie && cookie.respond_to?(:value)\n cookie.size > 1 ? cookie.value : cookie.value[0]\n else\n cookie\n end\n end", "def get_cookie\n txid = get_txid\n response = send('q' => 'cookie', 'txid' => txid)\n raise 'wrong txid in reply' if response['txid'] and response['txid'] != txid\n response['cookie']\n end", "def cookies_for domain\n @cookies ||= {}\n @cookies[ domain ]\n end", "def get_cookie(name)\n @driver.manage.cookie_named(name)\n end", "def me\n cookie = cookies[:auth_token]\n @current_user ||= User.find_by_auth_token(cookie) if cookie\n end", "def cookies # :doc:\n request.cookie_jar\n end", "def get_cookie\n resp = @cookie\n if @atl_token != \"\"\n resp = resp + \"; atl.xsrf.token=#{@atl_token}\"\n end\n puts \"Using cookie: #{resp}\".yellow\n resp\n end", "def set_tracking\n # set ad campaign stats if a source is in the url\n if cookies[:visitor_token].nil?\n begin\n visitor_token = SecureRandom.urlsafe_base64\n end while Applicant.exists?(:visitor_token => visitor_token)\n cookies[:visitor_token] = { value: visitor_token, expires: 30.days.from_now }\n end\n\n \tif !params[:src].nil?\n session[:src] = params[:src] \n session[:camp] = params[:camp]\n session[:adgrp] = params[:adg]\n session[:kw] = params[:kw]\n session[:ad] = params[:ad]\n session[:plc] = params[:plc]\n end\n\n # set site tracking stats\n if session[:page_views].nil?\n session[:page_views] = 1 \n #for direct visitors session[:referer_uri] is nil\n session[:referer_uri] = request.env[\"HTTP_REFERER\"]\n session[:device] = set_device\n session[:entry_page] = request.fullpath\n session[:entry_time] = Time.now\n else\n session[:page_views] += 1\n end\n end", "def visitors\n visited = self.visits.select { |visit| visit.visited == true }\n visited.map { |museum| museum.user }\n end", "def session_cookie_value\n cookies[_session_id_key]\n end", "def cookie_value; end", "def cookies\n HTTY::CookiesUtil.cookies_from_string @headers[COOKIES_HEADER_NAME]\n end", "def cookies\n test_cookies\n end", "def show\n if @invite.first_viewed_at < Time.now - 1.year && @invite.created_at < Time.now - 1.hour\n @invite.first_viewed_at = Time.now\n end\n @invite.most_recently_viewed_at = Time.now\n @invite.save\n \n cookies[:user_url] = @invite.url\n end", "def viewer\n @viewer ||=\n User.find_by_facebook_uid(facebook_cookies[:user_id]) ||\n User.new(:facebook_uid => facebook_cookies[:user_id])\n end", "def logged_in_user\n @current_user = User.find_by_id(session[:cookie])\n end", "def access_token_from_cookie\n authenticator.get_user_info_from_cookies(request.cookies)['access_token']\n rescue => err\n warn err.message\n end", "def access_token_from_cookie\n authenticator.get_user_info_from_cookies(request.cookies)['access_token']\n rescue => err\n warn err.message\n end", "def get_id_from_cookie\n Sinatra::Authentication::Cookies::Hashing.decrypt(cookies[:ottoman_connection], settings.private_key)\n end", "def serialize_into_cookie(record); end", "def set_visitor\n @visitor = Visitor.find(params[:id])\n end", "def set_visitor\n @visitor = Visitor.find(params[:id])\n end", "def cookie\n # 'frontend=aaa'\n nil\n end", "def set_visitor\n @visitor = Visitor.find(params[:id])\n end", "def set_visitor\n @visitor = Visitor.find(params[:id])\n end", "def set_visitor\n @visitor = Visitor.find(params[:id])\n end", "def visited_by?(visitor)\n if visitor.is_a?(String)\n return self.visits.find(:first, :conditions => {:uuid => visitor, :unique => true},\n :order => \"visits.created_at ASC\") unless visitor.blank?\n else\n return self.visits.find(:first, :conditions => {:visitor_id => visitor.id, :unique => true},\n :order => \"visits.created_at ASC\") unless visitor.new_record?\n end\n false\n end", "def guest_user\n User.find_by_lazy_id(cookies[:uuid])\n end", "def get_cookie(name)\n @cookies.each do |cookie|\n return cookie if cookie.name == name\n end\n nil\n end", "def session\n if Rails.env.test?\n cookies\n else\n super\n end\n end", "def show\n @visitor = Analytics::Visitor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "def get_session_cookie(response)\n response.get_fields('set-cookie').each do |cookie|\n return cookie if cookie =~ /JSESSIONID/\n end\n end", "def web_browser_cookie_settings\n return @web_browser_cookie_settings\n end", "def visitor_registered?\n cookies[self.class.read_inheritable_attribute(:cookie_name)].nil? == false\n end", "def cookie_path; end", "def vroute_cookie\n route = @stream.config[:http].vroute\n route ? \"Set-Cookie: vroute=#{route}; path=/; HttpOnly\" : nil\n end", "def current_golfer\n if(golfer_id = session[:golfer_id])\n @current_golfer ||= Golfer.find_by(id: golfer_id)\n elsif (golfer_id = cookies.signed[:golfer_id])\n golfer = Golfer.find_by(id: golfer_id)\n #if golfer && golfer.authenticated?(:remember, cookies[:remember_token])\n if golfer\n log_in golfer\n @current_golfer = golfer\n end\n end\n end" ]
[ "0.6747968", "0.6712068", "0.62937355", "0.62856764", "0.6272715", "0.61715776", "0.6121291", "0.60851467", "0.60616726", "0.6061551", "0.6045324", "0.6008674", "0.5947324", "0.5932483", "0.58395094", "0.5770199", "0.5742773", "0.57132494", "0.56777716", "0.5668247", "0.56604207", "0.5659227", "0.55646425", "0.5549368", "0.5547596", "0.5538332", "0.5530676", "0.5523228", "0.55218256", "0.5502232", "0.55006963", "0.5484281", "0.54809815", "0.5424242", "0.5419019", "0.54181814", "0.54105663", "0.53636086", "0.53570217", "0.53570217", "0.53570217", "0.53570217", "0.53570217", "0.53570217", "0.53570217", "0.53383154", "0.53359336", "0.53306687", "0.5324955", "0.53133565", "0.52960396", "0.5294876", "0.5263839", "0.5259023", "0.5252405", "0.52426094", "0.5242074", "0.5239704", "0.5237733", "0.52341884", "0.52329713", "0.52286834", "0.52267104", "0.5219095", "0.5217398", "0.5212957", "0.52102417", "0.5208637", "0.51864547", "0.51772594", "0.5172268", "0.51715595", "0.5160623", "0.5151416", "0.51487464", "0.51447266", "0.51435274", "0.5128302", "0.51280046", "0.51073474", "0.51073474", "0.5104806", "0.510272", "0.50934625", "0.50934625", "0.5088462", "0.5087825", "0.5087825", "0.5087825", "0.5081279", "0.50759465", "0.5065868", "0.505999", "0.5039938", "0.50353205", "0.5030828", "0.50207263", "0.501666", "0.5012029", "0.5005124" ]
0.76355803
0
Parse methods like puts
def parse_methods(line) line.each do |token| next unless token[:type] == :IDENTIFIER return { identifier: token[:value].to_sym, value: parse_sub_methods(line - [token]) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_method(*) end", "def puts(str)\nend", "def method_that_says(stuff)\n\tputs (stuff)\nend", "def puts(*args)\nend", "def puts(*rest) end", "def puts(*rest) end", "def puts(*rest) end", "def puts(*rest) end", "def say(m); puts m; end", "def puts\n end", "def puts(message); end", "def parse(input, game)\n method = input.words.first.command_pp\n\n arguments = input.words[1..-1]\n\n output = __send__(\"_#{method}\", arguments.join(\" \"), game)\n end", "def puts_two(*args) #define \"method name\" \n\targ1, arg2 = args\n\tputs \"arg1: #{arg1}, arg2: #{arg2}\"\nend", "def print\n\t\tputs name + ' ' + className + \" just \" + move + \" and said \" + call\n\tend", "def print_something(string)\n puts string\nend", "def print\n puts \"#{name} #{class_name} just #{movement} and said, \\\"#{call}\\\"\"\n end", "def parsed_methods\n parsed_include(:method)\n end", "def first_method(name, age)\n puts \"Hello #{name}. You are #{age} years old\"\nend", "def postprocess_print(send, type, line)\n if type == \"syntaxchecksuccess\"\n return syntax_check_success(send, line)\n\n elsif type == \"syntaxcheckfail\"\n return syntax_check_fail(send, line)\n\n elsif type == \"augmentsuccess\"\n return augment_success(send, line)\n\n elsif type == \"augmentfail\"\n return augment_fail(send, line)\n\n elsif type == \"executeoutput\"\n return execute_output(send, line)\n\n elsif type == \"executeerror\"\n return execute_error(send, line)\n end\n end", "def parse; end", "def parse; end", "def parse; end", "def method_shark es, method_name\n es.select {|e| e.method_name == method_name }\n .map {|e| \"\\n\\n\\n#{e.date}\\n\\n#{e.method_body}\" }\nend", "def parse;\n \"Parsing method\";\n end", "def _format_method\n return @_format_method if @_format_method\n\n arguments_type = ::Hash\n @_has_parameters = false\n\n # RANT RANT RANT:\n # THIS CODE DOES NOT WORK.\n # there is a bug in the Ruby parser in some cases.\n # In this object:\n # instance_eval(\"t :foo\")\n # cannot parse :foo\n # However it works fine in irb and ruby -e.\n #\n # kurt@cashnetusa.com 2009/01/08\n=begin\n # Handle early subsititions.\n @_template = @template.gsub(/\\<\\{\\{(.*?)\\}\\}\\>/) do | m |\n expr = $1\n # expr = \"(#{expr}).to_s\"\n expr = \"\\n#{expr}\\n\"\n expr = \"begin#{expr}end\"\n #expr = \";nil; (#{expr});\"\n # expr = \"lambda { || #{expr}; }.call\"\n $stderr.puts \"expr = #{expr}\"\n #Contenter::Api::Selector.with(@_selector) do\n result = instance_eval(expr).to_s\n #end\n # $stderr.puts \"result = #{result.inspect}\"\n result\n end\n=end\n @_template ||= @template\n @_template = @template if @_template == @template\n @_template.freeze\n\n parameter_offset = -1\n p = @_template\n t = \"'\"\n until p.empty?\n case\n # Escape string delimiters.\n when m = /\\A([\\\\'])/.match(p)\n t << '\\\\' + m[1]\n\n # Parameter subsititutions.\n when m = /\\A(\\{\\{\\{(.*?)\\}\\}\\})/.match(p)\n t << '\\' << (' << m[2] << ').to_s << \\''\n @_has_parameters = true\n\n # \"early\" subsititutions.\n # SEE RANT ABOVE.\n when m = /\\A(\\<\\{\\{(.*?)\\}\\}\\>)/.match(p)\n t << '\\' << (' << m[2] << ').to_s << \\''\n @_has_parameters = true\n\n else\n t << p[0 .. 0]\n p = p[1 .. -1]\n \n end\n \n p = m.post_match if m\n end\n t << \"'\"\n\n # STDERR.puts \"template #{template.inspect} => #{t.inspect}\"\n\n # Decide on arguments defaults depending on the template substitutions.\n @arguments_default = \n case arguments_type\n when ::Array\n EMPTY_ARRAY\n when ::Hash\n EMPTY_HASH\n else\n EMPTY_HASH\n end\n @arguments = @arguments_default\n\n # $stderr.puts \"arguments = #{@arguments.inspect}\"\n # $stderr.puts \"arguments_default = #{@arguments_default.inspect}\"\n \n # Define a __format singleton method.\n # TODO: Not thread-safe.\n if @_has_parameters\n t = <<-\"END\"\n def self.__format(args)\n arguments_save = @arguments\n @arguments = args || @arguments_default\n #{t}\n ensure\n @arguments = arguments_save\n end\nEND\n else\n t = <<-\"END\"\n def self.__format(args)\n @_template\n end\nEND\n end\n\n # $stderr.puts \"@_format =\\n#{t}\"\n\n @_format_method = t.freeze\n\n rescue Exception => err\n new_err = err.class.new(\"#{err} in #{self.inspect}:\\n #{err.backtrace * \"\\n \"}\")\n raise new_err\n end", "def print\r\n\t\tputs name + \" \" + className + \" says \" + call\r\n\tend", "def post_process\n @method_suffix = \"\"\n @arity = @words.length\n @bareword_slots = []\n @words.each_with_index do |word|\n case word\n when '*'\n @arity = MULTIPLE_ARGS \n @method_suffix += \"_star\"\n @bareword_slots << nil\n when Purugin::CommandParser::Syntax::Variable\n @bareword_slots << nil\n else\n # FIXME: Invalid syntax possible..error now or later?\n @method_suffix += \"_#{word}\"\n @bareword_slots << word\n end\n end\n @method_suffix = \"_#{name}\" if name # If name specified for command use that.\n end", "def get_parse(s);end", "def print\n\t\tputs name + \" \" + className + \" says \" + call\n\tend", "def parse_method_call(line)\n method, string = line.match(/^\\s*([a-z0-9_\\[\\]]+)(.*)/)[1..2]\n raise \"no method found\" unless method\n\n start_new_translation if method == 'msgid' and translation_complete?\n @last_method = method.to_sym\n add_string(string)\n end", "def parse_method_call(line)\n method, string = line.match(/^\\s*([a-z0-9_\\[\\]]+)(.*)/)[1..2]\n raise \"no method found\" unless method\n\n start_new_translation if method == 'msgid' and translation_complete?\n @last_method = method.to_sym\n add_string(string)\n end", "def print\r\n puts name + \" \" + className + \" says \" + \"\\\"\" + call + \"\\\"\"\r\n end", "def do_something this , that ,other\n puts \"We , I mean I ,am doing ,er , something!\"\nend", "def parslets; end", "def two_more_things (arg1, arg2)\n puts \"arg1:#{arg1}, arg2:#{arg2}\"\nend", "def parse_method(method)\n method.downcase.to_sym\n end", "def _perform(text)\n lines = text.split(\"\\n\")\n lines.map! {|line|\n line.gsub(/\\[\\[(.)+\\]\\]/i){|found|\n /\\[\\[([a-z_]*): ([a-z_]*)\\]\\]/i =~ found\n _perform(self.send($1.to_sym, $2))\n }\n }\n lines.join(\"\\n\")\n end", "def print_two(thing, another_thing)\n\t# this is where the method's code goes.\n\tputs \"thing 1: #{thing}, thing 2: #{another_thing}\"\nend", "def method_missing(method_sym, *arguments, &block)\n method = method_sym.to_s\n\n #puts \"%s %s %s\" % [\"---- \", method, \" ----\"]\n #\n if method =~ /^[A-Z]\\d{2}(_\\d{2})?/\n Array(parse(get_spec(method))).join(', ') rescue ''\n elsif respond_to?((/(\\w+)/.match(method))[0])\n instance_eval(method) rescue ''\n # for testing:\n elsif %w(E_STRING E_MULTI_STRING E_NUMBER E_DATETIME E_DATE E_TIME E_YES_NO E_SINGLE E_MULTIPLE E_ALLOW_NEGATIVE E_LOOKUP).include?(method)\n Array(parse(get_spec(method))).join(', ') rescue ''\n else\n super\n end\n end", "def parslet; end", "def parslet; end", "def parslet; end", "def parslet; end", "def parseLine(line,f=nil,i)\n\t# get the command type of the line \n\ttype = commandType(line)\n\t# if the type is not an array or the command doesnt have a type, throw an error\n\tif type.class != Array || type.length == 0 then return -1 else args = arg(line,type[0]) end\n\t# if the first element of the array is a hash --> its arithmentic\n\tif type[0].class == Hash then code = writeArithmetic(type[0],i)\n\telsif type.length != 1 then return -2\n\t# if theres only 1 type and its push or pop \n\telsif ['push','pop'].include?(type[0]) then code = mac(type[0] == 'push',args[0],args[1],f)\n\telse \n\t\t# this is another type that we should handle in future assignments\n\t\tt = [:func,:call,:ret,:label,:goto].select{|x| type[0].include?(x.to_s)}\n\t\tif t && t.length == 1 then code = method(t[0]).call(args,i)\n\t\t\t# unrecognized type -- throw error\n\t\telse return -3 end\n\tend\n\treturn code\nend", "def extract_method(args)\n raise_error_if_absent(args, [\"name\", \"start\", \"end\"])\n \n method_lines = extract_method_lines(args[:start])\n selected_lines = Range.new(args[:start], args[:end])\n method_contents = extract_method_contents(selected_lines)\n parameters = extract_parameters(method_contents)\n method_call = \"#{args[:name]}\"\n method_call += \"(#{parameters.join(', ')})\" unless parameters.empty?\n \n new_code = \"\"\n \n @code.each_line.with_index do |line, n|\n line_number = n + 1 ##### not 0-based\n if line_number == selected_lines.first\n call_identation = extract_identation_level_from line\n new_code << call_identation\n \n return_value = assignment_value(method_contents)\n unless return_value.nil?\n new_code << \"#{return_value} = \"\n method_contents.gsub!(/^(.*)#{return_value}\\s*=\\s*(.*)$/m, '\\1\\2')\n end\n \n new_code << \"#{method_call}\\n\"\n method_contents.gsub!(/^#{call_identation}/, \"\")\n elsif line_number == method_lines.last\n method_identation = extract_identation_level_from line\n # In this order to keep the line break preference\n new_code << \"#{method_identation}end\\n\"\n new_code << \"\\n#{method_identation}def #{method_call}\\n\"\n new_code << ident(method_contents, method_identation+\" \")\n end\n \n new_code << line unless selected_lines.include? line_number\n end\n new_code\n end", "def test_space_args_cmd\n assert_parses(\n s(:send, nil, :fun,\n s(:begin, s(:send, nil, :f, s(:lvar, :bar)))),\n %q{fun (f bar)})\n end", "def my_method2 argument1, argument2\n print argument1, \" \", argument2, \"\\n\" \n end", "def say (something)\n puts something\nend", "def foo # String instance method\n puts \"foo\"\n end", "def print_two (thing, another_thing)\r\n #...this is where the code goes\r\n puts \"thing_1: #{thing}, thing 2: #{another_thing}\"\r\nend", "def echo(str)\n p str\nend", "def print_method(context)\n m = method(eval(\"__method__\", context)) \n params = m.parameters.map { |param| param[1] }\n param_list = params.map { |param| \"#{param} = #{eval(param.to_s, context)}\" }.join(', ')\n puts \"#{m.name.to_s}(#{param_list})\"\nend", "def parsed; end", "def parsed; end", "def firstMethod()\n p \"hey this is first method ok\"\n p \"here i show how can create method in ruby\"\n p \" know time end \"\nend", "def do_something this,that,other\n puts \"We,I mean I ,am doing,er ,something!\"\nend", "def methods() end", "def method_missing(method, *params)\n raw_line.send method, *params\n end", "def FunctionCall(rest, parsed); end", "def cmd_cmds\n puts self.methods.grep(/^cmd_/).map {|m| m[4..-1]} * \" \"\n end", "def inspect(*) end", "def inspect(*) end", "def inspect(*) end", "def inspect(*) end", "def inspect(*) end", "def say(str)\n \"=> #{str}\"\nend", "def bornin _method, _class = [\n Fixnum,\n Float,\n String,\n Array,\n Hash,\n Range,\n Regexp,\n Math\n]\n\n # to colorize output\n require 'colorize'\n\n # Check\n if _method==nil\n return puts \"=> please pass first arg as a string\".red\n end\n\n # the patten to grep for\n re = Regexp.new '^' + _method.to_s + '$'\n\n # born in BasicObject?\n if BasicObject.instance_methods(false).grep(re).size==1\n return puts \"=> #{_method} : \" +\n \". born in BasicObject as an instance method\".green\n # born in Kernel?\n elsif Kernel.instance_methods(false).grep(re).size==1\n return puts \"=> #{_method} : \" +\n \".. born in Kernel as an instance method\".green\n # born in Object?\n elsif Object.instance_methods(false).grep(re).size==1\n return puts \"=> #{_method} : \" +\n \"... born in Object as an instance method\".green\n # born in Module?\n elsif Module.instance_methods(false).grep(re).size==1\n return puts \"=> #{_method} : \" +\n \".... born in Module as an instance method\".green\n end\n\n # puts \"check what class is _class\"\n # check what class is _class\n if _class.class == String\n _class = eval(_class)\n elsif _class.class == Symbol\n _class = Kernel.const_get(_class.to_s)\n # relying on some very basic classes listed above when\n # _class was not passed as a param\n elsif _class.is_a? Array\n _class.each do |e|\n # puts \"Checking #{_method} in #{e} ...\"\n output = bornin2 _method, e\n output || break\n # return\n end\n else\n bornin2 _method, _class\n end\n\nend", "def special_handler method, *args, &block\n # Sublevel markers, e.g. “ •” is level 2 line-item\n if level(method) > 0 && self.class::REGULAR_TAGS.keys.include?(m = (canonize method))\n self.class.class_eval \"alias_method :#{method}, :#{m}\"\n send method, args, block\n elsif self.class.instance_methods.include?(m = (normalize method))\n send(m, args) { yield if block_given? ; method.to_s }\n else\n [method, args].flatten\n end\n end", "def puts(string)\n print \"#{string}\\n\"\nend", "def echo(s)\n s\nend", "def operations\n puts \"(a) - addition (+)\"\n puts \"(s) - subtraction (-)\"\n puts \"(m) - multiplication (*)\"\n puts \"(d) - division (/)\"\nend", "def two_arg_method(arg1, arg2)\n puts \"Here are my args: #{arg1}, #{arg2}\"\nend", "def method(arg_1, arg_2)\n p arg_1\n p arg_2\nend", "def method_array\n @parser = nil\n @caller_lines.each do |kaller|\n code = Ripper.sexp(kaller.contents)\n code ||= Ripper.sexp(kaller.contents.sub(/^\\W*(if|unless)/, ''.freeze)) # if and unless \"block\" statements aren't valid one line ruby code\n code ||= Ripper.sexp(kaller.contents.sub(/do \\|.*\\|$/, ''.freeze)) # remove trailing do |thing| to make valid code\n code ||= Ripper.sexp(kaller.contents.sub(/(and|or)\\W*$/, ''.freeze))# trailing and || or\n code ||= Ripper.sexp(kaller.contents.sub(/:\\W*$/, ''.freeze)) # multi line ternary statements\n code ||= Ripper.sexp(kaller.contents.sub(/(^\\W*)|({ \\|?.*\\|?)}/, ''.freeze)) # multi line blocks using {}\n\n puts \"LetItGoFailed parse (#{kaller.file_name}:#{kaller.line_number}: \\n \\033[0;31m\"+ kaller.contents.strip + \"\\e[0m\".freeze if ENV['LET_IT_GO_RECORD_FAILED_CODE'] && code.nil? && kaller.contents.match(/\"|'/)\n\n parser = ::LetItGo::WTFParser.new(code, contents: kaller.contents)\n\n if parser.each_method.any? { |m| m.method_name == method_name }\n @line_number = kaller.line_number\n @file_name = kaller.file_name\n\n @parser = parser\n parser.each_method.each(&:arg_types)\n break\n else\n next\n end\n end\n @parser || []\n end", "def info(msg)\n puts \"\\n ==> #{msg}\"\nend", "def do_something this, that, other\n puts \"We, I mean I, am doing, er, something!\"\nend", "def echo( word )\n word\nend", "def echo(str)\n puts str\nend", "def method # test comment\n# ^^^ meta.function.method.without-arguments.ruby keyword.control.def.ruby\n# ^^^^^^ meta.function.method.without-arguments.ruby entity.name.function.ruby\n# ^ comment.line.number-sign.ruby punctuation.definition.comment.ruby\n# ^^^^^^^^^^^^^ comment.line.number-sign.ruby\n hello, world = [1,2]\n# ^^^^^ variable.other.ruby\n# ^ punctuation.separator.object.ruby\n# ^^^^^ variable.other.ruby\n# ^ keyword.operator.assignment.ruby\n# ^ punctuation.section.array.begin.ruby\n# ^ constant.numeric.ruby\n# ^ punctuation.separator.object.ruby\n# ^ constant.numeric.ruby\n# ^ punctuation.section.array.end.ruby\n end", "def print(*rest) end", "def print(*rest) end", "def print(*rest) end", "def print(*rest) end", "def method_missing(method, *args)\n case args[0]\n when Hash\n @r.cmd(\"#{method}(#{args[0].to_r})\")\n when Symbol\n @r.cmd(\"#{method}(#{args[0]})\")\n when String\n @r.cmd(\"#{method}(#{args[0]})\")\n when nil\n @r.cmd(\"#{method}()\")\n end\n end", "def say_hello(thing_to_say)\n puts thing_to_say \nend", "def parser; end", "def parser; end", "def parser; end", "def parser; end", "def parse_extended\n [get_symbol, parse]\n end", "def parse\n {:indent => @indent, :command => parse_command}\n end", "def parse_method_parameters method\n res = parse_method_or_yield_parameters method\n\n res = \"(#{res})\" unless res =~ /\\A\\(/\n method.params = res unless method.params\n\n return if method.block_params\n\n skip_tkspace_without_nl\n read_documentation_modifiers method, RDoc::METHOD_MODIFIERS\n end", "def method_signature\n case @opcode.arguments.size\n when 0\n @file.puts \" def #{method_name}\"\n when 1\n @file.puts \" def #{method_name}(arg1)\"\n when 2\n @file.puts \" def #{method_name}(arg1, arg2)\"\n end\n end", "def method_missing(m, *a, &b)\n strategy =\n case m.to_s\n when %r/^(.*[^_])_(!)?$/o\n :open_tag\n when %r/^_([^_].*)$/o\n :close_tag\n when 'e'\n :element\n when '__', '___'\n :puts\n else\n nil\n end\n\n if(strategy.nil? or (tagz.nil? and Tagz.privately===self))\n begin\n return super\n ensure\n :do_nothing_until_strange_core_dump_in_ruby_2_5_is_fixed\n # $!.set_backtrace caller(1) if $!\n end\n end\n \n case strategy\n when :open_tag\n m, bang = $1, $2\n b ||= lambda{} if bang\n tagz{ tagz__(m, *a, &b) }\n\n when :close_tag\n m = $1\n tagz{ __tagz(m, *a, &b) }\n\n when :element\n Tagz.element.new(*a, &b)\n\n when :puts\n tagz do\n tagz.push(\"\\n\")\n unless a.empty?\n tagz.push(a.join)\n tagz.push(\"\\n\")\n end\n end\n end\n end", "def function2method(method)\n \"#{Indentation.get}this.#{method.to_s[4 + Indentation.size..-1]}\"\n end", "def puts! arg, label=''\n puts \"+++ +++ #{label}\"\n puts arg.inspect\nend", "def p(string);end", "def method(arg1, arg2)\n p arg1\n p arg2\nend", "def print_stuff\n puts \"#{private_method_hello} annnnnd buh-#{private_method_bye}\"\n end", "def print_foo(bar)\n puts Foo\n puts @foo\n puts bar\nend", "def my_method\n puts \"ayyy\"\n puts \"joe\"\nend" ]
[ "0.63781714", "0.6233059", "0.6194906", "0.5961395", "0.5944565", "0.5944565", "0.5944565", "0.5944565", "0.592678", "0.5824414", "0.5754946", "0.5737878", "0.5706944", "0.57040983", "0.56837654", "0.56832343", "0.56503844", "0.56341773", "0.56329644", "0.55789065", "0.55789065", "0.55789065", "0.55583405", "0.55528295", "0.5545956", "0.5545424", "0.5537487", "0.55338967", "0.5531028", "0.5524067", "0.5524067", "0.55215955", "0.5520737", "0.55000323", "0.54961014", "0.5479109", "0.5474731", "0.5460024", "0.54343647", "0.5433591", "0.5433591", "0.5433591", "0.5433591", "0.5422989", "0.5416082", "0.5407101", "0.5406029", "0.5401629", "0.5394036", "0.5390163", "0.53889436", "0.5386701", "0.5374769", "0.5374769", "0.5347023", "0.5344415", "0.53436047", "0.5335495", "0.5329636", "0.5326461", "0.5312285", "0.5312285", "0.5312285", "0.5312285", "0.5312285", "0.5308965", "0.5305144", "0.5301088", "0.5299094", "0.52955484", "0.5294516", "0.52875227", "0.5284117", "0.5283593", "0.5281782", "0.5280015", "0.5271074", "0.5268816", "0.52639", "0.5263496", "0.5263496", "0.5263496", "0.5263496", "0.5261018", "0.5259951", "0.5253035", "0.5253035", "0.5253035", "0.5253035", "0.5248132", "0.52469355", "0.5244172", "0.5237711", "0.5234753", "0.52332395", "0.52296525", "0.52293926", "0.52290744", "0.52247965", "0.52149343", "0.52126616" ]
0.0
-1
Parse sub methods like to_string, to_integer
def parse_sub_methods(line) new_line = [] line.each do |token| next unless token[:type] == :IDENTIFIER arguments_size = 0 SUBMETHODS.each do |submethod| next unless submethod[:ikea_name] == token[:value].to_sym arguments_size = submethod[:arguments] end value = [line[line.index(token) + arguments_size]] line -= value line[line.index(token)] = { identifier: token[:value].to_sym, value: value } return line end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_missing(meth, *args, &block)\n if args.empty? && !block_given? && (match = /\\Ato_(\\w+)\\Z/.match(meth.to_s))\n begin\n convert_to(match[1])\n rescue ExpressionError\n super(meth, *args, &block)\n end\n else\n super(meth, *args, &block)\n end\n end", "def method_missing(method_id, *arguments)\n case method_id.to_s\n when /convert_complex_pattern_for_([_a-zA-Z]\\w*)/\n attribute = $1\n convert_complex_pattern(attribute)\n else\n super\n end\n end", "def method_missing(method_sym, *arguments, &block)\n method = method_sym.to_s\n\n #puts \"%s %s %s\" % [\"---- \", method, \" ----\"]\n #\n if method =~ /^[A-Z]\\d{2}(_\\d{2})?/\n Array(parse(get_spec(method))).join(', ') rescue ''\n elsif respond_to?((/(\\w+)/.match(method))[0])\n instance_eval(method) rescue ''\n # for testing:\n elsif %w(E_STRING E_MULTI_STRING E_NUMBER E_DATETIME E_DATE E_TIME E_YES_NO E_SINGLE E_MULTIPLE E_ALLOW_NEGATIVE E_LOOKUP).include?(method)\n Array(parse(get_spec(method))).join(', ') rescue ''\n else\n super\n end\n end", "def method_missing(id, *args)\n\t # Check this before valid_conversion? because valid_conversion? has low standards\n\t if (id.to_s =~ /(.+)\\?$/) and Units.valid_unit?($1)\n\t\t@units.is_a?($1)\n\t elsif @units.valid_conversion?(id)\n\t\tunits = Units.new(id)\n\t\t(@units == units) ? self : self.class.new(@units.convert(@value, id), units)\n\t elsif (id.to_s =~ /^to_(.+)$/) and Units.valid_unit?($1)\n\t\tunits = Units.new($1)\n\t\treturn self if @units == units\n\t\tself.class.new(@units.convert(@value, $1), units)\n\t else\n\t\t@value.send(id, *args)\n\t end\n\tend", "def get_parse(s);end", "def method_missing(id, *args)\n\t # Check this before valid_conversion? because valid_conversion? has low standards\n\t if (id.to_s =~ /(.+)\\?$/) and Units.valid_unit?($1)\n\t\t@units.is_a?($1)\n\t elsif (@units and @units.valid_conversion?(id)) or Units.valid_unit?(id)\n\t\tunits = Units.new(id)\n\t\tif @units\n\t\t (@units == units) ? self : self.class.new(@units.convert(@value, id), units)\n\t\telse\n\t\t self.class.new(value, units)\n\t\tend\n\t elsif (id.to_s =~ /^per_(.+)$/) and Units.valid_unit?($1)\n\t\tunits = @units ? @units.per({$1 => (args[0] || 1)}) : Units.new({$1 => -(args[0] || 1)})\n\t\tself.class.new(@value, units)\n\t elsif (id.to_s =~ /^to_(.+)$/) and Units.valid_unit?($1)\n\t\tunits = Units.new($1)\n\t\treturn self if @units == units\n\t\tself.class.new(@units.convert(@value, $1), units)\n\t else\n\t\t@value.send(id, *args)\n\t end\n\tend", "def parse; end", "def parse; end", "def parse; end", "def parse(params) new(params).parse end", "def integer_parsers\n @integer = action(seq(1..9, rep0(0..9))) do |ast|\n ast.flatten.join('').to_i\n end\n end", "def parse_method(method)\n method.downcase.to_sym\n end", "def create_method_from_expressions; end", "def convert_to_base_8(n)\r\n #n.method_name.method_name # replace these two method calls\r\n n.to_s(8).to_i\r\nend", "def call thing, method, args\n case method\n when :+, :-, :/, :*, :%, :<, :>, :<=, :>=, :==\n subject = expression(thing)\n Value.typed subject.type, \"(#{ subject }) #{method} (#{ expression(args.first) })\"\n when :floor, :ceil\n Value.typed CTypeInt, \"#{method}(#{ expression(thing) })\"\n when :[]\n callee = expression(thing)\n index = expression(args.first)\n raise \"Used [] operator on object which is not an Array\" unless callee.type.include? '['\n raise \"Used [] operator with too many index arguments\" if args.length > 1\n raise \"Used [] operator without an index\" if args.length == 0\n raise \"Used [] operator with a non-integer index\" unless index.type == CTypeInt\n Value.typed callee.type.split('[').first, \"#{callee}[#{index}]\"\n when :[]=\n callee = expression(thing)\n index = expression(args[0])\n value = expression(args[1])\n raise \"Used []= operator on object which is not an Array\" unless callee.type.include? '['\n raise \"Used []= operator with too many index arguments\" if args.length > 2\n raise \"Used []= operator needs both index and new value\" if args.length < 2\n raise \"Used []= operator with a non-integer index\" unless index.type == CTypeInt\n Value.typed value, \"#{callee}[#{index}] = #{value}\"\n #when :truncate\n # \"((signed long) #{ expression(thing) })\"\n end\n end", "def parse\n raise NotImplementedError\n end", "def method_missing(method_name, *args, &block)\n if (string = to_s).respond_to?(method_name)\n string.__send__(method_name, *args, &block)\n else\n super\n end\n end", "def parse_methods(line)\n line.each do |token|\n next unless token[:type] == :IDENTIFIER\n\n return {\n identifier: token[:value].to_sym,\n value: parse_sub_methods(line - [token])\n }\n end\n end", "def method_missing(meth, *args, &blk)\n if meth.to_s =~ /^from_([a-z]+)_to_([a-z]+)$/\n from, to = $1, $2\n return translate(args.first, from, to)\n end\n super\n end", "def method_missing(name, *args, &block)\n if name.to_s =~ /^to_(\\w+)$/\n return send(name) if define_conversion($1)\n end\n raise \"Method '#{ name }' unknown\" # TODO use standard exception\n end", "def extract_method_details; end", "def method_missing(id, *args, &block)\n return to_number(columns[$1.to_i]) if id =~ /c(\\d+)/\n return to_date(columns[$1.to_i]) if id =~ /d(\\d+)/\n return columns[$1.to_i] if id =~ /s(\\d+)/\n super\n end", "def parse(str); end", "def parse\n raise NotImplementedError.new\n end", "def coerce(oth)\n case oth\n when String\n oth = parser.parse(oth)\n else\n super\n end\n\n return oth, self\n end", "def parse\n end", "def execute\n case @method\n when \"0001\"\n print decode_twos_complement(@value)\n when \"0010\"\n print decode_floating_point(@value)\n else\n print @value.binary_to_decimal.chr\n end\n end", "def parse_method\n params[:method].gsub!('-', '?') if params[:method].present?\n end", "def parse_method\n params[:method].gsub!('-', '?') if params[:method].present?\n end", "def parse_method\n params[:method].gsub!('-', '?') if params[:method].present?\n end", "def call_method_from_string(str_method)\nend", "def parse_parameters; end", "def method_missing(meth, *args, &block)\n if not @parsed.nil? and @parsed.respond_to?(meth)\n return @parsed.send(meth.to_s, *args, &block)\n end\n return super\n end", "def convert(object); end", "def test_to_num\n assert_equal(11, RomanMathmaticalOperation.new.send(:to_num,\"XI\"))\n assert_equal(0, RomanMathmaticalOperation.new.send(:to_num,\"wrong\"))\n assert_not_equal(11, RomanMathmaticalOperation.new.send(:to_num,\"X\"))\n end", "def method_missing(id, *args) #:nodoc:\n\t\t\tif id.to_s.eql?(\"parse\") \t\t\n\t\t\t\traise Serialbar::Exceptions::NoParseMethodError, \"Parse method not implemented\" \n\t\t\telse\n\t\t\t\traise NoMethodError\n\t\t\tend\n \t\tend", "def convert!; end", "def parse\n raise \"absctract method called\"\n end", "def method_missing(method, *args)\n\t\t#Determines if the method name is the correct format\n\t\tif method.to_s =~ /^plus(\\d+)$/\n\t\t\tself.class.class_eval do\n\t\t\t\tdefine_method(method) {@num + $1.to_i}\t\n\t\t\tend\n\t\t\teval method.to_s\n\t\telse\n\t\t\tsuper\n\t\tend\n\tend", "def parse(virtual); end", "def test_Method_InstanceMethods_call\n\t\tm = 12.method(\"+\")\n\t\tassert_equal(15, m.call(3))\n\t\tassert_equal(32, m.call(20))\n\tend", "def parse_value; end", "def method\n expect :call, :attrasgn, :safe_call, :safe_attrasgn, :super, :zsuper, :result\n\n case self.node_type\n when :call, :attrasgn, :safe_call, :safe_attrasgn\n self[2]\n when :super, :zsuper\n :super\n when :result\n self.last\n end\n end", "def parse_values; end", "def test_Complex_ClassMethods_rect\n\t\tassert_equal(Complex(\"1.23+0.5i\"), Complex.rect(1.23, 0.5))\n\tend", "def test_Complex_ClassMethods_rect\n\t\tassert_equal(Complex(\"1.23+0.5i\"), Complex.rectangular(1.23, 0.5))\n\tend", "def parse_data\n [object_ref, get_symbol, parse]\n end", "def methods_accepting_symbol; end", "def method_missing(*keys)\n # catch behavior of rspec its implementation\n keys.shift if keys.is_a?(Array) && keys[0] == :[]\n # convert the value to an integer if we have numbers only\n # otherwise we return the string\n convert_to_i(fetch_data(keys))\n end", "def call_method_from_string(str_method)\n str_method.method('str_method').call\nend", "def method_missing(method, *args, &block)\n result = to_s.send(method, *args, &block)\n if result.is_a?(String)\n if method.to_s =~ /!$/\n replace(Rope.new(result))\n else\n Rope.new(result)\n end\n else\n result\n end\n end", "def converters; end", "def converters; end", "def converters; end", "def parse(*args)\n Integer(*params[:args]) rescue nil\nend", "def _string_parse!(klass, v)\n klass.parse(v)\n end", "def find_multimethod(x)\n case x\n when String\n signature = Signature.new(:string => x)\n when Method\n signature = x.signature\n when Signature\n signature = x\n end\n\n x = @multimethod.select{|mm| mm.matches_signature(signature)}\n\n x\n end", "def parslets; end", "def _format_method\n return @_format_method if @_format_method\n\n arguments_type = ::Hash\n @_has_parameters = false\n\n # RANT RANT RANT:\n # THIS CODE DOES NOT WORK.\n # there is a bug in the Ruby parser in some cases.\n # In this object:\n # instance_eval(\"t :foo\")\n # cannot parse :foo\n # However it works fine in irb and ruby -e.\n #\n # kurt@cashnetusa.com 2009/01/08\n=begin\n # Handle early subsititions.\n @_template = @template.gsub(/\\<\\{\\{(.*?)\\}\\}\\>/) do | m |\n expr = $1\n # expr = \"(#{expr}).to_s\"\n expr = \"\\n#{expr}\\n\"\n expr = \"begin#{expr}end\"\n #expr = \";nil; (#{expr});\"\n # expr = \"lambda { || #{expr}; }.call\"\n $stderr.puts \"expr = #{expr}\"\n #Contenter::Api::Selector.with(@_selector) do\n result = instance_eval(expr).to_s\n #end\n # $stderr.puts \"result = #{result.inspect}\"\n result\n end\n=end\n @_template ||= @template\n @_template = @template if @_template == @template\n @_template.freeze\n\n parameter_offset = -1\n p = @_template\n t = \"'\"\n until p.empty?\n case\n # Escape string delimiters.\n when m = /\\A([\\\\'])/.match(p)\n t << '\\\\' + m[1]\n\n # Parameter subsititutions.\n when m = /\\A(\\{\\{\\{(.*?)\\}\\}\\})/.match(p)\n t << '\\' << (' << m[2] << ').to_s << \\''\n @_has_parameters = true\n\n # \"early\" subsititutions.\n # SEE RANT ABOVE.\n when m = /\\A(\\<\\{\\{(.*?)\\}\\}\\>)/.match(p)\n t << '\\' << (' << m[2] << ').to_s << \\''\n @_has_parameters = true\n\n else\n t << p[0 .. 0]\n p = p[1 .. -1]\n \n end\n \n p = m.post_match if m\n end\n t << \"'\"\n\n # STDERR.puts \"template #{template.inspect} => #{t.inspect}\"\n\n # Decide on arguments defaults depending on the template substitutions.\n @arguments_default = \n case arguments_type\n when ::Array\n EMPTY_ARRAY\n when ::Hash\n EMPTY_HASH\n else\n EMPTY_HASH\n end\n @arguments = @arguments_default\n\n # $stderr.puts \"arguments = #{@arguments.inspect}\"\n # $stderr.puts \"arguments_default = #{@arguments_default.inspect}\"\n \n # Define a __format singleton method.\n # TODO: Not thread-safe.\n if @_has_parameters\n t = <<-\"END\"\n def self.__format(args)\n arguments_save = @arguments\n @arguments = args || @arguments_default\n #{t}\n ensure\n @arguments = arguments_save\n end\nEND\n else\n t = <<-\"END\"\n def self.__format(args)\n @_template\n end\nEND\n end\n\n # $stderr.puts \"@_format =\\n#{t}\"\n\n @_format_method = t.freeze\n\n rescue Exception => err\n new_err = err.class.new(\"#{err} in #{self.inspect}:\\n #{err.backtrace * \"\\n \"}\")\n raise new_err\n end", "def as(method)\n\n case \"#{method}\"\n when /url/ then return :url\n when /email/ then return :email\n when /phone/ then return :phone\n when /password/ then return :password\n end\n\n case type(method)\n when :string then return :string\n when :integer then return :number\n when :float then return :number\n when :decimal then return :number\n when :timestamp then return :datetime\n when :datetime then return :datetime\n when :date then return :date\n when :time then return :time\n when :text then return :text\n end\n\n return :file if file?(method)\n\n return ::Formula.default_as\n\n end", "def method_missing(method, *argments)\n # defimos o valor e metricas da conversao\n metrics = method.to_s.split '_to_'\n value = argments.first\n\n # se as metricas de origin forem iguais retornamos o valor\n return value if metrics[0] == metrics[1]\n\n # primeiro convertemos a unidade para o valor base\n value = self.method(\"#{metrics[0]}_to_#{@base_unit}\").call value\n\n # agora convertemos a unidade base para a unidade destino\n self.method(\"#{@base_unit}_to_#{metrics[1]}\").call value\n rescue\n super\n end", "def convert\n end", "def convert\n end", "def converter; end", "def method_missing(meth_id, *args)\n meth = meth_id.id2name\n case\n when meth[0..2] == 'to_'\n term = meth[3..-1]\n super unless OptionHandling.valid_terminal?(term)\n to_specific_term(term, *args)\n when meth[-1] == '!'\n option!(meth[0..-2].to_sym, *args)\n when meth[-1] == '='\n option!(meth[0..-2].to_sym, *args)\n option(meth[0..-2].to_sym)\n else\n option(meth_id, *args)\n end\n end", "def convert(data)\n return \"cls #{data.id}, #{data.value}\" if data.is_a? ClassicPattern\n return \"clv #{data.id}, #{data.year}, #{data.make}, #{data.series}, #{data.name}\" if data.is_a? ClassicVehicle\n return \"ci #{data.category.code} #{data.updated_value}\" if data.is_a? ClassicItem\n return \"co #{data.value}\" if data.is_a? ClassicItemOption\n return \"ser #{data.digits} #{data.start_value} #{data.end_value}\" if data.is_a? ClassicSerial\n nil\n end", "def methods=(_arg0); end", "def converters=(_arg0); end", "def string_to_integer(string)\nend", "def normalized_operation\n parse_operation\n end", "def methods_matching(re); end", "def call_method_from_string(str_method)\n send(str_method)\nend", "def string(*) end", "def parse\n individual_parameters = @equation.split(' ')\n\n integer_equation = individual_parameters.map do |param|\n next param if OPERATORS.include?(param)\n\n RomanNumeral.new(param).to_int\n end\n\n integer_equation.join(' ')\n end", "def method(p0) end", "def get_operation(n, algebraic_structure, operation)\n # Example: \"(T, U)\"\n individual_element_type = \"X\"\n\n # Example: \"l : (T, U), r : (T, U)\"\n method_params = \"l : #{individual_element_type}, r : #{individual_element_type}\" # (1..n).to_a.map{ |i| \"x#{i}\" }.map{ |p| \"#{p} : #{individual_element_type}\" }.join(\", \")\n\n # Example: \"(tmonoid.plus(l._1,r._1), umonoid.plus(l._2, r._2))\"\n values_commaed = TYPE_SYMBOLS.first(n).each_with_index.map do |t, i|\n \"#{t.downcase}#{algebraic_structure}.#{operation}(lTuple._#{i+1}, rTuple._#{i+1})\"\n end.join(\", \")\n values_commaed = \"apply(#{values_commaed})\"\n\n \"override def #{operation}(#{method_params}) = { val lTuple = unapply(l).get; val rTuple = unapply(r).get; #{values_commaed} }\"\nend", "def parsed\n raise NotImplementedError\n end", "def method_missing(*rest) end", "def call_method_from_string(str_method)\n send(str_method)\nend", "def coerce_params_for(method, type)\n raise \"Argument type for #{method} could not be found. Did you define a `signature` stanza for it?\" unless type\n\n if method.start_with?('self.')\n simple_name = method.to_s.gsub(/^self./, '').to_sym\n # Look for a Class method\n raise \"Error building typed method signature: Method #{method} is not defined in class #{name}\" unless methods.include?(simple_name)\n\n coerce_params_for_class(method(simple_name), type)\n else\n # Look for an instance method\n raise \"Error building typed method signature: Method #{method} is not defined in class #{name}\" unless method_defined?(method)\n\n coerce_params_for_instance(instance_method(method), type)\n end\n end", "def parse_factor\n case current\n when :L_PARANTH then\n expect(:L_PARANTH)\n exp = parse_expression\n expect(:R_PARANTH)\n\n exp\n when :ID then\n parse_variable_exp\n when :KW_NEW then\n parse_class_init\n else\n parse_constant\n end\n end", "def String(p0) end", "def initialize(obj)\n @methods = obj.is_a?(String) ? DefaultMethods-StringExceptionMethods : DefaultMethods\n end", "def parse(element)\n case element.name\n when 'array'\n element.elements.map {|child| parse(child)}\n\n when 'dict'\n result = {}\n\n element.elements.each_slice(2) do |key, value|\n result[key.text] = parse(value)\n end\n\n result\n\n when 'real'\n element.text.to_f\n\n when 'integer'\n element.text.to_i\n\n when 'string', 'date'\n element.text\n\n else\n # FIXME: Remove me or beef me up\n # puts \"Unknown type \" + element.name\n end\nend", "def breakdown(command)\n types = RESOURCE_TYPES.join('|')\n match = command.to_s.match(/^([^_]+)_(#{types})_?(.+)?$/)\n if match.nil?\n message = \"Could not break down `#{command}' to appropriate type and method.\\n\"\n message << \"The method name shoud be in the form of `action_type_subaction'.\"\n raise message\n end\n return match[1], match[2], match[3]\n end", "def convert(exp)\n if exp == nil\n {}\n elsif exp == false\n {\n :type => :name,\n :id => 'false',\n }\n elsif exp == true\n {\n :type => :name,\n :id => 'true',\n }\n else\n case exp[0]\n when :program\n {\n :type => :program,\n :body => convert(exp[1]),\n :filename => @filename\n }\n when :module\n {\n :type => :module,\n :name => convert(exp[1]),\n :body => convert(exp[2]),\n :filename => @filename\n }\n when :@ident, :@op\n {\n :type => :name,\n :id => exp[1],\n :location => exp[2],\n }\n when :@gvar\n {\n :type => :gvar,\n :id => exp[1],\n :location => exp[2]\n }\n when :dyna_symbol\n # ignore dynamic symbols for now\n {\n :type => :name,\n :id => '#dyna_symbol'\n }\n when :symbol\n sym = convert(exp[1])\n sym[:type] = :symbol\n sym\n when :@cvar\n {\n :type => :cvar,\n :id => exp[1][2..-1],\n :location => exp[2]\n }\n when :@ivar\n {\n :type => :ivar,\n :id => exp[1][1..-1],\n :location => exp[2]\n }\n when :@const, :@kw, :@backtick\n #:@const and :@kw are just names\n {\n :type => :name,\n :id => exp[1],\n :location => exp[2]\n }\n when :@label\n {\n :type => :name,\n :id => exp[1][0..-2],\n :location => exp[2]\n }\n when :def\n {\n :type => :def,\n :name => convert(exp[1]),\n :params => convert(exp[2]),\n :body => convert(exp[3])\n }\n when :defs\n name = {\n :type => :attribute,\n :value => convert(exp[1]),\n :attr => convert(exp[3])\n }\n {\n :type => :def,\n :name => name,\n :params => convert(exp[4]),\n :body => convert(exp[5])\n }\n when :do_block\n {\n :type => :lambda,\n :params => convert(exp[1]),\n :body => convert(exp[2])\n }\n when :lambda\n {\n :type => :lambda,\n :params => convert(exp[1]),\n :body => convert(exp[2])\n }\n when :brace_block\n {\n :type => :lambda,\n :params => convert(exp[1]),\n :body => convert(exp[2])\n }\n when :params\n ret = {:type => :params}\n if exp[1]\n ret[:positional] = convert_array(exp[1])\n end\n if exp[2]\n # keyword arguments (converted into positionals and defaults)\n unless ret[:positional]\n ret[:positional] = []\n end\n exp[2].each { |x| ret[:positional].push(convert(x[0])) }\n ret[:defaults] = exp[2].map { |x| convert(x[1]) }\n end\n if exp[3] and exp[3] != 0\n ret[:rest] = convert(exp[3])\n end\n if exp[4]\n ret[:after_rest] = convert_array(exp[4])\n end\n if exp[5]\n ret[:kw_keys] = convert_array(exp[5].map{ |x| x[0]})\n ret[:kw_values] = convert_array(exp[5].map{ |x| x[1] })\n end\n if exp[6]\n ret[:rest_kw] = convert(exp[6])\n end\n if exp[7]\n ret[:blockarg] = convert(exp[7])\n end\n ret\n when :block_var\n params = convert(exp[1])\n if exp[2]\n params[:block_var] = convert_array(exp[2])\n end\n params\n when :class\n ret = {\n :type => :class,\n :static => false,\n :name => convert(exp[1]),\n :body => convert(exp[3]),\n }\n if exp[2]\n ret[:super] = convert(exp[2])\n end\n ret\n when :sclass\n {\n :type => :class,\n :static => true,\n :name => convert(exp[1]),\n :body => convert(exp[2]),\n }\n when :method_add_block\n call = convert(exp[1])\n if call[:args]\n call[:args][:blockarg] = convert(exp[2])\n else\n call[:args] = {\n :blockarg => convert(exp[2])\n }\n end\n call\n when :method_add_arg\n call = convert(exp[1])\n call[:args] = convert(exp[2])\n call\n when :vcall\n {\n :type => :call,\n :func => convert(exp[1])\n }\n when :command\n {\n :type => :call,\n :func => convert(exp[1]),\n :args => convert(exp[2])\n }\n when :command_call\n if exp[2] == :'.' or exp[2] == :'::'\n func = {\n :type => :attribute,\n :value => convert(exp[1]),\n :attr => convert(exp[3])\n }\n else\n func = convert(exp[1])\n end\n {\n :type => :call,\n :func => func,\n :args => convert(exp[4])\n }\n when :super, :zsuper\n {\n :type => :call,\n :func => {:type => :name, :id => :super},\n :args => convert(exp[1])\n }\n when :call, :fcall\n if exp[3] != :call and (exp[2] == :'.' or exp[2] == :'::')\n func = {\n :type => :attribute,\n :value => convert(exp[1]),\n :attr => convert(exp[3])\n }\n else\n func = convert(exp[1])\n end\n {\n :type => :call,\n :func => func\n }\n when :args_new, :mlhs_new, :mrhs_new, :words_new, :word_new, :qwords_new, :qsymbols_new, :symbols_new\n {\n :type => :args,\n :positional => []\n }\n when :args_add, :mlhs_add, :mrhs_add, :word_add, :words_add, :qwords_add, :qsymbols_add, :symbols_add\n args = convert(exp[1])\n args[:positional].push(convert(exp[2]))\n args\n when :args_add_star, :mrhs_add_star, :mlhs_add_star\n args = convert(exp[1])\n if exp[2]\n args[:star] = convert(exp[2])\n end\n args\n when :args_add_block\n args = convert(exp[1])\n if exp[2]\n args[:blockarg] = convert(exp[2])\n end\n args\n when :assign, :massign\n {\n :type => :assign,\n :target => convert(exp[1]),\n :value => convert(exp[2])\n }\n when :opassign\n # convert x+=1 into x=x+1\n operation = convert([:binary, exp[1], exp[2][1][0..-2], exp[3]])\n {\n :type => :assign,\n :target => convert(exp[1]),\n :value => operation\n }\n when :dot2, :dot3\n {\n :type => exp[0],\n :from => convert(exp[1]),\n :to => convert(exp[2])\n }\n when :alias, :var_alias\n {\n :type => :assign,\n :target => convert(exp[1]),\n :value => convert(exp[2])\n }\n when :undef\n {\n :type => :undef,\n :names => convert_array(exp[1]),\n }\n when :if, :if_mod, :elsif, :ifop\n ret = {\n :type => :if,\n :test => convert(exp[1]),\n :body => convert(exp[2]),\n }\n if exp[3]\n ret[:else] = convert(exp[3])\n end\n if exp[0] == :if_mod\n ret[:mod] = true\n end\n ret\n when :case\n if exp[1]\n value = convert(exp[1])\n else\n value = nil\n end\n convert_when(exp[2], value)\n when :while, :while_mod\n if exp[0] == :while_mod\n mod = true\n else\n mod = false\n end\n {\n :type => :while,\n :test => convert(exp[1]),\n :body => convert(exp[2]),\n :mod => mod\n }\n when :until, :until_mod\n if exp[0] == :until_mod\n mod = true\n else\n mod = false\n end\n {\n :type => :while,\n :test => negate(convert(exp[1])),\n :body => convert(exp[2]),\n :mod => mod\n }\n when :unless, :unless_mod\n if exp[0] == :unless_mod\n mod = true\n else\n mod = false\n end\n ret = {\n :type => :if,\n :test => negate(convert(exp[1])),\n :body => convert(exp[2]),\n :mod => mod\n }\n if exp[3]\n ret[:else] = convert(exp[3])\n end\n ret\n when :for\n {\n :type => :for,\n :target => convert(exp[1]),\n :iter => convert(exp[2]),\n :body => convert(exp[3])\n }\n when :begin\n bodystmt = exp[1]\n {\n :type => :begin,\n :body => convert(bodystmt[1]),\n :rescue => convert(bodystmt[2]),\n :else => convert(bodystmt[3]),\n :ensure => convert(bodystmt[4])\n }\n when :rescue\n ret = {:type => :rescue}\n if exp[1]\n if exp[1][0].is_a? Array\n ret[:exceptions] = convert_array(exp[1])\n else\n ret[:expections] = convert(exp[1])[:positional]\n end\n end\n if exp[2]\n ret[:binder] = convert(exp[2])\n end\n if exp[3]\n ret[:handler] = convert(exp[3])\n end\n if exp[4]\n ret[:else] = convert(exp[4])\n end\n ret\n when :rescue_mod\n {\n :type => :begin,\n :body => convert(exp[1]),\n :rescue => convert(exp[2]),\n :mod => true\n }\n when :stmts_new\n {\n :type => :block,\n :stmts => []\n }\n when :stmts_add\n block = convert(exp[1])\n stmt = convert(exp[2])\n block[:stmts].push(stmt)\n block\n when :bodystmt\n block = convert(exp[1])\n if exp[2]\n res = convert(exp[2])\n block[:stmts].push(res)\n end\n block\n when :binary\n {\n :type => :binary,\n :left => convert(exp[1]),\n :op => op(exp[2]),\n :right => convert(exp[3])\n }\n when :array\n args = convert(exp[1])\n {\n :type => :array,\n :elts => args[:positional]\n }\n when :aref, :aref_field\n args = convert(exp[2])\n {\n :type => :subscript,\n :value => convert(exp[1]),\n :slice => args[:positional]\n }\n when :unary\n {\n :type => :unary,\n :op => op(exp[1]),\n :operand => convert(exp[2])\n }\n when :@int\n {\n :type => :int,\n :value => exp[1],\n :location => exp[2]\n }\n when :@float\n {\n :type => :float,\n :value => exp[1],\n :location => exp[2]\n }\n when :regexp_literal\n regexp = convert(exp[1])\n regexp[:regexp_end] = convert(exp[2])\n regexp\n when :regexp_new\n {\n :type => :regexp,\n }\n when :regexp_add\n {\n :type => :regexp,\n :pattern => convert(exp[2]),\n }\n when :@regexp_end\n make_string(exp[1], exp[2])\n when :@backref\n make_string(exp[1], exp[2])\n when :@tstring_content, :@CHAR\n make_string(exp[1], exp[2])\n when :string_content, :xstring_new\n make_string('')\n when :string_add, :xstring_add, :qwords_add\n if not exp[1] or exp[1] == [:string_content] or exp[1] == [:xstring_new]\n convert(exp[2])\n else\n {\n :type => :binary,\n :op => op(:+),\n :left => convert(exp[1]),\n :right => convert(exp[2])\n }\n end\n when :string_concat, :xstring_concat\n convert([:binary, exp[1], :+, exp[2]])\n when :hash\n if exp[1]\n convert(exp[1])\n else\n {\n :type => :hash,\n }\n end\n when :assoclist_from_args, :bare_assoc_hash\n {\n :type => :hash,\n :entries => convert_array(exp[1])\n }\n when :assoc_new\n {\n :type => :assoc,\n :key => convert(exp[1]),\n :value => convert(exp[2])\n }\n when :const_path_ref, :const_path_field\n {\n :type => :attribute,\n :value => convert(exp[1]),\n :attr => convert(exp[2])\n }\n when :field\n {\n :type => :attribute,\n :value => convert(exp[1]),\n :attr => convert(exp[3])\n }\n when :void_stmt\n {\n :type => :void\n }\n when :yield0\n {\n :type => :yield\n }\n when :return0\n {\n :type => :return\n }\n when :break\n {\n :type => :break\n }\n when :retry\n {\n :type => :retry\n }\n when :redo\n {\n :type => :redo\n }\n when :defined\n {\n :type => :unary,\n :op => op(:defined),\n :operand => convert(exp[1])\n }\n when :return, :yield\n {\n :type => exp[0],\n :value => args_to_array(convert(exp[1]))\n }\n when :string_embexpr\n {\n :type => :string_embexpr,\n :value => convert(exp[1])\n }\n when :var_ref,\n :var_field,\n :const_ref,\n :top_const_ref,\n :top_const_field,\n :paren,\n :else,\n :ensure,\n :arg_paren,\n :mlhs_paren,\n :rest_param,\n :blockarg,\n :symbol_literal,\n :regexp_literal,\n :param_error,\n :string_literal,\n :xstring_literal,\n :string_dvar,\n :mrhs_new_from_args,\n :assoc_splat,\n :next,\n :END,\n :BEGIN\n # superflous wrappers that contains one object, just remove it\n convert(exp[1])\n else\n banner('unknown')\n puts \"#{exp}\"\n exp\n end\n end\n end", "def normalizer; end", "def parse_extended\n [get_symbol, parse]\n end", "def extract_bogo_ops(string, method)\n string[/stress-ng: info: \\[\\d*\\] #{method}\\s+(\\d*.\\d*)\\s+(\\d*.\\d*)\\s+(\\d*.\\d*)\\s+(\\d*.\\d*)\\s+(\\d*.\\d*)\\s+(\\d*.\\d*)/, 5]\n end", "def too_complex; end", "def str2; end", "def str2; end", "def test_Complex_InstanceMethods_rectangular\n\t\tassert_equal([0,1], Complex::I.rectangular)\n\t\tassert_equal([2,3], Complex('2+3i').rectangular)\n\tend", "def parse\n case (token = next_token)\n when '(' then parse_until_peek(')')\n when '{' then Any.new(parse_until_peek('}'))\n when '[' then All.new(parse_until_peek(']'))\n when /^\"/ then FindString.new(token[1..-2])\n when /^#\\w/ then MethodCall.new(token[1..-1])\n when /^\\.\\w[\\w\\d_]+\\?/ then InstanceMethodCall.new(token[1..-1])\n when '$' then Capture.new(parse)\n when '!' then (@tokens.any? ? Not.new(parse) : Find.new(token))\n when '?' then Maybe.new(parse)\n when '^' then Parent.new(parse)\n when '\\\\' then FindWithCapture.new(parse)\n when /^%\\d/ then FindFromArgument.new(token[1..-1])\n else Find.new(token)\n end\n end", "def parsed_methods\n parsed_include(:method)\n end", "def parse_type_and_options(type)\n case type\n when /(string|text|binary|integer)\\{(\\d+)\\}/\n return $1, limit: $2.to_i\n when /decimal\\{(\\d+)[,.-](\\d+)\\}/\n return :decimal, precision: $1.to_i, scale: $2.to_i\n when /(references|belongs_to)\\{(.+)\\}/\n type = $1\n provided_options = $2.split(/[,.-]/)\n options = Hash[provided_options.map { |opt| [opt.to_sym, true] }]\n return type, options\n else\n return type, {}\n end\n end", "def test_Complex_InstanceMethods_to_r\n\t\tassert_equal(Rational('5/2'), Complex(2.5, 0).to_r)\n\tend", "def args\n expect :call, :attrasgn, :safe_call, :safe_attrasgn, :super, :zsuper\n\n case self.node_type\n when :call, :attrasgn, :safe_call, :safe_attrasgn\n if self[3]\n self[3..-1]\n else\n Sexp.new\n end\n when :super, :zsuper\n if self[1]\n self[1..-1]\n else\n Sexp.new\n end\n end\n end", "def sortable_call\n [self.call1, self.call2, self.call3, self.call4].map{|c| (c||\"\").gsub(/([0-9.]+)/, ' \\1 ').split(\" \").map{|s| s =~ /^[0-9.]+$/ ? s.to_f : s} }\n [self.call1, (self.call2 =~ /^[0-9.]+$/ ? self.call2.to_f : self.call2) ] + \"#{self.call3}#{self.call4}\".gsub(/[^a-zA-Z.0-9]/,'').gsub(/([0-9.]+)/, ' \\1 ').split(\" \") # .map{|s| s =~ /^[0-9.]+$/ ? s.to_f : s}\n end", "def get_method_type(signature, added_options = false)\n node = self.node\n\n if type = node_context_from_signature(signature)\n # Resolve self, @page, @node\n type\n elsif type = get_var_from_signature(signature)\n # Resolved stored set_xxx='something' in context.\n type\n elsif type = safe_method_from(helper, signature)\n # Resolve template helper methods\n type\n elsif helper.respond_to?(:helpers) && type = safe_method_from(helper.helpers, signature)\n # Resolve by looking at the included helpers\n type\n elsif node && !node.list_context? && type = safe_method_from(node.klass, signature, node)\n # not a list_contex\n # Resolve node context methods: xxx.foo, xxx.bar\n # All direct methods from nodes should be html escaped:\n type = type[:class].call(self, node.klass, signature) if type[:class].kind_of?(Proc)\n type.merge(:receiver => RubyLess::TypedString.new(node.name, :class => node.klass, :h => true))\n elsif node && node.list_context? && type = safe_method_from(Array, signature, node)\n # FIXME: why do we need this here ? Remove with related code in zafu_safe_definitions ?\n type = type[:class].call(self, node.klass, signature) if type[:class].kind_of?(Proc)\n type.merge(:receiver => RubyLess::TypedString.new(node.name, :class => Array, :elem => node.klass.first))\n elsif node && node.list_context? && type = safe_method_from(node.klass.first, signature, node)\n type = type[:class].call(self, node.klass, signature) if type[:class].kind_of?(Proc)\n type.merge(:receiver => RubyLess::TypedString.new(\"#{node.name}.first\", :class => node.klass.first, :h => true))\n elsif @rendering_block_owner && @blocks.first.kind_of?(String) && !added_options\n # Insert the block content into the method: <r:trans>blah</r:trans> becomes trans(\"blah\")\n signature_with_block = signature.dup\n signature_with_block << String\n if type = get_method_type(signature_with_block, true)\n type.merge(:prepend_args => RubyLess::TypedString.new(@blocks.first.inspect, :class => String, :literal => @blocks.first))\n else\n nil\n end\n elsif node && !added_options\n # Try prepending current node before arguments: link(\"foo\") becomes link(var1, \"foo\")\n signature_with_node = signature.dup\n signature_with_node.insert(1, node.real_class) # node.klass ?\n if type = get_method_type(signature_with_node, true)\n type.merge(:prepend_args => RubyLess::TypedString.new(node.name, :class => node.klass))\n else\n nil\n end\n else\n nil\n end\n end" ]
[ "0.62768805", "0.5593435", "0.5479057", "0.54323095", "0.54162294", "0.5395912", "0.5358301", "0.5358301", "0.5358301", "0.5296449", "0.52808195", "0.5241671", "0.5241481", "0.52375126", "0.5224852", "0.5208079", "0.5187549", "0.51856315", "0.5183439", "0.51830095", "0.51653516", "0.51599866", "0.51514435", "0.51370853", "0.51361525", "0.5098641", "0.50962245", "0.50887144", "0.50887144", "0.50887144", "0.5084344", "0.5067114", "0.5067043", "0.5053833", "0.50535864", "0.50466883", "0.50418735", "0.50280476", "0.5010749", "0.49847558", "0.49832883", "0.49763742", "0.49740487", "0.4962781", "0.49380028", "0.49320024", "0.49309573", "0.4912961", "0.49102855", "0.49011213", "0.49009967", "0.48944318", "0.48944318", "0.48944318", "0.48933846", "0.48880893", "0.48819146", "0.48780313", "0.48742267", "0.48735377", "0.48671407", "0.48611596", "0.48611596", "0.48580614", "0.485392", "0.4834987", "0.48320404", "0.48310542", "0.4830367", "0.48294938", "0.4828634", "0.4816636", "0.481651", "0.47877237", "0.47850102", "0.47759017", "0.47654772", "0.47577256", "0.4757246", "0.4751695", "0.4744896", "0.47427613", "0.4732896", "0.4732507", "0.4731413", "0.47287518", "0.47278956", "0.4717258", "0.47167802", "0.47086695", "0.47072554", "0.47072554", "0.47044674", "0.46973363", "0.46968168", "0.4690697", "0.46873313", "0.46862286", "0.46851307", "0.46845293" ]
0.5211597
15
This is used as a decider. It can return true, false or nil. This particular method ignores the digits(response), but you can use it, for example to verify a string of digits and decide the next state e.g. pin verification, credit card validity, etc.
def tired?(digits=nil) # ignore the arg, go with your guts (rand * 10 < 3) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(password)\n response = {\n status: 'OK', message: ''\n }\n digits = password.split('').map(&:to_i)\n\n if is_in_sequence(digits)\n response[:status] = 'Error'\n response[:message] = \"Numbers cannot consecutively go up or down.\"\n end\n response\nend", "def success_from(response)\n response == 'SUCCESSFUL' || response =~ /^\\d+$/ || response == 'true'\n end", "def credit_card_number_check \n if self.credit_card_number != nil\n if self.credit_card_number.to_s.match(/^4/) and (self.credit_card_number.to_s.length == 16 or self.credit_card_number.to_s.length == 13)\n \"Visa Card\"\n elsif self.credit_card_number.to_s.match(/^5[1-5]/) and (self.credit_card_number.to_s.length == 16)\n \"Master Card\"\n elsif self.credit_card_number.to_s.match(/^6011|65/ ) and (self.credit_card_number.to_s.length == 16)\n \"Discovery Card\"\n elsif self.credit_card_number.to_s.match(/^30[0-5]/) and (self.credit_card_number.to_s.length == 14)\n \"Diners Club\"\n elsif self.credit_card_number.to_s.match(/^3[47]/) and (self.credit_card_number.to_s.length == 15)\n \"Amex\"\n else \n \"credit card number invalid\"\n end \n end \n end", "def eval_response(response)\n return (response == \"OK\")\n end", "def valid_credit_card?(num)\r\n# Split the string into an array so we can work with each digit\r\n# Reverse the string so we can double every other number\r\n\tcard = num.split(//).reverse.each_with_index.map do |num, index| \r\n\t\tif index % 2 != 0 then\r\n\t\t\tnum.to_i * 2\r\n\t\telse\r\n\t\t\tnum.to_i\r\n\t\tend\r\n\tend\t\r\n\r\n# There must be a better way to do this, but the idea is to turn the array into a string\r\n# and back into an array to turn the double digit numbers into single digits.. /sigh\r\n\tcard.to_s\r\n\t.gsub(/,/,'')\r\n\t.gsub(/\\[/,'')\r\n\t.gsub(/\\]/,'')\r\n\t.gsub(/ /,'')\r\n\t.split('')\r\n\t.map {|i| i.to_i}\r\n\t.reduce(:+) % 10 == 0\r\nend", "def parse_response( key, val, * )\n #key is method input is coming from, val is user input\n if key === 'greet_user'\n val.length == 3 && val.match(/Y|y+E|e+S|s/)\n elsif key === 'print_temp_prompt'\n TemperatureConverter::TEMP_SCALES.include? val\n elsif key === 'get_temp_input'\n if( val.match(/[a-zA-Z\\W].+/) )\n false\n else\n ( val.match(/\\d{1,4}/) )\n end\n else\n false\n end\nend", "def is_valid?\n # Declare array variable for use in iterative block\n iterated_array = []\n\n # Split card_number into an array, iterate to double even indexes, and assign to variable\n card_number.chars.each_with_index do |number, index|\n # Look for digit to left of final digit and every second digit moving left.\n if (index - card_number.length).even?\n # If so, return doubled value\n doubled_number = card_number.chars[index].to_i * 2\n # Check if resulting number greater than 9 (i.e., double digits)\n if doubled_number > 9\n # If so, subtract 9 (equivalent to adding the two digits)\n doubled_number -= 9\n end\n # Push to array\n iterated_array << doubled_number\n # If not even index value...\n else\n # Push unmodified number to array\n iterated_array << number.to_i\n end\n end\n\n # Return true or false result of following boolean comparison\n iterated_array.sum % 10 == 0\n end", "def check_luhn(s)\n s.gsub!(/[^0-9]/, \"\")\n ss = s.reverse.split(//)\n\n alternate = false\n total = 0\n ss.each do |c|\n if alternate\n i = c.to_i*2\n total += (i > 9) ? (i % 10 + 1) : i\n else\n total += c.to_i\n end\n alternate = !alternate\n end\n\n result_check = (total % 10) == 0\n\n unless result_check\n # Card is invalid(luhn algorithm)\n flash[:error_card] = 'Card is not valid'\n\n # Block in session\n block_ip_in_session\n\n # Add transaction\n add_transaction(:i_account => $uid,\n :i_cc => @credit_card.i_cc,\n :type => \"payment_refund\",\n :ip => request.remote_ip.to_s)\n\n #redirect_to :controller => 'subs', :action => 'index'\n false\n else\n true\n end\n end", "def check_digit\n dv\n end", "def valid_response?\n return false unless response\n\n valid_hmac? && valid_amount? && valid_account?\n end", "def validResponse? response\n return false unless /^[0-7]$/ =~ response.to_s \n return false if @board.isColFull? response.to_i\n true\n end", "def response?\n qr?\n end", "def validate_answer(answer)\n answer == @result\n end", "def num_valid?\r\n number = ''\r\n # (1)need to split the number down first to handle it digit by digit\r\n # (2)because number length can change, better to reverse it and go front to back\r\n # (3)put through an each block to loop through the digits, adding with_index to help the modulo\r\n # (4)using a modulo to apply *2 if remainder is not 0 (i.e. every other number starting at position 1, using the index)\r\n # (5)building up the number string with << (could use += but no need to create a new object every time)\r\n @num.split('').reverse.each_with_index do |digit, index|\r\n number << digit if index%2 == 0\r\n number << (digit.to_i*2).to_s if index%2 != 0\r\n end\r\n\r\n # lastly have to check the result added together modulo's to zero\r\n # consulted http://blog.jayfields.com/2008/03/ruby-inject.html for inject syntax refresher\r\n # (1)need to split the number down into an array so inject() can turn them to_i and give us the sum\r\n # (2)using a modulo to ensure the final sum is a multiple of 10\r\n number.split('').inject { |r,e| r.to_i + e.to_i } % 10 == 0\r\n end", "def check_valid_uid(answer)\n correct = 1\n if answer.match(/[A-z]/)\n correct = 0\n else\n if Integer(answer) < 100\n correct = 0\n puts \"UID must be greater than 100\"\n end\n end\n return correct\nend", "def luhn?(cardNumber)\n cardNumber.split(//).map_with_index do |el, i|\n #1)Starting with the next to last digit\n #and continuing with every other\n #digit going back to the beginning of the card, double the digit\n #\n #This means that, if the length is even, even indices\n #are doubled, and vice versa\n if i % 2 == cardNumber.length % 2\n #Doubled digits will have to be split again\n (el.to_i * 2).to_s.split(//).map{|n| n.to_i}\n else\n el.to_i\n end\n #2) Sum all numbers\n end.flatten.enum_for.inject(0){|sum, num|sum + num } %\n #3)Check for multiple of 10\n 10 == 0\nend", "def get_code(display_string)\n valid_response = false\n until valid_response\n puts display_string\n response = gets.chomp\n valid_response = validate_response(response)\n end\n valid_response\n end", "def two_factor_verify(response)\n # Need to have an active challenge to verify it\n return unless session_token && session_token.has_challenge?\n\n challenge = Userbin::Challenge.new('current')\n challenge.verify(response: response)\n end", "def has_a_valid_pad?(test_cipher)\n case tester.query_target(test_cipher)\n when '403', '200'\n false\n when '404'\n true\n else\n raise \"tester returned bad value from site: #{status}\"\n end\n end", "def check(number)\n \n end", "def meets_challenge?\n true\n end", "def passes_luhn?(str)\n # Cover non-string args\n raise ArgumentError, \"Non-string argument(s) used.\" unless str.is_a?(String)\n\n # Reverse the str and break it down into chars to work with individual digits\n digits = str.reverse.chars\n # Keep vars to track the sum of odd and even elements in digits\n odd_sum = 0\n even_sum = 0\n # Keep an empty array for doubled even ordered digits\n doubled_evens = []\n\n digits.each_with_index do |dig, i|\n # Add a 1 to the index, i, and check if it's even or odd\n if (i + 1) % 2 != 0\n # Odd ordered digits just get directly added to the odd_sum var\n odd_sum += dig.to_i\n else\n # Even ordered digits are multiplied by 2 before being pushed into the array\n doubled_evens << dig.to_i * 2\n end\n end\n\n # Go through all the doubled even ordered digits\n doubled_evens.each do |num|\n # If int division of the number is greater than 0, it means the number is 2+ digits\n if num/10 != 0\n # Break the number into single digits and add those to even_sum\n num.to_s.chars.each do |dig|\n even_sum += dig.to_i\n end\n else\n # The number is a single digit number and can be added directly to even_sum\n even_sum += num\n end\n end\n\n # Add the sums together and mod by 10 to check if the last digit is 0\n (odd_sum + even_sum) % 10 == 0\nend", "def validateCard(card_str)\n\tcard_str = card_str.gsub(/[^0-9]/, \"\")\n\n\tdigits = card_str.split(\"\").map(&:to_i)\n\tchecksum = digits.pop # chop off last digit, store as checksum\n\tdigits << 0 # Add back in a zero for balanced calculations\n\n\tsum = 0\n\tdigits.each_slice 2 do |pair|\n\t\tdouble = pair.first * 2\n\t\tsum += (double >= 10) ? (double % 10 + 1) : double\n\t\tsum += pair.last\n\tend\n\n\t(sum * 9) % 10 == checksum \n\nend", "def is_full_luhn_valid?\n get_check_digit == check_digit\n end", "def valid?\n\t\t#return false if @number.match?(/[^\\d_]/)\n\t\tchecksum % 10 == 0\n\tend", "def isCreditCard(payload)\n cardNo = getCreditCard(payload)\n if cardNo.nil? # indicates no card found\n return false\n else\n return true\n end\nend", "def passport_valid?(passport_input)\n return false unless has_required_fields?(passport_input)\n\n field_inputs = passport_input.split\n\n field_inputs.all? do |field_input|\n code, value = field_input.split(':')\n case code\n when 'byr'\n value.to_i.between?(1920, 2002)\n when 'iyr'\n value.to_i.between?(2010, 2020)\n when 'eyr'\n value.to_i.between?(2020, 2030)\n when 'hgt'\n unit = value[-2..]\n num = value[0...-2].to_i\n [\"cm\", \"in\"].include?(unit) && unit == \"cm\" ? num.between?(150, 193) : num.between?(59, 76)\n when 'hcl'\n /^#[0-9a-f]{6}$/.match?(value)\n when 'ecl'\n ['amb', 'blu', 'brn', 'gry', 'grn', 'hzl', 'oth'].include?(value)\n when 'pid'\n /^[0-9]{9}$/.match?(value)\n when 'cid'\n true\n else \n raise \"invalid code\"\n end\n end\nend", "def valid?\n digits = ''\n # double every other number starting with the next to last\n # and working backwards\n @number.split('').reverse.each_with_index do |d,i|\n digits += d if i%2 == 0\n digits += (d.to_i*2).to_s if i%2 == 1\n end\n\n # sum the resulting digits, mod with ten, check against 0\n digits.split('').inject(0){|sum,d| sum+d.to_i}%10 == 0\n end", "def is_partial_luhn_valid?\n get_unit_digit == 0\n end", "def valid?(account)\n\tdigits = account.to_s.reverse.chars.map(&:to_i)\n\t# digits = account.to_s.reverse.chars.map { |c| c.to_i }\n \tcheck_sum = 0\n\n\tdoubled_digits = digits.with_index { |num, index| index.odd? ? num * 2 : num }\n\n\tdigits.each_slice(2) do |odd, even|\n \tcheck_sum += odd\n \tnext unless even\n \teven *= 2\n \teven = even.divmod(10).inject(:+) if even > 9\n \tcheck_sum += even\n end\n\n # look to refactor\n check_sum % 10 == 0\n check_sum.modulo(10) == 0\n\nend", "def isvalid(n)\n\tcars = n.chars.reduce(0) { |sum, c| sum + $digits[c] }\n\t#puts \"n #{n} cars #{cars}\"\n\treturn n.to_i == cars\nend", "def res_ok?(x)\n x.to_i == x\nend", "def has_wrong_number?\n status_code == '1'\n end", "def valid?\r\n card_sum = compare_num.sum\r\n if \r\n card_sum % 10 == 0\r\n true\r\n else\r\n false\r\n end\r\n end", "def check_response\n errors.add(:base, :invalid) unless response.present? && response[\"res\"] == 1\n end", "def response?(value)\n STDIN.gets.chomp == value ? true : false\nend", "def response?(value)\n STDIN.gets.chomp == value ? true : false\nend", "def response?(value)\n STDIN.gets.chomp == value ? true : false\nend", "def response?(value)\n STDIN.gets.chomp == value ? true : false\nend", "def check_response(response)\n response =~ /^Y,/ ? true : false\n end", "def check_card\n\t\tsplit_cc = @cc.to_s.split(\"\")\n\n# -- Convert string to an array of integers\n\t\t\tl = split_cc.length - 1\n\t\tfor num in 0..l\n\t\t\t@split_cc_integers << split_cc[num].to_i\n\t\tend\n\n# -- Now we split the original array of integers into two arrays of even indices and odd indices \n\t\tl_half = l/2\n\n\n# ------ EVENS -------\n\t\tfor num in 0..l_half\n\t\t\tevens = 2*num + 1\n\t\t\t@even_cc_integers << @split_cc_integers[evens]\n\t\tend\n\n\t\ttotal_of_evens = @even_cc_integers.each {|x| \n\t\t\t@sum_evens = @sum_evens + x\n\t\t\t}\n\n# ------ ODDS -------\n\t\tfor num in 0..l_half\n\t\t\todds = 2*num\n\t\t\t@odd_cc_integers << @split_cc_integers[odds]\n\t\tend\n\n\t\t@odd_cc_integers.each {|odd|\n\t\todd = 2*odd\n\t\tif odd < 10\n\t\t\t@modified_results_from_odd_cc_integers << odd\n\t\telse\n\t\t\ttens = odd/10\n\t\t\t@modified_results_from_odd_cc_integers << tens\n\t\t\tones = odd%10\n\t\t\t@modified_results_from_odd_cc_integers << ones\n\t\tend\n\t\t\t}\n\n\t\ttotal_of_odds = @modified_results_from_odd_cc_integers.each {|odd| \n\t\t\t@sum_odds = @sum_odds + odd\n\t\t\t}\n\n# ------ ODDS DONE -------\n# ------ Validation DONE -------\n\t\tgrand_total = @sum_evens + @sum_odds\n\n\t\tif grand_total%10 == 0\n x = \"valid\"\n puts \"This is a #{x} number!\"\n\t\t\treturn true\n\t\telse\n y = \"invalid\"\n puts \"This is an #{y} number!\"\n\t\t\treturn false\n\t\tend\n\tend", "def valid(number)\n puts '---------------------------valid?'\n digits = ''\n # double every other number starting with the next to last\n # and working backwards\n number.split('').reverse.each_with_index do |d,i|\n digits += d if i%2 == 0\n digits += (d.to_i*2).to_s if i%2 == 1\n end\n\n # sum the resulting digits, mod with ten, check against 0\n digits.split('').inject(0){|sum,d| sum+d.to_i}%10 == 0\n\n # puts '=============== !!!!valid always returning true for testing !!!!==========='\n # return true #just for testing\n end", "def card_number_valid?\n if card_number\n card_number =~ /\\A\\d{13,16}\\z/\n else\n true\n end\n end", "def check_valid_gid(answer)\n correct = 1\n if answer.match(/[A-z]/)\n correct = 0\n else\n if Integer(answer) < 10\n correct = 0\n puts \"GID must be greater than 10\"\n end\n end\n return correct\nend", "def result(answer)\n @answer == answer.to_i \n end", "def verify_result()\n #puts \"{#@recode}\" \"return code\"\n #puts \"{#@expect_code}\" \"expect code\"\n # method to show object's type, include both basic type and class type.\n #puts @recode.class\n #puts @expect_code.class\n # to_i to interger\n # to_f to float\n # to_s to string\n \n if @recode == @expect_code.to_s\n @output.puts \"Verification Success\"\n puts \"Verification Success\"\n\n else\n @output.puts \"ERROR: Verification Failiure errorcode:\" + @recode + \" errormsg:\" + @remsg\n puts \"ERROR: Verification Failiure error code:\" + @recode + \" errormsg:\" + @remsg\n end\n\n end", "def cvv_result(response)\n case response[:raw][:CardSecurityCodeMatch]\n when \"Pass\"\n return \"M\" # Match\n when \"Fail\"\n return \"N\" # No Match\n else\n return \"P\" # Not Processed\n end\n end", "def user_verify(answer)\n answer.downcase!\n if answer.start_with?('y')\n return true\n else\n return false\n end\nend", "def well_formated_response?\n all_expected_fields_received? && validate_bank_response_signature\n end", "def detect_result(dealer_cards, player_cards)\n player_total = card_total(player_cards)\n dealer_total = card_total(dealer_cards)\n\n if player_total > TARGET_NUMBER\n :player_busted\n elsif dealer_total > TARGET_NUMBER\n :dealer_busted\n elsif dealer_total < player_total\n :player\n elsif dealer_total > player_total\n :dealer\n else\n :tie\n end\nend", "def match_response response\n response.match(/^(?:[0-9]{1,3}\\.){3}[0-9]{1,3}$/) ? response : response[/.*: ([^<]+)<.*/, 1] \n rescue\n nil\n end", "def handle_verify_response(response)\n verify_response = response\n status = verify_response[\"data\"][\"status\"]\n charge_code = verify_response[\"data\"][\"chargecode\"]\n\n if charge_code == \"00\" && status == \"successful\"\n res = {\"error\": false, \"transaction_complete\": true, \"data\": verify_response[\"data\"]}\n return JSON.parse(res.to_json)\n else\n res = {\"error\": false, \"transaction_complete\": false, \"data\": verify_response[\"data\"]}\n return JSON.parse(res.to_json)\n end\n end", "def isbnlength(number)\r\n\tvalid10 = 0\r\n\tvalid13 = 0\r\n\tif number.length == 10\r\n\t\tvalid10 = \"true\"\r\n\telsif number.length == 13\r\n\t \tvalid13 = \"true\"\r\n\tend\r\nend", "def result_to_get?\n if not @result.nil?\n if @result.downcase == 'true'\n return true\n else\n return false\n end\n else\n return false\n end\n end", "def response_code_is_ok?\n return true if %w(00 24).include? response_code\n\n false\n end", "def digits_condition\n @number.scan(/\\D/).empty?\n end", "def luhn_valid (cc_number)\n sum1 = 0\n sum2 = 0\n \n cc_number.to_s.reverse.chars.each_slice(2) do |odd, even|\n sum1 += odd.to_i\n \n double = even.to_i * 2\n double -= 9 if double >= 10\n sum2 += double\n end\n if\n (sum1 + sum2) % 10 == 0\n print \"valid\"\n else\n print \"invalid\"\nend\nend", "def verify?\n retval = false\n unless self.lead_in == 0x55\n Ted::Recorder.logger \"Lead in value is not correct! Got #{self.lead_in} expected 0x55.\"\n # Don't return here, so we can get all of the errors\n end\n\n retval = super\n return retval\n end", "def response_equal_answer?\n @response.to_i == eval(@question)\n end", "def verify_answer?(question, answer)\n case question[:type]\n when :add\n question[:first_num] + question[:second_num] == answer\n when :subtract\n question[:first_num] - question[:second_num] == answer\n when :multiply\n question[:first_num] * question[:second_num] == answer\n when :divide\n question[:first_num] / question[:second_num] == answer\n end\nend", "def check_response_fingerprint(res, fallback_status)\n fp = http_fingerprint(response: res)\n if /RomPager\\/(?<version>[\\d\\.]+)/ =~ fp\n vprint_status(\"#{peer} is RomPager #{version}\")\n if Gem::Version.new(version) < Gem::Version.new('4.34')\n return Exploit::CheckCode::Appears\n end\n end\n fallback_status\n end", "def is_valid?\n ((@original.reverse.chars.first.to_i == check_digit) && (gs1_prefix == '979') && @code.count == 13) || @code.count == 12\n end", "def valid_rpc_response?(response)\n # validate response is an object\n return false unless response.is_a?(Hash)\n\n JSON_RPC_RESPONSE_REQUIRED_MEMBERS.each do |member|\n tmp_member = @symbolize_names ? member : member.to_s\n return false unless response.key?(tmp_member)\n end\n\n # validate response members are correct types\n response.each do |member, value|\n tmp_member = @symbolize_names ? member : member.to_sym\n return false if JSON_RPC_RESPONSE_MEMBER_TYPES.key?(tmp_member) &&\n !JSON_RPC_RESPONSE_MEMBER_TYPES[tmp_member].one? { |type| value.is_a?(type) }\n end\n\n return false if response[:jsonrpc] != JSON_RPC_VERSION\n\n result_key = @symbolize_names ? :result : :result.to_s\n error_key = @symbolize_names ? :error : :error.to_s\n\n return false if response.key?(result_key) && response.key?(error_key)\n\n if response.key?(error_key)\n error_response = response[error_key]\n # validate error response is an object\n return false unless error_response.is_a?(Hash)\n\n JSON_RPC_ERROR_RESPONSE_REQUIRED_MEMBERS.each do |member|\n tmp_member = @symbolize_names ? member : member.to_s\n return false unless error_response.key?(tmp_member)\n end\n\n # validate error response members are correct types\n error_response.each do |member, value|\n tmp_member = @symbolize_names ? member : member.to_sym\n return false if JSON_RPC_ERROR_RESPONSE_MEMBER_TYPES.key?(tmp_member) &&\n !JSON_RPC_ERROR_RESPONSE_MEMBER_TYPES[tmp_member].one? { |type| value.is_a?(type) }\n end\n end\n\n true\n end", "def valid_cc_number?\n #remove non-digits and read from right to left\n number = self.cc_four_digits.to_s.gsub(/\\D/, '').reverse\n\n sum, i = 0, 0\n\n number.each_char do |ch|\n n = ch.to_i\n\n # Step 1\n n *= 2 if i.odd?\n\n # Step 2\n n = 1 + (n - 10) if n >= 10\n\n sum += n\n i += 1\n end\n\n if (sum % 10).zero? # Step 3\n return true\n else\n errors.add(:cc_four_digits, 'Sorry, an invalid cardNumber Entered')\n return false\n end\n\n end", "def digital?\n digitals.present?\n end", "def validate(n)\n # reverse the number\n reversed = reverser(n)\n cleaned = cleaner(reversed)\n checker(cleaned)\n # reversed_number_string = n.to_s.reverse.chars\n # double every other number\n # doubler(reversed_number_string)\n # doubled = reversed_number_string.map.with_index do |number, index|\n # if index % 2 != 0\n # number.to_i * 2\n # else\n # number.to_i\n # end\n # end\n # check to see if each number is > 10\n # cleaned = doubler(reversed).map do |number|\n # if number / 10 >= 1\n # number - 9\n # else\n # number\n # end\n # end\n # # binding.pry\n # # if so, subtract 9\n # # if not, leave as is\n # # sum the numbers (reduce), check to see if divisbile by 10, return boolean\n # cleaned.reduce(:+) % 10 == 0\nend", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def valid_passport_number?(value)\n value =~ /^[0-9]{9}$/\n end", "def check_for_valid_response(resp)\n if resp == 'exit!'\n game_data.save\n elsif game_data.chosen_letters.include?(resp)\n repeat_response_query('repeat')\n elsif resp.length > 1\n repeat_response_query('multiple')\n else\n action(resp)\n end\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def validator(response, task_information)\n !response.body_utf8.match(/The login information you entered does not match an account on record. Please try again./i)\n end", "def getYesOrNo ( question )\n response = getInput(\"#{question} (y/n)\")\n\n if response.downcase == \"y\"\n true\n elsif response.downcase == \"n\"\n false\n else\n puts \"Invalid response\\n\"\n getYesOrNo( question )\n end\nend", "def isvalid?(cc_num) \r\n cc_num = cc_num.reverse.split(\"\").map! {|x| x.to_i}\r\n checkdig = cc_num[0]\r\n cc_num.delete_at(0)\r\n odds = []\r\n sd_evens = []\r\n dd_evens = []\r\n total = 0\r\n dd_evs_spl = []\r\n \r\n cc_num.each_index { |x|\r\n if x % 2 == 1\r\n odds << cc_num[x]\r\n elsif cc_num[x] < 5\r\n sd_evens << cc_num[x]\r\n else\r\n dd_evens << cc_num[x]\r\n end\r\n }\r\n \r\n sd_evens.map! {|x| x * 2}\r\n dd_evens.map! {|x| (x * 2).to_s}\r\n dd_evens = dd_evens.join(\"\").split(\"\")\r\n dd_evens.map! {|x| x.to_i}\r\n \r\n odds.each {|x| total += x}\r\n sd_evens.each {|x| total += x}\r\n dd_evens.each {|x| total += x}\r\n \r\n check_dig = (total * 9) % 10\r\n \r\n if checkdig == check_dig\r\n puts \"The number is valid.\"\r\n else\r\n puts \"The number is invalid.\"\r\n end\r\n\r\nend", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def invalid_response(response)\n puts(\"\\\"#{response}\\\" was not a valid input. Please input a number corresponding to your choice.\")\nend", "def check_card\n\t\tsplit_cc = @cc.to_s.split(\"\")\n\n# -- Convert string to an array of integers\n\t\t\tl = split_cc.length - 1\n\t\tfor num in 0..l\n\t\t\t@split_cc_integers << split_cc[num].to_i\n\t\tend\n\n# -- Now we split the original array of integers into two arrays of even indices and odd indices \n\t\tl_half = l/2\n\n\n# ------ EVENS -------\n\t\tfor num in 0..l_half\n\t\t\tevens = 2*num + 1\n\t\t\t@even_cc_integers << @split_cc_integers[evens]\n\t\tend\n\n\t\ttotal_of_evens = @even_cc_integers.each {|x| \n\t\t\t@sum_evens = @sum_evens + x\n\t\t\t}\n\n# ------ ODDS -------\n\t\tfor num in 0..l_half\n\t\t\todds = 2*num\n\t\t\t@odd_cc_integers << @split_cc_integers[odds]\n\t\tend\n\n\t\t@odd_cc_integers.each {|odd|\n\t\todd = 2*odd\n\t\tif odd < 10\n\t\t\t@modified_results_from_odd_cc_integers << odd\n\t\telse\n\t\t\ttens = odd/10\n\t\t\t@modified_results_from_odd_cc_integers << tens\n\t\t\tones = odd%10\n\t\t\t@modified_results_from_odd_cc_integers << ones\n\t\tend\n\t\t\t}\n\n\t\ttotal_of_odds = @modified_results_from_odd_cc_integers.each {|odd| \n\t\t\t@sum_odds = @sum_odds + odd\n\t\t\t}\n\n# ------ ODDS DONE -------\n# ------ Validation DONE -------\n\t\tgrand_total = @sum_evens + @sum_odds\n\n\t\tif grand_total%10 == 0\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "def verify(x)\n\ty = 1\n\twhile y == 1\n\t\tif x.is_a?(Integer) && x > 0 && x < 10 #need to fix this. Still able to take non integers like 1.5\n\t\t\treturn x\n\t\t\ty-=1\n\t\telse\n\t\t\tputs \"Try again - number must be 1 through 10 and an integer\"\n\t\t\tx = gets.chomp.to_i\n\t\tend\n\tend\nend", "def blackjack (total)\n if total == 21\n return true\n else \n return false\n end\nend", "def card_type\r\n length = @num.length\r\n if length == 15 && @num =~ /^(34|37)/\r\n \treturn 'AMEX'\r\n elsif length == 16 && @num =~ /^6011/\r\n \treturn 'Discover'\r\n elsif length == 16 && @num =~ /^5[1-5]/\r\n \treturn 'MasterCard'\r\n elsif (length == 13 || length == 16) && @num =~ /^4/\r\n \treturn 'Visa'\r\n else\r\n return 'Unknown'\r\n end\r\n end", "def expected_check_digit\n digits.last\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def good_guess? int\n\n return int == 42 ? true : false\n\nend", "def good_guess?(number_answer)\n # Your code goes here!\n if number_answer == 42\n return true\n else\n return false\n end\nend", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def is_valid_PIN(pin)\n# check if the pin is equal to the converted pin\n pin == \"#{pin.to_i}\"\n # if pin && (pin.length == 4 || pin.length ==6)\n # return true\n # end\n # false\nend", "def card_detection\n end", "def number_check(user_input)\n if user_input.numeric?\n return user_input\n else\n return false\n end\nend", "def detect_result(dealer_cards, player_cards)\r\n player_total = total(player_cards)\r\n dealer_total = total(dealer_cards)\r\n\r\n if player_total > HAND_LIMIT\r\n :player_busted\r\n elsif dealer_total > HAND_LIMIT\r\n :dealer_busted\r\n elsif dealer_total < player_total\r\n :player\r\n elsif dealer_total > player_total\r\n :dealer\r\n else\r\n :tie\r\n end\r\nend", "def detect_result(dealer_cards, player_cards)\n player_total = total(player_cards)\n dealer_total = total(dealer_cards)\n\n if player_total > GAME_LIMIT\n :player_busted\n elsif dealer_total > GAME_LIMIT\n :dealer_busted\n elsif dealer_total < player_total\n :player\n elsif dealer_total > player_total\n :dealer\n else\n :tie\n end\nend", "def assert_num\n\traise \"Card not 16 digits\" unless true\nend", "def good_guess?(integer)\nif integer==42\n return true\nelse\n return false\nend\nend", "def detect_result(dealer_cards, player_cards)\n player_total = total(player_cards)\n dealer_total = total(dealer_cards)\n\n if player_total > BREAK_POINT\n :player_busted\n elsif dealer_total > BREAK_POINT\n :dealer_busted\n elsif dealer_total < player_total\n :player\n elsif dealer_total > player_total\n :dealer\n else\n :tie\n end\nend", "def detect_result(dealer_cards, player_cards)\n player_total = total(player_cards)\n dealer_total = total(dealer_cards)\n\n if player_total > BREAK_POINT\n :player_busted\n elsif dealer_total > BREAK_POINT\n :dealer_busted\n elsif dealer_total < player_total\n :player\n elsif dealer_total > player_total\n :dealer\n else\n :tie\n end\nend", "def validate_answer(answer)\n end", "def process_challenge username, password, xsalt, xbb\n bb = xbb.to_i(16)\n # SRP-6a safety check\n return false if (bb % @N) == 0\n\n x = SRP.calc_x(username, password, xsalt)\n u = SRP.calc_u(@A, xbb, @N)\n\n # SRP-6a safety check\n return false if u == 0\n\n # calculate session key\n @S = \"%x\" % SRP.calc_client_S(bb, @a, @k, x, u, @N, @g)\n @K = SRP.sha1_hex(@S)\n\n # calculate match\n @M = \"%x\" % SRP.calc_M(username, xsalt, @A, xbb, @K, @N, @g)\n\n # calculate verifier\n @H_AMK = \"%x\" % SRP.calc_H_AMK(@A, @M, @K, @N, @g)\n\n return @M\n end", "def response\n response = gets.chomp\n if (response.downcase == \"yes\" || response.downcase == \"y\")\n initialize\n welcome\n return true\n elsif (response.downcase == \"no\" || response.downcase == \"n\")\n return true\n end\n end", "def valid?\n @number =~ /\\A\\d{9}\\z/\n end", "def detect_result(dealer_cards, player_cards)\n player_total = total(player_cards)\n dealer_total = total(dealer_cards)\n\n if player_total > GAME_MAX_TOTAL\n :player_busted\n elsif dealer_total > GAME_MAX_TOTAL\n :dealer_busted\n elsif dealer_total < player_total\n :player\n elsif dealer_total > player_total\n :dealer\n else\n :tie\n end\nend", "def is_an_account_number?(string)\n /\\d{4}-\\d{3}-\\d{3}/ === string ? true :false\nend", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end" ]
[ "0.6392427", "0.6386578", "0.6290566", "0.6233181", "0.6207501", "0.6184391", "0.60858285", "0.5942228", "0.59190714", "0.591239", "0.59107834", "0.5882406", "0.5870698", "0.5856343", "0.58457804", "0.58425826", "0.58239913", "0.5813238", "0.57937986", "0.57839775", "0.5770555", "0.57671845", "0.57669157", "0.5765446", "0.5760915", "0.5750032", "0.5747251", "0.5719464", "0.57186145", "0.57136905", "0.5691779", "0.5689073", "0.5668048", "0.5653289", "0.56466717", "0.56412125", "0.56412125", "0.56412125", "0.56412125", "0.5639707", "0.56360537", "0.5626132", "0.56227785", "0.5620406", "0.560706", "0.5597665", "0.5591942", "0.558089", "0.5560847", "0.55567944", "0.5555044", "0.55494076", "0.55483025", "0.5536312", "0.5520775", "0.5518457", "0.5512738", "0.5511367", "0.5502789", "0.5500074", "0.54964066", "0.5491562", "0.5480748", "0.5478904", "0.547786", "0.54753643", "0.5464459", "0.545821", "0.54546833", "0.5445994", "0.5444234", "0.5437512", "0.5428447", "0.54279286", "0.54279286", "0.54235065", "0.5420833", "0.54145485", "0.5405594", "0.53998995", "0.53996116", "0.5394665", "0.5391744", "0.5391387", "0.5389405", "0.5389029", "0.53876877", "0.53865516", "0.5385545", "0.538467", "0.5378239", "0.53774416", "0.5376549", "0.5376549", "0.53729516", "0.5365984", "0.5364863", "0.5362125", "0.53600717", "0.5359598", "0.53593147" ]
0.0
-1
This is an event callback. We use this to gather the digits for future use
def collect_callback(digits=nil) # do something, either in memory or in DB end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def consume_number; end", "def digit; end", "def available_digits\n @available_digits.to_a\n end", "def number\n HookNumber.new(number_record)\n end", "def speak_as_digits(element)\n speak_as(element, /[0-9]/, 'digits', method(:operation_speak_as_digits))\n end", "def on_dec\n end", "def digitize(n)\n @result = n.to_s.scan(/./).map{ |s| s.to_i } \nend", "def digits\n @digits ||= numbers.insert(3, digit(numbers).to_s)\n end", "def say_digits(digits, escapeDigits=ALL_SPECIAL_DIGITS) \r\n\t\tmsg=\"SAY DIGITS #{digits} #{escape_digit_string(escapeDigits)}\"\r\n\t\tsend(msg)\r\n\t\treturn get_int_result()\r\n\tend", "def interesting_number(number)\n number.each_char.map {|c| c.to_i}\n puts number\nend", "def digit_list(num)\n array = []\n \n num.to_s.each_char do |c| \n array.push(c.to_i)\n end\n array\nend", "def get_digits(text)\r\n text = text.reverse()\r\n num = Integer(text)\r\n res = []\r\n i = 0\r\n while i < text.length do\r\n rem = num % 10\r\n num = num / 10\r\n rem = String(rem)\r\n if rem >= '0' && rem <= '9'\r\n res.push(illuminate(rem))\r\n end\r\n i += 1\r\n end\r\n return res\r\nend", "def on_numeric(n)\n n\n end", "def on_numeric(n)\n n\n end", "def calculate_check_digit\n calculate_ponderated_values\n @check_digit = 10 - (@ponderated.inject(:+) % 10)\n end", "def digits\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 33 )\n\n begin\n # at line 191:10: ( DIGIT )+\n # at file 191:10: ( DIGIT )+\n match_count_46 = 0\n while true\n alt_46 = 2\n look_46_0 = @input.peek( 1 )\n\n if ( look_46_0 == DIGIT )\n alt_46 = 1\n\n end\n case alt_46\n when 1\n # at line 191:10: DIGIT\n match( DIGIT, TOKENS_FOLLOWING_DIGIT_IN_digits_1776 )\n\n else\n match_count_46 > 0 and break\n eee = EarlyExit(46)\n\n\n raise eee\n end\n match_count_46 += 1\n end\n\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 33 )\n\n end\n \n return \n end", "def run_phase\n new_digits = []\n running_sum = 0\n @digits.reverse.each do |digit|\n # We only care about the last digit in all sums\n running_sum = (running_sum + digit) % 10\n\n # Note that new digits will be in reverse order, so will reverse again after\n new_digits << running_sum\n end\n @digits = new_digits.reverse\n end", "def digits(arg)\n arg.to_s.gsub(/\\D+/,'')\n end", "def number; end", "def number; end", "def interpret\n return @number\n end", "def add_digits(number)\nend", "def digit!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 46 )\n\n \n # - - - - main rule block - - - -\n # at line 392:10: '0' .. '9'\n match_range( 0x30, 0x39 )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 46 )\n\n end", "def set_last_digits\n end", "def digits(cc_num)\n cc_num.to_i.digits\nend", "def line_count_experiment\n @letters_two.dump\n lines = @letters_two.xlate(@line_count_map)\n lines << @extra_digits\n lines.flatten!\n lines.dump('append')\n lines.chunk(2).to_i.collect { |d| d.to_s(5) }.dump(:from_base_5).to_i.to_letter\nend", "def next_digit\n @phone.slice!(0)\n end", "def print_numbers\n @file.each do |line|\n number = clean_numbers(line[:homephone])\n puts number\n end\n\n end", "def digitize_1(n)\n list = []\n puts n.to_s\n \n n.to_s.each_char do |char| \n list << char.to_i\n end\n\n return list.reverse\nend", "def digit!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 53 )\n\n type = DIGIT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 352:8: '0' .. '9'\n match_range( 0x30, 0x39 )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 53 )\n\n end", "def consume_numeric; end", "def initialize(digits)\n @value = digits.to_s.to_i\n end", "def dig(dig,num)\n\tnum/dig%10\nend", "def cpu_get_correct_digits(result)\n to_return = []\n result.each do |guess_digit, result_digit|\n if(result_digit == \"○\")\n to_return.push(guess_digit)\n end\n end\n to_return\n end", "def convert_to_numbers(multiline_digit)\n chunked = multiline_digit.map { |line| line.chars.each_slice(3).to_a }.transpose\n numbers = chunked.map { |digit| DIGIT_DICTIONARY[digit.flatten.join] ||= \"?\" }\n numbers.join('')\nend", "def generate_number_strings(cleaned_multiline_digits)\n cleaned_multiline_digits.map do |multiline_digit|\n convert_to_numbers(multiline_digit)\n end\nend", "def digit!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 37 )\n\n type = DIGIT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 136:8: '0' .. '9'\n match_range( 0x30, 0x39 )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 37 )\n\n end", "def digitize(n)\n number_array =[] #convert n into a string to use split. Map lets us create a new array but we must convert back into int\n number_array = n.to_s.split(\" \").map(&:to_i) # SPLIT divided strings into substrings\n return number_array\n\nend", "def digits(input)\n verify_int(input).to_s.split(//)\nend", "def initialize_check_digit\n @position = @digits.size\n append 0\n end", "def get_digits(num)\n digits = []\n result = num \n first_iter_flag = true\n while(result != 0)\n result = result/10 if(!first_iter_flag)\n first_iter_flag = false if(first_iter_flag)\n digits.unshift result%10 if(result != 0)\n end\n digits\nend", "def finishNumber(unfinishedNum)\n\t# Debug output\n\tif $DEBUG then STDERR.puts \"in finishNumber() with #{unfinishedNum}\" end\n\n\tcount = 0\n\n\tunfinishedNum.split(\"\").each_with_index do |char, index|\n\t\tif char == 'x' then\n\t\t\tunfinishedNum[index] = count.to_s\n\t\t\tcount = count + 1\n\t\tend\n\tend\n\n\treturn unfinishedNum\nend", "def initialize(digits)\n @digits = digits\n end", "def dig_number(number)\n arr_dig = number.to_s.chars\n count = arr_dig.size\n arr_dig.map {|dig| dig.to_i ** count} \nend", "def phone_numbers\n request = @browser.get(\"#{VoipfoneClient::API_GET_URL}?nums\")\n parse_response(request)[\"nums\"].collect {|n| n.first}\n end", "def sum_digits(num)\n\nend", "def digitize(n)\n n.digits\nend", "def grab_input_number\n string = ''\n string << @input.slice!(0) while input.length != 0 and ('0'..'9').include?(input[0])\n string.to_i\n end", "def on_inc\n end", "def event_data\n message = @event['check']['output']\n \"#{message.split[1]} RPS\"\n end", "def digital_root(number)\r\n # Your code goes here\r\n\r\n # int to array of numbers\r\n # seperate into digits\r\n # iterate\r\n # add them\r\n # return them (into another array?)\r\n\r\n #guard clause to make sure it's an integer?\r\n\r\n# if number !>= 0 && number !>= 1\r\n# if number == 0..9 dont run?\r\n\r\ndigits_arr = []\r\ndigital_root = []\r\n\r\nif !number.negative? # if number is not negative then run loop\r\n\r\n digits_arr = number.digits.reverse #this method wont work?\r\n\r\n #use to chr\r\n\r\n digital_root = digits_arr.sum\r\n\r\n root_digits = digital_root.digits.reverse\r\n\r\n digital_root_sum = \r\n\r\n\r\n digits_arr.each do |digit|\r\n #use sum method\r\n # if sum of digits_arr is == number then return true\r\n digit(i) + digit(i+1) #loop through add to next one - index?\r\n end\r\n\r\nelse \r\n return (-1) #if any negative argument is provided\r\n\r\nend\r\n\r\n\r\n# (&:to_i)\r\n# thats a short hand for map{|num| num.to_i}", "def digit!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 47 )\n\n type = DIGIT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 184:12: ( '0' .. '9' )+\n # at file 184:12: ( '0' .. '9' )+\n match_count_3 = 0\n while true\n alt_3 = 2\n look_3_0 = @input.peek( 1 )\n\n if ( look_3_0.between?( 0x30, 0x39 ) )\n alt_3 = 1\n\n end\n case alt_3\n when 1\n # at line 184:13: '0' .. '9'\n match_range( 0x30, 0x39 )\n\n else\n match_count_3 > 0 and break\n eee = EarlyExit(3)\n\n\n raise eee\n end\n match_count_3 += 1\n end\n\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 47 )\n\n end", "def callnumbers_from_945(record)\n callnumbers = []\n # Get the and b values to use as alternates\n # TODO: do we need to consider other fields (e.g. 099)?\n values_090ab = []\n x090ab = extract_marc(\"090ab\", :trim_punctuation => false)\n x090ab.call(record, values_090ab, nil)\n alternate_stem = values_090ab.join(\" \")\n # Process the callnumbers in the 945\n f945 = record.select {|f| f.tag == \"945\"}\n f945.each do |f|\n a = subfield_value(f, \"a\")\n b = subfield_value(f, \"b\")\n c = subfield_value(f, \"c\")\n g = subfield_value(f, \"g\")\n callnumber = build_callnumber(a, b, c, g, alternate_stem)\n if callnumber != \"\"\n callnumbers << callnumber\n end\n end\n callnumbers\nend", "def handle_numeric(number, fullactor, actor, target, text)\n # All numerics share the same args, and rarely care about anything but\n # text, so let's make it easier by passing a hash instead of a list\n args = {:fullactor => fullactor, :actor => actor, :target => target}\n base_event = :\"incoming_numeric_#{number}\"\n if Array === @handlers[base_event]\n handle(base_event, text, args)\n else\n # No handler = report and don't worry about it\n report \"Unknown raw #{number.to_s} from #{fullactor}: #{text}\"\n end\n end", "def paint_letter_box(start, finish)\n\n i = 0\n digit = []\n new_array = []\n while i < 10\n number = (start..finish).to_a # to_a mean return the array containing the numbers in the given range\n digit = number.join.chars.map(&:to_i) # I split the number array by join.chars.map(&:to_i) method\n new_array << digit.count(i) # I counted how many number equal to i, and i add the number to new array\n i+= 1 \n end\n\n puts new_array\nend", "def addends\n\t\tluhn_array = @digit_array.reverse.map.with_index(1) do |value, idx|\n\t\t\tif idx.even?\n\t\t\t\tvalue = (value * 2 > 10) ? (value * 2 - 9) : (value * 2)\n\t\t\telse\n\t\t\t\tvalue\n\t\t\tend\n\t\tend\n\t\tluhn_array.reverse\n\tend", "def parse_numbers(data)\n numbers = data.scan(/\\d{1,1000}/m).map(&:to_i)\n\n # extract last number if data ends with digit\n # rubocop:disable Style/IfUnlessModifier\n if !@is_last_block && data[-1] =~ /\\d/\n @prev_tail = numbers.pop\n end\n\n numbers\n end", "def digit \n\t\n\t$cst.add_branch(\"digit\")\n\t\n\tmatch_token(\"T_DIGIT\", $tokens[$index])\n\t\n\t$cst.ascend\n\t\nend", "def digits(text)\n return text.digits if text.is_a?(self)\n number = text.to_s.gsub(/\\D/,'')\n number = \"1#{number}\" if number.length == 10\n number\n end", "def speak_as_digits_inherit(element)\n reverse_speak_as(element, 'digits')\n\n isolate_text_node(element)\n\n visit(element, method(:speak_as_digits))\n end", "def number\n @number\n end", "def digitize(n)\n split_array_numbers = n.to_s.split(//).map { |x| x.to_i}.reverse\nend", "def expected_check_digit\n digits.last\n end", "def transform_track_number ( number )\n\t\t# puts \"transform_track_number: input #{number} #{number.to_s}\"\n\t\t_number = number.to_s + \"/\" + (@renumber_start_at + @total_tracks -1 ).to_s\n\tend", "def persistence(n)\n count = 0\n while n > 9 do\n n = n.digits.inject(:*)\n count += 1\n end\n count\nend", "def digit_list(num)\n num.digits.reverse\nend", "def digit_list(num)\n num.digits.reverse\nend", "def interpret\r\n return @number.to_i\r\n end", "def digit_list(num)\n int_array = []\n digit_array = num.to_s.split(//)\n digit_array.each do |numb|\n int_array += [numb.to_i]\n end\n int_array\nend", "def captured_number\n puts \"Enter a 4 digit number and press ENTER:\"\n gets.chomp.to_i\nend", "def sum(num)\n\n\tarray_of_digits = num.digits\n\n\tarray_of_digits.sum\n\nend", "def dec_nums(msg)\n numarr = msg[:message].squeeze(' ')\n numarr = numarr.split('').map(&:to_i)\n len = numarr.length\n total = 0\n for i in 0...len\n total = total + (2**i) * (numarr[len-i-1])\n end\n out = total.to_s\n msg.speak(out)\n end", "def digits(number)\n number.to_s.chars.map(&:to_i)\nend", "def num; end", "def num; end", "def decimal_digits\n pos0 = @pos\n if (code = @codes[@pos]) >= 0x30 and code <= 0x39\n @pos += 1\n while code = @codes[@pos] and code >= 0x30 and code <= 0x39\n @pos += 1\n end\n return @codes[pos0...@pos].pack(\"U*\")\n else\n nil\n end\n end", "def call_num(reg_key, addr, i_reg, m_spec)\n end", "def teletext_add_digit _value\n send_cmd(\"teletext_add_digit #{_value}\")\n end", "def numbers(n)\n\nend", "def decode_int\n # @index is at the position of the the 'i' so we just need everything between it\n # and the next appearance of 'e'.\n index_of_last_digit = self[@index..self.length - 1].index 'e'\n number_string = self[(@index + 1)..(@index + index_of_last_digit - 1)]\n @index += index_of_last_digit\n number_string.to_i\n end", "def bsb_number; end", "def featured(number)\n number += 1\n\n until number % 7 == 0 && number.odd?\n number += 1\n end\n\n loop do\n if number.digits.uniq == number.digits\n return number\n else\n number += 14\n end\n break if number.digits.size > 10\n end\n\n \"Error\"\nend", "def phone_number_value\n # byebug\n\n if self.phone_number.present?\n numbers_array = self.phone_number.split(\",\")\n numbers_array.each do |nn|\n nn = nn.gsub(\"-\",\"\").gsub(\"+91\",\"\").gsub(\" \",\"\") \n # byebug\n if nn.to_i.to_s.length != 10\n # byebug\n self.errors[:phone_number]<< \"must be 10 digit number\"\n end \n end\n end\n end", "def _digits\n\n _save = self.pos\n while true # choice\n _tmp = match_string(\"0\")\n break if _tmp\n self.pos = _save\n\n _save1 = self.pos\n while true # sequence\n _tmp = scan(/\\A(?-mix:[1-9])/)\n unless _tmp\n self.pos = _save1\n break\n end\n _tmp = scan(/\\A(?-mix:[0-9]*)/)\n unless _tmp\n self.pos = _save1\n end\n break\n end # end sequence\n\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_digits unless _tmp\n return _tmp\n end", "def dv\n split_reversed_rut = @last_rut.to_s.reverse.chars\n seq = [2, 3, 4, 5, 6, 7]\n i = 0\n digit_sum = split_reversed_rut.reduce(0) do |sum, n|\n partial_result = sum.to_i + (n.to_i * seq[i])\n i = i == 5 ? 0 : i + 1\n partial_result\n end\n partial_check_digit = 11 - (digit_sum % 11)\n case partial_check_digit\n when 11\n '0'\n when 10\n 'k'\n else\n partial_check_digit.to_s\n end\n end", "def digital_root(num)\n until num < 10\n num = num.to_s.split(\"\")\n formatted = []\n num.each do |n|\n formatted << n.to_i\n end\n\n num = formatted.inject(:+)\n end\n num\nend", "def digitArray(num)\n\tdigs = []\n\twhile num > 9\n\t\tnum, last_digit = num.divmod(10)\n\t\tdigs << last_digit\n\tend\n\tdigs << num\n\tdigs\nend", "def digit_list1(num)\n num.digits.reverse\nend", "def display_number\n # \n ('X' * (account_number.to_s.length - last_digits.size)) + last_digits\n # account_number.to_s[0..last_digits.size].to_s.size + \n # last_digits.to_s\n end", "def desc_digits(input)\n\t\tcreate_array(input).sort.join.to_i\n\tend", "def hex_digit!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 6 )\n\n \n # - - - - main rule block - - - -\n # at line 291:13: ( '0' .. '9' | 'a' .. 'f' | 'A' .. 'F' )\n if @input.peek( 1 ).between?( 0x30, 0x39 ) || @input.peek( 1 ).between?( 0x41, 0x46 ) || @input.peek( 1 ).between?( 0x61, 0x66 )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 6 )\n\n end", "def check_digit\n dv\n end", "def get_number_system(tok)\n ret = String.new(tok)\n if ret[0] == 36 # $\n ret[0] = \"\"\n return ret.to_i(16)\n elsif ret[0] == 67 # C\n ret[0] = \"\"\n return ret.to_i(8)\n elsif ret[0] == 66 # B\n ret[0] = \"\"\n return ret.to_i(2)\n else\n return ret.to_i(10)\n end\n end", "def voip_number\n FFaker.numerify('3### ####')\n end", "def digit_list(number)\n number.to_s.chars.map(&:to_i)\nend", "def digit_list(number)\n number.to_s.chars.map(&:to_i)\nend", "def digit_list(number)\n number.to_s.chars.map(&:to_i)\nend", "def digit_list(number)\n number.to_s.chars.map(&:to_i)\nend", "def digit_list(number)\n number.to_s.chars.map(&:to_i)\nend", "def birth_path_number_again(digits)\n no1 = digits[0].to_i\n no2 = digits[1].to_i\n number = no1 + no2\n number = number.to_s\nend" ]
[ "0.6346942", "0.61031765", "0.5721756", "0.57170177", "0.57105786", "0.5682282", "0.5672521", "0.55692613", "0.5545136", "0.55328053", "0.5531873", "0.55206746", "0.549168", "0.549168", "0.5469491", "0.5466268", "0.545692", "0.5451973", "0.5434246", "0.5434246", "0.53769916", "0.53638804", "0.53542745", "0.53456914", "0.5344523", "0.5337181", "0.53105646", "0.5306823", "0.5298144", "0.5284699", "0.5282036", "0.52815723", "0.5273023", "0.527137", "0.5257032", "0.525429", "0.5252636", "0.5247441", "0.52307075", "0.52267784", "0.52150476", "0.52062887", "0.5203367", "0.52011204", "0.5191628", "0.5183317", "0.51833045", "0.5179163", "0.5169555", "0.51619786", "0.5156008", "0.515298", "0.51481503", "0.5146225", "0.51451427", "0.51420075", "0.5138678", "0.51265776", "0.51160735", "0.51147914", "0.5114706", "0.51091266", "0.51053566", "0.5102852", "0.5088267", "0.5086933", "0.5086933", "0.5083701", "0.50815946", "0.50810575", "0.5076694", "0.5075777", "0.5073511", "0.5071088", "0.5071088", "0.5063624", "0.505798", "0.50543004", "0.50536597", "0.5051453", "0.50451684", "0.5039195", "0.50362813", "0.50314087", "0.50249714", "0.50248116", "0.5021538", "0.50199515", "0.5018922", "0.50143254", "0.5011486", "0.5010713", "0.5009713", "0.5006261", "0.50047994", "0.50047994", "0.50047994", "0.50047994", "0.50047994", "0.5003858" ]
0.5923783
2
This is an event callback.
def collect_rating(digits = nil) # do something, either with object state or DB info. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event; end", "def event; end", "def event; end", "def callback\n\n end", "def callback\n end", "def callback\n\tend", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def handle_event(event)\n\n\t\tend", "def callbacks; end", "def callbacks; end", "def listener; end", "def event_change\n\t\n\tend", "def send_events; end", "def events\n end", "def events=(_); end", "def callback &block\n super\n end", "def callback &block\n super\n end", "def callback\n def_deferr = ::EventMachine::DefaultDeferrable.new\n proc_callback = Proc.new { |response| ::OnesnooperServer::Log.debug(\n \"[#{self.class.name}] Handled as: #{response}\"\n ) }\n\n def_deferr.callback &proc_callback\n def_deferr.errback &proc_callback\n\n def_deferr\n end", "def callback=(_arg0); end", "def processEvent(eventName)\n\tend", "def on_entry\n end", "def event_bus; end", "def event_bus; end", "def callback_method\n run(\"on\", \"string\", \"callback\")\n end", "def process\n read_events.each {|event| event.callback!}\n end", "def callback\n self.class.callback\n end", "def callback\n self.class.callback\n end", "def send_events=(_arg0); end", "def apply(raw_event); end", "def callback\n Proc.new do |data, type, ev|\n event = Ecore::EcoreEventSignalExit.new(ev)\n\t event_type = [:interrupt, :quit, :terminate].find {|sym| event[sym] }\n\n\t @callback.call(event_type)\n\t 1\n\tend\n end", "def bookEvent\n end", "def qualified_event; end", "def qualified_event; end", "def onEnd\r\n end", "def human_event; end", "def event\n @event\n end", "def type ; :event ; end", "def event_callback(path, event)\n\t\t\t\tpublish(\"zk_event_#{path}\", event)\n\t\t\tend", "def on_update; end", "def callback_type; end", "def process(event)\n # Nothing\n end", "def callback_phase\n super\n end", "def after_set_callback; end", "def callback\n @on_declare\n end", "def listener=(_arg0); end", "def on event,&b\n each do |e| \n e.on event,&b\n end\n self\n end", "def ev_do_postprocess(was_events); end", "def ev_do_handle_events(readers, writers); end", "def callback(&blk)\n @blk=blk\n end", "def evented\n @evented = true\n end", "def onmessage(&blk); super; end", "def result\n main_event\n end", "def sub event, callback, subject_or_class = nil, args = nil\n location(event,subject_or_class).push [self,callback,args]\n end", "def fires_in; end", "def on_ready\n end", "def callback!\n watcher && watcher.callback!(self)\n end", "def get_event_callback\n Proc.new do |new_packets, refCon_ptr, connRefCon_ptr|\n begin\n # p \"packets received: #{new_packets[:numPackets]}\"\n timestamp = Time.now.to_f\n messages = get_messages(new_packets)\n # SINM ADDED\n @queue.push(messages.map do |message|\n enqueue_message(message, timestamp)\n end.compact)\n # SINM COMMENTED OUT\n # messages.each { |message| enqueue_message(message, timestamp) }\n rescue Exception => exception\n Thread.main.raise(exception)\n end\n end\n end", "def received\n end", "def event_callback\n case params[:event][:type]\n when \"message\"\n parse_message\n when \"app_mention\"\n end\n end", "def on_event_registered(unit, event)\n event\n end", "def listeners; end", "def call event\n fire(event)\n end", "def on_data_changed; end", "def after_update_callback\n puts('----------after_updateをコール----------')\n end", "def validate_event; end", "def worker\n @fsevent\n end", "def on_start\n end", "def on_end(&callback)\n @end_callback = callback\n end", "def on_entry(in_state: nil, &block)\n end", "def define_event_helpers; end", "def trigger(owner, event, *args); end", "def callback( which, *args )\n block = instance_variable_get( \"@on_#{which.to_s}\" )\n block.call( *args ) if block\n end", "def on_update(&update_callback)\n @update_callbacks << update_callback\n end", "def event_requirement; end", "def call\n catch_event unless no_event_possible?\n end", "def on_enter\n end", "def after_generate_callbacks; end", "def on_update(&block)\n @on_update = block\n end", "def on_data(&callback)\n @data_callback = callback\n end", "def change(event)\n event\n end", "def callback\n false\n end", "def write( event )\n nil\n end", "def on_process(&callback)\n @callback = callback\n end", "def on_quit\n end", "def create_events\n end", "def call(event)\n return false if drop?\n event\n end", "def on(event, &handler)\n # TODO raise error (for the time being)?\n end", "def on(event_name, &block)\n\t\t\t@events[event_name] = block\n\t\tend", "def on_data( &block )\n @on_data = block\n end", "def on_data_ok; on_data_cancel; end", "def update_global_common_events\n end", "def on_byte_input( &callback )\n\t\traise LocalJumpError, \"no block given\" unless callback\n\t\tself.byte_input_callback = callback\n\tend", "def on_inc\n end", "def on_data(&f)\n @on_data = f\n end" ]
[ "0.8080912", "0.8080912", "0.8080912", "0.78127563", "0.7773009", "0.7536711", "0.74571943", "0.74571943", "0.74571943", "0.74571943", "0.74571943", "0.74571943", "0.74571943", "0.74571943", "0.7390024", "0.7196657", "0.7196657", "0.7137596", "0.70711637", "0.7008733", "0.69691277", "0.68880385", "0.68775046", "0.68775046", "0.6792513", "0.67741674", "0.67461574", "0.669148", "0.66507125", "0.66507125", "0.66493237", "0.6617801", "0.6608197", "0.6608197", "0.65852416", "0.65362144", "0.6522274", "0.65120363", "0.64965975", "0.64965975", "0.64682937", "0.6444675", "0.64413494", "0.6409606", "0.639562", "0.63911444", "0.6359149", "0.6341799", "0.63332015", "0.6317115", "0.6296779", "0.62782633", "0.6262919", "0.6261959", "0.62413406", "0.6238257", "0.623565", "0.62321943", "0.6221543", "0.6210459", "0.6207814", "0.6203128", "0.61956096", "0.6188192", "0.6173455", "0.61676586", "0.616129", "0.609685", "0.6087429", "0.60793436", "0.6070571", "0.60573506", "0.60519916", "0.60487556", "0.6046963", "0.6046617", "0.6044956", "0.60238004", "0.6021714", "0.6019551", "0.60084474", "0.6008176", "0.59955305", "0.5982136", "0.5981649", "0.5965284", "0.59641844", "0.5959669", "0.59488904", "0.5945127", "0.59253234", "0.59164137", "0.59097546", "0.5905075", "0.58965003", "0.5892565", "0.5889052", "0.58885014", "0.58848655", "0.58781046", "0.58712465" ]
0.0
-1
Dynamically provide a range of keys options
def num_ratings 5 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def possible_keys(key); end", "def add_range_opts(fkey, lkey)\n @oparse.on(\"-r\", \"--range=START[:END]\", \n \"Start and optional end range\") do |r|\n\n raise \"-x and -r are mutually exclusive\" if @parser_got_range\n @parser_got_range=true\n\n unless m=/^(-?[0-9]+)(?::(-?[0-9]+))?$/.match(r)\n raise \"invalid range #{r.inspect}\"\n end\n\n @opts[fkey] = $1.to_i\n @opts[lkey] = $2.to_i if $2\n end\n\n @oparse.on(\"-x\", \"--hexrange=START[:END]\", \n \"Start and optional end range in hex\") do |r|\n\n raise \"-x and -r are mutually exclusive\" if @parser_got_range\n @parser_got_range=true\n\n unless m=/^(-?[0-9a-f]+)(?::(-?[0-9a-f]+))?$/i.match(r)\n raise \"invalid range #{r.inspect}\"\n end\n\n @opts[fkey] = \n if ($1[0,1] == '-')\n ($1[1..-1]).hex_to_num * -1\n else\n $1.hex_to_num\n end\n\n if $2\n @opts[lkey] = \n if($2[0,1] == '-')\n $2[1..-1].hex_to_num * -1\n else\n $2.hex_to_num\n end\n end\n end\n end", "def option_keys\n []\n end", "def vash_key_name(*args); 'option name'; end", "def key; @opts['key'] end", "def options\n\t\t\tVALID_OPTIONS_KEYS.inject({}) do |option,key|\n\t\t\t\toption.merge!(key => send(key))\n\t\t\tend\n\t\tend", "def key_options\n case key_type\n when :select\n return Concerto::Application.config.field_configs[key.to_sym][:values]\n else\n return nil\n end\n end", "def key_variants; end", "def additional_spec_options_collection\n args.collect do |key, value|\n case key.to_s\n when \"minimum\"\n \"is_at_least(#{value})\"\n when \"maximum\"\n \"is_at_most(#{value})\"\n when \"in\", \"within\"\n \"is_at_least(#{value.first}).is_at_most(#{value.last})\"\n when \"is\"\n \"is_equal_to(#{value})\"\n else\n raise(ArgumentError, \"Unknown property: #{key}\")\n end\n end\n end", "def params_keys\n default_keys + advanced_keys\nend", "def zrange(key, start, stop, **options); end", "def vash_valid_key?(x); self.class.option_name?(x); end", "def keys_for(host, options = T.unsafe(nil)); end", "def minimum_runnable_options\n [\n :keypair, :minimum_instances, :maximum_instances, :ami, :security_group,\n :expand_when, :contract_when, :set_master_ip_to\n ]\n end", "def options\n VALID_OPTIONS_KEYS.reduce({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def specific_keys\n %w(\n animate\n size\n background\n transparent\n enhanced\n rounded\n butt\n linewidth\n dashlength\n tiny\n small\n medium\n large\n giant\n font\n fontscale\n crop\n )\n end", "def options_for_key(klass, key_name)\n DoesKeyValue.log(\"State: Querying options_for_key for class:#{klass.to_s} and key:#{key_name}\")\n key_def = (@keys[klass.to_s] || Array.new).find{|x| x[:name]==key_name.to_sym} || {}\n opts = key_def[:options]\n end", "def index_options(keys=[:background, :unique, :sparse])\n Hash[ keys.map { |k| [k, true] } ]\n end", "def translate_options(keys, scope)\n keys.map{|k| [t(k, :scope => scope), k]}\n end", "def key_index\n options[:key_index]\n end", "def valid_options\n VALID_OPTIONS_KEYS.reduce({}) { |a, e| a.merge!(e => send(e)) }\n end", "def keys(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"keys\", start, stop, limit], :multi => true\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def decide_for_keys(keys, options = nil)\n @optimizely_client&.decide_for_keys(clone, keys, options)\n end", "def decide_for_keys(keys, options = nil)\n @optimizely_client&.decide_for_keys(clone, keys, options)\n end", "def creator(array, num_array, letter_array)\n array.map do |key|\n if num_array.include?(key[0])\n key = 'KeyCode::KEY_' + key\n elsif letter_array.include?(key)\n key = 'KeyCode::' + key.upcase\n elsif key.include?(\"LEFT\")\n key = 'KeyCode::CURSOR_LEFT'\n elsif key.include?('RIGHT')\n key = 'KeyCode::CURSOR_RIGHT'\n elsif key.include?('UP')\n key = 'KeyCode::CURSOR_UP'\n elsif key.include?('DOWN')\n key = 'KeyCode::CURSOR_DOWN'\n elsif ['CONTROL', 'CTRL', 'CNTRL'].include?(key)\n key = 'ModifierFlag::CONTROL_L'\n elsif ['OPTION', 'OPT', 'OP'].include?(key)\n key = 'ModifierFlag::OPTION_L'\n elsif ['COMM', 'COMMAND', 'CMD'].include?(key)\n key = 'ModifierFlag::COMMAND_L'\n elsif ['SHIFT', 'SHFT', 'SHIF'].include?(key)\n key = 'ModifierFlag::SHIFT_L'\n elsif ['PERIOD', 'DOT'].include?(key)\n key = 'KeyCode::DOT'\n elsif ['SEMICOLON', 'SEMI-COLON', 'SEMI_COLON'].include?(key)\n key = 'KeyCode::SEMICOLON'\n elsif [\"BR\", 'BRACKET', 'BRACE', 'BRACE_L', 'BRACKET_L', 'BRACKET_LEFT', 'LEFT_BRACKET'].include?(key)\n key = 'KeyCode::BRACKET_L' \n elsif [ 'BRACE_R', 'BRACKET_R', 'BRACKET_RIGHT', 'RIGHT_BRACKET' ].include?(key)\n key = 'KeyCode::BRACKET_R'\n end\n end\nend", "def valid_options\n %i(\n\n ) # end array\n end", "def keys(start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"keys\", start, stop, limit], multi: true\n end\n end", "def extra_keys(options, recall = T.unsafe(nil)); end", "def key_types=(_arg0); end", "def prepare_key(key, options)\n complete_key = key\n\n # if a scope is passed in options then build the full key\n complete_key = options[:scope].present? ? \"#{options[:scope].to_s}.#{complete_key}\" : complete_key\n\n # add the correct count suffix\n if options[:count].present? && options[:count] == 1\n complete_key = \"#{complete_key}.one\"\n elsif options[:count].present? && options[:count] != 1\n complete_key = \"#{complete_key}.other\"\n end\n complete_key\n end", "def validate_option_keys(options)\n raise TinyDyno::Errors::HashKeyOnly.new(klass: self.class, name: 'primary_key') if primary_key.nil?\n options.keys.each do |key|\n raise TinyDyno::Errors::InvalidSelector.new(klass: self.class, name: key) unless valid_field_selector?(field_name: key.to_s)\n end\n end", "def options\n VALID_OPTIONS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n ops = {}\n @options.each_value do |data|\n if data.given?\n if !data.short_name.nil?\n ops[data.short_name] = nil\n else\n ops[data.long_name] = nil\n end\n end\n end\n return ops.keys\n end", "def default_keys; end", "def from_keys\n end", "def initialize(options = {})\n @description = options.delete(:description)\n @keys = options.keys\n @primary = options[@keys.first]\n @secondary = options[@keys.last]\n end", "def options\n VALID_OPTIONS_KEYS.reduce({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def add_keys(*keys)\n @rye_opts[:keys] ||= []\n @rye_opts[:keys] += keys.flatten.compact\n @rye_opts[:keys].uniq!\n self # MUST RETURN self\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def keys(*) end", "def define_mapping\n @mapping[:all] = [\"-a\", \"--all\"]\n @mapping[:coord] = [\"-c\", \"--coord\"]\n @mapping[:delta] = [\"-d\", \"--delta\"]\n @mapping[:extreme] = [\"-e\", \"--extreme\"]\n @mapping[:index] = [\"-i\", \"--index\"]\n @mapping[:meta] = [\"-m\", \"--meta\"]\n @mapping[:option] = [\"-o\", \"--option\"]\n @mapping[:range] = [\"-r\", \"--range\"]\n @mapping[:section] = [\"-s\", \"--section\"]\n @mapping[:time] = [\"-t\", \"--time\"] \n end", "def options\n Hash[VALID_OPTIONS_KEYS.map {|key| [key, public_send(key)] }]\n end", "def __numval_optkeys\n super() + ['closeenough']\n end", "def get_range_keys(column_family, options = {})\n get_range(column_family,options.merge!(:count => 1)).keys\n end", "def arg_hash_keys_limit(required_keys, optional_keys, *args)\n args.each do |h|\n missing = required_keys - h.keys\n extra = h.keys - required_keys - optional_keys\n \n unless missing.empty? && extra.empty?\n msg = \"\"\n msg << \"Hash is missing required keys (#{missing.join(', ')}).\\n\" unless missing.empty?\n msg << \"Hash has extra keys which aren't allowed (#{extra.join(', ')}).\\n\" unless extra.empty?\n msg << \" Got: #{h.inspect}\"\n raise ArgumentError, msg\n end\n end\n end", "def flexible_key; end", "def key_inputs; end", "def convert_choice_to_key\n case get_option\n when \"1\"\n return \"height\"\n when \"2\"\n return \"mass\"\n when \"3\"\n return \"hair_color\"\n when \"4\"\n return \"skin_color\"\n when \"5\"\n return \"eye_color\"\n when \"6\"\n return \"birth_year\"\n when \"7\"\n return \"gender\"\n when \"8\"\n return \"homeworld\"\n when \"9\"\n return \"films\"\n when \"10\"\n return \"species\"\n end\nend", "def keys() end", "def answer_keys\n [key]\n end", "def key=(key)\n options[:key] = key\n end", "def key_options(key_name)\n DoesKeyValue::State.instance.options_for_key(self, key_name)\n end", "def zinter(*keys, **options); end", "def range_keys_for_indexes\n all_keys = options[:local_indexes].map(&:range_key) +\n options[:global_indexes].map(&:range_key)\n\n all_keys.reject do |range_key|\n range_key == options[:range_key]\n end.uniq\n end", "def options\n self.items\n itemsArr = @items.keys\n @options = []\n for i in 1..(items.length) do\n @options = @options + itemsArr.combination(i).to_a\n end\n @options\n end", "def __strval_optkeys\n super() << 'selectcolor' << 'title'\n end", "def range(range)\n opts[:min] = range.begin\n opts[:max] = range.end\n end", "def options\n Hash[ * VALID_OPTIONS_KEYS.map { |key| [key, send(key)] }.flatten ]\n end", "def key(*args)\n args.join(\":\")\n end", "def options_for_kase(options={})\n options = options.symbolize_keys\n options.reverse_merge!({:language_code => Utility.language_code || 'en', \n :country_code => Utility.country_code || 'US'})\n options = (params[:kase] || {}).symbolize_keys.merge({:kind => params[:kind], :title => params[:title]}.reject {|k,v| v.blank?}.merge(options))\n \n # determine kind\n kind = case options[:kind] || self.kase_type.to_s\n when /problem/ then :problem\n when /idea/ then :idea\n when /praise/ then :praise\n when /question/ then :question\n end\n options.delete(:kind)\n \n options.merge!({\n :person => @person,\n :tier => @tier,\n :topics => [@topic].compact,\n :type => kind\n }.reject {|k,v| v.blank?})\n options\n end", "def allow_keys(keys)\n @allow_keys = keys\n end", "def options\n Hash[VALID_OPTIONS.map { |key| [key, send(key)] }]\n end", "def option *keys\n key = keys.map(&:to_s).join('.').gsub(/::/, '.').split('.')\n\n MX.synchronize {\n # options.foo!.bar!.baz!\n [key, key[1..-1]].map do |candidate|\n candidate && candidate.inject(options) do |memo, k|\n memo.public_send(k.to_s) unless memo.nil?\n end\n end.compact.first\n }\n end", "def options\n Hash[VALID_OPTIONS_KEYS.map {|key| [key, send(key)] }]\n end", "def auto_range(direction); end", "def options\n { players_name: :no_empty,\n players_markers: :character,\n first_player: :y_n,\n board_rows: :\"3_5_7\",\n multi_game: :y_n,\n contest_threshold: :\"2_to_9\",\n player_quit: :any,\n user_choose: :y_n,\n new_game: :y_n }\n end", "def validate_range(key, value, enum_values)\n values = value.instance_of?(Array) ? value : [value]\n values.each do |v|\n add_templated_error(key, \"'#{v}' is not a valid setting for '#{template.name_for(key)}'\") unless enum_values.include?(v)\n end\n end", "def options\n Hash[*VALID_PARAMS_KEYS.map {|key| [key, send(key)] }.flatten]\n end", "def options\n\t\t\toptions = {}\n\t\t\tVALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n\t\t\toptions\n\t\tend", "def method_missing(key, *args)\n if key.to_s.end_with?('=')\n key = key.to_s.sub(/\\=$/,'').to_sym\n options[key] = ARRAY_KEYS.include?(key) ? [args].flatten.compact : args.first\n else\n if ARRAY_KEYS.include?(key)\n options[key] = [options[key] + args].flatten.compact.uniq\n else\n options[key] = args.first\n end\n end\n end", "def max_key_width=(_arg0); end", "def build_dict(option_specs) #:nodoc:\n @dict = {}\n keys = []\n option_specs.each do |option_spec|\n # Parse the specification\n m, label, oper, cont, arg = *option_spec.match(/([^=:]+)(?:([=:])([@])?(\\w+))?/)\n raise ParseError.new(\"invalid option format for '#{option_spec}'\") unless m\n\n # Figure out the specification type\n is_bang_arg = label.gsub!(/!$/, '')\n is_increment = label.gsub!(/\\+$/, '')\n forms = label.split('|')\n key = forms.first\n\n # Create an instance of OptionDefinition to hold metat data\n od = OptionDefinition.new(key)\n od.option_type = :boolean if is_bang_arg\n od.option_type = :increment if is_increment\n if (arg)\n od.option_type = (oper == '=') ? :required_argument : :optional_argument\n od.container_type = case cont\n when '@'; :array\n else :scalar\n end\n od.argument_type = case arg\n when 'f', 'float' ; :float\n when 'i', 'integer'; :integer\n when 's', 'string' ; :string\n else raise ParseError.new(\"unknown argument type '#{arg}'\")\n end\n end\n\n # Process alternate key names\n forms.each do |k|\n @dict[k] = od.dup\n keys << k\n end\n\n # Only support negation on long option names\n if (is_bang_arg)\n @dict[\"no-#{key}\"] = od.dup\n end\n end\n\n # Allow abbreviated long options\n keys.abbrev.each do |ab,key|\n @dict[ab] = @dict[key].dup\n @dict[ab].abbreviated = true unless (ab == key)\n end\n end", "def list_range(key, start, ending)\n timeout_retry(3, 3){\n write \"LRANGE #{key} #{start} #{ending}\\r\\n\"\n multi_bulk_reply\n }\n end", "def keys(*_arg0, &_arg1); end", "def key_types; end", "def key_types; end", "def valid_options\n [:label, :reader, :reader_options, :ingester, :ingester_options]\n end", "def options\n {\n keywords: ['Boolean', \"Quote all keywords, not just reserved words\"],\n restrict: ['String', \"Restrict generation to tables in the specified group (e.g. bdv, rdv)\"],\n joiner: ['String', \"Use 'str' instead of the default joiner between words in table and column names\"],\n unicode: ['Boolean', \"Use Unicode for all text fields by default\"],\n tables: [%w{cap title camel snake shout}, \"Case to use for table names\"],\n columns: [%w{cap title camel snake shout}, \"Case to use for table names\"],\n surrogates: [%w{counter guid hash}, \"Method to use for assigning surrogate keys\"],\n fks: [%w{no yes delay}, \"Emit foreign keys, delay them to the end, or omit them\"],\n }\n end", "def map_keywords(block)\n block\n .parameters\n .select { |arg,| arg.equal?(:keyreq) }\n .to_h { [_2, BLOCK_OPTIONS_MAPPINGS[_2]] }\n end", "def keys_from_hash\n if @keys.include?(@option.value)\n @keys.find_index(@option.value)\n else\n 0\n end\n end", "def alternative_key_names\n @alternative_key_names ||= [[:alt, :menu, :altKey], [:alt_graph, :AltGraph], [:caps_lock, :CapsLock], [:ctrl, :control, :ctrlKey], \n [:Fn], [:fn_lock, :FnLock], [:Hyper], [:meta, :metaKey], [:num_lock, :NumLock], [:OS], \n [:scroll_lock, :ScrollLock], [:shift, :shiftKey], [:Super], [:Symbol], [:symbol_lock, :SymbolLock]]\n end", "def make_option_list\n end", "def make_option_list\n end", "def __val2ruby_optkeys # { key=>proc, ... }\n super().update('labelwidget'=>proc{|v| window(v)})\n end", "def extract_instance_options(prefix, options)\n acceptable_keys = ['sid', 'thnum', 'bnum', 'apow', 'fpow', 'ncnum', 'xmsiz', 'opts']\n keys = options.keys.select { |key| key.to_s.starts_with? prefix }\n\n keys.inject({}) do |hash, key|\n real_key = key.to_s.gsub(/^#{prefix}/, '')\n hash[real_key.to_sym] = options[key] if acceptable_keys.include? real_key\n hash\n end\n end", "def validate_options(options)\n return super unless backend\n super(options.slice(*(options.keys - backend.valid_keys)))\n\n # Validate that the default backend from config has valid keys, or if\n # it is overridden by an array input that the array has valid keys.\n if options[:backend].is_a?(Array)\n name, backend_options = options[:backend]\n extra_keys = backend_options.keys - backend.valid_keys\n raise InvalidOptionKey, \"These are not valid #{name} backend keys: #{extra_keys.join(', ')}.\" unless extra_keys.empty?\n end\n end", "def sanitize_options(options)\n options.keys.each do |key|\n unless Facade.options[:valid_find_options].include?(key) || Facade.options[:valid_list_options].include?(key)\n raise InvalidListOptions, \"Bad key passed: #{key}\"\n end\n end\n end", "def play_options(prompt)\n choices = [\n {name: \"Hit\", value: 1},\n {name: \"Stand\", value: 2},\n {name: \"Exit\", value: 3}\n ]\n chosen_option = prompt.select(\"What would you like to do?\", choices, help_color: :yellow, help: \"(Use Keybvoard keys)\", show_help: :start, filter: true)\nend", "def option! keys, value\n key = (keys.is_a?(Array) ? keys.join('.') : keys.to_s).gsub(/::/, '.').split('.')\n last = key.pop\n\n MX.synchronize {\n # options.foo!.bar!.baz! = value\n build = key.inject(__options__) do |memo, k|\n memo.public_send(\"#{k}!\")\n end\n build[last] = value\n }\n end", "def zrange(key, start, stop, options = {})\n send_cluster_command([:zrange, key, start, stop, options])\n end", "def check_for_illegal_keys!(options)\n if any_unrecognized_keys?(ALLOWED_KEYS, options)\n raise \"Unrecognized options in add_method_tracer_call: #{unrecognized_keys(ALLOWED_KEYS, options).join(', ')}\"\n end\n end", "def zkeys(key, start, stop, opts = {})\n limit = opts[:limit] || -1\n mon_synchronize do\n perform [\"zkeys\", key, BLANK, start, stop, limit], :multi => true\n end\n end", "def opts(**kws)\n res = {}\n kws.each_pair do |kw, v|\n res[kw] = v[0] unless v[0] == v[1]\n end\n res\n end", "def limit_users(opts,collection,limit_defaults)\n opts.keys.sort.each do |k|\n v = (opts[k] == 'defaults') ? limit_defaults : Array(opts[k])\n\n v.each do |oper|\n collection[oper] ||= []\n\n if k == 'valid-user'\n collection[oper] << 'Require valid-user'\n else\n collection[oper] << \"Require ldap-user #{k}\"\n end\n end\n end\n end", "def show_possible_values(options={})\n\t\t@operator.choose do |menu|\n\t\t\toptions.each do |key, value|\n\t\t\t\tmenu.choice(key) { value }\n\t\t\tend\n\t\tend\n\tend" ]
[ "0.6546285", "0.62363833", "0.62213165", "0.6019009", "0.594", "0.58996177", "0.58906305", "0.58818734", "0.58591413", "0.5811829", "0.5779865", "0.57707435", "0.5717811", "0.5707581", "0.56992894", "0.5669388", "0.56571734", "0.56552714", "0.5645073", "0.56189317", "0.5615775", "0.560266", "0.5584927", "0.55765826", "0.55765826", "0.5575637", "0.5573734", "0.55713445", "0.55691016", "0.5558466", "0.5554911", "0.55533636", "0.5544254", "0.55319196", "0.55285347", "0.5518323", "0.5517128", "0.55129534", "0.5509755", "0.55002326", "0.55002326", "0.55002326", "0.55002326", "0.55002326", "0.55002326", "0.5494936", "0.54943186", "0.54895943", "0.5484015", "0.54808056", "0.5472401", "0.54674083", "0.54530084", "0.5435757", "0.5418531", "0.54042774", "0.5402469", "0.53939563", "0.53925234", "0.53906864", "0.5381646", "0.53744686", "0.53687924", "0.53680724", "0.53566766", "0.53533965", "0.5350876", "0.53501284", "0.5344012", "0.53343344", "0.5328849", "0.5325579", "0.53218734", "0.5321801", "0.53200644", "0.5318023", "0.53056383", "0.52937675", "0.5291309", "0.5283865", "0.52809936", "0.52809936", "0.52684444", "0.5262372", "0.5260775", "0.5245897", "0.524175", "0.52316695", "0.52316695", "0.52285165", "0.52203244", "0.52203137", "0.5218523", "0.5211234", "0.52079165", "0.51851255", "0.51823527", "0.5176075", "0.5171111", "0.51675767", "0.5166053" ]
0.0
-1
This can provide customized text to say
def greetings "Greetings. We come in peace." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def say text\n @output.say text\n end", "def say_that_thing_you_say\n \"#{self.name} always says: #{self.catchphrase}\"\n end", "def say_that_thing_you_say\n \"#{self.name} always says: #{self.catchphrase}\"\n end", "def say text\n @output.say text\n end", "def text(*)\n super\n end", "def display_text\n\t\t\t#specifying font to be used\n\t\t\t#text_font @font, 16\n\t\t\t#text \"Mmmmm ... Strings .... \", 10, 100\n\t\tend", "def say_that_thing_you_say\n \"#{self.name} always says: #{self.catchphrase}\"\n end", "def say_that_thing_you_say\n \"#{self.name} always says: #{self.catchphrase}\"\n end", "def info(text)\n puts \"#{text}\".foreground(:cyan)\n end", "def speak\n \"#{name} says Assalaam alaykum\"\n end", "def help_tip(text); \"\" end", "def speak\n \"#{@name} says Arf!!\"\n end", "def text text\n end", "def displayInfo(text)\n puts \"( - ) #{text}\"\n end", "def say(statement = '')\n ui.say statement\n end", "def speak \n \"#{self.name} says arf!\"\n end", "def speak\n \"#{self.name} says arf!\"\n end", "def speak\n \"#{@name} says Arf!\"\n end", "def say(*_args)\n end", "def say text = '', args = {}\n # defaults\n args = {\n :newline => true\n }.merge args\n\n # Justify options\n if args[:justify] && args[:padding]\n text = text.send args[:justify], args[:padding]\n end\n\n # Type options\n # process last due to the addition of special color codes\n text = case args[:type]\n when :fail\n text.colorize :red\n when :success\n text.colorize :green\n when :warn\n text.colorize :yellow\n else\n text\n end\n\n if args[:color]\n text = text.colorize(args[:color])\n end\n\n if args[:indent]\n text = (' ' * args[:indent]) + text\n end\n\n if args[:overwrite]\n STDOUT.flush\n text = text + \"\\r\"\n end\n\n if args[:progressbar] && Yuyi.verbose != true && Yuyi::Menu.menu && Yuyi::Menu.menu.progressbar\n Yuyi::Menu.menu.progressbar.log text\n elsif !args[:newline] || args[:overwrite]\n STDOUT.print text\n else\n STDOUT.puts text\n end\n end", "def say(text)\n @console.say(text)\n end", "def speak\n \"#{@name} says arf!\"\n end", "def speak\n \"#{@name} says arf!\"\n end", "def say(message)\n puts green(message) if self.verbose \n end", "def message\n t(\".message\")\n end", "def text\n # if the title is not present, show the code\n get_translation(self.text_translations, self.dataset.current_locale, self.dataset.default_language)\n end", "def say_notice(string)\n HighLine.new.say(\"\\n<%= color('#{string}', :notice ) %>\\n\")\n end", "def show_text(text, options={})\n add_actor Gamework::Text.new(text, options)\n end", "def say_that_thing_you_say\n \"#{self.name} always says: #{self.catchphrase}\"\nend", "def say_species \n \"I am a \" + \"#{@species}\" + \".\"\n end", "def say(*par)\n return unless self[:verbose]\n\n super(*par)\n end", "def text?; end", "def text?; end", "def text?; end", "def speak\n \"#{name} says arf!\"\n end", "def say something\n puts dude_format something\n end", "def says (opinion)\n puts \"#{name} says #{opinion}\"\n end", "def speak\n\t\tputs \"My name is #{@name}. I am a #{@colour} dog. I am #{@age} years old and live in #{@home}\"\n\tend", "def msg(type, text)\n case type\n when \"exit\"\n print(\"[\\033[31mEXIT\\033[0m] #{text}\\n\")\n when \"ok\"\n print(\"[\\033[32m OK \\033[0m] #{text}\\n\")\n when \"warn\"\n print(\"[\\033[33mWARN\\033[0m] #{text}\\n\")\n else\n print(\" #{text}\\n\")\n end\nend", "def speak\n \"#{name} says wuff!\"\n end", "def message_text\n user_option = user&.send(option_name(@option))\n\n user_option_text = if user_option\n \"_Current state:_ \" + user_option\n else\n 'This setting was not set for you yet.'\n end\n\n \"*#{option_button(@option)}*\\n#{user_option_text}\"\n end", "def speak\n \"#{name} says arf!\"\n end", "def print_message_text()\n @renderer.puts(\"Msg: #{@message_to_post.text_for_display}\")\n end", "def speak\n\t\tputs \"Meow. My name is #{@name.capitalize}.\"\n\t\tputs \"I am #{@age} years old and I live in #{@location}\"\n\t\tputs \"I am a #{@colour.downcase} #{@breed.downcase}.\"\n\tend", "def say(something)\n \"Say #{something}\"\n end", "def help_message()\n\t\treturn 'If you say (for example) \"help dance\", I\\'ll tell you what the dance command does.'\n\tend", "def text; end", "def text; end", "def text; end", "def text; end", "def text; end", "def text; end", "def text; end", "def text; end", "def text; end", "def text; end", "def text; end", "def text; end", "def text; end", "def text; end", "def formatted_text\n\t\tcase self.text\n\t\t\twhen \"space_created\"\n\t\t\t\treturn \"Space created, \\'#{self.reference.name}\\'\"\n\t\t\twhen \"discussion_created\"\n\t\t\t\treturn \"Discussion added, \\'#{self.reference.subject}\\'\"\n\t\t\twhen \"comment_created\"\n\t\t\t\treturn \"Comment added to \\'#{self.reference.discussion.subject}\\'\"\n\t\tend\n\tend", "def text\n self.title + \" -- \" + self.description\n end", "def speak\n \"#{name} says Arf!\"\n end", "def say_something(something)\n puts \"#{something}, said Becca\"\nend", "def qt_monkey_random_text \n return '\"generated: \" << (\"random\" * rand(5)) << ( \"text\" * rand(5))' \n end", "def speak\r\n \"#{name} say Arf!\"\r\n end", "def bold(*args); end", "def labelled_text(method, text, label_text = nil, label_options = {})\n %Q{#{label(method, \"#{label_text || method.to_s.titleize}\", label_options)} <div class=\"labelled\" id=\"#{object_name}_#{method}\">#{text}</div>}\n end", "def say(text, level = DEFAULT_LOG_LEVEL)\n puts text if @loud\n logger.add level, \"HARE: #{text}\"\n end", "def text _args\n \"text _args;\" \n end", "def text _args\n \"text _args;\" \n end", "def share_text_short\n \"I'm looking at #{self.latest_name.titleize} on Dinesafe.\"\n end", "def say_name\n \"My name is #{@name}\"\n end", "def say_species\n\t\t\"I am a #{self.species}.\"\n\tend", "def speak\n #\"#{@name} says arf!\"\n #\"#{name} says arf!\"\n \"#{self.name} says arf!\"\n end", "def message\n t(\".message\")\n end", "def message\n t(\".message\")\n end", "def speak\n \"#{@name} says arf!\"\nend", "def speak\n \"#{@name} says arf!\"\nend", "def speak\n \"#{@name} says arf!\"\nend", "def speak\n \"#{@name} says arf!\"\nend", "def speak\n \"#{@name} says arf!\"\nend", "def speak\n \"#{@name} says arf!\"\nend", "def show_info(message)\n say \"Information\", message, :cyan\n end", "def say_name\n puts \"#{name}\"\n end", "def description; @text; end", "def qt_monkey_random_text\n return '\"generated: \" << (\"random\" * rand(5)) << ( \"text\" * rand(5))'\n end", "def presented_by text\n \nend", "def say_species\n \"I am a #{self.species}.\"\n end", "def say_name\n p \"#{name}\"\n end", "def display_text\n return self.text unless self.text.blank?\n [wait_time ? \"#{wait_time} minute wait time\" : nil,\n rating ? \"rating #{rating}\" : nil,\n polling_place ? \"polling place: #{polling_place.name}\" : nil].compact.join(', ') \n end", "def display_text\n return self.text unless self.text.blank?\n [wait_time ? \"#{wait_time} minute wait time\" : nil,\n rating ? \"rating #{rating}\" : nil,\n polling_place ? \"polling place: #{polling_place.name}\" : nil].compact.join(', ') \n end", "def emphasis; end", "def create_first_text_message\n%(Today, I want to feel:\nPassionate\nEnergized\nConnected\nHopeful\nAligned\n)\n end", "def display_user_goodbye\n display_name = User[id_active_user].full_name\n goodbye_msg = \"It Was Very Nice Getting To Know You, Good Luck With All Your Future Endeavors And If We Cross Paths Again, We Will Be Very Pleased To Hear About Your Exploits, #{display_name}!\"\n puts \"\" \n puts \" -- #{ goodbye_msg } -- \".colorize(:color => :blue, :background => :white)\n puts \"\" \nend", "def warning text\n print_red(\"WARNING: #{text}\") \n end", "def warning text\n print_red(\"WARNING: #{text}\") \n end", "def say_name\n puts \"The hero's name is #{@name}\"\n end", "def show(msg)\n puts 'EXAMPLE<basic> ' + msg\nend", "def create_second_text_message(first_response)\n%(When I feel #{first_response}, I will also feel:\nCarefree\nPeaceful \nRelieved\nMellow\nRelaxed)\n end", "def say(msg, title = nil)\n unless title == nil\n puts title.center(62, '~')\n end\n puts \"=> #{msg}\".ljust(62)\nend" ]
[ "0.73506445", "0.7343326", "0.7308481", "0.7280095", "0.7208031", "0.71001935", "0.70144916", "0.70144916", "0.69812655", "0.6943222", "0.69161314", "0.6890564", "0.689022", "0.6850005", "0.68375355", "0.68166465", "0.67786485", "0.67753893", "0.6767282", "0.6765617", "0.6743792", "0.6706202", "0.6706202", "0.66781294", "0.66667366", "0.6652189", "0.6644913", "0.66329736", "0.66302276", "0.66065866", "0.66058844", "0.6581297", "0.6581297", "0.6581297", "0.6571694", "0.65668225", "0.6566296", "0.6565148", "0.6542833", "0.6541795", "0.65398", "0.6538165", "0.6535961", "0.65310735", "0.6530462", "0.6529987", "0.65227455", "0.65227455", "0.65227455", "0.65227455", "0.65227455", "0.65227455", "0.65227455", "0.65227455", "0.65227455", "0.65227455", "0.65227455", "0.65227455", "0.65227455", "0.65227455", "0.6521428", "0.651479", "0.65096617", "0.650035", "0.64917034", "0.64890736", "0.64830554", "0.6475273", "0.6471188", "0.6459643", "0.6459643", "0.64469576", "0.6444361", "0.64439887", "0.6431542", "0.6428134", "0.6428134", "0.6426735", "0.6426735", "0.6426735", "0.6426735", "0.6426735", "0.6426735", "0.6416704", "0.6414319", "0.64131427", "0.64109534", "0.6407875", "0.6399369", "0.6394568", "0.6390819", "0.6390819", "0.6387321", "0.63865215", "0.6386459", "0.6386298", "0.6386298", "0.6385356", "0.6380434", "0.63785416", "0.63780314" ]
0.0
-1
Suggested improvement support a custom mp3 file name
def growl "Please listen carefully to this recorded growl" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ext_to_mp3(filename)\n\t\tfilename_without_ext = filename.gsub(/[.]\\w+$/, \"\")\n\t\tfilename_without_ext + \".mp3\"\n\tend", "def get_filename(artist, song)\n \"#{ENCLOSURE_PATH}#{proper_filename(artist)}__#{proper_filename(song)}.mp3\"\n end", "def mp3_url\n @mp3_url ||= url_for_format('mp3')\n end", "def check_title\n if title.to_s == '' && audio_file.present?\n str = File.basename(audio_file_url).gsub(/[_]/, ' ') \n self.title = str.gsub(/[.mp3]/, '')\n self.save\n end\n end", "def build_audio_file_name(artist, record, segment, genre)\n # If we have a segment, find the intra-segment order. If segmented and isegorder is 0, then the track\n # is alone in its segment.\n track_pos = 0\n if record.segmented?\n track_pos = self.isegorder == 0 ? 1 : self.isegorder\n end\n # If we have a segment, prepend the title with the track position inside the segment\n title = track_pos == 0 ? self.stitle : track_pos.to_s+'. '+self.stitle\n\n # If we have a compilation, the main dir is the record title as opposite to the standard case\n # where it's the artist name\n if record.compile?\n dir = File.join(record.stitle.clean_path, artist.sname.clean_path)\n else\n dir = File.join(artist.sname.clean_path, record.stitle.clean_path)\n end\n\n fname = sprintf('%02d - %s', self.iorder, title.clean_path)\n dir += '/'+segment.stitle.clean_path unless segment.stitle.empty?\n\n return Cfg.music_dir+genre.sname+'/'+dir+'/'+fname\n end", "def xml_for_mp3 mp3\n m = /([^\\/]+\\/\\d{4}\\/\\d{2}\\/\\d{2}\\/\\d{4}\\s.*)\\.mp3$/.match mp3\n raise \"Ouch\" if m.nil?\n File.join 'stations', m[1] + \".xml\"\nend", "def set_filename_from_parent\n components = parent.filename.split('.')\n if components.size > 1\n ext = components.last\n name = components[0, components.size - 1].join('.')\n else\n ext = 'mp3'\n name = parent.filename\n end\n name = Digest::SHA1.hexdigest(\"KroogiFileDownload-#{id}-#{name}\")\n \n self.filename = \"#{name}.#{ext}\"\n end", "def search_file_name\n file_name = ''\n if @artist_id && @artist_id != 0\n artist_name = ARUtils.field( Artist , @artist_id , :name )\n file_name = artist_name if artist_name\n end\n if @album_id && @album_id != 0\n album_name = ARUtils.field( Album , @album_id , :name )\n file_name += ' - ' if ! file_name.empty?\n if album_name\n file_name += album_name\n end\n end\n file_name = 'songs' if file_name.empty?\n return ImagesModule.safe_file_name(file_name, true)\n end", "def build_audio_file_name\n return track.build_audio_file_name(segment_artist, record, segment, genre)\n end", "def rename_mp4_to_mp3\n\n file_path = attachment.path\n\n if (current_format = File.extname(self.attachment.path)) =~ /mp4/\n new_attachment_file_name = File.basename(self.attachment_file_name, File.extname(self.attachment_file_name)) + EXTNAME_FOR_RENAME\n file_path = File.join(File.dirname(self.attachment.path), File.basename(self.attachment.path, current_format)+EXTNAME_FOR_RENAME)\n\n FileUtils.mv(self.attachment.path, file_path)\n update_column(:attachment_file_name, new_attachment_file_name)\n end\n\n file_path\n end", "def create\n\n\n @mp3 = Mp3.new(mp3_params)\n\n uploaded_io = params[:mp3][:title]\n\n \n \n @mp3[:title] = uploaded_io.original_filename\n respond_to do |format|\n if @mp3.save\n\n \n File.open(Rails.root.join('app/assets', 'music', uploaded_io.original_filename), 'wb') do \n |file| file.write(uploaded_io.read)\n end\n\n #name = uploaded_io.original_filename\n # directory = \"app/assets/music\"\n # create the file path\n # path = File.join(directory, name)\n # write the file\n # File.open(path, \"wb\") { |f| f.write(upload['datafile'].read) }\n #\n \n\n\n format.html { redirect_to @mp3, notice: 'Mp3 was successfully created. '}\n format.json { render action: 'show', status: :created, location: @mp3 }\n else\n format.html { render action: 'new' }\n format.json { render json: @mp3.errors, status: :unprocessable_entity }\n end\n end\n end", "def songs\n<<<<<<< HEAD\n file=\"#{Rails.root}/public/#{params[:user_id]}/#{params[:file]}.#{params[:ext]}\"\n if File.exists?(file)\n send_file(\n file,\n filename: \"#{params[:file_name]}\",\n type: \"application/mp3\"\n )\n else\n render nothing: true\n end\n=======\n send_file(\n \"#{Rails.root}/public/#{params[:user_id]}/#{params[:file]}.#{params[:ext]}\",\n filename: \"#{params[:file_name]}\",\n type: \"application/mp3\"\n )\n>>>>>>> b71dc3f177d170c9fc8bde7924fd28f948e88acc\n end", "def set_title \n write_attribute(:title, File.basename(file_name, '.mp4')) if title.blank?\n end", "def mp3?\n File.extname(@path).downcase.eql?('.mp3')\n end", "def get_filename_regex\n return AUDIO_FILENAME_REGEX\n end", "def determine_new_dir_name(path, quality)\n if path.include? 'FLAC'\n return path.gsub 'FLAC', \"MP3 #{quality}\"\n elsif path.include? 'flac'\n return path.gsub 'flac', \"MP3 #{quality}\"\n else\n return path.gsub /\\/$/, \" [MP3 #{quality}]/\"\n end\n end", "def create_full_filename(tv, q, f)\n ext = helper_make_ext(q,f)\n title = tv['track']['title'].dup\n title.gsub!(/'|\"/, ' ')\n title.gsub!(/[^A-Za-z0-9_ \\-]/, '_')\n title.gsub!(/ /, '')\n prefix = \"#{tv['track_key']} #{title}\"\n # We cut this off at 27 characters, basically trying to keep aif name\n # under 32 characters long.\n prefix.slice!(27..10000) if prefix.length > 27\n \"#{prefix}.#{ext}\"\n end", "def fq_bundle_sample_prompt\n \"public/upload/audio/\" + bundle_resouce_file_name + \".mp3\"\n end", "def give_metadata(name, folder_name, url)\n album_parts = name.split(\" _ALBUM_ \")\n single_parts = name.split(\" _SINGLE_ \")\n album_parts, single_parts = [album_parts, single_parts].map do |parts_set|\n (parts_set.length < 2) ? nil : parts_set\n end\n artist, album = album_parts || single_parts\n Dir.glob(\"./audio/#{folder_name}/**/*.mp3\").each do |path|\n Mp3Info.open(path) do |mp3|\n mp3.tag.artist = artist\n mp3.tag.album = \"#{album_parts ? \"ALBUM\" : \"SINGLE\"} #{album}\"\n end\n end\n end", "def create_music(varname, filename)\n @music.add_music(varname, filename)\n end", "def audio\n @audio ||= URI.parse(\"#{AUDIO_SERVICE_URL}/#{@language.slug}/#{URI::encode(@text)}.mp3\")\n end", "def filename\n \"#{secure_token}.mp4\" if original_filename.present?\n end", "def video_download_filename(record)\n name = record.patient.fullname(:dashed)[0..50]\n time = record.created_at.to_s(:number)\n\n if record.video_file_name\n\n ext = record.video_file_name[/\\.([^\\.]+)$/]\n\n else\n\n ext = record.video_s3_file_name[/\\.([^\\.]+)$/]\n\n end\n\n \"#{name}_#{time}#{ext}\"\n end", "def asset_name\n 'Playlist'\n end", "def convert_to_mp3(file, file_dir)\n return if file_dir.include?(file)\n\n binding.pry\n file_name = file.split('.').first\n command = \"-i #{ file } -acodec libmp3lame #{ file_name }.mp3\"\n\n ffmpeg(command)\nend", "def filename_from_url(mp3_url)\n File.basename(URI.parse(mp3_url).path)\n end", "def is_mp3?\n if filename != nil\n filename.ends_with?('.mp3')\n else\n false\n end\nend", "def generate_name\n self.name = \"#{album.name}-#{self.image_file_file_name}\"\n end", "def files # loads all the mp3 files in the path directory / normalizes the filename to just the mp3 filename with no path\n @files ||= Dir.glob(\"#{path}/*.mp3\").collect{ |f| f.gsub(\"#{path}/\", \"\") } # then using the .collect method and gsub to just return the filename with out path\n end", "def file_listing_html_string(file_path, file_name)\n \"<audio controls>\" +\n \"<source inert-src='#{file_path}' type='audio/mpeg'>\" +\n \"</audio>\" +\n \"<a class='download'\" +\n \"href='#{file_path}'\" +\n \"download='#{file_name}'\" +\n \">download</a>\"\n end", "def get_media_filename\n \"#{@uuid}.#{get_thumbnail_extension}\"\n end", "def create_short_filename(tv, q, f)\n ext = helper_make_ext(q,f)\n \"#{tv['track_key']}.#{ext}\"\n end", "def filename\r\n \"#{model.user_id.to_s}_#{model.id.to_s}.mov\" if original_filename\r\n end", "def file_name\n case variant\n when :sample\n \"sample-#{md5}.#{file_ext}\"\n else\n \"#{md5}.#{file_ext}\"\n end\n end", "def text_to_flash_player(text, opts = {})\n bgcolor = opts[:bgcolor] if opts[:bgcolor]\n width = opts[:width] if opts[:width]\n height = opts[:height] if opts[:height]\n\n filename = Digest::MD5.hexdigest(text).to_s + \".mp3\"\n \n text.to_mp3(MP3_FOLDER_PATH + \"/\" + filename) unless File.exists?(MP3_FOLDER_PATH + \"/\" + filename) \n html_for_mp3_flash(MP3_FOLDER_URL + \"/\" + filename)\nend", "def filename_token(options = {})\n \"noaudio\" if options[:audio].eql?(false)\n end", "def mp3=(file_data)\n @file_data = file_data\n end", "def created_mp3s(splitter = @splitter)\n Dir.glob(\"#{splitter.output_folder}/*.mp3\").map { |f| File.basename f }\nend", "def set_new_filename\n if @video\n update_attribute(:filename, \"#{filename}.#{id}.flv\")\n update_attribute(:content_type, \"application/x-flash-video\")\n else\n update_attribute(:filename, \"#{filename}.#{id}.mp3\")\n update_attribute(:content_type, \"application/x-flash-audio\")\n end \n end", "def filename\n filename = (model.name + '_' + model.artist.name + '_' + model.release.name).downcase.gsub(/\\s/, '-')\n \"#{filename}\" if original_filename \n end", "def public_path(folder_name, file_name)\n \"./audio/#{folder_name}/#{file_name}\"\n end", "def change_file_metadata(song)\n Mp3Info.open(song[:path]) do |mp3|\n #song.dance=params['genre']\n mp3.tag2.TCON=song.dance\n #song.title=params['title']\n mp3.tag.title=song.title\n #song.artist=params['artist']\n mp3.tag.artist=song.artist\n #song.rating=params['rating'].to_i\n mp3.tag2.POPM=song.rating\n #song.save\n end\nend", "def path_to_audio(source, options = T.unsafe(nil)); end", "def audio_path(source, options = T.unsafe(nil)); end", "def clean_mp4_name(file)\n regex = /(.mkv)$/\n 'converted_' + file.gsub(regex, '') + '.mp4'\n end", "def downloaded_video_path\n \"/songs/#{self.id}.mpg\"\n end", "def to_mp3(filename, params={})\n text = params[:text] || self\n raise \"to_mp3 language option still not implemented\" if params[:language]\n #system(\"echo \\\"#{text.to_s}\\\" | text2wave | lame --alt-preset cbr 16 -a --resample 11 --lowpass 5 --athtype 2 -X3 - > #{filename} 2> /dev/null\")\n system(\"echo \\\"#{text.to_s}\\\" | text2wave -eval \\\"(voice_nitech_us_slt_arctic_hts)\\\" | lame --alt-preset cbr 16 -a --resample 11 --lowpass 5 -X3 - > #{filename} 2> /dev/null\")\n end", "def show\n @song = Song.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @song }\n format.mp3 {\n file = File.read(@song.location)\n send_data(file, :type => \"audio/mpeg\", :filename => \"#{@song.id}.mp3\", :disposition => \"inline\")\n }\n end\n end", "def files\n @files ||= Dir.glob(\"#{path}/*.mp3\").collect{|file|\n#normalize the filename to just the MP3 filename with no path\n file.gsub(\"#{path}/\", \"\")}\n end", "def files\n filename = Dir.glob(\"#{path}/*.mp3\")\n filename = filename.collect{|a_string| a_string.sub(\"#{path}/\", \"\")}\n end", "def fix_files\n Dir.glob(\"./audio/**/*.mp3\").each do |path|\n file_name = file_name_from_path(path)\n proper_file_name = file_name.gsub(/[^a-zA-Z1-9\\_\\.]/) { |char| \"_\" }\n unless file_name == proper_file_name\n `mv \"#{path}\" #{path.gsub(file_name, proper_file_name)}`\n end\n end\n end", "def quick_title(song)\n File.basename(song, File.extname(song)).gsub(/^[^A-Za-z]+\\s+(\\w)/, \"\\\\1\")\n end", "def file_name\n \"#{@file_name}.#{extension}\"\n end", "def rendered_name\n result = filename\n result = caption if !caption.blank?\n result\nend", "def name() @filename end", "def codec\n \"-acodec libmp3lame -y\"\n end", "def set_new_filename\n\t\t\tupdate_attribute(:video_file_name_mobile, \"#{self.video_file_name}.mp4\")\n\t\t\tupdate_attribute(:video_file_name, \"#{self.video_file_name}.flv\")\n\t\t\tupdate_attribute(:video_content_type, \"application/x-flash-video\")\n\t\tend", "def play\n path=\"\"\n @song = Song.where(:id=>params[:id]).first\n @audio = @song.audio\n @audio_path = @audio.id.to_s+\".mp3\"\n @audioimage_path = audioimagepath(@audio)\n respond_to do |format|\n format.html\n format.js\n end\n end", "def audio_path(source)\n compute_public_path(source, 'audios')\n end", "def build_filename(filename, item)\n repeat_groups = []\n answer = item.record.answer\n answer_group = nil\n answer_group = next_repeat_group_up(answer.parent_id) if answer.parent_id\n if answer_group.present?\n repeat_groups = respect_ancestors(answer_group, repeat_groups)\n filename += \"-#{repeat_groups.pop}\" until repeat_groups.empty?\n end\n filename += \"-#{answer.question.code}\"\n filename += File.extname(item.filename.to_s)\n filename.gsub(/[^0-9A-Za-z.\\-]/, \"_\")\n end", "def display_name\n @display_name ||= if audio? && metadata?\n artist, title = metadata.values_at('artist', 'title')\n title.present? ? [title, artist].compact.join(' - ').force_encoding('UTF-8') : attachment_file_name\n else\n attachment_file_name\n end\n end", "def file_for_month(month)\n sound_path(\"mon-#{month.to_i - 1}.ul\")\n end", "def convert_to_mp3\n\t\tputs \"\\n=> look for m4a files and convert it to mp3\\n\"\n\t\t\n\t\t# grab directory names.\n\t\tdir_names = Dir.entries @@dir_temp\n\t\t# remove .prefixes\n\t\tdir_names = self.remove_hidden_files dir_names\n\t\t\n\t\t# go thru each sub directories.\n\t\tdir_names.each do |current_dir|\n\t\t\tputs \"\\n=> at \" + @@dir_temp + current_dir + \"\\n\"\n\t\t\t\n\t\t\t# grabs the files in the directory\n\t\t\tcurrent_files = Dir.entries(@@dir_temp + \"/\" + current_dir)\n\t\t\t\n\t\t\t# remove the . prefixes.\n\t\t\tcurrent_files = self.remove_hidden_files current_files\n\t\t\t\n\t\t\t# cycle thru the file\n\t\t\tcurrent_files.each do |current_file|\n\t\t\t\t# file names\n\t\t\t\tsrc_file = \"\"\n\t\t\t\tdest_file = \"\"\n\t\t\t\n\t\t\t\t# checks if it has a m4a extension\n\t\t\t\tif self.is_m4a? current_file\t\t\n\t\t\t\t\tputs \"\\n=> encoding \" + current_file\n\t\t\t\t\t\n\t\t\t\t\t# creating src and dest files.\n\t\t\t\t\tsrc_file = @@dir_temp + current_dir + '/' + current_file\n\t\t\t\t\tdest_file = @@dir_temp + current_dir + '/' + self.ext_to_mp3(current_file)\n\t\t\t\t\t\n\t\t\t\t\t#src_file = \"'\" + src_file + \"'\" \n\t\t\t\t\t#dest_file = \"'\" + dest_file + \"'\" \n\t\t\t\t\t\n\t\t\t\t\t# escape the names.\n\t\t\t\t\tsrc_file = self.escaped_file_name(src_file)\n\t\t\t\t\tdest_file = self.escaped_file_name(dest_file)\n\t\t\t\t\t\n\t\t\t\t\tputs \"=> src \" + src_file \n\t\t\t\t\tputs \"=> dest \" + dest_file\n\t\t\t\t\t\n\t\t\t\t\t# lame encoding.\n\t\t\t\t\tself.lame_str(@@opt_lame, src_file, dest_file)\n\t\t\t\telse\n\t\t\t\t\tdest_file = @@dir_temp + current_dir + '/' + current_file\n\t\t\t\t\tdest_file = self.escaped_file_name(dest_file)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# split the mp3...\n\t\t\t\tself.mp3splt_str(@@opt_mp3splt, dest_file)\n\t\t\t\t\n\t\t\t\t# delete the source file.\n\t\t\t\t# only want the split files.\n\t\t\t\tself.rm_str(\"\", dest_file)\n\t\t\t\tif (src_file != \"\")\n\t\t\t\t\tself.rm_str(\"\", src_file)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def get_128kbps_mp3_url(html_doc)\r\n\t\t\tlinks = html_doc.css('a')\r\n\t\t\tmp3_urls = links.map {|link| (link.attribute('href').to_s.include? \".mp3\") ? link.attribute('href').to_s : \"\"}.delete_if{|href| href.empty?}\r\n\t\t\tmp3_urls.last\r\n\t\tend", "def files\n files = Dir[\"#{path}/*.mp3\"].each {|file_name| next if File.directory? file_name}\n files.each {|filename| filename.gsub!(/\\A(.....................)/, \"\")}\n files\n end", "def extract_audio_details\n path = audio.queued_for_write[:original].path\n open_opts = { :encoding => 'utf-8' }\n Mp3Info.open(path, open_opts) do |mp3|\n\t self.title = mp3.tag.title \n\t self.album = mp3.tag.album\n\t self.artist = mp3.tag.artist\n\t self.track = mp3.tag.tracknum\n end\nend", "def audio_file_field(field, options={})\n options.reverse_merge!(:id => field_id(field))\n options.merge!(:class => field_error(field, options))\n html = ''\n html += @template.file_field_tag field_name(field), options\n if object.send(field).url\n html += \"<span class='audio_file_field_name'>File: #{object.send(field).url}</span>\"\n end\n html\n end", "def set_new_filename\n update_attribute(:filename, \"#{filename}.#{id}.flv\")\n update_attribute(:content_type, \"video/x-flv\")\n end", "def getFiletype filename\n extension = filename.split(\".\")[1]\n case extension\n when \"wav\" then\t\"audio/wav\"\n when \"amr\" then\t\"audio/amr\"\n when \"amr-wb\" then \"audio/amr-wb\"\n when \"x-speex\" then \"audio/x-speex\"\n when \"spx\" then\t\"audio/x-speex\"\n else \n end\n end", "def format_song_name(song_name)\n if(song_name.length > 48)\n return \"\\\"\" + song_name[0 .. 44] + \"...\\\"\"\n else\n return \"\\\"\" + song_name + \"\\\"\"\n end\n end", "def music_file(file)\n ext_list = $config[\"music_file\"][\"media_extentions\"].gsub(/,/,\"|\")\n \n ext = \".*\\.(#{ext_list})$\" \n name = \"\"\n\n $config['music_file']['regex'].each do |pattern|\n if file =~ /.*#{pattern}#{ext}/i\n name = $1 if $1\n return false if name =~ /^sample/i\n return true\n end\n end\n return false\nend", "def path_is_unique\n return true if self.mp3.file.blank?\n\n # Guess what the audio path will be before it's actually saved there.\n # This is predictable for uploaded audio.\n # This could potentially fail if someone was uploading audio at exactly\n # midnight and some audio already existed for the next day.\n path = File.join(\n AUDIO_PATH_ROOT,\n self.store_dir,\n self.filename\n )\n\n if File.exist?(path)\n self.errors.add(:mp3, \"A file with that name already exists; \" \\\n \"please rename your local audio file and try again. \" \\\n \"If you are trying to replace the audio file, first delete the \" \\\n \"old audio.\")\n end\n end", "def generate_file_name\n file_name = attachment.instance_read(:file_name).slugged_filename\n attachment.instance_write :file_name, file_name\n end", "def set_name\n self.name = self.asset.original_filename\n end", "def filename(record, file)\n original = \"#{file.basename}.#{file.extension}\"\n write_attribute(:original_filename, original)\n ext = file.suffix.nil? || file.suffix == :original ? file.extension : file.suffix\n \"#{application_for_offering.id.to_s}-#{title.gsub(/[\\s,\\.\\\\\\/\\*\\?\\%\\:\\|\\\"\\'\\<\\>]?/,'')}.#{ext}\"\n end", "def audio_path\n #TODO change path after Yura send information\n \"/audio/success.wav\"\n end", "def create\n @backend = Backend.new(backend_params)\n\n uploaded_io = params[:backend][:mp3file]\n\n @backend[:mp3file] = uploaded_io.original_filename\n\n respond_to do |format|\n if @backend.save\n\n File.open(Rails.root.join('app/assets', 'music', uploaded_io.original_filename), 'wb') do \n |file| file.write(uploaded_io.read)\n end\n\n format.html { redirect_to @backend, notice: 'Backend was successfully created.' }\n format.json { render action: 'show', status: :created, location: @backend }\n else\n format.html { render action: 'new' }\n format.json { render json: @backend.errors, status: :unprocessable_entity }\n end\n end\n end", "def filename\n local?? swf_url : tmp_file.path\n end", "def files\n Dir.glob(self.path + '**/*.mp3').collect {|file| File.basename(file)}\n end", "def rename_artist(a)\n\t\t\n\t\tfor d in @files \n\t\t\t\n\t\t\tDir.new(d).each do |f| \n\t\t\n\t\t\t\tif is_mp3(f)\n\t\t\n\t\t\t\t\tmp3file = d+f\n\t\t\n\t\t\t\t\tputs \"#{mp3file} - re-tag artist as #{a}\"\n\t\t\t\t\t\t\t \t\n\t\t\t\t\ttag = ID3Lib::Tag.new(mp3file)\n\t\t\n\t\t\t\t\ttag_artist(tag, a)\n\t\t\t\t\t\n\t\t\t\t\tputs \"...\"\n\t\t\t\tend\t\t\n\t\t\t\t\n\t\t\tend\n\t\tend \n\tend", "def file_name_for(*args)\n \"%s.%s\" % [args.compact.join(self.class.thumbnail_separator), extension]\n end", "def random_song\n @mode = :dj\n \n wd = Dir.pwd\n Dir.chdir music_folder\n songs = Dir.glob(\"**/*.{mp3,ogg}\")\n path = songs[rand(songs.size)]\n Dir.chdir wd\n \n if path.blank?\n nil\n else\n [0, path, quick_title(path)]\n end\n end", "def file_name(name)\n name.to_s.gsub(/-/, \"_\").underscore\n end", "def art_file\n \"#{Digest::SHA1.hexdigest(\"#{artist_name}/#{album_name}\")}.png\"\n end", "def update_ID3(attributes)\n begin\n musicFile = TagLib::File.new(self.filePath())\n musicFile.title = attributes[:id3Title]\n musicFile.artist = attributes[:id3Artist]\n musicFile.save()\n rescue TagLib::BadFile => exc\n logger.error(\"Failed to id track: \\n #{exc}\")\n end \n end", "def file_for_day(day)\n sound_path(\"day-#{day}.ul\")\n end", "def s3_name(file)\n File.join(@params[:prefix], \n file.sub(/\\A#{@directory}/, '')).sub(/\\A\\//,'')\n end", "def set_file_name\n update(name: (file.filename rescue \"Untitled File\"))\n end", "def set_file_name\n update(name: (file.filename rescue \"Untitled File\"))\n end", "def filename\n \"mp-#{make_stamp}-1024.jpg\" if original_filename\n end", "def nameSound _args\n \"nameSound _args;\" \n end", "def file_name\n name.underscore\n end", "def file name\n \n end", "def video\n \"#{self.video_file_name}\"\n end", "def show\n path=\"\"\n @song = Song.where(:id=>params[:id]).first\n @user = @song.user\n @audio = @song.audio\n @audio_path = @audio.id.to_s+\".mp3\"\n @audioimage_path = audioimagepath(@audio)\n respond_to do |format|\n format.html\n format.js\n end\n end", "def files\n Dir.glob(\"#{path}/*.mp3\").collect {|file| file.gsub(\"#{path}/\",\"\")}\n end", "def full_path\n if path[0] == '/'\n path\n else\n File.join(Play.music_path,path)\n end\n end", "def to_mp3\n temp = Tempfile.new(File.basename(filename, '.flv') + \".mp3\")\n \n begin\n transcoder = Transcoder.new(full_filename, temp.path)\n transcoder.flashToAudio\n save_transcoder_commands(transcoder)\n rescue RVideo::TranscoderError => e\n save_transcoder_commands(transcoder)\n raise AudioConversionException.new(\"Unable to convert recording to audio: #{e.message}\")\n end\n \n temp.path\n end", "def safe_filename(info = @info)\n [track_fnum(info),\n artist_fname(info),\n track_fname(info),\n file_suffix(info)].join('.')\n end", "def mobi_filename(options={})\n options[:preview] ? manifest.filename + '-preview' : manifest.filename\n end", "def file_name\n potential_name = params[:filename] || file.original_name || (asset.respond_to?(:label) && asset.label) || file.id\n potential_name = potential_name.gsub(/[,;]/, '')\n potential_extension = ''\n if file.mime_type == 'image/png'\n potential_extension = '.png'\n elsif file.mime_type == 'image/tiff'\n potential_extension = '.png'\n elsif file.mime_type == 'image/jpeg' || file.mime_type == 'image/jpg'\n potential_extension = '.jpg'\n end\n return potential_name\n #return potential_name + potential_extension\n end" ]
[ "0.73971087", "0.70001215", "0.69900435", "0.69826937", "0.69017667", "0.6882844", "0.6768857", "0.67635435", "0.67413765", "0.6636585", "0.6566715", "0.6546137", "0.6541163", "0.65353173", "0.6534353", "0.6527951", "0.6521666", "0.64774466", "0.6408952", "0.6397662", "0.63632077", "0.6332068", "0.63174874", "0.63171923", "0.6314057", "0.6309683", "0.63096654", "0.63065434", "0.62833655", "0.62772864", "0.627453", "0.62660205", "0.62574303", "0.6242787", "0.62391615", "0.6237527", "0.62221295", "0.62203413", "0.6219785", "0.6218067", "0.62179047", "0.6205867", "0.61951345", "0.61583805", "0.6143744", "0.6136895", "0.6114903", "0.611117", "0.6105865", "0.6104567", "0.6098605", "0.6073606", "0.60552394", "0.6055194", "0.60427696", "0.6017193", "0.60076356", "0.5986438", "0.59823704", "0.5972395", "0.5953014", "0.5936114", "0.59302133", "0.5930191", "0.59271723", "0.5920778", "0.5920669", "0.59203714", "0.589952", "0.5896614", "0.58944327", "0.5878004", "0.5877901", "0.58770394", "0.58751667", "0.58579576", "0.585448", "0.58528894", "0.58469194", "0.5845261", "0.58401513", "0.58401436", "0.58392626", "0.5837791", "0.5836522", "0.58315015", "0.58299834", "0.58262515", "0.58262515", "0.5826096", "0.5812532", "0.58092624", "0.5803175", "0.57918996", "0.5783935", "0.57829297", "0.5779436", "0.5771954", "0.57701224", "0.57660854", "0.57658786" ]
0.0
-1
These are generated method for the interaction object, which are used by the view builder to create the XML response.
def says self.current_state.sayings.map do |phrase| if phrase.is_a?(String) phrase.match(/^ivr/) ? I18n.t(phrase) : phrase elsif phrase.is_a?(Symbol) self.send(phrase) end end.flatten || [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @interaction = Interaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @interaction.to_xml }\n end\n end", "def inspect\n values = @properties.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.FlexApi.V1.InteractionInstance #{values}>\"\n end", "def respond\n end", "def show\n @interaction = Interaction.find(params[:id])\n @opportunity = @interaction.opportunity\n @account = @opportunity.account\n @notes = @interaction.notes\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @interaction }\n end\n end", "def render_xml\n end", "def to_s\n '<Twilio.FlexApi.V1.InteractionPage>'\n end", "def inspect\n context = @solution.map{|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.FlexApi.V1.InteractionContext #{context}>\"\n end", "def set_interaction\n @interaction = Interaction.find(params[:id])\n end", "def set_interaction\n @interaction = Interaction.find(params[:id])\n end", "def set_interaction\n @interaction = Interaction.find(params[:id])\n end", "def to_s\n values = @params.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.FlexApi.V1.InteractionInstance #{values}>\"\n end", "def result\n render_xml\n end", "def to_xml\n response\n end", "def generate_response_xml\n builder = Builder::XmlMarkup.new\n builder.instruct!\n\n builder.imsx_POXEnvelopeResponse(\"xmlns\" => \"http://www.imsglobal.org/services/ltiv1p1/xsd/imsoms_v1p0\") do |env|\n env.imsx_POXHeader do |header|\n header.imsx_POXResponseHeaderInfo do |info|\n info.imsx_version \"V1.0\"\n info.imsx_messageIdentifier @message_identifier || IMS::LTI::generate_identifier\n info.imsx_statusInfo do |status|\n status.imsx_codeMajor @code_major\n status.imsx_severity @severity\n status.imsx_description @description\n status.imsx_messageRefIdentifier @message_ref_identifier\n status.imsx_operationRefIdentifier @operation\n end\n end\n end #/header\n env.imsx_POXBody do |body|\n unless unsupported?\n if @operation == OutcomeRequest::READ_REQUEST\n body.tag!(@operation + 'Response') do |request|\n request.result do |res|\n res.resultScore do |res_score|\n res_score.language \"en\" # 'en' represents the format of the number\n res_score.textString @score.to_s\n end\n end #/result\n end\n else\n body.tag!(@operation + 'Response')\n end #/operationResponse\n end\n end #/body\n end\n end", "def to_xml(*args)\n super\n end", "def show\n @interaction = Interaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interaction }\n end\n end", "def to_s\n '#<Twilio.FlexApi.V1.InteractionList>'\n end", "def new\n @opportunity = Opportunity.find(params[:opportunity_id])\n @account = @opportunity.account\n @interaction = Interaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @interaction }\n end\n end", "def interactions \n normal_interactions << default_interaction\n end", "def respond(); end", "def to_xml\n render_xml\n end", "def to_json\n { note: \"in an actual implementation of SelfDocumentingView, this method\n would call each v_<name>__<type> method and include its output\n in the response as a (<name>: <value>) pair\"\n }\n end", "def create\n @interaction = Interaction.new(params[:interaction])\n\n respond_to do |format|\n if @interaction.save\n flash[:notice] = 'Interaction was successfully created.'\n format.html { redirect_to interaction_url(@interaction) }\n format.xml { head :created, :location => interaction_url(@interaction) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @interaction.errors.to_xml }\n end\n end\n end", "def classed_interaction(type=\"Custom\", opts = {})\n\t\t\t\turl = \"api/v2/interactions\"\n\t\t\t\tvalidator = \"Playapi::Validation::#{type.split('_').map {|w| w.capitalize}.join}\".split(\"::\").inject(Module) {|acc, val| acc.const_get(val)}\n\t\t\t\tvalidator.validate(opts)\n\t\t\t\tget_object(:post, \"interaction\", url, {:interaction => opts, :type => type})\n\t\t\tend", "def xml; end", "def initialize response, xml_options = {}\n super(response, xml_options)\n end", "def generate_html_and_build_response!\n controller = self.class_to_model_name\n response_body = Poseidon::View.new.render(controller, meth, self)\n response.merge!(body: response_body)\n return response\n end", "def response\n self\n end", "def to_s\n context = @solution.map{|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.FlexApi.V1.InteractionContext #{context}>\"\n end", "def actions2\n return NewServiceRequestEntity.new_request_what_dialog_actions(self)\n end", "def response\n\t\t@response\n\tend", "def index\n @interaction_type_options = Interaction.uniq.pluck(:resource_type)\n @fields = FIELD_DESCS_JSON\n end", "def to_xml\n\t\tend", "def to_xml\n\t\tend", "def show\n \n@clicker = Clicker.find(params[:id])\n\n \nrespond_to do |format|\n \nformat.html # show.html.erb\n \nformat.xml { render :xml => @clicker+\"yyyyy\" }\n \n end\n \nend", "def render\n # To be implemented.\n end", "def actions\n return NewServiceRequestEntity.new_request_what_dialog_actions(self)\n end", "def rpc_response(value)\n render inline: \"xml.instruct! :xml, :version=>'1.0' \\n xml.methodResponse { xml.params { xml.param { #{value} }}}\", type: :builder, content_type: \"text/xml\"\n end", "def create_interaction\n # conversation = Conversation.get_conversation_for(self.operator_id, self.user_id).first\n # if conversation.nil?\n conversation = Conversation.new(:messages_attributes => { \"0\" => { \"body\" => self.request_note, :subject => self.title}})\n # else\n # conversation.messages << Message.new(:subject => self.title, :body => self.request_note)\n # end\n conversation.messages.last.sender = User.find(self.operator_id)\n conversation.messages.last.recipient = User.find(self.user_id)\n if conversation.save\n Interaction.create(:concierge_request_id => self.id, :interactable_id => conversation.messages.last.id, :interactable_type => 'Message', :conversation_id => conversation.id)\n self.submit!(self.user_id)\n self.on_reply!\n end\n end", "def update\n respond_to do |format|\n if @interaction.update(interaction_params)\n format.html { redirect_to @interaction, notice: 'Interaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @interaction }\n else\n format.html { render :edit }\n format.json { render json: @interaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def render\n end", "def xml?; end", "def xml?; end", "def response\n @_response\n end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def update\n @interaction = Interaction.find(params[:id])\n\n respond_to do |format|\n if @interaction.update_attributes(params[:interaction])\n flash[:notice] = 'Interaction was successfully updated.'\n format.html { redirect_to interaction_url(@interaction) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @interaction.errors.to_xml }\n end\n end\n end", "def create\n\n #render :text=>params\n #return\n\n @interaction = Interaction.new(params[:interaction])\n respond_to do |format|\n if @interaction.save!\n if !params[\"prev_interaction_id\"].nil?\n @prev_interaction=Interaction.find(params[\"prev_interaction_id\"])\n @prev_interaction.taskings.each do |tasking|\n tasking.active=false\n tasking.save!\n end\n @interaction.name=params[:interaction][:name]+\"\\n\"+@prev_interaction.name\n @prev_interaction.name=params[\"prev_comment\"]+\"\\n\"+@prev_interaction.name\n @prev_interaction.save!\n end\n logger.debug params\n logger.debug @interaction.interaction_contacts\n format.html { redirect_to :back, notice: 'Interaction was successfully created.' }\n else\n format.html { render :back, notice: 'Interaction could not be created.' }\n end\n end\n end", "def create_interaction_response(interaction_token, interaction_id, type, content = nil, tts = nil, embeds = nil, allowed_mentions = nil, flags = nil, components = nil)\n data = { tts: tts, content: content, embeds: embeds, allowed_mentions: allowed_mentions, flags: flags, components: components }.compact\n\n Discordrb::API.request(\n :interactions_iid_token_callback,\n interaction_id,\n :post,\n \"#{Discordrb::API.api_base}/interactions/#{interaction_id}/#{interaction_token}/callback\",\n { type: type, data: data }.to_json,\n content_type: :json\n )\n end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response; end", "def response\r\n @response\r\n end", "def build_result(action)\n xml = ''\n doc = Builder::XmlMarkup.new(:target => xml)\n doc.tag!(\"#{action}Response\", :xmlns => \"http://sdb.amazonaws.com/doc/2007-11-07\") do\n if block_given?\n yield doc\n end\n \n doc.ResponseMetadata do\n doc.RequestId \"1234\"\n doc.BoxUsage \"0\"\n end\n end\n \n xml\n end", "def raw_inputs\n @_interaction_inputs\n end", "def response\n @response\n end", "def response\n self.textual_response\n end", "def api_response\n response api_html(to_markup)\n end", "def expand(*args)\n\t\t\t#\tjust the default value, not the Response\n\t\t\t(super *args).to_s\n\t\tend", "def render(xm=Builder::XmlMarkup.new(:indent => 2))\n [:name, :visibility, :address].each do |a|\n xm.__send__(a, self.__send__(a)) unless self.__send__(a).nil?\n end\n \n xm.description { xm.cdata!(description) } unless description.nil?\n xm.open(self.open) unless open.nil?\n \n xm.phoneNumber(phone_number) unless phone_number.nil?\n xm.styleUrl(style_url) unless style_url.nil?\n \n unless address_details.nil?\n xm.AddressDetails(:xmlns => \"urn:oasis:names:tc:ciq:xsdschema:xAL:2.0\") { address_details.render(xm) } \n end\n \n xm.Snippet(snippet.text, snippet.max_lines) unless snippet.nil?\n \n xm.LookAt { look_at.render(xm) } unless look_at.nil?\n xm.TimePrimitive { time_primitive.render(xm) } unless time_primitive.nil?\n xm.StyleSelector { style_selector.render(xm) } unless style_selector.nil?\n end", "def activity_complements\n\n context.render_entity_aspects(activity, :activity)\n\n end", "def xf_hidden_field (object_name, method)\n addRefAttribute(object_name, method, {})\n addSiItem(object_name, method, {})\n return \"\"\n end", "def create_iview_xml(arg = nil)\n\t arg ||= self\n\t # check what we've been given before proceeding\n\t case arg\n\t when Component\n\t @component = arg\n\t when Fixnum\n\t @component = Component.find(arg)\n\t else raise ArgumentError \"#{__method__} expects a Component or Component.id as first argument!\"\n\t end\n\t @guide = nil\n\t # build guide from top-level component\n\t if @component.respond_to?(:ancestor_ids)\n\t then @guide = @component.root\n else raise ArgumentError, \"Component #{@component.id} must respond to :ancestor_ids\"\n end\n raise ArgumentError, \"\" unless @guide.is_a?(Component)\n\t # load a template xml file, containing only <Catalog> and 1 child <MediaItemList> with sample JPEG\n\t @template = <<-EOXML\n\t <?expression media exportversion=\"1.0\" appversion=\"1.0\"?>\n\t <CatalogType>\n\t <Catalog pathType=\"MAC\">EAD__Catalog</Catalog>\n\t <MediaItemList><!-- *** DELETE THE MediaItem ELEMENT FOR doNotTouch.jpg! *** --><MediaItem>\n\t <AssetProperties>\n\t <Filename>doNotTouch.jpg</Filename>\n\t <Filepath>digiserv-production:administrative:doNotTouch:doNotTouch.jpg</Filepath>\n\t <UniqueID>1</UniqueID>\n\t <Label>0</Label>\n\t <Rating>0</Rating>\n\t <MediaType>JPEG</MediaType>\n\t <FileSize unit=\"Bytes\">36243</FileSize>\n\t <Created>2009:06:04 15:07:22</Created>\n\t <Modified>2009:06:04 15:07:22</Modified>\n\t <Added>2009:06:18 13:29:03</Added>\n\t <Annotated>2009:06:18 13:29:10</Annotated>\n\t </AssetProperties>\n\t <MediaProperties>\n\t <Width unit=\"Pixels\">99</Width>\n\t <Height unit=\"Pixels\">640</Height>\n\t <Resolution unit=\"DPI\">72</Resolution>\n\t <Depth unit=\"Bits\">24</Depth>\n\t <ViewRotation>1</ViewRotation>\n\t <SampleColor>R:30 G:30 B:F0</SampleColor>\n\t <Pages>1</Pages>\n\t <ColorSpace>RGB </ColorSpace>\n\t <Compression>65541</Compression>\n\t <PrimaryEncoding>Photo - JPEG</PrimaryEncoding>\n\t <ColorProfile/>\n\t </MediaProperties>\n\t <MetaDataFields>\n\t <SourceURL/>\n\t </MetaDataFields>\n\t </MediaItem>\n\t </MediaItemList>\n\t <SetList/>\n\t </CatalogType>\n\tEOXML\n\t\n\t @doc=Nokogiri::XML( @template ) { |config| config.noblanks }\n\t @doc.encoding=\"UTF-8\"\n\t \n\t # change the text content of <CatalogType><Catalog> to \"EAD_\" + guideId + \"_Catalog\"\n\t @doc.xpath(\"/CatalogType/Catalog\").first.content=\"Component_#{@component.id}_#{@component.ead_id_att}_Catalog\"\n\t # add a new <Set> and recurse downwards from guide, adding metadata in <SetName> child\n\t fragment=@doc.xpath(\"/CatalogType/SetList\").first.add_child(Nokogiri::XML::Node.new \"Set\", @doc)\n\t #add_component_data( @component, fragment )\n\t #add_ead_data( ead, fragment ) # test only\n\t # dump to file\n\t #File.open(\"/tmp/test.xml\", 'w') {|f| f.puts @doc.to_xml(:indent => 2)}\n\t \n\t case @guide\n\t when Component\n\t add_component_data(@guide, fragment)\n\t end\n\t #return @doc\n\n filename=String.new\n case @guide.ead_id_att\n when /^viu/\n filename=@guide.ead_id_att\n else\n filename= @guide.name.parameterize.underscore.truncate(255)\n end\n\n\t\t@file=File.open(\"#{IVIEW_CATALOG_EXPORT_DIR}/#{filename}.xml\", 'w') \n\t\tlogger.debug \"writing file to #{IVIEW_CATALOG_EXPORT_DIR}/#{filename}.xml\"\n\t\t@file << @doc\n\t\t@file.close\n\tend", "def toxml\n\t\tend", "def inspect\n values = @properties.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.FlexApi.V1.InteractionChannelInstance #{values}>\"\n end", "def create\n @interaction = Interaction.new(params[:interaction])\n if @interaction.save\n redirect_to interactions_path\n else\n redirect_to new_interaction_path\n end\n end", "def render_xml_response \n @trust.update_attributes(:expires_at => Time.now.utc) if @trust && @trust.xml_expire? \n response.headers['CONTENT_TYPE'] = 'text/xml; charset=utf-8' \n response.headers['Content-Type'] = 'text/xml; charset=utf-8' \n render :text => \"<Response>#{@resp.headers['location'].gsub(/&/,'&#38;')}</Response>\" \n end", "def index\n @interactions = Interaction.all\n end", "def xml(item)\n presenter.xml(item)\n end", "def responder\r\n self.class.respond_to :html, :json\r\n end", "def rendered; end", "def to_xml\n request.clone.to_xml\n end", "def response\n @response\n end", "def response\n @response\n end", "def ole_methods\r\n @request.ole_methods\r\n end", "def response=(_arg0); end", "def response=(_arg0); end", "def response=(_arg0); end", "def response=(_arg0); end", "def im_argument()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::ImArgument::ImArgumentRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def create(opts)\n\t\t\t\turl = \"api/v2/interactions\"\n\t\t\t\tget_object(:post, \"interaction\", url, {:interaction => opts})\n\t\t\tend", "def generated\n end", "def update\n @interaction = Interaction.find(params[:id])\n\n respond_to do |format|\n if @interaction.update_attributes(params[:interaction])\n format.html { redirect_to @interaction, notice: 'Interaction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @clicker = Clicker.new\n\n \n respond_to do |format|\n \n format.html # new.html.erb\n \nformat.xml { render :xml => @clicker }\n \n end\n \nend", "def new\n @interviews_it = Interviews::It.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @interviews_it }\n end\n end", "def to_xml(xml)\n xml.Override(self.instance_values)\n end", "def to_xml(xml=Builder::XmlMarkup.new)\n attributes = {'ID' => id, 'Version' => version, 'IssueInstant' => issue_instant.in_time_zone.xmlschema}\n attributes['InResponseTo'] = in_response_to unless in_response_to.nil?\n attributes['Destination'] = destination unless destination.nil?\n attributes['Consent'] = consent unless consent.nil?\n attributes = add_xmlns(attributes)\n xml.tag!('samlp:Response', attributes) {\n xml << issuer.to_xml unless issuer.nil?\n xml << signature.to_xml unless signature.nil?\n # TODO: add extensions support\n xml << status.to_xml unless status.nil?\n assertions.each { |assertion| xml << assertion.to_xml }\n encrypted_assertions.each { |encrypted_assertion| xml << encrypted_assertion.to_xml }\n }\n end", "def get(id)\n\t\t\t\turl = \"api/v2/interactions/#{id}\"\n\t\t\t\tget_object(:get, \"interaction\", url)\n\t\t\tend", "def to_s\n '<Twilio.FlexApi.V1.InteractionChannelPage>'\n end", "def write(_request, _response)\n raise NotImplementedError, 'Implement this method in your strategy'\n end", "def response_to\n get_meta(:response)\n end", "def agentx_information\n super\n end" ]
[ "0.5996777", "0.58324873", "0.5689121", "0.56500363", "0.56149644", "0.5552172", "0.5480513", "0.54485685", "0.54485685", "0.54485685", "0.54064906", "0.5363855", "0.5326043", "0.5322011", "0.53097326", "0.5305662", "0.52977276", "0.5288128", "0.5273756", "0.52723783", "0.52650625", "0.52543366", "0.52443063", "0.5217733", "0.5212948", "0.51949835", "0.5188834", "0.5165503", "0.51636165", "0.5138137", "0.5115488", "0.5079038", "0.50725514", "0.50725514", "0.50501937", "0.5038383", "0.5036176", "0.50345564", "0.50344664", "0.50182986", "0.50148785", "0.5010334", "0.5010334", "0.5010304", "0.4996217", "0.49904352", "0.4988988", "0.49745855", "0.49743146", "0.49743146", "0.49743146", "0.49743146", "0.49743146", "0.49743146", "0.49743146", "0.49743146", "0.49743146", "0.49743146", "0.49743146", "0.49743146", "0.49743146", "0.49579343", "0.49542186", "0.49459666", "0.49294555", "0.49122703", "0.48969468", "0.4880673", "0.4877647", "0.48764825", "0.48704857", "0.48673844", "0.4863288", "0.4858542", "0.48515034", "0.4844709", "0.48347512", "0.48125672", "0.48094824", "0.48048347", "0.48033342", "0.48015645", "0.48015645", "0.4799448", "0.4794812", "0.4794812", "0.4794812", "0.4794812", "0.4790446", "0.47890925", "0.47885194", "0.4785336", "0.478472", "0.47780964", "0.47761446", "0.47749975", "0.47684658", "0.47602788", "0.47572437", "0.4755715", "0.47555572" ]
0.0
-1
Generated method to gather all the accepted keypresses.
def accepts self.current_state.pressings || {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key_pressed( event )\n @keys += [event.key]\n end", "def key_inputs; end", "def all\n scan_supported_keys\n end", "def answer_keys\n [key]\n end", "def possible_keys(key); end", "def confirm_newkeys; end", "def process_keyboard\n ACCEPTED_KEYS.each {|key|\n if Input.repeat?(key[0])\n c = (key[0] != :kSPACE) ? Keyboard.add_char(Ascii::SYM[key[0]]) : \" \"\n process_add(c)\n #Sound.play_ok\n play_random_key_sound\n end\n }\n end", "def keys() end", "def press_any_key\n # TODO: Print footer.\n get_wch\n end", "def keygens; end", "def init_accelerators\n @window.signal_connect \"key_press_event\" do |widget, event|\n ctrl = Gdk::Window::ModifierType::CONTROL_MASK == event.state\n g = Gdk::Keyval\n k = Gdk::Keyval.to_lower(event.keyval)\n\n # Nerd Shortcuts\n # This is used to provide an alternative to the arrow keys for\n # selecting an answer. It allows correcting more easily because\n # you don't need to move your hand while hitting enter. Great\n # for when eating pizza (or watching porn). It's located at:\n # QWERTZ: üöä#\n # QWERTY: [;'\\\n # NEO2DE: ßdy\\\n h = event.hardware_keycode\n\n # UNDO\n undo if(ctrl && k == g::GDK_z) || k == g::GDK_BackSpace\n\n # QUESTIONS UP/DOWN\n select_prev_question if(ctrl && k == g::GDK_Up) || k == g::GDK_Page_Up\n select_next_question if(ctrl && k == g::GDK_Down) || k == g::GDK_Page_Down\n\n # ANSWERS\n select_prev_answer if event.keyval == Gdk::Keyval::GDK_Left || h == 47\n select_next_answer if event.keyval == Gdk::Keyval::GDK_Right || h == 51\n\n # Go 5 answers down or up (especially useful for selecting tutors)\n select_prev_answer(5) if event.keyval == Gdk::Keyval::GDK_Up || h == 34\n select_next_answer(5) if event.keyval == Gdk::Keyval::GDK_Down || h == 48\n\n # FAILED QUESTION\n find_failed_question if(k == g::GDK_3270_Enter || k == g::GDK_ISO_Enter)\n find_failed_question if(k == g::GDK_KP_Enter || k == g::GDK_Return)\n\n # QUIT\n quit_application if ctrl && k == g::GDK_q\n\n @window.signal_emit_stop('key_press_event')\n end\n end", "def on_key(ch)\n end", "def keys\n return @keys if defined?(@keys)\n @keys = all.map do |tone|\n Key.from_index(tone.tone, tone.letter_index)\n end\n end", "def key_combination(*keys)\n keys.each {|k| press(k) }\n keys.reverse.each {|k| release(k) }\n end", "def key_listen\n Thread.new do\n loop do \n block = @key_bindings[get_character]\n puts block.call if block\n end\n end\n end", "def handle_key ch\n super\n end", "def send_keys(*args); end", "def key_down key\n @keys.push key\n end", "def keys(*) end", "def derived_receive_keys\n (receive_depth + 1).times.map{|i|derive_key(0,i)}\n end", "def key_manager; end", "def keys(pattern = \"*\")\n send_command([:keys, pattern]) do |reply|\n if reply.is_a?(String)\n reply.split(\" \")\n else\n reply\n end\n end\n end", "def list_keys()\n # TODO\n end", "def key_defs(actions)\n return actions.map{|(in_key, action)| {'key_code' => in_key}}\nend", "def ORIG_process_key keycode, object, window\n return :UNHANDLED if @_key_map.nil?\n blk = @_key_map[keycode]\n $log.debug \"XXX: _process key keycode #{keycode} #{blk.class}, #{self.class} \"\n return :UNHANDLED if blk.nil?\n if blk.is_a? OrderedHash \n #Ncurses::nodelay(window.get_window, bf = false)\n # if you set nodelay in ncurses.rb then this will not\n # wait for second key press, so you then must either make it blocking\n # here, or set a wtimeout here.\n #\n # This is since i have removed timeout globally since resize was happeing\n # after a keypress. maybe we can revert to timeout and not worry about resize so much\n Ncurses::wtimeout(window.get_window, 500) # will wait a second on wgetch so we can get gg and qq\n ch = window.getch\n # we should not reset here, resetting should happen in getch itself so it is consistent\n #Ncurses::nowtimeout(window.get_window, true)\n\n $log.debug \" process_key: got #{keycode} , #{ch} \"\n # next line ignores function keys etc. C-x F1, thus commented 255 2012-01-11 \n if ch < 0 #|| ch > 255\n return nil\n end\n #yn = ch.chr\n blk1 = blk[ch]\n # FIXME we are only returning the second key, what if form\n # has mapped first and second combo. We should unget keycode and ch. 2011-12-23 \n # check this out first.\n window.ungetch(ch) if blk1.nil? # trying 2011-09-27 \n return :UNHANDLED if blk1.nil? # changed nil to unhandled 2011-09-27 \n $log.debug \" process_key: found block for #{keycode} , #{ch} \"\n blk = blk1\n end\n if blk.is_a? Symbol\n if respond_to? blk\n return send(blk, *@_key_args[keycode])\n else\n ## 2013-03-05 - 19:50 why the hell is there an alert here, nowhere else\n alert \"This ( #{self.class} ) does not respond to #{blk.to_s} [PROCESS-KEY]\"\n # added 2013-03-05 - 19:50 so called can know\n return :UNHANDLED \n end\n else\n $log.debug \"rwidget BLOCK called _process_key \" if $log.debug? \n return blk.call object, *@_key_args[keycode]\n end\n #0\n end", "def keys\n end", "def derived_receive_keys\n receive_depth.times.map{|i|derive_key(0,i)}\n end", "def _process_key keycode, object, window\n return :UNHANDLED if @_key_map.nil?\n chr = nil\n ch = keycode\n if ch > 0 and ch < 256\n chr = ch.chr\n end\n blk = @_key_map[keycode]\n # i am scrappaing this since i am once again complicating too much\n=begin\n # if blk then we found an exact match which supercedes any ranges, arrays and regexes\n unless blk\n @_key_map.each_pair do |k,p|\n $log.debug \"KKK: processing key #{ch} #{chr} \"\n if (k == ch || k == chr)\n $log.debug \"KKK: checking match == #{k}: #{ch} #{chr} \"\n # compare both int key and chr\n $log.debug \"KKK: found match 1 #{ch} #{chr} \"\n #p.call(self, ch)\n #return 0\n blk = p\n break\n elsif k.respond_to? :include?\n $log.debug \"KKK: checking match include #{k}: #{ch} #{chr} \"\n # this bombs if its a String and we check for include of a ch.\n if !k.is_a?( String ) && (k.include?( ch ) || k.include?(chr))\n $log.debug \"KKK: found match include #{ch} #{chr} \"\n #p.call(self, ch)\n #return 0\n blk = p\n break\n end\n elsif k.is_a? Regexp\n if k.match(chr)\n $log.debug \"KKK: found match regex #{ch} #{chr} \"\n #p.call(self, ch)\n #return 0\n blk = p\n break\n end\n end\n end\n end\n=end\n # blk either has a proc or is nil\n # we still need to check for a complex map. if none, then execute simple map.\n ret = check_composite_mapping(ch, window)\n $log.debug \" composite returned (#{ret}) for #{ch} \"\n if !ret\n return execute_mapping(blk, ch, object) if blk\n end\n return execute_mapping(ret, ch, object) if ret\n return :UNHANDLED\n end", "def bind_key keycode, *args, &blk\n #$log.debug \" #{@name} bind_key received #{keycode} \"\n @_key_map ||= {}\n #\n # added on 2011-12-4 so we can pass a description for a key and print it\n # The first argument may be a string, it will not be removed\n # so existing programs will remain as is.\n @key_label ||= {}\n if args[0].is_a?(String) || args[0].is_a?(Symbol)\n @key_label[keycode] = args[0] \n else\n @key_label[keycode] = :unknown\n end\n\n if !block_given?\n blk = args.pop\n raise \"If block not passed, last arg should be a method symbol\" if !blk.is_a? Symbol\n #$log.debug \" #{@name} bind_key received a symbol #{blk} \"\n end\n case keycode\n when String\n # single assignment\n keycode = keycode.getbyte(0) \n when Array\n # double assignment\n # this means that all these keys have to be pressed in succession for this block, like \"gg\" or \"C-x C-c\"\n raise \"A one key array will not work. Pass without array\" if keycode.size == 1\n ee = []\n keycode.each do |e| \n e = e.getbyte(0) if e.is_a? String\n ee << e\n end\n bind_composite_mapping ee, args, blk\n return self\n #@_key_map[a0] ||= OrderedHash.new\n #@_key_map[a0][a1] = blk\n #$log.debug \" XX assigning #{keycode} to _key_map \" if $log.debug? \n else\n $log.debug \" assigning #{keycode} to _key_map for #{self.class}, #{@name}\" if $log.debug? \n end\n @_key_map[keycode] = blk\n @_key_args ||= {}\n @_key_args[keycode] = args\n self\n end", "def send_key(*args); end", "def key_set()\n return @outputs.keys()\n end", "def keymaps\n Vedeu::Keymaps.registered\n end", "def keys\n prefixed_keys.map { |key|\n Rack::Attack.unprefix_key(key)\n }\n end", "def keys\n prefixed_keys.map { |key|\n Rack::Attack.unprefix_key(key)\n }\n end", "def key_bindings\n super\n @root.bind('u', proc {@board.rotate_clockwise\n @board.rotate_clockwise})\n @root.bind('c', proc {@board.call_cheat})\n end", "def exchange_keys; end", "def exchange_keys; end", "def alpha_mapping\n {# 1st line\n Q: '__{ KeyCode::Q, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n W: \"__{ KeyCode::KEY_5, #{shift_opt}, KeyCode::MINUS, #{shift_opt}, #{left} }__\", # []\n E: \"__{ KeyCode::KEY_5, KeyCode::MINUS, #{left} }__\", # ()\n R: \"__{ KeyCode::KEY_5, #{opt}, KeyCode::MINUS, #{opt}, #{left} }__\", # {}\n T: \"__{ KeyCode::BACKQUOTE, KeyCode::BACKQUOTE, #{shift}, #{left} }__\", # <>\n Y: \"__{ KeyCode::KEY_1, #{shift} }__\", # 1\n U: \"__{ KeyCode::CURSOR_LEFT, #{cmd} }__\", # left\n I: '__{ KeyCode::CURSOR_UP }__', # up\n O: \"__{ KeyCode::CURSOR_RIGHT, #{cmd} }__\", # right\n P: nil,\n\n # 2nd line\n A: '__{ KeyCode::A, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n S: '__{ KeyCode::S, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n D: '__{ KeyCode::D, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n F: \"__{ KeyCode::KEY_3, KeyCode::KEY_3, #{left} }__\", # \"\",\n G: \"__{ KeyCode::KEY_4, KeyCode::KEY_4, #{left} }__\", # '',\n H: '__{ KeyCode::RawValue::0x97 }__', # nil, # 0, # ----- # todo: <- NC #'__{ KeyCode::M }__',\n J: '__{ KeyCode::CURSOR_LEFT }__', # LEFT\n K: '__{ KeyCode::CURSOR_DOWN }__', # DOWN\n L: '__{ KeyCode::CURSOR_RIGHT }__', # RIGHT\n QUOTE: '__{ KeyCode::RawValue::0x98 }__', # todo: -> NC\n\n # 3rd line\n Z: '__{ KeyCode::Z, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n X: '__{ KeyCode::X, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n C: '__{ KeyCode::C, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n V: '__{ KeyCode::V, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n B: '__{ KeyCode::B, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n N: '__{ KeyCode::N, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n M: \"__{ KeyCode::CURSOR_LEFT, #{opt} }__\", # <- word\n COMMA: '__{ KeyCode::RawValue::0x96 }__', # down something\n DOT: \"__{ KeyCode::CURSOR_RIGHT, #{opt} }__\", # -> word\n # BACKQUOTE: 'BACKSLASH', Z: 'COMMA',\n\n KEY_2: \"__{ KeyCode::L, #{shift_opt}, KeyCode::L, #{shift_opt}, #{left} }__\", # ||\n KEY_3: \"__{ KeyCode::KEY_3, KeyCode::KEY_3, #{left} }__\", # '', # -----\n KEY_4: \"__{ KeyCode::KEY_4, KeyCode::KEY_4, #{left} }__\", # \"\", # -----\n KEY_5: \"__{ KeyCode::BACKSLASH, KeyCode::BACKSLASH, #{left} }__\", # ``,\n KEY_7: nil,\n KEY_8: '__{ KeyCode::RawValue::0x95 }__',\n KEY_9: nil\n }.with_indifferent_access\n end", "def keys\n end", "def keys\n end", "def keys\n end", "def generate_keys()\n bobhi = read_key(\"key_bobhi345.txt\")\n floatlift = read_key(\"key_FloatLift.txt\")\n sirbob = read_key(\"key_sirbob3.txt\")\n api = read_key(\"key_JustForTheApiLul.txt\")\n return [bobhi, floatlift, sirbob, api]\nend", "def any_key\n puts \"\"\n puts \"Press any key to continue..\"\n STDIN.getch\n end", "def keypress &block\n @keyblock = block\n end", "def all(key_or_opts = :all, opts={})\n process(received(key_or_opts, opts)) + process(sent(key_or_opts, opts))\n end", "def raw_send_keys(*keys)\n invalidate_cache!\n keys.each { |key| vim.type(key) }\n end", "def ORIGbind_key keycode, *args, &blk # -- {{{\n #$log.debug \" #{@name} bind_key received #{keycode} \"\n @_key_map ||= {}\n #\n # added on 2011-12-4 so we can pass a description for a key and print it\n # The first argument may be a string, it will not be removed\n # so existing programs will remain as is.\n @key_label ||= {}\n if args[0].is_a?(String) || args[0].is_a?(Symbol)\n @key_label[keycode] = args[0] \n else\n @key_label[keycode] = :unknown\n end\n\n if !block_given?\n blk = args.pop\n raise \"If block not passed, last arg should be a method symbol\" if !blk.is_a? Symbol\n #$log.debug \" #{@name} bind_key received a symbol #{blk} \"\n end\n case keycode\n when String\n # single assignment\n keycode = keycode.getbyte(0) #if keycode.class==String ## 1.9 2009-10-05 19:40 \n #$log.debug \" #{name} Widg String called bind_key BIND #{keycode}, #{keycode_tos(keycode)} \"\n #$log.debug \" assigning #{keycode} \" if $log.debug? \n @_key_map[keycode] = blk\n when Array\n # double assignment\n # for starters lets try with 2 keys only\n raise \"A one key array will not work. Pass without array\" if keycode.size == 1\n a0 = keycode[0]\n a0 = keycode[0].getbyte(0) if keycode[0].class == String\n a1 = keycode[1]\n a1 = keycode[1].getbyte(0) if keycode[1].class == String\n @_key_map[a0] ||= OrderedHash.new\n #$log.debug \" assigning #{keycode} , A0 #{a0} , A1 #{a1} \" if $log.debug? \n @_key_map[a0][a1] = blk\n #$log.debug \" XX assigning #{keycode} to _key_map \" if $log.debug? \n else\n #$log.debug \" assigning #{keycode} to _key_map \" if $log.debug? \n @_key_map[keycode] = blk\n end\n @_key_args ||= {}\n @_key_args[keycode] = args\n\n end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def keys; end", "def method_missing(sym, *args, &block)\n super if !args.empty? or block\n cmds = sym.to_s.split(\"_\")\n callsequence = \"\"\n cmds.each do |cmd|\n callsequence << case cmd.downcase\n when \"ctrl\" then \"^\"\n when \"shift\" then \"+\"\n when \"alt\" then \"!\"\n when \"win\" then \"#\"\n when \"enter\" then \"{ENTER}\"\n when \"return\" then \"{ENTER}\"\n when \"del\" then \"{DEL}\"\n else\n cmd\n end\n end\n send_keys(callsequence)\n end", "def all\n @keys\n end", "def keys\n end", "def whiskey_process\n end", "def initialize_keys\n @key0 = 0x12345678\n @key1 = 0x23456789\n @key2 = 0x34567890\n @password.each_byte { |byte| update_keys(byte.chr) }\n nil\n end", "def keys\n @inputs.keys\n end", "def keys\n lock { @blurbs.keys }\n end", "def source\n puts '------------------------------------------------'.colorize(:light_blue)\n puts 'Input keys? [y/n]'.colorize(:light_blue)\n puts '------------------------------------------------'.colorize(:light_blue)\n $stdin.gets.chomp == 'y' ? source_keys : all_keys\n end", "def keys\n return @keys if @keys\n keys = py \"keys.py\"\n keys = parse_keys keys\n @keys = keys\n end", "def send_key(keycode, ctrl=false, alt=false, shift=false)\n matchingshortcuts = @shortcuts.select { |shortcut|\n shortcut.keycode == keycode && shortcut.ctrl == ctrl &&\n shortcut.alt == alt && shortcut.shift == shift\n }\n counter = 0\n matchingshortcuts.each { |shortcut|\n action = shortcut.action\n @actions[action].each { |handler|\n handler.call(shortcut)\n counter+=1\n }\n }\n counter\n end", "def list\n @keychain.keys\n end", "def keygens\n @keygens ||= fields.select { |f| f.class == Keygen }\n end", "def keystream(letter_count)\n\t\tkeystream = Array.new\n\t\tletters_added = 0\n\t\tbegin \n\t\t\tletter = get_letter\n\t\t\tif letter != 53 \n\t\t\t\tkeystream << letter\n\t\t\t\tletters_added += 1\n\t\t\tend\n\t\tend while letters_added < letter_count\n\t\tkeystream\n\tend", "def normalize_keys(keys, pressed_keys = [], memo = [])\n case keys\n when Array\n raise ArgumentError, \"empty keys passed\" if keys.empty?\n\n pressed_keys.push([])\n memo += combine_strings(keys).map do |key|\n normalize_keys(key, pressed_keys, memo)\n end\n pressed_keys.pop\n memo.flatten.compact\n when Symbol\n key = keys.to_s.downcase\n\n if MODIFIERS.keys.include?(key)\n pressed_keys.last.push(key)\n nil\n else\n key = KEYS.fetch(KEYS_MAPPING[key.to_sym] || key.to_sym)\n key[:modifiers] = pressed_keys.flatten.map { |k| MODIFIERS[k] }.reduce(0, :|)\n to_options(key)\n end\n when String\n raise ArgumentError, \"empty keys passed\" if keys.empty?\n\n pressed = pressed_keys.flatten\n keys.each_char.map do |char|\n key = KEYS[char] || {}\n\n if pressed.empty?\n key = key.merge(text: char, unmodifiedText: char)\n [to_options(key)]\n else\n text = pressed == [\"shift\"] ? char.upcase : char\n key = key.merge(\n text: text,\n unmodifiedText: text,\n isKeypad: key[\"location\"] == 3,\n modifiers: pressed.map { |k| MODIFIERS[k] }.reduce(0, :|)\n )\n\n modifiers = pressed.map { |k| to_options(KEYS.fetch(KEYS_MAPPING[k.to_sym])) }\n modifiers + [to_options(key)]\n end.flatten\n end\n else\n raise ArgumentError, \"unexpected argument\"\n end\n end", "def get_keys\n @encryption_io.get_keys\n end", "def each_key\n return enum_for(__method__) unless block_given?\n @raw.each_key do |key|\n yield key\n end\n self\n end", "def generate_key\n begin\n multipliers = eval(self.software.multipliers)\n key = []\n self.challenge.split(\"-\").each_with_index do |word,i|\n word = word.to_i(16) # convert hex to dec\n word *= (word[0].even?) ? multipliers[i][:even] : multipliers[i][:odd]\n key << word.to_s(16).reverse[0,8].reverse # convert dec to hex, keep only 8 rightmost hex characters\n end\n self.activation_key = key.join(\"-\").upcase\n rescue\n self.activation_key = \"error!\"\n end\n end", "def asking_getchar\n Fiber.yield :input\n end", "def handle_key(ch)\n # 2014-08-19 - 21:10 moving to init, so that user may override or remove\n #map_keys unless @keys_mapped\n handled = :UNHANDLED # 2011-10-4 \n if ch == ?\\C-u.getbyte(0)\n ret = universal_argument\n $log.debug \"C-u FORM set MULT to #{$multiplier}, ret = #{ret} \"\n return 0 if ret == 0\n ch = ret # unhandled char\n elsif ch >= ?\\M-1.getbyte(0) && ch <= ?\\M-9.getbyte(0)\n if $catch_alt_digits # emacs EMACS\n ret = digit_argument ch\n $log.debug \" FORM set MULT DA to #{$multiplier}, ret = #{ret} \"\n return 0 if ret == 0 # don't see this happening\n ch = ret # unhandled char\n end\n end\n\n $current_key = ch\n case ch\n when -1\n return\n when 1000, 12\n # NOTE this works if widgets cover entire screen like text areas and lists but not in \n # dialogs where there is blank space. only widgets are painted.\n # testing out 12 is C-l\n $log.debug \" form REFRESH_ALL repaint_all HK #{ch} #{self}, #{@name} \"\n repaint_all_widgets\n return\n when FFI::NCurses::KEY_RESIZE # SIGWINCH \n # note that in windows that have dialogs or text painted on window such as title or \n # box, the clear call will clear it out. these are not redrawn.\n lines = Ncurses.LINES\n cols = Ncurses.COLS\n x = Ncurses.stdscr.getmaxy\n y = Ncurses.stdscr.getmaxx\n $log.debug \" form RESIZE HK #{ch} #{self}, #{@name}, #{ch}, x #{x} y #{y} lines #{lines} , cols: #{cols} \"\n #alert \"SIGWINCH WE NEED TO RECALC AND REPAINT resize #{lines}, #{cols}: #{x}, #{y} \"\n\n # next line may be causing flicker, can we do without.\n Ncurses.endwin\n @window.wrefresh\n @window.wclear\n if @layout_manager\n @layout_manager.do_layout\n # we need to redo statusline and others that layout ignores\n else\n @widgets.each { |e| e.repaint_all(true) } # trying out\n end\n ## added RESIZE on 2012-01-5 \n ## stuff that relies on last line such as statusline dock etc will need to be redrawn.\n fire_handler :RESIZE, self \n else\n field = get_current_field\n if $log.debug?\n keycode = keycode_tos(ch)\n $log.debug \" form HK #{ch} #{self}, #{@name}, #{keycode}, field: giving to: #{field}, #{field.name} \" if field\n end\n handled = :UNHANDLED \n handled = field.handle_key ch unless field.nil? # no field focussable\n $log.debug \"handled inside Form #{ch} from #{field} got #{handled} \"\n # some widgets like textarea and list handle up and down\n if handled == :UNHANDLED or handled == -1 or field.nil?\n case ch\n when KEY_TAB, ?\\M-\\C-i.getbyte(0) # tab and M-tab in case widget eats tab (such as Table)\n ret = select_next_field\n return ret if ret == :NO_NEXT_FIELD\n # alt-shift-tab or backtab (in case Table eats backtab)\n when FFI::NCurses::KEY_BTAB, 481 ## backtab added 2008-12-14 18:41 \n ret = select_prev_field\n return ret if ret == :NO_PREV_FIELD\n when FFI::NCurses::KEY_UP\n ret = select_prev_field\n return ret if ret == :NO_PREV_FIELD\n when FFI::NCurses::KEY_DOWN\n ret = select_next_field\n return ret if ret == :NO_NEXT_FIELD\n else\n #$log.debug \" before calling process_key in form #{ch} \" if $log.debug? \n ret = process_key ch, self\n # seems we need to flushinp in case composite has pushed key\n $log.debug \"FORM process_key #{ch} got ret #{ret} in #{self}, flushing input \"\n # 2014-06-01 - 17:01 added flush, maybe at some point we could do it only if unhandled\n # in case some method wishes to actually push some keys\n Ncurses.flushinp\n return :UNHANDLED if ret == :UNHANDLED\n end\n elsif handled == :NO_NEXT_FIELD || handled == :NO_PREV_FIELD # 2011-10-4 \n return handled\n end\n end\n $log.debug \" form before repaint #{self} , #{@name}, ret #{ret}\"\n repaint\n $last_key = ch\n ret || 0 # 2011-10-17 \n end", "def process_confirm_keyboard_input(key)\n case key\n when :enter then print_confirm(@res, false)\n when :Y, :y then print_confirm(true, false)\n when :N, :n then print_confirm(false, false)\n when :tab, :down, :left, :space, :up, :right then print_confirm(!@res, true)\n end\n end", "def pressKeyToContinue\n puts \"\\n-- press any key to continue --\"\n gets\nend", "def handle_key(key); end", "def scard(key); end", "def scard(key); end", "def keys\n @keys||= [:token, :message, :title, :device, :priority]\n end", "def each_key(&block); end", "def key_variants; end", "def add_key_event_listener\n # Get the class of the object.\n @activity.class.class_eval do\n \n attr_accessor :input\n \n def on_destroy\n super\n #Release audio resources\n Song.release_resources \n end\n \n def onKeyDown(keyCode, event) \n if @input.feed_key_event_down(keyCode)\n return true\n else\n return super keyCode, event\n end\n end\n \n def onKeyUp(keyCode, event) \n if @input.feed_key_event_up(keyCode)\n return true\n else\n return super keyCode, event\n end\n end\n\n #TODO It does never get called, it does not matter how long\n #the press was\n def onKeyLongPress(keyCode, event) \n if @input.feed_key_event_up(keyCode)\n return true\n else\n return super keyCode, event\n end\n end\n \n end\n end", "def with_keys_disabled\n disable_keys\n yield\n enable_keys\n end", "def load_keys\n @@keys = Hash[buttons.map{|button| [button.text, button]}]\n end", "def shared_keyboard_and_mouse_event_init_keys\n shared_keyboard_and_mouse_event_init_keys ||= alternative_key_names.map do |key_grp| \n if @dom_3_attrs.include?(correct_key = key_grp.last) \n correct_key\n else\n \"keyModifierState#{correct_key}\".to_sym\n end\n end\n end", "def after_update\n @keys_pressed.clear\n @keys_released.clear\n end", "def process_confirm_input\n print_confirm(true, true)\n @confirm_loop = true\n while @confirm_loop\n input = IO.input\n process_confirm_mouse_click input\n process_confirm_keyboard_input input[:key]\n end\n end", "def scan_supported_keys\n sensors = Hash.new\n Settings.configFileExists\n\n puts \"Scanning keys...\\n\\n\"\n\n characters = [('a'..'z'), ('A'..'Z'),(0..9)].map { |i| i.to_a }.flatten\n characters.each {|l1|\n characters.each {|l2|\n characters.each {|l3|\n key = \"T#{l1}#{l2}#{l3}\"\n t = is_key_supported(key);\n if (t != 0.0)\n thresholds = [50, 68, 80, 90]\n if Printer.get_temperature_scale == 'fahrenheit'\n thresholds.map! { |t| Utils.to_fahrenheit(t) }\n end\n sensors['thresholds'] = thresholds\n sensors['name'] = name(key)\n sensors['enabled'] = 0\n\n Settings.addSensor(key, sensors)\n value, scale = Printer.parse_temperature(t)\n\n Printer.print_item_line(\"#{key} #{sensors['name']}\", value, scale, sensors['thresholds'])\n end\n }\n }\n }\n puts \"\\nDone scanning keys.\\n\"\n puts \"All keys are disabled by default. Use `istats enable [key]` to enable specific keys or `istats enable all`.\"\n puts \"The enabled sensors will show up when running `istats` or `istats extra`.\"\n end", "def keys\n (@defs.keys.to_set + @extra_inputs.keys.to_set).to_a\n end", "def keys\n @monitor.synchronize { @stash.keys }\n end", "def register(*key_strokes, &handler)\r\n \r\n AWT::Toolkit.getDefaultToolkit().addAWTEventListener(self, AWT::AWTEvent::KEY_EVENT_MASK)\r\n\r\n @key_strokes = key_strokes\r\n @handler = handler\r\n\r\n end", "def collectible_buttons_all\n h = {}\n collectible_buttons_available.each { |name| h[name.to_sym] = true }\n h\n end", "def keys\n # merge the unique keys of the handset and it's fallback\n return @capabilityhash.keys | @fallback.keys if @fallback != nil\n # no fallback so just return the handset's keys\n return @capabilityhash.keys\n end", "def hgetall(key)\n send_command([:hgetall, key], &Hashify)\n end", "def update_key_scan\n return unless open?\n return if @closing\n unless Input.controller_connected?\n @selected_key = 0\n close\n return\n end\n keymap = XInput.get_key_state.keys - ControllerSettings.excluded_commands\n key_selection(keymap)\n end", "def keys\n candy.keys\n end", "def handle_key key\n key\n end", "def all_keys\r\n keys = dispatch('33').split(',')\r\n #the reponse is \"1,field1,field2,....\" where 1 is success and rest are avail feilds.\r\n keys = keys[1..(keys.length)]\r\n end" ]
[ "0.6258688", "0.62388253", "0.62344676", "0.622095", "0.61351645", "0.6076193", "0.60335", "0.59263134", "0.59014165", "0.57416505", "0.5740689", "0.5568137", "0.55486906", "0.55258614", "0.54936653", "0.5469253", "0.54691386", "0.54503787", "0.5425833", "0.54038084", "0.5400069", "0.5393157", "0.5391987", "0.53866816", "0.5373994", "0.53632337", "0.53537434", "0.5340796", "0.53216237", "0.5318503", "0.5308154", "0.5288291", "0.5286447", "0.5286447", "0.5257967", "0.5246657", "0.5246657", "0.5242664", "0.5235808", "0.5235808", "0.5235808", "0.5232829", "0.5227433", "0.5202916", "0.5193392", "0.5193242", "0.5190681", "0.51869774", "0.51869774", "0.51869774", "0.51869774", "0.51869774", "0.51869774", "0.51869774", "0.51869774", "0.51869774", "0.5172904", "0.5167216", "0.5153102", "0.5152781", "0.51506525", "0.51415265", "0.513544", "0.51338226", "0.51265174", "0.5116346", "0.51070815", "0.5104541", "0.510138", "0.5101127", "0.50826263", "0.5077615", "0.5067426", "0.5066052", "0.5063839", "0.5063197", "0.50587016", "0.50504744", "0.5034382", "0.5034382", "0.5030872", "0.50234824", "0.5023163", "0.502113", "0.5019143", "0.50137866", "0.5004049", "0.5001282", "0.49944022", "0.49929738", "0.49842963", "0.4983074", "0.49808854", "0.49792498", "0.49755633", "0.49740267", "0.49696913", "0.49690452", "0.49689677", "0.4967734" ]
0.5257775
35
Accessor for target_path The target_path is the path where the finalizers will put the release
def target_path Pathname.new(config[:target_path]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def target_path\n Pathname.new(self.config[:target_path])\n end", "def target_path(target_name)\r\n File.join(package_dir, target_name)\r\n end", "def path\n File.join(@base, @target)\n end", "def getPath(target)\n File.expand_path(File.join(File.dirname(__FILE__), target))\nend", "def build_target_path\n File.join(destination, configuration[:build_target_path])\n end", "def targets_path\n self.root.join(TARGETS_DIRECTORY)\n end", "def release_path\n @release_path ||= Pathname.new(source_dir).join(data['release_path'] || './release').to_s\n end", "def release_path\n @config[:remote_path]\n end", "def target_file_path\n model.source_location(target_symbol)[:file_path]\n end", "def compiled_path; end", "def file_path( target )\n # theme.site do not work.\n File.join(page_layout.site.path, self.path, file_name(target)) \n end", "def file_path( target )\n # theme.site do not work.\n File.join( original_template_theme.store.path, self.path, file_name(target))\n end", "def file_path( target )\n File.join(template_theme.website.path, self.path, template_theme.file_name(target))\n end", "def capture_path(target_name, mode=0600)\r\n tempfile = _package_.setup_tempfile(target_name, mode)\r\n capture_block(tempfile) do\r\n current = @target_name\r\n \r\n begin\r\n @target_name = target_name\r\n yield\r\n ensure\r\n @target_name = current\r\n end\r\n \r\n end\r\n tempfile.close\r\n \r\n target_path target_name\r\n end", "def teardown\n teardown_construct(@target_path)\n @release.destroy\n @release = nil\n end", "def path\n @link.TargetPath\n end", "def destination\n @destination ||= File.join(tmpdir, File.basename(configuration[:release_path]))\n end", "def destination\n #configuration[:release_path]\n @destination ||= File.join(tmpdir, File.basename(configuration[:release_path]))\n\n end", "def conditional_target_file_path\n return if conditional_target_symbol.nil?\n\n model.source_location(conditional_target_symbol)[:file_path]\n end", "def release_path\n ::File.join(install_path, artifact_name, artifact_version)\n end", "def output_path=(path)\n @output_path = path\n end", "def output_path; end", "def compiled_path=(path); end", "def target\n filter.into @project.path_to(:target, @usage, :resources) unless filter.target || sources.empty?\n filter.target\n end", "def target\n return nil unless @target_dir\n unless @target\n @target = file(File.expand_path(@target_dir)) { |task| run if @target == task }\n @target.enhance @include.select {|f| f.is_a?(Rake::FileTask)}\n @target.enhance @exclude.select {|f| f.is_a?(Rake::FileTask)}\n @target.enhance copy_map.values\n end\n @target\n end", "def build_path\n Pathname.new(self.config[:build_path]) \n end", "def initialize(path, target=nil)\n self.path = path\n self.target = target\n end", "def build_path\n end", "def tar_path\n File.expand_path(@env[\"package.output\"], FileUtils.pwd)\n end", "def output_path\n \"build\"\n end", "def build_path(target_word)\n # debugger\n source_to_target_path = [target_word]\n current_word = target_word\n prev_word = @all_seen_words[current_word]\n\n until prev_word.nil?\n source_to_target_path.unshift(prev_word)\n current_word = prev_word\n prev_word = @all_seen_words[current_word]\n end\n @path = source_to_target_path\n @path\n end", "def source_path; end", "def output_dir(target_repo = \"\") # rubocop:disable Lint/DuplicateMethods\n @output_dir ||= File.join(@os_name, @os_version, target_repo, @architecture)\n end", "def public_path(target) \n page_generator.theme.file_path(target) \n end", "def destination_path\n @destination_path ||= Pathname.new(self.destination_root)\n end", "def target\n @target ||= begin\n target = static_data(\"target\")\n cache.build(target[\"url\"]) if target && target[\"url\"]\n end\n end", "def build_path\n Pathname.new(config[:build_path])\n end", "def target\n \"#{target_repo}/#{target_branch}\"\n end", "def package_dir\r\n \"${0%/#{target_name}}\"\r\n end", "def target\n base.image_for(\"#{name}_target\")\n end", "def file_path(file_name, target_name=file_name, mode=0600)\r\n _package_.build_file(target_name, file_name, mode)\r\n target_path target_name\r\n end", "def dest_path\n @dest_path ||= File.expand_path(path)\n end", "def dest_path\n @dest_path ||= File.expand_path(path)\n end", "def framework_path\n File.join(config.build_products_dir, name)\n end", "def target\n @target ||= Target.find(options[:target]).new(options[:directory])\n end", "def output_dir_path\n @output_dir_path ||= download_dir_path\n end", "def helper_target_dir\n helper_source_dir\n end", "def target_spec_path\n @target_spec_path ||= begin\n class_name_parts = object_name.split('::')\n\n # drop the module name if the object name contains multiple parts\n class_name_parts.delete_at(0) if class_name_parts.length > 1\n\n \"#{File.join(module_dir, 'spec', 'classes', *class_name_parts)}_spec.rb\"\n end\n end", "def destination\n @release_destination\n end", "def compile(target_path:)\n target_path = Pathname.new(target_path)\n mkdir_p target_path\n root = Pathname.new(\"/\")\n cache_resources = @site.cache_resources\n @stdout.puts \"Compiling #{@site.root_path.expand_path}\"\n begin\n @site.cache_resources = true\n @site.resources.each do |resource|\n derooted = Pathname.new(resource.request_path).relative_path_from(root)\n path = target_path.join(derooted)\n mkdir_p path.dirname\n @stdout.puts \" #{path}\"\n File.open(path.expand_path, \"w\"){ |f| f.write render(resource) }\n end\n @stdout.puts \"Successful compilation to #{target_path.expand_path}\"\n ensure\n @site.cache_resources = cache_resources\n end\n end", "def __path__\n File.join(root, 'tmp', 'build')\n end", "def target_url(target)\n File.join(\"/\", Pathname.new(target).relative_path_from(Pathname.new(DST_DIR)).to_s)\nend", "def target_object_path\n @target_pp_path ||= begin\n class_name_parts = object_name.split('::')[1..-1]\n class_name_parts << 'init' if class_name_parts.empty?\n\n \"#{File.join(module_dir, 'manifests', *class_name_parts)}.pp\"\n end\n end", "def target_filename\n raise NotImplementedError, \"Must be overridden by a subclass\"\n end", "def output_path(path)\n\t\t\tunless Pathname.new(path).absolute?\n\t\t\t\toutput = @variables['__OUTPUT__']\n\t\t\t\tif output\n\t\t\t\t\tDir.mkdir output unless Dir.exists? output\n\t\t\t\t\tpath = File.join(output, path)\n\t\t\t\tend\n\t\t\tend\n\t\t\tpath\n\t\tend", "def _target\n @_target ||= @_initializer.call\n end", "def recipe_path(recipe_name, target_name=recipe_name, mode=0700)\r\n _package_.build_recipe(target_name, recipe_name, mode)\r\n target_path target_name\r\n end", "def source_path\n Pathname.new(self.config[:source_path])\n end", "def output_path\n File.join(Musako.destination_path, @url)\n end", "def path\n asset_source_path\n end", "def path\n asset_source_path\n end", "def pathDistSource\n\tpathDist + \"source/\"\nend", "def target_recipe_path\n key = Digest::MD5.hexdigest(config.recipe)\n File.join(config.upload_path, \"recipe-#{key}.rb\")\n end", "def initialize(target_path = ApacheConfig::DEFAULT_CONFIG_PATH, config_path = DEFAULT_CONFIG_PATH)\n @target = Pathname.new(target_path).realpath.to_s\n @config_path = config_path\n end", "def target_dir\n return @target_dir ? @target_dir : Dir.home\n end", "def destination_rel_dir\n replace_build_path(super)\n end", "def initialize(target_path = \"../../test/fixtures-gh\")\n target_path = File.expand_path( target_path, __FILE__ ) unless Dir.exist?(target_path)\n Dir.chdir(target_path)\n `rm -rf *` # clean\n end", "def source_path\n Pathname.new(config[:source_path])\n end", "def loaded_path; end", "def source_path\n source[:path]\n end", "def path\n @path ||= make_path(@module.to_a.concat(outter_class.to_a).push(filename))\n end", "def file_path path\n File.join(output_path, manifest.lookup(path).split('/')[2..-1])\n end", "def configuration_file_for(target_dir); end", "def path\n @path ||= best_qmake\n end", "def setup_target\n link_target_task project.target, (project.sources + [project.main]).map {|fn| objectsify fn }\n end", "def target_root\n APP_ROOT.join(\"deployments/#{target_id}\")\n end", "def target_dir\n without_parent_dir ? \".\" : package_name\n end", "def target\n @target or raise LifecycleException.new(\"can't call target until you materialize the resource\")\n end", "def path\n @bundle_filename\n end", "def source_output_dir(target_repo = \"\") # rubocop:disable Lint/DuplicateMethods\n @source_output_dir ||= output_dir(target_repo)\n end", "def dsym_path\n Dir[BuildCommandGenerator.archive_path + \"/**/*.dsym\"].last\n end", "def target_asset_path(asset)\n File.join('public', asset.folder, asset.filename)\n end", "def post_configure\n super\n @path = File.expand_path(path)\n end", "def test_path=(value)\r\n @test_path = value\r\n # recreate outputter\r\n if @file_outputter then\r\n @file_outputter.flush\r\n logger.outputters.delete(@file_outputter)\r\n @file_outputter = nil\r\n end\r\n\r\n return test_path\r\n end", "def output_path(object)\n raise NotImplementedError\n end", "def target=(target)\n @target = target\n loaded!\n end", "def target=(target)\n @target = target\n loaded!\n end", "def min_file_path\n compiled_path || current_file_path\n end", "def target\n \"\"\n end", "def build_path\n @build_path ||= \"#{@ant_path}/#{@config[:build_name]}\"\n end", "def target_path\n @target_path ||= \"app/views/activity_notification\"\n end", "def path\n http_url @store.rdoc.generator.class_dir\n end", "def remove_target(target)\n @cache[\"targets\"].delete(target)\n end", "def target_file\n resource.original_file || resource.intermediate_files.first\n end", "def path\n # We cache this, since it can be fairly expensive to run the command to figure out\n # what this should be.\n if @path.nil?\n outputproperty, errorproperty = @platform.next_output_properties\n @ant.java(:classname => 'com.tc.object.tools.BootJarSignature',\n :classpath => @module_set['dso-l1'].subtree('src').classpath(@build_results, :full, :runtime).to_s,\n :jvm => @jvm.java,\n :fork => true,\n :failonerror => true,\n :dir => @build_results.tools_home.to_s) do\n @ant.redirector(:outputproperty => outputproperty, :alwayslog => true)\n end\n\n # Parse the output in case the JVM prints out additional messages, only the line\n # that contains the actual boot jar name will be used.\n # On MacOSX the JVM sometimes prints \"HotSpot not at correct virtual address.\n # Sharing disabled.\" for instance. Without parsing the output, the name of the\n # bootjar file will be wrong.\n rawout = @ant.get_ant_property(outputproperty)\n out = rawout\n rawout.each do |line|\n if line =~ /^dso-boot-/\n out = line\n break\n end\n end\n @path = FilePath.new(@directory, out)\n end\n\n @path\n end", "def target\n Pathname(\"/etc/munin/plugins/#{name}\")\n end", "def assets_path() = self.class.name.demodulize.delete_suffix('Generator').underscore", "def path\n @path ||= @project.dir.path\n end", "def fullDestPath(destPath)\n\t'generated/' + destPath\nend", "def target(folder = nil)\n @target ||= File.expand_path(folder)\n end" ]
[ "0.7227858", "0.6816888", "0.6516648", "0.6437539", "0.636318", "0.63157594", "0.6267534", "0.6256255", "0.612292", "0.5992524", "0.5947253", "0.59334385", "0.59148294", "0.5802213", "0.57843894", "0.57562286", "0.5748186", "0.5716268", "0.57156", "0.57070684", "0.5683034", "0.56765735", "0.5675382", "0.5629852", "0.5619856", "0.5604983", "0.55163896", "0.5514425", "0.54841053", "0.5477843", "0.545159", "0.54504913", "0.5424798", "0.5422616", "0.5408314", "0.5368506", "0.5367444", "0.53628004", "0.5357849", "0.5338028", "0.5336875", "0.5334702", "0.5334702", "0.5328788", "0.5320631", "0.5318671", "0.53068656", "0.53065854", "0.5293956", "0.52905387", "0.52756506", "0.5270558", "0.52649033", "0.5258509", "0.5244703", "0.5231795", "0.52199525", "0.52183235", "0.5214175", "0.5200315", "0.5200315", "0.5198026", "0.5197863", "0.5196464", "0.51920056", "0.5189779", "0.51886255", "0.5186535", "0.5180734", "0.51775134", "0.51756406", "0.5158353", "0.5154663", "0.5154026", "0.5148988", "0.5148705", "0.51478094", "0.5136894", "0.513646", "0.5113759", "0.51084805", "0.51023775", "0.5099457", "0.50833", "0.5082151", "0.5079148", "0.5079148", "0.5070834", "0.5067095", "0.50589746", "0.50506145", "0.5036667", "0.5033061", "0.5018916", "0.5003556", "0.500304", "0.5000644", "0.49697226", "0.49620432", "0.49580157" ]
0.71371746
1
Accessor for build_path The build_path is a temporary directory where the release will be built
def build_path Pathname.new(config[:build_path]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_path\n @build_path ||= Pathname.new(source_dir).join(data['build_path'] || './build').to_s\n end", "def build_path\n @build_path ||= \"#{@ant_path}/#{@config[:build_name]}\"\n end", "def build_path\n Pathname.new(self.config[:build_path]) \n end", "def build_dir\n @build_dir ||= File.join(Crate.project.build_dir, name )\n end", "def __path__\n File.join(root, 'tmp', 'build')\n end", "def build_target_path\n File.join(destination, configuration[:build_target_path])\n end", "def get_build_dir\n if @build_dir\n File.join(@dirname, @build_dir)\n else\n @dirname\n end\n end", "def get_build_dir\n if @build_dir\n File.join(@dirname, @build_dir)\n else\n @dirname\n end\n end", "def build_directory\n File.expand_path(config['build_directory'])\n end", "def build_dir\n File.expand_path(\"#{Config.build_dir}/#{project.name}\")\n end", "def output_path\n \"build\"\n end", "def build_root()\n \"#{project_root}/build\"\n end", "def build\n\t@built_gem_path ||= @helper.build_gem\nend", "def release_path\n @release_path ||= Pathname.new(source_dir).join(data['release_path'] || './release').to_s\n end", "def build_root\n Pathname.new(ENV[\"OBJDIR\"] || \"build\")\n end", "def build_path\n end", "def build_dir\n Rscons.application.build_dir\n end", "def component_build_path(cmp)\n File.join WORK_PATH, 'build', cmp\nend", "def component_build_path(cmp)\n File.join WORK_PATH, 'build', cmp\nend", "def release_path\n ::File.join(install_path, artifact_name, artifact_version)\n end", "def path\n @path ||= @project.dir.path\n end", "def build_archive_dir\n out = config_source['build-archive-dir']\n out = nil if (out != nil && out.downcase == 'none')\n out = FilePath.new(out) unless out.nil?\n out\n end", "def build_dir\n Puppet::Forge::Cache.base_path + \"tmp-unpacker-#{Digest::SHA1.hexdigest(@filename.basename.to_s)}\"\n end", "def to_build_rel pn\n pn.relative_path_from(build_dir)\n end", "def build_file\n @file = \"#{build_publish_date}-#{build_file_name}.#{build_tags}.#{build_filter}\"\n end", "def build_output_dir\n root.join(public_dir, public_output_dir)\n end", "def build_info_dir\n File.join base_dir, \"build_info\"\n end", "def compiled_path; end", "def build_erb_path\n @build_erb_path ||= \"#{ANT_TEMPLATE_FILEPATH}/#{ANT_BUILD_ERBNAME}\"\n end", "def framework_path\n File.join(config.build_products_dir, name)\n end", "def pathDist\n\t\"../../\" + distPackageName + \"_\" + version + \"/\"\nend", "def build!\n build_to self[:build_path]\n end", "def project_path\n if(File.directory?(@library_path))\n # library is source dir\n File.join(project_lib, clean_name)\n else\n # library is a binary (like swc, jar, etc)\n File.join(project_lib, File.basename(@file_target.archive_path))\n end\n end", "def build_to_temp_dir\n @builder.build_project\n\n # Copy build files to temporary directory\n @task.shell.mute do\n @task.directory @project.build_path, ::File.join(@project.package_path, @package_name), :force => true\n end\n end", "def generate_build_location(id)\n \"#{@config.output_dir}#{@config.prefix}/#{id}\"\n end", "def stow_buildout_path\n \"#{node['stow']['path']}/stow#{pkg_delim}#{node['stow']['version']}\"\n end", "def makePath\n\t\t\tbuildMgr.effective(filename).dirname.mkpath\n\t\tend", "def destination_rel_dir\n replace_build_path(super)\n end", "def _prepare_dir(project)\n tmp_path = Rails.root.join(\"tmp/git_checkout/#{Rails.env}/#{project.id}/#{project.path_with_namespace}\")\n tmp_path.mkpath unless tmp_path.exist?\n\n return tmp_path\n end", "def path\n File.expand_path File.join(basepath, version_dir, basename)\n end", "def destination\n @destination ||= File.join(tmpdir, File.basename(configuration[:release_path]))\n end", "def build_script\n File.join(data_dir, 'build-script')\n end", "def build_path *args\n Presto::Utils.build_path *args\n end", "def toBuildDirFile(filename)\n\t\treturn File.join(@buildDestination, File.basename(filename))\n\tend", "def carthage_build_path(platform, framework)\n return \"#{carthage_build_dir_for_platform(platform)}/#{framework}\"\nend", "def compiled_path=(path); end", "def within_build_path(&block)\n Dir.chdir app.config.build_dir do\n yield\n end\n end", "def min_file_path\n compiled_path || current_file_path\n end", "def get_project_path\n return File.absolute_path File.join(root_dir, src)\n end", "def workdir\n result = base.join('cache')\n result.mkpath\n result\n end", "def destination\n #configuration[:release_path]\n @destination ||= File.join(tmpdir, File.basename(configuration[:release_path]))\n\n end", "def work_path\n @work_path ||= tmp_path.join(name)\n end", "def make_carthage_build_path(name, platform)\n return \"Carthage/Build/#{platform}/#{name}\"\nend", "def repo_path\n @repo.dirstate.copy_map[@path] || @path\n end", "def initialize(build_dir)\n @build_dir = build_dir\n end", "def localPath(taskName)\n self.pipeline.pipe_root + \"/build/prod/\" + taskName\n end", "def repo_path\n @path\n end", "def path\n @path ||= File.dirname @config_file\n end", "def path\n File.join @proj_path_base, @proj_filename\n end", "def inspect_build_state\n inspect_build_to self[:build_path]\n end", "def pathDistSource\n\tpathDist + \"source/\"\nend", "def workfile_path(for_file = original_filename)\n # To be safe, keep this directory outside of the the cache directory\n # because calling CarrierWave.clean_cache_files! will remove any files in\n # the cache directory.\n File.join(work_dir, cache_id, version_name.to_s, for_file)\n end", "def build_dist_path(item)\n sub_build_dir = File.join(@config.build_dir, item.name)\n return Dir[File.join(sub_build_dir, \"#{item.name}-[0-9.]*.tar.gz\")][0]\n end", "def path\n File.join(@base, @target)\n end", "def path\n # We cache this, since it can be fairly expensive to run the command to figure out\n # what this should be.\n if @path.nil?\n outputproperty, errorproperty = @platform.next_output_properties\n @ant.java(:classname => 'com.tc.object.tools.BootJarSignature',\n :classpath => @module_set['dso-l1'].subtree('src').classpath(@build_results, :full, :runtime).to_s,\n :jvm => @jvm.java,\n :fork => true,\n :failonerror => true,\n :dir => @build_results.tools_home.to_s) do\n @ant.redirector(:outputproperty => outputproperty, :alwayslog => true)\n end\n\n # Parse the output in case the JVM prints out additional messages, only the line\n # that contains the actual boot jar name will be used.\n # On MacOSX the JVM sometimes prints \"HotSpot not at correct virtual address.\n # Sharing disabled.\" for instance. Without parsing the output, the name of the\n # bootjar file will be wrong.\n rawout = @ant.get_ant_property(outputproperty)\n out = rawout\n rawout.each do |line|\n if line =~ /^dso-boot-/\n out = line\n break\n end\n end\n @path = FilePath.new(@directory, out)\n end\n\n @path\n end", "def wrap_xcodebuild\n require 'fileutils'\n @wrapped_xcodebuild_path ||= File.join(Gym::ROOT, \"lib/assets/wrap_xcodebuild/xcbuild-safe.sh\")\n end", "def initialize(build_path, cache_path=nil)\n @build_path = build_path\n @cache_path = cache_path\n end", "def initialize(build_path, cache_path=nil)\n @build_path = build_path\n @cache_path = cache_path\n end", "def build_workspace_dir(root_dir, dirname, uuid)\n \"/#{root_dir}/#{dirname}-#{uuid}\"\nend", "def current_path\n ::File.join(install_path, artifact_name, 'current')\n end", "def temporary_file\n # Ensure this is unique so that is doesn't clash with parallel compile processes\n Pathname.new \"#{Origen.root}/tmp/compiler_#{Process.pid}_#{Time.now.to_f}\"\n end", "def android_build_root()\n \"#{build_root}/android\"\n end", "def build\n output_filepath = \"#{self.build_path}/#{OUTPUT_FILENAME}\"\n\n Dir.chdir \"#{self.build_path}\"\n\n # Need 1.9.4 version in order have file encoding\n cmd = \"#{ENV['ant']} #{@config[:build_name]}\"\n #cmd = \"/usr/local/bin/ant #{@config[:build_name]}\"\n\n log \"Running '#{cmd}' in #{self.build_path}\"\n output = system(cmd)\n\n return output_filepath\n end", "def generate_build\n filename = \"#{self.build_path}/#{ANT_BUILD_NAME}\"\n log \"Writing build xml to #{filename}\"\n File.open(filename, 'w') do |f|\n f.write(self.build_doc)\n f.close\n end\n filename\n end", "def release_path\n @config[:remote_path]\n end", "def remote_tmp_release_dir\n @remote_tmp_release_dir ||= File.join(remote_dir, File.basename(destination))\n end", "def file_path\n FileUtils.mkdir_p @path unless Dir.exist? @path\n\n @path\n end", "def path(key = '')\n @path ||= File.join(File.expand_path(@options[:repo]), key)\n end", "def path(key = '')\n @path ||= File.join(File.expand_path(@options[:repo]), key)\n end", "def version_path\n @version_path ||= \"lib/#{namespaced_path}/version.rb\"\n end", "def iphone_build_root()\n \"#{build_root}/iphone\"\n end", "def build_root\n self.class.build_root.join(name)\n end", "def path\n @path ||= Pathname.new(dir) + filename\n end", "def build_path\n @path_values.inject(base_value){|uri,path| uri.merge URI::Generic.build(path: path) }.path\n end", "def prep_build\n stdout.out_success(\"\\nPreparing build dir at: '#{settings['build_dir']}'\")\n stdout.verbose(\"Removing build dir at: #{settings['build_dir']}\")\n FileUtils.rm_rf(settings['build_dir'])\n # create the build dir\n stdout.verbose(\"Creating build dir at: #{settings['build_dir']}\")\n FileUtils.mkdir(settings['build_dir'])\n end", "def update_buildfile\n buildfile = change_version { |version| # THIS_VERSION minus SNAPSHOT\n resolve_next_version(this_version) # THIS_VERSION\n }\n File.open(Rake.application.rakefile.to_s, 'w') { |file| file.write buildfile }\n end", "def pkg_dir\n @pkg_dir ||= File.join( self.build_dir, \"#{name + ( version ? \"-#{version}\" : \"\" ) }\" )\n end", "def remote_buildparams(host, build)\n params_file = build.config_to_yaml\n params_file_name = File.basename(params_file)\n params_dir = rand_string\n rsync_to(params_file, host, \"/tmp/#{params_dir}/\")\n \"/tmp/#{params_dir}/#{params_file_name}\"\nend", "def cache_repository_path\n File.absolute_path(File.join(Rails.root, 'cache', cached_directory))\n end", "def disk_path\n project.full_path\n end", "def build_information_file\n dir = FilePath.new(@build_dir, \"cruisecontrol_integrated_xml_files\").ensure_directory\n FilePath.new(dir, \"build-information.xml\")\n end", "def build_store_path\n prefix = ENV['RST_DATA'] || RST::STOREPATH\n env = ENV['RST_ENV'] || 'development'\n _dir = File.join( prefix, env )\n FileUtils.mkdir_p(_dir)\n File.join(_dir, filename)\n end", "def path\n Rails.root.join(ROOT, type, name, executable).to_s\n end", "def update_buildfile\n buildfile = change_version { |version| # THIS_VERSION minus SNAPSHOT\n resolve_next_version(this_version) # THIS_VERSION\n }\n File.open(version_file, 'w') { |file| file.write buildfile }\n end", "def dependency_cache_path\n self.dependency_cache_path = tmp_path unless defined?(@dependency_cache_path)\n @dependency_cache_path\n end", "def workdir\n @workdir ||= ::File.join(::File.dirname(@repo_dir), 'download')\n end", "def render_path\n @render_path ||= generate_file_name(@site.config[\"url\"], @site.config[\"baseurl\"])\n end", "def version_dir\n products_dir = Product.version_directory\n product_dir = File.join(products_dir, @product.name)\n File.join(product_dir, @version.to_s)\n end", "def bits_full_local_path\n File.join(version_dir, BITS_FILENAME)\n end", "def run_dir\n run_base + \"/g4.#{geant_version}_cms_#{cmssw_version}/#{build_type}/CMSSW_#{cmssw_version}/src\"\n end" ]
[ "0.843737", "0.8229959", "0.79785204", "0.7757712", "0.75645447", "0.74710155", "0.74291223", "0.74291223", "0.7265817", "0.7152494", "0.71305054", "0.6964996", "0.69643474", "0.6896351", "0.6879736", "0.68020535", "0.6753839", "0.6710013", "0.6710013", "0.65743065", "0.654943", "0.6458871", "0.6432612", "0.6429959", "0.64238816", "0.6363233", "0.6320749", "0.6264682", "0.6180386", "0.6149939", "0.6142747", "0.60993725", "0.6083443", "0.60817057", "0.6080557", "0.6071224", "0.60504967", "0.6044854", "0.6029538", "0.60078406", "0.6002359", "0.5976596", "0.59687245", "0.59614706", "0.5960864", "0.5952368", "0.5950939", "0.594509", "0.5934295", "0.59178334", "0.59175783", "0.58921844", "0.587751", "0.58541214", "0.58450973", "0.5837219", "0.5829896", "0.5826841", "0.58198243", "0.5780394", "0.5774429", "0.5746688", "0.5742997", "0.57251555", "0.5710097", "0.5707408", "0.570002", "0.570002", "0.5686744", "0.5668125", "0.56640154", "0.56557775", "0.5651835", "0.5648266", "0.5632323", "0.56246716", "0.5624082", "0.5623626", "0.5623626", "0.56077045", "0.5603957", "0.56001425", "0.5599022", "0.5586405", "0.5582965", "0.5579821", "0.5577991", "0.55708086", "0.5544674", "0.5538356", "0.5535909", "0.5534627", "0.5529997", "0.55282605", "0.55270815", "0.552411", "0.5515075", "0.5507973", "0.5507967", "0.5507221" ]
0.79636157
3
Accessor for source_path The source path is the root of the project
def source_path Pathname.new(config[:source_path]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def source_path\n Pathname.new(self.config[:source_path])\n end", "def source_path\n source[:path]\n end", "def source_path\n File.expand_path source unless source.nil?\n end", "def source_path; end", "def source_dir\n @config.source_dir\n end", "def source_root\n File.expand_path(options[:source])\n end", "def source_root\n @source_root ||= Pathname.new(File.expand_path('../../', __FILE__))\n end", "def source_root\n @source_root ||= Pathname.new(File.expand_path(\"..\", __dir__))\n end", "def source_path(arg=nil)\n set_or_return(\n :source_path,\n arg,\n :kind_of => [ String ]\n )\n end", "def source_path\n return @source_path if !@source_path.nil?\n @source_path = Photo.photos_root_list.find{|path| path[self.path]}\n end", "def src_path\n File.dirname(__FILE__)\nend", "def src_path\n File.dirname(__FILE__)\nend", "def source_dir\n Dir.pwd\nend", "def source\n File.read(source_path)\n end", "def source_file\n return @source_file\n end", "def source_file\n @source_location[0]\n end", "def path\n @path ||= @project.dir.path\n end", "def source\n @source ||=\n Dassets.config.sources.select{ |source|\n @file_path =~ /^#{slash_path(source.path)}/\n }.last\n end", "def source_dir\n @_source_dir ||= File.join(working_dir, 'src')\n create_if_missing(@_source_dir)\n @_source_dir\n end", "def source_dir\n @_source_dir ||= File.join(working_dir, 'src')\n create_if_missing(@_source_dir)\n @_source_dir\n end", "def source_dir\n @_source_dir ||= File.join(working_dir, 'src')\n create_if_missing(@_source_dir)\n @_source_dir\n end", "def src_path(path)\n File.join(@git.dir.to_s, path)\n end", "def source_paths\n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n [__dir__]\nend", "def source_paths\n [__dir__]\nend", "def source_location\n source_component.source_location\n end", "def source_file\n @source_file || get_source_file\n end", "def source_access_path\n _access_path(source_annotations)\n end", "def src_path(path)\n app_path('src/' + path)\n end", "def sources\n source_paths\n end", "def get_project_path\n return File.absolute_path File.join(root_dir, src)\n end", "def source\n \"#{source_repo}/#{source_branch}\"\n end", "def file_with_source_path(source_path)\n source_path = source_path.unicode_normalize\n @source_path_to_file[source_path] || @abs_source_path_to_file[source_path]\n end", "def path\n asset_source_path\n end", "def path\n asset_source_path\n end", "def source_path\n sp = []\n\n Tml.session.block_options_queue.each do |opts|\n next unless hash_value(opts, :source)\n sp << hash_value(opts, :source)\n end\n\n sp = sp.reverse\n sp.unshift(Tml.session.current_source)\n\n sp.join(Tml.config.source_separator)\n end", "def source\n @source ||= begin\n source_opts = {\n :folder => File.join(options(:root), options(:source)),\n :cache => Rack::Sprockets.config.cache? ? cache : nil,\n :compress => Rack::Sprockets.config.compress,\n :secretary => {\n :root => options(:root),\n :load_path => options(:load_path),\n :expand_paths => options(:expand_paths)\n }\n }\n Source.new(path_info_resource, source_opts)\n end\n end", "def pathSourceDemo\n\t\"./demo/\"\nend", "def source_paths\n[File.join(File.expand_path(File.dirname(__FILE__)),'rails_root')]\nend", "def source\n @source ||= begin\n source_opts = {\n :folder => File.join(options(:root), options(:source)),\n :cache => Rack::Sprockets.config.cache? ? cache : nil,\n :compress => Rack::Sprockets.config.compress,\n :secretary => {\n :root => options(:root),\n :load_path => options(:load_path),\n :expand_paths => options(:expand_paths)\n }\n }\n Source.new(path_resource_name, source_opts)\n end\n end", "def source_location()\n #This is a stub, used for indexing\n end", "def source_paths\n Array(super) +\n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n Array(super) +\n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n Array(super) +\n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n Array(super) +\n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n Array(super) +\n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n Array(super) +\n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n Array(super) + \n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n Array(super) + \n [File.expand_path(File.dirname(__FILE__))]\nend", "def source_paths\n Array(super) + \n [File.expand_path(File.dirname(__FILE__))]\nend", "def pathDistSource\n\tpathDist + \"source/\"\nend", "def local_source\n @local_source ||= File.join( build_dir, File.basename( upstream_source.path ) )\n end", "def source(folder = nil)\n @source ||= File.expand_path(folder)\n end", "def source_paths\n source_path = [$RR_PATH] + Array(super)\n # say \"source path = #{source_path}\", :magenta\n source_path\nend", "def source\n f = File.open(File.join(root_path, path))\n data = f.read\n f.close\n data\n end", "def source_path\n src = File.join *[\n sandbox.path,\n ('..' if sandbox.multiruby?),\n 'src'\n ].compact\n\n FileUtils.mkdir_p src\n\n src\n end", "def source\n @source\n end", "def source\n @source\n end", "def source_path\n File.join(File.expand_path('../../', __FILE__), 'vendor', 'sg_node_mapper', 'nodemapper.js')\n end", "def source_path options={}\n @source_path ||= if options[:relative]\n File.join collection_path, \"#{id}.md\"\n else\n File.join Rails.root, collection_path, \"#{id}.md\"\n end\n end", "def external_path_for_source\n @external_path_for_source ||= File.join('source', 'external_document', external_name)\n end", "def relative_to_source(properties, key)\n path = properties[key]\n base = @source_dir ? @source_dir : ''\n\n return nil if path == nil\n return path if Pathname.new(path).absolute?\n return File.expand_path(File.join(base, path))\n end", "def source_root\n FilePath.new(build_module.root, name).canonicalize\n end", "def compute_source_path(source, ext)\n asset_for(source, ext)\n end", "def source_file=(value)\n @source_file = value\n end", "def src_path\n ENV[\"GOPATH\"]\nend", "def source\n @source ||= config_params(:source) || self.class.const_get(:DEFAULT_SOURCE)\n end", "def source\n @source ||= config_params(:source) || self.class.const_get(:DEFAULT_SOURCE)\n end", "def srcdir_root\n @srcdir\n end", "def srcdir_root\n @srcdir\n end", "def source_paths\n Array(super) + [__dir__]\nend", "def determine_path\n if source_line.file == SourceLine::DEFAULT_FILE\n return source_line.file\n end\n\n full_path = File.expand_path(source_line.file)\n pwd = Dir.pwd\n\n if full_path.start_with?(pwd)\n from = Pathname.new(full_path)\n to = Pathname.new(pwd)\n\n return from.relative_path_from(to).to_s\n else\n return full_path\n end\n end", "def source_location; end", "def source_paths\n Array(super) + \n [File.join(File.expand_path(File.dirname(__FILE__)),'rails_root')]\nend", "def source_paths\n Array(super) + [File.join(File.expand_path(File.dirname(__FILE__)),'rails_root')]\nend", "def get_source(workdir)\n if @url\n @source = Vanagon::Component::Source.source(@url, @options, workdir)\n @source.fetch\n @source.verify\n @extract_with = @source.respond_to?(:extract) ? @source.extract(@platform.tar) : ':'\n @cleanup_source = @source.cleanup if @source.respond_to?(:cleanup)\n @dirname = @source.dirname\n\n # Git based sources probably won't set the version, so we load it if it hasn't been already set\n @version ||= @source.version\n else\n warn \"No source given for component '#{@name}'\"\n\n # If there is no source, we don't want to try to change directories, so we just change to the current directory.\n @dirname = './'\n\n # If there is no source, there is nothing to do to extract\n @extract_with = ':'\n end\n end", "def srcdir_root\n @srcdir\n end", "def source_for(path)\n read(path, false)\n end", "def srcdir_root\n @ardir\n end", "def source_path\n if @site.respond_to?(:in_source_dir)\n @site.in_source_dir(\"_app.yaml\")\n else\n Jekyll.sanitized_path(@site.source, \"_app.yaml\")\n end\n end", "def repo_path\n @path\n end", "def source\n @_source ||= \"#{@rf['directory']}#{base_filename}.#{format}\"\n end", "def app_source\n return @app_source if @app_source\n\n Find.find(node_modules_bin) {|path| @app_source = path if path =~ /jscs$/ }\n @app_source\n end", "def source\n return @source\n end", "def source\n return @source\n end", "def sources_license_path(sources)\n common_prefix = Pathname.common_prefix(*sources).to_path\n\n # don't allow the repo root to be used as common prefix\n # the project this is run for should be excluded from the manifest,\n # or ignored in the config. any license in the root should be ignored.\n return common_prefix if common_prefix != Licensed::Git.repository_root\n\n # use the first source file as the license path.\n sources.first\n end", "def get_source\n raise 'check this!'\n # _reflector = new ReflectionClass($this);\n # $file = _reflector.filename;\n # if (!file_exists($file)) {\n # return;\n # end\n # $source = file($file, FILE_IGNORE_NEW_LINES);\n # array_splice($source, 0, _reflector.getEndLine());\n # $i = 0;\n # while (isset($source[$i]) && '/* */' == substr_replace($source[$i], '', 3, -2)) {\n # $source[$i] = str_replace('*//* ', '*/', substr($source[$i], 3, -2));\n # ++$i;\n # end\n # array_splice($source, $i);\n # return implode(\"\\n\", $source);\n end", "def source_files; end", "def source\n return BASE_SOURCE_URL + '/' + repo_id unless path_extension\n BASE_SOURCE_URL + '/' + repo_id + '/' + path_extension.sub(%r{^\\s*/}, '').sub(%r{/\\s*$}, '')\n end", "def source_path\n File.expand_path \"sitemap.xml\", File.dirname(__FILE__)\n end", "def source\n @source ||= File.join(Rails.root, 'config', 'settler.yml') if defined?(Rails)\n @source\n end", "def source\n @source || load_file_contents\n end", "def compiled_path; end", "def source_url\n settings.source_url\n end", "def source\n raise NotImplementedError\n end", "def source_paths\n Array(super) +\n [File.join(File.expand_path(File.dirname(__FILE__)),'rails_root')] +\n [File.join(File.expand_path(File.dirname(__FILE__)),'rails_root', 'config')]\nend", "def src\n\n sdk_path = find_sdk\n unless sdk_path == nil\n SDK_SRC_PATHS.each { |sp|\n p = sdk_path+sp\n return p if File.directory? p\n }\n end\n\n nil\n end" ]
[ "0.8608426", "0.8587065", "0.8257665", "0.8114052", "0.7738179", "0.75983936", "0.7559179", "0.75341105", "0.75250554", "0.73793215", "0.73064816", "0.73064816", "0.72715414", "0.72698927", "0.7246265", "0.7181403", "0.71596104", "0.7150219", "0.7124016", "0.7124016", "0.7124016", "0.7115357", "0.7111071", "0.7111071", "0.7111071", "0.7111071", "0.71091884", "0.71091884", "0.70843494", "0.70822436", "0.7064183", "0.7001556", "0.6990393", "0.6987953", "0.6978956", "0.69648844", "0.69558626", "0.69558626", "0.6955724", "0.69393456", "0.6920827", "0.69024867", "0.6899566", "0.687778", "0.6852871", "0.6852871", "0.6852871", "0.6852871", "0.6852871", "0.6852871", "0.6847385", "0.6847385", "0.6847385", "0.68401635", "0.68388766", "0.68318534", "0.6831804", "0.68266547", "0.68116045", "0.67749095", "0.67749095", "0.67477006", "0.6729474", "0.67273", "0.6726924", "0.67227495", "0.6718431", "0.6648386", "0.6616069", "0.66002715", "0.66002715", "0.6598389", "0.6598389", "0.6570955", "0.65614545", "0.6553765", "0.65429986", "0.6531491", "0.6524071", "0.6488906", "0.6478372", "0.645375", "0.6446116", "0.6443775", "0.6436498", "0.6430169", "0.64249754", "0.64249754", "0.64156526", "0.64056265", "0.64025486", "0.6377399", "0.6377167", "0.6366605", "0.63524586", "0.63445795", "0.6337595", "0.6336092", "0.6332811", "0.6328137" ]
0.8483697
2
Get the current SCM object
def scm(force = false) return @_scm if @_scm && !force case config[:scm] when :git @_scm = Release::Scm::Git.new(path: source_path) when :fixed @_scm = Release::Scm::Fixed.new else raise "Unknown SCM #{options[:scm].inspect}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scm\n @defaults[ :scm ] ||= SCM::Git.new\n end", "def scm\n if(@scm.nil?)\n path = path_to_git\n raise GitTaskError.new(\"We don't appear to be inside of a git repository\") if path.nil?\n @scm = Git.open(path)\n end\n\n @scm\n end", "def scm(force = false)\n return @_scm if @_scm && !force\n \n case self.config[:scm]\n when :git\n @_scm = Release::Scm::Git.new(:path => self.source_path)\n else\n raise \"Unknown SCM #{options[:scm].inspect}\"\n end\n end", "def scm config\n # no engine specified\n if !config\n return nil\n end\n\n # git backend\n if config['scm'] == 'git'\n return Git.new(self)\n end\n end", "def scm_value\n self\n end", "def scm=(scm)\n @scm = scm\n end", "def scm\n @scm = menu_with_default \"Which SCM to use for deployment\",\n [:git,:passthrough ], :git\n\n case @scm\n when :passthrough\n %W{ capistrano-deploy-scm-passthrough capistrano-improved-rsync-with-remote-cache}.each do |g|\n append_to_file \"Gemfile\", \"gem '#{g}', :group => :development\\n\"\n end\n end\n @scm\n end", "def get_scm_data(ref = @config[:ref])\n @_version = scm_version(ref) || \"\"\n @_date = scm_date(ref) || Time.now\n end", "def current_workspace\n get_ws = Proc.new do\n params['workspace_id'] ? \n Workspace.find(params['workspace_id'].to_i) : current_user.private_workspace\n end\n \n if @workspace\n # Hack: Workspace may be \"Workspace.new\"\n return @workspace if @workspace.id\n return get_ws.call\n end\n return @current_object if @current_object && @current_object.class == Workspace\n @workspace = get_ws.call\n end", "def version\n get_scm_data if @_version.nil?\n @_version\n end", "def current\n env[REPO] ||= new(env)\n end", "def get_current_object\n if @current_object.nil?\n @parent.get_current_object\n else\n @current_object\n end\n end", "def context\n unless @instance_context\n @instance_context = WorkspaceContext.new(@version , @params['sid'])\n end\n @instance_context\n end", "def get_scm(organization, scm, opts = {})\n data, _status_code, _headers = get_scm_with_http_info(organization, scm, opts)\n data\n end", "def current\n self.versioned? ? self.versions.current.instance : self\n end", "def current_branch\n self.lib.branch_current\n end", "def get_current_client\n get_current_hub&.current_client\n end", "def rb2scm(obj)\n case obj\n when NilClass\n SCM_EMPTY_LIST\n when FalseClass, TrueClass\n rb2scm_bool(obj)\n when Symbol\n rb2scm_symbol(obj)\n when Numeric\n rb2scm_number(obj)\n when Char\n rb2scm_char(obj)\n when String\n rb2scm_string(obj)\n when IO\n rb2scm_port(obj)\n when Pair\n rb2scm_pair(obj)\n when Array\n rb2scm_vector(obj)\n when ScmObject\n # nothing to do, just return\n obj\n else\n raise ArgumentError, \"not supported: %s\" % obj.class\n end\n end", "def get_current_owner\n sd = get_security_descriptor\n\n sd&.owner\n end", "def rpc_current_workspace\n db_check\n { \"workspace\" => self.framework.db.workspace.name, \"workspace_id\" => self.framework.db.workspace.id }\n end", "def current\n R10K::Git::Head.new('HEAD', self)\n end", "def current_company\n Company.find(1)\n end", "def current\n add_breadcrumb :current\n @sprint = @project.sprints.find_by_active(true)\n end", "def scm_list?; SCM_FALSE; end", "def get_current_scope\n get_current_hub&.current_scope\n end", "def current\n all_contexts[Thread.current.object_id]\n end", "def scm_default\n if File.exist? '.git'\n :git\n elsif File.exist? '.accurev'\n :accurev\n elsif File.exist? '.bzr'\n :bzr\n elsif File.exist? '.cvs'\n :cvs\n elsif File.exist? '_darcs'\n :darcs\n elsif File.exist? '.hg'\n :mercurial\n elsif File.exist? '.perforce'\n :perforce\n elsif File.exist? '.svn'\n :subversion\n else\n :none\n end\n end", "def current_branch\n git.branch.name\n end", "def current\n @env.first\n end", "def scm_string?; SCM_FALSE; end", "def system\n JenkinsApi::Client::System.new(self)\n end", "def system\n JenkinsApi::Client::System.new(self)\n end", "def object\n __getobj__\n end", "def current\n @current ||= Current.new(@session)\n end", "def scm_default\n if File.exist? '.git'\n :git\n elsif File.exist? '.accurev'\n :accurev\n elsif File.exist? '.bzr'\n :bzr\n elsif File.exist? '.cvs'\n :cvs\n elsif File.exist? '_darcs'\n :darcs\n elsif File.exist? '.hg'\n :mercurial\n elsif File.exist? '.perforce'\n :perforce\n elsif File.exist? '.svn'\n :subversion\n else\n :none\n end\n end", "def current_client\n @current_client ||= @finder.call\n end", "def current_branch\n repo.branches.find(&:head?)\n end", "def get_application_code\n case $scm_type\n when 'git' then\n export_source_from_git $scm_path\n $revision = git_get_revision\n end\nend", "def git\n # log \"Thread.current[:repo] nil? \" + Thread.current[:repo].nil?.to_s\n Thread.current[:repo] ||= clone(ARGV[0], ARGV[1])\n Thread.current[:repo]\n end", "def current_branch\n `git symbolic-ref --short -q HEAD`.chomp\n end", "def current_subcom\n @current_subcom ||= Subcommunity.find(params[:subcommunity_id])\n end", "def current_branch\n @current_branch ||= `git rev-parse --abbrev-ref HEAD`.strip\n end", "def new_client\n Svn::Client::Context.new\n end", "def vcs_type\n @vcs_type ||= (\n dir = nil\n Dir.chdir(root) do\n dir = Dir.glob(\"{.git,.hg,.svn,_darcs}\").first\n end\n dir[1..-1] if dir\n )\n end", "def sys_source\n @sys_source ||= MakeMakefile.find_executable(\"jscs\")\n end", "def workspace\n @cue_list.workspace\n end", "def current(cmd_type, cmd_str)\n @full_path ||= File.expand_path( File.dirname(__FILE__) ).gsub(/\\/config/, '')\n @curr_path ||= @full_path['/releases/'] ? @full_path.gsub(/releases\\/\\d+/, 'current') : @full_path \n \n send(cmd_type, cmd_str, :path => @curr_path)\nend", "def current_weblab\n return $current_weblab\n end", "def open(scm, options={}, &block) #:yield: io\n scm.open(self, options, &block)\n end", "def context\n unless @instance_context\n @instance_context = CpsContext.new(@version, )\n end\n @instance_context\n end", "def current_branch\n repo.branches.find(&:head?)\n end", "def current_live\n self.versioned? ? self.versions.current_live.instance : self\n end", "def current_workplace\n if @workplace && current_admin\n @workplace.name\n else#fail safe\n end \n end", "def get_current_owner #:doc:\n self.send \"current_#{owner_class.name.underscore}\".to_sym\n end", "def current\n Thread.current.thread_variable_get(:reactor)\n end", "def system\n return @system\n end", "def fetch_workspace\n # @workspace = current_path?(root_path) ? current_user.workspaces.first : Workspace.find(params[:workspace_id])\n @workspace = request.url == root_url ? current_user.workspaces.first : current_user.workspaces.find(params[:workspace_id])\n end", "def initialize\n @current = LIFECYCLE.first\n end", "def current_server\n @_current_server\n end", "def current_server\n @_current_server\n end", "def current_object\n @current_object ||= if plural?\n current_model.find(current_param)\n else\n parent_objects[-1].send(instance_variable_name)\n end\n end", "def get_company\n @company ||= current_company\n end", "def current_company\n Company.find(:first)\nend", "def current_editor\n @current_editor = User.find_by_id(locked_by)\n return _('unknown') if @current_editor.nil?\n @current_editor.name\n end", "def get_contract_current()\n self.class.get(\"/api/contracts/current\", :basic_auth => @auth)\n end", "def current_branch\n `git symbolic-ref --short HEAD`.strip\n end", "def project \n organizing_city.current_project\n end", "def repo\n @repo\n end", "def current_site\n @site = Site.first\n end", "def current_revision\n @svninfo.current_revision\n end", "def current_branch\n Dir.chdir @root do\n cmd = \"git rev-parse --abbrev-ref HEAD\"\n stdout, stderr, status = Open3.capture3 cmd\n if status != 0\n case stderr\n when /unknown revision/\n raise Error, \"could not determine branch of repo with no commits\"\n when /Not a git repository/\n raise NotARepositoryError\n else\n raise Error, stderr\n end\n end\n return stdout.strip\n end\n end", "def context\n unless @instance_context\n @instance_context = CompositionContext.new(@version, @params['sid'], )\n end\n @instance_context\n end", "def current\n LOOPS[Thread.current]\n end", "def scm_null?; SCM_FALSE; end", "def current_editor\n @current_editor = User.find_by_id(locked_by)\n return I18n.t('unknown') if @current_editor.nil?\n @current_editor.name\n end", "def rb2scm_string(str)\n ScmString.new(str)\n end", "def current_object\n unless self.controller.respond_to? :current_object\n raise ArgumentError, \"#{self.controller} expected to define current_object. Example: UsersController.current_object should return a @user\"\n end\n self.controller.send(:current_object)\n end", "def resolve_current\n resolve Gem::Resolver::CurrentSet.new\n end", "def scm_set_car!(scm_obj)\n @scm_car = scm_obj\n SCM_UNDEF\n end", "def model_class\n ::Ci::Build\n end", "def repo\n settings.repo\n end", "def current_editor\n @current_editor || creator\n end", "def get_site\n controller.send(:current_site)\n end", "def current_subscription\n self.subscriptions.current.first\n end", "def currentbranch\n %x{git branch | grep \"*\" | sed \"s;* ;;\"}.squish\n end", "def branch_name\n $repo.current_branch\n end", "def client\n Contentful::Management::Client.shared_instance\n end", "def current\n return nil if @temporary == :none\n return nil if @disabled\n\n name = @temporary || @current ||= if Origen.app.session.origen_core[:default_plugin]\n Origen.app.session.origen_core[:default_plugin]\n elsif Origen.app.config.default_plugin && !Origen.app.session.origen_core[:default_plugin_cleared_by_user]\n Origen.app.config.default_plugin\n end\n\n find { |p| p.name.to_sym == name } if name\n end", "def status\n GitStatus.new(self)\n end", "def current_job\n return @job_current\n end", "def current_cookbook\n @current_cookbook ||= Cookbook.find session[:cookbook_id] if session[:cookbook_id]\n end", "def current_branch\n return @branch unless @branch.blank?\n @branch = case @svninfo.url\n when /trunk/ then \"trunk\"\n when /branches\\/private\\/([^\\/]+)/ then $1\n when /branches\\/([^\\/]+)/ then $1\n when /tags\\/([^\\/]+)/ then $1\n else @config_source[\"branch\"]\n end \n @branch || \"unkown\"\n end", "def vcs\n @vcs ||= Nanoc::Extra::VCSes::Dummy.new\n end", "def resolve_current\n resolve DependencyResolver::CurrentSet.new\n end", "def current_site\n @current_site ||= Site.find_by_subdomain! subdomain\n end", "def current_version\n self.historical? ? self.class.find(self.id) : self\n end", "def current_version\n self.historical? ? self.class.find(self.id) : self\n end", "def current\n Thread.current[:CURRENT_CONTROLLER]\n end", "def workspace\n\t\tself.datastore['WORKSPACE'] ||\n\t\t\t(framework.db and framework.db.active and framework.db.workspace and framework.db.workspace.name)\n\tend", "def date\n get_scm_data if @_date.nil?\n @_date\n end" ]
[ "0.7458993", "0.6901301", "0.6887394", "0.65891117", "0.65846723", "0.653226", "0.6157386", "0.6155567", "0.61297804", "0.60138744", "0.59655905", "0.58169913", "0.5761971", "0.5724984", "0.5682817", "0.5640998", "0.55145156", "0.5508112", "0.5503778", "0.5501113", "0.5499637", "0.54855746", "0.54676753", "0.5466487", "0.5444447", "0.54185265", "0.5394431", "0.5391712", "0.53680533", "0.5358573", "0.5346897", "0.5346897", "0.5346456", "0.5330116", "0.5318795", "0.5315476", "0.53013694", "0.52857786", "0.52817136", "0.52802116", "0.52769095", "0.52658963", "0.52649146", "0.52580476", "0.52572846", "0.5253249", "0.5252322", "0.52430606", "0.5240519", "0.522157", "0.52214414", "0.52103233", "0.5204494", "0.5195933", "0.5180187", "0.5177304", "0.51701295", "0.5170022", "0.5156054", "0.5156054", "0.5144268", "0.51272047", "0.51216733", "0.51190114", "0.5109246", "0.5107817", "0.5103384", "0.5094417", "0.50861984", "0.5079429", "0.50745285", "0.5067325", "0.50556225", "0.50546384", "0.5041352", "0.5031385", "0.503112", "0.5026751", "0.50149924", "0.50145644", "0.5006853", "0.500384", "0.50034755", "0.50015265", "0.50000876", "0.49973127", "0.49936777", "0.49928597", "0.49928516", "0.49920145", "0.49909607", "0.49898836", "0.49895534", "0.49889538", "0.4977685", "0.4975856", "0.4975856", "0.49748775", "0.49638253", "0.49588174" ]
0.67117935
3
Use a certain preprocessor
def use(processor, options = {}) @stack << [self.class.get_callable(processor, Roger::Release::Processors.map), options] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess(text, defines={})\n defines = defines.dup\n result = []\n active_stack = []\n active = true\n text.each_line do |line|\n case line\n when /^#\\s*define\\s+(\\w+)\\s+(\\w*)\\s*$/\n defines[$1] = $2 if active\n when /^#\\s*if\\s+(\\w+)\\s*$/\n active_stack.push active\n active = active &&\n case preprocessor_expand($1, defines)\n when '0': false \n when '1': true\n else raise \"Can't parse: #{line}\" end\n when /^#\\s*ifdef\\s+(\\w+)\\s*$/\n active_stack.push active\n active = active && defines.has_key?($1)\n when /^#\\s*ifndef\\s+(\\w+)\\s*$/\n active_stack.push active\n active = active && !defines.has_key?($1)\n when /^#\\s*if\\s+[vV][eE][rR]\\s+(<|>)=?\\s+0x[0-9a-zA-Z]{8}\\s*$/\n # Allow version checks, but always consider the version to be higher\n # than the version compared to.\n active_stack.push active\n active = active && ($1 == \">\")\n when /^#\\s*else\\s*$/\n # If we have a parent if, and it's inactive, we don't actually\n # want to do anything here.\n active = !active if active_stack.empty? || active_stack.last\n when /^#\\s*endif(\\s+(\\w+))?\\s*$/\n active = active_stack.pop\n when /^#\\s*error\\s+(.+)$/\n raise $1 if active\n when /^#.*$/\n raise \"Unknown preprocessor command: #{line}\"\n else\n result << line if active\n end\n end\n raise \"Missing #endif\" unless active_stack.empty?\n result.join\n end", "def preprocess(&block)\n @site.preprocessor = block\n end", "def macro; end", "def macro; end", "def formatPreprocessor(theLines)\n\n\talignEndifs(\t\ttheLines);\n\talignUndefineDefine(theLines);\n\talignDefineValue(\ttheLines);\n\talignContinuations(\ttheLines);\n\n\treturn theLines;\n\nend", "def inline_macro name, processor\n processor = resolve_processor_class processor\n @inline_macros[name.to_s] = processor\n end", "def preprocessor_expand str, definitions\n while definitions.has_key? str\n str = definitions[str].to_s\n end\n str\n end", "def pre_processors\n @pre_processors ||= []\n end", "def process(source)\n\t\t\t@source = source.respond_to?(:path) ? File.basename(source.path) : 'unknown'\n\t\t\t@line_no = 0\n\t\t\t@last_if = nil\n\t\t\t@outputting = true\n\t\t\tout_lines = []\n\t\t\tsource.each_line do |line|\n\t\t\t\t@line_no += 1\n\t\t\t\tif is_from_preprocessor?(line)\n\t\t\t\t\tparse(line)\n\t\t\t\telse\n\t\t\t\t\tif @outputting\n\t\t\t\t\t\tout_lines << line\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tif @last_if\n\t\t\t\traise PreprocessorError, \"#@source:#@last_if:error: unmatched #if\"\n\t\t\tend\n\t\t\tFakeIO.new(out_lines)\n\t\tend", "def on_request( &block )\n @preprocessor = block\n end", "def register_processor(*args, &block)\n register_preprocessor(*args, &block)\n end", "def compileif\n\n end", "def handle_ifdefs_in(body)\n body.gsub(/^#ifdef HAVE_PROTOTYPES.*?#else.*?\\n(.*?)#endif.*?\\n/m, '\\1')\n end", "def handle_ifdefs_in(body)\n body.gsub(/^#ifdef HAVE_PROTOTYPES.*?#else.*?\\n(.*?)#endif.*?\\n/m) { $1 }\n end", "def debug_include\n'#ifndef NDEBUG\n#include <iostream>\n#endif'\n end", "def mock_defines(mock_config)\n family = mock_el_family(mock_config)\n version = mock_el_ver(mock_config)\n defines = \"\"\n if version =~ /^(4|5)$/ or family == \"sles\"\n defines = %(--define \"dist .#{family}#{version}\" \\\n --define \"_source_filedigest_algorithm 1\" \\\n --define \"_binary_filedigest_algorithm 1\" \\\n --define \"_binary_payload w9.gzdio\" \\\n --define \"_source_payload w9.gzdio\" \\\n --define \"_default_patch_fuzz 2\")\n end\n defines\nend", "def define_rules\n verify_swig_version\n super\n Rake::Task.create_rule(\n /#{env[:swig_cppext]}$/ => [proc {|t| t.sub /#{env[:swig_cppext]}$/, '.'+env[:swigext] }]\n ) do |r|\n sh_cmd :swig, :swig_flags, {'-I' => :swig_includedirs}, {'-I' => :includedirs},\n '-o', r.name, r.sources\n end\n end", "def define; end", "def register_preprocessor(mime_type, klass, &block)\n mutate_hash_config(:preprocessors, mime_type) do |processors|\n processors.push(wrap_processor(klass, block))\n processors\n end\n end", "def macro!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 48 )\n\n type = MACRO\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 169:9: 'macro'\n match( \"macro\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 48 )\n\n end", "def macro(spec)\n @c.macro(*spec.split('='))\n end", "def define\n end", "def define\n end", "def test_preprocessor(preprocessor,input,expected)\n # Prepare the output and the input streams\n puts \"Preparing the input and ouput streams...\"\n output = StringIO.new(\"\")\n # Process the input and exepected arguments.\n if !input.respond_to?(:each_line) or input.is_a?(String) then\n # input is actually a file name, open it.\n input = File.open(input.to_s,\"r\")\n end\n if !expected.respond_to?(:each_line) or expected.is_a?(String) then\n # expected is actually a file name, open it.\n expected = StringIO.new(File.read(expected.to_s))\n end\n\n # Apply the preprocessor\n puts \"Applying the preprocessor...\"\n preprocessor.preprocess(input,output)\n\n # Check the result\n puts \"Checking the result...\"\n output.rewind\n check = output.string == expected.read\n\n unless check\n puts \"*Error*: invalid expansion result.\"\n iline = output.string.each_line\n expected.rewind\n expected.each_line.with_index do |exp_line,i|\n line = iline.next\n puts \"exp_line=#{exp_line}\"\n puts \"line=#{line}\"\n if exp_line != line then\n puts \"Expected line #{i+1}:\\n#{exp_line}\"\n puts \"got:\\n#{line}\"\n end\n end\n return false\n end\n return true\nend", "def traite_inclusions_in code\n # On regarde si le fichier a des textes inclus\n if code.match(/^[ \\t]*<-/)\n code.gsub!(/^[ \\t]*<-([a-zA-Z0-9_\\/\\.]+)$/){\n finc = search_for_included_file(\"_#{$1}\", fpath)\n \"#{traite_inclusions_in(finc)}\"\n }\n end\n return code\n end", "def define(arg)\n if arg\n arg = arg.chomp.rstrip.lstrip\n name = arg.split(\" \").first\n value = arg.gsub!(\"#{name} \",\"\")\n # negative\n if value =~ /^-(\\d|x)*$/ \n type = \"long\"\n # negative float\n elsif value =~ /^-(\\d|\\.|x)*$/ \n type = \"float\" \n elsif value =~ /[a-zA-Z]/\n type = \"str\"\n value = \"\\\"#{value}\\\"\"\n elsif value !~ /(\\.|x)/\n type = \"long\"\n elsif value =~ /(\\d*\\.\\d*)/ # and no \n type = \"float\"\n elsif value =~ /0x\\d\\d/\n type = \"byte\"\n else \n raise ArgumentError, \"opps, could not determine the define type, got #{value}\"\n end\n $define_types[name] = type\n arg = \"#define #{name} #{value}\"\n $defines << arg\n dummy_for_testing = arg, type\n end\n end", "def third_party_processors; end", "def define(*opts, &block)\n top.append(*(sw = make_switch(opts, block)))\n sw[0]\n end", "def find(macro_name); end", "def preproc; end", "def preprocess(&block); end", "def make_runnable(code)\n return %Q[\nimport webpiraten as garbledwebpiratenlibraryname\nfrom webpiraten import Dir\nfrom webpiraten import Obj\nfrom webpiraten import look\nfrom webpiraten import move\nfrom webpiraten import put\nfrom webpiraten import take\nfrom webpiraten import turn\n\ngarbledwebpiratenlibraryname.configure_prefix(\"#{VM_PREFIX}\")\n\n] + code\n end", "def rule\n [ '$(CC)', '-DHAVE_CONFIG_H', '-I.', flags, '$(CFLAGS)', '-c', @sources ].flatten.join(' ')\n end", "def macros(env = default_environment)\n @macros ||= {}\n @macros[env] ||= {}\n end", "def filter(s, file = nil)\n\t\tstate = State.new([], \"\", false)\n\t\tstate.file = file\n\t\tstate.line_number = 0\n\t\ts.each_line do |line,index|\n\t\t\tstate.line = line\n\t\t\tstate.line_number += 1\n\t\t\tcheck_no_mix(state, line)\n\t\t\tcase preprocessor_word(line)\n\t\t\t\twhen \"#if\" then process_if(state, line)\n\t\t\t\twhen \"#ifdef\" then process_ifdef(state, line)\n\t\t\t\twhen \"#ifndef\" then process_ifndef(state, line)\n\t\t\t\twhen \"#elif\" then process_elif(state, line)\n\t\t\t\twhen \"#else\" then process_else(state, line)\n\t\t\t\twhen \"#endif\" then process_end(state, line)\n\t\t\t\telse process_line(state, line)\n\t\t\tend\n\t\tend\n\t\terror(state, \"Preprocessor directives not balanced\") if state.scopes.size != 0\n\t\t\n\t\treturn state.out\n\tend", "def build_framework?; build.include? 'framework'; end", "def create_value_preprocessor(parameter)\n type_name = parameter.type\n if type_name == TYPE_ARRAY\n if PRIMITIVE_TYPES.include? parameter.items\n preprocessor_for_values = Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValuePreprocessor.new(\n parameter.name,\n false,\n parameter.items,\n parameter.default,\n parameter.params\n )\n else\n preprocessor_for_values = create_preprocessor_for_type(parameter.name, parameter.items, false)\n end\n Sinatra::SwaggerExposer::Processing::SwaggerArrayValuePreprocessor.new(parameter.name, parameter.required, preprocessor_for_values)\n elsif PRIMITIVE_TYPES.include? type_name\n Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValuePreprocessor.new(\n parameter.name,\n parameter.required,\n type_name,\n parameter.default,\n parameter.params\n )\n else\n create_preprocessor_for_type(parameter.name, parameter.type, parameter.required)\n end\n end", "def postproc(source)\n Array(self.class.settings[:postproc]).inject(source) do |result, processor|\n case processor.strip\n when /^moocompat12$/i\n result.gsub(/\\/\\/<1.2compat>.*?\\/\\/<\\/1.2compat>/m, '').\n gsub(/\\/\\*<1.2compat>\\*\\/.*?\\/\\*<\\/1.2compat>\\*\\//m, '')\n when /^mooltie8$/i\n result.gsub(/\\/\\/<ltIE8>.*?\\/\\/<\\/ltIE8>/m, '').\n gsub(/\\/\\*<ltIE8>\\*\\/.*?\\/\\*<\\/ltIE8>\\*\\//m, '')\n else\n Jsus.logger.error \"Unknown post-processor: #{processor}\"\n result\n end\n end\n end", "def apply_macro(macro, docstring, call_params = T.unsafe(nil), full_source = T.unsafe(nil), block_source = T.unsafe(nil)); end", "def preprocessor_context\n @preprocessor_context ||= Nanoc3::Context.new({\n :site => self,\n :config => self.config,\n :items => self.items,\n :layouts => self.layouts\n })\n end", "def get_processor; end", "def do_compile code, do_eval=true\n\t\t\t@cf.cfp_logger.trace TRACE_ENGINE,\"Compiling #{code.fn} action #{code.action}\"\n\t\t\tbegin\n\t\t\t\t# Translate Cfruby style code into plain Ruby\n\t\t\t\ttranslator = Cfp_Translate.new(@cf,@parser)\n\t\t\t\t# Translate conditional blocks\n\t\t\t\tlines = translator.conditionals(code)\n\t\t\t\t# Line by line translation, depending on function - i.e. control, files, tidy etc.\n\t\t\t\ttranslated_lines = []\n\t\t\t\t# code.each do | line,num |\n\t\t\t\tlines.each do | line |\n\t\t\t\t\ttranslated_lines.push translator.do_translate(code.action,line)\n\t\t\t\tend\n\t\t\t\t# Encapsulate teh code into a class object\n\t\t\t\tbuf = code.encapsulate(translated_lines).join(\"\\n\")\n\t\t\t\t@cf.cfp_logger.trace TRACE_ALL,buf\n\t\t\t\teval buf if do_eval\n\t\t\trescue SyntaxError, RuntimeError\n\t\t\t\tmsg = 'ERROR cfscript ',code.fn,\" line #{code.linenum} - #{$!}\\n\"\n\t\t\t\tcode.dump\n\t\t\t\t@cf.cfp_logger.error LOG_CRIT,msg,'cfruby'\n\t\t\t\traise\n\t\t\tend\n\t\t\tbuf\n\t\tend", "def register_preprocessor(mime_type, klass, &block)\n expire_index!\n\n if block_given?\n name = klass.to_s\n klass = Class.new(Processor) do\n @name = name\n @processor = block\n end\n end\n\n @preprocessors[mime_type].push(klass)\n end", "def macro hash\n hash.each do |key, value|\n value = value.latex!.to_latex_math\n define_latex_macro key, value\n define_symbol_macro key, value\n define_global_macro key, value\n end\nend", "def pre_process\n end", "def pre_setup_case()\n return \"pre_setup_for_case\"\n end", "def get_include_system(code)\n return code[2][1][1]\n end", "def compile_to_ruby\n \"if \" + indent_c(@condition.compile_to_ruby) + \"\\n\" +\n indent_ruby(@then_part.compile_to_ruby) +\n \"\\nelse\\n\" +\n indent_c(@else_part.compile_to_ruby) +\n \"\\nend\"\n end", "def is_code?(line,labelhash)\n if @to_code && line !~ /^#include \"(page|align|pass).i65\".*/ # filter chaffy includes\n if @code.nil?\n # first line is special, the label\n @label = line\nputs @label if @label == \"STUDIO\"\n @addr = labelhash[@label]\n # start with a code quote and a slider button\n @code =\n \"\\n\\n\\n<$button popup=\\\"$:/state/codeSlider\\\">code</$button>\"\\\n \"<$reveal type=\\\"nomatch\\\" text=\\\"\\\" default=\\\"\\\" \"\\\n \"state=\\\"$:/state/codeSlider\\\" animate=\\\"yes\\\">\\n\\n```\"\n end\n # append code line, filter chaff\n @code += \"\\n\"+line\n end\n # turn on code trigger after checking, to avoid capturing the `#endif`\n if (line =~ /^\\#endif$/) # non-`#if 0` should have a comment after #endif in source\n @to_code = true\n end\n end", "def __synchromesh_regulate_from_macro(opts, name, already_defined)\n if opts.key?(:regulate)\n yield name => opts[:regulate]\n elsif !already_defined\n yield name => ->(*_args) {}\n end\n end", "def preprocess\n true\n end", "def _inter source\n c = compile source\n cifrom c\nend", "def preprocessors_for(file_path)\n select_matching_file_patterns(preprocess_paths, file_path).values\n end", "def standard_maps\n\n case self.current_framework\n when :testunit\n map /^controllers/ do\n target /^unit/ do\n file_name do |value, cargo|\n buffer = File.basename(cargo, \".rb\").gsub(\"s_controller\", \"\")\n value =~ /#{buffer}_test.rb/ ? true : false\n end\n end\n target /^functional/ do\n file_name do |value, cargo|\n buffer = File.basename(cargo, \".rb\").gsub(\"_controller\", \"\")\n value =~ /#{buffer}_controller_test.rb/ ? true : false\n end\n end\n end\n map /^models/ do\n target /^unit/ do\n file_name do |value, cargo|\n value =~ /#{File.basename(cargo, \".rb\")}_test.rb/ ? true : false\n end\n end\n target /^functional/ do\n file_name do |value, cargo|\n value =~ /#{File.basename(cargo, \".rb\")}s_controller_test.rb/ ? true : false\n end\n end\n end\n\n when :rspec\n map /^controllers/ do\n target /^models/ do\n file_name do |value, cargo|\n buffer = File.basename(cargo, \".rb\").gsub(\"s_controller\", \"\")\n value =~ /#{buffer}_spec.rb/ ? true : false\n end\n end\n target /^controllers/ do\n file_name do |value, cargo|\n buffer = File.basename(cargo, \".rb\").gsub(\"_controller\", \"\")\n value =~ /#{buffer}_controller_spec.rb/ ? true : false\n end\n end\n end\n map /^models/ do\n target /^models/ do\n file_name do |value, cargo|\n value =~ /#{File.basename(cargo, \".rb\")}_spec.rb/ ? true : false\n end\n end\n target /^controllers/ do\n file_name do |value, cargo|\n value =~ /#{File.basename(cargo, \".rb\")}s_controller_spec.rb/ ? true : false\n end\n end\n end\n end\n\n end", "def __replace_eval__(line, gen_code)\n # class_eval\n if line =~ \n /(.*)((class_eval)|(module_eval)|(instance_eval)|(eval)) ?\\(?\"(.*)\"\\)? ?(.*)/\n printf \"%s%s {%s} %s\\n\", $1, $2, gen_code[:code], $8\n end\nend", "def parse_macro(d)\n if d[:body] =~ /define\\s+#{Regexp.quote(d[:name])}\\([^\\)]*\\)[ \\t]*(.*)/m\n d[:value] = join_define($1)\n end\n d[:comments] = d[:rawComments].strip\n end", "def get_php_string_constant(constant_name, source)\n (source =~ /^define\\('#{constant_name}', '(.*)'\\);$/) ? $1 : nil\nend", "def skip_cond_incl!\n nest = 0\n while true\n bol = current_file.column == 1\n skip_space!\n c = readc\n if c.nil? # EOF\n return\n end\n if c == '\\''\n skip_char!\n next\n end\n if c == '\"'\n skip_string!\n next\n end\n if (c != '#' || !bol)\n next\n end\n column = current_file.column - 1\n tok = lex\n if (tok.kind != T::IDENT)\n next\n end\n if (nest == 0) && (Token.is_ident?(tok, \"else\") || Token.is_ident?(tok, \"elif\") || Token.is_ident?(tok, \"endif\"))\n unget_token(tok)\n hash = @token_gen.make_keyword('#')\n hash.bol = true\n hash.column = column\n unget_token(hash)\n return\n end\n if Token.is_ident?(tok, \"if\") || Token.is_ident?(tok, \"ifdef\") || Token.is_ident?(tok, \"ifndef\")\n nest += 1\n elsif (nest > 0) && Token.is_ident?(tok, \"endif\")\n nest -= 1\n end\n skip_line!\n end\n end", "def compile_ohai_plugins\n return super unless $CHEFSPEC_MODE\n return if $CHEFSPEC_PRELOAD\n\n super\n end", "def set_rpi_flags\n if $platform == :linux_rpi\n add_flags(:c, '-I/opt/vc/include')\n add_flags(:ld, '-L/opt/vc/lib -lbrcmGLESv2')\n end\nend", "def set_rpi_flags\n if $platform == :linux_rpi\n add_flags(:c, '-I/opt/vc/include')\n add_flags(:ld, '-L/opt/vc/lib -lbrcmGLESv2')\n end\nend", "def pre_compile(main_file, settings)\n\tFile.read(main_file)\nend", "def constantize(name, base_object=Monitors)\n begin\n const = base_object.constants.find{|cnst| cnst == name.camelcase }\n base_object.module_eval const\n rescue Exception => e\n puts \"#{name.camelcase} is not defined. #{e}\"\n nil\n end\n end", "def meta_exec(line, name, constant, path, meta_code = Cache_meta_without_hue)\n module_eval(\n format(\n meta_code,\n cache_name: name,\n cache_constant: constant,\n cache_path: path\n ),\n __FILE__,\n line\n )\n end", "def precompiled(locals); end", "def create_preprocessor_for_property(name, type_property, required)\n property_type = type_property.type\n if property_type == TYPE_ARRAY\n if PRIMITIVE_TYPES.include? type_property.items\n preprocessor_for_values = Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValuePreprocessor.new(\n name,\n false,\n type_property.items,\n type_property.properties[:default],\n type_property.properties\n )\n else\n preprocessor_for_values = create_preprocessor_for_type(name, type_property.items, false)\n end\n Sinatra::SwaggerExposer::Processing::SwaggerArrayValuePreprocessor.new(name, required, preprocessor_for_values)\n elsif PRIMITIVE_TYPES.include? property_type\n Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValuePreprocessor.new(\n name,\n required,\n property_type,\n type_property.properties[:default],\n type_property.properties\n )\n else\n create_preprocessor_for_type(name, property_type, required)\n end\n end", "def test_preprocessor_exception(preprocessor,string,exception)\n input = StringIO.new(string)\n output = StringIO.new(\"\")\n begin\n $ppr.preprocess(input,output)\n puts \"*Error*: preprocessed without exception.\"\n return false\n rescue Exception => e\n if e.to_s.include?(exception.to_s) then\n puts \"Got exception: <#{e}> as expected.\"\n return true\n else\n puts \"*Error*: unexpected exception.\", \n \"Got <#{e}> but expecting <#{exception}>.\"\n return false\n end\n end\nend", "def define!(string=nil, filename=\"(unknown Buildfile)\", &block)\n context = reset_define_context :current_mode => :all\n instance_eval(string, filename) if string\n instance_eval(&block) if block_given?\n load_imports\n reset_define_context context\n return self\n end", "def inno_setup_4 iss_file, options={}\n defines = (options[:define] || {}).map {|var,value| \"-d#{var}=#{value}\" }\n run 'c:/Program Files/Inno Setup 4/iscc', iss_file, *defines\nend", "def preprocessText(text)\n output = \"\"\n conditionals = Array.new\n\n text.split(\"\\n\").each do |line|\n currentConditional = conditionals.last\n\n # @if/@ifnot\n ifMatch = line.match(/^@(if[not]*)(.*)\\s*$/)\n if ifMatch\n name = ifMatch[1]\n \n #if must contain an expression\n expression = ifMatch[2].strip\n if expression.length == 0\n puts \"ERROR: @#{name} with no expression\"\n exit 1\n end\n \n # expression must be specific syntax\n expressionMatch = expression.match(/^([A-Z0-9_]+)$/)\n enabled = false\n if expressionMatch\n definitionKey = expressionMatch[1]\n if $defines[definitionKey]\n enabled = true\n end\n else\n puts \"ERROR: Invalid @#{name} expression.\"\n exit 1\n end\n\n if name == \"ifnot\"\n enabled = !enabled\n end\n \n # if the parent conditional is disabled, this is disabled too.\n if currentConditional and !currentConditional.enabled\n enabled = false\n end\n\n newConditional = ConditionalBlock.new\n newConditional.enabled = enabled\n newConditional.name = name\n conditionals.push(newConditional)\n next\n end\n \n # @else\n elseMatch = line.match(/^@(else)$/)\n if elseMatch\n if conditionals.length == 0\n puts \"ERROR: @else without @if\"\n exit 1\n end\n currentConditional.name = elseMatch[1]\n currentConditional.enabled = !currentConditional.enabled\n next\n end\n \n # @endif\n endIfMatch = line.match(/^@endif$/)\n if endIfMatch\n if conditionals.length == 0\n puts \"ERROR: @endif without @if\"\n exit 1\n end\n conditionals.pop\n next\n end\n \n if currentConditional and !currentConditional.enabled\n next\n end\n \n # replace definitions\n $defines.each_key do |key|\n while line[key]\n line[key] = $defines[key]\n end\n end\n \n output += \"#{line}\\n\"\n end\n\n if conditionals.length > 0\n puts \"ERROR: Unterminated @\" + conditionals[-1].name\n exit 1\n end\n\n return output\nend", "def set_used_rules(rules)\n\t\t@used_rules = rules\n\t\tinclude_file = File.join(@rule_directory,\"@include.list\")\n\t\tFile.open(include_file,\"w:utf-8\") do |file|\n\t\t\t@used_rules.each do |rule|\n\t\t\t\tfile.puts \"include \\\"#{rule.file_path}\\\"\"\n\t\t\tend\n\t\tend\n\t\t@base_command = \"\\\"#{@executable_path}\\\" \\\"#{include_file}\\\"\"\n\tend", "def constant_enabled(thing)\n Fission.constants.map do |const|\n const.to_s.downcase.to_sym\n end.include?(thing.to_s.downcase.to_sym)\n end", "def macro; raise NotImplementedError; end", "def macro; raise NotImplementedError; end", "def macro; raise NotImplementedError; end", "def valid_processors; end", "def set_up\n @compiler = VishCompiler.new('')\n @compiler.default_optimizers[:constant_folder] = true\n end", "def define(instruction)\n @def_instr = instruction\n end", "def load_source_and_set_module; end", "def header_editor_enabled=(_arg0); end", "def get_processor\n case @config[\"markdown\"].downcase\n when \"kramdown\" then KramdownParser.new(@config)\n else\n custom_processor\n end\n end", "def add_compiler_flag(flag)\n if try_cflags(flag)\n $CFLAGS << ' ' << flag\n else\n $stderr.puts(\"WARNING: '#{flag}' not accepted by compiler, skipping it\")\n end\nend", "def add_compiler_flag(flag)\n if try_cflags(flag)\n $CFLAGS << ' ' << flag\n else\n $stderr.puts(\"WARNING: '#{flag}' not accepted by compiler, skipping it\")\n end\nend", "def uncomment_lines(path, flag, *args)\n flag = flag.respond_to?(:source) ? flag.source : flag\n\n gsub_file(path, /^(\\s*)#[[:blank:]]*(.*#{flag})/, '\\1\\2', *args)\n end", "def included(klass)\n Registry.register_implementation(\n Inflector.underscore(klass.name).to_sym,\n klass\n )\n klass.extend(Macros)\n end", "def replace_keywords(in_file_list)\n in_file_list .each{|src_file_and_mode|\n src_file, mode = src_file_and_mode .split(':')\n dst_file = src_file .sub(/\\.in$/, '')\n print \"creating #{dst_file} ...\"\n replace_keywords1(src_file, dst_file , @macros, mode .oct)\n print \"done.\\n\"\n }\n end", "def header_guard random_suffix = nil, &block\n defined = \"_#{Project.name.upcase}_#{@dir.upcase}_#{@class.upcase}_#{random_suffix.nil? ? '' : rand.to_s[2..-1]+'_'}\"\n\n Ludy::erbout \"#ifndef #{defined}\n#define #{defined}\", block.binding\n block.call\n Ludy::erbout '#endif', block.binding\nend", "def use(processor)\n definition << processor\n processor\n end", "def build_framework?; ARGV.include? '--framework'; end", "def include=(_arg0); end", "def define_tasks\n @defines.each { |sym| send( sym ) }\n end", "def __replace_evals__()\n $__source_files__.each {|file|\n lines = File.new(file).readlines \n lines.each_index {|n|\n # check if the line has any eval(s)\n key = [file, n + 1]\n gen_code = $__gen_code__[key]\n # puts gen_code[:code] if gen_code\n if gen_code\n __replace_eval__(lines[n], gen_code)\n else\n puts lines[n]\n end\n }\n }\nend", "def include(arg)\n Object.module_eval \"include #{arg}\"\n end", "def process_line ln, line\r\n # convert inline processor\r\n while /\\#\\#(?<p_>[A-Z][_A-Z0-9]*)(:\\s*(?<a_>.+))?\\#\\#/ =~ line\r\n rst = conv_inline(p_, a_, ln, line)\r\n raise \"do not use '##.*##' inside your inline processor converting result\" if rst =~ /\\#\\#[A-Z][_A-Z0-9]*(:\\s*.+)?\\#\\#/\r\n line.sub!(/\\#\\#[A-Z][_A-Z0-9]*(:\\s*.+)?\\#\\#/, rst)\r\n end\r\n \r\n # create a token, with processor name\r\n token = self.tokenize(ln, line)\r\n # based on the the token indent level, close token stack if any\r\n self.close_stack token.indent_level\r\n \r\n # add token and then close it unless it opens a block\r\n @token_stack << token\r\n self.close_stack token.indent_level unless token.block_open?\r\n\r\n self # for methods chain\r\n end", "def expand_constants\n\n File.open(\"conftest.c\", \"w\") { |f| f.puts \"#include <FreeImage.h>\" }\n cpp = cpp_command('')\n system \"#{cpp} > confout\"\n\n constants = {}\n headers = []\n\n config = File.readlines(\"confout\")\n config.each do |include|\n next unless include.match(/\"(.*?FreeImage.h)\"/)\n filename = include.split('\"')[1]\n headers << filename\n end\n \n headers.uniq!\n\n # add typedef constants\n config.each do |define|\n next unless define.match(/^\\s*(\\w+)\\s*=\\s*\\d/) # typedef\n name = $1\n next unless name.match(/^(FIT|FICC|FIC|FIF|FILTER)_/)\n constants[$1] ||= []\n constants[$1] << [name]\n end\n\n if RUBY_VERSION >= \"1.9\"\n raw_headers = headers.collect { |i| File.read(i, :encoding => \"ISO-8859-1\") }.join\n else\n raw_headers = headers.collect { |i| File.read(i) }.join\n end\n \n # add #defined constants (load/save flags)\n constants['FLAG'] ||= []\n flag_defines = raw_headers.scan(/(flag constants\\s*---.*?)^\\/\\//m)\n flag_defines.each do |flag_data|\n flag_data[0].split(/\\n/).each do |define|\n next unless define.match(/^\\#define\\s*(\\w+)\\s(.*?(\\/\\/.+)$)?/) # #define\n constants['FLAG'] << [$1, $3]\n end\n end\n\n File.unlink(\"confout\")\n\n constants.keys.each { |i| constants[i].uniq! }\n\n File.open(\"image_science_ext.c\", \"w\") do |newf|\n File.foreach(\"image_science_ext.c.in\") do |l|\n if l.match(/\\/\\* expand FreeImage constants\\s+(\\w+)\\s+(\\w+)\\s*\\*\\//)\n klass_name = $1\n const_type = $2\n const_list = constants[const_type]\n unless const_list\n puts \"warning: no constants found matching #{const_type}\"\n next\n end\n const_list.each do |c, comment|\n if comment\n comment.sub!('//', '')\n comment.sub!(/[\\r\\n]+$/, '')\n comment.gsub!(/:/, '-') # colons break rdoc..\n comment.strip!\n newf.puts %Q{ /* #{comment} */}\n end\n newf.puts %Q{ rb_define_const(#{klass_name}, \"#{c}\", INT2FIX(#{c}));}\n end\n else\n newf.puts l\n end\n end\n end\n\nend", "def require_with_macro(required_name, delete_expanded_file, *macro_objs)\n source_name = required_name + \".rb\"\n source_directory = File.dirname((search_file($LOAD_PATH, source_name)).first)\n source = File.read(File.join(source_directory, source_name))\n @@GENSYM_TABLE = { }\n @@NONEXISTENT_VAR = nonexistent_var(source)\n expanded_path = File.join(source_directory, (\"macroexpanded_\" + source_name))\n File.open(expanded_path, \"w\") do |macroexpanded_file|\n macroexpanded_file.puts(macro_expand(source, *macro_objs))\n end\n require(\"macroexpanded_\" + required_name)\n if delete_expanded_file\n File.delete(expanded_path)\n end\n end", "def preproc=(_arg0); end", "def execute\n\t\t\tres = instance_exec(@node, &Glyph::MACROS[@name]).to_s\n\t\t\tres.gsub(/\\\\*([\\[\\]\\|])/){\"\\\\#$1\"}# : res\n\t\tend", "def precompile_token_script(script)\n result = ''\n token_index = 0\n script.split(\"\\n\").each do |line|\n line.rstrip!\n next if line.empty?\n next if line.start_with?('#')\n result << \"T#{token_index}: \" << line << \"\\n\"\n token_index += 1\n end\n result\n end", "def choose_processor\n self.processor = if MiniMagick::Utilities.which('mogrify')\n :mogrify\n elsif MiniMagick::Utilities.which('gm')\n :gm\n else\n nil\n end\n end", "def folly_flags()\n return NewArchitectureHelper.folly_compiler_flags\nend" ]
[ "0.63092464", "0.6140463", "0.60429186", "0.60429186", "0.5984884", "0.5687321", "0.5481028", "0.54745466", "0.54678714", "0.54376733", "0.5428714", "0.53935945", "0.5370338", "0.53387177", "0.5323118", "0.52336496", "0.5167644", "0.51615936", "0.5161245", "0.5158813", "0.5085027", "0.5075387", "0.5075387", "0.505653", "0.50094175", "0.4989077", "0.4953885", "0.49499696", "0.4931576", "0.4930234", "0.4917548", "0.4870787", "0.48496893", "0.4841845", "0.48337048", "0.4829303", "0.48146507", "0.4806307", "0.4790509", "0.47896236", "0.4785902", "0.47827813", "0.47801214", "0.47788554", "0.4762789", "0.4761525", "0.47526404", "0.47383323", "0.47252727", "0.47148952", "0.47126797", "0.47056967", "0.46995813", "0.469706", "0.46951166", "0.46910107", "0.46877334", "0.46873048", "0.4686539", "0.46692172", "0.46692172", "0.46688488", "0.46668765", "0.4653433", "0.46414396", "0.4636173", "0.46361288", "0.46360037", "0.46342787", "0.4624962", "0.461988", "0.46178913", "0.4615089", "0.4615089", "0.4615089", "0.46123084", "0.4609127", "0.46022415", "0.45970866", "0.45940518", "0.45909625", "0.45808595", "0.45808595", "0.4561931", "0.45615545", "0.45575914", "0.4553051", "0.45513454", "0.45480806", "0.4544727", "0.45411503", "0.4533337", "0.4532726", "0.45313752", "0.45298854", "0.45238402", "0.4523772", "0.4520224", "0.4507852", "0.45062718", "0.44945997" ]
0.0
-1
Write out the whole release into a directory, zip file or anything you can imagine finalize can be called multiple times, it just will run all of them. The default finalizer is :dir
def finalize(finalizer, options = {}) @stack << [self.class.get_callable(finalizer, Roger::Release::Finalizers.map), options] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write()\n entries = Dir.entries(@inputDir); entries.delete(\".\"); entries.delete(\"..\"); entries.delete(\"yamproject.json\"); entries.delete(\".DS_Store\")\n io = Zip::File.open(@outputFile, Zip::File::CREATE);\n writeEntries(entries, \"\", io)\n io.close();\n end", "def write\n FileUtils.rm @out_file if File.exists? @out_file\n in_progress \"Writing archive #{@out_file} from #{@input_dir}\" do\n Zip::File.open @out_file, Zip::File::CREATE do |zipfile|\n Dir[\"#{@input_dir}/**/**\"].reject{ |f| f == @out_file || !@filter.call(f) }.each do |file|\n progress \"deflating #{file}\"\n zipfile.add(file.sub(@input_dir + '/', ''), file)\n end\n end\n end\n end", "def write()\n entries = Dir.entries(@inputDir); entries.delete(\".\"); entries.delete(\"..\")\n io = Zip::File.open(@outputFile, Zip::File::CREATE);\n writeEntries(entries, \"\", io)\n io.close();\n end", "def write()\n entries = Dir.entries(@inputDir); entries.delete(\".\"); entries.delete(\"..\")\n io = Zip::File.open(@outputFile, Zip::File::CREATE);\n\n writeEntries(entries, \"\", io)\n io.close();\n end", "def write\n entries = Dir.entries(@input_dir) - %w[. ..]\n\n ::Zip::File.open(@output_file, ::Zip::File::CREATE) do |zipfile|\n write_entries entries, '', zipfile\n end\n end", "def write\n entries = Dir.entries(@input_dir) - %w[. ..]\n\n ::Zip::File.open(@output_file, ::Zip::File::CREATE) do |zipfile|\n write_entries entries, '', zipfile\n end\n end", "def write\r\n entries = Dir.entries(@input_dir) - %w[. ..]\r\n\r\n ::Zip::File.open(@output_file, ::Zip::File::CREATE) do |zipfile|\r\n write_entries entries, '', zipfile\r\n end\r\n end", "def write()\n entries = Dir.entries(@input_dir); entries.delete(\".\"); entries.delete(\"..\")\n io = Zip::ZipFile.open(@output_file, Zip::ZipFile::CREATE);\n write_entries(entries, \"\", io)\n io.close();\n end", "def write\n ::Zip::File.open(@output_file, ::Zip::File::CREATE) do |io|\n @folders.each do |input_dir, src, dest|\n src = '' if src == '/**' # the whole src directory could be specified by /**\n path = source_dir(File.join(input_dir, src))\n write_entries(path, entries(src, input_dir), dest, io)\n end\n end\n\n @output_file\n end", "def write\n entries = Dir.entries(@input_dir) - %w(. ..)\n\n ::Zip::File.open(@output_file, ::Zip::File::CREATE) do |io|\n write_entries(entries, '', io)\n end\n end", "def finalize_dirs\n @finalize_dirs || Dbt::Config.default_finalize_dirs\n end", "def write\n entries = Dir.entries(@input_dir)\n entries.delete('.')\n entries.delete('..')\n # TODO: delete config file\n io = Zip::File.open(@output_file, Zip::File::CREATE)\n write_entries(entries, '', io)\n io.close\n end", "def write\n entries = @input_dir.children(false)\n @zip.write entries, @input_dir, ''\n end", "def write_out\n @all_content.each do |venue_id, venue_content|\n manifest_dir = \"#{@base.deploy_path}\" / \"#{venue_content.sha1_digest}\"\n venue_dir = \"#{@base.deploy_path}\" / \"#{Venue.get!(venue_id).router.identifier}\"\n manifest_file = manifest_dir / \"manifest.json\"\n files_dir = manifest_dir / \"files\"\n venue_content_ln = \"#{venue_dir}\" / \"content\"\n sha1_file = manifest_dir / \"#{venue_content.sha1_digest}.sha1\"\n \n FileUtils.rm(venue_content_ln) if File.exists?(venue_content_ln)\n FileUtils.mkdir_p(venue_dir)\n if File.exists?(sha1_file)\n FileUtils.ln_sf(manifest_dir, venue_content_ln)\n next\n end\n\n FileUtils.mkdir_p(manifest_dir)\n\n open(manifest_file, \"w+\") do |f|\n f << venue_content.manifest.to_json\n end\n\n #FileUtils.mkdir_p(files_dir)\n source_files = venue_content.filelist\n venue_content.filelist.each do |f|\n #UploadManager is using the first 2 bytes of the file digest as directory names.\n #The split('/'[-3..-1].join('') restores the filename to the full digest when it is copied\n #from the upload dir to the deployment dir\n dest = \"#{manifest_dir}\" / \"#{f.split('/')[-3..-1].join('')}\"\n FileUtils.cp(f, dest)\n end\n \n open(sha1_file, \"w+\") do |f|\n f << venue_content.sha1_digest\n end\n \n FileUtils.ln_sf(manifest_dir, venue_content_ln)\n end\n end", "def write_archives\n self.collated.keys.each do |year|\n if self.layouts.key? 'archive_yearly'\n self.write_archive(year.to_s, 'archive_yearly')\n end\n\n self.collated[year].keys.each do |month|\n if self.layouts.key? 'archive_monthly'\n self.write_archive(File.join(year.to_s, month.to_s),\n 'archive_monthly')\n end\n\n self.collated[year][month].keys.each do |day|\n if self.layouts.key? 'archive_daily'\n self.write_archive(File.join(year.to_s, month.to_s, day.to_s),\n 'archive_daily')\n end\n end\n end\n end\n end", "def output\n @output ||= File.open(File.join(output_final_directory_path, Metasploit::Credential::Importer::Zip::MANIFEST_FILE_NAME), 'w')\n end", "def finalize_dirs\n @finalize_dirs || DbTasks::Config.default_finalize_dirs\n end", "def create_dirs_in_zipfile(created_dirs, entry_path, output_stream); end", "def write_entries(input_dir, entries, path, io)\n entries.each do |e|\n disk_file_path = File.join(input_dir, e)\n zip_file_path = zip_file_path(path, e, input_dir)\n\n if File.directory? disk_file_path\n recursively_deflate_directory(disk_file_path, io, zip_file_path)\n else\n put_into_archive(disk_file_path, io, zip_file_path)\n end\n end\n end", "def write\n @zip.write [@input_dir.basename], @input_dir.parent, ''\n end", "def zipIt\r\n puts \"Creating EPUB package:\"\r\n STDOUT.flush\r\n path = @dirs[:tmp]\r\n FileUtils.rm @epub, :force=>true\r\n Zip::ZipFile.open(@epub, 'w') do |zipfile|\r\n progress = ProgressBar.new(\"Compressing\", Dir[\"#{path}/**/**\"].length)\r\n Dir[\"#{path}/**/**\"].each do |file|\r\n zipfile.add(file.sub(path+'/', ''), file)\r\n progress.inc\r\n end\r\n progress.finish\r\n puts ''\r\n end\r\n end", "def write_entries(entries, path, zipfile, root_dir)\n entries.each do |e|\n zipfile_path = path == '' ? e : File.join(path, e)\n disk_file_path = File.join(root_dir, zipfile_path)\n\n if File.directory? disk_file_path\n recursively_deflate_directory(disk_file_path, zipfile, zipfile_path, root_dir)\n else\n put_into_archive(disk_file_path, zipfile, zipfile_path)\n end\n end\n end", "def close\n close_buffers\n # Zip it all up using the zip command for now :p\n pwd = Dir.pwd\n Dir.cd(realdir)\n exec(\"zip -r #{filename} *\")\n Dir.cd(pwd)\n FileUtils.rm_r(realdir)\n end", "def write\n make_parent_directory\n generate_file\n end", "def write_entries(entries, dir, io)\n entries.each do |e|\n file = dir == '' ? e : File.join(dir, e)\n disk_file = File.join(scr, file)\n\n if File.directory? disk_file\n recursively_deflate_directory(disk_file, io, file)\n else\n add(disk_file, io, file)\n end\n end\n end", "def cleanup\n FileUtils.rm(@out_filename)\n\n # XXX: could be rm-rf, but be safe for now. Might have\n # problems if app creates files in $PWD\n FileUtils.rmdir(@opts[:tmpdir])\n end", "def archive\n files.each do |path|\n path_obj = Pathname.new(path)\n path_name = path_obj.dirname.to_s\n compress = Kellerkind::Compress.new(:target_path => out,\n :source_path => path,\n :tarball_prefix => path_obj.basename.to_s)\n compress.find_at_source_path = true\n if File.exists?(path)\n Kellerkind::Process.verbose(:start_compressing)\n compress.gzip\n if File.exists?(\"#{path_name}/#{compress.tarball_name}\")\n Kellerkind::Process.verbose(:finished_compressing)\n FileUtils.mv(\"#{path_name}/#{compress.tarball_name}\",\n \"#{out}/#{compress.tarball_name}\")\n FileUtils.rm_rf(path)\n FileUtils.touch(path) if self.recreate\n end\n end\n end\n end", "def write_archive(archive, dir)\n\t\tIO.popen(\"cd #{dir}; tar x\", \"w\") do |p|\n\t\t\tp.write archive\n\t\tend\n\tend", "def write_entries(input_dir, entries, path, zipfile)\n entries.each do |e|\n zipfile_path = path == '' ? e : File.join(path, e)\n disk_file_path = File.join(input_dir, zipfile_path)\n\n if File.directory? disk_file_path\n recursively_deflate_directory(input_dir, disk_file_path, zipfile, zipfile_path)\n else\n put_into_archive(disk_file_path, zipfile, zipfile_path)\n end\n end\n end", "def build\n entries = Dir.entries(@input_dir)\n entries.delete_if {|e| @exclude.include?(e)}\n FileUtils.rm_f(@output_file) # Make sure file doesn't exist\n ::Zip::File.open(@output_file, ::Zip::File::CREATE) do |zipfile|\n write_entries entries, '', zipfile\n end\n end", "def write_entries(entries, path, zipfile)\n entries.each do |entry|\n zipfile_path = path == '' ? entry : File.join(path, entry)\n disk_file_path = File.join(src_path, zipfile_path)\n\n if File.directory?(disk_file_path)\n recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)\n else\n put_into_archive(disk_file_path, zipfile, zipfile_path)\n end\n end\n end", "def write(dest)\n path = destination(dest)\n FileUtils.mkdir_p(File.dirname(path))\n Jekyll.logger.debug \"Writing:\", path\n File.write(path, output, :mode => \"wb\")\n Jekyll::Hooks.trigger hook_owner, :post_write, self\n end", "def write_entries(entries, path, zipfile)\r\n entries.each do |e|\r\n zipfile_path = path == '' ? e : File.join(path, e)\r\n disk_file_path = File.join(@input_dir, zipfile_path)\r\n\r\n if File.directory? disk_file_path\r\n recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)\r\n else\r\n put_into_archive(disk_file_path, zipfile, zipfile_path)\r\n end\r\n end\r\n end", "def write(dest)\n path = destination(dest)\n FileUtils.mkdir_p(File.dirname(path))\n Jekyll.logger.debug \"Writing:\", path\n File.write(path, output, :mode => \"wb\")\n\n trigger_hooks(:post_write)\n end", "def write_entries(entries, path, zipfile)\n entries.each do |e|\n zipfile_path = path == '' ? e : File.join(path, e)\n disk_file_path = File.join(@input_dir, zipfile_path)\n\n if File.directory? disk_file_path\n recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)\n else\n put_into_archive(disk_file_path, zipfile, zipfile_path)\n end\n end\n end", "def write_entries(entries, path, zipfile)\n entries.each do |e|\n zipfile_path = path == '' ? e : File.join(path, e)\n disk_file_path = File.join(@input_dir, zipfile_path)\n\n if File.directory? disk_file_path\n recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)\n else\n put_into_archive(disk_file_path, zipfile, zipfile_path)\n end\n end\n end", "def write_entries(entries, path, io)\n entries.each do |e|\n zip_file_path = path == '' ? e : File.join(path, e)\n disk_file_path = File.join(@input_dir, zip_file_path)\n if File.directory?(disk_file_path)\n recursively_deflate_directory(disk_file_path, io, zip_file_path)\n elsif include_filename?(zip_file_path)\n put_into_archive(disk_file_path, io, zip_file_path)\n end\n end\n end", "def prepare\n FileUtils.rm_rf(output_dir)\n FileUtils.mkdir_p(output_dir)\n end", "def prepare\n FileUtils.rm_rf(output_dir)\n FileUtils.mkdir_p(output_dir)\n end", "def finalise\n end", "def write_entries(entries, path, zipfile)\n entries.each do |e|\n zipfile_path = path == '' ? e : File.join(path, e)\n disk_file_path = File.join(@input_dir, zipfile_path)\n puts \"Deflating #{disk_file_path}\"\n\n if File.directory? disk_file_path\n recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)\n else\n put_into_archive(disk_file_path, zipfile, zipfile_path)\n end\n end\n end", "def finish\n if @write_options then\n write_options\n exit\n end\n\n @op_dir ||= 'doc'\n\n @rdoc_include << \".\" if @rdoc_include.empty?\n root = @root.to_s\n @rdoc_include << root unless @rdoc_include.include?(root)\n\n @exclude = self.exclude\n\n finish_page_dir\n\n check_files\n\n # If no template was specified, use the default template for the output\n # formatter\n\n unless @template then\n @template = @generator_name\n @template_dir = template_dir_for @template\n end\n\n if @locale_name\n @locale = RDoc::I18n::Locale[@locale_name]\n @locale.load(@locale_dir)\n else\n @locale = nil\n end\n\n self\n end", "def zip_result_directory\n end", "def cleanup\n close_file_appender\n archive_run_result if (defined? @results_archive) && @archive_results\n end", "def close\n return if @closed\n\n finalize_current_entry\n update_local_headers\n @cdir.write_to_stream(@output_stream)\n @output_stream.close\n @closed = true\n end", "def write_zip(out_path)\n CrxMake.zip(\n :ex_dir => @build_dir,\n :pkey => full_key_path,\n :zip_output => out_path,\n :verbose => false\n )\n end", "def archive(dir)\n @archiver.archive(dir)\n end", "def run_dir(root)\n\tDir.foreach(root) { |fn|\n\t\tnext if fn == \".\" || fn == \"..\"\n\t\tcombined = File.join(root, fn)\n\t\tif File.directory?(combined)\n\t\t\trun_dir(combined)\n\t\telsif File.file?(combined) && (fn[\".dll\"] || fn[\".pdb\"])\n\t\t\tfpath = combined\n\t\t\tfpath = fpath[2..-1] if fpath[0..1] == \"./\"\n\t\t\tfpath = fpath.gsub(\"/\", \"\\\\\")\n\t\t\tprint(\"#{fpath}\\n\")\n\t\t\t`compress -R #{fpath}`\n\t\t\texit(1) if $?.exitstatus != 0\n\t\t\t`del #{fpath}`\n\t\tend\n\t}\t\nend", "def build\n sync\n output_dir.mkpath\n outputs.each(&:build)\n output_dir.touch\n end", "def run\n assets.each do |asset|\n next if ::File.directory?(asset)\n\n compress(asset)\n checksum(asset)\n end\n\n generate_manifest\n end", "def write\n entries = Dir.entries(@input_dir); entries.delete(\".\"); entries.delete('..')\n io = Zip::File.open(@server_pack_file, Zip::File::CREATE)\n write_entries(entries, '', io)\n io.close\n end", "def output_final_directory_path\n unless instance_variable_defined? :@output_final_directory_path\n tmp_path = Dir.mktmpdir(TEMP_ZIP_PATH_PREFIX)\n @output_final_directory_path = File.join(tmp_path, output_final_subdirectory_name)\n FileUtils.mkdir_p @output_final_directory_path\n end\n @output_final_directory_path\n end", "def write\n File.delete(@output_file) if File.exist?(@output_file)\n\n Zip::File.open(@output_file, Zip::File::CREATE) do |zipfile|\n zipfile.add(mimetype_entry(zipfile), \"#{@input_dir}/mimetype\")\n\n all_entries.each do |file|\n zipfile.add(file, \"#{@input_dir}/#{file}\")\n end\n end\n end", "def make_output_dir (src_path)\n delete_all_files(src_path) if directory_exists?(src_path) == true\n Dir.mkdir(src_path)\nend", "def write_entries(entries, path, zipfile)\n entries.each do |e|\n zipfile_path = path == '' ? e : File.join(path, e)\n disk_file_path = File.join(@input_dir, zipfile_path)\n if File.directory?(disk_file_path)\n recursively_deflate_directory(disk_file_path, zipfile, zipfile_path)\n next\n end\n put_into_archive(disk_file_path, zipfile, zipfile_path)\n end\n end", "def write\n\t\t#clear the directory before doing anything else\n\t\tclear @path\n\n\t\t#write out source code files\n\t\t@molds.each do |mold|\n\t\t\twrite_object(mold.name + \".h\", header(mold))\n\t\t\twrite_object(mold.name + \".m\", source(mold))\n\t\tend\n\tend", "def write(dir, overwrite: true)\n FileUtils.mkdir_p(dir) # Make any parent directories\n @crate.payload.each do |path, entry|\n fullpath = ::File.join(dir, path)\n next if !overwrite && ::File.exist?(fullpath)\n next if entry.directory?\n FileUtils.mkdir_p(::File.dirname(fullpath))\n if entry.symlink?\n ::File.symlink(entry.source.readlink, fullpath)\n else\n temp = Tempfile.new('ro-crate-temp')\n begin\n entry.write_to(temp)\n temp.close\n FileUtils.mv(temp, fullpath)\n ensure\n temp.unlink\n end\n end\n end\n end", "def write!\n Dir.mkdir @directory unless File.directory? @directory\n\n @locales.each_with_index do |locale, index|\n strings = @strings[locale]\n plurals = @plurals[locale]\n\n l_directory = locale_directory locale, index.zero?\n\n file = @table.to_s.empty? ? @adapter.default_file_name : @table\n\n date = DateTime.now\n\n Dir.mkdir l_directory unless File.directory? l_directory\n\n @adapter.write_locale(l_directory,\n file,\n strings,\n plurals,\n locale,\n date)\n end\n end", "def _zip_decender(zipstream, folder, path)\n if path.nil?\n path = folder.name\n else\n path = path + \"/\" + folder.name\n end\n zipstream.dir.mkdir(path)\n \n folder.assets.each do |a|\n logger.info(\"[ZIP] Adding #{a.file_name} in #{a.uploaded_file.path}\")\n zipstream.add(\"#{path}/#{a.file_name}\", a.uploaded_file.path)\n end\n folder.children.each do |f|\n _zip_decender(zipstream, f, path)\n end\n end", "def generate_output_file(zip_out, contents); end", "def make_zipfile dir, options={}\n zipfile = options[:filename] || \"#{dir}.zip\"\n excludes = ['-x', '*/.git/*', '-x', '*/.gitignore']\n exclude_each options[:excludes] do |exclude|\n excludes.push '-x', exclude\n end\n run 'zip', '-r', zipfile, dir, *excludes\n release zipfile, :cd => 1\nend", "def initialize_output_directory()\n require 'fileutils'\n FileUtils.mkdir_p(OUTPUT_DIRECTORY)\n end", "def setup_finalizer\n ObjectSpace.define_finalizer(self, self.class.close_io(@file))\n end", "def distribute\n output_dir(@spec.meta, @meta_dir)\n output_dir(@spec.path, @path_dir)\n output_dir(@spec.model, @model_dir)\n true\n end", "def setup_finalizer\n ObjectSpace.define_finalizer(self, self.class.close_io(@file))\n end", "def sort_out_output_directories \n FileUtils.mkdir_p(output_directory)\n FileUtils.mkdir_p(xml_directory)\n FileUtils.mkdir_p(intermediate_directory) unless run_in_memory\n end", "def finish!\n # Create our sentinel file\n FileUtils.touch('/etc/.sorted')\n end", "def gen_sub_directories\n @outputdir.mkpath\n end", "def releaseFiles\r\n rSuccess = true\r\n\r\n logOp('Copy core files') do\r\n RubyPackager::copyFiles(@RootDir, @ReleaseDir, @ReleaseInfo.core_files)\r\n # Create the ReleaseVersion file\r\n lStrTags = nil\r\n if (@ReleaseTags.empty?)\r\n lStrTags = ':tags => []'\r\n else\r\n lStrTags = \":tags => [ '#{@ReleaseTags.join('\\', \\'')}' ]\"\r\n end\r\n File.open(\"#{@ReleaseDir}/ReleaseInfo\", 'w') do |oFile|\r\n oFile << \"\r\n# This file has been generated by RubyPackager during a delivery.\r\n# More info about RubyPackager: http://rubypackager.sourceforge.net\r\n{\r\n :version => '#{@ReleaseVersion}',\r\n #{lStrTags},\r\n :dev_status => '#{@ReleaseInfo.project_info[:dev_status]}'\r\n}\r\n\"\r\n end\r\n end\r\n @ReleaseInfo.executables_info.each do |iExecutableInfo|\r\n if (iExecutableInfo[:exe_name] != nil)\r\n logOp(\"Create binary #{iExecutableInfo[:exe_name]}\") do\r\n # TODO (crate): When crate will work correctly under Windows, use it here to pack everything\r\n # For now the executable creation is platform dependent\r\n rSuccess = @PlatformReleaseInfo.create_binary(@RootDir, @ReleaseDir, @IncludeRuby, iExecutableInfo)\r\n end\r\n end\r\n end\r\n if (rSuccess)\r\n logOp('Copy additional files') do\r\n RubyPackager::copyFiles(@RootDir, @ReleaseDir, @ReleaseInfo.additional_files)\r\n end\r\n if (@IncludeTest)\r\n logOp('Copy test files') do\r\n RubyPackager::copyFiles(@RootDir, @ReleaseDir, @ReleaseInfo.test_files)\r\n end\r\n end\r\n end\r\n\r\n return rSuccess\r\n end", "def finalize(finalizer, options = {})\n @finalizers << [self.class.get_callable(finalizer, HtmlMockup::Release::Finalizers), options]\n end", "def writeEntries(entries, path, io)\n entries.each { |e|\n zipFilePath = path == \"\" ? e : File.join(path, e)\n diskFilePath = File.join(@inputDir, zipFilePath)\n puts \"==Deflating==\" + diskFilePath\n if File.directory?(diskFilePath)\n io.mkdir(zipFilePath)\n subdir = Dir.entries(diskFilePath)\n subdir.delete(\".\")\n subdir.delete(\"..\")\n writeEntries(subdir, zipFilePath, io)\n else\n io.get_output_stream(zipFilePath) { |f| f.puts(File.open(diskFilePath, \"rb\").read())}\n end\n }\n end", "def comp(input_dir, output_file)\n @inputDir = input_dir\n # @input_dir = @inputDir\n @outputFile = output_file\n FileUtils.rm @outputFile if File.exists? @outputFile\n # File.open(output_file, 'w')\n entries = Dir.entries(@inputDir); entries.delete(\".\"); entries.delete(\"..\")\n io = Zip::File.open(@outputFile, Zip::File::CREATE)\n\n writeEntries(entries, \"\", io)\n io.close\n puts \"\\n#{output_file} chaching!\\n\\n\"\n end", "def finalize\n\t\teach_door { |door| door.finalize }\n\tend", "def generate()\n prepare\n ::Dir.mkdir(@output_path) unless ::File.exists? @output_path\n\n @pages.each do |name, page|\n SiteLog.debug(\"Starting page generation - #{name}\")\n page.generate(@output_path, @version, @preserve_tree)\n SiteLog.debug(\"Finished page generation - #{name}\")\n end\n\n @files.each do |path, data|\n path = ::File.join(@output_path, path)\n ::FileUtils.mkdir_p(::File.dirname(path))\n ::File.open(path, \"w\") do |f|\n f.write(data)\n end\n end\n end", "def create_output_directory\n FileUtils.mkdir_p @output_dir\n end", "def write(dir)\n @dir = FileUtils.mkdir_p dir\n @css_file = File.join(@dir, @filename + '.css')\n\n File.delete(@css_file) if File.exist?(@css_file)\n @output = File.open(@css_file, 'w') { |file| file.write(@result) }\n @css_file\n end", "def gen_sub_directories\n\t\t@outputdir.mkpath\n\tend", "def gen_sub_directories\n\t\t@outputdir.mkpath\n\tend", "def cleanup(build_dir)\n build_dir = Pathname(build_dir)\n tmp_build_dir = Pathname('.temp-build')\n\n # copy over files we need to keep\n if File.directory?(build_dir)\n build_dir.glob(\"**/all-product-headers.yaml\").each do |file|\n intermediate = Pathname(file).relative_path_from(build_dir).dirname\n destination_dir = tmp_build_dir + intermediate\n\n FileUtils.mkdir_p(destination_dir)\n FileUtils.mv(file, destination_dir)\n end\n\n build_dir.rmtree if build_dir.directory?\n FileUtils.mv(tmp_build_dir, build_dir)\n end\nend", "def destination(lang)\n output_path.mkpath\n\n path = output_path.join(\"#{lang}.json\")\n path.open(\"w\") do |f|\n f.write yield\n end\n\n puts \"Created #{path}\"\n end", "def write\n buffer = create_zip(@entries, @ignore_entries)\n\n puts \"\\nwrite file #{@output_file}\"\n File.open(@output_file, \"wb\") {|f| f.write buffer.string }\n end", "def bundle!(export_dir= Rails.configuration.gtdinbox_export_dir)\n @bundle_filename = \"#{export_dir}/#{@bundle_id}-translation-export.zip\"\n\n\n Zip::ZipFile.open(@bundle_filename, Zip::ZipFile::CREATE) do |zipfile|\n pp @dir_names\n @dir_names.each {|dirname|zipfile.mkdir(dirname)}\n @dir_files.each do |dir_file|\n dirname, file = dir_file\n zip_filepath = File.basename(file.path).gsub(\"#{dirname}-#{@bundle_id}-\",'')\n zipfile.add([dirname, zip_filepath].join('/'), file.path)\n end\n end\n\n File.chmod(0644, @bundle_filename)\n clean_up\n\n @bundle_filename\n end", "def cleanup\n cleanup_unpack_path\n cleanup_download_path\n end", "def write_images\n # Enumerate all the files in the zip and write any that are in the media directory to the output buffer (which is used to generate the new zip file)\n @file.read_files do |entry| # entry is a file entry in the zip\n if entry.name.include? IMAGE_DIR_NAME\n # Check if this is an image being replaced\n current_image = @images.select { |image| !@relationship_manager.get_relationship(image.id).nil? and entry.name.include? @relationship_manager.get_relationship(image.id)[:target] }.first\n\n unless current_image.nil?\n replacement_path = current_image.path\n data = ::File.read(replacement_path)\n else\n entry.get_input_stream { |is| data = is.sysread }\n end\n\n @file.output_stream.put_next_entry(entry.name)\n @file.output_stream.write data\n end\n end\n\n # Create any new images\n @unique_image_paths = []\n @images.select { |image| image.is_new }.each do |new_image|\n next if @unique_image_paths.include? new_image.target # we only want to write each image once\n @unique_image_paths << new_image.target\n @file.output_stream.put_next_entry(\"word/#{new_image.target}\")\n @file.output_stream.write ::File.read(new_image.path)\n end\n end", "def after_destroy\n super\n\n # Try our best to remove the directory. If it fails there is little\n # else that we could do to resolve the situation -- we already tried to\n # delete it once...\n self.tmpdir and FileUtils.remove_entry_secure(self.tmpdir, true)\n\n # Remove repo directory.\n if self.iso_url\n # Some files in archives are write-only. Change this property so the\n # delete succeeds.\n remove_directory(iso_location)\n end\n end", "def finish_page_dir\n return unless @page_dir\n\n @files << @page_dir\n\n page_dir = Pathname(@page_dir)\n begin\n page_dir = page_dir.expand_path.relative_path_from @root\n rescue ArgumentError\n # On Windows, sometimes crosses different drive letters.\n page_dir = page_dir.expand_path\n end\n\n @page_dir = page_dir\n end", "def write(dir = self.dir, filename = self.filename)\n FileUtils.mkdir_p(File.join(WRITE_DIR, dir))\n self.image.write(File.join(WRITE_DIR, dir, filename))\n end", "def write_repository(product_dir, releases)\n platforms = releases.map { |release| release[:platform] }.uniq\n platforms.each do |platform|\n configuration_directory = File.join(product_dir, platform)\n FileUtils.mkdir_p(configuration_directory)\n releases_by_version = Hash.new { |hash, key| hash[key] = [] }\n releases.each do |release|\n next if release[:platform] != platform\n\n releases_by_version[release[:version]] << extract_release_fields(release)\n end\n releases_by_version.each_pair do |version, version_releases|\n File.write(File.join(configuration_directory, \"#{version.gsub('/', '-')}.json\"),\n JSON.pretty_generate(version_releases))\n end\n end\n end", "def write\n self.theme_assets_by_priority.each do |asset|\n self.output_resource_op asset\n\n self.open_file(self.target_asset_path(asset), 'wb') do |file|\n content = asset.content\n\n if asset.stylesheet_or_javascript?\n self.replace_asset_urls(content)\n end\n\n file.write(content)\n end\n\n self.output_resource_op_status asset\n end\n end", "def prepare doc_dir\n debug_msg \" preparing for web (gzip)\"\n cwd = Dir.pwd\n begin\n Dir.chdir doc_dir\n zip_file = 'rdoc.zip'\n `zip -r #{zip_file} .`\n ensure\n Dir.chdir cwd\n end\n end", "def output(_options, _directory, version, metadata, _output)\n metadata.releases[version].components.each do |_component|\n end\n end", "def create_zip(name,url)\n @outputFile = (Rails.root.to_s+\"/tmp/cache/downloads/\"+name+\".zip\")\n if File.exist?(@outputFile)\n FileUtils.rm_rf (@outputFile)\n end\n @inputDir = url\n entries = Dir.entries(@inputDir)\n entries.delete(\".\")\n entries.delete(\"..\")\n io = Zip::ZipFile.open(@outputFile, Zip::ZipFile::CREATE)\n writeEntries(entries, \"\", io) #calling recursive write entries method\n io.close();\n return @outputFile\n end", "def make_output_directory\n puts \"Making output directory\"\n # Double check that we don't clobber an existing dir\n if File.exists? @output_dir\n puts \"\\nSORRY! '#{ @output_dir }' directory already exists. Please try again.\\n\\n\"\n exit\n end\n FileUtils.mkdir_p @output_dir\n end", "def clearDistributionDirectory(projectDir)\n distDir = projectDir.to_s + '/dist'\n FileUtils.rm_rf(distDir)\n FileUtils.mkdir_p(distDir)\nend", "def write_all\n if cached_write?\n then write_cached_assets else write_assets\n end\n end", "def close\n # XXX should optimize to not write anything to unchanged files\n # In update mode, we first write the zip to a temporary zip file,\n # then move it on top of the original file\n out_zip = update? ? tmp_zipfile : @filename\n ZipFileWriter.new(directory, out_zip).write if write?\n @io.close if @io\n File.rename out_zip, @filename if update?\n end", "def finalize!\n @finalized = true\n self\n end", "def commit\n # TODO\n # Update ./docProps\n # app.xml slides, notes, counts, etc\n # core.xml Times\n entries.each do |path, buffer|\n path = path.to_s\n if @original_files.include? path\n @zip.replace_buffer path, buffer\n else\n @zip.add_buffer path, buffer\n end\n end\n @zip.commit\n end", "def clean\n cache = Cache.instance\n # remove all built files\n cache.targets(false).each do |target|\n cache.remove_target(target)\n FileUtils.rm_f(target)\n end\n # remove all created directories if they are empty\n cache.directories(false).sort {|a, b| b.size <=> a.size}.each do |directory|\n cache.remove_directory(directory)\n next unless File.directory?(directory)\n if (Dir.entries(directory) - ['.', '..']).empty?\n Dir.rmdir(directory) rescue nil\n end\n end\n cache.write\n end", "def write(dest_prefix, dest_suffix = nil)\n #self.render(@site.layouts, @site.site_payload) if self.output == nil\n\n path = File.join(dest_prefix, CGI.unescape(self.url))\n dest = File.dirname(path)\n\n # Create directory\n FileUtils.mkdir_p(dest) unless File.exist?(dest)\n\n # write partials\n #@partials.each do |partial|\n # @settings[partial].write if @settings[partial] != nil\n #end\n\n # Debugging - create html version of PDF\n #File.open(\"#{path}.html\", 'w') {|f| f.write(self.output) } if @settings[\"debug\"]\n #@settings.delete(\"debug\")\n\n self.output = File.read(\"#{path}\") if @name != \"/.pdf\"\n\n # Build PDF file\n fix_relative_paths\n kit = PDFKit.new(self.output, @settings)\n file = kit.to_file(File.join(dest_prefix, @name))\n end", "def run\n puts \"\\nHere we go!\\n\\n\"\n make_output_directory\n build_jar\n create_android\n include_www\n generate_manifest\n copy_libs\n add_name_to_strings\n write_java\n puts \"\\nDone!\\n\\n\"\n `open #{@output_dir}`\n end" ]
[ "0.6660286", "0.63722944", "0.6353809", "0.63394934", "0.6303561", "0.6303561", "0.6293844", "0.62638694", "0.6195404", "0.6183084", "0.61787283", "0.60590243", "0.6001356", "0.59868073", "0.5857162", "0.5848178", "0.58416617", "0.58103895", "0.5796512", "0.5764575", "0.57645017", "0.5764102", "0.56903195", "0.56890893", "0.56869256", "0.5682508", "0.5679577", "0.56592876", "0.5646422", "0.56436026", "0.5642169", "0.5637054", "0.56312627", "0.5622625", "0.5620657", "0.5620657", "0.5618523", "0.5611335", "0.5610855", "0.560407", "0.5597218", "0.558938", "0.5584626", "0.5581167", "0.557714", "0.5570454", "0.5565549", "0.55543756", "0.5546292", "0.5532329", "0.55315006", "0.5527121", "0.55244565", "0.5522069", "0.55117583", "0.55109686", "0.55108994", "0.5495673", "0.547496", "0.54727125", "0.5452096", "0.5450882", "0.54294693", "0.5403168", "0.5393613", "0.5384918", "0.53779125", "0.53721905", "0.5370841", "0.5364114", "0.5355591", "0.5347456", "0.53456837", "0.5332128", "0.5331221", "0.53269684", "0.5324836", "0.5324836", "0.5324311", "0.5316477", "0.5314669", "0.53016055", "0.5297306", "0.52940243", "0.5280118", "0.5276297", "0.5273333", "0.52671194", "0.52648735", "0.5263081", "0.5262458", "0.52568245", "0.52567947", "0.52550477", "0.52546453", "0.5231533", "0.52266645", "0.5225273", "0.52206844", "0.52156955", "0.52151334" ]
0.0
-1
Files to clean up in the build directory just before finalization happens
def cleanup(pattern) @stack << Cleaner.new(pattern) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup\n remove_files(TEST_INPUT_DIR)\n remove_files(TEST_OUTPUT_DIR)\nend", "def clean\n #rm_r(srcdir)\n rm_r(blddir)\n #rm_r(libdir)\n end", "def cleanup(build_dir)\n build_dir = Pathname(build_dir)\n tmp_build_dir = Pathname('.temp-build')\n\n # copy over files we need to keep\n if File.directory?(build_dir)\n build_dir.glob(\"**/all-product-headers.yaml\").each do |file|\n intermediate = Pathname(file).relative_path_from(build_dir).dirname\n destination_dir = tmp_build_dir + intermediate\n\n FileUtils.mkdir_p(destination_dir)\n FileUtils.mv(file, destination_dir)\n end\n\n build_dir.rmtree if build_dir.directory?\n FileUtils.mv(tmp_build_dir, build_dir)\n end\nend", "def clean\n cache = Cache.instance\n # remove all built files\n cache.targets(false).each do |target|\n cache.remove_target(target)\n FileUtils.rm_f(target)\n end\n # remove all created directories if they are empty\n cache.directories(false).sort {|a, b| b.size <=> a.size}.each do |directory|\n cache.remove_directory(directory)\n next unless File.directory?(directory)\n if (Dir.entries(directory) - ['.', '..']).empty?\n Dir.rmdir(directory) rescue nil\n end\n end\n cache.write\n end", "def clean_up\n @files.each {|file| FileUtils.remove(file.path)}\n end", "def clean_up(cmd = nil)\n FileUtils.rm(\n Dir.glob('build/{src,lib}.{rb,c,js}') +\n Dir.glob('build/ruby2d-opal.{rb,js}') +\n Dir.glob('build/app.c')\n )\n if cmd == :all\n puts \"cleaning up...\"\n FileUtils.rm_f 'build/app'\n FileUtils.rm_f 'build/app.js'\n FileUtils.rm_f 'build/app.html'\n FileUtils.rm_rf 'build/ios'\n FileUtils.rm_rf 'build/tvos'\n end\nend", "def clean_files\n FileUtils.rm(Dir[File.join(Rails.root, 'public/sitemap*.xml.gz')])\n end", "def clean_up(cmd = nil)\n FileUtils.rm(\n Dir.glob('build/*.{rb,c,js}')\n )\n if cmd == :all\n puts \"cleaning up...\"\n FileUtils.rm_f 'build/app'\n FileUtils.rm_f 'build/app.js'\n FileUtils.rm_f 'build/app.html'\n FileUtils.rm_rf 'build/App.app'\n FileUtils.rm_rf 'build/ios'\n FileUtils.rm_rf 'build/tvos'\n end\nend", "def cleanup\n tmpdir = File.join(OBS_BUILD_DIR,OBS_LOCAL_TMP)\n if File.exists?(tmpdir)\n FileUtils.rm_rf(tmpdir)\n end\n end", "def cleanall\n FileUtils.rm_r(OUTPUT_DIR, force: true, verbose: true)\n end", "def cleanup\n FileUtils.rm(@out_filename)\n\n # XXX: could be rm-rf, but be safe for now. Might have\n # problems if app creates files in $PWD\n FileUtils.rmdir(@opts[:tmpdir])\n end", "def clean!\n stop\n FileUtils.remove_entry(download_path) if File.exists? download_path\n FileUtils.remove_entry(tmp_save_dir, true) if File.exists? tmp_save_dir\n FileUtils.remove_entry(instance_dir, true) if File.exists? instance_dir\n FileUtils.remove_entry(md5sum_path) if File.exists? md5sum_path\n FileUtils.remove_entry(version_file) if File.exists? version_file\n end", "def clean!\n stop\n FileUtils.remove_entry(download_path) if File.exists? download_path\n FileUtils.remove_entry(tmp_save_dir, true) if File.exists? tmp_save_dir\n FileUtils.remove_entry(instance_dir, true) if File.exists? instance_dir\n FileUtils.remove_entry(md5sum_path) if File.exists? md5sum_path\n FileUtils.remove_entry(version_file) if File.exists? version_file\n end", "def cleanIntermediateFiles()\n puts \"Deleting intermediate files\"\n deleteTempFilesCmd = \"rm *.sam *.sai\"\n `#{deleteTempFilesCmd}`\n\n # Be careful here, delete only _sorted.bam\n puts \"Deleting intermediate BAM file\"\n deleteTempBAMFileCmd = \"rm *_sorted.bam\"\n `#{deleteTempBAMFileCmd}`\n\n makeDirCmd = \"mkdir casava_fastq\"\n `#{makeDirCmd}`\n moveCmd = \"mv *.fastq.gz ./casava_fastq\"\n `#{moveCmd}`\n end", "def cleanIntermediateFiles()\n puts \"Deleting intermediate files\"\n deleteTempFilesCmd = \"rm *.sam *.sai\"\n `#{deleteTempFilesCmd}`\n\n # Be careful here, delete only _sorted.bam\n puts \"Deleting intermediate BAM file\"\n deleteTempBAMFileCmd = \"rm *_sorted.bam\"\n `#{deleteTempBAMFileCmd}`\n\n makeDirCmd = \"mkdir casava_fastq\"\n `#{makeDirCmd}`\n moveCmd = \"mv *.fastq.gz ./casava_fastq\"\n `#{moveCmd}`\n end", "def preclean_project\n # Clean-up non-useful files (if any)\n clean_msg = `make clean 2>&1`\n @log_file.puts \"\\nNettoyage du répertoire :\\n\\n#{clean_msg}\"\n \n # I want to be sure...\n FileUtils::rm_f Dir.glob(\"*.o\")\n FileUtils::rm_f Dir.glob(\"*~\")\n end", "def cleanup()\n @definition.temporary_files.each do |file|\n if File.exists?(file) && File.writable?(file)\n File.delete(file)\n end\n end\n if @environment.verbose\n puts \"========== END #{@definition.name} ============\"\n end\n end", "def clean!\n stop\n remove_instance_dir!\n FileUtils.remove_entry(config.download_path) if File.exists?(config.download_path)\n FileUtils.remove_entry(config.tmp_save_dir, true) if File.exists? config.tmp_save_dir\n md5.clean!\n FileUtils.remove_entry(config.version_file) if File.exists? config.version_file\n end", "def clean_build_directory\n FileUtils.rm_rf Dir.glob(File.join(@project.build_path, '*'))\n end", "def cleanup\n cleanup_unpack_path\n cleanup_download_path\n end", "def clean_up\n FileUtils.rm_rf @temp_root\n end", "def cleanup!\n FileUtils.rm_rf(obsolete_files)\n FileUtils.rm_rf(metadata_file) unless @site.incremental?\n end", "def cleanup_files\n FileUtils.rm_rf(File.join(Rails.root, \"tmp\"))\n end", "def clean_files\n ck_valid\n File.unlink(pid_file) if File.exists?(pid_file)\n File.unlink(prof_file) if File.exists?(prof_file)\n File.unlink(socket_file) if File.exists?(socket_file)\n end", "def cleanup\n reshaper_orig_cleanup\n\n # remove some unwanted pages\n pages.delete_if do |page|\n path = page.destination(source)\n path =~ /shared\\/layouts/ or\n path =~ /shared\\/includes/\n end\n\n # remove some unwanted static files\n static_files.delete_if do |file|\n file.path =~ /shared\\/includes/ or\n file.path =~ /\\.styl$/ or # stylus files should be generated into site.css\n file.path =~ /readme\\./ # readme files are for github\n end\n\n end", "def clean_up\n FileUtils.rm_rf \"#{@path}\" unless create_in_current_directory?\n FileUtils.rm_rf \"#{@cache}\"\n end", "def clean\n FileUtils.rm(\"#{build_name}.json\")\n end", "def clean_up()\n File.delete(ZIP_FILE)\n end", "def clean_environment\n `rm -rf /tmp/#{@upload_id}` # all sliced pages of the source file\n end", "def cleanup_dirs\n @cleanup_dirs ||= ['.']\n end", "def purgeFiles\n Dir[\"#{@pagespath}/*\"].reject{ |f| f[\"#{@pagespath}/.keep\"] }.each do |filename|\n File.delete filename\n end\n\n Dir[\"#{@assetpath}/*\"].reject{ |f| f[\"#{@pagespath}/.keep\"] }.each do |filename|\n File.delete filename\n end\n end", "def cleanUpWorkingFiles()\n system(\"rm -f #{@tripFile} #{routeFile} #{routeAltFile}\") ;\n end", "def cleanup\n sh 'rm -rf _site'\n compass('clean')\nend", "def tidy_up\n Dir[\"*nin\"].each do |file|\n File.delete(file)\n end\n Dir[\"*nhr\"].each do |file|\n File.delete(file)\n end\n Dir[\"*nsq\"].each do |file|\n File.delete(file)\n end\n Dir[\"*blast\"].each do |file|\n File.delete(file)\n end\n end", "def cleanup\n FileUtils.rm_rf(sfx_cache_path)\n end", "def clean_up\n puts \"Run the following commands to clean up your test data:\"\n puts \"oc delete pv --all\"\n puts \"oc delete pvc --all\"\n puts \"Deleting temporary test files\"\n `rm -rf #{$templates_path}/*`\nend", "def clean_up\n Dir.foreach(Dir.pwd) do |f|\n if !f.start_with?('tmp_') then next\n elsif File.directory?(f) then FileUtils.rm_rf(f)\n else FileUtils.rm(f)\n end\n end\nend", "def cleanup\n @agent_file_history.each { |af| FileUtils.rm_f(af) }\n @key_file_history.each { |kf| FileUtils.rm_f(kf) }\n end", "def cleanup\n File.delete(temp_file_path)\n end", "def finalize_dirs\n @finalize_dirs || Dbt::Config.default_finalize_dirs\n end", "def cleanup\n FileUtils.rm_f Dir.glob(File.join(config.folder, '*.items'))\n end", "def teardown\n [\"file1\", \"file2\", \"file3\"].each {|f| FileUtils.rm f}\n Dir[\"test/backup/file*\"].each {|f| FileUtils.rm f}\n Dir[\"test/backup/*.tar.gz\"].each {|f| FileUtils.rm f}\n Dir.rmdir \"test/backup\" if File.exists? \"test/backup\"\n end", "def clean!\n FileUtils.rm(self[:build_path]) if File.exist?(self[:build_path])\n FileUtils.rm(self[:staging_path]) if File.exist?(self[:staging_path])\n return self\n end", "def cleanup\n\t\tfile_count = 0\n\t\tif File.directory?(@file_path)\n\t\t\tDir.foreach(@file_path) do |f|\n\t\t\t\tfile_count += 1\n\t\t\t fn = File.join(@file_path, f)\n\t\t\t File.delete(fn) if f != '.' && f != '..'\n\t\t\tend\n\t\t\tDir.delete(@file_path)\n\t\t\tmsg = \"Cleaned up #{file_count} files\"\n\t\telse\n\t\t\thalt 422, \"No directory\"\n\t\tend\n\t\t{ msg: msg }\n\tend", "def cleanup!; end", "def cleanup!; end", "def pkg_clean\n sysprint \"#{@name} clean\"\n\n FileUtils::rm_rf(@objdir, :secure => true)\n end", "def clean_app()\n wd = FileUtils.pwd()\n FileUtils.rm_f( [\n '/app/assets/*',\n '/app/components/*',\n '/app/controllers/*',\n '/app/helpers/*',\n '/app/models/*',\n '/app/views/*'\n ].collect!{|e| Dir.glob(wd + e)}.flatten.compact )\n end", "def cleanup_oldies\n debug_msg \"Removing old builds\"\n to_remove = []\n @builds.simple_builds.each do |build|\n current = nil\n build.versioned_builds.sort.each do |versioned|\n to_remove << current if current && current.same_minor?(versioned)\n current = versioned\n end\n end\n to_remove.each do |build|\n debug_msg \" - #{build}\"\n FileUtils.rm_rf File.join(@public_dir, build.to_s)\n end\n @builds.merged_builds.each do |merged|\n to_remove.each do |build|\n if merged.include? build\n debug_msg \" - #{merged}\"\n FileUtils.rm_rf File.join(@public_dir, merged.to_s) \n end\n end\n end\n \n end", "def tidy_up\n return if DEBUG\n\n puts heading(\"Tidying up PWD\")\n\n FileUtils.remove(Dir[\"#{FileUtils.pwd}/bugsnag-*.tgz\"])\nend", "def cleanup\n\tsh 'del /F /Q .\\_site\\*'\n\t# sh 'rm -rf ./_site'\nend", "def clean\n Dir.foreach(@wd) do |file|\n next if file.start_with?('.') or (file == \"config\")\n filename = File.join(@wd, file)\n FileUtils.remove_file(filename) if File.file?(filename)\n end\n end", "def after_destroy\n bundle_dir = File.join( self.userfolder, self.bundle_src_folder )\n logger.info(\"==================> Remove all bundle files for: \" + bundle_dir )\n %x[rm -f -R #{bundle_dir}]\n \n # delete bundle image file name\n %x[rm #{fq_bundle_image_filename('*')}]\n \n #delete sample audio prompt\n %x[rm #{fq_bundle_sample_prompt}]\n end", "def cleanup_state\n delete_if_exists(state_file_path)\n delete_if_exists(chef_file_path)\n delete_if_exists(past_scripts_path)\n delete_if_exists(log_path)\n end", "def cleanup; end", "def cleanup; end", "def cleanup; end", "def cleanup; end", "def cleanup\n close_file_appender\n archive_run_result if (defined? @results_archive) && @archive_results\n end", "def teardown\n FileUtils.rm_rf(\"test/resources/IncludesSinceTestRepository\")\n end", "def cleanup\n end", "def cleanup\n end", "def cleanup\n end", "def cleanup\n end", "def cleanup(prefix)\n print_header \"Cleaning up ...\"\n Constants::SOFTWARE.each do |sw|\n cmd \"rm #{prefix}/#{sw}.tar.gz; rm -rf #{prefix}/#{sw}\" if File.exist? \"#{prefix}/#{sw}.tar.gz\"\n end\n end", "def purge_output\n Dir.glob dir(\"output/**/*\") do |item|\n next if File.directory? item\n File.delete item unless @touchedfiles.include? undir(item)\n end\n end", "def clean\n needs_cleaning = File.exist?(project_dir)\n if needs_cleaning\n log.info(log_key) { \"Cleaning project directory `#{project_dir}'\" }\n FileUtils.rm_rf(project_dir)\n end\n create_required_directories\n deploy\n needs_cleaning\n end", "def clean(ant)\n @build_dir.delete\n end", "def clean()\n\t\ttmpdir = Dir.open(@tmpout) do |dir|\n\t\t\tdir.each do |file|\n\t\t\t\tif file != \".\" and file != \"..\" then\n\t\t\t\t\tFile.unlink(@tmpout + \"/\" + file)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tDir.rmdir @tmpout\n\tend", "def cleanup\n if File.exist?(@scalerui_dir)\n print \"Cleaning up directories...\"\n FileUtils.rm_r(@scalerui_dir)\n puts \"done\"\n else\n puts \"Nothing to clean up!\"\n end\n end", "def finalise\n end", "def cleanup\n\n # ----------------------------------------------\n account_name = 'your account name' # <-- change this!\n project_name = 'your project name' # <-- change this!\n # ----------------------------------------------\n\n project_dir = \"/home/#{account_name}/www\"\n Dir.chdir(project_dir)\n\n Dir.entries(project_name).select do |entry1|\n\n dir1 = File.join(project_name,entry1) #dir2 = \"#{project_name}/#{entry1}\"\n if is_directory?(dir1)\n Dir.entries(dir1).select do |entry2|\n \n dir2 = File.join(dir1,entry2) #dir2 = \"#{project_name}/#{entry1}/#{entry2}\"\n if is_directory?(dir2)\n Dir.entries(dir2).select do |entry3|\n \n dir3 = File.join(dir2,entry3) #dir3 = \"#{project_name}/#{entry1}/#{entry2}/#{entry3}\"\n if is_directory?(dir3)\n Dir.entries(dir3).select do |entry4|\n delete_file(File.join(dir3,entry4))\n end\n end\n\n delete_file(dir3)\n delete_dir(dir3)\n end\n end\n\n delete_file(dir2)\n delete_dir(dir2)\n end\n end\n\n delete_file(dir1)\n delete_dir(dir1)\n end\n\n delete_dir(project_name)\nend", "def cleanup_nontarget_files\n\n delete_dir = File.expand_path(File.join(app.build_dir, 'Resources/', 'Base.lproj/', 'assets/', 'images/'))\n\n puts_blue \"Cleaning up excess image files from target '#{options.Target}'\"\n puts_red \"Images for the following targets are being deleted from the build directory:\"\n\n (options.Targets.keys - [options.Target]).each do |target|\n\n puts_red \"#{target.to_s}\"\n Dir.glob(\"#{delete_dir}/**/#{target}-*.{jpg,png,gif}\").each do |f|\n puts_red \" Deleting #{File.basename(f)}\"\n File.delete(f)\n end\n end\n\n puts_red \"\\nImages prefixed all- are being deleted if a corresponding #{options.Target}- exists.\"\n\n Dir.glob(\"#{delete_dir}/**/all-*.{jpg,png,gif}\").each do |f|\n if File.exist?( f.sub(\"all-\", \"#{options.Target}-\") )\n puts_red \" Deleting #{File.basename(f)}\"\n File.delete(f)\n end\n end\n\n\n end", "def clean_sprockets_assets\n manifest.clean(backups_to_keep)\n end", "def cleanup\n end", "def cleanup\n end", "def cleanup\n end", "def clean_tests\n puts \"Removing generated tests from '#{Settings[:test_dir]}'...\"\n Dir.foreach(Settings[:test_dir]) do |dir|\n path = Pathname.new(Settings[:test_dir]) + dir\n next if dir == '.' or dir == '..' or dir == 'support' or not path.directory?\n FileUtils.rm_rf(path)\n end\nend", "def cleanup\n end", "def cleanup\n end", "def prepare_for_development\n FileUtils.rm_r(Dir[File.join(@context.gen_root, '*')])\n FileUtils.rm(\n File.join(@context.public_root, 'bundle.css'),\n :force => true\n )\n end", "def finalize!\n all_files.each { |f| Kernel.require f } if eager_load\n all_files.clear\n self\n end", "def clear!\r\n @last_build_file.delete()\r\n end", "def cleanup\n Util.rm_if_necessary(headers_path)\n Util.rm_if_necessary(body_path)\n end", "def cleanup\r\n end", "def cleanup\n begin\n File.delete(full_filename, full_filename + \".meta\")\n rescue\n logger.warn \"Unable to delete recordings files: #{full_filename}*\"\n end\n end", "def remove_files_we_dont_need\n say 'Remove files we don\\'t need'\n build :remove_public_index\n build :remove_readme_rdoc\n end", "def clean_up\n execute(\"rm -rf #{namespace_dir}\")\n end", "def cleanup\n winrm.run_cmd( \"del #{base64_file_name} /F /Q\" )\n winrm.run_cmd( \"del #{command_file_name} /F /Q\" )\n end", "def cleanup_app_caches(app_name, instance_name)\n Dir.chdir RailsPwnerer::Config[app_name, instance_name][:app_path] do\n if File.exist?('Gemfile')\n Kernel.system 'bundle exec rake assets:clean RAILS_ENV=production'\n else\n Kernel.system 'rake assets:clean RAILS_ENV=production'\n end\n end\n end", "def close_files\n [self.source, self.original, self.destination].each do |f|\n next unless f\n begin\n f.close\n File.unlink(f) if SystemInformation.env == 'production'\n rescue\n nil\n end\n end\n end", "def clear\n Dir[File.join(@output_dir, '*')].each do |path|\n File.delete(path)\n end\n end", "def clean_installation\n clean_paths.each { |path| FileUtils.rm_rf(path) }\n end", "def post_process(file)\n if File.basename(file.to_s).match(/library/)\n oldfile = file\n file = file.to_s.sub(\"library\", @options[:lib_name_u])\n FileUtils.mv(oldfile, file)\n end\n if File.dirname(file.to_s).split(\"/\").last == \"library\"\n origdir = File.dirname(file.to_s)\n dirarr = origdir.split(\"/\")\n dirarr[dirarr.size-1] = @options[:lib_name_u]\n new_dir = File.join(dirarr)\n mkdir(new_dir)\n oldfile = file\n file = File.join(new_dir, File.basename(file))\n FileUtils.mv(oldfile, file)\n FileUtils.rmdir(origdir)\n end\n if file.to_s.match(/\\.seed$/)\n out_file = Pathname.new(file.to_s.sub(/\\.seed$/, ''))\n # Don't overwrite a file of the same name, unless they --force\n if copy_check(out_file)\n template = ::ERB.new(File.read(file))\n # This binding has access to any instance variables of\n # the ProjectCreator instance\n result = template.result(binding)\n File.open(file.to_s.sub(/\\.seed$/,''), 'w+') do |io|\n io.puts result\n end\n end\n # Remove the seed file whether we copied or not\n FileUtils.rm_f(file)\n end\n end", "def clobber\n rm_r(srcdir)\n rm_r(blddir)\n rm_r(libdir)\n rm_r(config_file)\n end", "def clean\n FileUtils.remove_dir(@log_dir, true)\n end", "def finalize_dirs\n @finalize_dirs || DbTasks::Config.default_finalize_dirs\n end", "def bootstrap_cleanup\n end", "def clean()\n\t\tSystem::clean target()\n\tend", "def clean()\n\t\tSystem::clean target()\n\tend", "def clean_debris \n objdirs = File.join(\"**/\", \"obj\")\n userfiles = File.join(\"**/\", \"*.vcxproj.user\")\n\n delete_list = FileList.new(objdirs, userfiles)\n delete_list.each do |file|\n puts \"Removing #{file}\"\n FileUtils.rm_rf(\"#{file}\")\n end\nend" ]
[ "0.74821997", "0.73111963", "0.73092467", "0.7293423", "0.72630394", "0.7204535", "0.7179331", "0.71490556", "0.71440876", "0.7125522", "0.7108553", "0.7068123", "0.7068123", "0.703793", "0.703793", "0.7036852", "0.7023799", "0.7000978", "0.6981148", "0.68912953", "0.6888974", "0.6886777", "0.6832849", "0.6814494", "0.6803278", "0.67813146", "0.67450386", "0.6738077", "0.67299974", "0.6726788", "0.67222357", "0.67187685", "0.66885394", "0.667036", "0.6663578", "0.6656221", "0.6635587", "0.6582983", "0.6576769", "0.6554373", "0.6540009", "0.65246576", "0.65139025", "0.64755374", "0.6470704", "0.6470704", "0.6451716", "0.64490753", "0.6447817", "0.64450705", "0.6443761", "0.6442451", "0.64367473", "0.64289194", "0.6420085", "0.6420085", "0.6420085", "0.6420085", "0.64180154", "0.64121103", "0.64106196", "0.64106196", "0.64106196", "0.64106196", "0.64056146", "0.6396762", "0.63904524", "0.63868415", "0.6382666", "0.6364573", "0.6363819", "0.6362256", "0.63542753", "0.63525814", "0.6348415", "0.6348415", "0.6348415", "0.63434637", "0.63354826", "0.63354826", "0.6333671", "0.6332015", "0.6321929", "0.6318178", "0.630187", "0.629847", "0.6289813", "0.62897116", "0.62857795", "0.6284674", "0.6281043", "0.6280863", "0.6269071", "0.6268394", "0.62604797", "0.6257998", "0.6257719", "0.62511796", "0.6246084", "0.6246084", "0.6235525" ]
0.0
-1
Generates a banner if a block is given, or returns the currently set banner. It automatically takes care of adding comment marks around the banner. The default banner looks like this: ======================= = Version : v1.0.0 = = Date : 20120620 = =======================
def banner(options = {}, &_block) options = { comment: :js }.update(options) if block_given? @_banner = yield.to_s elsif !@_banner @_banner = default_banner.join("\n") end if options[:comment] comment(@_banner, style: options[:comment]) else @_banner end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def banner(options = {}, &block)\n options = {\n :comment => :js\n }.update(options)\n \n if block_given?\n @_banner = yield.to_s\n elsif !@_banner\n banner = []\n banner << \"Version : #{self.scm.version}\"\n banner << \"Date : #{self.scm.date.strftime(\"%Y-%m-%d\")}\"\n\n size = banner.inject(0){|mem,b| b.size > mem ? b.size : mem }\n banner.map!{|b| \"= #{b.ljust(size)} =\" }\n div = \"=\" * banner.first.size\n banner.unshift(div)\n banner << div\n @_banner = banner.join(\"\\n\")\n end\n \n if options[:comment]\n self.comment(@_banner, :style => options[:comment])\n else\n @_banner\n end\n end", "def banner(context, block)\n context.instance_eval(&block)\n end", "def banner(arg=nil)\n @banner = arg if arg\n @banner || description\n end", "def banner\n unless @banner\n @banner = +\"Usage: #{program_name} [options]\"\n visit(:add_banner, @banner)\n end\n @banner\n end", "def banner\n checkConnection()\n @banner\n end", "def banner\n checkConnection()\n @banner\n end", "def showBanner\n\treturn unless $options.show_banner\n\tputs <<BANNER\n ____ ____ ____ ___________ ____ __ __ ______\n / ___\\\\_/ __ \\\\ / \\\\_/ __ \\\\_ __ \\\\/ _ \\\\| | \\\\/ ___/\n / /_/ > ___/| | \\\\ ___/| | \\\\( <_> ) | /\\\\___ \\\\\n \\\\___ / \\\\___ >___| /\\\\___ >__| \\\\____/|____//____ >\n\\\\_____/ \\\\/ \\\\/ \\\\/ project generator \\\\/\n\nBANNER\nend", "def banner\n self.class.instance_variable_get(:@__banner)\n end", "def banner\n say %(\n\n ******************************************************************\n\n Your extension has been generated with a gemspec dependency on\n Archangel ~> v#{archangel_version}\n\n I have a feeling you're about to build something amazing.\n\n ******************************************************************\n\n )\n end", "def banner\n return \"codnar-weave - Weave documentation chunks to a single HTML.\"\n end", "def print_banner(meta_info = nil)\n banner = meta_info.nil? ? \"#{@banner}\" : \"#{meta_info}\\n #{@banner}\"\n puts banner\n end", "def banner_copyright\n return unless banner\n\n %(Header photo: &copy; <a href=\"#{banner.url}\">#{banner.author}</a>)\n end", "def banner(banner_src)\n content_for(:custom_banner) { banner_src.html_safe }\n end", "def banner\n <<-EOS\nUsage #{$0} GeneratorName [license=#{LICENSES.join('|')}] [migration=true] [dir=/dir/to/install] [named=true]\n\nOptional arguments:\n\n named : When =true, generates a NamedBase generator.\n\n license : The license to install in the generator.\n\n migration : When =true (or when the generator name ends in\n 'migration') adds extra code to the generator.\n\n dir : Directory to install into. vendor/generator/generator_name\n is the default.\n\nEOS\n end", "def banner(text)\n @__banner = text.strip\n end", "def banner(value = (not_set = true))\n if not_set\n @properties[:banner]\n else\n @properties[:banner] = value\n end\n end", "def print_banner\n print_line BANNER\n print_line\n print_line\n end", "def banner\n lines = []\n \n name_line = \"#{ name } role\"\n lines << name_line\n lines << \"=\" * name_line.length\n lines << ''\n if meta['description']\n lines << meta['description']\n lines << ''\n end\n lines << 'Usage:'\n lines << ''\n lines << \" #{ usage }\"\n lines << ''\n lines << ''\n \n lines.join(\"\\n\")\n end", "def banner()\n print \"\"\" \n =================================================================\n =================================================================\n\t ==========International Morse Code translator v 0.0.1 =========\n ==========Transates user supplied Morse Code to text ============\n\t =================================================================\n ==========Coded by Rick Flores | nanotechz9l ====================\n ==========E-mail 0xnanoquetz9l<<\\|/>>gmail.com ===================\n\t =================================================================\n =================================================================\n \n\"\"\".foreground(:blue).bright\nend", "def banner(arg=nil)\n arg.nil? ? @option_parser.banner : (@option_parser.banner = arg)\n end", "def banner\n\t\t\t@banner || \"Usage: #{program_prefix} [arguments]\"\n\t\tend", "def banner\n @data['banner']\n end", "def banner\n puts \"TITO-BOT\\n\"\nend", "def banner(text, line_width=40)\n banner_text = \"=\" * line_width\n banner_text << \"\\n\"\n banner_text << text.center(line_width)\n banner_text << \"\\n\"\n banner_text << \"=\" * line_width\n puts banner_text\n nil\n end", "def test_default_banner\n release = @rogerfile.release(scm: :fixed)\n\n # Set fixed version\n date = Time.now\n release.scm.version = \"1.0.0\"\n release.scm.date = date\n\n lines = release.banner.split(\"\\n\")\n\n assert_equal \"/* ====================== */\", lines[0]\n assert_equal \"/* = Version : 1.0.0 = */\", lines[1]\n assert_equal \"/* = Date : #{date.strftime('%Y-%m-%d')} = */\", lines[2]\n assert_equal \"/* ====================== */\", lines[3]\n end", "def banner_for(user, height=100)\n image_tag(url_for(user.set_banner(height)))\n end", "def banner\r\n \"Usage: #{$0} generator [options] [args]\"\r\n end", "def draw_banner\n bmp = Cache.picture(@quest.banner) # Get Picture\n # Shift the hue if requested\n bmp.hue_change(@quest.banner_hue) unless @quest.banner_hue == 0\n x = (contents_width - bmp.rect.width) / 2\n if x < 0 # Stretch horizontally if the banner is too wide\n dest_rect = bmp.rect.dup\n dest_rect.width = contents_width\n contents.stretch_blt(dest_rect, bmp, bmp.rect)\n else\n contents.blt(x, @draw_y, bmp, bmp.rect)\n end\n bmp.dispose\n end", "def build_doc_block(comment_block)\n yaml_match = /^\\s*---\\s(.*?)\\s---$/m.match(comment_block)\n return unless yaml_match\n markdown = comment_block.sub(yaml_match[0], '')\n\n begin\n config = YAML::load(yaml_match[1])\n rescue\n display_error(\"Could not parse YAML:\\n#{yaml_match[1]}\")\n end\n\n if config['name'].nil?\n puts \"Missing required name config value. This hologram comment will be skipped. \\n #{config.inspect}\"\n else\n doc_block = DocumentBlock.new(config, markdown)\n end\n end", "def game_banner\n puts <<-GRID\n ####### ####### ########{' '}\n # # ##{' '}\n # # ##{' '}\n # ## #### # #### #### # #### ####{' '}\n # # # # # # # # # ## ## # ##{' '}\n # # # # #### # # # # ######{' '}\n # # ## # # # ## # ## ## ##{' '}\n ### ### #### ### ##### #### ### #### ####\n GRID\nend", "def banner\n \"#{basename} #{self_command.formatted_usage(self, false)}\"\n end", "def banner\n \"Usage: #{$0} minimal_cart\"\n end", "def banner(_config, message )\r\n\t_config.vm.provision \"shell\", privileged: true, inline: <<-BANNER\r\n\t\tdpkg -l | grep -q sysvbanner || apt install -y sysvbanner\r\n\t\techo\t'################################################################################'\r\n\t\techo\r\n\t\twhich banner > /dev/null 2>&1 && banner #{message} || echo #{message}\r\n\t\techo\r\n\t\techo\t'################################################################################'\r\n\tBANNER\r\nend", "def block_name \n :CodeBlock \n end", "def block_name \n :CodeBlock \n end", "def banner\n\tputs\n\tputs \"#{HC}#{FWHT}Linux Log Cleaner\"\n\tputs \"By: #{FGRN}Hood3dRob1n#{RS}\"\n\tputs\nend", "def banner\n \"Usage: #{$0} #{spec.name} <action>\"\n end", "def banner s; @order << [:text, s] end", "def print_banner(banner_text, output)\n banner = Artii::Base.new\n output.puts\n output.puts banner.asciify(\" #{banner_text}\")\n output.puts\nend", "def banner\n \"Usage #{$0} compass_sass somethingelse whoknowswhat\"\n end", "def print_banner\n notice( \"\\n=== #{@key} ===\", [:CYAN, :BOLD])\n notice( description, [:CYAN] )\n notice( \"----> OS value: #{os_value.inspect}\", [:CYAN] ) if os_value\n notice( \"----> Recommended value: #{recommended_value.inspect}\", [:CYAN] ) if recommended_value\n end", "def cli_banner()\n print \"> \"\n end", "def get_banner\n @server.make_request('show.getbanner', tvdbid: @tvdbid)\n end", "def to_s\n @banner + \"\\n\\n\" + @doc.join(\"\\n\") + \"\\n\"\n end", "def block(options)\n [\n %[snippet #{options[:name]} \"#{options[:desc]}\"],\n options[:snip],\n \"endsnippet\"\n ].join(\"\\n\")\n end", "def sdk_block\n @sdk_block ||=\n Rails.cache.fetch([\"Block\", block_hash, \"object\"], expires_in: 1.hour) do\n CKB::Types::Block.from_h(original_raw_hash)\n end\n end", "def block_name\n if @split_across\n if @block_method == :count\n \"Block #{@block_num}/#{@num_blocks} (across dataset)\"\n else\n \"Block #{@block_num} of #{@block_size} words (across dataset)\"\n end\n else\n if @block_method == :count\n \"Block #{@block_num}/#{@num_blocks} (within \\\"#{@current_doc.title}\\\")\"\n else\n \"Block #{@block_num} of #{@block_size} words (within \\\"#{@current_doc.title}\\\")\"\n end\n end\n end", "def show\n banner = Banner.where(area: Banner.areas[:MemberShow]).first\n if banner\n @banner_image = banner.desktop_image.url\n @banner_url = banner.desktop_url\n end\n end", "def print_banner\n return if @silent\n say_blue \"=== #{@key} ===\", ['BOLD']\n say_blue description\n say_blue \" - os value: #{os_value}\" if os_value\n say_blue \" - os value: #{puppet_value}\" if puppet_value\n say_blue \" - recommended value: #{recommended_value}\" if recommended_value\n say_blue \" - chosen value: #{@value}\" if @value\n end", "def banner\n \"Usage: #{$0} #{spec.name} #{spec.name.camelize}Name [options]\"\n end", "def rails_banner\n env = defined?(Rails) ? Rails.env : 'development'\n\n puts Pry::Helpers::Text.__send__(ENV_COLORS[env], Object.const_get(\"#{env.upcase}_BANNER\"))\n\n ''\nend", "def banner\n \"Usage: #{$0} cmt ModelName field:type, field:type\"\n end", "def find_banner\n values = {\n left_border: @place.longitude-0.2,\n right_border: @place.longitude+0.2,\n top_border: @place.latitude+0.2,\n bottom_border: @place.latitude-0.2,\n self_id: @place.id\n }\n\n Banner.where(place_id: Place.where('latitude > :bottom_border and latitude < :top_border\n and longitude > :left_border and longitude < :right_border\n and id != :self_id and display_my_banners = true',\n values)).sample\n end", "def help; summarize(\"#{banner}\".sub(/\\n?\\z/, \"\\n\")) end", "def banner(msg)\n puts \"\\n #{'*' * (msg.size + 6)}\"\n puts \" * #{msg} *\"\n puts \" #{'*' * (msg.size + 6)}\\n\"\nend", "def display_banner()\n\n\tr = Random.rand(1..4)\n\n\tcase r\n\twhen 1\n\t\tputs \"\n\t.------..------..------..------..------.\n\t|D.--. ||V.--. ||A.--. ||S.--. ||H.--. |\n\t| :/\\\\: || :(): || (\\\\/) || :/\\\\: || :/\\\\: |\n\t| (__) || ()() || :\\\\/: || :\\\\/: || (__) |\n\t| '--'D|| '--'V|| '--'A|| '--'S|| '--'H|\n\t`------'`------'`------'`------'`------'\n\n\n\t\t\"\n\twhen 2\n\t\tputs \"\n\t@@@@@@@ @@@ @@@ @@@@@@ @@@@@@ @@@ @@@ \n\t@@@@@@@@ @@@ @@@ @@@@@@@@ @@@@@@@ @@@ @@@ \n\t@@! @@@ @@! @@@ @@! @@@ !@@ @@! @@@ \n\t!@! @!@ !@! @!@ !@! @!@ !@! !@! @!@ \n\t@!@ !@! @!@ !@! @!@!@!@! !!@@!! @!@!@!@! \n\t!@! !!! !@! !!! !!!@!!!! !!@!!! !!!@!!!! \n\t!!: !!! :!: !!: !!: !!! !:! !!: !!! \n\t:!: !:! ::!!:! :!: !:! !:! :!: !:! \n\t :::: :: :::: :: ::: :::: :: :: ::: \n\t:: : : : : : : :: : : : : :\n\t\n\n\t\t\"\n\twhen 3\n\t\tputs \"\n\n\t\t ^^ .-=-=-=-. ^^\n\t ^^ (`-=-=-=-=-`) ^^\n\t (`-=-=-=-=-=-=-`) ^^ ^^\n\t ^^ (`-=-=-=-=-=-=-=-`) ^^ ^^\n\t ( `-=-=-=-(@)-=-=-` ) ^^\n\t (`-=-=-=-=-=-=-=-=-`) ^^\n\t (`-=-=-=-=-=-=-=-=-`) ^^\n\t (`-=-=-=-=-=-=-=-=-`) ^^\n\t (`-=-=-=-=-=-=-=-=-`) ^^\n\t (`-=-=-=-=-=-=-=-`) ^^\n\t (`-=-=-=-=-=-=-`) ^^ ^^\n\t dvash (`-=-=-=-=-`)\n\t `-=-=-=-=-`\n\n\n\t\t\"\n\twhen 4\n\t\tputs \"\n\n\t _______________\n\t //~~~~~~~~~~~~~~~\\\\\\\\ |\n\t 0 / /_________________\\\\ \\\\| 0\n\t ---------------------------\n\t / /======|=D=V=A=S=H=|======\\\\ \\\\\n\t \\\\_____________________________/\n\t \\\\ _______ _______ /\n\t |\\\\ _/|__|__|\\\\_____/|__|__|\\\\_ /|\n\t | |`V' `---' `V'| |\n\t |______| |______|\n\t\t\n\n\t\t\"\n\tend\nend", "def get_html_banner()\n\t\t\t\thtml = %Q{\n\t\t\t\t\t<html><body bgcolor=black style=\"color:cyan; font-family: monospace\">\n\t\t\t\t\t\t<pre>#{Xssf::XssfBanner::Logos[2]}</pre><h3 style=\"position:absolute; right:1%; top:75%\" align=\"right\"><u>msf ></u> _</h3>\n\t\t\t\t\t\t<table width=\"300\" height=\"35\" style=\"border: 1px solid green; position:absolute; left:450px; top:30%\">\n\t\t\t\t\t\t\t<tr align=center>\n\t\t\t\t\t\t\t\t<td width=\"33%\" onMouseover=\"this.bgColor='green'\" onMouseout=\"this.bgColor='black'\"\n\t\t\t\t\t\t\t\tonClick=\"parent.location='#{VICTIM_GUI}?#{PARAM_GUI_PAGE}=main';\" style=\"cursor:pointer; border: 1px solid green;\">LOGS</td>\n\t\t\t\t\t\t\t\t<td width=\"33%\" onMouseover=\"this.bgColor='green'\" onMouseout=\"this.bgColor='black'\"\n\t\t\t\t\t\t\t\tonClick=\"parent.location='#{VICTIM_GUI}?#{PARAM_GUI_PAGE}=stats';\" style=\"cursor:pointer; border: 1px solid green;\">STATS</td>\n\t\t\t\t\t\t\t\t<td width=\"33%\" onMouseover=\"this.bgColor='green'\" onMouseout=\"this.bgColor='black'\"\n\t\t\t\t\t\t\t\tonClick=\"parent.location='#{VICTIM_GUI}?#{PARAM_GUI_PAGE}=help';\" style=\"cursor:pointer; border: 1px solid green;\">HELP</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</body></html>\n\t\t\t\t}\n\t\t\t\treturn html\n\t\t\tend", "def add_doc_block(comment_block)\n yaml_match = /^\\s*---\\s(.*?)\\s---$/m.match(comment_block)\n return unless yaml_match\n\n markdown = comment_block.sub(yaml_match[0], '')\n\n begin\n config = YAML::load(yaml_match[1])\n rescue\n DisplayMessage.error(\"Could not parse YAML:\\n#{yaml_match[1]}\")\n end\n\n if config['name'].nil?\n DisplayMessage.warning(\"Missing required name config value. This hologram comment will be skipped. \\n #{config.inspect}\")\n else\n doc_block = DocumentBlock.new(config, markdown)\n end\n\n @doc_blocks[doc_block.name] = doc_block if doc_block.is_valid?\n end", "def banner\n \"Usage: #{$0} my_controller controller\"\n end", "def block_name_declaration(block_name)\n buff_code \"#{block_name} = __blocks.delete('#{block_name}') { __create_block('#{block_name}') }\"\n end", "def banner?\n @properties.key?(:banner) && !@properties[:banner].nil?\n end", "def block_definition(block_node)\n buff_code \"__blocks['#{block_node.name}'] = __create_block('#{block_node.name}', #{location_node(block_node)}) do\"\n\n code_indent do\n visit_node_children(block_node)\n end\n\n buff_code 'end'\n end", "def banner_label\n html_content[0..100]\n end", "def banner_url\n object.banner_url.url\n end", "def set_banner\n @banner = Banner.find(params[:id])\n end", "def set_banner\n @banner = Banner.find(params[:id])\n end", "def set_banner\n @banner = Banner.find(params[:id])\n end", "def set_banner\n @banner = Banner.find(params[:id])\n end", "def set_banner\n @banner = Banner.find(params[:id])\n end", "def set_banner\n @banner = Banner.find(params[:id])\n end", "def bannerUrl\n @obj['bannerUrl']\n end", "def start_comment(description = 'Description')\n str = \"#{@indent}/**\\n\"\n str += \"#{@indent} *\\t@brief\\t<##{description}#>\\n\"\n str \n end", "def entry_banner\n 'Team Meeting'\n end", "def basic_blocks\n cfg.blocks\n end", "def banner\n \"Usage: #{$0} admin_ka ModelName\"\n end", "def new\n @banner = Banner.new\n @types = Banner::TYPES\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @banner }\n end\n end", "def banner_line(end_cap_string, center_string, fill_string, banner_width)\n end_cap_string + center_string.center(banner_width, fill_string) + end_cap_string\nend", "def new\n if params[:duplicate_id] && banner_dup = Banner.find(params[:duplicate_id])\n @banner = banner_dup.dup\n @banner.name += \" (copy)\"\n @banner.confirmed = false\n\n banner_dup.helper_items.each do |hi|\n @banner.helper_items << hi.dup\n end\n\n else\n @banner = Banner.new\n @banner.start_time = Time.now.at_midnight\n @banner.end_time = 1.week.from_now.end_of_day\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @banner }\n end\n end", "def banner\n packetfu_ascii_art\n puts \">>> PacketFu Shell #{PacketFu.version}.\"\n if Process.euid.zero? && @pcaprub_loaded\n puts \">>> Use $packetfu_default.config for salient networking details.\"\n print \"IP: %-15s Mac: %s\" % [$packetfu_default.ip_saddr, $packetfu_default.eth_saddr]\n puts \" Gateway: %s\" % $packetfu_default.eth_daddr\n print \"Net: %-15s\" % [Pcap.lookupnet($packetfu_default.iface)][0]\n print \" \" * 13\n puts \"Iface: %s\" % [($packetfu_default.iface)]\n puts \">>> Packet capturing/injecting enabled.\"\n else\n print \">>> Packet capturing/injecting disabled. \"\n puts Process.euid.zero? ? \"(no PcapRub)\" : \"(not root)\"\n end\n puts \"<>\" * 36\nend", "def banner\n if(@all_images.nil?)\n @all_images = Image.all\n end\n\n if(!@all_images.empty?)\n for img in @all_images\n if(img.picture_file_name == \"Company_Logo.png\")\n @imagelogo = img.picture.url\n end\n if(img.picture_file_name == \"Company_Banner.png\")\n @imagebanner = img.picture.url\n end\n end\n end\n end", "def banner\n out = <<-EOD;\n Usage: #{$0} authenticated ModelName [ControllerName] \n EOD\n end", "def link_banner(banner)\n raise \"Zone must be saved\" if new_record?\n raise ArgumentError.new(\"Banner must be saved\")if banner.new_record?\n\n session = Base.connection\n server = XMLRPC::Client.new2(\"#{session.url}#{self.class.endpoint}\")\n server.call(\"linkBanner\", session.id, self.id, banner.id)\n end", "def entry_banner\n 'Four by four'\n end", "def _extract_block(block)\n src_file_path = block.source_location[0]\n block_start_line_number = block.source_location[1]\n\n src_file_content = File.open(src_file_path).read\n lines_after_block_start = src_file_content.split(\"\\n\")[block_start_line_number..-1]\n\n # block already starts with one \"do\"\n do_counter = 1\n # assuming that \"do themize\" and corresponding \"end\" placed on separate lines\n block_end_index = 1\n lines_after_block_start.each_with_index do |line, i|\n # http://stackoverflow.com/a/11899069/6376451\n do_counter += line.scan(/<%.*?do.*?%>/).size\n do_counter -= line.scan(/<%.*?end.*?%>/).size\n if line =~ /\\s*<%\\s*end\\s*%>/ && do_counter == 0\n block_end_index = i\n break\n end\n end\n return nil if block_end_index == 0\n\n lines_after_block_start[0..block_end_index-1].join(\"\\n\")\n end", "def block_view(context, block_name)\n \n app = context[:app]\n \n result = case block_name\n \n when 'site_breadcrumb_public'\n\n preffixes = Plugins::Plugin.plugin_invoke_all('ignore_path_prefix_breadcrumb', {:app => self})\n\n if app.request.path_info.empty? or app.request.path_info.start_with?(*preffixes)\n bc = ''\n else\n path = app.request.path_info\n if path.match /\\/page\\/\\d+/\n path.sub!(/\\/page\\/\\d+/,'')\n end\n home_page_path = SystemConfiguration::Variable.get_value('site.anonymous_front_page', nil)\n bc = app.t.breadcrumb.home\n\n if home_page_path != path\n path_array = path.split('/')\n result = \"\"\n summary = \"\\\\\"\n bc = path_array.slice(0, path_array.size-1).inject(\"\") do |result, item| \n if item.empty?\n result << \"<a href=\\\"/\\\">#{app.t.breadcrumb.home}</a>\"\n result\n else \n result << \"<span class=\\\"breadcrumb_separator\\\"> &gt; </span> \" unless result.empty?\n result << \"<a href=\\\"#{summary}#{item}\\\">#{item.capitalize.gsub(/-/,' ')}</a>\"\n summary << \"#{item}\\\\\" \n result\n end\n end\n if path_array.size > 1\n bc << \" <span class=\\\"breadcrumb_separator\\\"> &gt; </span> <span class=\\\"breadcrumb_last\\\">#{path_array.last.capitalize.gsub(/-/,' ')}</span>\"\n end\n end\n end \n\n bc == app.t.breadcrumb.home ? '' : bc\n\n\n when 'site_breadcrumb'\n preffixes = Plugins::Plugin.plugin_invoke_all('ignore_path_prefix_breadcrumb', {:app => self})\n \n if app.request.path_info.empty? or app.request.path_info.start_with?(*preffixes)\n bc = ''\n else\n breadcrumb = Site::BreadcrumbBuilder.build(app.request.path_info, context) \n bc_render = SiteRenders::BreadcrumbRender.new(breadcrumb, context)\n bc = bc_render.render \n end \n\n bc\n\n\n when 'site_adminmenu'\n \n if app.user and app.user.is_superuser?\n \n # Retrieve the admin menu options\n admin_menu = {:name => 'admin_menu', :title => 'Admin menu', :description => 'Administration menu'}\n admin_menu_items = Plugins::Plugin.plugin_invoke_all('menu', context)\n \n menu = Site::Menu.build(admin_menu, admin_menu_items)\n menu.language_in_routes = false\n SiteRenders::MenuRender.new(menu, context).render\n \n end\n \n when /^menu_/\n \n menu_name = block_name.match(/^menu_(.+)/)[1]\n \n if menu = Site::Menu.get(menu_name)\n menu_render = SiteRenders::MenuRender.new(menu, context)\n menu_render.render\n else\n ''\n end\n \n when /^view_/ \n\n view_name = block_name.sub(/view_/,'')\n \n if view = ContentManagerSystem::View.get(view_name)\n arguments = \"\"\n if app.request.path_info and app.request.path_info.split('/').length > 2\n arguments = (x=app.request.path_info.split('/')).slice(2,x.length).join('/')\n end\n ::CMSRenders::ViewRender.new(view, app).render(1, arguments) \n else\n ''\n end\n \n when /^content_/\n \n content_id = block_name.sub(/content_/,'')\n if content = ContentManagerSystem::Content.get(content_id.to_i)\n CMSRenders::ContentRender.new(content, app).render\n else\n ''\n end \n\n\n end\n\n return result\n \n \n end", "def html_blocklike_show(title, content)\n render('layouts/block', :title => title, :content => content) unless content.blank?\n end", "def show_beta_banner\n return 1.0 if params[:beta] == 'destinations-next'\n\n # Remove this line for production launch\n false\n\n # Uncomment this for production launch\n # prng = Random.new(Time.now.to_i)\n # prng.rand < 0.0025\n end", "def create\n @banner = Banner.new(banner_params)\n exchange_attributes_params\n respond_to do |format|\n if @banner.save\n notice = 'Banner was successfully created.' \n notice += ' <span class=\"text-danger\">Error on bidder synch process. Please try again.</span>' if @banner.campaign and not @banner.campaign.update_bidder\n format.html { redirect_to @banner, notice: notice }\n format.json { render :show, status: :created, location: @banner }\n else\n format.html { render :new }\n format.json { render json: @banner.errors, status: :unprocessable_entity }\n end\n end\n end", "def banner\n \"Usage: #{$0} static_gen_specs ModelName [table_name]\"\n end", "def entry_banner\n 'Interview'\n end", "def set_banner\n @banner = Banner.find(params[:id])\n end", "def link_banner(banner)\n raise \"Zone must be saved\" if new_record?\n raise ArgumentError.new(\"Banner must be saved\")if banner.new_record?\n\n session = self.class.connection\n server = XmlrpcClient.new2(\"#{session.url}\")\n server.call(\"ox.linkBanner\", session, self.id, banner.id)\n end", "def prepare_block_str!\n raise ParserError, @block_str if @block_str.start_with? '-'\n\n @block_str = @block_str.\n gsub(/(\\d{4})/) { \"#{$1[0..1]}:#{$1[2..3]}\" }. # 4 digits\n gsub(/(\\d{3})/) { \"0#{$1[0]}:#{$1[1..2]}\" }. # 3 digits\n gsub(/now/) { RoundedTime.now.strftime('%H:%M') } # now\n\n return unless @block_str =~ HALF_BLOCK_RGX\n\n # Complete or start an ongoing block.\n @block_str = if (ob = @day.blocks.find(&:ongoing?))\n \"#{ob.start_s}-#{@block_str}\"\n else\n \"#{@block_str}-#{@block_str}\"\n end\n end", "def card_description(bug_id)\n descr = <<TXT\nBugzilla: #{bz_markdown_link(bug_id)}\n\n---\n## Review\n- Pull Request: *URL here*\nTXT\n\n # just to avoid the trailing blank errors in the heredoc\n descr + \"- \"\nend", "def blck\n MegaBar::Block.find(1)\nend", "def create_comment(string, &block); end", "def create_comment(string, &block); end", "def banner\n\tpacketfu_ascii_art\n\tputs \">>> PacketFu Shell #{PacketFu.version}.\"\n\tif Process.euid.zero? && @@pcaprub_loaded \n\t\tputs \">>> Use $packetfu_default.config for salient networking details.\"\n\t\tprint \"IP: %-15s Mac: %s\" % [$packetfu_default.ip_saddr, $packetfu_default.eth_saddr]\n\t\tputs \" Gateway: %s\" % $packetfu_default.eth_daddr\n\t\tprint \"Net: %-15s\" % [Pcap.lookupnet($packetfu_default.iface)][0]\n\t\tprint \" \" * 13 \n\t\tputs \"Iface: %s\" % [($packetfu_default.iface)]\n\t\tputs \">>> Packet capturing/injecting enabled.\"\n\telse\n\t\tprint \">>> Packet capturing/injecting disabled. \"\n\t\tputs Process.euid.zero? ? \"(no PcapRub)\" : \"(not root)\"\n\tend\n\tputs \"<>\" * 36\nend", "def blocker\n \"<div id='blocker'></div>\"\n end", "def build_vorbis_comment_block\n begin\n vorbis_comm_s = [@tags[\"vendor_tag\"].length].pack(\"V\")\n vorbis_comm_s += [@tags[\"vendor_tag\"]].pack(\"A*\")\n vorbis_comm_s += [@comment.length].pack(\"V\")\n @comment.each do |c|\n vorbis_comm_s += [c.bytesize].pack(\"V\")\n vorbis_comm_s += [c].pack(\"A*\")\n end\n vorbis_comm_s\n rescue\n raise FlacInfoWriteError, \"error building vorbis comment block\"\n end\n end" ]
[ "0.78166753", "0.70299935", "0.6992959", "0.6880235", "0.68714345", "0.68714345", "0.6574665", "0.656644", "0.6546895", "0.63553697", "0.62773603", "0.6258911", "0.6249515", "0.62452143", "0.62332374", "0.621797", "0.62174773", "0.620887", "0.6182099", "0.6050421", "0.603197", "0.59544826", "0.59438777", "0.5915186", "0.5880834", "0.5855309", "0.5849605", "0.57773596", "0.5757424", "0.5716834", "0.5694907", "0.56906813", "0.5575593", "0.55581003", "0.55581003", "0.554162", "0.55320615", "0.552155", "0.55148906", "0.5458216", "0.5446906", "0.54433703", "0.5434427", "0.54126287", "0.53927654", "0.537541", "0.5330956", "0.5328026", "0.53256726", "0.5318507", "0.5273651", "0.52708733", "0.5260903", "0.5259293", "0.52580935", "0.5241418", "0.5222778", "0.5173622", "0.5173481", "0.5144438", "0.5140675", "0.51372576", "0.5114802", "0.51074463", "0.5097108", "0.5097108", "0.5097108", "0.5097108", "0.5097108", "0.5097108", "0.5095187", "0.50899804", "0.50848657", "0.5082095", "0.50819063", "0.5070802", "0.50697225", "0.5058291", "0.5056132", "0.50541556", "0.5038064", "0.5037857", "0.5032983", "0.50308394", "0.5025422", "0.50243694", "0.50209737", "0.5018114", "0.50180656", "0.50040185", "0.50011283", "0.50006646", "0.49984404", "0.49855483", "0.49828267", "0.49796736", "0.49796736", "0.49736378", "0.4964352", "0.49567425" ]
0.7765645
1
Actually perform the release
def run! project.mode = :release # Validate paths validate_paths! # Extract mockup copy_source_path_to_build_path! validate_stack! # Run stack run_stack! # Cleanup cleanup! if config[:cleanup_build] ensure project.mode = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def release\n end", "def release\n end", "def release\n end", "def release(resource); end", "def release!\n @ec.release_temp self\n end", "def release\n locked? && release!\n end", "def release\n # @invObj.releaseObj(self)\n end", "def release(number)\n \n end", "def release\n\n a = self.to_a\n self.close\n a\n end", "def release()\n res = super(self)\n return res\n end", "def release\n\t\t@connection.transactions.release\n\tend", "def release\n action('release')\n end", "def release(point)\n\t\t\n\tend", "def release(point)\n\t\t\n\tend", "def release(point)\n\t\t\n\tend", "def release(point)\n\t\t\n\tend", "def release(ptr = nil)\n V2.raptor_free_term(self) unless ptr.null?\n end", "def release(point)\n\t\t\t\t\n\t\t\tend", "def release\n fail AlreadyRelease unless prerelease?\n @special = ''\n @metadata = ''\n end", "def release\n @connection.transactions.release\n end", "def release(resource)\n\t\t\t\t\t# A resource that is not good should also not be reusable.\n\t\t\t\t\t# unless resource.closed?\n\t\t\t\t\t\treuse(resource)\n\t\t\t\t\t# else\n\t\t\t\t\t# \tretire(resource)\n\t\t\t\t\t# end\n\t\t\t\tend", "def release!\n upload_io.close if @close_io_on_finish\n end", "def release_actions; end", "def release\n variables[:release]\n end", "def release_lock\n super\n end", "def release(n = 1)\n raise NotImplementedError\n end", "def release(plane)\n\n end", "def dispose; end", "def release\n @refresh_mutex.synchronize {\n @unlock = true\n\n delete\n\n @refresh_signal.signal\n }\n\n\n @refresh_thread.join if @refresh_thread\n @event_manager.create_event(\n {\n user: Config.current_job.username,\n action: 'release',\n object_type: 'lock',\n object_name: @name,\n task: @task_id,\n deployment: @deployment_name,\n }\n )\n end", "def release\n chk_conn\n @connected = false\n @db.release(self)\n end", "def release(key, value)\n return\n end", "def around_release\n yield\n end", "def release(resource)\n\t\t\t\t# A resource that is not good should also not be reusable.\n\t\t\t\tif resource.reusable?\n\t\t\t\t\treuse(resource)\n\t\t\t\telse\n\t\t\t\t\tretire(resource)\n\t\t\t\tend\n\t\t\tend", "def release(resource)\n\t\t\t\t# A resource that is not good should also not be reusable.\n\t\t\t\tif resource.reusable?\n\t\t\t\t\treuse(resource)\n\t\t\t\telse\n\t\t\t\t\tretire(resource)\n\t\t\t\tend\n\t\t\tend", "def unlock; end", "def release!\n PoolNode.delete(@id, node)\n end", "def teardown\n teardown_construct(@target_path)\n @release.destroy\n @release = nil\n end", "def release(resource)\n\t\t\t\t@available << resource\n\t\t\t\t\t\n\t\t\t\tif task = @waiting.pop\n\t\t\t\t\ttask.resume\n\t\t\t\tend\n\t\t\tend", "def release(job = ALL_JOBS)\n DRMAA.control(job, DRMAA::ACTION_RELEASE)\n end", "def release(point)\n\t\tsuper(point)\n\tend", "def release!\n ensure_service!\n service.delete_session path\n end", "def finalize()\n # below function is not yet fully functional\n unlock_all_instances()\n end", "def dispose\n call Memory.deAlloc(self)\n end", "def dispose\n call Memory.deAlloc(self)\n end", "def release_data!\n @data = nil\n end", "def release(job = ALL_JOBS)\n DRMAA.control(job, DRMAA::ACTION_RELEASE)\n end", "def release_task\n puts\n puts \"Release successful.\"\n end", "def release()\n fiber = Fiber.current\n if fiber[connection_pool_key]\n @busy_connections.delete(fiber)\n @connections << fiber[connection_pool_key]\n fiber[connection_pool_key] = nil\n end\n end", "def release(entry)\n @lock.synchronize do\n unlocked_release(entry.id)\n end\n end", "def dispose\n\n end", "def release\n if pointer.kind_of?(::FFI::MemoryPointer) && !pointer.null?\n pointer.free\n end\n while uri = @raptor_uri_list.pop\n V1_4.raptor_free_uri(uri) unless uri.nil? || uri.null?\n end\n end", "def on_release(&blk)\n opts[:on_release] = blk\n end", "def release\n return unless @lock_file # Skip if we don't have a file\n\n @lock_file.flock(File::LOCK_UN)\n File.delete( @lock_file )\n close_file\n end", "def release_lease(service=Azure::Blobs)\n service.lease(@blob, :release)\n end", "def release_resource(resource, authorizer=nil)\n debug \"central release_resource: '#{resource.inspect}'\"\n raise 'Method not implemented because the Central Manager just need to pass the same requisition to the other' \\\n ' brokers and create the concatenated results'\n end", "def finalize!; end", "def release_self\n # Release children resource recursively\n children.dup.each do |c|\n if c.release_self\n children.delete(c)\n end\n end\n return false unless children.empty?\n info \"Releasing hrn: #{hrn}, uid: #{uid}\"\n self.before_release if self.respond_to? :before_release\n props = { \n resource_id: uid, \n resource_address: resource_address #OmfCommon::CommProvider::Local::Topic.address_for(uid)\n }\n props[:hrn] = hrn if hrn\n inform :released, props\n\n \n # clean up topics \n @topics.each do |t| \n t.unsubscribe\n end\n \n true \n end", "def finalize\n close\n end", "def cleanup\n self.image = nil\n GC.start\n end", "def cleanup\n self.image = nil\n GC.start\n end", "def release(machine)\n if (address = address_for(machine))\n @pool[address] = nil\n end\n end", "def release\n request = Remit::Cancel::Request.new(transaction_id: transaction_id)\n response = remit.cancel request\n response.errors.empty?\n end", "def release_easy(easy)\n easy.reset\n easy_pool << easy\n end", "def dispose\n nil\n end", "def cleanup; end", "def cleanup; end", "def cleanup; end", "def cleanup; end", "def release\n if self.name!=NO_CATEGORY\n transaction do\n self.concepts.each do |concept|\n concept.update_attribute(:concept_category_id, self.function.no_category().id)\n end\n end\n end\n end", "def finalize\n end", "def release_transporter s\n s.close\n end", "def finalize\n end", "def finalize\n end", "def finalize\n end", "def finalize\n end", "def finalize\n end", "def finalize\n end", "def finalize\n end", "def finalize\n\n end", "def release(obj)\n @mut.synchronize do\n if @shutdown_block\n @shutdown_block.call(obj)\n else\n @q.push(obj)\n end\n\n @cond.broadcast\n end\n end", "def release\n @start_script[:run] = start_run_script\n end", "def finalize\n replace\n _promote\n end", "def release(thread)\n checkin_connection(sync{@allocated.delete(thread)})\n nil\n end", "def release(options = {})\n current_claimant = claimant\n with_hooks(:release, current_claimant, options) do\n log(:release)\n set_claimant(nil)\n end\n end", "def cleanup!; end", "def cleanup!; end", "def released(&block)\n @up_callback = block\n end", "def release_self\n # Release children resource recursively\n children.each do |c|\n if c.release_self\n self.synchronize do\n children.delete(c)\n end\n end\n end\n\n return false unless children.empty?\n\n info \"Releasing hrn: #{hrn}, uid: #{uid}\"\n self.before_release if self.respond_to? :before_release\n props = {\n res_id: resource_address\n }\n props[:hrn] = hrn if hrn\n inform :released, props\n\n # clean up topics\n @topics.each do |t|\n t.unsubscribe\n end\n\n @membership_topics.each_value do |t|\n if t.respond_to? :delete_on_message_cbk_by_id\n t.delete_on_message_cbk_by_id(@uid)\n end\n t.unsubscribe\n end\n\n true\n end", "def release(thread)\n conn = @allocated.delete(thread)\n\n if @connection_handling == :disconnect\n disconnect_connection(conn)\n else\n checkin_connection(conn)\n end\n end", "def release!\n render!\n @index.commit! commit_message\n @index.push!\n end", "def finish\n release_read_pool_connection\n end", "def unlock\n end", "def free\n @pool.shutdown(&:free)\n end", "def release_a_resource(resource_descr, type_to_release, authorizer)\n debug \"release_a_resource: resource_descr: #{resource_descr}, type_to_create: #{type_to_release}\"\n raise 'Method not implemented because the Central Manager just need to pass the same requisition to the other' \\\n ' brokers and create the concatenated results'\n end", "def release(fiber, conn)\n\t\t\t\t@busy_connections.delete(fiber)\n\t\t\t\t@connections << conn\n\t\t\tend", "def release_self\n # Release children resource recursively\n children.each do |c|\n if c.release_self\n self.synchronize do\n children.delete(c)\n end\n end\n end\n\n return false unless children.empty?\n\n info \"Releasing hrn: #{hrn}, uid: #{uid}\"\n\n call_hook(:before_release, self)\n\n props = {\n res_id: resource_address\n }\n props[:hrn] = hrn if hrn\n inform :released, props\n\n # clean up topics\n @topics.each do |t|\n t.unsubscribe(@uid)\n end\n\n @membership_topics.each_value do |t|\n if t.respond_to? :delete_on_message_cbk_by_id\n t.delete_on_message_cbk_by_id(@uid)\n end\n t.unsubscribe(@uid)\n end\n\n true\n end", "def cleanup\r\n end", "def finalize\n nil\n end", "def released_true?\n self.released\n end", "def release(rel)\n # Find the request with this id\n match = @reqList.select{|r| r.reqid == rel.reqid}\n if match == nil or match[0] == nil\n $Logger.error \"Internal error. Cannot find req with id #{rel.reqid}\"\n return\n end\n req = match[0]\n freeup(req) \n end", "def release(threat)\n hero = Hero.find_to_batle(threat.rank)\n if hero\n # TODO add more one hero\n batle = Batle.create(threat: threat, heroes: [hero])\n @batles.append(batle)\n else\n # run release again in a thread mode\n Thread.new do\n Rails.application.executor.wrap do\n # waits 10 seconds\n sleep(30)\n release(threat)\n end\n end\n end\n end" ]
[ "0.8604901", "0.85713875", "0.85713875", "0.81487435", "0.7855286", "0.7627473", "0.7470292", "0.744611", "0.7424807", "0.7247099", "0.7226407", "0.72063375", "0.72024286", "0.72024286", "0.72024286", "0.72024286", "0.7184828", "0.71420467", "0.71230716", "0.71191806", "0.7099474", "0.70282066", "0.69899225", "0.6935637", "0.69238216", "0.6870831", "0.6862413", "0.6857181", "0.6850606", "0.68100274", "0.6784747", "0.67675143", "0.6765493", "0.6765493", "0.6731597", "0.67225623", "0.66621166", "0.66608274", "0.66596735", "0.66450775", "0.66206414", "0.66161215", "0.6601586", "0.6601586", "0.6561856", "0.6548412", "0.6546282", "0.65331167", "0.6530326", "0.6513383", "0.6469214", "0.64216876", "0.6406489", "0.6399681", "0.63869977", "0.6376143", "0.63757384", "0.63500404", "0.6346692", "0.6346692", "0.63452965", "0.63406956", "0.63297194", "0.6327245", "0.63234985", "0.63234985", "0.63234985", "0.63234985", "0.6319424", "0.6310576", "0.6309157", "0.6284233", "0.6284233", "0.6284233", "0.6284233", "0.6284233", "0.6284233", "0.6284233", "0.6260995", "0.623628", "0.62274516", "0.62219435", "0.6210087", "0.61935604", "0.6181022", "0.6181022", "0.6177639", "0.6166157", "0.61618334", "0.616142", "0.61546725", "0.61509126", "0.6119706", "0.61160123", "0.6103131", "0.6087701", "0.60808986", "0.60332304", "0.6023429", "0.6021934", "0.6010501" ]
0.0
-1
============== = The runway = ============== Checks if build path exists (and cleans it up) Checks if target path exists (if not, creates it)
def validate_paths! ensure_clean_build_path! ensure_existing_target_path! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_paths!\n if self.build_path.exist?\n log self, \"Cleaning up previous build \\\"#{self.build_path}\\\"\"\n rm_rf(self.build_path)\n end\n \n if !self.target_path.exist?\n log self, \"Creating target path \\\"#{self.target_path}\\\"\"\n mkdir self.target_path\n end\n end", "def run!\n begin\n found = Project.find(@dir)\n rescue MissingProject\n ask_questions!\n make_directories!\n create_config!\n copy_sources!\n say color(\"Your project was created\", :green)\n say Montage::Commands::BLANK\n else\n raise Montage::ProjectExists, <<-ERROR.compress_lines\n A Montage project exists in a parent directory at\n `#{found.paths.root}'\n ERROR\n end\n end", "def prep_build\n stdout.out_success(\"\\nPreparing build dir at: '#{settings['build_dir']}'\")\n stdout.verbose(\"Removing build dir at: #{settings['build_dir']}\")\n FileUtils.rm_rf(settings['build_dir'])\n # create the build dir\n stdout.verbose(\"Creating build dir at: #{settings['build_dir']}\")\n FileUtils.mkdir(settings['build_dir'])\n end", "def stow_target_bin_exists?\n ::File.exist?(\"#{stow_target}/bin/stow\")\n end", "def check_and_build_target_directory_structure(target_host, target_directory, path_to_create)\n\n unless path_to_create.nil?\n\n @log.info(\"Attempting to create '#{path_to_create}' of target directory' '#{target_host}:#{target_directory}'...\")\n\n path_to_create_parts = path_to_create.split('/')\n remote_path = []\n\n target_directory.split('/').each do | directory |\n if !directory.empty?\n directory_path = directory.start_with?('/') ? directory : \"/#{directory}\"\n remote_path << directory\n\n if path_to_create_parts.include?(directory)\n rsync(@empty_directory, \"#{target_host}:/#{remote_path.join('/')}\", false)\n end\n\n end\n end\n @log.info(\"Successfully created '#{path_to_create}' of directory structure '#{target_host}:#{target_directory}'.\")\n\n else\n @log.info(\"Not attempting to create any of remote path '#{target_directory}' on host '#{target_host}'\")\n end\n end", "def run!\n # Validate paths\n validate_paths!\n \n # Extract mockup\n copy_source_path_to_build_path!\n \n validate_stack!\n \n # Run stack\n run_stack!\n \n # Run finalizers\n run_finalizers!\n \n # Cleanup\n cleanup! if self.config[:cleanup_build]\n \n end", "def try_build(m)\n do_cmd(m, \"rake clean\"){ return false }\n do_rake(m){ return false }\n return true\n end", "def build_target_path\n File.join(destination, configuration[:build_target_path])\n end", "def setup(target)\n Dir.mkdir(target) unless File.directory?(target)\nend", "def prepare_target_dir\n begin\n FileUtils.mkdir(@output_dir)\n copy_default_files\n rescue Errno::EEXIST\n puts \"-- #{output_dir} already exists -- canceling initialization. \"\n return\n end\n end", "def run_make()\n result = false\n Dir.chdir(PATH_BUILD) do\n result = call_system_command(CMD_BUILD_MAKE)\n puts \"penguin make failed, and return #{result}.\" unless result\n end\n return result\n end", "def run!\n project.mode = :release\n\n # Validate paths\n validate_paths!\n\n # Extract mockup\n copy_source_path_to_build_path!\n\n validate_stack!\n\n # Run stack\n run_stack!\n\n # Cleanup\n cleanup! if config[:cleanup_build]\n ensure\n project.mode = nil\n end", "def makePath\n\t\t\tbuildMgr.effective(filename).dirname.mkpath\n\t\tend", "def setup_target\n log \"Setting up #{@target}\"\n\n if File.exists? @target\n raise ArgumentError, %{Target directory \"#{@target}\" already exists}\n end\n\n FileUtils.mkdir @target\n\n run \"git init .\"\n\n # TODO: Create runner file\n end", "def testDontBuildBuiltDependency\n setRepository('DeliverablesProcessExistingDependency') do |iRepoDir|\n runFSCMS(['Build', '--', '--target', 'TestType/TestID2/0.1/TestDeliverable'])\n assert(File.exists?(\"#{iRepoDir}/TestType/TestID1/0.1/Deliverables/TestDeliverable\"))\n assert(!File.exists?(\"#{iRepoDir}/TestType/TestID1/0.1/Deliverables/TestDeliverable/BuiltFile\"))\n lBuiltFileName = \"#{iRepoDir}/TestType/TestID2/0.1/Deliverables/TestDeliverable/BuiltFile\"\n assert(File.exists?(lBuiltFileName))\n File.open(lBuiltFileName, 'r') do |iFile|\n assert_equal([\n $FSCMSTest_RepositoryToolsDir,\n \"#{iRepoDir}/TestType/TestID1/0.1/Deliverables/TestDeliverable\"\n ], iFile.read.split(\"\\n\"))\n end\n end\n end", "def in_build\n source_dir, build_dir = find_dirs\n FileUtils.mkdir_p(build_dir) unless File.directory?(build_dir)\n Dir.chdir build_dir do\n yield(source_dir)\n end\nend", "def prepare_working_dir\n FileUtils.mkdir_p @working_dir unless File.directory?(@working_dir)\n FileUtils.rm_rf Dir[\"#{@working_dir}/*\"] if @force_rebuild\n end", "def test_if_necessary\n # should return true\n assert Scripto.mkdir_if_necessary(DIR)\n assert Scripto.cp_if_necessary(SRC, DST)\n assert Scripto.ln_if_necessary(SRC, DST2)\n\n assert(File.directory?(DIR))\n assert_equal(File.read(SRC), File.read(DST))\n assert_equal(SRC, File.readlink(DST2))\n\n # should be silent\n assert_fu_output(nil, \"\") do\n assert_nil Scripto.mkdir_if_necessary(DIR)\n assert_nil Scripto.cp_if_necessary(SRC, DST)\n assert_nil Scripto.ln_if_necessary(SRC, DST2)\n end\n end", "def build_path\n @build_path ||= \"#{@ant_path}/#{@config[:build_name]}\"\n end", "def execute \n if(@hasExecuted==false and (not File::directory?(@newPath)))\n FileUtils.cp_r(@ogPath, @newPath)\n FileUtils::rm_r(@ogPath)\n @hasExecuted=true\n end\n end", "def prepare\n if not File.exists?(OBS_BUILD_DIR)\n FileUtils.mkdir_p OBS_BUILD_DIR\n end\n cleanup\n end", "def scratch_build\n begin\n distgit_pkg.build\n rescue => e\n puts \"Warning: scratch build failed: #{e}\".bold.red\n end\n end", "def scratch_build\n begin\n distgit_pkg.build\n rescue => e\n puts \"Warning: scratch build failed: #{e}\".bold.red\n end\n end", "def make_work_folder_if_empty\n unless Dir.exists?(WORKFOLDER)\n FileUtils.mkdir_p(WORKFOLDER)\n print_status(\"Workspace \\\"#{WORKFOLDER}\\\" created\")\n end\nend", "def build(rakeTask)\n\t\tfilePrereqs = filePrereqs() #remove internal build-system stuff\n\t\tunless FileUtils.uptodate?(target(), filePrereqs) #the check rake does always fails because it includes a non-file prereq task\n\t\t\tstaticLibMaintainer().addOrUpdate(:lib => target(), :objs => filePrereqs)\n\t\t\tstaticLibMaintainer().index(target())\n\t\tend\n\tend", "def verify_src_dest_dir_paths\n unless File.exists?(@era_root_dir_path) && File.directory?(@era_root_dir_path)\n STDERR.puts \"Source directory does not exist:\\n '#{@era_root_dir_path}'\"\n exit 2\n end\n if File.exists?(@era_root_dir_path_dest)\n STDERR.puts \"Destination directory or file already exists:\\n '#{@era_root_dir_path_dest}'\"\n exit 3\n end\n end", "def test_nonexistant_files_do_not_exist\n t = Crd::Target.new BAD\n assert_equal( false, t.exists? )\n end", "def check_build_src_file(rb_file)\n if !rb_file\n puts \"Please provide a Ruby file to build\"\n exit\n elsif !File.exists? rb_file\n puts \"Can't find file: #{rb_file}\"\n exit\n end\nend", "def ensure_created\n unless @created\n classpath = @module_set['dso-tests-jdk15'].subtree('src').classpath(@build_results, :full, :runtime)\n puts(\"Creating boot JAR with: #{@jvm} and config file: #{@config_file}\")\n \n File.delete(path.to_s) if FileTest.exist?(path.to_s)\n sysproperties = {\n PropertyNames::TC_BASE_DIR => @static_resources.root_dir.to_s,\n PropertyNames::MODULES_URL => @build_results.modules_home.to_url\n }\n \n begin \n @ant.java(:classname => 'com.tc.object.tools.BootJarTool',\n :classpath => classpath.to_s,\n :jvm => @jvm.java,\n :fork => true,\n :failonerror => true,\n :dir => @build_results.tools_home.to_s) do\n\n sysproperties.each do |name, value|\n @ant.sysproperty(:key => name.xml_escape(true),\n :value => value.xml_escape(true))\n end\n\n @ant.arg(:value => '-o')\n @ant.arg(:value => @directory.ensure_directory)\n @ant.arg(:value => '-f')\n @ant.arg(:value => @config_file)\n @ant.arg(:value => '-q')\n end\n rescue\n raise(\"Bootjar creation failed\")\n end\n \n @created = true\n end\n self\n end", "def globalSetup()\n # Build\n run(\"cd '#{Embedding::CODE_PATH}' && make clean && make\")\nend", "def cd_into_test?\n !File.exist?(\"app\") && File.exist?(\"test\") &&\n (File.exist?(\"main.tf\") || File.exist?(\"main.rb\"))\n end", "def pre_build\n puts \"pre_build dir=#{`pwd`}\"\n rbvt = RUBY_V\n rbvm = RUBY_V[/^\\d+\\.\\d+/]\n # remove leftovers from previous rake.\n rm_rf \"#{TGT_DIR}/lib\"\n rm_rf \"#{TGT_DIR}/etc\"\n rm_rf \"#{TGT_DIR}/share\"\n rm_rf \"#{TGT_DIR}/conf.d\"\n mkdir_p \"#{TGT_DIR}/lib\"\n cp_r \"#{EXT_RUBY}/lib/ruby\", \"#{TGT_DIR}/lib\"\n # copy include files\n mkdir_p \"#{TGT_DIR}/lib/ruby/include/ruby-#{rbvt}\"\n cp_r \"#{EXT_RUBY}/include/ruby-#{rbvt}/\", \"#{TGT_DIR}/lib/ruby/include\"\n SOLOCS.each_value do |path|\n cp \"#{path}\", \"#{TGT_DIR}\"\n end\n # do some windows things\n mkdir_p \"#{TGT_DIR}/share/glib-2.0/schemas\"\n if APP['GTK'] == \"gtk+-2.0\" \n cp_r\"#{TGT_SYS_DIR}/share/glib-2.0/schemas/gschema.dtd\",\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n cp_r \"#{ShoesDeps}/share/fontconfig\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/themes\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/xml\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/icons\", \"#{TGT_DIR}/share\"\n elsif APP['GTK'] == \"gtk+-3.0\"\n cp \"#{TGT_SYS_DIR}share/glib-2.0/schemas/gschemas.compiled\" ,\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n cp_r \"#{ShoesDeps}/share/fontconfig\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/themes\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/xml\", \"#{TGT_DIR}/share\"\n cp_r \"#{ShoesDeps}/share/icons\", \"#{TGT_DIR}/share\"\n else\n cp \"#{TGT_SYS_DIR}share/glib-2.0/schemas/gschemas.compiled\" ,\n \"#{TGT_DIR}/share/glib-2.0/schemas\"\n end\n sh \"#{WINDRES} -I. shoes/appwin32.rc shoes/appwin32.o\"\n cp_r \"#{ShoesDeps}/etc\", TGT_DIR\n mkdir_p \"#{ShoesDeps}/lib\"\n if APP['GTK'] == \"gtk+-3.0\"\n cp_r \"#{ShoesDeps}/lib/gtk-3.0\", \"#{TGT_DIR}/lib\" # shoes, exerb, ruby here\n else\n cp_r \"#{ShoesDeps}/lib/gtk-2.0\", \"#{TGT_DIR}/lib\" # shoes, exerb, ruby here\n end\n bindir = \"#{ShoesDeps}/bin\"\n #cp_r \"#{bindir}/fc-cache.exe\", TGT_DIR\n cp_r \"#{bindir}/gtk-update-icon-cache.exe\", TGT_DIR\n # below for debugging purposes\n if ENV['GDB'] \n cp \"#{bindir}/fc-cat.exe\", TGT_DIR\n cp \"#{bindir}/fc-list.exe\", TGT_DIR\n cp \"#{bindir}/fc-match.exe\", TGT_DIR\n cp \"#{bindir}/fc-pattern.exe\", TGT_DIR\n cp \"#{bindir}/fc-query.exe\", TGT_DIR\n cp \"#{bindir}/fc-scan.exe\", TGT_DIR\n cp \"#{bindir}/fc-validate.exe\", TGT_DIR\n end\n # disable MS Theme\n if !ENABLE_MS_THEME \n Dir.chdir(\"#{TGT_DIR}/share/themes/MS-Windows/gtk-2.0/\") do\n mv 'gtkrc', 'disabled-gtkrc'\n end\n else\n # add our overrides to the MS-Windows theme\n cp \"platform/msw/gtkrc\", \"#{TGT_DIR}/etc/gtk-2.0/\"\n end\n end", "def setup\n @build_dir = File.join project.dir, 'build'\n unless Dir.exists? @build_dir\n Dir.mkdir @build_dir\n end\n\n task 'default' => 'build'\n\n desc 'Build the project'\n task 'build' => project.target do\n puts \"Built #{File.basename project.target}\".green\n end\n\n self.setup_target\n self.setup_source_files\n\n if project.test_target\n self.setup_test_target\n self.setup_test_files\n end\n\n desc 'Clean up build artifacts and target'\n task 'clean' do\n sh \"rm -f #{project.target}\"\n project.sources.each do |fn|\n fn = objectsify fn\n sh \"rm -f #{fn}\"\n end\n end\n \n namespace 'test' do\n desc 'Build the test target'\n task 'build' => project.test_target do\n puts \"Built #{File.basename project.test_target}\".green\n end\n desc 'Clean test build artifacts'\n task 'clean' do\n sh \"rm -f #{project.test_target}\"\n project.test_sources.each do |fn|\n fn = objectsify fn\n sh \"rm -f #{fn}\"\n end\n end\n end\n \n end", "def test_dry_run_bug\n rakefile_dryrun\n\n rake\n\n FileUtils.rm_f \"temp_one\"\n\n rake \"--dry-run\"\n\n refute_match(/No such file/, @out)\n end", "def configure_phase\n self.project.targets.each do |target|\n begin\n phase = target.sources_build_phase\n next unless phase\n rescue NoMethodError\n next\n end\n\n \n bundle = target.copy_bundle_recources\n\n # remove zombie build files\n phase.files_references.each do |file|\n begin\n file.real_path\n rescue\n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n end\n \n # remove zombie bundle files\n bundle.files_references.each do |file|\n begin\n file.real_path\n rescue\n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file\n end\n end\n end\n\n removings = [] # name of seeds going to be removed from the target\n addings = [] # name of seeds going to be added to the target\n\n self.targets.keys.sort.each do |seed_name|\n target_names = self.targets[seed_name]\n if not target_names.include?(target.name)\n removings << seed_name if not removings.include?(seed_name)\n else\n addings << seed_name if not addings.include?(seed_name)\n end\n end\n\n\n self.file_references.each do |file|\n\n removings.each do |seed_names|\n next if not seed_names.include?(file.parent.name)\n \n bundle.files.each do |bundle_file|\n bundle.files.delete(bundle_file) if bundle_file.file_ref == file \n end\n \n phase.files.each do |build_file|\n phase.files.delete(build_file) if build_file.file_ref == file\n end\n end\n\n addings.each do |seed_names|\n next if file.name.end_with? \".h\"\n next if not seed_names.include?(file.parent.name)\n uuid = Xcodeproj::uuid_with_name \"#{target.name}:#{file.name}\"\n \n if self.seeds[seed_names].resources.any? { |s| file.name.end_with? s }\n bundle.add_file_reference_with_uuid(file, uuid, true)\n else \n phase.add_file_reference_with_uuid(file, uuid, true)\n end\n\n end\n end\n end\n end", "def execute\n if(@hasExecuted==false and (not File::exist?(@newPath)))\n FileUtils.cp(@ogPath, @newPath)\n @hasExecuted=true\n end\n end", "def create_dir(dirName)\r\n\tif !File.directory?(dirName)\r\n\t\tFileUtils.mkdir(dirName) #creates the /build directory\r\n\tend\r\nend", "def create_dir(dirName)\r\n\tif !File.directory?(dirName)\r\n\t\tFileUtils.mkdir(dirName) #creates the /build directory\r\n\tend\r\nend", "def testForceBuildSingleDeliverableOnce\n setRepository('UniqueExistingDeliverable') do |iRepoDir|\n runFSCMS(['Build', '--', '--target', 'TestType/TestID/0.1/TestDeliverable', '--target', 'TestType/TestID/0.1/TestDeliverable', '--force'])\n lBuiltFileName = \"#{iRepoDir}/TestType/TestID/0.1/Deliverables/TestDeliverable/BuiltFile\"\n assert(File.exists?(lBuiltFileName))\n File.open(lBuiltFileName, 'r') do |iFile|\n assert_equal($FSCMSTest_RepositoryToolsDir, iFile.read)\n end\n end\n end", "def output_path\n \"build\"\n end", "def generate\n puts \"current path should be: \" + PATH_SCRIPT + \"/core\"\n result = false\n Dir.chdir(PATH_SCRIPT+\"/core\") do\n result = call_system_command(CMD_BUILD_GENERATE)\n puts \"generating source code failed, and return #{result}.\" unless result\n end\n Dir.chdir(PATH_SCRIPT+\"/is\") do\n result = system(CMD_BUILD_GENERATE)\n puts \"generating source code failed, and return #{result}.\" unless result\n end\n return result\n end", "def build\n system(\"make build\", :chdir => self.config['destination'], :out => :err)\n end", "def testDontBuildSingleDeliverable\n setRepository('UniqueExistingDeliverable') do |iRepoDir|\n runFSCMS(['Build', '--', '--target', 'TestType/TestID/0.1/TestDeliverable'])\n assert(File.exists?(\"#{iRepoDir}/TestType/TestID/0.1/Deliverables/TestDeliverable\"))\n assert(!File.exists?(\"#{iRepoDir}/TestType/TestID/0.1/Deliverables/TestDeliverable/BuiltFile\"))\n end\n end", "def stow_path_bin_exists?\n ::File.exist?(\"#{stow_path}/../bin/stow\")\n end", "def ensure_exists\n create unless Dir.exist? path\n end", "def ensure_exists(sketch)\n puts \"Couldn't find: #{sketch}\" and exit unless FileTest.exist?(sketch)\n end", "def make(args)\n # Maybe we should write an \"uncrustify\" fastlane action?...\n Dir.chdir '..' do\n sh 'make ' + args\n end\nend", "def make(args)\n # Maybe we should write an \"uncrustify\" fastlane action?...\n Dir.chdir '..' do\n sh 'make ' + args\n end\nend", "def test_copy_using_cp\n @rogerfile.release(blank: true, cleanup_build: false)\n @project.construct.file \"html/test.txt\"\n @project.release.run!\n\n build_path = @project.release.build_path\n\n assert build_path.exist?\n assert_equal 1, build_path.children.size\n assert_equal build_path + \"test.txt\", build_path.children.first\n end", "def install!\n\t\t\traise \"Target exists\" if target.present?\n\n\t\t\t# Directory entry - create the directory\n\t\t\ttarget.mkpath\n\t\tend", "def ensure_directory_exists\r\n dir = File.dirname(full_path_from_current_attributes)\r\n FileUtils.mkdir_p(dir) unless File.exists?(dir)\r\n end", "def build_to_temp_dir\n @builder.build_project\n\n # Copy build files to temporary directory\n @task.shell.mute do\n @task.directory @project.build_path, ::File.join(@project.package_path, @package_name), :force => true\n end\n end", "def build()\n \n #check dir exists, if not, make it\n if(!File.exists?(@path))\n Dir.mkdir(@path)\n end\n \n #build directory structure\n puts 'Building directory structure'\n build_skeleton(@template.directory_structure)\n \n #execute build tasks\n puts 'Running build tasks'\n execute_tasks(@template.tasks,@template.path)\n \n puts 'Skeleton built'\n \n end", "def check_or_create_working_dir\n unless Dir.exists?(@working_directory)\n if File.writable?(@working_directory.split(\"/\")[0...-1].join(\"/\"))\n Dir.mkdir(@working_directory)\n return true if Dir.exists?(@working_directory)\n end\n end\n Loggers::Main.log.warn \"Creation of #{@working_directory} failed!\"\n end", "def testBuildSingleDeliverable_ObjectPath\n setRepository('UniqueDeliverable') do |iRepoDir|\n runFSCMS(['Build', '--', '--target', 'TestType/TestID'])\n lBuiltFileName = \"#{iRepoDir}/TestType/TestID/0.1/Deliverables/TestDeliverable/BuiltFile\"\n assert(File.exists?(lBuiltFileName))\n File.open(lBuiltFileName, 'r') do |iFile|\n assert_equal($FSCMSTest_RepositoryToolsDir, iFile.read)\n end\n end\n end", "def create_build_directories\n root_dir = generate_build_location(\"\")\n Dir.mkdir root_dir unless Dir.exists?(root_dir)\n img_dir = generate_image_location(\"\",\"\").split(\"/\")[0...-1].join(\"/\")\n Dir.mkdir img_dir unless Dir.exists?(img_dir)\n end", "def run\n unless !@valid_name || File.exists?(@project_name) || File.directory?(@project_name)\n $stdout.puts \"Creating goliath application under the directory #{@project_name}\"\n FileUtils.mkdir @project_name\n \n create_base_dirs\n copy_files_to_target\n setup_api_module\n copy_files_to_dir 'application.rb','config'\n copy_files_to_dir 'database.yml','config'\n $stdout.puts \"\\e[1;32m \\trun\\e[0m\\tbundle install\"\n Dir.chdir(\"#{@project_name}\")\n system(\"bundle install\")\n else \n unless !@valid_name\n $stdout.puts \"\\e[1;31mError:\\e[0m The directory #{@project_name} already exists, aborting. Maybe move it out of the way before continuing.\"\n end\n end\n end", "def setup_path\n # The Java Buildpack for WLS creates the complete domain structure and other linkages during staging.\n # The directory used for staging is at /tmp/staged/app\n # But the actual DEA execution occurs at /home/vcap/app. This discrepancy can result in broken paths and non-startup of the server.\n # So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution\n # Also, this script needs to be invoked before starting the server as it will create the links and also tweak the server args\n # (to listen on correct port, use user supplied jvm args)\n\n File.open(@application.root.to_s + '/' + SETUP_ENV_SCRIPT, 'w') do |f|\n\n f.puts '#!/bin/sh '\n f.puts '# There are 4 things handled by this script '\n f.puts ' '\n f.puts '# 1. Create links to mimic staging env and update scripts with jvm options '\n f.puts '# The Java Buildpack for WLS creates complete domain structure and other linkages during staging at '\n f.puts '# /tmp/staged/app location '\n f.puts '# But the actual DEA execution occurs at /home/vcap/app. '\n f.puts '# This discrepancy can result in broken paths and non-startup of the server. '\n f.puts '# So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution '\n f.puts '# Create paths that match the staging env, as otherwise scripts will break!! '\n f.puts ' '\n f.puts 'if [ ! -d \\\"/tmp/staged\\\" ]; then '\n f.puts ' /bin/mkdir /tmp/staged '\n f.puts 'fi; '\n f.puts 'if [ ! -d \\\"/tmp/staged/app\\\" ]; then '\n f.puts ' /bin/ln -s `pwd` /tmp/staged/app '\n f.puts 'fi; '\n f.puts ' '\n f.puts ' '\n end\n end", "def build_path\n Pathname.new(config[:build_path])\n end", "def testForceBuildSingleDeliverable\n setRepository('UniqueExistingDeliverable') do |iRepoDir|\n runFSCMS(['Build', '--', '--target', 'TestType/TestID/0.1/TestDeliverable', '--force'])\n lBuiltFileName = \"#{iRepoDir}/TestType/TestID/0.1/Deliverables/TestDeliverable/BuiltFile\"\n assert(File.exists?(lBuiltFileName))\n File.open(lBuiltFileName, 'r') do |iFile|\n assert_equal($FSCMSTest_RepositoryToolsDir, iFile.read)\n end\n end\n end", "def buildwise_run_sequential_build_target(build_id, task_name) \r\n begin\r\n FileUtils.rm_rf(\"spec/reports\") if File.exist?(\"spec/reports\")\r\n Rake::Task[task_name].invoke\r\n ensure\r\n puts \"Finished: Notify build status\"\r\n sleep 2 # wait a couple of seconds to finish writing last test results xml file out\r\n puts \"[Rake] finish the build\"\r\n buildwise_finish_build(build_id)\r\n end\r\nend", "def create_target?\n !(project.initialize_with_readme && target_branch == project.default_branch) && target_new_branch\n end", "def build_path\n Pathname.new(self.config[:build_path]) \n end", "def create_project(invocation_path, arg_app_name, quiet = false, gem_path = nil)\n root_path = File.join(invocation_path, arg_app_name)\n FileUtils.mkpath(root_path)\n puts \"(in #{invocation_path})\" unless quiet\n puts \" created directory: #{arg_app_name}\" unless quiet\n create_app_structure(root_path, arg_app_name, quiet, gem_path)\n puts '' unless quiet\n puts 'Done!' unless quiet\n\n root_path\n end", "def build(rakeTask)\n\t\t#we've called ourselves after updating prereqs and running them; now do our work\n\t\t\n\t\tfilePrereqs = filePrereqs() #remove internal build-system stuff\n\t\tunless FileUtils.uptodate?(target(), filePrereqs) #the check rake does always fails because it includes non-file prereq tasks, so do our own\n\t\t\tlinker().link(:objs => linkDepsOrdered(), :target => target())\n\t\tend\n\tend", "def run_stage_one \n\t# directory tools is needed by stage on, be sure it does not exist yet\n\tif File.exists?(\"/tools\")\n\t\tputs sprintf(\"%015.4f\", Time.now.to_f) + \" error > EXIT! Directory or softlink /tools already exists\"\n\t\tputs sprintf(\"%015.4f\", Time.now.to_f) + \" error > Too risky for me to continue. Remove /tools, then\"\n\t\tputs sprintf(\"%015.4f\", Time.now.to_f) + \" error > try again.\"\n\t\t$stdout.flush\n\t\traise \"SoftlinkAlreadyThere\"\n\tend\n\t# File.symlink(@builddir + \"/stage01/chroot/tools\", \"/tools\")\n\tsystem(\"mkdir /tools\")\n\tsystem(\"mkdir -p \" + @builddir + \"/stage01/chroot/tools\")\n\tsystem(\"mount -o bind \" + @builddir + \"/stage01/chroot/tools /tools\")\n\t[ \"/stage01\", \"/stage01/build\",\"/stage01/chroot\",\"/stage01/chroot/tools\", \"/tmp\" ].each { |d|\n\t\tunless File.exists?(@builddir + d)\n\t\t\tDir.mkdir(@builddir + d)\n\t\tend\n\t}\n\t# Stage 01 abfrühstücken\n\t# Alle Scripte in stage01 suchen\n\tstage_one_objs = get_stage_one_objs\n\t# Download first\n\tstage_one_objs.each { |i| i.download }\n\t# Unpack\n\tstage_one_objs.each { |i|\n\t\ti.unpack\n\t\t### Dir.chdir(@workdir)\n\t\ti.patch(@log_each)\n\t\t### Dir.chdir(@workdir)\n\t\ti.build(@log_each)\n\t\t### Dir.chdir(@workdir)\n\t\ti.install(@log_each)\n\t\t### Dir.chdir(@workdir)\n\t\ti.filecheck\n\t\t### Dir.chdir(@workdir)\n\t}\n\tsystem(\"umount /tools\")\nend", "def testBuildProcessDirDependency\n setRepository('DeliverablesProcessDependency') do |iRepoDir|\n runFSCMS(['Build', '--', '--target', 'TestType/TestID2/0.2/TestDeliverable'])\n lBuiltFileName = \"#{iRepoDir}/TestType/TestID1/0.1/Deliverables/TestDeliverable/BuiltFile\"\n assert(File.exists?(lBuiltFileName))\n File.open(lBuiltFileName, 'r') do |iFile|\n assert_equal($FSCMSTest_RepositoryToolsDir, iFile.read)\n end\n lBuiltFileName = \"#{iRepoDir}/TestType/TestID2/0.2/Deliverables/TestDeliverable/BuiltFile\"\n assert(File.exists?(lBuiltFileName))\n File.open(lBuiltFileName, 'r') do |iFile|\n assert_equal(\"#{iRepoDir}/TestType/TestID1/0.1/Deliverables/TestDeliverable\", iFile.read)\n end\n end\n end", "def clean\n needs_cleaning = File.exist?(project_dir)\n if needs_cleaning\n log.info(log_key) { \"Cleaning project directory `#{project_dir}'\" }\n FileUtils.rm_rf(project_dir)\n end\n create_required_directories\n deploy\n needs_cleaning\n end", "def testBuildSingleDeliverableOnce\n setRepository('UniqueDeliverable') do |iRepoDir|\n runFSCMS(['Build', '--', '--target', 'TestType/TestID/0.1/TestDeliverable', '--target', 'TestType/TestID/0.1/TestDeliverable'])\n lBuiltFileName = \"#{iRepoDir}/TestType/TestID/0.1/Deliverables/TestDeliverable/BuiltFile\"\n assert(File.exists?(lBuiltFileName))\n File.open(lBuiltFileName, 'r') do |iFile|\n assert_equal($FSCMSTest_RepositoryToolsDir, iFile.read)\n end\n end\n end", "def find_or_create_destination_folder\n Dir.mkdir(HTML_RESULT_FOLDER) if !Dir.exists?HTML_RESULT_FOLDER\n end", "def check_dest_dir\n dir = File.dirname absolute_filename\n FileUtils.mkdir_p(dir) unless Dir.exist?(dir)\n end", "def touch_directory(path, opt={})\n unless File.exists? path\n FileUtils.mkdir_p path\n STDOUT.write \"Created #{path.relative_to_project_root}\\n\".color(:green) unless opt[:quiet]\n end\n nil\n end", "def testBuildSingleDeliverableHierarchicalID_ObjectPath\n setRepository('UniqueDeliverableHierarchicalID') do |iRepoDir|\n runFSCMS(['Build', '--', '--target', 'TestType/TestID/SubTestID/SubSubTestID'])\n lBuiltFileName = \"#{iRepoDir}/TestType/TestID/SubTestID/SubSubTestID/0.1/Deliverables/TestDeliverable/BuiltFile\"\n assert(File.exists?(lBuiltFileName))\n File.open(lBuiltFileName, 'r') do |iFile|\n assert_equal($FSCMSTest_RepositoryToolsDir, iFile.read)\n end\n end\n end", "def destination_file_up_to_date?\n return false unless compilation_context.incremental_build?\n\n source_db = compilation_context.source_file_database\n target_db = compilation_context.target_file_database\n\n destination_file_exist? && # destination file must exist\n target_db.up_to_date?(source_path) && # source file must be up-to-date from last build of this target\n source_db.file_stat_for(source_path) == target_db.file_stat_for(source_path)\n end", "def make\n @this_version = extract_version\n check\n with_release_candidate_version do |release_candidate_buildfile|\n args = []\n args << 'buildr' << '--buildfile' << release_candidate_buildfile\n args << '--environment' << Buildr.environment unless Buildr.environment.to_s.empty?\n args << 'clean' << 'upload' << 'DEBUG=no'\n sh *args\n end\n tag_release resolve_tag\n update_version_to_next if this_version != resolve_next_version(this_version)\n end", "def build_here\n cp_a File.join(root_dir, \"test\", \"setup\", \"#{name}.svn.gz\"), \".\"\n\n puts `gzip -f -d #{name}.svn.gz`\n raise unless $? == 0\n puts `svnadmin create #{name}`\n raise unless $? == 0\n puts `svnadmin load #{name} < #{name}.svn`\n raise unless $? == 0\n end", "def archive_build_if_necessary(target_directory)\n # Nothing here in superclass\n end", "def prepare(module_name, version)\n return if @target.directory?\n\n begin\n @target.mkpath\n Puppet.notice _(\"Created target directory %{dir}\") % { dir: @target }\n rescue SystemCallError => orig_error\n raise converted_to_friendly_error(module_name, version, orig_error)\n end\n end", "def build\n if phase.has_key?('build')\n execute(\"build\", phase['build'])\n end\n end", "def maybe_build\n return unless @last_notice_at\n if time_to_build?\n UI.info \"Tishadow building at #{Time.now} with \\\"#{@build_command}\\\"\"\n run_or_update\n clear_notified\n stop_clock\n end\n end", "def ensure_fastfile\n return true if FastlaneCore::FastlaneFolder.setup?\n\n create = UI.confirm('Could not find fastlane in current directory. Make sure to have your fastlane configuration files inside a folder called \"fastlane\". Would you like to set fastlane up?')\n if create\n Fastlane::Setup.start\n end\n return false\n end", "def create_folder_if_needed path; Dir.mkdir(path) unless File.exists?(path) end", "def build_root\n Pathname.new(ENV[\"OBJDIR\"] || \"build\")\n end", "def setup_carthage_env(current_dir)\n # mkdir if folder is NOT existed.\n %W(#{current_dir}/Carthage #{current_dir}/Carthage/.tmp #{current_dir}/Carthage/Checkouts #{current_dir}/Carthage/Build #{current_dir}/Carthage/Repo).each do |each_path|\n FileUtils.mkdir_p each_path.to_s unless File.exist? each_path.to_s\n end\nend", "def check_dest_dir\n FileUtils.mkdir_p(dest_dir) unless Dir.exist?(dest_dir)\n end", "def setup(build, launcher, listener, env)\n ignored_paths = @ignored_paths.split(',').collect { |p| p.strip }\n listener.info \"Ignoring paths: #{ignored_paths.inspect}\"\n\n begin\n changeset = build.native.getChangeSet()\n # XXX: Can there be files in the changeset if it's manually triggered?\n # If so, how do we check for manual trigger?\n if changeset.isEmptySet()\n listener.info \"Empty changeset, running build.\"\n return\n end\n\n changeset.each do |change|\n change.getAffectedPaths().each do |path|\n\n # For each path we see if at least one ignore matches, and ignore this\n # file if that's the case.\n should_ignore = false\n ignored_paths.each do |ignore|\n if File.fnmatch(ignore, path)\n should_ignore = true\n break\n end\n end\n\n # If file isn't ignored, we keep on truckin', i.e. run the build.\n if not should_ignore\n listener.info \"Found non-ignored file change, running build.\"\n return\n end\n end\n end\n rescue\n listener.error \"Encountered exception when scanning for ignored paths: #{$!}\"\n end\n\n # We only get here if no unignored file was touched, so skip build.\n listener.info \"All files ignored, skipping build.\"\n build.native.setResult(Java.hudson.model.Result::NOT_BUILT)\n build.halt(\"Build not needed.\")\n end", "def run!\n # Ensure the package directory exists and is purged\n purge_directory(package_dir)\n\n instance_eval(&self.class.setup) if self.class.setup\n instance_eval(&self.class.validate) if self.class.validate\n instance_eval(&self.class.build) if self.class.build\n instance_eval(&self.class.clean) if self.class.clean\n\n # Ensure the temporary directory is removed at the end of a successful\n # run. Without removal, successful builds will \"leak\" in /tmp and cause\n # increased disk usage.\n #\n # Instead of having this as an +ensure+ block, failed builds will persist\n # this directory so developers can go poke around and figure out why the\n # build failed.\n remove_directory(staging_dir)\n end", "def build_path\n @build_path ||= Pathname.new(source_dir).join(data['build_path'] || './build').to_s\n end", "def build\n\t@built_gem_path ||= @helper.build_gem\nend", "def testBuildSingleDeliverable_VersionedObjectPath\n setRepository('UniqueDeliverable') do |iRepoDir|\n runFSCMS(['Build', '--', '--target', 'TestType/TestID/0.1'])\n lBuiltFileName = \"#{iRepoDir}/TestType/TestID/0.1/Deliverables/TestDeliverable/BuiltFile\"\n assert(File.exists?(lBuiltFileName))\n File.open(lBuiltFileName, 'r') do |iFile|\n assert_equal($FSCMSTest_RepositoryToolsDir, iFile.read)\n end\n end\n end", "def setup\n return unless git?\n\n Dir.chdir source_path do\n\n path = clone\n\n Dir.chdir path do\n\n if name = build then\n file = File.expand_path name\n\n # private instance variable. When this is set Entry#install looks\n # for a local file instead of trying to download by name\n @entry.instance_variable_set :@file, file\n end\n\n end if path\n\n end\n end", "def test_build_no_install\n result = Sprout::Builder.build(@manual_spec, @fixture)\n assert_equal('swfmill', result.executable)\n end", "def make_output_dir (src_path)\n delete_all_files(src_path) if directory_exists?(src_path) == true\n Dir.mkdir(src_path)\nend", "def compile(build_folder, check: false, write: false, release: false, verbose: false, use_cache: true)\n @file_resolver = FileResolver.new(Config.instance.project_path, build_folder)\n compilation_context.file_resolver = @file_resolver\n compilation_context.should_check = check\n compilation_context.should_write = write\n compilation_context.release_build = release\n compilation_context.verbose = verbose\n compilation_context.use_cache = use_cache\n\n self.class.globals_tracker.catch do\n @build_folder = build_folder\n\n FileUtils.mkdir_p(build_folder)\n\n puts \" handling target #{@target.name.inspect} in build dir `#{Config.instance.pretty_path_from_project(build_folder)}`\"\n\n file_resolver.add_file(FileTypes::SourceFile.new(Config.instance.pretty_path_from_project(@book.file_path).to_s))\n compilation_context.plugins\n\n parse_toc_item(@target.root_toc)\n parse_target_file_requests\n\n process_all_target_files\n generate_other_files\n\n # build folder cleanup\n remove_unnecessary_files\n remove_empty_folders\n\n source_paths = file_resolver.files.select { |a| a.is_a?(FileTypes::SourceFile) }.map { |a| a.source_path }\n compilation_context.source_file_database.cleanup(source_paths)\n compilation_context.source_file_database.update_all_metadata\n compilation_context.source_file_database.save_to_file\n\n compilation_context.target_file_database.cleanup(source_paths)\n compilation_context.target_file_database.update_all_metadata\n compilation_context.target_file_database.save_to_file\n end\n ensure\n self.class.globals_tracker.clear_all\n end", "def __path__\n File.join(root, 'tmp', 'build')\n end", "def is_built(module_instance)\n unless module_instance.type.to_sym == :servicebuilder or module_instance.type.to_sym == :ext\n file = File.join(module_instance.path, \"target/#{module_instance.name}-#{Rays::Project.instance.version}.war\")\n File.exist?(file)\n else\n !Rays::Utils::FileUtils.find_down(module_instance.path, /.*\\.war$/).empty?\n end\n end", "def run(args) # :nodoc\n if args.size > 1\n path = File.expand_path(args[1])\n settings[:directory] = \"#{path}:#{settings[:directory]}\"\n msg \"Source directories searched: #{settings[:directory]}\"\n else\n if confirm('Reintialize source path to empty?', false)\n settings[:directory] = '$cdir:$cwd'\n msg 'Source directories searched: $cdir:$cwd'\n end\n end\n end", "def within_build_path(&block)\n Dir.chdir app.config.build_dir do\n yield\n end\n end", "def target_missing(target)\n raise RuntimeError, \"No target named '%s' exists in this build file.\" % target\n end", "def run_build?\n ENV['BUILD_ASSETS'].to_s == 'true' ||\n build_files.blank? ||\n src_files.select { |f| File.mtime(f) >= File.mtime(cache_file) }.any?\n end" ]
[ "0.6942509", "0.6190765", "0.616429", "0.61332756", "0.59299403", "0.5907227", "0.5828116", "0.5824962", "0.57918704", "0.57817394", "0.57297724", "0.57290787", "0.5717126", "0.56875616", "0.56801456", "0.5677445", "0.56576836", "0.56522954", "0.5643231", "0.56342417", "0.56307316", "0.560924", "0.560924", "0.55995226", "0.55855495", "0.55779535", "0.55711955", "0.5567473", "0.5550903", "0.5542833", "0.5537804", "0.5528068", "0.55261254", "0.5524708", "0.5521809", "0.55151916", "0.55042386", "0.55042386", "0.55034775", "0.54991436", "0.54858327", "0.54751515", "0.5474034", "0.5473414", "0.5467248", "0.5462554", "0.54587466", "0.54587466", "0.54572755", "0.5456371", "0.54427123", "0.5434183", "0.54325074", "0.5414142", "0.54061896", "0.53939426", "0.53872144", "0.53776973", "0.53769094", "0.5366435", "0.5355967", "0.53541017", "0.5351655", "0.53513384", "0.53507525", "0.53389686", "0.5338608", "0.53340274", "0.5331112", "0.5330223", "0.5320759", "0.5310828", "0.5310503", "0.5306643", "0.5301046", "0.530014", "0.5292366", "0.52915645", "0.52906483", "0.52892476", "0.52837694", "0.52781856", "0.52739567", "0.5271929", "0.5246905", "0.52417105", "0.5239427", "0.5231406", "0.5215308", "0.5213937", "0.51994824", "0.51956326", "0.51953673", "0.51935923", "0.51897734", "0.51868707", "0.5182214", "0.51812637", "0.5177511", "0.5175058" ]
0.6355515
1
Checks if the project will be runned If config[:blank] is true it will automatically add Mockup processor
def validate_stack! return if config[:blank] ensure_mockup_processor_in_stack! ensure_dir_finalizer_in_stack! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_setup_suite()\n @cfg['pre_setup'] =\"defined\"\n return true\n end", "def setup\n true\n end", "def setup?\n @setup\n end", "def configured?; false; end", "def just_set_up?\n AppConfig[:just_set_up] == true\n end", "def first_run?\n not File.exists? '/boot/config/.boxcar'\n end", "def precheck\n if !BinarySolo.dir_valid?\n puts \"this is not a binary_solo directoy => better run $ binarysolo init\".colorize(:red)\n false\n elsif !BinarySolo.config_valid?\n puts \"your config is invalid - but I dont have any details for you (yet)\".colorize(:red)\n false\n else\n true\n end\nend", "def setup\n debug 'No custom setup defined'\n end", "def should_build?\n config.auto_build && !dev_server_running?\n end", "def build?\n config[:mode] == :build\n end", "def just_set_up!\n AppConfig[:just_set_up] = false\n end", "def verify_configuration\n if options.config_check?\n unless File.exists?(\"#{Rails.root}/config/initializers/cambium.rb\")\n help_message('cambium_prereqs')\n exit\n end\n end\n end", "def config_tool_needed?\n false\n end", "def testing?\n $TESTING || Merb::Config[:testing]\n end", "def do_setup; \"\" end", "def configured?\n true\n end", "def mock_enabled?\n settings.mock || false\n end", "def build_config?\n show?\n end", "def mock_enabled?\n settings.mock || false\n end", "def check_project\n return if project.dataset_names.empty?\n return unless project.done_preprocessing?(false)\n to_run = project.next_distances(true)\n to_run = project.next_inclade(true) if to_run.nil?\n queue_job(to_run) unless to_run.nil?\n end", "def no_harm?\n @config.no_harm?\n end", "def assert_usable_configuration!\n if Rails.version > \"3.1.0\" && !Rails.application.config.assets.initialize_on_precompile \n raise(\"Cannot precompile js-routes unless environment is initialized. Please set config.assets.initialize_on_precompile to true.\")\n end\n true\n end", "def test_build_no_install\n result = Sprout::Builder.build(@manual_spec, @fixture)\n assert_equal('swfmill', result.executable)\n end", "def test?\n !production?\n end", "def without_autobuild?\n Threaded.executing?(:without_autobuild)\n end", "def should_generate? config\n File.basename(source_file)[0] != '_'\n end", "def environment_configured?\n Rails.env.test? || required_vars.empty? || required_vars.all?{|var_name| !ENV[var_name].nil? && !ENV[var_name].empty?}\n end", "def setup?\n @options\n end", "def setup?\n @options\n end", "def test? ; @app.options[:env] == :test ; end", "def setup\n unless @platform.provisioning.empty?\n script = @platform.provisioning.join(' && ')\n dispatch(script)\n end\n end", "def setup_projects\n # noop\n end", "def bootstrapped?\n File.read(helper_file).include?(\"Spork.prefork\")\n end", "def config\n mode == \"autoinst_config\"\n end", "def testing?\n $TESTING ||= env?(:test) || Merb::Config[:testing]\n end", "def app_configured?; end", "def check_configure\n apply_task_params(true)\n enable_variants\n unless Cache.instance[\"configuration_data\"][\"configured\"]\n if @script.autoconf\n configure\n end\n end\n end", "def test?\n RUBYMOTION_ENV == 'test'\n end", "def init!\n # check if configuration file is already created\n puts \"=> [MoIP] Sandbox mode enabled\" if sandbox?\n unless File.exist?(CONFIG_FILE)\n puts \"=> [Moip] The configuration could not be found at #{CONFIG_FILE.inspect}\"\n return\n end\n end", "def setup\n # no setup\n\tend", "def test_disabled?\n ENV['NO_TEST'] == '1'\nend", "def test_disabled?\n ENV['NO_TEST'] == '1'\nend", "def needs_customization?\n return false\n end", "def setup\n self.setup! unless self.setup?\n end", "def development?; self == \"development\"; end", "def spec_stubs?\n @config.files.copy.any? { |f, _| f.start_with?(STUBS_FOLDER) } \\\n || @config.files.compile.any? { |f, _| f.start_with?(STUBS_FOLDER) }\n end", "def already_configured?\n return unless File.exist?('.config.fgi.yml')\n puts 'There is already a FGI config on this project.'\n exit!\n end", "def needed_if_relevant?\n false\n end", "def bootstrap_required?\n entry_point.nil?\n end", "def is_for_test_rail_run\n !ENV[\"TESTRAIL_RUN_ID\"].nil? && ENV[\"TESTRAIL_RUN\"].nil? && ENV[\"TESTRAIL_PLAN_ID\"].nil?\n end", "def rspec?; ::ENV['TEST_RUNNER'].present?; end", "def needed_if_relevant?\n false\n end", "def is_for_project?\n not self.project.nil?\n end", "def init!\n # check if configuration file is already created\n unless File.exist?(CONFIG_FILE)\n puts \"=> [PagSeguro] The configuration could not be found at #{CONFIG_FILE.inspect}\"\n return\n end\n \n # The developer mode is enabled? So install it!\n developer_mode_install! if developer?\n end", "def user_running_test?\n return true if ENV['CUCUMBER_FORMAT'] == 'Teamcity::Cucumber::Formatter'\n return true if ENV['TEAMCITY_RAKE_RUNNER_MODE'] == 'idea'\n return true if ENV['RAKE_CONSOLE'] == 'true'\n false\n end", "def test?\n settings.environment == 'test'\n end", "def dummy?\n defined?(::Piktur::Spec::Application) &&\n ::Rails.application.is_a?(::Piktur::Spec::Application)\n end", "def local?\n test_framework?\n end", "def stand_alone?; end", "def stand_alone?; end", "def simulate_mode?\n !! ENV['simulate']\n end", "def project?\n true\n end", "def developer?\n config[\"developer\"] == true\n end", "def gui?\n !ENV.fetch('GUI', '').empty?\nend", "def preprocess\n true\n end", "def report_coverage?\n config.report || config.no_coverage.nil? && config.coverage && config.test.nil? && config.args.empty?\n end", "def setup?\n Crocoduck::Store.server_cluster && \n Crocoduck::Store.server_db && \n Crocoduck::Store.server_collection\n end", "def check_config\n unless File.directory?(yolo_dir) and File.exist?(yaml_path)\n @error.run_setup\n load_config\n @formatter.setup_complete\n end\n end", "def globalSetup()\n # Build\n run(\"cd '#{Embedding::CODE_PATH}' && make clean && make\")\nend", "def custom_runner?\n Gem::Version.new(MiniTest::Unit::VERSION) >= Gem::Version.new('2.1.0')\n end", "def setup\n # Do nothing\n end", "def setup\n # Do nothing\n end", "def setup\n # Do nothing\n end", "def setup\n # Do nothing\n end", "def setup\n # Do nothing\n end", "def setup\n # Do nothing\n end", "def setup\n # Do nothing\n end", "def ci?\n ENV['CI'] == 'true'\nend", "def required?\n config[:required]\n end", "def check_requirements!\n return unless Command.up?\n\n matomo_js = File.join(@config.get('source'), 'piwik.js')\n\n error_source_missing(@config.get('source')) unless File.exist?(matomo_js)\n end", "def setup\n # noop\n end", "def bootstrapped?\n raise \"Invalid Bootstrapper\"\n end", "def _init_configuration\n\t\t# Set defaults\n\t\t@setup = { \"create\" => false, \"environment\" => false, \"test\" => true, \"destroy\" => false }\n\t\t@config = false\n\tend", "def start_setup\n\t\tread_config()\n\n\t\tputs \"Initializing annotation for project: #{self.project_file_name} ...\"\n\t\tputs \"=================================\"\n\n\t\tif add_annotation_target()\n\t\t\tputs \"=================================\"\n\t\t\tputs \"Annotation initialization for project #{self.project_file_name} done.(●'◡'●)ノ♥\"\n\t\tend\n\tend", "def dev_or_test?\n development? || test?\n end", "def is_for_test_rail_plan\n !ENV[\"TESTRAIL_RUN\"].nil? && !ENV[\"TESTRAIL_PLAN_ID\"].nil? && !ENV[\"TESTRAIL_ENTRY_ID\"].nil? && !ENV[\"TESTRAIL_ENTRY_RUN_ID\"].nil?\n end", "def setup\n ''\n end", "def build_framework?; build.include? 'framework'; end", "def refute_have_run_something(configuration, msg = nil)\n msg ||= \"Expected configuration to have run nothing, but did\"\n assert_empty configuration.runs, msg\n end", "def module_enabled\n case name\n when 'wiki'\n # Create a wiki with a default start page\n if project && project.wiki.nil?\n Wiki.create(:project => project, :start_page => 'Wiki')\n end\n when 'definitions'\n Definition.init(self.project_id) if project.definition.blank?\n when 'plans'\n # Create some initialize plans\n if project && project.plans.blank?\n # Create parent first\n template_plans.find_all { |plan| plan[:parent].nil? }.each { |parent|\n project.plans << Plan.new({:name => parent[:name]}) if project.plans.find_by_name(parent[:name]).blank?\n }\n # Create children later\n template_plans.find_all { |plan| plan[:parent].present? }.each { |p|\n project.plans << Plan.new({:name => p[:name], :parent_id => project.plans.find_by_name(p[:parent]).id}) if project.plans.find_by_name(p[:name]).blank?\n }\n end\n end\n end", "def process config\n replace_variables config.template_location\n\n replace_variables config.generate_settings.command unless config.generate_settings == nil || config.generate_settings.command == nil\n replace_variables config.generate_settings.docker_file unless config.generate_settings == nil || config.generate_settings.docker_file == nil\n\n replace_variables config.build_settings.build_commands.fetch unless config.build_settings == nil || config.build_settings.build_commands.fetch == nil\n replace_variables config.build_settings.build_commands.build unless config.build_settings == nil || config.build_settings.build_commands.build == nil\n replace_variables config.build_settings.build_commands.test unless config.build_settings == nil || config.build_settings.build_commands.test == nil\n\n replace_variables config.build_settings.docker_settings.image unless config.build_settings == nil || config.build_settings.docker_settings.image == nil\n replace_variables config.build_settings.docker_settings.env unless config.build_settings == nil || config.build_settings.docker_settings.env == nil\n replace_variables config.build_settings.docker_settings.binds unless config.build_settings == nil || config.build_settings.docker_settings.binds == nil\n replace_variables config.build_settings.docker_settings.working_directory unless config.build_settings == nil || config.build_settings.docker_settings.working_directory == nil\n\n return config\n end", "def fake?\n @test_mode == :fake\n end", "def prebuild(choice)\n case choice\n when :none\n run @main_app\n else\n run @main_app\n end\n end", "def initialize_whiny_nils\n require(\"active_support/whiny_nil\") if configuration.whiny_nils\n end", "def ensure_fastfile\n return true if FastlaneCore::FastlaneFolder.setup?\n\n create = UI.confirm('Could not find fastlane in current directory. Make sure to have your fastlane configuration files inside a folder called \"fastlane\". Would you like to set fastlane up?')\n if create\n Fastlane::Setup.start\n end\n return false\n end", "def configure_early?\n true\n end", "def agent_should_start?\n !blacklisted_constants? &&\n !blacklisted_executables? &&\n !in_blacklisted_rake_task?\n end", "def initialize\n reset\n @debugging = !ENV['MM_CHEAT'].nil?\n puts \"*** DEBUG ENABLED ***\" if @debugging\n end", "def setup_done?\n Pillar.exists? pillar: Pillar.all_pillars[:apiserver]\n end", "def configured?\n !!@config\n end" ]
[ "0.65366465", "0.60218596", "0.5975327", "0.59612125", "0.59197545", "0.584014", "0.5695137", "0.56768423", "0.56666774", "0.5665043", "0.56503534", "0.5592042", "0.5588963", "0.55881464", "0.5581252", "0.5556007", "0.5543677", "0.55401367", "0.55256236", "0.5511515", "0.5508046", "0.55067754", "0.5506409", "0.5492658", "0.54784656", "0.54588693", "0.5444305", "0.5444104", "0.5444104", "0.5417135", "0.54148394", "0.54095095", "0.5405938", "0.5405546", "0.5405421", "0.540337", "0.54004186", "0.53792423", "0.5377913", "0.5375305", "0.5364391", "0.5364391", "0.53538615", "0.53508854", "0.5342626", "0.5335074", "0.53346294", "0.53303486", "0.53278834", "0.53261346", "0.5323346", "0.53214926", "0.5315757", "0.5305447", "0.5292226", "0.5288503", "0.52866626", "0.5279677", "0.5277755", "0.5277755", "0.5275873", "0.52514714", "0.5230237", "0.5226709", "0.52089417", "0.52081114", "0.52074224", "0.5197005", "0.51922345", "0.51882774", "0.5176349", "0.5176349", "0.5176349", "0.5176349", "0.5176349", "0.5176349", "0.5176349", "0.5169646", "0.5167563", "0.5153967", "0.51527673", "0.5149312", "0.51475304", "0.5146869", "0.51459163", "0.5136031", "0.51359195", "0.5126286", "0.5122497", "0.51201063", "0.51180553", "0.5116802", "0.5114615", "0.5111381", "0.5110929", "0.5110912", "0.511033", "0.5102706", "0.5099304", "0.5099289" ]
0.52991086
54
Find a processor in the stack
def find_in_stack(klass) @stack.find { |(processor, _options)| processor.class == klass } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_processor_by_dataset(dataset)\n processors.values.detect { |p| p.datasets&.include? dataset }\n end", "def fetch(processor_name)\n idx = processors.index {|processor| processor.name.equal?(processor_name)}\n idx or raise(UnknownProcessor.new(processor_name))\n end", "def locate_method\n <<-CODE\n t1 = stack_pop(); // include_private\n t2 = stack_pop(); // meth\n t3 = stack_pop(); // self\n stack_push(cpu_locate_method_on(state, c, t3, t2, t1));\n CODE\n end", "def get_processor; end", "def get_procs( symbol, name )\n return nil if @procs.size == 0\n @procs.find_all do |sym, match, block|\n (\n (sym.nil? or symbol == sym) and\n ((name.nil? and match.nil?) or match.nil? or (\n (name == match) or\n (match.kind_of? Regexp and name =~ match)\n )\n )\n )\n end.collect{|x| x[-1]}\n end", "def peek\n @stack[0]\n end", "def find_fault( path, stack )\n faults[stack]\n end", "def try_resolve(router)\n ret = @macs.find{|e| e[:router]==router || e[:macs].index(router)}\n return ret[:router] if ret #found something?\n router #nope\n end", "def processor_by_ref(ref)\n @processors[class_by_ref(ref)]\n end", "def find_by_name(name)\n @proc_table = Array.new\n ProcFetch.get_process({:name => name}).each do |proc_attrs|\n @proc_table.push(ProcInfo.new(proc_attrs))\n end\n childs_tree\n end", "def top()\n @stack[0]\n end", "def find(name)\n list.select do |vm|\n vm.name.to_s.index(name.to_s) && vm.running?\n end.first\n end", "def processor_path\n @processor_path || DEFAULT_PROCESSOR_PATH\n end", "def peek\n if empty?\n nil\n else\n @stack.first\n end\n end", "def search_by_name(process_name)\n if process_name =~ /^\\/.*\\/$/\n process_name.slice!(0)\n process_name = Regexp.new(/#{process_name.chop}/)\n find_all\n else\n find_by_name(process_name)\n end\n\n process_list = Array.new\n\n @proc_table.each do |process|\n if process_name.is_a? Regexp\n process_list << process if process.name =~ process_name || process.commandline =~ process_name\n else\n process_list << process if process.name.to_s.downcase == \"#{process_name.to_s.downcase}\" || process.commandline.to_s.downcase == \"#{process_name.to_s.downcase}\"\n end\n end\n\n process_list = nil if process_list.empty?\n\n return process_list\n end", "def find_vm(rp,vm_name)\n mob_vm = nil\n rp.each do |vm|\n break if ! mob_vm.nil?\n mob_vm = vm if vm.name == vm_name\n end\n if mob_vm.nil?\n fail \"Could not find virtual machine: #{vm_name}\"\n end\n mob_vm\n end", "def locate\n processes = includes.reduce(all_processes, &by_inclusion_patterns)\n processes = excludes.reduce(processes, &by_exclusion_patterns)\n processes = filters.reduce(processes, &by_filter)\n end", "def find(macro_name); end", "def find_soffice_pid\n %x(pgrep #{soffice_pname}).presence&.to_i\n end", "def processor\n return @options[:processor]\n end", "def get_system_proc\r\n # Make sure you got the correct SYSTEM Account Name no matter the OS Language\r\n local_sys = resolve_sid(\"S-1-5-18\")\r\n system_account_name = \"#{local_sys[:domain]}\\\\#{local_sys[:name]}\"\r\n\r\n this_pid = session.sys.process.getpid\r\n # Processes that can Blue Screen a host if migrated in to\r\n dangerous_processes = [\"lsass.exe\", \"csrss.exe\", \"smss.exe\"]\r\n session.sys.process.processes.each do |p|\r\n # Check we are not migrating to a process that can BSOD the host\r\n next if dangerous_processes.include?(p[\"name\"])\r\n next if p[\"pid\"] == this_pid\r\n next if p[\"pid\"] == 4\r\n next if p[\"user\"] != system_account_name\r\n return p\r\n end\r\n end", "def peek\n @codes[@pc]\n end", "def find_process_id(process_name)\n process = remote_processes.find { |p| p.cmd.include?(process_name) }\n process ? process.pid : nil\n end", "def locate_line(line)\n i = 1\n total = @lines.size\n while i < total\n cur_line = @lines.at(i)\n if cur_line == line\n ip = @lines.at(i-1)\n return nil if ip < 0\n return [self, ip]\n elsif cur_line > line\n break\n end\n\n i += 2\n end\n\n # Didn't find line in this CM, so check if a contained\n # CM encompasses the line searched for\n child_methods.each do |child|\n if res = child.locate_line(line)\n return res\n end\n end\n\n # No child method is a match - fail\n return nil\n end", "def getProcessor(key)\n key.downcase!\n raise ArgumentError, 'key must be a string' unless key.match /^[a-z]+$/\n \n context = OSX::NSApp.delegate.managedObjectContext\n request = OSX::NSFetchRequest.alloc.init\n \n entity = OSX::NSEntityDescription.\n entityForName_inManagedObjectContext('Processor', context)\n request.setEntity(entity)\n \n predicate = OSX::NSPredicate.predicateWithFormat(\"(key LIKE[c] '#{key}')\")\n request.setPredicate(predicate)\n \n sortDescriptor = OSX::NSSortDescriptor.alloc.initWithKey_ascending('key', true)\n request.setSortDescriptors([sortDescriptor])\n \n result = context.executeFetchRequest_error(request).first\n if result.is_a? OSX::NSError\n OSX::NSLog(\"Error Retriving Data: %@\", result)\n return nil\n end\n OSX::NSLog(\"Item: %@ Class: %@\", result, result.class)\n result = result.to_ruby # can't call #empty? or #size or #[] on a NSCFArray\n return nil if result.empty?\n return result.first.valueForKey('uri')\n end", "def find_min_priority\n loc = find_min_locator and [loc.value, loc.priority]\n end", "def find_worker id\n self.workers.find{ |worker| worker[:id] == id } \n end", "def lookup(token)\n if @subroutine.key?(token.val)\n @subroutine[token.val].vm_address\n elsif @class.key?(token.val)\n @class[token.val].vm_address\n else\n puts \"#{token.val} cannot be found in symbol tables\"\n end\n end", "def find_node(node_number)\n @_node_map[node_number]\n end", "def [](process_name)\n if process_name.include? '.'\n select { |process| process.type == process_name }\n else\n select { |process| process.process == process_name }.first\n end\n end", "def search_node(ip)\n found = nil\n @known_nodes.each do |node|\n if node.is_you? ip\n found = node\n end\n end\n return found\n end", "def peek()\n @stack.peek\n end", "def scan\n # start with the platform/families who have no families (the top levels)\n top = Train::Platforms.top_platforms\n top.each do |_name, plat|\n # we are doing a instance_eval here to make sure we have the proper\n # context with all the detect helper methods\n next unless instance_eval(&plat.detect)\n\n # if we have a match start looking at the children\n plat_result = scan_children(plat)\n next if plat_result.nil?\n\n # return platform to backend\n @family_hierarchy << plat.name\n return get_platform(plat_result)\n end\n\n raise Train::PlatformDetectionFailed, \"Sorry, we are unable to detect your platform\"\n end", "def top()\n @stack[-1]\n end", "def find_by_phone(phone)\n PhoneNumber.find_by_phone(phone).try(:member)\n end", "def find_optional_node_by_role(role, stack)\n if !node[:override_stacks].nil? && !node[:override_stacks][role].nil?\n stack = node[:override_stacks][role]\n puts \"stack override for #{role} found, using stack #{stack}\"\n end\n @nodes ||= find_stack(stack)\n matching_nodes = []\n @nodes.each { |stack_node|\n if stack_node[:roles] && stack_node[:roles].include?(role)\n matching_nodes << stack_node\n end\n }\n # Warn if no node has been found in the stack\n Chef::Log.debug \"The #{role} machine is either missing or corrupt in the #{stack} environment. This is okay, if the #{role} machine is not required.\" if matching_nodes.size == 0\n # Fail if mutiple nodes have been found in the stack\n raise \"Multiple #{role} machines were found in the #{stack} environment... This is not allowed. Cleanup of nodes may be necessary.\" if matching_nodes.size > 1\n return matching_nodes[0]\nend", "def _get_local_component(component)\n component = component.to_sym\n locals = @known_classes.values.map do |m|\n m[:pipeline_group][component]\n end.compact\n # TODO: Add a logger here..\n puts \"Found multiple bindings for: #{p}. Getting first found\" unless locals.size <= 1\n locals[0]\n end", "def find(param)\n detect { |e| e.to_param == param }\n end", "def processor_host\n @processor_host || raise(StandardError, PROCESSOR_HOST_MISSING)\n end", "def find_procname(pid)\n\tname = nil\n\t@client.sys.process.get_processes.each do |proc|\n\t\tif proc['pid'] == pid.to_i\n\t\t\tname = proc['name']\n\t\tend\n\tend\n\treturn name\nend", "def find_by_pid(pid)\n @proc_table = Array.new\n ProcFetch.get_process(:processid => pid).each do |proc_attrs|\n @proc_table.push(ProcInfo.new(proc_attrs))\n end\n childs_tree\n end", "def get_prc(prc)\n prc = [prc] unless prc.is_a?(Array)\n prc.map { |pn| Mdoc.get_processor(pn) }\n end", "def board_node_by_location(location)\n $board.each { |x| return x if x.location == location }\n return nil\nend", "def get_system_proc\r\n\t\t# Make sure you got the correct SYSTEM Account Name no matter the OS Language\r\n\t\tlocal_sys = resolve_sid(\"S-1-5-18\")\r\n\t\tsystem_account_name = \"#{local_sys[:domain]}\\\\#{local_sys[:name]}\"\r\n\r\n\t\t# Processes that can Blue Screen a host if migrated in to\r\n\t\tdangerous_processes = [\"lsass.exe\", \"csrss.exe\", \"smss.exe\"]\r\n\t\tsession.sys.process.processes.each do |p|\r\n\t\t\t# Check we are not migrating to a process that can BSOD the host\r\n\t\t\tnext if dangerous_processes.include?(p[\"name\"])\r\n\t\t\tnext if p[\"pid\"] == session.sys.process.getpid\r\n\t\t\tnext if p[\"pid\"] == 4\r\n\t\t\tnext if p[\"user\"] != system_account_name\r\n\t\t\treturn p\r\n\t\tend\r\n\tend", "def first(path_stack, node); end", "def top\n @stack[-1]\n end", "def find_path\n fail ProcessorNotImplementedError,\n \"Please implement #{self.class}#find_path\"\n end", "def has_proc?(code)\n hcp_codes = hcp_proc_codes.split(',') rescue nil\n return unless hcp_codes.any?\n hcp_codes.index(code)\n end", "def top()\n @stack[-1]\n end", "def peek\n self.stack_var[-1]\n end", "def machine(name)\n @env.active_machines.each do |m|\n node = @env.machine(*m)\n return node if node.name == name\n end\n nil\n end", "def get_proc(name)\r\n return Ragweed::Ptr.new(name) if name.kind_of? Numeric or name.kind_of? Ptr\r\n ptr(Ragweed::Wrap32::get_proc_address(name))\r\n end", "def get_breakpoint(cm, ip)\n @breakpoint_tracker.get_breakpoint(cm, ip)\n end", "def processor_type\n if @processor_type.nil?\n if os_family == 'Windows' && ENV['PROCESSOR_ARCHITECTURE']\n @processor_type = ENV['PROCESSOR_ARCHITECTURE']\n else\n @processor_type = @platform.exec(\"uname\", (os_type(:nice) =~ /Windows|HP-UX/ ? '-m' : '-p')).strip\n end\n end\n \n @processor_type\n end", "def find_symbol(sym, ctx)\n ctx.each do |h|\n if val = resolve_in(h, sym)\n return val\n end\n end\n\n nil\n end", "def processor_count\n @processor_count ||= begin\n os_name = RbConfig::CONFIG[\"target_os\"]\n if os_name =~ /mingw|mswin/\n require 'win32ole'\n result = WIN32OLE.connect(\"winmgmts://\").ExecQuery(\n \"select NumberOfLogicalProcessors from Win32_Processor\")\n result.to_enum.collect(&:NumberOfLogicalProcessors).reduce(:+)\n elsif File.readable?(\"/proc/cpuinfo\")\n IO.read(\"/proc/cpuinfo\").scan(/^processor/).size\n elsif File.executable?(\"/usr/bin/hwprefs\")\n IO.popen(\"/usr/bin/hwprefs thread_count\").read.to_i\n elsif File.executable?(\"/usr/sbin/psrinfo\")\n IO.popen(\"/usr/sbin/psrinfo\").read.scan(/^.*on-*line/).size\n elsif File.executable?(\"/usr/sbin/ioscan\")\n IO.popen(\"/usr/sbin/ioscan -kC processor\") do |out|\n out.read.scan(/^.*processor/).size\n end\n elsif File.executable?(\"/usr/sbin/pmcycles\")\n IO.popen(\"/usr/sbin/pmcycles -m\").read.count(\"\\n\")\n elsif File.executable?(\"/usr/sbin/lsdev\")\n IO.popen(\"/usr/sbin/lsdev -Cc processor -S 1\").read.count(\"\\n\")\n elsif File.executable?(\"/usr/sbin/sysconf\") and os_name =~ /irix/i\n IO.popen(\"/usr/sbin/sysconf NPROC_ONLN\").read.to_i\n elsif File.executable?(\"/usr/sbin/sysctl\")\n IO.popen(\"/usr/sbin/sysctl -n hw.ncpu\").read.to_i\n elsif File.executable?(\"/sbin/sysctl\")\n IO.popen(\"/sbin/sysctl -n hw.ncpu\").read.to_i\n else\n $stderr.puts \"Unknown platform: \" + RbConfig::CONFIG[\"target_os\"]\n $stderr.puts \"Assuming 1 processor.\"\n 1\n end\n end\n end", "def stack_top\n if @sp.zero?\n nil\n else\n @stack[@sp - 1]\n end\n end", "def find_route(request)\n @routes.find {|r| r.match?(request) }\n end", "def find_command( name )\n commands.each { |cmd| return cmd if cmd.name == name }\n nil\n end", "def get_proc_remote(name)\r\n if !name.kind_of?String\r\n return name\r\n end\r\n\r\n mod, meth = name.split \"!\"\r\n\r\n if mod.nil? or meth.nil?\r\n raise \"can not set this breakpoint: #{name}\"\r\n end\r\n\r\n modh = remote_call \"kernel32!GetModuleHandleA\", mod\r\n raise \"no such module #{ mod }\" if not modh\r\n\r\n # Location is an offset\r\n if is_hex(meth)\r\n baseaddr = 0\r\n modules.each do |m|\r\n if m.szModule.to_s.match(/#{mod}/)\r\n baseaddr = m.modBaseAddr\r\n break\r\n end\r\n end\r\n\r\n # Somehow the module does not appear to be\r\n # loaded. This should have been caught by\r\n # Process::is_breakpoint_deferred either way\r\n # Process::initialize should catch this return\r\n if baseaddr == 0 or baseaddr == -1\r\n return name\r\n end\r\n\r\n ret = baseaddr + meth.hex\r\n else\r\n # Location is a symbolic name\r\n ret = remote_call \"kernel32!GetProcAddress\", modh, meth\r\n end\r\n ret\r\n end", "def peek\n return self.heap[0]\n end", "def find_node(*args)\n node = @nodes.find_node(*args)\n node if context?(node)\n end", "def find_node\n @grid.find_node(self.mouse_x, self.mouse_y)\n end", "def processor_count\n case RbConfig::CONFIG['host_os']\n when /darwin9/\n `hwprefs cpu_count`.to_i\n when /darwin/\n (`which hwprefs` != '' ? `hwprefs thread_count` : `sysctl -n hw.ncpu`).to_i\n when /linux|cygwin/\n `grep -c ^processor /proc/cpuinfo`.to_i\n when /(net|open|free)bsd/\n `sysctl -n hw.ncpu`.to_i\n when /mswin|mingw/\n require 'win32ole'\n wmi = WIN32OLE.connect(\"winmgmts://\")\n cpu = wmi.ExecQuery(\"select NumberOfLogicalProcessors from Win32_Processor\")\n cpu.to_enum.first.NumberOfLogicalProcessors\n when /solaris2/\n `psrinfo -p`.to_i # this is physical cpus afaik\n else\n $stderr.puts \"Unknown architecture ( #{RbConfig::CONFIG[\"host_os\"]} ) assuming one processor.\"\n 1\n end\nend", "def get_proc_count\n procs = Facter.value('processors')\n if procs.key?('count') then\n procs['count'].to_i\n else\n 1\n end\nend", "def stack_top\n\n Lib.lua_gettop(@pointer)\n end", "def get_min()\n @min_stack[-1]\n end", "def load_stack\n $LOAD_STACK\n end", "def get_breakpoint(cm, ip)\n @breakpoint_tracker.get_breakpoint(cm, ip)\n end", "def find_macro(aMacroPhrase, useTable)\n key = MacroStep.macro_key(aMacroPhrase, useTable, :invokation)\n return macro_steps[key]\n end", "def search_for_command(command)\n @command_map[ command ]\n end", "def find(x)\n return nil if x.nil?\n low = 0\n high = @segments.size - 1\n while low <= high\n mid = (low + high) / 2\n\n case matches?(x, low, high, mid)\n when -1 then high = mid - 1\n when 1 then low = mid + 1\n when 0 then return @segments[mid]\n else return nil\n end\n end\n nil\n end", "def find(x)\n return nil if x.nil?\n low = 0\n high = @segments.size - 1\n while low <= high\n mid = (low + high) / 2\n\n case matches?(x, low, high, mid)\n when -1 then high = mid - 1\n when 1 then low = mid + 1\n when 0 then return @segments[mid]\n else return nil\n end\n end\n nil\n end", "def use(processor, options = {})\n @stack << [self.class.get_callable(processor, Roger::Release::Processors.map), options]\n end", "def fork\n find_forks(@computer_mark).first\n end", "def find_by_param(param)\n with_param(param).first\n end", "def find(num_of_line)\n target_line, target_method_declare_line = extract_content(num_of_line)\n recursive_search_ast(@ast, target_line, target_method_declare_line)\n return @method_source\n end", "def top()\n @stack[-1]\n end", "def stack(which, name)\n @@stacks[which][name]\n end", "def get_min()\n @min_stack[-1]\n end", "def pidof(program)\n pids = []\n full = cmd_exec('ps -elf').to_s\n full.split(\"\\n\").each do |pid|\n pids << pid.split(' ')[3].to_i if pid.include? program\n end\n pids\n end", "def has_process?(processname)\n\t\t\t\tif(!processname.kind_of?(Regexp))\n\t\t\t\t\tprocessname = Regexp.new(Regexp.escape(processname))\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tprocesses().each_value() { |runningprocess|\n\t\t\t\t\tif(processname.match(runningprocess.program))\n\t\t\t\t\t\tCfruby.controller.inform('debug', \"\\\"#{processname.source}\\\" is running\")\n\t\t\t\t\t\treturn(runningprocess)\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tCfruby.controller.inform('debug', \"\\\"#{processname.source}\\\" is not running\")\n\t\t\t\treturn(false)\n\t\t\tend", "def breadth_first(value_to_find)\r\n current_node = self\r\n queue = MyQueue.new \r\n\r\n while current_node != nil\r\n if current_node.payload == value_to_find\r\n return current_node\r\n end\r\n current_node.children.each do |child|\r\n queue.enqueue(child)\r\n end\r\n current_node = queue.dequeue\r\n end\r\n end", "def discover_fork(ctoken, spaces, board)\n open_spaces = compile_open_spaces(spaces)\n\n # Cycle through open_spaces; temporarily add a token to spaces;\n # then determine if there are two instances of two computer tokens\n # in a row.\n avail = [] # array of fork-creating spaces, to maximize randomness of play\n open_spaces.each do |space|\n # assigns computer token to this empty space\n spaces[space] = ctoken\n # check if spaces now contains a fork!\n afork, length = are_there_two_computer_tokens_in_a_row(ctoken, spaces, board)\n spaces[space] = \" \"\n avail << space if length && length > 1 # add this space to array of fork-creating spaces\n end\n if ! avail.empty? # do this if there ARE available fork-creating spaces\n corners = avail.select {|x| [0, 2, 6, 8].include?(x)}\n return corners.sample if ! corners.empty? # gimme any corner blocker first\n return avail.sample # then other kinds of blockers\n end\n return false # if no forks were found\nend", "def find_vm_host\n # datacenter.hostFolder.children is a tree with clusters having hosts in it.\n # needs to flatten nested array\n hosts = datacenter.hostFolder.children.map { |child| child.host }.flatten\n host = hosts.select { |host|\n host.vm.find { |hvm|\n hvm == vm\n }\n }.first\n\n host\n end", "def find_vm_host\n # datacenter.hostFolder.children is a tree with clusters having hosts in it.\n # needs to flatten nested array\n hosts = datacenter.hostFolder.children.map { |child| child.host }.flatten\n host = hosts.select { |host|\n host.vm.find { |hvm|\n hvm == vm\n }\n }.first\n\n host\n end", "def find_vm_host\n # datacenter.hostFolder.children is a tree with clusters having hosts in it.\n # needs to flatten nested array\n hosts = datacenter.hostFolder.children.map { |child| child.host }.flatten\n host = hosts.select { |host|\n host.vm.find { |hvm|\n hvm == vm\n }\n }.first\n\n host\n end", "def find_frame_of_port(port)\n if port.respond_to?(:to_str)\n port = task.find_port(port)\n end\n if result = frame_associations[port]\n result\n else\n supercall(nil, :find_frame_of_port, port)\n end\n end", "def find(&block)\n return nil unless valid?\n @hops.find(&block)\n end", "def top\n @stack.last\n end", "def peek\n raise \"Stack Underflow - The stack is empty\" if self.is_empty?\n @store[top]\n end", "def find_local_symbol(symbol)\n find_class_or_module(symbol) || super\n end", "def top()\n @stack.empty? ? nil : @stack.last\n end", "def find_route(url)\n @routes.each do |route|\n if route.match(url)\n return route\n end\n end\n nil\n end", "def p4_cpu(os)\n cpu = RbConfig::CONFIG['target_cpu']\n case os\n when :darwin, :linux\n if cpu =~ /i686/\n 'x86'\n elsif cpu =~ /universal/\n 'x86_64'\n else\n cpu\n end\n else\n case cpu\n when /ia/i\n 'ia64'\n else\n cpu\n end\n end\nend", "def detect_cpu_cores_nix\n # On Unix platforms trying to use etc module to determine accessible\n # number of cores\n require 'etc'\n Etc.nprocessors\n end", "def find_preloader(item, property)\n return Preloaders::NilPreloader.instance if item.nil?\n\n method = :\"#{property}__priloo__\"\n preloader = item.send(method) if item.respond_to? method\n preloader ||= Preloaders::CollectionPreloader.instance if property == :__each__ && item.is_a?(Enumerable)\n preloader ||= Preloaders::NavigatingPreloader.new(property)\n raise \"Cannot find any preloader for property '#{property}' of #{item}\" unless preloader\n\n preloader\n end", "def find_by_path(request_path)\n routes = Disraptor::RouteStore.get_routes()\n\n return routes.values.detect do |route|\n route['sourcePath'] == request_path\n end\n end", "def getpid\n @resource.fail \"Either stop/status commands or a pattern must be specified\" unless @resource[:pattern]\n ps = Facter[\"ps\"].value\n @resource.fail \"You must upgrade Facter to a version that includes 'ps'\" unless ps and ps != \"\"\n regex = Regexp.new(@resource[:pattern])\n self.debug \"Executing '#{ps}'\"\n IO.popen(ps) { |table|\n table.each_line { |line|\n if regex.match(line)\n ary = line.sub(/^\\s+/, '').split(/\\s+/)\n return ary[1]\n end\n }\n }\n\n nil\n end", "def stackFrameWalk()\n toKernel32Code = toKernel32()\n data = <<EOS\n push esi\n push ecx\n\n mov eax, ebp\n\n stack_walking:\n mov esi, eax\n lodsd\n mov ecx,[eax]\n test ecx, ecx\n jnz stack_walking\n\n ; esi now points to last stack frame (and since lodsd increments esi by 4 it points to function in ntdll.dll)\n mov eax,[esi]\n\n find_begin:\n dec eax\n xor ax,ax ; work through image until we find base address\n cmp word [eax],0x5A4D ; MZ start of PE header\n jnz find_begin\n\n pop ecx\n pop esi\n\n mov edx, eax\n ; edx now points to ntdll.dll or kernel32.dll base address (depending on windows version)\n\n #{toKernel32Code}\nEOS\n data\n end" ]
[ "0.63662827", "0.62281543", "0.6001952", "0.56400645", "0.5556072", "0.5550804", "0.5449586", "0.5342971", "0.5336633", "0.52724665", "0.5239903", "0.5185863", "0.5110354", "0.5093909", "0.50866336", "0.50786215", "0.50699306", "0.50662357", "0.5063109", "0.50586224", "0.5004295", "0.49898463", "0.4988505", "0.4965796", "0.4964004", "0.49630722", "0.4960535", "0.49592277", "0.49573803", "0.49494508", "0.49476", "0.49437743", "0.4918038", "0.4911703", "0.49103165", "0.4900106", "0.4898885", "0.48930803", "0.48896524", "0.48896044", "0.48812538", "0.48694965", "0.486446", "0.48563778", "0.48445123", "0.4843258", "0.48429498", "0.48315138", "0.48280486", "0.4824871", "0.48232013", "0.48099917", "0.4804861", "0.47953263", "0.47890756", "0.47814208", "0.47804335", "0.47803006", "0.47789308", "0.4761319", "0.4753531", "0.4752319", "0.4742292", "0.47411993", "0.4717092", "0.47170848", "0.4715898", "0.4713723", "0.47136828", "0.4710062", "0.47040257", "0.4694799", "0.46945763", "0.46945667", "0.46925396", "0.46908757", "0.4688495", "0.46811292", "0.46772152", "0.4674265", "0.46641412", "0.46593747", "0.46589184", "0.46426508", "0.46409646", "0.46409646", "0.46409646", "0.4631186", "0.46311215", "0.46291265", "0.4622441", "0.46191034", "0.4617725", "0.46158755", "0.4615369", "0.46099725", "0.46030968", "0.46014887", "0.45991772", "0.45972285" ]
0.7201373
0
Let's make our own `each` method on AnimalSet. Now, we can have a set of animals and get one at a time. Because the animals is ultimately just an array (look at the initialize method), we're going to cheat a little bit and just take a block to AnimalSet's each method and then
def each(&block) @animals.each(&block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each(&block)\n to_set.each(&block)\n end", "def each_set\n \n end", "def each(&block); end", "def each(&block); end", "def each(&block); end", "def each(&block); end", "def each(&block); end", "def each(&block); end", "def each(&blk)\n to_a.each(&blk)\n end", "def each(&blk)\r\n to_a.each(&blk)\r\n end", "def each(&block)\n to_a.each(&block)\n end", "def each(&block)\n to_a.each(&block)\n end", "def each(&block)\n internal_collection.each(&block)\n end", "def each(&a_proc); end", "def each(&block)\n to_a.each(&block)\n end", "def each(&block)\n raise NotImplementedError\n end", "def each(&block)\n find_each(&block)\n end", "def each(&block)\n all.each(&block)\n end", "def each(&block)\n return all.each(&block)\n end", "def each(&block)\n @collection.each(&block)\n end", "def each(&block)\n @collection.each(&block)\n end", "def each(&block)\n raise NotImplementedError\n end", "def each(&block)\n to_a.each(&block)\n end", "def each(&block)\n end", "def each\n to_a.each\n end", "def each\n to_a.each\n end", "def each\n to_a.each\n end", "def each(*) end", "def each()\n self.to_a.each { |elt| yield elt }\n end", "def each(&block)\n unless block_given?\n return ArrayEnumerator.new(self, :each ) # for 1.8.7\n end\n i = 0\n lim = self.__size\n while i < lim\n block.call(self.__at(i))\n i += 1\n end\n self\n end", "def each\n self.to_a.each do |el|\n yield(el)\n end\n end", "def each(&block)\n @all.each(&block)\n end", "def each\n # passes block - if any - to upstream each.\n to_a.each(&Proc.new)\n end", "def each\n all.each do |el|\n yield el\n end\n end", "def each(&blk); each_value(&blk) ; end", "def each\n return enum_for(:each) unless block_given?\n results.each(&Proc.new)\n self\n end", "def each(&block)\n array.each(&block)\n end", "def each\n all.each do |el|\n yield el\n end\n end", "def each\n raise 'Not implemented'\n end", "def each(&block)\n\n end", "def each\n return enum_for(:each) unless block_given?\n\n @data.collection.each { |item| yield item }\n end", "def each(&block)\n @items.each(&block)\n self\n end", "def each(&block)\n @array.each(&block)\n end", "def each(&block)\n @array.each(&block)\n end", "def each\r\n @many = true\r\n yield(self)\r\n end", "def each &block\n end", "def each(options={}, &block)\n end", "def each(&block)\n @array.each(&block)\n end", "def each\n @collection.each { |c| yield c }\n end", "def each(&block)\n @mutable.each(&block)\n end", "def collect!\n block_given? or return enum_for(__method__)\n set = self.class.new\n each { |o| set << yield(o) }\n replace(set)\n end", "def each\n yield self[0]\n yield self[1]\n end", "def each_identity; end", "def each; end", "def each; end", "def each; end", "def each; end", "def each; end", "def each; end", "def each; end", "def each; end", "def each; end", "def each; end", "def each; end", "def each(&block)\nend", "def each(&block)\n @collection.each do |collectable|\n if block_given?\n block.call collectable\n else \n yield collectable\n end\n end \n end", "def each\n if block_given?\n @array.each do |e|\n yield e\n end\n end\n end", "def each(&block)\n if use_eager_all?\n all(&block)\n else\n super\n end\n end", "def each(&blk)\n data.each(&blk)\n end", "def each(&blk)\n values.each(&blk)\n end", "def each(&block)\n return enum_for :each unless block\n\n @data.each(&block)\n\n self\n end", "def each(&block)\n @items.each(&block)\n end", "def each(&block)\n @values.each(&block)\n self\n end", "def each(&block)\n items.each &block\n end", "def each(&block)\n items.each &block\n end", "def each_container(&block)\n collection.each_value(&block)\n end", "def each(&block)\r\n @arr.each &block\r\n end", "def each(&block)\r\n @arr.each &block\r\n end", "def each\n yield self\n end", "def each\n raise NotImplementedError.new(\"each() must be implemented by subclasses of AbstractChangeset.\")\n end", "def each\n\n\t\t@a.each do |x|\n\t\t\tyield x\n\t\tend\n\tend", "def each(&block)\n entries.each(&block)\n end", "def each(&block)\n entries.each(&block)\n end", "def each\n return enum_for(:each) unless block_given?\n changesets.each do |c|\n yield c\n end\n end", "def each(&block)\n @relation.each(&block)\n end", "def each(&block)\n return enum_for(:each) unless block\n while rec = fetch\n block.call rec\n end\n self\n end", "def each(&block)\n return enum_for(:each) unless block\n while rec = fetch\n block.call rec\n end\n self\n end", "def each(*args, &block)\n array.each(*args, &block)\n end", "def each(&blk)\n @values.each(&blk)\n end", "def each(&block)\n self.data.each(&block)\n end", "def custom_each(array)\r\n i = 0 \r\n while i < array.length \r\n yield array[i]\r\n i += 1\r\n end\r\nend", "def each(&block)\n entries.each(&block)\n self\n end", "def each\n for each element\n yield(element)\n end\nend", "def each(array)\n for elem in array do\n yield(elem)\n end\n\n array\nend", "def each\n find.each { |found| yield(found) }\n end", "def each(&block)\n @poss.each(&block)\n end", "def each(&block)\n\n all.each { |wi| block.call(wi) }\n end", "def each\n # Include every to be inside enumerable:\n yield \"pizza\"\n yield \"spaghetti\"\n yield \"salad\"\n yield \"water\"\n yield \"bread\"\n end", "def each(&block)\n block or return enum_for(__method__)\n to_a.each(&block)\n self\n end", "def each(&block)\n self.entries.each(&block)\n end" ]
[ "0.74520004", "0.6771321", "0.6714319", "0.6714319", "0.6714319", "0.6714319", "0.6714319", "0.6714319", "0.6712648", "0.6606891", "0.66025525", "0.66025525", "0.6601737", "0.65995485", "0.6589604", "0.6571258", "0.6534822", "0.65341634", "0.6518419", "0.65175265", "0.6513707", "0.65088654", "0.64938635", "0.64898205", "0.6463406", "0.6463406", "0.6463406", "0.64546216", "0.6437913", "0.64210105", "0.6391142", "0.63802695", "0.63747585", "0.6335544", "0.63355017", "0.6310195", "0.63019", "0.6294073", "0.62878865", "0.62796074", "0.6273736", "0.62425613", "0.62339103", "0.62339103", "0.62149274", "0.6214061", "0.62124586", "0.62060714", "0.6198183", "0.6196101", "0.61934435", "0.6191736", "0.61844444", "0.6166312", "0.6166312", "0.6166312", "0.6166312", "0.6166312", "0.6166312", "0.6166312", "0.6166312", "0.6166312", "0.6166312", "0.6166312", "0.61652935", "0.61519027", "0.6150063", "0.6146259", "0.613999", "0.6122732", "0.6121271", "0.61205226", "0.60943717", "0.6091735", "0.6091735", "0.60907", "0.60679877", "0.60679877", "0.60617775", "0.6055686", "0.603347", "0.6031446", "0.6031446", "0.6031381", "0.60168827", "0.6014112", "0.6014112", "0.60138935", "0.6013822", "0.6012425", "0.60117227", "0.60086834", "0.6007366", "0.6000552", "0.5995603", "0.5995015", "0.5994414", "0.5990355", "0.5985437", "0.59802556" ]
0.7883949
0
goal ideas: number of consecutive problems solved number of problems solved number of problems solved by language number of problems with an explanation
def initialize require 'bcrypt' super @options.banner = "Usage: #{__FILE__} goals [options]" @options.on('-i', '--interactive', "Updates display in real-time") do |o| @interactive = true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def n_solved_problems\n\t\tn_solved_problems=self.user_problem_relations.select{|r| (r.solved_during_free || r.solved_during_premium)}.count\n\tend", "def getNumberOfSolutions; @solutions.length; end", "def solve\n t = IO.read( 'resources/0089_roman.txt' ).split.map do |line|\n n = ProjectEuler::Roman.to_i( line )\n line.length - ProjectEuler::Roman.from_i( n ).length\n end\n\n t.inject( :+ )\n end", "def problem_108a\n i = 4\n max = 0\n solve = {}\n loop do\n num = 0\n a = Rational(1,i)\n 2.upto(i*2+1) do |j|\n if (a - Rational(1,j)).numerator == 1\n num += 1 \n# puts \"(#{a} - #{Rational(1,j)} == #{a - Rational(1,j)}\"\n end\n end\n\n solve[num] = [] unless solve[num]\n solve[num] << i.factors\n\n if num >= max\n puts \"####################################\"\n solve.each_key.sort.each do |k|\n s = solve[k].map do |v|\n h = {}\n v.each {|a| h[a] = (h[a] || 0) + 1 }\n h.values.sort.flatten\n end.uniq.sort\n puts \"k = #{k} groups: #{s.inspect}\"\n# puts solve[k].inspect\n end\n puts \"#{i} = #{num} #{i.factors} #{i.factors.length + i.divisors.length}\" \n max = num\n end\n break if num > 1000\n i += 1\n end\n i\nend", "def generate_solution_space\n @problem.add( \"N { assigned(C,WD,TF) : weekday(WD,_), timeframe(TF,_) } N :- course_component(C,_,N,_,_,_).\" )\n end", "def problem_14(*params)\n option = params.pop[:problem] if params.last.is_a? Hash\n option ||= :count_clumps\n\n option == :count_clumps ? count_clumps(*params): same_ends(*params)\nend", "def solve\n perms = (1..9).to_a.permutation.map {|p| p.join}\n prods = []\n\n perms.each do |p|\n (1..2).each do |len|\n a, b, c = p[0, len].to_i, p[len..4].to_i, p[5, 4].to_i\n prods << c if a * b == c\n end\n end\n \n prods.uniq.reduce( :+ )\n end", "def nb_problems\n return @pb_list.length\n end", "def calculates(problems)\n problems.each do |each_prob|\n calculate_problem(each_prob)\n end\nend", "def solution(s, p, q)\n counts = [nil, [0], [0], [0], [0]]\n factors = s.split(//).map do |nu|\n case nu\n when 'A'\n 1\n when 'C'\n 2\n when 'G'\n 3\n when 'T'\n 4\n end\n end\n for i in (1..factors.length)\n fa = factors[i - 1]\n for j in [1, 2, 3, 4]\n counts[j][i] = counts[j][i - 1]\n end\n counts[fa][i] += 1\n end\n \n (0..p.count - 1).map { |k|\n if p[k] == q[k]\n factors[p[k]]\n else\n [1, 2, 3, 4].index do |i|\n counts[i][q[k] + 1] - counts[i][p[k]] > 0\n end + 1\n end\n }\nend", "def solve\n loop { break if !shift }\n return @solutions\n end", "def number_of_programming_languages(text_array)\n resume_as_array = resume_to_array(text_array)\n result = 0\n @programming_languages.each do |p|\n if resume_as_array.include?(p)\n result += 1\n end\n end\n return result\nend", "def solve_again_with_issues(array, sum)\n result = {}\n freq = {}\n count = 0\n\n array.each do |el|\n freq[el] ? freq[el] += 1 : freq[el] = 1\n end\n\n array.each do |el|\n if freq[sum - el] && !result[sum - el]\n count += freq[sum - el]\n end\n end\n count/2\nend", "def solve(n, s, d, m)\n # Complete this function\n records = s;\n\n (1...n).each do |i|\n records[i] += records[i-1]\n end\n\n numberOfWays = (m <= n && records[m - 1] == d) ? 1 : 0;\n\n (m...n).each do |i|\n if records[i] - records[i - m] == d\n numberOfWays += 1\n end\n end\n\n numberOfWays\n\nend", "def solve\n\t\t# Attempt to find a mismatch in start/end\n\t\t# letters in the maps. This signifies first\n\t\t# and last words of the solution\n\t\tdiff_list = []\n\t\t@start_map.each {|k,v|\n\t\t\tr = @end_map[k]\n\t\t\tdiff = r-v\n\t\t\tputs \"#{k} => #{v} | #{r} diff #{diff}\"\n\t\t\t\n\t\t\t# If values in map don't match, remember this\n\t\t\tif diff != 0\n\t\t\t\tdiff_list << diff\n\t\t\tend\n\t\t}\n\n\t\t# Ensure the matchings satisfy the properties of\n\t\t# and solvable puzzle. If there are \n\t\tputs diff_list\n\t\tif diff_list.size == 0\n\t\t\t# This means there are cycles (multiple\n\t\t\t# choices for the first word).\n\t\telsif diff_list.size == 2\n\t\t\t# Ensure there is exactly one starting\n\t\t\t# word and exactly one ending word\n\t\t\treturn [] if !diff_list.include?( 1 )\n\t\t\treturn [] if !diff_list.include?( -1 )\n\t\telse\n\t\t\t# This signifies an unsolvable puzzle\n\t\t\tputs \"Not Solvable\"\n\t\t\treturn []\n\t\tend\n\n\t\t# The characteristics of this word list look\n\t\t# good so far. Let's now try to enumerate the\n\t\t# solution array\n\t\treturn enumerate_solution\n end", "def solver (seed_char, blanks_words_sizes, matrix)\n\t# Set numerical target\n\ttarget = magic_num(seed_char)\t\n\t# Find magic number sum buckets\n\tskynet(target, blanks_words_sizes, blanks_words_sizes.length - 1, 0, [])\n\t# Alphabetical sort input matrix\n\tsorted_seed_char = seed_char.chars.sort.join\t\n\n\t# Find unique sets from skynet solutions\n\t$answer[:trace].each do |arrOarr|\n\t\tarrOarr.sort!\n\tend \n\n\t$answer[:trace].uniq!\t\n\t\n\t# Finds match for complete set of words from skynet solutions\n\t$answer[:trace].each do |answer_arr_el|\t\t\t\t\n\t\tunordered_match(sorted_seed_char, matrix, answer_arr_el, answer_arr_el.length - 1, \"\", [])\n\t\t# Can be ignored\n\t\t$ops += $seed[answer_arr_el[0][0]][:num_groups][answer_arr_el[0][1]].length *\n\t\t\t$seed[answer_arr_el[1][0]][:num_groups][answer_arr_el[1][1]].length *\n\t\t\t$seed[answer_arr_el[1][0]][:num_groups][answer_arr_el[1][1]].length *\n\t\t\t$seed[answer_arr_el[1][0]][:num_groups][answer_arr_el[1][1]].length\t\t\n\tend\n\t\n\treturn $answer[:words]\nend", "def solve(ingredients, part_two: false)\n score = 0\n max = 0\n\n (0..100).each do |i|\n (0..100 - i).each do |j|\n (0..100 - i - j).each do |k|\n l = 100 - i - j - k\n capacity = calculate_total(ingredients, \"capacity\", i, j, k, l)\n durability = calculate_total(ingredients, \"durability\", i, j, k, l)\n flavor = calculate_total(ingredients, \"flavor\", i, j, k, l)\n texture = calculate_total(ingredients, \"texture\", i, j, k, l)\n calories = calculate_total(ingredients, \"calories\", i, j, k, l)\n\n next if part_two && calories != 500\n next if capacity <= 0 || durability <= 0 || flavor <= 0 || texture <= 0\n\n score = capacity * durability * flavor * texture\n max = score if score > max\n end\n end\n end\n max\nend", "def solved?\n unknown_count == 0\n end", "def sol inp\n k, ins = inp.split(' ',2)\n k = k.to_i\n ps, pr, pi, pu, pw, pd, pl = ins.split.map(&:to_f)\n\n @ps = ps\n @pr = pr\n @pu = pu\n @pw = pw\n @pd = pd\n @pl = pl\n\n #\n # required_wins = 2\n # # winning 1st set\n # first_set = ps*pi + pr*(1-pi)\n # # winning 2nd set\n # first_set * winning_another_set + (1-first_set)*winning_another_set\n #\n # required_wins.times do |i|\n # count = 0\n # while count <= i\n # wins[i] = win_scene(pi,ps,pr, count)\n # count+=1\n # break if count == i\n # lose_scene(pi,ps,pr, pr,count)\n # end\n # end\n\n # winning second set after winning first + winning second set after winning one\n # wins[0]*win_scene(pi,ps,pr) + (1-wins[0])*lose_scene(pi,ps,pr)\n\n def win_scene(pi,round,required_wins,current_wins)\n return 0 if round >= required_wins\n # puts \"w #{' '*round},#{required_wins},#{current_wins})\"\n sunny = (round == 0) ? pi : (pi+(@pu*@pw))\n sunny = 1.0 if sunny > 1\n sunny = 0.0 if sunny < 0\n chance = sunny*@ps + (1-sunny)*@pr\n binding.pry if chance > 1\n\n if required_wins == current_wins+1\n chance\n else\n # return 0 if round > 100\n return 0 if (10**7*chance).to_i < 1\n wins = win_scene(sunny,round+1,required_wins,current_wins+1)\n # lose = lose_scene(sunny,round+1,required_wins,current_wins+1)\n chance * (wins)#+ (1-chance)*lose\n end\n end\n\n def lose_scene(pi,round,required_wins,current_wins)\n return 0 if round >= required_wins\n # puts \"l #{' '*round},#{required_wins},#{current_wins})\"\n sunny = (round == 0) ? pi : (pi-(@pd*@pl))\n sunny = 1.0 if sunny > 1\n sunny = 0.0 if sunny < 0\n chance = sunny*@ps + (1-sunny)*@pr\n binding.pry if chance > 1\n\n if required_wins == current_wins\n chance\n else\n # return 0 if round > 100\n return 0 if (10**7*chance).to_i < 1\n wins = win_scene(sunny,round+1,required_wins,current_wins+1)\n # lose = lose_scene(sunny,round+1,required_wins,current_wins+1)\n chance * (wins) #+ (1-chance)*lose\n end\n end\n\n # a = win_scene(pi,0,1,0)\n b = win_scene(pi,0,k,0)\n c = lose_scene(pi,0,k,0)\n # c = (k > 1) ? lose_scene(pi,1,k,0) : 0\n\n puts b\n puts c\n b +c\n # wtf?\n # 0.4* win_scene(pi,0,k,0)+ (1-0.6)*lose_scene(pi,0,k,0)\n\n# def smth(pi, ps, pr, setcount=0)\n# arr[1] = arr[0]\n# end\n# # set 2+ ?\n# set2 = ((ps+pu)*pw + ps*(1-pw))*pi\n# (1-set1)*((ps-pd)*pl + ps*(1-pl))\n# if k > 1\n# (k-1).times do\n#\n# end\n# end\nend", "def show_all_solutions\n solutions = permutations(%w{l l l l l r r r r r}).to_a\n 0.upto(solutions.length-1) do |solution|\n puts \"Solution \\# #{solution+1}\"\n trace(solutions[solution])\n self.grid = make_grid\n end\n solutions.size\n end", "def solutions(args)\n book = require_arg(args,'book')\n hw = get_hw_from_file_or_die(require_arg(args,'in_file'))\n sets = hw_to_sets(hw,book)\n stream_labels = assign_starts_of_streams_to_sets(sets,hw)\n out_file = require_arg(args,'out_file')\n class_title = require_arg(args,'class_title')\n sets = require_arg(args,'sets')\n gb_file = require_arg(args,'gb_file')\n sample = (args.has_key?('sample') && args['sample'].to_i==1)\n roster = get_roster_from_opengrade(gb_file) # roster[\"blow_joe\"]={last, first, class, id_string, and id_int}\n solution_in_book = {} # [label]=boolean\n sources_parent_dir = File.expand_path(require_arg(args,'sources_parent_dir'))\n subdir_list = []\n Dir.chdir(sources_parent_dir) do # do block so we chdir back afterward\n subdir_list=Dir[\"*\"].reject{|o| not File.directory?(o)}.sort\n end\n probs = {}\n n_hw_defined=0\n header = true\n students_encountered = {}\n problem_labels_encountered = []\n File.readlines(sets).each { |line|\n if header then\n header = false\n else\n # set,book,ch,num,parts,flags,chunk,student\n unless line=~/(.*),(.*),(.*),(.*),(.*),(.*),(.*),(.*)/ then fatal_error(\"illegal line in #{sets}: #{line}\") end\n hw,ch,num,student = [$1.to_i,$3.to_i,$4,$8] # no to_i on num, could be \"g7\"\n if hw>n_hw_defined then n_hw_defined=hw end\n students_encountered[student] = true\n if probs[student].nil? then probs[student] = {} end\n if probs[student][hw].nil? then probs[student][hw] = [] end\n l = $num_to_label[[ch,num]]\n if l.nil? then fatal_error(\"no label found for ch. #{ch}, problem #{num}\") end\n problem_labels_encountered.push(l)\n probs[student][hw].push(l)\n end\n }\n students_encountered.keys.each { |k|\n unless roster.has_key?(k) then fatal_error(\"student #{k} occurs in #{sets}, but not in #{gb_file}\") end\n }\n roster.keys.each { |k|\n unless students_encountered.has_key?(k) then fatal_error(\"student #{k} occurs in #{gb_file}, but not in #{sets}\") end\n }\n label_to_source_file = {}\n problem_labels_encountered.each { |l|\n p = $label_to_num[l]\n solution_in_book[l] = $has_solution[p]\n subdir_list.each { |d|\n t = sources_parent_dir+\"/\"+d+\"/\"+l+\".tex\"\n if File.exists?(t) then label_to_source_file[l] = t; next end\n }\n if !solution_in_book[l] && label_to_source_file[l].nil? then $stderr.print \"warning: no solution found for #{l} in any subdirectory of #{sources_parent_dir}\\n\" end\n }\n head = <<-\"HEAD\"\n \\\\documentclass{simplesolns}\n \\\\begin{document}\n {\\\\Huge\\\\textbf{Solutions for #{class_title}}}\\\\\\\\\\n\n HEAD\n tail = <<-'TAIL'\n \\end{document}\n TAIL\n toc = ''\n tex = ''\n 1.upto(n_hw_defined) { |hw|\n toc = toc + \"\\\\noindent Homework #{hw} ... \\\\pageref{set#{hw}}\\\\\\\\\\n\"\n first_student = true\n roster.keys.sort.each { |student|\n label_for_toc = ''\n if sample && !first_student then break end\n if first_student then label_for_toc = \"\\\\label{set#{hw}}\" end\n tex = tex + <<-\"TEX\"\n\n \\\\pagebreak\n\n \\\\noindent%\n {\\\\large\\\\textbf{Solutions to Homework #{hw}, #{class_title},\n #{roster[student][\"first\"]} #{roster[student][\"last\"]} }}#{label_for_toc}\\\\\\\\\\n\n TEX\n first_student = false\n probs[student][hw].each { |label|\n p = $label_to_num[label]\n if solution_in_book[label] then\n tex = tex+solution_helper(p,'solution in the back of the book')\n else\n source_file = label_to_source_file[label]\n missing = false\n if source_file.nil?\n missing = true\n else\n s,err = slurp_file_with_detailed_error_reporting(source_file)\n if s.nil? then \n missing=true \n $stderr.print \"warning: error reading file #{source_file}, #{err}\"\n else\n tex = tex+solution_helper(p,s)\n end\n end\n if missing then\n tex = tex+solution_helper(p,'!!!!!!!!!!! missing solution !!!!!!!!!!!!!!')\n end\n end\n }\n }\n }\n File.open(out_file,'w') { |f|\n f.print head+toc + \"\\\\pagebreak\" + tex+tail\n }\nend", "def calc_no_of_valleys(\n steps:\n )\n # Convert it to a char array\n char_array = steps.split('')\n result, temp, stack = 0, 0, [0]\n char_array.each do |step|\n \t# If step is U increment temp else decrement\n \ttemp = step.eql?('U') ? temp+1 : temp-1\n \t# Empty the stack\n \tstack_var = stack.pop\n \t# Increment result if we move from 0 to -ve\n \tresult += 1 if (stack_var == -1 && temp == 0)\n \t# Push the last state into stack\n \tstack.push(temp)\n end\n # Return result\n result\nend", "def solve_again_with_more_issues(array, sum)\n array.combination(2).find_all do |one, two|\n one + two == sum\n end.size\nend", "def solution(s, p, q)\n # write your code in Ruby 2.2\n g = s.length + 1\n a = (s.length + 1)**3\n c = (s.length + 1)**2\n tmp = []\n res = []\n tmp.push 0\n o = 0\n s.split('').each do |i|\n o += if i == 'T'\n 1\n elsif i == 'G'\n g\n elsif i == 'C'\n c\n else\n a\nend\n tmp.push o\n end\n (0...p.length).each do |k|\n o = tmp[q[k] + 1] - tmp[p[k]]\n if o >= a\n res.push 1\n elsif o >= c\n res.push 2\n elsif o >= g\n res.push 3\n else\n res.push 4\n end\n end\n res\nend", "def word_count\n @tried_solutions.length\n end", "def print_solution\n\n\t\t# The first, the number of test case\n\t\tputs \"Test case \\##{@i}\"\n\n\t\t# For every pair to be tested\n\t\t@sub_sequence_idx.each do |s,e|\n\n\t\t\t# the maximum number of coincidences is stored on max\n\t\t\tmax = 0\n\n\t\t\t# the current number of coincidences in a row is stored on coincidences_on_a_row\n\t\t\tcoincidences_on_a_row = 0\n\n\t\t\t# From start of the range\n\t\t\ti = s - 1\n\n\t\t\t# Until the end of it (please note the index of s,e is 1-based)\n\t\t\twhile i < e - 1\n\n\t\t\t\t# if there is a coincidence\n\t\t\t\tif @equals[ i ]\n\n\t\t\t\t\t# we inc the counter\n\t\t\t\t\tcoincidences_on_a_row += 1\n\n\t\t\t\t# if the coincidences stop...\n\t\t\t\telsif coincidences_on_a_row > 0\n\n\t\t\t\t\t# we store the maximum\n\t\t\t\t\tmax = [ coincidences_on_a_row, max ].max\n\n\t\t\t\t\t# and reset the counter\n\t\t\t\t\tcoincidences_on_a_row = 0\n\t\t\t\tend\n\n\t\t\t\t# next number!!\n\t\t\t\ti += 1\n\t\t\tend\n\n\t\t\t# in case of coincidences found at the end of the range, update the max before...\n\t\t\tmax = [ coincidences_on_a_row, max ].max\n\n\t\t\t# ...before print it. Please note that we compute equalities\n\t\t\t# but problem asks us for numbers-equals-in-a-row, so we need to sum 1\n\t\t\tputs max + 1\n\t\tend\n\tend", "def solve(directions)\n directions = parse(directions)\n steps = map(directions)\n\n count(steps)\nend", "def how_many_solutions?(a, b, c)\n test = b**2 - 4*a*c\n if test > 0\n 2\n elsif test == 0\n 1\n else\n 0\n end\nend", "def number_of_conflicts\n p (1.0-self.fitness) * $time_slots.size * $classes_array.size\n ((1.0-self.fitness) * $time_slots.size * $classes_array.size).round.to_i\n end", "def solve( n = 1_000 )\n (1..n).inject( 0 ) {|sum, i| sum + i.in_words.delete(' -').length}\n end", "def solve\n end", "def part1(grid)\n grid.conflicts.size\nend", "def problem_14(*input)\n if input[0] == nil then input.push(0) end\n if input[-1].is_a? Integer then input << {:problem => :count_clumps} end\n if input[-1][:problem] == :same_ends\n same_ends(*input[0..-2])\n else\n count_clumps(*input[0..-2])\n end\nend", "def jqll\n counter = 1\n matrix = Jqll1.new\n File.open(\"src/problem-107/network\").each do |i|\n line = i.strip.split(',')\n (counter..39).each do |i|\n matrix.push Jqll2.new(line[i].to_i, counter, i + 1) if line[i] != \"-\"\n end\n counter += 1\n end\n result = matrix.total\n matrix.minimize\n result -= matrix.total\nend", "def problem(a=100,b=100)\n (2..a).inject(0) {|s1,i| s1 += (2..b).inject(0) {|s2,j| @terms.add?(i**j) ? s2 += 1 : s2}}\n end", "def solve_two_vs_three_vs_five\n return if @arr[1].nil? || @arr[6].nil?\n\n #p \"1,6: #{@arr[1]},#{@arr[6]}\"\n\n @words.filter{|x| x.length == 5 && @hash[x].nil?}.each{|w|\n if @arr[1].chars.all?{|c| w.chars.include?(c)}\n solved(3, w)\n elsif w.chars.all?{|c2| @arr[6].chars.include?(c2)}\n solved(5, w)\n else\n solved(2, w)\n end\n }\n end", "def solution\n line = 0\n puts \"*********************************\"\n puts \"********* SOLUTION **************\"\n puts \"*********************************\"\n @rows.each do |i|\n puts \"[#{i[0]}][#{i[1]}][#{i[2]}] | [#{i[3]}][#{i[4]}][#{i[5]}] | [#{i[6]}][#{i[7]}][#{i[8]}]\"\n line = line+1\n puts \"---------------------------------\" if line%3==0 end\n end", "def hw_to_sets(hw,book) \n sets = []\n stream_starts_at_set = 1\n hw.each { |stream|\n stream_starts_at_set = stream_starts_at_set+stream[\"delay\"].to_i\n set_number = stream_starts_at_set\n stream[\"chunks\"].each { |chunk|\n if sets[set_number].nil? then sets[set_number]=[] end\n sets[set_number].push(chunk)\n set_number = set_number+1\n }\n }\n 1.upto(sets.length-1) { |set_number|\n if sets[set_number].nil? then sets[set_number]=[] end\n }\n\n read_problems_csv(book)\n\n 1.upto(sets.length-1) { |set_number|\n sets[set_number].each { |chunk|\n chunk.each { |fg|\n flags,probs = fg\n probs.each { |g|\n g.each { |p|\n k = [p[0],p[1]]\n if p[0]<0 then\n fatal_error(\"in hw_to_sets, chapter=#{p[0]} for a problem on hw #{set_number}\")\n end\n label = $num_to_label[k]\n if $problem_assigned_on_set[k].nil?\n $problem_assigned_on_set[k] = set_number\n else\n if p[2].nil? || p[2]=='' then\n fatal_error(\"problem #{p[0]}-#{p[1]}, #{label}, assigned on both hw #{$problem_assigned_on_set[k]} and hw #{set_number}, and no specific parts were given on the second hw\")\n end\n end\n }\n }\n }\n }\n }\n\n return sets\nend", "def solved(ans)\n\n end", "def solveProblem lst\n big = -1\n numbers = {}\n half = lst.length / 2\n lst.each do |i|\n if numbers.has_key?(i) then\n numbers[i] += 1\n else\n numbers[i] = 1\n end\n if numbers[i] > half then return i end\n end\n return big\nend", "def calculate\n candidates = []\n\n generalized_cause = NLU::Generalization.new(symbols: @symbols).generalize(@cause)\n\n #ap \"sentence: #{cause_sentence}\"\n #ap \"learned: #{@learned.inspect}\"\n\n # We go through everything that was learned before\n @learned.each do |function_name, criteria|\n criteria[:generalizations].each do |generalization|\n\n # We generate a pre-candidate for this generalization. It starts\n # with score zero because we don't know yet whether this criteria\n # fits the sentence or not.\n local_candidate = {\n fn: function_name,\n attrs: { },\n score: 0.0\n }\n\n #ap \"generalized_cause #{generalized_cause}\"\n\n # We then generalize the cause sentence and go through it.\n # We will match *each* learned generalization against the cause\n # generalization.\n generalized_cause.each_with_index do |cause_rule, cause_index|\n\n\n # Wildcard\n #\n # Matches these:\n #\n # > i want a [type:wildcard:some_name_for_this_wildcard]\n # > i want a ford\n #\n wildcard = \"[#{NLU::Generalization::RESERVED_TYPES[:wildcard]}]\"\n #ap \"wildcard: #{wildcard}\"\n wildcard_regex = Regexp.escape(wildcard)\n if generalization =~ /wildcard/i\n wildcard_generalization = generalization\n .gsub(/\\[(type:wildcard)(.+)\\]/i, '[\\1]')\n end\n #ap \"wildcard_generalization(#{wildcard_generalization}) =~ cause_rule(#{wildcard_regex})\"\n if wildcard_generalization.to_s =~ Regexp.new(wildcard_regex, Regexp::IGNORECASE)\n #ap \"true -> #{wildcard_generalization} =~ /#{Regexp.new(wildcard_regex, Regexp::IGNORECASE)}/i\"\n\n rule = wildcard_generalization.gsub(\"#{wildcard}\", \"(.+)\")\n #ap \"rule #{rule}\"\n #binding.pry\n if value = cause_sentence.join(\" \").match(Regexp.new(rule, Regexp::IGNORECASE))\n value = value[-1]\n prop = attr_name_from_type_param(generalization)\n\n local_candidate = local_candidate.merge({\n attrs: {\n prop => value\n },\n score: 0.75\n })\n end\n\n # If we find a learned generalization that matches the generalized\n # sentence, we will save it.\n elsif generalization == cause_rule\n cause_rule.split(\" \").each_with_index do |typed_string, index|\n\n # If the learned generalization has a type anywhere, we will\n # check what is the corresponding word in the cause sentence.\n #\n # For example, consider the following sentence:\n #\n # [type:subject] want a [type:make]\n #\n # and the sentence\n #\n # I want a ford\n #\n # Finding `[type:make]` at position 3 of the array, we will\n # get `ford` at the position 3 of the cause sentence. With\n # that we can come up with `{make: 'ford'}`.\n #\n if typed_string =~ /\\[type/i\n local_candidate[:score] += 1\n type = attr_name_from_type_param(typed_string)\n prop = type_properties(type)\n type_token_length = prop[:token_length]\n\n # In `i want a car`, this will get the `i`. If the type\n # says instead that it's formed by two symbols (e.g\n # `i want`), then it will take `i want`.\n #\n # The -1 in the brackets is because otherwise it would be\n # translated to the following if the type had 1 symbol\n #\n # cause_sentence[1..1+1]\n #\n # That would take 2 words (`[1..2]`). We want one word, so\n #\n # cause_sentence[1..1+1-1]\n #\n word_for_type = cause_sentence[index..index+(type_token_length-1)]\n #ap \"> type: #{type} - #{index} #{cause_sentence[index..index+type_token_length]}\"\n\n local_candidate[:attrs][type] = word_for_type.join(\" \")\n\n # When it's just the same sentence as one seen before, no\n # generalizations\n else\n local_candidate[:score] = 1\n end\n end\n\n end\n end\n\n if local_candidate[:score] > 0\n candidates << local_candidate\n end\n end\n end\n\n # TODO - normalization is taking out some elements that are good.\n #candidates = normalize_scores(candidates)\n candidates = pick_candidates(candidates)\n candidates = merge_attributes(candidates)\n\n candidates\n end", "def phase_one\r\n # start with empty elimination array\r\n council_elimination = []\r\n # loop 8 times (game mechanics)\r\n 8.times do\r\n # tribe which has lost the challenge\r\n loosing_tribe = @borneo.immunity_challenge\r\n # tribal council for the loosing tribe will eliminate one participants\r\n council_elimination << loosing_tribe.tribal_council\r\n end\r\n # return all eliminations (used for the test szenario)\r\n return council_elimination.length\r\nend", "def exec\n question = Question.find(self.question_id)\n tmp = Time.now.to_i\n\n\t\t# Compila a resposta\n compile_result = Judge::compile(self.lang,self.response,tmp)\n\n\t\t# Verifica se houve erro de compilacao\n if compile_result[0] != 0\n self.compile_errors = compile_result[1]\n self.correct = false\n else\n\n\t\t\t# Se compilou, executa os casos de teste.\n correct = Judge::test(lang,compile_result[1],question.test_cases,tmp)\n\n self.results = Hash.new\n self.correct = true\n\t\t\t# para cada caso de teste salva os dados retornados\n\t\t\t# os dados retornados estarao na variavel 'r'\n\t\t\t# cada caso de teste tem seus dados armazenados no hash 'results'\n correct.each do |id,r|\n\n self.results[id] = Hash.new\n self.results[id][:error] = false\n self.results[id][:diff_error] = false\n self.results[id][:time_error] = false\n self.results[id][:exec_error] = false\n self.results[id][:presentation_error] = false\n self.results[id][:content] = question.test_cases.find(id).content\n\n self.results[id][:title] = question.test_cases.find(id).title\n self.results[id][:show_input_output] = question.test_cases.find(id).show_input_output\n\n if question.test_cases.find(id).show_input_output\n self.results[id][:input] = r[1][0]\n self.results[id][:output_expected] = r[1][1]\n end\n\n self.results[id][:output] = r[1][2]\n self.results[id][:id] = id\n\n\t\t\t\t# cada erro possui um numero de identificacao\n if r[0] == 3\n self.correct = false\n self.results[id][:error] = true\n self.results[id][:diff_error] = true\n elsif r[0] == 2\n self.correct = false\n self.results[id][:error] = true\n self.results[id][:presentation_error] = true\n elsif r[0] == 143 || r[0] == 141\n self.correct = false\n self.results[id][:error] = true\n self.results[id][:time_error] = true\n elsif r[0] != 0\n self.correct = false\n self.results[id][:error] = true\n self.results[id][:exec_error] = true\n end\n\n\t\t\t\t# se o numero de tentativas for suficiente para mostrar dicas, salva a dica na resposta do caso de teste.\n if Answer.where(user_id: self.user_id, question_id: self.question_id, correct: false, compile_errors: nil).count >= question.test_cases.find(id).tip_limit-1 || self.correct\n self.results[id][:tip] = question.test_cases.find(id).tip\n end\n\n #self.results[id][:output2] = simple_format r[1][0]\n end\n end\n true\n end", "def find_solution_count(lines, look_ahead=3)\n init = Struct.new(:value, :length).new\n init.value = 0\n init.length = 1\n\n running_lengths = Array[init]\n\n for i in 0..lines.length - 1 do\n current = Struct.new(:value, :length).new\n current.value = lines[i]\n current.length = running_lengths.inject(0) { |sum, item|\n current.value <= item.value + look_ahead ?\n sum += item.length : sum\n }\n\n running_lengths.unshift current\n\n if running_lengths.length > look_ahead\n running_lengths.pop\n end\n end\n\n # running_lengths contains values for 180, 179, and 178, in that order.\n return running_lengths[0].length\nend", "def solve\n max = nil\n\n # Start with the longest possible and work down. \n 9.downto( 1 ) do |i|\n max = Array.new( i ) {|j| 1 + j}.permutation.to_a.map! {|j| j.join.to_i}.select {|j| j.prime? }.max\n break if max\n end\n \n max\n end", "def evaluate_problems(competition)\n\t\ttotal_value=0\n\t\tproblems=competition.problems\n\t\tproblems.each do |p|\n\t\t\ttotal_value += value_problem(p)\n\t\tend\n\t\thash_percents={}\n\t\t#balta6tina!\n\t\t#the reason for the next line is to make sure that the sum of the percents of the problems is always 100\n\t\tlast_problem_percent=100\n\t\tcount=1\n\t\tproblems.each do |p|\n\t\t\tif count < problems.count\n\t\t\t\tpercent=((value_problem(p).to_f / total_value)*100).round(0).to_i\n\t\t\t\thash_percents[\"percent_problem_#{p.id}\"]=percent\n\t\t\t\tlast_problem_percent -= percent\n\t\t\t\tcount += 1\n\t\t\telse\n\t\t\t\thash_percents[\"percent_problem_#{p.id}\"]=last_problem_percent\n\t\t\tend\n\t\tend\n\t\treturn hash_percents\n\tend", "def paras(text, q, aA, aB, aC, aD, pnum = 0)\n\tcommon_words = [\"the\", \"be\", \"of\", \"and\", \"a\", \"is\", \"to\", \"in\", \"he\", \"have\", \"it\", \"that\", \"for\", \"they\", \"I\", \"with\", \"as\", \"not\", \"on\", \"she\", \"at\", \"by\", \"this\", \"we\", \"you\", \"do\", \"but\", \"from\", \"or\", \"which\", \"one\", \"would\", \"all\", \"will\", \"there\", \"say\", \"who\", \"make\", \"when\", \"can\", \"more\", \"if\", \"no\", \"man\", \"out\", \"other\", \"so\", \"what\", \"time\", \"up\", \"go\", \"about\", \"than\", \"into\", \"could\", \"only\", \"these\", \"come\", \"these\", \"some\", \"then\", \"any\"] #, \"state\", \"only\", \"new\", \"year\", \"some\", \"take\", \"come\", \"these\", \"know\", \"see\", \"use\", \"get\", \"like\", \"then\", \"first\", \"any\", \"work\", \"now\", \"may\", \"such\", \"give\", \"over\", \"think\", \"most\", \"even\", \"find\", \"day\", \"also\", \"after\", \"way\", \"many\", \"must\", \"look\", \"before\", \"great\", \"back\", \"through\", \"long\", \"where\", \"much\", \"should\", \"well\", \"people\", \"down\", \"own\", \"just\", \"because\", \"good\", \"each\", \"those\", \"feel\", \"seem\", \"how\", \"high\", \"too\", \"place\", \"little\", \"world\", \"very\", \"still\", \"nation\", \"hand\", \"old\", \"life\", \"tell\", \"write\", \"become\", \"here\", \"show\", \"house\", \"both\"]\n\n\tnumberWords = [\"one\", \"two\", \"three\", \"four\", \"five\", \"six\", \"seven\", \"eight\", \"nine\", \"ten\", \"eleven\", \"twelve\", \"thirteen\", \"fourteen\", \"fifteen\", \"sixteen\", \"seventeen\", \"eighteen\", \"nineteen\", \"twenty\", \"thirty\", \"forty\", \"fifty\", \"sixty\", \"seventy\", \"eighty\", \"ninety\", \"hundred\", \"thousand\", \"million\", \"billion\", \"trillion\"] \n\tnumberWords = Regexp.union(numberWords)\n\n\taWords = []\n\taWords << aA << aB << aC << aD\t\n\tqWords = q.split(\" \")\n\tallWords = aWords + qWords\n \ttext = text.scan(/(\\<p\\>)(.*?)(\\<\\/p\\>)/m).map(&:join)[pnum]\n \twrittenNumbers = []\n\n \tputs \"allWords = \" + allWords.to_s\n\n\n\ttext.gsub!(/<\\/?[^>]*>/,\"\")\n\ttext.gsub!(/(&#160;)/,\"\")\n\ttext.gsub!(/(\\[\\d+\\])/,\"\")\n\twrittenNumbers = text.downcase.scan(/\\b#{numberWords}(?:(?:\\s+and\\s+|\\s+)#{numberWords})*\\b/i)\n\twrittenNumbers.concat text.scan(/\\b[\\d\\.*,*]+\\b/)\n\tputs \"writtenNumbers = \" + writtenNumbers.to_s\n\n\taWords.each do |i|\n\t\ti2 = i.gsub(/(\\?|\\.|\\,|\\!)/,\"\")\n\t\tif common_words.include?(i2) == false\n\t\t\ttext.gsub!(/\\b#{i2}\\b/i, orange(i2))\n\t\tend\n\tend\n\n\tqWords.each do |i|\n\t\ti2 = i.gsub(/(\\?|\\.|\\,|\\!)/,\"\")\n\t\tif common_words.include?(i2) == false\n\t\t\ttext.gsub!(/\\b#{i2}\\b/i, pink(i2))\n\t\tend\n\tend\t\t\n\n\twrittenNumbers.each do |wnum|\n\t\tif wnum.numberize != 0 \n\t\t\tputs \"wnum = \" + wnum.numberize.to_s\n\t\tend\n\t\tallWords.each do |qora|\n\t\t\tif qora.numberize != 0\n\t\t\t\tputs \"qora = \" + qora.numberize.to_s \n\t\t\tend \n\t\t\tif wnum.numberize < qora.numberize * 1.05 and wnum.numberize > qora.numberize * 0.95\n\t\t\t\ttext.gsub!(/\\b#{wnum.to_s}\\b/i, blue(wnum.to_s))\n\t\t\tend\n\t\tend\n\tend\n\treturn text\nend", "def solve_zero_vs_six_vs_nine\n return if @arr[1].nil? || @arr[4].nil?\n\n #p \"1,4: #{@arr[1]},#{@arr[4]}\"\n\n @words.filter{|x| x.length == 6 && @hash[x].nil?}.each{|w|\n if @arr[4].chars.all?{|c| w.chars.include?(c)}\n solved(9, w)\n elsif @arr[1].chars.all?{|c2| w.chars.include?(c2)}\n solved(0, w)\n else\n solved(6, w)\n end\n }\n end", "def solve\n n = 33\n while true\n begin\n n += 2\n end while n.prime?\n\n s, ds = 2, 6\n while s < n && !(n - s).prime?\n s += ds\n ds += 4\n end\n\n break if s >= n\n end\n \n n\n end", "def problem_76a\n num = 100\n solve = lambda do |a,off,max|\n n = 0\n while a[off] < max && (a.length-off) >= 2 \n a[off] += a.pop\n n += 1\n n += solve.call(a.dup,off+1,a[off]) if a.length - off > 1\n end\n n\n end\n puts 1 + solve.call([1] * num, 0,num-1)\nend", "def problem_14(*numbers) # cannot specify an optional parameter at the end of spat! ref to link below\n selection = numbers.last.is_a?(Hash) ? numbers.pop : Hash.new\n selection[:problem] == :same_ends ? same_ends(*numbers) : count_clumps(*numbers)\nend", "def solve_math_attempt\n\n # 0 jolt charging outlet\n outlet = JoltageAdapter.new(0)\n @adapters.push(outlet)\n\n # final jump to device\n dev = Device.new(@adapters)\n @adapters.push(dev)\n\n @adapters.sort_by! {|adapter| adapter.joltage}\n\n\n # we only care about the joltages\n available_joltages = @adapters.map { |adapter| adapter.joltage }\n\n count = 0\n\n available_joltages.each do |joltage|\n\n # p joltage\n\n can_link_to = available_joltages.select do |node|\n diff = node - joltage\n diff <= 3 && diff > 0\n end\n\n is_linked_to = available_joltages.select do |node|\n diff = joltage - node\n diff <= 3 && diff > 0\n end\n\n # count += can_link_to.size\n # count *= is_linked_to.size\n\n impact = (can_link_to.size) * (is_linked_to.size) - 1\n\n puts \"Adapter #{joltage} impact: #{impact}\"\n\n count += impact unless impact <= 0\n\n\n\n\n # puts 2**(can_link_to.size-1) unless (can_link_to.size - 1 <= 0)\n\n # puts \"Joltage #{joltage} can link to #{can_link_to}, size #{can_link_to.size}\"\n\n # puts \"Increasing current count of #{count} by #{can_link_to.size}\"\n # count *= 2**(can_link_to.size-1) unless can_link_to.size <= 0\n\n\n end\n puts \"COUNT: #{count}\"\n # puts count.class\n # p count\n\nend", "def process(problem)\n @problem = problem\n problem.constraints.each do |constraint|\n process_constraint(constraint)\n end\n problem.constraints = @constraints\n\n if allquantors_inside?(problem)\n @constraints = []\n problem = YarplFlattener.new.process(problem)\n end\n\n problem.constraints.each do |constraint|\n expand_count_all(constraint.expression,problem)\n end\n\n remove_invalid_constraints(problem)\n end", "def test(pattern)\n amount_solved = 0\n steps_to_solution = 0\n\n p = pattern.split('')\n\n genome.split('').each do |c|\n steps_to_solution += 1\n val = p[0]\n if val == c\n amount_solved += 1\n p.slice!(0)\n break if p.length == 0\n end\n end\n\n steps_to_solution - amount_solved\n end", "def solve\n 1.upto(100).inject(:*).to_s.split('').map{|x| x.to_i}.inject(:+)\nend", "def partial_review_self_check_count\n check_count = 0\n self.sections.each do |s|\n next if !s.dot_rev_check?\n s.subsections.each do |ss|\n next if !ss.dot_rev_check?\n ss.checks.each { |c| check_count += 1 if c.bare_board_design_check? && c.is_self_check? }\n end\n end\n check_count\n end", "def countNumIntran(res)\n\t\tiCount = 0\n\n\t\tif res == nil || res.length == 0\n\t\t\treturn iCount\n\t\tend\n\n\t\tres.each do |constituent|\n\t\t\t# verify Intransitive Verb Phrase\n\t\t\tif(constituent.pos == @vp)\n\t\t\t\t# (or no immediate children at all)\n\t\t\t\tif(constituent.children == nil || !constituent.has_children?)\n\t\t\t\t\tiCount = iCount + 1\n\t\t\t\telse\n\t\t\t\t\t# whose immediate (top-level) constituents include no NPs\n\t\t\t\t\t# containsNps = false\n\t\t\t\t\t# constituent.children.each do |child|\n\t\t\t\t\t# \tif(child.pos == @np)\n\t\t\t\t\t# \t\tcontainsNps = true\n\t\t\t\t\t# \t\tbreak\n\t\t\t\t\t# \tend\n\t\t\t\t\t# end\n\n\t\t\t\t\t# # no top-level constituents found\n\t\t\t\t\t# if(!containsNps)\n\t\t\t\t\t# \tiCount = iCount + 1\n\t\t\t\t\t# end\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tiCount = iCount + countNumIntran(constituent.children)\n\t\tend\n\t\treturn iCount\n\tend", "def part1()\n @seats = @input.map(&:dup)\n until rules_part1() == 0\n end\n count = 0\n @seats.each { |row| count += row.count('#') }\n count\nend", "def solution(s, p, q)\r\n # write your code in Ruby 2.2\r\n # A -1\r\n # C -2\r\n # G -3\r\n # T -4\r\n # s - string with n charactekrs\r\n #cagccta\r\n #0123345\r\n #p,q - not empty arrays\r\n #\r\n #p[0]=2 q[0]=4 gcc 322 => 2\r\n #p[1]=5 q[1]=5 t 4 => 4\r\n \r\n \r\n arr = Array.new(q.count)\r\n \r\n \r\n\r\n \r\n arr.each_with_index{|el, i|\r\n \r\n ss = s[p[i]..q[i]]\r\n \r\n if ss.index('A') \r\n n = 1\r\n elsif ss.index('C')\r\n n=2\r\n elsif ss.index('G')\r\n n=3\r\n else \r\n n=4\r\n end\r\n \r\n arr[i] = n\r\n \r\n }\r\n \r\n \r\n \r\n arr\r\n \r\nend", "def proof_of_work(last_proof)\n proof = 0\n while valid_proof(last_proof, proof) == false\n proof += 1\n end\n\n proof\n end", "def problem_14(*items, **options)\n problem = (options.is_a? Hash) ? options[:problem] : :count_clumps\n if problem == :same_ends\n same_ends *items\n else\n count_clumps *items\n end\nend", "def solution(number)\n counter = 3\n sol = 0\n while counter < number\n if (counter % 3 == 0) && (counter % 5 == 0)\n sol += counter\n elsif (counter % 3 == 0) || (counter % 5 == 0)\n sol += counter\n end\n counter += 1\n end\n p sol\nend", "def recursive_solution\n\n end", "def solve(s)\n answer = \"\"\n arr = s.split('')\n hash = Hash.new(0)\n arr.each_with_index do |el, idx|\n if el.to_i >= 1\n if arr[idx + 1] == \"(\"\n el.to_i.times do \n if arr[idx + 2].to_i >= 1\n if arr[idx + 3] == \"(\"\n arr[idx + 2].to_i.times do \n answer += (arr[(idx + 4)...arr.index(\")\")].join(''))\n end\n end\n end\n answer += (arr[(idx + 2)...arr.index(\")\")].join(''))\n end\n \n # hash[arr[idx + 1]] += 1\n end\n end\n \n end\n return answer\nend", "def help(game)\n\n game = game.game()\n\n #Algorithm for each columns\n (0...game.nCol).each do |i|\n\n cell = nil #reset\n nbTent = 0\n\n whiteZone = FindWhiteZone.find(game, 0, i)\n whiteZone.each do |zone| #Count the number of possible tent\n if (zone.size % 2 == 0)\n nbTent += (zone.size / 2)\n else\n nbTent += (zone.size / 2) + 1\n cell = zone.first #registered answer\n end\n end\n nbTent += Count.count(game, :tent, 0, i)\n\n if nbTent != game.colClues[i]\n break\n end\n\n if !(cell.nil?) #We find an answer\n return HelpAllPossibilitiesGiveItRow.new(cell, game.correction.cols[i], \"tent\")\n end\n\n end\n\n #Algorithm for each row\n (0...game.nRow).each do |i|\n\n cell = nil #reset\n nbTent = 0\n\n whiteZone = FindWhiteZone.find(game, 1, i)\n whiteZone.each do |zone| #Count the number of possible tents\n if (zone.size % 2 == 0)\n nbTent += (zone.size / 2)\n else\n nbTent += (zone.size / 2) + 1\n cell = zone.first #register answer\n end\n end\n nbTent += Count.count(game, :tent, 1, i)\n\n if nbTent == game.rowClues[i]\n\n if !(cell.nil?) #We find an answer\n return HelpAllPossibilitiesGiveItColumn.new(cell, game.correction.rows[i], \"tent\")\n end\n\n end\n end\n\n return HelpNotFound.new()\n\n end", "def solution(roman)\n dict = { \"I\" => 1, \"V\" => 5, \"X\" => 10, \"L\" => 50, \"C\" => 100, \"D\" => 500, \"M\" => 1000, \"N\" => 0 }\n return 0 if roman == \"N\"\n arr = roman.split(//)\n \n arr.each do |char| # check if all characters are valid\n if !dict.keys.include?(char)\n raise \"Invalid\"\n end \n end\n \n fre = Hash.new(0)\n arr.each do |char|\n fre[char] += 1\n end\n \n raise \"Invalid\" if fre[\"V\"], fre[\"L\"], fre[\"D\"] == 2 # these characters can't appear twice\n \n fre.each_value do |value| # a character can't repeat more than 3 times\n if value > 3\n raise \"Invalid\"\n end\n end\n \n # translation starts\n\n num = 0\n last = arr.length\n arr<<'N'\n i = 0\n while i < last\n if dict[arr[i]] < dict[arr[i+1]]\n num += (dict[arr[i+1]] - dict[arr[i]])\n i += 2\n else\n num += dict[arr[i]]\n i += 1\n end\n end \n return num \nend\n \n", "def total_score(play)\n sum = 0;\n play.decision_array.each_with_index{|v, i|\n sum += 1 if v == decision_array[i] && i != 0 # exclude an example\n }\n sum\n end", "def problem_8\nend", "def getUniqueProblems(subms, val)\n\t\tproblems = []\n\t\tproblemsADay = {}\n\t\tsubms.each do |subm|\n\t\t\ttemp = getProblem( subm )\n\t\t\tunless problems.any? { |problem| problem.id == temp.id }\n\t\t\t\tproblems << temp\n\t\t\t\tproblemsADay[ temp.daysAgo ] = problemsADay[ temp.daysAgo ].to_i + 1\n\t\t\t\tif val == 1\n\t\t\t\t\t@totalscoreA += temp.point.to_i\n\t\t\t\t\t@mostA = [problemsADay[ temp.daysAgo ], @mostA ].max\n\t\t\t\telse\n\t\t\t\t\t@totalscoreB += temp.point.to_i\n\t\t\t\t\t@mostB = [problemsADay[ temp.daysAgo ], @mostB ].max\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tproblems.each do |shit|\n\t\t\t\t\tif shit.id == temp.id \n\t\t\t\t\t\tshit.friendsSubmissions << temp.friendsSubmissions[0] \n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn problems\n\tend", "def generateproblems\n # First problem is unique\n # rand(0..1) picks a random problem from type 0 or 1\n # , 0) is the first problem\n types(rand(0..1), 0)\n (1..8).each do |i|\n types(rand(1..9), i)\n end\n types(10, 9)\n (10..18).each do |i|\n types(rand(1..9), i)\n end\n end", "def dpll\n\t\t#need to count degree, best_guess, assignments and such heuristic stuff somewhere... makes sense to do it here\n\t\t#should make a version without heuristics aswell\n##############################################3\n#\t\tputs \"the kb : \" + @kb.to_s\n\n\t\t@kb.each do |sente|\n##########################################################333\n#\t\t\tputs \" the sentences: \" + sente.to_s\n\n\t\t\tif(sente.size==1)\n\t\t\t\tindex=sente[0]\n\t\t\t\tif(index > 0)\n\t\t\t\t\t@id_array[index-1].pos_increment\n\t\t\t\t\t@id_array[index-1].puret=true\t\t\t\t\t\n\t\t\t\telse\n\t\t\t\t\tindex*=-1\n\t\t\t\t\t@id_array[index-1].neg_increment\n\t\t\t\t\t@id_array[index-1].puref = true\n\t\t\t\tend\t\n\t\t\telse\t\n\t\t\t\tsente.each do |atome|\n#############################################################\n#\t\t\t\t\tputs \"the individual atoms: \" + atome.to_s\n\t\t\t\t\tif(atome > 0)\n\t\t\t\t\t\tindex = atome-1\n\t\t\t\t\t\t@id_array[index].pos_increment\n\t\t\t\t\telse\n\t\t\t\t\t\tindex = -1*atome-1\n\t\t\t\t\t\t@id_array[index].neg_increment\n\t\t\t\t\tend\t\t\t\n\t\t\t\tend\n\t\t\tend\t\n\t\tend\n\t\t@id_array.each do |var|\n\t\t\tif(!var.assignment_intialize)\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\t\t\n\t\t#intialization stuff\n\t\t##########heuristic sort!\n\t\tvar_list = @id_array\n\t\tvar_list.sort!\n\t\t\n\t\tdepth=0\n\t\tassignment = Array.new\n\t\tsatisfiable = false\n\t\tstack = []\n\t\n\t\t#make parallel array assignment\n\t\tid_array.map { assignment << 0}\n\t\t\n\n\t\t#insert root\n\t\t(var_list[depth].assignments).map do |child|\n\t\t\tstack.push(Assign_Stack_Object.new(child,depth))\n\t\tend\n\t\t\n\t\t#start depth-first search\n\t\twhile(stack.size()>0)\n\t\n\t\t\ttemp = stack.pop\n\t\t\n\t\t\t#comparing depth to make sure assignment variables reassigned if popping up the tree\n\t\t\twhile(depth>temp.depth)\n\t\t\t\tassignment[depth] = 0\n\t\t\t\tdepth -=1\n\t\t\tend\t\n\t\t\t#add it to the assignment evaluation list (depth doubles as index through var_list)\n\t\t\tassignment[var_list[temp.depth].id - 1] = temp.value\n\t\t\n\t\t\t#Evaluate the assignment list\n\t\t\tif(satisfiable_assignment?(assignment)==1)\n##########################################################################333\n\t\t\t\tputs \"the kb is: \" + @kb.to_s \n\t\t\t\tputs \"the assignment that evaluates to true: \"\n\t\t\t\tputs assignment.to_s\n#############################################################################\n\t\t\t\t\n\t\t\t\treturn true\n\t\t\tend\n\t\n\t\t\t#add children\n\t\t\tdepth+=1\t\n\t\n\t\t\t#if not bottumed out, add more children based on values from the var\n\t\t\tif(depth<var_list.size())\n\t\t\t\t(var_list[depth].assignments).map do |child|\n\t\t\t\t\tstack.push(Assign_Stack_Object.new(child,depth))\n\t\t\t\tend\t \n\t\t\telse\n\t\t#reset to bottom value\n\t\t\t\tdepth =var_list.size-1\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend", "def step0(debug=false)\n\n # make sure we don't step beyond the solution\n return nil if done?\n\n t0 = Time.now\n @nb_iter += 1\n\n puts \"+++iteration #{@nb_iter}+++\" if debug\n puts \"nb problems = #{@pb_list.length}\" if debug\n\n best_pb = @pb_list.shift\n @rejected_grids.push(best_pb.grid)\n\n puts \"best problem:\" if debug\n puts best_pb.show_stats if debug\n\n if best_pb.min_depth == 1 then\n\n # we can create a problem with all the steps included at once\n new_steps = []\n best_pb.each_poss(1) do |poss|\n new_steps.push(Step.new(poss.row, poss.col, poss.first))\n end\n @nb_try += 1\n begin\n child = Sudoku.new(best_pb.grid, best_pb.steps, new_steps)\n #if the new problem is a dead-end, discard it\n if child.max_poss == 0 and not child.complete? then\n puts \"No solution possible for best problem, discard it\" if debug\n @rejected_grids.push(child.grid)\n @nb_discard += 1\n #avoid duplicates\n elsif @pb_list.include?(child)\n @nb_dup += 1\n elsif @rejected_grids.include?(child.grid)\n # this problem has been processed before\n @nb_discard += 1\n else\n @pb_list.push(child)\n end\n rescue RuntimeError\n # the combination of depth=1 solution caused a conflict\n puts \"Impossible solution for best problem, discard it\" if debug\n @nb_discard += 1\n end\n else\n\n # we need to create a new problem for each possibility\n best_pb.each_poss(best_pb.min_depth) do |poss|\n poss.each do |v|\n @nb_try += 1\n new_steps = [Step.new(poss.row, poss.col, v)]\n child = Sudoku.new(best_pb.grid, best_pb.steps, new_steps)\n #if the new problem is a dead-end, discard it\n if child.max_poss == 0 and not child.complete? then\n puts \"No solution possible for best problem, discard it\" if debug\n @rejected_grids.push(child.grid)\n @nb_discard += 1\n #avoid duplicates\n elsif @pb_list.include?(child)\n @nb_dup += 1\n elsif @rejected_grids.include?(child.grid)\n # this problem has been processed before\n @nb_discard += 1\n else\n @pb_list.push(child)\n end\n end\n end\n end\n\n # resort the list by max_poss / min_dof\n @pb_list.sort! do |x,y|\n res = x.max_poss <=> y.max_poss\n res = x.dof <=> y.dof if res == 0\n res\n end\n\n @duration += Time.now - t0\n\n #return the solution if we have one\n if @pb_list.empty? then\n return null\n else\n return @pb_list[0]\n end\n\n end", "def solve\n\n #Loop until the puzzle is solved or until one\n #loop didn't change any values\n #--------------------------------------------------\n puzzle_check\n \n #If the puzzle wasn't solved, try one more time\n if !@value_changed\n @value_changed = true\n puzzle_check\n end\n \n puts \"Solved: #{@solved}, Unable to solve:#{!@value_changed}\"\n end", "def solution(a)\n counter = Hash.new(0)\n a.each do |elem|\n counter[elem] += 1\n end\n\n (1..a.size).each do |number|\n return 0 if counter[number] != 1\n end\n\n 1\nend", "def update_total_matches\n self.correct_matches = (maker.code.select.with_index { |v, i| v == breaker.guess[i] }).length\n self.matches = 4 - (maker.code - breaker.guess).length - correct_matches\n end", "def solution4(input)\n end", "def solution(n, p, q)\n primes = []\n sieve(n).each_with_index { |v, i| \n primes << i if v\n }\n #puts primes\n \n semiprimes = [false] * (n + 1)\n primes.each { |x|\n primes.each { |y|\n sp = x * y\n break if sp > n\n semiprimes[sp] = true\n }\n }\n #puts semiprimes.inspect\n \n counts = [0]\n (1..n).each { |i|\n counts[i] = counts[i - 1]\n counts[i] += 1 if semiprimes[i]\n }\n #puts counts.inspect\n \n result = []\n p.each_with_index { |a, i| \n b = q[i]\n result << counts[b] - counts[a - 1]\n }\n result\nend", "def solution(k, a)\n count = 0\n current = 0\n a.each { |length| \n current += length\n if current >= k\n current = 0\n count += 1\n end\n }\n count\nend", "def problem3 n\n 2.step(n,1).each do |x|\n return x-1 if n == 1\n n /= x if x.prime? && (n % x == 0)\n end\nend", "def step(debug=false)\n\n # make sure we don't step beyond the solution\n return nil if done?\n\n t0 = Time.now\n @nb_iter += 1\n\n puts \"+++iteration #{@nb_iter}+++\" if debug\n puts \"nb problems = #{@pb_list.length}\" if debug\n\n best_pb = @pb_list.shift\n @rejected_grids.push(best_pb.grid)\n\n puts \"best problem:\" if debug\n puts best_pb.show_stats if debug\n\n if best_pb.min_depth == 1 then\n\n # we can create a problem with all the steps included at once\n new_steps = []\n best_pb.each_poss(1) do |poss|\n new_steps.push(Step.new(poss.row, poss.col, poss.first))\n end\n @nb_try += 1\n begin\n child = Sudoku.new(best_pb.grid, best_pb.steps, new_steps)\n #if the new problem is a dead-end, discard it\n if child.max_poss == 0 and not child.complete? then\n puts \"No solution possible for best problem, discard it\" if debug\n @rejected_grids.push(child.grid)\n @nb_discard += 1\n #avoid duplicates\n elsif @pb_list.include?(child)\n @nb_dup += 1\n elsif @rejected_grids.include?(child.grid)\n # this problem has been processed before\n @nb_discard += 1\n else\n @pb_list.push(child)\n end\n rescue RuntimeError\n # the combination of depth=1 solution caused a conflict\n puts \"Impossible solution for best problem, discard it\" if debug\n @nb_discard += 1\n end\n else\n\n # we will just process the problem that reduce the most the possibilities\n # on its row, col and box\n poss_list = best_pb.sorted_poss { |x, y| x.min_poss <=> y.min_poss }\n poss = poss_list[0]\n poss.each do |v|\n @nb_try += 1\n new_steps = [Step.new(poss.row, poss.col, v)]\n child = Sudoku.new(best_pb.grid, best_pb.steps, new_steps)\n #if the new problem is a dead-end, discard it\n if child.max_poss == 0 and not child.complete? then\n puts \"No solution possible for best problem, discard it\" if debug\n @rejected_grids.push(child.grid)\n @nb_discard += 1\n #avoid duplicates\n elsif @pb_list.include?(child)\n @nb_dup += 1\n elsif @rejected_grids.include?(child.grid)\n # this problem has been processed before\n @nb_discard += 1\n else\n @pb_list.push(child)\n end\n end\n end\n\n # resort the list by max_poss / min_dof\n @pb_list.sort! do |x,y|\n res = x.max_poss <=> y.max_poss\n res = x.dof <=> y.dof if res == 0\n res\n end\n\n @duration += Time.now - t0\n\n #return the solution if we have one\n if @pb_list.empty? then\n return nil\n else\n return @pb_list[0]\n end\n\n end", "def solve(notes)\n ############################################\n # Preprocessing\n notes = uniq(notes).sort.select{|n| !n.is_rest?}\n return [[]] if notes.length == 0\n raise ArgumentError, \"There are more unique notes than strings!\" if notes.length > @guitar.nstrings\n # Separate the notes to be solved into two categories: open notes vs non-open notes\n open_notes = notes.select{|note| @open_notes.key?(note.val)}\n non_open_notes = notes.select{|note| !@open_notes.key?(note.val)}.sort\n\n # If there are zero non-open notes, then all the notes can be played with no fingers.\n return [open_notes.map{|note| [note.name, @open_notes[note.val].first, 0]}] if non_open_notes.length == 0\n\n # Note we can arbitrarily choose any note as our point of reference for spatial locality for a given string.\n # However, notes that can utilize open strings may reduce cost but negatively affect the premise of spatial locality of note-string assignment.\n # Therefore, use lowest note that cannot be an open string note to preserve spatial locality.\n # With this, there is no need to choose between an open string or non-open string for a potential open string note.\n base_note = non_open_notes.first\n base_note_task = notes.each_with_index.select{|n,i| n == base_note}.first[1]\n note_offsets = notes.map{|note| note.num_steps_from(base_note)}\n\n # Initialize basic cost matrix\n cost_matrix = init_cost_matrix(notes)\n\n if !AssignmentSolver::solvable?(cost_matrix)\n warn [notes.join(\",\"), \"is unsolvable\"].join(\" \")\n return []\n end\n \n ############################################\n # String-Note Optimal Assignment\n # Use as many strings needed from highest (right) to lowest (left)\n solutions = Set.new\n (0..@guitar.nstrings-notes.length).to_a.reverse.each {|from|\n used_strings = @sorted_tuning[from...@guitar.nstrings]\n string_offsets = @offsets_grid[from][from...@guitar.nstrings]\n # Grab the submatrix of partially filled cost_matrix\n base = (from...@guitar.nstrings).map{|r|\n cost_matrix[r]\n }\n \n # Fill in the nil elements of the submatrix with relative offsets\n layer = string_offsets.map{|s_offset| note_offsets.map{|n_offset| (n_offset - s_offset)}}\n layer_abs = layer.map{|row| row.map{|e| e.abs}}\n\n # Relative positions\n relative_pos = overlay(base, layer)\n # Euclidean distance conversion\n costs = overlay(base, layer_abs)\n costs = Matrix.new(costs, used_strings, notes)\n \n # Compute best assignment solution\n solver = HungarianSolver.new(costs)\n solution = solver.run()\n next if solution.length == 0\n\n # Find the offset on the string being used as a point of reference for the base_note\n base_str, note_idx = solution.select{|w,t| t == base_note_task}.first\n base_note_offset = base_note.num_steps_from(used_strings[base_str])\n\n # Adjust relative offsets to center around the designated base note position.\n adjustment = layer[base_str][note_idx] * -1\n layer.each{|row| row.map!{|e| e += adjustment}}\n\n solution = solution.select{|w,t| layer[w][t]}.map{|w,t|\n relative_offset = layer[w][t]\n # Check if this is an open string note\n offset_from_capo = if base[w][t] == 0\n # Open note string since base element is 0\n 0\n else\n # Compute offset from capo for this string\n base_note_offset + relative_offset\n end\n [used_strings[w].name, from+w, offset_from_capo]\n }\n solutions << solution\n }\n\n return solutions.to_a\n end", "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 process(problem)\n @id = 0\n problem.constraints.each do |c|\n puts print_expression(c.expression)\n puts \"\\n\\n\"\n end\n problem\n end", "def steps\n find_solution\n end", "def solution(n, p, q)\n primes = primes(n)\n # puts \"primes:#{primes}\"\n semi_primes_count = Array.new n+1, 0\n primes.each do |p1|\n primes.each do |p2|\n break if p1 * p2 > n\n semi_primes_count[p1 * p2] = 1\n end\n end\n\n 1.upto(n) do |i|\n semi_primes_count[i] += semi_primes_count[i - 1]\n end\n\n queries = [p,q].transpose\n\n res = queries.map do |query|\n semi_primes_count[query.last] - semi_primes_count[query.first - 1]\n end\n\n # puts \"res:#{res}\"\n\n res\n end", "def solve!\n end", "def build_subsolutions\n @success_probability = Array.new(@size)\n @success_probability[@size-1] = 1.0/@size\n (@size-1).downto(1).each { |k|\n @success_probability[k-1] = 1.0/@size + @success_probability[k]*(k-1)/k\n }\n end", "def getStepCount(input1,input2,input3,input4)\n\tways = possible_moves(input1,input2,input3,input4)\n\tfound = true\n\tcount = 1\n\n\twhile found do\n\t temp = []\n\t\tways.each do |way|\n\t\t\tmoves = possible_moves(way.first,way.last,input3,input4)\n\t\t\tif moves.include?([input3,input4])\n\t\t\t\tfound = false\n\t\t\tend\n\t\t\tmoves.each {|arr| temp.push(arr) }\n\t\tend\n\t\tcount += 1\n\t\tways = temp\n\tend\n\tcount\nend", "def red_correct\n if @guess.grep(\"r\").size == 0 && @answer.grep(\"r\").size == 0\n total = 0\n elsif @guess.grep(\"r\").size == 1 && @answer.grep(\"r\").size == 0\n total = 0\n elsif @guess.grep(\"r\").size == 2 && @answer.grep(\"r\").size == 0\n total = 0\n elsif @guess.grep(\"r\").size == 3 && @answer.grep(\"r\").size == 0\n total = 0\n elsif @guess.grep(\"r\").size == 4 && @answer.grep(\"r\").size == 0\n total = 0\n elsif @guess.grep(\"r\").size == 0 && @answer.grep(\"r\").size == 1\n total = 0\n elsif @guess.grep(\"r\").size == 1 && @answer.grep(\"r\").size == 1\n total = 1\n elsif @guess.grep(\"r\").size == 2 && @answer.grep(\"r\").size == 1\n total = 1\n elsif @guess.grep(\"r\").size == 3 && @answer.grep(\"r\").size == 1\n total = 1\n elsif @guess.grep(\"r\").size == 4 && @answer.grep(\"r\").size == 1\n total = 1\n elsif @guess.grep(\"r\").size == 0 && @answer.grep(\"r\").size == 2\n total = 0\n elsif @guess.grep(\"r\").size == 1 && @answer.grep(\"r\").size == 2\n total = 1\n elsif @guess.grep(\"r\").size == 2 && @answer.grep(\"r\").size == 2\n total = 2\n elsif @guess.grep(\"r\").size == 3 && @answer.grep(\"r\").size == 2\n total = 2\n elsif @guess.grep(\"r\").size == 4 && @answer.grep(\"r\").size == 2\n total = 2\n elsif @guess.grep(\"r\").size == 0 && @answer.grep(\"r\").size == 3\n total = 0\n elsif @guess.grep(\"r\").size == 1 && @answer.grep(\"r\").size == 3\n total = 1\n elsif @guess.grep(\"r\").size == 2 && @answer.grep(\"r\").size == 3\n total = 2\n elsif @guess.grep(\"r\").size == 3 && @answer.grep(\"r\").size == 3\n total = 3\n elsif @guess.grep(\"r\").size == 4 && @answer.grep(\"r\").size == 3\n total = 3\n elsif @guess.grep(\"r\").size == 0 && @answer.grep(\"r\").size == 4\n total = 0\n elsif @guess.grep(\"r\").size == 1 && @answer.grep(\"r\").size == 4\n total = 1\n elsif @guess.grep(\"r\").size == 2 && @answer.grep(\"r\").size == 4\n total = 2\n elsif @guess.grep(\"r\").size == 3 && @answer.grep(\"r\").size == 4\n total = 3\n else @guess.grep(\"r\").size == 4 && @answer.grep(\"r\").size == 4\n total = 4\n end\n end", "def reduce_solved\n before = 9*9*9\n after = entropy\n while before > after\n before = after\n reduce_line\n reduce_col\n reduce_grid\n after = entropy\n end\n self\n end", "def solution(s, p, q)\n result = []\n positions = { \"A\" => 0, \"C\" => 1, \"G\" => 2, \"T\" => 3 }\n\n prefix_occurences = build_prefix_occurences(s, positions)\n\n (0..p.length-1).each do |index|\n from = p[index]\n to = q[index]\n\n subset_occurences = calculate_subset_occurences(prefix_occurences[from], prefix_occurences[to + 1])\n\n result << 1 && next if subset_occurences[0] != 0\n result << 2 && next if subset_occurences[1] != 0\n result << 3 && next if subset_occurences[2] != 0\n result << 4 && next if subset_occurences[3] != 0\n end\n\n result\nend", "def choose_problems(competition)\n\t\tusers=competition.users\n\t\tcase competition.target\n\t\twhen 1\n\t\t\tproblems=Problem.all.where(target: 1)\n\t\twhen 2\n\t\t\tproblems=Problem.all.where(target: 2)\n\t\twhen 3\n\t\t\tproblems=Problem.all.where(target: 3)\n\t\telse\n\t\t\tproblems=Problem.all\n\t\tend\t\n\t\tchecked_problems=problems.where(checked: true) #<-- add checked\n\t\tunseen_problems=checked_problems\n\t\tusers.each do |u|\n\t\t\tunseen_problems=unseen_problems.select{ |p| !p.viewers.include?(u)}\n\t\tend \n\t\tproblems_length=0\n\t\tproblem=nil\n\t\twhile problems_length < competition.length do\n\t\t\tmax_length=competition.length-problems_length\n\t\t\tproblem=nil\n\t\t\tproblem=unseen_problems.select{ |p| p.length <= max_length && !competition.problems.include?(p)}.sample #balta6tina\n\t\t\tif problem.present?\n\t\t\t\tproblems_length += problem.length\n\t\t\t\tcompetition.competition_problems.create!(problem_id: problem.id)\n\t\t\telse\n\t\t\t\tproblem=checked_problems.select{ |p| p.length <= max_length && !competition.problems.include?(p)}.sample\n\t\t\t\tproblems_length += problem.length\n\t\t\t\tcompetition.competition_problems.create!(problem_id: problem.id)\n\t\t\tend\n\t\tend\t\n end", "def problem_14\nend", "def problem_108(size = 1001)\n func = lambda do |a|\n if a.length == 1\n a[0]+1\n else\n m = a[0]\n (2*m+1) * func.call(a[1,a.length]) -m\n end\n end\n\n primes = Primes.upto(200)\n prime_number = lambda do |a|\n r = 1\n a.sort.reverse.each_with_index { |m,i| r *= primes[i] ** m }\n r\n end\n\n values = {}\n last = 0\n 1.upto(100).each do |nn|\n nn.groupings do |a|\n sols = func.call a\n ans = prime_number.call a\n# puts \"np=#{nn} sols=#{sols} ans=#{ans} => #{a.inspect}\"\n if values[sols]\n values[sols] = [values[sols],[ans,a]].min\n else\n values[sols] = [ans,a]\n end\n true\n end\n size.upto(size*5/4) do |num|\n if values[num]\n puts \"for np = #{nn} => #{num} => #{values[num].inspect}\"\n if last == values[num]\n puts \"factors = #{values[num][0].factors}\"\n return values[num][0] \n end\n last = values[num]\n break\n end\n end\n #values.sort.each do |k,v|\n # puts \"#{k} => #{v}\"\n #end\n end\n nil\nend", "def TN93(sequence_array = [])\n diff = []\n seq_hash = count(sequence_array)\n seq_hash.values.each do |v|\n comb = v * (v - 1) / 2\n comb.times {diff << 0}\n end\n\n seq_hash.keys.combination(2).to_a.each do |pair|\n s1 = pair[0]\n s2 = pair[1]\n diff_temp = compare_two_seq(s1,s2)\n comb = seq_hash[s1] * seq_hash[s2]\n comb.times {diff << diff_temp}\n end\n\n count_diff = count(diff)\n out_hash = Hash.new(0)\n Hash[count_diff.sort_by{|k,v|k}].each do |k,v|\n out_hash[k] = v\n end\n return out_hash\nend", "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 problem_14(*arr, **hash)\n if !hash.is_a? Hash\n arr << hash\n return count_clumps(arr)\n end\n\n if hash[:problem] == :same_ends\n n = arr.shift\n return same_ends(n, arr) \n else\n return count_clumps(arr)\n end\nend", "def solve\n # Generate uniques\n spaces = student_ids.product(bag_ids)\n\n visited_nodes = 0\n student_ids.each do |sid|\n bid = solver.choose(*bag_choices_for_student(sid))\n visited_nodes +=1\n partial_plan[sid] = bid\n solver.assert assigned_bags_are_unique(partial_plan)\n solver.assert assigned_bags_without_student_repeats(partial_plan)\n end\n\n puts \"Visited: #{visited_nodes} nodes\"\n partial_plan.to_a\n end", "def exercise1\n parse_data\n passports.count(&:valid?)\n end", "def solve(nums)\n count = 0\n nums.each do |num|\n if num.to_s.length % 2 != 0\n count += 1\n end\n end\n return count\nend", "def solution(n, a)\n counters = Array.new(n, 0)\n max = 0\n a.each do |item|\n if item >= 1 && item <= n\n counters[item - 1] += 1\n max = counters[item - 1] if counters[item - 1] > max\n elsif item == n + 1\n counters = Array.new(n, max)\n end\n end\n\n counters\nend" ]
[ "0.63234204", "0.6315762", "0.61288184", "0.5832933", "0.58299303", "0.5805946", "0.57894576", "0.57882416", "0.5771115", "0.5752342", "0.5688124", "0.56875163", "0.56603605", "0.56595415", "0.56519115", "0.562449", "0.5593997", "0.55732644", "0.55663335", "0.55593926", "0.5541868", "0.5533851", "0.5526607", "0.5518836", "0.5510775", "0.550437", "0.5495469", "0.54774404", "0.54708326", "0.5444317", "0.5425197", "0.5417505", "0.5416971", "0.54147303", "0.54041564", "0.53949904", "0.5389825", "0.5385632", "0.53836364", "0.5381459", "0.5366114", "0.5362248", "0.53479785", "0.53242505", "0.5315531", "0.5309883", "0.530245", "0.5301884", "0.5292662", "0.5289327", "0.5282766", "0.52683765", "0.5248532", "0.5245991", "0.5243201", "0.5236017", "0.5229809", "0.5229557", "0.52260196", "0.5222122", "0.522074", "0.5218125", "0.5214887", "0.5206667", "0.5201116", "0.51987153", "0.51967347", "0.5188168", "0.51821053", "0.51735526", "0.5167518", "0.51656145", "0.5164534", "0.51633334", "0.515625", "0.5154433", "0.5145281", "0.5145259", "0.5140663", "0.5134847", "0.51345766", "0.51252335", "0.5116373", "0.5115823", "0.51140314", "0.5110234", "0.5109774", "0.5107446", "0.51014453", "0.5098418", "0.50948125", "0.509321", "0.50922656", "0.5091089", "0.5087473", "0.50853235", "0.5084069", "0.5083512", "0.5082886", "0.5074481", "0.5060666" ]
0.0
-1
Logs in the given user.
def log_in(user) session[:user_id] = user.id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_login(user)\n click_log_in\n fill_login_credentials(user)\n end", "def login_as(user)\n login(users(user).email, users(user).password)\n end", "def sign_in(user)\n login_as user\n end", "def login(user=:joerg)\r\n login_as(user)\r\n end", "def log_user_in(user)\n note \"Welcome, #{user.contact.con_name}\"\n\n user.log(\"Logged in\")\n user.user_last_logged_in = Time.now\n user.save\n\n sm = SessionManager.new($store)\n sm.fork_session(@session, @context)\n @session.user = user\n @session.news = DailyPlanet.top_news_for_user(user)\n if user.contact.mail.empty?\n @data.user = user\n collect_user_info(false, true)\n else\n @session.pop\n end\n end", "def user_log_in(user)\n if user && user.authenticate(params[:user][:password])\n session[:user_id] = user.id\n redirect \"/users/#{user.id}\"\n\n else\n flash[:message] = \"Account could not be authenticated. Please enter username and password.\"\n redirect '/login'\n end\n end", "def log_in(user)\n reset_session\n set_user_id_in_session(user.id)\n # Guard against session replay attacks\n session[:session_token] = user.session_token\n end", "def log_in(user)\n email = $credentials[user]['email']\n password = $credentials[user]['password']\n case user\n when 'User A'\n transporter.go_to_url(USER_A_HOST)\n set_field('identifier', email)\n click_btn('Next')\n set_field('password', password)\n click_btn('Next')\n when 'User B'\n transporter.go_to_url(USER_B_HOST)\n end\n end", "def login(user)\n session[:user_id] = user.id\n flash[:success] ||= \"Welcome, #{user.username}!\"\n redirect_to user_path(user)\n end", "def sign_in(user)\n login_as(user, scope: :user)\n visit root_path\n end", "def login(user)\n session[:user_id] = user.try(:id)\n @current_user = user\n end", "def login_user\n puts \"Please enter your name\"\n name = CLI.gets_with_quit\n\n if self.user_exists(name)\n user = self.find_user(name)\n if check_password(user)\n CLI.active_user = user\n # fall through to CLI.start\n else\n CLI.start\n end\n\n else\n puts \"Sorry, User not found!\"\n if CLI.yes_no(\"Sign Up\")\n self.signup_user(name)\n else\n CLI.start\n end\n end\n end", "def login_as(user)\n session[:user_id] = user.id\n end", "def log_in_user(user)\n session[:user_id] = user.id\n session[:admin_open] = false\n redirect_to admin_path(:page => 'index')\n end", "def login(user)\n session[:user_id] = user.id\n end", "def login user\n @request.session[:user_id] = user.id\n @controller.instance_variable_set('@current_user', user)\n end", "def login_as(user)\n unless user.is_a?(User)\n user = get_user(user)\n end\n clear_cookies\n GDS::SSO.test_user = user\n end", "def log_in(user)\n session[:user_id] = user.id\n end", "def login user, password\n @username = user\n @ctx.login user, password\n end", "def log_user_in(user)\n set_omniauth_user user\n visit '/'\n click_link 'Log In'\n end", "def login_user\n password = Faker::Internet.password\n with_versioning do\n @logged_in_user = create(:user, password: password, password_confirmation: password)\n end\n sign_in_with_credentials(@logged_in_user.email, password)\n end", "def login!(user)\n # Store both local ID and horizon_borrower_id\n # to try and prevent mismatches from cookies.\n session[:current_user_id] = user.id\n session[:current_user_horizon_id] = user.horizon_borrower_id\n\n # Blacklight requires this to migrate guest bookmarks over\n # to permanent bookmarks where needed. It's not documented\n # well exactly how this works with non-Devise auth, but appears\n # to be working.\n transfer_guest_user_actions_to_current_user\n end", "def login!(user, options = {})\n session[:session_token] = user.persistence_token\n session[:active_at] = Time.now\n @current_user = user\n end", "def log_in_as(user)\n session[:user_id] = user.id\n end", "def login_as(user)\n UserSession.create(users(user))\n end", "def login_user(user = User.create!(email: 'marcos@iugu.com.br', password: '123456'))\n \tlogin_as user, scope: :user\n user\n end", "def login\n\t\tif @current_user != nil\n\t\t\tredirect_to user_path(@current_user.id)\n\t\tend\n\tend", "def login_user(user = gen_user)\n session[:user_id] = user.id\n return user\n end", "def login(user)\n visit new_user_session_path\n fill_in 'user_email', with: user.email\n fill_in 'user_password', with: user.password\n click_button 'Log in'\n end", "def login_as(user)\n session[:user_id] = users(user).id\n end", "def login_user(user)\n session[:current_user_id] = user.id\n end", "def login_as(user)\n if String === user\n id = users(user).id\n elsif User === user\n id = user.id\n end\n\n @request.session[:user_id] = id || nil\n end", "def log_in(user)\n session[:user_id] = user.id\n\n @@pusher.trigger('presence-miniTwitter', 'user_logged_in', {\n \t\tmessage: \"#{current_user.name}\"\n \t})\n end", "def log_in_as(user)\n session[:user_id] = user.id\n\n end", "def login_as(user)\n @request.session[:user] = user ? users(user).id : nil\n end", "def login(user)\n visit \"/login\"\n within (\".form\") do\n fill_in :email, with: user.email\n fill_in :password, with: user.password\n click_button \"Login\"\n end\n end", "def login_as(user)\n visit new_user_session_path\n fill_in :user_email, with: user.email\n fill_in :user_password, with: 'password123'\n click_button 'Login'\n end", "def sign_in_user(user)\n wait_until {sign_in.visible?}\n sign_in.click\n enter_credentials(user)\n sign_in_button.click\n end", "def login_user(user)\n post sessions_path, params: { email: user.email, password: user.password }\n end", "def login_as(user)\n @request.session[:user_id] = user.id\n end", "def log_in_as(user)\n puts 'logging in!!'\n session[:name] = user.name\n end", "def login!(user, *args, **kwargs)\n login(user, *args, **kwargs)\n session = kwargs[:session] || self\n assert_flash_success(session: session)\n user = User.find_by(login: user) if user.is_a?(String)\n assert_equal(user.id, User.current_id, \"Wrong user ended up logged in!\")\n end", "def login(user)\n \tsession[:user_id] = user.id\n end", "def login(user)\n request.session[:uid] = user.id\n end", "def login_with(user)\n visit new_user_session_path\n fill_in \"user_email\", with: user.email\n fill_in \"user_password\", with: \"123456\"\n click_button \"Sign in\"\n end", "def login_user(user_name)\n user = Goldberg::User.find_by_name(user_name)\n @request.session[:goldberg] = {:user_id => (user ? user.id : nil)}\n Goldberg::AuthController.set_user(@request.session)\n @request.session[:last_time] = Time.now\n end", "def login!(user)\n user.reset_session_token!\n # curr_session_token == user.session_token\n # sets user.curr_session_token and persists to UserSessionsOwnership table\n user.set_curr_session_token\n @current_user = user # set current_user upon login\n # session[:session_token] = user.session_token\n session[:session_token] = user.curr_session_token\n end", "def login(username=nil, password=nil, asUser=nil)\n params = {:userName => username, :password => password}\n if asUser && (as_username = asUser[:login])\n asUser[:login] = as_username\n end\n params.merge!(:asUser => asUser) if asUser\n set_user(run(:login, params)[:userTicket])\n end", "def login(user=nil, password=nil)\n # If the user or password have already been set and no new informations\n # are given to the function, take these old informations.\n @user = user if @user.nil? \n @password = password if @password.nil?\n rep = call('User.login', {'login' => @user.to_s, 'password' => @password,\\\n 'remember' => 1})\n # Parse the cookie stored in @cookie.\n parse_cookie\n rep\n end", "def login( user )\n session[:user_id] = user ? user.id : nil\n end", "def login_as(user)\n Session.create(users(user))\n end", "def log_in(user_id)\n session[:user_id] = user_id\n end", "def log_in\n @user = User.new\n end", "def log_in(user)\n current_user = user\n session[:session_token] = user.reset_session_token!\n end", "def login user\n session[:user_id] = user.id\n end", "def login(user)\n session[:user_id] = user.id\n end", "def login_as_user(user)\n visit login_path\n fill_in('Email', :with => user.email)\n fill_in('Password', :with => user.password)\n click_on 'log_in_submit_form'\n end", "def login( user )\n\t\t@current_user = user\n\t\tsession[:user_id] = user.id\n\t\tuser.update_attributes :last_ip => request.ip\n\tend", "def login_user(user)\n # {#set_rack_session} comes from the 'rack_session_access' gem\n page.set_rack_session('cas' => {\n 'user' => user.email,\n 'extra_attributes' => {\n 'email' => user.email,\n 'first_name' => user.first_name,\n 'last_name' => user.last_name,\n 'ssoGuid' => user.guid\n }\n })\n end", "def login_user\n @user = FactoryBot.create(:user)\n login_as @user\n end", "def user_log_in(user)\n session[:user_id] = user.id\n end", "def login_with(user)\n visit new_user_sessions_path\n fill_in \"user_session_email\", with: 'test@test.com'\n fill_in \"user_session_password\", with: \"123456\"\n click_button \"Sign in\"\n end", "def login\n create(:user).tap{ |user| login_as(user) }\n end", "def log_in_as(user, options = {})\n password = options[:password] || 'password'\n if integration_test?\n post login_path, params: {\n session: { email: user.email, password: password }\n }\n else\n session[:user_id] = user.id\n end\n end", "def log_in_as(user)\n post '/login', params: { 'session' => { 'name' => user.username } }\n end", "def login\n if request.get?\n session[:user_id] = nil\n else\n # Try to get the user with the supplied username and password\n logged_in_user = User.login(params[:user][:name], params[:login][:password])\n\n # Create the session and redirect\n unless logged_in_user.blank?\n session[:user_id] = logged_in_user.id\n jumpto = session[:jumpto] || root_path\n session[:jumpto] = nil\n redirect_to(jumpto)\n else\n flash.now[:login_error] = 'Invalid username or password.'\n end\n end\n end", "def logging_in \n @user = User.find(current_user.id)\n sign_in @user\n\n redirect_to after_sign_in_path_for(@user)\n end", "def log_in_as(user)\n session[:regular_user_id] = user.id\n end", "def sign_in(user)\n\tvisit signin_path\n\tfill_in \"Name\", with: user.name\n\tfill_in \"Password\", with: user.password\n\tclick_button \"Sign in\"\n\n\t# filling in the form doesn’t work when not using Capybara\n\tcookies[:remember_token] = user.remember_token\nend", "def login(user)\n @request.session[:user] = user\n end", "def login_user(user = nil, test_context = {})\n user ||= @user\n @controller.send(:auto_login, user)\n @controller.send(:after_login!, user, [user.send(user.sorcery_config.username_attribute_names.first), 'secret'])\n end", "def login(user)\n visit login_path\n fill_in :email, with: user.email\n fill_in :password, with: user.password\n click_button \"Log in\"\n end", "def login\n if request.get?\n session[:user_id] = nil\n @user = User.new\n else\n @user = User.new(params[:user])\n logged_in_user = @user.try_to_login\n if logged_in_user\n session[:user_id] = logged_in_user.id\n redirect_to(:controller => \"admin\")\n else\n flash[:notice] = \"Sorry, Invalid user/password combination!\"\n end \n end\n end", "def login_user!(user)\n user.reset_session_token!\n session[:session_token] = user.session_token\n end", "def log_in_as(user, password: 'password', remember_me: '1')\n post login_path, params: { session: { username: user.username,\n password: password,\n remember_me: remember_me } }\n end", "def log_in_as(user)\n session[:user_id] = user.id\n end", "def log_in_as(user)\n session[:user_id] = user.id\n end", "def log_in_as(user)\n session[:user_id] = user.id\n end", "def log_in_as(user)\n session[:user_id] = user.id\n end", "def log_in_as(user)\n session[:user_id] = user.id\n end", "def login_as(user)\n @request.session[:user_id] = user ? users(user).id : nil\n @request.session[:online_at] = Time.now.utc\n end", "def login(user)\n sleep 0.3\n get_elem_and_click(:xpath, LOGIN_BUTTON)\n get_elem_and_fill(:xpath, \"//input[@type='email']\", user.email)\n get_elem_and_fill(:xpath, \"//input[@name='password']\", user.password)\n get_elem_and_click(:xpath, \"//button[@type='submit']\")\n end", "def sign_in(test_user = :user_1)\n visit new_user_session_path\n fill_in 'Email', with: users(test_user).email\n fill_in 'Password', with: 'password'\n click_on 'Log in'\n end", "def login\n @user = User.find_or_create_from_auth_hash(auth_hash)\n @user_name = @user.display_name\n\n session[:current_user_id] = @user.id\n\n render :login, :layout => false\n end", "def login\n username = params[:user][:username]\n found_user = User.find_by(username: username)\n if found_user\n session[:user_id] = found_user.id\n flash[:success] = \"Successfully logged in as existing user #{found_user.username}\"\n else\n @user = User.new(username: username)\n if @user.save\n session[:user_id] = @user.id\n flash[:success] = \"Successfully created new user #{@user.username} with ID #{@user.id}\"\n else\n flash.now[:error] = \"A problem occurred: Could not log in\"\n # render \"users/login_form\"\n render \"users/login_form\"\n return\n end\n end\n \n return redirect_to root_path\n end", "def login_user_by_id(user_id)\r\n session[:user_id] = user_id\r\n logger.debug(\"Setting session id to #{session[:user_id]}\")\r\n AuditLog.create(:user_id => user_id, :action => \"Logged in\")\r\n end", "def login\n\t\tuser = User.authenticate(params[:username],params[:password])\n\t\tif user\n\t\t\tsession[:current_user_id] = user.id\n\t\t\tflash[:notice] = \"logged in\"\n\t\t\tredirect_to '/home'\n\t\telse\n\t\t\tflash[:notice] = \"Wrong username/password\"\n\t\t\tredirect_to '/index'\n\t\tend\n\tend" ]
[ "0.79255563", "0.7896003", "0.7872409", "0.7774304", "0.7651823", "0.7573199", "0.7571553", "0.756544", "0.75425416", "0.7480216", "0.74682415", "0.74503946", "0.7436136", "0.74269396", "0.7387112", "0.73547155", "0.7344561", "0.73239136", "0.7320213", "0.73145443", "0.7305449", "0.7300077", "0.72789675", "0.72582793", "0.72344095", "0.72263384", "0.7206241", "0.71826625", "0.71786785", "0.7177072", "0.71608144", "0.715782", "0.7149708", "0.71334755", "0.7125186", "0.7108403", "0.71023077", "0.7096227", "0.7089713", "0.70859563", "0.7084609", "0.70824784", "0.7081465", "0.7044405", "0.7042551", "0.70406514", "0.7033244", "0.70307046", "0.7026771", "0.70261973", "0.70226103", "0.70215887", "0.7002814", "0.69997126", "0.6998918", "0.69952667", "0.69948155", "0.69898486", "0.69776946", "0.6974262", "0.6968997", "0.69509196", "0.69506216", "0.6950519", "0.6936906", "0.69308525", "0.6907067", "0.6898874", "0.6894726", "0.6894634", "0.68937004", "0.68849885", "0.68817425", "0.68794066", "0.68668103", "0.6862255", "0.6862255", "0.6862255", "0.6862255", "0.6862255", "0.6855862", "0.6855135", "0.6853106", "0.68514067", "0.6849795", "0.68418086", "0.6835891" ]
0.70581007
55
Returns the current loggedin user (if any).
def current_user if session[:user_id] @current_user ||= User.find_by(id: session[:user_id]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_user\n if session[:user_id]\n return User.find(session[:id])\n else\n return nil\n end\n end", "def current_user\n if session[:user_id]\n User.find(session[:user_id])\n else\n nil\n end\n end", "def current_user\n return unless session[:user_id]\n User.find(session[:user_id])\n end", "def get_current_user\n if session[:authenticated]\n return User.find_by_id(session[:user_id])\n end\n return nil\n end", "def getLoggedInUser\n if session[:user_id]\n return User.find(session[:user_id])\n else\n return nil\n end\n end", "def current_user\n if session[:user_id]\n User.find(session[:user_id])\n else\n end\n end", "def current_user\n User.get_user(session[:user_id]) if session[:user_id]\n end", "def current_user\n if session[:user_id]\n return @user ||= User.find(session[:user_id]['$oid'])\n else\n return nil\n end\n end", "def current_user\n\t\tif session[:user_id].present?\n\t\t\tUser.find(session[:user_id])\n\t\tend\n\tend", "def current_user\n if session[:user_id]\n user = User.find(session[:user_id])\n else\n nil\n end\n end", "def current_user\n if valid_session?\n User.find(session[:user_id])\n end\n end", "def get_current_user\n if @current_user\n return @current_user\n else\n @current_user = User.find_by(id: session[:user_id])\n end\n end", "def get_logged_in_user\n if logged_in?\n user = User.find(session[:current_user_id])\n if user\n return user\n else\n return nil\n end\n end\n \n #default return nil\n nil\n end", "def get_current_user\n @current_user ||= User.find(session[:user_id]) unless session[:user_id].blank?\n return @current_user\n end", "def current_user\n if session[:user_id]\n User.find_by(id: session[:user_id])\n end\n end", "def current_user\n User.find_by(uid: session[:user]) if logged_in?\n end", "def current_user(id = session[:user_id])\n User.get_one id\n end", "def current_user\n @current_user ||= User.find(session[:user_id]) if logged_in?\n end", "def current_user\n @current_user ||= User.find(session[:user_id]) if logged_in?\n end", "def current_user\n return @current_user if @current_user.present?\n\n if session[:uid]\n @current_user = User.from_session(session)\n end\n\n @current_user\n end", "def current_user\n if logged_in?\n return User.get(session['user'])\n end\n AnonymousUser.new\n end", "def get_current_user\n unless session[:user_id]\n @current_user = nil\n return\n end\n @current_user = User.first(:conditions => {:id => session[:user_id] })\n end", "def get_current_user\n unless session[:user_id].blank?\n @current_user = User.find(session[:user_id])\n else\n @current_user = nil\n end\n end", "def current_user\n\t\t\tUser.find(session[:user_id])\n\t\tend", "def current_user\n\t\t\tUser.find(session[:user_id])\n\t\tend", "def current_user\n @current_user if logged_in?\n end", "def current_user\n @current_user if logged_in?\n end", "def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend", "def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend", "def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend", "def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend", "def current_user\n if !session[:user_id] then nil else User.find(session[:user_id]) end\n end", "def current_user\n User.find(session[:user_id]) if session[:user_id]\n end", "def current_user\n User.find(session[:user_id]) if session[:user_id]\n end", "def get_current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[\"user_id\"])\n end\n end", "def current_user\n user_id = get_log_in_session\n if user_id\n get_user(user_id)\n else\n user = get_user(cookies.signed['user_id'])\n if user&.authenticated?(:remember, cookies[:remember_token])\n set_log_in_session user\n user\n end\n end\n end", "def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n #return current user if @current_user already exists.\n #if there's no current user, return the user with ID == session user ID, if there is one.\n end", "def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n return @current_user\n end", "def current_user\n if !@current_user.nil?\n @current_user\n elsif !session[:current_user_id].nil?\n begin\n @current_user = User.find(session[:current_user_id])\n rescue ActiveRecord::RecordNotFound\n @current_user = nil\n end\n end\n end", "def current_user\n if Rails.application.config.use_omniauth\n return nil unless session[:user_info]\n @current_user ||= User.find_user_from_omniauth(session[:user_info])\n else\n @current_user ||= User.where(username: request.env['aker.check'].user.username).first\n end\n end", "def current_user\n return unless session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end", "def current_user\n return unless session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end", "def current_user\n return unless session[:user_id]\n @current_user ||= User.first(:id => session[:user_id])\n end", "def current_user\n begin\n unless @current_user.nil?\n return @current_user\n else\n if session[:user_id]\n return @current_user = User.find(session[:user_id])\n else\n return nil\n end\n end\n rescue\n return nil\n end\nend", "def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n #return current user or set to this if there isnt a current user\n end", "def current_user\n # User.find would throw an error if we cannot find the user\n User.find_by({ id: session[:user_id] })\n end", "def current_user\n\n sql = \"SELECT * FROM users WHERE id = $1;\"\n \n results = run_sql(sql, [session[:user_id]]) \n return results.first\n end", "def current_user\n\tif session[:user_id].present?\n\t\tUser.find(session[:user_id])\t\n\tend\nend", "def current_user\n return @current_user ||= User.find(session[:user_id]) unless session[:user_id].nil?\n end", "def current_user\n if @current_user.nil?\n @current_user = User.find_by(id: session[:user_id])\n else\n @current_user\n end\n end", "def current_user\n get_from_options_or_controller(:current_user)\n end", "def current_user\n begin \n User.find(session[:user_id])\n rescue ActiveRecord::RecordNotFound\n nil\n end\n end", "def current_user\n if user_signed_in?\n Session.active_sessions.find_by(id: request.headers['sid'], utoken: request.headers['utoken']).user\n else\n nil\n end\n end", "def current_user\n if user_signed_in?\n Session.active_sessions.find_by(id: request.headers['sid'], utoken: request.headers['utoken']).user\n else\n nil\n end\n end", "def current_user\n User.find_by(id: session[:user_id])\n end", "def current_user\n User.find_by(id: session[:user_id])\n end", "def current_user\n return nil unless session[:user_id]\n User.get(session[:user_id])\nend", "def current_user\r\n\tif(session[:user_id])\r\n\t\t@u ||= User.first(id: session[:user_id])\r\n\t\treturn @u\r\n\telse\r\n\t\treturn nil\r\n\tend\r\nend", "def current_user\n \t# If the session contains the user_id with non-nil, we have ID of some user\n \t# Return the user object for ID\n \t\n \t# Using instance variable helps limit calls\n \t# \"Or equals\" means \n \t\t# if nil, set it -- if not, return it\n \tif session[:user_id]\n \t@current_user ||= User.find(session[:user_id])\n end\n end", "def current_user\n logged_in? ? User.find_by_id(session[:user_id]) : nil\n end", "def find_current_user\n if is_logged_in?\n @current_user = User.find(session[:user_id])\n else\n @current_user = nil\n end\n end", "def current_user\n if logged_in?\n session[:user] = nil\n return temporary_logged_in_user ? temporary_logged_in_user :\n set_temporary_logged_in_user(cached_user)\n else\n session[:user] ||= create_new_user # if there wasn't one\n session[:user] = create_new_user unless session[:user].respond_to?(:stale?)\n session[:user] = create_new_user if session[:user].stale?\n return session[:user]\n end\n end", "def current_user\n return unless session[:user_id]\n @current_user ||= User.find_by_id(session[:user_id])\n end", "def current_user\n if session[:user_id].present?\n @current_user = User.find_by(uid: session[:user_id])\n # session.clear if @current_user.nil?\n return @current_user\n end\n end", "def current_user\n if session[:user_id]\n return User.find(session[:user_id])\n end\nend", "def current_user\n\t\t\tUser.find_by_id(session[:user_id])\n\t\tend", "def current_user\n if session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end\n end", "def current_user\n if session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end\n end", "def return_current_user\n @current_user ||= User.find(session[:id_of_current_user]) if session[:id_of_current_user]\n end", "def current_user\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n end", "def current_user\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n end", "def logged_in_user\n if (!logged_in?)\n return User.logged_out_user\n end\n #return nil if !logged_in?\n return session[\"app_user\"]\n end", "def current_user\n core_id = Origen::Users::User.current_user_id\n user = app_users.find { |user| user.core_id == core_id }\n user || User.new(core_id)\n end", "def current_user\n @user ||= User.find_by_id(session[:user_id])if logged_in?\n end", "def current_user\n load_session\n @current_user\n end", "def find_current_user\n user_id = session[:user_id]\n if user_id\n user = Marty::User.active.find(user_id) rescue nil\n else\n user = try_to_autologin\n end\n\n user\n end", "def current_user\n return nil unless session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end", "def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n # return current user or set it to what is found in cookie, only if there is one to begin with\n end", "def current_user\n \t@current_user || User.find(session[:user_id]) if session[:user_id]\n end", "def current_user\n @current_user ||= begin\n if session[:user_id]\n user = User.where(id: session[:user_id])\n user[0] if user.any?\n end\n end\n # @current_user ||= User.find session[:user_id] if session[:user_id]\n end", "def current_user\n\n \tif session[:user_id].present?\n \t\tUser.find(session[:user_id])\n\n \tend\n\n end", "def current_user\n\tsession[:user_id] ? User.find(session[:user_id]) : nil\nend", "def current_user\n\tsession[:user_id] ? User.find(session[:user_id]) : nil\nend", "def current_user\n # retrieve from database on every request instead of\n # storing it as global variable when current_user=\n # is called to prevent user information becoming stale.\n @current_user ||= (session[:user_name] && User.find_by(user_name: session[:user_name])) || real_user\n end", "def current_user\n\t\tif !@current_user\n\t\t\t@current_user = User.find_by(id: session[:user_id])\n\t\tend\n\t\t@current_user\n\tend", "def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end", "def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end", "def current_user\n return unless session[:user_id]\n @current_user = User.find_by_id(session[:user_id])\n end", "def current_user\n @current_user ||= User.find(session[:user_id]) if user_signed_in?\n end", "def current_user\n\t\tUser.find_by(:id => session[:user_id])\n\tend", "def current_user\n User.find session[:user_id] if user_signed_in?\n end", "def authenticated_user\n if session[:user_id].nil?\n return nil\n else\n return User.find(session[:user_id])\n end\n end", "def current_user\n return @current_user if defined?(@current_user)\n @current_user = User.find_by_id(session[:user_id])\n end", "def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end", "def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end", "def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end", "def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end", "def current_user\n if session[:user_id]\n @current_user ||= User.find_by(id: session[:user_id])\n end\n end", "def current_user\n if session[:user_id]\n @current_user = User.find(session[:user_id])\n end\n end", "def current_user\n @user ||= User.find_by(id: session[:user_id]) if session[:user_id]\n end", "def current_user\n \n # Normally we would look in the session to see if there is a user_id \n # to figure out if the user is loggged in.\n # For demo purposes this app randomly picks if the user is logged in\n if rand(100) > 20 \n User.last\n else\n nil\n end\n end" ]
[ "0.85960984", "0.8593657", "0.855797", "0.8545853", "0.8534344", "0.8497545", "0.847914", "0.8460573", "0.8457271", "0.84556973", "0.84472865", "0.8442264", "0.8441092", "0.84366953", "0.8400402", "0.83765614", "0.8368829", "0.8337418", "0.8337418", "0.8314651", "0.8311652", "0.83023316", "0.8291481", "0.82835174", "0.82835174", "0.82822436", "0.82822436", "0.82777715", "0.82777715", "0.82777715", "0.82777715", "0.8276581", "0.8275023", "0.8275023", "0.8255083", "0.8249995", "0.82446975", "0.8239647", "0.8232271", "0.82151717", "0.82147837", "0.82147837", "0.82103586", "0.8191853", "0.8187335", "0.81870914", "0.818249", "0.8178561", "0.8178069", "0.8167405", "0.8166237", "0.8165827", "0.8164524", "0.8164524", "0.816404", "0.816404", "0.81622803", "0.8161969", "0.8160386", "0.8157338", "0.8153178", "0.81529313", "0.81492436", "0.8147794", "0.814727", "0.81466174", "0.8136481", "0.8136481", "0.8132164", "0.81201875", "0.81201875", "0.81199944", "0.8119824", "0.8116362", "0.8112842", "0.81102794", "0.81090635", "0.81087977", "0.81074595", "0.80979383", "0.8093762", "0.80920845", "0.80920845", "0.8090045", "0.8087256", "0.80838054", "0.80838054", "0.8081629", "0.80800456", "0.80800176", "0.80791426", "0.8078592", "0.8078462", "0.8078152", "0.8078152", "0.8078152", "0.8078152", "0.8078152", "0.8073231", "0.807296", "0.8071747" ]
0.0
-1
Returns true if the user is logged in, false otherwise.
def logged_in? !current_user.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_is_logged_in()\n user = get_user()\n if user != nil\n true\n else\n false\n end\n end", "def logged_in?\n user._logged_in?\n end", "def logged_in?\n if session[:username]\n if session[:logged_in?]\n return true\n end\n else\n return false\n end\n end", "def logged_in?\n if !session[:user_id].nil?\n return true\n else\n return false\n end\n end", "def user_is_logged_in?\n !!session[:user_id]\n end", "def logged_in?\n return false unless session[:user_id]\n\n User.find_by_id(session[:user_id]).present?\n end", "def logged_in?\n !!logged_user\n end", "def logged_in?\n (current_user ? login_access : false).is_a?(User)\n end", "def logged_in?\n if current_user\n true\n else\n false\n end\n end", "def logged_in?\n current_user != :false\n end", "def logged_in?\n current_user != :false\n end", "def logged_in?\n current_user.present?\n end", "def logged_in?\n return true if self.current_user\n return false\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\r\n current_user != :false\r\n end", "def loggedin?\n @session.nil? ? false : (return true)\n end", "def is_logged_in?\n\t\t!session[:user_id].nil?\n\tend", "def logged_in?\n\t\t\tcurrent_user.is_a? User\n\t\tend", "def logged_in?()\n if session[:user_id]\n return true\n else \n return false\n end\n end", "def logged_in?\n current_user != :false \n end", "def is_logged_in_user?\n session[:user_authenticated]\n end", "def logged_in?\n @logged_in == true\n end", "def logged_in?\n @logged_in == true\n end", "def logged_in?\n if current_user\n true\n else \n false\n end\n end", "def is_logged_in?\n !session[:user_id].nil?\n end", "def user_is_logged_in?\n !!session[:user_id]\n end", "def logged_in?\n\t\tif not current_user.present? then redirect_to \"/unauthorized\" and return false\n\t\tend\n\t\treturn true\n\tend", "def logged_in?\n return false unless @auth_header\n true\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n\t\t !!current_user\n end", "def logged_in?\r\n\t\t!current_user.nil?\r\n\tend", "def logged_in?\n\n if session[:current_user_id]\n return true\n end\n \n #Default return false\n false\n \n end", "def logged_in?\n\t\tcurrent_user.present?\n\tend", "def logged_in?\n !session[:user_id].nil?\n end", "def logged_in?\n !session[:user_id].nil?\n end", "def logged_in?\n !session[:user_id].nil?\n end", "def logged_in?\n !session[:user_id].nil?\n end", "def logged_in?\n !!logged_in_user \n end", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n current_user ? true : false;\n end", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n\t\t!current_user.nil?\n\tend", "def logged_in?\n @logged_in\n end", "def logged_in?\n @logged_in\n end", "def logged_in?\n @logged_in\n end", "def logged_in?\n @logged_in\n end", "def logged_in?\n current_user.present? # True neu user login\n end", "def logged_in?\n #boolean return\t\n \tcurrent_user != nil\n end", "def is_user_logged_in?\n\tlogged_in = false\n\t if logged_in\n then true\n else\n redirect_to root_path\n end\n end", "def logged_in?\n @logged_in ? true : false\n end", "def logged_in?\n current_user != nil ? true : false\n end", "def logged_in?\n return session['current_user']\n end", "def logged_in?\n !current_user.nil?\n end", "def logged_in?\n !current_user.nil?\n end", "def logged_in?\n\t\t!current_user.nil?\n \tend", "def is_logged_in?\n return true if current_user || current_admin\n end", "def logged_in?\n \t\t!current_user.nil?\n \tend", "def logged_in?\n\t\t#if currentuser.nil returns true then logedin is false\n\t\t!current_user.nil?\n\tend", "def logged_in?\n !current_user.blank?\n end", "def logged_in?\n !!session[:logged_in]\n end", "def logged_in?\n # !! turns this into a boolean, so we DON'T get nil\n !!session[:user_id]\n end", "def logged_in?\n !!session[:user_id]\n # !!@current_user\n end", "def logged_in?\n ## to query if the logged in, call the current_user with !! preceeded, this turns it to true or false\n # TRUE or FALSE\n !!current_user\n end", "def _is_login\n p session[:user]\n session[:user] ? true : false\n end", "def logged_in?\n if session[:username].blank? or\n session[:authenticated].blank? or\n !session[:authenticated]\n return false\n end\n\n return true\n end", "def user_logged_in?\n current_user.present?\n end", "def user_logged_in?\n current_user.present?\n end", "def logged_in?\n current_user_id.to_i > 0\n end", "def is_logged_in?\n session[:user_id].present?\n end", "def logged_in?\n current_user.is_a? User\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end", "def logged_in?\n !!current_user\n end" ]
[ "0.9082417", "0.8764097", "0.87552106", "0.8718715", "0.86894006", "0.86498255", "0.86469626", "0.86372185", "0.8631328", "0.86285406", "0.86285406", "0.8582609", "0.85669243", "0.85613596", "0.85613596", "0.8551865", "0.85491496", "0.85443276", "0.85409296", "0.8539988", "0.8517927", "0.8511279", "0.8508452", "0.8508452", "0.8507709", "0.8505226", "0.84988797", "0.8491304", "0.8484085", "0.8482917", "0.8482917", "0.8482917", "0.8482917", "0.8482917", "0.8482917", "0.8482917", "0.8482917", "0.8482917", "0.84715056", "0.8469552", "0.84658724", "0.8465275", "0.84569186", "0.84569186", "0.84569186", "0.84569186", "0.84564346", "0.8454783", "0.8454261", "0.8453559", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.84534836", "0.8442786", "0.8442786", "0.8442786", "0.8442786", "0.84288824", "0.84257317", "0.84221077", "0.8421079", "0.84119624", "0.8409261", "0.840512", "0.840512", "0.8403647", "0.8402856", "0.8402169", "0.83969295", "0.83946496", "0.8387275", "0.8384129", "0.83830756", "0.83823043", "0.83774966", "0.83763194", "0.8374361", "0.8374361", "0.83696514", "0.8369602", "0.836562", "0.8361304", "0.8361304", "0.8361304", "0.8361304" ]
0.0
-1
go through all the line of the column of the worksheet
def go_through_all_the_lines(worksheet_key) data = [] worksheet = get_worksheet(worksheet_key) # create an array called data in order to store all the emails worksheet.rows.each do |row| # for each of line of the row we add it into the "data array" data << row[1].gsub(/[[:space:]]/, '') end return data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each_column\n end", "def each_col\n cols.each\n end", "def increase_columns(column)\n @sheet_data.each do |r|\n r.size.upto(column) do\n r << nil\n end\n end\n end", "def each_row\n end", "def steps\n @columns * @rows\n end", "def each\n @reaktor_rows\n end", "def col\r\n @lines[@line_num].cursor\r\n end", "def each\n @rows.each do |row|\n row.each do |col|\n\tyield col\n end\n end\n end", "def each_column\n @chash.each_with_index { |c, i| \n next if c.hidden\n yield c,i if block_given?\n }\n end", "def each(&block)\n worksheet.rows.each { |row| block.call(row.values) }\n end", "def get_columns\n column_lines = []\n 0.upto(@@width - 1) do |column|\n column_line = \"\"\n 0.upto(@@height - 1) do |row|\n column_line << @board[row][column]\n end\n column_lines << column_line\n end\n column_lines\n end", "def getMaxRow ws,columnNo\r\n\trow = 1\r\n\twhile cell_value = ws.cells(row,columnNo).value\r\n\t\trow = row + 1\r\n\tend\r\n\trow = row - 1\r\nend", "def each(&block)\n cells.each(&block)\n end", "def each_column(cassandra, cf, key, opts={})\n start_column = opts[:start] || ''\n prev_column = nil\n while start_column != prev_column\n start_column = prev_column\n adjusted_opts = opts.merge(:start => start_column || opts[:start])\n chunk = cassandra.get(cf, key, adjusted_opts)\n chunk.each do |column, value|\n #raise \"hell\" if (column <=> start_column) < 0\n next if start_column == column\n yield column, value\n prev_column = column\n end\n end\n true\n end", "def get_col_cells col\n\t\treturn (col...9 ** 2).step(9).to_a\n\tend", "def each(&block)\n (0..@delegate.getRowSize-1).each { |row|\n (0..@delegate.getColSize-1).each { |col|\n yield(self[row,col])\n }\n }\n end", "def each\n @worksheet.rows.each { |row| yield row.values }\n end", "def each(&block)\n @cells.each(&block)\n end", "def rows\n @columns.each do |column|\n @rows << Array.new(@columns.size) do |i|\n \"#{column}#{i + 1}\"\n end\n end\n @rows\n end", "def each_row\n @sheet.rowIterator.each { |row| yield row }\n end", "def each(_skip = nil, &block)\n @sheet.rowIterator.each(&block)\n end", "def col; end", "def current_line_pos\n pos - col\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 each_cell\n\t\teach_row do |row|\n\t\t\trow.each do |cell|\n\t\t\t\tyield cell if cell\n\t\t\tend\n\t\tend\n\tend", "def each(&block)\n (@options[:columns] || @grid.html_columns).each do |column|\n block.call(get(column))\n end\n end", "def board_column_values(board, column_number)\n column_values = []\n\n BOARD_HEIGHT.times do |i|\n column_values << board.values[column_number - 1 + BOARD_WIDTH * i]\n end\n column_values\nend", "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_row\n @board.each do |row|\n yield row\n end\n end", "def columns(line)\n line[ox...(ox + width)] || ''\n end", "def readColumnsCrieteria ws,columnNumber,criterion,maxColumns\r\n returnVal = []\r\n maxColumns.times do |row|\r\n row = row + 2\r\n match = true\r\n criterion.each do |key,val|\r\n value = ws.cells(row,key).value\r\n unless criterion[key].match(value.to_s)\r\n match = false \r\n end\r\n end\r\n #if the given crieteria matches, push the value to the array\r\n if match\r\n value = ws.cells(row,columnNumber).value\r\n returnVal.push value \r\n end\r\n #check if the given criterion are matching\r\n end\r\n returnVal \r\nend", "def column(x)\n i = x - 1\n self.cells.where(x: i)\n end", "def display_col(col)\r\n\r\n print \"Column #{col}: \"\r\n @bingo_board[@cols.index(col)].each {|num| print \"#{num} \"}\r\n puts\r\n\r\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 endCol; @col + @width - 1; end", "def get_col(col)\n\tcol_array = []\n\t$boggle_board.length.times do |row|\n\t\tcol_array << $boggle_board[row][col]\n\t\trow+=1\n\tend\n\tcol_array\nend", "def column(j) # :yield: e\n if block_given?\n 0.upto(row_size - 1) do\n |i|\n yield @rows[i][j]\n end\n else\n rows = @rows\n r_size = rows.size\n cols = Array.new(r_size)\n for i in 0..r_size-1 do\n cols[i] = rows[i][j]\n end\n Vector.elements(cols, false)\n end\n end", "def print_cell(minesweeper_model, row)\n (0..minesweeper_model.number).step(1) do |col|\n if minesweeper_model.mines_board[row][col].status\n print minesweeper_model.mines_board[row][col].obtain_value\n else\n print ' '\n end\n print '|'\n end\n end", "def next_cell(row, col)\n col += 1\n if col > 8\n row += 1\n col = 0\n end\n\n if row > 8\n raise InvalidNextCellRequestException, \"End of puzzle reached\"\n elsif !fixed_value?(row, col)\n [row, col]\n else\n next_cell(row, col)\n end\n end", "def get_row_cells row\n\t\treturn (row * 9...row * 9 + 9).to_a\n\tend", "def column_of(range); end", "def read_rows\n line_no = 0\n\n @sheet.rows.each do |r|\n line_no += 1\n row = row_as_array(r)\n next if empty_row?(row)\n\n data = convert_row(row, line_no)\n yield data if block_given?\n end\n end", "def each\n for index in 1..self.columns do\n yield self[index-1]\n end\n end", "def get_column(col_title)\n id_gmail = ENV['GMAIL_ID']\n mdp_gmail = ENV['GMAIL_MDP']\n session = GoogleDrive::Session.from_config(\"config.json\")\n ws = session.spreadsheet_by_key(\"1N7--OE8i6xGaAO2AA8cxe9Ry1xm2GSdGULdlyJL7-iE\").worksheets[0]\n gmail = Gmail.connect!(id_gmail, mdp_gmail)\n i = 0\n column = Array.new\n while i < ws.num_rows do\n column.push(ws.list[i][col_title])\n i += 1\n end\n column\nend", "def column_next dir=0\n if dir == 0\n $stact += $grows\n $stact = 0 if $stact >= $viewport.size\n else\n $stact -= $grows\n $stact = 0 if $stact < 0\n end\nend", "def column_next dir=0\n if dir == 0\n $stact += $grows\n $stact = 0 if $stact >= $viewport.size\n else\n $stact -= $grows\n $stact = 0 if $stact < 0\n end\nend", "def column_next dir=0\n if dir == 0\n $stact += $grows\n $stact = 0 if $stact >= $viewport.size\n else\n $stact -= $grows\n $stact = 0 if $stact < 0\n end\nend", "def each(&block)\n return enum_for :each unless block\n\n %x{\n for (var i = 0, length = #@native.rows.length; i < length; i++) {\n #{block.call(self[`i`])};\n }\n }\n\n self\n end", "def get_row_elements(row)\n @cells[row]\n end", "def color_column(col, row_start, row_end, color)\n (row_start..row_end).each do |y|\n color_pixel(col, y, color)\n end\n end", "def row(y)\n i = y - 1\n self.cells.where(y: i)\n end", "def col_targets(column)\n row = 0\n until row == 8\n @targets << [row, column]\n row += 1\n end\n end", "def get_column_elements(column)\n @cells.each_with_object([]) do |row, queried_column|\n queried_column << row[column]\n end\n end", "def horizontal_line (board)\n board.each_index do |row_index|\n if (board[row_index].all? { |position| position == \"O\" })\n return true\n elsif (board[row_index].all? { |position| position == \"X\"})\n return true\n end\n end\n return false\n end", "def get_row_contents(row)\n @board.slice(row*9,9)\n end", "def get_col_contents(col)\n column_string = \"\"\n\n (0..8).each do |row|\n column_string << @board.slice(row * 9 + col,1)\n end\n\n column_string\n end", "def each_cell(row_xml)\n return [] unless row_xml\n row_xml.children.each do |cell_element|\n coordinate = ::Roo::Utils.extract_coordinate(cell_element[\"r\"])\n hyperlinks = hyperlinks(@relationships)[coordinate]\n\n yield cell_from_xml(cell_element, hyperlinks, coordinate)\n end\n end", "def discover_points # step 1\r\n x = 0\r\n y = 0\r\n @image_arr.each do |row|\r\n x = 0\r\n row.each do |cell|\r\n if cell == 1 # discovered the cell is 1\r\n @ordinal_arr.push([y,x]) # this is where i push the ordinals.\r\n puts \"#{y},#{x}\"\r\n end\r\n x = x + 1\r\n end\r\n y = y + 1\r\n puts \"\" \r\n end\r\n end", "def row; end", "def each_row(options = {}, &block)\n row_count = 0\n options[:offset] ||= 0\n @sheet.each_row_streaming do |row|\n break if options[:max_rows] && row_count == options[:max_rows] + options[:offset] + 1\n if block_given? && !(options[:offset] && row_count < options[:offset])\n block.call(cells_for_row_element(row, options))\n end\n row_count += 1\n end\n end", "def print_board(board)\n board.each do |row|\n row.each do |column|\n print column\n end\n print \"\\n\"\n end\nend", "def board_iterate # (&given_proc)\n @board.each_with_index do |row, i|\n row.each_with_index do |element, j|\n # given_proc.call(element)\n yield(element, i, j)\n end\n end\n end", "def col\n horizontals_push; alignments_reset ; widths_reset\n end", "def laat_bord_zien\nprint \"\\t\"\n@board.each_with_index do |piece, index|\ndisplay_piece_by_location(piece, index)\nend\nend", "def horizontal_check \n\t@board.each do |row|\n\t\treturn true if row.count('x') == 5\n\tend\n\treturn false\n end", "def col_elems(y)\n col = []\n @grid.each do |sub|\n yield sub[y] if block_given?\n col.push(sub[y]) unless block_given?\n end\n col unless block_given?\n end", "def move_to_column(x); puts \"\\e[#{x}F\" end", "def get_vacant_pos col\n vacant_position = nil\n\n @row.times do |idx|\n if @grid[idx][col-1] == \"O\"\n vacant_position = idx + 1\n else\n break\n end\n end\n\n vacant_position\n end", "def colrow() @records.get_data(GRT_COLROW); end", "def column(n)\n column = []\n each_row do |row|\n column << row[n]\n end\n return column\n end", "def board\n @board.each do |row|\n print row\n puts \"\"\n end\n end", "def get_col(board, col)\n column = []\n board.each_with_index { |obj,i| column.push(board[i][col])}\n return column\nend", "def loser_board\n @grid.each do |row|\n puts row.join(' ')\n end\n end", "def each\n @rows.each {|x| x.each {|e| yield(e)}}\n nil\n end", "def cell_columns\n cells = []\n # for each column\n 1.upto(3).each do |column|\n grid = []\n\n # for each row\n 1.upto(3).each do |row|\n grid << get_cell_value(row, column)\n end\n\n cells << grid\n end\n\n cells\n end", "def print_cave(cave)\n cave.each do |row|\n row.each do |cell|\n print cell\n end\n print \"\\n\"\n end\nend", "def columns; end", "def each(&block)\n rows.each(&block)\n end", "def column_at(x, y, y_is_line = false)\n x = @text.x if x < x-@text.x\n line = @newline_data.dig(row_at(y)) unless y_is_line\n line = @newline_data.dig(y) if y_is_line\n column= 0\n return unless line\n\n text = line[:text]\n buffer= \"\"\n local_x=0\n\n text.size.times do |i|\n local_x = @text.font.text_width(buffer)\n\n break if local_x >= x\n column+=1\n buffer+=text.chars[i]\n end\n\n return column\n end", "def color_column(col, row_start, row_end, color)\n (row_start..row_end).each do |y|\n color_pixel(col, y, color)\n end\n end", "def each\r\n assert_exists\r\n arr_rows = rows\r\n for i in 0..arr_rows.length - 1 do\r\n yield arr_rows[i]\r\n end\r\n end", "def each_column(&block)\n if block_given?\n @columns.each(&block)\n self\n else\n @columns\n end\n end", "def cells\n rows.flatten\n end", "def check_columns\n column_winner = nil\n\n # index in arrays will be representations of board column\n x_arr =[]\n o_arr =[]\n # arrays will be the size of the board default value for each column will be 0\n @board.size.times do\n x_arr << 0\n o_arr << 0\n end\n\n # updates amount in x or o array as a column based on marker = x or o\n @board.each do |row|\n row.each_with_index do |marker, index|\n if marker == 'x'\n x_arr[index] += 1\n # checks if winner to break out of loop\n if x_arr[index] == @board.size\n column_winner = 'x'\n break\n end\n elsif marker == 'o'\n o_arr[index] += 1\n # checks if winner to break out of loop\n if o_arr[index] == @board.size\n column_winner = 'o'\n break\n end\n end\n\n end\n end\n\n column_winner\n end", "def get_column(col_num)\n column = []\n @grid.each do |row|\n column << row[col_num]\n end\n column\n end", "def get_col(board, col)\n \n col_array = []\n board.each do |row|\n col_array << row[col]\n end\n col_array\nend", "def column; end", "def column; end", "def column; end", "def column; end", "def column; end", "def column; end", "def column; end", "def fill_cols(l)\n col_a = yield(@orig_1040)\n col_c = yield(@new_1040)\n line[\"#{l}A\"] = col_a\n line[\"#{l}B\"] = col_c - col_a unless col_c == col_a\n line[\"#{l}C\"] = col_c\n end", "def next_cell(grid)\n grid.each_with_index do |row, x|\n row.each_with_index do |cell, y|\n return x, y if cell.length > 1\n end\n end\n end", "def peek(row, col, direction)\n x, y = [row, col]\n x, y = peek_apply(x, y, direction)\n return 0 unless valid_boundary?(x, y)\n\n begin\n cell = matrix[x][y]\n return 1 if cell == '#'\n return 0 if cell == 'L'\n x, y = peek_apply(x, y, direction)\n end while valid_boundary?(x, y)\n\n 0\n end", "def each_line\n return enum_for(:each) unless block_given?\n offset, last_line_index = @from, lines.count - 1\n lines.each_with_index do |line, line_index|\n yield(line, page_for(index: offset), line_index == last_line_index)\n offset += line.length\n end\n end", "def get_col(board, col)\n column = []\n board.each { |row| column.push(row[col])}\n return column\nend", "def get_col(col)\ncol = $boggle_board.map{|board| board[col]}\nend", "def rows\n CellCollection.new(@data, @column)\n end" ]
[ "0.68509716", "0.68227506", "0.6151273", "0.60603017", "0.605372", "0.5941241", "0.59393305", "0.59317684", "0.59093803", "0.58688396", "0.58553386", "0.5827637", "0.5761838", "0.57608", "0.5758982", "0.5753964", "0.57388496", "0.5709712", "0.5680023", "0.56694955", "0.56580025", "0.56547356", "0.5651038", "0.56218755", "0.56188047", "0.5585606", "0.5581821", "0.5567353", "0.5561259", "0.55589044", "0.55398", "0.553825", "0.5531483", "0.5523327", "0.5514363", "0.5507329", "0.55069315", "0.549598", "0.5487144", "0.5474848", "0.54659134", "0.5455133", "0.54531723", "0.54446214", "0.54220295", "0.54220295", "0.54220295", "0.5406566", "0.5404329", "0.5369379", "0.53675807", "0.5358735", "0.53494555", "0.5343912", "0.53431404", "0.53381723", "0.53377557", "0.53189826", "0.53150684", "0.5309049", "0.52960104", "0.52949756", "0.52798617", "0.5278516", "0.52775943", "0.5276506", "0.5274522", "0.5267369", "0.52627116", "0.52618235", "0.5258761", "0.52584934", "0.52563787", "0.5249696", "0.5242574", "0.5237905", "0.52350277", "0.5234941", "0.5234206", "0.5228913", "0.5225599", "0.5223027", "0.5221661", "0.5220638", "0.520375", "0.5202119", "0.5199214", "0.5199214", "0.5199214", "0.5199214", "0.5199214", "0.5199214", "0.5199214", "0.5196299", "0.519555", "0.5183883", "0.51792014", "0.51780325", "0.517579", "0.5161009" ]
0.58484954
11
send email methode (and the key as variable)
def send_gmail_to_listing(worksheet_key) # first we connect to gmail with the $gmail variable (where our logs are stored) $gmail #we go through each email adresse # send we send (deliver) an email with subject + body go_through_all_the_lines(worksheet_key).each do |email| $gmail.deliver do to email subject "The Hacking Project" # write your subject here text_part do body "je suis élève à une formation de code gratuite, ouverte à tous, sans restriction géographique, ni restriction de niveau. La formation s'appelle The Hacking Project (http://thehackingproject.org/). Nous apprenons l'informatique via la méthode du peer-learning : nous faisons des projets concrets qui nous sont assignés tous les jours, sur lesquel nous planchons en petites équipes autonomes. Le projet du jour est d'envoyer des emails à nos élus locaux pour qu'ils nous aident à faire de The Hacking Project un nouveau format d'éducation gratuite. Nous vous contactons pour vous parler du projet, et vous dire que vous pouvez ouvrir une cellule à {townhall_name}, où vous pouvez former gratuitement 6 personnes (ou plus), qu'elles soient débutantes, ou confirmées. Le modèle d'éducation de The Hacking Project n'a pas de limite en terme de nombre de moussaillons (c'est comme cela que l'on appelle les élèves), donc nous serions ravis de travailler avec {townhall_name} ! Charles, co-fondateur de The Hacking Project pourra répondre à toutes vos questions : 06.95.46.60.80 " #write your message here content_type 'text/plain; charset=UTF-8' end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key_email\n @professor = params[:professor]\n @url = 'http://localhost:3000/sessions/new'\n mail(to: @professor.email, subject: 'Saudações querido(a) professor(a)!')\n end", "def konsalt_mail params\n build_params params\n send_email t('emails.konsalta_mail.subject')\n end", "def send_key(*args); end", "def e_email_for(key = 'email_order_paid')\n (e_settings[key]) || case key.to_s\n when 'email_order_received'\n '<h1>ORDER SUMMARY {number}</h1> Dear {name}, please review and retain the following order information for your records.<br>{order_table}'\n when 'email_order_confirmed'\n '<h1>ORDER CONFIRMED {number}</h1> Dear {name}, your order has been confirmed. Please retain the following order information for your records<br>{order_table}'\n when 'email_order_shipped'\n '<h1>SHIPMENT SUMMARY</h1> Dear {name}, your order {number} has been shipped. Shipped method: {shipping_name} <br>{order_table}<br>{tracking_url}'\n when 'email_order_cancelled'\n '<h1>ORDER {number} CANCELLED</h1> Dear {name}, your order has been cancelled. Please retain this cancellation information for your records. <br>{order_table}'\n when 'email_order_invoice'\n '<table style=\"width: 100%;\"><tr><td><h1>INVOICE #{invoice_number}</h1> <h4>Order #{number}</h4><div>{current_date}</div></td><td style=\"text-align: center;\"><img src=\"http://camaleon.tuzitio.com/media/132/logo2.png\"></td></tr></table> <table style=\"width: 100%;\"><tr><td><strong>Billing Address</strong><br>{billing_info}</td><td><strong>Shipping Address</strong><br>{shipping_info}</td></tr><tr><td colspan=\"2\">{order_table}</td></tr></table>'\n end\n end", "def send_invitation(invitation_hash)\n @email = invitation_hash[:email]\n @code = invitation_hash[:code]\n mail(:to => @email, :subject => \"Invite to #{Settings.application.name}\")\n end", "def mail; end", "def ab e,s,m\n @e = e\n @s = s\n @m = m \n @greeting = \"Hi\"\n mail to: \"kunalwaghray52@gmail.com\"\n end", "def send_email_through_data(gmail)\n gmail = gmail\n read_hash(gmail,read_json)\n end", "def order_send(order)\n @greeting = \"Hi\"\np 1111111111\np order\n @orde_email = order.email\n\n mail(:to => order.email, :subject => \"Your Order\")\n end", "def email_key\n \"zDMSATq0W3hmA5p3rKTgD\"\n end", "def send_an_email(message, subject, to)\n message_params = {}\n message_params[:from] = 'QuikSort Bot <***@quiksort.in>'\n message_params[:to] = to\n message_params[:subject] = subject\n message_params[:text] = message\n logger.info $MG_CLIENT.send_message 'quiksort.in', message_params\nend", "def set_email email, key\n opts = {:single_quoted => false}\n params = {\n :query => {\n \"ClientToken\" => self.token,\n \"EmailAddress\" => Type::String.safe_value(email, opts),\n \"PersonKey\" => Type::String.safe_value(key, opts)\n }\n }\n put 'set_email.php', params\n end", "def e_email_keys\n '{root_url} => site url, {date} => order date, {number} => order number, {name} => client first name, {full_name}, {order_table} => table of products of the order, {shipping_name} => shipping method name, {tracking_url} => the url of tracking, {shipping_info} => Shipping info, {billing_info} => Billing info, {invoice_number} => Sequential Invoice Number, {url} => Order Url'\n end", "def send_mash_game(game, email)\n @greeting = \"Hiya\"\n @email = email\n @game = game\n mail to: @email, subject: \"Your MASH Game\"\n end", "def sendmail_book(b)\n mail :to => \"wtakawo@gmail.com\"\n end", "def sendmail(object)\n email\n end", "def send_email(data = {})\n assign_properties(data)\n\n self\n end", "def bar(to,a,b)\n @a = a\n @b = b\n mail :to => to\n end", "def send_message\n Pony.mail({\n :from => params[:email], \n :to => 'info_the_lodge@gmail.com',\n :subject => params[:email] + \" has contacted you - Phone: \" + params[:phone], \n :body => params[:email] + params[:message],\n :via => :smtp,\n :via_options => {\n :address => 'smtp.gmail.com', \n :port => '587', \n :enable_starttls_auto => true,\n :user_name => 'info_the_lodge',\n :password => 'secret',\n :authentication => :plain,\n :domain => 'localhost.localdomain'\n }}) \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 tanji\n @greeting = \"Hi\"\n\n mail (:to => \"attack.chance.3g@gmail.com\",:subject => \"hello\")\n end", "def mail_send(mail, message)\n\tGmail.connect('metaldroope@gmail.com', 'superpassword123') do |gmail|\n\t\temail = gmail.compose do\n\t\t to mail['mail']\n\t\t subject \"Top DJ News\"\n\t\t body message\n\t\tend\n\t\temail.deliver!\n\tend\nend", "def order_shipped\n@greeting = \"Hi\"\nmail :to => \"to@example.org\"\nend", "def send_email(message)\n @message = message\n mail to: \"china@pozitive.biz, coddeys@gmail.com\", subject: \"Request from website\"\n end", "def send_email(name, message)\n @greeting = \"Hi\"\n @name = name \n @message = message\n \n mail to: \"ostadfree@gmail.com\"\n end", "def micorreo(parametros)\n @nombre = parametros[:nombre]\n @email = parametros[:email]\n @asunto = parametros[:asunto]\n @mensaje = parametros[:mensaje]\n\n mail to: \"contacto@hernandelaossa.com.co\", :subject => \"PQRS CES\" \n\n end", "def sendmail\n @greeting = \"Hi\"\n\n mail to: \"Saratani_Masaya@ogis-ri.co.jp\"\n end", "def send_request\n message_request = mail_params\n puts \"#############################################\"\n p message_request[:messages].values\n sender = message_request[:sender]\n messages = message_request[:messages]\n messages = messages.to_hash.map { |m| m[1] }\n\n mailing_service = GoogleApiServices::MailingService.new(google_auth_client)\n mailing_service.send(sender: sender, messages: messages)\n end", "def read_hash(gmail, my_hash)\n\n @my_hash = my_hash\n @gmail = gmail\n\n @my_hash.each do |key, value|\n unless value == \"\" && EmailAddress.valid?(value)\n content = body_content(key)\n send_email(@gmail, content, value)\n end\n end\nend", "def send_mail(email,subject,body)\n Pony.mail(:to => email,\n :from => t.email.adress,\n :subject => subject,\n :body => body,\n :content_type => 'text/html',\n :charset => 'utf-8',\n :via => :smtp, :smtp => {\n :host => 'smtp.kunigo.com.br',\n :port => '587',\n :user => 'kunigo@kunigo.com.br',\n :password => 'PASSWORD',\n :auth => :plain,\n :domain => \"localhost.localdomain\"\n })\n end", "def send_order(order)\n # simpan parameter order ke dalam instance variable\n @order = order \n\n # karena instance dari order terelasi dengan user\n # note : order belongs_to user, and user has_many orders\n # maka simpan variabel user melalui order\n @user = order.user\n\n # setelah itu kirim email ke user\n mail to: @user.email, subject: 'Delivery System - Your Purchanse Order' do |format|\n format.html\n end\n end", "def send_mail(changed_watched_paths, hash, paths_by_users)\n \n # send one email for email address\n paths_by_users.keys.each do |user_email|\n subject=nil\n body=String.new @body_prefix\n \n # merge in the changed paths this user is interested in\n paths_by_users[user_email].each do |watched_path|\n \n if changed_watched_paths[watched_path]\n \n body << \"\\n\" << changed_watched_paths[watched_path].join(\"\\n\")\n # take any to generate the branch\n if !subject\n \n subject= String.new @subject_prefix\n subject << extract_branch(changed_watched_paths[watched_path])\n subject << \" by user \"\n subject << hash[:author]\n\t @logger.debug(\"Subject is=\"<< subject)\n end\n end \n end\n \n body << \"\\n\\nuser: \" << hash[:author]\n body << \"revision: \" << hash[:rev]\n body << \"\\ndate: \" << hash[:date]\n body << \"comment: \" << hash[:log] \n \n yield(user_email, subject, body)\n \n end\n end", "def send_email(meeting)\n @meeting=meeting\n mail( :to => \"sohaibahmed368@gmail.com\",\n :subject => 'New request submitted' )\n end", "def get(key)\n append(Sender.new(:get, key))\n end", "def send_email(gmail, body, mail_address)\n\n body_content = body\n mail_address = mail_address\n gmail = gmail\n\n gmail.deliver do\n to mail_address\n\n subject \"[Presentation] - The Hacking Project - Formation d'informatique gratuite\"\n html_part do\n content_type 'text/html; charset=UTF-8'\n body body_content\n end\n puts \"mail sent to #{mail_address}\"\n #in order to stay below the 10 mail / sec limit\n sleep(1)\n\n end\nend", "def send_email(resource,metric_info,dimension_info,url,metric_type)\n @user = resource \n @info = metric_info\n @dimension_info = dimension_info\n @url = url\n @metric_type = metric_type\n mail(:to => resource.email, :subject => \"Databot Websites Data\",:from => \"noreply@databot.com\")\n end", "def send_one_email_to(name, mail)\n email = @gmail.compose do\n to mail\n subject \"Apprentissage entre pairs + gratuité + code = The Hacking Project\"\n html_part do\n content_type 'text/html; charset=UTF-8'\n body get_the_email_html(name) #TODO faire pour toutes les villes du tableau -> suppose de lire les colonnes du tableau dans une boucle (ajouter un délai)\n end\n end\nemail.deliver!\nend", "def big_vol_mail(option_data)\n @options_data = option_data\n [\"cshonline@gmail.com\",\"lastarsenal@163.com\",\"liuyg1025@163.com\"].each do |addr|\n mail(to: addr, subject: \"BigVolOptions\").deliver\n end\n end", "def send_recipe(recipe_id, current_user)\n @greeting = \"Hi\"\n @recipe = Recipe.find(recipe_id)\n @email = current_user.email \n mail to: \"88pawankumarjha@gmail.com\", \n from: @email, \n :subject => \"A new recipe : #{@recipe.name}\"\n end", "def email; end", "def email; end", "def email; end", "def email; end", "def mail_content(case_id, lender_id)\n @loan_case = LoanCase.find(case_id)\n @lender = Lender.find(lender_id)\n @key = \"+\"\n while @key.index(\"+\")\n @key = AES.encrypt(@lender.id.to_s, ENV[\"KEY\"])\n end\n @token = \"+\"\n while @token.index(\"+\")\n @token = AES.encrypt(@loan_case.id.to_s, ENV[\"KEY\"])\n end\n mail to: \"\\\"#{@lender.name}\\\" <#{@lender.email}>\", subject: \"[EZBANK-新房貸][#{@loan_case.address}]\"\n end", "def chore_notification_email(assignment)\n @user = assignment.user\n @chore = assignment.chore\n @due_date = assignment.due_date.to_formatted_s(:long_ordinal)\n @url = complete_chore_url(assignment)\n sendgrid_category \"Chore Notification\"\n # sendgrid_unique_args :key2 => \"newvalue2\", :key3 => \"value3\"\n mail :to => @user.email, :subject => \"#{@user.name}. You've got a chore!\"\n end", "def send_message(message)\n @message = message\n mail to: \"colinsmix@gmail.com\", from: @message['email'], subject: \"Message Received from Music Blog Gatherer\"\n end", "def message_email(user, sender, message, convoID)\n \t@user = user\n \t@message = message\n \t@sender = sender\n \t@url = 'http://www.projecthelp.co/inbox/' + convoID.to_s\n\n \tmail :to\t\t=> user.email,\n :subject\t=> \"New message from \" + @sender.first_name\n end", "def contact_me(params)\n @params = params\n @greeting = \"Hi\"\n #mail to: \"to@example.org\"\n mail(:from => @params.personal_email,:to =>@params.personal_email, :subject => \"- EJJE -Gracias Por tu ayuda\")\n end", "def send_email(data)\n @type = data[:type]\n @message = data[:message]\n @name = data[:name]\n @from = data[:email]\n \n mail(\n :from => @from, \n :reply_to => @from,\n :subject => \"#{@type} - contact form on project.shearn89.com\"\n )\n end", "def send_email( params )\n puts \"From: #{params[:from]}\"\n puts \"To: #{params[:to]}\"\n puts \"Email subject: #{params[:subject]}\"\n puts \"Email body: #{params[:body]}\" \n return true\n end", "def sendmail\n puts \"send mail \"\n puts @manifest.code \n\n @company = @manifest.company\n\n ActionCorreo.st_email(@manifest).deliver_now \n end", "def sofortkontakt\n @greeting = \"Hi\"\n\n mail :to => \"to@example.org\"\n end", "def email_players(recipient, params)\n \n subject = params[:email_subject]\n @text = params[:email_text]\n @game = Game.find(params[:game_id])\n @sender = User.find(params[:sender_id])\n \n mail :to => recipient, :subject => subject\n end", "def product_back_in_inventory\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def say_hi(medium)\n @medium = medium\n\n mail(to: '446146366@qq.com' , subject: \"视频#{@medium.subject}更新通知\")\n mail(to: 'mwang@jingqi100.com' , subject: \"视频#{@medium.subject}更新通知\")\n mail(to: 'hhuang@jingqi100.com' , subject: \"视频#{@medium.subject}更新通知\")\n mail(to: 'mwu@jingqi100.com' , subject: \"视频#{@medium.subject}更新通知\").deliver\n end", "def send_mail_now(sender_mail, sender_name, sender_phone, msg)\n @sender_mail = sender_mail\n @sender_name = sender_name\n @sender_phone = sender_phone\n @feedback_msg = msg\n\n mail :to => [\"sysadmin@venki-spb.ru\", \"pavel.polushkin@gmail.com\", \"a_10@bk.ru\"], :subject => \"VENKI-SPB.RU \" + sender_name\n end", "def mailer; end", "def new_game\n @greeting = \"Hi\"\n# @all_rsvps = Rsvp.where(\"event_id = ?\", event.id)\n #@all_rsvps.each do |rsvp|\n # @user = User.where(\"id = ?\", rsvp.user_id).first\n #mail(:to => @user.email, :from => \"sibnerian@gmail.com\", :subject => \"Event Change\")\n #end\n\n mail to: \"to@example.org\"\n end", "def confirm_booksbymail_email(user, bib, values)\n @to = \"bkbymail@pobox.upenn.edu\"\n @from = \"#{user.name} <#{user.data['email']}>\"\n @subject = \"Books by Mail Request\"\n\n @title = values['title']\n @bibid = values['bibid']\n @author = values['author']\n @publication = values['publication']\n @callno = values['call_no']\n @volume = values['volume']\n @comments = values[:comments]\n @patronname = user.name \n @patronemail = values['email']\n @pennid = user.data['penn_id']\n\n if Rails.env.development?\n @subject = \"TEST \" + @subject + \" (to: #{@to}, from: #{@from})\"\n @to = ENV['DEVELOPMENT_EMAIL']\n @from = ENV['DEVELOPMENT_EMAIL']\n end\n\n mail(to: @to,\n from: @from,\n subject: @subject,\n template_name: 'confirm_booksbymail')\n end", "def important_message\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def send_email\n mail = {\n :to => TO_ADDRESS,\n :from => from_email,\n :body => body,\n :subject => \"Comment on Docket 09-51 from #{@comment[:name]}\"\n }\n Pony.mail(mail)\n end", "def chngemail\n #@talk = Talk.find(params[:id])\n #@contact = Contact.find(@talk.contact_id)\n #@contact.email = params[:email]\n #if @contact.update \t\n \t#flash[:notice] = 'Contact email successfully updated.'\n #redirect_to :action => \"edit\", :id => params[:id]\n #else\n #redirect_to :action => \"edit\", :id => params[:id]\n # end\n \n #@talk.call_when_time = Time.now\n #@contact = Contact.find(params[:contact_id])\n #render :text => @contact.last_name, :layout => true \n #Contact.update (@talk.contact_id,\t { :email => params[:email] })\n @datum = params[:hovor]\n @datven = \"\"\n @datum.each_value {|value| @datven += \"value is #{value}\" }\n \n redirect_to :action => \"index\"\n #render :text => @datven, :layout => true \t\n #\tparams[:hovor][\"kdy(1i)\"] \n #redirect_to :action => \"edit\", :id => params[:id]\n end", "def send_edit_code email, edit_code\n \n @first_name = \"lol\"\n \n require 'mandrill' \n m = Mandrill::API.new\n message = {\n :subject=> \"Your Summit Edit Code\", \n :from_name=> \"Social Summit List\",\n :from_email=>\"info@summits.social-change.net\",\n :to=>[ \n { \n :email => email\n } \n ], \n :html=>render_to_string('emails/new_edit_code', :layout => false) \n } \n sending = m.messages.send message \n puts sending\n end", "def send_email_by_passing_jsonobject(sendto, json_object, filename)\n Pony.mail({\n :to => sendto,\n :from => 'Magic Team',\n :subject => 'Your web scrapper successfully finished',\n :body => 'Thanks for using web scrapper service offered by MAGiC',\n :attachments => {filename => \"json_object\"},\n :via => :smtp,\n :via_options => {\n :address => 'smtp.gmail.com',\n :port => '587',\n :enable_starttls_auto => true,\n :user_name => 'osu.magic.team@gmail.com',\n :password => 'OSUCSE3901',\n :authentication => :plain, # :plain, :login, :cram_md5, no auth by default\n :domain => \"localhost.localdomain\" # the HELO domain provided by the client to the server\n },\n })\n end", "def send_email\n g = GmailSender.new(USER_NAME, PASSWORD)\n\n g.send(:to => to,\n :subject => @subject,\n :content => full_content)\n end", "def send_email(final_location,user_email)\n\n#This variable is used to store the email headers\nmessage =<<EOF\nFrom: LUCNHINATOR! <FROM@gmail.com>\nTo: RECEIVER <TO@gmail.com>\nSubject: Your Lunch Location!\nThe following are information regarding your lunch location\nEOF\n\n\n #Using Block\n smtp = Net::SMTP.new('smtp.gmail.com', 587 ) #intialise the SMTP gmail protocol to be used\n smtp.enable_starttls #To start the TTL\n smtp.start('gmail.com', 'lunchinatorassignment@gmail.com', 'lunchinator2019', :login) do |smtp| #After logging in,it would start to create the email and send it\n smtp.send_message (message + \"\\n Location Name: \" + final_location.name + \"\\n Location Address: \" + final_location.address + \"\\n Cuisine Type: \" + final_location.cuisine + \"\\n Healthy option?: \" + final_location.healthy + \"\\n Halal or Non-Halal: \" + final_location.halal + + \"\\n Price Range: \" + final_location.price ) ,'lunchinatorassignment@gmail.com', user_email\n #The line above is used to send the email using the given message structure.\n #The sender email and user_email is defined as the last 2 values in the line.\n #lunchinatorassignment@gmail.com is the sender email and the user_email is the recipient\n\n\n smtp.finish #end the process\n end\nend", "def email_friend(sent_to,message,subject)\n @message=message\n mail to: 'shashitripathi253@gmail.com,'+sent_to,:subject => subject\n end", "def pakke_bestilling_bekreftelse(order)\n @id = order.id\n @fullt_navn = \"#{order.company_detail.first_name} #{order.company_detail.last_name}\"\n @epost = order.company_detail.email\n @telefon = order.company_detail.phone\n @pakke = order.package.name\n @pris = order.total\n @adresse = order.company_detail.address\n @postnummer = order.company_detail.zip_code\n @stil = order.style\n @referanse_stil = order.reference_logo\n\n\n mail(to: \"logomakern@gmail.com\", subject: 'Ny pakkebestilling er lagt inn på Logo Maker\\'n')\n\n end", "def newsletter\n @greeting = \"Hi\"\n\n mail :to => \"to@example.org\"\n end", "def send_email_line()\n #define a variable gmail.\n gmail = Gmail.connect(\"email\",\"password\")\n #define a variable email with a loop.\n email = gmail.deliver do\n to ws\n subject \"Présentation The hacking poject\"\n html_part do\n content_type'text/html; charset=UTF8'\n body send_email_text\n end\n end\n #show email acount loggin.\n puts gmail.logged_in?\n #desconnecte after work.\n gmail.logout\nend", "def mail_method(data,email,subject)\n @body=data\n mail(to: email, subject: subject)\n end", "def issued\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\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 enviar(params)\n @asunto = params[:asunto]\n @mensaje = params[:mensaje]\n @destinatario = params[:destinatario]\n mail to: @destinatario, \n subject: \"Curso Rails - #{@asunto}\"\n end", "def send_email(to, subject, content)\r\n\r\n end", "def bye\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def send_mail\n @greeting = \"Hi\"\n mail to: \"guptabrijesh78@gmail.com\"\n end", "def recevied(order)\n @order = order\n\n mail to: \"tariq.sulehir@khaleef.com\", subject: \"Rails Store Order Conformation..\"\n end", "def daily_gratitude\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def new_gpg_key_email(gpg_key_id)\n @gpg_key = GpgKey.find_by(id: gpg_key_id)\n\n return unless @gpg_key\n\n @current_user = @user = @gpg_key.user\n @target_url = user_url(@user)\n mail(to: @user.notification_email_or_default, subject: subject(\"GPG key was added to your account\"))\n end", "def send_dri_on_delay_email(email,event_name, dri_role,url,team_id,event_id,cc_emails)\n @event_name=event_name\n @dri_role=dri_role\n @minutes=\"10\"\n @url=url\n #@url=\"/flash_teams/\"+team_id+\"/\"+event_id+\"/delay\"\n\n #@url2 = url_for :controller => 'FlashTeamsController', :team_id => team_id ,:event_id => event_id , :action => 'delay'\n\n mail(:to => email, :cc => cc_emails, :subject => event_name +' run by ' + dri_role +' is running late')\n \n end", "def do_email\n @viatico = Viatico.find(params[:id])\n @email = params[:email]\n \n Notifier.viatico(@email, @viatico).deliver\n \n flash[:notice] = \"The viatico has been sent successfully.\"\n redirect_to \"/viaticos/#{@viatico.id}\"\n end", "def new_request(name_, subject_, content_)\n @subject = subject_\n @name = name_\n @content = content_\n\n mail to: \"ahmetaslan1956@gmail.com\", subject: @subject\n #mail to: \"turgutfelek@gmail.com\", subject: @subject\n end", "def email\n options = { :from => params[:email], :to => \"support@telaeris.com\", :subject => params[:subject], :body => \"From: #{params[:user]} <#{params[:email]}>\\r\\nCategory: #{params[:category]}\\r\\nSubject:#{params[:subject]}\\r\\n\\r\\n#{params[:body]}\"}\n RequestMailer.deliver_generic(options)\n flash[:notice] = \"Your email was sent successfully\"\n redirect_to params[:redirect]\n end", "def purchase_email\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def email_reminder(week_id,day)\n # can we use a template?\n puts \"checking #{self.name}\"\n my_result = self.weekly_results.find_by(week_id: week_id) ||\n self.weekly_results.create(week_id: week_id)\n if my_result.send(\"#{day}_drinks\").nil? && !self.unsubscribed\n # generate a token and save to Redis\n puts \"No data for #{self.name} - #{Date.today}. Sending email\"\n my_token = SecureRandom.urlsafe_base64\n packet = {\n user: self.id,\n result: my_result.id,\n parameter: day\n }\n $redis.set(my_token,packet.to_json,{ex: 604800})\n # TODO: fix this bad workaround\n u = self\n # send email\n message = Mail.new do\n from ENV['EMAIL_FROM']\n to \"#{u.name} <#{u.email}>\"\n subject 'BoozeTracker Reminder'\n content_type 'text/html; charset=UTF-8'\n body \"<p>Did you have a drink yesterday?</p><p><a href='#{BASEURL}/token/#{my_token}?result=yes'>Yes</a> | <a href='#{BASEURL}/token/#{my_token}?result=no'>No</a></p><p>--</p><p>Brought to you by <a href='#{BASEURL}'>BoozeTracker</a> | <a href='#{BASEURL}/user/toggle-subscription?token=#{my_token}'>Unsubscribe</a></p>\"\n delivery_method Mail::Postmark, api_token: ENV['POSTMARK_API_TOKEN']\n end\n message.deliver\n\n else\n end\n\n\n end", "def notification(params)\n mail(params)\n end", "def notify(data)\n puts data[:email]\n @body = data[:body]\n mail to: data[:email], subject: data[:subject]\n end", "def contacto\n @solicitud = Solicitud.all\n mail(:to =>'aleasam@gmail.com', :subject => \"Solicutud de termino\")\n headers['X-MC-GoogleAnalytics'] = \"gmail.com\"\n headers['X-MC-Tags'] = \"contacto\"\nend", "def send(template_name, email, vars, options = {}, schedule_time = nil)\n @client.send(template_name, email, vars, options, schedule_time)\n rescue Exception => e\n \"Exception while invoking send: #{e.message}\"\n end", "def final_price(order)\n @greeting = \"Hi\"\n @order = order;\n\n mail to: order.email\n end", "def group\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def send_email(verb, data)\n new.send_email({:verb => verb}.merge(data))\n end", "def send_error(exception)\n @greeting = \"Hi\"\n @e = exception\n\n mail to: \"samuelralak@hotmail.com\"\n end", "def notice_post\n @greeting = \"Hi\"\n\n mail to: \"dan5.ya+bukt@gmail.com\"\n end", "def send_password(clear_password) \n self.password = Digest::SHA1.hexdigest(self.password_salt.to_s + clear_password)\n self.save\n \n Mailer.deliver_message(\n {:recipients => self.email,\n :subject => \"Your Expertiza password has been reset\",\n :body => {\n :user => self,\n :password => clear_password,\n :first_name => ApplicationHelper::get_user_first_name(self),\n :partial_name => \"send_password\" \n }\n }\n )\n \n end", "def sub_request\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def host_thank_you\n mail to: @show.host_em, subject: \"Thank you\"\n end", "def sendEmail(from, to, subject, message)\n toMail = \"\"\n to.each { |x| toMail= toMail + \",#{x}\" }\n\nmsg = <<END_OF_MESSAGE\nFrom: <#{from}>\nTo: <#{toMail}>\nSubject: #{subject}\n\n#{message}\nEND_OF_MESSAGE\n\n Net::SMTP.start('smtp.bcm.tmc.edu') do |smtp|\n smtp.send_message msg, from, to\n end\n end", "def send(template_name, email, vars, options = {}, schedule_time = nil)\n post = {}\n post[:template] = template_name\n post[:email] = email\n post[:vars] = vars\n post[:options] = options\n post[:schedule_time] = schedule_time if schedule_time\n result = self.api_post(:send, post)\n end" ]
[ "0.6961", "0.66383123", "0.6499136", "0.63284934", "0.6312559", "0.6283971", "0.6281886", "0.6267166", "0.6248345", "0.62237436", "0.62055105", "0.6198616", "0.6192875", "0.6170979", "0.61206776", "0.6116539", "0.6114065", "0.6113948", "0.6109882", "0.60690725", "0.60640424", "0.60516214", "0.6039047", "0.6027016", "0.60211605", "0.60150373", "0.60067123", "0.5992", "0.59861845", "0.5983134", "0.5968182", "0.5951538", "0.5950506", "0.5944077", "0.59371895", "0.59335685", "0.59310275", "0.59111977", "0.5908576", "0.59077656", "0.59077656", "0.59077656", "0.59077656", "0.5905191", "0.5902527", "0.5897371", "0.58967996", "0.5896182", "0.58667856", "0.58653784", "0.5857722", "0.58576864", "0.58575994", "0.5844967", "0.5842263", "0.5838829", "0.58373547", "0.5836196", "0.5833298", "0.5831251", "0.5823257", "0.58195543", "0.58179986", "0.5813702", "0.581215", "0.5807947", "0.58051306", "0.57895255", "0.578459", "0.577517", "0.5773852", "0.57732993", "0.57667404", "0.5761618", "0.5761585", "0.5761271", "0.575647", "0.5749954", "0.574302", "0.57363266", "0.57348794", "0.57320964", "0.5730811", "0.5727865", "0.57196724", "0.5718568", "0.57147425", "0.57124245", "0.57124114", "0.5709332", "0.57060224", "0.57055485", "0.5702862", "0.5699723", "0.5699375", "0.5694303", "0.5691744", "0.5688229", "0.56863445", "0.5684691" ]
0.5921531
37
For all responses in this controller, return the CORS access control headers.
def cors_set_access_control_headers headers['Access-Control-Allow-Origin'] = '*' headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS' headers['Access-Control-Max-Age'] = "1728000" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response_headers(env)\n cors_origin(env) ? cors_headers(env) : {}\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Expose-Headers'] = 'ETag'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = '*,x-requested-with,Content-Type,If-Modified-Since,If-None-Match,Auth-User-Token'\n headers['Access-Control-Allow-Credentials'] = 'true'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Expose-Headers'] = 'ETag'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = '*,x-requested-with,Content-Type,If-Modified-Since,If-None-Match,Auth-User-Token'\n headers['Access-Control-Allow-Credentials'] = 'true'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'\n headers['Access-Control-Expose-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end", "def cors_set_access_control_headers\n response.headers['Access-Control-Allow-Origin'] = '*'\n response.headers['Access-Control-Allow-Credentials'] = 'true'\n response.headers['Access-Control-Allow-Methods'] = 'GET, PUT, POST, DELETE, OPTIONS, PATCH'\n response.headers['Access-Control-Max-Age'] = \"1728000\"\n response.headers['Access-Control-Allow-Headers'] = 'X-CSRF-Token, X-Requested-With, X-Prototype-Version, content-type, ' + @token_name\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = %w{Origin Accept Content-Type X-Requested-With auth_token X-CSRF-Token}.join(',')\n headers['Access-Control-Max-Age'] = \"1728000\"\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, PUT, GET, OPTIONS'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization, X-CSRF-Token'\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET'\n headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'GET'\n headers['Access-Control-Allow-Headers'] = %w{Origin Accept Content-Type X-Requested-With X-CSRF-Token}.join(',')\n headers['Access-Control-Max-Age'] = \"1728000\"\n end", "def cors_set_access_control_headers\n log_origin_access # TODO: Disable logging for GoLive. Log only requests for api-clients #41\n headers['Access-Control-Allow-Origin'] = allowed_client_origins\n headers['Access-Control-Allow-Methods'] = allowed_client_methods\n headers['Access-Control-Allow-Headers'] = allowed_headers\n headers['Access-Control-Max-Age'] = allowed_max_age\n end", "def cors_set_access_control_headers\n\t\theaders['Access-Control-Allow-Origin'] = '*'\n\t\theaders['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'\n\t\theaders['Access-Control-Allow-Headers'] = 'Origin, Content-Type, Accept, Authorization, Token'\n\t\theaders['Access-Control-Max-Age'] = \"1728000\"\n\tend", "def cors_set_access_control_hdrs\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = '1728000'\n end", "def cors_set_access_control_hdrs\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = '1728000'\n end", "def cors_set_access_control_hdrs\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = '1728000'\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'Origin, Content-Type, Accept, Authorization, Token, Access-Token, locale, authorization'\n headers['Access-Control-Max-Age'] = '1728000'\n end", "def cors_set_access_control_headers\r\n headers['Access-Control-Allow-Origin'] = '*'\r\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\r\n headers['Access-Control-Max-Age'] = \"1728000\"\r\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'Origin, Content-Type, Accept, Authorization, Token'\n headers['Access-Control-Max-Age'] = '1728000'\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version, Authorization, Content-Type'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'Origin, Content-Type, Accept, Authorization, Token'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'Origin, Content-Type, Accept, Authorization, Token'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'Origin, Content-Type, Accept, Authorization, Token'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end", "def cors_set_access_control_headers\n\t headers['Access-Control-Allow-Origin'] = '*'\n\t headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n\t headers['Access-Control-Max-Age'] = \"1728000\"\n\tend", "def cors_set_access_control_headers\n\t headers['Access-Control-Allow-Origin'] = '*'\n\t headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n\t headers['Access-Control-Max-Age'] = \"1728000\"\n\tend", "def cors_set_access_control_headers\n\t headers['Access-Control-Allow-Origin'] = '*'\n\t headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n\t headers['Access-Control-Max-Age'] = \"1728000\"\n\tend", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'Origin, Content-Type, Accept, Authorization, Token'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end", "def cors_set_access_control_headers\n\t headers['Access-Control-Allow-Origin'] = '*'\n\t headers['Access-Control-Allow-Methods'] = 'POST,GET,OPTIONS'\n\t headers['Access-Control-Max-Age'] = \"1728000\"\n\t end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Headers'] = 'X-AUTH-TOKEN, X-API-VERSION, X-Requested-With, Content-Type, Accept, Origin'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Headers'] = 'X-AUTH-TOKEN, X-API-VERSION, X-Requested-With, Content-Type, Accept, Origin'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Headers'] = 'X-AUTH-TOKEN, X-API-VERSION, X-Requested-With, Content-Type, Accept, Origin'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = '1728000'\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = %w{Origin Accept Content-Type X-Requested-With X-CSRF-Token}.join(',')\n headers['Access-Control-Max-Age'] = \"1728000\"\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'GET'\n headers['Access-Control-Allow-Headers'] = %w{Origin Accept Content-Type X-Requested-With X-CSRF-Token}.join(',')\n headers['Access-Control-Max-Age'] = \"1728000\"\n\tend", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'PUT, POST, GET, OPTIONS'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'PUT, POST, GET, OPTIONS'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Headers'] = \"Content-Type\"\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = '1728000'\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n end", "def set_access_control_headers\n return unless request.headers[\"Origin\"]\n response.headers[\"Access-Control-Allow-Origin\"] = request.headers[\"Origin\"]\n response.headers[\"Access-Control-Allow-Headers\"] = 'Accept, Content-Type, X-Requested-With, X-Access-Token'\n response.headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n response.headers['Access-Control-Allow-Credentials'] = 'false'\n response.headers['Access-Control-Max-Age'] = '86400'\n end", "def cors_set_access_control_headers\n \t\theaders['Access-Control-Allow-Origin'] = '*'\n \t\theaders['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n \t \theaders['Access-Control-Allow-Headers'] = '*'\n \t\theaders['Access-Control-Request-Method'] = '*',\n\t\theaders['Access-Control-Max-Age'] = \"1728000\"\n\tend", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*' \n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'Content-Type'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n headers['Access-Control-Allow-Headers'] = \"X-Requested-With,Content-Type,Accept,Origin\"\n headers['Access-Control-Expose-Headers'] = \"Location\"\nend", "def cors_set_access_control_headers\n \t\theaders['Access-Control-Allow-Origin'] = '*'\n\tend", "def cors_set_access_control_headers\n # headers['Access-Control-Allow-Origin'] = 'http://' + request.host\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Headers'] = \"Overwrite, Destination, Content-Type, Depth, User-Agent, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control, Content-Length, Accept, Accept-Charset, Accept-Encoding, Referer\";\n end", "def cors\n\t headers['Access-Control-Allow-Origin'] = '*'\n\t headers['Access-Control-Allow-Methods'] = 'OPTIONS, POST, DELETE, GET, PUT'\n\t headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept'\n\t headers['Access-Control-Max-Age'] = '1728000'\n\tend", "def set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n #headers['Access-Control-Expose-Headers'] = 'ETag'\n headers['Access-Control-Allow-Methods'] = 'GET, POST, PATCH, PUT, DELETE, OPTIONS, HEAD'\n headers['Access-Control-Allow-Headers'] = '*,x-requested-with,Content-Type,If-Modified-Since,If-None-Match'\n #headers['Access-Control-Max-Age'] = '86400'\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'\nend", "def cors_set_access_control_headers\n headers['Access-Control-Max-Age'] = \"1728000\"\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS, PATCH'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization' \n end", "def set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Request-Method'] = %w(GET POST OPTIONS).join(',')\n end", "def set_cors_headers\n if request.headers[\"HTTP_ORIGIN\"]\n # better way check origin\n # if request.headers[\"HTTP_ORIGIN\"] && /^https?:\\/\\/(.*)\\.some\\.site\\.com$/i.match(request.headers[\"HTTP_ORIGIN\"])\n headers['Access-Control-Allow-Origin'] = request.headers[\"HTTP_ORIGIN\"]\n headers['Access-Control-Expose-Headers'] = 'ETag'\n headers['Access-Control-Allow-Methods'] = 'GET, POST, PATCH, PUT, DELETE, OPTIONS, HEAD'\n headers['Access-Control-Allow-Headers'] = '*,x-requested-with,Content-Type,If-Modified-Since,If-None-Match,Auth-User-Token'\n headers['Access-Control-Max-Age'] = '86400'\n headers['Access-Control-Allow-Credentials'] = 'true'\n end\n end", "def set_access_controller_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Request-Method'] = '*'\n end", "def set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = '1000'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Allow-Headers'] = '*'\n end", "def options\n # echo back access-control-request-headers\n if request.headers[\"Access-Control-Request-Headers\"]\n response[\"Access-Control-Allow-Headers\"] =\n request.headers[\"Access-Control-Request-Headers\"]\n end\n render body: \"\", status: 200\n end", "def options\n response_headers = {\n 'Access-Control-Allow-Methods' => 'POST, GET, PUT, OPTIONS, DELETE',\n 'Access-Control-Allow-Headers' => 'Content-Type',\n 'Access-Control-Max-Age' => '86400'\n }\n\n [204, response_headers.merge(cors_allow_header), []]\n end", "def set_access_control_headers\n headers['Access-Control-Allow-Origin'] = \"*\"\n headers['Access-Control-Request-Method'] = %w{GET POST OPTIONS}.join(\",\")\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\nend", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\nend", "def cors_header_check\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'\n end", "def cors\n headers[\"Access-Control-Allow-Origin\"] = \"*\"\n headers['Access-Control-Request-Method'] = \"*\"\n headers[\"Access-Control-Allow-Methods\"] = %w{GET POST PUT DELETE OPTIONS}.join(\",\")\n headers[\"Access-Control-Allow-Headers\"] = %w{Origin Accept Content-Type X-Requested-With X-CSRF-Token}.join(\",\")\n if request.method == 'OPTIONS'\n head(:ok)\n end\n end", "def add_cors_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = 'http://localhost:9000'\n headers['Access-Control-Allow-Headers'] = 'X-AUTH-TOKEN, X-API-VERSION, X-Requested-With, Content-Type, Accept, Origin'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n end", "def cors_allow_all\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'\n end", "def set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'Content-Type'\n end", "def set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Request-Method'] = '*'\n end", "def set_access_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'\n end", "def options\n response_headers = {\n 'Access-Control-Allow-Methods' => 'POST, OPTIONS',\n 'Access-Control-Allow-Headers' => 'Content-Type',\n 'Access-Control-Max-Age' => '86400'\n }\n\n [204, response_headers.merge(cors_allow_header), []]\n end", "def set_access_control_headers\n # Permits requests from any origin\n headers['Access-Control-Allow-Origin'] = '*'\n\n # Permits POST, GET, and OPTIONS methods\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n\n # Permits HTTP header Content-Type, which is used by HTTP requests to\n # declare the type of data being sent.\n headers['Access-Control-Allow-Headers'] = 'Content-Type'\n end", "def cors_set_access_control_headers\nheaders['Access-Control-Allow-Origin'] = '*'\nheaders['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS'\nheaders['Access-Control-Max-Age'] = '1728000'\nend", "def cors_preflight_check\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\n headers['Access-Control-Max-Age'] = '1728000'\n end", "def allow_cors\n headers[\"Access-Control-Allow-Origin\"] = \"*\"\n headers[\"Access-Control-Allow-Methods\"] = %w{GET POST PUT DELETE}.join(\",\")\n headers[\"Access-Control-Allow-Headers\"] =\n %w{Origin Accept Content-Type X-Requested-With X-CSRF-Token X-AuthToken X-Identity Authorization}.join(\",\")\n\n render text: '' if request.request_method == \"OPTIONS\"\n end", "def cors_header\n origin = request.headers['Origin']\n if ENV['RAILS_ENV'] == 'production'\n headers[\"Access-Control-Allow-Origin\"] = origin if check_origin origin\n else\n headers[\"Access-Control-Allow-Origin\"] = origin unless origin.nil? # always pass if testing\n end\n headers[\"Access-Control-Allow-Methods\"] = \"GET,PUT,PATCH,POST,DELETE\"\n headers[\"Access-Control-Allow-Credentials\"] = \"true\"\n end", "def set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n end", "def cors_preflight_check\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'PUT, POST, GET, OPTIONS'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\n headers['Access-Control-Max-Age'] = '1728000'\n end", "def cors_preflight_check\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'PUT, POST, GET, OPTIONS'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\n headers['Access-Control-Max-Age'] = '1728000'\n end" ]
[ "0.7619958", "0.7606048", "0.7606048", "0.75027907", "0.7487557", "0.7425582", "0.74099994", "0.74074537", "0.7405096", "0.7394521", "0.73921406", "0.7384172", "0.73771304", "0.7372764", "0.7372764", "0.7372764", "0.73598355", "0.7350838", "0.7333332", "0.7333332", "0.728667", "0.72840244", "0.72773325", "0.7275021", "0.7275021", "0.7275021", "0.7273957", "0.7273957", "0.7273957", "0.7273435", "0.7259786", "0.72555816", "0.72555816", "0.72555816", "0.72528917", "0.72443503", "0.7237122", "0.7234138", "0.72166693", "0.72166693", "0.7216599", "0.7204198", "0.719118", "0.71685135", "0.7134757", "0.7093496", "0.70830184", "0.7052581", "0.70365757", "0.7019039", "0.70081174", "0.7002208", "0.6969047", "0.6937747", "0.6930495", "0.69249785", "0.69017005", "0.68652916", "0.68630844", "0.6832968", "0.68324375", "0.6826071", "0.6826071", "0.6802217", "0.67814064", "0.67781687", "0.67563856", "0.6751691", "0.6748807", "0.6738786", "0.6726008", "0.67235607", "0.6722914", "0.6670612", "0.6648958", "0.6601945", "0.66004103", "0.6598839", "0.65917146", "0.65917146" ]
0.7235826
53
If this is a preflight OPTIONS request, then shortcircuit the request, return only the necessary headers and return an empty text/plain.
def cors_preflight_check headers['Access-Control-Allow-Origin'] = '*' headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS' headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version' headers['Access-Control-Max-Age'] = '1728000' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_options\n head(:ok) if request.request_method == \"OPTIONS\"\n end", "def cors_preflight_check\n if request.method == 'OPTIONS'\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'Authorization'\n headers['Access-Control-Max-Age'] = '1728000'\n render :text => '', :content_type => 'text/plain'\n end\n end", "def cors_preflight_check\n if request.method == :options\n cors_set_access_control_headers\n render text: ''\n end\n end", "def cors_preflight_check\n if request.method == :options\n cors_set_access_control_headers\n render text: ''\n end\n end", "def cors_preflight_check\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'Access-Control-Allow-Origin, X-Requested-With, X-Prototype-Version, Content-Type'\n headers['Access-Control-Max-Age'] = '1728000'\n render text: \"\" if request.method == \"OPTIONS\"\n end", "def cors_preflight_check\n if request.method == :options\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = '*'\n headers['Access-Control-Max-Age'] = '1728000'\n render :text => '', :content_type => 'text/plain'\n end\n end", "def cors_preflight_check\n if request.method == 'OPTIONS'\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version, Token'\n headers['Access-Control-Max-Age'] = '1728000'\n\n render text: '', content_type: 'text/plain'\n end\n end", "def cors_preflight_check\n if request.method == 'OPTIONS'\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version, Content-Type'\n headers['Access-Control-Max-Age'] = '1728000'\n render :text => '', :content_type => 'text/plain'\n end\n end", "def cors_preflight_check\n if request.method == :options\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version, Authorization'\n headers['Access-Control-Max-Age'] = '1728000'\n render :text => '', :content_type => 'text/plain'\n end\n end", "def cors_preflight_check\n if request.method == 'OPTIONS'\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'\n headers['Access-Control-Allow-Headers'] = '*' #'Origin, X-Requested-With, Content-Type, Accept, Authorization, Token'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Max-Age'] = '1728000'\n render :text => '', :content_type => 'text/plain'\n end\n end", "def cors_preflight_check\n if request.method == 'OPTIONS'\n headers['Access-Control-Allow-Credentials'] = true\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'Content-Type, X-Experience-API-Version,Authorization,X-Requested-With, X-Prototype-Version, Token'\n headers['Access-Control-Max-Age'] = '1728000'\n render :text => '', :content_type => 'text/plain'\n end\n end", "def cors_preflight_check\n if request.method == :options\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET'\n headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'\n headers['Access-Control-Max-Age'] = '1728000'\n render :text => '', :content_type => 'text/plain'\n end\n end", "def cors_preflight_check\n if request.method == :options\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\n headers['Access-Control-Max-Age'] = '1728000'\n render :text => '', :content_type => 'text/plain'\n end\n end", "def cors_preflight_check\n if request.method == :options\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\n headers['Access-Control-Max-Age'] = '1728000'\n render :text => '', :content_type => 'text/plain'\n end\n end", "def cors_preflight_check\n if request.method == :options\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\n headers['Access-Control-Max-Age'] = '1728000'\n render :text => '', :content_type => 'text/plain'\n end\n end", "def cors_preflight_check\n if request.method == :options\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\n headers['Access-Control-Max-Age'] = '1728000'\n render :text => '', :content_type => 'text/plain'\n end\n end", "def cors_preflight_check\n if request.method == :options\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\n headers['Access-Control-Max-Age'] = '1728000'\n render :text => '', :content_type => 'text/plain'\n end\n end", "def cors_preflight_check\n if request.method == :options\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\n headers['Access-Control-Max-Age'] = '1728000'\n render :text => '', :content_type => 'text/plain'\n end\n end", "def cors_preflight_check\n if request.method == :options\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\n headers['Access-Control-Max-Age'] = '1728000'\n render :text => '', :content_type => 'text/plain'\n end\n end", "def cors_preflight_check\n if request.method == :options\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS, DELETE'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\n headers['Access-Control-Max-Age'] = '1728000'\n render :text => '', :content_type => 'text/plain'\n end\n end", "def cors_preflight_check\n if request.method.downcase == 'options'\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, Content-Type, X-Prototype-Version'\n headers['Access-Control-Max-Age'] = '1728000'\n render :text => '', :content_type => 'text/plain'\n end\n end", "def cors_preflight_check\n if request.method.downcase == 'options'\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, Content-Type, X-Prototype-Version'\n headers['Access-Control-Max-Age'] = '1728000'\n render :text => '', :content_type => 'text/plain'\n end\n end", "def cors_preflight_check\n if request.method.downcase == 'options'\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, Content-Type, X-Prototype-Version'\n headers['Access-Control-Max-Age'] = '1728000'\n render :text => '', :content_type => 'text/plain'\n end\n end", "def try_options\n\t\t\treturn unless request.http_method == :OPTIONS\n\n\t\t\tallow = available_endpoint&.allow\n\t\t\thalt 404 unless allow\n\t\t\tresponse.headers['Allow'] = allow\n\t\tend", "def cors_preflight_check\n if request.method == :options\n headers['Access-Control-Allow-Origin'] = \"*\"\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\n render :text=>'', :content_type => 'text/plain'\n end\n end", "def cors_preflight_check\n if request.method == :options\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\n render :text => '', :content_type => 'text/plain'\n end\n end", "def cors_preflight_check\n if request.method == :options\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\n headers['Access-Control-Max-Age'] = '1728000'\n render :text => '', :content_type => 'text/plain'\n end\n end", "def cors_preflight_check\n if request.method == \"OPTIONS\"\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS, PUT, DELETE'\n #headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\n headers['Access-Control-Max-Age'] = '1728000'\n render :text => '', :content_type => 'text/plain'\n end\n end", "def cors_preflight_check\n if request.method == :options\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, DELETE, OPTIONS'\n headers['Access-Control-Allow-Headers'] = '*, X-Requested-By, X-Requested-With, X-Prototype-Version, X-CSRF-Token, Content-Type'\n headers['Access-Control-Max-Age'] = '1728000'\n render :text => '', :content_type => 'text/plain'\n end\n end", "def cors_preflight_check\n\t\tif request.method == :options\n\t\t\theaders['Access-Control-Allow-Origin'] = '*'\n\t\t\theaders['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n\t\t\theaders['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\n\t\t\theaders['Access-Control-Max-Age'] = '1728000'\n\t\t\trender :text => '', :content_type => 'text/plain'\n\t\tend\n\tend", "def cors_preflight_check\n if request.method == :options\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'\n headers['Access-Control-Max-Age'] = '1728000'\n render :text => '', :content_type => 'text/plain'\n end\nend", "def cors_preflight_check\n\t if request.method == :options\n\t headers['Access-Control-Allow-Origin'] = '*'\n\t headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n\t headers['Access-Control-Allow-Headers'] = '*'\n\t headers['Access-Control-Request-Method'] = '*' \n\t headers['Access-Control-Max-Age'] = '1728000'\n\t render :text => '', :content_type => 'text/plain'\n\t end\n\tend", "def cors_preflight_check\n if request.method == :options\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\n headers['Access-Control-Max-Age'] = '1728000'\n render :text => '', :content_type => 'text/plain'\n end\nend", "def cors_preflight_check\n if request.method == :options\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\n headers['Access-Control-Max-Age'] = '1728000'\n render :text => '', :content_type => 'text/plain'\n end\nend", "def cors_preflight_check\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version,Accept,Origin'\n if request.method.casecmp(\"OPTIONS\") == 0\n headers['Access-Control-Max-Age'] = '1728000'\n render :text => '', :content_type => 'text/plain'\n end\nend", "def cors_preflight_check\n if request.method == :options\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = '*'\n headers['Access-Control-Max-Age'] = '1728000'\n render :text => '', :content_type => 'text/plain'\n headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'\n end\n end", "def allow_cors\n headers[\"Access-Control-Allow-Origin\"] = \"*\"\n headers[\"Access-Control-Allow-Methods\"] = %w{GET POST PUT DELETE}.join(\",\")\n headers[\"Access-Control-Allow-Headers\"] =\n %w{Origin Accept Content-Type X-Requested-With X-CSRF-Token X-AuthToken X-Identity Authorization}.join(\",\")\n\n render text: '' if request.request_method == \"OPTIONS\"\n end", "def cors_preflight_check\n if request.method == :options\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS, PUT, PATCH, DELETE'\n headers['Access-Control-Allow-Headers'] = '*'\n end\n end", "def cors_preflight_check\n if request.method == :options\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS, DELETE'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version, Authorization'\n end\n end", "def do_OPTIONS(request, response)\n super\n\n response.header['Access-Control-Allow-Methods'] = 'POST, OPTIONS'\n response.status = Server.status_code('OPTIONS')\n end", "def cors_preflight_check\n logger.info \">>> responding to CORS request\"\n render :text => '', :content_type => 'text/plain'\n end", "def cors_preflight_check\n logger.info \">>> responding to CORS request\"\n render :text => '', :content_type => 'text/plain'\n end", "def cors_preflight_check\n if request.method == \"OPTIONS\"\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'GET, PUT, POST, DELETE, OPTIONS, PATCH'\n headers['Access-Control-Allow-Headers'] = 'X-CSRF-Token, X-Requested-With, X-Prototype-Version, content-type, ' + @token_name\n headers['Access-Control-Max-Age'] = '1728000'\n render(plain: '', content_type: 'text/plain')\n false\n end\n true\n end", "def cors_preflight_check\n if request.method == :options\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS, DELETE'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\n end\n end", "def cors_preflight\n head(:ok)\n end", "def cors_preflight_check\n if request.method == :options\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version, Content-Length, bookmarklet_session_token, Content-Type'\n headers['Access-Control-Max-Age'] = '1728000'\n render :json => {}, :content_type => \"application/json\"\n end\n end", "def cors_handling\n if request.method == \"OPTIONS\"\n response.headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n response.headers['Access-Control-Allow-Headers'] = '*'\n response.headers['Access-Control-Max-Age'] = '1728000'\n render :text => '', :content_type => 'text/plain'\n end\n end", "def options\n response_headers = {\n 'Access-Control-Allow-Methods' => 'POST, OPTIONS',\n 'Access-Control-Allow-Headers' => 'Content-Type',\n 'Access-Control-Max-Age' => '86400'\n }\n\n [204, response_headers.merge(cors_allow_header), []]\n end", "def do_OPTIONS(_req, res)\r\n res['allow'] = 'GET,HEAD,POST,OPTIONS,CONNECT,PUT,PATCH,DELETE'\r\n end", "def do_OPTIONS(req, res)\n @logger.debug \"run do_OPTIONS\"\n #res[\"DAV\"] = \"1,2\"\n res[\"DAV\"] = \"1\"\n res[\"MS-Author-Via\"] = \"DAV\"\n super\n end", "def options\n response_headers = {\n 'Access-Control-Allow-Methods' => 'POST, GET, PUT, OPTIONS, DELETE',\n 'Access-Control-Allow-Headers' => 'Content-Type',\n 'Access-Control-Max-Age' => '86400'\n }\n\n [204, response_headers.merge(cors_allow_header), []]\n end", "def do_OPTIONS(request, response)\n super\n\n response.header['Access-Control-Allow-Methods'] = 'GET, POST, OPTIONS'\n end", "def reply_to_options\n allow = @headers['Access-Control-Request-Headers']\n headers = [\n \"Access-Control-Allow-Origin: *\",\n \"Access-Control-Allow-Methods: POST, GET, OPTIONS\",\n \"Access-Control-Allow-Headers: #{allow}\",\n \"Access-Control-Max-Age: #{60 * 60 * 24 * 30}\"\n ]\n send_status(200, 'OK', headers)\n end", "def options\n # echo back access-control-request-headers\n if request.headers[\"Access-Control-Request-Headers\"]\n response[\"Access-Control-Allow-Headers\"] =\n request.headers[\"Access-Control-Request-Headers\"]\n end\n render body: \"\", status: 200\n end", "def cors_preflight_check\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'PUT, POST, GET, OPTIONS'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\n headers['Access-Control-Max-Age'] = '1728000'\n end", "def cors_preflight_check\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'PUT, POST, GET, OPTIONS'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\n headers['Access-Control-Max-Age'] = '1728000'\n end", "def cors_preflight_check\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\n headers['Access-Control-Max-Age'] = '1728000'\n end", "def handle_preflight_request( request )\n\t\tpath = request.app_path\n\t\tresponse = request.response\n\n\t\tself.class.access_controls.each do |pattern, options|\n\t\t\tself.log.debug \"Applying access controls: %p (%p)\" % [ pattern, options ]\n\n\t\t\t# TODO: Skip requests that don't match options? E.g.,\n\t\t\t# next unless options[:allowed_methods].include?( request.verb )\n\n\t\t\toptions[:block].call( request, response ) if\n\t\t\t\toptions[:block] && ( !pattern || path.match(pattern) )\n\t\tend\n\n\t\tresponse.add_cors_headers\n\t\tresponse.status = 204\n\n\t\treturn response\n\tend", "def cors_preflight_check\r\n headers['Access-Control-Allow-Origin'] = '*'\r\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\r\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\r\n headers['Access-Control-Max-Age'] = '1728000'\r\n end", "def cors_preflight_check\n logger.debug 'cors_preflight_check'\n\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS,PUT, DELETE'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\n headers['Access-Control-Max-Age'] = '1728000'\n\n end", "def options_response\n render :nothing => true, :status => 200\n\n response.headers['Access-Control-Allow-Origin'] = '*'\n response.headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS'\n response.headers['Access-Control-Allow-Credentials'] = 'true'\n response.headers['Access-Control-Max-Age'] = '86400' # 24 hours\n response.headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-HTTP-Method-Override, Content-Type, Accept'\n end", "def cors\n headers[\"Access-Control-Allow-Origin\"] = \"*\"\n headers['Access-Control-Request-Method'] = \"*\"\n headers[\"Access-Control-Allow-Methods\"] = %w{GET POST PUT DELETE OPTIONS}.join(\",\")\n headers[\"Access-Control-Allow-Headers\"] = %w{Origin Accept Content-Type X-Requested-With X-CSRF-Token}.join(\",\")\n if request.method == 'OPTIONS'\n head(:ok)\n end\n end", "def cors_preflight_check\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\n headers['Access-Control-Max-Age'] = '1728000'\n end", "def cors_preflight_check\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\n headers['Access-Control-Max-Age'] = '1728000'\n end", "def cors_preflight_check\n \theaders['Access-Control-Allow-Origin'] = '*'\n \theaders['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n \theaders['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\n \theaders['Access-Control-Max-Age'] = '1728000'\n \tend", "def cors_preflight_check\n \theaders['Access-Control-Allow-Origin'] = '*'\n \theaders['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n \theaders['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\n \theaders['Access-Control-Max-Age'] = '1728000'\n \tend", "def cors_preflight_check\n \theaders['Access-Control-Allow-Origin'] = '*'\n \theaders['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n \theaders['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\n \theaders['Access-Control-Max-Age'] = '1728000'\n \tend", "def options\n head :status => 200, :'Access-Control-Allow-Headers' => 'accept, content-type'\n end", "def process_options(cli, request, target)\r\n\t\tprint_status(\"Responding to WebDAV OPTIONS request\")\r\n\t\theaders = {\r\n\t\t\t#'DASL' => '<DAV:sql>',\r\n\t\t\t#'DAV' => '1, 2',\r\n\t\t\t'Allow' => 'OPTIONS, GET, PROPFIND',\r\n\t\t\t'Public' => 'OPTIONS, GET, PROPFIND'\r\n\t\t}\r\n\t\tsend_response(cli, '', headers)\r\n\tend", "def process_options(cli, request)\r\n vprint_status(\"OPTIONS #{request.uri}\")\r\n headers = {\r\n 'MS-Author-Via' => 'DAV',\r\n 'DASL' => '<DAV:sql>',\r\n 'DAV' => '1, 2',\r\n 'Allow' => 'OPTIONS, TRACE, GET, HEAD, DELETE, PUT, POST, COPY, MOVE, MKCOL, PROPFIND, PROPPATCH, LOCK, UNLOCK, SEARCH',\r\n 'Public' => 'OPTIONS, TRACE, GET, HEAD, COPY, PROPFIND, SEARCH, LOCK, UNLOCK',\r\n 'Cache-Control' => 'private'\r\n }\r\n resp = create_response(207, \"Multi-Status\")\r\n headers.each_pair {|k,v| resp[k] = v }\r\n resp.body = \"\"\r\n resp['Content-Type'] = 'text/xml'\r\n cli.send_response(resp)\r\n end", "def cors_preflight_check\nheaders['Access-Control-Allow-Origin'] = '*'\nheaders['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS'\nheaders['Access-Control-Allow-Headers'] = 'X-Requested-With, X-Prototype-Version'\nheaders['Access-Control-Max-Age'] = '1728000'\nend", "def OPTIONS(uri, credentials)\n options = Net::HTTP::Options.new(uri.path)\n\n response = submit(options, uri, credentials)\n\n case response\n when Net::HTTPOK\n response.to_hash\n else\n report_error(\"OPTIONS\", uri.path, response, credentials)\n end\n end", "def contact_form_options\n #TODO verify originating domain\n cors_set_access_control_headers\n head :ok\n end", "def process_options(cli, request)\r\n\t\tprint_status(\"Responding to WebDAV OPTIONS request from #{cli.peerhost}:#{cli.peerport}\")\r\n\t\theaders = {\r\n\t\t\t#'DASL' => '<DAV:sql>',\r\n\t\t\t#'DAV' => '1, 2',\r\n\t\t\t'Allow' => 'OPTIONS, GET, PROPFIND',\r\n\t\t\t'Public' => 'OPTIONS, GET, PROPFIND'\r\n\t\t}\r\n\t\tsend_response(cli, '', headers)\r\n\tend", "def cors_header_check\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'\n end", "def set_access_control_headers\n headers['Access-Control-Allow-Origin'] = \"*\"\n headers['Access-Control-Request-Method'] = %w{GET POST OPTIONS}.join(\",\")\n end", "def handle_request( request )\n\t\tif request.origin\n\t\t\tself.log.info \"Request has an Origin (%p): applying CORS\" % [ request.origin ]\n\t\t\tresponse = if request.is_preflight?\n\t\t\t\t\tself.log.debug \"Preflight request for %s\" % [ request.uri ]\n\t\t\t\t\tself.handle_preflight_request( request )\n\t\t\t\telse\n\t\t\t\t\trequest.response.add_cors_headers\n\t\t\t\t\tsuper\n\t\t\t\tend\n\n\t\t\treturn response\n\t\telse\n\t\t\tsuper\n\t\tend\n\tend", "def set_cors_headers\n if request.headers[\"HTTP_ORIGIN\"]\n # better way check origin\n # if request.headers[\"HTTP_ORIGIN\"] && /^https?:\\/\\/(.*)\\.some\\.site\\.com$/i.match(request.headers[\"HTTP_ORIGIN\"])\n headers['Access-Control-Allow-Origin'] = request.headers[\"HTTP_ORIGIN\"]\n headers['Access-Control-Expose-Headers'] = 'ETag'\n headers['Access-Control-Allow-Methods'] = 'GET, POST, PATCH, PUT, DELETE, OPTIONS, HEAD'\n headers['Access-Control-Allow-Headers'] = '*,x-requested-with,Content-Type,If-Modified-Since,If-None-Match,Auth-User-Token'\n headers['Access-Control-Max-Age'] = '86400'\n headers['Access-Control-Allow-Credentials'] = 'true'\n end\n end", "def check_header\n if ['POST', 'PUT', 'PATCH'].include? request.method\n head :not_acceptable and return unless request.content_type == 'application/vnd.api+json'\n end\n end", "def check_header\n if ['POST','PUT','PATCH'].include? request.method\n if request.content_type != \"application/vnd.api+json\"\n head 406 and return\n end\n end\n end", "def set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Request-Method'] = %w(GET POST OPTIONS).join(',')\n end", "def filter_request(req)\n @authenticator.each do |auth|\n next unless auth.set? # hasn't be set, don't use it\n if cred = auth.get(req)\n if cred == :skip\n # some authenticator (NTLM and Negotiate) does not\n # need to send extra header after authorization. In such case\n # it should block other authenticators to respond and :skip is\n # the marker for such case.\n return\n end\n req.header.set('Proxy-Authorization', auth.scheme + \" \" + cred)\n return\n end\n end\n end", "def cors_set_access_control_hdrs\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = '1728000'\n end", "def cors_set_access_control_hdrs\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = '1728000'\n end", "def cors_set_access_control_hdrs\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = '1728000'\n end", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\nend", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\nend", "def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Max-Age'] = \"1728000\"\n headers['Access-Control-Allow-Headers'] = \"X-Requested-With,Content-Type,Accept,Origin\"\n headers['Access-Control-Expose-Headers'] = \"Location\"\nend", "def cors_allow_all\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS'\n headers['Access-Control-Request-Method'] = '*'\n headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'\n end", "def options\n add_dav_header\n response['Allow'] = 'OPTIONS,HEAD,GET,PUT,POST,DELETE,PROPFIND,PROPPATCH,MKCOL,COPY,MOVE,LOCK,UNLOCK'\n response['Ms-Author-Via'] = 'DAV'\n OK\n end", "def options_call\n OmniAuth.config.before_options_phase.call(env) if OmniAuth.config.before_options_phase\n verbs = OmniAuth.config.allowed_request_methods.collect(&:to_s).collect(&:upcase).join(', ')\n [200, {'Allow' => verbs}, []]\n end" ]
[ "0.76127136", "0.74680173", "0.74091864", "0.74091864", "0.7308189", "0.72889477", "0.7264628", "0.7240284", "0.7235438", "0.721866", "0.7217812", "0.7214809", "0.7213254", "0.7213254", "0.7213254", "0.7213254", "0.7213254", "0.7213254", "0.7213254", "0.71998173", "0.7199732", "0.7199732", "0.7199732", "0.71779066", "0.7159818", "0.71531105", "0.7152918", "0.71366316", "0.71232563", "0.71189296", "0.71106625", "0.710264", "0.70992917", "0.70992917", "0.7048799", "0.70401603", "0.68453026", "0.68425435", "0.68243206", "0.6818993", "0.67801374", "0.67801374", "0.6763484", "0.6763336", "0.6714875", "0.66902953", "0.66284305", "0.6622974", "0.662085", "0.6585853", "0.65721357", "0.65394914", "0.65224123", "0.64285135", "0.63907224", "0.63907224", "0.6383014", "0.63755155", "0.63744223", "0.6335686", "0.63279384", "0.62792325", "0.6258191", "0.62561715", "0.6244695", "0.6244695", "0.6244695", "0.6189697", "0.60764647", "0.601191", "0.5972439", "0.5969988", "0.59559494", "0.581813", "0.5791154", "0.57381487", "0.57363856", "0.57348955", "0.5695519", "0.56629807", "0.5632708", "0.5609693", "0.5599862", "0.5599862", "0.5599862", "0.5580358", "0.5580358", "0.55762786", "0.5566396", "0.5566291", "0.5562874" ]
0.6352907
66
Users Controller HTTP Request Methods Returns a list of all Users GET /users GET /users.json
def index @users = User.all render json: @users end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users\n get('get_users')\n end", "def list_users\n self.class.get('/users')\n end", "def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end", "def users(args = {})\n get(\"/users.json\",args)\n end", "def users(params = {})\n params.merge!(key: 'users')\n objects_from_response(Code42::User, :get, 'user', params)\n end", "def users(params = {})\n make_get_request('/account/users', params)\n end", "def index\n users = User.all\n json_response(users)\n end", "def all\n result = Client.request(:get, 'users')\n\n if result.is_a?(Result::Success)\n result.body[:users].map { |data| User.new(data) }\n else\n []\n end\n end", "def list\n get('users')['users']\n end", "def list\n response = @client.get(\"/users\")\n response[\"users\"].map {|u| User.new(@client, u) }\n end", "def index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @users.map(&:as_json) }\n\t\tend\n\tend", "def index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t format.html # index.html.erb\n\t\t format.json { render json: @users }\n\t\tend\n\tend", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def all_users(**args)\n params = parameters(args) do\n optional_params\n end\n request(:get, 'users', params)\n end", "def users(params = {})\n response = get('users/lookup.json', params)\n response.map {|user| Croudia::Object::User.new(user) }\n end", "def index\n @users = UserService.all_users\n end", "def list\r\n users = User.all\r\n render json: users\r\n end", "def index\n @users = User.all\n logger.debug(\"user index\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def list\n log \"retrieving users list from #{users_path}\"\n response = identity_client.get(users_path)\n records = JSON.load(response.body)[\"users\"]\n records.map { |record|\n record[\"username\"]\n }.map { |username|\n Raca::User.new(@account, username)\n }\n end", "def users\n\t\trespond_with User.all\n\tend", "def list_users\n @users = User.find(:all)\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def get_users(request); end", "def get_users\r\n # Prepare query url.\r\n _path_url = '/users'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n decoded.map { |element| User.from_hash(element) }\r\n end", "def index\n @users = User.all\n render json: @users, status: :ok\n end", "def list\n\t\t# retrieve all users\n @users = User.find(:all)\n end", "def list_users(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'ListUsers'\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? :marker\n\t\t\targs[:query]['Marker'] = optional[:marker]\n\t\tend\n\t\tif optional.key? :max_items\n\t\t\targs[:query]['MaxItems'] = optional[:max_items]\n\t\tend\n\t\tself.run(args)\n\tend", "def index\n @users = User.users_only.active # only active users\n @users = @users.search( params[:q] ) unless params[:q].blank? # search for term\n @users = @users.page( params[:page] ).per( params[:per_page] ) # paginate\n\n render json: UsersListSerializer.new(@users), status: :ok\n end", "def list\n # ask the user_repository for a list of all the users\n users = @user_repository.all\n # pass that list to the view to display\n @view.list_users(users)\n end", "def index\n\t\tputs \"IN INDEX ACTION OF USERS\"\n\t\tputs params\n\t\t@users = User.paginate(page: params[:page])\n\tend", "def list_users(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'ListUsers'\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 index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n render ActiveModelSerializers::SerializableResource.new(@users,\n each_serializer: UserSerializer\n ).to_json, status: 200\n end", "def all\n response = conn.get do |request|\n request.url \"/v1/admin/users.json\"\n end\n\n response.body[\"users\"].map {|attributes| Nuwe::User.new(attributes)}\n end", "def index\n @users = User.all\n end", "def index\n @users = UserService.getAllUserList\n end", "def get_all_users(params = {})\n res = call_api(:method => :get, :uri => @api_base.merge(\"user\"), :query_params => params)\n return unless res.successful?\n Users.new(res.data)\n end", "def users_list(options = {})\n if block_given?\n Pagination::Cursor.new(self, :users_list, options).each do |page|\n yield page\n end\n else\n get(\"users\", options)\n end\n end", "def list\n\t\t\t# Author\n\t\t\tauthorize! :manage, User\n\n\t\t\t# Get params\n\t\t\tpage \t\t\t= \t(params[:page] || 1).to_i\n\t\t\tper \t\t\t=\t(params[:per] || 24).to_i\n\t\t\tsearch_params \t=\tparams[:search] || {}\n\t\t\torder_params \t= \tparams[:order] || {}\n\n\t\t\t# Get users\n\t\t\tusers = User.list_search_with_params search_params, order_params\n\n\t\t\t# Render result\n\t\t\trespond_to do |f|\n\t\t\t\tf.html {\n\t\t\t\t\trender 'list',\n\t\t\t\t\t\tlayout: 'layout_back',\n\t\t\t\t\t\tlocals: {\n\t\t\t\t\t\t\tusers: \tusers,\n\t\t\t\t\t\t\tpage: \tpage,\n\t\t\t\t\t\t\tper: \tper\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tf.json {\n\t\t\t\t\tusers_in_page = users.page page, per\n\n\t\t\t\t\t# Check if empty\n\t\t\t\t\tif users_in_page.count == 0\n\t\t\t\t\t\trender json: {\n\t\t\t\t\t\t\tstatus: 1\n\t\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t\trender json: {\n\t\t\t\t\t\t\tstatus: 0,\n\t\t\t\t\t\t\tresult: {\n\t\t\t\t\t\t\t\tlist: render_to_string(\n\t\t\t\t\t\t\t\t\tpartial: 'list',\n\t\t\t\t\t\t\t\t\tformats: :html,\n\t\t\t\t\t\t\t\t\tlocals: {\n\t\t\t\t\t\t\t\t\t\tusers: users_in_page\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tpaginator: render_to_string(\n\t\t\t\t\t\t\t\t\tpartial: '/shared/pagination',\n\t\t\t\t\t\t\t\t\tformats: :html,\n\t\t\t\t\t\t\t\t\tlocals: {\n\t\t\t\t\t\t\t\t\t\ttotal: \tusers.count,\n\t\t\t\t\t\t\t\t\t\tper: \tper,\n\t\t\t\t\t\t\t\t\t\tpage: \tpage\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\tend\n\t\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def index\n\t\t@users = User.all\n\tend", "def list_users\n http_get(:uri=>\"/users\", :fields=>x_cookie)\n end", "def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end", "def index\n @users = User.all\n\n respond_with @users\n end", "def index\n json_response(User.all) \n end", "def index\n @users = User.all\n render json: {\n messages: \"Request Successfull!\",\n is_success: true,\n data: { users: @users }\n }\n end", "def index\r\n users = User.all\r\n render json: users\r\n end", "def index\n\t\t@users = User.page(params[:page]).per(10)\n\tend", "def list_users(user_id)\n self.class.get(\"/users/#{user_id}\")\n end", "def users\n self.class.get(\"/user\", @options).parsed_response[\"items\"]\n end", "def show\n @users = User.all\n json_response(@users)\n end", "def get_users_list\n service_response = AdminManagement::Users::UserList.new(params).perform\n render_api_response(service_response)\n end", "def users\n @users = User.find(:all)\n end", "def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend", "def index\n @users = User.all\n\n respond_to do |format|\n format.html\n format.json { render json: @users }\n end\n end", "def index\n @users = User.paginate(page: params[:page])\n end", "def index\r\n @users = User.all\r\n end", "def index\r\n @users = User.all\r\n end", "def index\r\n @users = User.all\r\n end", "def list\n @all_users = User.find(:all)\n end", "def index\n\t\t@users = User.all\n\t\thide_view_action\n\t\tsetup_remove_confirm_message 'users.confirm_delete'\n\t\tsetup_index_title 'users.index.title'\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @users }\n\t\tend\n\tend", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n @users = User.all\n end", "def index\n \t@users = User.all\n\n respond_to do |format| \n format.json { render json: @users }\n end\n end", "def all_users()\n @endpoint = \"/users.json?limit=100\"\n setup_get\n res = @http.request(@req)\n return JSON.load(res.body)[\"users\"].sort_by { |user| user[\"lastname\"] }\n end", "def index\n\t@users = User.all\nend", "def index\n @users = User.all\n respond_with @users\n end", "def index\n @users = User.all\n respond_with @users\n end", "def index\n @users = User.all.paginate(page: params[:page])\n end", "def index\n @title = 'user index'\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\r\n respond_with User.all\r\n end", "def index\n if current_user\n @users = User.all\n render \"index_users.json.jb\"\n else\n render json: []\n end\n end", "def index\n\t\t@users = User.order('name ASC').all\n respond_with(@users)\n end", "def index\n\t\t@users = User.all\n\t\t\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml\t{ render :xml => @users }\n\t\tend\n\tend", "def index\n @users = User.find(:all)\n end", "def index\n @users = User.find(:all)\n end", "def index\n @users = User.find(:all)\n end", "def index\n\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def list\n render json: User.all\n end", "def index\n @users = User.all\n render json: @users, status: :ok\n end", "def index\n @users = User.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def users\n puts \"SEARCH USERS\"\n @users = User.search(params[:q])\n puts \"SEARCH USERS COUNT:#{@users.count}\"\n render :json => @users.as_json(:current_user => current_user)\n end", "def user_list\n\t\tget_call = Curl::Easy.http_get(\"#{@ip_address}:#{@port_2}/v2.0/users/\"\n\t\t) do |curl| curl.headers['x-auth-token'] = @token end\n\t\t\n\t\tputs \"Here is a list of users...\"\n\t\tparsed_json = JSON.parse(get_call.body_str)\n\t\t\n\t\tputs parsed_json\n\t\treturn parsed_json\n\tend", "def index\n @q = apply_scopes(User).all.search(params[:q])\n @users = @q.result(distinct: true).page(params[:page])\n\n respond_with(@users)\n end", "def users\n get(:users)['Users'].map do |details|\n User.new(details['Url'], party: self, details: details)\n end\n end", "def query_users(options={}) path = \"/api/v2/users\"\n get(path, options, AvaTax::VERSION) end", "def index\n \t@users = User.all\n \tend", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end" ]
[ "0.8286488", "0.8226217", "0.8200115", "0.80941004", "0.7992455", "0.79266506", "0.79173476", "0.7858174", "0.7848147", "0.7839271", "0.781122", "0.7797733", "0.778675", "0.77834505", "0.7778145", "0.77396375", "0.7721704", "0.76198006", "0.7615688", "0.7612956", "0.7581192", "0.75752586", "0.7565626", "0.7538087", "0.752531", "0.752488", "0.749869", "0.74930584", "0.7470323", "0.7463716", "0.7459296", "0.7458164", "0.7458164", "0.7458164", "0.7457615", "0.74561816", "0.7438929", "0.7438586", "0.74355906", "0.74325544", "0.7422231", "0.7411591", "0.7411591", "0.7411591", "0.7411591", "0.7411591", "0.7411591", "0.74007225", "0.7396177", "0.73930895", "0.73847973", "0.73836577", "0.7380488", "0.7377571", "0.73752326", "0.7372512", "0.73714334", "0.73598105", "0.7358932", "0.7345427", "0.7344129", "0.7339016", "0.7334744", "0.7334744", "0.7334744", "0.7334331", "0.73295736", "0.73271936", "0.73271936", "0.73271936", "0.73271936", "0.73271936", "0.73271936", "0.73271936", "0.7319885", "0.73189616", "0.72945404", "0.72876155", "0.72863847", "0.72849065", "0.7273538", "0.7266463", "0.7254998", "0.7250139", "0.72495437", "0.72426575", "0.72426575", "0.72426575", "0.72388256", "0.72388256", "0.72372085", "0.7235095", "0.7228953", "0.72270846", "0.72253907", "0.7223562", "0.72196764", "0.7219472", "0.72103244", "0.7209833", "0.7209833" ]
0.0
-1
Returns the user with the specific ID GET /users/1 GET /users/1.json
def show @user = User.find(params[:id]) render json: @user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response[\"user\"]\n end", "def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response.first[1]\n end", "def get_user id, options={}, headers={}\n @connection.get \"users/#{id}.json\", options, headers\n end", "def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end", "def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end", "def get_user(user_id:)\n parse(JSON.parse(connection.get(\"users/#{user_id}\").body))\n end", "def get_user(id)\n @users[id]\n end", "def user(id = 'self')\n get(\"users/#{id}\").user\n end", "def get_user(id, &block)\n get(\"#{@base_url}/user/#{id}/json\", user_mapping, block)\n end", "def get_user(id)\n conn = @client.get do |req|\n req.url \"/api/v2/user/#{id}\"\n req.headers[\"Authorization\"] = @token\n end\n conn.body\n end", "def get_user(id)\n @client.raw('get', \"/config/users/#{id}\")\n end", "def retrieve(user_id:)\n User.new get_request(\"users/#{user_id}\").body.dig(\"user\")\n end", "def user(user_id, params = {})\n make_get_request(\"/users/#{user_id}\", params)\n end", "def get_user_by_id(id)\n $r.hgetall(\"user:#{id}\")\n end", "def user(id = nil)\n id.to_i.zero? ? get('/user') : get(\"/users/#{id}\")\n end", "def user(user_id)\n response = connection.get do |req|\n req.url \"/user/#{user_id}\", simple_params\n end\n response.body[0]\n end", "def get_user(user_id)\n request(Route.new(:GET, '/users/%{user_id}', user_id: user_id))\n end", "def get_user(id)\n begin\n user = JSON.parse(RestClient.get construct_url(\"user/#{id}\"))\n rescue RestClient::ResourceNotFound => e\n @last_error = e.http_body\n @last_error_code = e.http_code\n false\n end\n end", "def show\n user = User.find_by(id: params[:id])\n render json: user, status: :ok\n end", "def get(user_id)\n User.find user_id\n end", "def find_user_by_id(id = 'my', params = {})\n object_from_response(Code42::User, :get, \"user/#{id}\", params)\n end", "def get_user_by_id(id)\n resp = request('getUserByID', {:userID => id})['user']\n resp['username'].empty? ? nil : User.new(self, resp)\n end", "def get_by_id\n \n # the user_id param comes from our route\n user = User.find(params[:user_id])\n \n if user\n render json: user, status: :ok\n else\n render json: { errors: 'User not found' }, status: :not_found\n end\n end", "def get(user_id:)\n path = '/users/{userId}'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'GET',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end", "def user_management_get_single_user id\n # the base uri for api requests\n query_builder = Configuration.BASE_URI.dup\n\n # prepare query string for API call\n query_builder << \"/v1/users/{id}\"\n\n # process optional query parameters\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\n \"id\" => id,\n }\n\n # process optional query parameters\n query_builder = APIHelper.append_url_with_query_parameters query_builder, {\n \"client_id\" => @client_id,\n \"client_secret\" => @client_secret,\n }\n\n # validate and preprocess url\n query_url = APIHelper.clean_url query_builder\n\n # prepare headers\n headers = {\n \"user-agent\" => \"IAMDATA V1\",\n \"accept\" => \"application/json\"\n }\n\n # invoke the API call request to fetch the response\n response = Unirest.get query_url, headers:headers\n\n # Error handling using HTTP status codes\n if response.code == 401\n raise APIException.new \"Unauthorized\", 401, response.raw_body\n elsif response.code == 404\n raise APIException.new \"Not Found\", 404, response.raw_body\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\n end\n\n response.body\n end", "def user(user_id = nil)\n user_id = username if user_id.nil? || user_id == \"\"\n if user_id.to_i.to_s == user_id.to_s\n users = connection.get(connection.build_url('users', :userids => user_id)).body\n else\n users = connection.get(connection.build_url('users', :logins => user_id)).body\n end\n users.map!{|hash| hash.values.first}\n users.first\n end", "def get_user\n @user = User.find_by_id(params[:id])\n if @user \n return @user\n else \n render json: {\"message\": {\"type\": \"error\", \"content\": \"The user could not be found!\"}}\n end\n end", "def user(id:)\n User.find(id)\n end", "def user(id)\n target = \"#{self.base_url}/user/#{id.to_s}/\"\n self.class.get(target, {basic_auth: self.auth})\n end", "def user(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"users/#{id}\", params)\n end", "def find_user_by_id(id)\n users.find_by_id(id)\n end", "def show\n user = User.select(:id, :username, :email).find(params[:id])\n render :json => user\n end", "def get_user(users, id)\n user = users.select { |f| f[:id] == id }\n user.first\n end", "def get_user(id)\r\n # Prepare query url.\r\n _path_url = '/users/{id}'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'id' => id\r\n )\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n UserDetail.from_hash(decoded)\r\n end", "def show_user(id)\n BrickFTP::API::User.find(id)\n end", "def show_user(id)\n BrickFTP::API::User.find(id)\n end", "def get_user(user_id)\n return User.find(user_id)\n end", "def find_user_by_id(id)\n User.find(id)\n end", "def user(user_id)\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n get(\"users/#{user_id}.json\", params)\n end", "def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end", "def get_user_byid(id)\n @user = User.find_by_id(id)\n end", "def account_user(id)\n get(\"accountuser/#{id}\")\n end", "def get_user(id, accountId, options={}) path = \"/api/v2/accounts/#{accountId}/users/#{id}\"\n get(path, options, AvaTax::VERSION) end", "def show_by_id\n user = User.get_user_by_id(params[:id]) # Obtain the user corresponding to the id\n\n if user != nil # If exist the user in DB\n response = { content: user, message: \"User has been obtained successfully\", status: 200 } # Return the corresponding user\n\n render json: response, status: 200\n else # If not exist data\n response = { content: {}, message: \"User not found\", status: 404 }\n\n render json: response, status: 404 # Return 'not found'\n end\n end", "def show\n user = User.find(params[:id])\n render json: user\n end", "def fetch_user(id)\n client.user(id)\n end", "def user\n Webmetrics.users.find_one('_id' => id)\n end", "def get_user_details\n @user = User.find_by_id(params[:user_id])\n render json: @user\n end", "def user user_id, options = {}\n perform_get_with_object(\"/users/#{user_id}\", options, Vimeo::Entities::User)\n end", "def show\n @user = UserService.getUserById(params[:id])\n end", "def user(id)\n Bibliovore::User.new(\n get_endpoint(\"users/#{id}\", 'user'), self\n )\n end", "def get \n render :json => User.find(params[:id])\n end", "def show\n id = params[:id]\n if current_user.id == params[:id].to_i \n @user = current_user\n else\n @user = current_user.find(id)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def find_user(user_id)\n user = User.find(user_id)\n user\n end", "def show\n user = User.find(params[:id])\n render json: user\n end", "def show\n user_id = params.require(:id).to_i\n\n if user_id != current_user.id\n bad_request\n else\n @user = User.find(user_id)\n if @user\n success(body: @user)\n else\n not_found\n end\n end\n end", "def show\n user = User.find(params[:id])\n\n render json: user\n end", "def user(user_id_or_url = nil, options = {})\n options = make_options(:user_id, user_id_or_url, options)\n get(options)\n end", "def show\n\t\t@user = User.find(params[:id]) rescue nil\n\t\tif @user\n\t\t\tapi_response(@user, 'User Details', :ok)\n\t\telse\n\t\t\tapi_response(nil, 'User id not present in the database', :bad_request)\n\t\tend\n\tend", "def show\n user = User.find_by(uid: params[:id])\n if user\n puts 'USER FOUND'\n render json: user\n else\n puts 'NO USER'\n render json: 'no user'.to_json\n end\n end", "def show\n render json: User.find(params[\"id\"])\n end", "def user(id)\n @users[id.resolve_id]\n end", "def show\n user = User.friendly.find(params[:user_id]) \n render json: user\n end", "def get\n\t\t\t\tparams.required(:id)\t\n\n\t\t\t\t# Grab the service that is trying to authenticate\n unathenticated_error unless @api_consumer.is_a? Service\n service = @api_consumer\n\n\t\t\t\t@user = service.users.find params[:id]\n\t\t\tend", "def get_user_byid(id)\n # accept an id input parameter\n # use the User Model class to get the User associated with the `id` primary key\n # return the User instance that matches the provided id\n @user = User.find_by(:id => id)\n @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show \n user = User.find_by(id: params[:id])\n if !user.blank?\n render status: 200, json: {\n message:\"Found User\",\n response: {\n name: user.name,\n email: user.email,\n id: user.id\n }\n }.to_json\n else \n render status: 404, json: {\n errors: \"Can't Find User\"\n }.to_json\n end \n end", "def find_user_by_id\n if !User.exists? id: params[:id]\n render json: { errors: { user: [\"does not exist\"] } }, status: 422\n end\n end", "def show\n user = User.find(params[:id])\n render json: user\n end", "def show\n render json: User.find(params[:id])\n end", "def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end", "def show\n @user = User.get(params[:id]) \n end", "def view_user(params)\n user_id = params.delete(:user_id)\n raise ArgumentError.new(\"user_id required\") unless user_id\n res = call_api(:method => :get, :uri => @api_base.merge(\"user/#{user_id}\"), :query_params => params)\n return unless res.successful?\n User::Person.new(res.data)\n end", "def get(user_id)\n get_request(t_url(:user, user_id))\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def show\n if !params[:id]\n @user = current_user\n else\n @user = User.find_by_username(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user_id = UserId.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_id }\n end\n end", "def show\n user = User.find_by(id: params[:id])\n if user\n render json: {status: 200, user: user}\n else\n render json: {status: 500, message: user.errors.full_messages}\n end\n end", "def show\n if params[:id].to_i.to_s == params[:id]\n @user = User.find(params[:id])\n else\n @user = User.find_by(username: params[:id])\n end\n end", "def show\r\n user = User.find(params[:id])\r\n if user.nil?\r\n render json: {error: true, message: \"User not found\"}\r\n else\r\n render json: user\r\n end\r\n end", "def show\n @user = User.find(params[:id])\n render json:@user\n end", "def show\n @user = User.find(params[:id])\n render json:@user\n end", "def show\n @user = User.find(params[:id])\n if @user\n render json: {\n user: @user\n }\n else\n render json: {\n status: 500,\n errors: ['user not found']\n }\n end\n end", "def get_user \n @user = User.find(params[:id])\n end", "def get_user\n @user = User.find(params[:user_id])\n end", "def byUid\n @user = User.find(:all, :conditions => [ \"uid = ?\" , params[:id]])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n user = User.find(params[:id])\n render json: @user\nend" ]
[ "0.8705296", "0.8546368", "0.853986", "0.8514078", "0.8329413", "0.82746834", "0.8237801", "0.81001085", "0.80971336", "0.80551195", "0.8019696", "0.8013668", "0.8001796", "0.7932169", "0.792641", "0.7896633", "0.78872395", "0.7872276", "0.7864672", "0.7859307", "0.7845869", "0.7844285", "0.7840926", "0.78094727", "0.78010815", "0.7800118", "0.7792345", "0.7774317", "0.7754039", "0.7744597", "0.772309", "0.7715946", "0.7699063", "0.7689553", "0.76892614", "0.76892614", "0.76479405", "0.7586974", "0.75824237", "0.7573989", "0.75717926", "0.75602925", "0.755819", "0.7554216", "0.75485295", "0.74875665", "0.7472003", "0.74601257", "0.7450415", "0.7412295", "0.7391551", "0.7390804", "0.73855007", "0.7352702", "0.7345498", "0.7342386", "0.733286", "0.73289335", "0.7324726", "0.7321681", "0.7300654", "0.7300545", "0.7300135", "0.72922766", "0.7292265", "0.7289487", "0.7289487", "0.7289487", "0.7289487", "0.7289487", "0.7289487", "0.7289487", "0.72573656", "0.7239678", "0.7228325", "0.7224798", "0.7223937", "0.72238755", "0.7220899", "0.7217549", "0.7202645", "0.720101", "0.72008574", "0.7199674", "0.71949244", "0.7190199", "0.71901584", "0.71901584", "0.71862847", "0.7175991", "0.71745497", "0.7167798", "0.71644044" ]
0.72758406
77
Creates a new user with data in the POST body POST /users POST /users.json
def create @user = User.new(user_params(params)) if @user.save render json: @user, status: :created, location: @user else render json: @user.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end", "def create\n user = User.new(user_params)\n if user.save\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end", "def create_user(params:)\n parse(JSON.parse(connection.post(\"users\", params.to_json).body))\n end", "def create\n user = User.new(user_params)\n\n respond_to do |format|\n if user.save\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n user = User.create(user_params)\n if user.save\n render json: user\n else\n render json: user.errors, status: :bad\n end\n end", "def create_user\n @user = User.new(user_params)\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create_user(options = {})\n post \"/users\", options\n end", "def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\trender json: @user, status: :created, location: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: { error: I18n.t('user_create_error') }, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n \n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n user = User.create(user_params)\n render json: user, message: 'user succefully create', status: 200\n end", "def create\n user = User.new(user_params)\n if user.save\n render json: {status: \"Se creo el usuario\"}, status: :ok\n else\n render json: {status: \"Error al crear el usuario\", errors: user.errors }, status: :unprocessable_entity\n end\n end", "def create\n user = User.create(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors, status: :unprocessable_entity\n end\n end", "def create\n \n user = User.new(user_params)\n\n if user.save\n\n render json: {status: 200, msg: 'User was created.'}\n\n else \n render json: {\n errors: user.errors.full_messages\n }, status: :unprocessable_entity\n\n end\n\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n user = User.new(user_params)\n render json: { status: 200, msg: 'User was created.', data: \"User Id #{user.id}\" } if user.save\n end", "def create\n user = User.new(user_params)\n if user.save\n render json: {status: 200, msg: 'User was created.'}\n else\n render json: {errors: user.errors.messages}\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params(params))\n \n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\tputs user_params\n\t\tuser = User.new(user_params)\n\t\tif user.save\n\t\t\trender json: { user: user, status: :success }\n\t\telse\n\t\t\trender json: { status: :failure, errors: user.errors.full_messages.join('') }\n\t\tend\n\tend", "def create\n\n up = user_params\n\n if up[:name].present?\n up[:first_name] = up[:name].split(' ')[0]\n up[:last_name] = up[:name].split(' ')[1]\n up.delete :name\n end\n @user = User.new(up)\n\n respond_to do |format|\n if @user.save\n # render json: {user: user, token: token}\n\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: api_user_url(@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\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 create_user(attributes)\n post(\"/v1/users\", attributes)\n end", "def create\n @user = User.new user_params(params[:user])\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new user_params(params[:user])\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n user = User.new(@user_info)\n if user.save && user.errors.empty?\n render json: { status: 200, data: UserSerializer.new(user).as_json }\n else\n render json: { status: 400, error: user.errors.full_messages }\n end\n end", "def create\n user = User.new(user_params)\n if user.save\n render :json => user, :status => :created\n else\n render :json => {:ok => false, :message => user.errors}, :status => :unprocessable_entity\n end\n end", "def create\n\t\t@user = User.new(users_params)\n\t\tif @user.save\n\t\t\tjson_response(@user, \"User is created Successfully.\")\n\t\telse\n\t\t\trender json: {message: @user.errors.full_messages.join(\" \")}, status: 400\n\t\tend\t\t\n\tend", "def create\n user = User.create(user_params) \n render json: user, status: :created\n end", "def create\n\t\tnew_user = User.new(user_params)\n\t\tif new_user.save\n\t\t render status: 200, json: {\n\t\t \tstatus: 200,\n\t\t message:\"New User Created\",\n\t\t response: {\n\t\t name: new_user.name,\n\t\t email: new_user.email,\n\t\t id: new_user.id,\n\t\t facebook_id: new_user.facebook_id,\n\t\t device_id: new_user.device_id,\n\t\t authentication_token: new_user.authentication_token\n\t\t }\n\t\t \n\t\t }.to_json\n\t\telse\n\t\t render status: 404, json: {\n\t\t \tstatus: 404,\n\t\t errors: new_user.errors\n\t\t }.to_json\n\t\tend\n\tend", "def create\n logger.debug user_params\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :not_acceptable\n end\n end", "def create_user(body)\n post 'create_user', body\n end", "def create(user_id:, email: nil, phone: nil, password: nil, name: nil)\n path = '/users'\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n userId: user_id,\n email: email,\n phone: phone,\n password: password,\n name: name,\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'POST',\n path: path,\n headers: headers,\n params: params,\n response_type: Models::User\n )\n end", "def create\n user = User.new(user_params)\n if user.save\n render json: { status: 'OK', msg: 'User was created.', error: 'nil' },\n status: :created\n else\n not_good(422)\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n render json: { user: @user, success: 'User registration successful' }\n else\n render json: { error: 'User registration unsuccessful' }\n end\n end", "def create\n @user = User.new(user_params)\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, 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.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, 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.new(user_params)\n\n if @user.save\n render :show, status: :created\n else\n render json: { errors: @user.errors }, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\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 json: @user, status: :created }\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.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, 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 end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, 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 end", "def create\n user = User.new(user_params)\n \n if user.save\n token = JsonWebToken.encode(user_id: user.id)\n render json: { auth_token: token, user: AuthUserSerializer.new(user).serializable_hash }, status: 201\n else \n render json: { errors: user.errors.full_messages }, status: 400\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n \tdata = { data: @user, status: :created, message: \"User was successfully created.\" }\n render :json => data\n else\n \tdata = { data: @user.errors, status: :unprocessable_entity }\n render :json => data\n end\n end", "def create\n @user = User.new(user_params)\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.new(user_params)\n\n if user.valid?\n user.save\n render json: {user: user, token: encode_token({user_id: user.id})}\n else\n render json: {error: \"Failed to create the user\"}\n end\n end", "def create\n @user = User.create user_params\n \n if @user.save\n respond_with(@user) do |format|\n format.json {render}\n end\n end\n end", "def create\n @user = User.new(params[:user])\n \n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n \n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, :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 end", "def create\n @user = User.new(user_attributes)\n if @user.save\n created(@user)\n else\n validation_errors(@user)\n end\n end", "def create\n @user = User.new(form_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: { users: @user }, status: :created }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n puts '-----------------------create in user controller'\n\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n\n end", "def create\n @user = User.new(params[:user])\n\t\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 end", "def create\n @user_user = User::User.new(user_user_params)\n\n respond_to do |format|\n if @user_user.save\n format.html { redirect_to @user_user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user_user }\n else\n format.html { render :new }\n format.json { render json: @user_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n logger.debug(\"user create\")\n @user = User.new(params[:user])\n respond_to do |format|\n if @user.save\n format.html { redirect_to home_path, 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 end", "def create(options = {})\n request(:post, '/users.json', default_params(options))\n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n render.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\t\t\t\t@user = User.create!(create_user_params)\n\t\t\tend", "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 create\n @user = User.new(user_params)\n\n if @user.save\n respond_with(@user, location: users_url, notice: 'User was successfully created.')\n else\n respond_with(@user)\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to root_path, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created}\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user.as_json(only: [:email, :authentication_token]), status: :created\n else\n head(:unprocessable_entity)\n end\n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to edit_user_url(@user), notice: 'User was successfully created.' }\n format.json { render :edit, 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 r = @api.create_user(user_params)\n respond_to do |format|\n if r.code == 201\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n else\n response = JSON.parse(r.body)\n format.html { redirect_to users_url, alert: response['message']}\n end\n end\n end", "def create\n\n @user = User.new(params[:user])\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 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 end", "def create\n @user = User.new(params[:user])\n if @user.save\n redirect_to users_path\n else\n redirect_to new_user_path\n end\n end", "def create\n params[:user][\"_id\"] = params[:user][:name]\n @user = User.new(params[:user])\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 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 end", "def create\n @user = User.new(params[:user])\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 :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 end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to user_url(@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.new(user_params)\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.new(user_params)\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.new(user_params)\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.new(user_params)\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.new(user_params)\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.new(user_params)\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.new(user_params)\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.new(user_params)\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.new(user_params)\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.new(user_params)\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.new(user_params)\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.new(user_params)\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.new(user_params)\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.new(user_params)\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.new(user_params)\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.new(user_params)\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.new(user_params)\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.new(user_params)\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.new(user_params)\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.new(user_params)\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.new(user_params)\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.new(user_params)\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.new(user_params)\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.new(user_params)\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.new(user_params)\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.new(user_params)\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" ]
[ "0.837674", "0.83123714", "0.83068573", "0.8284226", "0.8262974", "0.82519037", "0.82277703", "0.81871957", "0.8186128", "0.816766", "0.8167242", "0.81608427", "0.8152632", "0.8146575", "0.81424874", "0.81369233", "0.8123216", "0.8115891", "0.81088287", "0.81073755", "0.80881417", "0.8085063", "0.8065171", "0.8055766", "0.80529636", "0.8043663", "0.8043663", "0.80409694", "0.80409694", "0.80409694", "0.80384606", "0.801295", "0.80121446", "0.8003705", "0.7992331", "0.7977083", "0.79749864", "0.79738975", "0.7966658", "0.7918588", "0.79160166", "0.7910897", "0.7905937", "0.7904784", "0.7903506", "0.79028374", "0.79017365", "0.78941005", "0.78856266", "0.78792936", "0.78716964", "0.7871487", "0.7864155", "0.7858756", "0.7848585", "0.78324986", "0.78233296", "0.7821431", "0.7816371", "0.7816317", "0.7808036", "0.78078425", "0.7807402", "0.78029335", "0.7801553", "0.7800443", "0.7798631", "0.77900106", "0.77883434", "0.7784448", "0.77820206", "0.77762836", "0.77760005", "0.7768873", "0.7768093", "0.7768093", "0.7768093", "0.7766663", "0.7766663", "0.7766663", "0.7766663", "0.7766663", "0.7766663", "0.7766663", "0.7766663", "0.7766663", "0.7766663", "0.7766663", "0.7766663", "0.7766663", "0.7766663", "0.7766663", "0.7766663", "0.7766663", "0.7766663", "0.7766663", "0.7766663", "0.7766663", "0.7766663" ]
0.80172586
32
Updates a user with data in the PUT body PATCH/PUT /users/1 PATCH/PUT /users/1.json
def update @user = User.find(params[:id]) if @user.update(user_params(params)) head :no_content else render json: @user.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n @user.update(user_params_update)\n json_response(@user)\n end", "def update\n @user = current_user\n if @user.update(update_user_params)\n render 'api/v1/users/show'\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n user = find_user\n user.update!(user_params)\n render json: user\n end", "def update\n respond_to do |format|\n if user.update(user_params)\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.json { head :ok }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if user.update(user_params)\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end", "def update_user(user, options = {})\n put \"/users/#{user}\", options\n end", "def update\n if @user\n @user.update(user_params)\n render json: @user, serializer: UserSerializer, message: 'user succefully update', status: 200\n else\n render json: { error: 'unable update' }, status: 400\n end\n end", "def update\n\t\tif @user.update(user_params)\n\t\t\trender json: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend", "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n if params[:id]\n @user = User.find(params[:id])\n else\n @user = current_user\n end\n\n respond_to do |format|\n if @user.id == current_user.id and @user.update_attributes(User.from_params(params))\n format.json { head :no_content }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: user\n else\n render json: user.errors.full_messages\n end\n end", "def update\n user = User.find(params[:id])\n\n # Use update with user_params to do a mass-assignment update and save. \n if user.update_attributes(user_params)\n render json: user\n else \n render json: user.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: {error: \"Could not update user\"}\n end\n end", "def update_user\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status :unprocessable_entity\n end\n end", "def update\n if @user.update(user_params)\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update_user(options)\n patch(\"/user\", options, 3)\n end", "def update\n @user = current_api_user\n unless @user.update(user_params)\n render json: { error: @user.errors.full_messages.to_sentence }, status: :not_found\n end\n end", "def update\n if @user.update(user_params)\n render json: @user, status: 200\n else\n render json: @user.errors, status: 422\n end\n end", "def update\n user = User.find_by(id: params[:id])\n user.update(user_params)\n render json: user\n end", "def update\n if @user.id == current_api_user.id\n if @user.update(user_params)\n render json: @user.as_json(except: [:updated_at]), status: :ok\n else\n render json: @user.errors, status: :bad_request\n end\n else\n render json: '', status: :forbidden\n end\n end", "def update\n if @user.update(user_params)\n respond_with(@user, location: users_url, notice: 'User was successfully updated.')\n else\n respond_with(@user)\n end\n end", "def update\n if @user.update(user_params)\n render json: @user, status: :ok, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\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 = user.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "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 = User.find(params[:id])\n\n if @user.update user_params(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id]) \n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User #{@user.name} was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params[:user]))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { render action: \"edit\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_path, :notice => 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "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 edit_user_path(@user), :notice => 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to user_path(@user), notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n \trespond_to do |format|\n if @user.update(user_params)\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n\t \t\n end", "def update\n @user = User.find(params[:id])\n \n respond_to do |format|\n if @user.update_attributes(user_params)\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 respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to users_path }\n format.json { render :json => @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: {\n status: 'OK',\n msg: 'User details have been updated.',\n error: 'nil'\n }, status: :accepted\n else\n not_good(406)\n end\n end", "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { head :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 update\n # not_found unless @user\n # @user = User.get(params[:id]) || not_found\n\n respond_to do |format|\n if @user.update(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n \t@user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(user_params)\n format.html { redirect_to users_url, 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 modify_user(user)\n query_api_object Model::User, '/rest/user', user.to_hash, 'PUT'\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 @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 update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "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\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = get_user(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to root_url, notice: \"User #{@user.login_name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = ::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end", "def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\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 @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 update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.8303187", "0.8248406", "0.82054526", "0.81798065", "0.8134207", "0.809614", "0.80682826", "0.80568343", "0.8042508", "0.8020912", "0.799587", "0.799587", "0.79676855", "0.79637045", "0.796057", "0.7959517", "0.7951013", "0.7947392", "0.7942937", "0.79337895", "0.79263794", "0.7918856", "0.79186726", "0.7915627", "0.7900954", "0.7899755", "0.78953874", "0.7893108", "0.7883319", "0.78792894", "0.78628945", "0.7861466", "0.78606904", "0.7855274", "0.7855274", "0.7846862", "0.7841655", "0.7840287", "0.78380203", "0.7832656", "0.7821683", "0.78130007", "0.78121334", "0.78073764", "0.77996504", "0.77996504", "0.77996504", "0.77996504", "0.77996504", "0.77996504", "0.77996504", "0.77996504", "0.77996504", "0.77996504", "0.77996504", "0.77996504", "0.77996504", "0.7797131", "0.77962863", "0.77893335", "0.7789227", "0.7786886", "0.778086", "0.778086", "0.77786094", "0.77759993", "0.7775468", "0.7770321", "0.77635187", "0.77634305", "0.7762001", "0.7762001", "0.7761018", "0.7758178", "0.7758178", "0.7758178", "0.7758178", "0.7758178", "0.7758178", "0.7758178", "0.7758178", "0.7758178", "0.7758178", "0.7758178", "0.7758178", "0.7758178", "0.7758178", "0.7758178", "0.7758178", "0.7758178", "0.7758178", "0.7758178", "0.7758178", "0.7758178", "0.7758178", "0.7758178", "0.7758178", "0.7758178", "0.7758178", "0.7758178", "0.7758178" ]
0.0
-1
Deletes the user with the specific ID DELETE /users/1 DELETE /users/1.json
def destroy @user = User.find(params[:id]) @user.destroy head :no_content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end", "def delete user_id, options={}, headers={}\n @connection.delete \"users/#{user_id}.json\", options, headers\n end", "def delete(user_id)\n self.class.delete(\"/#{@api_ver}/users/#{user_id}\", default_options_to_merge_with)\n end", "def delete_user(id)\n get_user_byid(id).destroy\n end", "def delete_user(id)\n elektron_identity.delete(\"users/#{id}\")\n end", "def delete_user(user_id:, params:)\n connection.delete(\"users/#{user_id}\", params).body\n end", "def delete_user(id)\n @user = User.destroy(id)\n end", "def delete_user(user_id)\n raise Auth0::MissingUserId, 'Must supply a valid user_id' if user_id.to_s.empty?\n path = \"#{users_path}/#{user_id}\"\n delete(path)\n end", "def delete(id)\n begin\n User.filter(:id => id).destroy\n flash[:success] = 'The specified user has been removed'\n rescue => e\n Ramaze::Log.error(e)\n flash[:error] = 'The specified user could not be removed'\n end\n\n redirect_referrer\n end", "def user_delete(user_id)\n\t\tdelete_call = Curl::Easy.http_delete(\"#{@ip_address}:#{@port_2}/v2.0/users/#{user_id}\"\n\t\t) do |curl|\n\t\t\tcurl.headers['x-auth-token'] = @token\n\t\t\tcurl.headers['userId'] = user_id\n\t\tend\n\t\n\tend", "def delete(user_id:)\n path = '/users/{userId}'\n .gsub('{userId}', user_id)\n\n if user_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"userId\"')\n end\n\n params = {\n }\n \n headers = {\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'DELETE',\n path: path,\n headers: headers,\n params: params,\n )\n end", "def destroy\n user = User.find(params[:id]) # from url, nothing to do with table\n user.destroy\n render json: user\n end", "def delete_user(id)\n # accept an id input parameter\n # use the User Model class to remove the User associated with the `id` primary key from the database\n # (no return is required)\n (User.find_by(id: id)).destroy\n end", "def delete_user\n client.delete(user)\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 call(id)\n client.delete(\"/api/rest/v1/users/#{id}.json\")\n true\n end", "def user_management_delete_user id\n # the base uri for api requests\n query_builder = Configuration.BASE_URI.dup\n\n # prepare query string for API call\n query_builder << \"/v1/users\"\n\n # process optional query parameters\n query_builder = APIHelper.append_url_with_query_parameters query_builder, {\n \"id\" => id,\n \"client_id\" => @client_id,\n \"client_secret\" => @client_secret,\n }\n\n # validate and preprocess url\n query_url = APIHelper.clean_url query_builder\n\n # prepare headers\n headers = {\n \"user-agent\" => \"IAMDATA V1\",\n \"accept\" => \"application/json\"\n }\n\n # invoke the API call request to fetch the response\n response = Unirest.delete query_url, headers:headers\n\n # Error handling using HTTP status codes\n if response.code == 404\n raise APIException.new \"Not found\", 404, response.raw_body\n elsif response.code == 401\n raise APIException.new \"Unauthorized\", 401, response.raw_body\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\n end\n\n response.body\n end", "def delete\n user = User.delete_user(params[:id]) # Delete an existing user\n\n if user != nil # If the user was deleted successfully\n response = { content: user, message: \"User has been deleted successfully\", status: 200 } # Return the corresponding user\n\n render json: response, status: 200\n else # If the user was not destroyed\n response = { content: {}, message: \"User not found\", status: 404 } \n\n render json: response, status: 404 # Return 'not found'\n end\n end", "def user_delete(user_id)\n res = http_delete(:uri=>\"/users/#{user_id}\", :fields=>x_cookie)\n return res.code\n end", "def destroy\n @user = User.find_by_id_or_username params[:id]\n @user.destroy\n render api_delete @user\n end", "def delete_user(id)\n\n db = connect_to_db(\"db/db.db\")\n\n db.execute(\"DELETE FROM posts WHERE user_id = ?\", id)\n \n db.execute(\"DELETE FROM users WHERE id = ?\", id)\n\n end", "def delete\n @user = User.find(params[:id])\n end", "def delete\n @user = User.find(params[:id])\n end", "def destroy\n @user = get_user(params[:id])\n begin\n @user.destroy\n flash[:notice] = \"User #{@user.login_name} deleted\"\n rescue Exception => e\n flash[:notice] = e.message\n end\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n user = User.find(params[:id])\n user.destroy\n head :no_content\n end", "def delete_user\n @user = User.find(params[:id])\n if @user.destroy\n render :json => @user\n else\n render :json => @user.errors.full_messages\n end\n end", "def delete_user(id)\r\n # Prepare query url.\r\n _path_url = '/users/{id}'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'id' => id\r\n )\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.delete(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n Message.from_hash(decoded)\r\n end", "def delete\n @user = User.find(params[:id])\n @user.delete\n redirect_to root_path\n end", "def delete_by_id(user_id)\n Iterable.request(conf, \"/users/byUserId/#{user_id}\").delete\n end", "def delete_account_user(id)\n post(\"accountuser/#{id}?_method=DELETE\")\n end", "def delete_user( user_id )\n\n raise ArgumentError.new(format('wrong type. user \\'user_id\\' must be an String (for an User name) or an Integer (for an User Id), given \\'%s\\'', user_id.class.to_s)) \\\n if( user_id.is_a?(String) && user_id.is_a?(Integer) )\n raise ArgumentError.new('missing \\'user_id\\'') if( user_id.size.zero? )\n\n if(user_id.is_a?(String))\n usr = user(user_id)\n user_id = usr.dig('id')\n end\n\n return { 'status' => 404, 'message' => format( 'No User \\'%s\\' found', user_id) } if( user_id.nil? )\n return { 'status' => 403, 'message' => format( 'Can\\'t delete user id %d (admin user)', user_id ) } if( user_id.is_a?(Integer) && user_id.to_i.zero? )\n\n endpoint = format('/api/admin/users/%d', user_id )\n logger.debug( \"Deleting user id #{user_id} (DELETE #{endpoint})\" ) if @debug\n\n delete( endpoint )\n end", "def delete\n connection.delete_user id\n nil\n end", "def destroy\n @user = user.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n \n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n logger.debug(\"user destroy\")\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n user = User.find(params[:id])\n if user.destroy\n response_data = {\n status: 'success',\n user: user,\n }\n else\n response_data = {\n status: 'error',\n }\n end\n render json: response_data, status: :ok\n end", "def delete_user\n User.delete(params[:id])\n render :text => \"\"\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 destroy\n\t\t@user = User.find params[:id]\n\t\t@user.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to users_url }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "def delete\n render json: User.delete(params[\"id\"])\n end", "def destroy\n @user = V1::User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(v1_users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n \tuser = User.find params[:id]\n \tuser.destroy\n\n \tredirect_to users_path, status: 303\n end", "def destroy\n user = User.find(params[:id])\n user.destroy\n redirect_to users_path, :notice => \"User deleted.\"\n end", "def destroy\n @user = User.find(params[:id])\n begin\n @user.delete\n flash[:notice] = \"User #{@user.fullname} deleted\"\n rescue Exception => e\n flash[:notice] = e.message\n end\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n User.find(params[:id]).destroy\n respond_to do |format|\n flash[:success] = \"User was successfully deleted.\"\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def delete\n @user.destroy\n respond_to do |format|\n format.html { redirect_to v1_resources_users_all_path, notice: 'User was deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n begin\n user = User.find(params[:user_id])\n if user.destroy\n render body: nil, status: 204\n else\n render json: { errors: user.errors.messages }, status: 422\n end\n rescue => e\n render json: { errors: e.message }, status: 404\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:user_id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find_by_id(params[:id])\n @user.destroy\n end", "def destroy\n @user = User.find(params[:id])\n begin\n @user.destroy\n flash[:notice] = \"User #{@user.name} deleted\"\n rescue Exception => e\n flash[:notice] = e.message\n end\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def remove_user\n query_api \"/rest/user\", nil, \"DELETE\"\n end", "def destroy\n @user = User.find(params[:id]).destroy\n flash[:success] = \"User deleted!\"\n redirect_to users_url\n end", "def destroy\n user = User.find(params[:id])\n user.destroy\n redirect_to users_path\n end", "def destroy\n if User.find(params[:id]).destroy\n render status: :ok,\n json: {\n status: :ok\n }\n end\n end", "def destroy\n user = User.find_by_id(params[:id])\n if user != nil\n @user = user\n user.destroy\n end\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 delete_user(user)\n delete user_path(user)\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to dm_core.admin_users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted.\"\n redirect_to users_url\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n record_activity(\"deleted user: \" + @user.email)\n redirect_to users_path, :notice => \"User deleted\"\n end", "def destroy\n @user = User.find(params[:id])\n\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted.\"\n redirect_to users_url\n end", "def destroy\n User.find(params[:id]).destroy\n flash[:success] = \"User deleted.\"\n redirect_to users_url\n end", "def destroy\n user = User.get(params[:id])\n user.destroy if user\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @users = User.find(params[:id])\n if @users.destroy\n render json: { status: 200, msg: 'User has been deleted.' }\n end\n end", "def remove_user\n query_api '/rest/user', nil, 'DELETE'\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.8989289", "0.8844713", "0.86481804", "0.8501752", "0.84544957", "0.83500093", "0.8301986", "0.82395816", "0.81958026", "0.81577766", "0.81554115", "0.81507814", "0.81396246", "0.8139492", "0.8123947", "0.8087602", "0.808041", "0.8075921", "0.8057377", "0.80557734", "0.8050001", "0.7999304", "0.79795384", "0.79795384", "0.7966438", "0.7944441", "0.79170626", "0.7913405", "0.79077137", "0.7906264", "0.7891655", "0.7885305", "0.787847", "0.78738874", "0.78690434", "0.7867484", "0.78612345", "0.78557634", "0.7855408", "0.7850493", "0.7845073", "0.78389835", "0.7819073", "0.7806906", "0.7804774", "0.7801969", "0.7795497", "0.77921295", "0.77921295", "0.77921295", "0.77921295", "0.77921295", "0.77921295", "0.77921295", "0.77921295", "0.77921295", "0.77921295", "0.77921295", "0.77921295", "0.77921295", "0.77921295", "0.77921295", "0.77921295", "0.77921295", "0.7786001", "0.7773574", "0.77728444", "0.77664554", "0.7762061", "0.77590615", "0.77549857", "0.77535844", "0.7753002", "0.77469677", "0.77445674", "0.77436304", "0.77436036", "0.7740431", "0.77398956", "0.7737648", "0.7737648", "0.77371454", "0.773316", "0.77325505", "0.7732408", "0.77321935", "0.7732083", "0.7732083", "0.7732083", "0.7732083", "0.7732083", "0.7732083", "0.7732083", "0.7732083", "0.7732083", "0.7732083", "0.7732083", "0.7732083", "0.7732083", "0.7732083", "0.7732083" ]
0.0
-1
Returns a list of specified user's splatts GET /users/splatts/1 GET /users/splatts/1.json
def splatts @user = User.find(params[:id]) render json: @user.splatts end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def splatts\n \t@user = User.find(params[:id])\n \t\n \trender json: @user.splatts\n end", "def splatts_feed\n \t@feed = Splatt.find_by_sql(\"SELECT user_id, body, created_at FROM splatts JOIN follows ON follows.followed_id = splatts.user_id WHERE follows.follower_id = '#{params[:id]}' ORDER BY splatts.created_at\")\n \t\n \trender json: @feed\n end", "def splatts_feed\n\t@feed = Splatt.find_by_sql(\"SELECT splatts.user_id, splatts.body, splatts.created_at FROM splatts JOIN follows ON follows.followed_id = splatts.user_id WHERE follows.follower_id = #{params[:id]} ORDER BY splatts.created_at\")\n\t\n\trender json: @feed\nend", "def show\n @spot = Spot.find(params[:id])\n @users = UserSpots.find_all_by_spot_id(params[:id])\n @profiles = []\n @users.each { |item| @profiles << Profile.find_by_user_id(item.user_id) }\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: [@spot, @profiles] }\n end\n end", "def user_list\n @snippets = Snippet\n .where(user: current_user)\n .paginate(page: params[:page], per_page: 30)\n .order(created_at: :desc)\n render 'user_list'\n end", "def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend", "def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend", "def get_lists(user)\n get(\"/#{user}/lists.json\")\n end", "def index\n if (current_user.has_role? :admin) && params[:user_id].present?\n user = User.find_by_id(params[:user_id])\n if user.present?\n @spends = user.spends\n else\n flash[:notice] = \"Invalid Entry for User\"\n redirect_to users_path\n end\n elsif (current_user.has_role? :admin) && !params[:user_id].present?\n flash[:notice] = \"Params User_id should be present\"\n redirect_to users_path\n else\n @spends = current_user.spends\n end\n\n end", "def index\n if params[:user_id]\n @user = User.find_by('github_login=? OR github_id=?', params[:user_id], params[:user_id])\n @spins = Spin.where(user: @user, visible: true)\n else\n @spins = Spin.where(visible: true)\n end\n @spins = @spins.where(\"full_name ILIKE ?\", \"%#{params[:name]}%\") if params[:name]\n @spins = @spins.joins(:user).where(\"users.github_login ILIKE ?\", \"%#{params[:author]}%\") if params[:author]\n @spins = @spins.order(\"#{params[:sort]} #{params[:order] || 'DESC'}\") if params[:sort]\n if @spins.count.positive?\n return_response @spins, :ok, {}\n else\n render status: :no_content\n end\n end", "def user\n \t@user = User.find(params[:id])\n @listings = User.find(params[:id]).listings\n end", "def set_listings\n @user = User.find(params[:user_id])\n end", "def index\n @userlitts = Userlitt.all\n end", "def index\n @user_smart_points = UserSmartPoint.all\n render json: @user_smart_points\n end", "def me\n\t\tuser_listings = current_user.listings\n render json: [current_user, user_listings]\n end", "def user_list\n\t\tget_call = Curl::Easy.http_get(\"#{@ip_address}:#{@port_2}/v2.0/users/\"\n\t\t) do |curl| curl.headers['x-auth-token'] = @token end\n\t\t\n\t\tputs \"Here is a list of users...\"\n\t\tparsed_json = JSON.parse(get_call.body_str)\n\t\t\n\t\tputs parsed_json\n\t\treturn parsed_json\n\tend", "def set_listings\n @user = User.find(params[:user_id])\n end", "def list\r\n users = User.all\r\n render json: users\r\n end", "def get_slip_data(id:)\n empty_param_error('id') if id.to_s.eql? ''\n resource :get, \"api/v1/users/me/slips/#{id}\"\n end", "def show\n @user = User.find(params[:id])\n @user_sweets = @user.sweets\n # binding.pry\n # TODO: implement user sweets\n end", "def index\n symptoms = Symptom.where(user_id: params[:user_id])\n\n if current_user.id == params[:user_id].to_i\n render json: SymptomSerializer.new(symptoms)\n else\n render json: { error: '401 Unauthorized' }, status: 401\n end\n\n\n end", "def index\n @sprojects = current_user.sprojects.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprojects }\n end\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def profile(usernames)\n get(\"/1/users/show.json\", :users => [usernames].flatten).users\n end", "def listing(type, **params)\n params[:t] = params.delete(:time) if params.key?(:time)\n @client.model(:get, \"/user/#{get_attribute(:name)}/#{type}.json\", params)\n end", "def listing(type, **params)\n params[:t] = params.delete(:time) if params.key?(:time)\n @client.model(:get, \"/user/#{get_attribute(:name)}/#{type}.json\", params)\n end", "def index\n @client.spots(-33.8670522, 151.1957362, :types => 'restaurant')\n @users = User.all\n end", "def index\n @user = User.find(params[:user_id])\n @picks = @user.picks.order(\"created_at DESC\").page(params[:page]).per(20)\n end", "def index\n @snippits = current_user.snippits\n end", "def point_list\n @user_point = UserPoint.find_by_user_id(current_user.id)\n end", "def get_list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/#{get_user_id!(params)}#{@url_suffix}\", params)\n end", "def user_list\n\t\tres = {}\n\t\tusers = User.where(\"lower(name) ~ ?\",params[:pattern].downcase)\n\t\tif users\n\t\t\tres[:status] = \"0\"\n\t\t\tres[:users] = users.pluck(:name, :email, :image)\n\t\telse\n\t\t\tres[:status] = \"1\"\n\t\tend\n\t\trender json: res\n\tend", "def show\n @spot_listing = SpotListing.find(params[:id])\n @user = @spot_listing.user\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spot_listing }\n end\n end", "def list\n get('users')['users']\n end", "def index\n @user_plants = UserPlant.where(user: current_user)\n render json: @user_plants,\n include: { plant: { only: [:name, :water, :light_indoors, :light_outdoors] } },\n except: [:updated_at, :created_at, :user_id]\n end", "def users\n self.class.get(\"/user\", @options).parsed_response[\"items\"]\n end", "def fremont_users\n\ttmp = Array.new\n\tres = Array.new\n\ti = 0\n\twhile (tmp = TOKEN.get('/v2/campus/7/users', params: { page: i, per_page: 100 }).parsed).length > 0\n\t\tputs 'user request page is ' + i.to_s\n\t\ttmp.each do |page|\n\t\t\tres.push(page)\n\t\tend\n\t\ti += 1\n\tend\n\treturn res\nend", "def list\n render json: User.all\n end", "def index\n @users = @stakeholder.users.paginate(:page => params[:page])\n end", "def get_name_and_location\n @top_ten.each do |user|\n user_details = self.class.get(\"/users/#{user[0]}\").parsed_response\n user << user_details[\"name\"]\n user << user_details[\"location\"]\n end\n end", "def index\n @users = User.only_students\n @current_term = Term.where(:is_active => true)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def get_list(user, list)\n get(\"/#{user}/lists/#{list}.json\")\n end", "def show\n @user_list= []\n \n @customtable = CustomeTable.where(:identifier_id => @hackathon.id)\n @reguser = Registration.where(:hackathon_id => @hackathon.id)\n \n @reguser.each do |user| \n u = User.find(user.userId)\n @user_list.push(u.user_name)\n end\n end", "def select_user\n # @users = ['ichthala', 'wescarr17', 'seraphicmanta', 'tcclevela', 'antonwheel', 'horse_ebooks', 'catlandbooks']\n # @users.each_with_index do |user, index|\n # @users[index] = Twitter.user(user)\n # end\n\n @users = []\n\n while @users.count < 9\n offset = rand(Twitteruser.count)\n rand_sn = Twitteruser.first(:offset => offset).screen_name\n unless @users.find_index(rand_sn)\n @users << rand_sn\n end\n end\n\n @users << 'horse_ebooks'\n\n @users.each_with_index do |user, index|\n @users[index] = Twitter.user(user)\n end\n\n respond_to do |format|\n format.html\n format.json {render json: @users}\n end\n\n end", "def user_product_listings\n render json: @user.product_listings\n end", "def list_users\n self.class.get('/users')\n end", "def index\n @listings = Listing.by_user(current_user).all\n\n render json: @listings\n end", "def index\n @params = params\n @list = get_list_via_solr('user')\n @api_response = {\n users: @list,\n meta: { pagination: pagination_params }\n }\n render json: @api_response\n end", "def show\n\t @user = User.find(params[:id])\n\n\t allusers = Array.new\n\t @allusers = User.order('score DESC')\n\n\t if @allusers.length >= 1\n\t @firstplace = @allusers[0]\n\t end\n\t if @allusers.length >= 2\n\t @firstplace = @allusers[0]\n\t @secondplace = @allusers[1]\n\t end\n\t if @allusers.length >= 3\n\t @firstplace = @allusers[0]\n\t @secondplace = @allusers[1]\n\t @thirdplace = @allusers[2]\n\t end\n\n\n\tend", "def stamps(user_id=self.username, limit=20)\n response = connection.get do |req|\n req.url \"/users/#{user_id}/stamps\", :limit => limit\n end\n response.body.stamps\n end", "def index\n users = policy_scope(User)\n render json: { users: users }\n end", "def users(*params)\n puts \"Users:\"\n @users.each do |user|\n muted = @muted_users.include?(user)\n puts \"#{user}#{muted ? \" (muted)\" : \"\"}\"\n end\n end", "def users(*params)\n puts \"Users:\"\n\n @users.each do |user|\n muted = @muted_users.include?(user)\n puts \"#{user}#{muted ? ' (muted)' : ''}\"\n end\n end", "def index\n shoutouts = Shoutout.where(user_ids: params[:id])\n shoutouts = policy_scope(shoutouts)\n render json: shoutouts\n end", "def playlists(user)\n get(:standard, {:method => \"user.getPlaylists\", :user => user})\n end", "def index\n \n @plants = Plant.all\n @personal_plants = PersonalPlant.where(:user_id => session[:user][:id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plants }\n end\n end", "def list_users(workspace)\n puts \"\\nUser List\\n\\n\"\n tp workspace.users, \"id\", \"name\", \"real_name\", \"status_text\", \"status_emoji\"\nend", "def user_list\n @room = current_user.room\n @user_list = @room.users\n render partial: \"user_list\"\n end", "def breakdown\n @points = current_user.points.limit(5)\n render json: @points, status: 200\n end", "def index\n @users = User.all.select(\"id\", \"name\", \"progress\", \"created_at\", \"updated_at\")\n render :json => @users\n end", "def show_user_tweets\n @user_tweets = TwitterClient.user_timeline(params[:name])\n render json: @user_tweets\n end", "def show\n @user = User.find(params[:id])\n @teams = TeamPlayer.where(:user_id => params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def get_users\n\t\t\t@users = User.all.where(:on_beverage_list => true).order('firstname, lastname')\n\t\tend", "def list(garbage, start)\n @all_user = session_user.agency.users\n @start = start.to_i || 0\n @limit = request.params[\"limit\"] || UserListingLength\n @user = @all_user[@start .. (@start+@limit)-1] # FIXME: Do it with sequel!\n @uparted = @user.partition{|u| @user.index(u) % 2 == 0 }\n end", "def users\n get('get_users')\n end", "def show\n @users = User.all\n json_response(@users)\n end", "def list\n\t\t# retrieve all users\n @users = User.find(:all)\n end", "def index\n # show overview of users (both walkers and non-walkers)\n # allow user to filter on (non-)walkers\n # position of these people should be shown on a map (aprox. not exact)\n\n # start with 10 users\n # radius = 10km\n LoadNearbyUsers(10, false, current_user.id);\n end", "def user_info(user_id, list_id)\n return [db.execute(\"SELECT * FROM users WHERE user_id=?\", user_id), db.execute(\"SELECT * FROM listings WHERE list_id=?\", list_id)]\nend", "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 get_user_list\n return User.find(:all, :order => 'last_name ASC').collect {|user| [user.full_name, user.id]}\n end", "def user_listings\n @listings =current_user.listings\n end", "def index\n @lists = @user.lists\n end", "def students\n users\n end", "def listing(type, **options)\n options[:t] = options.delete(:time) if options.key?(:time)\n PaginatedListing.new(client, options) do |**req_opts|\n client.model(:get, \"/user/#{read_attribute(:name)}/#{type}.json\", options.merge(req_opts))\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 users\n self.triples.map(&:first)\n end", "def index\n StatsManager::StatsD.time(Settings::StatsConstants.api['user']['index']) do\n if params[:ids]\n ids = params[:ids].split(\",\")\n if ids.length <= 10\n @users = User.find(ids)\n @status = 200\n else\n render_error(400, \"too many ids included (max 10)\")\n end\n elsif user_signed_in?\n @status = 200\n @user = current_user\n @user_personal_roll_subdomain = (@user.public_roll and @user.public_roll.subdomain)\n render 'v1/user/show'\n else\n render_error(401, \"current user not authenticated\")\n end\n end\n end", "def index\n @grams = Gram.all #if we wanted to make an app so that user can only see their own pin make = current_user.pins.all if not Gram.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @grams }\n end\n end", "def show\n\t\t@user = User.find(params[:id])\n\t\t@users = User.all\n\t\t@skill = Skill.where(user_id: current_user.id)\n\t\t@slot = Slot.where(user_id: current_user.id)\n\tend", "def list_users\n tp @users, :real_name, :slack_id, :user_name => {:display_method => :name}\n end", "def index\n @user_points = UserPoint.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @user_points }\n end\n end", "def index\n \n @users = User.page(params[:page]).per_page(14)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n \n end", "def index\n if !user_signed_in? \n @psts = Pst.where(:published => true)\n # @psts = Pst.all\n else\n @psts = Pst.where(:user_id => current_user.id)\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @psts }\n end\n end", "def all_users\n return [] if @json_data['users'].nil?\n @json_data['users'].collect { |user| [user['first'], user['last']].join(' ') }\n end", "def list\n @trips = Trips.my_trips(cookies[ :user_id ] )\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 all_users\n every_user =\n $all_posts.group_by { |row| row.name}\n .map { |row| row.first }\n render json: every_user\n end", "def get_sports\n set_user\n @sports = []\n @user_sport_settings = @user.user_sport_settings.all\n @user_sport_settings.each do |user_sport_setting|\n @sports << user_sport_setting.sport\n end\n render json: @sports\nend", "def index\n users = @fun.get_reposts.limit(5).reposters\n users.map! do |user|\n user = user.info_to_json\n user[:user_path] = user_path user[:login]\n user\n end\n render json: users\n end", "def show\n @user = User.find_by_name(params[:name])\n @participants = Participant.find_all_by_user_id(@user.id).paginate(:page => params[:page], :per_page => 5)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def index\n if current_user.role?(:spreader)\n end\n @users = User.staff_members.page(params[:page])\n end", "def show\n @user = current_user\n @user_sweets = @user.sweets\n end", "def get_users_list\n service_response = AdminManagement::Users::UserList.new(params).perform\n render_api_response(service_response)\n end", "def index\n render json: { users: User.pluck(:email, :admin), password: 'PassworD@55' }\n end", "def index\n @slots = Slot.where(user_id: current_user.id)\n end", "def index\n paginate json: @user.playlists.all\n end", "def index\n @users = User.paginate(page: params[:page]) #uses paginate gem to create a lists of users separated into pages by groups of 30\n end", "def index\n # 1 is for UserType : 'Professeur'\n @users = User.find_all_by_class_room_id_and_user_type_id(current_user.class_room, 1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @users }\n end\n end", "def index \n #Show all users \n @users = User.all\n render json: @users.as_json(only: [:id, :first_name, :last_name, :email, :business_name, :business_verticals, :business_neighborhood, :created_at, :sign_in_count, :current_sign_in_at, :last_sign_in_at])\n end" ]
[ "0.84186566", "0.62961507", "0.6205785", "0.6168993", "0.60175306", "0.5870528", "0.5870528", "0.5860279", "0.58402807", "0.57501084", "0.5745007", "0.57437515", "0.5723455", "0.5719962", "0.57161933", "0.56872386", "0.5676178", "0.5630771", "0.5630121", "0.5619994", "0.5619147", "0.5615083", "0.5610681", "0.56102896", "0.55869865", "0.55869865", "0.55795497", "0.5578104", "0.5560775", "0.5543886", "0.55236584", "0.55212003", "0.5506403", "0.5488717", "0.5485878", "0.54852504", "0.5473605", "0.54662704", "0.54599434", "0.5451719", "0.5447632", "0.5445266", "0.54331833", "0.54307216", "0.5413024", "0.5406179", "0.53998667", "0.5399109", "0.53965074", "0.5393517", "0.5387433", "0.5373465", "0.5371728", "0.53714764", "0.53610396", "0.5359966", "0.5357617", "0.5357029", "0.53550106", "0.53454936", "0.53413665", "0.5340349", "0.5333889", "0.53332514", "0.5331995", "0.5327899", "0.53233045", "0.53211164", "0.5320634", "0.53201085", "0.5319191", "0.53127193", "0.5310117", "0.5308844", "0.53043693", "0.5294065", "0.5293944", "0.5293771", "0.52910095", "0.5290201", "0.5287504", "0.5278938", "0.5269519", "0.52577066", "0.5257335", "0.52547705", "0.5254179", "0.5253048", "0.5249851", "0.5245619", "0.5236603", "0.5233305", "0.52327317", "0.52269745", "0.5225031", "0.5224266", "0.52203745", "0.5218662", "0.52171874", "0.52116615" ]
0.84677845
0
Returns the specified user's "news feed" GET /users/splatts_feed/1
def splatts_feed @feed = Splatt.find_by_sql("SELECT splatts.user_id, splatts.body, splatts.created_at FROM splatts JOIN follows ON follows.followed_id = splatts.user_id WHERE follows.follower_id = #{params[:id]} ORDER BY splatts.created_at") render json: @feed end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def newsfeed\n check_auth :newsfeed\n \n response = connection.post do |req|\n req.url '/user/newsfeed'\n req.body = { :format => @format }\n end\n response\n end", "def feed\n get '/users/self/feed', auth_params\n end", "def rss\n\n # Get the specified user, making sure that it exists\n if !@user = User.find_by_login(params[:user_login])\n raise ActiveRecord::RecordNotFound\n end\n\n # If the everybody flag is set, respond with feed items about everybody\n # on Blavel\n # Otherwise, respond with feed items only about the people that the\n # current user is following\n @everybody = params[:everybody]\n if @everybody\n @feed_items = gather_feed_items\n else\n @feed_items = gather_feed_items(current_user)\n end\n\n rescue ActiveRecord::RecordNotFound => error\n logger.info error\n flash[:notice] = 'The user you requested does not exist.'\n redirect_to '/'\n end", "def index\n @user_feeds = UserFeed.find_all_by_user_id(current_user.id)\n end", "def username_feed(username)\n\t\t\tid = search_user(username)['data'][0]['id']\n\t\t\tfeed = user_feed(id)\t\t\t\n\t\t\treturn feed\n\t\tend", "def user_live_feed(user_id, params = {})\n get(\"/v1/users/#{user_id}/live\", params)\n end", "def splatts_feed\n \t@feed = Splatt.find_by_sql(\"SELECT user_id, body, created_at FROM splatts JOIN follows ON follows.followed_id = splatts.user_id WHERE follows.follower_id = '#{params[:id]}' ORDER BY splatts.created_at\")\n \t\n \trender json: @feed\n end", "def show\n \t@user = User.find(params[:id])\n # Make microposts available for users show-action\n @feed_items = @user.microposts.paginate(page: params[:page])\n end", "def index\n people_in_feed = current_user.feed_list\n @posts = Post.where(user: people_in_feed)\n end", "def feed\n\t\t# This is preliminary. See \"Following users\" for the full implementation.\n\t\t#Micropost.where(\"user_id = ?\", id) # \"?\" ensures variable 'id' is properly escaped\n\t\t\t\t\t\t\t# before being used in SQL query\n\t\t\t\t\t\t\t# same as 'microposts' - which references all microposts of the user\n\t\t\t\t\t\t\t# But eventually want not just this user's microposts -- but the\n\t\t\t\t\t\t\t# microposts of the folks he's following\n\t\t\t\t\t\t\t# Otherwise user.microposts would've been fine, rather we want user.feed\n\t\t# rather than show posts by user, show posts by users the user follows\n\t\tMicropost.from_users_followed_by(self) \n\tend", "def show\n redirect_to feeds_url\n # @feed = Feed.find(params[:id])\n # @user_feed = current_user.user_feeds.find_by_feed_id(@feed.id)\n end", "def feed\n\t\tMicropost.where(\"user_id = ?\", id)\n\tend", "def feed\n\t\tMicropost.where(\"user_id = ?\", id)\n\tend", "def feed\n\t\tMicropost.where(\"user_id = ?\", id)\n\tend", "def set_user_feed\n @feed = current_user.subscriptions.find(params[:id])\n end", "def show\n @feed = current_user.feeds.find_by_slug(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed }\n end\n end", "def feed\n\t\tMicropost.where(\"user_id = ?\", id)\n \tend", "def news_for_feed(feed_id)\n news = []\n\n where(:user_id => User.current_user_id, :feed_id => feed_id).each do |news_item|\n news.push news_item.attributes\n end\n\n news\n end", "def get_news_feed(user_id)\n ids = []\n @follows[user_id] = { user_id => 1 } unless @follows.key?(user_id)\n @alltweets.reverse_each do |uid, tid|\n ids << tid if uid == user_id || @follows[user_id][uid]\n return ids if ids.size >= 10 \n end\n ids\n end", "def feed\n Micropost.where(\"user_id = ?\", id)\n end", "def feed\n Micropost.where(\"user_id = ?\", id)\n end", "def feed\n Micropost.where(\"user_id = ?\", id)\n end", "def feed\n Micropost.where(\"user_id = ?\", id)\n end", "def feed\n Micropost.where(\"user_id = ?\", id)\n end", "def feed\n Micropost.where(\"user_id = ?\", id)\n end", "def feed\n Micropost.where(\"user_id = ?\", id)\n end", "def feed\n Micropost.where(\"user_id = ?\", id)\n end", "def feed\n Micropost.where(\"user_id = ?\", id)\n end", "def feed\n # This is preliminary. See \"Following users\" for the full implementation.\n Micropost.where(\"story_id = ?\", id)\n end", "def feed\n user = User.find_by_case_insensitive_username(params[:id])\n if user\n redirect_to \"/feeds/#{user.feed.id}.atom\"\n else\n render :file => \"#{Rails.root}/public/404.html\", :status => 404\n end\n end", "def show\n if @user != current_user\n redirect_to :action => 'feed', :id => @user.id\n end\n end", "def feed\n # escape the id to avoid security holes\n Micropost.where(\"user_id = ?\", id)\n end", "def feed\n # Preliminary implementation\n # The \"?\" ensures that the 'id' is properly escaped before being included in the underlying SQL query. This is more secure than inserting the 'id' into the SQL query directly because SQL injection would be possible otherwise\n \n #Micropost.where(\"user_id = ?\", id)\n\n # Display a feed of microposts for only the users that the user is following\n Micropost.from_users_followed_by(self)\n end", "def news\n query = \"SELECT actor_id, post_id, target_id, created_time, updated_time, attribution, message, attachment, likes, comments, permalink, action_links FROM stream WHERE filter_key in (SELECT filter_key FROM stream_filter WHERE uid = '#{@user.id}' AND type = 'newsfeed')\"\n pp @session.fql_query(query)\nend", "def feed_target\n User.find_by(id: feed_id)\n end", "def user_news\n query = \"SELECT actor_id, post_id, target_id, created_time, updated_time, attribution, message, attachment, likes, comments, permalink, action_links \n FROM stream \n WHERE (filter_key in (SELECT filter_key FROM stream_filter WHERE uid = '#{@user.id}' AND type = 'newsfeed')) AND\n (actor_id = '#{@user.id}')\"\n pp @session.fql_query(query)\nend", "def feed\n Post.where(\"user_id IN (?) OR user_id = ?\", friend_ids, id).feed\n end", "def feeds\n @user = current_user\n @subscribed_ids = @user.subscriptions.pluck(:feed_uid)\n end", "def index\n @user = User.find(params[:user_id])\n @posts = Post.feed_items(@user)\n @post = Post.new\n end", "def feed\n @articles = Article.feed_list(current_user, params[:page])\n end", "def feeds\n profile = Profile.find(params[:id])\n profile.feeds\n redirect_to lato_profile_path(profile)\n end", "def feed\n # This is preliminary. See \"Following users\" for the full implementation\n Micropost.where( \"user_id = ?\", id ) \n # using ? ensures that id is properly escaped before submitting the SQL query\n end", "def fetch_from_news_feed\n unless self.facebook_omniauth.blank?\n fb_user = self.facebook_client_user\n unless fb_user.blank?\n posts = fb_user.home # fetch posts\n Movie.name_is_not_blank.name_without_dictionary_word.this_year.each do |movie|\n posts.each do |post|\n FacebookFeed.create_facebook_post(post, movie, post.from)\n User.pull_comments(post, movie) #check for comments is present\n end # each post end\n end # movie end\n end\n end\n end", "def show\n @feed = Feed.find(params[:id])\n #@feeds = Feed.from_users_followed_by(current_user)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed }\n end\n end", "def index\n @feed_items = @user.feed_items\n render json: @feed_items\n end", "def friend_feed(options={})\n get('/feed', options)\n end", "def index\n @page_title = 'Feeds'\n if !@user.nil?\n @feeds = @user.feeds\n else\n @feeds = Feed.find(:all, :limit => 100)\n end\n render_index\n end", "def set_feeds_user\n @feeds_user = FeedsUser.find(params[:id])\n end", "def show_nouser\n @feed = Feed.find_by_uid!(params[:feed])\n feed_uids = Rails.cache.fetch [:feed_uids, @feed] do\n [@feed.uid] + @feed.children.pluck(:uid)\n end\n\n if @date.nil?\n @date = @feed.last_paper_date\n end\n\n @backdate = _backdate(@date, @range)\n @recent_comments = _recent_comments(feed_uids)\n @papers, @pagination = _range_query(feed_uids, @backdate, @date, @page)\n\n render 'feeds/show'\n end", "def feed\n\n # If the user is not logged in, render the non-member home action\n if !current_user\n render :template => 'promo/home', :layout => 'empty'\n else\n @everybody = params[:everybody]\n\n # If the everybody flag is set, respond with feed items about everybody\n # on Blavel\n # Otherwise, respond with feed items only about the people that the\n # current user is following\n if @everybody\n @feed_items = gather_feed_items\n else\n @feed_items = gather_feed_items(current_user)\n end\n\n # Pass through the first 5 followers and the first 5 followees, all\n # randomised\n @followers = current_user.followers.sort_by { rand }.first(6)\n @followees = current_user.followees.sort_by { rand }.first(6)\n\n # Respond with html or javascript, depending on whether it is requested\n # via ajax or not\n respond_to do |format|\n format.html\n format.js { render :template => 'feeds/feed.js.erb', :layout => false }\n end\n end\n end", "def feed(usuario = \"me\")\n\t\t@graph.get_connections(usuario, 'feed')\n\tend", "def feed\n # This is preliminary. See \"Following users\" for the full implementation.\n #The question mark ensures that id is properly escaped before being included in the underlying SQL query, \n #thereby avoiding a serious security hole called SQL injection. The id attribute here is just an integer, \n #so there is no danger in this case, but always escaping variables injected into SQL statements is a good habit to cultivate. \n Micropost.where(\"user_id = ?\", id)\n end", "def getAllUserFeed(userID)\n i = 0\n feed = Array.new\n feed[i] = getUserProfileFeed(userID, 0, 0)\n count = feed[i][\"count\"]\n i += 1\n while count > 0\n feed[i] = getUserProfileFeed(userID, feed[i-1][\"last_document_id\"], feed[i-1][\"last_event_id\"])\n count = feed[i][\"count\"]\n i += 1\n end\n feed\n end", "def show_nouser\n @feed = Feed.find_by_uid!(params[:feed])\n feed_uids = [@feed.uid] + @feed.children.pluck(:uid)\n\n @date = (_parse_date(params) || @feed.last_paper_date || Date.today).to_date\n @range = _parse_range(params) || 1\n @page = params[:page]\n\n if @range == :since_last\n # If we're not signed in, there's no sense\n # in which we can do \"since last\"\n @range = 1\n end\n\n @backdate = @date - (@range-1).days\n\n @recent_comments = _recent_comments(feed_uids)\n\n @papers = _range_query(feed_uids, @backdate, @date, @page)\n end", "def set_feed_item\n @user = User.find(params[:user_id])\n end", "def show\n @feed = Feed.find(params[:id])\n end", "def show\n @feed = Feed.find(params[:id])\n end", "def index\n if session[:user_id]\n redirect_to home_feeds_url\n end\n end", "def set_news_feed\n @news_feed = NewsFeed.find(params[:id])\n end", "def feed\n\t\t\tpost = { \"token\" => @token }\n\t\t\tdocxml = nil\n\t\t\tdocxml = nessus_request('feed', post)\n\t\t\tif docxml.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\tfeed = docxml.root.elements['contents'].elements['feed'].text\n\t\t\tversion = docxml.root.elements['contents'].elements['server_version'].text\n\t\t\tweb_version = docxml.root.elements['contents'].elements['web_server_version'].text\n\t\t\treturn feed, version, web_version\n\t\tend", "def feed\n # defer to Micropost.from_users_followed_by\n Micropost.from_users_followed_by(self)\n end", "def feed\n Micropost.from_users_followed_by(self)\n end", "def feed\n Micropost.from_users_followed_by(self)\n end", "def feed\n Micropost.from_users_followed_by(self)\n end", "def feed\n Micropost.from_users_followed_by(self)\n end", "def feed\n Micropost.from_users_followed_by(self)\n end", "def feed\n Micropost.from_users_followed_by(self)\n end", "def feed\n Micropost.from_users_followed_by(self)\n end", "def feed\n Micropost.from_users_followed_by(self)\n end", "def feed\n FeedItem.from_users_followed_by(self)\n end", "def feed\n\t\t\tpart_of_feed = \"relationships.follower_id = :id or microposts.user_id = :id\"\n\t\t\tMicropost.joins(user: :followers).where(part_of_feed, { id: id })\n\t\tend", "def show\n @feed = Feed.find(params[:id])\n @related_feeds = @feed.list_related_feeds(current_user)\n @feed_entries = Entry.where(feed_id: @feed.id).order(\"updated_at DESC\").page(params[:page]).per(10)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feed }\n end\n end", "def get_userposts( user )\n posts = []\n url = \"http://feeds.delicious.com/rss/#{user}\"\n\n response = Net::HTTP.get_response(URI.parse(url)).body\n doc = REXML::Document.new(response)\n\n doc.elements.each(\"//item\") do |item|\n posts << { \"href\" => item.elements[\"link\"].text }\n end\n\n sleep 1\n return posts\n end", "def getUserProfileFeed(userID, lastDocumentID, lastEventID)\n request('getUserProfileFeed', {'userID' => userID, 'lastDocumentID' => lastDocumentID, 'lastEventID' => lastEventID})\n end", "def retrieve_feed\n uri = URI.parse(@feed_url)\n Net::HTTP.get_response(uri).body\n end", "def set_newsfeed\n @newsfeed = Newsfeed.find(params[:id])\n end", "def feed\n Survey.where(\"user_id = ?\", id)\n end", "def news\n do_scrape\n @posts = UbuEntry.all(:order => \"id DESC\", :limit => 400)\n render :layout => false, :content_type => Mime::RSS\n end", "def feed\n Micropost.from_users_followed_by(self)\n end", "def feed\n Micropost.from_users_followed_by(self)\n end", "def index\n if params[:user_id]\n @user = User.find(params[:user_id])\n @posts = @user.posts\n render :layout => \"user\"\n else\n @posts = current_user.stream_posts\n render :layout => \"home\"\n end\n end", "def newsfeed\n Post.newsfeed_for(self)\n end", "def show\n @user = User.find(params[:id])\n @user_sweets = @user.sweets\n # binding.pry\n # TODO: implement user sweets\n end", "def feed\n\t\tMicropost.where(\"user_id IN (?) OR user_id = ?\", following_ids, id)\n \n\tend", "def feed\n\t\tfollowing_ids = \"SELECT followed_id FROM relationships WHERE follower_id = :user_id\"\n\t\tMicropost.where(\"user_id IN (#{following_ids}) OR user_id = :user_id\", user_id: id)\n\tend", "def feed\n Micropost.where(\"user_id = ?\", id) # id u ovom context isto sto i self.id\n # isto sto i: microposts (isto sto i self.microposts)\n end", "def profile_feeds(is_current_user = false)\n res = @user.contents.includes(:hash_tags, :owner, :user).ignore_daily_devotions\n unless is_current_user\n @user.user_anonymities.pluck(:start_time, :end_time).each do |range|\n res = res.where.not(created_at: range.first..(range.last || Time.current))\n end\n end\n res.order(created_at: :desc).page(@page).per(@per_page)\n end", "def show\n @user = User.find(current_user.id)\n#redirect_to \"newsfeeds/index\"\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def news_feed\n begin\n client = Feedlr::Client.new(oauth_access_token: ENV['FEEDLY_OAUTH_ACCESS_TOKEN'])\n @latest_list = {}\n client.user_unread_counts.unreadcounts.each do |unread_articles|\n next if unread_articles['count'] == 0\n unread_article_items = client.stream_entries_contents(unread_articles.id, unreadOnly: true).items\n next if unread_article_items.empty?\n\n unread_article_items.each do |article|\n @latest_list[article.alternate[0].href] = \"◼︎ <a href='#{article.alternate[0].href}'>#{article.title} - #{article.origin.title}</a>\"\n end\n client.mark_article_as_read(unread_articles.id)\n end\n @latest_news = @latest_list.values.join(\"<br>\")\n rescue => evar\n fail evar\n end\n @latest_news\n end", "def feed\n Post.from_users_followed_by(self)\n end", "def feed\n Post.from_users_followed_by(self)\n end", "def feed\n @posts = Post.feed_of(params[:id])\n end", "def show\n @rss_feed = RssFeed.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rss_feed }\n end\n end", "def feed\n\t\t#pulls all microposts from all the following ids..inefficient\n\t\t#Micropost.where(\"user_id IN (?) OR user_id = ?\", following_ids, id)\n\t\tfollowing_ids = \"SELECT followed_id FROM relationships where follower_id = :user_id\"\n\t\tMicropost.where(\"user_id IN (#{ following_ids}) OR user_id = :user_id\", following_ids: following_ids, user_id: id)\n\tend", "def get_feed\n begin\n new_tumblr = Tumblr::User.new(self.email, self.password) #Authentication\n blog = new_tumblr.tumblr[\"tumblelog\"][\"name\"] #Get blog name through hashes\n Tumblr.blog = blog # set blog name\n stories = Array.new # create stories array to be returned\n posts = Tumblr::Post.all #Get user posts\n posts.each do |post| #loop and convert to story type\n s = TumblrAccount.convert_blog_to_story(post)\n if(!(s.content == \"\"))\n stories.push(s) #adds element to list\n end\n end\n stories #returned\n rescue\n raise\n return []\n end\n end", "def profile\n @feeds = Feed.all\n @feed = Feed.new\n end", "def feed\n\t\t# Using a sub-select is more efficient. The entire query is performed in the database.\n\t\tfollowing_ids = \"SELECT followed_id FROM relationships\n WHERE follower_id = :user_id\"\n \tMicropost.where(\"user_id IN (#{following_ids})\n OR user_id = :user_id\", user_id: id)\n\tend", "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 show\n @post = current_user.posts.build\n @user = User.find(params[:id])\n if current_user == @user\n @posts = current_user.feed.paginate(page: params[:page]) \n else\n @posts = @user.posts.paginate(page: params[:page])\n end\n end", "def feed\n Answer.where(\"user_id = ?\", id)\n end" ]
[ "0.73320335", "0.71323335", "0.7036603", "0.7031902", "0.7019047", "0.6747547", "0.6729413", "0.67033523", "0.6613464", "0.6570303", "0.6514249", "0.6497581", "0.6497581", "0.6497581", "0.644843", "0.643915", "0.64156926", "0.6384068", "0.63435745", "0.63391554", "0.63391554", "0.63391554", "0.63391554", "0.63391554", "0.63391554", "0.63391554", "0.63391554", "0.6298739", "0.6257262", "0.6254131", "0.62387556", "0.62312454", "0.62272704", "0.6223147", "0.62005097", "0.61744344", "0.6164967", "0.6139116", "0.6139033", "0.61131024", "0.61058325", "0.6102019", "0.6095837", "0.6088299", "0.60875976", "0.60790104", "0.60644686", "0.605733", "0.6056586", "0.6046861", "0.6041992", "0.6004912", "0.598021", "0.5976783", "0.59579426", "0.59301007", "0.59301007", "0.58686364", "0.58631015", "0.585232", "0.5840728", "0.5834242", "0.5834242", "0.5834242", "0.5834242", "0.5834242", "0.5834242", "0.5834242", "0.5834242", "0.58261013", "0.5825216", "0.58245987", "0.5814751", "0.58141416", "0.5803121", "0.5788358", "0.57857966", "0.5784085", "0.5779977", "0.5779977", "0.57503116", "0.5745377", "0.5739142", "0.5702119", "0.5694124", "0.5690835", "0.5675441", "0.5667874", "0.5657586", "0.5653637", "0.5653637", "0.56524575", "0.56494725", "0.563833", "0.56369495", "0.56222177", "0.5615965", "0.5615278", "0.5610058", "0.5605691" ]
0.6777519
5
Creates a follower/followed rel between users POST /users/follows
def add_follows #params[:id] is user who follows #params[:follows_id] is user to be followed #make follower @follower = User.find(params[:id]) #make followed @followed = User.find(params[:follows_id]) if @follower.follows << @followed head :no_content else render json: @follower.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def follow!(user)\n relationships.create!(:followed_id => user.id)\n end", "def follow(user_id)\n followee_relationships.create(followee_id: user_id)\n end", "def follow(user)\n active_relationships.create(followed_id: user.id)\n end", "def follow(user)\n\tout_followings.create(to_id: user.id)\nend", "def follow(user_id)\n follower.create(followed_id: user_id)\n end", "def follow(user)\n active_follows.create(followed_id: user.id)\n \n end", "def follow!(followed)\n relationships.create!(:followed_id => followed.id)\n end", "def follow!(followed)\n self.relationships.create!(:followed_id => followed.id)\n end", "def follow!(other_user)\n relationships.create(followed_id: other_user.id)\n end", "def follow!(other_user)\n relationships.create!(followed_id: other_user.id)\n end", "def follow!(other_user)\n relationships.create!(followed_id: other_user.id)\n end", "def follow!(other_user)\n relationships.create!(followed_id: other_user.id)\n end", "def follow!(other_user)\n relationships.create!(followed_id: other_user.id)\n end", "def follow!(other_user)\n relationships.create!(followed_id: other_user.id)\n end", "def follow!(other_user)\n relationships.create!(followed_id: other_user.id)\n end", "def follow(other_user)\n following_relationships.create(followed_id: other_user.id)\n end", "def follow(user_id, follow_status)\n following_relationships.create(following_id: user_id, follow_status: follow_status)\n end", "def follow(user_id, follow_status)\n following_relationships.create(following_id: user_id, follow_status: follow_status)\n end", "def follow(user)\n Follow.create(follower: self, followed: user)\n end", "def follow (other_user)\n active_relationships.create(followed_id: other_user.id)\nend", "def follow!(other_user)\n\t\t# same as user.relationships.create or self.relationships.create\n\t\trelationships.create!(followed_id: other_user.id)\n\tend", "def follow(other_user)\n active_relationships.create(followed_id: other_user.id)\n end", "def follow(other_user)\n active_relationships.create(followed_id: other_user.id)\n end", "def follow(other_user)\n active_relationships.create(followed_id: other_user.id)\n end", "def follow(other_user)\n active_relationships.create(followed_id: other_user.id)\n end", "def follow(other_user)\n active_relationships.create(followed_id: other_user.id)\n end", "def follow(other_user)\n active_relationships.create(followed_id: other_user.id)\n end", "def follow(other_user)\n active_relationships.create(followed_id: other_user.id)\n end", "def follow(other_user)\n active_relationships.create(followed_id: other_user.id)\n end", "def follow(other_user)\n active_relationships.create(followed_id: other_user.id)\n end", "def follow(other_user)\n active_follows.create(followed_id: other_user.id)\n end", "def follow_user(follow_user)\n #before we can create the relationship between the two users, we need to check\n #if the user is not already following the other user, or the user is not trying to follow themself\n #if the user is following the other user that means a relationship already exists\n if following?(follow_user) \n raise \"Can't follow yourself or a user you are already following!\"\n else\n Follow.create({:user => self, :followed_user => follow_user})\n end\n end", "def follow!(other_user)\n\t\trelationships.create!(followed_id: other_user.id)\n\tend", "def follow\r\n @relationship = Relationship.create(follower_id: current_user.id, followed_id: params[:followed_id])\r\n @relationship.create_activity key: 'relationship.follow', owner: current_user, recipient: User.find(params[:followed_id])\r\n\r\n if @relationship.save\r\n render json: @relationship\r\n else\r\n render json: { error: \"Relationship creating error\" }, status: :unprocessable_entity\r\n end\r\n end", "def follow(foo_user)\n active_relationships.create(followed_id: foo_user.id)\n end", "def create\n @user=User.find(params[:user_id])\n @follower = @user.followers.create(follower_params)\n if @follower.save\n render json: @follower, status: :created\n else\n render json: @follower.errors, status: :unprocessable_entity\n end\n end", "def create\n\n user = User.find(params[:followed_id])\n @current_user.follow(user)\n redirect_to user\n\n\n # PATCH/PUT /relationships/1\n # PATCH/PUT /relationships/1.json\n def update\n\n end\n\n # DELETE /relationships/1\n # DELETE /relationships/1.json\n def destroy\n user = Relationship.find(params[:id]).followed\n @current_user.unfollow(user)\n redirect_to user\n end\n end", "def follow(other_user_id)\n \tuser_to_follow = User.find_by(id: other_user_id)\n followee_followerships.create(followee_id: user_to_follow.id)\n end", "def follow(other_user)\n active_relationships.create(following_id: other_user.id)\n end", "def follow(other_user)\n follow_down.create(following_id: other_user.id)\n end", "def follow!(user)\n followings.find_or_create_by!(following_id: user.id)\n end", "def follow(other)\n active_relationships.create(follower_id: self.id, followed_id: other.id)\n end", "def follow!(other_user)\n\t\tself.relationships.create! followed_id: other_user.id, follower_id: self.id\n\tend", "def follow(other)\n active_relationships.create(followed_id: other.id)\nend", "def followed\n\t\t@user = User.find(params[:id])\n\t\tcurrent_user.create_rel(\"FOLLOWING\", @user) \n\t\tif request.xhr?\n\t\t\trender json: { count: @user.following.count, id: @user.id }\n\t\telse\n\t\t\tredirect_to @user\n\t\tend\n\n\tend", "def follow(other_user)\n\t\tactive_relationships.create(followed_id: other_user.id)\n\tend", "def follow\n Following.find_or_create_by_follower_id_and_followed_id(current_user.id, params[:user_id])\n @user_id = params[:user_id]\n @followed = true\n render \"shared/follow\"\n end", "def follow! followee\n following << followee\n save\n followee.followers << self\n followee.save\n end", "def follow(other)\n active_relationships.create(followed_id: other.id)\n end", "def create\n @follow = current_user.follows.new(follow_params)\n @user = User.where(\"id = ?\", @follow.following )\n respond_to do |format|\n if @follow.save\n format.html { redirect_back fallback_location: root_path, notice: 'You are now following this user!' }\n format.json { render :show, status: :created, location: @follow }\n else\n format.html { render :new }\n format.json { render json: @follow.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_follower(user)\n followers << user\n end", "def create\n\t\t@user = User.find(params[:followed_id])\n\t\tcurrent_user.follow(@user)\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to @user }\n\t\t\tformat.js\n\t\tend\n\tend", "def create\n @user = User.find(params[:relationship][:followed_id])\n current_user.follow!(@user)\n respond_to do |format|\n format.html { redirect_to @user }\n format.js\n end\n end", "def create\n @user = User.find(params[:relationship][:followed_id])\n current_user.follow!(@user)\n respond_to do |format|\n format.html { redirect_to @user }\n format.js\n end\n end", "def follow! followee\n return if following? followee\n following << followee\n save\n followee.followers << self\n followee.save\n end", "def follow!(other_user)\n self.relationships.create!(followed_id: other_user.id)\n self.update_attribute(:followings_num, self.followings_num + 1)\n other_user.update_attribute(:followers_num, other_user.followers_num + 1)\n end", "def follow(other_person)\n active_relationships.create(followed_id: other_person.id)\n end", "def add_follows\n \t@follower = User.find(params[:id])\n \t@followed = User.find(params[:follows_id])\n \t\n \tif @follower.follows << @followed\n \t\t\n \telse\n \t\trender json @follower.errors\n \tend\n end", "def follow! (other)\n\t\tself.relationships.create!(followed_id: other.id)\n\tend", "def follow(user)\n\t self[:following].push(user.id)\n\t\tself.save\n end", "def create\n @leader = User.find(params[:user_id])\n @leader.user_followers.create(:follower_id => current_user.id)\n\n saved = @leader.save\n respond_to do |format|\n if saved\n flash[:notice] = 'You are now following '.concat(@leader.login)\n end\n format.html { redirect_to user_tweets_path(@leader) }\n if saved\n format.xml { render :xml => @leader, :status => :created, :location => @leaders }\n else\n format.xml { render :xml => @leader.errors, :status => :unprocessable_entity }\n end\n end\n end", "def follow(user)\n user.add_follower(self)\n self\n end", "def follow\n current_user.follow_user(@user)\n render json: {ok: 1}\n end", "def create\n current_user.follow(@user)\n redirect_back fallback_location: \"/\"\n end", "def create\n relationship =\n Relationship.new(follower_id: current_user.id,\n followed_id: params[:id])\n\n if relationship.save\n expose current_user.reload\n else\n error! :invalid_resource, relationship.errors\n end\n end", "def user_follows \n if user_signed_in?\n Rails.logger.debug { \"The user to be followed is #{params[:id]}\" }\n user = User.find(id: params[:id])\n user.follows << current_user\n end\n end", "def follow(user_a,user_b)\n\t\t#This method deletes the follow relationship in the database\n\t\tuser_a.follow(user_b)\n\n\t\tif REDIS.exists(user_a.handle+\"_relations\")\n\t\t\tREDIS.sadd(user_a.handle+\"_relations\", params[:userid])\n\t\tend\n\t\tif REDIS.exists(user_a.handle+\"_num_following\")\n\t\t\tREDIS.incr(user_a.handle+\"_num_following\")\n\t\tend\n\t\tif REDIS.exists(user_b.handle+\"_num_followers\")\n\t\t\tREDIS.incr(user_b.handle+\"_num_followers\")\n\t\tend\n\tend", "def followUser(userToFollow)\n @followers << userToFollow\n end", "def create\n @user = User.find(params[:followed_id])\n current_user.follow(@user)\n respond_to do |f|\n f.html { redirect_to @user}\n f.js\n end\n end", "def follow(user)\n new_relationship = Followship.new(following_id: user.id, follower_id: self.id)\n if new_relationship.save\n return true\n else\n return false\n end\n end", "def add_follower(user)\n @followers << user\n end", "def follow(user_id)\n if self.id != user_id && active_follow.find_by(following_id: user_id) == nil\n active_follow.create!(following_id: user_id)\n end\n end", "def add_follower(user)\n @followers.push(user)\n end", "def create\n current_account.follow(@account)\n # TODO: Set up a mailer for notifying accounts of new followers\n respond_to do |format|\n format.html { redirect_to account_url }\n format.json { render :status }\n end\n\n end", "def follow(user)\n user.followers << self\n end", "def follow!(user)\n\t\tfollowed << user \n\tend", "def follow!(user)\n\t\tfollowed << user\n\tend", "def follow(user)\n Friend.add_follower(self, user)\n end", "def create\n @user = User.find(params[:followed_id])\n current_user.follow(@user)\n\n respond_with @user\n # respond_to do |format|\n # format.html {redirects_to @user}\n # format.js\n # end\n end", "def follow(user)\n user.add_follower(self)\n self\n end", "def create\n @user = User.find(params[:relationship][:followed_id])\n current_user.follow!(@user)\n respond_with @user\n #no worked are needed. Sidekiq suppoerts delayed mailer by default.\n UserMailer.delay.follower_confirmation(current_user, @user)\n end", "def follow(other_user)\n following << other_user\n end", "def follow(other_user)\n following << other_user\n end", "def follow(other_user)\n following << other_user\n end", "def follow(other_user)\n following << other_user\n end", "def follow(other_user)\n following << other_user\n end", "def follow(other_user)\n following << other_user\n end", "def follow_user(follower, following)\n User.where(handle: follower).first.push(:following, following)\n end", "def add_follower_to_deal(id:, **args)\n params = parameters(args) do\n required_params :user_id\n optional_params :user_id\n end\n request(:post, \"deals/#{id}/followers\", params)\n end", "def follow_create(node1_id, node2_id, node1_index, node2_index)\n node1 = self.neo.get_node_index(node1_index, 'uuid', node1_id)\n node2 = self.neo.get_node_index(node2_index, 'uuid', node2_id)\n\n unless node1\n target = Kernel.const_get(node1_index.singularize.capitalize).find_by_slug_id(node1_id)\n node1 = target.neo4j_create\n end\n\n unless node2\n target = Kernel.const_get(node2_index.singularize.capitalize).find_by_slug_id(node2_id)\n node2 = target.neo4j_create\n end\n\n if node1 && node2\n follow = self.neo.create_relationship('follow', node1, node2)\n self.neo.add_relationship_to_index('users', 'follow', \"#{node1_id}-#{node2_id}\", follow) if follow\n self.update_affinity(node1_id, node2_id, node1, node2, 10, false, nil, 'positive', false) if follow\n end\n end", "def create_follow\n user.follow_questions.create(question: self.question)\n end", "def create\n @user = User.find(params[:following_id])\n current_user.follow(@user)\n respond_to do |format|\n format.html {}\n format.js \n end\n end", "def add_follower\n if (@user = find(User, params[:user_id])).is_a?(User)\n current_user.follow(@user)\n redirect_to @user, notice: \"Now you are following #{@user.username}!, and you can read his personal articles and comments!\"\n end\n end", "def create_follow\n user.follow_questions.create(question: self)\n end", "def create\n @user = User.find(params[:relationship][:followed_id])\n # in the params hash under :relationship, is a hash with 1 entry: {\"followed_id\" => \"9\"}\n current_user.follow!(@user)\n respond_to do |format|\n format.html { redirect_to @user }\n format.js\n end\n\n # this works b/c Ajax uses js to implement the action\n # causes rails to call a JavaScript Embedded Ruby file create.js.erb\n # 'redirect_to @user' reloads the page the user is already on - seems redundant\n end", "def follow_self\n Follow.create(follower_id: id, followed_id: id)\n end", "def follow(user)\n user.followers << self\n self\n end", "def follow_user\n\t\tauthenticate_current_user\n\t\t# add the current user to the user they followed list of followers\n\t\tUser.find(params.user_id).followers.push(User.find(current_user.id))\n\t\t# run the following action to return the updated group of followers\n\t\tfollowing\n\tend", "def follow(user_id, followee_id)\n @follows[user_id] = { user_id => 1 } unless @follows.key?(user_id)\n @follows[user_id][followee_id] = 1\n end", "def follow_fan_base!(followed)\r\n fan_relationships.create!(:followed_id => followed.id)\r\n end" ]
[ "0.80411303", "0.7941248", "0.7911175", "0.77704346", "0.7770313", "0.77614915", "0.772184", "0.76744205", "0.76594657", "0.76553077", "0.76553077", "0.76553077", "0.76553077", "0.76553077", "0.76371175", "0.7634871", "0.76297414", "0.762898", "0.7619792", "0.7587638", "0.7570419", "0.75584096", "0.75584096", "0.75584096", "0.75584096", "0.75584096", "0.75584096", "0.75584096", "0.75584096", "0.75584096", "0.7524634", "0.75043267", "0.7495694", "0.74905807", "0.7487381", "0.7435204", "0.74154717", "0.741439", "0.74106216", "0.7407721", "0.73844796", "0.73186696", "0.73179394", "0.73133874", "0.7306926", "0.7302893", "0.72790354", "0.7257102", "0.72491187", "0.7237533", "0.72245055", "0.72141165", "0.7209525", "0.7209525", "0.716658", "0.71394765", "0.712254", "0.71081907", "0.7105173", "0.71012837", "0.70936", "0.70561427", "0.70011497", "0.6990794", "0.6990244", "0.6988488", "0.6972571", "0.6953776", "0.6950465", "0.69374835", "0.69336265", "0.6927612", "0.69264084", "0.69171166", "0.6888088", "0.6886093", "0.6883277", "0.6882889", "0.6882596", "0.68820465", "0.68769366", "0.68761265", "0.68761265", "0.68761265", "0.68761265", "0.68761265", "0.68761265", "0.68700993", "0.6857597", "0.68562037", "0.68501616", "0.684887", "0.6842671", "0.68395036", "0.6831442", "0.6825334", "0.6807088", "0.6803575", "0.6792699", "0.67908335" ]
0.75329614
30
Returns a list of the users followed by the user GET /users/follow/[:id]
def show_follows @user = User.find(params[:id]) render json: @user.follows end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_followed_users(user_id, params = {})\n get(\"/v1/users/#{user_id}/followed_users\", params)\n end", "def user_follows user_id, pages: 1\n url = API + \"users/#{user_id}/follows?access_token=\" + @access_token\n pages.times do\n get(url)['data'].map do |user|\n @user_ids << user['id']\n end\n url = get(url)['pagination']['next_url']\n end\n export(@user_id_list, @user_ids)\n end", "def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @usersList = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\n end", "def user_follows \n if user_signed_in?\n Rails.logger.debug { \"The user to be followed is #{params[:id]}\" }\n user = User.find(id: params[:id])\n user.follows << current_user\n end\n end", "def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\n end", "def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\n end", "def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\n end", "def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\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 following\n # collect all the users ids that this user is following\n following_ids = follows.pluck(:following_id)\n User.where(id: following_ids)\n end", "def following\n\t@title = \"Following\"\n\t@user = User.find(params[:id])\n\t@users = @user.following.paginate(page: params[:page])\n\trender 'show_follow'\n end", "def following\n optional! :offset, type: Integer, default: 0\n optional! :limit, type: Integer, default: 20, values: 1..150\n\n @users = @user.follow_users.fields_for_list.order(\"actions.id asc\").offset(params[:offset]).limit(params[:limit])\n end", "def following\n @title = 'Following'\n @user = User.find(params[:id])\n @users = @user.following.paginate(page: params[:page])\n render 'show_follow'\n end", "def follows_given(user_id)\n follows = Follow.where(user_id: user_id)\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 following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.following.paginate(page: params[:page])\n render 'show_follow'\n end", "def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.following.paginate(page: params[:page])\n render 'show_follow'\n end", "def following\r\n @title = \"Following\"\r\n @user = User.find(params[:id])\r\n @users = @user.followed_users.paginate(page: params[:page], per_page: 25)\r\n render 'show_follow'\r\n end", "def followings\n b=BeFollow.scoped_by_follower_id(self.id)\n user_ids=b.map do |a|\n a.user.id\n end\n User.find_all_by_id(user_ids)\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 following\n\t\tauthenticate_current_user\n\t\t# grab all the current user's following\n\t\tfollowing = UserFollower.where(user_follower_id: current_user.id)\n\t\t# create an empty array\n\t\tfollowing_group = []\n\t\t# rotate through each following returned, and grab the user object\n\t\tfollowing.each do |x|\n\t\t\t# push each following user object into array\n\t\t\tfollowing_group.push(User.find(x.user_id))\n\t\tend\n\t\t# respond with the array of following user objects\n\t\trespond_with following_group\n\n\tend", "def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.following.paginate(:page => params[:page])\n render 'show_follow'\n end", "def following\n @following||= get(\"/user/show/#{login}/following\")['users'].map { |u| User.new(connection, :login => u) }\n end", "def followers\n @title = 'Followers'\n @user = User.find(params[:id])\n @users = @user.followers.paginate(page: params[:page])\n render 'show_follow'\n end", "def show_follows\n \t@user = User.find(params[:id])\n \t\n \trender json: @user.follows\n end", "def followers\n @title = \"Followers\"\n @user = User.find(params[:id])\n @users = @user.followers.paginate(page: params[:page])\n render 'show_follow'\n end", "def follow\n user = User.find(params[:user_id])\n @follow = current_user.follow(user)\n render json: @follow\n end", "def user_followers user_id, pages: 1\n url = API + \"users/#{user_id}/followed-by?access_token=\" + @access_token\n pages.times do\n get(url)['data'].map do |user|\n @user_ids << user['id']\n end\n url = get(url)['pagination']['next_url']\n end\n export(@user_id_list, @user_ids)\n end", "def follow\n current_user.follow_user(@user)\n render json: {ok: 1}\n end", "def show\n user = Api::V1::User.find(params[:id])\n unless user.nil?\n render json: user.followings.all\n end\n end", "def show\n user = Api::V1::User.find(params[:id])\n unless user.nil?\n render json: user.followings.all\n end\n end", "def followed\n\t\t@user = User.find(params[:id])\n\t\tcurrent_user.create_rel(\"FOLLOWING\", @user) \n\t\tif request.xhr?\n\t\t\trender json: { count: @user.following.count, id: @user.id }\n\t\telse\n\t\t\tredirect_to @user\n\t\tend\n\n\tend", "def user_followers(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"users/#{id}/followers\", params)\n end", "def followers(user = nil, params = {})\n args = [user, params]\n get path_from_args('statuses/followers', args), params_from_args(args)\n end", "def followers\n follower_ids = Follow.where(following_id: id).pluck(:user_id)\n User.where(id: follower_ids)\n end", "def followers(id)\n perform_request_with_collection(:get,\n \"/api/v1/accounts/#{id}/followers\",\n {}, Mastodon::Account)\n end", "def current_users_follows\n if signed_in?\n current_users_follows = []\n current_user.follows.each do |follow|\n current_users_follows.push(follow.followed_id)\n end\n current_users_follows || []\n end\n end", "def followers\n Follow.where(\"following_id = ?\", self.id)\n end", "def follower\n @users = User.find(params[:id]).followers\n render json: @users\n end", "def following\n users = connection.get(\n \"/users/#{CGI.escape(login)}/following\"\n )\n\n users.map do |stalkee|\n self.class.new(stalkee, connection)\n end\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 follow_list(options)\n session.options = adapt_to_dev_env(options)\n session.get('/follows')\n end", "def following\n @users = User.find(params[:id]).all_following\n render json: @users\n end", "def followers(params={})\n args = params.map{|k,v| \"#{k}=#{v}\"}.join('&')\n get(\"/statuses/followers.json?#{args}\")\n end", "def followings\n @followees = @user.followees.order(created_at: :desc) # order the followings(the people that current_user follows) according to when they were followed by current_user, with the most recent following at the top.\n end", "def follow(*user_ids)\n query_params = user_ids.pop if user_ids.last.is_a?(::Hash)\n query_params ||= {}\n filter(query_params.merge(:follow => user_ids))\n end", "def follow\n @data = {:user_id => params[:follow_user_id], :follow_user_id => current_user.id, :followed => 1}\n status = UserFollower.follow(@data)\n render json: {:status => status}\n end", "def following(id)\n perform_request_with_collection(:get,\n \"/api/v1/accounts/#{id}/following\",\n {}, Mastodon::Account)\n end", "def user_followed\n amigos = self.friends.pluck(:friend_id)\n User.find(amigos)\n end", "def list_followers(id)\n get(\"lists/#{id}/followers\").followers\n end", "def followers\n @followers ||= get(\"/user/show/#{login}/followers\")['users'].map { |u| User.new(connection, :login => u) }\n end", "def followed\n Follower.where(\"follower_id=?\", self.id).map{|f| f.user}\n end", "def follow_user\n\t\tauthenticate_current_user\n\t\t# add the current user to the user they followed list of followers\n\t\tUser.find(params.user_id).followers.push(User.find(current_user.id))\n\t\t# run the following action to return the updated group of followers\n\t\tfollowing\n\tend", "def following(user_id = nil)\n twitter_request do\n logger.info \"Get following of #{user_id || 'me'}\"\n client.friend_ids(user_id).take(5000)\n end\n end", "def show_followers\n\t@user = User.find(params[:id])\n\t\n\trender json: @user.followed_by\n\tend", "def show_followers\n \t@user = User.find(params[:id])\n \t\n \trender json: @user.followed_by\n end", "def followees\n list = service.find_user_follows(user).map {|data| build_object(data)}\n followees = list.map {|followee| followee.login}\n end", "def followers(options={})\n perform_get(\"statuses/followers.#{Twitter.format}\", options)\n end", "def index\n @follows = Follow.where(user_id:current_user)\n end", "def follow\n follow = User.where(:username => params[:id]).first\n @current_user.friends << follow\n redirect_to user_path( follow.username )\n end", "def get_following(user)\n Follow.find_by(follower_id: self.id, followed_id: user.id)\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 followings\n @followings = @other_user.followings.paginate(:page => params[:page], :per_page => 20)\n end", "def followers_ids(user = nil, params = {})\n args = [user, params]\n get path_from_args('followers/ids', args), params_from_args(params)\n end", "def fetch_user_and_followings\n @user = User.find(params[:followee_id])\n @follow = Follow.find_by(follower_id: current_user.id, followee_id: params[:followee_id])\n end", "def followers\n @followers = Follower.where(:friend_id => @current_user.id)\n end", "def index\n @user_followings = UserFollowing.all\n end", "def follow\r\n \r\n @followu = FollowUser.where(user_id: @u_id)\r\n @followt = FollowThread.where(user_id: @u_id)\r\n end", "def following\n @user = User.find(params[:id])\n @title = @user.firstname + \" Is Following\"\n @turfs = @user.following.paginate(:page => params[:page])\n render 'show_follow'\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 get_followees(ids)\n followees_resp = twitter_user.request(:get, configatron.api_call_url + \"users/lookup.json?user_id=#{ids.join(',')}\")\n \n if followees_resp.is_a?(Net::HTTPSuccess)\n get_nicknames_and_names(JSON.parse(followees_resp.body))\n end\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 followers\n @followers = current_user.followers.order(\"username\").page(params[:page]).per(10)\n end", "def show\n @twitter_user = TwitterUser.find(params[:id])\n @follower_ids = Twitter.follower_ids(@twitter_user.twitter_username).collection\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @twitter_user }\n end\n end", "def follow(user_id)\n followee_relationships.create(followee_id: user_id)\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 all_followships\n followships = User.find(params[:user_id]).followships\n render :json => followships\n end", "def follow\n Following.find_or_create_by_follower_id_and_followed_id(current_user.id, params[:user_id])\n @user_id = params[:user_id]\n @followed = true\n render \"shared/follow\"\n end", "def following\n @title = 'Following'\n @users = @user.following.page(params[:page])\n render 'show_follow'\n end", "def followers\n\t Friendship.findFriends(self,\"follow\",\"from\")\n end", "def add_follows\n\t#params[:id] is user who follows \n\t#params[:follows_id] is user to be followed\n\t\n\t#make follower\n\t@follower = User.find(params[:id])\n\t\n\t#make followed\n\t@followed = User.find(params[:follows_id])\n\t\n\tif \n\t\t@follower.follows << @followed\n\t\thead :no_content\n\telse\n\t\trender json: @follower.errors, status: :unprocessable_entity\n\tend\nend", "def follow\n who = User.find(params[:id])\n @current_user.follow(who)\n render :text => \"you are now following #{who.username}\"\n end", "def following\n @title = \"Following\"\n @user=User.find(params[:id])\n @other_users=@user.following.paginate(:page=>params[:page], :per_page => 30)\n respond_to do |format|\n format.html { render 'show_follow' }\n format.json { render json: @other_users }\n end\n end", "def Listfollowers\n follower= Following.where(\"followingid =:followingId\",{followingId:getUserId[0]['userId']}).count\n render json: {follower:follower}, status: :ok\n end", "def get_following(user)\r\n ret = []\r\n url = \"/me/friends?fields=id,name,picture&limit=500&access_token=#{user.setting.oauth_facebook}\"\r\n resp = facebook_https.get(url)\r\n if resp.class == Net::HTTPOK\r\n users = JSON.parse(resp.body)[\"data\"]\r\n ret = users.collect{|u| {:name => u['name'], :avatar => u['picture'], :id => u['id']}}\r\n end\r\n ret\r\n end", "def follow(user_id)\n follower.create(followed_id: user_id)\n end", "def following_usernames\n url = [PUBLIC_BASE_URL, 'user/show', self.login, 'following'].join('/')\n JSON.parse(open(url).read)['users']\n end", "def followers\n user = load_user\n\n expose user\n .followers\n .includes(:following, :favorite_restaurants)\n .paginate(page: params[:page], per_page: params[:per_page]),\n each_serializer: UserRelationshipSerializer\n end", "def follow(user)\n\t self[:following].push(user.id)\n\t\tself.save\n end", "def followers\n @title = \"Followers\"\n @user=User.find(params[:id])\n @other_users=@user.followers.paginate(:page=>params[:page], :per_page => 30)\n respond_to do |format|\n format.html { render 'show_follow' }\n format.json { render json: @other_users }\n end\n end", "def get_followees\n HTTParty.post(\"#{@api_path}/users/followees/#{@handle}/#{@password}\")\n end", "def follow(user)\n active_relationships.create(followed_id: user.id)\n end", "def followed_users_and_me\n followed_users + [id]\n end", "def followUser(userToFollow)\n @followers << userToFollow\n end", "def set_follow\n @user_auth = auth_user\n @user_followed = User.find(params[:follow_user_id])\n end", "def following\n Follow.where(\"follower_id = ?\", self.id)\n end", "def follow_user(user)\n # Ternary to prevent duplicates\n following?(user) ? following : following << user\n end", "def followed_users\n cached_followed_users\n end", "def following\n @following = current_user.following.order(\"username\").page(params[:page]).per(10)\n end", "def findFollowees\n @user = User.find(params[:id])\n @followees = @user.followees.all\n render json: @followees, status: :ok\n end" ]
[ "0.80836886", "0.80478525", "0.799923", "0.79600894", "0.7885907", "0.7885907", "0.7885907", "0.7885399", "0.7835323", "0.7796355", "0.77958846", "0.77817684", "0.77735734", "0.776926", "0.7746403", "0.77456397", "0.77456397", "0.7725664", "0.7721697", "0.77054805", "0.7701465", "0.7689404", "0.76570153", "0.7629831", "0.7624542", "0.7614153", "0.76038957", "0.7603823", "0.76030254", "0.75619376", "0.75619376", "0.7546667", "0.75465184", "0.75143564", "0.7505482", "0.75007254", "0.74879766", "0.7474666", "0.7465887", "0.7457333", "0.74434954", "0.7443142", "0.7442053", "0.7433355", "0.74108887", "0.74095756", "0.73870885", "0.7370012", "0.73611826", "0.7356338", "0.73519665", "0.7344517", "0.7341254", "0.73300153", "0.7326391", "0.732484", "0.731301", "0.73106796", "0.729702", "0.7296878", "0.7295916", "0.7293047", "0.7289193", "0.72506666", "0.7239128", "0.72359955", "0.7235284", "0.7229724", "0.72271264", "0.7223377", "0.7207008", "0.71877", "0.71731216", "0.7172978", "0.7170382", "0.716498", "0.71525496", "0.71524084", "0.71429414", "0.7140921", "0.7140283", "0.71344876", "0.71343493", "0.7133397", "0.7132179", "0.7124227", "0.711836", "0.71107966", "0.71059644", "0.710288", "0.70991", "0.70946085", "0.70894873", "0.7078319", "0.7076357", "0.7075052", "0.70725006", "0.7062428", "0.70613325", "0.7049745" ]
0.76849973
22
Returns a list of the users follow the specified user GET /users/follower/[:id]
def show_followers @user = User.find(params[:id]) render json: @user.followed_by end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_followed_users(user_id, params = {})\n get(\"/v1/users/#{user_id}/followed_users\", params)\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(user = nil, params = {})\n args = [user, params]\n get path_from_args('statuses/followers', args), params_from_args(args)\n end", "def user_followers(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"users/#{id}/followers\", params)\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 follows_given(user_id)\n follows = Follow.where(user_id: user_id)\n end", "def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @usersList = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\n end", "def followers\n @title = 'Followers'\n @user = User.find(params[:id])\n @users = @user.followers.paginate(page: params[:page])\n render 'show_follow'\n end", "def user_follows user_id, pages: 1\n url = API + \"users/#{user_id}/follows?access_token=\" + @access_token\n pages.times do\n get(url)['data'].map do |user|\n @user_ids << user['id']\n end\n url = get(url)['pagination']['next_url']\n end\n export(@user_id_list, @user_ids)\n end", "def followers\n @title = \"Followers\"\n @user = User.find(params[:id])\n @users = @user.followers.paginate(page: params[:page])\n render 'show_follow'\n end", "def user_follows \n if user_signed_in?\n Rails.logger.debug { \"The user to be followed is #{params[:id]}\" }\n user = User.find(id: params[:id])\n user.follows << current_user\n end\n end", "def show\n user = Api::V1::User.find(params[:id])\n unless user.nil?\n render json: user.followings.all\n end\n end", "def show\n user = Api::V1::User.find(params[:id])\n unless user.nil?\n render json: user.followings.all\n end\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 following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\n end", "def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\n end", "def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\n end", "def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.followed_users.paginate(page: params[:page])\n render 'show_follow'\n end", "def user_followers(user_id, params = {})\n get(\"/v1/users/#{user_id}/followers\", params)\n end", "def user_followers user_id, pages: 1\n url = API + \"users/#{user_id}/followed-by?access_token=\" + @access_token\n pages.times do\n get(url)['data'].map do |user|\n @user_ids << user['id']\n end\n url = get(url)['pagination']['next_url']\n end\n export(@user_id_list, @user_ids)\n end", "def followers_ids(user = nil, params = {})\n args = [user, params]\n get path_from_args('followers/ids', args), params_from_args(params)\n end", "def following\n\t@title = \"Following\"\n\t@user = User.find(params[:id])\n\t@users = @user.following.paginate(page: params[:page])\n\trender 'show_follow'\n end", "def followers(id)\n perform_request_with_collection(:get,\n \"/api/v1/accounts/#{id}/followers\",\n {}, Mastodon::Account)\n end", "def following\n\t\tauthenticate_current_user\n\t\t# grab all the current user's following\n\t\tfollowing = UserFollower.where(user_follower_id: current_user.id)\n\t\t# create an empty array\n\t\tfollowing_group = []\n\t\t# rotate through each following returned, and grab the user object\n\t\tfollowing.each do |x|\n\t\t\t# push each following user object into array\n\t\t\tfollowing_group.push(User.find(x.user_id))\n\t\tend\n\t\t# respond with the array of following user objects\n\t\trespond_with following_group\n\n\tend", "def followers\n follower_ids = Follow.where(following_id: id).pluck(:user_id)\n User.where(id: follower_ids)\n end", "def follower\n @users = User.find(params[:id]).followers\n render json: @users\n end", "def get_following(user)\n Follow.find_by(follower_id: self.id, followed_id: user.id)\n end", "def followers(params={})\n args = params.map{|k,v| \"#{k}=#{v}\"}.join('&')\n get(\"/statuses/followers.json?#{args}\")\n end", "def following\n @title = 'Following'\n @user = User.find(params[:id])\n @users = @user.following.paginate(page: params[:page])\n render 'show_follow'\n end", "def following\r\n @title = \"Following\"\r\n @user = User.find(params[:id])\r\n @users = @user.followed_users.paginate(page: params[:page], per_page: 25)\r\n render 'show_follow'\r\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 following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.following.paginate(page: params[:page])\n render 'show_follow'\n end", "def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.following.paginate(page: params[:page])\n render 'show_follow'\n end", "def show_followers\n \t@user = User.find(params[:id])\n \t\n \trender json: @user.followed_by\n end", "def followers\n Follow.where(\"following_id = ?\", self.id)\n end", "def following\n # collect all the users ids that this user is following\n following_ids = follows.pluck(:following_id)\n User.where(id: following_ids)\n end", "def follow_user\n\t\tauthenticate_current_user\n\t\t# add the current user to the user they followed list of followers\n\t\tUser.find(params.user_id).followers.push(User.find(current_user.id))\n\t\t# run the following action to return the updated group of followers\n\t\tfollowing\n\tend", "def followed\n Follower.where(\"follower_id=?\", self.id).map{|f| f.user}\n end", "def following\n @title = \"Following\"\n @user = User.find(params[:id])\n @users = @user.following.paginate(:page => params[:page])\n render 'show_follow'\n end", "def list_followers(id)\n get(\"lists/#{id}/followers\").followers\n end", "def followers\n user = load_user\n\n expose user\n .followers\n .includes(:following, :favorite_restaurants)\n .paginate(page: params[:page], per_page: params[:per_page]),\n each_serializer: UserRelationshipSerializer\n end", "def followings\n b=BeFollow.scoped_by_follower_id(self.id)\n user_ids=b.map do |a|\n a.user.id\n end\n User.find_all_by_id(user_ids)\n end", "def following\n optional! :offset, type: Integer, default: 0\n optional! :limit, type: Integer, default: 20, values: 1..150\n\n @users = @user.follow_users.fields_for_list.order(\"actions.id asc\").offset(params[:offset]).limit(params[:limit])\n end", "def followers(user=nil)\n\t\tself.twitagent.followers(user)\n\trescue => err\n\t\tRAILS_DEFAULT_LOGGER.error \"Failed to get followers via OAuth for #{current_user.inspect}\"\n\t\tflash[:error] = \"Twitter API failure (getting followers)\"\n\t\treturn\n\tend", "def followers\n @followers = Follower.where(:friend_id => @current_user.id)\n end", "def show_follows\n\t@user = User.find(params[:id])\n\n\trender json: @user.follows\n\tend", "def follow\n current_user.follow_user(@user)\n render json: {ok: 1}\n end", "def following\n @following||= get(\"/user/show/#{login}/following\")['users'].map { |u| User.new(connection, :login => u) }\n end", "def following(user_id = nil)\n twitter_request do\n logger.info \"Get following of #{user_id || 'me'}\"\n client.friend_ids(user_id).take(5000)\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\n @followers = current_user.followers.order(\"username\").page(params[:page]).per(10)\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 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 follow\n user = User.find(params[:user_id])\n @follow = current_user.follow(user)\n render json: @follow\n end", "def following(id)\n perform_request_with_collection(:get,\n \"/api/v1/accounts/#{id}/following\",\n {}, Mastodon::Account)\n end", "def follow(user_id)\n follower.create(followed_id: user_id)\n end", "def followers(options={})\n perform_get(\"statuses/followers.#{Twitter.format}\", options)\n end", "def show_follows\n \t@user = User.find(params[:id])\n \t\n \trender json: @user.follows\n end", "def followed\n\t\t@user = User.find(params[:id])\n\t\tcurrent_user.create_rel(\"FOLLOWING\", @user) \n\t\tif request.xhr?\n\t\t\trender json: { count: @user.following.count, id: @user.id }\n\t\telse\n\t\t\tredirect_to @user\n\t\tend\n\n\tend", "def followers\n list = service.find_followers(user).map {|data| build_object(data)}\n followers = list.map {|follower| follower.login}\n end", "def followers\n @user = User.find_by_case_insensitive_username(params[:id])\n\n if @user.nil?\n render :file => \"#{Rails.root}/public/404.html\", :status => 404\n elsif @user.username != params[:id] # case difference\n redirect_to \"/users/#{@user.username}/followers\"\n else\n set_params_page\n\n @feeds = @user.followers\n\n @feeds = @feeds.paginate(:page => params[:page], :per_page => params[:per_page], :order => :id.desc)\n\n set_pagination_buttons(@feeds)\n\n @authors = @feeds.map{|f| f.author}\n\n #build title\n if @user == current_user\n title = \"Your followers\"\n else\n title = \"@#{@user.username}'s followers\"\n end\n\n render \"users/list\", :locals => {:title => title}\n end\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 follower_ids(options={})\n perform_get(\"followers/ids.#{Twitter.format}\", options)\n end", "def deal_followers(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"deals/#{id}/followers\", params)\n end", "def show\n @twitter_user = TwitterUser.find(params[:id])\n @follower_ids = Twitter.follower_ids(@twitter_user.twitter_username).collection\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @twitter_user }\n end\n end", "def follow(*user_ids)\n query_params = user_ids.pop if user_ids.last.is_a?(::Hash)\n query_params ||= {}\n filter(query_params.merge(:follow => user_ids))\n end", "def following_record(user)\n followings_as_follower.find_by(user: user)\n end", "def find_followed_by(user, options = {})\r\n Relationship.find_followed_by(user, [self.relationshiptype_id], options)\r\n end", "def follow(user_id)\n followee_relationships.create(followee_id: user_id)\n end", "def follow\n @data = {:user_id => params[:follow_user_id], :follow_user_id => current_user.id, :followed => 1}\n status = UserFollower.follow(@data)\n render json: {:status => status}\n end", "def follow_user\n user = User.find(params[:user_id])\n authorize! :follow, user\n current_user.follow(user)\n render_success_message(\"You are following #{user.full_name(false)}\")\n end", "def followings\n @followees = @user.followees.order(created_at: :desc) # order the followings(the people that current_user follows) according to when they were followed by current_user, with the most recent following at the top.\n end", "def following\n @users = User.find(params[:id]).all_following\n render json: @users\n end", "def followUser(userToFollow)\n @followers << userToFollow\n end", "def followers\n begin\n @followers = current_user.twitter.get(\"/statuses/followers?page=#{params[:page] || 1}\")\n rescue TwitterAuth::Dispatcher::Error\n @followers = []\n end\n\n status = @followers.empty? ? 404 : 200\n\n respond_to do |format|\n format.html { render(:action => 'followers', :status => status) }\n format.json { render(:json => @followers.to_json, :status => status) }\n end\n end", "def followerss\n followers = relationships.find_by_followed_id(self.id)\n return followers\n end", "def followers\n @title = 'Followers'\n @users = @user.followers.page(params[:page])\n render 'show_follow'\n end", "def index\n unless params[:user_id].blank?\n @user_relationships = UserRelationship.where(follower_id: params[:user_id])\n else\n @user_relationships = UserRelationship.all\n end\n end", "def following\n Follow.where(\"follower_id = ?\", self.id)\n end", "def followers\n @title = \"Followers\"\n @user=User.find(params[:id])\n @other_users=@user.followers.paginate(:page=>params[:page], :per_page => 30)\n respond_to do |format|\n format.html { render 'show_follow' }\n format.json { render json: @other_users }\n end\n end", "def fetch_user_and_followings\n @user = User.find(params[:followee_id])\n @follow = Follow.find_by(follower_id: current_user.id, followee_id: params[:followee_id])\n end", "def user_followed\n amigos = self.friends.pluck(:friend_id)\n User.find(amigos)\n end", "def followings\n @followings = @other_user.followings.paginate(:page => params[:page], :per_page => 20)\n end", "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 user_followers\n self.followers.map{ |f| User.find(f.follower_id) }\n end", "def followers(options = {})\n Tinybucket::Resource::User::Followers.new(username, options)\n end", "def following\n @user = User.find(params[:id])\n @title = @user.firstname + \" Is Following\"\n @turfs = @user.following.paginate(:page => params[:page])\n render 'show_follow'\n end", "def followers\n\t Friendship.findFriends(self,\"follow\",\"from\")\n end", "def followers\n @followers = @other_user.followers.paginate(:page => params[:page], :per_page => 20)\n end", "def followees\n list = service.find_user_follows(user).map {|data| build_object(data)}\n followees = list.map {|followee| followee.login}\n end", "def followers\n user_ids = $redis.smembers(self.redis_key(:followers))\n User.where(:id => user_ids)\n end", "def following\n user = load_user\n\n expose user\n .following\n .includes(:following, :favorite_restaurants)\n .paginate(page: params[:page], per_page: params[:per_page]),\n each_serializer: UserRelationshipSerializer\n end", "def add_follower\n if (@user = find(User, params[:user_id])).is_a?(User)\n current_user.follow(@user)\n redirect_to @user, notice: \"Now you are following #{@user.username}!, and you can read his personal articles and comments!\"\n end\n end", "def follow\n Following.find_or_create_by_follower_id_and_followed_id(current_user.id, params[:user_id])\n @user_id = params[:user_id]\n @followed = true\n render \"shared/follow\"\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 Listfollowers\n follower= Following.where(\"followingid =:followingId\",{followingId:getUserId[0]['userId']}).count\n render json: {follower:follower}, status: :ok\n end", "def index\n @user_followings = UserFollowing.all\n end", "def follow_user(user)\n # Ternary to prevent duplicates\n following?(user) ? following : following << user\n end", "def get_following(user)\r\n ret = []\r\n url = \"/me/friends?fields=id,name,picture&limit=500&access_token=#{user.setting.oauth_facebook}\"\r\n resp = facebook_https.get(url)\r\n if resp.class == Net::HTTPOK\r\n users = JSON.parse(resp.body)[\"data\"]\r\n ret = users.collect{|u| {:name => u['name'], :avatar => u['picture'], :id => u['id']}}\r\n end\r\n ret\r\n end", "def followers\n scrape_for(:followers, :get_followers)\n end" ]
[ "0.84300786", "0.81395066", "0.812883", "0.80016524", "0.7900078", "0.7899384", "0.78491586", "0.7823466", "0.7816126", "0.7796465", "0.7781863", "0.77795184", "0.77795184", "0.7764248", "0.77571243", "0.77571243", "0.77571243", "0.7756899", "0.7745759", "0.7743099", "0.774301", "0.77361447", "0.7730029", "0.77165586", "0.7715499", "0.77034974", "0.7679535", "0.7659663", "0.7648118", "0.7634166", "0.76120466", "0.7611547", "0.7611547", "0.76009357", "0.7587179", "0.75669605", "0.7564959", "0.7548823", "0.7545367", "0.75441337", "0.7528196", "0.75050896", "0.749719", "0.7487002", "0.7482189", "0.7477071", "0.7468799", "0.74683505", "0.7467848", "0.74604446", "0.74437934", "0.7439685", "0.74308425", "0.7425261", "0.742204", "0.74201876", "0.73998165", "0.7399695", "0.7394453", "0.7355089", "0.73511136", "0.7332797", "0.7317794", "0.7309193", "0.72881466", "0.72877365", "0.72837865", "0.7278892", "0.72717685", "0.7269275", "0.7265556", "0.72579396", "0.72408867", "0.72367656", "0.723316", "0.7233113", "0.72280395", "0.7222582", "0.72222394", "0.722188", "0.7217786", "0.7206251", "0.7188782", "0.71736884", "0.71605474", "0.7150775", "0.71467817", "0.71423346", "0.7133092", "0.7126147", "0.7126083", "0.71257746", "0.7122076", "0.71213996", "0.71202075", "0.7115606", "0.71091354", "0.7090856", "0.70832515", "0.70800406" ]
0.7648264
28
causes user with id1 to unfollow the user with id2 DELETE
def delete_follows @follower = User.find(params[:id]) @followed = User.find(params[:follows_id]) @follower.follows.delete(@followed) head :no_content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unfollow(other_user_id)\n \tuser_to_unfollow = User.find_by(id: other_user_id)\n active_relationships.find_by(followed_id: user_to_unfollow.id).destroy\n end", "def unfollow(other_user)\n \tactive_relationships.find_by(followed_id: other_user.id).destroy\n \tend", "def unfollow!(other_user)\n relationships.find_by_followed_id(other_user.id).destroy\n end", "def unfollow!(other_user)\n relationships.find_by_followed_id(other_user.id).destroy\n end", "def unfollow!(other_user)\n relationships.find_by_followed_id(other_user.id).destroy\n end", "def unfollow!(other_user)\n relationships.find_by_followed_id(other_user.id).destroy\n end", "def unfollow!(other_user)\n relationships.find_by_followed_id(other_user.id).destroy\n end", "def unfollow!(other_user)\n relationships.find_by(followed_id: other_user.id).destroy\n end", "def unfollow(other_user)\n active_follows.find_by(followed_id: other_user.id).destroy\n end", "def unfollow!(other_user)\n relationships.find_by(followed_id: other_user.id).destroy!\n end", "def unfollow(other_user)\n following.delete(other_user)\n end", "def unfollow(other_user)\n following.delete(other_user)\n end", "def unfollow(other_user)\n following.delete(other_user)\n end", "def unfollow(other_user)\n following.delete(other_user)\n end", "def unfollow(other_user)\n active_relationships.find_by(followed_id: other_user.id).destroy\n end", "def unfollow(other_user)\n active_relationships.find_by(followed_id: other_user.id).destroy\n end", "def unfollow(other_user)\n active_relationships.find_by(followed_id: other_user.id).destroy\n end", "def unfollow\n unfollow = User.where(:username => params[:id]).first\n relationship = @current_user.followers.where( :friend_id => unfollow.id ).first\n relationship.destroy\n redirect_to user_path( unfollow.username )\n end", "def unfollow!(other_user)\n\t\tself.relationships.find_by_followed_id(other_user.id).destroy\n\tend", "def unfollowed(other_user)\n passive_relationships.find_by(follower_id: other_user.id).try(:destroy) \n end", "def unfollow(other_user)\n following_relationships.find_by(followed_id: other_user.id).destroy\n end", "def unfollow(other_user)\n\t\tactive_relationships.find_by(followed_id: other_user.id).destroy\n\tend", "def unfollow!(user)\n relationships.find_by_followed_id(user).destroy\n end", "def user_unfollows\n if user_signed_in?\n Rails.logger.debug { \"The user to be unfollowed is #{params[:id]}\" }\n user = User.find(id: params[:id])\n user.follows.delete(current_user)\n end\n \n end", "def destroy\n user = Relationship.find(params[:id]).followed\n @current_user.unfollow(user)\n redirect_to user\n end", "def unfollow_user(user)\n following.delete(user)\n end", "def unfollow\n @user = User.find(params[:follow_id])\n\n current_user.following.delete(params[:follow_id].to_i)\n @user.followers.delete(current_user.id)\n\n current_user.save\n @user.save\n \n if current_user.save\n flash[:success] = \"You are no longer following #{@user.username}!\"\n redirect_to root_path\n else\n flash[:error] = \"Something went wrong.\"\n end\n #show_followers\n end", "def unfollow! followee\n following_ids.delete(followee.id)\n save\n followee.followers_ids.delete(id)\n followee.save\n end", "def unfollow(user)\n user.followers.delete(self)\n end", "def delete_follower\n if (@user = find(User, params[:user_id])).is_a?(User)\n current_user.unfollow(@user)\n redirect_to @user, notice: \"You are not following #{@user.username} anymore!\"\n end\n end", "def ufu\r\n \r\n @follow = FollowUser.where(user_id: @u_id, second_user_id: params[:id])\r\n if @follow[0].destroy\r\n redirect_to follow_path\r\n end\r\n end", "def unfollow_user\n\t\tauthenticate_current_user\n\t\t# destroy the current user from that user's followers\n\t\tUser.find(params.user_id).followers.destroy(User.find(current_user.id))\n\t\t# run the following action to return the updated group of followers\n\t\tfollowing\n\tend", "def unfollow!(user)\n followings.find_by(following_id: user.id)&.destroy!\n end", "def unfollow_user(follow_user)\n #before we can destroy the link we must check if the user is already not following the other user\n #or if the user is trying to unfollow themself.\n #if the user can follow the other user then that means no relationship exists\n if can_follow?(follow_user)\n raise \"Can't unfollow yourself or a user that you are not already following!\"\n else\n followRel = Follow.find(:first, :conditions => {:user_id => self.id, :follow_user_id => follow_user.id})\n followRel.destroy\n end\n end", "def unfollow(user_a, user_b)\n\t\t#This method deletes the follow relationship in the database\n\t\tuser_a.unfollow(user_b)\n\n\t\tif REDIS.exists(user_a.handle+\"_relations\")\n\t\t\tREDIS.srem(user_a.handle+\"_relations\", params[:userid])\n\t\tend\n\t\tif REDIS.exists(user_a.handle+\"_num_following\")\n\t\t\tREDIS.decr(user_a.handle+\"_num_following\")\n\t\tend\n\t\tif REDIS.exists(user_b.handle+\"_num_followers\")\n\t\t\tREDIS.decr(user_b.handle+\"_num_followers\")\n\t\tend\n\tend", "def unfollow(user)\n self.following.delete(user)\n end", "def unfollow\n fs = Friendship.where(user_id: current_user, friend_id: params[:id]).first\n if fs\n fs.destroy\n redirect_to user_url(params[:id]), notice: \"This user was removed from your list of friends.\"\n else\n flash.alert = \"Something went wrong. You weren't following that user.\"\n redirect_to users_url\n end\n end", "def unfollow\n user_id = params[:id]\n following_user_id = (params[:following_user_id] || params[:connected_user_id])\n\n if (user_id.present? and following_user_id.present?)\n user = User.find_by_id(user_id)\n following_user = User.find_by_id(following_user_id)\n\n if (!user.nil? and !following_user.nil?)\n if !user.follows.exists?(following_user)\n message = t('user.unfollow.messages.already_not_following', {following_user_name: following_user.name})\n else\n followed_following_obj = user.unfollow(following_user_id)\n if followed_following_obj.nil?\n message = t('user.unfollow.messages.failure', { following_user_name: following_user.name })\n else\n message = t('user.unfollow.messages.success', { following_user_name: following_user.name })\n end\n end\n else\n message = t('user.unfollow.errors.no_user_found', { user_id: user_id, following_user_id: following_user_id })\n end\n else\n message = t('user.unfollow.errors.could_not_process_unfollow')\n end\n\n redirect_to :back, flash: { notice: message }\n end", "def unfollow\n current_user.unfollow_user(@user)\n render json: {ok: 1}\n end", "def unfollow\n @user = User.find_by_id(params[:id])\n if @user and current_user.unfollow(@user)\n flash[:notice] = \"You are no longer following #{@user.login} :(\"\n redirect_to home_path()\n elsif @user\n flash[:notice] = \"You aren't following #{@user.login}\"\n redirect_to user_path(@user.login)\n else\n redirect_to home_path()\n end\n end", "def unfollow! followee\n return if !following? followee\n following_ids.delete(followee.id)\n save\n followee.followers_ids.delete(id)\n followee.save\n end", "def destroy\n @user = User.find(params[:id])\n if @user\n current_user.unfollow(@user)\n flash[:notice] = \"Unfollow #{@user.username}\"\n else\n flash[:notice] = 'Something happens please try again'\n end\n redirect_to request.referer\n end", "def unfollow_user\n user = User.find(params[:user_id])\n current_user.unfollow(user)\n render_success_message(\"You are not anymore following #{user.full_name(false)}\")\n end", "def unfollow(user_id, followee_id)\n @follows[user_id] = { user_id => 1 } unless @follows.key?(user_id)\n @follows[user_id][followee_id] = nil\n end", "def unfollow\n if @user_auth.nil?\n raise ActionController::MethodNotAllowed, 'Vous n\\'êtes pas connecté'\n elsif @user_auth.id != @user_followed.id\n follow = Follow.find_by(follower_user_id: @user_auth.id, followed_user_id:@user_followed.id)\n if follow.destroy\n redirect_back fallback_location: '/', notice: \"Vous ne suivez plus #{@user_followed.name}\"\n else\n redirect_back fallback_location: '/', error: \"Impossible de follow l'utilisateur\"\n end\n else\n redirect_back fallback_location: '/', error: 'Vous ne pouvez pas vous auto unfollow'\n end\n end", "def unfollow_user\n\t\t# determine who is following who\n\t @follower = current_user\n @following = User.find_by_login(params[:username])\n @user = @following\n\n\t\t# if follower was self, unknown\n if @follower.id == @following.id\n gflash :error => \"Unknown request!\"\n redirect_back_or_default('/')\n end\n\n\t\t# see if user is being followed \t\n exist = Follow.find(:first, :conditions => {:follower_id => @follower.id, :following_id => @following.id})\n if exist\n\t\t\t# if he is, erase from database\n exist.destroy\n\t\t\t# show pop up regarding unfollow success\n gflash :success => \"You are no longer following #{@following.login}!\"\n else\n gflash :error => \"You are already not following #{@following.login}!\"\n end\n redirect_to :action => 'profile', :username => @following.login\n end", "def fu\r\n @follow = FollowUser.new(:user_id => @u_id, :second_user_id => params[:id])\r\n if @follow.save\r\n redirect_to follow_path\r\n end\r\n @follow = FollowUser.where(user_id: @u_id, second_user_id: params[:id])\r\n if @follow[0].destroy\r\n redirect_to follow_path\r\n end\r\n end", "def unfollow(other_person)\n active_relationships.find_by(followed_id: other_person.id).destroy\n end", "def unfollow(user)\n following = out_followings.find_by(to_id: user.id)\n if following\n following.destroy\n true\n else\n false\n end\n end", "def unfollow!(followed)\n relationships.find_by_followed_id(followed).destroy\n end", "def unfollow!(followed)\n relationships.find_by_followed_id(followed).destroy\n end", "def unfriendship\n if params[:id]\n current_user.follow_ids.delete(params[:id])\n @user = User.find(params[:id]).del_follower(current_user)\n @user.save\n current_user.save\n end\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.js\n end\n end", "def unfollow\n @user = User.friendly.find(params[:user_id])\n\n @follow = Follow.find_by followable_id: @user.id, follower_id: current_user.id\n @follow.status = 2\n \n if @follow.save\n render :json => {:success => true}\n else \n render :json => {:success => false}\n end\n end", "def unfollow\n \n # Get the specified user, making sure that it exists\n @user = User.find_by_login(params[:user_login])\n \n # Find the follow relationship between the current user and the specified\n # user\n @follow = Follow.find(:first, :conditions => \"follower_id = #{current_user.id} and followee_id = #{@user.id}\")\n \n # Destroy the follow relationship\n @follow.destroy\n current_user.save!\n \n # Redirect back to the profile of the user that was being followed\n flash[:notice] = \"You are no longer following #{@user.login}.\"\n redirect_to user_profile_url(:user_login => @user.login)\n end", "def unfollow\r\n @relationship = Relationship.where(follower_id: current_user.id, followed_id: params[:followed_id]).first\r\n @relationship.create_activity key: 'relationship.unfollow', owner: current_user, recipient: User.find(params[:followed_id]) \r\n @relationship.destroy\r\n render json: { message: \"Relationship destroyed successfully\" }\r\n end", "def destroy\n @follow = Follow.where(follower_id: current_user.id, followed_id: params[:id]).first\n @follow.destroy\n redirect_to users_path, notice: 'You successfully unfollowed'\n end", "def delete_follower(user)\n followers.delete(user)\n end", "def delete_follows\n \t@follower = User.find(params[:id])\n \t@followed = User.find(params[:follows_id])\n \t\n \tif @follower.follows.delete(@followed)\n \t\t\n \telse\n \t\trender json @follower.errors\n \tend\n end", "def destroy_following\n user = User.find(params[:id])\n current_user.followings.where(following_id: user.id).destroy_all\n end", "def destroy\n @user = User.find(params[:user_id])\n @follower = @user.follower.find(params[:id])\n @follower.destroy\n head :no_content\n end", "def unfollow\n \t\n \t\t@fol = Follow.find_by_follower_and_followee(session[:id], params[:aid])\n \t\tif @fol == nil\n \t\t\tflash[:error] = \"wtf????\"\n \t\telse\n \t\t\t@sql = \"DELETE FROM follows WHERE follower = \"+@fol.follower.to_s+\" AND followee = \"+@fol.followee.to_s\n \t\tActiveRecord::Base.connection.execute(@sql)\n \t\t\n \t\t#if request.xhr?\n \t\t\trender 'accounts/unfollow'\n \t\t\t#else\n \t\t\t\t#redirect_to :controller => :main, :action => :searching\n \t\t\t#end\n \t\tend\n \t\t\n \t \t\n end", "def destroy_user(id)\n #TODO:\n # ADD SOME USER LEVEL TO AVOID THESE\n end", "def follower_following_delete\n @follower_following = FollowerFollowing.find(params[:id])\n \n @group_user = GroupUser.find_by_sql([\"SELECT gu.* FROM (group_users gu LEFT JOIN groups g ON g.id=gu.group_id) WHERE (g.user_id=#{@login_user.id} AND gu.user_id=#{@follower_following.following.id}) OR (g.user_id=#{@follower_following.following.id} AND gu.user_id=#{@login_user.id})\"])#:user_id=>@login_user.id,:group_id=>group.id)\n @group_user = GroupUser.find_by_sql([\"SELECT gu.* FROM (group_users gu LEFT JOIN groups g ON g.id=gu.group_id) WHERE (g.user_id=#{@follower_following.follower.id} AND gu.user_id=#{@login_user.id}) OR (g.user_id=#{@login_user.id} AND gu.user_id=#{@follower_following.follower.id})\"]) if @group_user.blank?\n @group_user.each do |g_u|\n g_u.destroy\n end\n @follower_following.destroy\n render :text=>\"Success\"\n end", "def destroy\n @user = Relationship.find(params[:id]).followed\n current_user.unfollow(@user)\n respond_to do |format|\n format.html { redirect_to @user }\n format.js\n end\n end", "def remove\n begin\n followee = User.find(params[:id])\n rescue Exception => e\n flash[:error] = \"Couldn't find followee \"+params[:id].to_s\n end\n if current_user && followee\n current_user.followees.delete followee\n current_user.save\n flash[:notice] = \"There you go! No longer following \"+followee.handle\n else\n flash[:error] ||= \": No current user\"\n end\n redirect_to root_path\n end", "def destroy\n @user = Relationship.find(params[:id]).followed\n current_user.unfollow!(@user)\n respond_to do |format|\n format.html { redirect_to @user }\n format.js\n end\n end", "def destroy\n @user = Relationship.find(params[:id]).followed\n current_user.unfollow!(@user)\n respond_to do |format|\n format.html { redirect_to @user }\n format.js\n end\n end", "def destroy\n rel = current_user.active_relationships.find_by(followed_id: params[:id])\n @user = Relationship.find(rel).followed\n current_user.unfollow(@user)\n\n respond_with @user\n # respond_to do |format|\n # format.html {redirects_to @user}\n # format.js\n # end\n end", "def destroy\n @api_v1_follower = Api::V1::Follower.where('follower_id =? and user_id =?', @current_user.id, params[:id]).first\n if @api_v1_follower.destroy\n head :no_content\n else \n render json: { error: 'not allowed' }, status: 401\n end\n end", "def remove_follower\n @user = User.friendly.find(params[:user_id])\n\n @follow = Follow.find_by followable_id: current_user.id, follower_id: @user.id\n @follow.status = 2\n\n if @follow.save\n render :json => {:success => true}\n else\n render :json => {:success => false}\n end\n end", "def destroy\n response = current_user.unfollow_item(params[:id])\n redirect_to items_path\n end", "def unfollow(from_id, to_id, scope = Amico.default_scope_key)\n return if from_id == to_id\n\n Amico.redis.multi do\n Amico.redis.zrem(\"#{Amico.namespace}:#{Amico.following_key}:#{scope}:#{from_id}\", to_id)\n Amico.redis.zrem(\"#{Amico.namespace}:#{Amico.followers_key}:#{scope}:#{to_id}\", from_id)\n Amico.redis.zrem(\"#{Amico.namespace}:#{Amico.reciprocated_key}:#{scope}:#{from_id}\", to_id)\n Amico.redis.zrem(\"#{Amico.namespace}:#{Amico.reciprocated_key}:#{scope}:#{to_id}\", from_id)\n Amico.redis.zrem(\"#{Amico.namespace}:#{Amico.pending_key}:#{scope}:#{to_id}\", from_id)\n Amico.redis.zrem(\"#{Amico.namespace}:#{Amico.pending_with_key}:#{scope}:#{from_id}\", to_id)\n end\n end", "def delete_from_db(user_id)\n @table_follows.where(user_id: user_id).delete\n end", "def unfollow\n user = User.find(params[:user_id])\n @unfollow = current_user.stop_following(user)\n render json: @unfollow\n end", "def unfollow_location(user_id, location_id)\n # need to cover case where we try to unfollow same location twice. Should be an if check for a nil return value, only\n # delete if user_id AND location_id are in the table\n @unfollow = Following.where(\"user_id = ? AND location_id = ?\", user_id, location_id)\n Following.destroy(@unfollow)\n end", "def unfollow\n requested_profile.unfollow!(requested_follow_profile)\n redirect_to :action => 'following', :profile_id => current_user.profile\n end", "def destroy\n another_user = User.find params[:user_id]\n current_user.friends.delete(another_user)\n redirect_to users_path\n end", "def del_follow\n current_user.del_follow(@user)\n\n respond_to do |format|\n format.html { redirect_to wall_user_path(@user) }\n format.json { render :json => { user: @user.as_json(:json => 'wall') }}\n end\n end", "def unfollow\n userToUnFollow = User.find_by_id(params[:id])\n begin\n if userToUnFollow\n @currentUser.unfollow_user(userToUnFollow)\n flash[:notice] = \"#{userToUnFollow} unfollowed successfully\"\n end\n rescue Exception => e\n flash[:notice] = e.message\n end\n #Do not want to display a blank search page to the user - head to the user index\n if session[:last_page] == search_path\n redirect_to(:action => \"index\")\n else\n redirect_to(session[:last_page])\n end\n end", "def destroy\n @user = User.find(params[:id])\n\n if @user.id == current_user.id\n redirect_to :back, notice: 'user.delete_self'\n return\n elsif @user.id < current_user.id\n redirect_to :back, notice: 'user.delete_admin_with_smaller_ID'\n return\n end\n\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url, notice: 'user.deleted' }\n format.json { head :no_content }\n end\n end", "def destroy\n head 404\n # @api_v1_following = Api::V1::Follower.where('following_id =? and user_id =?', @current_user.id, params[:id]).first\n # if @api_v1_following.destroy\n # head :no_content\n # else \n # render json: { error: 'not allowed' }, status: 401\n # end\n end", "def unfollow_user(follower, following)\n User.where(handle: follower).first.pull(:following, following)\n end", "def unlink_user\n user and update(email: user.email, user_id: nil)\n end", "def unfollow_fan_base!(followed)\r\n fan_relationships.find_by_followed_id(followed).destroy\r\n end", "def unfollow_location(user_id, location_id)\n Following.find_by_sql(\"SELECT * FROM following f WHERE f.follower_id = ? AND f.location_id = ?\", user_id, location_id).destroy\n end", "def remove_user_by_id(user_id)\n # ........\n end", "def destroy_arbitrary_friendship\n user_1 = current_admin.users.find(params[:user_1])\n user_2 = current_admin.users.find(params[:user_2])\n Friendship.destroy_arbitrary_friendship(user_2, user_1 )\n puts \"=============================================================\"\n redirect_to :back, :notice => \"#{user_1.username} totally hates #{user_2.username} and vice-versa, DE-FRIENDSHIP COMPLETE\"\n end", "def destroy\n @user_follow_user = UserFollowUser.find(params[:id])\n @user_follow_user.destroy\n\n respond_to do |format|\n format.html { redirect_to user_follow_users_url }\n format.json { head :ok }\n end\n end", "def stop_following(user, target)\n return false if user.blank? || target.blank?\n friend = self.find(:first, :conditions => {:inviter_id => user.id, :invited_id => target.id})\n if friend\n friend.destroy\n else\n false\n end\n end", "def delete\n begin\n super(@partnership.user1)\n rescue CoachClient::Exception\n super(@partnership.user2)\n end\n end", "def destroy\n @follow = Follow.where(:follower_id => session[:user_id], :followee_id => params[:id])\n @follow.destroy\n\n respond_to do |format|\n format.html { redirect_to :back, notice: \"You are now longer following #{User.find_by_id(params[:id]).username}\" }\n format.json { head :no_content }\n end\n end", "def destroy\n if @relation.user1_id == @currentUser.id or @currentUser.role == 0\n @relation.destroy\n respond_to do |format|\n format.html { redirect_to relations_url, notice: 'Relation was successfully destroyed.' }\n format.json { head :no_content }\n end\n else\n redirect_to relations_url, notice: 'You cant revoke anothers users queries'\n end\n end", "def destroy\n @turf = Relationship.find(params[:id]).followed\n current_user.unfollow!(@turf)\n respond_to do |format|\n format.html { redirect_to \"/users\" }\n format.js\n end\n end", "def unfollow\n @data = {:user_id => params[:follow_user_id] , :follow_user_id => current_user.id}\n status = UserFollower.unfollow(@data)\n render json: {:status => status} \n # render layout: \"homepage\"\n\n end", "def delete_user\n end", "def deleteuser(del_id)\n db.execute(\"DELETE FROM users WHERE user_id=?\", del_id)\n db.execute(\"DELETE FROM listings WHERE user_id=?\", del_id)\nend", "def destory\n User.find(params[:id]).destory\n flash[:success] = \"用户已删除\"\n redirect_to users_url\n end", "def destroy\n current_account.unfollow(@account)\n respond_to do |format|\n format.html { redirect_to account_url }\n format.json { render :status }\n end\n end", "def unfollow\n if request.post?\n @unf_ids = params[:unfollow]\n \n #unf_str = \"\"\n #unf_cnt = unf_ids.length - 1\n #for i in 0..unf_cnt\n # unf_str +=unf_ids[i].to_s\n # unf_str += \",\" unless unf_cnt == i\n #end\n if @unf_ids.nil? || @unf_ids.length < 1\n else\n @unf_ids.each do |unfo| \n hydra = Typhoeus::Hydra.new\n uri = \"http://api.twitter.com/1/friendships/destroy.json\"\n req = Typhoeus::Request.new(uri,\n :method =>\"post\",\n :params =>{:user_id=>unfo, :include_entities=>\"true\"})\n \n sign_request(req,uri)\n hydra.queue(req)\n hydra.run\n #puts req.response.inspect\n end\n end\n end\n respond_to do |format|\n format.js\n end\n end", "def Unfollow\n \n @kite = Kite.find(params[:id])\n \n if current_user\n @following = current_user.follwing.where(:Type => params[:type], :kite_id =>params[:id]).first\n end\n\n respond_to do |format|\n if @following && @following.destroy\n format.html { redirect_to(@kite, :notice => 'Kite has been unfollowed.')}\n format.xml { render :xml => @kite, :status => :created, :location => @kite }\n format.js {}\n format.json { render :json => @following, :status => :success }\n else\n format.html { render :action => \"owner_show\" }\n format.xml { render :status => :failure }\n format.js {}\n format.json { render :status => :unprocessable_entity }\n end\n end\n\n end" ]
[ "0.8186295", "0.7986248", "0.79437536", "0.79437536", "0.79437536", "0.79437536", "0.79437536", "0.7936696", "0.79340196", "0.78898203", "0.78401005", "0.7838987", "0.7838987", "0.7838987", "0.782432", "0.782432", "0.782432", "0.776968", "0.7761406", "0.7756433", "0.774717", "0.77344346", "0.7727749", "0.7643762", "0.76113844", "0.7610035", "0.7600369", "0.75650215", "0.7554124", "0.7547258", "0.75404334", "0.7523155", "0.7498031", "0.74910736", "0.74810326", "0.74694", "0.7468314", "0.7408798", "0.739464", "0.73858005", "0.7370702", "0.7331432", "0.7255872", "0.7253566", "0.71956617", "0.7188883", "0.7173727", "0.71730006", "0.7120282", "0.7114989", "0.7114989", "0.7110526", "0.7098283", "0.7093998", "0.7083878", "0.7066882", "0.7034117", "0.7020966", "0.6990534", "0.6975959", "0.6940226", "0.6891052", "0.6860128", "0.6851373", "0.68458295", "0.6830042", "0.6830042", "0.68286717", "0.68091995", "0.68023", "0.6785501", "0.67832834", "0.6773272", "0.6757917", "0.67552704", "0.6742949", "0.6725123", "0.6720762", "0.67179215", "0.67115974", "0.6706347", "0.67018324", "0.667949", "0.6665652", "0.66334796", "0.6617288", "0.6598127", "0.6593635", "0.658354", "0.65684414", "0.6543559", "0.6527693", "0.6517685", "0.6508579", "0.6507003", "0.6498783", "0.64897466", "0.6483758", "0.64831734", "0.6478888" ]
0.7006976
58
GET /admin_panels GET /admin_panels.json
def index @experiments = Experiment.where(pend_status: [0]) @experiments_wait = Experiment.where(pend_status: [1]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @panels = Panel.all\n end", "def admin_panel_params\n params[:admin_panel]\n end", "def set_admin_panel\n @admin_panel = AdminPanel.find(params[:id])\n end", "def index\n @port_panels = PortPanel.all\n end", "def index\n @collections = Rack::WebProfiler::Model::CollectionRecord.order(Sequel.desc(:created_at))\n .limit(20)\n\n return json(@collections, to_json_opts: {\n only: [:token, :http_method, :http_status, :url, :ip]\n }) if prefer_json?\n\n erb \"panel/index.erb\", layout: \"panel/layout.erb\"\n end", "def previews\n @session_user = User.find(session[:user_id])\n @page = @session_user.page\n panels = Array.new\n for panel in @page.panels.order(:created_at)\n fields = get_panel_preview(panel) \n panels.push(fields)\n end\n render json: panels\n end", "def options\n @session_user = User.find(session[:user_id])\n @page = @session_user.page\n options = Array.new\n for panel in @page.panels.order(:created_at)\n if panel.type == 'MSelectpanel' || panel.type == 'SSelectpanel'\n if panel.options\n for option in panel.options.order(:created_at)\n options.push(option)\n end\n end \n end \n end\n render json: options\n end", "def index\n @panel_models = PanelModel.all\n end", "def show_panel\n @tab_name = params[:panel_name]\n @panel_name = params[:panel_name] == \"properties\" ? \"prop_sheet\" : params[:panel_name]\n @all_pages = @question_sheet.pages # for pages_list\n @page = @question_sheet.pages.find(params[:id])\n\n respond_to do |format|\n format.js # load panel\n end\n end", "def create\n @admin_panel = AdminPanel.new(admin_panel_params)\n\n respond_to do |format|\n if @admin_panel.save\n format.html { redirect_to @admin_panel, notice: 'Admin panel was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_panel }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_panel.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @cpanel_malls = Cpanel::Mall.all\n end", "def show\n render json: @admin\n end", "def show_admin\n screen_name(\"Inicial-Admin\")\n\n distribute_ots\n\n respond_to do |format|\n format.html { render action: \"show_admin\" }\n format.json { head :ok }\n end\n end", "def index\n @control_panels = ControlPanel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @control_panels }\n end\n end", "def get_dashboards\n @dash_service.get_dashboards\n end", "def index\n @admin_stages = Clapme::Stage.all\n end", "def destroy\n @admin_panel.destroy\n respond_to do |format|\n format.html { redirect_to admin_panels_url }\n format.json { head :no_content }\n end\n end", "def index\n\n if @user.admin == false\n @panels = Panel.all(:order => 'date_made DESC', :conditions => {:live_state => \"Live\"})\n else\n @panels = Panel.all(:order => 'date_made DESC')\n end\n @visuals = Visualization.find_all_by_user_id(@user)\n @compiles = Compilation.find_all_by_user_id(@user)\n @links = Linkalation.find_all_by_user_id(@user)\n\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @panels }\n end\n end", "def admin_labs\n self.roles.where(name: \"admin\", resource_type: \"Lab\")\n end", "def index\n @admins = Admin.all\n\n render json: @admins\n end", "def panel\r\n \t@authq = params[:authq] || \"\"\r\n \t@auth_type = params[:type] || \"\"\r\n \t# This should return the JSON for solr documents\r\n results = get_browse_info(@authq, @auth_type)\r\n @data = results[0]\r\n heading = @data[\"heading\"]\r\n #Call helper method to see whether external data should or should not be included within panel\r\n #This used to be @authq but changing it because the parameter from the link may have different\r\n #ending punctuation than the heading in the browse. Relying entirely on heading now\r\n permissions_key = heading.delete_prefix('\"').delete_suffix('\"')\r\n @exclusions = check_permissions(permissions_key)\r\n render \"panel\"\r\n \r\n end", "def index\n @admin_dashboards = Admin::Dashboard.all\n end", "def update\n respond_to do |format|\n if @admin_panel.update(admin_panel_params)\n format.html { redirect_to @admin_panel, notice: 'Admin panel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_panel.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_panel\n @panel = Panel.find(params[:id])\n end", "def index\n @portal_configs = Portal::Config.all\n end", "def index\n @admin_collaborators = Admin::Collaborator.all\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @admin_collaborators }\n end\n end", "def create_empty_panel\n\n # Lookup panel meta\n path = \"/slm/panel/getCatalogPanels.sp\"\n params = {:cpoid => @project_oid,\n :_slug => \"/custom/#{@page_oid}\",\n :ignorePanelDefOids => ''} # empty ignorePanelDefOids apparently is required\n response = rally_get(path, params)\n\n panels = JSON.parse(response.body)\n custom_html_panel_oid = nil\n panels.each do |panel|\n custom_html_panel_oid = panel['oid'] if panel['title'] == \"Custom HTML\"\n end\n \n # Create new panel\n request_path = \"/slm/dashboard/addpanel.sp\"\n params = {:cpoid => @project_oid, :_slug => \"/custom/#{@page_oid}\"}\n path = construct_get(request_path, params)\n\n form_data = {\"panelDefinitionOid\" => custom_html_panel_oid,\n \"dashboardName\" => \"#{@tab_name}#{@page_oid}\",\n \"col\" => 0,\n \"index\" => 0}\n response = rally_post(path, form_data)\n\n # response is json that just contains oid e.g. {\"oid\": \"1234556\"}\n panel_oid = JSON.parse(response.body)['oid']\n\n return panel_oid\n end", "def show\n @admin_level = AdminLevel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_level }\n end\n end", "def index\n @panel_subscriptions = Panel::Subscription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @panel_subscriptions }\n end\n end", "def index\n @admin_levels = Admin::Level.all\n end", "def index\n @world_admins = WorldAdmin.all\n end", "def new\n @panel = Panel.new( :status => Status.active )\n @place = Place.find(params[:place_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @panel }\n end\n end", "def show\n @admin_side_menu = Admin::SideMenu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_side_menu }\n end\n end", "def index\n authorize Admin\n @admins = initialize_grid(Admin.where(\"id != ?\", current_admin.id).order('id desc'), per_page: 10)\n end", "def index\n @admin_admins = Admin::Admin.page(params[:page]).per(15).load\n end", "def show\n @admin_collaborator = Admin::Collaborator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_collaborator }\n end\n end", "def show\n @pool = @current_user.pools.find_by(id: params[:id])\n render layout: 'angular'\n end", "def show\n @panel = Panel.find(params[:id])\n @place = Place.find(params[:place_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @panel }\n end\n end", "def show\n @lab_permissions_role = LabPermissionsRole.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_permissions_role }\n end\n end", "def index\n @cohorts = current_user.accessible_cohorts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cohorts }\n end\n end", "def show\n @panel_plan = Panel::Plan.find(params[:id])\n @features = Panel::Planfeature.where(:panel_plan_id => params[:id]).all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @panel_plan }\n end\n end", "def length\n return @panels.length\n end", "def index\n @team_admins = TeamAdmin.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @team_admins }\n end\n end", "def show\n @admin = Admin.find(params[:id])\n @admins = Admin.all\n end", "def admin_dashboard_params\n params[:admin_dashboard]\n end", "def port_panel_params\n params[:port_panel]\n end", "def dashboard_admin\n @user = current_user\n @users = User.all\n @grid = AdminsGrid.new(params[:admins_grid]) do |scope|\n scope.page(params[:page]).per(10)\n end\n @index_path = request.path\n end", "def show\n @lab_role = LabRole.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_role }\n end\n end", "def index\n @admins = Admin.accessible_by(current_ability, :index).limit(20)\n respond_to do |format|\n format.json { render :json => @admins }\n format.xml { render :xml => @admins }\n format.html\n end\n end", "def index\n @collections = Rack::WebProfiler::Model::CollectionRecord.order(Sequel.desc(:created_at))\n .limit(20)\n\n erb \"panel/index.erb\", layout: \"panel/layout.erb\"\n end", "def static\n\t\t@scroll = Scroll.find(params[:id])\n\t\t@panels = Panel.find_all_by_scroll_id(params[:id],:order => \"panel_id\")\n\tend", "def index\n @roles = Role.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @roles }\n format.json { render :json => @roles.to_json(:only => [:id, :code, :name, :definition]) }\n format.js { render (:update){ |page| page[dom_id_nested(:index)].replace :file => \"admin/roles/index\" } }\n end\n end", "def show\n @panel = Panel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @panel }\n end\n end", "def index\n @admins = Admin.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admins }\n end\n end", "def index\n @admin_administrators = Admin::Administrator.page(params[:page])\n end", "def index\n @administrators = Administrator.all\n end", "def index\n @administrators = Administrator.all\n end", "def index\n @administrators = Administrator.all\n end", "def index\n id = params[:ids].first.split(\":\").third\n assignment = AllAboard::PerspectiveAssignment.find(id)\n respond_with assignment.configurable_attributes\n end", "def show\n @admin = Admin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin }\n end\n end", "def admin_panel\n respond_with :message, text: t('telegram_bot.texts.show_admin_menu'), reply_markup: {\n inline_keyboard: admin_menu\n }\n end", "def index\n @admin = Admin.find_by(id: session[:admin_id])\n @admins = Admin.select_admins_to_show(@admin)\n end", "def index\n @systemadmins = Systemadmin.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @systemadmins }\n end\n end", "def show\n @panel = Panel.find(params[:id])\n @contents = @panel.contents.all(:order => '\"order\"')\n @links = @panel.links.all(:order => '\"order\"')\n @links_count = @panel.links.count\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @panel }\n end\n end", "def show\n @level_container = LevelContainer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @level_container }\n end\n end", "def show\n @administration = Administration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end", "def show\n content = User.all\n render response: { dashboard: content }\n end", "def index\n @tab = :admins\n @entities = Entity.all\n end", "def dashboard\n @players = User.all\n verify_session() #ApplicationHelper::UserInterface\n retreiveChallenges #UserHelper::ChallengeInterface\n end", "def set_port_panel\n @port_panel = PortPanel.find(params[:id])\n end", "def index\n @admin_slider_items = SliderItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_slider_items }\n end\n end", "def index\n @dbadmins = Dbadmin.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dbadmins }\n end\n end", "def index\n @current_admin_user = current_admin_user\n @menus = Menu.all\n @title = \"Menus\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @menus }\n end\n end", "def new\n @panel_plan = Panel::Plan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @panel_plan }\n end\n end", "def set_admin_dashboard\n @admin_dashboard = Admin::Dashboard.find(params[:id])\n end", "def index\n @active_page = :settings\n @settings = Setting.editable.order(\"#{@sort_field} #{@sort_direction}\").page(@current_page).per(@page_limit)\n @settings_count = Setting.editable.count\n\n respond_to do |format|\n format.html { render layout: 'admin' }\n format.json do\n settings = @settings.map do |s|\n {\n key: s.key,\n alt: s.alt,\n value: s.type == 'password' ? '********' : s.value,\n type: s.type,\n id: s.id\n }\n end\n render json: { settings: settings, total_count: @settings_count }.to_json, status: :ok\n end\n end\n end", "def option\n panel = Panel.find(params[:panelid])\n render json: panel.options.order(:created_at).last\n end", "def show\n @devices = @box.devices.order(:name)\n\n @patchpanels = @box.patchpanels.order(:name)\n end", "def update\n @panel = Panel.find(params[:id])\n\n respond_to do |format|\n if @panel.update_attributes(params[:panel])\n format.html { redirect_to(admin_panel_path(@panel), :notice => 'Panel was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\r\n @admin_decp_module = Admin::DecpModule.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @admin_decp_module }\r\n end\r\n end", "def show\n @dashboard = Dashboard.find(params[:id])\n @chart_selectors_data = {}\n \n tables = [] \n (ActiveRecord::RdsDb.connection.tables - ['schema_migrations']).each do |table_name|\n next unless ar_class_exist?(table_name)\n \n table = {\n name: table_name.titleize,\n value: table_name,\n dimensions: [],\n metrics: [],\n dates: []\n }\n \n table_class = table_name.classify.constantize\n table_class.columns.each do |column|\n next unless [:string, :integer, :datetime].include?(column.type)\n \n # TODO: Dimension can be either string field or belongs_to association\n \n if [:string, :integer].include?(column.type)\n table[:dimensions] << prepare_column(column)\n table[:metrics] << prepare_column(column) \n elsif column.type == :datetime\n table[:dates] << prepare_column(column)\n end\n \n end \n \n tables << table \n end\n \n \n \n @chart_selectors_data[:tables] = tables\n @dashboard_modules = @dashboard.dashboard_modules.order('created_at DESC')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dashboard }\n end\n end", "def list\n @collections = Admin::Collection.names\n\n render json: { collections: @collections }\n end", "def index\n @site_admins = SiteAdmin.all\n end", "def destroy\n @panel = Panel.find(params[:id])\n @panel.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_panels_url) }\n format.xml { head :ok }\n end\n end", "def index\n @admin_skills = Admin::Skill.all\n\n render json: @admin_skills\n end", "def show\n render json: @admin_skill\n end", "def admin_index\n return if !user_is_allowed('laws', 'view')\n \n @gen = Caboose::PageBarGenerator.new(params, {\n 'category_id' => '',\n \t\t 'legal_id_like' => '',\t\t \n \t\t 'title_like' => '',\n \t\t 'content_like' => '' \t\t \n \t\t},{\n \t\t 'model' => 'Law',\n \t 'sort'\t\t\t => 'legal_id',\n \t\t 'desc'\t\t\t => false,\n \t\t 'base_url'\t\t=> '/admin/laws'\n \t})\n \t@laws = @gen.items\n \trender :layout => 'caboose/admin'\n end", "def update\n respond_to do |format|\n if @panel.update(panel_params)\n format.html { redirect_to @panel, notice: 'Panel was successfully updated.' }\n format.json { render :show, status: :ok, location: @panel }\n else\n format.html { render :edit }\n format.json { render json: @panel.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @all_type=Api::V1::AdminType.all\n render json: @all_type\n end", "def info_for_edit_page\n @is_super_adm = is_super?\n\n if @is_super_adm\n # Loading Choosing of adm\n @admins = User.admins_list\n\n if @admins.empty?\n @mentors = [@admins]\n else\n employee = @user.client.employee\n if employee.present?\n @admins_cur = employee.employee_id\n @mentors_cur = @user.client.employee_id\n else\n @admins_cur = params[:administrator_id]\n @mentors_cur = 0\n end\n @mentors = User.mentors_list(@admins_cur, additional_users: User.all_local_admins)\n end\n elsif current_user.local_admin?\n @mentors = User.mentors_list(current_user.role_model.id, additional_users: [current_user])\n @mentors_cur = @user.client.employee_id\n end\n end", "def index\n @lesson_plans = current_user.lesson_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lesson_plans }\n end\n end", "def show(token)\n @collection = Rack::WebProfiler::Model::CollectionRecord[token: token]\n return not_found if @collection.nil?\n\n @collectors = Rack::WebProfiler.config.collectors.all\n @collector = nil\n\n unless @request.params[\"panel\"].nil?\n @collector = @collectors[@request.params[\"panel\"].to_sym]\n else\n @collector = @collectors.values.first\n end\n\n return not_found if @collector.nil?\n\n return json(@collection) if prefer_json?\n erb \"panel/show.erb\", layout: \"panel/layout.erb\"\n end", "def index\n @admin_pages = Admin::Page.all\n end", "def show\n @panel_subscription = Panel::Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @panel_subscription }\n end\n end", "def show\n @role_permision = RolePermision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @role_permision }\n end\n end", "def expand_all_panels\n @default_panel_state = :expanded\n end", "def index\n @user_page_settings = UserPageSetting.all\n render json: @user_page_settings\n end", "def index\n lists = policy_scope(List).includes(:admin).page(page).per(per)\n authorize lists\n json_response(PageDecorator.decorate(lists).as_json(admin: true), :ok)\n end", "def index\n plan = Plan.find_by(url:params[:plan_id])\n stories = plan.stories\n render json: stories\n end", "def list_admins\n service_response = ManagerManagement::Team::ListAdmins.new(params).perform\n return render_api_response(service_response)\n end", "def index\n respond_to do |format|\n format.html { render 'application/cube_trainer' }\n format.json { render json: current_user.modes }\n end\n end" ]
[ "0.6984211", "0.6706471", "0.6646405", "0.65596354", "0.6087478", "0.60628635", "0.6054905", "0.6020001", "0.6016398", "0.58363056", "0.5819224", "0.57761025", "0.5737134", "0.5718471", "0.5699787", "0.56658864", "0.56512755", "0.56453633", "0.5644101", "0.56278944", "0.5621686", "0.561828", "0.56138927", "0.5579235", "0.55780464", "0.556295", "0.55512655", "0.55155087", "0.5459541", "0.5437405", "0.53997767", "0.539653", "0.5391559", "0.5389679", "0.5382968", "0.53819054", "0.5377628", "0.5369256", "0.53449124", "0.53288954", "0.53113955", "0.53074867", "0.53033715", "0.52994263", "0.5279351", "0.5276732", "0.5254838", "0.5254049", "0.52525574", "0.5244798", "0.5242209", "0.52310395", "0.5220569", "0.5207687", "0.52025425", "0.5202303", "0.5202303", "0.5202303", "0.5202281", "0.5197978", "0.5196095", "0.5190669", "0.51812917", "0.5180623", "0.51675314", "0.51660967", "0.5165387", "0.5154035", "0.5151775", "0.51506644", "0.5142631", "0.51369864", "0.51349026", "0.5134434", "0.513428", "0.51328796", "0.51287144", "0.51277477", "0.5127163", "0.5126691", "0.5125361", "0.5118241", "0.5114863", "0.51142997", "0.51132965", "0.5105778", "0.5104704", "0.51043767", "0.51029736", "0.51003265", "0.5096019", "0.5092715", "0.5089546", "0.50851965", "0.5082647", "0.50821733", "0.5080119", "0.5079493", "0.5069438", "0.50638956", "0.5063508" ]
0.0
-1
GET /admin_panels/1 GET /admin_panels/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @panels = Panel.all\n end", "def set_admin_panel\n @admin_panel = AdminPanel.find(params[:id])\n end", "def admin_panel_params\n params[:admin_panel]\n end", "def index\n @port_panels = PortPanel.all\n end", "def show_panel\n @tab_name = params[:panel_name]\n @panel_name = params[:panel_name] == \"properties\" ? \"prop_sheet\" : params[:panel_name]\n @all_pages = @question_sheet.pages # for pages_list\n @page = @question_sheet.pages.find(params[:id])\n\n respond_to do |format|\n format.js # load panel\n end\n end", "def index\n @panel_models = PanelModel.all\n end", "def index\n @collections = Rack::WebProfiler::Model::CollectionRecord.order(Sequel.desc(:created_at))\n .limit(20)\n\n return json(@collections, to_json_opts: {\n only: [:token, :http_method, :http_status, :url, :ip]\n }) if prefer_json?\n\n erb \"panel/index.erb\", layout: \"panel/layout.erb\"\n end", "def set_panel\n @panel = Panel.find(params[:id])\n end", "def create\n @admin_panel = AdminPanel.new(admin_panel_params)\n\n respond_to do |format|\n if @admin_panel.save\n format.html { redirect_to @admin_panel, notice: 'Admin panel was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_panel }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_panel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_empty_panel\n\n # Lookup panel meta\n path = \"/slm/panel/getCatalogPanels.sp\"\n params = {:cpoid => @project_oid,\n :_slug => \"/custom/#{@page_oid}\",\n :ignorePanelDefOids => ''} # empty ignorePanelDefOids apparently is required\n response = rally_get(path, params)\n\n panels = JSON.parse(response.body)\n custom_html_panel_oid = nil\n panels.each do |panel|\n custom_html_panel_oid = panel['oid'] if panel['title'] == \"Custom HTML\"\n end\n \n # Create new panel\n request_path = \"/slm/dashboard/addpanel.sp\"\n params = {:cpoid => @project_oid, :_slug => \"/custom/#{@page_oid}\"}\n path = construct_get(request_path, params)\n\n form_data = {\"panelDefinitionOid\" => custom_html_panel_oid,\n \"dashboardName\" => \"#{@tab_name}#{@page_oid}\",\n \"col\" => 0,\n \"index\" => 0}\n response = rally_post(path, form_data)\n\n # response is json that just contains oid e.g. {\"oid\": \"1234556\"}\n panel_oid = JSON.parse(response.body)['oid']\n\n return panel_oid\n end", "def previews\n @session_user = User.find(session[:user_id])\n @page = @session_user.page\n panels = Array.new\n for panel in @page.panels.order(:created_at)\n fields = get_panel_preview(panel) \n panels.push(fields)\n end\n render json: panels\n end", "def new\n @panel = Panel.new( :status => Status.active )\n @place = Place.find(params[:place_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @panel }\n end\n end", "def options\n @session_user = User.find(session[:user_id])\n @page = @session_user.page\n options = Array.new\n for panel in @page.panels.order(:created_at)\n if panel.type == 'MSelectpanel' || panel.type == 'SSelectpanel'\n if panel.options\n for option in panel.options.order(:created_at)\n options.push(option)\n end\n end \n end \n end\n render json: options\n end", "def show\n render json: @admin\n end", "def index\n @control_panels = ControlPanel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @control_panels }\n end\n end", "def index\n @cpanel_malls = Cpanel::Mall.all\n end", "def show\n @admin_level = AdminLevel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_level }\n end\n end", "def show\n @pool = @current_user.pools.find_by(id: params[:id])\n render layout: 'angular'\n end", "def update\n respond_to do |format|\n if @admin_panel.update(admin_panel_params)\n format.html { redirect_to @admin_panel, notice: 'Admin panel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_panel.errors, status: :unprocessable_entity }\n end\n end\n end", "def panel\r\n \t@authq = params[:authq] || \"\"\r\n \t@auth_type = params[:type] || \"\"\r\n \t# This should return the JSON for solr documents\r\n results = get_browse_info(@authq, @auth_type)\r\n @data = results[0]\r\n heading = @data[\"heading\"]\r\n #Call helper method to see whether external data should or should not be included within panel\r\n #This used to be @authq but changing it because the parameter from the link may have different\r\n #ending punctuation than the heading in the browse. Relying entirely on heading now\r\n permissions_key = heading.delete_prefix('\"').delete_suffix('\"')\r\n @exclusions = check_permissions(permissions_key)\r\n render \"panel\"\r\n \r\n end", "def show_admin\n screen_name(\"Inicial-Admin\")\n\n distribute_ots\n\n respond_to do |format|\n format.html { render action: \"show_admin\" }\n format.json { head :ok }\n end\n end", "def destroy\n @admin_panel.destroy\n respond_to do |format|\n format.html { redirect_to admin_panels_url }\n format.json { head :no_content }\n end\n end", "def show\n @lab_permissions_role = LabPermissionsRole.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_permissions_role }\n end\n end", "def show\n @panel = Panel.find(params[:id])\n @place = Place.find(params[:place_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @panel }\n end\n end", "def show\n @panel = Panel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @panel }\n end\n end", "def show\n @admin_collaborator = Admin::Collaborator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_collaborator }\n end\n end", "def show\n @lab_role = LabRole.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_role }\n end\n end", "def index\n @portal_configs = Portal::Config.all\n end", "def show\n @admin_side_menu = Admin::SideMenu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_side_menu }\n end\n end", "def new\n @panel_plan = Panel::Plan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @panel_plan }\n end\n end", "def index\n @panel_subscriptions = Panel::Subscription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @panel_subscriptions }\n end\n end", "def index\n\n if @user.admin == false\n @panels = Panel.all(:order => 'date_made DESC', :conditions => {:live_state => \"Live\"})\n else\n @panels = Panel.all(:order => 'date_made DESC')\n end\n @visuals = Visualization.find_all_by_user_id(@user)\n @compiles = Compilation.find_all_by_user_id(@user)\n @links = Linkalation.find_all_by_user_id(@user)\n\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @panels }\n end\n end", "def show\n @level_container = LevelContainer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @level_container }\n end\n end", "def show\n @panel_plan = Panel::Plan.find(params[:id])\n @features = Panel::Planfeature.where(:panel_plan_id => params[:id]).all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @panel_plan }\n end\n end", "def set_port_panel\n @port_panel = PortPanel.find(params[:id])\n end", "def show\n @panel_subscription = Panel::Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @panel_subscription }\n end\n end", "def show\n @control_panel = ControlPanel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @control_panel }\n end\n end", "def static\n\t\t@scroll = Scroll.find(params[:id])\n\t\t@panels = Panel.find_all_by_scroll_id(params[:id],:order => \"panel_id\")\n\tend", "def show\r\n @admin_decp_module = Admin::DecpModule.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @admin_decp_module }\r\n end\r\n end", "def index\n @admin_dashboards = Admin::Dashboard.all\n end", "def show\n @administration = Administration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @administration }\n end\n end", "def option\n panel = Panel.find(params[:panelid])\n render json: panel.options.order(:created_at).last\n end", "def show\n @admin = Admin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin }\n end\n end", "def show\n @portaluserassignment = Portaluserassignment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @portaluserassignment }\n end\n end", "def index\n @admin_stages = Clapme::Stage.all\n end", "def set_panel_model\n @panel_model = PanelModel.find(params[:id])\n end", "def show\n @admined_page1 = AdminedPage1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admined_page1 }\n end\n end", "def index\n @admins = Admin.all\n\n render json: @admins\n end", "def update\n @panel = Panel.find(params[:id])\n\n respond_to do |format|\n if @panel.update_attributes(params[:panel])\n format.html { redirect_to(admin_panel_path(@panel), :notice => 'Panel was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def port_panel_params\n params[:port_panel]\n end", "def index\n @admin_collaborators = Admin::Collaborator.all\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @admin_collaborators }\n end\n end", "def show(token)\n @collection = Rack::WebProfiler::Model::CollectionRecord[token: token]\n return not_found if @collection.nil?\n\n @collectors = Rack::WebProfiler.config.collectors.all\n @collector = nil\n\n unless @request.params[\"panel\"].nil?\n @collector = @collectors[@request.params[\"panel\"].to_sym]\n else\n @collector = @collectors.values.first\n end\n\n return not_found if @collector.nil?\n\n return json(@collection) if prefer_json?\n erb \"panel/show.erb\", layout: \"panel/layout.erb\"\n end", "def show\n @role_permision = RolePermision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @role_permision }\n end\n end", "def set_admin_dashboard\n @admin_dashboard = Admin::Dashboard.find(params[:id])\n end", "def show\n @panel = Panel.find(params[:id])\n @contents = @panel.contents.all(:order => '\"order\"')\n @links = @panel.links.all(:order => '\"order\"')\n @links_count = @panel.links.count\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @panel }\n end\n end", "def index\n @collections = Rack::WebProfiler::Model::CollectionRecord.order(Sequel.desc(:created_at))\n .limit(20)\n\n erb \"panel/index.erb\", layout: \"panel/layout.erb\"\n end", "def show\n @admin = Admin.find(params[:id])\n @admins = Admin.all\n end", "def show\n @panel_billing = Panel::Billing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @panel_billing }\n end\n end", "def admin_labs\n self.roles.where(name: \"admin\", resource_type: \"Lab\")\n end", "def update\n respond_to do |format|\n if @panel.update(panel_params)\n format.html { redirect_to @panel, notice: 'Panel was successfully updated.' }\n format.json { render :show, status: :ok, location: @panel }\n else\n format.html { render :edit }\n format.json { render json: @panel.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @deweys_power_panel = DeweysPowerPanel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @deweys_power_panel }\n end\n end", "def length\n return @panels.length\n end", "def get_dashboards\n @dash_service.get_dashboards\n end", "def destroy\n @panel = Panel.find(params[:id])\n @panel.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_panels_url) }\n format.xml { head :ok }\n end\n end", "def show\n @dashboard = Dashboard.find(params[:id])\n @chart_selectors_data = {}\n \n tables = [] \n (ActiveRecord::RdsDb.connection.tables - ['schema_migrations']).each do |table_name|\n next unless ar_class_exist?(table_name)\n \n table = {\n name: table_name.titleize,\n value: table_name,\n dimensions: [],\n metrics: [],\n dates: []\n }\n \n table_class = table_name.classify.constantize\n table_class.columns.each do |column|\n next unless [:string, :integer, :datetime].include?(column.type)\n \n # TODO: Dimension can be either string field or belongs_to association\n \n if [:string, :integer].include?(column.type)\n table[:dimensions] << prepare_column(column)\n table[:metrics] << prepare_column(column) \n elsif column.type == :datetime\n table[:dates] << prepare_column(column)\n end\n \n end \n \n tables << table \n end\n \n \n \n @chart_selectors_data[:tables] = tables\n @dashboard_modules = @dashboard.dashboard_modules.order('created_at DESC')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dashboard }\n end\n end", "def index\n id = params[:ids].first.split(\":\").third\n assignment = AllAboard::PerspectiveAssignment.find(id)\n respond_with assignment.configurable_attributes\n end", "def show\n render json: @admin_skill\n end", "def show\n @console_pool = ConsolePool.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @console_pool }\n end\n end", "def show\n @admin_slider_item = SliderItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_slider_item }\n end\n end", "def new\n @admined_page1 = AdminedPage1.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admined_page1 }\n end\n end", "def index\n @active_page = :settings\n @settings = Setting.editable.order(\"#{@sort_field} #{@sort_direction}\").page(@current_page).per(@page_limit)\n @settings_count = Setting.editable.count\n\n respond_to do |format|\n format.html { render layout: 'admin' }\n format.json do\n settings = @settings.map do |s|\n {\n key: s.key,\n alt: s.alt,\n value: s.type == 'password' ? '********' : s.value,\n type: s.type,\n id: s.id\n }\n end\n render json: { settings: settings, total_count: @settings_count }.to_json, status: :ok\n end\n end\n end", "def new\n @admin_side_menu = Admin::SideMenu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_side_menu }\n end\n end", "def show\n @useradmin = Useradmin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @useradmin }\n end\n end", "def index\n @admin_levels = Admin::Level.all\n end", "def show\n @devices = @box.devices.order(:name)\n\n @patchpanels = @box.patchpanels.order(:name)\n end", "def show\n @cohort = current_user.accessible_cohorts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cohort }\n end\n end", "def index\n @cohorts = current_user.accessible_cohorts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cohorts }\n end\n end", "def create\n @panel = Panel.new(params[:panel])\n\n respond_to do |format|\n if @panel.save\n format.html { redirect_to(admin_panel_path(@panel), :notice => 'Panel was successfully created.') }\n format.xml { render :xml => @panel, :status => :created, :location => @panel }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @all_type=Api::V1::AdminType.all\n render json: @all_type\n end", "def show\n @admin = Admin.find(params[:id])\n end", "def show\n @admin = Admin.find(params[:id])\n end", "def show\n @admin = Admin.find(params[:id])\n end", "def show\n @admin = Admin.find(params[:id])\n end", "def show\n @admin = Admin.find(params[:id])\n end", "def show(token)\n @collection = Rack::WebProfiler::Model::CollectionRecord[token: token]\n return error404 if @collection.nil?\n\n @collectors = Rack::WebProfiler.config.collectors.all\n\n # @todo return json if request.content_type ask json (same for xml?)\n # @example json {} if @request.media_type.include? \"json\"\n\n erb \"panel/show.erb\", layout: \"panel/layout.erb\"\n end", "def show\n @admin = Admin.find(params[:id])\n\n end", "def index\n authorize Admin\n @admins = initialize_grid(Admin.where(\"id != ?\", current_admin.id).order('id desc'), per_page: 10)\n end", "def show\n @admin_whitelist = Admin::Whitelist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_whitelist }\n end\n end", "def new\n @panel_subscription = Panel::Subscription.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @panel_subscription }\n end\n end", "def admin_dashboard_params\n params[:admin_dashboard]\n end", "def index\n @systemadmins = Systemadmin.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @systemadmins }\n end\n end", "def new\n @admin_level = AdminLevel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_level }\n end\n end", "def index\n @admin_admins = Admin::Admin.page(params[:page]).per(15).load\n end", "def show\n dashboard_4\n end", "def set_cpanel_mall\n @cpanel_mall = Cpanel::Mall.find(params[:id])\n end", "def render_ext_panel(items = [])\n items.each { |item| \n item[:html] = item[:html].gsub(/\"/,'\\\"').gsub(/\\n/,'')\n item[:id] ||= rand(10000)\n }\n render :partial => \"admin/extjs/panel\", :locals => {\n :items => items, :random_id => rand(10000)\n }\n end", "def show\n if current_user.present?\n #@work_dashboard = Work::Dashboard.find(params[:id])\n @worked_list = Setting.version_mod.split(' ')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_dashboard }\n end\n end\n end", "def show\n @team_admin = TeamAdmin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team_admin }\n end\n end", "def index\n @admin_slider_items = SliderItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_slider_items }\n end\n end", "def show\n @admin = Admin.find params[:id]\n end", "def index\n @admins = Admin.accessible_by(current_ability, :index).limit(20)\n respond_to do |format|\n format.json { render :json => @admins }\n format.xml { render :xml => @admins }\n format.html\n end\n end" ]
[ "0.69977415", "0.68487227", "0.66271675", "0.6569947", "0.6191715", "0.6141695", "0.6110992", "0.6065194", "0.59664947", "0.5952652", "0.59156317", "0.5851803", "0.5850464", "0.5832145", "0.58181256", "0.5817692", "0.57961076", "0.5779452", "0.57725435", "0.5746137", "0.57455444", "0.56952447", "0.56779075", "0.56588113", "0.5656805", "0.5622555", "0.56090635", "0.5603767", "0.5595148", "0.55928105", "0.5590372", "0.55879724", "0.5585144", "0.5584673", "0.5579527", "0.5555088", "0.5545685", "0.5518593", "0.55171907", "0.5515286", "0.5502191", "0.549478", "0.54915816", "0.5483612", "0.54803365", "0.547953", "0.5471002", "0.5461631", "0.5449138", "0.5421706", "0.54045755", "0.5392452", "0.538272", "0.53811055", "0.537952", "0.5372157", "0.5371235", "0.5363777", "0.53557885", "0.535419", "0.53391296", "0.5339047", "0.5338306", "0.53374374", "0.53318137", "0.53268045", "0.5323301", "0.53212214", "0.5291448", "0.52715075", "0.5266675", "0.526398", "0.52624387", "0.52615696", "0.5259123", "0.52522737", "0.523677", "0.523499", "0.52328306", "0.52323675", "0.52323675", "0.52323675", "0.52323675", "0.52323675", "0.5229729", "0.5229538", "0.52252835", "0.5221356", "0.52190244", "0.52172923", "0.5215248", "0.5210972", "0.52082074", "0.5204964", "0.5195527", "0.5193914", "0.519389", "0.5181103", "0.5176798", "0.51747584", "0.5169864" ]
0.0
-1
POST /admin_panels POST /admin_panels.json
def create @admin_panel = AdminPanel.new(admin_panel_params) respond_to do |format| if @admin_panel.save format.html { redirect_to @admin_panel, notice: 'Admin panel was successfully created.' } format.json { render action: 'show', status: :created, location: @admin_panel } else format.html { render action: 'new' } format.json { render json: @admin_panel.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @panel = Panel.new(params[:panel])\n\n respond_to do |format|\n if @panel.save\n format.html { redirect_to(admin_panel_path(@panel), :notice => 'Panel was successfully created.') }\n format.xml { render :xml => @panel, :status => :created, :location => @panel }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @panel = Panel.new(panel_params)\n\n respond_to do |format|\n if @panel.save\n format.html { redirect_to @panel, notice: 'Panel was successfully created.' }\n format.json { render :show, status: :created, location: @panel }\n else\n format.html { render :new }\n format.json { render json: @panel.errors, status: :unprocessable_entity }\n end\n end\n end", "def admin_panel_params\n params[:admin_panel]\n end", "def set_admin_panel\n @admin_panel = AdminPanel.find(params[:id])\n end", "def create_empty_panel\n\n # Lookup panel meta\n path = \"/slm/panel/getCatalogPanels.sp\"\n params = {:cpoid => @project_oid,\n :_slug => \"/custom/#{@page_oid}\",\n :ignorePanelDefOids => ''} # empty ignorePanelDefOids apparently is required\n response = rally_get(path, params)\n\n panels = JSON.parse(response.body)\n custom_html_panel_oid = nil\n panels.each do |panel|\n custom_html_panel_oid = panel['oid'] if panel['title'] == \"Custom HTML\"\n end\n \n # Create new panel\n request_path = \"/slm/dashboard/addpanel.sp\"\n params = {:cpoid => @project_oid, :_slug => \"/custom/#{@page_oid}\"}\n path = construct_get(request_path, params)\n\n form_data = {\"panelDefinitionOid\" => custom_html_panel_oid,\n \"dashboardName\" => \"#{@tab_name}#{@page_oid}\",\n \"col\" => 0,\n \"index\" => 0}\n response = rally_post(path, form_data)\n\n # response is json that just contains oid e.g. {\"oid\": \"1234556\"}\n panel_oid = JSON.parse(response.body)['oid']\n\n return panel_oid\n end", "def create\n @panel = Panel.new(params[:panel])\n @place = Place.find(params[:place_id])\n @panel.user = \"user test\"\n\n respond_to do |format|\n if @panel.save\n format.html { redirect_to(place_panel_url(@place, @panel), :notice => 'Panel was successfully created.') }\n format.json { render :json => @panel, :status => :created, :location => @panel }\n else\n format.html { render :action => :new }\n format.json { render :json => @panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @port_panel = PortPanel.new(port_panel_params)\n\n respond_to do |format|\n if @port_panel.save\n format.html { redirect_to @port_panel, notice: 'Port panel was successfully created.' }\n format.json { render action: 'show', status: :created, location: @port_panel }\n else\n format.html { render action: 'new' }\n format.json { render json: @port_panel.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @panels = Panel.all\n end", "def create\n @panel = Panel.new(params[:panel])\n\n respond_to do |format|\n if @panel.save\n flash[:notice] = 'Panel was successfully created.'\n format.html { redirect_to(@panel) }\n format.xml { render :xml => @panel, :status => :created, :location => @panel }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @panel_model = PanelModel.new(panel_model_params)\n\n respond_to do |format|\n if @panel_model.save\n format.html { redirect_to @panel_model, notice: 'Panel model was successfully created.' }\n format.json { render action: 'show', status: :created, location: @panel_model }\n else\n format.html { render action: 'new' }\n format.json { render json: @panel_model.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @admin_panel.destroy\n respond_to do |format|\n format.html { redirect_to admin_panels_url }\n format.json { head :no_content }\n end\n end", "def panel_params\n params.require(:panel).permit(:panel_id, :teacher_1, :teacher_2)\n end", "def previews\n @session_user = User.find(session[:user_id])\n @page = @session_user.page\n panels = Array.new\n for panel in @page.panels.order(:created_at)\n fields = get_panel_preview(panel) \n panels.push(fields)\n end\n render json: panels\n end", "def set_panel\n @panel = Panel.find(params[:id])\n end", "def index\n @port_panels = PortPanel.all\n end", "def update\n respond_to do |format|\n if @admin_panel.update(admin_panel_params)\n format.html { redirect_to @admin_panel, notice: 'Admin panel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_panel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @deweys_power_panel = DeweysPowerPanel.new(params[:deweys_power_panel])\n\n respond_to do |format|\n if @deweys_power_panel.save\n format.html { redirect_to(@deweys_power_panel, :notice => 'Deweys power panel was successfully created.') }\n format.xml { render :xml => @deweys_power_panel, :status => :created, :location => @deweys_power_panel }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @deweys_power_panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @panel_plan = Panel::Plan.new(params[:panel_plan])\n\n respond_to do |format|\n if @panel_plan.save\n format.html { redirect_to(@panel_plan, :notice => 'Plan was successfully created.') }\n format.json { render :json => @panel_plan, :status => :created, :location => @panel_plan }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @panel_plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def port_panel_params\n params[:port_panel]\n end", "def create\n @control_panel = ControlPanel.new(params[:control_panel])\n\n respond_to do |format|\n if @control_panel.save\n flash[:notice] = 'ControlPanel was successfully created.'\n format.html { redirect_to(@control_panel) }\n format.xml { render :xml => @control_panel, :status => :created, :location => @control_panel }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @control_panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @panel = Panel.new( :status => Status.active )\n @place = Place.find(params[:place_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @panel }\n end\n end", "def set_port_panel\n @port_panel = PortPanel.find(params[:id])\n end", "def dashboard_params\n params.require(:dashboard).permit(:widgets, :name, :show)\n end", "def show_panel\n @tab_name = params[:panel_name]\n @panel_name = params[:panel_name] == \"properties\" ? \"prop_sheet\" : params[:panel_name]\n @all_pages = @question_sheet.pages # for pages_list\n @page = @question_sheet.pages.find(params[:id])\n\n respond_to do |format|\n format.js # load panel\n end\n end", "def update\n respond_to do |format|\n if @panel.update(panel_params)\n format.html { redirect_to @panel, notice: 'Panel was successfully updated.' }\n format.json { render :show, status: :ok, location: @panel }\n else\n format.html { render :edit }\n format.json { render json: @panel.errors, status: :unprocessable_entity }\n end\n end\n end", "def options\n @session_user = User.find(session[:user_id])\n @page = @session_user.page\n options = Array.new\n for panel in @page.panels.order(:created_at)\n if panel.type == 'MSelectpanel' || panel.type == 'SSelectpanel'\n if panel.options\n for option in panel.options.order(:created_at)\n options.push(option)\n end\n end \n end \n end\n render json: options\n end", "def panel_model_params\n params.require(:panel_model).permit(:name, :numberOfPort, :category)\n end", "def new\n @panel_plan = Panel::Plan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @panel_plan }\n end\n end", "def add_panelists(webinar_id:, params:)\n parse(JSON.parse(connection.post(\"webinars/#{webinar_id}/panelists\", params.to_json).body))\n end", "def update\n @panel = Panel.find(params[:id])\n\n respond_to do |format|\n if @panel.update_attributes(params[:panel])\n format.html { redirect_to(admin_panel_path(@panel), :notice => 'Panel was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @page_layout = PageLayout.new(params[:page_layout].permit(:content_type, :name, :num_panels, :html_content, :preview_content))\n\n respond_to do |format|\n if @page_layout.save\n format.html { redirect_to @page_layout, notice: 'Page layout was successfully created.' }\n format.json { render json: @page_layout, status: :created, location: @page_layout }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page_layout.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @panel = Panel.find(params[:id])\n @panel.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_panels_url) }\n format.xml { head :ok }\n end\n end", "def create\n @admin_dashboard = Admin::Dashboard.new(admin_dashboard_params)\n\n respond_to do |format|\n if @admin_dashboard.save\n format.html { redirect_to @admin_dashboard, notice: 'Dashboard was successfully created.' }\n format.json { render :show, status: :created, location: @admin_dashboard }\n else\n format.html { render :new }\n format.json { render json: @admin_dashboard.errors, status: :unprocessable_entity }\n end\n end\n end", "def dashboard_params\n params.require(:dashboard).permit(:name, :display_name, :description, :html_col_per_row, :one_or_many_results, :status_flag)\n end", "def render_ext_panel(items = [])\n items.each { |item| \n item[:html] = item[:html].gsub(/\"/,'\\\"').gsub(/\\n/,'')\n item[:id] ||= rand(10000)\n }\n render :partial => \"admin/extjs/panel\", :locals => {\n :items => items, :random_id => rand(10000)\n }\n end", "def index\n @panel_models = PanelModel.all\n end", "def admin_panel_tag_params\n params.require(:admin_panel_tag).permit(:name, :description)\n end", "def expand_all_panels\n @default_panel_state = :expanded\n end", "def new\n @panel = Panel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @panel }\n end\n end", "def new\n @panel = Panel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @panel }\n end\n end", "def destroy\n @port_panel.destroy\n respond_to do |format|\n format.html { redirect_to port_panels_url }\n format.json { head :no_content }\n end\n end", "def set_admin_panel_tag\n @admin_panel_tag = AdminPanel::Tag.find_by(name: params[:id])\n @admin_panel_tag_id = AdminPanel::Tag.find(params[:id])\n end", "def set_panel_model\n @panel_model = PanelModel.find(params[:id])\n end", "def wizard_panel(params)\n left = params[:wizard_panel_left] || \"0\"\n top = params[:wizard_panel_top] || \"0\"\n\n style = \"left:#{left};top:#{top};\"\n\n panel = '\n <div id=\"wizard_panel\" class=\"rounded\" style=\"'+style+'\">\n <div id=\"wizard_panel_content\" class=\"rounded\">\n \t<div id=\"wizard_panel_handle\" class=\"rounded handle\">\n \t</div>\n \t<ul id=\"wizard_list\">'\n \t @links.each do |link_name, link_url| \n panel += \"<li><a href=\\\"#{link_url}\\\">#{link_name}</a></li>\"\n end\n \tpanel += ' </ul>\n </div>\n </div>'\n end", "def create\n @admin_stage = Clapme::Stage.new(admin_stage_params)\n\n respond_to do |format|\n if @admin_stage.save\n format.html { redirect_to admin_stage_url(@admin_stage.id), notice: 'Stage was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_stage }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_stage.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @site_admin = SiteAdmin.new(site_admin_params)\n\n respond_to do |format|\n if @site_admin.save\n format.html { redirect_to @site_admin, notice: 'Site admin was successfully created.' }\n format.json { render :show, status: :created, location: @site_admin }\n else\n format.html { render :new }\n format.json { render json: @site_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "def dashboard_params\n params.require(:admin_only_dashboard).permit(:name_sv, :description_sv, :name_en, :description_en, :is_custom,\n :data_gatherer, :data_gatherer[:timeframe])\n end", "def create\n @world_admin = WorldAdmin.new(world_admin_params)\n\n respond_to do |format|\n if @world_admin.save\n format.html { redirect_to @world_admin, notice: 'World admin was successfully created.' }\n format.json { render :show, status: :created, location: @world_admin }\n else\n format.html { render :new }\n format.json { render json: @world_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @link = @panel.links.build(params[:link])\n\n @reset_unread = params[:unread]\n if @reset_unread == \"Yes\"\n @seen_panels = Visualization.find_all_by_panel_id(@panel.id)\n for panel in @seen_panels do\n panel.destroy\n end\n end\n \n respond_to do |format|\n if @link.save\n format.html { redirect_to(@panel) }\n format.xml { render :xml => @link, :status => :created, :location => @link }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @link.errors, :status => :unprocessable_entity }\n end\n end\n end", "def dashboard_params\n # remove single/double quotes from name which cause chart's to fail:\n params[:dashboard][:name] = params[:dashboard][:name].gsub(/'/, '').gsub(/\"/, '') unless params[:dashboard][:name].blank?\n params.require(:dashboard).permit(\n :name,\n widgets_attributes: [:id, :_destroy, :chart_id]\n )\n end", "def index\n @collections = Rack::WebProfiler::Model::CollectionRecord.order(Sequel.desc(:created_at))\n .limit(20)\n\n return json(@collections, to_json_opts: {\n only: [:token, :http_method, :http_status, :url, :ip]\n }) if prefer_json?\n\n erb \"panel/index.erb\", layout: \"panel/layout.erb\"\n end", "def create\n @admin_side_menu = Admin::SideMenu.new(params[:admin_side_menu])\n\n respond_to do |format|\n if @admin_side_menu.save\n format.html { redirect_to @admin_side_menu, notice: 'Side menu was successfully created.' }\n format.json { render json: @admin_side_menu, status: :created, location: @admin_side_menu }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_side_menu.errors, status: :unprocessable_entity }\n end\n end\n end", "def dashboard_params\n params.require(:dashboard).permit(:title, :token, :user_id, :dashboard_id)\n end", "def new\n @panel_subscription = Panel::Subscription.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @panel_subscription }\n end\n end", "def variables_for_new\r\n @path = administration.article_cluster_categories_path\r\n @method = :post\r\n end", "def new\n @control_panel = ControlPanel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @control_panel }\n end\n end", "def new\n @deweys_power_panel = DeweysPowerPanel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @deweys_power_panel }\n end\n end", "def destroy\n @panel.destroy\n respond_to do |format|\n format.html { redirect_to panels_url, notice: 'Panel was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def html_actions_panel(node, output)\n return nil unless node.is_a?(ICollection)\n\n # We also know fairly certain that if an object is a non-extended\n # SimpleCollection, we won't need to show the panel either.\n return nil if node.class == Tilia::Dav::SimpleCollection\n\n output.value << <<FORM\n<form method=\"post\" action=\"\">\n <h3>Create new folder</h3>\n <input type=\"hidden\" name=\"sabreAction\" value=\"mkcol\" />\n <label>Name:</label> <input type=\"text\" name=\"name\" /><br />\n <input type=\"submit\" value=\"create\" />\n</form>\n<form method=\"post\" action=\"\" enctype=\"multipart/form-data\">\n <h3>Upload file</h3>\n <input type=\"hidden\" name=\"sabreAction\" value=\"put\" />\n <label>Name (optional):</label> <input type=\"text\" name=\"name\" /><br />\n <label>File:</label> <input type=\"file\" name=\"file\" /><br />\n <input type=\"submit\" value=\"upload\" />\n</form>\nFORM\n end", "def new\n @admin_side_menu = Admin::SideMenu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_side_menu }\n end\n end", "def index\n @control_panels = ControlPanel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @control_panels }\n end\n end", "def panel_category_params\n params.fetch(:category, {}).permit(:name, :status, :slug, :catalog_id)\n end", "def create\n @cpanel_promotion = Cpanel::Promotion.new(cpanel_promotion_params)\n\n respond_to do |format|\n if @cpanel_promotion.save\n format.html { redirect_to @cpanel_promotion, notice: 'Promotion was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cpanel_promotion }\n else\n format.html { render action: 'new' }\n format.json { render json: @cpanel_promotion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @panel_subscription = Panel::Subscription.new(params[:panel_subscription])\n\n respond_to do |format|\n if @panel_subscription.save\n format.html { redirect_to(@panel_subscription, :notice => 'Subscription was successfully created.') }\n format.json { render :json => @panel_subscription, :status => :created, :location => @panel_subscription }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @panel_subscription.errors, :status => :unprocessable_entity }\n end\n end\n end", "def length\n return @panels.length\n end", "def update_by_ajax\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n cat_h = {:desktop => User::AUTH_DESKTOP, :user => User::AUTH_USER, :log => User::AUTH_LOG}\n\n yaml = ApplicationHelper.get_config_yaml\n\n cat_h.keys.each do |cat|\n\n next if params[cat].blank?\n\n unless @login_user.admin?(cat_h[cat])\n render(:text => t('msg.need_to_be_admin'))\n return\n end\n\n yaml[cat] ||= {}\n\n params[cat].each do |key, val|\n yaml[cat][key] = val\n end\n end\n\n ApplicationHelper.save_config_yaml(yaml)\n\n render(:text => '')\n end", "def post\n frm.button(:name=>\"post\").click\n AssignmentsList.new(@browser)\n end", "def show_admin\n screen_name(\"Inicial-Admin\")\n\n distribute_ots\n\n respond_to do |format|\n format.html { render action: \"show_admin\" }\n format.json { head :ok }\n end\n end", "def create\n @lab_area = LabArea.new(lab_area_params)\n\n respond_to do |format|\n if @lab_area.save\n format.html { redirect_to @lab_area, notice: 'Lab area was successfully created.' }\n format.json { render :show, status: :created, location: @lab_area }\n else\n format.html { render :new }\n format.json { render json: @lab_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def panel\r\n \t@authq = params[:authq] || \"\"\r\n \t@auth_type = params[:type] || \"\"\r\n \t# This should return the JSON for solr documents\r\n results = get_browse_info(@authq, @auth_type)\r\n @data = results[0]\r\n heading = @data[\"heading\"]\r\n #Call helper method to see whether external data should or should not be included within panel\r\n #This used to be @authq but changing it because the parameter from the link may have different\r\n #ending punctuation than the heading in the browse. Relying entirely on heading now\r\n permissions_key = heading.delete_prefix('\"').delete_suffix('\"')\r\n @exclusions = check_permissions(permissions_key)\r\n render \"panel\"\r\n \r\n end", "def create\n @manage_admin = Manage::Admin.new(manage_admin_params)\n @admin_roles= @manage_admin.roles\n respond_to do |format|\n if @manage_admin.save\n\n # 保存角色信息\n roles_id=params[:roles]\n @manage_admin.roles_in_id=roles_id\n\n format.html { redirect_to @manage_admin, notice: \"成功创建管理员#{@manage_admin.nickname}.\" }\n\n format.json { render :show, status: :created, location: @manage_admin }\n else\n format.html { render :new }\n format.json { render json: @manage_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin = Admin.new(admin_params)\n\n if @admin.save\n render json: @admin, status: :created, location: @admin\n else\n render json: @admin.errors, status: :unprocessable_entity\n end\n end", "def add\n @departments = Department.all\n @roles = Role.all\n if request.post?\n if Admin.regist(params)\n flash[:notice] = '新規ユーザーを作成しました'\n redirect_to(url_for({ controller: 'super', action: 'dashboard' }))\n else\n flash[:error] = '新規ユーザー作成に失敗しました'\n redirect_to(url_for({ controller: 'admin', action: 'add' }))\n end\n end\n end", "def sort_panels!\n dashboard[:panel_groups].each do |group|\n missing_panels! unless group[:panels].is_a? Array\n\n group[:panels] = group[:panels].sort_by { |panel| -panel[:weight].to_i }\n end\n end", "def new\n @portaluserassignment = Portaluserassignment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @portaluserassignment }\n end\n end", "def destroy\n @place = Place.find(params[:place_id])\n @panel = Panel.find(params[:id])\n @panel.status = Status.inactive\n @panel.save\n\n respond_to do |format|\n format.html { redirect_to(place_panels_url(@place)) }\n format.json { head :ok }\n end\n end", "def new\n @panel_billing = Panel::Billing.new\n @countries = Country.find(:all)\n @users = User.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @panel_billing }\n end\n end", "def new\n @admin_level = AdminLevel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_level }\n end\n end", "def new\n @item = Item.new\n @item.item_attachments.build\n @panels = Panel.where(\"active=?\", true)\n @items = Item.where(\"active=?\", true).order(\"title asc\")\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def create\n @sidecfg = Sidecfg.new(sidecfg_params)\n\n respond_to do |format|\n if @sidecfg.save\n format.html { redirect_to @sidecfg, notice: 'Sidecfg was successfully created.' }\n format.json { render :show, status: :created, location: @sidecfg }\n else\n format.html { render :new }\n format.json { render json: @sidecfg.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @panel = Panel.find(params[:id])\n @place = Place.find(params[:place_id])\n\n respond_to do |format|\n if @panel.update_attributes(params[:panel])\n format.html { redirect_to(place_panel_url(@place, @panel), :notice => 'Panel was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def admin_blog_module_params\n params.require(:admin_blog_module).permit(\n :name,\n :body,\n :layout,\n :position,\n :slot_id,\n :post_page_id\n )\n end", "def post\n frm.button(:value=>\"Post\").click\n AssignmentsList.new(@browser)\n end", "def find_or_create_panel(panels, metric)\n panel = find_panel(panels, metric)\n return panel if panel\n\n panel = new_panel(metric)\n panels << panel\n\n panel\n end", "def add_admin_tab(*args)\n admin_tabs << args\n end", "def update\n @panel = Panel.find(params[:id])\n\n respond_to do |format|\n if @panel.update_attributes(params[:panel])\n flash[:notice] = 'Panel was successfully updated.'\n format.html { redirect_to(@panel) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n @panel = Panel.find(params[:id])\n @panel.destroy\n\n respond_to do |format|\n format.html { redirect_to(panels_url) }\n format.xml { head :ok }\n end\n end", "def create\n params[:panel_billing]['user_id'] = 4\n @panel_billing = Panel::Billing.new(params[:panel_billing])\n\n respond_to do |format|\n if @panel_billing.save\n format.html { redirect_to(@panel_billing, :notice => 'Billing was successfully created.') }\n format.json { render :json => @panel_billing, :status => :created, :location => @panel_billing }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @panel_billing.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_dashboard(params, id = \"\", space_id = \"\")\n create_saved_object(params, \"dashboard\", id, space_id)\n end", "def create\n @admin_level = AdminLevel.new(params[:admin_level])\n\n respond_to do |format|\n if @admin_level.save\n format.html { redirect_to @admin_level, notice: 'Admin level was successfully created.' }\n format.json { render json: @admin_level, status: :created, location: @admin_level }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_level.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @admin_stages = Clapme::Stage.all\n end", "def admin_dashboard_params\n params[:admin_dashboard]\n end", "def dashboard_params\n end", "def dashboard_params\n params.require(:dashboard).permit(\"hostname\", \"kernel_version\", \"ipaddress\", \"macaddress\", \"cpuidle\", \"total_memory\", \"used_memory\", \"free_memory\", \"total_swap\", \"used_swap\", \"free_swap\", \"userslist\", \"disk_free_space\", \"disk_Used_space\",\"stat\",\"search\")\n end", "def set_panel_category\n @panel_category = ::Category.find(params[:id])\n end", "def admin_panel\n respond_with :message, text: t('telegram_bot.texts.show_admin_menu'), reply_markup: {\n inline_keyboard: admin_menu\n }\n end", "def create\n @dynamic_project_page = DynamicProjectPage.create(dynamic_project_page_params)\n\n respond_to do |format|\n if @dynamic_project_page.save\n format.html { redirect_to '/administrator/dynamic_project_pages', notice: 'Информация обновлена' }\n format.json { render :show, status: :created, location: @dynamic_project_page }\n else\n format.html { render :new }\n format.json { render json: @dynamic_project_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @admined_page1 = AdminedPage1.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admined_page1 }\n end\n end", "def _draw_panel\n @apotomo_emit_raw_view = true\n render :view => param(:panel)\n end", "def create\n @subadmin = Subadmin.new(subadmin_params)\n\n respond_to do |format|\n if @subadmin.save\n format.html { redirect_to @subadmin, notice: 'Subadmin was successfully created.' }\n format.json { render :show, status: :created, location: @subadmin }\n else\n format.html { render :new }\n format.json { render json: @subadmin.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6527788", "0.63824564", "0.633019", "0.6245982", "0.62453824", "0.5860257", "0.58516514", "0.579617", "0.5777765", "0.57460743", "0.57059425", "0.5699958", "0.5649252", "0.5623576", "0.56196934", "0.55935884", "0.5406349", "0.5383279", "0.53630465", "0.5353849", "0.534657", "0.534351", "0.5326452", "0.5324846", "0.5298659", "0.52805144", "0.5274424", "0.5255853", "0.52333164", "0.5172041", "0.516002", "0.51529616", "0.50619304", "0.50472945", "0.50291616", "0.5021663", "0.5017728", "0.50168467", "0.5014024", "0.5014024", "0.5014024", "0.5003786", "0.49920192", "0.49876195", "0.4934705", "0.49321556", "0.49246034", "0.4912243", "0.4892225", "0.4891725", "0.48902044", "0.48899338", "0.48836863", "0.4864589", "0.48559377", "0.4854399", "0.48523933", "0.48247477", "0.48244566", "0.48201737", "0.47947913", "0.4774443", "0.47718978", "0.47640693", "0.47558385", "0.4753546", "0.47397336", "0.47380257", "0.47374326", "0.47277626", "0.47138146", "0.47116706", "0.47085688", "0.47049865", "0.47021475", "0.47016144", "0.4697728", "0.4697505", "0.46895027", "0.46805036", "0.46793154", "0.46772504", "0.46765792", "0.46703124", "0.4669988", "0.46633908", "0.46617553", "0.46529528", "0.46523443", "0.46511742", "0.46453688", "0.46432874", "0.46372354", "0.4633807", "0.46275863", "0.46265903", "0.46263945", "0.46259898", "0.46229926", "0.46220127" ]
0.7130741
0
PATCH/PUT /admin_panels/1 PATCH/PUT /admin_panels/1.json
def update respond_to do |format| if @admin_panel.update(admin_panel_params) format.html { redirect_to @admin_panel, notice: 'Admin panel was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @admin_panel.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @panel = Panel.find(params[:id])\n\n respond_to do |format|\n if @panel.update_attributes(params[:panel])\n format.html { redirect_to(admin_panel_path(@panel), :notice => 'Panel was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @panel.update(panel_params)\n format.html { redirect_to @panel, notice: 'Panel was successfully updated.' }\n format.json { render :show, status: :ok, location: @panel }\n else\n format.html { render :edit }\n format.json { render json: @panel.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @panel = Panel.find(params[:id])\n @place = Place.find(params[:place_id])\n\n respond_to do |format|\n if @panel.update_attributes(params[:panel])\n format.html { redirect_to(place_panel_url(@place, @panel), :notice => 'Panel was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @panel_model.update(panel_model_params)\n format.html { redirect_to @panel_model, notice: 'Panel model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @panel_model.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @panel = Panel.find(params[:id])\n\n respond_to do |format|\n if @panel.update_attributes(params[:panel])\n flash[:notice] = 'Panel was successfully updated.'\n format.html { redirect_to(@panel) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_admin_panel\n @admin_panel = AdminPanel.find(params[:id])\n end", "def update\n respond_to do |format|\n if @port_panel.update(port_panel_params)\n format.html { redirect_to @port_panel, notice: 'Port panel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @port_panel.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_by_ajax\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n cat_h = {:desktop => User::AUTH_DESKTOP, :user => User::AUTH_USER, :log => User::AUTH_LOG}\n\n yaml = ApplicationHelper.get_config_yaml\n\n cat_h.keys.each do |cat|\n\n next if params[cat].blank?\n\n unless @login_user.admin?(cat_h[cat])\n render(:text => t('msg.need_to_be_admin'))\n return\n end\n\n yaml[cat] ||= {}\n\n params[cat].each do |key, val|\n yaml[cat][key] = val\n end\n end\n\n ApplicationHelper.save_config_yaml(yaml)\n\n render(:text => '')\n end", "def update\n @panel_plan = Panel::Plan.find(params[:id])\n\n respond_to do |format|\n if @panel_plan.update_attributes(params[:panel_plan])\n format.html { redirect_to(@panel_plan, :notice => 'Plan was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @panel_plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @control_panel = ControlPanel.find(params[:id])\n\n respond_to do |format|\n if @control_panel.update_attributes(params[:control_panel])\n flash[:notice] = 'ControlPanel was successfully updated.'\n format.html { redirect_to(@control_panel) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @control_panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @page_layout = PageLayout.find(params[:id])\n\n respond_to do |format|\n if @page_layout.update_attributes(params[:page_layout].permit(:content_type, :name, :num_panels, :html_content, :preview_content))\n format.html { redirect_to @page_layout, notice: 'Page layout was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page_layout.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @admin = Admin.find(params[:id])\n\n if @admin.update(admin_params)\n head :no_content\n else\n render json: @admin.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @sold_panel.update(sold_panel_params)\n format.html { redirect_to @sold_panel, notice: 'Sold panel was successfully updated.' }\n format.json { render :show, status: :ok, location: @sold_panel }\n else\n format.html { render :edit }\n format.json { render json: @sold_panel.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_dashboard.update(admin_dashboard_params)\n format.html { redirect_to @admin_dashboard, notice: 'Dashboard was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_dashboard }\n else\n format.html { render :edit }\n format.json { render json: @admin_dashboard.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @deweys_power_panel = DeweysPowerPanel.find(params[:id])\n\n respond_to do |format|\n if @deweys_power_panel.update_attributes(params[:deweys_power_panel])\n format.html { redirect_to(@deweys_power_panel, :notice => 'Deweys power panel was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @deweys_power_panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dashboard.update(dashboard_params)\n format.html { redirect_to @dashboard, notice: 'Dashboard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dashboard.errors, status: :unprocessable_entity }\n end\n end\n\n enabled_widgets = params[:widgets] || {}\n Dashboard.available_widgets.each do |(feature,_)|\n if enabled_widgets.include?(feature)\n @dashboard.widgets.merge!({feature => true})\n else\n @dashboard.widgets.except!(feature)\n end\n @dashboard.save\n end\n end", "def update\n @sidebar = Sidebar.where(id: params[:id]).first\n @old_s_index = @sidebar.staged_position || @sidebar.active_position\n @sidebar.update params[:configure][@sidebar.id.to_s].permit!\n respond_to do |format|\n format.js\n format.html do\n return redirect_to(admin_sidebar_index_path)\n end\n end\n end", "def update\n @pnl = Pnl.find(params[:id])\n\n respond_to do |format|\n if @pnl.update_attributes(params[:pnl])\n format.html { redirect_to(@pnl, :notice => 'Pnl was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pnl.errors, :status => :unprocessable_entity }\n end\n end\n end", "def variables_for_edit\r\n @path = administration.article_cluster_category_path\r\n @method = :patch\r\n end", "def update\n @admin_side_menu = Admin::SideMenu.find(params[:id])\n\n respond_to do |format|\n if @admin_side_menu.update_attributes(params[:admin_side_menu])\n format.html { redirect_to @admin_side_menu, notice: 'Side menu was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_side_menu.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @poll_options_set = PollOptionsSet.find(params[:id])\n\n respond_to do |format|\n if @poll_options_set.update_attributes(params[:poll_options_set])\n format.html { redirect_to @poll_options_set, notice: 'Poll options set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @poll_options_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, @admin_system_admin\n respond_to do |format|\n if @admin_system_admin.update(admin_system_admin_params)\n format.html { redirect_to @admin_system_admin, notice: 'System admin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_system_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @level_container = LevelContainer.find(params[:id])\n\n respond_to do |format|\n if @level_container.update_attributes(params[:level_container])\n format.html { redirect_to @level_container, notice: 'Level container was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @level_container.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @form_section.update(form_section_params)\n respond_with( [ :admin, @form_section] )\n end", "def update\n @dashboard = Dashboard.find(params[:id])\n\n respond_to do |format|\n if @dashboard.update_attributes(params[:dashboard])\n format.html { redirect_to @dashboard, notice: 'Dashboard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dashboard.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_panel\n @panel = Panel.find(params[:id])\n end", "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @panel_id = args[:panel_id] if args.key?(:panel_id)\n @panel_position = args[:panel_position] if args.key?(:panel_position)\n @total_panels = args[:total_panels] if args.key?(:total_panels)\n end", "def update\n @admin_collaborator = Admin::Collaborator.find(params[:id])\n\n respond_to do |format|\n if @admin_collaborator.update_attributes(params[:admin_collaborator])\n format.html { redirect_to @admin_collaborator, notice: 'Collaborator was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_collaborator.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cfg_module.update(cfg_module_params)\n format.html { redirect_to @cfg_module, notice: 'Cfg module was successfully updated.' }\n format.json { render :show, status: :ok, location: @cfg_module }\n else\n format.html { render :edit }\n format.json { render json: @cfg_module.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @collab = Collab.find(params[:id])\n\n respond_to do |format|\n if @collab.update_attributes(params[:collab])\n format.html { redirect_to @collab, notice: 'Collab was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @collab.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_stage.update(admin_stage_params)\n format.html { redirect_to admin_stage_url(@admin_stage.id), notice: 'Stage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_stage.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cpanel_mall.update(cpanel_mall_params)\n format.html { redirect_to @cpanel_mall, notice: 'Mall was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cpanel_mall.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @admin.update(admin_params)\n render :show, status: :ok, location: @admin\n else\n render json: @admin.errors, status: :unprocessable_entity\n end\n end", "def update\n @lab_role = LabRole.find(params[:id])\n\n respond_to do |format|\n if @lab_role.update_attributes(params[:lab_role])\n format.html { redirect_to @lab_role, notice: 'Lab role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab_role.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @systemadmin = Systemadmin.find(params[:id])\n\n respond_to do |format|\n if @systemadmin.update_attributes(params[:systemadmin])\n format.html { redirect_to @systemadmin, notice: 'Systemadmin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @systemadmin.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n\n\n admin_edit_prep\n\n respond_to do |format|\n format.html {render :layout => 'artist_admin'}\n format.json {\n render :json => {\n :success => true,\n :\"#{@hook}\" => render_to_string(\n :action => 'admin.html.erb',\n :layout => @layout,\n ),\n :\"edit\" => \"true\",\n :\"admin-show\" => \"true\",\n\n }\n }\n end\n end", "def update\n respond_to do |format|\n if @lab_section.update(lab_section_params)\n format.html { redirect_to @lab_section, notice: 'Lab section was successfully updated.' }\n format.json { render :show, status: :ok, location: @lab_section }\n else\n format.html { render :edit }\n format.json { render json: @lab_section.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @console_pool = ConsolePool.find(params[:id])\n\n respond_to do |format|\n if @console_pool.update_attributes(params[:console_pool])\n format.html { redirect_to @console_pool, notice: 'Console pool was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @console_pool.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @adm_sets.update(admin_setting_params)\n format.html { redirect_to [:admin, :settings], notice: 'Setting updated.' }\n format.json { render :show, status: :ok, location: @adm_sets }\n else\n format.html { render :edit }\n format.json { render json: @adm_sets.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @lab_area.update(lab_area_params)\n format.html { redirect_to @lab_area, notice: 'Lab area was successfully updated.' }\n format.json { render :show, status: :ok, location: @lab_area }\n else\n format.html { render :edit }\n format.json { render json: @lab_area.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @lab = lab.find(params[:id])\n\n respond_to do |format|\n if @lab.update_attributes(params[:lab])\n format.html { redirect_to @lab, notice: 'lab was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cpanel_promotion.update(cpanel_promotion_params)\n format.html { redirect_to @cpanel_promotion, notice: 'Promotion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cpanel_promotion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mod_pack.update(mod_pack_params)\n format.html { redirect_to @mod_pack, notice: 'Mod pack was successfully updated.' }\n format.json { render :show, status: :ok, location: @mod_pack }\n else\n format.html { render :edit }\n format.json { render json: @mod_pack.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @slab = Slab.find(params[:id])\n\n respond_to do |format|\n if @slab.update_attributes(params[:slab])\n format.html { redirect_to @slab, :notice => 'Slab was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @slab.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @panel_subscription = Panel::Subscription.find(params[:id])\n respond_to do |format|\n if @panel_subscription.update_attributes(params[:panel_subscription])\n format.html { redirect_to(@panel_subscription, :notice => 'Subscription was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @panel_subscription.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pool.update(pool_params)\n format.html { redirect_to @pool, notice: 'Aggregator was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pool.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sesiune.update(sesiune_params)\n format.html { redirect_to controlPanel_path, notice: 'Sesiune was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: controlPanel_path.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @admin = Admin.find(params[:id])\n\n respond_to do |format|\n if @admin.update_attributes(params[:admin])\n format.html { redirect_to @admin, notice: 'Admin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n id = params[ :id ]\n\n if ( @current_user.restricted? and @current_user.id != id.to_i )\n return appctrl_not_permitted()\n end\n\n @user = User.find( id )\n @control_panel = @user.control_panel\n end", "def patch!\n request! :patch\n end", "def edit\n @admin = Admin.where(id: params[:id]).first\n @departments = Department.all\n if request.post?\n if Admin.updated(params)\n flash[:notice] = 'ユーザー情報を編集しました'\n redirect_to(url_for({ controller: 'super', action: 'dashboard' }))\n else\n flash[:error] = 'ユーザ-の情報編集に失敗しました'\n redirect_to(url_for({ controller: 'admin', action: 'edit', id: params[:id]}))\n end\n end\n end", "def update\n # this action is not provided for partyroles\n end", "def update\n @lab_permissions_role = LabPermissionsRole.find(params[:id])\n\n respond_to do |format|\n if @lab_permissions_role.update_attributes(params[:lab_permissions_role])\n format.html { redirect_to @lab_permissions_role, notice: 'Lab permissions role was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab_permissions_role.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @clapme_stage.update(website_stage_params)\n format.html { redirect_to website_stage_url(@clapme_stage.id), notice: 'Stage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @clapme_stage.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n # {:name => poll_params[:name]}\n if @poll.update(poll_params)\n format.html { redirect_to admin_path(@poll), notice: 'Poll was successfully updated.' }\n format.json { render :show, status: :ok, location: admin_path(@poll) }\n else\n format.html { render :edit }\n format.json { render json: @poll.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin.update(admin_params)\n format.html { redirect_to @admin, notice: 'Admin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_admin\n user = User.find(params[:id])\n if user.is_admin?\n user.is_admin = false\n else\n user.is_admin = true\n end\n user.save!\n respond_to do |format|\n format.js {\n render :update do |page|\n page[\"user_#{user.id}\"].replace_html :partial => 'user', :locals => { :user => user }\n page[\"user_#{user.id}\"].visual_effect :highlight\n end\n }\n end\n end", "def update\n @form = Form.find(params[:id])\n @form.update_attributes(params[:form])\n respond_with :admin, @form\n end", "def update\n authorize! :edit, @questionnaire\n\n @questionnaire.load_JSON(params[:questionnaire], current_user)\n\n respond_to do |format|\n# if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to @questionnaire, notice: 'Kysymyslomakkeen muokkaaminen onnistui.' }\n format.json { head :no_content }\n# else\n# format.html { render action: \"edit\" }\n# format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n# end\n\n end\n end", "def update\n respond_to do |format|\n if @site_admin.update(site_admin_params)\n format.html { redirect_to @site_admin, notice: 'Site admin was successfully updated.' }\n format.json { render :show, status: :ok, location: @site_admin }\n else\n format.html { render :edit }\n format.json { render json: @site_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @admin\n respond_to do |format|\n attr = admin_params\n if attr[:password].blank? && attr[:password_confirmation].blank?\n attr = attr.except(:password, :password_confirmation)\n end\n if @admin.update(attr)\n format.html { redirect_to admins_url, notice: 'Admin was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin }\n else\n format.html { render :edit }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @lens = Lens.find(params[:id])\n attrb = select_params(lens_params)\n # linear_data is an array of Objects of Components Properties\n # that needs to be deserialized correctly\n attrb[\"linear_data\"] = JSON.parse(attrb[\"linear_data\"])\n lens = Lens.update(attrb)\n \n # @lens.update(lens_params)\n # render inline: \"<%= @lens.id %>\"\n end", "def update\n @field = Field.find(params[:id])\n @field.update_attributes(params[:field])\n respond_with :admin, @field\n end", "def update\n respond_to do |format|\n if @poll_option.update(poll_option_params)\n format.html { redirect_to [:admin, @poll_option], notice: 'Poll option was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @poll_option.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dashboard.update(dashboard_params)\n format.html { redirect_to @dashboard, notice: 'Dashboard was successfully updated.' }\n format.json { render :show, status: :ok, location: @dashboard }\n else\n format.html { render :edit }\n format.json { render json: @dashboard.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dashboard.update(dashboard_params)\n format.html { redirect_to @dashboard, notice: 'Dashboard was successfully updated.' }\n format.json { render :show, status: :ok, location: @dashboard }\n else\n format.html { render :edit }\n format.json { render json: @dashboard.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dashboard.update(dashboard_params)\n format.html { redirect_to @dashboard, notice: 'Dashboard was successfully updated.' }\n format.json { render :show, status: :ok, location: @dashboard }\n else\n format.html { render :edit }\n format.json { render json: @dashboard.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dashboard.update(dashboard_params)\n format.html { redirect_to @dashboard, notice: 'Dashboard was successfully updated.' }\n format.json { render :show, status: :ok, location: @dashboard }\n else\n format.html { render :edit }\n format.json { render json: @dashboard.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dashboard.update(dashboard_params)\n format.html { redirect_to @dashboard, notice: 'Dashboard was successfully updated.' }\n format.json { render :show, status: :ok, location: @dashboard }\n else\n format.html { render :edit }\n format.json { render json: @dashboard.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_groups_poll.update(api_v1_groups_poll_params)\n format.html { redirect_to @api_v1_groups_poll, notice: 'Groups poll was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_groups_poll }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_groups_poll.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_admin.update(admin_admin_params)\n format.html { redirect_to @admin_admin, notice: 'Admin was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_admin }\n else\n format.html { render :edit }\n format.json { render json: @admin_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cfg.update(cfg_params)\n format.html { redirect_to @cfg, notice: 'Cfg was successfully updated.' }\n format.json { render :show, status: :ok, location: @cfg }\n else\n format.html { render :edit }\n format.json { render json: @cfg.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if panel_params[:panel_number] and panel_params[:panel_location]\n Panel.assign(@ann, panel: panel_params[:panel_number], to: panel_params[:panel_location])\n end\n\n @panel = @ann.panel\n\n respond_to do |format|\n if @ann.update(ann_params)\n format.html { redirect_to @ann, notice: 'Ann was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ann.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_admin_type.update(api_v1_admin_type_params)\n format.html { redirect_to @api_v1_admin_type, notice: 'Admin type was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_admin_type }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_admin_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n current_admin_user\n @tablet = Tablet.find(params[:id])\n\n respond_to do |format|\n if @tablet.update_attributes(params[:tablet])\n format.html { redirect_to @tablet, notice: 'Tablet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tablet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @admined_page1 = AdminedPage1.find(params[:id])\n\n respond_to do |format|\n if @admined_page1.update_attributes(params[:admined_page1])\n format.html { redirect_to @admined_page1, notice: 'Admined page1 was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admined_page1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @dashboard = Account.find(session[:account_id]).dashboards.find(params[:id])\n\n respond_to do |format|\n if @dashboard.update_attributes(params[:dashboard])\n format.html { redirect_to(@dashboard, :notice => 'Dashboard was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dashboard.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cpanel_tag.update(cpanel_tag_params)\n format.html { redirect_to @cpanel_tag, notice: 'Tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cpanel_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @lab_flow = LabFlow.find(params[:id])\n\n respond_to do |format|\n if @lab_flow.update_attributes(params[:lab_flow])\n format.html { redirect_to @lab_flow, notice: 'lab flow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab_flow.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_admin\n update admin_client\n end", "def update\n respond_to do |format|\n if @addons_combo.update(addons_combo_params)\n format.html { redirect_to @addons_combo, notice: 'Addons combo was successfully updated.' }\n format.json { render :show, status: :ok, location: @addons_combo }\n else\n format.html { render :edit }\n format.json { render json: @addons_combo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @applied_capabilities = args[:applied_capabilities] if args.key?(:applied_capabilities)\n @applied_label_policy = args[:applied_label_policy] if args.key?(:applied_label_policy)\n @create_time = args[:create_time] if args.key?(:create_time)\n @creator = args[:creator] if args.key?(:creator)\n @disable_time = args[:disable_time] if args.key?(:disable_time)\n @disabler = args[:disabler] if args.key?(:disabler)\n @display_hints = args[:display_hints] if args.key?(:display_hints)\n @fields = args[:fields] if args.key?(:fields)\n @id = args[:id] if args.key?(:id)\n @label_type = args[:label_type] if args.key?(:label_type)\n @learn_more_uri = args[:learn_more_uri] if args.key?(:learn_more_uri)\n @lifecycle = args[:lifecycle] if args.key?(:lifecycle)\n @lock_status = args[:lock_status] if args.key?(:lock_status)\n @name = args[:name] if args.key?(:name)\n @properties = args[:properties] if args.key?(:properties)\n @publish_time = args[:publish_time] if args.key?(:publish_time)\n @publisher = args[:publisher] if args.key?(:publisher)\n @revision_create_time = args[:revision_create_time] if args.key?(:revision_create_time)\n @revision_creator = args[:revision_creator] if args.key?(:revision_creator)\n @revision_id = args[:revision_id] if args.key?(:revision_id)\n @schema_capabilities = args[:schema_capabilities] if args.key?(:schema_capabilities)\n end", "def update\n respond_to do |format|\n if @portal_config.update(portal_config_params)\n format.html { redirect_to @portal_config, notice: 'Config was successfully updated.' }\n format.json { render :show, status: :ok, location: @portal_config }\n else\n format.html { render :edit }\n format.json { render json: @portal_config.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @lab = Lab.find(params[:id])\n\n respond_to do |format|\n if @lab.update_attributes(params[:lab])\n format.html { redirect_to @lab, notice: 'Lab was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize Admin\n respond_to do |format|\n if @admin.update(admin_params)\n format.html { redirect_to @admin, notice: 'Admin was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin }\n else\n format.html { render :edit }\n format.json { render json: @admin.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def admin_panel_params\n params[:admin_panel]\n end", "def update\n base = 'Failed to save the system administrator. '\n respond_to do |format|\n if @admin.update_attributes(sys_admin_params)\n flash[:success] = 'The system administrator was successfully updated.'\n format.html { redirect_to edit_admins_system administrator_url(@admin) }\n format.json { render json: { rows: [@admin.marshall], status: 200, total: 1 } }\n else\n flash[:error] = 'An error occured while updating the system administrator.'\n format.html { render action: \"edit\", alert: base + @admin.errors.full_messages.to_sentence + \".\" }\n format.json { render json: { errors: @admin.errors, status: :unprocessable_entity } }\n end\n end\n end", "def update\n respond_to do |format|\n if @minor.update(minor_params)\n format.html { redirect_to :show, notice: 'Minor was successfully updated.' }\n format.json { render :show, status: :ok, location: @minor }\n else\n format.html { render :edit }\n format.json { render json: @minor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @widget_layout = WidgetLayout.find(params[:id])\n respond_to do |format|\n if @widget_layout.update_attributes(params[:widget_layout])\n flash[:notice] = 'WidgetLayout was successfully updated.'\n format.html { \n if params['admin_page']\n redirect_to('/admin/modules')\n else\n redirect_to(@widget_layout) \n end \n }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @widget_layout.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @lab_method = LabMethod.find(params[:id])\n\n respond_to do |format|\n if @lab_method.update_attributes(params[:lab_method])\n format.html { redirect_to @lab_method, notice: 'Lab method was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab_method.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @world_admin.update(world_admin_params)\n format.html { redirect_to @world_admin, notice: 'World admin was successfully updated.' }\n format.json { render :show, status: :ok, location: @world_admin }\n else\n format.html { render :edit }\n format.json { render json: @world_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @manage_admin.update(manage_admin_params)\n\n # 保存角色信息\n roles_id=params[:roles]\n @manage_admin.roles_in_id=roles_id\n\n format.html { redirect_to @manage_admin, notice: '管理员信息更新成功.' }\n\n format.json { render :show, status: :ok, location: @manage_admin }\n else\n format.html { render :edit,notice:'修改失败'}\n format.json { render json: @manage_admin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n respond_to do |format|\n if @data_dashboard.update(data_dashboard_params)\n format.html { redirect_to @data_dashboard, notice: 'Data dashboard was successfully updated.' }\n format.json { render :show, status: :ok, location: @data_dashboard }\n else\n format.html { render :edit }\n format.json { render json: @data_dashboard.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @api_disabled = args[:api_disabled] if args.key?(:api_disabled)\n @custom_roles_support_level = args[:custom_roles_support_level] if args.key?(:custom_roles_support_level)\n @description = args[:description] if args.key?(:description)\n @name = args[:name] if args.key?(:name)\n @only_in_predefined_roles = args[:only_in_predefined_roles] if args.key?(:only_in_predefined_roles)\n @primary_permission = args[:primary_permission] if args.key?(:primary_permission)\n @stage = args[:stage] if args.key?(:stage)\n @title = args[:title] if args.key?(:title)\n end", "def update\n @konfig = Konfig.find(params[:id])\n\n respond_to do |format|\n if @konfig.update_attributes(params[:konfig])\n format.html { redirect_to admin_konfig_path(@konfig), notice: 'Config was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @konfig.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @admin_whitelist = Admin::Whitelist.find(params[:id])\n\n respond_to do |format|\n if @admin_whitelist.update_attributes(params[:admin_whitelist])\n format.html { redirect_to @admin_whitelist, notice: 'Whitelist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_whitelist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @jetty = Jetty.find(params[:id])\n\n respond_to do |format|\n if @jetty.update_attributes(params[:jetty])\n format.html { redirect_to @jetty, notice: 'Jetty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @jetty.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @useradmin = Useradmin.find(params[:id])\n #\n respond_to do |format|\n if @useradmin.update_attributes(params[:useradmin])\n format.html { redirect_to @useradmin, notice: 'Useradmin was successfully updated.' }\n format.js\n else\n format.html { render action: \"edit\" }\n format.js { render action: \"edit\" }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_app.update(admin_app_params)\n format.html { redirect_to [:admin, @admin_app], notice: 'App was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_app }\n else\n format.html { render :edit }\n format.json { render json: @admin_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @subadmin.update(subadmin_params)\n format.html { redirect_to @subadmin, notice: 'Subadmin was successfully updated.' }\n format.json { render :show, status: :ok, location: @subadmin }\n else\n format.html { render :edit }\n format.json { render json: @subadmin.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6814441", "0.6558909", "0.6390522", "0.6368118", "0.6266316", "0.60912967", "0.6084242", "0.60687673", "0.5981208", "0.5948328", "0.5786139", "0.5765855", "0.57264185", "0.57002145", "0.56980145", "0.56680197", "0.5658721", "0.5613816", "0.561247", "0.55899686", "0.5580736", "0.55706215", "0.5569093", "0.55666596", "0.5559051", "0.55433303", "0.55416405", "0.55242103", "0.552203", "0.551655", "0.55011195", "0.5496385", "0.5485339", "0.5480453", "0.54796785", "0.5471525", "0.5468491", "0.546067", "0.54525244", "0.54511905", "0.54494256", "0.54383785", "0.5437982", "0.5431815", "0.54267746", "0.54217964", "0.542135", "0.54160386", "0.5397091", "0.5395797", "0.53910804", "0.53905547", "0.5389754", "0.53870827", "0.53844565", "0.5378874", "0.5374855", "0.5374731", "0.53733146", "0.5373182", "0.5370217", "0.53676707", "0.536706", "0.5364584", "0.53631765", "0.53631765", "0.53631765", "0.53631765", "0.53631765", "0.53538364", "0.5346878", "0.53446764", "0.53439134", "0.53406435", "0.5339978", "0.5336978", "0.53365624", "0.53260016", "0.53257686", "0.531832", "0.5314395", "0.53139573", "0.53128606", "0.5311188", "0.53053606", "0.53049946", "0.5304062", "0.5296984", "0.52949476", "0.5294639", "0.52893245", "0.52889305", "0.5288589", "0.52869445", "0.52806085", "0.52780646", "0.5277533", "0.5276869", "0.52751845", "0.52741235" ]
0.7056478
0
DELETE /admin_panels/1 DELETE /admin_panels/1.json
def destroy @admin_panel.destroy respond_to do |format| format.html { redirect_to admin_panels_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @panel = Panel.find(params[:id])\n @panel.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_panels_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @panel = Panel.find(params[:id])\n @panel.destroy\n\n respond_to do |format|\n format.html { redirect_to(panels_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @cpanel_mall.destroy\n respond_to do |format|\n format.html { redirect_to cpanel_malls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n conf.delete 'dashboard'\n end", "def destroy\n @panel.destroy\n respond_to do |format|\n format.html { redirect_to panels_url, notice: 'Panel was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @port_panel.destroy\n respond_to do |format|\n format.html { redirect_to port_panels_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @panel_model.destroy\n respond_to do |format|\n format.html { redirect_to panel_models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @control_panel = ControlPanel.find(params[:id])\n @control_panel.destroy\n\n respond_to do |format|\n format.html { redirect_to(control_panels_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @deweys_power_panel = DeweysPowerPanel.find(params[:id])\n @deweys_power_panel.destroy\n\n respond_to do |format|\n format.html { redirect_to(deweys_power_panels_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @admin_categoryall = Categoryall.find(params[:id])\n @admin_categoryall.destroy\n respond_with(@admin_categoryall, :location => admin_panels_url)\n end", "def destroy\n @panel_plan = Panel::Plan.find(params[:id])\n @panel_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to(panel_plans_url) }\n format.json { head :ok }\n end\n end", "def destroy\n @admin.destroy\n\n render json: { operation: 'OK' }, status: :ok\n end", "def destroy\n @dashboard.destroy\n respond_to do |format|\n format.html { redirect_to dashboards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_dashboard.destroy\n respond_to do |format|\n format.html { redirect_to admin_dashboards_url, notice: 'Dashboard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dashboard = Dashboard.find(params[:id])\n @dashboard.destroy\n\n respond_to do |format|\n format.html { redirect_to dashboards_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin = Admin.find(params[:id])\n @admin.destroy\n\n render json: {:ok => true}\n end", "def destroy\n @admin.destroy\n\n head :no_content\n end", "def destroy\n @admin_level = AdminLevel.find(params[:id])\n @admin_level.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_levels_url }\n format.json { head :ok }\n end\n end", "def destroy\n @place = Place.find(params[:place_id])\n @panel = Panel.find(params[:id])\n @panel.status = Status.inactive\n @panel.save\n\n respond_to do |format|\n format.html { redirect_to(place_panels_url(@place)) }\n format.json { head :ok }\n end\n end", "def destroy\n @health.destroy\n respond_to do |format|\n format.html { redirect_to \"/dashboard\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @level_container = LevelContainer.find(params[:id])\n @level_container.destroy\n\n respond_to do |format|\n format.html { redirect_to level_containers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cpanel_promotion.destroy\n respond_to do |format|\n format.html { redirect_to cpanel_promotions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin.destroy\n respond_to do |format|\n format.html { redirect_to admins_sys_admins_url }\n format.json { render json: { status: 200 } }\n end\n end", "def destroy\n @cfg_module.destroy\n respond_to do |format|\n format.html { redirect_to cfg_modules_url, notice: 'Cfg module was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_stage.destroy\n respond_to do |format|\n format.html { redirect_to admin_stages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dbadmin = Dbadmin.find(params[:id])\n @dbadmin.destroy\n\n respond_to do |format|\n format.html { redirect_to dbadmins_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin.destroy\n respond_to do |format|\n format.html { redirect_to admins_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @link = @panel.links.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to(@panel) }\n format.xml { head :ok }\n end\n end", "def destroy\n @admin_side_menu = Admin::SideMenu.find(params[:id])\n @admin_side_menu.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_side_menus_url }\n format.json { head :ok }\n end\n end", "def destroy\n @admin_level.destroy\n respond_to do |format|\n format.html { redirect_to admin_levels_url, notice: 'Level was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dashboard.destroy\n respond_to do |format|\n format.html { redirect_to dashboards_url, notice: 'Dashboard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dashboard.destroy\n respond_to do |format|\n format.html { redirect_to dashboards_url, notice: 'Dashboard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dashboard.destroy\n respond_to do |format|\n format.html { redirect_to dashboards_url, notice: 'Dashboard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dashboard.destroy\n respond_to do |format|\n format.html { redirect_to dashboards_url, notice: 'Dashboard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dashboard.destroy\n respond_to do |format|\n format.html { redirect_to dashboards_url, notice: 'Dashboard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dashboard.destroy\n respond_to do |format|\n format.html { redirect_to dashboards_url, notice: 'Dashboard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end", "def destroy\n @ad = Ad.find(params[:id])\n @ad.destroy\n\n respond_to do |format|\n format.html { render :action => :admin_dash, :id => 1, :uuid => @uuid }\n format.json { head :no_content }\n end\n end", "def destroy\n @slab = Slab.find(params[:id])\n @slab.destroy\n\n respond_to do |format|\n format.html { redirect_to slabs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cpanel_tag.destroy\n respond_to do |format|\n format.html { redirect_to cpanel_tags_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @panel_billing = Panel::Billing.find(params[:id])\n @panel_billing.destroy\n\n respond_to do |format|\n format.html { redirect_to(panel_billings_url) }\n format.json { head :ok }\n end\n end", "def destroy\n @portal_config.destroy\n respond_to do |format|\n format.html { redirect_to portal_configs_url, notice: 'Config was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sidecfg.destroy\n respond_to do |format|\n format.html { redirect_to sidecfgs_url, notice: 'Sidecfg was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin = Admin.find(params[:id])\n @admin.destroy\n\n respond_to do |format|\n format.html { redirect_to admins_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @collab = Collab.find(params[:id])\n @collab.destroy\n\n respond_to do |format|\n format.html { redirect_to collabs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @clapme_stage.destroy\n respond_to do |format|\n format.html { redirect_to website_stages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @medium_status_mod = MediumStatusMod.find(params[:id])\n @medium_status_mod.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_status_mods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wp_dyna_config = WpDynaConfig.find(params[:id])\n @wp_dyna_config.destroy\n\n respond_to do |format|\n format.html { redirect_to wp_dyna_configs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @panel_subscription = Panel::Subscription.find(params[:id])\n @panel_subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to(panel_subscriptions_url) }\n format.json { head :ok }\n end\n end", "def destroy\n @admined_page1 = AdminedPage1.find(params[:id])\n @admined_page1.destroy\n\n respond_to do |format|\n format.html { redirect_to admined_page1s_url }\n format.json { head :ok }\n end\n end", "def destroy\n @dpm.destroy\n respond_to do |format|\n format.html { redirect_to dpms_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\r\n @admin_decp_module = Admin::DecpModule.find(params[:id])\r\n @admin_decp_module.destroy_full\r\n\r\n respond_to do |format|\r\n format.html { redirect_to admin_decp_modules_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @activity_award_cfg.destroy\n respond_to do |format|\n format.html { redirect_to admin_activity_award_cfgs_url, notice: 'Activity award cfg was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_dashboard( name )\n\n raise ArgumentError.new(format('wrong type. \\'name\\' must be an String, given \\'%s\\'', name.class.to_s)) unless( name.is_a?(String) )\n raise ArgumentError.new('missing name') if( name.size.zero? )\n\n endpoint = format( '/api/dashboards/db/%s', slug(name) )\n\n @logger.debug(\"Deleting dashboard #{slug(name)} (DELETE #{endpoint})\") if @debug\n\n delete(endpoint)\n end", "def delete(name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n\n @client.post({\n 'action' => 'del',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\n end", "def destroy\n @adminmatrixstorageform.destroy\n respond_to do |format|\n format.html { redirect_to adminmatrixstorageforms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @adminmatrixgenu.destroy\n respond_to do |format|\n format.html { redirect_to adminmatrixgenus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cfg.destroy\n respond_to do |format|\n format.html { redirect_to cfgs_url, notice: 'Cfg was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_menu.destroy\n render json: {message: 'deletado com sucesso'}\n end", "def destroy\n @server.destroy\n respond_to do |format|\n format.html { redirect_to [:admin, @site] }\n format.json { head :no_content }\n end\n end", "def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: UserBoards.delete(params[\"id\"])\n end", "def destroy\n @dashboard = Dashboard.find(params[:id])\n @dashboard.destroy\n\n respond_to do |format|\n format.html { redirect_to(dashboards_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @admin.destroy\n respond_to do |format|\n format.html { redirect_to backend_admins_url, notice: '删除成功!' }\n format.json { render :destroy }\n end\n end", "def destroy\n @data_dashboard.destroy\n respond_to do |format|\n format.html { redirect_to data_dashboards_url, notice: 'Data dashboard was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @lab = lab.find(params[:id])\n @lab.destroy\n\n respond_to do |format|\n format.html { redirect_to labs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_administrator.destroy\n respond_to do |format|\n format.html { redirect_to admin_administrators_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @lab_role = LabRole.find(params[:id])\n @lab_role.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_roles_url }\n format.json { head :no_content }\n end\n end", "def delete\n item = FormTemplate.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end", "def destroy\n conf.delete 'api'\n end", "def destroy\n Field.where(unique_id: params[:unique_id]).destroy_all\n respond_to do |format|\n format.html { redirect_to '/dashboard', notice: 'Form was successfully deleted.' }\n end\n end", "def destroy\n @admin_collaborator = Admin::Collaborator.find(params[:id])\n @admin_collaborator.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_collaborators_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :destroy, @admin_system_admin\n @admin_system_admin.destroy\n respond_to do |format|\n format.html { redirect_to admin_system_admins_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @systemadmin = Systemadmin.find(params[:id])\n @systemadmin.destroy\n\n respond_to do |format|\n format.html { redirect_to systemadmins_url }\n format.json { head :no_content }\n end\n end", "def delete_dashboards\n Dashboard.all.map { |data| Dashboard[data['link']] }.each { |d| d.delete }\n end", "def destroy\n @admin_store = Admin::Store.find(params[:id])\n @admin_store.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_stores_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin.destroy\n respond_to do |format|\n \n end\n end", "def destroy\n @world_admin.destroy\n respond_to do |format|\n format.html { redirect_to world_admins_url, notice: 'World admin was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @editability = Editability.find(params[:id])\n @editability.destroy\n\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post_setting.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_index_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @image = Gui::Image.find(params[:id])\n @image.destroy\n redirect_to gui_panels_path\n\n # respond_to do |format|\n # format.html { redirect_to gui_images_url }\n # format.json { head :no_content }\n # end\n end", "def destroy\n @permcl.destroy\n respond_to do |format|\n format.html { redirect_to permcls_url, notice: 'Permcl was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize @admin\n\n @admin.destroy\n respond_to do |format|\n format.html { redirect_to admins_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @administration = Administration.find(params[:id])\n @administration.destroy\n\n respond_to do |format|\n format.html { redirect_to administrations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @administration = Administration.find(params[:id])\n @administration.destroy\n\n respond_to do |format|\n format.html { redirect_to administrations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pool.destroy\n respond_to do |format|\n format.html { redirect_to pools_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @health_level.destroy\n\n respond_to do |format|\n format.html { redirect_to health_levels_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if false\n @sold_panel.destroy\n respond_to do |format|\n format.html { redirect_to sold_panels_url, notice: 'Sold panel was successfully destroyed.' }\n format.json { head :no_content }\n end\n else\n render :file => \"/public/404.html\",:status => \"404\" \n end\n end", "def destroy\n @level.destroy\n respond_to do |format|\n format.html { redirect_to levels_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @lab_flow = LabFlow.find(params[:id])\n @lab_flow.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_flows_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 \"/dynamics/#{@board.dynamic_id}\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_admin_type.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_admin_types_url, notice: 'Admin type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dynamic_project_page.destroy\n respond_to do |format|\n format.html { redirect_to '/administrator/dynamic_project_pages', notice: 'Информация обновлена' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_form.destroy\n respond_to do |format|\n format.html { redirect_to admin_forms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @site_admin.destroy\n respond_to do |format|\n format.html { redirect_to site_admins_url, notice: 'Site admin was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n secureEnter @step\n @step.destroy\n respond_to do |format|\n format.html { redirect_to edit_post_path(@step.post.id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_sub_metric.destroy\n respond_to do |format|\n format.html { redirect_to admin_sub_metrics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @lab_permissions_role = LabPermissionsRole.find(params[:id])\n @lab_permissions_role.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_permissions_roles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @console_pool = ConsolePool.find(params[:id])\n @console_pool.destroy\n\n respond_to do |format|\n format.html { redirect_to console_pools_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7414868", "0.70485306", "0.689241", "0.6883058", "0.6851572", "0.68437153", "0.6747899", "0.66987664", "0.667577", "0.6669158", "0.6649219", "0.65649974", "0.6553565", "0.6524404", "0.64714277", "0.6470395", "0.64145106", "0.6414252", "0.639615", "0.6342583", "0.6328403", "0.6320386", "0.6314618", "0.6308684", "0.6299355", "0.6290119", "0.6288291", "0.6283429", "0.62799793", "0.6266199", "0.62218285", "0.62206936", "0.62206936", "0.62206936", "0.62206936", "0.62206936", "0.6218838", "0.62170666", "0.6216153", "0.6210359", "0.6205802", "0.6203719", "0.6200141", "0.6199987", "0.6190144", "0.618969", "0.61850893", "0.61837894", "0.6172885", "0.6153188", "0.61509115", "0.6140531", "0.61354387", "0.6131638", "0.6128162", "0.6126476", "0.6117211", "0.6114463", "0.61141515", "0.6114071", "0.61108494", "0.6109981", "0.61086166", "0.60971695", "0.60964656", "0.60928464", "0.6086513", "0.6085079", "0.60804415", "0.6079746", "0.60741085", "0.60641694", "0.606279", "0.60601217", "0.6054175", "0.60534716", "0.60494614", "0.6048842", "0.6045319", "0.60346323", "0.60324836", "0.602643", "0.60222805", "0.6020655", "0.60197186", "0.60197186", "0.6013519", "0.6012545", "0.6011561", "0.60096085", "0.60005254", "0.5998526", "0.5997652", "0.59963566", "0.5988131", "0.5987131", "0.59838533", "0.598146", "0.5976182", "0.59759116" ]
0.77658314
0
Use callbacks to share common setup or constraints between actions.
def set_admin_panel @admin_panel = AdminPanel.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 admin_panel_params params[:admin_panel] 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
Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use the same element twice.
def two_sum(nums, target) result = [] nums.each_with_index do |num, idx| find_num = target - num result = [idx, nums.index(find_num)] if nums.include?(find_num) && nums.index(find_num) != idx return result if result.length > 0 end if result.length == 0 return "Target sum not found in array" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(nums, target)\n nums.each_with_index do |e, i|\n nums.each_with_index do |e_, i_|\n return [i, i_] if ((e + e_ == target) && (i != i_))\n end\n end\nend", "def two_sum(nums, target)\n target_indexes = []\n nums.each_with_index do |primary, index|\n nums.each_with_index do |num, i|\n if primary + num == target && index != i\n target_indexes << index\n target_indexes << i\n end\n end\n end\n return target_indexes.uniq\nend", "def brute_force_two_sum(array, target)\n indexes = []\n array.each.with_index do |n1, index1|\n array.each.with_index do |n2, index2|\n indexes.push(index1) if target - n1 == n2 && index1 != index2\n end\n end\n indexes\nend", "def two_sum(numbers, target)\n\n numbers.each_with_index do |num, index|\n \n looking_for = target - num\n answer_2 = binary_search(numbers, index + 1, numbers.length - 1, looking_for)\n if !!answer_2\n return [index + 1, answer_2 + 1] \n end\n end\nend", "def two_sum(numbers, target)\n arr = numbers\n num = target\n index_array = []\n return_array = []\n current_index = 0\n\n loop do\n idx_counter = current_index\n current_element = arr[current_index]\n\n loop do\n break if idx_counter >= arr.length - 1\n next_index = idx_counter + 1\n next_element = arr[next_index]\n if current_element + next_element == num\n index_array << current_index << next_index\n end\n idx_counter += 1\n end\n\n if return_array == []\n current_index += 1\n end\n break if return_array.reduce(:+) == num\n end\n\n p index_array\nend", "def two_sum(nums, target)\n indices_array = []\n i = 0\n while i < nums.length\n j = i + 1\n while j < nums.length\n if nums[i] + nums[j] == target\n indices_array << i\n indices_array << j\n end\n j += 1\n end\n i += 1\n end\n return indices_array\nend", "def two_sum(nums, target)\n nums.each_with_index do |num1, idx1|\n nums.each_with_index do |num2, idx2|\n if (num1 + num2 == target) && (idx1 != idx2)\n return [idx1, idx2]\n end\n end\n end\nend", "def two_sum_binary(numbers, target)\n numbers.each_with_index do |num, i|\n j = binary_search(numbers, target - num, i+1)\n\n # +1 because we do both index1 and index2 are not zero-based\n return [i+1, j+1] unless j == -1\n end\n\n raise ArgumentError.new(\"No two sum solution\")\nend", "def twoSum(numbers, target)\n (0...(numbers.size - 1)).each do |ind1|\n ((ind1 + 1)...numbers.size).each do |ind2|\n return [ind1, ind2] if numbers[ind1] + numbers[ind2] == target\n end\n end\nend", "def map_then_iterate_two_sum(array, target)\n hash = {}\n array.each.with_index do |i, index|\n hash[i] = index\n end\n indexes = []\n array.each.with_index do |ii, index|\n complement = target - ii \n if hash.has_key?(complement) && hash.fetch(complement) != index\n indexes.push(index, hash.fetch(complement))\n return indexes\n end\n end\nend", "def two_sum(nums, target)\n hsh = Hash.new\n nums.each_with_index do |n, i|\n hsh[n] = i+1\n end\n \n nums.each_with_index do |val, ind|\n second = target - val\n if hsh.include?(second) && nums.index(second) != ind\n return [ind+1, nums.index(second)+1]\n end\n end\nend", "def two_sum(nums, target)\n results = []\n i = 1\n while i < nums.length\n diff = target - nums[i - 1]\n if nums[i..-1].include?(diff)\n idx = nums[i..-1].index(diff)\n results << i - 1 << idx + i\n end\n\n i += 1\n end\n\n results\nend", "def two_sum(nums, target)\n nums.each_with_index do |num1, idx1|\n nums.each_with_index do |num2, idx2|\n next if idx1 == idx2\n return [idx1, idx2] if num1 + num2 == target\n end\n end\n return \"Couldn't find target value\"\nend", "def two_sum(nums, target)\n nums.each_with_index do |ele, i|\n check = target - ele\n return i, nums.index(check) if nums.include?(check) && i != nums.index(check)\n end\nend", "def two_sum_indices(arr, target_sum)\n complements = {}\n arr.each_with_index do |el, i|\n complement, j = complements[target_sum - el] # these will both be nil if the complement doesn't exist\n return [i, j] if complement\n\n complements[el] = [el, i]\n end\n nil\nend", "def one_pass_two_sum(array, target)\n hash = {}\n array.each.with_index do |i, index|\n complement = target - i\n if hash.has_key?(complement)\n return [hash.fetch(complement), index]\n end\n hash[i] = index\n end\nend", "def two_sum(numbers, target)\n numbers.each_with_index do |num, idx|\n # why `idx + 1`? because we don't want to include the number in our search\n # so if we start at idx 0, we want to search from 1..end for the complement\n # also, so we don't re-search smaller numbers, since this array is sorted.\n low = idx + 1\n high = numbers.size - 1\n search = target - num\n\n while low <= high\n mid = (low + high) / 2\n\n if numbers[mid] == search\n return [idx + 1, mid + 1] # NOT zero-indexed!\n elsif numbers[mid] > search\n # note we ignore including `mid` on next search for both `high` and `low`\n # and our first condition already takes care of `mid`\n high = mid - 1\n else\n low = mid + 1\n end\n end\n end\nend", "def twoSum(numbers, target)\n # solution\n result = []\n numbers.each do |i|\n y = numbers.length - 1\n while y > numbers.index(i) do \n if i + numbers[y] == target\n result << numbers.index(i) << y\n return result\n end\n y -= 1\n end\n end\nend", "def two_sum(nums, target)\n complements = Hash.new\n \n nums.each_with_index do |num, index|\n if complements.has_key? (target - num)\n return [complements[target - num], index]\n else\n complements[num] = index\n end\n end\n \n return []\nend", "def two_sum_indices(arr, target_sum)\n complements = {}\n arr.each_with_index do |el, i|\n complement, j = complements[target_sum - el] # these will both be nil if the complement doesn't exist\n return [i, j] if complement\n \n complements[el] = [el, i]\n end\n nil\nend", "def two_sum(numbers, target)\n size = numbers.length\n i = 0\n j = size - 1\n\n while numbers[i] + numbers[j] != target\n i += 1 if (numbers[i] + numbers[j]) < target\n j -= 1 if (numbers[i] + numbers[j]) > target\n end\n\n [i + 1, j + 1]\nend", "def two_sum(nums, target)\n hash_idx_nums = {}\n index_result_array = []\n for index in (0...nums.length)\n hash_idx_nums[index] = nums[index]\n end\n\n # nums.each do |num|\n # result = target - num\n # if hash_idx_nums.value?(result)\n # index_result_array << hash_idx_nums.key(result)\n # end\n # end\n for index in (0...nums.length)\n result = target - nums[index]\n \n if hash_idx_nums.value?(result) && hash_idx_nums.key(result) != index\n index_result_array << hash_idx_nums.key(result)\n end\n end\n p index_result_array\n return index_result_array[0], index_result_array[1]\nend", "def two_sum(numbers, target)\n numbers.each_with_index do |n1, i1|\n numbers.each_with_index do |n2, i2|\n return [i1, i2] if (n1 + n2) == target && i1 != i2\n end\n end\nend", "def two_sum(nums, target)\n # i,j = 0, nums.length-1\n i = 0\n j = nums.length-1\n output = []\n while i < nums.length-1\n while j > i\n if nums[i] + nums[j] == target\n output << i << j\n end\n j-=1\n end\n i+=1\nend\nreturn output #returning index\nend", "def two_sum(array, target)\n num_hash = {}\n \n array.each_with_index do |num, index|\n difference = target - num\n if num_hash[difference]\n return [num_hash[difference], index]\n else\n num_hash[num] = index\n end\n end\nend", "def two_sum(nums, target)\n nums.map do | i |\n x = nums.index(i)+1\n if nums[x] + i == target\n return [nums.index(i),x]\n end\n end\nend", "def two_sum(integers, target)\n # O(n)\n integers_with_index = integers.each_with_index.to_a\n # O(n*log(n))\n integers_with_index = integers_with_index.sort_by { |(n, _)| n }\n\n front, back = 0, integers_with_index.count - 1\n\n until front == back\n sum = integers_with_index[front][0] + integers_with_index[back][0]\n if sum == target\n return [integers_with_index[front][1], integers_with_index[back][1]].sort\n elsif sum > target\n back -= 1\n else\n front += 1\n end\n end\nend", "def two_sum(nums, target)\n index_of_complement = {}\n (0...nums.size).each do |i|\n if index_of_complement.key?(nums[i]) \n return [index_of_complement[nums[i]], i] \n else\n index_of_complement[target - nums[i]] = i\n end\n end\nend", "def two_sum(nums, target)\n sorted_nums = nums.sort\n\n last_index = sorted_nums.size - 1\n first_index = 0\n\n while true do\n if sorted_nums[last_index] + sorted_nums[first_index] > target\n last_index -= 1\n\n next\n end\n\n smaller_have_to_be = target - sorted_nums[last_index]\n\n while true do\n if sorted_nums[first_index] < smaller_have_to_be\n first_index += 1\n\n next\n end\n\n break\n end\n\n if sorted_nums[first_index] != smaller_have_to_be\n last_index -= 1\n next\n end\n\n break\n end\n\n # Find correct indexes ( because that indexs in sorted array )\n\n result = []\n nums.each_with_index do |number, index|\n if [sorted_nums[first_index], sorted_nums[last_index]].include?(number)\n result.push(index)\n end\n end\n\n result\nend", "def two_sum(nums, target)\n nums_hash = {}\n nums.each_with_index do |val, i|\n nums_hash[val] = i\n end\n\n nums.each_with_index do |ival, i|\n complement = target - ival\n next if nums_hash[complement] == i\n if nums_hash.key?(complement)\n return [i, nums_hash[complement]]\n end\n end\n []\nend", "def nums(target, *array)\n\tarray.each_with_index do |a, x|\n\t\tarray.each_with_index do |b, y|\n\t\t\tif x > y\n\t\t\t\tif a + b == target\n\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\n\treturn false\nend", "def two_sum_indices?(arr, target_sum)\n summands = {}\n\n arr.each_with_index do |num, i|\n summand = target_sum - num\n return [target_sum[summand], i] if summands.key?(summand)\n\n summands[num] = i\n end\n\n false\nend", "def two_sum(nums, target)\n diff = {}\n\n nums.each_with_index do |num, idx|\n if diff[num]\n return [diff[num], idx]\n else\n diff[target - num] = idx\n end\n end\nend", "def two_sum(nums, target)\n nums_hash = {}\n \n nums.each.with_index do |num, idx|\n nums_hash[num] = idx\n end\n \n nums.each.with_index do |num1, i|\n val = target - num1\n \n return [i, nums_hash[val]] if nums_hash[val] && nums_hash[val] != i\n end\nend", "def two_sum(nums, target)\n seen = {}\n nums.each_with_index do |num, idx|\n return [seen[num], idx] if seen[num]\n\n seen[target - num] = idx\n end\nend", "def two_sum(nums, target)\n if target_match = nums.combination(2).find { |pair| pair.sum == target }\n index1 = nums.index(target_match[0])\n nums.delete_at(nums.index(target_match[0]))\n index2 = nums.index(target_match[1]) + 1\n [index1, index2]\n end\nend", "def two_sum(nums, target)\n hash = Hash.new\n nums.each_with_index do |num, index|\n findable = target - num\n if hash[findable]\n return [nums.index(findable), index]\n end\n hash[num] = findable\n end\n require 'pry'; binding.pry\nend", "def two_sum(numbers, target)\n n_index = {} \n (0...numbers.length).each do |i1|\n i2 = n_index[target - numbers[i1]]\n return [i1 + 1, i2 + 1].sort if i2 && i2 != i1 \n n_index[numbers[i1]] = i1\n end\nend", "def find_triplets(target)\n @nums.each do |num, occ|\n pair = find_pairs(target - num)\n return num * pair if pair != -1\n end\n end", "def two_sum(array, target)\n found = Hash.new(false)\n goal = nil\n\n array.each do |el|\n goal = (target - el).abs\n return true if found[goal] && goal + el == target\n found[el] = true\n end\n\n false\nend", "def two_sum(nums, target)\n hash = {}\n nums.each_with_index do |num, idx|\n other_num = target - num\n other_num_idx = hash[other_num]\n return [other_num_idx, idx] if other_num_idx\n\n hash[num] = idx\n end\n []\nend", "def find_target_sum_arrays(arr, target)\n helper(arr, target, arr.length - 1, [], 0)\nend", "def two_sum(nums, target)\n hash = {}\n nums.each_with_index do |val, index|\n ans = target - val\n return [hash[ans], index] if hash.include?(ans)\n\n hash[val] = index\n end\nend", "def two_sum(numbers, target)\n i = 0\n j = numbers.length - 1\n\n while i < j\n sum = numbers[i] + numbers[j]\n\n if target < sum\n j -= 1\n elsif target > sum\n i += 1\n else\n return [i + 1, j + 1]\n end\n end\nend", "def two_sum(nums, target)\n map = {}\n\n (0...nums.size).each do |i|\n current_value = nums[i]\n\n if map[target - current_value]\n return [map[target - current_value] + 1, i + 1]\n else\n map[current_value] = i\n end\n end\nend", "def two_sum(nums, target)\n hash = {}\n\n nums.each_with_index do |n, idx|\n differential = target - n\n return [hash[differential], idx] if hash[differential]\n hash[n] = idx\n end\nend", "def two_sum(array, target)\n\n !!array.uniq.combination(2).detect { |a, b| a + b == target }\nend", "def pair_sum(arr, target)\n # basic approach is nested loops scanning each element checking if its == to target\n result = []\n i = 0\n j = i + 1\n while i < arr.length\n while j < arr.length\n p i, j\n if i != j && arr[i] + arr[j] == target\n result << [i, j]\n end\n j += 1\n end\n i += 1\n j = i + 1\n end\n result\nend", "def two_sum(integers, target) \n checked = {}\n integers.each.with_index do |num, idx|\n diff = target - num\n checked[diff] ? (return true) : (checked[num] = idx)\n end\n false\nend", "def two_sum(nums, target)\n num_hash = Hash.new\n \n nums.each_with_index do |num, idx|\n diff = target - num\n if num_hash[diff]\n return idx < num_hash[diff] ? [idx, num_hash[diff]] : [num_hash[diff], idx]\n end\n num_hash[num] = idx\n end\n null\nend", "def two_sum(numbers, target)\n hash={}\n numbers.each_with_index do |num,index|\n if(hash[num])\n return [hash[num], index+1]\n else\n hash[target-num] = index+1\n end\n end\nend", "def two_sum(numbers, target)\n low = 0\n high = numbers.size - 1\n\n until low == high\n sum = numbers[low] + numbers[high]\n case sum <=> target\n when 0\n return [low + 1, high + 1] # NOT zero-indexed!\n when 1 # sum > target\n high -= 1\n when -1 # sum < target\n low += 1\n end\n end\nend", "def adds_up(nums, target)\n\n i = 0\n while i < nums.length\n j = i + 1\n while j < nums.length\n if nums[i] == target - nums[j]\n return [i, j]\n end\n\n j += 1\n end\n\n i += 1\n end\n\n return []\nend", "def two_sum(arr, target) \n hash = {}\n \n i = 0\n for val in arr do\n val1 = arr[i]\n val2 = target - val1 \n if hash[val2] \n return [hash[val2], i]\n else\n hash[val1] = i \n end\n i += 1\n end\n\n nil \nend", "def two_sum(numbers, target)\n ##set hash\n hash = {}\n ##set array\n arr = []\n\n numbers.each_with_index do |val, idx|\n if hash.key?(target - val)\n arr.push(hash[target - val])\n arr.push(idx + 1)\n break\n else\n hash[val] = idx + 1\n end\n end\n\n arr\nend", "def two_sum(nums, target)\n numbers_checked = {}\n\n nums.each do |num|\n other_part_of_pair = target - num\n if numbers_checked.has_key?(other_part_of_pair)\n return [nums.index(other_part_of_pair), nums.rindex(num)]\n else\n numbers_checked[num] = true\n end\n end\nend", "def two_sum(nums, target)\n h = {}\n nums.each_with_index do |a, i|\n n = target - a\n return [h[n], i] if h[n]\n h[a] = i\n end\nend", "def two_sum(nums, target)\n\tnum_len = nums.length\n\tdic = {}\n\ti = 0 \n while i < num_len\t\n \tnumber = nums[i]\n \tif number == target / 2 && dic[number]\n \t\treturn [dic[number],i]\n \tend\n \tdic[number] = i\n \tmaybe = dic[target-number]\n \tif maybe && maybe != i\n \t\treturn [maybe,i]\n \t\tbreak\n \tend\n i += 1\n end\nend", "def two_sum(nums, target)\n map = {}\n len = nums.length\n len.times do |i|\n complement = target - nums[i]\n if map.include? complement\n return [i, map[complement]]\n end\n map[nums[i]] = i\n end\n raise \"No solution !\"\nend", "def sum_pair(list, target)\n list.each do |a|\n list.each do |b|\n if a + b == target and list.index(a) != list.index(b)\n return [a, b]\n end\n end\n end\nend", "def two_sum_2_pointers(numbers, target)\n l_pointer = 0\n r_pointer = numbers.size - 1\n\n while l_pointer < r_pointer\n sum = numbers[l_pointer] + numbers[r_pointer]\n\n if sum < target\n l_pointer += 1\n elsif sum > target\n r_pointer -= 1\n else\n return [l_pointer + 1, r_pointer + 1]\n end\n end\n\n raise ArgumentError.new(\"No two sum solution\")\nend", "def two_sum(nums, target)\n table = {}\n i = 0\n while i < nums.length\n table[target - nums[i]] = i\n i += 1\n end\n \n j = 0\n while j < nums.length\n if table.key?(nums[j]) && j != table[nums[j]]\n return [j, table[nums[j]]] \n end\n j += 1\n end\nend", "def two_sum_hash(numbers, target)\n n_index = {} \n (0...numbers.length).each do |i2|\n i1 = n_index[target - numbers[i2]] \n\n # We know that n[i2] > n[i1] because input array is sorted.\n return [i1 + 1, i2 + 1] if i1 && i1 != i2\n n_index[numbers[i2]] = i2\n end\nend", "def search_range(nums, target)\n return [-1,-1] if nums.empty? || !nums.include?(target)\n output = [*nums.each_with_index]\n all_targets = output.find_all do |tuple|\n tuple[0] == target\n end\n [all_targets.first[1], all_targets.last[1]]\nend", "def two_sum_ptr(nums, target)\n low, high = 0, nums.length - 1\n while( low < high)\n if(nums[low] + nums[high] == target)\n return [low + 1, high + 1]\n elsif nums[low] + nums[high] < target\n low += 1\n else\n high -= 1\n end\n end\nend", "def two_sum(nums, target)\n low = 0\n high = nums.length - 1\n\n while low < high\n sum = nums[low] + nums[high]\n\n if sum < target\n low += 1\n elsif sum > target\n high -= 1\n else\n return[low, high]\n end\n end\nend", "def two_sum_with_hash(nums, target)\n h = {}\n nums.each_with_index {|x, index| h[x] = index }\n nums.each_with_index do |row, index|\n diff = target - row\n if h.keys.include? diff and (not h[diff] == index)\n return index, h[diff]\n end\n end\nend", "def twosum(array, target)\n return [] if array.length<=1\n cache = {}\n array.each.with_index do |e,i|\n if cache.include? (target-e)\n return [i,cache[target-e]]\n else\n cache[e] = i\n end\n end\n return []\nend", "def two_sum?(arr, target)\n h = Hash.new\n arr.each_with_index do |val, i|\n h[val] = i\n end\n\n arr.each_index do |i|\n to_find = target - arr[i]\n return true if h[to_find] && h[to_find] != i\n end\n false\nend", "def two_number_sum(array, target_sum)\n i = 0\n while i <= array.length - 1\n j = array.length - 1\n while j >= 0\n if array[i] + array[j] == target_sum && i != j\n return [array[i], array[j]]\n end\n j -= 1\n end\n i += 1\n end\n return []\nend", "def bad_two_sum?(arr, target)\n sums = []\n arr.each_index do |i|\n (i+1...arr.length).each do |j|\n sums << arr[i] + arr[j]\n end\n end\n sums.include?(target)\nend", "def two_sum?(arr, target)\n s1 = Set.new \n arr.each_with_index do |el, idx|\n return true if s1.include?(target-el)\n s1.add(el)\n end\n false\nend", "def okay_two_sum?(nums, target)\n output = []\n i = 0\n j = nums.length - 1\n \n while i != j\n sum = nums[i] + nums[j]\n\n if sum == target\n output << [i, j]\n end \n\n if sum <= target\n i += 1\n else\n j -= 1\n end\n end\n\n output\nend", "def summer (array, target_number)\n\t#tracks number position in array \n\tindex = 0\n\t#array of two element arrays that is returned by function\n\tanswer_array = []\n\twhile index <= array.length\n\t \tarray.each do |number|\n\t\t\tif (((array[index].to_i + array[number].to_i) == target_number) && index != number)\n\t\t\t\tanswer_array.push([array[index], array[number]])\n\t\t\tend \n end\n index += 1 \n end \t\n answer_array\nend", "def find_complements1(numbers, target_sum: 2020)\n complements = numbers.map { |n| [n, target_sum - n] }.to_h\n complements.find { |_n, c| complements.key?(c) }\nend", "def sorting_two_sum(array, target)\n arr = array.sort\n arr.each_with_index do |int, idx|\n search_array = array[0...idx] + array[(idx + 1)..-1]\n return true if search_array.bsearch { |x| x == target - int }\n end\n false\nend", "def two_sum(n, target)\n n.each_with_object({}).with_index do |(v,o),j|\n i = o[target - v]\n return [i,j] if i\n o[v] = j\n end\n raise \"Cannot Find Answer\"\nend", "def good_two_sum?(arr, target)\n input_hash = Hash.new\n \n arr.each.with_index do |el, i|\n input_hash[el]=i\n end\n arr.each.with_index do |el, i|\n var = input_hash[target - el]\n return true if var && var !=i\n end\n false\nend", "def sum_pairs(nums, target)\n results = []\n if nums.count < 2\n return results\n end\n nums.sort!\n (0..(nums.length - 2)).each do |first_index|\n second_index = first_index + 1\n until second_index == nums.length\n sum = nums[first_index] + nums[second_index]\n if sum == target\n results << [nums[first_index], nums[second_index]].sort\n end\n second_index += 1\n end\n end\n results.sort\nend", "def search_range(nums, target)\n emp = []\n if nums.include?(target)\n nums.each_with_index do |n,i|\n if n == target\n emp.push(i)\n end\n end\n\n emp.map {|n| [emp[0], emp[emp.length - 1]] }[0]\n\n else\n [-1,-1]\n end\nend", "def bad_two_sum?(arr, target)\n\n arr.each.with_index do |x, idx|\n arr.each.with_index do |y, idy|\n if idx == idy\n next\n else\n if (x + y) == target\n return true\n end\n end\n end\n end\n\n return false\n\nend", "def okay_two_sum?(arr, target)\n arr.sort!\n\n arr.select! { |el| el < target }\n\n arr.each { |el| arr.include?(target - el) ? (return true) : next }\n false\nend", "def okay_two_sum?(arr, target)\n arr.each_with_index do |el,idx|\n if bi_search(arr[idx+1..-1], target, el)\n return true\n end\n end\n false\nend", "def two_sum?(array, target)\n hash = Hash.new\n array.each do |el|\n interm_target = target - el\n return true if hash.keys.include?(el)\n hash[interm_target] = true\n end\n false\nend", "def two_sum?(array, target)\n #O(n)\n hash = Hash.new(0)\n i = 1\n array.each do |ele|\n hash[ele] = i \n i += 1\n end\n hash.each_key do |k|\n return true if hash.has_key?(target - k) && hash[k] != hash[target - k]\n end\n false \nend", "def two_sum(nums, target)\n\n l,r = 0, nums.count-1\n\n results = []\n\n while l < r\n\n total = nums[l] + nums[r]\n if total == target\n results << [nums[l],nums[r]]\n l,r = l+1, r-1\n elsif total < target\n l += 1\n else\n r -= 1\n end\n end\n results\nend", "def two_sum(array, target_sum)\n\tarray.sort!\n\tlow_pointer = 0\n\thigh_pointer = array.length - 1\n\n\twhile low_pointer < high_pointer\n\t\tcurrent_sum = array[low_pointer] + array[high_pointer]\n\t\tif current_sum == target_sum\n\t\t\treturn [array[low_pointer], array[high_pointer]]\n\t\telsif current_sum < target_sum\n\t\t\tlow_pointer += 1\n\t\telsif current_sum > target_sum\n\t\t\thigh_pointer -= 1\n\t\tend\n\tend\n[]\nend", "def okay_two_sum?(arr, target)\n arr = arr.sort\n arr.each_index do |i|\n to_find = target - arr[i]\n sub_arr = arr[0...i] + arr[i + 1..-1]\n return true if sub_arr.bsearch { |x| x == to_find }\n end\n false\nend", "def okay_two_sum?(arr, target)\n sorted = quick_sort(arr)\n\n arr.each_with_index do |el, idx|\n p current = target - el\n bruh = bsearch(arr, current)\n next if bruh == idx\n return true unless bruh.nil?\n end\n\n return false\nend", "def bad_two_sum?(array, target)\n array.each.with_index do |el1, idx1|\n array.each.with_index do |el2, idx2|\n if el1 + el2 == target && idx2 > idx1\n return true \n end\n end\n end\n false \nend", "def okay_two_sum?(arr, target)\n sorted_arr = arr.sort\n sorted_arr.each.with_index do |el, idx|\n target_pair = target - el\n if sorted_arr[idx+1..-1].bsearch{|n| n >= target_pair } == target_pair\n p target_pair\n return true\n end\n end\n false\nend", "def sum_pairs(ints, s)\n arr = []\n ints.each do |int|\n target_number = s - int\n if ints.include?(target_number)\n arr << [int, target_number]\n end\n end\n if arr.size == 0\n nil\n else\n arr[0]\n end\nend", "def ok_two_sum(arr, target)\n sorted = quick_sort(arr)\n\n arr.each do |el|\n b_target = target - el\n return true if b_search(arr, b_target)\n end\n false\nend", "def two_sum?(arr, target)\n m_hash = {}\n arr.each_with_index do |e, i|\n complement = target - e\n if m_hash.key?(complement)\n return true\n else\n m_hash[e] = true\n end\n end\n false\nend", "def hash_two_sum(array, target)\n numbers = Hash.new(0)\n array.each { |num| numbers[num] = true }\n numbers.each { |k, v| return true if numbers.has_key?(target - k)}\nend", "def two_sum_3(nums, target)\n len = nums.length\n hash = {}\n\n for i in (0...len)\n elt = nums[i]\n diff = target - elt\n # check to see if diff is in the hash; if so we found 2 numbers that add up to sum, that is diff and elt\n if hash[diff]\n index1 = nums.index(diff)\n puts \"index1=#{index1+1}, index2=#{i+1}\"\n return\n else\n hash[elt] = 1 # add the key elt to the hash\n end\n end\nend", "def hash_two_sum(arr, target)\n h = Hash.new { |h, k| h[k] = [] }\n arr.each_with_index do |num, i|\n return true unless h[target - num].empty?\n h[num] << i\n end\n\n false\nend", "def two_sum_2(nums, target)\n sorted_nums = merge_sort(nums)\n i, j = 0, sorted_nums.length-1\n while i < j\n sum = sorted_nums[i] + sorted_nums[j]\n if sum == target\n index1 = nums.index(sorted_nums[i])\n index2 = nums.index(sorted_nums[j])\n puts \"index1=#{index1+1}, index2=#{index2+1}\"\n return\n elsif sum < target\n i += 1\n else\n j -= 1\n end\n end\nend", "def okay_two_sums?(arr, target)\n arr.sort!\n\n arr.each do |num|\n return true if b_search?(arr, (target - num))\n end\n false\nend", "def is_sum_of_any_two(target, numbers)\n for index1 in 0...numbers.length - 1\n for index2 in index1 + 1...numbers.length\n if (numbers[index1] + numbers[index2]) == target\n return true\n end\n end\n end\n false\nend" ]
[ "0.79458165", "0.7920071", "0.778021", "0.7730683", "0.76339716", "0.7541881", "0.75198734", "0.75039226", "0.7478158", "0.747538", "0.74371535", "0.7429129", "0.7428328", "0.7404742", "0.73965514", "0.7393406", "0.7382433", "0.7366243", "0.7348411", "0.733666", "0.7316211", "0.72861993", "0.72767645", "0.72490406", "0.7246694", "0.7222364", "0.7192517", "0.7178028", "0.7159887", "0.7144175", "0.71214944", "0.7111207", "0.71046597", "0.7103905", "0.7071495", "0.7070957", "0.7067333", "0.70448333", "0.7037231", "0.70364326", "0.70309055", "0.702508", "0.70111173", "0.70032275", "0.6990441", "0.69761586", "0.6918201", "0.69161534", "0.69105834", "0.6904859", "0.6897925", "0.6868517", "0.6862322", "0.68364865", "0.6831864", "0.68293804", "0.6815821", "0.68110704", "0.6800397", "0.67935246", "0.6789633", "0.67721516", "0.6771594", "0.67614347", "0.6731529", "0.672488", "0.67231435", "0.6718086", "0.6712395", "0.6701343", "0.66934216", "0.6689356", "0.6685166", "0.6683972", "0.6676261", "0.6668728", "0.66647416", "0.66419905", "0.66369706", "0.6618727", "0.6597959", "0.659045", "0.65776765", "0.6556781", "0.6547933", "0.6547449", "0.6542547", "0.6533471", "0.6529777", "0.6527794", "0.6524768", "0.65198404", "0.6504494", "0.64933616", "0.64933276", "0.6490891", "0.6489973", "0.6479811", "0.6468706", "0.64612377" ]
0.7373319
17
current method of printing tree
def printlewis(node) puts node.to_s + " =" if node.nodes? temp = Array.new node.nodes.each { |n| if n == nil puts ":" elsif n == node.parent puts n elsif !temp.include?(n) temp << n puts n else puts n end } if !temp.empty? temp.each { |n| puts "========" printlewis(n) } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_tree\n ''\n end", "def printTree()\n def pTree(node, i)\n puts node.toString i\n node.children.each do|child|\n pTree(child, i+1)\n end\n end\n pTree(@root, 0)\n end", "def print_tree(tree)\n return \"-\" if tree.nil?\n puts \"#{tree.value}: \"\n print \"Left: \"\n puts \"#{print_tree(tree.children[0])}\"\n print \"Right: \"\n puts \"#{print_tree(tree.children[1])}\"\nend", "def printout\n\t\t\n\t\tindex = 0\n\t\t\n\t\tdef small_loop (node, index)\n\t\t\t\n\t\t\tfor i in 0...index\n\t\t\t\tprint \" \"\n\t\t\tend\n\t\t\t\n\t\t\tputs node.name\n\t\t\tindex += 1\n\t\t\t\n\t\t\tif node.children.length > 0\n\t\t\t\tindex += 1\n\t\t\t\tnode.children.cycle(1) { |child| small_loop(child, index) }\n\t\t\tend\n\t\tend\n\t\t\n\t\tsmall_loop(@root, index)\n\tend", "def print_tree(tree)\n\t\t\tif tree.is_leaf? and tree.depth > 0\n\t\t\t\tprint_line((\"|\\t\"*(tree.depth-1))+\"+------\"+tree.name)\n\t\t\telse\n\t\t\t\tprint_line((\"|\\t\"*tree.depth)+tree.name)\n\t\t\tend\n\t\t\ttree.children.each_pair do |name,child|\n\t\t\t\t\tprint_tree(child)\n\t\t\tend\n\t\tend", "def print_tree\n if root.children\n puts \" - root : #{root.children.length} - \"\n root.children.each(&:print_node)\n puts ''\n end\n end", "def to_tree() = puts(TTY::Tree.new({ '.' => as_tree }).render)", "def print\n node = root\n \n print_node(node, \"> \")\n end", "def printTree(options = {})\n # Set defaults\n options[:name] ||= true\n options[:content] ||= false\n \n result = \"\"\n \n options[:output] = result \n # Traverse tree and modify result by tacking on child names.\n printTraversal(options)\n \n puts result\n end", "def test_print_tree\n setup_test_tree\n #puts\n #@root.print_tree\n end", "def print()\n current_node = @root_node\n while current_node != nil\n current_node.print()\n current_node = current_node.get_next()\n end\n end", "def print_tree(d)\n \n print_tree(d['l']) if d.key?('l')\n print \"#{d['v']},\" if d.key?('v')\n print_tree(d['r']) if d.key?('r')\n \nend", "def show_tree\n\tend", "def print(root)\n root_index = @tree.index(root)\n temp_tree = @tree[root_index..-1]\n temp_tree.each do |n|\n if n\n puts n.title + \": \" + n.rating.to_s\n end\n end\n end", "def cmd_tree\n print_tree(Editor, 0)\n end", "def printf\n output = []\n children = []\n output.push(\"#{@root.title}: #{@root.rating}\")\n if @root.left != nil\n children.push(@root.left)\n end\n if @root.right != nil\n children.push(@root.right)\n end\n children.each do |i|\n output.push(\"#{i.title}: #{i.rating}\")\n if i.left != nil\n children.push(i.left)\n end\n if i.right != nil\n children.push(i.right)\n end\n end\n puts output\n end", "def print_tree(out = $stdout)\n out.puts \"## Class: #{name}\"\n out.puts \" Visible Name: #{visible_name}\"\n out.puts \" Description : #{description}\"\n tables.each do |table|\n table.print_tree(out)\n end\n end", "def print(node = root)\n puts %( ) * node.level + \"#{node}\"\n node.children.each do |child|\n print(child)\n end\n true\n end", "def print_tree\n current = nil\n stack = Stack.new\n stack.push(@root)\n until stack.empty?\n current = stack.pop\n if current.parent.nil?\n puts current.tag\n else\n puts \"#{current.tag}\\t<=\\t#{current.parent.tag}\"\n end\n unless current.childs.size.zero?\n current.childs.reverse_each { |child| stack.push(child) }\n end\n end\n end", "def see_tree(tree)\n tree.each do |i|\n puts \"---------------\"\n puts \"Node: #{i.value}\"\n puts \"Parent: \" + i.find_parent[0].value.to_s if i.find_parent.count > 0\n puts \"Left Child: \" + i.find_left_child[0].value.to_s if i.find_left_child.count > 0\n puts \"Right Child: \" + i.find_right_child[0].value.to_s if i.find_right_child.count > 0\n end\nend", "def show_node(tree, node)\n print \"ID:#{node.id} Parent:#{node.parent} Keys:\"\n node.keys.each { |key| print \"[#{key}]\"}\n print \" Sub trees:\"\n node.sub_trees.each { |sub_tree| print \"-#{sub_tree}-\"}\n print \"\\n\"\n node.sub_trees.compact.each { |sub_tree| show_node(tree, tree.nodes[sub_tree])}\nend", "def print_tree(indent = 0, lines = [])\n lines << (\" \" * indent) + self.to_s\n @nodes.keys.sort.each do |reference|\n node = @nodes[reference]\n if node.is_a? APISpec::Namespace\n node.print_tree(indent + 1, lines)\n else\n lines << (\" \" * (indent + 1)) + \"#{reference} => #{node.to_s}\"\n end\n end\n lines.join(\"\\n\")\n end", "def printf(children=nil)\n text = \"\"\n if (self.root)\n queue = Queue.new\n queue.push(self.root)\n while (!queue.empty?)\n temp = queue.pop\n text << temp.title << \":\" << temp.rating.to_s\n if (temp.left)\n queue.push(temp.left)\n end\n if (temp.right)\n queue.push(temp.right)\n end\n text << \"\\n\"\n end\n puts text\n return\n end\n end", "def print_tree_perimeter(root)\n print \"print\"\nend", "def level_order_print(tree)\n unless tree\n return\n end\n\n nodes = [tree]\n current_line_count = 1\n next_line_count = 0\n\n while nodes.length != 0\n current_node = nodes.shift\n current_line_count -= 1\n print current_node.key.to_s + ' '\n if current_node.left_child\n nodes.push(current_node.left_child)\n next_line_count += 1\n end\n if current_node.right_child\n nodes.push(current_node.right_child)\n next_line_count += 1\n end\n if current_line_count == 0\n # finished printing current level\n puts ''\n current_line_count = next_line_count\n next_line_count = current_line_count\n end\n end\nend", "def display\n puts @root.to_s + \" \" + \"=\" * 10\n traverse(@root,0) {|n, l| puts \" \"*l + \"node: #{n}\"}\n self\n end", "def printTree(root = @root, indentation = \"\\n\")\r\n #print root the first time running mehtod, the rest will be printed as children\r\n puts \"#{indentation}#{root.value}\" if root == @root\r\n root.children.each do | child |\r\n puts \"#{indentation}\\t#{child.value}\\n\"\r\n #if there are children, again\r\n printTree(child, indentation + \"\\t\") if child.children.any?\r\n end\r\n end", "def printf()\n #node object array\n children = []\n\n #info array\n arr = []\n arr.push(\"#{@root.title}: #{@root.rating}\")\n if @root.left != nil\n children.push(@root.left)\n end\n if @root.right != nil\n children.push(@root.right)\n end\n\n # adds nodes to children array AND pushes data to arr\n children.each do |node|\n if node.left != nil\n children.push(node.left)\n end\n if node.right != nil\n children.push(node.right)\n end\n arr.push(\"#{node.title}: #{node.rating}\")\n end\n\n puts arr\n end", "def recursive_print(result=\"\", node=@head)\n\t\tif node.nil?\n\t\t\treturn result\n\t\tend \n\t\tresult += node.data\n\t\tif node.next \n\t\t\tresult += \" > \"\n\t\tend \n\t\trecursive_print(result, node.next)\n\tend", "def display_tree() \n list = []\n yield @tree.value\n left_child = @tree.left_child\n right_child = @tree.right_child\n\n list << left_child if left_child != nil\n list << right_child if right_child != nil\n\n loop do\n break if list.empty?\n node = list.shift\n yield node.value\n list << node.left_child if node.left_child != nil\n list << node.right_child if node.right_child != nil\n end\n end", "def walkthrough\n curNode = @head\n while curNode != nil\n curNode.data.print()\n curNode = curNode.next\n end\n end", "def printf(root=nil)# def printf(children=nil)\n if root == nil\n root = @root\n end\n node_array = []\n node_array.push(root)\n printf_breadth(node_array)\n end", "def printf(children=nil)\n results = Queue.new\n results.enq(@root)\n\n while !results.empty?\n node = results.deq\n \n puts \"#{node.title}: #{node.rating}\" if node.title \n\n results.enq(node.left) if node.left\n results.enq(node.right) if node.right\n end\n end", "def printf(list=[@root], output='')\n # remove front list item & add it to the output\n first = list.shift()\n print_string = first.title + ': ' + first.rating.to_s + \"\\n\"\n output << print_string\n # add its children to the back of the list\n if first.left\n list << first.left\n end\n if first.right\n list << first.right\n end\n # repeat until all nodes have been visited, then print output\n if list.empty?\n puts output\n return\n else\n printf(list, output)\n end\n end", "def print_node\n puts \"Value of node #{node_value}. Childs of node: #{node_childs} \"\n end", "def show_tree\n htmltree = \"\"\n self.each { |node| \n htmltree += \"<li><a href='#{normalize(node.name)}'>\"\n htmltree += '&nbsp; ' * node.node_depth * 3\n htmltree += \"#{node.name}</a></li>\\n\"\n }\n htmltree\n end", "def printf(children=nil)\n toPrint = \"\"\n nextLine = []\n toPrint += \"#{@root.title}: #{@root.rating}\\n\"\n nextLine << @root.left if @root.left\n nextLine << @root.right if @root.right\n while nextLine.length > 0\n placeholder = []\n nextLine.each do |x|\n title = x.title\n rating = x.rating\n toPrint += \"#{title}: #{rating}\\n\"\n placeholder << x.left if x.left\n placeholder << x.right if x.right\n end\n nextLine = placeholder\n end\n print toPrint\n end", "def print\n print_node(@head)\n end", "def printf(children=nil)\n line = [@root]\n\n line.each do |i|\n puts \"#{i.title}: #{i.rating}\"\n if i.left\n line << i.left\n end\n if i.right\n line << i.right\n end\n end\n end", "def render\n\t\t\ttree.flatten.map(&:to_s).join\n\t\tend", "def print()\n puts @node_data.to_s\n end", "def to_text\n self_and_descendants.map do |node|\n if block_given?\n inspect = yield(node)\n else\n inspect = node.class.inspect\n end\n \"#{'*'*(node.level+1)} #{inspect} (#{node.parent_id.inspect}, #{node.left}, #{node.right})\"\n end.join(\"\\n\")\n end", "def printf\n queue = [@root]\n str = \"\"\n\n while queue != []\n current = queue.shift\n str << \"#{current.title}: #{current.rating}\\n\"\n queue.push(current.left) if current.left\n queue.push(current.right) if current.right\n end\n\n puts str\n end", "def print_tree(array , item, level)\n items = array[item]\n unless items == nil\n indent = level > 0 ? sprintf(\"%#{level * 2}s\", \" \") : \"\"\n items.each do |e|\n puts \"#{indent}-#{e[:title]}\"\n print_tree(e, level + 1)\n end\n end\nend", "def printf(children=nil)\n if @root != nil\n queue = Queue.new\n queue.enq(@root)\n result = nil\n while !queue.empty?\n node = queue.deq\n puts(node.to_s)\n queue.enq(node.left) if node.left\n queue.enq(node.right) if node.right\n end\n end\n end", "def printf(children=nil)\n queue = [@root]\n result = \"\"\n\n until queue.empty?\n temp_root = queue.shift\n\n unless temp_root.left == nil\n queue << temp_root.left\n end\n unless temp_root.right == nil\n queue << temp_root.right\n end\n\n result << \"#{temp_root.title}: #{temp_root.rating}\\n\"\n end\n\n puts result\n end", "def print_tree(id)\n puts \"--------------------- Tree Record: #{NewYorkTrees::Tree.all[id].name} ---------------------\"\n puts \"\"\n puts \"Common Name:\"\n puts \"#{NewYorkTrees::Tree.all[id].name.ljust(25)}\"\n puts \"\"\n puts \"Scientific Name:\"\n puts \"#{NewYorkTrees::Tree.all[id].scientific_name.ljust(25)}\"\n puts \"\"\n puts \"Bark:\"\n puts \"#{NewYorkTrees::Tree.all[id].bark.ljust(25)}\"\n puts \"\"\n puts \"Twigs:\"\n puts \"#{NewYorkTrees::Tree.all[id].twigs.ljust(25)}\"\n puts \"\"\n puts \"Winter Buds:\"\n puts \"#{NewYorkTrees::Tree.all[id].winter_buds.ljust(25)}\"\n puts \"\"\n puts \"Leaves:\"\n puts \"#{NewYorkTrees::Tree.all[id].leaves.ljust(25)}\"\n puts \"\"\n puts \"Fruit:\"\n puts \"#{NewYorkTrees::Tree.all[id].fruit.ljust(25)}\"\n puts \"\"\n puts \"Distinguishing Features:\"\n puts \"#{NewYorkTrees::Tree.all[id].distinguishing_features.ljust(25)}\"\n puts \"\"\n puts \"---------------------Description---------------------\"\n\n puts \"#{NewYorkTrees::Tree.all[id].description}\"\n puts \"\"\n end", "def print_r prefix=\"\", daughters=false\n\t\tputs \"#{prefix}#{@e}\"\n\t\tif @children\n\t\t\t(daughters ? @daughters : @children).each do |child|\n\t\t\t\tchild.print_r \"#{prefix}\\t\", daughters\n\t\t\tend\n\t\tend\n\tend", "def show()\n printed = \"IPv4 Tree\\n---------\\n\"\n list4 = dump_children(@v4_root)\n list6 = dump_children(@v6_root)\n\n list4.each do |entry|\n cidr = entry[:CIDR]\n depth = entry[:Depth]\n\n if (depth == 0)\n indent = \"\"\n else\n indent = \" \" * (depth*3)\n end\n\n printed << \"#{indent}#{cidr.desc}\\n\"\n end\n\n printed << \"\\n\\nIPv6 Tree\\n---------\\n\" if (list6.length != 0)\n\n list6.each do |entry|\n cidr = entry[:CIDR]\n depth = entry[:Depth]\n\n if (depth == 0)\n indent = \"\"\n else\n indent = \" \" * (depth*3)\n end\n\n printed << \"#{indent}#{cidr.desc(:Short => true)}\\n\"\n end\n\n return(printed)\n end", "def print_tree(out = $stdout)\n out.puts \"Resource: #{id} (Key Field: #{key_field})\"\n rets_classes.each do |rets_class|\n rets_class.print_tree(out)\n end\n end", "def output_tree(element, indent = '')\n\t\t\t\tputs \"#{indent}#{element.class}: #{element.text_value}\"\n\t\t\t\t(element.elements || []).each do |e|\n\t\t\t\t\toutput_tree(e, \"#{indent} \")\n\t\t\t\tend\n\t\t\tend", "def printf(children=nil)\n h = height(@root) + 1\n root = @root\n h.times do |i|\n self.print_level(root, i)\n end\n end", "def prints_as_self?(node); end", "def printf(children=nil)\n \n queue = [@root]\n output = \"\"\n \n until queue.empty?\n traversal = queue.shift\n queue << traversal.left if traversal.left\n queue << traversal.right if traversal.right\n \n output += \"#{traversal.title}: #{traversal.rating}\\n\"\n end\n \n puts output\n end", "def printtree(n, t)\n if t.question==nil\n n.times {print \" \"}\n puts t.name\n else\n puts t.question\n printtree n+1, t.yes\n printtree n+1, t.no\n end\n end", "def print_tree(level = 0)\n if is_root?\n print \"\\n*\"\n else\n print \"|\" unless parent.is_root?\n print(' ' * (level - 1) * 4)\n print(is_root? ? \"+\" : \"|\")\n print \"---\"\n print(has_children? ? \"+\" : \">\")\n end\n\n if content\n content_hash = content.split(\"[\").first\n else\n content_hash = nil\n end\n\n puts \" #{content}\" + \" <Type: \" + (@node_type || \"no_type\") + \">\"\n\n children { |child| child.print_tree(level + 1)}\n end", "def print_tree(n, i = 0)\n i.times { print \" \" }\n puts \"+-#{n}\"\n $classtree[n].sort.each { |c| print_tree(c, i+2) }\nend", "def show_tree\n\t\t@root_node.show\n\tend", "def print_paths\n path, counter = [], 0\n puts '************************ Tree Paths ***********************************'\n puts\n print_tree_paths(self.root, path, counter)\n puts\n puts '***********************************************************************'\n end", "def printf(children=nil)\n children = [@root] if children.nil?\n grand_children = []\n children.each do |node|\n puts \"#{node.title}: #{node.rating}\\n\"\n grand_children.push(node.left) if node.left\n grand_children.push(node.right) if node.right\n end\n printf(grand_children) unless grand_children.empty?\n end", "def printf(children=nil)\n queue = [@root]\n\n queue.each do |current|\n puts \"#{current.value}\"\n if current.left && current.right\n queue << current.left << current.right\n elsif current.left\n queue << current.left\n elsif current.right\n queue << current.right\n end\n end\n end", "def print_tree(out = $stdout)\n out.puts \" #{long_value} -> #{value}\"\n end", "def printf(children=nil)\n fname = \"comparison.txt\"\n comparison_file = File.open(fname, \"w\")\n \n theight = tree_height(@root)\n for i in 1..theight do\n print_given_level(@root, i)\n end\n \n comparison_file.close\n\n end", "def printf(children=nil)\n if children == nil\n children = [@root]\n end\n arr = []\n children.each do |ele|\n puts \"#{ele.title}: #{ele.rating}\"\n arr << ele.left if ele.left != nil\n arr << ele.right if ele.right != nil\n end\n if arr.size == 0\n return nil\n else\n printf(arr)\n end\n end", "def printf(children=nil)\n\n new_children = []\n \n if children == nil\n children = [@root.left, @root.right]\n puts @root.title.to_s + \": \" + @root.rating.to_s\n end\n\n children.each do |ch|\n if ch != nil\n puts ch.title.to_s + \": \" + ch.rating.to_s\n new_children.push(ch.left) if ch.left\n new_children.push(ch.right) if ch.right\n end\n end\n\n if new_children != []\n printf(new_children)\n end\n end", "def printf(children=nil)\n tree_output = [@root]\n tree_output.each do |node|\n tree_output.push(node.left) if !node.left.nil?\n tree_output.push(node.right) if !node.right.nil?\n end\n\n tree_output.each do |node|\n puts \"#{node.title}: #{node.rating}\"\n end\n\n end", "def print_item(level:, current_item:)\n # Print the current item\n tabs = \"\\t\" * level\n puts tabs + '+ ' + current_item[:name]\n\n # Print the current item's children\n children = $children_of[current_item[:id]]\n if children && children.length > 0\n children.each do |child|\n print_item(\n level: level + 1, \n current_item: child\n )\n end\n end\nend", "def print(depth)\n spaces = \" \".freeze * depth\n \"#{left_stats} #{spaces} └── #{@node.name}\"\n end", "def defaultRepresent(theTree)\n return theTree.sym.name unless isNT?(theTree.sym) \n theLine = ''\n spacer = ''\n theTree.children.each do |c|\n theLine << spacer << c.represent(self)\n spacer = ' '\n end\n return theLine\n end", "def printf(children=nil)\n queue = Queue.new\n queue.enq(@root)\n while !queue.empty?\n value = queue.deq\n puts \"#{value.title}: #{value.rating}\\n\"\n queue.enq(value.left) if value.left\n queue.enq(value.right) if value.right\n end\n end", "def tree_print(tree, folder)\n str = \"\";\n tree.each do |key, value|\n if not value.is_a?(Hash)\n # page\n if value.name != \"Home\"\n str += \"<li><a href=\\\"/#{@wiki.base_path}#{value.url_path}\\\">#{value.name}</a></li>\"\n end\n else\n # folder\n subfolder = folder + \"/\" + key\n str += \"<li><a href=\\\"#{@wiki.base_path}#{subfolder}/\\\">#{key}</a>\"\n str += \"<ul>\"\n str += tree_print(value, subfolder)\n str += \"</ul>\"\n str += \"</li>\"\n end\n end\n return str\n end", "def disp_node(node, depth)\n# mon_string = ''\n# depth.times {mon_string+=' '}\n# mon_string += \"- #{node.name}\"\n# `echo \"#{mon_string}\" >> toto.txt`\n\n # depth.times {print ' '}\n # puts \"- #{node.name}\"\n self.graph.each_adjacent node do |adj_node|\n disp_node adj_node, depth+1\n end\n end", "def printf(children=nil)\n queue = [@root]\n result = []\n while queue.length > 0\n new_root = queue.shift\n if new_root.left != nil\n queue.push(new_root.left)\n end\n if new_root.right != nil\n queue.push(new_root.right)\n end\n result.push(\"#{new_root.title}: #{new_root.rating}\")\n end\n result.each {|x| puts x}\n end", "def printf(children=nil)\n list = [@root]\n while !list.empty?\n if list[0].left\n list.push(list[0].left)\n end\n if list[0].right\n list.push(list[0].right)\n end\n puts \"#{list[0].title}: #{list[0].rating}\\n\"\n list.shift\n end\n end", "def show_binary_tree\n text = tree_levels_text_array\n puts \"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\"\n puts \"\\nBinary Tree Display:\\n \"\n text.each { |row| puts \"\\n\" + row }\n puts \"\\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\"\n end", "def printnodes(node, level)\r\n\theader(level)\r\n\tputs node\r\n\tif node.nodes?\r\n\t\ttemp = Array.new\r\n\t\tnode.nodes.each { |n|\r\n\t\t\tif n == nil\r\n\t\t\t\theader(level + 1)\r\n\t\t\t\tputs \":\"\r\n\t\t\telsif n == node.parent\r\n\t\t\t\theader(level + 1)\r\n\t\t\t\tputs node\r\n\t\t\telsif !temp.include?(n)\r\n\t\t\t\ttemp << n\r\n\t\t\telse\r\n\t\t\t\theader(level + 1)\r\n\t\t\t\tputs node\r\n\t\t\tend\r\n\t\t}\r\n\t\tif !temp.empty?\r\n\t\t\ttemp.each { |n|\r\n\t\t\t\tprintnodes(n, level + 1)\r\n\t\t\t}\r\n\t\tend\r\n\tend\r\nend", "def printf(children=nil)\n if @root.nil?\n return nil\n else\n for i in @root\n puts i\n end\n end\n end", "def printf\n queue = Queue.new\n queue.enq(@root)\n until queue.empty?\n value = queue.deq\n puts value unless value.title.nil?\n queue.enq(value.left) if value.left\n queue.enq(value.right) if value.right\n end\n end", "def dump(depth = 0)\n print ' ' * depth * 2\n print \"// #{self.to_s}\\n\"\n end", "def pretty_print(node = @root, prefix = '', is_left = true)\n pretty_print(node.right_child, \"#{prefix}#{is_left ? '│ ' : ' '}\", false) if node.right_child\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.data}\"\n pretty_print(node.left_child, \"#{prefix}#{is_left ? ' ' : '│ '}\", true) if node.left_child\n end", "def pretty_print(node = @root, prefix = '', is_left = true)\n pretty_print(node.right_child, \"#{prefix}#{is_left ? '│ ' : ' '}\", false) if node.right_child\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.data}\"\n pretty_print(node.left_child, \"#{prefix}#{is_left ? ' ' : '│ '}\", true) if node.left_child\n end", "def _display_tree(max_length=20, tabs='')\n\t\tif(@type != '')\n\t\t\tprint(tabs + \"[\" + @type + ((@param != '')? '(' + @param.to_s + ')': '') + \"]\\n\")\n\t\telse\n\t\t\tprint(tabs + \"[TEMPLATE:\" + @template.template_file + \"]\\n\")\n\t\tend\n\n\t\tfor content in @contents\n\t\t\tif(content.is_a?(SifterElement))\n\t\t\t\tcontent._display_tree(max_length, tabs + \"\\t\")\n\t\t\telsif(content.is_a?(SifterTemplate))\n\t\t\t\tcontent._display_tree(max_length, tabs + \"\\t\")\n\t\t\telse\n\t\t\t\tcontent.gsub!(/[\\r\\n]/, ' ')\n\t\t\t\tprint(tabs + \"\\t[TEXT:\" + content[0, max_length] + \"]\\n\")\n\t\t\tend\n\t\tend\n\tend", "def print\n if self.length == 0\n puts \"empty\"\n else\n self.each { |node| puts node.data }\n end\n end", "def print\n output = \"\"\n current_node = self.head\n\n until current_node.nil?\n output += current_node.data + \"\\n\"\n current_node = current_node.next\n end\n\n puts output\n end", "def print(children=nil)\n queue = Queue.new\n #Add the root to the queue\n queue.enq(@root)\n #loop while queue isn't empty\n while !queue.empty?\n #take and print value in queue\n value = queue.deq\n puts \"#{value.title}: #{value.rating}\" if !value.title.nil?\n #search left then right for new queue item\n queue.enq(value.left) if value.left\n queue.enq(value.right) if value.right\n end\n end", "def recursive_print(array)\n\nend", "def print_depth(item)\n return if item.hidden?\n print_item item, 0\n list_recur_print item, 2\n end", "def draw_tree\n result = ''\n max_cols = @n + 1\n calc_tree.each do |row|\n print = ' ' * ((max_cols - row.length) / 2) * max_cols\n print << row.join(' ')\n result << \"#{print}\\n\"\n end\n puts result\n end", "def pretty_print(node = @root, prefix = '', is_left = true)\n pretty_print(node.right, \"#{prefix}#{is_left ? '│ ' : ' '}\", false) if node.right\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.data}\"\n pretty_print(node.left, \"#{prefix}#{is_left ? ' ' : '│ '}\", true) if node.left\n end", "def print(node = @root, prefix = '', is_left = true)\n if node.nil?\n return\n end\n\n print(node.right_node, \"#{prefix}#{is_left ? '│ ' : ' '}\", false) if node.right_node\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.value}\"\n print(node.left_node, \"#{prefix}#{is_left ? ' ' : '│ '}\", true) if node.left_node\n end", "def pretty_print(node = @root, prefix = '', is_left = true)\n unless node.right.nil?\n pretty_print(node.right, \"#{prefix}#{is_left ? '│ ' : ' '}\", false)\n end\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.data}\"\n unless node.left.nil?\n pretty_print(node.left, \"#{prefix}#{is_left ? ' ' : '│ '}\", true)\n end\n end", "def print_debug\n\t\tprint_divider\n\t\tputs \"Root Node: \\n\" + root.to_s\n\t\tprint_divider\n\t\t\n\t\tputs \"Current Node: \\n\" + @current_node.to_s\n\t\tprint_divider\n\t\t\n\t\tputs \"Attributes: \\n\" + attributes.to_s\n\t\tprint_divider\n\t\t\n\t\tputs \"Children: \\n\" + children.to_xml\n\t\tprint_divider\n\tend", "def pretty_print(node = root, prefix = '', is_left = true)\n pretty_print(node.right, \"#{prefix}#{is_left ? '│ ' : ' '}\", false) if node.right\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.data}\"\n pretty_print(node.left, \"#{prefix}#{is_left ? ' ' : '│ '}\", true) if node.left\n end", "def printf(children=nil)\n if children.nil?\n children = [@root]\n end\n next_row = []\n children.each do |child|\n puts \"#{child.title}: #{child.rating}\"\n next_row.push(child.left) if !child.left.nil?\n next_row.push(child.right) if !child.right.nil?\n end\n if next_row.size == 0\n nil\n else\n printf(next_row)\n end\n end", "def pretty_print(node = @root, prefix = '', is_left = true)\n pretty_print(node.right_child, \"#{prefix}#{is_left ? '│ ' : ' '}\", false) if node.right_child\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.value}\"\n pretty_print(node.left_child, \"#{prefix}#{is_left ? ' ' : '│ '}\", true) if node.left_child\n end", "def print_result ptree, path_prefix\n puts dump(ptree, path_prefix)\n end", "def pretty_print(node = @root, prefix = '', is_left = true)\n pretty_print(node.right_node, \"#{prefix}#{is_left ? '│ ' : ' '}\", false) if node.right_node\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.data}\"\n pretty_print(node.left_node, \"#{prefix}#{is_left ? ' ' : '│ '}\", true) if node.left_node\n end", "def printf(children=nil)\n list = \"\"\n queue = MyQueue.new()\n queue.enqueue(@root)\n while queue.empty? != true\n list << \"#{queue.head.title}: #{queue.head.rating}\\n\"\n queue.enqueue(queue.head&.left) if queue.head.left\n queue.enqueue(queue.head&.right) if queue.head.right\n queue.dequeue\n end\n p list\n end", "def pretty_print(node = @root_node, prefix = '', is_left = true)\n pretty_print(node.right_node, \"#{prefix}#{is_left ? '│ ' : ' '}\", false) if node.right_node\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.data}\"\n pretty_print(node.left_node, \"#{prefix}#{is_left ? ' ' : '│ '}\", true) if node.left_node\n end", "def print_tree(out = $stdout)\n out.puts \"### LookupTable: #{name}\"\n out.puts \" Resource: #{resource_id}\"\n out.puts \" Required: #{table_fragment['Required']}\"\n out.puts \" Searchable: #{ table_fragment[\"Searchable\"] }\"\n out.puts \" Units: #{ table_fragment[\"Units\"] }\"\n out.puts \" ShortName: #{ table_fragment[\"ShortName\"] }\"\n out.puts \" LongName: #{ long_name }\"\n out.puts \" StandardName: #{ table_fragment[\"StandardName\"] }\"\n out.puts \"#### Types:\"\n\n lookup_types.each do |lookup_type|\n lookup_type.print_tree(out)\n end\n end" ]
[ "0.83595693", "0.79416937", "0.77512246", "0.75878114", "0.75693196", "0.7517739", "0.73786217", "0.735212", "0.73361164", "0.72806823", "0.7255799", "0.7239917", "0.71538436", "0.7136661", "0.7135993", "0.7069136", "0.70629543", "0.7049791", "0.70478374", "0.7041523", "0.70190156", "0.7002518", "0.6999662", "0.6963662", "0.6956271", "0.6954141", "0.6936263", "0.6891133", "0.68667364", "0.6863117", "0.68319535", "0.68268657", "0.68125683", "0.68065125", "0.6803735", "0.6787052", "0.67816484", "0.67781276", "0.67707473", "0.6756682", "0.6752678", "0.6751637", "0.6750824", "0.6746074", "0.6740738", "0.67366546", "0.67281336", "0.67240185", "0.67231613", "0.6722479", "0.66983604", "0.668988", "0.66874766", "0.6686483", "0.667506", "0.6671135", "0.6664281", "0.66641545", "0.66586834", "0.6647879", "0.66441065", "0.66421634", "0.66389114", "0.662988", "0.6627511", "0.6616566", "0.6615959", "0.66095924", "0.66056037", "0.6598607", "0.6597718", "0.65971285", "0.6595141", "0.6581459", "0.6576735", "0.65762025", "0.6573584", "0.6570971", "0.6558307", "0.65535426", "0.65535426", "0.6549378", "0.65469307", "0.65306234", "0.6523193", "0.65227515", "0.6521472", "0.65138024", "0.65071565", "0.65010107", "0.64940554", "0.6491891", "0.6474264", "0.6467895", "0.64602494", "0.64600635", "0.6458738", "0.6454482", "0.6441612", "0.6435552" ]
0.66395026
62
old method of print tree (uses header() )
def printnodes(node, level) header(level) puts node if node.nodes? temp = Array.new node.nodes.each { |n| if n == nil header(level + 1) puts ":" elsif n == node.parent header(level + 1) puts node elsif !temp.include?(n) temp << n else header(level + 1) puts node end } if !temp.empty? temp.each { |n| printnodes(n, level + 1) } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_tree\n ''\n end", "def print_tree(out = $stdout)\n out.puts \"## Class: #{name}\"\n out.puts \" Visible Name: #{visible_name}\"\n out.puts \" Description : #{description}\"\n tables.each do |table|\n table.print_tree(out)\n end\n end", "def printout\n\t\t\n\t\tindex = 0\n\t\t\n\t\tdef small_loop (node, index)\n\t\t\t\n\t\t\tfor i in 0...index\n\t\t\t\tprint \" \"\n\t\t\tend\n\t\t\t\n\t\t\tputs node.name\n\t\t\tindex += 1\n\t\t\t\n\t\t\tif node.children.length > 0\n\t\t\t\tindex += 1\n\t\t\t\tnode.children.cycle(1) { |child| small_loop(child, index) }\n\t\t\tend\n\t\tend\n\t\t\n\t\tsmall_loop(@root, index)\n\tend", "def print_tree(tree)\n\t\t\tif tree.is_leaf? and tree.depth > 0\n\t\t\t\tprint_line((\"|\\t\"*(tree.depth-1))+\"+------\"+tree.name)\n\t\t\telse\n\t\t\t\tprint_line((\"|\\t\"*tree.depth)+tree.name)\n\t\t\tend\n\t\t\ttree.children.each_pair do |name,child|\n\t\t\t\t\tprint_tree(child)\n\t\t\tend\n\t\tend", "def print\n node = root\n \n print_node(node, \"> \")\n end", "def printTree()\n def pTree(node, i)\n puts node.toString i\n node.children.each do|child|\n pTree(child, i+1)\n end\n end\n pTree(@root, 0)\n end", "def printTree(options = {})\n # Set defaults\n options[:name] ||= true\n options[:content] ||= false\n \n result = \"\"\n \n options[:output] = result \n # Traverse tree and modify result by tacking on child names.\n printTraversal(options)\n \n puts result\n end", "def to_tree() = puts(TTY::Tree.new({ '.' => as_tree }).render)", "def print\n print_node(@head)\n end", "def print_tree(tree)\n return \"-\" if tree.nil?\n puts \"#{tree.value}: \"\n print \"Left: \"\n puts \"#{print_tree(tree.children[0])}\"\n print \"Right: \"\n puts \"#{print_tree(tree.children[1])}\"\nend", "def print_tree\n if root.children\n puts \" - root : #{root.children.length} - \"\n root.children.each(&:print_node)\n puts ''\n end\n end", "def print_tree(d)\n \n print_tree(d['l']) if d.key?('l')\n print \"#{d['v']},\" if d.key?('v')\n print_tree(d['r']) if d.key?('r')\n \nend", "def print_tree(indent = 0, lines = [])\n lines << (\" \" * indent) + self.to_s\n @nodes.keys.sort.each do |reference|\n node = @nodes[reference]\n if node.is_a? APISpec::Namespace\n node.print_tree(indent + 1, lines)\n else\n lines << (\" \" * (indent + 1)) + \"#{reference} => #{node.to_s}\"\n end\n end\n lines.join(\"\\n\")\n end", "def print_tree(id)\n puts \"--------------------- Tree Record: #{NewYorkTrees::Tree.all[id].name} ---------------------\"\n puts \"\"\n puts \"Common Name:\"\n puts \"#{NewYorkTrees::Tree.all[id].name.ljust(25)}\"\n puts \"\"\n puts \"Scientific Name:\"\n puts \"#{NewYorkTrees::Tree.all[id].scientific_name.ljust(25)}\"\n puts \"\"\n puts \"Bark:\"\n puts \"#{NewYorkTrees::Tree.all[id].bark.ljust(25)}\"\n puts \"\"\n puts \"Twigs:\"\n puts \"#{NewYorkTrees::Tree.all[id].twigs.ljust(25)}\"\n puts \"\"\n puts \"Winter Buds:\"\n puts \"#{NewYorkTrees::Tree.all[id].winter_buds.ljust(25)}\"\n puts \"\"\n puts \"Leaves:\"\n puts \"#{NewYorkTrees::Tree.all[id].leaves.ljust(25)}\"\n puts \"\"\n puts \"Fruit:\"\n puts \"#{NewYorkTrees::Tree.all[id].fruit.ljust(25)}\"\n puts \"\"\n puts \"Distinguishing Features:\"\n puts \"#{NewYorkTrees::Tree.all[id].distinguishing_features.ljust(25)}\"\n puts \"\"\n puts \"---------------------Description---------------------\"\n\n puts \"#{NewYorkTrees::Tree.all[id].description}\"\n puts \"\"\n end", "def test_print_tree\n setup_test_tree\n #puts\n #@root.print_tree\n end", "def print_tree(array , item, level)\n items = array[item]\n unless items == nil\n indent = level > 0 ? sprintf(\"%#{level * 2}s\", \" \") : \"\"\n items.each do |e|\n puts \"#{indent}-#{e[:title]}\"\n print_tree(e, level + 1)\n end\n end\nend", "def cmd_tree\n print_tree(Editor, 0)\n end", "def _display_tree(max_length=20, tabs='')\n\t\tif(@type != '')\n\t\t\tprint(tabs + \"[\" + @type + ((@param != '')? '(' + @param.to_s + ')': '') + \"]\\n\")\n\t\telse\n\t\t\tprint(tabs + \"[TEMPLATE:\" + @template.template_file + \"]\\n\")\n\t\tend\n\n\t\tfor content in @contents\n\t\t\tif(content.is_a?(SifterElement))\n\t\t\t\tcontent._display_tree(max_length, tabs + \"\\t\")\n\t\t\telsif(content.is_a?(SifterTemplate))\n\t\t\t\tcontent._display_tree(max_length, tabs + \"\\t\")\n\t\t\telse\n\t\t\t\tcontent.gsub!(/[\\r\\n]/, ' ')\n\t\t\t\tprint(tabs + \"\\t[TEXT:\" + content[0, max_length] + \"]\\n\")\n\t\t\tend\n\t\tend\n\tend", "def show_binary_tree\n text = tree_levels_text_array\n puts \"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\"\n puts \"\\nBinary Tree Display:\\n \"\n text.each { |row| puts \"\\n\" + row }\n puts \"\\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\"\n end", "def print_tree(out = $stdout)\n out.puts \"### LookupTable: #{name}\"\n out.puts \" Resource: #{resource_id}\"\n out.puts \" Required: #{table_fragment['Required']}\"\n out.puts \" Searchable: #{ table_fragment[\"Searchable\"] }\"\n out.puts \" Units: #{ table_fragment[\"Units\"] }\"\n out.puts \" ShortName: #{ table_fragment[\"ShortName\"] }\"\n out.puts \" LongName: #{ long_name }\"\n out.puts \" StandardName: #{ table_fragment[\"StandardName\"] }\"\n out.puts \"#### Types:\"\n\n lookup_types.each do |lookup_type|\n lookup_type.print_tree(out)\n end\n end", "def print_tree(level = 0)\n if is_root?\n print \"\\n*\"\n else\n print \"|\" unless parent.is_root?\n print(' ' * (level - 1) * 4)\n print(is_root? ? \"+\" : \"|\")\n print \"---\"\n print(has_children? ? \"+\" : \">\")\n end\n\n if content\n content_hash = content.split(\"[\").first\n else\n content_hash = nil\n end\n\n puts \" #{content}\" + \" <Type: \" + (@node_type || \"no_type\") + \">\"\n\n children { |child| child.print_tree(level + 1)}\n end", "def show_tree\n\tend", "def show_node(tree, node)\n print \"ID:#{node.id} Parent:#{node.parent} Keys:\"\n node.keys.each { |key| print \"[#{key}]\"}\n print \" Sub trees:\"\n node.sub_trees.each { |sub_tree| print \"-#{sub_tree}-\"}\n print \"\\n\"\n node.sub_trees.compact.each { |sub_tree| show_node(tree, tree.nodes[sub_tree])}\nend", "def level_order_print(tree)\n unless tree\n return\n end\n\n nodes = [tree]\n current_line_count = 1\n next_line_count = 0\n\n while nodes.length != 0\n current_node = nodes.shift\n current_line_count -= 1\n print current_node.key.to_s + ' '\n if current_node.left_child\n nodes.push(current_node.left_child)\n next_line_count += 1\n end\n if current_node.right_child\n nodes.push(current_node.right_child)\n next_line_count += 1\n end\n if current_line_count == 0\n # finished printing current level\n puts ''\n current_line_count = next_line_count\n next_line_count = current_line_count\n end\n end\nend", "def show_tree\n htmltree = \"\"\n self.each { |node| \n htmltree += \"<li><a href='#{normalize(node.name)}'>\"\n htmltree += '&nbsp; ' * node.node_depth * 3\n htmltree += \"#{node.name}</a></li>\\n\"\n }\n htmltree\n end", "def show()\n printed = \"IPv4 Tree\\n---------\\n\"\n list4 = dump_children(@v4_root)\n list6 = dump_children(@v6_root)\n\n list4.each do |entry|\n cidr = entry[:CIDR]\n depth = entry[:Depth]\n\n if (depth == 0)\n indent = \"\"\n else\n indent = \" \" * (depth*3)\n end\n\n printed << \"#{indent}#{cidr.desc}\\n\"\n end\n\n printed << \"\\n\\nIPv6 Tree\\n---------\\n\" if (list6.length != 0)\n\n list6.each do |entry|\n cidr = entry[:CIDR]\n depth = entry[:Depth]\n\n if (depth == 0)\n indent = \"\"\n else\n indent = \" \" * (depth*3)\n end\n\n printed << \"#{indent}#{cidr.desc(:Short => true)}\\n\"\n end\n\n return(printed)\n end", "def print(root)\n root_index = @tree.index(root)\n temp_tree = @tree[root_index..-1]\n temp_tree.each do |n|\n if n\n puts n.title + \": \" + n.rating.to_s\n end\n end\n end", "def print_r prefix=\"\", daughters=false\n\t\tputs \"#{prefix}#{@e}\"\n\t\tif @children\n\t\t\t(daughters ? @daughters : @children).each do |child|\n\t\t\t\tchild.print_r \"#{prefix}\\t\", daughters\n\t\t\tend\n\t\tend\n\tend", "def printf(children=nil)\n line = [@root]\n\n line.each do |i|\n puts \"#{i.title}: #{i.rating}\"\n if i.left\n line << i.left\n end\n if i.right\n line << i.right\n end\n end\n end", "def printf\n output = []\n children = []\n output.push(\"#{@root.title}: #{@root.rating}\")\n if @root.left != nil\n children.push(@root.left)\n end\n if @root.right != nil\n children.push(@root.right)\n end\n children.each do |i|\n output.push(\"#{i.title}: #{i.rating}\")\n if i.left != nil\n children.push(i.left)\n end\n if i.right != nil\n children.push(i.right)\n end\n end\n puts output\n end", "def print_tree(stream, indent=0)\n\t\t\tstream.puts summary(\"\\t\"*indent)\n\t\t\t@children.sort_by { |child_status|\n\t\t\t\tchild_status.get_rss_total\n\t\t\t}.each { |child_status|\n\t\t\t\t# recursively print trees for child statuses\n\t\t\t\tchild_status.print_tree(stream, indent+1)\n\t\t\t}\n\t\tend", "def printf(children=nil)\n fname = \"comparison.txt\"\n comparison_file = File.open(fname, \"w\")\n \n theight = tree_height(@root)\n for i in 1..theight do\n print_given_level(@root, i)\n end\n \n comparison_file.close\n\n end", "def print(node = root)\n puts %( ) * node.level + \"#{node}\"\n node.children.each do |child|\n print(child)\n end\n true\n end", "def tree_print(tree, folder)\n str = \"\";\n tree.each do |key, value|\n if not value.is_a?(Hash)\n # page\n if value.name != \"Home\"\n str += \"<li><a href=\\\"/#{@wiki.base_path}#{value.url_path}\\\">#{value.name}</a></li>\"\n end\n else\n # folder\n subfolder = folder + \"/\" + key\n str += \"<li><a href=\\\"#{@wiki.base_path}#{subfolder}/\\\">#{key}</a>\"\n str += \"<ul>\"\n str += tree_print(value, subfolder)\n str += \"</ul>\"\n str += \"</li>\"\n end\n end\n return str\n end", "def printf(children=nil)\n h = height(@root) + 1\n root = @root\n h.times do |i|\n self.print_level(root, i)\n end\n end", "def PrintOutlineTree (item)\n\twhile item.IsValid() do\n\t\tPrintIndent(item)\n\t\tif item.IsOpen()\n\t\t\tprint( \"- \" + item.GetTitle() + \" ACTION -> \")\n\t\telse\n\t\t\tprint(\"+ \" + item.GetTitle() + \" ACTION -> \")\n\t\tend\n\t\n\t\t# Print Action\n\t\taction = item.GetAction()\n\t\tif action.IsValid()\n\t\t\tif action.GetType() == Action::E_GoTo\n\t\t\t\tdest = action.GetDest()\n\t\t\t\tif dest.IsValid()\n\t\t\t\t\tpage = dest.GetPage()\n\t\t\t\t\tputs \"GoTo Page #\" + page.GetIndex().to_s()\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tputs \"Not a 'GoTo' action\"\n\t\t\tend\n\t\telse\n\t\t\tputs \"NIL\"\n\t\tend\n\t\n\t\t# Recursively print children sub-trees \n\t\tif item.HasChildren() \n\t\t\tPrintOutlineTree(item.GetFirstChild())\n\t\tend\n\t\titem = item.GetNext()\n\tend\nend", "def draw_tree\n result = ''\n max_cols = @n + 1\n calc_tree.each do |row|\n print = ' ' * ((max_cols - row.length) / 2) * max_cols\n print << row.join(' ')\n result << \"#{print}\\n\"\n end\n puts result\n end", "def printf()\n #node object array\n children = []\n\n #info array\n arr = []\n arr.push(\"#{@root.title}: #{@root.rating}\")\n if @root.left != nil\n children.push(@root.left)\n end\n if @root.right != nil\n children.push(@root.right)\n end\n\n # adds nodes to children array AND pushes data to arr\n children.each do |node|\n if node.left != nil\n children.push(node.left)\n end\n if node.right != nil\n children.push(node.right)\n end\n arr.push(\"#{node.title}: #{node.rating}\")\n end\n\n puts arr\n end", "def pretty_print(depth = 0)\n depth.times { STDERR.print ' *' }\n STDERR.print ' '\n STDERR.puts \"#{@name} (#{@id})\"\n @contents.each { |obj| obj.pretty_print(depth + 1) }\n end", "def display\n puts @root.to_s + \" \" + \"=\" * 10\n traverse(@root,0) {|n, l| puts \" \"*l + \"node: #{n}\"}\n self\n end", "def print_tree(out = $stdout)\n out.puts \"Resource: #{id} (Key Field: #{key_field})\"\n rets_classes.each do |rets_class|\n rets_class.print_tree(out)\n end\n end", "def print()\n current_node = @root_node\n while current_node != nil\n current_node.print()\n current_node = current_node.get_next()\n end\n end", "def printOverview\n @nodes.each do |node|\n puts node.nodeID + \" \" + (node.e0.to_s) +\n (node.e1.to_s) + \n (node.w0.to_s) + \n (node.w1.to_s)\n end\n end", "def print(depth)\n spaces = \" \".freeze * depth\n \"#{left_stats} #{spaces} └── #{@node.name}\"\n end", "def disp_node(node, depth)\n# mon_string = ''\n# depth.times {mon_string+=' '}\n# mon_string += \"- #{node.name}\"\n# `echo \"#{mon_string}\" >> toto.txt`\n\n # depth.times {print ' '}\n # puts \"- #{node.name}\"\n self.graph.each_adjacent node do |adj_node|\n disp_node adj_node, depth+1\n end\n end", "def print_result ptree, path_prefix\n puts dump(ptree, path_prefix)\n end", "def printf(children=nil)\n toPrint = \"\"\n nextLine = []\n toPrint += \"#{@root.title}: #{@root.rating}\\n\"\n nextLine << @root.left if @root.left\n nextLine << @root.right if @root.right\n while nextLine.length > 0\n placeholder = []\n nextLine.each do |x|\n title = x.title\n rating = x.rating\n toPrint += \"#{title}: #{rating}\\n\"\n placeholder << x.left if x.left\n placeholder << x.right if x.right\n end\n nextLine = placeholder\n end\n print toPrint\n end", "def _display_tree(max_length=20, tabs='')\n\t\treturn @contents._display_tree(max_length, tabs)\n\tend", "def recursive_print(result=\"\", node=@head)\n\t\tif node.nil?\n\t\t\treturn result\n\t\tend \n\t\tresult += node.data\n\t\tif node.next \n\t\t\tresult += \" > \"\n\t\tend \n\t\trecursive_print(result, node.next)\n\tend", "def printf(children=nil)\n text = \"\"\n if (self.root)\n queue = Queue.new\n queue.push(self.root)\n while (!queue.empty?)\n temp = queue.pop\n text << temp.title << \":\" << temp.rating.to_s\n if (temp.left)\n queue.push(temp.left)\n end\n if (temp.right)\n queue.push(temp.right)\n end\n text << \"\\n\"\n end\n puts text\n return\n end\n end", "def printit\n node = @head\n counter = 0\n while(node = node.next)\n if counter == 10\n print \"\\n\"\n counter = 0\n end\n printf \"%-4s\", node\n counter = counter + 1\n end\n end", "def printit\n node = @head\n counter = 0\n while(node = node.next)\n if counter == 10\n print \"\\n\"\n counter = 0\n end\n printf \"%-4s\", node\n counter = counter + 1\n end\n end", "def printit\n node = @head\n counter = 0\n while(node = node.next)\n if counter == 10\n print \"\\n\"\n counter = 0\n end\n printf \"%-4s\", node\n counter = counter + 1\n end\n end", "def printit\n node = @head\n counter = 0\n while(node = node.next)\n if counter == 10\n print \"\\n\"\n counter = 0\n end\n printf \"%-4s\", node\n counter = counter + 1\n end\n end", "def printtree(n, t)\n if t.question==nil\n n.times {print \" \"}\n puts t.name\n else\n puts t.question\n printtree n+1, t.yes\n printtree n+1, t.no\n end\n end", "def print\n str = \"\"\n current = self.head\n while current != nil do\n str = \"#{str}#{current.data}\"\n current = current.next\n if current != nil\n str += \"\\n\"\n end\n end\n puts str\n end", "def walkthrough\n curNode = @head\n while curNode != nil\n curNode.data.print()\n curNode = curNode.next\n end\n end", "def printf(list=[@root], output='')\n # remove front list item & add it to the output\n first = list.shift()\n print_string = first.title + ': ' + first.rating.to_s + \"\\n\"\n output << print_string\n # add its children to the back of the list\n if first.left\n list << first.left\n end\n if first.right\n list << first.right\n end\n # repeat until all nodes have been visited, then print output\n if list.empty?\n puts output\n return\n else\n printf(list, output)\n end\n end", "def print\n output = \"\"\n current_node = self.head\n\n until current_node.nil?\n output += current_node.data + \"\\n\"\n current_node = current_node.next\n end\n\n puts output\n end", "def print_header\n\tputs \"The students of Villians Academy\"\n\tputs \"-------------\"\nend", "def print\n if self.length == 0\n puts \"empty\"\n else\n self.each { |node| puts node.data }\n end\n end", "def print_tree(n, i = 0)\n i.times { print \" \" }\n puts \"+-#{n}\"\n $classtree[n].sort.each { |c| print_tree(c, i+2) }\nend", "def print\n return nil if @head.nil?\n print_string = \"\"\n current = @head\n print_string.concat(current.data + \"\\n\")\n until current.next.nil?\n current = current.next\n print_string.concat(current.data + \"\\n\")\n end\n puts print_string\n end", "def dump(depth = 0)\n print ' ' * depth * 2\n print \"<!DOCTYPE #{@name}>\\n\"\n end", "def print_non_leaf(node)\n # printer function for .hrl .erl non-leaf elements declarations\n if !@regtally.has?(node)\n node_name = node.s_u_name\n case node.kind\n when \"struct\", \"array\"\n @hrl << \"-record('#{node_name}',{\" \n @erl << \"-define('#{node_name}',\\n\" if node.level == 0\n @erl << \"-define('#{node_name}'(Path),\\n\" if node.level > 0\n @erl << \"#{@@ind[0]}{struct,'#{node_name}',\\n\"\n when \"union\"\n # @hrl << \"-record('#{node_name}',{\" \n @erl << \"-define('#{node_name}'(Path),\\n\"\n @erl << \"#{@@ind[0]}{union,'#{node_name}',\\n\" \n @erl << \"#{@@ind[0]} {?MODULE,union_type,[Path]},\\n\"\n end\n node.children.each do |n|\n print_element(n)\n end\n @regtally.add(node)\n end\n end", "def print_header\n\t\t\"The students of Makers Academy\\n=======================================\"\nend", "def print_header\n puts\n puts \"The students of Villains Academy\"\n puts \"-------------\"\nend", "def print\n current_node = @head\n while current_node != nil\n puts \"#{current_node.data}\\n\"\n current_node = current_node.next\n end\n end", "def print_item(level:, current_item:)\n # Print the current item\n tabs = \"\\t\" * level\n puts tabs + '+ ' + current_item[:name]\n\n # Print the current item's children\n children = $children_of[current_item[:id]]\n if children && children.length > 0\n children.each do |child|\n print_item(\n level: level + 1, \n current_item: child\n )\n end\n end\nend", "def print_header\n puts \"\\nThe students of Villains Academy\"\n puts \"---------------\\n \"\nend", "def printf(children=nil)\n if children.nil?\n children = [@root]\n end\n next_row = []\n children.each do |child|\n puts \"#{child.title}: #{child.rating}\"\n next_row.push(child.left) if !child.left.nil?\n next_row.push(child.right) if !child.right.nil?\n end\n if next_row.size == 0\n nil\n else\n printf(next_row)\n end\n end", "def print_header\n\tputs \"The students of my cohort at Makers Academy\"\n\tputs \"-------------------------\"\nend", "def print\n puts SEPARATOR\n puts @name\n puts SEPARATOR\n puts @desc\n if(@diagram)\n puts\n puts \"Diagram:\"\n puts\n puts @diagram\n end\n end", "def print_debug\n\t\tprint_divider\n\t\tputs \"Root Node: \\n\" + root.to_s\n\t\tprint_divider\n\t\t\n\t\tputs \"Current Node: \\n\" + @current_node.to_s\n\t\tprint_divider\n\t\t\n\t\tputs \"Attributes: \\n\" + attributes.to_s\n\t\tprint_divider\n\t\t\n\t\tputs \"Children: \\n\" + children.to_xml\n\t\tprint_divider\n\tend", "def show_tree\n\t\t@root_node.show\n\tend", "def print_header\n puts \"\\nThe students of Villains Academy\"\n puts \"-------------\"\nend", "def print()\n puts @node_data.to_s\n end", "def print_header \n puts \"The students of Villains Academy\"\n puts \"--------------------------------\"\nend", "def print_tree(out = $stdout)\n out.puts \" #{long_value} -> #{value}\"\n end", "def printf(children=nil)\n children = [@root] if children.nil?\n grand_children = []\n children.each do |node|\n puts \"#{node.title}: #{node.rating}\\n\"\n grand_children.push(node.left) if node.left\n grand_children.push(node.right) if node.right\n end\n printf(grand_children) unless grand_children.empty?\n end", "def print_header\n puts \"The students of Villains Academy\"\n puts \"-------------\"\nend", "def preorder_print(start, traversal)\n traversal\n end", "def print_header\n puts \"The students of Villains Academy\"\n puts \"--------------\"\nend", "def print_header\n puts \"The students of Villains Academy\"\n puts \"--------------\"\nend", "def print_header\n puts \"The students of Villains Academy\"\n puts \"-------------\"\nend", "def print_header\n puts \"The students of Villains Academy\"\n puts \"-------------\"\nend", "def print_header\n puts \"The students of Villains Academy\"\n puts \"-------------\"\nend", "def dump(depth = 0)\n print ' ' * depth * 2\n print \"// #{self.to_s}\\n\"\n end", "def printf(children=nil)\n results = Queue.new\n results.enq(@root)\n\n while !results.empty?\n node = results.deq\n \n puts \"#{node.title}: #{node.rating}\" if node.title \n\n results.enq(node.left) if node.left\n results.enq(node.right) if node.right\n end\n end", "def dump\n super\n\n puts \"page header:\"\n pp page_header\n puts\n\n puts \"fseg header:\"\n pp fseg_header\n puts\n\n puts \"sizes:\"\n puts \" %-15s%5i\" % [\"header\", header_space]\n puts \" %-15s%5i\" % [\"trailer\", trailer_space]\n puts \" %-15s%5i\" % [\"directory\", directory_space]\n puts \" %-15s%5i\" % [\"free\", free_space]\n puts \" %-15s%5i\" % [\"used\", used_space]\n puts \" %-15s%5i\" % [\"record\", record_space]\n puts \" %-15s%5.2f\" % [\"per record\", space_per_record]\n puts\n\n puts \"page directory:\"\n pp directory\n puts\n\n puts \"system records:\"\n pp infimum.record\n pp supremum.record\n puts\n\n puts \"garbage records:\"\n each_garbage_record do |rec|\n pp rec.record\n puts\n end\n puts\n\n puts \"records:\"\n each_record do |rec|\n pp rec.record\n puts\n end\n puts\n end", "def print_tree\n current = nil\n stack = Stack.new\n stack.push(@root)\n until stack.empty?\n current = stack.pop\n if current.parent.nil?\n puts current.tag\n else\n puts \"#{current.tag}\\t<=\\t#{current.parent.tag}\"\n end\n unless current.childs.size.zero?\n current.childs.reverse_each { |child| stack.push(child) }\n end\n end\n end", "def pre_order_print(start, traversal = \"\")\n return traversal unless start\n\n traversal += \"#{start.value}-\"\n traversal = pre_order_print(start.left, traversal)\n pre_order_print(start.right, traversal)\n end", "def print(node = @root, prefix = '', is_left = true)\n if node.nil?\n return\n end\n\n print(node.right_node, \"#{prefix}#{is_left ? '│ ' : ' '}\", false) if node.right_node\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.value}\"\n print(node.left_node, \"#{prefix}#{is_left ? ' ' : '│ '}\", true) if node.left_node\n end", "def show_document\n\tprint_header\n\tprint_document\n\tprint_footer\nend", "def pretty_print(node = @root, prefix = '', is_left = true)\n pretty_print(node.right_child, \"#{prefix}#{is_left ? '│ ' : ' '}\", false) if node.right_child\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.data}\"\n pretty_print(node.left_child, \"#{prefix}#{is_left ? ' ' : '│ '}\", true) if node.left_child\n end", "def pretty_print(node = @root, prefix = '', is_left = true)\n pretty_print(node.right_child, \"#{prefix}#{is_left ? '│ ' : ' '}\", false) if node.right_child\n puts \"#{prefix}#{is_left ? '└── ' : '┌── '}#{node.data}\"\n pretty_print(node.left_child, \"#{prefix}#{is_left ? ' ' : '│ '}\", true) if node.left_child\n end", "def printf(root=nil)# def printf(children=nil)\n if root == nil\n root = @root\n end\n node_array = []\n node_array.push(root)\n printf_breadth(node_array)\n end", "def print_node\n puts \"Value of node #{node_value}. Childs of node: #{node_childs} \"\n end", "def printTree(root = @root, indentation = \"\\n\")\r\n #print root the first time running mehtod, the rest will be printed as children\r\n puts \"#{indentation}#{root.value}\" if root == @root\r\n root.children.each do | child |\r\n puts \"#{indentation}\\t#{child.value}\\n\"\r\n #if there are children, again\r\n printTree(child, indentation + \"\\t\") if child.children.any?\r\n end\r\n end", "def print\n output = \"\"\n temp = self.head\n while temp\n output << temp.data << \"\\n\"\n temp = temp.next\n end\n puts output\n end" ]
[ "0.7520265", "0.73511225", "0.7191661", "0.7166378", "0.70896465", "0.70646954", "0.70571697", "0.6942813", "0.6904817", "0.6821833", "0.6818737", "0.6801423", "0.6776815", "0.675557", "0.67255574", "0.6571123", "0.65693665", "0.6549814", "0.6548929", "0.65363294", "0.6532557", "0.6513331", "0.6505353", "0.65002584", "0.64692646", "0.6468192", "0.64556724", "0.6444492", "0.6442244", "0.6415649", "0.64104253", "0.63948387", "0.63927877", "0.638743", "0.6383144", "0.6378378", "0.6351559", "0.6336181", "0.6335724", "0.62814367", "0.62795174", "0.62747973", "0.6271185", "0.62563497", "0.6244105", "0.62436515", "0.62435305", "0.62362164", "0.6234483", "0.6226002", "0.6218844", "0.6218844", "0.6218844", "0.6218844", "0.6218773", "0.62099624", "0.620624", "0.6195475", "0.61909604", "0.61896664", "0.61893696", "0.61789167", "0.6159021", "0.61567056", "0.61466223", "0.61460495", "0.61390203", "0.6134968", "0.6114896", "0.60780793", "0.60707116", "0.60694134", "0.6067638", "0.60633403", "0.60617626", "0.6049507", "0.6043432", "0.6042283", "0.60316384", "0.60177577", "0.60152376", "0.6014628", "0.6013576", "0.6013576", "0.6013192", "0.6013192", "0.6013192", "0.60099846", "0.6006111", "0.60020286", "0.6001601", "0.5998109", "0.59963256", "0.599317", "0.5991408", "0.5991408", "0.5984585", "0.59837455", "0.5979748", "0.5978685" ]
0.68202424
10
function that fixes bonds in the structure
def fix(node, charge) # if this node has any children, fix them if node.next? # only fix the children that are elements node.nodes.compact.each { |n| fix(n, charge) } end # if this element is not the root, and the formal charge has still not been met for both the current element and the parent, make a bond between the current element and its parent while !node.root? && node.formal_charge != 0 if node.parent.next? node.next = node.parent node.parent.next = node end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fix_bikes\n @bikes.each { |bike| bike.working = true }\n end", "def basic_split(*bonds)\n if bonds.size > 0\n delete_and_restore_bonds(*bonds) do |mol|\n mol.ob.separate.map(&:upcast)\n end\n else\n self.ob.separate.map(&:upcast)\n end\n end", "def bonds\n each_bond.map.to_a\n end", "def bonds\n each_bond.map.to_a\n end", "def define_adyacent_bombs\n @board.length.times do |i|\n @board[i][:value] = get_total_adyacent_bombs(i) unless @board[i][:value] == @bomb\n end\n end", "def bpart_cleanup(xmldoc)\n xmldoc.xpath(\"//relation/bpart\").each do |x|\n extract_localities(x)\n x.replace(x.children)\n end\n end", "def fix\n auto_shop.fix_vehicle\n end", "def fix\n auto_shop.fix_vehicle\n end", "def delete_and_restore_bonds(*bonds, &block)\n bonds.each do |bond|\n unless @ob.delete_bond(bond.ob, false)\n raise \"#{bond.inspect} not deleted!\" \n end\n end\n reply = block.call(self)\n bonds.each {|bond| @ob.add_bond(bond.ob) }\n reply\n end", "def fix_costs!\n fix_costs\n save!\n end", "def unbond(atom1,atom2)\n atom1.bonds.delete(atom2)\n atom2.bonds.delete(atom1)\n [atom1.bonds, atom2.bonds]\nend", "def failed_split(*bonds)\n puts \"Ground Truth: #{basic_split(*bonds).inspect}\"\n self.find_internal_adducts unless @adducts\n # binding.pry if bonds.size == 2\n returns = []\n mols = []\n mols2 = []\n product_mols = []\n if bonds.size > 0\n # set apart the adducts\n p delete_and_restore_bonds(*bonds) do |mol|\n mol.ob.separate.map(&:upcast)\n end\n bonds.each do |bond|\n delete_and_restore_bonds(bond) do |mol| \n mols = mol.ob.separate.map(&:upcast)\n puts \"MOLS: #{mols.inspect}\"\n mols = []\n adducts_present = []\n mol.ob.separate.map(&:upcast).map {|a| @adducts.include?(a) ? adducts_present << a : mols << a}\n puts \"MOLS: #{mols.inspect}\"\n product_mols << mols\n end\n end # bonds.each\n puts \"PMOLS: #{product_mols.inspect}\"\n mols\n else\n mols = self.ob.separate.map(&:upcast).delete_if {|a| @adducts.include?(a)}\n mols2 = mols.map(&:dup)\n mols_all = mols.map(&:dup)\n @adducts.map do |adduct|\n #mols2.each {|mol| mol.associate_atom! adduct.atoms.first }\n mols_all.product([adduct]).map {|mol, adduct| mol.associate_atom! adduct.atoms.first }\n mols2.product([adduct]).map {|mol, adduct| mol.associate_atom! adduct.atoms.first }\n end\n# p mols3\n# p mols_all\n# puts \"+\"*50\n# p mols2 != mols\n products = mols2 != mols ? mols.product(mols2) : [mols]\n # p products\n products.delete_if do |set|\n puts \"set: #{set}\"\n set.last.ob.separate.map(&:upcast).include?(set.first)\n puts \"set: #{set}\"\n end\n # p products\n #binding.pry\n #puts \"adduct_added: #{adduct_added.inspect}\"\n # Right now, I'm making the response sets of matched pairs, even if they have adducts... which they should?\n # Is there a better way to feed these back?\n #adduct_added.empty? ? mols : mols.flatten.sort_by(&:mol_wt).reverse.zip(adduct_added.sort_by(&:mol_wt))\n #products.first.is_a?(Array) ? products.flatten : products\n products\n end\n end", "def process_fix\n super\n end", "def update_bombs bombs , player\r\n bombs.each do |bomb|\r\n update_bomb(bomb,player)\r\n end\r\n # remove_bombs_if_difused(bombs)\r\nend", "def info_fixups\n\t\t# Each reference should be an array consisting of two elements\n\t\trefs = module_info['References']\n\t\tif(refs and not refs.empty?)\n\t\t\trefs.each_index do |i|\n\t\t\t\tif !(refs[i].respond_to?('[]') and refs[i].length == 2)\n\t\t\t\t\trefs[i] = nil\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Purge invalid references\n\t\t\trefs.delete(nil)\n\t\tend\n\tend", "def applyBadConsequence(m)\n badConsequence = m.getBadConsequence\n nLevels = badConsequence.getLevels\n decrementLevels(nLevels)\n pendingBad = badConsequence.adjustToFitTreasureLists(@visibleTreasures, @hiddenTreasures)\n setPendingBadConsequence(pendingBad)\n \n end", "def fix!# {{{\n self.checksum!\n end", "def mark_bridges percentage = 30\n mark_columns { |state,column| \n num = column.count { |e| e.gap? or e.undefined? }\n if (num.to_f/column.length) > 1.0-percentage/100.0\n state.delete!\n end\n state\n }\n end", "def fix\n assembled_address = $config[:base_address]\n instructions.each do |instr|\n instr.fix(assembled_address)\n assembled_address += instr.size\n end\n end", "def fixatable(enable=true) \n @fixation = enable \n self\n end", "def unmark_circles_part_of_bingo\n @circles.each do |circle|\n circle.update(part_of_bingo: false)\n end\n end", "def fixBTree( node, index)\n # If the left sibling has more than min keys.\n if (index != 0 && node.arr[index - 1].n > self.min)\n self.borrowFromLeft(node, index)\n elsif (index != node.n && node.arr[index + 1].n > self.min)\n self.borrowFromRight(node, index)\n else\n if (index != node.n)\n self.merge(node, index)\n else\n self.merge(node, index - 1)\n end\n end\n end", "def set_bonuses\n init_bonus_sets if @set_bonuses.nil?\n @set_bonuses.compact.map { |state_id| $data_states[state_id] }\n end", "def not_null\n bad_boi_points ||=0\n good_boi_points ||=0\n end", "def blur\n things_to_blur = []\n # looking for 1s to blur going through each array\n @grid.each_with_index do |or_row, row_index|\n or_row.each_with_index do |cell, cell_index|\n #is this current cell a 1?\n if cell == 1\n #run function on code\n recursive_blur(Point.new(cell_index, row_index), things_to_blur)\n end\n end\n end\n things_to_blur.each do |point|\n @grid[point.y][point.x] = 1\n end\n output_image\n end", "def recalc_boundaries\n if map.control_points.count > 2\n map.boundary.recalc\n for annotation in map.annotations\n annotation.boundary.recalc\n end\n end\n end", "def new_bond\n @ob.new_bond.upcast\n end", "def replace(oldthing, newthing)\n k,v=@hash_references.select {|k,v| v==oldthing}.flatten\n @hash_references[k]=newthing\n @fields.map! {|atom|\n if atom==oldthing\n newthing\n else\n if atom.is_a? Binstruct\n atom.replace(oldthing,newthing)\n end\n atom\n end\n }\n end", "def clean_refill dirty_atts\n # TODO\n end", "def fix_notes(condensed)\n\t condensed.each do |loc|\n\t ##Rails.logger.debug \"\\nes287_debug line(#{__LINE__}) location=#{loc['location_name']} #{loc['call_number']}\\n\"\n\t ##Rails.logger.debug \"\\nes287_debug line(#{__LINE__}) copies = \" + loc[\"copies\"][0].count.inspect\n\t if !loc[\"copies\"][0][\"items\"][\"Not Available\"].blank? and loc[\"copies\"][0][\"items\"][\"Not Available\"][\"status\"] == 'none'\n\t ##Rails.logger.debug \"\\nes287_debug line(#{__LINE__}) seems like there are no items, so copy notes,etc.\"\n\t ['orders','summary_holdings','supplements','indexes','notes',\n\t\t 'reproduction_note','current_issues'].each do |type|\n\t\tloc[\"copies\"][0][type] = loc[type] unless loc[type].blank?\n\t end\n\t end\n\t end\n\t condensed\n\t end", "def change_user_bonuses # :root: :norobots:\n return unless (@user2 = find_or_goto_index(User, params[:id].to_s))\n if is_in_admin_mode?\n if request.method != \"POST\"\n # Reformat bonuses as string for editing, one entry per line.\n @val = \"\"\n if @user2.bonuses\n vals = @user2.bonuses.map do |points, reason|\n sprintf(\"%-6d %s\", points, reason.gsub(/\\s+/, \" \"))\n end\n @val = vals.join(\"\\n\")\n end\n else\n # Parse new set of values.\n @val = params[:val]\n line_num = 0\n errors = false\n bonuses = []\n @val.split(\"\\n\").each do |line|\n line_num += 1\n if (match = line.match(/^\\s*(\\d+)\\s*(\\S.*\\S)\\s*$/))\n bonuses.push([match[1].to_i, match[2].to_s])\n else\n flash_error(\"Syntax error on line #{line_num}.\")\n errors = true\n end\n end\n # Success: update user's contribution.\n unless errors\n contrib = @user2.contribution.to_i\n # Subtract old bonuses.\n if @user2.bonuses\n @user2.bonuses.each do |points, _reason|\n contrib -= points\n end\n end\n # Add new bonuses\n bonuses.each do |points, _reason|\n contrib += points\n end\n # Update database.\n @user2.bonuses = bonuses\n @user2.contribution = contrib\n @user2.save\n Transaction.put_user(\n id: @user2,\n set_bonuses: bonuses,\n set_contribution: contrib\n )\n redirect_to(action: \"show_user\", id: @user2.id)\n end\n end\n else\n redirect_to(action: \"show_user\", id: @user2.id)\n end\n end", "def unnormalized; end", "def blur!(blur_distance)\r\n ones = get_ones\r\n\r\n @icon.each_with_index do |row, row_index|\r\n row.each_with_index do |item, col_index|\r\n ones.each do |found_row_index, found_col_index|\r\n if manhattan_distance(col_index, row_index, found_col_index, found_row_index) <= blur_distance\r\n @icon[row_index][col_index] = 1\r\n end\r\n end\r\n end\r\n end\r\n end", "def update_balls args\n args.state.balls.each do |ball|\n ball[:x] = ball[:x] + ball[:velX]\n ball[:y] = ball[:y] + ball[:velY]\n pocketed? args, ball\n balls_border args, ball\n end\n friction args\n limit_vel args\nend", "def applyBadConsequence(badCons)\n # Decrement the correesponding levels\n decreaseLevels(badCons.levels)\n # Set the pending bad consequence\n pendingBadCons = badCons.adjustToFitTreasureLists(@visibleTreasures, @hiddenTreasures)\n setPendingBadConsequence(pendingBadCons)\n end", "def rm_fixed_values_from_cddts\n axes = [@row, @col, @block.to_a.flatten]\n axes.each{|axis|\n axis.each{|elm|\n next unless elm.fixed\n @cddts.delete(elm.cddts.first)\n }\n }\n\n# if ProgramConfig[:debug]\n# if @fixed == false and @cddts.length == 1\n# print \"DEBUG: [#{@i}, #{@j}] = #{@cddts.first}\\n\"\n# end\n# end\n @fixed = true if(@cddts.length == 1)\n end", "def change_user_bonuses\n return unless (@user2 = find_or_goto_index(User, params[:id].to_s))\n\n if in_admin_mode?\n if request.method != \"POST\"\n # Reformat bonuses as string for editing, one entry per line.\n @val = \"\"\n if @user2.bonuses\n vals = @user2.bonuses.map do |points, reason|\n format(\"%-6d %s\", points, reason.gsub(/\\s+/, \" \"))\n end\n @val = vals.join(\"\\n\")\n end\n else\n # Parse new set of values.\n @val = params[:val]\n line_num = 0\n errors = false\n bonuses = []\n @val.split(\"\\n\").each do |line|\n line_num += 1\n if (match = line.match(/^\\s*(\\d+)\\s*(\\S.*\\S)\\s*$/))\n bonuses.push([match[1].to_i, match[2].to_s])\n else\n flash_error(\"Syntax error on line #{line_num}.\")\n errors = true\n end\n end\n # Success: update user's contribution.\n unless errors\n contrib = @user2.contribution.to_i\n # Subtract old bonuses.\n @user2.bonuses&.each_key do |points|\n contrib -= points\n end\n # Add new bonuses\n bonuses.each do |(points, _reason)|\n contrib += points\n end\n # Update database.\n @user2.bonuses = bonuses\n @user2.contribution = contrib\n @user2.save\n redirect_to(action: \"show_user\", id: @user2.id)\n end\n end\n else\n redirect_to(action: \"show_user\", id: @user2.id)\n end\n end", "def recalc\n logger.debug \"recalculating boundary #{self.inspect}\"\n \n return unless self.ne_lat.nil? or self.ne_lng.nil? or self.sw_lat.nil? or self.sw_lng.nil?\n \n if boundary_object_type == \"Annotation\"\n cp = Annotation.find(boundary_object_id).map.control_points.first(3)\n elsif boundary_object_type == \"Map\"\n cp = Map.find(boundary_object_id).control_points.first(3)\n end\n \n self.ne_lat, self.ne_lng = ControlPoint.compute_latlng_from_known_xy(ne_x, ne_y, cp)\n self.sw_lat, self.sw_lng = ControlPoint.compute_latlng_from_known_xy(sw_x, sw_y, cp)\n self.save\n \n end", "def init_bonus_sets\n @set_bonuses = []\n end", "def set_original_value(left_bank, right_bank, boat, m, c)\n boat.in_left_bank = !boat.in_left_bank\n if boat.in_left_bank == true\n left_bank.m_no += m\n left_bank.c_no += c\n right_bank.m_no -= m\n right_bank.c_no -= c\n else\n right_bank.m_no += m\n right_bank.c_no += c\n left_bank.m_no -= m\n left_bank.c_no -= c\n end\nend", "def prepare_update\n # All elder broadcasts are trash...\n tmp = @broadcasts; \n @broadcasts = []\n @to_destroy = tmp.reject {|bc| bc.dirty?}\n\n # Get rid of unsolved, conflicts with unactivated broadcasts\n @conflicts = @conflicts.reject{|c| c.active_broadcast.nil?}\n\n # Clean all unactivated broadcasts from remaining conflicts\n @conflicts.each {|c| c.new_broadcasts = [] }\n\n # unless somebody used them\n tmp.select { |bc| bc.dirty? }.each do |bc|\n self.add_conflict( :conflict => find_or_create_conflict_by_active_broadcast(bc) )\n end\n end", "def set_blinds\n @active_players[0].current_bet = @small_blind_value\n @active_players[1].current_bet = @big_blind_value\n @table_current_bet = @active_players[1].current_bet\n @pot_size += @active_players[0].current_bet + @active_players[1].current_bet\n @committed += @pot_size\n @active_players.rotate!(2)\nend", "def lewis(elements, charge)\r\n\t# moves all hydrogens from element array to the end, so the core elements can be dealt with\r\n\thydrogens = Array.new\r\n\telements.delete_if { |element|\r\n\t\tif element == \"H\"\r\n\t\t\thydrogens << \"H\"\r\n\t\tend\r\n\t}\r\n\tif !hydrogens.empty?\r\n\t\telements << hydrogens\r\n\tend\r\n\t\r\n\telements.flatten!\r\n\t\r\n\t# depending on how many different elements there are (uniq), the structure is made differently\r\n\tlewistype = elements.uniq.length\r\n\t\r\n\tcase lewistype\r\n\t\t# if there is only one element in the compound (ie diatomic, etc)\r\n\t\t# bond each element to each other\r\n\t\twhen 1\r\n\t\t\troot = cur = Element.new(elements.shift, nil)\r\n\t\t\twhile !elements.empty?\r\n\t\t\t\tcur = cur.next = Element.new(elements.shift, cur)\r\n\t\t\tend\r\n\t\t\tfix(root, charge)\r\n\t\t# if there are 2 elements in the compound, take the least electronegative and make it the central atom\r\n\t\t# attach all other elements onto the central atom\r\n\t\twhen 2\r\n\t\t\troot = cur = Element.new(elements.shift, nil)\r\n\t\t\twhile !elements.empty?\r\n\t\t\t\tcur.next = Element.new(elements.shift, cur)\r\n\t\t\tend\r\n\t\t\tfix(root, charge)\r\n\tend\r\n\t\r\n\t# prints structure\r\n\tprintlewis(root)\r\nend", "def use_hires_bb\n reverse_of( self['ignore_hires_bb'].val )\n end", "def fix_signs\n self.offset_flags = Support::EncodingUtils.network_to_host_64(self.offset_flags)\n self.parent_one_rev = self.parent_one_rev.to_signed_32\n self.parent_two_rev = self.parent_two_rev.to_signed_32\n \n self\n end", "def neutral!\n had_hydrogens = h_added?\n atoms.each {|atom| atom.charge = 0 if (atom.charge != 0) }\n remove_h!\n add_h! if had_hydrogens \n self\n end", "def buff_support_rebels!\n soft_patch_defines_lua!(\"fun_and_balance_support_rebels\",\n [\"NDiplomacy.SUPPORT_REBELS_EFFECT\", 10, 50],\n [\"NDiplomacy.SUPPORT_REBELS_MONEY_FACTOR\", 0.5, 0.1],\n [\"NDiplomacy.SUPPORT_REBELS_COST\", 30, 20],\n )\n end", "def apply_badgings\r\n if @badging_list\r\n @badging_list.map { |badging| badging.save! }\r\n end\r\n end", "def prune_bnodes(input, bnodes_to_clear)\n case input\n when Array\n # If, after replacement, an array contains only the value null remove the value, leaving an empty array.\n input.map { |o| prune_bnodes(o, bnodes_to_clear) }.compact\n when Hash\n output = {}\n input.each do |key, value|\n if context.expand_iri(key) == '@id' && bnodes_to_clear.include?(value)\n # Don't add this to output, as it is pruned as being superfluous\n else\n output[key] = prune_bnodes(value, bnodes_to_clear)\n end\n end\n output\n else\n input\n end\n end", "def colliBall_h(balls)\r\n for molecule, mol_col_chk in balls.combination(2)\r\n if mol_col_chk.collide?(molecule) && (! molecule.noCollideList.include?(mol_col_chk))\r\n if @crn.reactions.key?([molecule.species, mol_col_chk.species]) \r\n @balls += split(@balls, [molecule, mol_col_chk], @crn.reactions[[molecule.species, mol_col_chk.species]][1])\r\n else \r\n #bounce around when it is not a reaction\r\n temp = Marshal.load(Marshal.dump(molecule.v))\r\n molecule.v = Marshal.load(Marshal.dump(mol_col_chk.v))\r\n mol_col_chk.v = temp\r\n end #no coList\r\n else\r\n molecule.noCollideList = molecule.noCollideList - [mol_col_chk]\r\n mol_col_chk.noCollideList = mol_col_chk.noCollideList - [molecule]\r\n end # if collide\r\n end #for\r\n end", "def update_borders\n @borders.each { |b| b.update }\n end", "def rm_cddts_outof_blk\n axes = [@ref_rows, @ref_cols]\n axes.each{|axis|\n axis.each{|ref|\n intrsct_cddts = []\n (self.to_a.flatten & ref).each{|elm|\n intrsct_cddts.push(elm.cddts).flatten!.uniq!\n }\n six_cells_cddts = []\n (self.to_a.flatten - ref).each{|elm|\n six_cells_cddts.push(elm.cddts).flatten!.uniq!\n }\n intrsct_cddts.each{|cddt|\n unless six_cells_cddts.include?(cddt)\n (ref - self.to_a.flatten).each{|elm|\n elm.cddts.delete(cddt)\n# if ProgramConfig[:debug]\n# if elm.fixed == false and elm.cddts.length == 1\n# print \"DEBUG: [#{elm.i}, #{elm.j}] = #{elm.cddts.first}\\n\"\n# end\n# end\n elm.fixed = true if(elm.cddts.length == 1)\n }\n end\n }\n }\n }\n end", "def rebuild_weight_array\n end", "def fix(address)\n @address = address\n end", "def fix(address)\n @address = address\n end", "def repair!\n update!\n end", "def propagate_bonus_changes\n\n ActiveRecord::Base.transaction(:requires_new => true) do\n\n if (!self.character_id.nil? && self.character_id > 0) # only spread, if there's a resource pool\n GameRules::Rules.the_rules().resource_types.each do |resource_type|\n\n to_check = [{\n attribute: resource_type[:symbolic_id].to_s()+'_production_bonus_effects',\n attribute_settlement: resource_type[:symbolic_id].to_s()+'_production_bonus_global_effects',\n },\n {\n attribute: resource_type[:symbolic_id].to_s()+'_production_bonus_alliance',\n attribute_settlement: resource_type[:symbolic_id].to_s()+'_production_bonus_alliance',\n },\n {\n attribute: resource_type[:symbolic_id].to_s()+'_production_bonus_sciences',\n attribute_settlement: resource_type[:symbolic_id].to_s()+'_production_bonus_sciences',\n }\n ]\n to_check = to_check.select { |bonus| !self.changes[bonus[:attribute]].nil? } # filter those, that have changed\n\n if !to_check.nil? && to_check.length > 0\n self.owner.settlements.each do |settlement|\n settlement.lock!\n to_check.each do |bonus|\n settlement.increment(bonus[:attribute_settlement], self.changes[bonus[:attribute]][1] - self.changes[bonus[:attribute]][0])\n end\n settlement.save!\n end\n end\n end\n end\n end\n\n true\n end", "def reformat_for_next_generation!\n # create an array of dead cells and insert it as the first and last row of cells\n dead_cells = (1..@cells.first.size).map { Cell.new }\n # don't forget to deep copy the dead_cells\n @cells.unshift Marshal.load(Marshal.dump(dead_cells))\n @cells.push Marshal.load(Marshal.dump(dead_cells))\n\n # also insert a dead cell at the left and right of each row\n @cells.each do |row|\n row.unshift Cell.new\n row.push Cell.new\n end\n\n # validate to see if we broke the board\n validate\n end", "def avoid_roads(width, height, bad)\n\n routes = Array.new(height + 1) { Array.new(width + 1) { 0 } } # how many routes to a block?\n\n routes.each_with_index do |row, i|\n row.each_index do |j|\n if (i == 0 && j == 0)\n routes[0][0] = 1\n elsif i == 0\n routes[i][j] = routes[0][j - 1] unless is_obstructed?(i, j, i, j - 1, bad)\n elsif j == 0\n routes[i][j] = routes[i - 1][0] unless is_obstructed?(i, j, i - 1, j, bad)\n else\n top = (is_obstructed?(i, j, i - 1, j, bad) ? 0 : routes[i - 1][j])\n left = (is_obstructed?(i, j, i, j - 1, bad) ? 0 : routes[i][j - 1])\n routes[i][j] = top + left\n end\n end\n end\n\n return routes[height][width]\nend", "def assign_bonuses\n allocate_comp_energy\n if self.user_quaffle_allocation > @s_energy\n @uq_bonus = (2 * (self.user_quaffle_allocation - @s_energy) - 1)\n end \n\n if @q_energy > self.user_snitch_allocation \n @cq_bonus = (2 * (@q_energy - self.user_snitch_allocation) - 1)\n end\n\n if self.user_bludger_allocation > @q_energy\n @ub_bonus = (2 * (self.user_bludger_allocation - @q_energy) - 1)\n end\n\n if @b_energy > self.user_quaffle_allocation \n @cb_bonus = (2 * (@b_energy - self.user_quaffle_allocation) - 1)\n end\n\n if self.user_snitch_allocation > @b_energy\n @us_bonus = (2 * (self.user_snitch_allocation - @b_energy) - 1)\n end\n\n if @s_energy > self.user_bludger_allocation\n @cs_bonus = (2 * (self.user_bludger_allocation) - 1)\n end\n end", "def update_billcoins(info)\r\n\t\t# reads the transactions and updates the @billcoins based on those transactions\r\n\t\t# returns false if the update encounted errors\r\n\t\t# returns true if the update was a success\r\n\t\tsuccess = true\r\n\t\terror_msg = \"\"\r\n\t\ttransactions = info['transaction']\r\n\r\n\t\ttransactions.each{ |t|\r\n\t\t\tfrom, to = t.split('>')\t\t# splits to \"FROM\", \"TO(AMOUNT)\"\r\n\t\t\tto, amount = to.split('(')\t# splits to \"TO\", \"AMOUNT)\"\r\n\r\n\t\t\t# validate the addresses first\r\n\t\t\tsuccess, error_msg = validate_address(from)\r\n\t\t\tbreak unless success\r\n\r\n\t\t\tsuccess, error_msg = validate_address(to)\r\n\t\t\tbreak unless success\r\n\r\n\t\t\tamount = amount.delete(')')\t# removes the last ')'\r\n\t\t\tamount = amount.to_i\r\n\r\n\t\t\tif not @billcoins.include? from\r\n\t\t\t\t@billcoins[from] = 0\r\n\t\t\tend\r\n\t\t\tif not @billcoins.include? to\r\n\t\t\t\t@billcoins[to] = 0\r\n\t\t\tend\t\r\n\r\n\t\t\t@billcoins[from] -= amount\r\n\t\t\t@billcoins[to] += amount\r\n\r\n\t\t\t#puts \"#{from}: #{@billcoins[from]} sent #{to}: #{@billcoins[to]}\"\r\n\r\n\t\t\tsuccess, error_msg = validate_billcoins(from)\r\n\t\t\treturn success, error_msg unless success\r\n\r\n\t\t\tsuccess, error_msg = validate_billcoins(to)\r\n\t\t\treturn success, error_msg unless success\r\n\t\t}\r\n\r\n\t\treturn success, error_msg\r\n\tend", "def each_bond(&block)\n # could use the C++ iterator in the future\n block or return enum_for(__method__)\n iter = @ob.begin_bonds\n obbond = @ob.begin_bond(iter)\n while obbond\n block.call obbond.upcast\n obbond = @ob.next_bond(iter)\n end\n self\n end", "def free_bottles_and_caps(bottles, caps)\n from_bottles = bottles / BOTTLE_TO_REDEEM\n from_caps = caps / CAP_TO_REDEEM \n update_bottles(from_bottles, from_caps)\n from_bottles + from_caps\nend", "def handle_gray_booms!\n return if @pending_gray_boom_tile_lays.values.flatten.empty?\n\n # clear gray double boom city actions, no tiles remain\n if (num_double_boom_tiles = gray_double_boomcity_tile_count).zero?\n @pending_gray_boom_tile_lays[:double_boom].clear\n\n # there are enough gray double boom city tiles, automatically lay them\n elsif num_double_boom_tiles >= @pending_gray_boom_tile_lays[:double_boom].size\n @pending_gray_boom_tile_lays[:double_boom].each do |hex|\n boomcity_to_double_boomcity!(hex, gray_checked: true)\n end\n end\n\n # clear pending gray boom city tile lays, no tiles remain\n if gray_boomcity_tile_potential_count.zero?\n @pending_gray_boom_tile_lays[:boom].clear\n\n # there are enough gray boom city tiles, automatically lay them\n elsif gray_boomcity_tile_count >= @pending_gray_boom_tile_lays[:boom].size\n @pending_gray_boom_tile_lays[:boom].each do |hex|\n boomtown_to_boomcity!(hex, gray_checked: true)\n end\n end\n end", "def applyBadConsequence(m)\n if(m.getBadConsequence.isDeath)\n discardAllTreasures\n else\n decrementLevels(m.getBadConsequence.getLevels)\n pbc=m.getBadConsequence.adjustToFitTreasureLists(@visibleTreasures, @hiddenTreasures)\n setPendingBadConsequence(pbc)\n end\n\n end", "def blur!\r\n ones = get_ones\r\n ones.each do |found_row_number, found_col_number| \r\n @picture[found_row_number -1][found_col_number] = 1 unless found_row_number == 0 #up\r\n @picture[found_row_number +1][found_col_number] = 1 unless found_row_number == @picture.length-1 #down\r\n @picture[found_row_number][found_col_number -1] = 1 unless found_col_number == 0 #left\r\n @picture[found_row_number][found_col_number +1] = 1 unless found_col_number == @picture[found_row_number].length-1 #right\r\n end\r\n end", "def normalize!\n end", "def modify_bonus(code)\n bonus = code.bonus\n self.modifiable_bonuses.each { |team_bonus| bonus = team_bonus.modify_bonus(bonus, code.ko) }\n bonus || 0\n end", "def update_legacy_balances\n liabilities.where.not(member_id: nil).find_each { |l| Operations.update_legacy_balance(l) }\n end", "def continuize!\n @data.each_index do |data_index|\n @data[data_index].each do |attribute_name, attribute|\n att_type = @attributes.find { |attr| attr[:name] == attribute_name }\n #class is a special case. Store original value\n if att_type[:name] == \"class\" or att_type[:name] == @class_attribute\n @old_class_nominal_attributes = att_type[:nominal_attributes]\n end\n\n if att_type[:type] == \"string\" or att_type[:type] == \"nominal\"\n @data[data_index][attribute_name] = att_type[:nominal_attributes].find_index(attribute)\n end\n end\n end\n\n #change attribute types\n @attributes.each do |attribute|\n if attribute[:type] == \"string\" or attribute[:type] == \"nominal\"\n attribute[:type] = \"numeric\"\n attribute[:old_nominal_attributes] = attribute[:nominal_attributes]\n attribute[:nominal_attributes] = nil\n end\n end\n self\n end", "def fixup(name)\n @@typedef_table['table_data'].each do |e|\n if e[1].has_key?('.forward_base_name') && e[1]['.forward_base_name'].eql?(name)\n table = (e[1]['.type'].eql?'union') ? @@uniontag_table : @@structtag_table\n table['table_data'].each do |g|\n if g[0].eql?(name)\n e[1]['.members'] = Marshal.load(Marshal.dump(g[1]['.members']))\n e[1].delete('.forward_base_name')\n end\n end\n end\n end\nend", "def bond(other)\n raise \"Can't bond an atom to itself.\" if self == other\n raise \"Can't bond to any more atoms\" if (self.saturated? || other.saturated?)\n @bonds << other\n other.bonds << self\n self\n end", "def fixup(name)\n @@typedef_table['table_data'].each do |e|\n if e[1].has_key?('.forward_base_name') && e[1]['.forward_base_name'].eql?(name)\n table = (e[1]['.type'].eql?'union') ? @@uniontag_table : @@structtag_table\n table['table_data'].each do |g|\n if g[0].eql?(name)\n e[1]['.members'] = Marshal.load(Marshal.dump(g[1]['.members']))\n e[1].delete('.forward_base_name')\n end\n end\n end\n end\nend", "def normalize!; end", "def replace_probs(mps, probs)\n mps.each_with_index do |mp,i|\n mp[1].each_with_index do |e,j|\n e[1] = probs[i+j]\n end\n end\n mps#[mps]\n end", "def give_bonuses(acquired_hotel, primary, secondary, acquired_hotel_size, tie_for_first, tie_for_second)\n response = acquired_hotel.get_bonus_amounts(acquired_hotel_size)\n majority_bonus = response[0]\n minority_bonus = response[1]\n\n if tie_for_first != 'none'\n split = (majority_bonus + minority_bonus)/2\n primary.cash = primary.cash + split\n tie_for_first.cash = tie_for_first.cash + split\n primary.save\n tie_for_first.save\n if tie_for_second != 'none'\n split = minority_bonus/2\n secondary.cash = secondary.cash + split\n tie_for_second.cash = tie_for_second.cash + split\n secondary.save\n tie_for_second.save\n end\n elsif tie_for_second != 'none'\n split = minority_bonus/2\n secondary.cash = secondary.cash + split\n tie_for_second.cash = tie_for_second.cash + split\n secondary.save\n tie_for_second.save\n else\n primary.cash = primary.cash + majority_bonus\n secondary.cash = secondary.cash + minority_bonus\n primary.save\n secondary.save\n end\n end", "def berlioz; end", "def functioning_bikes\n bikes.reject {|bike| bike.broken?}\n end", "def collect_broken_bikes(van)\n\t\tvan.broken_bikes.each {|bike| bikes << van.release(bike)}\n\tend", "def nip_it_in_the_bud\n while has_bud?(@sequence) do\n @sequence.shift\n @sequence.each { |entry| entry.level -= 1 }\n end\n end", "def bizet; end", "def place_bombs\n range = (0...@grid.length).to_a\n total_bombs = (@grid.length ** 2) / 4\n @grid[range.sample][range.sample].value = BOMB until @grid.flatten.map(&:value).count(BOMB) == total_bombs\n end", "def correct_standards_pointed_to_missing_ref_ids(element)\n ref_id_map = {\n 'B1AC98EADE4145689E70EEEBD9B8CC19' => patch_duplicated_parent_ref_ids(element,'B1AC98EADE4145689E70EEEBD9B8CC18'),\n '834B17E279C64263AA83F7625F5D2994' => patch_duplicated_parent_ref_ids(element,'834B17E279C64263AA83F7625F5D2993'),\n '91FABAB899814C55851003A0EE98F8FC' => patch_duplicated_parent_ref_ids(element,'91FABAB899814C55851003A0EE98F8FB')\n }\n return unless (element.is_a?(Standard) and ref_id_map.keys.include?(element.parent_ref_id))\n element.instance_variable_set(:@parent_ref_id,ref_id_map[element.parent_ref_id])\n end", "def test_monkey_patch_city_neighbors\n assert_equal ['Nil Town', 'Enumerable Canyon', 'Matzburg'], @l.monkey_patch_city['neighbors']\n end", "def blam!\n berzerk? ? w00t! : super\n end", "def update!(**args)\n @biasingfield = args[:biasingfield] if args.key?(:biasingfield)\n end", "def process\n Trade::Shipment.update_all(\n { taxon_concept_id: @taxon_relationship.taxon_concept_id },\n {\n taxon_concept_id: @old_taxon_relationship.taxon_concept_id,\n reported_taxon_concept_id: @taxon_relationship.other_taxon_concept_id\n }\n )\n end", "def rebalance_conversion_rates!\n warn \"Disabled code #{__method__}. Do not enable in release. #{__FILE__}:#{__LINE__}\"\n\n patch_mod_file!(\"common/static_modifiers/00_static_modifiers.txt\") do |node|\n modify_node! node,\n [\"base_values\", \"global_missionary_strength\", 0.02, 0.01],\n [\"base_values\", \"global_heretic_missionary_strength\", nil, 0.01]\n end\n\n patch_mod_file!(\"common/religions/00_religion.txt\") do |node|\n node.each do |group_name, group|\n group.each do |name, religion|\n next if [\"crusade_name\", \"defender_of_faith\", \"can_form_personal_unions\", \"center_of_religion\", \"flags_with_emblem_percentage\", \"flag_emblem_index_range\", \"harmonized_modifier\", \"ai_will_propagate_through_trade\"].include?(name)\n if group_name == \"pagan\"\n religion[\"province\"] ||= PropertyList[]\n religion[\"province\"][\"local_missionary_strength\"] = 0.03\n else\n religion[\"province\"].delete!(\"local_missionary_strength\") if religion[\"province\"]\n end\n end\n end\n end\n end", "def rebalance_conversion_rates!\n warn \"Disabled code #{__method__}. Do not enable in release. #{__FILE__}:#{__LINE__}\"\n\n patch_mod_file!(\"common/static_modifiers/00_static_modifiers.txt\") do |node|\n modify_node! node,\n [\"base_values\", \"global_missionary_strength\", 0.02, 0.01],\n [\"base_values\", \"global_heretic_missionary_strength\", nil, 0.01]\n end\n\n patch_mod_file!(\"common/religions/00_religion.txt\") do |node|\n node.each do |group_name, group|\n group.each do |name, religion|\n next if [\"crusade_name\", \"defender_of_faith\", \"can_form_personal_unions\", \"center_of_religion\", \"flags_with_emblem_percentage\", \"flag_emblem_index_range\", \"harmonized_modifier\", \"ai_will_propagate_through_trade\"].include?(name)\n if group_name == \"pagan\"\n religion[\"province\"] ||= PropertyList[]\n religion[\"province\"][\"local_missionary_strength\"] = 0.03\n else\n religion[\"province\"].delete!(\"local_missionary_strength\") if religion[\"province\"]\n end\n end\n end\n end\n end", "def canonicize!\n complement! if !canonical?\n end", "def blur(distance)\r\n # instantiate variables\r\n @b_array = Array.new(array.length) { Array.new(array[0].length,0) }\r\n min_y= 0\r\n max_y = b_array.length - 1\r\n min_x = 0 \r\n max_x = b_array[0].length - 1\r\n blurred_coordinates = []\r\n #iterate through each row of the array, passing down index and value\r\n array.each_with_index do |row,row_i|\r\n #iterate through each column (value) passing index and value\r\n row.each_with_index do |col,col_i| \r\n if row[col_i] == 1 \r\n blurred_coordinates << get_manhattan_set(row_i,col_i,distance)\r\n end\r\n end\r\n end\r\n\r\n blurred_coordinates.each do |set|\r\n set.each do |point|\r\n unless point[0]< min_x || point[1] < min_y || point[0]> max_y || point[1] > max_x\r\n @b_array[point[0]][point[1]] = 1\r\n end\r\n end \r\n end\r\n end", "def pre_conversion_sanity_check()\r\n # Do a dry run of the bug conversion checking the mappings between BugZilla and FogBugz fields\r\n # If the FB API allowed creation of things like projects and priorities, this wouldn't be necessary\r\n missing_fields = []\r\n\r\n @bz_reader.each_bug do |bz_bug|\r\n verify_field_mappings(bz_bug, missing_fields)\r\n end\r\n\r\n missing_fields\r\n end", "def set_absorbent! \n set_normal! \n @absorbent = true \n end", "def item_effect_damagefix\r\n self.damage = nil unless $game_temp.in_battle\r\n end", "def update\n return unless @bhpb_frame && @bhpb_bcg && @bhpb_bars\n \n @bhpb_frame.update\n @bhpb_bcg.update\n \n i = 0\n @bhpb_bars.each { |b|\n max_rate = (@current_bar - i).to_f * @per_bar\n empty_rate = max_rate - @per_bar\n if @current_rate >= max_rate\n b.src_rect.width = b.bitmap.width\n b.wave_amp = 0\n elsif @current_rate < empty_rate\n b.src_rect.width = 0.0\n b.wave_amp = 0\n else\n max_rate = (max_rate - empty_rate) - (@current_rate - empty_rate) \n max_rate = 1.0 - (max_rate * 100.0 / @per_bar) / 100.0\n \n b.src_rect.width = ((b.bitmap.width - BHP::FILL_X_OFFSET_LEFT - BHP::FILL_X_OFFSET_RIGHT) * max_rate) + BHP::FILL_X_OFFSET_LEFT\n end\n b.update\n \n i += 1\n }\n \n if @current_rate != @boss.hp_rate\n @current_rate -= 0.0045 if @current_rate > @boss.hp_rate\n @current_rate = 0.0 if @current_rate < 0.0\n @current_rate += 0.0045 if @current_rate < @boss.hp_rate\n @current_rate = 1.0 if @current_rate > 1.0\n end\n \n if @confusing_bar != (@current_rate / @per_bar).ceil\n @confusing_bar = (@current_rate / @per_bar).ceil\n txt = \"x\" + @confusing_bar.to_s\n @bhpb_x.bitmap.clear\n @bhpb_x.bitmap.draw_text(BHP::TIMES_X_OFFSET, 0, @bhpb_x.width, @bhpb_x.height, txt)\n end\n \n @bhpb_x.update\n \n if @current_rate <= 0.0 && BHP::HIDE_BAR_WHEN_BOSS_DIES\n @bhpb_frame.opacity = 0\n @bhpb_bcg.opacity = 0 \n @bhpb_bars.each { |b| b.opacity = 0 }\n @bhpb_x.opacity = 0\n elsif @current_rate > 0.0 && BHP::HIDE_BAR_WHEN_BOSS_DIES\n @bhpb_frame.opacity = 255\n @bhpb_bcg.opacity = 255\n @bhpb_bars.each { |b| b.opacity = 255 }\n @bhpb_x.opacity = 255 \n end\n \n return if (BHP::HIDE_BAR_WHEN_BOSS_DIES && @current_rate <= 0.0) || BHP::HIDE_SWITCH == 0 || ($game_switches[BHP::HIDE_SWITCH] && @bhpb_frame.opacity == 0) || (!$game_switches[BHP::HIDE_SWITCH] && @bhpb_frame.opacity == 255)\n if $game_switches[BHP::HIDE_SWITCH] && @bhpb_frame.opacity != 0\n @bhpb_frame.opacity = 0\n @bhpb_bcg.opacity = 0 \n @bhpb_bars.each { |b| b.opacity = 0 }\n @bhpb_x.opacity = 0\n elsif !$game_switches[BHP::HIDE_SWITCH] && @bhpb_frame.opacity != 255\n @bhpb_frame.opacity = 255\n @bhpb_bcg.opacity = 255\n @bhpb_bars.each { |b| b.opacity = 255 }\n @bhpb_x.opacity = 255\n end\n end", "def fix_boolean(node)\n node.children.map! do |child|\n if child.is_a?(AST::Node) &&\n child.type == :coerce_b\n child.children.first\n else\n child\n end\n end\n end", "def fixpos\n @pos = fix_value( @pos )\n end", "def fix_address(x = @x, y = @y)\n fixed_x = (x - x.to_i).abs < 0.500 ? x.to_i : x.to_i + 1\n fixed_y = (y - y.to_i).abs < 0.500 ? y.to_i : y.to_i + 1\n \n return [fixed_x,fixed_y]\n end", "def blur_coordinate(row_number, column_number, distance)\n @array.each_with_index do |row, other_row_number|\n row.each_with_index do |cell, other_column_number|\n manhattan_distance = calculate_manhattan_distance(\n row_number,\n column_number,\n other_row_number,\n other_column_number\n )\n\n should_we_blur_it = manhattan_distance <= distance\n\n if should_we_blur_it == true\n @array[other_row_number][other_column_number] = 1\n end\n end\n end\n\n # (1..distance).each do |delta_row|\n # (1..distance).each do |delta_col|\n # #right\n # manhattan_distance = calculate_manhattan_distance(row_number, column_number, row_number + delta_row, column_number + delta_col)\n # if manhattan_distance <= distance == true\n # @array[row_number + delta_row][column_number + delta_col] = 1\n # end\n #\n # #up\n # manhattan_distance = calculate_manhattan_distance(row_number, column_number, row_number - delta_row, column_number + delta_col)\n # if manhattan_distance <= distance == true\n # @array[row_number - delta_row][column_number + delta_col] = 1\n # end\n #\n # manhattan_distance = calculate_manhattan_distance(row_number, column_number, row_number - delta_row, column_number - delta_col)\n # if manhattan_distance <= distance == true\n # @array[row_number - delta_row][column_number - delta_col] = 1\n # end\n #\n # manhattan_distance = calculate_manhattan_distance(row_number, column_number, row_number + delta_row, column_number - delta_col)\n # if manhattan_distance <= distance == true\n # @array[row_number + delta_row][column_number - delta_col] = 1\n # end\n # end\n # end\n end", "def fuse\r\n\t\ti,j=0\r\n\t\twhile i<8 do \r\n\t\t j=0\r\n\t\t while j<8 do\r\n\t\t \r\n\t\t if @nha[i][j] == nil\r\n\t\t @nha[i][j] =\".\" \r\n\t\t end\r\n\t\t j+=1\r\n\t\t end \r\n\t\t i+=1\r\n\t\tend \r\n\t\treturn true\r\n\tend" ]
[ "0.606688", "0.54154354", "0.52664775", "0.52664775", "0.5240525", "0.52170265", "0.5197726", "0.5197726", "0.5184201", "0.5111774", "0.5095374", "0.5094876", "0.5085245", "0.5072558", "0.5064278", "0.50623107", "0.50543255", "0.49761108", "0.49743333", "0.49716952", "0.49694538", "0.49585652", "0.49541017", "0.49269578", "0.49177712", "0.4915409", "0.49146459", "0.49120733", "0.48938316", "0.4884124", "0.4878721", "0.48716453", "0.4865301", "0.48566505", "0.48355132", "0.4835203", "0.48283127", "0.4810967", "0.4810549", "0.4799861", "0.4789691", "0.47828764", "0.4775173", "0.47730976", "0.47726765", "0.47720835", "0.47709954", "0.47491914", "0.47459215", "0.47409627", "0.47288784", "0.4728569", "0.4726669", "0.47238654", "0.47238654", "0.47142106", "0.46990895", "0.46973574", "0.4692349", "0.46796027", "0.4679003", "0.46746677", "0.4668682", "0.46593058", "0.46546668", "0.4652067", "0.46281892", "0.46246415", "0.46243903", "0.46173823", "0.4613738", "0.46118647", "0.46103036", "0.4601293", "0.46005493", "0.45987242", "0.45880646", "0.4585066", "0.4585018", "0.4582578", "0.45793644", "0.45784038", "0.45690626", "0.4567883", "0.4556097", "0.45465878", "0.45447326", "0.4542577", "0.4542577", "0.45400295", "0.4539802", "0.45381305", "0.4536107", "0.45331052", "0.45315802", "0.45301282", "0.45291865", "0.45276567", "0.4526372", "0.4521501" ]
0.5371729
2
generates lewis structure, then checks the structure to see if it is correct
def lewis(elements, charge) # moves all hydrogens from element array to the end, so the core elements can be dealt with hydrogens = Array.new elements.delete_if { |element| if element == "H" hydrogens << "H" end } if !hydrogens.empty? elements << hydrogens end elements.flatten! # depending on how many different elements there are (uniq), the structure is made differently lewistype = elements.uniq.length case lewistype # if there is only one element in the compound (ie diatomic, etc) # bond each element to each other when 1 root = cur = Element.new(elements.shift, nil) while !elements.empty? cur = cur.next = Element.new(elements.shift, cur) end fix(root, charge) # if there are 2 elements in the compound, take the least electronegative and make it the central atom # attach all other elements onto the central atom when 2 root = cur = Element.new(elements.shift, nil) while !elements.empty? cur.next = Element.new(elements.shift, cur) end fix(root, charge) end # prints structure printlewis(root) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_basic_generation\n lf = LinuxFortune.generate\n assert !lf.nil? # fortune should be present\n assert !lf.body.nil? && !lf.body.empty? # body should be present\n assert !lf.source.nil? && !lf.source.empty? # source should be present\n end", "def check_create_lti_provider_data_validity(create_lti_provider_data)\n schema = {\n 'type' => 'object',\n 'required' => %w(LaunchPoint Secret UseDefaultTcInfo Key Name\n Description ContactEmail SendTcInfo\n SendContextInfo SendUserId SendUserName SendUserEmail\n SendLinkTitle SendLinkDescription SendD2LUserName\n SendD2LOrgDefinedId SendD2LOrgRoleId),\n 'properties' =>\n {\n 'LaunchPoint' => { 'type' => 'string' },\n 'Secret' => { 'type' => 'string' },\n 'UseDefaultTcInfo' => { 'type' => 'string' },\n 'Key' => { 'type' => 'string' },\n 'Name' => { 'type' => 'string' },\n 'Description' => { 'type' => 'string' },\n 'ContactEmail' => { 'type' => 'string' },\n 'IsVisible' => { 'type' => 'boolean' },\n 'SendTcInfo' => { 'type' => 'boolean' }, # LE's 1.12+\n 'SendContextInfo' => { 'type' => 'boolean' }, # LE's 1.12+\n 'SendUserId' => { 'type' => 'boolean' }, # LE's 1.12+\n 'SendUserName' => { 'type' => 'boolean' }, # LE's 1.12+\n 'SendUserEmail' => { 'type' => 'boolean' }, # LE's 1.12+\n 'SendLinkTitle' => { 'type' => 'boolean' }, # LE's 1.12+\n 'SendLinkDescription' => { 'type' => 'boolean' }, # LE's 1.12+\n 'SendD2LUserName' => { 'type' => 'boolean' }, # LE's 1.12+\n 'SendD2LOrgDefinedId' => { 'type' => 'boolean' }, # LE's 1.12+\n 'SendD2LOrgRoleId' => { 'type' => 'boolean' } # LE's 1.12+\n }\n }\n JSON::Validator.validate!(schema, create_lti_provider_data, validate_schema: true)\nend", "def check_course_template_data_validity(course_template_data)\n schema = {\n 'type' => 'object',\n 'required' => %w(Name Code Path ParentOrgUnitIds),\n 'properties' => {\n 'Name' => { 'type' => 'string' },\n 'Code' => { 'type' => 'string' },\n 'Path' => { 'type' => 'string' },\n 'ParentOrgUnitIds' => {\n 'type' => 'array',\n 'items' => { 'type' => 'integer', 'minItems' => 1 }\n }\n }\n }\n JSON::Validator.validate!(schema, course_template_data, validate_schema: true)\nend", "def has_referential_integrity?\n tb = PROIEL::Treebank.new\n tb.load_from_xml(@filename)\n\n errors = []\n\n # Pass 1: keep track of all object IDs and look for duplicates\n sentence_ids = {}\n token_ids = {}\n\n tb.sources.each do |source|\n source.divs.each do |div|\n div.sentences.each do |sentence|\n errors << \"Repeated sentence ID #{sentence.id}\" if sentence_ids.key?(sentence.id)\n sentence_ids[sentence.id] = true\n\n sentence.tokens.each do |token|\n errors << \"Repeated token ID #{token.id}\" if token_ids.key?(token.id)\n token_ids[token.id] = { sentence: sentence.id, div: div.id, source: source.id }\n end\n end\n end\n end\n\n # Pass 2: check object ID references\n tb.sources.each do |source|\n source.tokens.each do |token|\n # Head IDs and slash IDs should be sentence internal\n check_reference_locality(errors, token, token_ids, :head_id, token.head_id, domain: :sentence, allow_nil: true)\n\n token.slashes.each do |_, target_id|\n check_reference_locality(errors, token, token_ids, :slash_id, target_id, domain: :sentence, allow_nil: false)\n end\n\n # Antecedent IDs should be source internal\n check_reference_locality(errors, token, token_ids, :antecedent_id, token.antecedent_id, domain: :source, allow_nil: true)\n end\n end\n\n # Pass 3: verify that all features are defined\n # TBD\n\n # Pass 4: alignment_id on div, sentence or token requires an alignment_id on source\n tb.sources.each do |source|\n if source.alignment_id.nil?\n if source.divs.any?(&:alignment_id) or source.sentences.any?(&:alignment_id) or source.tokens.any?(&:alignment_id)\n errors << \"Alignment ID(s) on divs, sentences or tokens without alignment ID on source\"\n end\n end\n end\n\n # Pass 5: if div is aligned, sentences and tokens within should belong\n # to aligned div(s); if sentence aligned, tokens within should belong\n # to aligned sentence(s). Skip if no alignment_id on source (see pass\n # 4) or if aligned source not available.\n if @aligned_filename\n aligned_tb = PROIEL::Treebank.new\n aligned_tb.load_from_xml(@aligned_filename)\n\n tb.sources.each do |source|\n if source.alignment_id\n aligned_source = aligned_tb.find_source(source.alignment_id)\n\n if aligned_source\n check_alignment_integrity(errors, source, aligned_source)\n else\n errors << \"Aligned source not available in treebank\"\n end\n end\n end\n end\n\n # Decide if there were any errors\n if errors.empty?\n true\n else\n @errors += errors\n\n false\n end\n end", "def verify_fields(fbe_struct_size)\n fbe_current_size = 4 + 4\n\n if (fbe_current_size + id.fbe_size) > fbe_struct_size\n return true\n end\n unless id.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += id.fbe_size\n\n if (fbe_current_size + name.fbe_size) > fbe_struct_size\n return true\n end\n unless name.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += name.fbe_size\n\n if (fbe_current_size + state.fbe_size) > fbe_struct_size\n return true\n end\n unless state.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += state.fbe_size\n\n if (fbe_current_size + wallet.fbe_size) > fbe_struct_size\n return true\n end\n unless wallet.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += wallet.fbe_size\n\n if (fbe_current_size + asset.fbe_size) > fbe_struct_size\n return true\n end\n unless asset.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += asset.fbe_size\n\n if (fbe_current_size + orders.fbe_size) > fbe_struct_size\n return true\n end\n unless orders.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += orders.fbe_size\n\n true\n end", "def verify_fields(fbe_struct_size)\n fbe_current_size = 4 + 4\n\n if (fbe_current_size + id.fbe_size) > fbe_struct_size\n return true\n end\n unless id.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += id.fbe_size\n\n if (fbe_current_size + symbol.fbe_size) > fbe_struct_size\n return true\n end\n unless symbol.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += symbol.fbe_size\n\n if (fbe_current_size + side.fbe_size) > fbe_struct_size\n return true\n end\n unless side.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += side.fbe_size\n\n if (fbe_current_size + type.fbe_size) > fbe_struct_size\n return true\n end\n unless type.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += type.fbe_size\n\n if (fbe_current_size + price.fbe_size) > fbe_struct_size\n return true\n end\n unless price.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += price.fbe_size\n\n if (fbe_current_size + volume.fbe_size) > fbe_struct_size\n return true\n end\n unless volume.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += volume.fbe_size\n\n true\n end", "def validate_object(item_hash)\n not_nil = [\"name\", \"item_type\", \"element\", \"register\", \"sell\", \"buy\", \"invent1\", \"invent2\"]\n stats = [\"atk\", \"def\", \"hit\", \"avd\", \"mag\", \"str\", \"vit\", \"agl\", \"int\", \"luk\", \"cost\", \"ap\"]\n stats.each do |stat|\n not_nil += (1..5).map {|x| \"#{stat}#{x}\"}\n end\n not_nil.delete(\"cost1\") #no cost for level 1.\n \n conditional_nil = []\n valid = true\n case item_hash[\"item_type\"]\n when \"Armour\", \"Ring\"\n not_nil += [\"absorb\", \"autoskill\", \"autoskill_slot_count\"]\n else\n not_nil += [\"range\", \"height\"]\n (1..4).each do |x|\n not_nil << \"weapon#{x}\"\n conditional_nil << \"weapon#{x}_level\"\n end\n end\n \n \n not_nil.each do |x|\n if item_hash[x].nil?\n valid = false\n puts \"Couldn't find #{x} in #{item_hash}\"\n end\n end\n conditional_nil.each do |x|\n if match = (/([\\w ]+)_level/.match(x)[1])\n if item_hash[match] != \"(nothing)\" and item_hash[x].nil?\n valid = false \n \"Couldn't find #{x} in #{item_hash}, but expected it\"\n end \n end\n end\n return valid\nend", "def structure_dump() end", "def vadidate_journal_line_items line_number, expected_gla_name, expected_amount , expected_dim1, expected_dim2, expected_dim3, expected_dim4\n\tgen_compare expected_gla_name,(JNL.line_get_journal_gla line_number),\"expected_gla_name at No. #{line_number} is #{expected_gla_name}\"\n\tgen_compare expected_amount,(JNL.line_get_journal_line_value line_number),\"expected_amount at No. #{line_number} is #{expected_amount}\"\n\tgen_compare expected_dim1,(JNL.line_get_journal_dimension1 line_number),\"expected_dim1 at No. #{line_number} is #{expected_dim1}\"\n\tgen_compare expected_dim2,(JNL.line_get_journal_dimension2 line_number),\"expected_dim2 at No. #{line_number} is #{expected_dim2}\"\n\tgen_compare expected_dim3,(JNL.line_get_journal_dimension3 line_number),\"expected_dim3 at No. #{line_number} is #{expected_dim3}\"\n\tgen_compare expected_dim4,(JNL.line_get_journal_dimension4 line_number),\"expected_dim4 at No. #{line_number} is #{expected_dim4}\"\nend", "def affi_object_well_formed(affi_object, name_list, parsed_complex, auth_id)\n # problem: affi_object nil\n if affi_object == nil\n puts \"\\n********************* Affiliation is nil **********************\\n\"\n print name_list\n # problem: missing country\n elsif affi_object.country == nil\n if parsed_complex == false\n printf(\"\\nAuthor %d affilition parsed as complex \\n\", auth_id)\n else\n printf(\"\\nAuthor %d affilition parse as single \\n\", auth_id)\n end\n print name_list\n puts \"\\n************************Missing country**********************\\n\"\n affi_object.print()\n return false\n # problem: missing name\n elsif affi_object.name == nil\n if parsed_complex == false\n printf(\"\\nAuthor %d affilition parsed as complex \\n\", auth_id)\n else\n printf(\"\\nAuthor %d affilition parse as single \\n\", auth_id)\n end\n print name_list\n puts \"\\n************************ Missing name **********************\\n\"\n affi_object.print()\n return false\n # problem: missing author or author_affiliation_id incorrect\nelsif affi_object.article_author_id == nil or \\\n affi_object.article_author_id != auth_id\n if parsed_complex == false\n printf(\"\\nAuthor %d affilition parsed as complex \\n\", auth_id)\n else\n printf(\"\\nAuthor %d affilition parse as single \\n\", auth_id)\n end\n print name_list\n puts \"\\n************************ Wrong Author ID **********************\\n\"\n affi_object.print()\n return false\n else\n return true\n end\nend", "def test_initialize_objects\n\t# assert_equal @w.nodes, 0\n\t# assert_equal @w.validWordList, 0\n\tassert_kind_of Graph, @w \n\tassert_kind_of Node, @n\n end", "def valid?\n return false if @identifier.nil?\n return false if @identifier.to_s.length > 25\n return false if @name.nil?\n return false if @name.to_s.length > 50\n return false if @status.nil?\n return false if @type.nil?\n return false if @address_line1.nil?\n return false if @address_line1.to_s.length > 50\n return false if !@address_line2.nil? && @address_line2.to_s.length > 50\n return false if !@city.nil? && @city.to_s.length > 50\n return false if !@state.nil? && @state.to_s.length > 50\n return false if !@zip.nil? && @zip.to_s.length > 12\n return false if !@phone_number.nil? && @phone_number.to_s.length > 30\n return false if !@fax_number.nil? && @fax_number.to_s.length > 30\n return false if !@website.nil? && @website.to_s.length > 255\n return false if !@account_number.nil? && @account_number.to_s.length > 100\n return false if !@lead_source.nil? && @lead_source.to_s.length > 50\n return false if !@user_defined_field1.nil? && @user_defined_field1.to_s.length > 50\n return false if !@user_defined_field2.nil? && @user_defined_field2.to_s.length > 50\n return false if !@user_defined_field3.nil? && @user_defined_field3.to_s.length > 50\n return false if !@user_defined_field4.nil? && @user_defined_field4.to_s.length > 50\n return false if !@user_defined_field5.nil? && @user_defined_field5.to_s.length > 50\n return false if !@user_defined_field6.nil? && @user_defined_field6.to_s.length > 50\n return false if !@user_defined_field7.nil? && @user_defined_field7.to_s.length > 50\n return false if !@user_defined_field8.nil? && @user_defined_field8.to_s.length > 50\n return false if !@user_defined_field9.nil? && @user_defined_field9.to_s.length > 50\n return false if !@user_defined_field10.nil? && @user_defined_field10.to_s.length > 50\n return true\n end", "def check_course_template_updated_data_validity(course_template_data)\n schema = {\n 'type' => 'object',\n 'required' => %w(Name Code),\n 'properties' => {\n 'Name' => { 'type' => 'string' },\n 'Code' => { 'type' => 'string' }\n }\n }\n JSON::Validator.validate!(schema, course_template_data, validate_schema: true)\nend", "def validate(new_block)\n previous_block = find_block_by_height(new_block.height - 1)\n\n # 1. Height.\n if previous_block&.height.to_i + 1 != new_block.height.to_i\n raise \"Height isn't valid\"\n end\n\n if previous_block.nil? == false\n # 2. Previous block hash\n if previous_block.block_header_hash != new_block.previous_block_header_hash\n raise \"Previous block header hash is wrong\"\n end\n\n # 2. Time: Can't be before the previous block.\n if previous_block.time > new_block.time\n raise \"New block can't have been created before the previous one\"\n end\n end\n\n # 3. Transactions: Wallets should only spend fund they own.\n new_block.transactions.each do |transaction|\n if WalletTransfer.find(transaction[\"id\"]).nil? == false\n raise \"A transaction with the same ID already exists on the blockchain\"\n end\n\n case transaction[\"message\"][\"type\"]\n when \"funds_transfer\"\n if valid_cryptography?(transaction) == false\n raise \"Cryptography of the transaction is invalid\"\n end\n\n # The amount + fee needs to be available to the wallet.\n if address_has_enough_funds?(transaction[\"message\"]) == false\n raise \"From address doesn't have enough funds\"\n end\n\n when \"mining_reward\"\n fees = new_block.transactions.reject { |t| t[\"message\"][\"type\"] == \"mining_reward\" }\n .map { |t| BigDecimal(t[\"message\"][\"fee\"]) }\n .reduce(&:+) || BigDecimal(0)\n\n mining_reward = BigDecimal(transaction[\"message\"][\"amount\"])\n if mining_reward != fees + 1\n raise \"Mining reward amount is invalid (#{mining_reward.to_s(\"F\")})\"\n end\n end\n end\n\n # 4. There should be exactly one mining reward transaction.\n mining_rewards = new_block.transactions.reject { |t| t[\"message\"][\"type\"] != \"mining_reward\" }\n if mining_rewards.size != 1\n raise \"Unexpected amount of mining rewards\"\n end\n\n # 5. Merkle tree root: Should be valid.\n merkle_root = MerkleTree.new(*new_block.transactions.map(&:to_json).sort { |a, b| a[\"id\"] <=> b[\"id\"] }).root.value\n if new_block.merkle_root != merkle_root\n raise \"Merkle root is invalid\"\n end\n\n # 6. Block hash: Is it valid and is the level of difficulty what's expected.\n if new_block.compute_block_header_hash != new_block.block_header_hash\n raise \"Block header hash is invalid\"\n end\n\n if new_block.block_header_hash[0, DIFFICULTY_LEVEL] != \"0\" * DIFFICULTY_LEVEL\n raise \"Block doesn't match expected difficulty level\"\n end\n end", "def construct_word(word, word_len, dict, twos=@@two_tiles, threes=@@three_tiles, fours=@@four_tiles)\n\t\n\t\tleftover = word_len - word.length\n\t\t\n\t\t# NOTE: I decided to repeat .each routines, as the alternative would mean passing a whole lot of variables to a routine that only executes a few lines of code. When changing one scenario, all other matching scenarios must be changed.\n\t\t# 0: A word of appropriate length has been found. All that remains is to search the dictionary.\n\t\t# 1: There will never be a scenario with one left-over. There are no tiles of length 1.\n\t\t# 2: The only tiles that will fit is of length 2. Only query 'twos'.\n\t\t# 3: The only tiles that will fit is of length 3.\n\t\t# 4: Valid tile placement includes tiles of length 2 and 4.\n\t\t# 5: Valid tile placement includes tiles of length 2 and 3.\n\t\t# 6+: Valid tile placement includes tiles of length 2, 3, and 4.\n\t\tcase leftover\n\t\t\twhen 0 \n\t\t\t\tif (dict.query(word))\n\t\t\t\t\t@@valid_combinations.push(word)\n\t\t\t\tend\n\t\t\twhen 2\n\t\t\t\ttwos.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_twos = twos - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, new_twos, threes, fours) \n\t\t\t\t}\n\t\t\twhen 3\n\t\t\t\tthrees.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_threes = threes - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, twos, new_threes, fours) \n\t\t\t\t}\n\t\t\twhen 4\n\t\t\t\ttwos.each { |tile|\n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_twos = twos - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, new_twos, threes, fours) \n\t\t\t\t}\n\t\t\t\tfours.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_fours = fours - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, twos, threes, new_fours) \n\t\t\t\t}\n\t\t\twhen 5\n\t\t\t\ttwos.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_twos = twos - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, new_twos, threes, fours) \n\t\t\t\t}\n\t\t\t\tthrees.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_threes = threes - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, twos, new_threes, fours) \n\t\t\t\t}\n\t\t\twhen 6..15\n\t\t\t\ttwos.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_twos = twos - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, new_twos, threes, fours) \n\t\t\t\t}\n\t\t\t\tthrees.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_threes = threes - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, twos, new_threes, fours) \n\t\t\t\t}\n\t\t\t\tfours.each { |tile| \n\t\t\t\t\tnew_word = word + tile.letters\n\t\t\t\t\tnew_fours = fours - [tile]\n\t\t\t\t\tconstruct_word(new_word, word_len, dict, twos, threes, new_fours) \n\t\t\t\t}\n\t\t\telse \n\t\t\t\tputs \"Leftover: \" << leftover.to_s\n\t\t\tend\n\t\t\n\tend", "def pre_conversion_sanity_check()\r\n # Do a dry run of the bug conversion checking the mappings between BugZilla and FogBugz fields\r\n # If the FB API allowed creation of things like projects and priorities, this wouldn't be necessary\r\n missing_fields = []\r\n\r\n @bz_reader.each_bug do |bz_bug|\r\n verify_field_mappings(bz_bug, missing_fields)\r\n end\r\n\r\n missing_fields\r\n end", "def degenerate?\n @structure.degenerate?\n end", "def valid?\n return false if !@external_id.nil? && @external_id.to_s.length > 64\n return false if !@first_name.nil? && @first_name.to_s.length > 128\n return false if @last_name.nil?\n return false if @last_name.to_s.length > 64\n return false if @last_name.to_s.length < 1\n return false if !@middle_name.nil? && @middle_name.to_s.length > 64\n gender_validator = EnumAttributeValidator.new('String', [\"M\", \"F\"])\n return false unless gender_validator.valid?(@gender)\n return false if !@language.nil? && @language.to_s.length > 32\n return false if !@phone.nil? && @phone.to_s.length > 64\n return false if !@email.nil? && @email.to_s.length > 128\n return false if !@doc_type.nil? && @doc_type.to_s.length > 32\n return false if !@doc_issuer_info.nil? && @doc_issuer_info.to_s.length > 256\n return false if !@doc_series.nil? && @doc_series.to_s.length > 64\n return false if !@doc_number.nil? && @doc_number.to_s.length > 64\n return false if !@department_code.nil? && @department_code.to_s.length > 64\n return false if !@department_name.nil? && @department_name.to_s.length > 256\n return false if !@building_no.nil? && @building_no.to_s.length > 8\n return false if !@city.nil? && @city.to_s.length > 32\n return false if !@country_code.nil? && @country_code.to_s.length > 8\n return false if !@country_name.nil? && @country_name.to_s.length > 64\n return false if !@district.nil? && @district.to_s.length > 64\n return false if !@flat_no.nil? && @flat_no.to_s.length > 8\n return false if !@house_no.nil? && @house_no.to_s.length > 16\n return false if !@region.nil? && @region.to_s.length > 64\n return false if !@room_no.nil? && @room_no.to_s.length > 8\n return false if !@settlement_type.nil? && @settlement_type.to_s.length > 32\n return false if !@street.nil? && @street.to_s.length > 64\n return false if !@raw_address.nil? && @raw_address.to_s.length > 512\n true\n end", "def test_good_block\r\n\t\ts = \"SYSTEM>Gaozu(100)\"\r\n\t\ttb = Block.new(\"0\", \"0\", s, \"1518893687.329767000\", \"fd18\")\r\n\t\t\r\n\t\tassert_equal 1, tb.validate_block\r\n\tend", "def test_what_is_said_in_specification\n WLang::dialect(\"specification\") do\n rules WLang::RuleSet::Basic\n rules WLang::RuleSet::Imperative\n end\n tests = [\n [\"*{authors as who}{${who}}{, }\", \"blambeau, llambeau, ancailliau\"],\n [\"*{authors as who}{${who}} {, }\", \"blambeaullambeauancailliau {, }\"],\n [\"*{authors as who} {${who}}{, }\", nil]\n ]\n context = {\"authors\" => [\"blambeau\", \"llambeau\", \"ancailliau\"]}\n \n tests.each do |test|\n template, expected = test\n if expected.nil?\n assert_raise WLang::ParseError do\n assert_equal(expected, template.wlang(context, \"specification\"))\n end\n else\n assert_equal(expected, template.wlang(context, \"specification\"))\n end\n end\n end", "def test_typecheck\n\t\tassert_raise( RuntimeError ) { Room.new(\"1\", \"2\", \"3\", 4, [], [], [], {}, {}) }\n\t\tassert_raise( RuntimeError ) { Room.new(1, 2, \"3\", 4, [], [], [], {}, {}) }\n\t\tassert_raise( RuntimeError ) { Room.new(1, \"2\", 3, 4, [], [], [], {}, {}) }\n\t\tassert_raise( RuntimeError ) { Room.new(1, \"2\", \"3\", \"4\", [], [], [], {}, {}) }\n\t\tassert_raise( RuntimeError ) { Room.new(1, \"2\", \"3\", 4, {}, [], [], {}, {}) }\n\t\tassert_raise( RuntimeError ) { Room.new(1, \"2\", \"3\", 4, [], {}, [], {}, {}) }\n\t\tassert_raise( RuntimeError ) { Room.new(1, \"2\", \"3\", 4, [], [], {}, {}, {}) }\n\t\tassert_raise( RuntimeError ) { Room.new(1, \"2\", \"3\", 4, [], [], [], [], {}) }\n\t\tassert_raise( RuntimeError ) { Room.new(1, \"2\", \"3\", 4, [], [], [], {}, []) }\n\t\tassert_raise( RuntimeError ) { @room.connect(\"2\", Direction::NORTH, Door.new(0)) }\n\t\tassert_raise( RuntimeError ) { @room.connect(2, \"Direction::NORTH\", Door.new(0)) }\n\t\tassert_raise( RuntimeError ) { @room.connect(2, Direction::NORTH, \"Door.new(0)\") }\n\tend", "def verify_fields(fbe_struct_size)\n fbe_current_size = 4 + 4\n\n if (fbe_current_size + byte0.fbe_size) > fbe_struct_size\n return true\n end\n unless byte0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += byte0.fbe_size\n\n if (fbe_current_size + byte1.fbe_size) > fbe_struct_size\n return true\n end\n unless byte1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += byte1.fbe_size\n\n if (fbe_current_size + byte2.fbe_size) > fbe_struct_size\n return true\n end\n unless byte2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += byte2.fbe_size\n\n if (fbe_current_size + byte3.fbe_size) > fbe_struct_size\n return true\n end\n unless byte3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += byte3.fbe_size\n\n if (fbe_current_size + byte4.fbe_size) > fbe_struct_size\n return true\n end\n unless byte4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += byte4.fbe_size\n\n if (fbe_current_size + byte5.fbe_size) > fbe_struct_size\n return true\n end\n unless byte5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += byte5.fbe_size\n\n if (fbe_current_size + char0.fbe_size) > fbe_struct_size\n return true\n end\n unless char0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += char0.fbe_size\n\n if (fbe_current_size + char1.fbe_size) > fbe_struct_size\n return true\n end\n unless char1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += char1.fbe_size\n\n if (fbe_current_size + char2.fbe_size) > fbe_struct_size\n return true\n end\n unless char2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += char2.fbe_size\n\n if (fbe_current_size + char3.fbe_size) > fbe_struct_size\n return true\n end\n unless char3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += char3.fbe_size\n\n if (fbe_current_size + char4.fbe_size) > fbe_struct_size\n return true\n end\n unless char4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += char4.fbe_size\n\n if (fbe_current_size + char5.fbe_size) > fbe_struct_size\n return true\n end\n unless char5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += char5.fbe_size\n\n if (fbe_current_size + wchar0.fbe_size) > fbe_struct_size\n return true\n end\n unless wchar0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += wchar0.fbe_size\n\n if (fbe_current_size + wchar1.fbe_size) > fbe_struct_size\n return true\n end\n unless wchar1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += wchar1.fbe_size\n\n if (fbe_current_size + wchar2.fbe_size) > fbe_struct_size\n return true\n end\n unless wchar2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += wchar2.fbe_size\n\n if (fbe_current_size + wchar3.fbe_size) > fbe_struct_size\n return true\n end\n unless wchar3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += wchar3.fbe_size\n\n if (fbe_current_size + wchar4.fbe_size) > fbe_struct_size\n return true\n end\n unless wchar4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += wchar4.fbe_size\n\n if (fbe_current_size + wchar5.fbe_size) > fbe_struct_size\n return true\n end\n unless wchar5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += wchar5.fbe_size\n\n if (fbe_current_size + int8b0.fbe_size) > fbe_struct_size\n return true\n end\n unless int8b0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int8b0.fbe_size\n\n if (fbe_current_size + int8b1.fbe_size) > fbe_struct_size\n return true\n end\n unless int8b1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int8b1.fbe_size\n\n if (fbe_current_size + int8b2.fbe_size) > fbe_struct_size\n return true\n end\n unless int8b2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int8b2.fbe_size\n\n if (fbe_current_size + int8b3.fbe_size) > fbe_struct_size\n return true\n end\n unless int8b3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int8b3.fbe_size\n\n if (fbe_current_size + int8b4.fbe_size) > fbe_struct_size\n return true\n end\n unless int8b4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int8b4.fbe_size\n\n if (fbe_current_size + int8b5.fbe_size) > fbe_struct_size\n return true\n end\n unless int8b5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int8b5.fbe_size\n\n if (fbe_current_size + uint8b0.fbe_size) > fbe_struct_size\n return true\n end\n unless uint8b0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint8b0.fbe_size\n\n if (fbe_current_size + uint8b1.fbe_size) > fbe_struct_size\n return true\n end\n unless uint8b1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint8b1.fbe_size\n\n if (fbe_current_size + uint8b2.fbe_size) > fbe_struct_size\n return true\n end\n unless uint8b2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint8b2.fbe_size\n\n if (fbe_current_size + uint8b3.fbe_size) > fbe_struct_size\n return true\n end\n unless uint8b3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint8b3.fbe_size\n\n if (fbe_current_size + uint8b4.fbe_size) > fbe_struct_size\n return true\n end\n unless uint8b4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint8b4.fbe_size\n\n if (fbe_current_size + uint8b5.fbe_size) > fbe_struct_size\n return true\n end\n unless uint8b5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint8b5.fbe_size\n\n if (fbe_current_size + int16b0.fbe_size) > fbe_struct_size\n return true\n end\n unless int16b0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int16b0.fbe_size\n\n if (fbe_current_size + int16b1.fbe_size) > fbe_struct_size\n return true\n end\n unless int16b1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int16b1.fbe_size\n\n if (fbe_current_size + int16b2.fbe_size) > fbe_struct_size\n return true\n end\n unless int16b2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int16b2.fbe_size\n\n if (fbe_current_size + int16b3.fbe_size) > fbe_struct_size\n return true\n end\n unless int16b3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int16b3.fbe_size\n\n if (fbe_current_size + int16b4.fbe_size) > fbe_struct_size\n return true\n end\n unless int16b4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int16b4.fbe_size\n\n if (fbe_current_size + int16b5.fbe_size) > fbe_struct_size\n return true\n end\n unless int16b5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int16b5.fbe_size\n\n if (fbe_current_size + uint16b0.fbe_size) > fbe_struct_size\n return true\n end\n unless uint16b0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint16b0.fbe_size\n\n if (fbe_current_size + uint16b1.fbe_size) > fbe_struct_size\n return true\n end\n unless uint16b1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint16b1.fbe_size\n\n if (fbe_current_size + uint16b2.fbe_size) > fbe_struct_size\n return true\n end\n unless uint16b2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint16b2.fbe_size\n\n if (fbe_current_size + uint16b3.fbe_size) > fbe_struct_size\n return true\n end\n unless uint16b3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint16b3.fbe_size\n\n if (fbe_current_size + uint16b4.fbe_size) > fbe_struct_size\n return true\n end\n unless uint16b4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint16b4.fbe_size\n\n if (fbe_current_size + uint16b5.fbe_size) > fbe_struct_size\n return true\n end\n unless uint16b5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint16b5.fbe_size\n\n if (fbe_current_size + int32b0.fbe_size) > fbe_struct_size\n return true\n end\n unless int32b0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int32b0.fbe_size\n\n if (fbe_current_size + int32b1.fbe_size) > fbe_struct_size\n return true\n end\n unless int32b1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int32b1.fbe_size\n\n if (fbe_current_size + int32b2.fbe_size) > fbe_struct_size\n return true\n end\n unless int32b2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int32b2.fbe_size\n\n if (fbe_current_size + int32b3.fbe_size) > fbe_struct_size\n return true\n end\n unless int32b3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int32b3.fbe_size\n\n if (fbe_current_size + int32b4.fbe_size) > fbe_struct_size\n return true\n end\n unless int32b4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int32b4.fbe_size\n\n if (fbe_current_size + int32b5.fbe_size) > fbe_struct_size\n return true\n end\n unless int32b5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int32b5.fbe_size\n\n if (fbe_current_size + uint32b0.fbe_size) > fbe_struct_size\n return true\n end\n unless uint32b0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint32b0.fbe_size\n\n if (fbe_current_size + uint32b1.fbe_size) > fbe_struct_size\n return true\n end\n unless uint32b1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint32b1.fbe_size\n\n if (fbe_current_size + uint32b2.fbe_size) > fbe_struct_size\n return true\n end\n unless uint32b2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint32b2.fbe_size\n\n if (fbe_current_size + uint32b3.fbe_size) > fbe_struct_size\n return true\n end\n unless uint32b3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint32b3.fbe_size\n\n if (fbe_current_size + uint32b4.fbe_size) > fbe_struct_size\n return true\n end\n unless uint32b4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint32b4.fbe_size\n\n if (fbe_current_size + uint32b5.fbe_size) > fbe_struct_size\n return true\n end\n unless uint32b5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint32b5.fbe_size\n\n if (fbe_current_size + int64b0.fbe_size) > fbe_struct_size\n return true\n end\n unless int64b0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int64b0.fbe_size\n\n if (fbe_current_size + int64b1.fbe_size) > fbe_struct_size\n return true\n end\n unless int64b1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int64b1.fbe_size\n\n if (fbe_current_size + int64b2.fbe_size) > fbe_struct_size\n return true\n end\n unless int64b2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int64b2.fbe_size\n\n if (fbe_current_size + int64b3.fbe_size) > fbe_struct_size\n return true\n end\n unless int64b3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int64b3.fbe_size\n\n if (fbe_current_size + int64b4.fbe_size) > fbe_struct_size\n return true\n end\n unless int64b4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int64b4.fbe_size\n\n if (fbe_current_size + int64b5.fbe_size) > fbe_struct_size\n return true\n end\n unless int64b5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int64b5.fbe_size\n\n if (fbe_current_size + uint64b0.fbe_size) > fbe_struct_size\n return true\n end\n unless uint64b0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint64b0.fbe_size\n\n if (fbe_current_size + uint64b1.fbe_size) > fbe_struct_size\n return true\n end\n unless uint64b1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint64b1.fbe_size\n\n if (fbe_current_size + uint64b2.fbe_size) > fbe_struct_size\n return true\n end\n unless uint64b2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint64b2.fbe_size\n\n if (fbe_current_size + uint64b3.fbe_size) > fbe_struct_size\n return true\n end\n unless uint64b3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint64b3.fbe_size\n\n if (fbe_current_size + uint64b4.fbe_size) > fbe_struct_size\n return true\n end\n unless uint64b4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint64b4.fbe_size\n\n if (fbe_current_size + uint64b5.fbe_size) > fbe_struct_size\n return true\n end\n unless uint64b5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint64b5.fbe_size\n\n true\n end", "def buildObject()\n case @x\n when 0\n attrX = $doorAttr[rand(6)]\n attrSX = $doorAttrS[rand(6)]\n @obj_pickable = false\n @combat_usability = false\n when 1\n attrX = $chestAttr[rand(3)]\n attrSX = $chestAttrS[rand(3)]\n @obj_pickable = false\n @combat_usability = false\n when 2\n attrX = $knifeAttr[rand(2)] \n attrSX = $knifeAttrS[rand(2)]\n @obj_pickable = true\n @combat_usability = true\n when 3\n attrX = $bodyAttr[rand(3)]\n attrSX = $bodyAttrS[rand(3)]\n @obj_pickable = true\n @combat_usability = true\n when 4\n attrX = $vialAttr[rand(3)]\n attrSX = $vialAttrS[rand(3)] \n @obj_pickable = true\n @combat_usability = true\n when 5\n attrX = $keyAttr[rand(2)] \n attrSX = $keyAttrS[rand(2)] \n @obj_pickable = true\n @combat_usability = false\n when 6\n attrX = $windowAttr[rand(5)] \n attrSX = $windowAttrS[rand(5)] \n @obj_pickable = false\n @combat_usability = false\n when 7\n attrX = $herbAttr[rand(3)]\n attrSX = $herbAttrS[rand(3)]\n @obj_pickable = true\n @combat_usability = true\n end\n \n @obj_name = @objX\n @obj_attr = attrX\n @obj_secondattr = attrSX\n end", "def createH2KSysType1( elements, sysType1Name )\n locationText = \"HouseFile/House/HeatingCooling/Type1\"\n\n elements[locationText].add_element(sysType1Name)\n if ( sysType1Name == \"Baseboards\" )\n locationText = \"HouseFile/House/HeatingCooling/Type1/Baseboards\"\n elements[locationText].add_element(\"EquipmentInformation\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Baseboards/EquipmentInformation\"\n elements[locationText].attributes[\"numberOfElectronicThermostats\"] = \"0\"\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/Baseboards\"\n elements[locationText].add_element(\"Specifications\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Baseboards/Specifications\"\n elements[locationText].attributes[\"sizingFactor\"] = \"1.1\"\n elements[locationText].attributes[\"efficiency\"] = \"100\"\n elements[locationText].add_element(\"OutputCapacity\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Baseboards/Specifications/OutputCapacity\"\n elements[locationText].attributes[\"code\"] = \"2\" # Calculated\n elements[locationText].attributes[\"value\"] = \"0\" # Calculated value - will be replaced!\n elements[locationText].attributes[\"uiUnits\"] = \"kW\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n elsif ( sysType1Name == \"Furnace\" )\n\n\n stream_out (\"ADDING FURNACE ....\\n\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace\"\n elements[locationText].add_element(\"EquipmentInformation\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace/EquipmentInformation\"\n elements[locationText].attributes[\"energystar\"] = \"false\"\n elements[locationText].add_element(\"Manufacturer\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace\"\n elements[locationText].add_element(\"Equipment\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace/Equipment\"\n elements[locationText].attributes[\"isBiEnergy\"] = \"false\"\n elements[locationText].attributes[\"switchoverTemperature\"] = \"0\"\n elements[locationText].add_element(\"EnergySource\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace/Equipment/EnergySource\"\n elements[locationText].attributes[\"code\"] = \"2\" # Gas\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace/Equipment\"\n elements[locationText].add_element(\"EquipmentType\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace/Equipment/EquipmentType\"\n elements[locationText].attributes[\"code\"] = \"1\" # Furnace with cont. pilot\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace\"\n elements[locationText].add_element(\"Specifications\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace/Specifications\"\n elements[locationText].attributes[\"sizingFactor\"] = \"1.1\"\n elements[locationText].attributes[\"efficiency\"] = \"78\"\n elements[locationText].attributes[\"isSteadyState\"] = \"true\"\n elements[locationText].attributes[\"pilotLight\"] = \"0\"\n elements[locationText].attributes[\"flueDiameter\"] = \"127\"\n elements[locationText].add_element(\"OutputCapacity\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Furnace/Specifications/OutputCapacity\"\n elements[locationText].attributes[\"code\"] = \"2\" # Calculated\n elements[locationText].attributes[\"value\"] = \"0\" # Calculated value - will be replaced!\n elements[locationText].attributes[\"uiUnits\"] = \"kW\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n elsif ( sysType1Name == \"Boiler\" )\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler\"\n elements[locationText].add_element(\"EquipmentInformation\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler/EquipmentInformation\"\n elements[locationText].attributes[\"energystar\"] = \"false\"\n elements[locationText].add_element(\"Manufacturer\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler\"\n elements[locationText].add_element(\"Equipment\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler/Equipment\"\n elements[locationText].attributes[\"isBiEnergy\"] = \"false\"\n elements[locationText].attributes[\"switchoverTemperature\"] = \"0\"\n elements[locationText].add_element(\"EnergySource\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler/Equipment/EnergySource\"\n elements[locationText].attributes[\"code\"] = \"2\" # Gas\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler/Equipment\"\n elements[locationText].add_element(\"EquipmentType\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler/Equipment/EquipmentType\"\n elements[locationText].attributes[\"code\"] = \"1\" # Boiler with cont. pilot\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler\"\n elements[locationText].add_element(\"Specifications\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler/Specifications\"\n elements[locationText].attributes[\"sizingFactor\"] = \"1.1\"\n elements[locationText].attributes[\"efficiency\"] = \"78\"\n elements[locationText].attributes[\"isSteadyState\"] = \"true\"\n elements[locationText].attributes[\"pilotLight\"] = \"0\"\n elements[locationText].attributes[\"flueDiameter\"] = \"127\"\n elements[locationText].add_element(\"OutputCapacity\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/Boiler/Specifications/OutputCapacity\"\n elements[locationText].attributes[\"code\"] = \"2\" # Calculated\n elements[locationText].attributes[\"value\"] = \"0\" # Calculated value - will be replaced!\n elements[locationText].attributes[\"uiUnits\"] = \"kW\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n elsif ( sysType1Name == \"ComboHeatDhw\" )\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw\"\n elements[locationText].add_element(\"EquipmentInformation\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/EquipmentInformation\"\n elements[locationText].attributes[\"energystar\"] = \"false\"\n elements[locationText].add_element(\"Manufacturer\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw\"\n elements[locationText].add_element(\"Equipment\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/Equipment\"\n elements[locationText].add_element(\"EnergySource\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/Equipment/EnergySource\"\n elements[locationText].attributes[\"code\"] = \"2\" # Gas\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/Equipment\"\n elements[locationText].add_element(\"EquipmentType\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/Equipment/EquipmentType\"\n elements[locationText].attributes[\"code\"] = \"1\" # ComboHeatDhw with cont. pilot\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw\"\n elements[locationText].add_element(\"Specifications\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/Specifications\"\n elements[locationText].attributes[\"sizingFactor\"] = \"1.1\"\n elements[locationText].attributes[\"efficiency\"] = \"78\"\n elements[locationText].attributes[\"isSteadyState\"] = \"true\"\n elements[locationText].attributes[\"pilotLight\"] = \"25.3\"\n elements[locationText].attributes[\"flueDiameter\"] = \"152.4\"\n elements[locationText].add_element(\"OutputCapacity\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/Specifications/OutputCapacity\"\n elements[locationText].attributes[\"code\"] = \"2\" # Calculated\n elements[locationText].attributes[\"value\"] = \"0\" # Calculated value - will be replaced!\n elements[locationText].attributes[\"uiUnits\"] = \"kW\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw\"\n elements[locationText].add_element(\"ComboTankAndPump\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/ComboTankAndPump\"\n elements[locationText].add_element(\"TankCapacity\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/ComboTankAndPump/TankCapacity\"\n elements[locationText].attributes[\"code\"] = \"3\"\n elements[locationText].attributes[\"value\"] = \"151.4\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/ComboTankAndPump\"\n elements[locationText].add_element(\"EnergyFactor\")\n elements[locationText].attributes[\"useDefaults\"] = \"true\"\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/ComboTankAndPump\"\n elements[locationText].add_element(\"TankLocation\")\n elements[locationText].attributes[\"code\"] = \"2\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/ComboHeatDhw/ComboTankAndPump\"\n elements[locationText].add_element(\"CirculationPump\")\n elements[locationText].attributes[\"isCalculated\"] = \"true\"\n elements[locationText].attributes[\"value\"] = \"0\"\n elements[locationText].attributes[\"hasEnergyEfficientMotor\"] = \"false\"\n\n elsif ( sysType1Name == \"P9\" )\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9\"\n elements[locationText].attributes[\"id\"] = \"0\"\n elements[locationText].attributes[\"numberOfSystems\"] = \"1\"\n elements[locationText].attributes[\"thermalPerformanceFactor\"] = \"0.9\"\n elements[locationText].attributes[\"annualElectricity\"] = \"1800\"\n elements[locationText].attributes[\"spaceHeatingCapacity\"] = \"23900\"\n elements[locationText].attributes[\"spaceHeatingEfficiency\"] = \"90\"\n elements[locationText].attributes[\"waterHeatingPerformanceFactor\"] = \"0.9\"\n elements[locationText].attributes[\"burnerInput\"] = \"0\"\n elements[locationText].attributes[\"recoveryEfficiency\"] = \"0\"\n elements[locationText].attributes[\"isUserSpecified\"] = \"true\"\n elements[locationText].add_element(\"EquipmentInformation\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/EquipmentInformation\"\n elements[locationText].add_element(\"Manufacturer\")\n elements[locationText].add_element(\"Model\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/EquipmentInformation/Manufacturer\"\n elements[locationText].text = \"Generic\"\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/EquipmentInformation/Model\"\n elements[locationText].text = \"Generic\"\n\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9\"\n elements[locationText].add_element(\"TestData\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/TestData\"\n elements[locationText].attributes[\"controlsPower\"] = \"10\"\n elements[locationText].attributes[\"circulationPower\"] = \"130\"\n elements[locationText].attributes[\"dailyUse\"] = \"0.2\"\n elements[locationText].attributes[\"standbyLossWithFan\"] = \"0\"\n elements[locationText].attributes[\"standbyLossWithoutFan\"] = \"0\"\n elements[locationText].attributes[\"oneHourRatingHotWater\"] = \"1000\"\n elements[locationText].attributes[\"oneHourRatingConcurrent\"] = \"1000\"\n elements[locationText].add_element(\"EnergySource\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/TestData/EnergySource\"\n elements[locationText].attributes[\"code\"] = \"2\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/TestData\"\n elements[locationText].add_element(\"NetEfficiency\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/TestData/NetEfficiency\"\n elements[locationText].attributes[\"loadPerformance15\"] = \"80\"\n elements[locationText].attributes[\"loadPerformance40\"] = \"80\"\n elements[locationText].attributes[\"loadPerformance100\"] = \"80\"\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/TestData\"\n elements[locationText].add_element(\"ElectricalUse\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/TestData/ElectricalUse\"\n elements[locationText].attributes[\"loadPerformance15\"] = \"100\"\n elements[locationText].attributes[\"loadPerformance40\"] = \"200\"\n elements[locationText].attributes[\"loadPerformance100\"] = \"300\"\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/TestData\"\n elements[locationText].add_element(\"BlowerPower\")\n locationText = \"HouseFile/House/HeatingCooling/Type1/P9/TestData/BlowerPower\"\n elements[locationText].attributes[\"loadPerformance15\"] = \"300\"\n elements[locationText].attributes[\"loadPerformance40\"] = \"500\"\n elements[locationText].attributes[\"loadPerformance100\"] = \"800\"\n end\nend", "def valid_attributes\n m = FactoryGirl.build(:lisa)\n {\n :full_name => m.full_name,\n :first_name => m.first_name,\n :last_name => m.last_name,\n :training_level => m.training_level,\n :portable_name => m.portable_name,\n :portable_number => m.portable_number,\n :email => m.email,\n :status => m.status,\n :password => m.password,\n :admin_hr => m.admin_hr,\n :admin_calendar => m.admin_calendar,\n :admin_root => m.admin_root,\n }\n end", "def verify_ref_1l_condition\n Unified835Output::BenignNull.new\n end", "def check_org_unit_data_validity(org_unit_data)\n schema = {\n 'type' => 'object',\n 'required' => %w(Type Name Code Parents),\n 'properties' => {\n 'Type' => { 'type' => 'integer' },\n 'Name' => { 'type' => 'string' },\n 'Code' => { 'type' => 'string' },\n 'Parents' => {\n 'type' => 'array',\n 'items' => { 'type' => 'integer', 'minItems' => 1 }\n }\n }\n }\n JSON::Validator.validate!(schema, org_unit_data, validate_schema: true)\nend", "def validate_data(description, author, artist, type, status, genres, release, html_name, alternative_names, rank, rating, rating_max, cover_xpath)\n Utils_file::dir_create(@dir)\n Utils_connection::write_cover(@manga_data[:index_page], cover_xpath, @dir + 'cover.jpg', @params[:manga_path] + @manga_data[:website][:dir] + 'mangas/' + @manga_data[:name] + '.jpg')\n File.open(@dir + 'description.txt', 'w') do |txt|\n txt << Utils_file::data_concatenation(@manga_data, Utils_file::description_manipulation(description), author, artist, type, status, genres, release, html_name, alternative_names)\n end\n @aff.data_disp(@manga_data[:in_db])\n if @manga_data[:in_db]\n @db.update_manga(@manga_data[:name], description, author, artist, genres, html_name, alternative_names, rank, rating, rating_max)\n else\n @db.add_manga(@manga_data, description, author, artist, type, status, genres, release, html_name, alternative_names, rank, rating, rating_max)\n end\n end", "def valid?\n return false unless valid_poly_t?\n return false unless p1 == p2\n ts = transcript.dup\n\n # check tx = <lx, rx> using inner product proof\n uks = []\n terms.each do |term|\n ts.points << term[:L]\n ts.points << term[:R]\n uks << ts.challenge_scalar(\"uk\")\n end\n\n q = GENERATOR_BJ * w\n lhs = p1 + q * tx\n l0 = terms.first[:L]\n r0 = terms.first[:R]\n u0 = uks.first\n u02 = FIELD.power(u0, 2)\n u02_inv = FIELD.inverse(u02)\n g_sum = vec_g.dup\n h_sum = vec_h2.dup\n i = 0\n until g_sum.length == 1\n g_hi = []\n g_lo = []\n h_hi = []\n h_lo = []\n half = g_sum.length / 2\n g_sum.each.with_index do |g, j|\n if j < half\n g_lo << g\n h_lo << h_sum[j]\n else\n g_hi << g\n h_hi << h_sum[j]\n end\n end\n g_sum = []\n h_sum = []\n u = uks[i]\n u_inv = FIELD.inverse(u)\n g_lo.each.with_index do |g, j|\n g_sum << (g * u_inv + g_hi[j] * u)\n h_sum << (h_lo[j] * u + h_hi[j] * u_inv)\n end\n i += 1\n end\n\n det = l0 * u02 + r0 * u02_inv\n terms[1..]\n .each\n .with_index(1) do |t, j|\n uj2 = FIELD.power(uks[j], 2)\n uj2_inv = FIELD.inverse(uj2)\n det = det + t[:L] * uj2 + t[:R] * uj2_inv\n end\n\n g0 = g_sum.first\n h0 = h_sum.first\n a0_b0 = FIELD.mod(a0 * b0)\n\n rhs = g0 * a0 + h0 * b0 + q * a0_b0 + det.negate\n lhs == rhs\n end", "def recurse(zipper, acc)\n if zipper.node.simple? or zipper.node.component?\n if zipper.node.invalid?\n if zipper.node.date?\n acc.ik403(zipper, \"R\", \"8\", \"is not a valid date\")\n elsif zipper.node.time?\n acc.ik403(zipper, \"R\", \"8\", \"is not a valid time\")\n elsif zipper.node.numeric?\n acc.ik403(zipper, \"R\", \"6\", \"is not a valid number\")\n else\n acc.ik403(zipper, \"R\", \"6\", \"is not a valid string\")\n end\n elsif zipper.node.blank?\n if zipper.node.usage.required?\n acc.ik403(zipper, \"R\", \"1\", \"must be present\")\n end\n elsif zipper.node.usage.forbidden?\n acc.ik403(zipper, \"R\", \"I10\", \"must not be present\")\n elsif not zipper.node.allowed?\n acc.ik403(zipper, \"R\", \"7\", \"is not an allowed value\")\n elsif zipper.node.too_long?\n acc.ik403(zipper, \"R\", \"5\", \"is too long\")\n elsif zipper.node.too_short?\n acc.ik403(zipper, \"R\", \"4\", \"is too short\")\n end\n\n elsif zipper.node.composite?\n if zipper.node.blank?\n if zipper.node.usage.required?\n acc.ik403(zipper, \"R\", \"1\", \"must be present\")\n end\n elsif zipper.node.usage.forbidden?\n acc.ik403(zipper, \"R\", \"I10\", \"must not be present\")\n else\n if zipper.node.present?\n zipper.children.each{|z| recurse(z, acc) }\n\n d = zipper.node.definition\n d.syntax_notes.each do |s|\n zs = syntax_note_errors(s, zipper)\n ex = s.reason(zipper) if zs.present?\n zs.each{|c| acc.ik403(c, \"R\", \"2\", ex) }\n end\n end\n end\n\n elsif zipper.node.repeated?\n zipper.children.each{|z| recurse(z, acc) }\n\n elsif zipper.node.segment?\n if zipper.node.valid?\n zipper.children.each do |element|\n recurse(element, acc)\n end\n\n zipper.node.definition.tap do |d_|\n d_.syntax_notes.each do |s|\n es = syntax_note_errors(s, zipper)\n ex = s.reason(zipper) if es.present?\n es.each{|c| acc.ik403(c, \"R\", \"2\", ex) }\n end\n end\n else\n acc.ik304(zipper, \"R\", \"2\", \"unexpected segment\")\n end\n\n elsif zipper.node.loop?\n group = Hash.new{|h,k| h[k] = [] }\n\n zipper.children.each do |child|\n # Child is either a segment or loop\n recurse(child, acc)\n\n if child.node.loop?\n group[child.node.definition] << child\n elsif child.node.valid?\n group[child.node.usage] << child\n end\n end\n\n # Though we're iterating the definition tree, we need to track\n # the last location before a required child was missing.\n last = zipper\n\n zipper.node.definition.children.each do |child|\n repeat = child.repeat_count\n matches = group.at(child)\n\n if matches.blank? and child.required?\n if child.loop?\n acc.ik304(last, \"R\", \"I7\", \"missing #{child.id} loop\")\n else\n acc.ik304(last, \"R\", \"3\", \"missing #{child.id} segment\")\n end\n elsif repeat < matches.length\n matches.drop(repeat.max).each do |c|\n if child.loop?\n acc.ik304(c, \"R\", \"4\", \"loop occurs too many times\")\n else\n acc.ik304(c, \"R\", \"5\", \"segment occurs too many times\")\n end\n end\n end\n\n last = matches.last unless matches.blank?\n end\n\n elsif zipper.node.table?\n group = Hash.new{|h,k| h[k] = [] }\n\n zipper.children.each do |child|\n # Child is either a segment or loop\n recurse(child, acc)\n\n if child.node.loop?\n group[child.node.definition] << child\n elsif child.node.valid?\n group[child.node.usage] << child\n end\n end\n\n # Though we're iterating the definition tree, we need to track\n # the last location before a required child was missing.\n last = zipper\n\n zipper.node.definition.children.each do |child|\n matches = group.at(child)\n repeat = child.repeat_count\n\n if matches.blank? and child.required?\n if child.loop?\n acc.ik304(last, \"R\", \"I7\", \"missing #{child.id} loop\")\n else\n acc.ik304(last, \"R\", \"3\", \"missing #{child.id} segment\")\n end\n elsif repeat < matches.length\n matches.drop(repeat.max).each do |c|\n if child.loop?\n acc.ik304(c, \"R\", \"4\", \"loop occurs too many times\")\n else\n acc.ik304(c, \"R\", \"5\", \"segment occurs too many times\")\n end\n end\n end\n\n last = matches.last unless matches.blank?\n end\n\n elsif zipper.node.transaction_set?\n group = Hash.new{|h,k| h[k] = [] }\n\n zipper.children.each do |table|\n recurse(table, acc)\n group[table.node.definition] << table\n end\n\n zipper.node.definition.tap do |d_|\n d_.table_defs.each do |table|\n # @todo: How do we know which tables are required? It isn't\n # obvious because some tables have more than one entry segment,\n # and perhaps each has a different requirement designator.\n end\n end\n end\n end", "def valid; end", "def update_structure\n # Check for errors.\n errors.add :type, I18n.t('activerecord.errors.models.tournament.attributes.type.changed') if type_changed?\n errors.add :start_time, I18n.t('activerecord.errors.models.tournament.attributes.start_time.changed') if start_time_changed? and start_time_was <= Time.now\n \n if started?\n errors.add :league, I18n.t('activerecord.errors.models.tournament.attributes.started.league') if league_changed?\n errors.add :start_time, I18n.t('activerecord.errors.models.tournament.attributes.started.start_time') if start_time_changed?\n errors.add :max_players, I18n.t('activerecord.errors.models.tournament.attributes.started.max_players') if max_players_changed?\n errors.add :registration_time, I18n.t('activerecord.errors.models.tournament.attributes.started.registration_time') if registration_time_changed?\n end\n\n if locked?\n errors.add :league, I18n.t('activerecord.errors.models.tournament.attributes.locked.league') if league_changed?\n errors.add :start_time, I18n.t('activerecord.errors.models.tournament.attributes.locked.start_time') if start_time_changed?\n errors.add :max_players, I18n.t('activerecord.errors.models.tournament.attributes.locked.max_players') if max_players_changed?\n errors.add :registration_time, I18n.t('activerecord.errors.models.tournament.attributes.locked.registration_time') if registration_time_changed?\n end\n\n raise ActiveRecord::Rollback unless errors.empty?\n \n if max_players_changed?\n destroy_structure\n reload\n create_structure\n waiting_players.where(player_accepted: true).each { |player| add_player(player) }\n end\n end", "def valid?\n return false if @name.nil?\n return false if @name.to_s.length > 30\n return false if @management_it_solution_type.nil?\n management_it_solution_type_validator = EnumAttributeValidator.new('String', [\"LevelPlatforms\", \"Kaseya\", \"NAble\", \"Continuum\", \"Custom\"])\n return false unless management_it_solution_type_validator.valid?(@management_it_solution_type)\n return false if !@management_solution_name.nil? && @management_solution_name.to_s.length > 30\n return false if !@management_server_url.nil? && @management_server_url.to_s.length > 200\n return false if !@webservice_override_url.nil? && @webservice_override_url.to_s.length > 200\n return false if !@portal_override_login_url.nil? && @portal_override_login_url.to_s.length > 200\n return false if !@global_login_username.nil? && @global_login_username.to_s.length > 50\n return false if !@global_login_password.nil? && @global_login_password.to_s.length > 50\n return false if !@n_able_username.nil? && @n_able_username.to_s.length > 50\n return false if !@n_able_password.nil? && @n_able_password.to_s.length > 50\n return false if !@continuum_api_username.nil? && @continuum_api_username.to_s.length > 100\n return false if !@continuum_api_password.nil? && @continuum_api_password.to_s.length > 100\n return false if !@level_api_username.nil? && @level_api_username.to_s.length > 100\n return false if !@level_api_password.nil? && @level_api_password.to_s.length > 100\n return false if !@level_var_domain.nil? && @level_var_domain.to_s.length > 100\n return true\n end", "def verify_fields(fbe_struct_size)\n fbe_current_size = 4 + 4\n\n if (fbe_current_size + currency.fbe_size) > fbe_struct_size\n return true\n end\n unless currency.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += currency.fbe_size\n\n if (fbe_current_size + amount.fbe_size) > fbe_struct_size\n return true\n end\n unless amount.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += amount.fbe_size\n\n true\n end", "def parse_file status, source_file_obj\n existing_structure = self.loop_item_type.present?\n\n # keep track of the errors\n status[:errors] = []\n\n # keep track of the line and column being analised, for error reporting.\n status[:line] = 0\n status[:column] = 0\n\n # save the headers and the items\n status[:headers] = []\n status[:items] = []\n\n # auxiliar hash, to avoid repetition\n created_items = {}\n\n # read the file into a table\n begin\n if File.open(source_file_obj.source.path, &:readline).match(/;/) == nil\n separator = ','\n else\n separator = ';'\n end\n\n table = CSV.read(source_file_obj.source.path, {\n :quote_char =>'\"',\n :col_sep =>separator,\n :row_sep =>:auto,\n :headers => :first_row\n })\n rescue => e\n status[:errors] << e.message\n return false\n end\n #get the headers\n status[:headers] = table.headers\n item_types = {}\n\n if !self.parse_source_headers(status, item_types, existing_structure)\n return false\n end\n\n default_language = self.questionnaire\n .questionnaire_fields\n .find_by_is_default_language(true)\n .language\n\n table.each do |row|\n status[:line] += 1\n\n # Start with parent as nil (because the first element of each line is the root of the nested set, and looping structure)\n # there is also an hierarchy between items.\n parent = nil\n\n # and then for each item of the row\n row_as_a = row.to_a\n\n row_as_a.each_index do |i| # row_as_a[i][0] => item_type ; row_as_a[i][1] => loop_item_names\n created_items[i.to_s] ||= {}\n\n if row_as_a[i][1].present? # if there's no name, there's no item\n the_val = row_as_a[i][1].squeeze(\" \").strip\n the_type = row_as_a[i][0].squeeze(\" \").strip\n the_type.slice!(0) if the_type[0] == '#'\n status[:column] += 1\n\n if existing_structure && (existing_item=(item_types[the_type].existing_item_with(the_val, parent, default_language)))\n parent = existing_item\n next\n end\n\n # loop_item_names in downcase for comparison purposes. So that the file doesn't need to be case sensitive.\n item_details = {:name => the_val.downcase, :parent => parent.nil? ? \"parent_empty\" : parent.id}\n item_hash = Digest::MD5.hexdigest(item_details.to_s)\n\n # check if item was previously added\n if created_items[i.to_s][item_hash]\n #set this item as the parent\n parent = LoopItem.find(created_items[i.to_s][item_hash])\n else # otherwise create a new item\n son = LoopItem.new()#:item_name => row_as_a[i][1].to_s)\n son.loop_item_type_id = item_types[the_type].id\n # set it's parent, if parent is defined, otherwise it will be a root item.\n if parent\n son.parent = parent\n end\n\n # handle loopItemNames. Find or create it and then add it to the loop_item and loop_item_type and loop_source\n begin\n l_item_name = item_types[the_type].loop_item_name_with(the_val, default_language, self)\n rescue ActiveRecord::RecordInvalid => e\n status[:errors] << \"ERROR: line #{status[:line]} and column #{status[:column]}. Check the character encoding of your file.\"\n next\n end\n son.loop_item_name = l_item_name\n\n # set sort_index => total loop_items before adding the new item to it, so that it is the index of the total of items[0 to total]\n # son.sort_index = item_types[the_type].loop_items.count #set the sort_index to be one more than the parent's. The default is zero, so the parent starts at zero.\n son.sort_index = item_types[the_type].loop_items.empty? ? 0 : item_types[the_type].loop_items.maximum(\"sort_index\") + 1\n\n # save the son\n if son.save\n #add the item to the hash of created items\n created_items[i.to_s][item_hash] = son.id\n status[:items] << son\n\n #redefine the parent for next iteration\n parent = son\n else\n status[:errors] << \"Problem in line \" + status[:line] + \", and column \" + status[:column]\n return false\n end\n end\n end\n end\n\n status[:column] = 0\n end\n end", "def sane_structure?\n structure.nil? || (structure.to_s =~ Structure::STRUCTURE_PATTERN && !ancestor_ids.include?(self.id))\n end", "def generate_yaml_object?\n generate! unless skip_for_generation?\n end", "def create_structure\n if File.exists?(\"features\") && File.directory?(\"features\")\n return\n else\n FileUtils.mkpath \"features/step_definitions\"\n FileUtils.mkdir \"features/support\"\n FileUtils.mkdir \"features/screenshots\"\n FileUtils.touch\"features/support/env.rb\"\n end\n \n\n end", "def valid?\n return false if !@adwords_grouping.nil? && @adwords_grouping.to_s.length > 50\n return false if !@adwords_label1.nil? && @adwords_label1.to_s.length > 50\n return false if !@adwords_label2.nil? && @adwords_label2.to_s.length > 50\n return false if !@adwords_label3.nil? && @adwords_label3.to_s.length > 50\n return false if !@adwords_label4.nil? && @adwords_label4.to_s.length > 50\n return false if !@adwords_label5.nil? && @adwords_label5.to_s.length > 50\n return false if !@age_group.nil? && @age_group.to_s.length > 5\n return false if !@book_author.nil? && @book_author.to_s.length > 50\n return false if !@book_format.nil? && @book_format.to_s.length > 50\n return false if !@book_isbn.nil? && @book_isbn.to_s.length > 20\n return false if !@book_publisher.nil? && @book_publisher.to_s.length > 50\n return false if !@category_description.nil? && @category_description.to_s.length > 1000\n return false if !@color.nil? && @color.to_s.length > 20\n return false if !@condition.nil? && @condition.to_s.length > 15\n return false if !@custom_label0.nil? && @custom_label0.to_s.length > 50\n return false if !@custom_label1.nil? && @custom_label1.to_s.length > 50\n return false if !@custom_label2.nil? && @custom_label2.to_s.length > 50\n return false if !@custom_label3.nil? && @custom_label3.to_s.length > 50\n return false if !@custom_label4.nil? && @custom_label4.to_s.length > 50\n return false if !@gender.nil? && @gender.to_s.length > 6\n return false if !@google_product_category.nil? && @google_product_category.to_s.length > 250\n return false if !@music_artist.nil? && @music_artist.to_s.length > 50\n return false if !@music_format.nil? && @music_format.to_s.length > 5\n return false if !@product_type.nil? && @product_type.to_s.length > 10\n return false if !@promotion_id1.nil? && @promotion_id1.to_s.length > 30\n return false if !@promotion_id10.nil? && @promotion_id10.to_s.length > 30\n return false if !@promotion_id2.nil? && @promotion_id2.to_s.length > 30\n return false if !@promotion_id3.nil? && @promotion_id3.to_s.length > 30\n return false if !@promotion_id4.nil? && @promotion_id4.to_s.length > 30\n return false if !@promotion_id5.nil? && @promotion_id5.to_s.length > 30\n return false if !@promotion_id6.nil? && @promotion_id6.to_s.length > 30\n return false if !@promotion_id7.nil? && @promotion_id7.to_s.length > 30\n return false if !@promotion_id8.nil? && @promotion_id8.to_s.length > 30\n return false if !@promotion_id9.nil? && @promotion_id9.to_s.length > 30\n return false if !@search_lowest_url.nil? && @search_lowest_url.to_s.length > 250\n return false if !@size.nil? && @size.to_s.length > 20\n return false if !@video_director.nil? && @video_director.to_s.length > 50\n return false if !@video_format.nil? && @video_format.to_s.length > 5\n return false if !@video_rating.nil? && @video_rating.to_s.length > 5\n return false if !@video_starring.nil? && @video_starring.to_s.length > 150\n true\n end", "def generate_check\n Output835.log.info \"\\n\\nCheck number : #{@check.check_number} undergoing processing\"\n transaction_segments =[ transaction_set_header, financial_info, reassociation_trace]\n\n transaction_segments << ref_ev_loop if @facility_output_config.details[:ref_ev_batchid]\n transaction_segments += [reciever_id, date_time_reference, payer_identification_loop,\n payee_identification_loop, reference_identification]\n transaction_segments << claim_loop if !@check.interest_only_check\n transaction_segments << provider_adjustment\n\n\n transaction_segments = transaction_segments.flatten.compact\n @se01[0] = transaction_segments.length + 1 if @se01\n transaction_segments << transaction_set_trailer(transaction_segments.length + 1)\n transaction_segments\n end", "def checkCreatePV( elements )\n if ( elements[\"HouseFile/House/Generation/PhotovoltaicSystems\"] == nil )\n locationText = \"HouseFile/House/Generation\"\n elements[locationText].add_element(\"PhotovoltaicSystems\")\n locationText = \"HouseFile/House/Generation/PhotovoltaicSystems\"\n elements[locationText].add_element(\"System\")\n locationText = \"HouseFile/House/Generation/PhotovoltaicSystems/System\"\n elements[locationText].attributes[\"rank\"] = \"1\"\n elements[locationText].add_element(\"EquipmentInformation\")\n elements[locationText].add_element(\"Array\")\n locationText = \"HouseFile/House/Generation/PhotovoltaicSystems/System/Array\"\n elements[locationText].attributes[\"area\"] = \"50\"\n elements[locationText].attributes[\"slope\"] = \"42\"\n elements[locationText].attributes[\"azimuth\"] = \"0\"\n\n locationText = \"HouseFile/House/Generation/PhotovoltaicSystems/System\"\n elements[locationText].add_element(\"Efficiency\")\n locationText = \"HouseFile/House/Generation/PhotovoltaicSystems/System/Efficiency\"\n elements[locationText].attributes[\"miscellaneousLosses\"] = \"3\"\n elements[locationText].attributes[\"otherPowerLosses\"] = \"1\"\n elements[locationText].attributes[\"inverterEfficiency\"] = \"90\"\n elements[locationText].attributes[\"gridAbsorptionRate\"] = \"90\"\n\n locationText = \"HouseFile/House/Generation/PhotovoltaicSystems/System\"\n elements[locationText].add_element(\"Module\")\n locationText = \"HouseFile/House/Generation/PhotovoltaicSystems/System/Module\"\n elements[locationText].attributes[\"efficiency\"] = \"13\"\n elements[locationText].attributes[\"cellTemperature\"] = \"45\"\n elements[locationText].attributes[\"coefficientOfEfficiency\"] = \"0.4\"\n elements[locationText].add_element(\"Type\")\n locationText = \"HouseFile/House/Generation/PhotovoltaicSystems/System/Module/Type\"\n elements[locationText].attributes[\"code\"] = \"1\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n end\nend", "def test_validation\n \n # Valid? - Yes\n pn = PartNumber.initial_part_number\n pcb_pn = '600-123-a0'.split('-')\n pcba_pn = '500-120-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n pn.pcb_revision = 'a'\n pn.pcba_prefix = pcba_pn[0]\n pn.pcba_number = pcba_pn[1]\n pn.pcba_dash_number = pcba_pn[2]\n pn.pcba_revision = 'a'\n \n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcba_number?)\n assert( pn.valid_pcba_prefix?)\n assert( pn.valid_pcba_dash_number?)\n assert( pn.valid_pcb_part_number?)\n assert( pn.valid_pcba_part_number?)\n assert( pn.valid_components?('new'=='new'))\n assert(!pn.error_message)\n \n # Valid? - No - PCB, PCBA part numbers are not unique.\n pcba_pn = '600-123-00'.split('-')\n pn.pcba_prefix = pcba_pn[0]\n pn.pcba_number = pcba_pn[1]\n pn.pcba_dash_number = pcba_pn[2]\n pn.pcba_revision = 'b'\n \n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcba_number?)\n assert( pn.valid_pcba_prefix?)\n assert( pn.valid_pcba_dash_number?)\n assert( pn.valid_pcb_part_number?)\n assert( pn.valid_pcba_part_number?)\n assert(!pn.valid_components?('new'=='new'))\n assert( pn.error_message)\n assert_equal('The PCB part number (600-123-a0 a) and the PCBA part number ' +\n \"(600-123-00 b) must be unique - YOUR PART NUMBER WAS NOT CREATED\",\n pn.error_message)\n \n\n # Valid? - No - Format bad, short prefix\n pcb_pn = '12-123-a0'.split('-')\n pcba_pn = '34-120-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcba_prefix = pcba_pn[0]\n assert( pn.valid_pcb_number?)\n assert(!pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcba_number?)\n assert(!pn.valid_pcba_prefix?)\n assert( pn.valid_pcba_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_pcba_part_number?)\n assert(!pn.valid_components?('new'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n\n # Valid? - No - Format bad, illegal characters in the prefix\n pcb_pn = '12e-123-a0'.split('-')\n pcba_pn = 'pcb-120-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcba_prefix = pcba_pn[0]\n assert( pn.valid_pcb_number?)\n assert(!pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcba_number?)\n assert(!pn.valid_pcba_prefix?)\n assert( pn.valid_pcba_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_pcba_part_number?)\n assert(!pn.valid_components?('new'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n # Valid? - No - Format bad, wrong number of characters in the number\n pcb_pn = '127-3-a0'.split('-')\n pcba_pn = '128-21-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcba_prefix = pcba_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcba_number = pcba_pn[1]\n assert(!pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert(!pn.valid_pcba_number?)\n assert( pn.valid_pcba_prefix?)\n assert( pn.valid_pcba_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_pcba_part_number?)\n assert(!pn.valid_components?('new'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n # Valid? - No - Format bad, illegal characters in the number\n pcb_pn = '127-###-a0'.split('-')\n pcba_pn = '128-JPA-00'.split('-')\n pn.pcb_number = pcb_pn[1]\n pn.pcba_number = pcba_pn[1]\n assert(!pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert(!pn.valid_pcba_number?)\n assert( pn.valid_pcba_prefix?)\n assert( pn.valid_pcba_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_pcba_part_number?)\n assert(!pn.valid_components?('new'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n # Valid? - No - Format bad, illegal characters in the dash number\n pcb_pn = '127-714-*'.split('-')\n pcba_pn = '128-755-!&'.split('-')\n pn.pcb_number = pcb_pn[1]\n pn.pcba_number = pcba_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n pn.pcba_dash_number = pcba_pn[2]\n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert(!pn.valid_pcb_dash_number?)\n assert( pn.valid_pcba_number?)\n assert( pn.valid_pcba_prefix?)\n assert(!pn.valid_pcba_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_pcba_part_number?)\n assert(!pn.valid_components?('new'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n # Valid? - Yes\n pcb_pn = '127-714-01'.split('-')\n pcba_pn = '128-755-a0'.split('-')\n pn.pcb_dash_number = pcb_pn[2]\n pn.pcba_dash_number = pcba_pn[2]\n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcba_number?)\n assert( pn.valid_pcba_prefix?)\n assert( pn.valid_pcba_dash_number?)\n assert( pn.valid_pcb_part_number?)\n assert( pn.valid_pcba_part_number?)\n assert( pn.valid_components?('new'=='new'))\n assert(!pn.error_message)\n\n # Valid? - Yes\n pn = PartNumber.initial_part_number\n pcb_pn = '600-123-a0'.split('-') \n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n\n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcb_part_number?)\n assert( pn.valid_components?('not'=='new'))\n assert(!pn.error_message)\n \n # Valid? - No, pcb pn exists.\n pcb_pn = '252-700-b0'.split('-') \n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n pn.pcb_revision = 'a'\n\n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcb_part_number?)\n assert(!pn.valid_components?('not'=='new'))\n assert_equal(@msg_pcb_exists_pcb, pn.error_message)\n \n # Valid? - No, pcb pn duplicates pcba pn \n pcb_pn = '259-700-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n pn.pcb_revision = 'b'\n\n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcb_part_number?)\n assert(!pn.valid_components?('not'=='new'))\n assert_equal(@msg_pcb_exists_pcba, pn.error_message)\n \n # Valid? - No, pcb pn prefix contains the wrong number of characters \n pcb_pn = '12-700-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n assert( pn.valid_pcb_number?)\n assert(!pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_components?('not'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n # Valid? - No, pcb pn prefix contains illegal characters \n pcb_pn = '12e-700-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n assert( pn.valid_pcb_number?)\n assert(!pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_components?('not'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n\n # Valid? - No, pcb pn number contains wrong number of characters \n pcb_pn = '127-3-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n assert(!pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_components?('not'=='new'))\n #assert_equal(@msg_format_error, pn.error_message)\n\n\n # Valid? - No, pcb pn number contains illegal characters \n pcb_pn = '127-#*@-00'.split('-')\n pn.pcb_number = pcb_pn[1]\n assert(!pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_components?('not'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n\n # Valid? - No, pcb pn dash number contains wrong number of, and illegal, characters \n pcb_pn = '127-714-@'.split('-')\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert(!pn.valid_pcb_dash_number?)\n assert(!pn.valid_pcb_part_number?)\n assert(!pn.valid_components?('not'=='new'))\n assert_equal(@msg_format_error, pn.error_message)\n\n # Valid? - Yes \n pcb_pn = '127-714-01'.split('-')\n pn.pcb_dash_number = pcb_pn[2]\n assert( pn.valid_pcb_number?)\n assert( pn.valid_pcb_prefix?)\n assert( pn.valid_pcb_dash_number?)\n assert( pn.valid_pcb_part_number?)\n assert( pn.valid_components?('not'=='new'))\n assert(!pn.error_message)\n \n \n assert(!pn.exists?)\n assert_nil(pn.error_message)\n pn.save\n assert(pn.exists?)\n assert_equal(@msg_pcb_exists_pcb, pn.error_message)\n\n assert(PartNumber.valid_prefix?('100'))\n assert(!PartNumber.valid_prefix?('1'))\n assert(!PartNumber.valid_prefix?('a'))\n assert(!PartNumber.valid_prefix?('10'))\n assert(!PartNumber.valid_prefix?('a7'))\n assert(!PartNumber.valid_prefix?('1aa'))\n assert(!PartNumber.valid_prefix?('a00'))\n assert(!PartNumber.valid_prefix?('1776'))\n assert(!PartNumber.valid_prefix?('a345'))\n \n assert(PartNumber.valid_number?('100'))\n assert(!PartNumber.valid_number?('1'))\n assert(!PartNumber.valid_number?('a'))\n assert(!PartNumber.valid_number?('10'))\n assert(!PartNumber.valid_number?('a7'))\n assert(!PartNumber.valid_number?('1aa'))\n assert(!PartNumber.valid_number?('a00'))\n assert(!PartNumber.valid_number?('1776'))\n assert(!PartNumber.valid_number?('a345'))\n \n assert(PartNumber.valid_dash_number?('a0'))\n assert(PartNumber.valid_dash_number?('0a'))\n assert(!PartNumber.valid_dash_number?('a'))\n assert(!PartNumber.valid_dash_number?('4'))\n assert(!PartNumber.valid_dash_number?('aa33'))\n assert(!PartNumber.valid_dash_number?('333'))\n \n # Create known part numbers for testing.\n pn = PartNumber.initial_part_number\n pcb_pn = '700-801-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n pn.save\n \n pn = PartNumber.initial_part_number\n pcb_pn = '700-802-00'.split('-')\n pcba_pn = '700-804-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n pn.pcba_prefix = pcba_pn[0]\n pn.pcba_number = pcba_pn[1]\n pn.pcba_dash_number = pcba_pn[2]\n pn.save\n \n pn = PartNumber.initial_part_number\n pcb_pn = '700-801-01'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n assert( pn.valid_components?('not'=='new'))\n assert(!pn.error_message)\n\n pn = PartNumber.initial_part_number\n pcb_pn = '700-804-00'.split('-')\n pn.pcb_prefix = pcb_pn[0]\n pn.pcb_number = pcb_pn[1]\n pn.pcb_dash_number = pcb_pn[2]\n assert(!pn.valid_components?('not'=='new'))\n assert( pn.error_message)\n assert_equal(@msg_pcb_exists_pcba, pn.error_message)\n \n pcba_pn = '700-900-90'.split('-')\n pn.pcba_prefix = pcba_pn[0]\n pn.pcba_number = pcba_pn[1]\n pn.pcba_dash_number = pcba_pn[2]\n pn.pcba_revision = 'b'\n assert(!pn.valid_components?('new'))\n assert( pn.error_message)\n assert_equal(@msg_pcb_exists_pcba, pn.error_message)\n \n \n pcba_pn = '000-000-00'.split('-')\n pn.pcba_prefix = pcba_pn[0]\n pn.pcba_number = pcba_pn[1]\n pn.pcba_dash_number = pcba_pn[2]\n pn.pcba_revision = 'a'\n assert(!pn.valid_components?('new'))\n assert( pn.error_message)\n assert_equal(@msg_pcb_exists_pcba, pn.error_message)\n \n end", "def generate_employement_information_structs(status_array, name, pos, tenure, phone, ext, email, addr, city, state_array, postal, url)\n Struct.new(\"EmploymentInformation\", :status, :name, :position, :tenure,\n :work_phone, :work_phone_ext, :work_email, :work_address,\n :work_city, :work_state, :work_postal_code, :social_media_url)\n\n leadsArray = []\n\n for status in status_array\n for state in state_array\n leadsArray.push(Struct::EmploymentInformation.new(status, name, pos, tenure, phone, ext, email, addr, city, state, postal, url))\n end\n end\n\n return leadsArray\nend", "def check_org_unit_updated_data_validity(org_unit_data)\n schema = {\n 'type' => 'object',\n 'required' => %w(Identifier Name Code Path Type),\n 'properties' => {\n 'Identifier' => { 'type' => 'string' },\n 'Name' => { 'type' => 'string' },\n 'Code' => { 'type' => 'string' },\n 'Path' => { 'type' => 'string' },\n 'Type' => {\n 'required' => %w(Id Code Name),\n 'properties' => {\n 'Id' => { 'type' => 'integer' },\n 'Code' => { 'type' => 'string' },\n 'Name' => { 'type' => 'string' }\n }\n }\n }\n }\n JSON::Validator.validate!(schema, org_unit_data, validate_schema: true)\nend", "def build\n if @scenarioYAML[\"STUDENT_COUNT\"]\n build_world_from_students\n #elsif !@scenarioYAML[\"SCHOOL_COUNT\"].nil?\n # build_world_from_edOrgs()\n # --> not supported yet\n else\n @log.error \"STUDENT_COUNT or SCHOOL_COUNT must be set for a world to be created --> Exiting...\"\n end\n @world\n end", "def build_world_from_students\n num_students = @scenarioYAML[\"STUDENT_COUNT\"]\n @log.info \"Creating world from initial number of students: #{num_students}\"\n\n # create grade breakdown from total number of students\n # populate education organization structure using breakdown (number of students per grade)\n # update structure with time information (create sessions using begin year and number of years)\n # expand school enrollment information using previously created session information\n # use time information to create master schedule (course offerings)\n # finally, write interchange\n compute_grade_breakdown(num_students)\n create_edOrgs_using_breakdown\n begin_year, num_years = add_time_information_to_edOrgs\n expand_student_counts_using_time_information(begin_year, num_years)\n\n create_master_schedule\n create_assessments(begin_year, num_years)\n create_descriptors\n create_learning_objectives\n create_work_orders\n end", "def test_hierarchical_loops\n want = <<~EDI.gsub(/\\n/, \"\")\n ST*856*0001~\n BSN*00*??*19700101*00000000*0001~\n DTM*011*19700101~\n HL*1**S~\n TD1*CTN*1****G*0.1773127753*LB~\n TD5*Z*2*??*ZZ*UPS3~\n REF*PK*?~\n DTM*011*19700101~\n N1*ST*Sweeney Todd~\n N3*2705 Fleet St~\n N4*Birmingham*AL*35226*US~\n HL*2*1*O~\n PRF*00000007397108***19700101~\n HL*3*2*P~\n MAN*SM*?~\n HL*4*3*I~\n LIN*1*UP*860001662184*VP*860001662184~\n SN1*1*1*EA**1*EA~\n SLN*1**O*1*EA*59.95*PE~\n CTT*2*159.85~\n SE*21*0001\n EDI\n store = Eddy::Data::Store.new(time: @epoch)\n ts = Eddy::TransactionSets::TS856::TS.new(store)\n ts.BSN do |bsn|\n bsn.BSN01 = \"00\"\n bsn.BSN02 = \"??\"\n bsn.BSN03 = @epoch\n bsn.BSN04 = @epoch\n bsn.BSN05 = \"0001\"\n end\n ts.DTM do |dtm|\n dtm.DateTimeQualifier = \"011\" # Shipped\n dtm.Date = @epoch\n end\n ts.HL_SHIPMENT do |hl_s|\n hl_s.HL.HL01 = \"1\"\n hl_s.HL.HL03 = \"S\"\n hl_s.TD1.TD101 = \"CTN\"\n hl_s.TD1.TD102 = 1\n hl_s.TD1.TD106 = \"G\"\n hl_s.TD1.TD107 = (80.5 / 454) # 0.1773127753\n hl_s.TD1.TD108 = \"LB\"\n hl_s.TD5.TD501 = \"Z\"\n hl_s.TD5.TD502 = \"2\"\n hl_s.TD5.TD503 = \"??\"\n hl_s.TD5.TD504 = \"ZZ\"\n hl_s.TD5.TD505 = \"UPS3\"\n hl_s.REF.REF01 = \"PK\"\n hl_s.REF.REF02 = \"?\"\n hl_s.DTM.DTM01 = \"011\" # Shipped\n hl_s.DTM.DTM02 = @epoch\n hl_s.L_N1 do |n1|\n # N1\n n1.N1.N101 = \"ST\"\n n1.N1.Name = \"Sweeney Todd\"\n # N3\n n1.N3.AddressInformation1 = \"2705 Fleet St\"\n # N4\n n1.N4.CityName = \"Birmingham\"\n n1.N4.StateOrProvinceCode = \"AL\"\n n1.N4.PostalCode = \"35226\"\n n1.N4.CountryCode = \"US\"\n end\n hl_s.HL_ORDER do |hl_o|\n hl_o.HL.HL01 = \"2\"\n hl_o.HL.HL02 = \"1\"\n hl_o.HL.HL03 = \"O\"\n hl_o.PRF.PRF01 = \"00000007397108\"\n hl_o.PRF.PRF04 = @epoch\n end\n hl_s.HL_TARE do |hl_t|\n hl_t.HL.HL01 = \"3\"\n hl_t.HL.HL02 = \"2\"\n hl_t.HL.HL03 = \"P\"\n hl_t.MAN.MAN01 = \"SM\"\n hl_t.MAN.MAN02 = \"?\"\n end\n hl_s.HL_ITEM do |hl_i|\n hl_i.HL.HL01 = \"4\"\n hl_i.HL.HL02 = \"3\"\n hl_i.HL.HL03 = \"I\"\n hl_i.LIN.LIN01 = \"1\"\n hl_i.LIN.LIN02 = \"UP\"\n hl_i.LIN.LIN03 = \"860001662184\"\n hl_i.LIN.LIN04 = \"VP\"\n hl_i.LIN.LIN05 = \"860001662184\"\n hl_i.SN1.SN101 = \"1\"\n hl_i.SN1.SN102 = 1\n hl_i.SN1.SN103 = \"EA\"\n hl_i.SN1.SN105 = 1\n hl_i.SN1.SN106 = \"EA\"\n hl_i.L_SLN do |rep|\n rep.SLN.SLN01 = \"1\"\n rep.SLN.SLN03 = \"O\"\n rep.SLN.SLN04 = 1\n rep.SLN.SLN05 = \"EA\"\n rep.SLN.SLN06 = 59.95\n rep.SLN.SLN07 = \"PE\"\n end\n end\n end\n ts.CTT do |ctt|\n ctt.CTT01 = 2\n ctt.CTT02 = 159.85\n end\n result = ts.render()\n assert_equal(want, result)\n end", "def check\n \n end", "def check\n \n end", "def compatible?(another_definition)\n @errors = []\n @warnings = []\n\n @finding = FHIR::StructureDefinitionFinding.new\n @finding.resourceType = snapshot.element[0].path\n @finding.profileIdA = id\n @finding.profileIdB = another_definition.id if another_definition.respond_to?(:id)\n\n if !(another_definition.is_a? FHIR::StructureDefinition)\n @errors << @finding.error('', '', 'Not a StructureDefinition', 'StructureDefinition', another_definition.class.name.to_s)\n return false\n elsif another_definition.snapshot.element[0].path != snapshot.element[0].path\n @errors << @finding.error('', '', 'Incompatible resourceType', @finding.resourceType, another_definition.snapshot.element[0].path.to_s)\n return false\n end\n\n left_elements = Array.new(snapshot.element)\n right_elements = Array.new(another_definition.snapshot.element)\n\n left_paths = left_elements.map(&:path)\n right_paths = right_elements.map(&:path)\n\n # StructureDefinitions don't always include all base attributes (for example, of a ContactPoint)\n # if nothing is modified from the base definition, so we have to add them in if they are missing.\n base_definition = FHIR::Definitions.get_resource_definition(snapshot.element[0].path)\n base_elements = base_definition.snapshot.element\n\n left_missing = right_paths - left_paths\n # left_missing_roots = left_missing.map{|e| e.split('.')[0..-2].join('.') }.uniq\n add_missing_elements(id, left_missing, left_elements, base_elements)\n\n right_missing = left_paths - right_paths\n # right_missing_roots = right_missing.map{|e| e.split('.')[0..-2].join('.') }.uniq\n add_missing_elements(another_definition.id, right_missing, right_elements, base_elements)\n\n # update paths\n left_paths = left_elements.map(&:path)\n right_paths = right_elements.map(&:path)\n\n # recalculate the missing attributes\n left_missing = right_paths - left_paths\n right_missing = left_paths - right_paths\n\n # generate warnings for missing fields (ignoring extensions)\n left_missing.each do |e|\n next if e.include? 'extension'\n elem = get_element_by_path(e, right_elements)\n if !elem.min.nil? && elem.min > 0\n @errors << @finding.error(e, 'min', 'Missing REQUIRED element', 'Missing', elem.min.to_s)\n elsif elem.isModifier == true\n @errors << @finding.error(e, 'isModifier', 'Missing MODIFIER element', 'Missing', elem.isModifier.to_s)\n else\n @warnings << @finding.warning(e, '', 'Missing element', 'Missing', 'Defined')\n end\n end\n right_missing.each do |e|\n next if e.include? 'extension'\n elem = get_element_by_path(e, left_elements)\n if !elem.min.nil? && elem.min > 0\n @errors << @finding.error(e, 'min', 'Missing REQUIRED element', elem.min.to_s, 'Missing')\n elsif elem.isModifier == true\n @errors << @finding.error(e, 'isModifier', 'Missing MODIFIER element', elem.isModifier.to_s, 'Missing')\n else\n @warnings << @finding.warning(e, '', 'Missing element', 'Defined', 'Missing')\n end\n end\n\n left_extensions = []\n right_extensions = []\n\n # compare elements, starting with the elements in this definition\n left_elements.each do |x|\n if x.path.include? 'extension'\n # handle extensions separately\n left_extensions << x\n else\n y = get_element_by_path(x.path, right_elements)\n compare_element_definitions(x, y, another_definition)\n end\n end\n\n # now compare elements defined in the other definition, if we haven't already looked at them\n right_elements.each do |y|\n if y.path.include? 'extension'\n # handle extensions separately\n right_extensions << y\n elsif left_missing.include? y.path\n x = get_element_by_path(y.path, left_elements)\n compare_element_definitions(x, y, another_definition)\n end\n end\n\n # finally, compare the extensions.\n checked_extensions = []\n left_extensions.each do |x|\n y = get_extension(x.name, right_extensions)\n unless y.nil?\n # both profiles share an extension with the same name\n checked_extensions << x.name\n compare_extension_definition(x, y, another_definition)\n end\n y = get_extension(x.type[0].profile, right_extensions)\n next unless !y.nil? && x.name != y.name\n # both profiles share the same extension definition but with a different name\n checked_extensions << x.name\n checked_extensions << y.name\n compare_element_definitions(x, y, another_definition)\n end\n right_extensions.each do |y|\n next if checked_extensions.include?(y.name)\n x = get_extension(y.name, left_extensions)\n unless x.nil?\n # both profiles share an extension with the same name\n checked_extensions << y.name\n compare_extension_definition(x, y, another_definition)\n end\n x = get_extension(y.type[0].profile, left_extensions)\n next unless !x.nil? && x.name != y.name && !checked_extensions.include?(x.name)\n # both profiles share the same extension definition but with a different name\n checked_extensions << x.name\n checked_extensions << y.name\n compare_element_definitions(x, y, another_definition)\n end\n @errors.flatten!\n @warnings.flatten!\n @errors.size.zero?\n end", "def valid_relation_literal!(heading, tuples, raise_on_error = true)\n if Array === tuples\n invalid = tuples.find{|t| !valid_tuple_literal?(heading, t)}\n if invalid\n raise_on_error ? raise(::Veritas::RelationMismatchError, \"Invalid tuple #{invalid.inspect} for heading #{heading}\", caller) : false\n else\n tuples\n end\n else\n raise_on_error ? raise(::Veritas::RelationMismatchError, \"Invalid relation literal #{tuples.inspect}\", caller) : false \n end\n end", "def check_attributes\n if (@values == nil)\n puts \"Specify necessary informations: \"\n get_input_values\n @additions = Array.new()\n end\n #check_time_string\n end", "def test_create_dict_initialize\n refute_nil @grapher.create_dict 'wordlist.txt'\n end", "def valid_person\n @person ||= StateLegislator.new(state: @metadatum.abbreviation)\n @person.id = 'VTL000008'\n @person.save!\n @person\n end", "def test_headlines_verify_tree_data\n page = Wiki::Api::Page.new name: \"program\"\n headline = page.root_headline\n # get root\n assert headline.name == \"program\", \"expected program name\"\n\n # iterate one deep and verify headline index names\n headline.headlines.each do |name, headline|\n assert headline.name == name\n end\n headlines = headline.headlines.values\n\n # English\n english_headlines = headlines[0]\n assert english_headlines.name == \"English\"\n english_headlines = english_headlines.headlines.values\n assert english_headlines[0].name == \"Alternative_forms\"\n assert english_headlines[1].name == \"Etymology\"\n assert english_headlines[2].name == \"Pronunciation\"\n assert english_headlines[3].name == \"Noun\"\n noun_english_headlines = english_headlines[3].headlines.values\n assert noun_english_headlines[0].name == \"Usage_notes\"\n assert noun_english_headlines[1].name == \"Synonyms\"\n assert noun_english_headlines[2].name == \"Translations\"\n assert english_headlines[4].name == \"Verb\"\n verb_english_headlines = english_headlines[4].headlines.values\n assert verb_english_headlines[0].name == \"Related_terms\"\n assert verb_english_headlines[1].name == \"Translations_2\"\n assert english_headlines[5].name == \"External_links\"\n\n # Czech\n czech_headlines = headlines[1]\n assert czech_headlines.name == \"Czech\"\n czech_headlines = czech_headlines.headlines.values\n assert czech_headlines[0].name == \"Pronunciation_2\"\n assert czech_headlines[1].name == \"Noun_2\"\n\n # Hungarian\n hungarian_headlines = headlines[2]\n assert hungarian_headlines.name == \"Hungarian\"\n hungarian_headlines = hungarian_headlines.headlines.values\n assert hungarian_headlines[0].name == \"Pronunciation_3\"\n assert hungarian_headlines[1].name == \"Noun_3\"\n noun_hungarian_headlines = hungarian_headlines[1].headlines.values\n assert noun_hungarian_headlines[0].name == \"Declension\"\n assert noun_hungarian_headlines[1].name == \"Derived_terms\"\n\n # Norwegian\n norwegian_headlines = headlines[3]\n assert norwegian_headlines.name == \"Norwegian_Bokm.C3.A5l\"\n norwegian_headlines = norwegian_headlines.headlines.values\n assert norwegian_headlines[0].name == \"Noun_4\"\n\n # Romanian\n romanian_headlines = headlines[4]\n assert romanian_headlines.name == \"Romanian\"\n romanian_headlines = romanian_headlines.headlines.values\n assert romanian_headlines[0].name == \"Etymology_2\"\n assert romanian_headlines[1].name == \"Noun_5\"\n noun_romanian_headlines = romanian_headlines[1].headlines.values\n assert noun_romanian_headlines[0].name == \"Declension_2\"\n assert noun_romanian_headlines[1].name == \"Related_terms_2\"\n\n # Serbo-Croatian\n serb_croatian_headlines = headlines[5]\n assert serb_croatian_headlines.name == \"Serbo-Croatian\"\n serb_croatian_headlines = serb_croatian_headlines.headlines.values\n assert serb_croatian_headlines[0].name == \"Noun_6\"\n noun_serb_croatian_headlines = serb_croatian_headlines[0].headlines.values\n assert noun_serb_croatian_headlines[0].name == \"Declension_3\"\n\n # Slovak\n slovak_headlines = headlines[6]\n assert slovak_headlines.name == \"Slovak\"\n slovak_headlines = slovak_headlines.headlines.values\n assert slovak_headlines[0].name == \"Noun_7\"\n\n # Swedish\n swedish_headlines = headlines[7]\n assert swedish_headlines.name == \"Swedish\"\n swedish_headlines = swedish_headlines.headlines.values\n assert swedish_headlines[0].name == \"Etymology_3\"\n assert swedish_headlines[1].name == \"Noun_8\"\n noun_swedish_headlines = swedish_headlines[1].headlines.values\n assert noun_swedish_headlines[0].name == \"Declension_4\"\n\n # Turkish\n turkish_headlines = headlines[8]\n assert turkish_headlines.name == \"Turkish\"\n turkish_headlines = turkish_headlines.headlines.values\n assert turkish_headlines[0].name == \"Etymology_4\"\n assert turkish_headlines[1].name == \"Noun_9\"\n noun_turkish_headlines = turkish_headlines[1].headlines.values\n assert noun_turkish_headlines[0].name == \"Declension_5\"\n\n end", "def createHRV( elements )\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList\"\n elements[locationText].add_element(\"Hrv\")\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv\"\n elements[locationText].attributes[\"supplyFlowrate\"] = \"60\"\n elements[locationText].attributes[\"exhaustFlowrate\"] = \"60\"\n elements[locationText].attributes[\"fanPower1\"] = \"123.7\"\n elements[locationText].attributes[\"isDefaultFanpower\"] = \"true\"\n elements[locationText].attributes[\"isEnergyStar\"] = \"false\"\n elements[locationText].attributes[\"isHomeVentilatingInstituteCertified\"] = \"false\"\n elements[locationText].attributes[\"isSupplemental\"] = \"false\"\n elements[locationText].attributes[\"temperatureCondition1\"] = \"0\"\n elements[locationText].attributes[\"temperatureCondition2\"] = \"-25\"\n elements[locationText].attributes[\"fanPower2\"] = \"145.6\"\n elements[locationText].attributes[\"efficiency1\"] = \"64\"\n elements[locationText].attributes[\"efficiency2\"] = \"64\"\n elements[locationText].attributes[\"preheaterCapacity\"] = \"0\"\n elements[locationText].attributes[\"lowTempVentReduction\"] = \"0\"\n elements[locationText].attributes[\"coolingEfficiency\"] = \"25\"\n elements[locationText].add_element(\"EquipmentInformation\")\n elements[locationText].add_element(\"VentilatorType\")\n\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/VentilatorType\"\n elements[locationText].attributes[\"code\"] = \"1\" # HRV\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv\"\n elements[locationText].add_element(\"ColdAirDucts\")\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/ColdAirDucts\"\n elements[locationText].add_element(\"Supply\")\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/ColdAirDucts/Supply\"\n elements[locationText].attributes[\"length\"] = \"1.5\"\n elements[locationText].attributes[\"diameter\"] = \"152.4\"\n elements[locationText].attributes[\"insulation\"] = \"0.7\"\n elements[locationText].add_element(\"Location\")\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/ColdAirDucts/Supply/Location\"\n elements[locationText].attributes[\"code\"] = \"4\" # Main Floor\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/ColdAirDucts/Supply\"\n elements[locationText].add_element(\"Type\")\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/ColdAirDucts/Supply/Type\"\n elements[locationText].attributes[\"code\"] = \"1\" # Flexible\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/ColdAirDucts/Supply\"\n elements[locationText].add_element(\"Sealing\")\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/ColdAirDucts/Supply/Sealing\"\n elements[locationText].attributes[\"code\"] = \"2\" # Sealed\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/ColdAirDucts\"\n elements[locationText].add_element(\"Exhaust\")\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/ColdAirDucts/Exhaust\"\n elements[locationText].attributes[\"length\"] = \"1.5\"\n elements[locationText].attributes[\"diameter\"] = \"152.4\"\n elements[locationText].attributes[\"insulation\"] = \"0.7\"\n elements[locationText].add_element(\"Location\")\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/ColdAirDucts/Exhaust/Location\"\n elements[locationText].attributes[\"code\"] = \"4\" # Main Floor\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/ColdAirDucts/Exhaust\"\n elements[locationText].add_element(\"Type\")\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/ColdAirDucts/Exhaust/Type\"\n elements[locationText].attributes[\"code\"] = \"1\" # Flexible\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/ColdAirDucts/Exhaust\"\n elements[locationText].add_element(\"Sealing\")\n locationText = \"HouseFile/House/Ventilation/WholeHouseVentilatorList/Hrv/ColdAirDucts/Exhaust/Sealing\"\n elements[locationText].attributes[\"code\"] = \"2\" # Sealed\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\nend", "def create_structure\n # Create variables table\n @db.execute(\"create table if not exists variables(key varchar(255) PRIMARY KEY, value TEXT);\");\n\n # Create quotes table\n @db.execute(\"create table if not exists quotes (id INTEGER PRIMARY KEY, quote TEXT);\")\n\n # Remember NSFW links\n @db.execute(\"create table if not exists nsfwlink_status (id INTEGER PRIMARY KEY, user VARCHAR(15), nsfw TINYINT DEFAULT 0);\")\n\n # Allow polls\n @poll_db.execute(\"create table if not exists polls (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user VARCHAR(30), question VARCHAR(255), date TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL)\")\n\n # Voting alternatives for polls\n @poll_db.execute(\"create table if not exists answers (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, poll_id INTEGER REFERENCES polls(id), number INTEGER, answer VARCHAR(255));\")\n\n # Votes for polls\n @poll_db.execute(\"create table if not exists votes (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, usermask VARCHAR(255), poll_id INTEGER REFERENCES polls(id), answer_id INTEGER REFERENCES answers(id));\")\n\n\n if @debug == true\n puts \"Should have created tables by now\"\n end\n end", "def create_structure\n # Create the words table\n @db.execute(\"create table if not exists words (id INTEGER PRIMARY KEY, word varchar(50) UNIQUE NOT NULL);\")\n\n # Create the wordpair table\n @db.execute(\"create table if not exists pairs (id INTEGER PRIMARY KEY, word_id INTEGER(8), pair_id INTEGER(8), occurance INTEGER(10) DEFAULT 1 NOT NULL, question_suffix INTEGER DEFAULT 0 NOT NULL, comma_suffix INTEGER DEFAULT 0 NOT NULL, dot_suffix INTEGER DEFAULT 0 NOT NULL, exclamation_suffix INTEGER DEFAULT 0 NOT NULL);\")\n\n # Create our tripair table\n @db.execute(\"create table if not exists tripairs (id INTEGER PRIMARY KEY, first_id INTEGER(8), second_id INTEGER(8), third_id INTEGER(8), occurance INTEGER(10) DEFAULT 1 NOT NULL, question_suffix INTEGER DEFAULT 0 NOT NULL, comma_suffix INTEGER DEFAULT 0 NOT NULL, dot_suffix INTEGER DEFAULT 0 NOT NULL, exclamation_suffix INTEGER DEFAULT 0 NOT NULL);\")\n\n # Create the nouns table (for context)\n @db.execute(\"create table if not exists nouns (id INTEGER PRIMARY KEY, noun VARCHAR(50) UNIQUE NOT NULL);\")\n\n # Create table linking nouns and pairs\n @db.execute(\"create table if not exists context (id INTEGER PRIMARY KEY, noun_id INTEGER, pair_identifier INTEGER);\")\n\n # Create emotion-table linking emotions to words\n @db.execute(\"create table if not exists pair_emotions (id INTEGER PRIMARY KEY, pair_id INTEGER, emotion_index INTEGER, tripair TINYINT);\")\n\n # Create statistics table\n @db.execute(\"create table if not exists statistics (id INTEGER PRIMARY KEY, user VARCHAR(15), lines INTEGER DEFAULT 1, words INTEGER DEFAULT 0);\")\n\n # Create last seen table\n @db.execute(\"create table if not exists last_seen (user VARCHAR(50) PRIMARY KEY, seen_at DATETIME);\")\n\n # Create last seen table\n @db.execute(\"create table if not exists greetings (id INTEGER PRIMARY KEY, greet VARCHAR(255), user VARCHAR(255));\")\n\n\n if @debug == true\n puts \"Should have created tables by now\"\n end\n\n end", "def check_for_structure_changes!\n watched_fields = db.query(\"DESC #{watched}\").to_a\n audit_fields = db.query(\"DESC #{audit}\").to_a\n delta = watched_fields - audit_fields\n delta = [delta, (audit_fields - watched_fields).reject { |i| METADATA_FIELDS.include?(i['Field']) }].flatten\n metadata_present = METADATA_FIELDS.all? { |f| (audit_fields - watched_fields).map { |i| i['Field'] }.include?(f) }\n\n if !delta.empty?\n raise \"Structure has changed for table '#{name}'!\"\n elsif !metadata_present\n missing_fields = METADATA_FIELDS - (audit_fields - watched_fields).map { |i| i['Field'] }\n raise \"Missing meta-data fields in audit table '#{name}' : #{missing_fields.join(', ')}.\"\n else\n logger.info \"Audit table #{name} is up to date.\"\n end\n end", "def result_structure\r\n AlphaStructure.new map, @creatures, @spawners, @quests, @knowledge_base, pool, file_key, requests, get_meta_data\r\n end", "def check_data_structur(data)\n data.each do |id, values|\n count = values.size\n if count.odd? or count > 2\n puts \"+%s+\" % [\"-\" * 57]\n puts \"|%32s%26s\" % [\"WARNING\", \"|\"]\n puts \"+%s+\" % [\"-\" * 57]\n end\n if count.odd?\n last = values.keys.last\n puts \"%s%17s\" % [\"| Sample #{id} was not returned to store!\", \"|\"]\n puts \"%s%30s%8s\" % [\"| Measured output PDE\", \"#{dose_unit_text(values[last])}/day in #{last}.\", \"|\"]\n values.delete(last)\n data.delete(id) if values.empty?\n puts \"+%s+\" % [\"-\" * 57]\n count = values.size\n end\n # if sample left store more times -- new data record is created for data pair\n # due to using get_integrate method\n correction = {}\n if count > 2\n puts \"%s%6s%16s\" % [\"| Sample #{id} left store more times\", \"(#{count / 2})!\", \"|\"]\n print \"| Original sample name #{id} was renamed to:\"\n n = 0\n values.each_slice(2) do |pair|\n n += 1\n correction[id + \"_m#{n}\"] = pair.to_h\n if n == 1\n puts \"%10s%4s \" % [\"#{id}_m#{n}\", \"|\"]\n else\n puts \"|%54s%4s \" % [\"#{id}_m#{n}\", \"|\"]\n end\n end\n puts \"+%s+\" % [\"-\" * 57]\n data = data.merge(correction)\n data.delete(id)\n end\n end\n data\n end", "def generate_document_structure; build_document_hash end", "def generate()\n traverse(@root)\n @un_arr.traverseUnions if @@union_flag\n @un_arr.traverseArrays if @@dyn_array_flag\n write_to_file\n end", "def validate_block(block)\n raise InvalidBlockError.new('invalid header') unless @header_chain.valid?(block.header)\n # valid ommers\n raise InvalidBlockError.new('ommers blocks can not more than 2') if block.ommers.size > 2\n block.ommers.each do |ommer|\n unless is_kin?(ommer, get_block(block.header.parent_hash), 6)\n raise InvalidBlockError.new(\"invalid ommer relation\")\n end\n end\n\n parent_header = @header_chain.get_header(block.header.parent_hash)\n state = State.new(store, state_root: parent_header.state_root)\n evm = EVM.new(state: state, chain: self, fork_schema: @fork_config.choose_fork(block.header.number))\n # valid transactions and gas\n begin\n receipts = evm.transition(block)\n rescue EVM::InvalidTransition => e\n raise InvalidBlockError.new(e.message)\n end\n\n # verify state root\n if evm.state_root != block.header.state_root\n error(\"incorrect state_root, evm: #{Utils.hex evm.state_root}, header: #{Utils.hex block.header.state_root} height: #{block.header.number}\")\n raise InvalidBlockError.new(\"incorrect state_root\")\n end\n\n # verify receipts root\n trie = Trie.new\n receipts.each_with_index do |r, i|\n trie[RLP.encode(i)] = RLP.encode(r)\n end\n\n if trie.root_hash != block.header.receipts_root\n raise InvalidBlockError.new(\"incorrect receipts_root\")\n end\n\n # verify state root\n trie = Trie.new\n block.transactions.each_with_index do |t, i|\n trie[RLP.encode(i)] = RLP.encode(t)\n end\n\n if trie.root_hash != block.header.transactions_root\n raise InvalidBlockError.new(\"incorrect transactions_root\")\n end\n end", "def test_valid\n italian = RecipeType.new\n\n assert_equal(false, italian.valid?)\n\n italian.name = \"\"\n assert_equal(false, italian.valid?)\n\n italian.name = \"Italian\"\n assert_equal(true, italian.valid?)\n end", "def create_models(bldg_types, vintages, climate_zones, epw_files = [])\n #### Create the prototype building\n failures = []\n\n # Loop through all of the given combinations\n bldg_types.sort.each do |building_type|\n vintages.sort.each do |template|\n climate_zones.sort.each do |climate_zone|\n model_name = \"#{building_type}-#{template}-#{climate_zone}\"\n puts \"****Testing #{model_name}****\"\n\n # Create an instance of the measure\n measure = CreateDOEPrototypeBuilding.new\n\n # Create an instance of a runner\n runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new)\n\n # Make an empty model\n model = OpenStudio::Model::Model.new\n\n # Set argument values\n arguments = measure.arguments(model)\n argument_map = OpenStudio::Measure::OSArgumentMap.new\n building_type_arg = arguments[0].clone\n assert(building_type_arg.setValue(building_type))\n argument_map['building_type'] = building_type_arg\n\n template_arg = arguments[1].clone\n assert(template_arg.setValue(template))\n argument_map['template'] = template_arg\n\n climate_zone_arg = arguments[2].clone\n assert(climate_zone_arg.setValue(climate_zone))\n argument_map['climate_zone'] = climate_zone_arg\n\n epw_arg = arguments[3].clone\n assert(epw_arg.setValue('Not Applicable'))\n argument_map['epw_file'] = epw_arg\n\n measure.run(model, runner, argument_map)\n result = runner.result\n show_output(result)\n if result.value.valueName != 'Success'\n failures << \"Error - #{model_name} - Model was not created successfully.\"\n end\n\n model_directory = \"#{@test_dir}/#{building_type}-#{template}-#{climate_zone}\"\n\n # Convert the model to energyplus idf\n forward_translator = OpenStudio::EnergyPlus::ForwardTranslator.new\n idf = forward_translator.translateModel(model)\n idf_path_string = \"#{model_directory}/#{model_name}.idf\"\n idf_path = OpenStudio::Path.new(idf_path_string)\n idf.save(idf_path, true)\n end\n end\n end\n\n #### Return the list of failures\n return failures\n end", "def checks; end", "def verify_integrity(object, entry)\n base_name = remove_dot_json(entry.name)\n if object[\"raw_data\"][\"id\"] != base_name\n yield(\"ID in #{entry.path_for_printing} must be '#{base_name}' (is '#{object[\"raw_data\"][\"id\"]}')\")\n elsif RESERVED_NAMES.match?(entry.parent.name)\n yield(\"Data bag name ('#{entry.parent.name}') must not match #{RESERVED_NAMES.inspect}\")\n end\n end", "def addMissingDWHR(elements)\n locationText = \"HouseFile/House/Components/HotWater/Primary\"\n elements[locationText].add_element(\"DrainWaterHeatRecovery\")\n locationText = \"HouseFile/House/Components/HotWater/Primary/DrainWaterHeatRecovery\"\n elements[locationText].attributes[\"showerLength\"] = \"5.0\"\n elements[locationText].attributes[\"dailyShowers\"] = \"2\"\n elements[locationText].attributes[\"preheatShowerTank\"] = \"false\"\n elements[locationText].attributes[\"effectivenessAt9.5\"] = \"50.0\"\n elements[locationText].add_element(\"Efficiency\", {\"code\"=>\"2\"})\n elements[locationText].add_element(\"EquipmentInformation\")\n elements[locationText].add_element(\"ShowerTemperature\", {\"code\"=>\"1\"})\n elements[locationText].add_element(\"ShowerHead\", {\"code\"=>\"0\"})\n locationText = \"HouseFile/House/Components/HotWater/Primary/DrainWaterHeatRecovery/EquipmentInformation\"\n elements[locationText].add_element(\"Manufacturer\")\n elements[locationText].add_element(\"Model\")\n\n # ASF 05-10-2016: Added default values for manufacturer, model so hthat user can spec \"NA\" in choice file.\n locationText = \"HouseFile/House/Components/HotWater/Primary/DrainWaterHeatRecovery/EquipmentInformation/Manufacturer\"\n elements[locationText].text = \"Generic\"\n locationText = \"HouseFile/House/Components/HotWater/Primary/DrainWaterHeatRecovery/EquipmentInformation/Model\"\n elements[locationText].text = \"2-Medium Efficiency\"\n locationText = \"HouseFile/House/Components/HotWater/Primary/DrainWaterHeatRecovery/ShowerTemperature\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\n locationText = \"HouseFile/House/Components/HotWater/Primary/DrainWaterHeatRecovery/ShowerHead\"\n elements[locationText].add_element(\"English\")\n elements[locationText].add_element(\"French\")\nend", "def validate_gml\n # Rails.logger.debug \"Tag #{id}: validate_gml\"\n doc = gml_document\n errors, warnings, recommendations = [], [], []\n\n # TODO use nested tags -- e.g. stroke/pt/t rather than just t\n errors << check_for_tag('stroke', \"No <stroke> tags - at least 1 stroke required\")\n errors << check_for_tag('pt', \"No <pt> tags - GML requires at least 1 point. This isn't 'EmptyML'\")\n # TODO iterate through each pt to ensure each has x/y's -- not just any x/y\n errors << check_for_tag('x', \"Missing <x> tags inside your <pt>'s\")\n errors << check_for_tag('y', \"Missing <y> tags inside your <pt>'s\")\n\n # TODO parse & verify all pt values are between 0 and 1.0\n\n warnings << check_for_tag('time', \"No <time> tags in your <pt> tags! Capturing time data makes things much more interesting.\")\n warnings << check_for_tag('client', \"No <client> tag - provide some info about your app!\")\n warnings << check_for_tag('environment', \"No <environment> tag\")\n warnings << check_for_tag('up', \"No <up> tag in your <environment> - is this horizontal or landscape?!\")\n warnings << check_for_tag('screenBounds', \"No <screenBounds> tag in your <environment> - otherwise apps might draw it in the wrong aspect ratio\")\n # Offset? Rotation? z coords? could be a 'protips' section...\n # Time? Maybe just recommendation?\n\n recommendations << check_for_tag('uniqueKey', \"No <uniqueKey> tag - includign a unique device ID of some kind lets users pair their 000000book accounts with your app, e.g. iPhone uuid, MAC address, etc\")\n recommendations << \"You don't have any newlines. Proper formatting makes your GML nice & human-readable\" unless doc.to_s =~ /\\n/\n recommendations << \"You don't have any tabs. Indenting is the bomb yo\" unless doc.to_s =~ /\\t/ || doc.to_s =~ / / # assume 2 spaces = 1 tab\n # Geo information?\n\n rescue\n errors << \"Error parsing GML (malformed XML?)\"+(Rails.env == 'development' ? \": #{$!.class} - #{$!}\" : '')\n\n ensure\n self.validation_results = ActiveSupport::OrderedHash.new\n self.validation_results[:errors] = errors.compact unless errors.blank?\n self.validation_results[:warnings] = warnings.compact unless warnings.blank?\n self.validation_results[:recommendations] = recommendations.compact unless recommendations.blank?\n\n Rails.logger.debug \"GML Validation Results...\"\n Rails.logger.debug self.validation_results.inspect\n return validation_results\n end", "def dump_attributes_and_build_failure_message(all_generated_attributes_json)\n generated_attributes_file = Rails.root.join('tmp/generated_attributes_file.json')\n\n File.write(generated_attributes_file, all_generated_attributes_json)\n\n \"Generated attributes do not match expected attributes.\\n\" \\\n \"Compare #{generated_attributes_file} and \" \\\n \"#{expected_time_slot_attributes_file} for further checks\"\n end", "def is_valid?\n false if not @output.include? 'Generating' or @output.include? 'Failed'\n true\n end", "def check_course_data_validity(course_data)\n schema = {\n 'type' => 'object',\n 'required' => %w(Name Code CourseTemplateId SemesterId\n StartDate EndDate LocaleId ForceLocale\n ShowAddressBook),\n 'properties' => {\n 'Name' => { 'type' => 'string' },\n 'Code' => { 'type' => 'string' },\n 'CourseTemplateId' => { 'type' => 'integer' },\n 'SemesterId' => { 'type' => %w(integer null) },\n 'StartDate' => { 'type' => %w(string null) },\n 'EndDate' => { 'type' => %w(string null) },\n 'LocaleId' => { 'type' => %w(integer null) },\n 'ForceLocale' => { 'type' => 'boolean' },\n 'ShowAddressBook' => { 'type' => 'boolean' }\n }\n }\n JSON::Validator.validate!(schema, course_data, validate_schema: true)\nend", "def test_structures_method_struct_get\n structures = ['Microformats::Structures::HCard', :h_card, \"HCard\", \"h_card\"]\n structures.each do |structure|\n assert struct_class = Structure.get(structure),\n \"Failed to load structure: #{structure} #{structure.class}\"\n assert_equal struct_class.class_name.camelcase.downcase,\n structure.to_s.split('::').pop.camelcase.downcase,\n \"Invalid class_name for: #{structure}\"\n end\n assert_raise(NameError, \"No exception raise for undefined structure.\") do\n Structure.get(\"fail\")\n end\n end", "def exercise2\n parse_data PositionalValidator\n validators.count(&:valid?)\n end", "def checkStructForContent(studentDir, contentInfo, shortName)\n rtn = []\n\n content = getRawFileContents(\"#{studentDir}/data.h\")\n contentInfo.each{|fieldInfo|\n structContent = getStructContent(content, fieldInfo[0])\n\n if (structContent == '')\n print \"Unable to get struct content (#{studentDir}, #{fieldInfo[0]}\"\n next\n end\n\n fieldInfo[1].each{|field|\n if (!structContent.match(/\\b#{field}\\b/))\n rtn << [\"Struct #{fieldInfo[0]} does not have #{shortName} #{field}.\", 5]\n end\n }\n }\n\n return rtn\nend", "def build_struct_tree data\n data.to_hashugar\n end", "def valid_tree?\n true\n end", "def valid_tree?\n true\n end", "def check_integrity(list)\n complete = list.to_a\n 1.upto(list.level) do |l|\n #if anything in the higher layer wasn't in layer 0\n difference = list.to_a(nil,nil,nil,l) - complete\n puts \"stray node found in level: #{l} which is #{list.to_a(nil,nil,nil,l)}\" if !difference.empty? \n expect(difference).to match_array([])\n end\nend", "def validated; end", "def test_candidate_key\n arr = [@obj]\n obj = @obj.clone\n obj.outpulsemapid = nil\n refute arr.any? &obj.candidate_key\n\n obj = @obj.clone\n obj.digitpattern = nil\n refute arr.any? &obj.candidate_key\n\n obj = @obj.clone\n obj.inputnoa = nil\n refute arr.any? &obj.candidate_key\n\n obj = @obj.clone\n obj.mindigitcount = nil\n refute arr.any? &obj.candidate_key\n\n obj = @obj.clone\n obj.maxdigitcount = nil\n refute arr.any? &obj.candidate_key\n\n obj = @obj.clone\n obj.members.each { |attribute| obj.public_send \"#{attribute}=\", nil }\n obj.outpulsemapid = @obj.outpulsemapid\n obj.digitpattern = @obj.digitpattern \n obj.inputnoa = @obj.inputnoa\n obj.mindigitcount = @obj.mindigitcount\n obj.maxdigitcount = @obj.maxdigitcount\n assert arr.any? &obj.candidate_key\n end", "def valid_tree?\n true\n end", "def test_get_WireList\n printf \"\\n@T:#{__method__}\\n\"\n @root = XMLParse.read(\"./tp/test_simple.xml\")\n golden = { \n \"wire001\" => FICE_DB::SignalInf.new( :name => \"wire001\" , :type => \"wire\"),\n \"wire002\" => FICE_DB::SignalInf.new( :name => \"wire002\" , :type => \"wire\", :msb => 3, :lsb => 0),\n \"wire003\" => FICE_DB::SignalInf.new( :name => \"wire003\" , :type => \"wire\", :msb => 3, :lsb => 0),\n \"SEL_w\" => FICE_DB::SignalInf.new( :name => \"SEL_w\" , :type => \"wire\"),\n \"CLK_w\" => FICE_DB::SignalInf.new( :name => \"CLK_w\" , :type => \"wire\"),\n \"drive_change_original\" => FICE_DB::SignalInf.new( :name => \"drive_change_original\" , :type => \"wire\"),\n }\n assert_equal(golden,XMLParse::get_WireList(@root,\"test\"))\n end", "def valid_data_on_creation?\n valid_data_on_creation\n end", "def create_lean(entities)\n\tif($lean_height > 0)\n\t\tif($lean_side == \"SW1\")\n\t\t\tr = Geom::Transformation.rotation [0,0,0],[0,0,1],360.degrees\n\t\t\tt = Geom::Transformation.new [$lean_offset,-$lean_length,0]\n\t\t\tbuild_lean(entities, r, t)\n\t\tend\n\t\tif($lean_side == \"SW2\")\n\t\t\tr = Geom::Transformation.rotation [0,0,0],[0,0,1],180.degrees\n\t\t\tt = Geom::Transformation.new [$length-$lean_offset,+$width+$lean_length,0]\n\t\t\tbuild_lean(entities, r, t)\n\t\tend\n\t\tif($lean_side == \"EW1\")\n\t\t\tr = Geom::Transformation.rotation [0,0,0],[0,0,1],270.degrees\n\t\t\tt = Geom::Transformation.new [-$lean_length,+$width-$lean_offset,0]\n\t\t\tbuild_lean(entities, r, t)\n\t\tend\n\t\tif($lean_side == \"EW2\")\n\t\t\tr = Geom::Transformation.rotation [0,0,0],[0,0,1],90.degrees\n\t\t\tt = Geom::Transformation.new [$length+$lean_length,$lean_offset,0]\n\t\t\tbuild_lean(entities, r, t)\n\t\tend\n\tend\nend", "def generate_constructions\n # TODO? delete and re-create or check that it exists and update?\n # self.construct_assemblies.destroy_all\n # self.materials.destroy_all\n # self.fenestration_constructions.destroy_all\n # self.door_construction.destroy_all\n\n # model names\n constructions = %w(UndergroundWall UndergroundFloor InteriorWall InteriorFloor ExteriorWall ExteriorFloor Roof)\n fenestrations = %w(Window Skylight)\n doors = ['Door']\n space_ids = []\n\n # get all building -> stories -> spaces (that's what constructions are attached to)\n stories = building.building_stories\n spaces = []\n stories.each do |story|\n story.spaces.each do |space|\n spaces << space\n end\n end\n space_ids = spaces.collect(&:id)\n logger.debug(\"*****SPACES: #{space_ids.inspect} *****\")\n\n project_cas = []\n project_mats = []\n project_fens = []\n project_doors = []\n\n # to find doors, windows, skylights\n int_wall_ids = []\n ext_wall_ids = []\n roof_ids = []\n\n # assign regular constructions\n constructions.each do |con|\n con_model = con.constantize\n instances = con_model.any_in(space_id: space_ids)\n\n if con === 'InteriorWall'\n int_wall_ids = instances.collect(&:id)\n elsif con === 'ExteriorWall'\n ext_wall_ids = instances.collect(&:id)\n elsif con === 'Roof'\n roof_ids = instances.collect(&:id)\n end\n\n # puts \"#{instances.size} instances of #{con}\"\n # logger.info \"#{instances.size} instances of #{con}\"\n\n instances.each do |instance|\n # get lib record\n unless instance.construction_library_id.nil?\n lib = Construction.find(instance.construction_library_id)\n\n # TODO: check that it doesn't exist yet or skip?\n ca = construct_assemblies.find_or_create_by(name: lib.name)\n ca.compatible_surface_type = lib.compatible_surface_type\n # save other attributes here (for floors)\n ca.slab_type = lib.slab_type\n ca.slab_insulation_orientation = lib.slab_insulation_orientation\n ca.slab_insulation_thermal_resistance = lib.slab_insulation_thermal_resistance\n\n material_refs = []\n # material references\n logger.debug(\"!!!!! LAYERS: #{lib['layers']}\")\n unless lib['layers'].nil?\n lib.layers.each do |layer|\n mat = materials.find_or_create_by(name: layer['name'])\n mat.code_category = layer['code_category']\n mat.code_item = layer['code_item']\n # save framing_configuration and material (required)\n mat.framing_depth = layer['framing_depth']\n mat.framing_configuration = layer['framing_configuration']\n mat.framing_material = layer['framing_material']\n mat.framing_material = layer['framing_material']\n mat.cavity_insulation = layer['cavity_insulation_r_value']\n\n mat.save\n material_refs << mat.name\n # only save unique records to project\n match = project_mats.find { |m| m['name'] === mat.name }\n logger.info(\"MATCH: #{match}, for material #{mat.name}\")\n project_mats << mat if match.nil?\n end\n end\n\n # save material references to construction assembly\n ca.material_reference = material_refs\n ca.save\n # only save unique records to project\n match = project_cas.find { |m| m['name'] === ca.name }\n # puts \"MATCH: #{match} for ca #{ca.name}\"\n logger.info \"MATCH: #{match} for ca #{ca.name}\"\n project_cas << ca if match.nil?\n\n # save construction assembly reference on original instance (in construct_assembly_reference field, use name)\n instance.construct_assembly_reference = ca.name\n instance.save\n end\n end\n end\n\n\n logger.info \"Exterior Wall ids are #{ext_wall_ids}\"\n\n # assign doors\n door_instances = Door.or({:interior_wall_id.in => int_wall_ids}, {:exterior_wall_id.in => ext_wall_ids})\n\n logger.info(\"Door instances: #{door_instances.size}\")\n door_instances.each do |instance|\n # get lib record\n unless instance.construction_library_id.nil?\n lib = DoorLookup.find(instance.construction_library_id)\n dc = door_constructions.find_or_create_by(name: lib.name)\n # add other lib fields\n lib.attributes.each_pair do |key, value|\n unless %(created_at updated_at id _id).include? key\n dc[key] = value\n end\n end\n dc.save\n\n # only save unique records to project\n match = project_doors.find { |m| m['name'] === dc.name }\n logger.info(\"MATCH: #{match} for door construction #{dc.name}\")\n project_doors << dc if match.nil?\n\n # save construction assembly reference on original instance (in construct_assembly_reference field, use name)\n instance.door_construction_reference = dc.name\n instance.save\n end\n end\n\n # assign fenestrations\n fenestrations.each do |fen|\n fen_model = fen.constantize\n if fen === 'Window'\n instances = fen_model.any_in(exterior_wall_id: ext_wall_ids)\n else\n # skylight\n instances = fen_model.any_in(roof_id: roof_ids)\n end\n # puts \"#{instances.size} instances of #{fen}\"\n # logger.info(\"#{instances.size} instances of #{fen}\")\n\n instances.each do |instance|\n # get lib record\n unless instance.construction_library_id.nil?\n lib = Fenestration.find(instance.construction_library_id)\n # TODO: check that it doesn't exist yet or skip?\n fc = fenestration_constructions.find_or_create_by(name: lib.name)\n # save all lib attributes to construction instance\n lib.attributes.each_pair do |key, value|\n unless %(created_at updated_at id _id).include? key\n fc[key] = value\n end\n end\n fc.save\n\n # only save unique records to project\n match = project_fens.find { |m| m['name'] === fc.name }\n logger.info(\"MATCH: #{match} for fen construction #{fc.name}\")\n project_fens << fc if match.nil?\n\n # save construction assembly reference on original instance (in construct_assembly_reference field, use name)\n instance.fenestration_construction_reference = fc.name\n instance.save\n end\n end\n end\n\n # save all to project\n self.door_constructions = project_doors\n self.fenestration_constructions = project_fens\n self.construct_assemblies = project_cas\n self.materials = project_mats\n self.save!\n end", "def valid?\n return false if @first_name.nil?\n return false if @first_name.to_s.length > 30\n return false if !@last_name.nil? && @last_name.to_s.length > 30\n return false if !@address_line1.nil? && @address_line1.to_s.length > 50\n return false if !@address_line2.nil? && @address_line2.to_s.length > 50\n return false if !@city.nil? && @city.to_s.length > 50\n return false if !@state.nil? && @state.to_s.length > 50\n return false if !@zip.nil? && @zip.to_s.length > 12\n return false if !@country.nil? && @country.to_s.length > 50\n return false if !@security_identifier.nil? && @security_identifier.to_s.length > 184\n return false if !@title.nil? && @title.to_s.length > 100\n return false if !@school.nil? && @school.to_s.length > 50\n return false if !@nick_name.nil? && @nick_name.to_s.length > 30\n return false if !@significant_other.nil? && @significant_other.to_s.length > 30\n return false if !@portal_password.nil? && @portal_password.to_s.length > 15\n return false if !@portal_security_level.nil? && @portal_security_level > 6.0\n return false if !@portal_security_level.nil? && @portal_security_level < 1.0\n gender_validator = EnumAttributeValidator.new('String', [\"Male\", \"Female\"])\n return false unless gender_validator.valid?(@gender)\n presence_validator = EnumAttributeValidator.new('String', [\"Online\", \"DoNotDisturb\", \"Away\", \"Offline\", \"NoAgent\"])\n return false unless presence_validator.valid?(@presence)\n return true\n end", "def verify_object_info_data(data_set)\n logger.debug \"Checking object number #{data_set[CoreObjectData::OBJECT_NUM.name]}\"\n object_data_errors = []\n text_values_match?(data_set[CoreObjectData::OBJECT_NUM.name], element_value(object_num_input), object_data_errors)\n\n other_nums = data_set[CoreObjectData::OTHER_NUM.name]\n other_nums && other_nums.each do |num|\n index = other_nums.index num\n text_values_match?(num[CoreObjectData::NUM_VALUE.name], element_value(other_num_num_input index), object_data_errors)\n text_values_match?(num[CoreObjectData::NUM_TYPE.name], element_value(other_num_type_input index), object_data_errors)\n end\n\n num_objects = data_set[CoreObjectData::NUM_OBJECTS.name]\n num_objects && text_values_match?(num_objects.to_s, element_value(num_objects_input), object_data_errors)\n\n collection = data_set[CoreObjectData::COLLECTION.name]\n collection && text_values_match?(collection, element_value(collection_input), object_data_errors)\n\n resp_depts = data_set[CoreObjectData::RESPONSIBLE_DEPTS.name]\n resp_depts && resp_depts.each { |dept| text_values_match?(dept[CoreObjectData::RESPONSIBLE_DEPT.name], element_value(resp_dept_input resp_depts.index(dept)), object_data_errors) }\n\n pub_to_list = data_set[CoreObjectData::PUBLISH_TO_LIST.name]\n pub_to_list && pub_to_list.each { |pub| text_values_match?(pub[CoreObjectData::PUBLISH_TO.name], element_value(publish_to_input pub_to_list.index(pub)), object_data_errors) }\n\n status = data_set[CoreObjectData::RECORD_STATUS.name]\n status && text_values_match?(status, element_value(record_status_input), object_data_errors)\n\n inv_statuses = data_set[CoreObjectData::INVENTORY_STATUS_LIST.name]\n inv_statuses && inv_statuses.each { |stat| text_values_match?(stat[CoreObjectData::INVENTORY_STATUS.name], element_value(inventory_status_input inv_statuses.index(stat)), object_data_errors) }\n\n brief_descrips = data_set[CoreObjectData::BRIEF_DESCRIPS.name]\n brief_descrips && brief_descrips.each { |descrip| text_values_match?(descrip[CoreObjectData::BRIEF_DESCRIP.name], element_value(brief_desc_text_area brief_descrips.index(descrip)), object_data_errors) }\n\n dist_feat = data_set[CoreObjectData::DISTINGUISHING_FEATURES.name]\n dist_feat && text_values_match?(dist_feat, element_value(dist_features_text_area), object_data_errors)\n\n comments = data_set[CoreObjectData::COMMENTS.name]\n comments && comments.each { |comment| text_values_match?(comment[CoreObjectData::COMMENT.name], element_value(comment_text_area comments.index(comment)), object_data_errors) }\n\n titles = data_set[CoreObjectData::TITLE_GRP.name]\n titles && titles.each do |title|\n index = titles.index title\n text_values_match?(title[CoreObjectData::TITLE.name], element_value(title_input index), object_data_errors)\n text_values_match?(title[CoreObjectData::TITLE_TYPE.name], element_value(title_type_input index), object_data_errors)\n text_values_match?(title[CoreObjectData::TITLE_LANG.name], element_value(title_lang_input index), object_data_errors)\n\n translations = title[CoreObjectData::TITLE_TRANSLATION_SUB_GRP.name]\n translations && translations.each do |trans|\n sub_index = translations.index trans\n text_values_match?(trans[CoreObjectData::TITLE_TRANSLATION.name], element_value(title_translation_input [index, sub_index]), object_data_errors)\n text_values_match?(trans[CoreObjectData::TITLE_TRANSLATION_LANG.name], element_value(title_translation_lang_input [index, sub_index]), object_data_errors)\n end\n end\n\n obj_names = data_set[CoreObjectData::OBJ_NAME_GRP.name]\n obj_names && obj_names.each do |name|\n index = obj_names.index name\n text_values_match?(name[CoreObjectData::OBJ_NAME_NAME.name], element_value(object_name_input index), object_data_errors)\n text_values_match?(name[CoreObjectData::OBJ_NAME_CURRENCY.name], element_value(object_name_currency_input index), object_data_errors)\n text_values_match?(name[CoreObjectData::OBJ_NAME_LEVEL.name], element_value(object_name_level_input index), object_data_errors)\n text_values_match?(name[CoreObjectData::OBJ_NAME_SYSTEM.name], element_value(object_name_system_input index), object_data_errors)\n text_values_match?(name[CoreObjectData::OBJ_NAME_TYPE.name], element_value(object_name_type_input index), object_data_errors)\n text_values_match?(name[CoreObjectData::OBJ_NAME_LANG.name], element_value(object_name_lang_input index), object_data_errors)\n text_values_match?(name[CoreObjectData::OBJ_NAME_NOTE.name], element_value(object_name_note_input index), object_data_errors)\n end\n\n object_data_errors\n end", "def make(addToSingleCollection=true)\n fieldsAlreadySet = Hash.new(false)\n dependentGenerators = Hash.new\n \n allFields = Array.new\n obj = class_for_name(@templateName).new\n # populate all the fields; traverse both collections of fields at once\n [@fieldDefs,@transients].each do |field_map|\n next if field_map.nil?\n \n field_map.each_pair do |fieldName,generator| \n # if it's a dependent generator, check to see if the fields it's dependent on have been set\n if generator.kind_of? Hirsute::DependentGenerator\n if !dependent_fields_are_set?(fieldsAlreadySet,generator)\n dependentGenerators[fieldName] = generator\n next\n end\n end\n obj.set(fieldName,generator.generate(obj))\n fieldsAlreadySet[fieldName] = true;\n end\n end\n \n # now handle any dependent generators left hanging and try to spot endless loops\n cur_dependent_gens_length = dependentGenerators.size\n while(cur_dependent_gens_length > 0)\n dependentGenerators.keys.each do |field|\n generator = dependentGenerators[field]\n next if generator.nil?\n if dependent_fields_are_set?(fieldsAlreadySet,generator)\n \n # all dependencies are in place\n obj.set(field,generator.generate(obj))\n fieldsAlreadySet[field] = true\n dependentGenerators.delete(field)\n end\n end\n \n # if the size of the hash hasn't changed, we have a problem: another pass through the loop won't change things, so it'll go forever\n raise \"Dependency loop spotted in #{@templateName}. Check generators to make sure there are no circular dependencies.\" if dependentGenerators.size == cur_dependent_gens_length\n cur_dependent_gens_length = dependentGenerators.size\n end\n \n # if there is exactly one collection declared for this type, add this object to it\n colls = Hirsute::Collection.collections_holding_object(@templateName)\n colls[0] << obj if addToSingleCollection && colls && colls.length == 1 \n obj\n end", "def create\n authorize :user\n failflag=\"\"\n #does that user already have a map to that wedgetail\n if @localmap=Localmap.checkWedge(@user,params[:localmap][:wedgetail])\n if @localmap.localID != params[:localmap][:localID]\n failflag=\"Error 1: That wedgetail number is already mapped to another localID\"\n else\n failflag=\"Error 0: That mapping already exists\"\n end\n end\n \n #does that user already have that localID mapped to a different patient\n if failflag==\"\" and @localmap=Localmap.get(@user,params[:localmap][:localID])\n if @localmap.wedgetail != params[:localmap][:wedgetail]\n failflag=\"Error 2: That localID is already mapped to another wedgetail number\"\n end\n else\n # all seems OK\n @team=@user.wedgetail\n @team=@user.team if @user.team !=\"\" and @user.team !='0' and @user.team !=NULL\n @localmap=Localmap.create(:team=>@team,:localID=>params[:localmap][:localID],:wedgetail=>params[:localmap][:wedgetail])\n end\n \n respond_to do |format|\n format.xml{\n if failflag==\"\"\n if @localmap.save\n @message=\"Localmap created\"\n render :xml => @localmap, :template => 'localmaps/localmap.xml.builder',:status => :created\n else\n render :xml => @localmap.errors, :status => :unprocessable_entity \n end\n else\n @message=failflag\n render :xml => @localmap, :template => 'localmaps/localmap.xml.builder',:status => :unprocessable_entity\n end\n } \n end\n end", "def malts; end", "def test_create_dict_set_initialized\n refute_nil @grapher.create_dict_set('wordlist.txt')\n end", "def valid_tree?\n false\n end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?; end", "def structure\n # create a hash and return it\n h = {\n name: @name,\n required: @required,\n expression: @expression,\n data_type: @data_type,\n field_type: @field_type\n }\n h[:properties] = @properties if @properties.keys.count > 0\n h\n end" ]
[ "0.602283", "0.5786843", "0.5420919", "0.5378987", "0.53750634", "0.53115386", "0.52449715", "0.5235955", "0.5201291", "0.5135546", "0.5116663", "0.51126945", "0.5069255", "0.505662", "0.5051854", "0.5047134", "0.50461906", "0.50410455", "0.5040217", "0.5039712", "0.50251234", "0.50126946", "0.5008482", "0.49988842", "0.49845502", "0.49556515", "0.49321243", "0.49292314", "0.49173352", "0.49076638", "0.48983362", "0.48960686", "0.48774073", "0.48756272", "0.48608956", "0.48576242", "0.48479006", "0.48464713", "0.48427063", "0.48298705", "0.4823217", "0.48070735", "0.48047978", "0.48045304", "0.48021647", "0.48005188", "0.4794148", "0.47925252", "0.47925252", "0.47723046", "0.47691467", "0.47600755", "0.47527605", "0.47465703", "0.47440982", "0.4740667", "0.47363284", "0.47302234", "0.4725391", "0.47238758", "0.4721114", "0.47191855", "0.47186697", "0.4717448", "0.4714614", "0.4713919", "0.47068784", "0.47065637", "0.4705449", "0.47005865", "0.4700205", "0.46892646", "0.4686987", "0.46864116", "0.46858358", "0.46854776", "0.46815604", "0.46646726", "0.46646726", "0.46643016", "0.4658807", "0.4658794", "0.46576774", "0.46558386", "0.46545723", "0.4652131", "0.4650884", "0.4645033", "0.46404338", "0.46336082", "0.4630863", "0.46213475", "0.46187916", "0.46162632", "0.46154872", "0.46154872", "0.46154872", "0.46154872", "0.46154872", "0.46116856" ]
0.5221472
8
Call the method directors_database to retrieve the NDS
def pretty_print_nds(nds) # Change the code below to pretty print the nds with pp pp nds end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @dns = Dn.all\n end", "def db_ddns_access(data={})\n return nil if data.empty? || (!data.has_key?(:id) && !data.has_key?(:device_id) && !data.has_key?(:ip_address) && !data.has_key?(:full_domain))\n \n where_data = data.clone\n\n if data.has_key?(:full_domain) then\n full_domain = where_data[:full_domain]\n host_name = find_hostname(full_domain)\n domain_name = find_domainname(full_domain)\n domain = Domain.find_by_domain_name(domain_name)\n domain_id = domain.id\n where_data[:hostname] = host_name\n where_data[:domain_id] = domain_id\n where_data.delete(:full_domain)\n end\n\n if where_data.has_key?(:ip_address) then\n where_data[:ip_address] = IPAddr.new(where_data[:ip_address]).to_i.to_s(16).rjust(8, \"0\")\n end\n\n rows = DDNS.where(where_data).first\n \n if !rows.nil? then\n return rows\n else\n return nil\n end\n end", "def pretty_print_nds(nds)\n pp directors_database\nend", "def pretty_print_nds(nds)\n pp directors_database\nend", "def pretty_print_nds(nds)\n pp directors_database\nend", "def determine_database\n self.class.database \n end", "def pretty_print_nds(nds)\n nil\n pp directors_database\nend", "def getToolsSyndicateLocaldatabase( entity_id, destructive)\n params = Hash.new\n params['entity_id'] = entity_id\n params['destructive'] = destructive\n return doCurl(\"get\",\"/tools/syndicate/localdatabase\",params)\n end", "def databases\n get '_all_dbs'\n end", "def datoms(dbname, params = {})\n version = params.fetch(:t, '-')\n get db_url(dbname, version, \"datoms\"), params\n end", "def datastore_info\n dc = @cluster.datacenter\n ds = dc.datastore_folder\n\n ds_info = ''\n\n ds.fetch!.each do |ref, _ds|\n ds_info << \"VCENTER_DS_REF=\\\"#{ref}\\\"\\n\"\n end\n\n ds_info\n end", "def database \n # NOTE:: Having an instance variable here, causes problems\n # when having two Sinatra Apps, each with their own db setup.\n # the instance variable retains only the last setup, so the\n # first setup is overwritten.\n @database ||= ::DataMapper.setup(dm_setup_context, dm_database_url)\n end", "def domain\n\t\treturn @dmn\n\tend", "def database; datastore['DATABASE']; end", "def getDB\n @db\n end", "def databases\n CouchRest.get \"#{@uri}/_all_dbs\"\n end", "def get_dc\n datastreams[\"DC\"]\n end", "def db_info\n @conn.query({url_path: \"#{database}\", method: :get})\n end", "def read_replica_db_instance_identifiers\n @dbi.read_replica_db_instance_identifiers\n end", "def read_replica_db_instance_identifiers\n @dbi.read_replica_db_instance_identifiers\n end", "def get_dbs\n if @target_config['DBS'].empty?\n if @target_config['VERSION'].scan(/./)[0].to_i < 5 and not @target_config['VERSION'].nil?\n # MySQL < 5\n print_error(\"DB Version: #{@target_config['VERSION']}\")\n print_error(\"There is no information_schema to query.....\")\n print_error(\"Unable to enumerate databases for MySQL < 5\")\n elsif @target_config['VERSION'].scan(/./)[0].to_i >= 5 or @target_config['VERSION'].nil?\n # MySQL >= 5\n results = error_basic_inject('select count(schema_name) from information_schema.schemata')\n if results.nil?\n results = error_basic_inject('select count(distinct(db)) from mysql.db')\n dbs_count = 0 unless not results.nil?\n print_error(\"Unable to get database count, flying a bit blind!\") unless not results.nil?\n dbs_count = results unless results.nil?\n print_status(\"Requesting #{dbs_count} Databases Names....\") unless results.nil?\n else\n dbs_count = results\n print_status(\"Requesting #{dbs_count} Databases Names....\")\n end\n dbz=[]\n count = 0\n while not results.nil?\n results = error_basic_inject(\"select schema_name from information_schema.schemata limit #{count},1\")\n pad = ' ' * (results.size + 25) unless results.nil? or results == ''\n pad = ' ' * 50 if results.nil? or results == ''\n print \"\\r(#{count})> #{results}#{pad}\".cyan unless results == ''\n dbz << results unless results == ''\n count = count.to_i + 1\n end\n print_line(\"\")\n if dbz.empty?\n print_line(\"\")\n print_error(\"Unable to get any database names!\")\n print_error(\"Lack of privileges?\")\n print_status(\"Possible Solutions include:\")\n print_caution(\"A) Become HR's best friend by updating the code and sending him a copy\")\n print_caution(\"B) Tweak Settings and try things again\")\n print_caution(\"C) Be a bawz and do it manually\")\n print_line(\"\")\n else\t\n @target_config['DBS'] = dbz\n print_good(\"DBS: #{dbz.join(', ').sub(/, $/, '')}\")\n end\n end\n else\n print_good(\"DBS: #{@target_config['DBS'].join(', ').sub(/,$/, '')}\")\n end\n end", "def index\n @dns_entries = DnsEntry.all\n end", "def database\n @database\n end", "def database\n @database\n end", "def databases\n arrayCommand( \"show db\", DictItemArray, RESPONSE_DATABASES_FOLLOW, RESPONSE_NO_DATABASES )\n end", "def databases\n arrayCommand( \"show db\", DictItemArray, RESPONSE_DATABASES_FOLLOW, RESPONSE_NO_DATABASES )\n end", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n pp directors_database\nend", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n pp directors_database\nend", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n pp directors_database\nend", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n pp directors_database\nend", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n pp directors_database\nend", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n pp directors_database\nend", "def get_datastream( pid, dsID )\n pid.include?(\"druid\") ? pid = pid : pid = \"druid:#{pid}\"\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID + '/content') \n RestClient.get(uri.to_s)\n rescue => e\n e.response \n end", "def set_dnc\n @dnc = Dnc.find(params[:id])\n end", "def database\n @database ||= determine_database\n end", "def index\n @network_dvrs = NetworkDvr.all\n end", "def set_dn\n @dn = Dn.find(params[:id])\n end", "def dids\r\n DidsController.instance\r\n end", "def query_device_management\n @devices = query(\"select * from device_management \")\n end", "def dn_ds_ration\n return (self.dn/self.ds)\n end", "def all_dbs\n @conn.query({url_path: \"_all_dbs\", method: :get})\n end", "def get_database(db_name)\n Monga::Database.new(@client, db_name)\n end", "def results\n get_domain_data\n end", "def demon\n fetch('naruto.demons')\n end", "def get_dbs\n if @target_config['VERSION'].scan(/./)[0].to_i < 5 and not @target_config['VERSION'].nil?\n # MySQL < 5\n print_error(\"DB Version: #{@target_config['VERSION']}\")\n print_error(\"There is no information_schema to query.....\")\n print_error(\"Unable to enumerate databases for MySQL < 5\")\n elsif @target_config['VERSION'].scan(/./)[0].to_i >= 5 or @target_config['VERSION'].nil?\n # MySQL v5+\n results = union_basic_inject($config['INJECTOR']['MYSQL']['UNION']['VULN_COLUMN'].to_i, 'select count(schema_name) from information_schema.schemata')\n if results.nil?\n results = union_basic_inject($config['INJECTOR']['MYSQL']['UNION']['VULN_COLUMN'].to_i, 'select count(distinct(db)) from mysql.db') #This usually needs privs, but maybe in some case if info schema is blocked\n dbs_count=0 unless not results.nil?\n print_error(\"Unable to get database count, flying a bit blind!\") unless not results.nil?\n dbs_count=results unless results.nil?\n print_status(\"Requesting #{dbs_count} Databases Names....\") unless results.nil?\n else\n dbs_count=results\n print_status(\"Requesting #{dbs_count} Databases Names....\")\n end\n dbz=[]\n count=0\n while not results.nil?\n results = union_basic_inject($config['INJECTOR']['MYSQL']['UNION']['VULN_COLUMN'].to_i, \"select schema_name from information_schema.schemata limit #{count},1\")\n pad = ' ' * (results.size + 10) unless results == '' or results.nil?\n pad = ' ' * 50 if results.nil?\n print \"\\r(#{count})> #{results}#{pad}\".cyan unless results == ''\n dbz << results unless results == ''\n count = count.to_i + 1\n end\n print_line(\"\")\n if dbz.empty?\n print_line(\"\")\n print_error(\"Unable to get any database names!\")\n print_error(\"Lack of privileges?\")\n print_status(\"Possible Solutions include:\")\n print_caution(\"A) Become HR's best friend by updating the code and sending him a copy\")\n print_caution(\"B) Tweak Settings and try things again\")\n print_caution(\"C) Be a bawz and do it manually\")\n print_line(\"\")\n else\t\n @target_config['DBS'] += dbz\n @target_config['DBS'].uniq! unless @target_config['DBS'].nil? or @target_config['DBS'].size == 0\n print_good(\"DBS: #{dbz.join(', ').sub(/, $/, '')}\") unless dbz.nil? or dbz.size == 0\n print_good(\"DBS: #{@target_config['DBS'].join(', ').sub(/, $/, '')}\") if dbz.nil? or dbz.size == 0 and not @target_config['DBS'].nil?\n end\n end\n end", "def info\n specified_db_or_all { |db| display_db_info db }\n end", "def datastore\n result = splunk_exec(\"show\",[\"datastore-dir\"])\n result = result.to_s.split(':')[1].strip\n return result\n end", "def index\n @dncs = Dnc.all.sort_by { |dnc| [Terr.find(dnc.terrid).region, dnc.street, dnc.number] }\n end", "def info\n specified_db_or_all { |db| display_db_info db }\n end", "def read_replica_source_db_instance_identifier\n @dbi.read_replica_source_db_instance_identifier\n end", "def read_replica_source_db_instance_identifier\n @dbi.read_replica_source_db_instance_identifier\n end", "def db\n Doozer::Configs.db_conn\n end", "def db\n Doozer::Configs.db_conn\n end", "def database_id\n service.database\n end", "def show\n name = @application.fqdn\n begin\n nameservers = NameServerCache.get_name_servers\n rescue Exception => e\n return render_error(:not_found, \"Could not resolve DNS #{name}: #{e.message}\", 170, \"DNS_RESOLVABLE\")\n end\n\n dns = Dnsruby::Resolver.new(:nameserver => nameservers[rand(nameservers.length)]) if nameservers\n begin\n dns.query(name, Dnsruby::Types.A)\n render_success(:ok, \"boolean\", true, \"Resolved DNS #{name}\")\n rescue Exception => e\n render_error(:not_found, \"Could not resolve DNS #{name}: #{e.message}\", 170)\n end\n end", "def find_db\n db = nil\n if !database.nil?\n db = rds.db_instances[database]\n elsif !environment.nil?\n db = find_db_by_environment(environment)\n end\n db\n end", "def cloud_controller_database\n if Chef::Config[:solo]\n return cloud_controller_database_from_attrs\n end\n\n ccdb_role = node['cloudfoundry']['roles']['cloud_controller_database_master']\n unless ccdb_role\n return cloud_controller_database_from_attrs\n end\n\n results = search(:node, \"roles:#{ccdb_role} AND chef_environment:#{node.chef_environment}\")\n unless results.any?\n Chef::Log.warn \"No CCDB found with a search for roles:#{ccdb_role}\"\n return cloud_controller_database_from_attrs\n end\n\n if results.count > 1\n Chef::Log.warn \"More than one CCDB found with a search for roles:#{ccdb_role}, picking the first\"\n end\n ccdb = results[0]\n\n cloud_controller_database_from_attrs(ccdb)\nend", "def db_name\n data[:db_name]\n end", "def database_name\n data[:database_name]\n end", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n require \"pp\"\n pp directors_database\nend", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n require 'pp'\n p directors_database\nend", "def dbs\n @dbs_hash.keys\n end", "def database_name\n @dbi.db_name\n end", "def database_name\n @dbi.db_name\n end", "def what_should_my_dns_be?\n get_mongo_dns_endpoint(get_instance_id)\n end", "def all_directors\n\t\tself.house_directors + self.asst_div_directors + self.clinical_managers + self.asst_house_managers\n\tend", "def db\n @db ||= finder_result.connection\n end", "def find_datastore(datacenter, ds_name)\n dc = datacenter\n base_entity = dc.datastore\n base_entity.find { |f| f.info.name == ds_name } \\\n || abort(\"no such datastore #{ds_name}\")\nend", "def referencing_databases\n ensure_service!\n\n @grpc.referencing_databases.map do |referencing_database|\n segments = referencing_database.split \"/\"\n database_grpc = service.get_database segments[3], segments[5]\n Database.from_grpc database_grpc, service\n end\n end", "def execute\n puts DB_MSG\n logger.info(DB_MSG)\n # connect to the database and query on a Site\n CaTissue::Database.current.open { find_in_transit_site }\n end", "def dns(target, page: 1)\n params = { page: page }\n _get(\"/query/domains/dns/#{target}\", params) { |json| json }\n end", "def index\n @dor_informations = DorInformation.all\n end", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n pp directors_database\n nil\nend", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n pp directors_database\n nil\nend", "def datastore(arg)\n ds = VCenterDriver::VIHelper.one_item(OpenNebula::Datastore, arg)\n\n {\n :ds_ref => ds['TEMPLATE/VCENTER_DS_REF'],\n :one_item => ds\n }\n end", "def dns\n doc = request(\"dns-list_records\")\n api_error?(doc)\n (doc/:data).inject([]) { |records, dns| records << Dns.new_from_xml(dns); records }\n end", "def print_directors(nds)\n pp nds\nend", "def database_names\n database_info.keys\n end", "def getDefaultDatabases\n if !$remoteDatabasesLoaded\n info \"Loading remote databases...\"\n\n $remoteDatabases = []\n\n failures = false\n\n if !loadDatabase \"boostslair\",\n \"https://boostslair.com/rubysetupsystem/database.json\",\n File.expand_path('rubysetupsystem.cert', __dir__)\n failures = true\n end\n\n if failures\n warning \"One or more databases failed to download.\"\n warning \"Precompiled and other features may be unavailable.\"\n end\n\n $remoteDatabasesLoaded = true\n info \"#{$remoteDatabases.length} remote databases loaded\"\n end\n\n $remoteDatabases\nend", "def printGetSupportedDBs()\n printDebugMessage('printGetSupportedDBs', 'Begin', 1)\n dbInfoList = getDatabaseInfoList()\n dbInfoList.each{ |dbInfo|\n puts dbInfo.elements['name'].text\n }\n printDebugMessage('printGetSupportedDBs', 'End', 1)\n end", "def dns\n @dns ||= Resolv::DNS.open\n end", "def main\n Dotenv.load\n # get arg\n time = ARGV.length < 2 ? '15m' : \"%s%s\" % [ARGV[0], ARGV[1]]\n # check environment variables\n # exit if not set those\n if ENV['ND_DB_HOST'] == nil || ENV['ND_DB_USER'] == nil || ENV['ND_DB_PASS'] == nil || ENV['ND_DB_NAME'] == nil\n puts 'environment value has not set'\n puts 'you have to set ND_DB_{NAME,USER,PASS,HOST}'\n exit(1)\n end\n Process.daemon\n scheduler = Rufus::Scheduler.new\n register_pid\n scheduler.every time do\n ND::NDCrawl.new(ENV['ND_DB_HOST'], ENV['ND_DB_USER'], ENV['ND_DB_PASS'], ENV['ND_DB_NAME']).main\n end\n scheduler.join\nend", "def add_disseminator_location_to_datastreams\n self.ds_specs.each do |name,ds_config|\n ds = datastreams[name]\n if ds && ds.controlGroup == 'E' && ds_config[:disseminator].present?\n ds.dsLocation= \"#{ActiveFedora.config_for_environment[:url]}/objects/#{pid}/methods/#{ds_config[:disseminator]}\"\n end\n end\n true\n end", "def rdfs_domain\n end", "def druid_db_obj\n @druid_db_obj ||= Druid.find_or_create_by!(druid: druid)\n end", "def retrieve_db\n require 'rubygems'\n require 'mongo'\n\n Mongo::MongoClient.new(\n \"localhost\",\n \"27017\",\n :connect_timeout => 180\n )\nend", "def list\n cf_get(path: \"#{uri_prefix}/virtual_dns\")\n end", "def get_all_ndbnos\n puts \"Fetching all NDB numbers...\\n\\n\"\n ndbnos = []\n begin\n # We manually break this loop because we never make assumptions about how\n # big the NDB list is\n offset = 0\n i = 0\n max = 250\n while 1\n puts \"Querying the NDB -- \" + i.to_s + \"\\n\"\n response = self.class.get \"/ndb/list\", {\n query: {\n lt: \"f\",\n max: max,\n offset: offset,\n }\n }\n # No responses? We're at the end!\n break if response[\"list\"][\"total\"] == 0\n # Responses, so add them all to our ndbnos database\n ndbnos.concat(response[\"list\"][\"item\"].map { |item| item[\"id\"] })\n offset = offset + 250\n i = i + 1\n end\n rescue\n # Something went wrong! Typically, this is nothing, but let the user know\n puts \"\\n\\nHmm... something went wrong when querying NDB IDs...\\n\\n\"\n end\n ndbnos = ndbnos.uniq\n puts \"\\n\\nFound \" + ndbnos.count.to_s + \" IDs...\"\n return ndbnos\n end", "def database_name\n @database_name\n end", "def index\n @users_dbs = UsersDb.all\n end", "def database\n self.class.database\n end", "def dns\n @gapi.dns_name\n end", "def dns\n @dns ||= @node.search('DNS/listEntry').map do |entry|\n DomainName.new(entry.inner_text)\n end\n end", "def pretty_print_nds(nds)\n d= directors_database\n #binding.pry\n pp d\n\nend", "def get_DN(cn)\n return \"cn=#{escape_seg(cn)},#{@people_base}\"\n end", "def srvhost\n datastore['SRVHOST']\n end", "def _connect_database\n _send_command(\"db_connect #{@options[:db_user]}:#{@options[:db_pass]}@#{@options[:db_host]}/#{@options[:db_name]}\")\n end", "def database_info(*names)\n names = names.map(&:to_s)\n info = native.list_databases\n info = info.select { |e| names.include?(e[:name]) } unless names.empty?\n names.size == 1 ? info.first : info\n end", "def pretty_print_nds(nds)\n # Change the code below to pretty print the nds with pp\n #nil\n require 'pp'\n pp directors_database\n puts directors_database\nend", "def database_info(dbname, options = {})\n version = options.fetch(:t, '-')\n get db_url(dbname, version) + \"/\", :Accept => 'application/edn'\n end", "def index\n @ad_crawling_dbs = AdCrawlingDb.all\n end" ]
[ "0.5962282", "0.5917655", "0.573061", "0.573061", "0.5696976", "0.5647392", "0.5623889", "0.56018966", "0.5586423", "0.55815876", "0.55814934", "0.5535011", "0.5483551", "0.54736954", "0.5452035", "0.5441273", "0.5437387", "0.5412612", "0.5402453", "0.5402453", "0.5395019", "0.5394764", "0.53849554", "0.53849554", "0.53478885", "0.53478885", "0.5318709", "0.53187084", "0.53187084", "0.53187084", "0.53187084", "0.53187084", "0.5315239", "0.531449", "0.5306047", "0.5304033", "0.52896845", "0.52796435", "0.527711", "0.5275158", "0.5244254", "0.5225082", "0.52168953", "0.5203987", "0.51910806", "0.5174632", "0.51710206", "0.5167184", "0.5165047", "0.5141179", "0.5141179", "0.51401734", "0.51401734", "0.5138466", "0.51354694", "0.5131974", "0.51310676", "0.51296234", "0.5126871", "0.5122242", "0.5121584", "0.51083094", "0.51022", "0.51022", "0.50995374", "0.5097098", "0.5092913", "0.5092864", "0.50885314", "0.50862265", "0.5083907", "0.5078071", "0.5070301", "0.5070301", "0.5063907", "0.5058018", "0.5047962", "0.5044961", "0.50432545", "0.50357133", "0.50291693", "0.50284636", "0.5027644", "0.5017355", "0.49992022", "0.4986994", "0.498385", "0.49813527", "0.4979547", "0.49794498", "0.49763188", "0.49729523", "0.49712613", "0.49680457", "0.4967245", "0.4966038", "0.49651876", "0.4963334", "0.49614358", "0.4959731", "0.49546245" ]
0.0
-1
Use this to find news sources from Google News. Run it periodically to build up a bank of news sources to include
def find_sources names = "" Googlenews.items(100).each do |report| name = report['title'].match(/ - ([\w. ]+)/)[1] names << name unless Source.find_by_name(name) source = Source.new({ :name => name }) source.save end end render :text => names end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def googleNewsSearch(name, mins = 720)\n\n type = \"\"\n theRep = Rep.all\n puts \"THE REP! : #{theRep}\"\n if Rep.where(name: name)[0].json.index(\"senate\") != nil\n type = \"Sen\"\n else\n type = \"Rep\"\n end\n\n # fix the name -- so if there is 'ç' or some weird\n # character like that, it turns into 'c'\n name = ActiveSupport::Inflector.transliterate(name)\n query = \"%22#{type} #{name}%22\"\n query.gsub!(\" \", \"%20\")\n\n link = \"https://www.google.com/search?q=#{query}&tbm=nws&tbs=qdr:n#{mins}\"\n file = open(link)\n document = Nokogiri::HTML(file)\n puts document.class\n titles = document.css('h3 > a')\n urls = document.css('h3 > a')\n excerpts = document.css('.st')\n dates = document.css('div.slp > span.f')\n\n\n\n articles = []\n for i in 0..(titles.length - 1)\n article_info = {}\n article_info[\"title\"] = cleanString(titles[i].text)\n article_info['url'] = cleanUrl(urls[i].attr('href'))\n article_info['excerpt'] = cleanString(excerpts[i].text)\n article_info['date'] = cleanDate(dates[i].text)\n articles << article_info\n end\n\n return articles\nend", "def scrape\n\t\topen(@url) do |rss|\n\t\t\tfeed = RSS::Parser.parse(rss)\n\t\t\t@source_name = feed.channel.title\n\t\t\tfeed.items.each do |item|\n\t\t\t\tif date_valid?(item.pubDate) and item.title\n\t\t\t\t\tcreate_article(item.dc_creator, item.title, item.description,\\\n\t\t\t\t\t\t\"\", @source_name, item.pubDate.to_date, item.link)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t@articles\n\tend", "def scrape\n\t\topen(@url) do |rss|\n\t\t\tfeed = RSS::Parser.parse(rss)\n\t\t\t@source_name = feed.channel.title\n\t\t\tfeed.items.each do |item|\n\t\t\t\tif date_valid?(item.pubDate) and item.title\n\t\t\t\t\tcreate_article(get_author(item), item.title, item.description,\\\n\t\t\t\t\t\tget_images(item), @source_name, item.pubDate.to_date,\\\n\t\t\t\t\t\titem.link, get_image_length(item))\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t@articles\n\tend", "def scrape\n\t\topen(@url) do |rss|\n\t\t\tfeed = RSS::Parser.parse(rss)\n\t\t\tfeed.items.each do |item|\n\t\t\t\tif date_valid?(item.pubDate) and item.title\n\t\t\t\t\tcreate_article(@default_author, item.title, item.description,\\\n\t\t\t\t\t\t\"\", @source_name, item.pubDate.to_date, item.link)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t@articles\n\tend", "def sources_data\n sources_url = Api.gnews_path('sources')\n call_gnews_url(sources_url).parse\n end", "def crawl\n update_all_feeds\n fetch_and_store_articles\n end", "def get_urls_to_retrieve(d1)\n urls = []\n\n if (d1==nil || d1 ==\"\")\n t = DateTime.now\n d = t.strftime(\"%Y/%m/%d\")\n else\n d = d1\n end\n pt1 = \"http://www.bbc.co.uk/\"\n pt2 = \"/programmes/schedules/\"\n\n channel = \"bbcone\"\n url = \"#{pt1}#{channel}#{pt2}london/#{d}.json\"\n urls.push(url)\n\n channel = \"bbctwo\"\n url = \"#{pt1}#{channel}#{pt2}england/#{d}.json\"\n urls.push(url)\n\n channel = \"bbcthree\"\n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n channel = \"bbcfour\"\n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n channel = \"bbchd\"\n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n channel = \"cbeebies\"\n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n channel = \"cbbc\"\n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n channel = \"parliament\"\n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n channel = \"bbcnews\"\n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n channel = \"radio4\"\n url = \"#{pt1}#{channel}#{pt2}fm/#{d}.json\"\n\n channel = \"radio1\"\n url = \"#{pt1}#{channel}#{pt2}england/#{d}.json\"\n\n channel = \"1extra\"\n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n channel = \"radio2\"\n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n channel = \"radio3\"\n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n channel = \"5live\" \n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n channel = \"5livesportsextra\"\n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n channel = \"6music\"\n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n channel = \"asiannetwork\"\n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n channel = \"worldservice\"\n url = \"#{pt1}#{channel}#{pt2}#{d}.json\"\n urls.push(url)\n\n return urls\n end", "def search_and_fetch_jobs\n feed = RSS::Parser.parse(open(target_url_with_query))\n feed.items.take(10)\n end", "def fetch_articles\n current_feed = get_rss_feed( self.url )\n current_feed.entries.each do |article|\n unless self.array_of_article_urls.include?(article.url)\n a = Article.new(title: article.title, url: article.url, clicks: 0)\n a.title ||= article.summary\n self.articles.push a \n end\n end\n\tend", "def get_new_articles\n # Download the RSS feed and save to self.doc\n get_source\n \n # Keep track of which articles are in the feed \n articles = []\n \n article_links = (self.doc/'li.mjItemMain').collect do |mjItem|\n mjItem.at('a.mjLinkItem')\n end\n \n # For each item in the RSS feed \n article_links.each_with_index do |link, index|\n \n # Create or update the article in the db\n articles << Article.factory(\n :category => self.category,\n :description => '',\n :feed => self,\n :url => \"http://online.wsj.com#{link.attributes['href']}\",\n :priority => index\n )\n end\n \n articles\n end", "def get_urls()\n generate_thread(@@source_url)\n end", "def fetch_data\n rss_provider = RssProvider.find(params[:format])\n unless rss_provider.rss_url.include?(\"indiatvnews\" ) || rss_provider.rss_url.include?(\"hindu\" ) || rss_provider.rss_url.include?(\"zee\" )\n xml = HTTParty.get(rss_provider.rss_url)\n ProviderContent.create(xml: xml, rss_provider_id: rss_provider.id)\n feeds = xml[\"rss\"][\"channel\"][\"item\"]\n feeds.each do |feed|\n if rss_provider.rss_url.include?(\"indiatoday\" )\n title = News.find_by(title: feed[\"title\"])\n unless title.present?\n\n\n index_of_summary = feed[\"description\"].index(\"</a>\")\n summary = feed[\"description\"][index_of_summary..].delete_prefix(\"</a> \")\n index_of_image = feed[\"description\"].index(\"src\")\n image_url = feed[\"description\"][(index_of_image+5)..(index_of_summary-4)]\n News.create(title: feed[\"title\"], summary: summary, \n published_on: feed[\"pubDate\"], url: feed[\"link\"], media_url: image_url,\n rss_provider_id: rss_provider.id, category_id: rss_provider.category.id, \n provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n rss_provider.update(news_updated_at: Time.now.localtime)\n\n end\n\n \n elsif rss_provider.rss_url.include?(\"news18\")\n title = News.find_by(title: feed[\"title\"])\n unless title.present?\n index_of_image = feed[\"description\"].index(\"https\")\n summary_index = feed[\"description\"].index(\" />\")\n last_index_of_image = feed[\"description\"].index(\"jpg\")\n image_url = feed[\"description\"][(index_of_image)..(last_index_of_image)] + \"pg\"\n summary = feed[\"description\"][(summary_index+3)..]\n News.create(title: feed[\"title\"], summary: summary,published_on: feed[\"pubDate\"], url: feed[\"link\"], media_url: image_url, rss_provider_id: rss_provider.id, category_id: rss_provider.category.id, \n provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n rss_provider.update(news_updated_at: Time.now.localtime)\n end\n\n\n elsif rss_provider.rss_url.include?(\"bbc\")\n title = News.find_by(title: feed[\"title\"])\n unless title.present?\n News.create(title: feed[\"title\"], summary: feed[\"description\"], \n published_on: feed[\"pubDate\"], url: feed[\"link\"], media_url: feed[\"fullimage\"], \n rss_provider_id: rss_provider.id, category_id: rss_provider.category.id, \n provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n rss_provider.update(news_updated_at: Time.now.localtime)\n end\n\n\n elsif rss_provider.rss_url.include?(\"ndtv\")\n title = News.find_by(title: feed[\"title\"])\n unless title.present?\n News.create!(title: feed[\"title\"], summary: feed[\"description\"], \n published_on: feed[\"updatedAt\"], url: feed[\"link\"], media_url: feed[\"fullimage\"], \n rss_provider_id: rss_provider.id, category_id: rss_provider.category.id,provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n rss_provider.update(news_updated_at: Time.now.localtime)\n end\n\n\n \n elsif rss_provider.rss_url.include?(\"timesofindia\")\n title = News.find_by(title: feed[\"title\"])\n\n unless title.present?\n\n if rss_provider.category.category_name == \"Top Story\" \n News.create(title: feed[\"title\"], summary: feed[\"description\"], \n published_on: feed[\"pubDate\"], url: feed[\"link\"], media_url: \"\", \n rss_provider_id: rss_provider.id,category_id: rss_provider.category.id, \n provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n rss_provider.update(news_updated_at: Time.now.localtime) \n else\n unless feed[\"description\"] == nil \n index_of_image = feed[\"description\"].index(\"src\")\n last_index_of_image = feed[\"description\"][index_of_image..].index(\"/>\")+index_of_image\n image_url = feed[\"description\"][(index_of_image+5)..(last_index_of_image-3)]\n summary_index = feed[\"description\"].index(\"</a>\")\n summary = feed[\"description\"][(summary_index+4)..]\n News.create(title: feed[\"title\"], summary: summary, \n published_on: feed[\"pubDate\"], url: feed[\"link\"], media_url: image_url, \n rss_provider_id: rss_provider.id, category_id: rss_provider.category.id, \n provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n rss_provider.update(news_updated_at: Time.now.localtime)\n end\n end\n end\n \n\n end\n\n end\n end\n\n unless rss_provider.rss_url.include?(\"timesofindia\" ) || rss_provider.rss_url.include?(\"ndtv\" ) || rss_provider.rss_url.include?(\"bbc\" ) ||\n rss_provider.rss_url.include?(\"news18\") || rss_provider.rss_url.include?(\"indiatoday\") \n\n\n if rss_provider.rss_url.include?(\"indiatvnews\" )\n xml = HTTParty.get(rss_provider.rss_url)\n ProviderContent.create(xml: xml, rss_provider_id: rss_provider.id)\n\n xml = xml.body\n feeds = Feedjira.parse(xml)\n feeds.entries.each do |feed|\n index_of_summary = feed.summary.index(\"</a>\")\n summary = feed.summary[index_of_summary+4..]\n index_of_image = feed.summary.index(\"src\")\n image_url = feed.summary[(index_of_image+5)..(index_of_summary-5)]\n title = News.find_by(title: feed.title)\n unless title.present?\n News.create(title: feed.title, summary: summary, \n published_on: feed.published, url: feed.url, media_url: image_url, \n rss_provider_id: rss_provider.id, category_id: rss_provider.category.id, \n provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n end\n\n end\n rss_provider.update(news_updated_at: Time.now.localtime)\n\n elsif rss_provider.rss_url.include?(\"thehindu\")\n xml = HTTParty.get(rss_provider.rss_url)\n ProviderContent.create(xml: xml, rss_provider_id: rss_provider.id)\n xml = xml.body\n feeds = Feedjira.parse(xml)\n feeds.entries.each do |feed|\n title = News.find_by(title: feed.title)\n unless title.present?\n News.create(title: feed.title, summary: feed.summary.strip, \n published_on: feed.published, url: feed.url,rss_provider_id: rss_provider.id, category_id: rss_provider.category.id, \n provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n end\n\n end\n rss_provider.update(news_updated_at: Time.now.localtime)\n\n elsif rss_provider.rss_url.include?(\"zee\")\n xml = HTTParty.get(rss_provider.rss_url)\n ProviderContent.create(xml: xml, rss_provider_id: rss_provider.id)\n xml = xml.body\n feeds = Feedjira.parse(xml)\n feeds.entries.each do |feed|\n title = News.find_by(title: feed.title)\n unless title.present?\n News.create(title: feed.title, summary: feed.summary.strip, \n published_on: feed.published, url: feed.url,rss_provider_id: rss_provider.id, category_id: rss_provider.category.id, \n provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n end\n\n end\n rss_provider.update(news_updated_at: Time.now.localtime)\n end\n\n end\n\n unless rss_provider.rss_url.include?(\"timesofindia\" ) || rss_provider.rss_url.include?(\"ndtv\" ) || rss_provider.rss_url.include?(\"bbc\" ) ||\n rss_provider.rss_url.include?(\"news18\") || rss_provider.rss_url.include?(\"indiatoday\") ||\n rss_provider.rss_url.include?(\"indiatvnews\") || rss_provider.rss_url.include?(\"thehindu\") ||\n rss_provider.rss_url.include?(\"zee\")\n\n xml = HTTParty.get(rss_provider.rss_url)\n ProviderContent.create(xml: xml, rss_provider_id: rss_provider.id)\n xml = xml.body\n feeds = Feedjira.parse(xml)\n feeds.entries.each do |feed|\n title = News.find_by(title: feed.title)\n unless title.present?\n News.create(title: feed.title, summary: feed.summary.strip, \n published_on: feed.published, url: feed.url,rss_provider_id: rss_provider.id, category_id: rss_provider.category.id, \n provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n end\n\n end\n rss_provider.update(news_updated_at: Time.now.localtime)\n\n end\n redirect_to admin_rss_providers_path, alert: \"Fetched Successfully \"\n\n end", "def fetch_articles\n\t\trequire 'open-uri'\n\t\tnewest_article = Article.limit(1).order(\"date DESC\")\n\t\ttrigger = false\n\t\tarticles = Array.new\n\t\tcache_article = Article.new\n\n\t\tfile = open(URL)\n\t\tcontents = file.readlines\n\t\tcontents.each do |line|\n\t\t\tif trigger\n\t\t\t\t#Date\n\t\t\t\tif line =~ /[1-3]?[0-9]\\.1?[0-9]\\.201[0-9]{1}/\n\t\t\t\t\tcache_article.date = line.slice(/[1-3]?[0-9]\\.1?[0-9]\\.201[0-9]{1}/)\n\t\t\t\t\tif (newest_article[0] != nil && cache_article.date < newest_article[0].date)\n\t\t\t\t\t\treturn nil\n\t\t\t\t\tend\n\t\t\t\t#Title\n\t\t\t\telsif line =~ /<h2>.+<\\/h2>/\n\t\t\t\t\tline.slice!(\"<h2>\")\n\t\t\t\t\tline.slice!(\"<\\/h2>\")\n\t\t\t\t\tcache_article.title = replace_uml line.strip\n\t\t\t\t#Text\n\t\t\t\telsif line =~ /<p[^>]*>/\n\t\t\t\t\tcache_article.text = fetch_text cache_article.url\n\t\t\t\t\tcache_article.text = replace_uml cache_article.text\n\t\t\t\t\timage_url = fetch_image_url cache_article.url\n\t\t\t\t\tcache_article.news_image = URI.parse(image_url) \n\t\t\t\t\tarticle = Article.create(title: cache_article.title, url: cache_article.url, text: cache_article.text, date: cache_article.date, news_image: cache_article.news_image)\n\t\t\t\t\ttrigger = false\n\t\t\t\t#url\n\t\t\t\telsif line =~ /\\/de\\/newsdetail.+.html/\n\t\t\t\t\tcache_article.url = \"http://www.ehco.ch\" + line.slice(/\\/de\\/newsdetail.+.html/)\n\t\t\t\tend\n\t\t\telsif line.include? \"news-element newsarchiv\"\n\t\t\t\ttrigger = true\t\t\t\t\t\n\t\t\tend\n\t\tend\n\tend", "def top_news_sources\n\n end", "def read_rss\n query = \"http://news.google.ru/news?hl=ru&topic=#{@topic}&output=rss&ned=ru_ru&num=30&&scoring=n\"\n feed = Feedjira::Feed.fetch_and_parse(query)\n feed.entries.map do |entry|\n {\n uuid: SecureRandom.uuid,\n title: entry.title,\n url: entry.url.match(GOOGLE_URI_REGEX)[0],\n published_datetime: entry.published,\n published_unixtime: entry.published.to_i\n }\n end\n end", "def scrape\n article_urls = Extractors::GoogleNewsRss.new(query: @query).extract\n\n transformed_articles = []\n\n article_urls.each do |article_url|\n payload = Extractors::Article.new(url: article_url).extract\n article_transformer = Transformers::Article.new(url: article_url, payload: payload)\n\n begin\n transformed_article = article_transformer.transform\n transformed_articles << transformed_article\n yield transformed_article if block_given?\n rescue Transformers::ScrapePatternNotDefined => e\n raise e unless block_given?\n yield e\n end\n end\n\n transformed_articles\n end", "def index\n @search_googles = SearchGoogle.all\n \n term_date = Date.parse((Date.today - 5).to_s)\n \n while term_date < (Date.today)\n google_url = \"http://rank.ezme.net/?mode=recmd\" + \"3\" + \"&day=\" + term_date.to_s\n\n google_crawler = SES.new(\"google\", term_date)\n\n google_crawler.Scraper(google_url)\n\n term_date += 1\n end\n end", "def find_sources\n @articles_found = {}\n @topic = params[:article][:q]\n # Check wikipedia\n @articles_found[:wikipedia] = top_article_wikipedia(params[:article][:q])\n @articles_found.filter! { |_source, article| !article.nil? }\n render 'pages/home'\n end", "def get_cnn\n articles = []\n\n urls = {'politics' => 'http://rss.cnn.com/rss/cnn_allpolitics.rss',\n 'tech' => 'http://rss.cnn.com/rss/cnn_tech.rss',\n 'business' => 'http://rss.cnn.com/rss/money_latest.rss',\n 'travel' => 'http://rss.cnn.com/rss/cnn_travel.rss',\n 'entertainment' => 'http://rss.cnn.com/rss/cnn_showbiz.rss',\n 'health' => 'http://rss.cnn.com/rss/cnn_health.rss',\n 'sports' => 'http://rss.cnn.com/rss/si_topstories.rss'\n }\n\n authors = %w(Dorren Serkan Chad Randall Matt Decarlo Rachel Depa)\n urls.each do |cat, url|\n content = open(url).read\n rss = RSS::Parser.parse(content, false)\n\n rss.items.each do |item|\n article = {:id => item.title.downcase.gsub(/\\W+/, '-'),\n :title => item.title, \n :content => item.description,\n :category => cat,\n :published_at => item.pubDate,\n :ratings => rand(5) + 1,\n :authors => []}\n\n article[:authors] << authors[rand(authors.size)]\n\n 2.times do |i|\n num = rand(50)\n article[:authors] << authors[num] if num < authors.size\n end\n\n articles << article\n end\n end \n\n articles\nend", "def fetch_feeds_from_urls(feed_urls)\n threads = []\n feeds = []\n feed_urls.each do |feed_url|\n threads << Thread.new {\n feeds << RSS::Parser.parse(feed_url, false)\n }\n end\n threads.each {|t| t.join}\n feeds\nend", "def crawl #TODO: (base, source, query, exclusion[])\n folders = get_folders\n links = get_links(folders)\n filtered_links = filter_links(links) #TODO: add exclusion array\n download_files(filtered_links)\n end", "def update_from_feed()\n\t\t\n\t@links = Link.all \n\n\t@links.each do |link| \n\n\t\tfeed = Feedzirra::Feed.fetch_and_parse(link.url)\n\n\t\tputs \"pulling feeds\"\n\t\tfeed.entries.each do |entry|\n\n\t\t\tif entry.published > link.updated_at\n\n\t\t\t\tif entry.url =~ /^#{URI::regexp}$/\n\t\t\t\t\tfind_keywords(entry.url, link.tags)\n\t\t\t\t\tputs entry.url\t\n\t\t\t\telse\n\t\t\t\t\tputs \"bad url\"\n\t\t\t\t\tputs entry.url\t\n\t\t\t\tend\n\t\t\t\t\t\n\t\t\tend\n\t\tend\n\n\tend\n\nend", "def feeds\n all.select { |c| c.google_id =~ /^feed/ }\n end", "def parse_feed url=rss_url, now = Time.now\n\n options = {\n user_agent: 'Geolinguist Test',\n max_redirects: 2,\n compress: true\n }\n\n\n f = Feedjira::Feed.fetch_and_parse url, options\n if f.url != rss_url.sub(RSS_SUFFIX,'')\n self.base_url = f.url.sub(RSS_SUFFIX,'').sub(SUFFIX,'')\n url = rss_url\n save\n f = Feedjira::Feed.fetch_and_parse url, options\n end\n\n\n if f.last_modified.blank?\n save_and_update_last_fetched now if self.last_fetched.blank?\n return\n end\n if last_fetched.blank? || f.last_modified > last_fetched\n puts f.inspect\n f.entries.each do |entry|\n if last_fetched.blank? || last_fetched < entry.published\n self.total_entries += 1\n body = [entry.title,entry.summary].join(\"\\n\")\n matches = LanguageRecognizer.recognize body\n if matches.blank?\n self.no_matches += 1\n else\n matches.each {|match| self[match] += 1}\n end\n end\n end\n save_and_update_last_fetched now\n end\n end", "def build_news(data, last_fetch)\n doc = Nokogiri::HTML(open(data[\"origin\"]))\n news = doc.xpath(data[\"news\"]).collect do |node|\n x = collect_news_item(node, data)\n time = parseTime x[\"time\"].to_s\n x[\"time\"] = time.to_s\n break unless earlier?(last_fetch, time)\n x\n end\n news\n end", "def build_candidates\n doc = Nokogiri::HTML(open(\"http://www.google.com/search?q=#{query}&num=30\"))\n doc.xpath('//div/cite').each do |node|\n @candidates << Sanitize.clean(node)\n end\n\n @candidates = @candidates.collect{|c| c if c.include?(\"http\") && (c.include?(\"youtube.com\") || c.include?(\"soundcloud.com\") || c.include?(\"bandcamp.com\")) }.compact\n\n #replace each with url, score, and title\n set = []\n\n @candidates.each do |c|\n if c.include?(\"youtube\")\n set << get_youtube(c)\n elsif c.include?(\"soundcloud\")\n set << get_soundcloud(c)\n elsif c.include?(\"bandcamp\")\n set << get_bandcamp(c)\n end\n end\n\n @candidates = set\n @candidates.sort!{|x,y| y[:score] <=> x[:score]}\n puts @candidates.count\n end", "def perform\n Source.all.reduce(0) do |count, source|\n begin\n raw_feed = Feedjira::Feed.fetch_and_parse(source.url)\n rescue Feedjira::FetchFailure, Faraday::ConnectionFailed => e\n logger.info(\"Unable to fetch #{source.url}: #{e.message}\")\n next count\n rescue Feedjira::NoParserAvailable => e\n logger.info(\"No parser available for source #{source.url}: #{e.message}\")\n next count\n end\n\n refresh_source(source, raw_feed)\n\n entries_to_save = raw_feed.entries.reject do |entry|\n Post.where(internal_id: entry.entry_id).exists?\n end\n\n posts = entries_to_save.map do |entry|\n PostBuilder.build(entry, source)\n end\n\n source.subscribers.each do |user|\n posts.each do |post|\n post.populize_entry(user)\n end\n end\n\n count + entries_to_save.size\n end\n end", "def get_urls(url, d)\n useragent = \"NotubeMiniCrawler/0.1\"\n u = URI.parse url \n req = Net::HTTP::Get.new(u.request_uri,{'User-Agent' => useragent})\n begin \n res2 = Net::HTTP.new(u.host, u.port).start {|http|http.request(req) }\n end\n j = nil\n begin\n j = JSON.parse(res2.body)\n rescue JSON::ParserError=>e\n puts \"Error \"+e.to_s\n return Array.new\n rescue OpenURI::HTTPError=>e\n case e.to_s \n when /^404/\n raise 'Not Found'\n when /^304/\n raise 'No Info'\n end\n return Array.new\n end\n txt = \"\"\n service=j[\"schedule\"][\"service\"][\"key\"]\n serviceTitle=j[\"schedule\"][\"service\"][\"key\"]\n arr = j[\"schedule\"][\"day\"][\"broadcasts\"]\n arr2 = Array.new\n pids = Array.new\n arr.each do |x|\n pid = x[\"programme\"][\"pid\"]\n tt1 = x[\"programme\"][\"display_titles\"][\"title\"]\n tt2 = x[\"programme\"][\"display_titles\"][\"subtitle\"]\n pidTitle = \"#{tt1}: #{tt2}\"\n # fix up &amps;\n pidTitle.gsub!(\"&\",\"&amp;\")\n startd = x[\"start\"]\n endd = x[\"end\"]\n #puts \"start #{startd} date to match #{d} ''\"\n if (startd.match(d))\n pids.push(pid)\n arr2.push({\"pid\"=>pid,\"displayTitle\"=>pidTitle,\"startd\"=>startd,\"endd\"=>endd,\"service\"=>service,\"serviceTitle\"=>serviceTitle})\n end\n end\n return arr2,pids\n end", "def scrape\n @articles = []\n url = 'http://feeds.news.com.au/heraldsun/rss/heraldsun_news_technology_2790.xml'\n open(url) do |rss|\n feed = RSS::Parser.parse(rss, false)\n feed.items.each do |item|\n article = Article.create(title: item.title.to_s.tr('\"', '\\''),\n summary: item.description.to_s\n .gsub(/&#8217;/, '\\'').gsub(/\\\"/, '\\''),\n imageURL: item.enclosure.url,\n link: item.link,\n pubDate: DateTime.parse(item.pubDate.to_s),\n source: HSImporter.source_name)\n @articles << article\n end\n end\n @articles\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 retrieve_data\n # Define the url\n url = 'http://www.sbs.com.au/news/rss/news/science-technology.xml'\n\n # Open the url and parse the rss feed\n open(url) do |rss|\n # Start parsing\n feed = RSS::Parser.parse(rss, false)\n\n # Iterate each item and scrape information\n feed.items.each do |item|\n # If the title of thie article matches the title of the last saved article,\n # stop scraping to avoid from saving duplicates in database\n break if !@last_title.nil? && @last_title.eql?(item.title.to_s)\n\n # If thie article is already stored then ignore\n next if Article.find_by(title: item.title.to_s)\n\n # Make a template dictionary to put @articles\n temp = {\n author: nil,\n title: item.title,\n summary: item.description,\n image: nil,\n date_time: DateTime.parse(item.pubDate.to_s),\n link: item.link,\n categories: nil\n }\n\n # Put the object into articles array\n @articles << temp\n end\n end\n end", "def fetch_next_week_events\n return [] unless sources.try(:first).present?\n\n source = sources.first\n source.refresh_token_if_expired\n\n gdata = Googledata.new\n gdata.pull(source.oauth_token)\n end", "def get_articles(source_hash)\n\t# make string of all the sources in hash\n\tsources_string = \"\"\n\tsource_hash.each_value do |source_array|\n\t\tsource_array.each do |source|\n\t\t\tsources_string += \"#{source},\"\n\t\tend\n\tend\n\n\n\trequest_string = \"https://newsapi.org/v2/top-headlines?sources=#{sources_string}&apiKey=ecd08186d0394c99bcd808f2f76eed1b\"\n\t\n\tsample_uri = URI(request_string) #opens a portal to the data at that link\n\tsample_response = Net::HTTP.get(sample_uri) #go grab the data in the portal\n\tsample_parsedResponse = JSON.parse(sample_response) #makes data easy to read\n\t\n\t# articles stored as an ARRAY stored in value of key \"articles\"\n\tarticle_data = sample_parsedResponse[\"articles\"]\n\t# data is now an array of articles from all sources\n\treturn article_data\nend", "def scrape\n\t\turi = URI.parse(@url)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\thttp.use_ssl = false\n\t\t#Make a GET request to the given url\n\t\tresponse = http.send_request('GET', @request_url)\n\t\t# Parse the response body\n\t\tforecast = JSON.parse(response.body)\n\t\tforecast[\"response\"][\"results\"].each do |article|\n\t\t\tif date_valid?(article[\"webPublicationDate\"])\n\t\t\t\tcreate_article(article[\"type\"], article[\"sectionId\"],\n\t\t\t\t\tarticle[\"webTitle\"], article[\"webPublicationDate\"],\n\t\t\t\t\tarticle[\"id\"], article[\"webUrl\"], article[\"apiUrl\"],\n\t\t\t\t\tarticle[\"sectionName\"])\n\t\t\tend\n\t\tend\n\t\t@articles\n\tend", "def scrape\n @articles = []\n # CODE HERE\n url = 'http://api.nytimes.com/'\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = false\n request_url = url + 'svc/search/v2/articlesearch.'\\\n 'json?fq=romney&facet_field=day_of_week&begin_date'\\\n \"=#{(Date.today - 7).to_s.delete!('-')}&end_date\"\\\n \"=#{Date.today.to_s.delete!('-')}&api-key=#{@nyt_api_key}\"\n response = http.send_request('GET', request_url)\n json_message = JSON.parse(response.body)\n json_message.fetch('response').fetch('docs').each do |key|\n article = Article.create(author: nil,\n title: key.fetch('headline').fetch('main')\n .to_s,\n summary: key.fetch('snippet') ? (key.fetch('abstract')) : nil,\n imageURL: nil,\n source: key.fetch('source'),\n pubDate: DateTime.parse(key.fetch('pub_date')\n .to_s),\n link: key.fetch('web_url').to_s)\n @articles << article\n end\n @articles\n end", "def get_all_the_urls_of_val_doise_townhalls(url)\n page = Nokogiri::HTML(open(url))\n urls = []\n source = \"http://annuaire-des-mairies.com/\"\n news_links = page.css(\"a\").select{|link| link['class'] == \"lientxt\"}\n news_links.each do |link|\n lien = link['href']\n nv_link = lien.byteslice(2,lien.length)\n nv_link = source + nv_link\n urls << nv_link\n end\n return urls\nend", "def scrape\n google_url = create_google_url\n google_data = Scrubyt::Extractor.define do\n fetch google_url\n\n link_title \"//a[@class='l']\", :write_text => true do\n link_url\n end\n end\n google_data.to_hash.map {|r| r[:link_url]}\n end", "def makeSourcesList(accounts)\n sources = []\n\n accounts.each do |account|\n if account[:service] == 'twitter'\n sources << buildSourceHash(account, 'Home Timeline', 'statuses/home_timeline')\n sources << buildSourceHash(account, 'Own Tweets', 'statuses/user_timeline')\n sources << buildSourceHash(account, 'Mentions', 'statuses/mentions_timeline')\n sources << buildSourceHash(account, 'Direct Messages', 'direct_messages')\n sources << buildSourceHash(account, 'Sent Messages', 'direct_messages/sent')\n # Now we have to auth with Twitter to get the lists\n twitterClient = Twitter::REST::Client.new do |config|\n config.consumer_key = ENV['TWITTER_CONSUMER_KEY']\n config.consumer_secret = ENV['TWITTER_CONSUMER_SECRET']\n config.access_token = account[:servicetokens]['oauth_token']\n config.access_token_secret = account[:servicetokens]['oauth_token_secret']\n end\n begin\n lists = twitterClient.lists()\n lists.each do |list|\n sources << buildSourceHash(account, \"#{list[:name].gsub(/[\\-_]/,' ').titlecase} list\", \"lists/#{list[:slug]}/statuses\")\n end\n rescue\n end\n \n elsif account[:service] == 'facebook'\n sources << buildSourceHash(account, 'Home Feed', 'me/home')\n sources << buildSourceHash(account, 'Wall', 'me/feed')\n sources << buildSourceHash(account, 'Events', 'me/events')\n sources << buildSourceHash(account, 'Notifications', 'me/notifications')\n end\n end\n\n return sources\nend", "def get_sources(workdir)\n @sources.each do |source|\n cur_source = Vanagon::Component::Source.source(source.url, { :ref => source.ref, :sum => source.sum }, workdir)\n cur_source.fetch\n cur_source.verify\n end\n end", "def get_video_urls(feed_url)\n Youtube.notify \"Retrieving videos...\"\n urls_titles = {}\n result_feed = Nokogiri::XML(open(feed_url))\n urls_titles.merge!(grab_urls_and_titles(result_feed))\n\n #as long as the feed has a next link we follow it and add the resulting video urls\n loop do\n next_link = result_feed.search(\"//feed/link[@rel='next']\").first\n break if next_link.nil?\n result_feed = Nokogiri::HTML(open(next_link[\"href\"]))\n urls_titles.merge!(grab_urls_and_titles(result_feed))\n end\n\n filter_urls(urls_titles)\n end", "def run\n scraper = ThreatDetector::Scraper.new options\n\n fetch_feeds.map do |item|\n next unless valid_feed?(item)\n\n scraper.for(item['name'], item['url'])\n scraper.parse_and_save_entries\n\n yield(item, scraper) if block_given?\n item.slice('name', 'url', 'source')\n end.compact\n end", "def news_results\n GoogleNewsResults.instance\n end", "def scrape\t\t\n url = 'http://api.nytimes.com'\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n #If the api being scraped uses https, then set use_ssl to true.\n #http.use_ssl = false\n request_url = '/svc/search/v2/articlesearch.json?q=bangkok+bombings&page=1&sort=newest&api-key=e89effddaf8553d3a95336aaf6882ebe:5:72702694'\n response = http.send_request('GET', request_url)\n article_parse = JSON.parse(response.body)\n article_data= article_parse['response']['docs']\n puts \"Title: The New York Times\"\n puts \"--------------------------------\"\n article_data.each do |v|\n\n tags= tag_article(v['headline']['main'].to_s)\n article = Article.new(title: v['headline']['main'].to_s, \n summary: v['snippet'].to_s, \n link: v['web_url'], \n source: \"New York Times\", \n date: v['pub_date'].to_s.gsub(/,/,'.'), \n tag_list: tags)\n article.save\n end\n\t end", "def sources\n @sources ||= AVAILABLE_SOURCES.each_with_object({}) do |source_class, list|\n source = source_class.new\n list[source.id.to_s] = {\n 'name' => source.name,\n 'website' => source.website,\n 'notes' => source.notes,\n 'class' => source.class\n }\n end\n end", "def scrape\n open(@url) do |rss|\n feed = RSS::Parser.parse(rss)\n\n feed.items.each do |item|\n # Remove the p tag and retrieve image url from the description\n # if it exists\n p_tag = item.description[%r{<p>.*</p>}]\n if p_tag\n item.description.slice! p_tag\n img_url = p_tag.match(/src=\"(?<img>[^\"]*)\"/)[:img]\n else\n img_url = nil\n end\n\n # Sanitize HTML\n item.title = CGI.unescapeHTML(item.title)\n item.description = CGI.unescapeHTML(item.description)\n\n @articles.push(\n title: item.title,\n summary: item.description,\n image_url: img_url,\n source: @source,\n url: item.link,\n pub_date: item.pubDate.to_s,\n guid: item.guid.content\n )\n end\n end\n end", "def cache_feeds\n puts \"Caching feeds... (can be slow)\"\n feeds = Conf.feeds.map do |uri|\n # silly to need this, but if the feed fails to fetch,\n # don't kill the ruby thread ...\n begin\n feed = FeedTools::Feed.open( uri )\n { :uri => uri, :title => feed.title, \n :items => feed.items.map { |item| { :title => item.title, :author => item.author.name, :published => item.published, :link => item.link } } }\n rescue FeedTools::FeedAccessError\n puts uri\n next\n end\n end\n feeds.each { |feed|\n new = CachedFeed.find_or_initialize_by_uri( feed[:uri] )\n new.parsed_feed = feed\n new.save!\n }\n end", "def run_ticker(m)\n config = YAML.safe_load(File.read(\"config/google.yml\"))\n source = \"http://www.google.com/appsstatus/rss/en\"\n current_msg = String.new\n \n # Get current RSS message without reporting it.\n raw = String.new\n open(source) do |input|\n raw = input.read\n end\n rss = RSS::Parser.parse(raw, false)\n\n if !rss.items.empty?\n current_msg = rss.items[0].description\n end\n\n # Begin checking for new RSS messages.\n while @@active\n sleep(config['frequency'])\n\n raw = String.new\n open(source) do |input|\n raw = input.read\n end\n rss = RSS::Parser.parse(raw, false)\n\n # If there are any entries in the RSS feed, check if they\n # are different from what we already have. If so, update, then\n # print them out.\n if !rss.items.empty?\n if (rss.items[0].description != current_msg)\n current_msg = rss.items[0].description\n\n cleaned_rss = Sanitize.clean(rss.items[0].description)\n # Google has an interesting way of dividing up different entries...\n # with the following Unicode character delimiter.\n msg_set = cleaned_rss.split \"\\u00A0\"\n msg_set.each { |msg| msg.strip! }\n msg_set.delete_if { |msg| msg.empty? }\n \n reply = \"[#{rss.items[0].title}] \"\n reply << (msg_set[0]).to_s\n \n # Report RSS results to each channel in the list.\n config['channels'].each do |chname|\n max_msg_size = 512 - m.bot.nick.size - chname.size - 43\n Channel(chname).send reply[0,max_msg_size]\n Channel(chname).send \"More info at: #{rss.items[0].link}\"\n end\n\n end\n end\n end\n\n end", "def scrape\n articles = []\n url = 'http://api.nytimes.com'\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = false\n\n key = 'api-key=c12cb16541dce28040f58db4a5e139d6%3A17%3A72711388'\n\n request_url = '/svc/search/v2/articlesearch.json?' + key\n response = http.send_request('GET', request_url)\n\n result = JSON.parse(response.body)\n docs = result['response']['docs']\n\n docs.each do |doc|\n articles << (interpret doc)\n end\n articles\n end", "def fetch_items(options = {})\n options = options.reverse_merge(:enable_max_items_per_fetch => true,\n :enable_last_fetched_item_url => true ,\n :enable_max_pages_per_fetch => true)\n\n logger.info \"now fetching: #{source_website.name}\"\n if status == RUNNING\n warning = \"the source_website #{source_website.name} is being fetched... please stop it if you want another fetch\"\n logger.info warning\n raise warning\n end\n if invalid_item_list_css?\n warning = \"the source_website #{source_website.name} seems has no entries, is the css: /#{source_website.items_list_css}/ correct? \"\n logger.info warning\n raise warning\n end\n update_attribute(:status, RUNNING)\n logger.debug \"-- last_fetched_item_url: \"\n logger.debug \"-- \\n #{last_fetched_item_url.split(LAST_N_URL_SEPARATOR).join(\"\\n\")}\" unless last_fetched_item_url.blank?\n begin\n fetch_items_list_strategy(options)\n rescue Exception => e\n puts \"exception: #{e}, more details, please check the log\"\n logger.error e\n logger.error e.backtrace.join(\"\\n\")\n ensure\n update_attribute(:status, \"\")\n save_last_fetched_info\n end\n end", "def fetch(source)\n Feedjira::Feed.fetch_and_parse source\n end", "def get_urls(proxy=nil)\n query = SETTINGS.extract_query!\n payloads = SETTINGS.create_payloads(PAYLOAD_TEMPLATE_PATH)\n File.read(\"#{QUERY_BLACKLIST_PATH}\").each_line do |black| # check if the search query is black listed\n if query == black\n FORMAT.warning(\"Query: #{query} is blacklisted, defaulting to random query\")\n query = File.readlines(\"#{PATH}/lib/lists/search_query.txt\").sample # Retry if it is\n end\n end\n\n FORMAT.info(\"I'm searching for possible SQL vulnerable sites, using search query #{query.chomp}\")\n agent = Mechanize.new\n if proxy\n agent.set_proxy(proxy.split(\":\").first, proxy.split(\":\").last) # Set your proxy if used\n end\n correct_agent = SETTINGS.random_agent?\n agent.user_agent = correct_agent\n\n correct_agent == DEFAULT_USER_AGENT ? FORMAT.info(\"Using default user agent\") :\n FORMAT.info(\"Grabbed random agent from #{RAND_AGENT_PATH}\")\n\n google_page = agent.get(\"http://google.com\")\n google_form = google_page.form('f')\n\n FORMAT.info(\"Verifying search query...\")\n unless SETTINGS.test_query(query, correct_agent, proxy)\n query = File.readlines(\"#{PATH}/lib/lists/search_query.txt\").sample\n LOGGER.info(\"Query changed to: #{query}\")\n end\n\n google_form.q = \"#{query}\" # Search Google for the query\n url = agent.submit(google_form, google_form.buttons.first)\n\n url.links.each do |link|\n if link.href.to_s =~ /url.q/ # Pull the links from the search\n str = link.href.to_s\n str_list = str.split(%r{=|&})\n urls = str_list[1]\n if urls.split(\"/\")[2].start_with?(*SKIP) # Skip all the bad URLs\n next\n end\n urls_to_log = URI.decode(urls)\n FORMAT.success(\"Site found: #{urls_to_log}\")\n sleep(0.3)\n payloads.each { |payload|\n File.open(\"#{SITES_TO_CHECK_PATH}\", \"a+\") { |to_check| to_check.puts(\"#{urls_to_log}#{payload}\")}\n }\n end\n end\n FORMAT.info(\"I've dumped possible vulnerable sites into #{SITES_TO_CHECK_PATH}\")\n end", "def get_urls\n\n url_array = []\n top_five = 0\n\n while top_five < 5\n url_array << @news_instance[\"response\"][\"docs\"][top_five][\"web_url\"]\n top_five += 1\n end\n\n # returns the array\n return url_array\n\n end", "def scrape\r\n @article_arr = []\r\n\t\turl = 'http://feeds.news.com.au/heraldsun/rss/heraldsun_news_technology_2790.xml'\r\n open(url) do |rss|\r\n \tfeed = RSS::Parser.parse(rss, false)\r\n \tputs \"Title: #{feed.channel.title}\"\r\n puts \"*********************************\"\r\n puts \" \"\r\n feed.items.each do |item|\r\n \t@article_arr << HSArticle.new(author: \"nil\", title: item.title.to_s.gsub(/,/,' ').gsub(/\"/,' ').gsub(/'s/,'s').gsub(/'/, ''), \r\n summary: item.description.to_s.gsub(/,/,' ').gsub(/\\\"/,'\\'').gsub(/'s/,''), images: item.enclosure.url, source: item.link,\r\n date: item.pubDate.to_s.gsub(/,/,'').gsub(/\\\"/,'\\'').gsub(/'s/,''))\r\n end\r\n end\r\n @articles.concat(@article_arr)\r\n end", "def search_for_new_reports(until_date=Date.today)\n\n url = \"http://www.fixmystreet.com/open311/v2/requests.xml?jurisdiction_id=fiksgatami.no&agency_responsible=2434%7C2240&start_date=#{(until_date - 14).strftime('%Y-%m-%d')}&end_date=#{until_date.strftime('%Y-%m-%d')}\"\n\n doc = Nokogiri::XML HTTParty.get(url).response.body\n\n rows = []\n count = 0\n\n doc.search('request').each do |i|\n rows << i.children.inject({}){|hsh,el| hsh[el.name] = el.inner_text;hsh}\n end\n\n rows.each do |row|\n\n if row[\"agency_responsible\"].strip == \"Staffordshire County Council\"\n subdomain = \"www\"\n else\n subdomain = \"lichfielddc\"\n end\n\n details = {\n :uid => row[\"service_request_id\"],\n :url => \"http://#{subdomain}.fixmystreet.com/report/#{row['service_request_id']}\",\n :council => row[\"agency_responsible\"].strip,\n :description => row[\"description\"],\n :detail => row[\"detail\"],\n :sent => Date.parse(row[\"agency_sent_datetime\"]),\n :lat => row[\"lat\"],\n :lng => row[\"long\"],\n :requested => Date.parse(row[\"requested_datetime\"]),\n :service => row[\"service_name\"],\n :title => row[\"title\"],\n :status => row[\"status\"],\n :updated => Date.parse(row[\"updated_datetime\"])\n }\n\n ScraperWiki.save([:uid], details)\n\n end\n\nend", "def search_for_new_reports(until_date=Date.today)\n\n url = \"http://www.fixmystreet.com/open311/v2/requests.xml?jurisdiction_id=fiksgatami.no&agency_responsible=2434%7C2240&start_date=#{(until_date - 14).strftime('%Y-%m-%d')}&end_date=#{until_date.strftime('%Y-%m-%d')}\"\n\n doc = Nokogiri::XML HTTParty.get(url).response.body\n\n rows = []\n count = 0\n\n doc.search('request').each do |i|\n rows << i.children.inject({}){|hsh,el| hsh[el.name] = el.inner_text;hsh}\n end\n\n rows.each do |row|\n\n if row[\"agency_responsible\"].strip == \"Staffordshire County Council\"\n subdomain = \"www\"\n else\n subdomain = \"lichfielddc\"\n end\n\n details = {\n :uid => row[\"service_request_id\"],\n :url => \"http://#{subdomain}.fixmystreet.com/report/#{row['service_request_id']}\",\n :council => row[\"agency_responsible\"].strip,\n :description => row[\"description\"],\n :detail => row[\"detail\"],\n :sent => Date.parse(row[\"agency_sent_datetime\"]),\n :lat => row[\"lat\"],\n :lng => row[\"long\"],\n :requested => Date.parse(row[\"requested_datetime\"]),\n :service => row[\"service_name\"],\n :title => row[\"title\"],\n :status => row[\"status\"],\n :updated => Date.parse(row[\"updated_datetime\"])\n }\n\n ScraperWiki.save([:uid], details)\n\n end\n\nend", "def add_news_to_entries\n doc = Nokogiri::HTML(open(@config[\"url\"]))\n # the bloody dynamic loading only gives me the first 10\n canonical = doc.xpath('//head/link[@rel=\"canonical\"]').first['href']\n @canonical = canonical\n\n doc.css('.block-content').take(@config[\"consume_top\"]).each do |item|\n link = item.css('h3.block-title>a').first\n next if @entries.any? {|e| e[:rel_href] == link['href']} # skip duplicate entries\n @entries << {\n title: link.content,\n reading_time: item.css('.readingTime').first.content,\n rel_href: link['href']\n }\n end\n end", "def getScrapingURLs(shared)\n\tFile.open(\"urls.txt\").each do |line|\n\t\tshared.pushurl(line.chomp)\n\tend\nend", "def prepare_sources\n SOURCES.each_pair do |suite, url|\n prepare_source_for(url, @freshen)\n end\n end", "def fetch_all_categories\n everything = @@news_api.get_everything(\n language: 'en',\n sources:'techcrunch,talksport,the-next-web,\n national-geographic, al-jazeera-english,\n crypto-coins-news',\n page: 1\n )\n end", "def scrape\n scraped_articles=[]\n scraped_articles=scrape_articles(false)\n # Iterate through the API List\n scraped_articles['response']['docs'].each do |item|\n process_item (item)\n end\n end", "def get_all_emails\n urls = get_all_the_urls_of_val_doise_townhalls\n emails = []\n\n urls.each do |url|\n emails << get_the_email_of_a_townhal_from_its_webpage(url)\n end\n\n emails\nend", "def fetch\n @jobs = fetch_rss(url, Sources::STACKOVERFLOW)\n end", "def scrape\n # Define the URL\n url = \"http://content.guardianapis.com/search?api-key=uggudpb34qwz47bxb3rn7e4q&page=1&page-size=100\"\n start_date = @start.strftime(\"%Y-%m-%d\")\n end_date = @end.strftime(\"%Y-%m-%d\")\n url += '&from-date=' + start_date + '&to-date=' + end_date\n \n # Define the HTTP object\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n\n # Get the response \n response = http.get(uri)\n \n # Parse the response body\n forecast = JSON.parse(response.body)\n\n # Start parsing and store information in GuardianArticle object\n forecast['response']['results'].each do |each_article|\n temp = News::GuardianArticle.new( \n author: nil,\n title: each_article[\"webTitle\"],\n summary: nil,\n images: nil,\n source: each_article[\"webUrl\"],\n date: each_article[\"webPublicationDate\"],\n type: each_article[\"type\"],\n sectionID: each_article[\"sectionId\"],\n id: each_article[\"id\"],\n apiUrl: each_article[\"apiUrl\"],\n section_name: each_article[\"sectionName\"]\n )\n \n # put this article into the array of articles\n @articles << temp\n end\n \n # Return the array of articles\n @articles\n\tend", "def index\n # Load the latest full blog feed for Frank's blog as per \n @latest_blog_posts = load_blog_feed_for_url('http://blog.rietta.com/feeds/posts/default?alt=rss')\n \n # Load the latest posts for the Marketing label feed. Labels are case sensitive - Marketing != marketing\n # Please note that the example of the Google website has an error on its label example. The alt=rss comes after\n # the label in the feed URL\n @latest_marketing_posts = load_blog_feed_for_url('http://blog.rietta.com/feeds/posts/default/-/Marketing?alt=rss')\n \n # Load the latest posts for the SQL Converter label feed (space in the tag)\n @latest_sql_converter_posts = load_blog_feed_for_url('http://blog.rietta.com/feeds/posts/default/-/SQL%20Converter?alt=rss')\n end", "def update_google\n\t sitemap_uri = @starting_url + '/system/rsm.xml'\n\t escaped_sitemap_uri = URI.escape(sitemap_uri)\n\t Net::HTTP.get('www.google.com',\n\t '/webmasters/sitemaps/ping?sitemap=' +\n\t escaped_sitemap_uri)\n\tend", "def extract_items(content)\n GnewsItemsExtractor.new.get_gnews_items(content)\nend", "def urls\n @gapi.source_uris\n end", "def search(date_str)\n doc = get_page_results\n rows = get_todays_rows(doc, date_str)\n # to get the relevant links\n regex = /puppy|pup|Pup|dog|Dog/\n results = filter_links(rows, regex)\nend", "def articles_data(source)\n articles_url = Api.gnews_path('articles?source=' + source)\n call_gnews_url(articles_url).parse\n end", "def fetch_articles\n response = $redis.get('news')\n if response.nil?\n base_uri = \"http://content.guardianapis.com/search?order-by=newest&type=article\"\n response = JSON.generate(HTTParty.get(base_uri + \"&api-key=\" + ENV['GUARDIAN_API_KEY'])[\"response\"][\"results\"])\n $redis.set(\"news\", response)\n $redis.expire(\"news\", 1.hours.to_i)\n end\n @response = JSON.load(response)\n end", "def index\n domain = 'www.hs-karlsruhe.de'\n site_master = '/fakultaeten/fk-iwi/masterstudiengaenge/fk-iwiim/aktuell.html' \n site_bachelor = '/fakultaeten/fk-iwi/bachelorstudiengaenge/fk-iwiib/aktuell.html' \n site_general = '/fakultaeten/fk-iwi/aktuelles.html'\n\n file_master = \"aktuell_master.html\"\n file_bachelor = \"aktuell_bachelor.html\"\n file_general = \"aktuell_general.html\"\n\n # If the data is too old, fetch new data\n Rails.logger.info(\"data is too old?\")\n Rails.logger.info(\"age: \" + (Time.now - @@lastFetch).to_s)\n @news = News.find(:all)\n\n if Time.now - @@lastFetch > 2.hour or @news.empty? then \n Rails.logger.info(\"fetching new data!\")\n # delete all stored news\n @news = Array.new\n News.delete_all\n @newsCount = 1\n\n\n\n downloadWebsite(domain, site_master, file_master)\n downloadWebsite(domain, site_bachelor, file_bachelor)\n downloadWebsite(domain, site_general, file_general)\n\n \n\n # Fetch Bachelor News\n parseForNews(file_master, \"IM\")\n parseForNews(file_bachelor, \"IB\")\n parseForNews(file_general, \"IWI\")\n\n @@lastFetch = Time.now\n end\n\n @updated_at = @@lastFetch\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @news }\n end\n end", "def news_feed\n begin\n client = Feedlr::Client.new(oauth_access_token: ENV['FEEDLY_OAUTH_ACCESS_TOKEN'])\n @latest_list = {}\n client.user_unread_counts.unreadcounts.each do |unread_articles|\n next if unread_articles['count'] == 0\n unread_article_items = client.stream_entries_contents(unread_articles.id, unreadOnly: true).items\n next if unread_article_items.empty?\n\n unread_article_items.each do |article|\n @latest_list[article.alternate[0].href] = \"◼︎ <a href='#{article.alternate[0].href}'>#{article.title} - #{article.origin.title}</a>\"\n end\n client.mark_article_as_read(unread_articles.id)\n end\n @latest_news = @latest_list.values.join(\"<br>\")\n rescue => evar\n fail evar\n end\n @latest_news\n end", "def retrieve_posts\n # Get posts\n rss = RSS::Parser.parse(AWL_RSS_URL)\n\n # Grab shortened URLs\n links = rss.items.map(&:guid).map(&:content)\n\n @articles = []\n\n links.each do |link|\n @articles << Article.new(link)\n end\n\n # TODO: Only grab the tags for articles that haven't already be tweeted\n @articles.map(&:retrieve_tags)\n end", "def main\n doc = Nokogiri::HTML(open(START_URI))\n dirs_to_search = doc.css('a').map{|x|x[:href]}.grep(%r{/SolaceSounds/SolaceSounds})\n\n streams_to_rip = []\n\n dirs_to_search.each do |dir|\n puts \"Searching #{HOST}#{dir}\"\n\n # don't overwhelm the server\n sleep 1\n\n subdir = Nokogiri::HTML(open(HOST + dir))\n streams_to_grab = subdir.css('a').map{|x|x[:href]}.grep(%r{\\.mp3})\n streams_to_rip.concat(streams_to_grab)\n end\n\n # we've found all of the mp3 streams, now we grab them\n streams_to_rip.each do |url|\n if stream_already_downloaded(url)\n puts \"skipping url: #{url}\"\n next\n end\n rip_stream(url)\n move_ripped_file(url)\n set_mp3_tags(url)\n end\nend", "def source_search(url, html)\n\n hits = []\n\n html.css('script,embed,object').each do |source|\n\n # attributes\n data = source.attr('data')\n src = source.attr('src')\n\n if src.nil?\n # load script and parse?\n else\n # check src lib name\n hits << url if src =~ /swfobject.js|player.swf/i\n hits << url if data =~ /player.swf/i\n end\n end\n\n hits.uniq!\n\n end", "def index\n @news_sources = NewsSource.all\n end", "def insert_news_if_necessary(url)\n latest_date = latest_news_date(Feed.id_from_url(url))\n latest_date = Setting.keep_news_time if latest_date.zero?\n\n channel = Arss::FeedParser.parse_uri(url).feed['channel']\n return unless channel.has_key? 'items'\n\n channel['items'].each do |item|\n if Setting.get_delete_after_days.nonzero?\n next if (item['pubDate'] <= latest_date or item['pubDate'] < Setting.keep_news_time)\n end\n\n create(:user_id => User.current_user_id, :feed_id => Feed.id_from_url(url),\n :title => item['title'], :description => item['description'],\n :url => item['link'], :read => 0, :date => item['pubDate'])\n end\n end", "def fetch_by_issn(issn)\r\n xml = fetch_xml(issn)\r\n\r\n\r\n results = BentoSearch::Results.new.concat(\r\n xml.xpath(\"./rdf:RDF/rss:item\", xml_ns).collect do |node|\r\n item = BentoSearch::ResultItem.new\r\n\r\n item.format = \"Article\"\r\n\r\n item.issn = issn # one we searched with, we know that!\r\n\r\n item.title = xml_text(node, \"rss:title\")\r\n item.link = xml_text(node, \"rss:link\")\r\n\r\n item.publisher = xml_text(node, \"prism:publisher\") || xml_text(node, \"dc:publisher\")\r\n item.source_title = xml_text(node, \"prism:PublicationName\")\r\n item.volume = xml_text(node, \"prism:volume\")\r\n item.issue = xml_text(node, \"prism:number\")\r\n item.start_page = xml_text(node, \"prism:startingPage\")\r\n item.end_page = xml_text(node, \"prism:endingPage\")\r\n\r\n # Look for something that looks like a DOI in dc:identifier\r\n node.xpath(\"dc:identifier\").each do |id_node|\r\n if id_node.text =~ /\\ADOI (.*)\\Z/\r\n item.doi = $1\r\n # doi's seem to often have garbage after a \"; \", especially\r\n # from highwire. heuristically fix, sorry, a real DOI with \"; \"\r\n # will get corrupted.\r\n if (parts = item.doi.split(\"; \")).length > 1\r\n item.doi = parts.first\r\n end\r\n\r\n break\r\n end\r\n end\r\n\r\n # authors?\r\n node.xpath(\"dc:creator\", xml_ns).each do |creator_node|\r\n name = creator_node.text\r\n name.strip!\r\n\r\n # author names in RSS seem to often have HTML entities,\r\n # un-encode them to literals.\r\n name = HTMLEntities.new.decode(name)\r\n\r\n\r\n item.authors << BentoSearch::Author.new(:display => name)\r\n end\r\n\r\n # Date is weird and various formatted, we do our best to\r\n # look for yyyy-mm-dd at the beginning of either prism:coverDate or\r\n # dc:date or prism:publicationDate\r\n date_node = xml_text(node, \"prism:coverDate\") || xml_text(node, \"dc:date\") || xml_text(node, \"prism:publicationDate\")\r\n if date_node && date_node =~ /\\A(\\d\\d\\d\\d-\\d\\d-\\d\\d)/\r\n item.publication_date = Date.strptime( $1, \"%Y-%m-%d\")\r\n elsif date_node\r\n # Let's try a random parse, they give us all kinds of things I'm afraid\r\n item.publication_date = Date.parse(date_node) rescue ArgumentError\r\n end\r\n\r\n # abstract, we need to strip possible HTML tags (sometimes they're\r\n # there, sometimes not), and also decode HTML entities. \r\n item.abstract = xml_text(node, \"rss:description\").try do |text| \r\n HTMLEntities.new.decode(strip_tags(text))\r\n end\r\n\r\n item\r\n end\r\n )\r\n\r\n # Items seem to come back in arbitrary order, we want to sort\r\n # by date reverse if we can\r\n if results.all? {|i| i.publication_date.present? }\r\n results.sort_by! {|i| i.publication_date}.reverse!\r\n end\r\n\r\n fill_in_search_metadata_for(results)\r\n\r\n return results\r\n end", "def update_search_engines\n\t @url = \"http://#{request.host_with_port}/\"\n sitemap_uri = @url + 'sitemap.xml'\n escaped_sitemap_uri = CGI.escape(sitemap_uri)\n\t Rails.logger.info \"Notifiying new sitemap => \" + escaped_sitemap_uri\n Rails.logger.info \"Notifying Google...\"\n res = Net::HTTP.get_response('www.google.com', '/webmasters/tools/ping?sitemap=' + escaped_sitemap_uri)\n Rails.logger.info res.class\n Rails.logger.info \"Notifying Yahoo...\"\n res = Net::HTTP.get_response('search.yahooapis.com', '/SiteExplorerService/V1/updateNotification?appid=SitemapWriter&url=' + escaped_sitemap_uri)\n Rails.logger.info res.class\n Rails.logger.info \"Notifying Bing...\"\n res = Net::HTTP.get_response('www.bing.com', '/webmaster/ping.aspx?siteMap=' + escaped_sitemap_uri)\n Rails.logger.info res.class\n Rails.logger.info \"Notifying Ask...\"\n res = Net::HTTP.get_response('submissions.ask.com', '/ping?sitemap=' + escaped_sitemap_uri)\n Rails.logger.info res.class\n end", "def xml_feed_entries(feed_url, locale, offset)\r\n p \"Feed #{feed_url}\"\r\n doc = Nokogiri::XML(open(feed_url))\r\n doc.xpath(\"//item\").count.times do |n|\r\n \r\n # process dates\r\n sdt = DateTime.parse(doc.xpath(\"//item//xCal:dtstart\")[n].text) rescue nil\r\n edt = doc.xpath(\"//item//xCal:dtend\")[n].text\r\n edt.blank? ? enddt = sdt.advance(:hours => 2) : enddt = DateTime.parse(edt)\r\n \r\n # get event title and url\r\n etitle = doc.xpath(\"//item//title\")[n].text.split(' at ')[0]\r\n url = doc.xpath(\"//item//link\")[n].text \r\n sid = doc.xpath(\"//item//id\")[n].text \r\n\r\n # get county based on coordinates\r\n lat = doc.xpath(\"//item//geo:lat\")[n].text\r\n lng = doc.xpath(\"//item//geo:long\")[n].text\r\n county = Schedule.chk_geocode(lat, lng) rescue nil\r\n \r\n # add only current events \r\n if sdt >= Date.today\r\n \r\n # find correct channel and location\r\n cid = LocalChannel.select_channel(etitle, county, locale).flatten 1\r\n# cid.map {|channel| p \"Channel: #{channel.channelID}\" }\r\n\r\n # add event to calendar\r\n cid.map {|channel| add_event(doc, n, sid, etitle[0..199], sdt, enddt, channel.channelID, url, offset)} if cid\r\n# add_event(doc, n, sid, etitle[0..199], sdt, enddt, cid[0].channelID, url, offset) if cid\r\n end\r\n end \r\n end", "def spawn_feeds\n\tFile.open(\"feeds.txt\", \"r\").each_line do |line|\n\t\tFeed.create(:url => line.strip) unless !Feed.find_by_url(line.strip).nil?\n\tend\nend", "def show\n @country = Country.find_by_name(params[:name])\n @country_news = []\n # if response = HTTParty.get(\"http://ajax.googleapis.com/ajax/services/search/news?v=1.0&q=#{params[:name]}\")\n #google news api code\n country_name = URI::encode(@country.name)\n response = HTTParty.get(\"http://ajax.googleapis.com/ajax/services/search/news?v=1.0&q=#{country_name}\")\n @country_news = JSON.parse(response.body)\n\n #NYT api response code for the timeline js\n # could use the dates from the last month\n current_Date= Time.new\n current_year = current_Date.year.to_s\n current_month = current_Date.month.to_s\n @api_form_date = current_year+\"0\"+current_month+\"01\"\n country_articles=HTTParty.get(\"http://api.nytimes.com/svc/search/v2/articlesearch.json?q=#{country_name}&begin_date=#{@api_form_date}&sort=oldest&pages=0&api-key=ae59fa9ced00c8e0934ee66358d80da6:1:68403659\")\n @country_NYT=JSON.parse(country_articles.body)\n #take the nyt data and set it into a hash\n\n # getting the heat index number\n # news_wire = HTTParty.get(\"http://api.nytimes.com/svc/search/v2/articlesearch.json?q=#{country_name}&begin_date=20131101&sort=oldest&pages=0&api-key=ae59fa9ced00c8e0934ee66358d80da6:1:68403659\")\n # @news_wire_results=JSON.parse(news_wire.body)\n # @heat_index = @news_wire_results[\"response\"][\"docs\"].length\n\n @timeline_events_ar =[]\n @country_NYT[\"response\"][\"docs\"].each_with_index do |result, i|\n @date_instance = {\n \"startDate\" => Time.parse(result[\"pub_date\"]).strftime(\"%Y,%m,%d\"),\n # \"endDate\" => Time.parse(result[\"pub_date\"]).strftime(\"%Y,%m,%d\"),\n \"headline\" => result[\"headline\"][\"main\"],\n \"text\" => result[\"abstract\"],\n \"tag\" => \"tag#{i%6}\",\n \"classname\" => \"\",\n \"asset\" => {\n \"media\" => result[\"web_url\"],\n \"thumb_nail\" => \"\",\n \"credit\" => result[\"first_name\"],\n \"caption\" => result[\"snippet\"]\n }\n }\n @timeline_events_ar << @date_instance\n end\n @timeline = {\n \"timeline\" => {\n \"headline\" => \"New York Times Timeline\",\n \"type\" => \"default\",\n \"startDate\" => Time.parse(@country_NYT[\"response\"][\"docs\"].first[\"pub_date\"]).strftime(\"%Y,%m,%d\"),\n \"date\" => @timeline_events_ar\n }\n }\n\n end", "def fetch_news(last_fetch = \"#{Date.today.to_s} 00:00:00\")\n x = build_news(parse_json(@filename), last_fetch)\n end", "def update_google\n sitemap_uri = @SITEMAP_CONFIG[:domain] + '/sitemap.xml.gz'\n escaped_sitemap_uri = URI.escape(sitemap_uri)\n Net::HTTP.get('www.google.com', '/webmasters/tools/ping?sitemap=' + escaped_sitemap_uri)\n end", "def scrape\n articles = []\n url = 'http://feeds.news.com.au/heraldsun/rss/heraldsun_news_sport_2789.xml'\n\n open(url) do |rss|\n feed = RSS::Parser.parse(rss)\n feed.items.each do |item|\n articles << (interpret item)\n end\n end\n articles\n end", "def scrape\n\t\turl = 'http://www.wsj.com/xml/rss/3_7455.xml'\n open(url) do |rss|\n \tfeed = RSS::Parser.parse(rss, false)\n puts \" \"\n puts \"*********************************\"\n \tputs \"Title: #{feed.channel.title}\"\n puts \"--------------------------------\"\n feed.items.each do |item|\n tags = tag_article(item.title.to_s)\n \tarticle = Article.new(title: item.title.to_s, \n summary: item.description.to_s.gsub(/\\\"/,''), \n link: item.link, \n date: item.pubDate.to_s.gsub(/,/,''),\n tag_list: tags, \n source: \"Wall Street Journal\")\n article.save\n end\n end\n end", "def get_urlposts( url )\n urlposts = []\n urlcode = Digest::MD5.hexdigest(url)\n url = \"http://feeds.delicious.com/rss/url/#{urlcode}\"\n\n response = Net::HTTP.get_response(URI.parse(url)).body\n doc = REXML::Document.new(response)\n\n doc.elements.each(\"//item\") do |item|\n urlposts << { \"user\" => item.elements[\"dc:creator\"].text }\n end\n\n sleep 1\n return urlposts\n end", "def find_3rd_party_apps(weibo_screen_name)\n user = $client.user_show_by_screen_name(weibo_screen_name) ;#user = $client.user_show 1961488257\n sts = $client.statuses(user.id)\n \n sources = {}\n i = 0\n while sts.next_page? #Loops untill end of collection\n sts.each do | s |\n link = Nokogiri::XML s.source\n xpath = \"//a[@href]\"\n elem = link.search(xpath) # ; puts elem.first.text ; puts elem.first['href']\n \n uri = URI(elem.first['href']).host\n sources[elem.first.text] = uri unless sources.keys.include? elem.first.text\n \n # IDEA: it doesn't looks smart to iterative through all the statuses to find out all 3rd party links. Better solution?\n \n # Debug use: limited search\n #i += 1\n #if i > 5 then\n # break \n #end\n end\n end \n # puts sources.inspect\n return sources\nend", "def searches\n Boundary.get(@url)\n end", "def latest_news(feed_url, options={})\n div_id = options[:div_id] || \"news_feed\"\n s = <<-EOF\n<div id=\"#{div_id}\"></div>\n\n<script type=\"text/javascript\">\n\n google.load(\"feeds\", \"1\");\n\n function #{div_id}_init() {\n var feed = new google.feeds.Feed(\"#{feed_url}\");\n feed.setNumEntries(3)\n feed.load(function(result) {\n if (!result.error) {\n var container = $(\"##{div_id}\");\n for (var i = 0; i < result.feed.entries.length; i++) {\n var entry = result.feed.entries[i];\n container.append('<div><div class=\"blog_title\"><a href=\"' + entry.link + '\">' + entry.title + '</a></div>'\n + '<div class=\"blog_body\">' + entry.contentSnippet + '</div>'\n + '<div class=\"blog_date\">' + entry.publishedDate + '</div>'\n + '</div>');\n }\n }\n });\n }\n google.setOnLoadCallback(#{div_id}_init);\n</script>\n EOF\n s.html_safe\n end", "def initialise(*url)\n @urls = [] \n list = File.open('url_list').each do |url|\n puts url\n doc = Nokogiri::HTML(open(url)) \n @urls.push(doc)\n end\n end", "def update_search_engines\r\n sitemap_uri = @url + 'sitemap.xml'\r\n escaped_sitemap_uri = CGI.escape(sitemap_uri)\r\n Rails.logger.info \"Notifying Google\"\r\n res = Net::HTTP.get_response('www.google.com', '/webmasters/tools/ping?sitemap=' + escaped_sitemap_uri)\r\n Rails.logger.info res.class\r\n Rails.logger.info \"Notifying Yahoo\"\r\n res = Net::HTTP.get_response('search.yahooapis.com', '/SiteExplorerService/V1/updateNotification?appid=SitemapWriter&url=' + escaped_sitemap_uri)\r\n Rails.logger.info res.class\r\n Rails.logger.info \"Notifying Bing\"\r\n res = Net::HTTP.get_response('www.bing.com', '/webmaster/ping.aspx?siteMap=' + escaped_sitemap_uri)\r\n Rails.logger.info res.class\r\n Rails.logger.info \"Notifying Ask\"\r\n # res = Net::HTTP.get_response('submissions.ask.com', '/ping?sitemap=' + escaped_sitemap_uri)\r\n # Rails.logger.info res.class\r\n end", "def get_article_list(start = 0, news_type: \"\", from_date: \"\", to_date: \"\", title_keyword: \"\", content_keyword: \"\")\n from_date = from_date.to_s unless from_date.kind_of?(String)\n to_date = to_date.to_s unless to_date.kind_of?(String)\n\n doc = REXML::Document.new(fetch_article_list(start, news_type, from_date, to_date, title_keyword, content_keyword))\n article_ids = REXML::XPath.match(doc, \"//articleCode\").map(&:text)\n disp_titles = REXML::XPath.match(doc, \"//dispTitle\").map { |node| normalize_text(node.text) }\n main_titles = REXML::XPath.match(doc, \"//mainTitle\").map { |node| normalize_text(node.text) }\n sub_titles = REXML::XPath.match(doc, \"//subTitle\").map { |node| normalize_text(node.text) }\n dates = REXML::XPath.match(doc, \"//sendInfo\").map(&:text)\n movie_counts = REXML::XPath.match(doc, \"//fMovieCnt\").map { |node| node.text.to_i }\n music_counts = REXML::XPath.match(doc, \"//fMusicCnt\").map { |node| node.text.to_i }\n photo_counts = REXML::XPath.match(doc, \"//fPhotoCnt\").map { |node| node.text.to_i }\n\n article_ids.zip(\n disp_titles, main_titles, sub_titles, dates,\n movie_counts, music_counts, photo_counts\n ).map do |id, disp, main, sub, date, movie, music, photo|\n date = \"2015-04-02\" if id == \"AR0060168\"\n Article.new(\n id, date: Date.parse(date),\n display_title: disp, main_title: main, sub_title: sub,\n movie_count: movie, music_count: music, photo_count: photo\n )\n end\n end", "def all_new_ads(url=nil)\n\tsite = 'http://saudi.dubizzle.com'\n\turl = site+\"/ar/items-for-sale/search/\" if(url==nil)\n\tproceed = true\n\twhile proceed\n \t\tputs \"Fetching the ads from \"+url\n\t\tdoc = Nokogiri::HTML(open(url))\n\t\tnothing_found = doc.css('d-no-results__heading')\n\t\tif(nothing_found.children && nothing_found.children.length>0)\n\t\t\treturn\n\t\tend\n\t\tcontents = doc.at_css('.d-listing').css('.d-listing__item')\n\t\tputs 'found '+contents.length.to_s+' items to scan.'\n\t\tcontents.each do |item|\n\t\t text = item.children[1].children[1].children[1].attributes[\"href\"].value\n\t\t text = site+text\n\n\t\t if(@existing.index(text)!=nil)\n\t\t\tputs 'stopping after getting already known url'\n\t\t\tproceed = false\n\t\t\tbreak\n\t\t else\n\t\t @ads.push(text)\n\t\t end\n\t\tend\n\t\tif(doc.css('.u-pager__item--next').children[1] == nil)\n\t\t\tputs 'Completed scanning for lists, proceeding to scrape individual items'\n\t\t\treturn\n\t\tend\n\t\turl = site+doc.css('.u-pager__item--next').children[1].attribute('href').value\n\t\tputs 'now crawling to next page for items'\n\tend\n\t# all_new_ads(next_page_url)\n end", "def load()\n raise 'Cannot load trackbacks without a site defined' if site.nil?\n \n # Paginate through search\n page = 1\n duplicate_count = 0\n \n begin\n begin\n results = Topsy.search(site, :window => :realtime, :page => page, :perpage => per_page)\n rescue Topsy::InformTopsy => e\n Grapevine.log_error(\"Topsy Search (#{name})\")\n rescue Topsy::Unavailable => e\n Grapevine.log_error(\"Topsy Unavailable (Limit: #{Topsy.rate_limit.remaining} of #{Topsy.rate_limit.limit})\")\n end\n \n # Exit load if Topsy does not return results\n if results.nil?\n return\n end\n \n # Loop over links and load trackbacks for each one\n results.list.each do |item|\n # Create and append message\n message = create_message(item)\n \n if !message.nil?\n # Attempt to create a topic\n topic = create_topic(message)\n if topic.nil?\n next\n end\n\n # Skip message from a user if it's a duplicate\n if Message.first(:author => message.author, :topic => topic)\n duplicate_count += 1\n \n # Exit if we've encountered too many duplicates\n if duplicate_count > duplicate_max_count\n return\n # Otherwise continue to next item\n else\n next;\n end\n # Reset the duplicate count if we see a new tweet\n else\n duplicate_count = 0\n end\n\n # Assign topic and save message\n message.topic = topic\n message.save\n\n Grapevine.log.debug \"MESSAGE: [#{message.author}] #{message.content}\"\n end\n end\n\n page += 1\n end while results.last_offset < results.total && page < 10\n end", "def runAll()\n\t\tprevCves = Set.new\n\n\t\tprevCves = setupCsvFile(@resultsFilePath, RESULT_HEADERS)\n\t\tprevCves += setupCsvFile(@manualFilePath, RESULT_HEADERS)\t\n\t\tprevCves +=\tsetupCsvFile(@removedFilePath, ['CVE', 'Reason'])\n\n\t\tcveManualFile = CSV.open(@manualFilePath, 'ab')\n\n\t\t# open csv file for results to be written to \n\t\tcveResultsFile = CSV.open(@resultsFilePath, 'ab')\n\n\t\tcveRemovedFile = CSV.open(@removedFilePath, 'ab')\n\n\n\t\tCHROMIUM_NIST_YEARS.each do | year |\n\t\t\tnistFilePath = \"#{@nistFile}#{NIST_PREFIX}#{year}#{NIST_SUFFIX}\"\n\t\t\tif not File.exists?(nistFilePath)\n\t\t\t\tdownloadNistData(year, nistFilePath)\n\t\t\tend\n\t\t\t\n\t\t\tfile = open(nistFilePath)\n\t\t\tdoc = Nokogiri::XML(file)\n\n\t\t\t# search by products affected by vulnerability\n\t\t\tputs \"Searching #{nistFilePath} for Chrome CVEs \\n\"\n\t\t\tentry1 = doc.xpath(\"//cpe-lang:fact-ref[starts-with(@name, 'cpe:/a:google:chrome:')]/../../..\")\n\n\t\t\tcveLinks = findNistLinks(entry1, cveManualFile, prevCves)\n\n\t\t\tscrapeResults = scrapeCveLinks(cveLinks, cveRemovedFile, cveManualFile)\n\n\t\t\tsaveResults(cveResultsFile, scrapeResults)\n\n\t\t\t# search by references to chromium in vuln links\n\t\t\tentry2 = doc.xpath(\"//vuln:reference[contains(@href, 'chromium')]/../..\")\n\n\t\t\t# Make sure the two sets don't overlap\n\t\t\tentry = entry2 - entry1\n\n\t\t\tcveLinks2 = findNistLinks(entry, cveManualFile, prevCves)\n\n\t\t\tscrapeResults2 = scrapeCveLinks(cveLinks2, cveRemovedFile, cveManualFile)\n\n\t\t\tsaveResults(cveResultsFile, scrapeResults2)\n\t\tend\n\tend", "def crawl\n while NG_URL.where(:a_hrefs_unprocessed => { :$not => { :$size => 0}}).count > 0 do\n next_unprocessed_url\n end\n end", "def scraped_feeds\n Dir.glob(File.join(working_directory, 'feeds', '*.txt'))\n end", "def fetch\n feed_data = REXML::Document.new(open(@url, :proxy => true)).root\n parse(feed_data)\n end", "def featured_events(from_date)\n if File.exist?('last_ran.txt') then\n\t\tlast = File.open('last_ran.txt', 'r')\n\t\tlast_ran = DateTime.parse([*last][0])\n\t\tlast.close\n\telse\n\t\tabort(\"Please create a file named 'last_ran.txt' that contains the date that this task last executed.\")\n\tend\n\t\n \t\t\n url = 'http://events.stanford.edu/xml/rss.xml'\n\txml_data = Net::HTTP.get(URI.parse(url))\n\n\tdata = XmlSimple.xml_in(xml_data)\n\n\tevents = data['channel'][0]['item']\n\n\tevents_parsed = []\n\n\terrors = File.open('no_address_errors.txt', 'w')\n\n\tevents.each do |event|\n\n\t\tpubDate = DateTime.parse(event['pubDate'][0])\n\n\t\tif pubDate < last_ran then\n\t\t\tnext\n\t\tend\n\n\t\tevent_p = {}\n\n\t\ttitle = event['title'][0]\n\t\tdesc = event['description'][0]\n\n\t\tdesc_split = desc.match(/(Date:.+<br\\/>).*(Location:.+<br\\/>)(.+)/m)\n\n\t\tdate_messy = desc_split[1]\n\t\tunless date_messy.index(':').nil? or date_messy.index('.<').nil? then\n\t\t\tstart = date_messy.index(':') + 1\n\t\t\tfinish = date_messy.index('.<') - 1\n\t\telse\n\t\t\tnext\n\t\tend\n\t\tdate = date_messy[start..finish].strip.squeeze(' ')\n\n\t\tdate = DateTime.parse(date)\n\t\tif date < from_date then\n\t\t next\n end\n puts \"\"\n\t\t\n \n\t\tlocation_messy = desc_split[2]\n\t\tstart = location_messy.index(':') + 1\n\t\tfinish = location_messy.index('<') - 1\n\n\t\tlocation = location_messy[start..finish].gsub(/\\s+/, ' ').strip.squeeze(' ')\n\n\t\tshort_desc = 'Detailed location: ' + location # full location description\n\t\tlong_desc = desc_split[3].gsub(/\\s+/, ' ').strip.squeeze(' ')\n\n\t\t# find image url\n\n\t\tlink = event['link'][0]\n\t\tpage = Nokogiri::HTML(open(link))\n\t\timage_elem = page.css('div#sidebar').css('div.image').css('img')\n\t\timage_url = 'http://events.stanford.edu' + image_elem[0]['src'] unless image_elem.empty?\n\n\t\t# find tags\n\t\ttags_elem = page.search(\"[text()*='Tags:']\").first.next_element.children\n\t\ttags = tags_elem.text + \", stanford\" unless tags_elem.empty?\n\n\t\t# find address\n\n\t\taddress_regex_result = location.match(/[0-9]+ (\\D*)[,]? ([A-Z]{2}|California)( [0-9]{5}(-[0-9]{4})?)?$/)\n\n\t\taddress = {}\n\n\t\tif address_regex_result.kind_of? MatchData then\n\t\t\taddress[:street] = address_regex_result[0]\n\t\telse\n\t\t\t# utilize campus-map\n\t\t\tbegin\n\t\t\t\tres = get_campus_map_address(location)\n\t\t\trescue\n\t\t\t\tnext\n\t\t\tend\n\t\t\tif res[:error] then\n\t\t\t\terrors.puts event\n\t\t\t\terrors.puts\n\t\t\t\tnext\n\t\t\telse\n\t\t\t\taddress = res\n\t\t\tend\n\t\tend\n\n\t\tevent_p[:title] = title\n\t\tevent_p[:start_date] = date\n\t\tevent_p[:end_date] = date + Rational(2, 24) # assuming events last 2 hours...\n\t\tevent_p[:short_desc] = short_desc\n\t\tevent_p[:long_desc] = long_desc\n\t\tevent_p[:image_url] = image_url\n\t\tevent_p[:tags] = tags\n\t\tevent_p[:address] = address[:street] unless address[:street].nil?\n\t\tevent_p[:lat] = address[:lat] unless address[:lat].nil?\n\t\tevent_p[:lng] = address[:lng] unless address[:lng].nil?\n\n\t\tevents_parsed << event_p\n\t\tputs event_p\n\tend\n\t\n\terrors.close\n\t\n\toutput = File.open('last_ran.txt', 'w')\n\tlast_ran = DateTime.now\n\toutput.puts last_ran.to_s\n\toutput.close\n\t\n\treturn events_parsed\nend" ]
[ "0.68651307", "0.6719305", "0.6623156", "0.6374155", "0.6352204", "0.62479985", "0.62230045", "0.6161313", "0.6133828", "0.60842186", "0.6056822", "0.60338753", "0.59746814", "0.596958", "0.5925915", "0.5919258", "0.58842796", "0.5878615", "0.5840933", "0.581973", "0.58051205", "0.5788759", "0.57881415", "0.578244", "0.57446015", "0.5733973", "0.57310665", "0.5728626", "0.5710121", "0.5708867", "0.57053494", "0.5680701", "0.5674311", "0.5668607", "0.5640687", "0.5640643", "0.5639003", "0.56298244", "0.5626909", "0.5578245", "0.557266", "0.5570565", "0.55673045", "0.5557165", "0.5554692", "0.5554426", "0.5540296", "0.55369604", "0.5533957", "0.55244356", "0.5521355", "0.5518039", "0.55122995", "0.54984635", "0.54984635", "0.5497159", "0.5495249", "0.5485485", "0.5480106", "0.5475351", "0.5475212", "0.5465744", "0.5451295", "0.5449033", "0.5444584", "0.5444356", "0.5437836", "0.54276377", "0.5424665", "0.5422207", "0.542192", "0.5419387", "0.54089344", "0.54048556", "0.5401773", "0.5399718", "0.53989446", "0.53778696", "0.5369509", "0.53686076", "0.5349103", "0.5348945", "0.53404254", "0.53322744", "0.53239655", "0.53224736", "0.5319834", "0.5319512", "0.5319213", "0.5312628", "0.5310517", "0.5305228", "0.53011584", "0.5297463", "0.52963084", "0.5287735", "0.5286921", "0.5286019", "0.52848387", "0.5283421" ]
0.6614735
3
methods at the root here will become instance methods
def sing puts "I LOVE VOTING LALALALA" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def methods() end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def instance; end", "def instance; end", "def instance; end", "def startMethods()\n @orderMethods = OrderTree.new(@root) ##Metodos de recorridos\n @addMethods = AddTree.new(@root,@compare) ##Metodos de agregado\n @searchMethods = SearchTree.new(@root,@compare) ## Metodos de busqueda en arbol\n @removeMethods = RemoveTree.new(@root,@compare) ##Metodos para remover elementos\n @drawMethods = DrawTree.new(@root,@compare)\n end", "def internal; end", "def internal_methods; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def private; end", "def instance_methods; end", "def methods=(_arg0); end", "def main\n super\n return self\n end", "def public_instance_methods(include_super=true) end", "def instance_methods(include_super=true) end", "def implementation; end", "def implementation; end", "def operations; end", "def operations; end", "def init; end", "def init; end", "def init; end", "def init; end", "def class() end", "def setup!\n setup_instance_methods!\n self\n end", "def method_of_instance; end", "def method_of_instance; end", "def method_of_instance; end", "def method_of_instance; end", "def instances; end", "def instances; end", "def public; end", "def public; end", "def initialize\n\t\t\n\tend", "def public_method; end", "def method_missing(method, *args)\n self.root.send(method, *args)\n end", "def initialize\n \n end", "def initialize #everytie an instance of the class is initialized, we should push it into the @@all class variable\n @@all << self\n end", "def call\n # implement in subclasses\n end", "def instance_helper\n\tend", "def base; self; end", "def private_instance_methods(include_super=true) end", "def method_missing(meth, *args)\n if root.respond_to? meth\n root.send meth, *args\n else\n super\n end\n end", "def init\n\n end", "def initialize\n \n end", "def init; end", "def initialize\n\n\tend", "def initialize\n\n\tend", "def instance_variables() end", "def self\n @define_self = true", "def root; end", "def root; end", "def root; end", "def root; end", "def root; end", "def root; end", "def root; end", "def root; end", "def root; end", "def root; end", "def root; end", "def root; end", "def root; end", "def root; end", "def root; end", "def methods\n super + DELEGATED_METHODS\n end", "def delegating_method; end", "def initialize ( _caller )\n super\n end", "def initialize ( _caller )\n super\n end", "def wrapper; end", "def run; new.run; end", "def custom; end", "def custom; end", "def nested_classes\n super\n end", "def initialize\n @@all << self\n \n end", "def init\n self\n end", "def super_method; end", "def instance_method(p0) end", "def initialize(parent); end", "def initialize\n\n\n\n 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 singleton_methods; end", "def method\n\t\t# code code\n\tend", "def +@\n self\n end", "def initialize\n @@all << self\n end", "def initialize() end", "def get_root()\n \n end" ]
[ "0.7567448", "0.72434783", "0.72434783", "0.72434783", "0.72434783", "0.6615682", "0.6615682", "0.6615682", "0.6561756", "0.6555613", "0.65063184", "0.6475449", "0.6475449", "0.6475449", "0.6475449", "0.6475449", "0.6475449", "0.6475449", "0.6475449", "0.6475449", "0.6475449", "0.6475449", "0.6475449", "0.64709026", "0.64219445", "0.6373862", "0.6350847", "0.63253033", "0.6260569", "0.6255963", "0.6255963", "0.6233634", "0.6233634", "0.6217191", "0.6217191", "0.6217191", "0.6217191", "0.61693263", "0.6166169", "0.61546576", "0.61546576", "0.61546576", "0.61546576", "0.61534965", "0.61534965", "0.6149246", "0.6149246", "0.6086874", "0.6074161", "0.6056131", "0.6052961", "0.60507125", "0.6040173", "0.6039215", "0.6017561", "0.60137326", "0.5986169", "0.5981114", "0.5967308", "0.5961896", "0.5950275", "0.5950275", "0.59482676", "0.5923315", "0.592246", "0.592246", "0.592246", "0.592246", "0.592246", "0.592246", "0.592246", "0.592246", "0.592246", "0.592246", "0.592246", "0.592246", "0.592246", "0.592246", "0.592246", "0.5917888", "0.59083563", "0.5904018", "0.5904018", "0.5890136", "0.5885978", "0.58837146", "0.58837146", "0.58831745", "0.58796173", "0.5869284", "0.5865527", "0.58638555", "0.5850717", "0.5846941", "0.58468616", "0.5843846", "0.5830463", "0.5829765", "0.582733", "0.58236134", "0.5813817" ]
0.0
-1
GET /containers GET /containers.json
def index @containers = Container.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def containers\n @containers ||= Docker::Container.all(\n all: true, # include stopped containers\n filters: { id: container_ids }.to_json\n ).map(&:json)\n end", "def containers\n TestLab::Container.all\n end", "def containers(key = nil, options = {})\n key ||= properties.key1\n\n query = \"comp=list\"\n options.each { |okey, ovalue| query += \"&#{okey}=#{[ovalue].flatten.join(',')}\" }\n\n response = blob_response(key, query)\n\n doc = Nokogiri::XML(response.body)\n\n results = doc.xpath('//Containers/Container').collect do |element|\n Container.new(Hash.from_xml(element.to_s)['Container'])\n end\n\n results.concat(next_marker_results(doc, :containers, key, options))\n end", "def list_containers(options={})\n query = { }\n if options\n query['prefix'] = options[:prefix] if options[:prefix]\n query['marker'] = options[:marker] if options[:marker]\n query['maxresults'] = options[:max_results].to_s if options[:max_results]\n query['include'] = 'metadata' if options[:metadata] == true\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n end\n\n uri = containers_uri(query)\n response = call(:get, uri)\n\n Serialization.container_enumeration_results_from_xml(response.body)\n end", "def list # rubocop:disable Metrics/AbcSize\n if @options[:container]\n containerview = ObjectStorage.new(@options[:id_domain], @options[:user_name], @options[:passwd])\n containerview = containerview.contents(@options[:container])\n if containerview.code == '201' || containerview.code == '200'\n containerview.body\n elsif containerview.code == '204'\n print 'the container is empty'\n else\n @util.response_handler(containerview)\n end\n else\n newcontainer = ObjectStorage.new(@options[:id_domain], @options[:user_name], @options[:passwd])\n newcontainer = newcontainer.list\n @util.response_handler(newcontainer)\n newcontainer.body if newcontainer.code == '200'\n puts 'there are no containers' if newcontainer.code == '204'\n end \n end", "def index\n user_session[:current_container]=nil\n if params[:label].blank?\n @containers = Container.list(params[:filter])\n else\n @container = Container.find_by_label(params[:label])\n render action: 'show' and return\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @containers }\n end\n end", "def create\n response = post_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/containers.json\"), params[:container].to_json, (sesh :current_token))\n json_respond response.body \n\n end", "def get_containers\n assert_not_nil @rdigg.info.get_containers\n end", "def running_containers\n containers = ::Docker::Container.all(all: true, filters: { status: [\"running\"] }.to_json)\n return containers\n end", "def read_containers\n []\n end", "def create\n response = post_request(URI.parse(\"http://\"+Storage.find(cookies[:donabe_ip]).data+\"/\"+Storage.find(cookies[:current_tenant]).data+\"/containers.json\"), params[:container].to_json, Storage.find(cookies[:current_token]).data)\n json_respond response.body \n\n end", "def index_containers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContainersApi.index_containers ...'\n end\n # resource path\n local_var_path = '/containers'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sort_by'] = @api_client.build_collection_param(opts[:'sort_by'], :pipe) if !opts[:'sort_by'].nil?\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?\n query_params[:'comment'] = opts[:'comment'] if !opts[:'comment'].nil?\n query_params[:'quota_total_size'] = opts[:'quota_total_size'] if !opts[:'quota_total_size'].nil?\n query_params[:'quota_on_cache'] = opts[:'quota_on_cache'] if !opts[:'quota_on_cache'].nil?\n query_params[:'stat_total_files'] = opts[:'stat_total_files'] if !opts[:'stat_total_files'].nil?\n query_params[:'stat_total_size'] = opts[:'stat_total_size'] if !opts[:'stat_total_size'].nil?\n query_params[:'stat_size_on_cache'] = opts[:'stat_size_on_cache'] if !opts[:'stat_size_on_cache'].nil?\n query_params[:'guest_right'] = opts[:'guest_right'] if !opts[:'guest_right'].nil?\n query_params[:'last_update'] = opts[:'last_update'] if !opts[:'last_update'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'ContainerCollection' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContainersApi#index_containers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index_containers(opts = {})\n data, _status_code, _headers = index_containers_with_http_info(opts)\n data\n end", "def containers\n containers_exited(days_old: 1)\n containers_running(days_old: 1)\n end", "def containers\n return @containers\n end", "def container(container_id)\n if container_id\n container = ::Docker::Container.send(:new, @dockerd, container_id)\n # return the container json if we can retrieve it.\n begin\n # check the container exists by querying its json\n container.json\n container\n # if the container doesn't exist we get an Excon 404\n rescue Excon::Errors::NotFound\n nil\n end\n else\n nil\n end\n end", "def show\n @container_stack = ContainerStack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @container_stack }\n end\n end", "def containers_ids\n containers(:response_format => :id_array)\n end", "def get_containers\n init_folder unless @init # have I been initialized?\n return @containers \n end", "def index\n @containers_pages = @page.containers_pages\n end", "def index\n @serverhascontainers = Serverhascontainer.all\n end", "def get_containers\n content = YAML::load(File.read(docker_compose_file))\n content.has_key?('version') ? content['services'].keys : content.keys\n end", "def get_container_properties(name, options={})\n # Query\n query = { }\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n # Call\n response = call(:get, container_uri(name, query), nil, {}, options)\n\n # result\n container = Serialization.container_from_headers(response.headers)\n container.name = name\n container\n end", "def metadata\n log \"retrieving container metadata from #{container_path}\"\n response = storage_client.head(container_path)\n custom = {}\n response.each_capitalized_name { |name|\n custom[name] = response[name] if name[/\\AX-Container-Meta-/]\n }\n {\n :objects => response[\"X-Container-Object-Count\"].to_i,\n :bytes => response[\"X-Container-Bytes-Used\"].to_i,\n :custom => custom,\n }\n end", "def all\n containers = service.list_containers\n data = []\n containers.each do |container|\n c = parse_storage_object(container)\n c[:acl] = 'unknown'\n data << c\n end\n load(data)\n end", "def containers=(value)\n @containers = value\n end", "def create_container(collection, container = nil)\n active_container = container\n if active_container.nil?\n active_container = {\n \"metadata\": [\n {\n \"key\": \"dc.title\",\n \"language\": \"en_US\",\n \"value\": \"Empty Container Document\"\n },\n {\n \"key\": \"dc.contributor.author\",\n \"language\": \"en_US\",\n \"value\": \"Data Services, Bobst Library\"\n }\n ]\n }\n end\n cmd = `curl -X POST -H \"Content-Type: application/json\" -H \"Accept: application/json\" -H \"rest-dspace-token: #{@token}\" -d '#{JSON.generate(active_container)}' #{ENV[\"FDA_REST_ENDPOINT\"]}/collections/#{collection}/items --insecure -s`\n return JSON.parse(cmd)\n end", "def get_container_properties(name, options={})\n query = { }\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n response = call(:get, container_uri(name, query))\n\n container = Serialization.container_from_headers(response.headers)\n container.name = name\n container\n end", "def containers_from_solr\n containers(:response_format => :load_from_solr)\n end", "def containers\n obj = parse_object(1)\n return nil unless obj && obj.m_Container && obj.m_Container.array?\n obj.m_Container.value.map do |e|\n {:name => e.first.value, :preload_index => e.second.preloadIndex.value, :path_id => e.second.asset.m_PathID.value}\n end\n end", "def inspect(container_s)\n containers = container_s\n containers = [containers] unless container_s.is_a?(Array)\n return [] if containers.empty?\n out = run!('inspect', containers)\n result = JSON.parse(out).map { |c| Container.new(c, session:self)}\n if container_s.is_a?(Array)\n result\n else\n result.first\n end\n end", "def get_running_containers\n\n containers = []\n running_tasks = get_list_tasks_result\n running_tasks.task_arns.each do |task_arn|\n containers << RaisEcs::Container.new({\n cloud: @cloud,\n cluster: @cluster,\n service: self,\n task_arn: task_arn\n })\n end\n\n return containers\n\n end", "def index\n if @container\n @container_contents = @container.container_contents\n else\n @container_contents = ContainerContent.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @container_contents }\n end\n end", "def show\n @level_container = LevelContainer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @level_container }\n end\n end", "def get_container(container_name = \"lightstructures\")\n containers = $azure_blob_service.list_containers()\n return containers.detect { |c| c.name == container_name } # Must be better ways?!\nend", "def container\n @container ||= Docker::Container.get(@name)\n rescue Docker::Error::NotFoundError\n @container = nil\n end", "def create params = {}, body = {}\n @connection.request(method: :post, path: build_path(\"/containers/create\", params), headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end", "def index\n @declaration_containers = @declaration.declaration_containers.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @declaration_containers }\n end\n end", "def get_container_metadata(name, options={})\n # Query\n query = { 'comp' => 'metadata' }\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n # Call\n response = call(:get, container_uri(name, query), nil, {}, options)\n\n # result\n container = Serialization.container_from_headers(response.headers)\n container.name = name\n container\n end", "def container\n namespace + '_container'\n end", "def show\n @container_navigation = ContainerNavigation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @container_navigation }\n end\n end", "def objects(container = @default_container,\n path: nil, limit: nil, gt: nil, lt: nil)\n path = path[1..-1] if path && path[0] == ?/\n p = { path: path, limit: limit, marker: gt, end_marker: lt\n }.delete_if {|k,v| v.nil? }\n j,h = api_openstack(:get, container, p)\n Hash[j.map {|o| [ o['name'], {\n :hash => o['hash'],\n :lastmod => Time.parse(o['last_modified']),\n :size => o['bytes'].to_i,\n :type => o['content_type'],\n :contuse => h['x-container-bytes-used'],\n :contoct => h['x-container-object-coun'],\n :storpol => h['x-storage-policy'],\n } ] } ]\n end", "def get_container_metadata(name, options={})\n query = { 'comp' => 'metadata'}\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n response = call(:get, container_uri(name, query))\n\n container = Serialization.container_from_headers(response.headers)\n container.name = name\n container\n end", "def list # rubocop:disable Metrics/AbcSize\n authcookie = ComputeBase.new\n authcookie = authcookie.authenticate(id_domain, user, passwd, restendpoint)\n url = restendpoint + @function + container\n uri = URI.parse(url)\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::Get.new(uri.request_uri)\n request.add_field 'accept', 'application/oracle-compute-v3+json' if action == 'details'\n request.add_field 'accept', 'application/oracle-compute-v3+directory+json' if action == 'list'\n request.add_field 'Cookie', authcookie\n http.request(request)\n end", "def get_container\n container_id_key = params.keys.find_all { |key| key =~ /\\w+_id/ }.last\n container_class = eval(container_id_key.humanize.titleize.delete(' '))\n @container = container_class.find_by_id(params[container_id_key])\n redirect_with_error 'Invalid project id' unless @container\n end", "def get # replace this with the call that I use in my class that follows redirects\n @debug and $stderr.puts \"getting container\"\n @debug and $stderr.puts self.uri, {accept: \"text/turtle\"}, self.client.username, self.client.password\n response = LDP::HTTPUtils.get(self.uri, {accept: \"text/turtle\"}, self.client.username, self.client.password)\n etag = Digest::SHA2.hexdigest `date` \n headers = {ETag: \"#{etag}\", accept: 'text/turtle', content_type: 'text/turtle'}\n\n response = LDP::HTTPUtils.get(self.uri, headers, self.client.username, self.client.password)\n\n if response\n return response\n else\n @debug and $stderr.puts \"FAILED to find this container #{self.uri.to_s}\" # do something more useful, one day\n return false\n end\n end", "def get_container(container_name)\n container = Docker::Container.all().find do |container|\n container.json['Name'] == \"/#{container_name}\"\n end\n\n if container.nil?\n Kernel.abort(\"Error: Docker container '#{container_name}' does not appear to be running. Please use 'docker logs -f #{container_name}' to investigate any start-up failures.\")\n # This return statement is required as we mock the Kernel.abort call in unit testing.\n return\n end\n\n container\nend", "def read_pods\n kubeclient = build_kube_client!\n\n kubeclient.get_pods(namespace: actual_namespace).as_json\n rescue Kubeclient::ResourceNotFoundError\n []\n end", "def ephemeral_containers\n return @ephemeral_containers\n end", "def get_containers_by(params)\n @containers.values.select do |container|\n (params.to_a - container.attributes.to_a).empty?\n end\n end", "def index\n if (params[:user])\n @containers = User.find_by_login(params[:user]).containers\n else\n if (current_user.nil?)\n redirect_to :controller => :users, :action => :login\n return\n else\n @containers = current_user.containers\n end\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :layout => false }\n end\n end", "def destroy\n @container = Container.find(params[:id])\n @container.destroy\n\n respond_to do |format|\n format.html { redirect_to containers_url, notice: 'Container was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def show_container_with_http_info(container_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContainersApi.show_container ...'\n end\n # verify the required parameter 'container_id' is set\n if @api_client.config.client_side_validation && container_id.nil?\n fail ArgumentError, \"Missing the required parameter 'container_id' when calling ContainersApi.show_container\"\n end\n # resource path\n local_var_path = '/containers/{container_id}'.sub('{' + 'container_id' + '}', CGI.escape(container_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Container' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContainersApi#show_container\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def info\n container.info\n end", "def create\n response = get_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/containers/\"+params[:containerID].to_s+\"/deploy.json\"), (sesh :current_token))\n json_respond response.body\n end", "def index\n status = get_health_status( )\n response = make_response( status )\n #render json: response, :status => response.is_healthy? ? 200 : 500\n render json: response, :status => 200 # dont want to continuously restart the container\n end", "def container\n return nil if container_type.blank? || container_id.blank?\n container_type.constantize.where(id: container_id).first\n end", "def show\n @container = Container.get!(params[:id])\n @dropbox = Dropbox.new(@container)\n @upload_url = upload_container_url(@container.id)\n if Ixtlan::Guard.check(self, :containers, :edit, nil) || @container.public?\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @container }\n end\n else\n redirect_to container_url(Container.root.id)\n end\n end", "def container\n @container ||= Container.new(spec[:containers].first)\n end", "def show\n @containers_pages = @page.containers_pages \n end", "def container_names\n (@pod.dig(:spec, :containers) + self.class.init_containers(@pod)).map { |c| c.fetch(:name) }.uniq\n end", "def index\n response = HTTParty.get('http://okta-api:8080/pets/v1/cats', {headers: {\"X-Token\"=> session[:oktastate][:credentials][:token]}})\n if response.code == 200\n @cats = JSON.parse(response.body)\n else\n @cats = []\n end\n end", "def list\n @collections = Admin::Collection.names\n\n render json: { collections: @collections }\n end", "def container\n cache or raise RuntimeError, \"no container known.\"\n end", "def new\n @container_stack = ContainerStack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @container_stack }\n end\n end", "def find_container\n if action_name.in? ['create', 'update']\n cid = params[:container_id]\n else\n cid = params[:id]\n params[:id] = params[:download_id]\n alid = params[:activity_log_id]\n altype = params[:activity_log_type]\n end\n @container = NfsStore::Browse.open_container id: cid, user: current_user\n @retrieval_type = params[:retrieval_type]\n\n @activity_log = ActivityLog.open_activity_log altype, alid, current_user if alid.present? && altype.present?\n\n case @retrieval_type\n when 'stored_file'\n @download = @container.stored_files.find_by(id: params[:download_id])\n when 'archived_file'\n @download = @container.archived_files.find_by(id: params[:download_id])\n else\n raise FphsException, 'Incorrect retrieval_type set'\n end\n\n @container.parent_item = @activity_log\n @master = @container.master\n @master.current_user ||= current_user\n # object_instance.container = @container\n @container\n end", "def containers_for_image(img = docker_image)\n `docker ps -aq -f ancestor=#{img}`.split(\"\\n\")\n end", "def index\n nova_ip = nil\n quantum_ip = nil\n # Read X-Auth-Token from message header and extract nova/quantum IPs\n if request.headers[\"X-Auth-Token\"] != \"\"\n token = request.headers[\"X-Auth-Token\"]\n begin\n services = Donabe::KEYSTONE.get_endpoints(token)\n services[\"endpoints\"].each do |endpoint|\n if endpoint[\"name\"] == \"nova\"\n nova_ip = endpoint[\"internalURL\"]\n elsif endpoint[\"name\"] == \"quantum\"\n quantum_ip = endpoint[\"internalURL\"]\n end\n end\n # Check if these nodes are active using given nova/quantum IPs\n checkNodes(DeployedContainer.where(:tenant_id => params[:tenant_id]),nova_ip,quantum_ip,token)\n\n @deployed_containers = DeployedContainer.where(:tenant_id => params[:tenant_id])\n logger.info \"Deployed Containers:\"\n logger.info @deployed_containers.to_s()\n rescue\n # Donabe no longer holds its own cookies\n # This rescue solution is deprecated\n # token = Storage.find(cookies[:current_token]).data\n # nova_ip = Storage.find(cookies[:nova_ip]).data\n # quantum_ip = Storage.find(cookies[:quantum_ip]).data\n\n logger.info \"Incorrect/Expired Token Received From Curvature:\"\n logger.info token\n \n # Respond with HTTP 401 Unauthorized\n render status: :unauthorized\n end\n else\n # Respond with HTTP 401 Unauthorized\n render status: :unauthorized\n end\n end", "def index\n @collections = current_user.collections.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @collections }\n end\n end", "def get_docker_container(environment, container_name)\n container_id = \"#{environment.get_compose_project_name}_#{container_name}\"\n container = get_container(container_id)\n until container.json['NetworkSettings']['Ports']\n container = get_container(container_id)\n end\n container\nend", "def get_container_instance(container)\n Docker::Container.all(all: true).each do |cont|\n return cont if cont.id == container\n end\n end", "def create\n begin\n #get the server chosen container_params[:server_id]\n @currentServer = Server.where(id: container_params[:server_id])\n Docker.url = 'tcp://' + @currentServer[0].ip + \":\" + @currentServer[0].port\n\n #create the container in docker\n if container_params[:exposed_port].blank?\n @con = Docker::Container.create(\n 'name' => container_params[:name],\n 'Image' => container_params[:image]\n ) \n else \n @con = Docker::Container.create(\n 'name' => container_params[:name],\n 'Image' => container_params[:image],\n 'ExposedPorts' => { container_params[:exposed_port]+'/tcp' => {} },\n 'HostConfig' => {\n 'PortBindings' => {\n container_params[:exposed_port]+'/tcp' => [{ 'HostPort' => container_params[:host_port] }]\n }\n }\n )\n end\n\n #adds the container into the database\n @container = Container.new(:name => container_params[:name], :image => container_params[:image], :command => container_params[:command], :exposed_port => container_params[:exposed_port], \n :host_port => container_params[:host_port], :dockercontainer_id => @con.id, :status => 'Created')\n\n Docker.url = ''\n\n respond_to do |format|\n if @container.save\n Serverhascontainer.new(:server_id => @currentServer[0].id, :container_id => @container.id).save\n format.html { redirect_to root_path, notice: 'Container was successfully created.' }\n format.json { render :show, status: :created, location: @container }\n else\n format.html { render :new }\n format.json { render json: @container.errors, status: :unprocessable_entity }\n end\n end\n\n rescue Docker::Error::ClientError => e\n respond_to do |format| \n format.html { redirect_to root_path, notice: \"Oops: #{e.message}\" }\n end\n\n rescue Docker::Error::NotFoundError => e\n respond_to do |format| \n format.html { redirect_to root_path, notice: \"Oops: #{e.message}\" }\n end\n\n rescue Docker::Error::ConflictError => e\n respond_to do |format| \n format.html { redirect_to root_path, notice: \"Oops: #{e.message}\" }\n end\n\n end\n end", "def index\n info = Aws.get_recipes_from_db\n render :json => info\n end", "def search(prefix)\n log \"retrieving container listing from #{container_path} items starting with #{prefix}\"\n list(prefix: prefix)\n end", "def container\n @container ||= find_or_create_container\n end", "def container_instances\n instances = []\n @client.describe_tasks(cluster: @cluster, tasks: tasks)[0].each do |e|\n instances << e[:container_instance_arn]\n end\n instances\n end", "def container\n @container ||= Dry::Container.new\n end", "def index\n conditions = { :client_id => @client.id }\n if params[\"tags\"]\n conditions.merge!({:tags => params[\"tags\"]})\n end\n\n @collections = Collection.where(conditions).order('updated_at DESC')\n @collections.reject! { |item| ! item.read?(@user, @client) }\n\n entries = Array.new\n if @collections\n @collections.each do |item|\n entries << item.info_hash(@user, @client)\n end\n end\n render_json :entry => entries and return\n end", "def set_container\n @container = Container.find(params[:id])\n end", "def set_container\n @container = Container.find(params[:id])\n end", "def get_container(container_name)\n assert_not_nil @rdigg.info.get_container(\"technology\")\n end", "def container_params\n params.require(:container).permit(:name, :image, :command, :exposed_port, :host_port, :server_id)\n end", "def container_properties(name, key = nil)\n key ||= properties.key1\n\n response = blob_response(key, \"restype=container\", name)\n\n ContainerProperty.new(response.headers)\n end", "def add_container(params = {})\n now = Time.now.strftime(\"%Y-%m-%dT%H:%M:%S\")\n now = now.gsub(':', '--')\n\n @slug = params.fetch(:slug, now)\n \n containers = self.get_containers\n containers.each do |c|\n return c if c.uri.to_s.match(/\\/#{@slug}\\/?$/) # check if it already exists\n end\n \n # headers = {accept: 'text/turtle', content_type: 'text/turtle', \"Slug\" => @slug, \"Link\" => '<http://www.w3.org/ns/ldp#BasicContainer>; rel=\"type\"'}\n \n payload = \"\"\"@prefix ldp: <http://www.w3.org/ns/ldp#> . \n <> a ldp:Container, ldp:BasicContainer .\"\"\"\n etag = Digest::SHA2.hexdigest payload \n headers = {ETag: \"#{etag}\", accept: 'text/turtle', content_type: 'text/turtle', \"Slug\" => @slug, \"Link\" => '<http://www.w3.org/ns/ldp#BasicContainer>; rel=\"type\"'}\n \n \n response = LDP::HTTPUtils::post(self.uri, headers, payload, self.client.username, self.client.password)\n if response\n newuri = response.headers[:location] \n newcont = self._add_container({:uri => newuri,\n :client => self.client,\n :parent => self,\n :top => self.toplevel_container,\n :init => true})\n unless newcont\n abort \"PROBLEM - cannot add new container with id #{newuri}. BAILING just to be safe\"\n end\n return newcont\n else\n abort \"PROBLEM - cannot create container into #{self.uri}. BAILING just to be safe\"\n end\n \n end", "def container\n options.fetch(:container)\n end", "def container\n container_class\n end", "def check_container(name)\n begin\n container=CF.container(name)\n container.make_public unless container.cdn_enabled?\n puts container.cdn_url if container.cdn_enabled?\n count=container.count\n rescue CloudFiles::Exception::NoSuchContainer\n container=CF.create_container(name)\n container.make_public\n count=container.count\n rescue CloudFiles::Exception::InvalidResponse\n\tSTDERR.puts \"FAIL: Invalid response container\"\n exit\n end\n return count\nend", "def handle_create(event)\n @bus.request 'containers', 'created', event: event.json, container: container_info(event.id)\n end", "def describe_container_instances(params={})\n if instances = params.delete('containerInstances')\n params.merge!(Fog::AWS.indexed_param('containerInstances.member', [*instances]))\n end\n\n request({\n 'Action' => 'DescribeContainerInstances',\n :parser => Fog::Parsers::AWS::ECS::DescribeContainerInstances.new\n }.merge(params))\n end", "def id\n container.id\n end", "def init_containers\n return @init_containers\n end", "def index\n @collections = @institution.collections.order(:name)\n\n respond_to do |format|\n format.html { render layout: 'fluid' }# index.html.erb\n format.json { render json: @collections }\n end\n end", "def index\n @custom_collections = CustomCollection.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @custom_collections }\n end\n end", "def show\n @container_content = ContainerContent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @container_content }\n end\n end", "def show\n @receipt_container = ReceiptContainer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @receipt_container }\n end\n end", "def container_params\n params.require(:container).permit(:name, :container_name, :image)\n end", "def containers\n return @containers unless @containers.nil?\n container_codes = []\n codes = code.split('|')\n container_codes << (codes = codes[0..-2]).join('|') while codes.size > 1\n # first is country code\n @containers = [country]\n # second, third can be parent administrative division if not nil\n # NOTE container codes is like: [\"ES|58|PO\", \"ES|58\", \"ES\"] (country is last)\n @containers += Division.find_all_by_code container_codes[0..-2], :order => :level if container_codes.size > 1\n return @containers\n end", "def index\n render json: @owner.cats\n end", "def index\n @datacenters = Datacenter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @datacenters }\n end\n end", "def show_resources_in_namespace(namespace, *resource_types)\n run \"kubectl get #{resource_types.join(',')} --namespace #{namespace} --output=wide\"\nend" ]
[ "0.7165998", "0.7068954", "0.6897867", "0.6833766", "0.6760254", "0.6758191", "0.67024255", "0.6604404", "0.6592616", "0.6590891", "0.65503347", "0.6488054", "0.6399582", "0.6274847", "0.62428796", "0.62336564", "0.6215182", "0.6203278", "0.61912113", "0.607803", "0.6036521", "0.5987912", "0.5963187", "0.595787", "0.5945166", "0.59438276", "0.59167475", "0.59093577", "0.59033835", "0.59014076", "0.5895529", "0.5890641", "0.5878423", "0.5864035", "0.5863255", "0.58625203", "0.5861244", "0.5839449", "0.5836548", "0.58287334", "0.58202106", "0.5784988", "0.5784361", "0.5768238", "0.57623535", "0.57447195", "0.5744468", "0.57406545", "0.5681949", "0.56564337", "0.56517345", "0.5638566", "0.5615299", "0.5604537", "0.5593178", "0.5589419", "0.55731887", "0.55566275", "0.55426216", "0.55419993", "0.5539339", "0.5534638", "0.5533749", "0.5517145", "0.5515159", "0.55115396", "0.55073786", "0.55036825", "0.5498985", "0.5487767", "0.5479696", "0.547474", "0.54728514", "0.546151", "0.5452944", "0.5434666", "0.54330885", "0.543145", "0.54313177", "0.54313177", "0.5420943", "0.54118085", "0.5405506", "0.53872645", "0.53768075", "0.5374161", "0.5370475", "0.53668493", "0.53615814", "0.53572726", "0.53519636", "0.53497076", "0.5321609", "0.53212416", "0.5318696", "0.53179616", "0.53027016", "0.53023875", "0.5302378", "0.52813894" ]
0.7273097
0
GET /containers/1 GET /containers/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @containers = Container.all\n end", "def index\n user_session[:current_container]=nil\n if params[:label].blank?\n @containers = Container.list(params[:filter])\n else\n @container = Container.find_by_label(params[:label])\n render action: 'show' and return\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @containers }\n end\n end", "def create\n response = post_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/containers.json\"), params[:container].to_json, (sesh :current_token))\n json_respond response.body \n\n end", "def containers\n TestLab::Container.all\n end", "def create\n response = post_request(URI.parse(\"http://\"+Storage.find(cookies[:donabe_ip]).data+\"/\"+Storage.find(cookies[:current_tenant]).data+\"/containers.json\"), params[:container].to_json, Storage.find(cookies[:current_token]).data)\n json_respond response.body \n\n end", "def containers\n @containers ||= Docker::Container.all(\n all: true, # include stopped containers\n filters: { id: container_ids }.to_json\n ).map(&:json)\n end", "def index_containers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContainersApi.index_containers ...'\n end\n # resource path\n local_var_path = '/containers'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sort_by'] = @api_client.build_collection_param(opts[:'sort_by'], :pipe) if !opts[:'sort_by'].nil?\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?\n query_params[:'comment'] = opts[:'comment'] if !opts[:'comment'].nil?\n query_params[:'quota_total_size'] = opts[:'quota_total_size'] if !opts[:'quota_total_size'].nil?\n query_params[:'quota_on_cache'] = opts[:'quota_on_cache'] if !opts[:'quota_on_cache'].nil?\n query_params[:'stat_total_files'] = opts[:'stat_total_files'] if !opts[:'stat_total_files'].nil?\n query_params[:'stat_total_size'] = opts[:'stat_total_size'] if !opts[:'stat_total_size'].nil?\n query_params[:'stat_size_on_cache'] = opts[:'stat_size_on_cache'] if !opts[:'stat_size_on_cache'].nil?\n query_params[:'guest_right'] = opts[:'guest_right'] if !opts[:'guest_right'].nil?\n query_params[:'last_update'] = opts[:'last_update'] if !opts[:'last_update'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'ContainerCollection' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContainersApi#index_containers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def containers(key = nil, options = {})\n key ||= properties.key1\n\n query = \"comp=list\"\n options.each { |okey, ovalue| query += \"&#{okey}=#{[ovalue].flatten.join(',')}\" }\n\n response = blob_response(key, query)\n\n doc = Nokogiri::XML(response.body)\n\n results = doc.xpath('//Containers/Container').collect do |element|\n Container.new(Hash.from_xml(element.to_s)['Container'])\n end\n\n results.concat(next_marker_results(doc, :containers, key, options))\n end", "def list # rubocop:disable Metrics/AbcSize\n if @options[:container]\n containerview = ObjectStorage.new(@options[:id_domain], @options[:user_name], @options[:passwd])\n containerview = containerview.contents(@options[:container])\n if containerview.code == '201' || containerview.code == '200'\n containerview.body\n elsif containerview.code == '204'\n print 'the container is empty'\n else\n @util.response_handler(containerview)\n end\n else\n newcontainer = ObjectStorage.new(@options[:id_domain], @options[:user_name], @options[:passwd])\n newcontainer = newcontainer.list\n @util.response_handler(newcontainer)\n newcontainer.body if newcontainer.code == '200'\n puts 'there are no containers' if newcontainer.code == '204'\n end \n end", "def show\n @container_stack = ContainerStack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @container_stack }\n end\n end", "def list_containers(options={})\n query = { }\n if options\n query['prefix'] = options[:prefix] if options[:prefix]\n query['marker'] = options[:marker] if options[:marker]\n query['maxresults'] = options[:max_results].to_s if options[:max_results]\n query['include'] = 'metadata' if options[:metadata] == true\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n end\n\n uri = containers_uri(query)\n response = call(:get, uri)\n\n Serialization.container_enumeration_results_from_xml(response.body)\n end", "def container(container_id)\n if container_id\n container = ::Docker::Container.send(:new, @dockerd, container_id)\n # return the container json if we can retrieve it.\n begin\n # check the container exists by querying its json\n container.json\n container\n # if the container doesn't exist we get an Excon 404\n rescue Excon::Errors::NotFound\n nil\n end\n else\n nil\n end\n end", "def index_containers(opts = {})\n data, _status_code, _headers = index_containers_with_http_info(opts)\n data\n end", "def read_containers\n []\n end", "def get_container(container_name)\n container = Docker::Container.all().find do |container|\n container.json['Name'] == \"/#{container_name}\"\n end\n\n if container.nil?\n Kernel.abort(\"Error: Docker container '#{container_name}' does not appear to be running. Please use 'docker logs -f #{container_name}' to investigate any start-up failures.\")\n # This return statement is required as we mock the Kernel.abort call in unit testing.\n return\n end\n\n container\nend", "def get_containers\n assert_not_nil @rdigg.info.get_containers\n end", "def container\n @container ||= Docker::Container.get(@name)\n rescue Docker::Error::NotFoundError\n @container = nil\n end", "def get_container\n container_id_key = params.keys.find_all { |key| key =~ /\\w+_id/ }.last\n container_class = eval(container_id_key.humanize.titleize.delete(' '))\n @container = container_class.find_by_id(params[container_id_key])\n redirect_with_error 'Invalid project id' unless @container\n end", "def get_container(container_name = \"lightstructures\")\n containers = $azure_blob_service.list_containers()\n return containers.detect { |c| c.name == container_name } # Must be better ways?!\nend", "def show\n @level_container = LevelContainer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @level_container }\n end\n end", "def show\n @container_navigation = ContainerNavigation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @container_navigation }\n end\n end", "def running_containers\n containers = ::Docker::Container.all(all: true, filters: { status: [\"running\"] }.to_json)\n return containers\n end", "def containers_ids\n containers(:response_format => :id_array)\n end", "def get_container_properties(name, options={})\n # Query\n query = { }\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n # Call\n response = call(:get, container_uri(name, query), nil, {}, options)\n\n # result\n container = Serialization.container_from_headers(response.headers)\n container.name = name\n container\n end", "def get_container_instance(container)\n Docker::Container.all(all: true).each do |cont|\n return cont if cont.id == container\n end\n end", "def container\n return nil if container_type.blank? || container_id.blank?\n container_type.constantize.where(id: container_id).first\n end", "def index\n @containers_pages = @page.containers_pages\n end", "def get_container_properties(name, options={})\n query = { }\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n response = call(:get, container_uri(name, query))\n\n container = Serialization.container_from_headers(response.headers)\n container.name = name\n container\n end", "def get # replace this with the call that I use in my class that follows redirects\n @debug and $stderr.puts \"getting container\"\n @debug and $stderr.puts self.uri, {accept: \"text/turtle\"}, self.client.username, self.client.password\n response = LDP::HTTPUtils.get(self.uri, {accept: \"text/turtle\"}, self.client.username, self.client.password)\n etag = Digest::SHA2.hexdigest `date` \n headers = {ETag: \"#{etag}\", accept: 'text/turtle', content_type: 'text/turtle'}\n\n response = LDP::HTTPUtils.get(self.uri, headers, self.client.username, self.client.password)\n\n if response\n return response\n else\n @debug and $stderr.puts \"FAILED to find this container #{self.uri.to_s}\" # do something more useful, one day\n return false\n end\n end", "def show_container_with_http_info(container_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContainersApi.show_container ...'\n end\n # verify the required parameter 'container_id' is set\n if @api_client.config.client_side_validation && container_id.nil?\n fail ArgumentError, \"Missing the required parameter 'container_id' when calling ContainersApi.show_container\"\n end\n # resource path\n local_var_path = '/containers/{container_id}'.sub('{' + 'container_id' + '}', CGI.escape(container_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Container' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContainersApi#show_container\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n status = get_health_status( )\n response = make_response( status )\n #render json: response, :status => response.is_healthy? ? 200 : 500\n render json: response, :status => 200 # dont want to continuously restart the container\n end", "def index\n if @container\n @container_contents = @container.container_contents\n else\n @container_contents = ContainerContent.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @container_contents }\n end\n end", "def inspect(container_s)\n containers = container_s\n containers = [containers] unless container_s.is_a?(Array)\n return [] if containers.empty?\n out = run!('inspect', containers)\n result = JSON.parse(out).map { |c| Container.new(c, session:self)}\n if container_s.is_a?(Array)\n result\n else\n result.first\n end\n end", "def id\n container.id\n end", "def index\n @serverhascontainers = Serverhascontainer.all\n end", "def show\n @container = Container.get!(params[:id])\n @dropbox = Dropbox.new(@container)\n @upload_url = upload_container_url(@container.id)\n if Ixtlan::Guard.check(self, :containers, :edit, nil) || @container.public?\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @container }\n end\n else\n redirect_to container_url(Container.root.id)\n end\n end", "def get_container_metadata(name, options={})\n # Query\n query = { 'comp' => 'metadata' }\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n # Call\n response = call(:get, container_uri(name, query), nil, {}, options)\n\n # result\n container = Serialization.container_from_headers(response.headers)\n container.name = name\n container\n end", "def destroy\n @container = Container.find(params[:id])\n @container.destroy\n\n respond_to do |format|\n format.html { redirect_to containers_url, notice: 'Container was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def containers\n containers_exited(days_old: 1)\n containers_running(days_old: 1)\n end", "def container\n @container ||= Container.new(spec[:containers].first)\n end", "def get_container_metadata(name, options={})\n query = { 'comp' => 'metadata'}\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n response = call(:get, container_uri(name, query))\n\n container = Serialization.container_from_headers(response.headers)\n container.name = name\n container\n end", "def set_container\n @container = Container.find(params[:id])\n end", "def set_container\n @container = Container.find(params[:id])\n end", "def info\n container.info\n end", "def index\n @declaration_containers = @declaration.declaration_containers.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @declaration_containers }\n end\n end", "def create\n response = get_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/containers/\"+params[:containerID].to_s+\"/deploy.json\"), (sesh :current_token))\n json_respond response.body\n end", "def container\n namespace + '_container'\n end", "def metadata\n log \"retrieving container metadata from #{container_path}\"\n response = storage_client.head(container_path)\n custom = {}\n response.each_capitalized_name { |name|\n custom[name] = response[name] if name[/\\AX-Container-Meta-/]\n }\n {\n :objects => response[\"X-Container-Object-Count\"].to_i,\n :bytes => response[\"X-Container-Bytes-Used\"].to_i,\n :custom => custom,\n }\n end", "def create params = {}, body = {}\n @connection.request(method: :post, path: build_path(\"/containers/create\", params), headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end", "def new\n @container_stack = ContainerStack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @container_stack }\n end\n end", "def create\n begin\n #get the server chosen container_params[:server_id]\n @currentServer = Server.where(id: container_params[:server_id])\n Docker.url = 'tcp://' + @currentServer[0].ip + \":\" + @currentServer[0].port\n\n #create the container in docker\n if container_params[:exposed_port].blank?\n @con = Docker::Container.create(\n 'name' => container_params[:name],\n 'Image' => container_params[:image]\n ) \n else \n @con = Docker::Container.create(\n 'name' => container_params[:name],\n 'Image' => container_params[:image],\n 'ExposedPorts' => { container_params[:exposed_port]+'/tcp' => {} },\n 'HostConfig' => {\n 'PortBindings' => {\n container_params[:exposed_port]+'/tcp' => [{ 'HostPort' => container_params[:host_port] }]\n }\n }\n )\n end\n\n #adds the container into the database\n @container = Container.new(:name => container_params[:name], :image => container_params[:image], :command => container_params[:command], :exposed_port => container_params[:exposed_port], \n :host_port => container_params[:host_port], :dockercontainer_id => @con.id, :status => 'Created')\n\n Docker.url = ''\n\n respond_to do |format|\n if @container.save\n Serverhascontainer.new(:server_id => @currentServer[0].id, :container_id => @container.id).save\n format.html { redirect_to root_path, notice: 'Container was successfully created.' }\n format.json { render :show, status: :created, location: @container }\n else\n format.html { render :new }\n format.json { render json: @container.errors, status: :unprocessable_entity }\n end\n end\n\n rescue Docker::Error::ClientError => e\n respond_to do |format| \n format.html { redirect_to root_path, notice: \"Oops: #{e.message}\" }\n end\n\n rescue Docker::Error::NotFoundError => e\n respond_to do |format| \n format.html { redirect_to root_path, notice: \"Oops: #{e.message}\" }\n end\n\n rescue Docker::Error::ConflictError => e\n respond_to do |format| \n format.html { redirect_to root_path, notice: \"Oops: #{e.message}\" }\n end\n\n end\n end", "def container_id\n if !params[:container_id].nil?\n return params[:container_id]\n else\n return params[:id]\n end\n end", "def find_container\n if action_name.in? ['create', 'update']\n cid = params[:container_id]\n else\n cid = params[:id]\n params[:id] = params[:download_id]\n alid = params[:activity_log_id]\n altype = params[:activity_log_type]\n end\n @container = NfsStore::Browse.open_container id: cid, user: current_user\n @retrieval_type = params[:retrieval_type]\n\n @activity_log = ActivityLog.open_activity_log altype, alid, current_user if alid.present? && altype.present?\n\n case @retrieval_type\n when 'stored_file'\n @download = @container.stored_files.find_by(id: params[:download_id])\n when 'archived_file'\n @download = @container.archived_files.find_by(id: params[:download_id])\n else\n raise FphsException, 'Incorrect retrieval_type set'\n end\n\n @container.parent_item = @activity_log\n @master = @container.master\n @master.current_user ||= current_user\n # object_instance.container = @container\n @container\n end", "def create_container(collection, container = nil)\n active_container = container\n if active_container.nil?\n active_container = {\n \"metadata\": [\n {\n \"key\": \"dc.title\",\n \"language\": \"en_US\",\n \"value\": \"Empty Container Document\"\n },\n {\n \"key\": \"dc.contributor.author\",\n \"language\": \"en_US\",\n \"value\": \"Data Services, Bobst Library\"\n }\n ]\n }\n end\n cmd = `curl -X POST -H \"Content-Type: application/json\" -H \"Accept: application/json\" -H \"rest-dspace-token: #{@token}\" -d '#{JSON.generate(active_container)}' #{ENV[\"FDA_REST_ENDPOINT\"]}/collections/#{collection}/items --insecure -s`\n return JSON.parse(cmd)\n end", "def get_docker_container(environment, container_name)\n container_id = \"#{environment.get_compose_project_name}_#{container_name}\"\n container = get_container(container_id)\n until container.json['NetworkSettings']['Ports']\n container = get_container(container_id)\n end\n container\nend", "def get_containers\n content = YAML::load(File.read(docker_compose_file))\n content.has_key?('version') ? content['services'].keys : content.keys\n end", "def containers\n return @containers\n end", "def show\n @receipt_container = ReceiptContainer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @receipt_container }\n end\n end", "def get_container(container_name)\n assert_not_nil @rdigg.info.get_container(\"technology\")\n end", "def index\n @docker_instances = DockerInstance.all\n @docker_instance = DockerInstance.new\n end", "def containers=(value)\n @containers = value\n end", "def get(container_name, file_name)\n validate_path_elements(container_name, file_name)\n\n File.from_response(\n file_name,\n client.request_raw_response(\n method: :get,\n path: \"#{container_name}/#{file_name}\",\n expected: 200,\n )\n )\n end", "def container_properties(name, key = nil)\n key ||= properties.key1\n\n response = blob_response(key, \"restype=container\", name)\n\n ContainerProperty.new(response.headers)\n end", "def container_id\n @container_info[\"Id\"]\n end", "def objects(container = @default_container,\n path: nil, limit: nil, gt: nil, lt: nil)\n path = path[1..-1] if path && path[0] == ?/\n p = { path: path, limit: limit, marker: gt, end_marker: lt\n }.delete_if {|k,v| v.nil? }\n j,h = api_openstack(:get, container, p)\n Hash[j.map {|o| [ o['name'], {\n :hash => o['hash'],\n :lastmod => Time.parse(o['last_modified']),\n :size => o['bytes'].to_i,\n :type => o['content_type'],\n :contuse => h['x-container-bytes-used'],\n :contoct => h['x-container-object-coun'],\n :storpol => h['x-storage-policy'],\n } ] } ]\n end", "def get_containers\n init_folder unless @init # have I been initialized?\n return @containers \n end", "def container\n cache or raise RuntimeError, \"no container known.\"\n end", "def destroy\n @container = Container.find(params[:id])\n @container.destroy\n\n respond_to do |format|\n format.html { redirect_to(containers_url) }\n format.xml { head :ok }\n end\n end", "def get_container_id(image=@ws_image, hosts=@hosts)\n hosts.each do |host|\n Docker.url = \"tcp://#{host}:#{@docker_port}/\"\n containers = Docker::Container.all(all: true, filters: { ancestor: [image],status:['running'] }.to_json)\n return containers.first unless containers.empty?\n end\n fail('Could not found a webserver running')\n end", "def container_params\n params.require(:container).permit(:name, :image, :command, :exposed_port, :host_port, :server_id)\n end", "def index\n if (params[:user])\n @containers = User.find_by_login(params[:user]).containers\n else\n if (current_user.nil?)\n redirect_to :controller => :users, :action => :login\n return\n else\n @containers = current_user.containers\n end\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :layout => false }\n end\n end", "def read_pods\n kubeclient = build_kube_client!\n\n kubeclient.get_pods(namespace: actual_namespace).as_json\n rescue Kubeclient::ResourceNotFoundError\n []\n end", "def show\n @container_content = ContainerContent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @container_content }\n end\n end", "def all\n containers = service.list_containers\n data = []\n containers.each do |container|\n c = parse_storage_object(container)\n c[:acl] = 'unknown'\n data << c\n end\n load(data)\n end", "def show\n @containers_pages = @page.containers_pages \n end", "def add_container(params = {})\n now = Time.now.strftime(\"%Y-%m-%dT%H:%M:%S\")\n now = now.gsub(':', '--')\n\n @slug = params.fetch(:slug, now)\n \n containers = self.get_containers\n containers.each do |c|\n return c if c.uri.to_s.match(/\\/#{@slug}\\/?$/) # check if it already exists\n end\n \n # headers = {accept: 'text/turtle', content_type: 'text/turtle', \"Slug\" => @slug, \"Link\" => '<http://www.w3.org/ns/ldp#BasicContainer>; rel=\"type\"'}\n \n payload = \"\"\"@prefix ldp: <http://www.w3.org/ns/ldp#> . \n <> a ldp:Container, ldp:BasicContainer .\"\"\"\n etag = Digest::SHA2.hexdigest payload \n headers = {ETag: \"#{etag}\", accept: 'text/turtle', content_type: 'text/turtle', \"Slug\" => @slug, \"Link\" => '<http://www.w3.org/ns/ldp#BasicContainer>; rel=\"type\"'}\n \n \n response = LDP::HTTPUtils::post(self.uri, headers, payload, self.client.username, self.client.password)\n if response\n newuri = response.headers[:location] \n newcont = self._add_container({:uri => newuri,\n :client => self.client,\n :parent => self,\n :top => self.toplevel_container,\n :init => true})\n unless newcont\n abort \"PROBLEM - cannot add new container with id #{newuri}. BAILING just to be safe\"\n end\n return newcont\n else\n abort \"PROBLEM - cannot create container into #{self.uri}. BAILING just to be safe\"\n end\n \n end", "def list # rubocop:disable Metrics/AbcSize\n authcookie = ComputeBase.new\n authcookie = authcookie.authenticate(id_domain, user, passwd, restendpoint)\n url = restendpoint + @function + container\n uri = URI.parse(url)\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::Get.new(uri.request_uri)\n request.add_field 'accept', 'application/oracle-compute-v3+json' if action == 'details'\n request.add_field 'accept', 'application/oracle-compute-v3+directory+json' if action == 'list'\n request.add_field 'Cookie', authcookie\n http.request(request)\n end", "def search(prefix)\n log \"retrieving container listing from #{container_path} items starting with #{prefix}\"\n list(prefix: prefix)\n end", "def containers\n obj = parse_object(1)\n return nil unless obj && obj.m_Container && obj.m_Container.array?\n obj.m_Container.value.map do |e|\n {:name => e.first.value, :preload_index => e.second.preloadIndex.value, :path_id => e.second.asset.m_PathID.value}\n end\n end", "def container_uri(name, query={})\n return name if name.kind_of? ::URI\n query = { 'restype' => 'container'}.merge(query)\n generate_uri(name, query)\n end", "def get_containers_by(params)\n @containers.values.select do |container|\n (params.to_a - container.attributes.to_a).empty?\n end\n end", "def index\n nova_ip = nil\n quantum_ip = nil\n # Read X-Auth-Token from message header and extract nova/quantum IPs\n if request.headers[\"X-Auth-Token\"] != \"\"\n token = request.headers[\"X-Auth-Token\"]\n begin\n services = Donabe::KEYSTONE.get_endpoints(token)\n services[\"endpoints\"].each do |endpoint|\n if endpoint[\"name\"] == \"nova\"\n nova_ip = endpoint[\"internalURL\"]\n elsif endpoint[\"name\"] == \"quantum\"\n quantum_ip = endpoint[\"internalURL\"]\n end\n end\n # Check if these nodes are active using given nova/quantum IPs\n checkNodes(DeployedContainer.where(:tenant_id => params[:tenant_id]),nova_ip,quantum_ip,token)\n\n @deployed_containers = DeployedContainer.where(:tenant_id => params[:tenant_id])\n logger.info \"Deployed Containers:\"\n logger.info @deployed_containers.to_s()\n rescue\n # Donabe no longer holds its own cookies\n # This rescue solution is deprecated\n # token = Storage.find(cookies[:current_token]).data\n # nova_ip = Storage.find(cookies[:nova_ip]).data\n # quantum_ip = Storage.find(cookies[:quantum_ip]).data\n\n logger.info \"Incorrect/Expired Token Received From Curvature:\"\n logger.info token\n \n # Respond with HTTP 401 Unauthorized\n render status: :unauthorized\n end\n else\n # Respond with HTTP 401 Unauthorized\n render status: :unauthorized\n end\n end", "def containers_from_solr\n containers(:response_format => :load_from_solr)\n end", "def show\n @konfig = Konfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @konfig }\n end\n end", "def check_container(name)\n begin\n container=CF.container(name)\n container.make_public unless container.cdn_enabled?\n puts container.cdn_url if container.cdn_enabled?\n count=container.count\n rescue CloudFiles::Exception::NoSuchContainer\n container=CF.create_container(name)\n container.make_public\n count=container.count\n rescue CloudFiles::Exception::InvalidResponse\n\tSTDERR.puts \"FAIL: Invalid response container\"\n exit\n end\n return count\nend", "def handle_create(event)\n @bus.request 'containers', 'created', event: event.json, container: container_info(event.id)\n end", "def index\n info = Aws.get_recipes_from_db\n render :json => info\n end", "def container\n @container ||= find_or_create_container\n end", "def read_container_id\n @id = ContainerStateFiles.read_container_id(store_address)\n cid = @id\n # SystemDebug.debug(SystemDebug.containers, 'read container from file ', @container_id)\n if @id == -1 || @id.nil? # && set_state != :nocontainer\n info = container_api.inspect_container_by_name(@container_name) # docker_info\n info = info[0] if info.is_a?(Array)\n if info.key?(:RepoTags)\n #No container by that name and it will return images by that name WTF\n @id = -1\n else\n @id = info[:Id] if info.key?(:Id)\n end\n end\n save_state unless cid == @id\n @id\n rescue EnginesException\n clear_cid unless cid == -1\n @id = -1\n end", "def containers_for_image(img = docker_image)\n `docker ps -aq -f ancestor=#{img}`.split(\"\\n\")\n end", "def new\n @container = Container.new\n \n respond_to do |format|\n format.html { render :action => :edit }\n format.xml { render :action => :edit, :xml => @container }\n end\n end", "def container_names\n (@pod.dig(:spec, :containers) + self.class.init_containers(@pod)).map { |c| c.fetch(:name) }.uniq\n end", "def id\n container_info.ids[0] if container_info.entries.length == 1\n end", "def container_params\n params.require(:container).permit(:name, :container_name, :image)\n end", "def container_id\n return @container_id\n end", "def show_container(container_id, opts = {})\n data, _status_code, _headers = show_container_with_http_info(container_id, opts)\n data\n end", "def show\n @console_pool = ConsolePool.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @console_pool }\n end\n end", "def handle_start(event)\n @bus.request 'containers', 'started', event: event.json, container: container_info(event.id)\n end", "def get_container_acl(name, options={})\n # Query\n query = { 'comp' => 'acl' }\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n \n # Call\n response = call(:get, container_uri(name, query), nil, {}, options)\n\n # Result\n container = Serialization.container_from_headers(response.headers)\n container.name = name\n\n signed_identifiers = nil\n signed_identifiers = Serialization.signed_identifiers_from_xml(response.body) if response.body != nil && response.body.length > 0\n\n return container, signed_identifiers\n end", "def container\n options.fetch(:container)\n end", "def index\n response = HTTParty.get('http://okta-api:8080/pets/v1/cats', {headers: {\"X-Token\"=> session[:oktastate][:credentials][:token]}})\n if response.code == 200\n @cats = JSON.parse(response.body)\n else\n @cats = []\n end\n end" ]
[ "0.7073563", "0.67935073", "0.6714441", "0.65694743", "0.6517765", "0.65022904", "0.6481102", "0.6479815", "0.64027053", "0.6386483", "0.63101", "0.6241775", "0.6180359", "0.6120906", "0.6048366", "0.6031399", "0.6015925", "0.6007973", "0.599529", "0.5950116", "0.5936465", "0.592388", "0.5913088", "0.5880928", "0.5880346", "0.5859305", "0.5851717", "0.5849039", "0.584566", "0.58315295", "0.5824229", "0.58159465", "0.58116835", "0.58096284", "0.5786219", "0.577827", "0.57746845", "0.5769631", "0.57678765", "0.5737891", "0.5735824", "0.57224935", "0.57224935", "0.56856614", "0.5683828", "0.5680184", "0.56755555", "0.5665695", "0.56524855", "0.5651305", "0.56500727", "0.564454", "0.5627106", "0.5621873", "0.5621777", "0.56029767", "0.55586445", "0.55529386", "0.5548465", "0.5532392", "0.55227286", "0.5505167", "0.55017823", "0.54978794", "0.5486868", "0.54814714", "0.54708654", "0.54660386", "0.54466987", "0.5435921", "0.5434379", "0.54280645", "0.54216325", "0.541804", "0.54098964", "0.5408017", "0.5400477", "0.5398147", "0.5393799", "0.5393358", "0.53912413", "0.5387202", "0.5379604", "0.5377693", "0.5370044", "0.5355039", "0.5337489", "0.5328946", "0.53267366", "0.5313898", "0.53099525", "0.5308709", "0.5306045", "0.5301876", "0.53005713", "0.5299004", "0.5291774", "0.5278745", "0.5261243", "0.52586216", "0.5243985" ]
0.0
-1
POST /containers POST /containers.json
def create begin #get the server chosen container_params[:server_id] @currentServer = Server.where(id: container_params[:server_id]) Docker.url = 'tcp://' + @currentServer[0].ip + ":" + @currentServer[0].port #create the container in docker if container_params[:exposed_port].blank? @con = Docker::Container.create( 'name' => container_params[:name], 'Image' => container_params[:image] ) else @con = Docker::Container.create( 'name' => container_params[:name], 'Image' => container_params[:image], 'ExposedPorts' => { container_params[:exposed_port]+'/tcp' => {} }, 'HostConfig' => { 'PortBindings' => { container_params[:exposed_port]+'/tcp' => [{ 'HostPort' => container_params[:host_port] }] } } ) end #adds the container into the database @container = Container.new(:name => container_params[:name], :image => container_params[:image], :command => container_params[:command], :exposed_port => container_params[:exposed_port], :host_port => container_params[:host_port], :dockercontainer_id => @con.id, :status => 'Created') Docker.url = '' respond_to do |format| if @container.save Serverhascontainer.new(:server_id => @currentServer[0].id, :container_id => @container.id).save format.html { redirect_to root_path, notice: 'Container was successfully created.' } format.json { render :show, status: :created, location: @container } else format.html { render :new } format.json { render json: @container.errors, status: :unprocessable_entity } end end rescue Docker::Error::ClientError => e respond_to do |format| format.html { redirect_to root_path, notice: "Oops: #{e.message}" } end rescue Docker::Error::NotFoundError => e respond_to do |format| format.html { redirect_to root_path, notice: "Oops: #{e.message}" } end rescue Docker::Error::ConflictError => e respond_to do |format| format.html { redirect_to root_path, notice: "Oops: #{e.message}" } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n response = post_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/containers.json\"), params[:container].to_json, (sesh :current_token))\n json_respond response.body \n\n end", "def create\n response = post_request(URI.parse(\"http://\"+Storage.find(cookies[:donabe_ip]).data+\"/\"+Storage.find(cookies[:current_tenant]).data+\"/containers.json\"), params[:container].to_json, Storage.find(cookies[:current_token]).data)\n json_respond response.body \n\n end", "def create params = {}, body = {}\n @connection.request(method: :post, path: build_path(\"/containers/create\", params), headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end", "def handle_create(event)\n @bus.request 'containers', 'created', event: event.json, container: container_info(event.id)\n end", "def create\n response = get_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/containers/\"+params[:containerID].to_s+\"/deploy.json\"), (sesh :current_token))\n json_respond response.body\n end", "def create_container(collection, container = nil)\n active_container = container\n if active_container.nil?\n active_container = {\n \"metadata\": [\n {\n \"key\": \"dc.title\",\n \"language\": \"en_US\",\n \"value\": \"Empty Container Document\"\n },\n {\n \"key\": \"dc.contributor.author\",\n \"language\": \"en_US\",\n \"value\": \"Data Services, Bobst Library\"\n }\n ]\n }\n end\n cmd = `curl -X POST -H \"Content-Type: application/json\" -H \"Accept: application/json\" -H \"rest-dspace-token: #{@token}\" -d '#{JSON.generate(active_container)}' #{ENV[\"FDA_REST_ENDPOINT\"]}/collections/#{collection}/items --insecure -s`\n return JSON.parse(cmd)\n end", "def container_params\n params.require(:container).permit(:name, :container_name, :image)\n end", "def container_params\n params.require(:container).permit(:name, :image, :command, :exposed_port, :host_port, :server_id)\n end", "def create\n @container = current_user.containers.build(params[:container])\n \n respond_to do |format|\n if @container.save\n flash[:notice] = 'Container was successfully created.'\n format.html { redirect_to(@container) }\n format.xml { render :xml => @container, :status => :created, :location => @container }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @container.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create # rubocop:disable Metrics/AbcSize\n attrcheck = { 'container name' => @options[:container] }\n @validate.attrvalidate(@options, attrcheck)\n newcontainer = ObjectStorage.new(@options[:id_domain], @options[:user_name], @options[:passwd])\n newcontainer = newcontainer.create(@options[:container])\n if newcontainer.code == '201'\n puts \"Container #{@options[:container]} created\"\n else\n @util.response_handler(newcontainer)\n end \n end", "def create\n @serverhascontainer = Serverhascontainer.new(serverhascontainer_params)\n\n respond_to do |format|\n if @serverhascontainer.save\n format.html { redirect_to @serverhascontainer, notice: 'Serverhascontainer was successfully created.' }\n format.json { render :show, status: :created, location: @serverhascontainer }\n else\n format.html { render :new }\n format.json { render json: @serverhascontainer.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_container(params = {})\n now = Time.now.strftime(\"%Y-%m-%dT%H:%M:%S\")\n now = now.gsub(':', '--')\n\n @slug = params.fetch(:slug, now)\n \n containers = self.get_containers\n containers.each do |c|\n return c if c.uri.to_s.match(/\\/#{@slug}\\/?$/) # check if it already exists\n end\n \n # headers = {accept: 'text/turtle', content_type: 'text/turtle', \"Slug\" => @slug, \"Link\" => '<http://www.w3.org/ns/ldp#BasicContainer>; rel=\"type\"'}\n \n payload = \"\"\"@prefix ldp: <http://www.w3.org/ns/ldp#> . \n <> a ldp:Container, ldp:BasicContainer .\"\"\"\n etag = Digest::SHA2.hexdigest payload \n headers = {ETag: \"#{etag}\", accept: 'text/turtle', content_type: 'text/turtle', \"Slug\" => @slug, \"Link\" => '<http://www.w3.org/ns/ldp#BasicContainer>; rel=\"type\"'}\n \n \n response = LDP::HTTPUtils::post(self.uri, headers, payload, self.client.username, self.client.password)\n if response\n newuri = response.headers[:location] \n newcont = self._add_container({:uri => newuri,\n :client => self.client,\n :parent => self,\n :top => self.toplevel_container,\n :init => true})\n unless newcont\n abort \"PROBLEM - cannot add new container with id #{newuri}. BAILING just to be safe\"\n end\n return newcont\n else\n abort \"PROBLEM - cannot create container into #{self.uri}. BAILING just to be safe\"\n end\n \n end", "def create_container\n\t\t\t\t@command.container_class.new\n\t\t\tend", "def create_container_with_http_info(container_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContainersApi.create_container ...'\n end\n # verify the required parameter 'container_body' is set\n if @api_client.config.client_side_validation && container_body.nil?\n fail ArgumentError, \"Missing the required parameter 'container_body' when calling ContainersApi.create_container\"\n end\n # resource path\n local_var_path = '/containers'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(container_body) \n\n # return_type\n return_type = opts[:return_type] || 'Container' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContainersApi#create_container\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @container_item = ContainerItem.new(container_item_params)\n respond_to do |format|\n if @container_item.save\n format.html {redirect_back(fallback_location: (request.referer || root_path), notice: 'Container item was successfully created.')}\n format.json { render json: @container_item, status: :created, location: @container_item }\n else\n format.html {redirect_back(fallback_location: (request.referer || root_path), notice: 'Container item was NOT successfully created.')}\n format.json { render json: @container_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def run_container(port:, password:, name:)\n response_of_create = create_container(port: port, password: password, name: name)\n return unless response_of_create.success?\n\n container_id = JSON.parse(response_of_create.body).fetch('Id')\n start_container(container_id: container_id)\n rescue StandardError\n false\n end", "def create body = {}\n @connection.request(method: :post, path: \"/volumes/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end", "def create\n @container_stack = ContainerStack.new(params[:container_stack])\n\n respond_to do |format|\n if @container_stack.save\n format.html { redirect_to @container_stack, notice: 'Container stack was successfully created.' }\n format.json { render json: @container_stack, status: :created, location: @container_stack }\n else\n format.html { render action: \"new\" }\n format.json { render json: @container_stack.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @level_container = LevelContainer.new(params[:level_container])\n\n respond_to do |format|\n if @level_container.save\n format.html { redirect_to @level_container, notice: 'Level container was successfully created.' }\n format.json { render json: @level_container, status: :created, location: @level_container }\n else\n format.html { render action: \"new\" }\n format.json { render json: @level_container.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_container(name, options={})\n query = { }\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n uri = container_uri(name, query)\n\n headers = service_properties_headers\n\n add_metadata_to_headers(options[:metadata], headers) if options[:metadata]\n\n headers['x-ms-blob-public-access'] = options[:public_access_level].to_s if options[:public_access_level]\n\n response = call(:put, uri, nil, headers)\n\n container = Serialization.container_from_headers(response.headers)\n container.name = name\n container.metadata = options[:metadata]\n container\n end", "def containers=(value)\n @containers = value\n end", "def create\n @docker_instance = DockerInstance.new(docker_instance_params)\n @docker_instance.creating!\n respond_to do |format|\n if @docker_instance.save\n format.js\n else\n format.html { render :new }\n format.json { render json: @docker_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_and_run_container args\n \t# update the timeout for the Excon Http Client\n \t# set the chunk size to enable streaming of log files\n ::Docker.options = {:chunk_size => 1, :read_timeout => 3600}\n container = ::Docker::Container.create(\n \t\t'Image' => args[:image],\n \t\t'Cmd' => args[:command],\n \t\t\"Binds\" => args[:volumes],\n \t\t\"Env\" => args[:environment],\n \t\t'WorkingDir' => args[:working_directory],\n 'NetworkMode' => @network,\n 'name' => args[:name],\n 'PublishAllPorts' => true\n )\n\n output = ''\n\n unless args[:deamon] == true\n thread = Thread.new do\n container.attach(:stream => true, :stdin => nil, :stdout => true, :stderr => true, :logs => false, :tty => false) do\n |stream, chunk|\n if chunk.index('[ERROR]') != nil # deal with hidden characters\n @logger.error chunk.gsub(/\\[.*\\]/,'')\n else\n output += chunk.gsub(/\\[.*\\]/,'') if output == ''\n output += chunk.gsub(/\\[.*\\]/,'').prepend(\" \") unless output == ''\n @logger.debug chunk.gsub(/\\[.*\\]/,'')\n end\n end\n end\n end\n\n \n\n container.start\n \n thread.join unless args[:deamon] == true\n\n success = (container.json['State']['ExitCode'] == 0) ? true: false \n \n @logger.error(output) unless success \n\n \treturn container, success\n end", "def start_container(container_id: nil, container_name: nil)\n return if container_id.nil? && container_name.nil?\n\n id = container_id.nil? ? container_name : container_id\n conn.post(\"/containers/#{id}/start\")\n end", "def add_chef_object(container_name, requestor, object_json)\n post(api_url(\"/#{container_name}\"), requestor, :payload => object_json)\n end", "def create_container\n UI.important(\"Creating container: #{container_name}\")\n CpuLoadHandler.print_cpu_load\n begin\n container = create_container_call\n set_container_name(container)\n rescue StandardError\n UI.important(\"Something went wrong while creating: #{container_name}, will retry in #{@sleep_interval} seconds\")\n CpuLoadHandler.print_cpu_load\n @docker_commander.delete_container\n sleep @sleep_interval\n container = create_container_call\n set_container_name(container)\n end\n @container = get_container_instance(container)\n\n if @container.nil?\n sleep 3\n @container = get_container_instance(container)\n end\n end", "def index\n @containers = Container.all\n end", "def add_container(container)\n # Avoid duplicated labels on compose\n while @containers.has_key?(container.attributes[:label]) do\n container.attributes[:label].succ!\n end\n\n @containers[container.attributes[:label]] = container\n true\n end", "def new\n @container_stack = ContainerStack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @container_stack }\n end\n end", "def containerize(\n project_name: '',\n project_id: 0,\n app: {}\n )\n\n puts \"#{__method__.to_s} enter\"\n\n # Where to push the docker image\n #docker_remote_registry_uri = \"\"\n #docker_remote_registry_uri = \"localhost:5000\" if server.compute_engine == 'minikube'\n #docker_remote_registry_uri = \"gcr.io/#{project_name}-#{project_id}\" if server.compute_engine == 'gce'\n\n\n app_name = \"#{project_name}-#{project_id}\"\n image_name = \"#{project_name}-#{project_id}\"\n\n\n docker_context_directory = docker_ready_context_directory(\n app_name: app_name,\n app_source_directory: app.source_url\n )\n\n passenger_prep(container_context_directory: docker_context_directory, app_types: app.type)\n\n dockerfile_contents = docker_ready_dockerfile(app_directory: app_name, app_types: app.type)\n\n make_file(\"#{docker_context_directory}/Dockerfile\", dockerfile_contents)\n\n\n\n docker_create_container_image(image_name: image_name, context_directory: docker_context_directory)\n\n container_info = { image_name: image_name }\n\n puts \"#{__method__.to_s} exit\"\n\n # Convert data structure (hashes and arrays) into a\n # dot notation accessable structure (ex. config.project.name)\n #\n return RecursiveOpenStruct.new(container_info, recurse_over_arrays: true )\n\nend", "def containers\n @containers ||= Docker::Container.all(\n all: true, # include stopped containers\n filters: { id: container_ids }.to_json\n ).map(&:json)\n end", "def update\n @updated_container = params([:container])\n @container = DeployedContainer.find(params[:container][:id])\n\n nova_ip = nil\n quantum_ip = nil\n if request.headers[\"X-Auth-Token\"] != \"\"\n token = request.headers[\"X-Auth-Token\"]\n begin\n services = Donabe::KEYSTONE.get_endpoints(token)\n services[\"endpoints\"].each do |endpoint|\n if endpoint[\"name\"] == \"nova\"\n nova_ip = endpoint[\"internalURL\"]\n elsif endpoint[\"name\"] == \"quantum\"\n quantum_ip = endpoint[\"internalURL\"]\n end\n end\n rescue\n token = Storage.find(cookies[:current_token]).data\n nova_ip = Storage.find(cookies[:nova_ip]).data\n quantum_ip = Storage.find(cookies[:quantum_ip]).data\n end\n end\n\n novaIP = URI.parse(nova_ip)\n nova = Ropenstack::Nova.new(novaIP, token)\n\n quantumIP = URI.parse(quantum_ip)\n quantum = Ropenstack::Quantum.new(quantumIP, token)\n\n # Make a note of how many networks this container already has\n networks_count = @container.deployed_networks.count\n # Define an array to keep track of how many existing networks have been sent back\n existing_networks = Array.new()\n @updated_container[\"deployed_networks\"].each do |network|\n if network[\"deployStatus\"] == false\n # This is a new network. Create it and store its data\n\n else\n # This is an existing network\n existing_networks << network[\"temp_id\"]\n end\n end\n \n if existing_networks.count < networks_count\n # Some existing networks were not sent back. Delete these networks\n end \n\n # Make a note of how many VMs this container already has\n vms_count = @container.deployed_vms.count\n # Define an array to keep track of how many existing VMs have been sent back\n existing_vms = Array.new()\n @updated_container[\"deployed_vms\"].each do |vm|\n if vm[\"deployStatus\"] == false\n # This is a new VM. Create it and store its data\n v = @container.deployed_vms.build()\n ports = Array.new()\n port_list = Array.new()\n vm[\"deployed_connected_networks\"].each do |network|\n port = quantum.create_port(network[\"openstack_id\"],'',\"compute:nova\")\n ports << port[\"port\"][\"id\"]\n data = {'uuid'=>network[\"openstack_id\"]}\n port_list << data\n connected_network = v.deployed_connected_networks.build()\n connected_network.openstack_id = network[\"openstack_id\"]\n connected_network.save \n end\n else\n # This is an existing VM\n existing_vms << vm[\"temp_id\"]\n end\n end\n \n if existing_vms.count < vms_count\n # Some existing vms were not sent back. Delete these vms\n end \n \n # Make a note of how many routers this container already has\n routers_count = @container.deployed_routers.count\n # Define an array to keep track of how many existing routers have been sent back\n existing_routers = Array.new()\n @updated_container[\"deployed_routers\"].each do |router|\n if router[\"deployStatus\"] == false\n # This is a new router. Create it and store its data\n else\n # This is an existing router\n existing_routers << router[\"temp_id\"] \n end\n end\n\n if existing_routers.count < routers_count\n # Some existing routers were not sent back. Delete these routers\n end \n\n @updated_container[\"deployed_conatiners\"].each do |container|\n # Do some magic. Possibly recursive magic.\n end\n\n end", "def prune params = {}\n @connection.post(build_path(\"/containers/prune\", params))\n end", "def set_container\n @container = Container.find(params[:id])\n end", "def set_container\n @container = Container.find(params[:id])\n end", "def create_new_container\n puts 'Start creating a new container..'\n host = get_available_host\n if host.nil?\n puts 'Could not found a host with limit enough to create more containers'\n return\n end\n puts \"getting an available port to #{host}\"\n port = get_available_port(host)\n if port.nil?\n puts 'Could not found an available port'\n return\n end\n\n puts \"using port #{port} from #{host}\"\n\n Docker.url = \"tcp://#{host}:#{@docker_port}/\"\n container = Docker::Container.create(\n 'Image' => \"#{@ws_image}\",\n 'ExposedPorts' => { \n '8070/tcp' => {}\n },\n 'HostConfig' => {\n 'CpuPeriod' => 25000,\n 'PortBindings' => {\n '8070/tcp' => [ { 'HostPort' => \"#{port}\" } ]\n }\n }\n )\n container.start\n register_container(host, port, container.id)\n end", "def commit(options = {})\n options.merge!('container' => self.id[0..7])\n hash = JSON.parse(connection.request(:post, '/commit', options))\n Docker::Image.send(:new, :id => hash['Id'], :connection => self.connection)\n end", "def handle_start(event)\n @bus.request 'containers', 'started', event: event.json, container: container_info(event.id)\n end", "def create_container(name, options={})\n # Query\n query = { }\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n # Scheme + path\n uri = container_uri(name, query)\n\n # Headers\n headers = StorageService.common_headers\n StorageService.add_metadata_to_headers(options[:metadata], headers) if options[:metadata]\n headers['x-ms-blob-public-access'] = options[:public_access_level].to_s if options[:public_access_level]\n\n # Call\n response = call(:put, uri, nil, headers, options)\n\n # result\n container = Serialization.container_from_headers(response.headers)\n container.name = name\n container.metadata = options[:metadata]\n container\n end", "def create\n @container_row = ContainerRow.new(container_row_params)\n respond_to do |format|\n if @container_row.save\n flash[:success] = 'Row was successfully created.'\n format.html { redirect_to admin_container_row_url(@container_row) }\n format.json { render :show, status: :created, location: @container_row }\n else\n set_new\n format.html { render :new }\n format.json { render json: @container_row.errors, status: :unprocessable_entity }\n end\n end\n end", "def commit(options = {})\n options.merge!(container: self.id[0..7])\n hash = Docker::Util.parse_json(connection.post('/commit', options))\n Docker::Image.send(:new, id: hash[:id], connection: self.connection)\n end", "def assign_containers_to_pods!(pods, containers)\n pods.each do |pod|\n pod['containers'] = containers.select do |container|\n container.key?('pod') && container['pod'] == pod['name']\n end\n end\nend", "def create\n @container_content = @container.container_contents.new(params[:container_content])\n\n respond_to do |format|\n if @container_content.save\n format.html { redirect_to(@container_content.container, :notice => 'Container content was successfully created.') }\n format.xml { render :xml => @container_content, :status => :created, :location => @container_content }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @container_content.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_new\n @container = Container.find(params[:container_id])\n @container_row = ContainerRow.new\n end", "def create\n @containers_page = ContainersPage.new(containers_page_params)\n respond_to do |format|\n if @containers_page.save\n @containers_pages = @page.containers_pages\n format.js\n format.html do \n flash[:success] = 'Container was successfully added to page.'\n redirect_to @containers_page\n end\n format.json { render :show, status: :created, location: @containers_page }\n else\n format.js { head :ok }\n format.html { render :new }\n format.json { render json: @containers_page.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_container(name, expire, **data)\n data.each do |k, v|\n @client.hset(name, k, v)\n @client.expire(name, expire)\n @logger.debug(\"Saving container: #{name} with fields #{data.keys} and expire set to #{expire}\")\n end\n @logger.debug('Container data has been saved to database')\n rescue StandardError => e\n @logger.error(\" Unable to save the to database: #{e} \")\n end", "def attach(options = {})\n options = { :stream => true, :stdout => true }.merge(options)\n connection.post(\"/containers/#{id}/attach\", options)\n end", "def create_container_data\n # For container env_vars and image info.\n task_definition_arn = first_task.task_definition_arn # task is a method in the superclass: Ssh\n response = ecs.describe_task_definition(task_definition: task_definition_arn)\n task_definition = response.to_h[:task_definition]\n container_definition = task_definition[:container_definitions].first # assumes care about the first container definition\n env_file_data = env_file_data(container_definition[:environment])\n\n sonic_folder = \"/tmp/sonic\"\n FileUtils.mkdir_p(sonic_folder) unless File.exist?(sonic_folder)\n IO.write(\"/tmp/sonic/task-arn.txt\", task_arns.first)\n IO.write(\"/tmp/sonic/docker-image.txt\", container_definition[:image])\n IO.write(\"/tmp/sonic/env-file.txt\", env_file_data)\n FileUtils.cp_r(bash_scripts, \"/tmp/sonic\")\n end", "def create_pod(pod_spec, kubectl_options)\n sh = Shell.new\n new_pod_json = (sh.echo(pod_spec.to_json) | sh.system(\"kubectl #{kubectl_options} create -o json -f -\")).to_s\n\n new_pod = JSON.parse(new_pod_json)\n pod_name = new_pod[\"metadata\"][\"name\"]\n\n puts \"Created pod: #{pod_name}\"\n pod_name\nend", "def destroy\n @container = Container.find(params[:id])\n @container.destroy\n\n respond_to do |format|\n format.html { redirect_to containers_url, notice: 'Container was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def patch_containers(containers)\n (containers || Array.new).each do |container|\n if container[\"image\"] =~ /.*velum.*/\n container[\"image\"] = \"sles12/velum:development\"\n container[\"volumeMounts\"] ||= Array.new\n container[\"volumeMounts\"] << {\n \"mountPath\" => \"/srv/velum\",\n \"name\" => \"velum-devel\"\n }\n container[\"env\"] ||= Array.new\n container[\"env\"].each do |env|\n env[\"value\"] = \"development\" if env[\"name\"] == \"RAILS_ENV\"\n end\n\n # Ensure the velum_production db is used, this is what the\n # salt mysql returner is configured to use\n container[\"env\"] << {\n \"name\" => \"VELUM_DB_NAME\",\n \"value\" => \"velum_production\"\n }\n end\n end\nend", "def create(container_name, file_name, body = nil, args = {})\n validate_path_elements(container_name, file_name)\n\n client.request(\n method: :put,\n path: \"#{container_name}/#{file_name}\",\n expected: 201,\n params: {:body => body},\n headers: create_headers_from(args)\n )\n end", "def create\n collection = Collection.create(collection_params)\n\n render json: collection\n end", "def index\n user_session[:current_container]=nil\n if params[:label].blank?\n @containers = Container.list(params[:filter])\n else\n @container = Container.find_by_label(params[:label])\n render action: 'show' and return\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @containers }\n end\n end", "def create\n @container_clone.name = params[:container_clone][:name]\n respond_to do |format|\n if @container_clone.save\n @container.container_rows.each do |row|\n clone_row = ContainerRow.create!(container_id: @container_clone.id,css_classes: row.css_classes, position: row.position)\n row.row_columns.each do |col|\n clone_col = col.dup\n clone_col.container_row_id = clone_row.id\n clone_col.save\n end\n end\n flash[:success] = 'Container was successfully cloned.'\n format.html { redirect_to admin_container_url(@container_clone) }\n format.json { render :show, status: :created, location: @container_clone }\n else\n format.html { render :new }\n format.json { render json: @container_clone.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_container_call\n # When CPU is under load we cannot create a healthy container\n CpuLoadHandler.wait_cpu_to_idle\n\n additional_env = ''\n environment_variables.each do |variable|\n additional_env += \" -e #{variable}\"\n end\n emulator_args = is_running_on_emulator ? \"-p #{no_vnc_port}:6080 -e DEVICE='#{device_name}'\" : ''\n emulator_args = \"#{emulator_args}#{additional_env}\"\n @docker_commander.start_container(emulator_args: emulator_args, docker_image: docker_image,\n core_amount: core_amount)\n end", "def containers\n TestLab::Container.all\n end", "def destroy\n @docker_instance.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def prepare_container\n exposed_ports = {}\n port_bindings = {}\n links = []\n\n # Build expose and port binding parameters\n if !@attributes[:ports].nil?\n @attributes[:ports].each do |port|\n exposed_ports[\"#{port.container_port}/tcp\"] = {}\n port_bindings[\"#{port.container_port}/tcp\"] = [{\n \"HostIp\" => port.host_ip || '',\n \"HostPort\" => port.host_port || ''\n }]\n end\n end\n\n # Build link parameters\n @dependencies.each do |dependency|\n links << \"#{dependency.stats['Id']}:#{dependency.attributes[:label]}\"\n end\n\n container_config = {\n Image: @attributes[:image],\n Cmd: @attributes[:command],\n Env: @attributes[:environment],\n Volumes: @attributes[:volumes],\n ExposedPorts: exposed_ports,\n HostConfig: {\n Links: links,\n PortBindings: port_bindings\n }\n }\n\n @container = Docker::Container.create(container_config)\n end", "def create\n @receipt_container = ReceiptContainer.new(params[:receipt_container])\n @receipt_container.company_id = current_user.company_id\n respond_to do |format|\n if @receipt_container.save\n format.html { redirect_to @receipt_container, notice: 'Receipt container was successfully created.' }\n format.json { render json: @receipt_container, status: :created, location: @receipt_container }\n else\n format.html { render action: \"new\" }\n format.json { render json: @receipt_container.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @collection = Collection.new(collection_params)\n build_kiosks(params)\n respond_to do |format|\n if @collection.save\n format.html { redirect_to @collection, notice: 'Collection was successfully created.' }\n format.json { render :show, status: :created, location: @collection }\n else\n format.html { render :new }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end", "def container(container_id)\n if container_id\n container = ::Docker::Container.send(:new, @dockerd, container_id)\n # return the container json if we can retrieve it.\n begin\n # check the container exists by querying its json\n container.json\n container\n # if the container doesn't exist we get an Excon 404\n rescue Excon::Errors::NotFound\n nil\n end\n else\n nil\n end\n end", "def create(container)\n # If the caller has already set an id, trust it.\n container.assign_id!(new_uuid) unless container.id\n container.assign_org_id!(@org_id)\n container.update_timestamps!\n container.last_updated_by!(requester_authz_id)\n\n validate_before_create!(container)\n\n unless container.authz_id\n container.create_authz_object_as(requester_authz_id)\n end\n\n user_side_create(container)\n\n container.persisted!\n container\n end", "def wrap_container( payload )\n\n raise Dossia::BadArgumentError, 'This method expects a Nokogiri NodeSet or Element' unless payload.class == Nokogiri::XML::NodeSet or payload.class == Nokogiri::XML::Element\n\n builder = Nokogiri::XML::Builder.new do |xml|\n \n xml.container(\n \"xmlns\" => \"http://www.dossia.org/v2.0/api\",\n \"xmlns:xsi\" => \"http://www.w3.org/2001/XMLSchema-instance\", \n \"xsi:schemaLocation\" => \"http://www.dossia.org/v2.0/api http://www.dossia.org/v2.0/api/container.xsd\"\n )\n\n end\n\n builder = Nokogiri::XML builder.to_xml\n\n if payload.class == Nokogiri::XML::NodeSet\n payload.each {|node| builder.xpath('//api:container', 'api' => 'http://www.dossia.org/v2.0/api').first.add_child node }\n else\n builder.xpath('//api:container', 'api' => 'http://www.dossia.org/v2.0/api').first.add_child payload\n end\n\n builder\n\n end", "def get_containers\n assert_not_nil @rdigg.info.get_containers\n end", "def containers(key = nil, options = {})\n key ||= properties.key1\n\n query = \"comp=list\"\n options.each { |okey, ovalue| query += \"&#{okey}=#{[ovalue].flatten.join(',')}\" }\n\n response = blob_response(key, query)\n\n doc = Nokogiri::XML(response.body)\n\n results = doc.xpath('//Containers/Container').collect do |element|\n Container.new(Hash.from_xml(element.to_s)['Container'])\n end\n\n results.concat(next_marker_results(doc, :containers, key, options))\n end", "def create\n @docker_cfg = DockerCfg.new(docker_cfg_params)\n\n respond_to do |format|\n if @docker_cfg.save\n format.html { redirect_to @docker_cfg, notice: 'Docker cfg was successfully created.' }\n format.json { render :show, status: :created, location: @docker_cfg }\n else\n format.html { render :new }\n format.json { render json: @docker_cfg.errors, status: :unprocessable_entity }\n end\n end\n end", "def index_containers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContainersApi.index_containers ...'\n end\n # resource path\n local_var_path = '/containers'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sort_by'] = @api_client.build_collection_param(opts[:'sort_by'], :pipe) if !opts[:'sort_by'].nil?\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?\n query_params[:'comment'] = opts[:'comment'] if !opts[:'comment'].nil?\n query_params[:'quota_total_size'] = opts[:'quota_total_size'] if !opts[:'quota_total_size'].nil?\n query_params[:'quota_on_cache'] = opts[:'quota_on_cache'] if !opts[:'quota_on_cache'].nil?\n query_params[:'stat_total_files'] = opts[:'stat_total_files'] if !opts[:'stat_total_files'].nil?\n query_params[:'stat_total_size'] = opts[:'stat_total_size'] if !opts[:'stat_total_size'].nil?\n query_params[:'stat_size_on_cache'] = opts[:'stat_size_on_cache'] if !opts[:'stat_size_on_cache'].nil?\n query_params[:'guest_right'] = opts[:'guest_right'] if !opts[:'guest_right'].nil?\n query_params[:'last_update'] = opts[:'last_update'] if !opts[:'last_update'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'ContainerCollection' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContainersApi#index_containers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def ephemeral_containers=(value)\n @ephemeral_containers = value\n end", "def create_container(container_body, opts = {})\n data, _status_code, _headers = create_container_with_http_info(container_body, opts)\n data\n end", "def create\n @container_navigation = ContainerNavigation.new(params[:container_navigation])\n\n respond_to do |format|\n if @container_navigation.save\n format.html { redirect_to @container_navigation, notice: 'Container navigation was successfully created.' }\n format.json { render json: @container_navigation, status: :created, location: @container_navigation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @container_navigation.errors, status: :unprocessable_entity }\n end\n end\n end", "def list # rubocop:disable Metrics/AbcSize\n if @options[:container]\n containerview = ObjectStorage.new(@options[:id_domain], @options[:user_name], @options[:passwd])\n containerview = containerview.contents(@options[:container])\n if containerview.code == '201' || containerview.code == '200'\n containerview.body\n elsif containerview.code == '204'\n print 'the container is empty'\n else\n @util.response_handler(containerview)\n end\n else\n newcontainer = ObjectStorage.new(@options[:id_domain], @options[:user_name], @options[:passwd])\n newcontainer = newcontainer.list\n @util.response_handler(newcontainer)\n newcontainer.body if newcontainer.code == '200'\n puts 'there are no containers' if newcontainer.code == '204'\n end \n end", "def build_containers_tree\n TreeBuilderContainers.new(\"containers_tree\", \"containers\", @sb)\n end", "def destroy\n @container = Container.find(params[:id])\n @container.destroy\n\n respond_to do |format|\n format.html { redirect_to(containers_url) }\n format.xml { head :ok }\n end\n end", "def serverhascontainer_params\n params.require(:serverhascontainer).permit(:container_id, :server_id)\n end", "def containers_ids\n containers(:response_format => :id_array)\n end", "def container=(value)\n @container = value\n end", "def create_category payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post CATEGORIES, payload )\n\t\t\t\tend", "def validate_container_resources\n (pod_containers.map { |c| c[1..] || [] } + init_containers).flatten(1).each do |container|\n [\n [:resources, :requests, :cpu],\n [:resources, :requests, :memory],\n [:resources, :limits, :cpu],\n [:resources, :limits, :memory],\n ].each do |path|\n next if container.dig(*path)\n name = container[:name] || container[:image] || \"unknown\"\n @errors << \"Container #{name} is missing #{path.join(\".\")}\"\n end\n end\n end", "def post_inventories(name,description, organization=1,variables='')\n dprint \"/api/v1/hosts\"\n resp = @rest['/api/v1/hosts'].post({\n :name => name,\n :description => description,\n :organization => organization,\n :variables => variables\n })\n dprint resp\n\n #[XXX] Theoretical what this is at this point - need to see \n # actual response\n JSON.parse(resp)[\"results\"]\n end", "def exec_container(container)\n if shell?\n cmd = ['sh', '-c', cmd_list.join(' ')]\n else\n cmd = cmd_list\n end\n\n stdout = stderr = exit_status = nil\n\n if !silent? && (verbose? || all?)\n spinner \"Executing command on #{container['name']}\" do\n stdout, stderr, exit_status = client.post(\"containers/#{container['id']}/exec\", {cmd: cmd})\n\n raise Kontena::Cli::SpinAbort if exit_status != 0\n end\n else\n stdout, stderr, exit_status = client.post(\"containers/#{container['id']}/exec\", {cmd: cmd})\n end\n\n stdout.each do |chunk| $stdout.write chunk end\n stderr.each do |chunk| $stderr.write chunk end\n\n exit exit_status if exit_status != 0 && !skip?\n\n return exit_status == 0\n end", "def index_containers(opts = {})\n data, _status_code, _headers = index_containers_with_http_info(opts)\n data\n end", "def post_storage(request)\n # --- Check OCCI XML from POST ---\n if request.params['occixml'] == nil\n error_msg = \"OCCI XML representation of Image\" +\n \" not present in the request\"\n error = OpenNebula::Error.new(error_msg)\n return error, 400\n end\n\n # --- Create and Add the new Image ---\n occixml = request.params['occixml']\n occixml = occixml[:tempfile].read if occixml.class == Hash\n\n image = ImageOCCI.new(\n Image.build_xml,\n @client,\n occixml,\n request.params['file'])\n\n # --- Generate the template and Allocate the new Instance ---\n template = image.to_one_template\n return template, 500 if OpenNebula.is_error?(template)\n\n rc = image.allocate(template, @config[:datastore_id]||1)\n if OpenNebula.is_error?(rc)\n return rc, CloudServer::HTTP_ERROR_CODE[rc.errno]\n end\n\n image.info\n #wait until image is ready to return\n while (image.state_str == 'LOCKED') && (image['RUNNING_VMS'] == '0') do\n sleep IMAGE_POLL_SLEEP_TIME\n image.info\n end\n\n # --- Prepare XML Response ---\n return to_occi_xml(image, :code=>201)\n end", "def read_containers\n []\n end", "def create\n params = run_params.clone\n pass_plaintxt = params[:password]\n params[:password] = BCrypt::Password.create(params[:password])\n heroku_netrc = nil\n if params[\"heroku_netrc\"]\n heroku_netrc = params[\"heroku_netrc\"].read\n end\n params[\"heroku_netrc\"] = \"dummystring\"\n # By default run is running :)\n params[\"status_id\"] = 1\n @run = Run.new(params)\n respond_to do |format|\n if @run.save\n @docker_kickstart = DockerKickstartsController.new(@run, params[\"rundockerservers_attributes\"], pass_plaintxt, heroku_netrc)\n number_of_containers = @docker_kickstart.docker_kickstart\n set_run_status(@run[:id], number_of_containers)\n\n format.html { redirect_to @run, notice: 'Run was successfully created.' }\n format.json { render :show, status: :created, location: @run }\n else\n format.html { render :new }\n format.json { render json: @run.errors, status: :unprocessable_entity }\n end\n end\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 start_container(image, expose_port)\n container = Docker::Container.create('Image' => image, 'HostConfig' => {'PortBindings' => {\"#{expose_port}/tcp\" => [{}]}})\n container.start\n Container.new(container, expose_port)\nend", "def create\n @declaration_container = DeclarationContainer.new(params[:declaration_container])\n\n respond_to do |format|\n if @declaration_container.save\n format.html { redirect_to new_declaration_container_url(:declaration_id => @declaration_container.declaration_id), notice: 'Declaration container was successfully created.' }\n format.json { render json: @declaration_container, status: :created, location: @declaration_container }\n else\n format.html { render action: \"new\" }\n format.json { render json: @declaration_container.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dock = Dock.new(dock_params)\n\n respond_to do |format|\n if @dock.save\n format.html do\n redirect_to @dock, notice:\n 'Dock was successfully created.'\n end\n format.json { render :show, status: :created, location: @dock }\n else\n format.html { render :new }\n format.json { render json: @dock.errors, status: :unprocessable_entity }\n end\n end\n end", "def container_clone_params\n params.require(:container_clone).permit(:name)\n end", "def test_handle_empty_container_name\n setup_gce_metadata_stubs\n setup_k8s_metadata_stubs\n container_name = ''\n # This tag will not match the kubernetes regex because it requires a\n # non-empty container name.\n tag = container_tag_with_container_name(container_name)\n setup_logging_stubs do\n d = create_driver(REQUIRE_VALID_TAGS_CONFIG, tag)\n d.emit(container_log_entry_with_metadata(log_entry(0), container_name))\n d.run\n end\n params = CONTAINER_FROM_METADATA_PARAMS.merge(\n resource: CONTAINER_FROM_METADATA_PARAMS[:resource].merge(\n labels: CONTAINER_FROM_METADATA_PARAMS[:resource][:labels].merge(\n 'container_name' => container_name\n )\n ),\n log_name: tag\n )\n verify_log_entries(1, params, 'textPayload')\n end", "def containers_page_params\n params.require(:containers_page).permit(:container_id,:page_id)\n end", "def update\n respond_to do |format|\n if @container.update(container_params)\n format.html { redirect_to @container, notice: 'Container was successfully updated.' }\n format.json { render :show, status: :ok, location: @container }\n else\n format.html { render :edit }\n format.json { render json: @container.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_params\n sample_storage_container_params\n end", "def container\n namespace + '_container'\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 create\n @collection = Admin::Collection.new(collection_params)\n\n if @collection.save\n render json: @collection, status: :created#, location: @collection\n else\n render json: @collection.errors, status: :unprocessable_entity\n end\n end", "def handle_destroy(event)\n @bus.request 'containers', 'destroyed', event: event.json, container: container_info(event.id)\n end", "def destroy\n @serverhascontainer.destroy\n respond_to do |format|\n format.html { redirect_to serverhascontainers_url, notice: 'Serverhascontainer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.8195612", "0.8015509", "0.7977083", "0.69968426", "0.69769883", "0.6730368", "0.6479558", "0.6473718", "0.6403856", "0.6397522", "0.62297755", "0.60446113", "0.5989358", "0.59754825", "0.59112823", "0.5880414", "0.5852181", "0.58451915", "0.58311284", "0.5713688", "0.5690989", "0.56610703", "0.56561965", "0.565", "0.5636471", "0.5625958", "0.5616527", "0.55979675", "0.5560391", "0.5559956", "0.5557942", "0.55576086", "0.5553719", "0.5549539", "0.5549539", "0.5548328", "0.55138505", "0.549586", "0.548259", "0.54526955", "0.5441455", "0.543433", "0.541736", "0.54127604", "0.54008394", "0.5392152", "0.5374929", "0.53648674", "0.5361768", "0.5358861", "0.5341687", "0.53382766", "0.53369147", "0.5322951", "0.53108865", "0.5305543", "0.529083", "0.528389", "0.5250927", "0.52276564", "0.52214974", "0.5214376", "0.51978683", "0.5164405", "0.51636803", "0.51578015", "0.51466054", "0.51334643", "0.5129738", "0.5127929", "0.512469", "0.5113706", "0.51056004", "0.5102493", "0.51012254", "0.50933796", "0.50764716", "0.5072227", "0.5071919", "0.507124", "0.5069331", "0.50665563", "0.5066129", "0.50567514", "0.50449234", "0.50411576", "0.50167084", "0.501587", "0.50073546", "0.50008595", "0.49878392", "0.49870875", "0.49805102", "0.4956573", "0.4954594", "0.49544305", "0.49531105", "0.49526215", "0.49457586", "0.49433792" ]
0.652329
6
PATCH/PUT /containers/1 PATCH/PUT /containers/1.json
def update respond_to do |format| if @container.update(container_params) format.html { redirect_to @container, notice: 'Container was successfully updated.' } format.json { render :show, status: :ok, location: @container } else format.html { render :edit } format.json { render json: @container.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @container = Container.find(params[:id])\n\n respond_to do |format|\n if @container.update_attributes(params[:container])\n format.html { redirect_to @container, notice: 'Container was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @container.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @containers = args[:containers] if args.key?(:containers)\n end", "def update\n @container = Container.get!(params[:id])\n\n respond_to do |format|\n if @container.update(params[:container])\n flash[:notice] = 'Container was successfully updated.'\n format.html { redirect_to(edit_container_url(@container.id)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @container.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @container = Container.find(params[:id])\n\n respond_to do |format|\n if @container.update_attributes(params[:container])\n flash[:notice] = 'Container was successfully updated.'\n format.html { redirect_to(@container) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @container.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @container_type = args[:container_type] if args.key?(:container_type)\n @id = args[:id] if args.key?(:id)\n end", "def update\n @updated_container = params([:container])\n @container = DeployedContainer.find(params[:container][:id])\n\n nova_ip = nil\n quantum_ip = nil\n if request.headers[\"X-Auth-Token\"] != \"\"\n token = request.headers[\"X-Auth-Token\"]\n begin\n services = Donabe::KEYSTONE.get_endpoints(token)\n services[\"endpoints\"].each do |endpoint|\n if endpoint[\"name\"] == \"nova\"\n nova_ip = endpoint[\"internalURL\"]\n elsif endpoint[\"name\"] == \"quantum\"\n quantum_ip = endpoint[\"internalURL\"]\n end\n end\n rescue\n token = Storage.find(cookies[:current_token]).data\n nova_ip = Storage.find(cookies[:nova_ip]).data\n quantum_ip = Storage.find(cookies[:quantum_ip]).data\n end\n end\n\n novaIP = URI.parse(nova_ip)\n nova = Ropenstack::Nova.new(novaIP, token)\n\n quantumIP = URI.parse(quantum_ip)\n quantum = Ropenstack::Quantum.new(quantumIP, token)\n\n # Make a note of how many networks this container already has\n networks_count = @container.deployed_networks.count\n # Define an array to keep track of how many existing networks have been sent back\n existing_networks = Array.new()\n @updated_container[\"deployed_networks\"].each do |network|\n if network[\"deployStatus\"] == false\n # This is a new network. Create it and store its data\n\n else\n # This is an existing network\n existing_networks << network[\"temp_id\"]\n end\n end\n \n if existing_networks.count < networks_count\n # Some existing networks were not sent back. Delete these networks\n end \n\n # Make a note of how many VMs this container already has\n vms_count = @container.deployed_vms.count\n # Define an array to keep track of how many existing VMs have been sent back\n existing_vms = Array.new()\n @updated_container[\"deployed_vms\"].each do |vm|\n if vm[\"deployStatus\"] == false\n # This is a new VM. Create it and store its data\n v = @container.deployed_vms.build()\n ports = Array.new()\n port_list = Array.new()\n vm[\"deployed_connected_networks\"].each do |network|\n port = quantum.create_port(network[\"openstack_id\"],'',\"compute:nova\")\n ports << port[\"port\"][\"id\"]\n data = {'uuid'=>network[\"openstack_id\"]}\n port_list << data\n connected_network = v.deployed_connected_networks.build()\n connected_network.openstack_id = network[\"openstack_id\"]\n connected_network.save \n end\n else\n # This is an existing VM\n existing_vms << vm[\"temp_id\"]\n end\n end\n \n if existing_vms.count < vms_count\n # Some existing vms were not sent back. Delete these vms\n end \n \n # Make a note of how many routers this container already has\n routers_count = @container.deployed_routers.count\n # Define an array to keep track of how many existing routers have been sent back\n existing_routers = Array.new()\n @updated_container[\"deployed_routers\"].each do |router|\n if router[\"deployStatus\"] == false\n # This is a new router. Create it and store its data\n else\n # This is an existing router\n existing_routers << router[\"temp_id\"] \n end\n end\n\n if existing_routers.count < routers_count\n # Some existing routers were not sent back. Delete these routers\n end \n\n @updated_container[\"deployed_conatiners\"].each do |container|\n # Do some magic. Possibly recursive magic.\n end\n\n end", "def update!(**args)\n @container = args[:container] if args.key?(:container)\n @container_type = args[:container_type] if args.key?(:container_type)\n @deleted = args[:deleted] if args.key?(:deleted)\n @id = args[:id] if args.key?(:id)\n @last_updated = args[:last_updated] if args.key?(:last_updated)\n @last_updated_micros = args[:last_updated_micros] if args.key?(:last_updated_micros)\n @source_etag = args[:source_etag] if args.key?(:source_etag)\n end", "def update!(**args)\n @container_id = args[:container_id] if args.key?(:container_id)\n @container_type = args[:container_type] if args.key?(:container_type)\n @extended_data = args[:extended_data] if args.key?(:extended_data)\n @materialized = args[:materialized] if args.key?(:materialized)\n end", "def update_container_with_http_info(container_id, container_body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ContainersApi.update_container ...'\n end\n # verify the required parameter 'container_id' is set\n if @api_client.config.client_side_validation && container_id.nil?\n fail ArgumentError, \"Missing the required parameter 'container_id' when calling ContainersApi.update_container\"\n end\n # verify the required parameter 'container_body' is set\n if @api_client.config.client_side_validation && container_body.nil?\n fail ArgumentError, \"Missing the required parameter 'container_body' when calling ContainersApi.update_container\"\n end\n # resource path\n local_var_path = '/containers/{container_id}'.sub('{' + 'container_id' + '}', CGI.escape(container_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(container_body) \n\n # return_type\n return_type = opts[:return_type] || 'Container' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ContainersApi#update_container\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update!(**args)\n @container_id = args[:container_id] if args.key?(:container_id)\n @permission = args[:permission] if args.key?(:permission)\n end", "def update\n @container_stack = ContainerStack.find(params[:id])\n\n respond_to do |format|\n if @container_stack.update_attributes(params[:container_stack])\n format.html { redirect_to @container_stack, notice: 'Container stack was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @container_stack.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n respond_to do |format|\n if @serverhascontainer.update(serverhascontainer_params)\n format.html { redirect_to @serverhascontainer, notice: 'Serverhascontainer was successfully updated.' }\n format.json { render :show, status: :ok, location: @serverhascontainer }\n else\n format.html { render :edit }\n format.json { render json: @serverhascontainer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @acl_choices = args[:acl_choices] if args.key?(:acl_choices)\n @additional_container_info = args[:additional_container_info] if args.key?(:additional_container_info)\n @affinity = args[:affinity] if args.key?(:affinity)\n @contact_visibility = args[:contact_visibility] if args.key?(:contact_visibility)\n @container = args[:container] if args.key?(:container)\n @container_id = args[:container_id] if args.key?(:container_id)\n @container_primary = args[:container_primary] if args.key?(:container_primary)\n @container_type = args[:container_type] if args.key?(:container_type)\n @cross_device_allowed = args[:cross_device_allowed] if args.key?(:cross_device_allowed)\n @default_acl_choice = args[:default_acl_choice] if args.key?(:default_acl_choice)\n @deprecated_contact_container_id = args[:deprecated_contact_container_id] if args.key?(:deprecated_contact_container_id)\n @edge_key = args[:edge_key] if args.key?(:edge_key)\n @edge_key_info = args[:edge_key_info] if args.key?(:edge_key_info)\n @encoded_container_id = args[:encoded_container_id] if args.key?(:encoded_container_id)\n @field_acl = args[:field_acl] if args.key?(:field_acl)\n @last_update_time = args[:last_update_time] if args.key?(:last_update_time)\n @matching_info = args[:matching_info] if args.key?(:matching_info)\n @other_deduped_containers = args[:other_deduped_containers] if args.key?(:other_deduped_containers)\n @primary = args[:primary] if args.key?(:primary)\n @product_metadata = args[:product_metadata] if args.key?(:product_metadata)\n @verified = args[:verified] if args.key?(:verified)\n @visibility = args[:visibility] if args.key?(:visibility)\n @writeable = args[:writeable] if args.key?(:writeable)\n end", "def patch!\n request! :patch\n end", "def update!(**args)\n @container_version = args[:container_version] if args.key?(:container_version)\n @container_version_header = args[:container_version_header] if args.key?(:container_version_header)\n end", "def update\n respond_to do |format|\n if @container_item.update(container_item_params)\n format.html {redirect_back(fallback_location: (request.referer || root_path), notice: 'Container item was successfully created.')}\n format.json { render json: @container_item, status: :ok, location: @container_item }\n else\n format.html {redirect_back(fallback_location: (request.referer || root_path), notice: 'Container item was NOT successfully updated.')}\n format.json { render json: @container_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\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(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end", "def update\n @receipt_container = ReceiptContainer.find(params[:id])\n\n respond_to do |format|\n if @receipt_container.update_attributes(params[:receipt_container])\n format.html { redirect_to @receipt_container, notice: 'Receipt container was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @receipt_container.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @container_content = ContainerContent.find(params[:id])\n\n respond_to do |format|\n if @container_content.update_attributes(params[:container_content])\n format.html { redirect_to(@container_content.container, :notice => 'Container content was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @container_content.errors, :status => :unprocessable_entity }\n end\n end\n end", "def patch_containers(containers)\n (containers || Array.new).each do |container|\n if container[\"image\"] =~ /.*velum.*/\n container[\"image\"] = \"sles12/velum:development\"\n container[\"volumeMounts\"] ||= Array.new\n container[\"volumeMounts\"] << {\n \"mountPath\" => \"/srv/velum\",\n \"name\" => \"velum-devel\"\n }\n container[\"env\"] ||= Array.new\n container[\"env\"].each do |env|\n env[\"value\"] = \"development\" if env[\"name\"] == \"RAILS_ENV\"\n end\n\n # Ensure the velum_production db is used, this is what the\n # salt mysql returner is configured to use\n container[\"env\"] << {\n \"name\" => \"VELUM_DB_NAME\",\n \"value\" => \"velum_production\"\n }\n end\n end\nend", "def update!(**args)\n @container_port = args[:container_port] if args.key?(:container_port)\n end", "def update!(**args)\n @container_type = args[:container_type] if args.key?(:container_type)\n @intersect_type = args[:intersect_type] if args.key?(:intersect_type)\n @remodelings = args[:remodelings] if args.key?(:remodelings)\n @same_type = args[:same_type] if args.key?(:same_type)\n @union_type = args[:union_type] if args.key?(:union_type)\n end", "def put!\n request! :put\n end", "def update\n upload_slides(params)\n build_kiosks(params)\n respond_to do |format|\n if @collection.update(collection_params)\n format.html { redirect_to @collection, notice: 'Collection was successfully updated.' }\n format.json { render :show, status: :ok, location: @collection }\n else\n format.html { render :edit }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @container_detail = args[:container_detail] if args.key?(:container_detail)\n @custom_job_detail = args[:custom_job_detail] if args.key?(:custom_job_detail)\n end", "def update\n @template_container = TemplateContainer.find(params[:id])\n\n respond_to do |format|\n if @template_container.update_attributes(params[:template_container])\n flash[:notice] = 'TemplateContainer was successfully updated.'\n format.html { redirect_to(@template_container) }\n format.xml { head :ok }\n format.js { render :layout => false }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @template_container.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @level_container = LevelContainer.find(params[:id])\n\n respond_to do |format|\n if @level_container.update_attributes(params[:level_container])\n format.html { redirect_to @level_container, notice: 'Level container was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @level_container.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n respond_to do |format|\n if @docker_instance.update(docker_instance_params)\n format.html { redirect_to @docker_instance, notice: 'Docker instance was successfully updated.' }\n format.json { render :show, status: :ok, location: @docker_instance }\n else\n format.html { render :edit }\n format.json { render json: @docker_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @batch = args[:batch] if args.key?(:batch)\n @container_image = args[:container_image] if args.key?(:container_image)\n @vpc_network = args[:vpc_network] if args.key?(:vpc_network)\n end", "def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend", "def update!(**args)\n @account_id = args[:account_id] if args.key?(:account_id)\n @container = args[:container] if args.key?(:container)\n @container_id = args[:container_id] if args.key?(:container_id)\n @container_version_id = args[:container_version_id] if args.key?(:container_version_id)\n @deleted = args[:deleted] if args.key?(:deleted)\n @fingerprint = args[:fingerprint] if args.key?(:fingerprint)\n @folder = args[:folder] if args.key?(:folder)\n @macro = args[:macro] if args.key?(:macro)\n @name = args[:name] if args.key?(:name)\n @notes = args[:notes] if args.key?(:notes)\n @rule = args[:rule] if args.key?(:rule)\n @tag = args[:tag] if args.key?(:tag)\n @trigger = args[:trigger] if args.key?(:trigger)\n @variable = args[:variable] if args.key?(:variable)\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 options={}\n client.put(\"/#{id}\", options)\n end", "def assign_containers_to_pods!(pods, containers)\n pods.each do |pod|\n pod['containers'] = containers.select do |container|\n container.key?('pod') && container['pod'] == pod['name']\n end\n end\nend", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "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 request_body_Data= '{ \"widget\":\n {\n \"name\" : \"'+params[:name]+'\",\n \"description\" : \"'+params[:description]+'\"\n }}'\n response = RestClient::Request.new({\n method: :put,\n url: ENV['API_URL'] + '/widgets/' + params[:id],\n payload: request_body_Data,\n headers: { Authorization: session[:access_token], content_type: 'application/json'}\n }).execute do |response, request, result|\n case response.code\n when 400\n [ :error, JSON.parse(response) ]\n when 200\n [ :success, JSON.parse(response) ]\n json=JSON.parse(response)\n @widget= Widget.new do |widget|\n widget.id=json[\"data\"][\"widget\"][\"id\"]\n widget.name=json[\"data\"][\"widget\"][\"name\"]\n widget.description=json[\"data\"][\"widget\"][\"description\"]\n widget.kind=json[\"data\"][\"widget\"][\"kind\"]\n widget.userid=json[\"data\"][\"widget\"][\"user\"][\"id\"]\n widget.username=json[\"data\"][\"widget\"][\"user\"][\"name\"]\n widget.owner=json[\"data\"][\"widget\"][\"owner\"]\n end\n else\n fail \"Invalid response #{response.to_str} received.\"\n end\n end\n respond_to do |format|\n if @widget\n format.html { redirect_to @widget, notice: 'Widget was successfully updated.' }\n format.json { render :show, status: :ok, location: @widget }\n else\n format.html { render :edit }\n format.json { render json: @widget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @container_runtime = args[:container_runtime] if args.key?(:container_runtime)\n @max_pods_per_node = args[:max_pods_per_node] if args.key?(:max_pods_per_node)\n end", "def update\n respond_to do |format|\n if @docker_cfg.update(docker_cfg_params)\n format.html { redirect_to @docker_cfg, notice: 'Docker cfg was successfully updated.' }\n format.json { render :show, status: :ok, location: @docker_cfg }\n else\n format.html { render :edit }\n format.json { render json: @docker_cfg.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @all_namespaces = args[:all_namespaces] if args.key?(:all_namespaces)\n @cluster_metadata = args[:cluster_metadata] if args.key?(:cluster_metadata)\n @complete_time = args[:complete_time] if args.key?(:complete_time)\n @config_backup_size_bytes = args[:config_backup_size_bytes] if args.key?(:config_backup_size_bytes)\n @contains_secrets = args[:contains_secrets] if args.key?(:contains_secrets)\n @contains_volume_data = args[:contains_volume_data] if args.key?(:contains_volume_data)\n @create_time = args[:create_time] if args.key?(:create_time)\n @delete_lock_days = args[:delete_lock_days] if args.key?(:delete_lock_days)\n @delete_lock_expire_time = args[:delete_lock_expire_time] if args.key?(:delete_lock_expire_time)\n @description = args[:description] if args.key?(:description)\n @encryption_key = args[:encryption_key] if args.key?(:encryption_key)\n @etag = args[:etag] if args.key?(:etag)\n @labels = args[:labels] if args.key?(:labels)\n @manual = args[:manual] if args.key?(:manual)\n @name = args[:name] if args.key?(:name)\n @pod_count = args[:pod_count] if args.key?(:pod_count)\n @resource_count = args[:resource_count] if args.key?(:resource_count)\n @retain_days = args[:retain_days] if args.key?(:retain_days)\n @retain_expire_time = args[:retain_expire_time] if args.key?(:retain_expire_time)\n @selected_applications = args[:selected_applications] if args.key?(:selected_applications)\n @selected_namespaces = args[:selected_namespaces] if args.key?(:selected_namespaces)\n @size_bytes = args[:size_bytes] if args.key?(:size_bytes)\n @state = args[:state] if args.key?(:state)\n @state_reason = args[:state_reason] if args.key?(:state_reason)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n @volume_count = args[:volume_count] if args.key?(:volume_count)\n end", "def update!(**args)\n @container_spec = args[:container_spec] if args.key?(:container_spec)\n @disk_spec = args[:disk_spec] if args.key?(:disk_spec)\n @machine_spec = args[:machine_spec] if args.key?(:machine_spec)\n @nfs_mounts = args[:nfs_mounts] if args.key?(:nfs_mounts)\n @python_package_spec = args[:python_package_spec] if args.key?(:python_package_spec)\n @replica_count = args[:replica_count] if args.key?(:replica_count)\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update!(**args)\n @container_name = args[:container_name] if args.key?(:container_name)\n @content_language = args[:content_language] if args.key?(:content_language)\n @create_time = args[:create_time] if args.key?(:create_time)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @interactions = args[:interactions] if args.key?(:interactions)\n @keywords = args[:keywords] if args.key?(:keywords)\n @mime_type = args[:mime_type] if args.key?(:mime_type)\n @object_type = args[:object_type] if args.key?(:object_type)\n @search_quality_metadata = args[:search_quality_metadata] if args.key?(:search_quality_metadata)\n @source_repository_url = args[:source_repository_url] if args.key?(:source_repository_url)\n @title = args[:title] if args.key?(:title)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def create\n response = post_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/containers.json\"), params[:container].to_json, (sesh :current_token))\n json_respond response.body \n\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 rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end", "def update!(**args)\n @container_name = args[:container_name] if args.key?(:container_name)\n @content_language = args[:content_language] if args.key?(:content_language)\n @context_attributes = args[:context_attributes] if args.key?(:context_attributes)\n @create_time = args[:create_time] if args.key?(:create_time)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @interactions = args[:interactions] if args.key?(:interactions)\n @keywords = args[:keywords] if args.key?(:keywords)\n @mime_type = args[:mime_type] if args.key?(:mime_type)\n @object_type = args[:object_type] if args.key?(:object_type)\n @search_quality_metadata = args[:search_quality_metadata] if args.key?(:search_quality_metadata)\n @source_repository_url = args[:source_repository_url] if args.key?(:source_repository_url)\n @title = args[:title] if args.key?(:title)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def put(id, json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name, id].compact.join('/')\n url += \"/\" \n return HTTParty.put(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end", "def patch(url, payload, headers={})\n RestClient.patch url, payload, headers\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 render_json :status => :forbidden and return unless @collection.write?(@user, @client)\n if !params[:collection]\n render_json :status => :bad_request, :messages => \"Tried to update collection with no data.\" and return\n end\n @collection.update_attributes(params[:collection].slice(:metadata, :read_only, :title, :tags, :priv))\n render_json :entry => @collection.to_hash(@user, @client) and return\n end", "def update\n animal = Animal.find(params[:id])\n\n if validate_params(animal_params)\n animal.update(animal_params)\n render json: animal, status: 200, location: [:api, animal]\n else\n render json: { errors: animal.errors }, status: 422\n end\n end", "def replace(data, force=false)\n args = \"\"\n if force\n args += \"--force --cascade\"\n end\n\n cmd = \"kubectl replace -f - #{args}\"\n err = runWithData(cmd, data)\n if err\n return \"could not replace object: #{err}\"\n end\n return false\nend", "def container_params\n params.require(:container).permit(:name, :image, :command, :exposed_port, :host_port, :server_id)\n end", "def container_params\n params.require(:container).permit(:name, :container_name, :image)\n end", "def patch\n end", "def update!(**args)\n @operations = args[:operations] if args.key?(:operations)\n @service_config_id = args[:service_config_id] if args.key?(:service_config_id)\n end", "def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "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!(**args)\n @attributes = args[:attributes] if args.key?(:attributes)\n @resources = args[:resources] if args.key?(:resources)\n @service_config_id = args[:service_config_id] if args.key?(:service_config_id)\n end", "def update!(**args)\n @artifact_uri = args[:artifact_uri] if args.key?(:artifact_uri)\n @container_spec = args[:container_spec] if args.key?(:container_spec)\n @predict_schemata = args[:predict_schemata] if args.key?(:predict_schemata)\n end", "def update\n respond_to do |format|\n if @cephalopod.update(cephalopod_params)\n format.html { redirect_to @cephalopod, notice: 'Cephalopod was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cephalopod.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(*args)\n request :put, *args\n end", "def create\n response = post_request(URI.parse(\"http://\"+Storage.find(cookies[:donabe_ip]).data+\"/\"+Storage.find(cookies[:current_tenant]).data+\"/containers.json\"), params[:container].to_json, Storage.find(cookies[:current_token]).data)\n json_respond response.body \n\n end", "def update\n @konfig = Konfig.find(params[:id])\n\n respond_to do |format|\n if @konfig.update_attributes(params[:konfig])\n format.html { redirect_to admin_konfig_path(@konfig), notice: 'Config was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @konfig.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @shipping_container = ShippingContainer.find(params[:id])\n\n respond_to do |format|\n if @shipping_container.update_attributes(params[:shipping_container])\n flash[:notice] = 'ShippingContainer was successfully updated.'\n format.html { redirect_to(admin_shipping_containers_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shipping_container.errors, :status => :unprocessable_entity }\n end\n end\n end", "def patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end", "def update!(**args)\n @account_id = args[:account_id] if args.key?(:account_id)\n @container_id = args[:container_id] if args.key?(:container_id)\n @container_version_id = args[:container_version_id] if args.key?(:container_version_id)\n @deleted = args[:deleted] if args.key?(:deleted)\n @name = args[:name] if args.key?(:name)\n @num_macros = args[:num_macros] if args.key?(:num_macros)\n @num_rules = args[:num_rules] if args.key?(:num_rules)\n @num_tags = args[:num_tags] if args.key?(:num_tags)\n @num_triggers = args[:num_triggers] if args.key?(:num_triggers)\n @num_variables = args[:num_variables] if args.key?(:num_variables)\n end", "def update!(**args)\n @resource_container = args[:resource_container] if args.key?(:resource_container)\n @resource_location = args[:resource_location] if args.key?(:resource_location)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n end", "def patch(payload)\n post_like payload, Net::HTTP::Patch.new(@uri.path)\n end", "def set_container\n @container = Container.find(params[:id])\n end", "def set_container\n @container = Container.find(params[:id])\n end", "def update!(**args)\n @account_id = args[:account_id] if args.key?(:account_id)\n @container_id = args[:container_id] if args.key?(:container_id)\n @fingerprint = args[:fingerprint] if args.key?(:fingerprint)\n @folder_id = args[:folder_id] if args.key?(:folder_id)\n @name = args[:name] if args.key?(:name)\n end", "def update!(**args)\n @container_type = args[:container_type] if args.key?(:container_type)\n @display_name = args[:display_name] if args.key?(:display_name)\n @display_name_last_first = args[:display_name_last_first] if args.key?(:display_name_last_first)\n end", "def update!(**args)\n @container = args[:container] if args.key?(:container)\n @elementary_streams = args[:elementary_streams] if args.key?(:elementary_streams)\n @encryption_id = args[:encryption_id] if args.key?(:encryption_id)\n @file_name = args[:file_name] if args.key?(:file_name)\n @key = args[:key] if args.key?(:key)\n @segment_settings = args[:segment_settings] if args.key?(:segment_settings)\n end", "def update_radios_for_array(args = {}) \n id = args['id']\n temp_path = \"/radios.json/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"radioId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update!(**args)\n @annotations = args[:annotations] if args.key?(:annotations)\n @bare_metal_version = args[:bare_metal_version] if args.key?(:bare_metal_version)\n @binary_authorization = args[:binary_authorization] if args.key?(:binary_authorization)\n @cluster_operations = args[:cluster_operations] if args.key?(:cluster_operations)\n @control_plane = args[:control_plane] if args.key?(:control_plane)\n @create_time = args[:create_time] if args.key?(:create_time)\n @delete_time = args[:delete_time] if args.key?(:delete_time)\n @description = args[:description] if args.key?(:description)\n @endpoint = args[:endpoint] if args.key?(:endpoint)\n @etag = args[:etag] if args.key?(:etag)\n @fleet = args[:fleet] if args.key?(:fleet)\n @load_balancer = args[:load_balancer] if args.key?(:load_balancer)\n @local_name = args[:local_name] if args.key?(:local_name)\n @maintenance_config = args[:maintenance_config] if args.key?(:maintenance_config)\n @maintenance_status = args[:maintenance_status] if args.key?(:maintenance_status)\n @name = args[:name] if args.key?(:name)\n @network_config = args[:network_config] if args.key?(:network_config)\n @node_access_config = args[:node_access_config] if args.key?(:node_access_config)\n @node_config = args[:node_config] if args.key?(:node_config)\n @os_environment_config = args[:os_environment_config] if args.key?(:os_environment_config)\n @proxy = args[:proxy] if args.key?(:proxy)\n @reconciling = args[:reconciling] if args.key?(:reconciling)\n @security_config = args[:security_config] if args.key?(:security_config)\n @state = args[:state] if args.key?(:state)\n @status = args[:status] if args.key?(:status)\n @storage = args[:storage] if args.key?(:storage)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n @validation_check = args[:validation_check] if args.key?(:validation_check)\n end", "def update\n respond_to do |format|\n\n format.json { render json: Axis.find(params[:id]).update( name: params[:name]) }\n end\n\n # end\n end", "def patch_kubernetes_cluster_with_http_info(moid, kubernetes_cluster, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.patch_kubernetes_cluster ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling KubernetesApi.patch_kubernetes_cluster\"\n end\n # verify the required parameter 'kubernetes_cluster' is set\n if @api_client.config.client_side_validation && kubernetes_cluster.nil?\n fail ArgumentError, \"Missing the required parameter 'kubernetes_cluster' when calling KubernetesApi.patch_kubernetes_cluster\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/Clusters/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(kubernetes_cluster)\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesCluster'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.patch_kubernetes_cluster\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#patch_kubernetes_cluster\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n respond_with []\n end", "def add_chef_object(container_name, requestor, object_json)\n post(api_url(\"/#{container_name}\"), requestor, :payload => object_json)\n end", "def update_current_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def patch(path, body_params = {})\n debug_log \"PATCH #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end", "def patch_kubernetes_version_with_http_info(moid, kubernetes_version, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.patch_kubernetes_version ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling KubernetesApi.patch_kubernetes_version\"\n end\n # verify the required parameter 'kubernetes_version' is set\n if @api_client.config.client_side_validation && kubernetes_version.nil?\n fail ArgumentError, \"Missing the required parameter 'kubernetes_version' when calling KubernetesApi.patch_kubernetes_version\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/Versions/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(kubernetes_version)\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesVersion'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.patch_kubernetes_version\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#patch_kubernetes_version\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end", "def update!(**args)\n @cloud_run = args[:cloud_run] if args.key?(:cloud_run)\n @kubernetes = args[:kubernetes] if args.key?(:kubernetes)\n end", "def test_update_post\n data = {\n title: \"Roll lemon\",\n content: \"Gingerbread bear claw muffin danish danish marzipan. Toffee lollipop wafer carrot cake dessert.\",\n description: \"Chocolate tootsie roll lemon drops. Chupa chups chocolate bar apple pie\",\n image: \"chocolate.png\",\n status: 1\n }\n expected = 200\n post_id = 1\n uri = URI.parse('http://localhost:3000/v1/posts/'+post_id.to_s)\n http = Net::HTTP.new(uri.host,uri.port)\n request = Net::HTTP::Put.new(uri.path)\n request.set_form_data(data)\n response = http.request(request)\n actual = JSON.parse(response.body)\n result = assert_equal(expected,actual['meta']['code'])\n puts this_method_name + \" - \" + result.to_s\n end", "def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cluster = Cluster.find(params[:id])\n\n respond_to do |format|\n if @cluster.update_attributes(params[:cluster])\n format.html { redirect_to @cluster, notice: 'Cluster was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cluster.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @collection = Collection.find(params[:id])\n expire_front\n\n\n respond_to do |format|\n if @collection.update_attributes(params[:collection])\n format.html { redirect_to @collection, notice: 'Collection was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end", "def partial_update(klass, id, patchset, options = {}, format = nil)\n headers = {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n options = { resource: klass, id: id, format: format}.merge options\n if [FHIR::Formats::ResourceFormat::RESOURCE_XML, FHIR::Formats::ResourceFormat::RESOURCE_XML_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_XML\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_XML}\"\n elsif [FHIR::Formats::ResourceFormat::RESOURCE_JSON, FHIR::Formats::ResourceFormat::RESOURCE_JSON_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_JSON\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_JSON}\"\n end\n headers[:prefer] = @return_preference if @use_return_preference\n reply = patch resource_url(options), patchset, fhir_headers(headers)\n reply.resource = parse_reply(klass, format, reply)\n reply.resource_class = klass\n reply\n end", "def update\n 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 cmd_modify argv\n setup argv\n json = @hash['json']\n e = @hash['element']\n response = @api.modify(json, e)\n msg response\n return response\n end", "def update!(**args)\n @errors = args[:errors] if args.key?(:errors)\n @etag = args[:etag] if args.key?(:etag)\n @group_id = args[:group_id] if args.key?(:group_id)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @resource = args[:resource] if args.key?(:resource)\n end", "def update!(**args)\n @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" ]
[ "0.6936837", "0.65907705", "0.65039676", "0.6361538", "0.63550586", "0.6173861", "0.6113243", "0.609286", "0.60480607", "0.5989976", "0.58575135", "0.583319", "0.58241105", "0.5778027", "0.57750654", "0.57386357", "0.5709766", "0.5704527", "0.5668994", "0.5651344", "0.5637639", "0.5623014", "0.56044555", "0.55819696", "0.5549156", "0.55484575", "0.55367947", "0.55348396", "0.55328476", "0.55284333", "0.5518573", "0.5515003", "0.5507019", "0.5501991", "0.5499414", "0.5466216", "0.54541975", "0.5439535", "0.54154736", "0.54110205", "0.54016674", "0.53971076", "0.5393019", "0.5391032", "0.5377444", "0.53771144", "0.5354298", "0.5348699", "0.5347663", "0.5331533", "0.53152907", "0.53027457", "0.52915287", "0.52641", "0.5254734", "0.5253752", "0.52505076", "0.5245948", "0.5243729", "0.5228662", "0.5220362", "0.52074206", "0.517245", "0.517245", "0.51703215", "0.516848", "0.5166996", "0.51657987", "0.5163851", "0.5162525", "0.51617855", "0.51564455", "0.5152685", "0.5147278", "0.51418275", "0.51274014", "0.51274014", "0.51228505", "0.5122612", "0.51178664", "0.5111449", "0.5111305", "0.51072127", "0.51045597", "0.51043665", "0.51033324", "0.5102302", "0.51015854", "0.5089038", "0.5069282", "0.50682455", "0.5067292", "0.5060915", "0.5058592", "0.50544775", "0.5054273", "0.50534457", "0.5050115", "0.5043202", "0.5041909" ]
0.6783597
1
DELETE /containers/1 DELETE /containers/1.json
def destroy begin #finds the current server that the container is on and sets it as Docker.ulr #@serverid = Serverhascontainer.where(container_id: @container.id)[0].server_id; #@currentServer = Server.where(id: @serverid) #Docker.url = 'tcp://' + @currentServer[0]["ip"] + ":" + @currentServer[0]["port"] Docker.url = findServer() #removes the container from docker Docker::Container.get(Container.find(params[:id]).dockercontainer_id).remove; #removes the Server-container relation from the database @d = Serverhascontainer.where(container_id: @container.id) Serverhascontainer.destroy(@d[0].id); #removes the container from the database @container.destroy Docker.url = '' respond_to do |format| format.html { redirect_to root_path, notice: 'deleted.' } format.json { head :no_content } end rescue Docker::Error::ConflictError => e respond_to do |format| format.html { redirect_to root_path, notice: "Oops: You cannot remove a running container. Stop the container before attempting removal" } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 @container = Container.find(params[:id])\n @container.destroy\n\n respond_to do |format|\n format.html { redirect_to containers_url, notice: 'Container was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @container = Container.find(params[:id])\n @container.destroy\n\n respond_to do |format|\n format.html { redirect_to(containers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @docker_instance.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\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 response = get_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/deployed_containers/\"+params[:id].to_s+\"/destroy_deployed.json\"), (sesh :current_token))\n json_respond response.body\n\n end", "def destroy\n @serverhascontainer.destroy\n respond_to do |format|\n format.html { redirect_to serverhascontainers_url, notice: 'Serverhascontainer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @level_container = LevelContainer.find(params[:id])\n @level_container.destroy\n\n respond_to do |format|\n format.html { redirect_to level_containers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @container = Container.get(params[:id])\n @container.destroy if(@container && !@container.root?)\n\n respond_to do |format|\n format.html { redirect_to(container_url(@container.parent.id)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @container_item.destroy\n respond_to do |format|\n format.html { destroy_redirect @container_item, notice: 'Container item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @container_stack = ContainerStack.find(params[:id])\n @container_stack.destroy\n\n respond_to do |format|\n format.html { redirect_to container_stacks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n log_debug \"[ #{@node}/#{@environment} ] - Destroy Podman Container #{@container} ...\"\n @cmd_runner.run_cmd \"#{podman_cmd} container rm #{@container}\"\n end", "def destroy\n @container_content = ContainerContent.find(params[:id])\n container = @container_content.container\n @container_content.destroy\n\n respond_to do |format|\n format.html { redirect_to(container) }\n format.xml { head :ok }\n end\n end", "def delete_container(name, options={})\n # Query\n query = { }\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n # Call\n call(:delete, container_uri(name, query), nil, {}, options)\n \n # result\n nil\n end", "def destroy\n @receipt_container = ReceiptContainer.find(params[:id])\n @receipt_container.destroy\n\n respond_to do |format|\n format.html { redirect_to receipt_containers_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\n @template_container = TemplateContainer.find(params[:id])\n @template_container.destroy\n respond_to do |format|\n format.html { redirect_to(template_containers_url) }\n format.xml { head :ok }\n format.js { render :layout => false }\n end\n end", "def destroy\n @container = @container_row.container\n @container_row.destroy\n respond_to do |format|\n flash[:success] = 'Row was successfully deleted.' \n format.html { redirect_to admin_container_url(@container) }\n format.json { head :no_content }\n end\n end", "def delete_container(name, options={})\n query = { }\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n call(:delete, container_uri(name, query))\n nil\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @cephalopod.destroy\n respond_to do |format|\n format.html { redirect_to cephalopods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @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 @docker_cfg.destroy\n respond_to do |format|\n format.html { redirect_to docker_cfgs_url, notice: 'Docker cfg was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def handle_destroy(event)\n @bus.request 'containers', 'destroyed', event: event.json, container: container_info(event.id)\n end", "def destroy\n @container_navigation = ContainerNavigation.find(params[:id])\n @container_navigation.destroy\n\n respond_to do |format|\n format.html { redirect_to container_navigations_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n # The correct implementation, with garbage collection:\n # if params.has_key?(:container_id)\n # container = ActiveFedora::Base.load_instance(params[:container_id]) \n # container.file_objects_remove(params[:id])\n # FileAsset.garbage_collect(params[:id])\n # else\n \n # The dirty implementation (leaves relationship in container object, deletes regardless of whether the file object has other containers)\n ActiveFedora::Base.load_instance(params[:id]).delete \n flash[:notice] = \"Deleted #{params[:id]} from #{params[:container_id]}.\"\n \n if !params[:container_id].nil?\n redirect_params = {:controller => \"catalog\", :action => \"edit\", :id => params[:container_id], :anchor => \"file_assets\"}\n end\n redirect_params ||= {:action => 'index', :q => nil , :f => nil}\n \n redirect_to redirect_params\n \n end", "def destroy\n id = params[:id]\n @datacenter = Datacenter.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @datacenter.destroy\n\n respond_to do |format|\n format.html { redirect_to datacenters_url }\n format.json { head :ok }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def delete(labels = [])\n call_container_method(:delete, labels)\n end", "def destroy\n @declaration_container.destroy\n\n respond_to do |format|\n format.html { redirect_to declaration_containers_url(:declaration_id => @declaration_container.declaration_id) }\n format.json { head :no_content }\n end\n end", "def destroy\n animal = Animal.find(params[:id])\n animal.destroy\n head 204\n end", "def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end", "def destroy\n @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 @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 prune params = {}\n @connection.post(build_path(\"/containers/prune\", params))\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @api_post.destroy\n\n head :no_content\n end", "def destroy\n @konfig = Konfig.find(params[:id])\n @konfig.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_konfigs_url }\n format.json { head :no_content }\n end\n end", "def delete\n svc = Service.find_by_label(params[:label])\n raise CloudError.new(CloudError::SERVICE_NOT_FOUND) unless svc\n raise CloudError.new(CloudError::FORBIDDEN) unless svc.verify_auth_token(@service_auth_token)\n\n svc.destroy\n\n render :json => {}\n end", "def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n response = connection.delete(\"/collections/#{id}\")\n (200..299).include?(response.status)\n end", "def clean\n # TODO: help?\n # TODO: check for unknown args\n\n # Can give the following\n # Error response from daemon: conflict: unable to delete cfc459985b4b (cannot be forced)\n # image is being used by running container a7108a524a4d\n command = \"docker images -q -f='dangling=true' | xargs docker rmi --force\"\n run command\nend", "def destroy\n dns_entry_response = RestClient.delete('https://api.cloudflare.com/client/v4/zones/:zone_identifier/dns_records/:identifier',:content_type => :json, :accept => :json, :'x-auth-key' => session[:key] :'x-auth-email' => session[:email])\n @dns_entry.destroy\n respond_to do |format|\n format.html { redirect_to dns_entries_url, notice: \"Dns entry was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete\n if params[:id]\n result = backend_instance.compute_delete(params[:id])\n else\n result = backend_instance.compute_delete_all\n end\n\n if result\n respond_with(Occi::Collection.new)\n else\n respond_with(Occi::Collection.new, status: 304)\n end\n end", "def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end", "def destroy\n @shipping_container = ShippingContainer.find(params[:id])\n @shipping_container.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_shipping_containers_url) }\n format.xml { head :ok }\n end\n end", "def remove_container(name)\n render :update do |page|\n page.remove name\n end\n end", "def destroy\n @page = @containers_page.page\n @containers_page.destroy\n @containers_pages = @page.containers_pages\n respond_to do |format|\n format.js\n format.html do \n flash[:success] = 'Container was successfully removed from page.' \n redirect_to containers_pages_url \n end\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 @lifecycle = Lifecycle.find(params[:id])\n @lifecycle.destroy\n\n respond_to do |format|\n format.html { redirect_to lifecycles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @chronicle.destroy\n respond_to do |format|\n format.html { redirect_to chronicles_url }\n format.json { head :no_content }\n end\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couche was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n id = @api_v1_canvas.id\n @api_v1_canvas.destroy\n respond_to do |format|\n format.html do\n redirect_to api_v1_canvases_url, notice: 'Canvas was successfully destroyed.'\n end\n\n format.json do\n msg = { id: id }\n broadcast(\"deleted\", msg)\n head :no_content\n end\n end\n end", "def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @database.destroy\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :no_content }\n end\n end", "def delete_blob(container, blob, key = nil, options = {})\n key ||= properties.key1\n\n url = File.join(properties.primary_endpoints.blob, container, blob)\n url += \"?snapshot=\" + options[:date] if options[:date]\n\n headers = build_headers(url, key, :blob, :verb => 'DELETE')\n\n response = ArmrestService.send(\n :rest_delete,\n :url => url,\n :headers => headers,\n :proxy => proxy,\n :ssl_version => ssl_version,\n :ssl_verify => ssl_verify\n )\n\n headers = Azure::Armrest::ResponseHeaders.new(response.headers)\n headers.response_code = response.code\n\n headers\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 @jumbotron.destroy\n respond_to do |format|\n format.html { redirect_to jumbotrons_url, notice: 'Jumbotron was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def remove\n @container.stop\n @container.delete\n end", "def destroy\n @kv.destroy\n respond_to do |format|\n format.html { redirect_to kvs_url, notice: 'Kv was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @node = Node.find_key(params[:id] || params[:name])\n @node.destroy\n respond_to do |format|\n format.html { redirect_to deployment_path(@node.deployment_id) }\n format.json { render api_delete @node }\n end\n end", "def destroy\n @client.delete( name )\n end", "def destroy\n streak, success = jsonapi_destroy.to_a\n\n if success\n render json: { meta: {} }\n else\n render_errors_for(streak)\n end\n end", "def destroy\n @admin.destroy\n\n render json: { operation: 'OK' }, status: :ok\n end", "def destroy\n chef_rest_v1.delete(\"clients/#{@name}\")\n end", "def destroy\n output = \"oneimage delete #{resource[:name]} \", self.class.login\n `#{output}`\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "def cleanup\n docker.stop_container\n docker.delete_container\n end", "def destroy\n @collection.destroy\n\n render json: @collection, status: :ok#, location: @collection\n end", "def destroy\n @database = Database.find(params[:id])\n if @database.started\n @database_client = RdsServer.find(@database.name)\n @database_client.destroy\n end\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :ok }\n end\n end", "def destroy\n @cloud.delete\n respond_to do |format|\n format.html { redirect_to clouds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image_collection.destroy\n respond_to do |format|\n format.html { redirect_to image_collections_url, notice: 'Image collection was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cage.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @azul.destroy\n respond_to do |format|\n format.html { redirect_to azuls_url, notice: 'Azul was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_index_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @database = Database.find(params[:id])\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json {render :head => :no_content }\n end\n end", "def destroy\n @cont = Cont.find(params[:id])\n @cont.destroy\n\n respond_to do |format|\n format.html { redirect_to conts_url }\n format.json { head :ok }\n end\n end", "def destroy\n @datasource.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @cloud = Cloud.find(params[:id])\n @cloud.destroy\n\n respond_to do |format|\n format.html { redirect_to clouds_url }\n format.json { head :no_content }\n end\n end", "def delete_ingress(namespace, ingress_name)\n if namespace_exists?(namespace) && object_exists?(namespace, \"ingress\", ingress_name)\n execute(\"kubectl delete ingress #{ingress_name} -n #{namespace}\")\n end\nend", "def destroy\n @command.destroy\n respond_to do |format|\n msg = { :status => 'ok', message: 'Deleted Successfully'}\n format.json { render json: msg }\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(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 @data_collection = DataCollection.find(params[:id])\n @data_collection.destroy\n\n respond_to do |format|\n format.html { redirect_to data_collections_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client.delete(@name)\n end", "def destroy\n #@incidentcategory.destroy\n render json: {}, status: 200\n end", "def destroy\n @health.destroy\n respond_to do |format|\n format.html { redirect_to \"/dashboard\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n\n json_response(@post)\n end", "def destroy\n @collab = Collab.find(params[:id])\n @collab.destroy\n\n respond_to do |format|\n format.html { redirect_to collabs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @control_loop.destroy\n respond_to do |format|\n format.html { redirect_to control_loops_url, notice: 'Control loop was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fabrica.destroy\n respond_to do |format|\n format.html { redirect_to fabricas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @data_center = DataCenter.find(params[:id])\n @data_center.destroy\n\n respond_to do |format|\n format.html { redirect_to data_centers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @databox.destroy\n render json: { post: @databox }\n# respond_to do |format|\n# format.html { redirect_to databoxes_url }\n# format.json { head :no_content }\n# end\n end", "def destroy\n return if @name.nil?\n delete_rest \"vservers/#{@name}\"\n end" ]
[ "0.77223444", "0.7654943", "0.7483602", "0.73324454", "0.72308844", "0.713478", "0.701006", "0.6858805", "0.68261087", "0.6803036", "0.67661566", "0.6749949", "0.6699148", "0.6698651", "0.66778785", "0.66631824", "0.66421735", "0.6640113", "0.6590578", "0.6587223", "0.65377533", "0.64680576", "0.6463081", "0.6460962", "0.6396799", "0.63406616", "0.62864935", "0.6277713", "0.6245317", "0.62420905", "0.6240677", "0.6231705", "0.62176967", "0.61996067", "0.6186059", "0.61787075", "0.6178179", "0.6172735", "0.61547905", "0.61547494", "0.6143794", "0.6139286", "0.6138062", "0.61269057", "0.61259556", "0.6125264", "0.6118471", "0.61096776", "0.6109463", "0.6104722", "0.6101895", "0.60942984", "0.6085986", "0.60696834", "0.6066584", "0.60611343", "0.60585225", "0.6055983", "0.6055709", "0.6048965", "0.60488296", "0.60466266", "0.6040851", "0.6036339", "0.6036178", "0.60278773", "0.6027285", "0.6013621", "0.6012248", "0.6007444", "0.6007444", "0.6006176", "0.59971195", "0.59964913", "0.5990192", "0.59881747", "0.59856945", "0.59818983", "0.5981591", "0.5980735", "0.5980628", "0.59800404", "0.5979675", "0.59788185", "0.5977905", "0.5973863", "0.59729254", "0.5966546", "0.59626895", "0.5962045", "0.595896", "0.59535813", "0.59532803", "0.59528935", "0.5952345", "0.59519166", "0.59511065", "0.5949408", "0.59488994", "0.59483117" ]
0.6998827
7
Use callbacks to share common setup or constraints between actions.
def set_container @container = Container.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 container_params params.require(:container).permit(:name, :image, :command, :exposed_port, :host_port, :server_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
def get_character_movies_from_api(character_name) make the web request response_string = RestClient.get(' response_hash = JSON.parse(response_string) characters_arr = response_hash["results"] character_idx = nil characters_arr.each_with_index do |hash,idx| if hash["name"] == character_name character_idx = idx end end arr_of_films = characters_arr[character_idx]["films"] arr_of_hashes = [] arr_of_films.each do |film_url| film_str = RestClient.get(film_url) film_hash = JSON.parse(film_str) arr_of_hashes << film_hash end return arr_of_hashes make the web request iterate over the response hash to find the collection of `films` for the given `character` `character` collect those film API urls, make a web request to each URL to get the info for that film return value of this method should be collection of info about each film. i.e. an array of hashes in which each hash reps a given film this collection will be the argument given to `print_movies` and that method will do some nice presentation stuff like puts out a list of movies by title. Have a play around with the puts with other info about a given film. end puts get_character_movies_from_api("Luke Skywalker") puts ""
def parse_url(url) response_str = RestClient.get(url) characters_arr = JSON.parse(response_str) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_character_movies_from_api(character)\n #make the web request\n all_characters = RestClient.get('http://www.swapi.co/api/people/')\n character_hash = JSON.parse(all_characters)\n film_urls = get_film_urls(character_hash, character)\n\n parse_character_movies(parse_films(film_urls))\nend", "def get_character_movies_from_api(character_name)\n #make the web request\n\n response_string = RestClient.get('http://www.swapi.co/api/people/')\n response_hash = JSON.parse(response_string)\n\n counter = 1\n films = []\n\n\n while films.size <= 1 do\n\n response_hash[\"results\"].find do |item_name|\n\n if item_name[\"name\"].downcase == character_name.downcase\n films = item_name[\"films\"]\n puts \"Film found\"\n films.collect! do |film_url|\n response_film_url = RestClient.get(film_url)\n response_film_url_hash = JSON.parse(response_film_url)\n response_film_url_hash[\"title\"]\n end\n puts \"Film Convert\"\n return films\n elsif response_hash[\"next\"] == nil\n return puts \"Character not found.\"\n end\n\n counter += 1\n\n response_string = RestClient.get(response_hash[\"next\"])\n response_hash = JSON.parse(response_string)\n end\nend\n\n\n #films = []\n #response_hash[\"results\"].find do |item_name|\n #\n # if item_name[\"name\"].downcase == character_name.downcase\n # films = item_name[\"films\"]\n # end\n #end\n\n #if response_hash[\"results\"][0][\"name\"].downcase == character_name\n # films = response_hash[\"results\"][0][\"films\"]\n #end\n\n #films.collect! do |film_url|\n # response_film_url = RestClient.get(film_url)\n # response_film_url_hash = JSON.parse(response_film_url)\n # response_film_url_hash[\"title\"]\n #end\n\n\n\n\n # iterate over the response hash to find the collection of `films` for the given\n # `character`\n # collect those film API urls, make a web request to each URL to get the info\n # for that film\n # return value of this method should be collection of info about each film.\n # i.e. an array of hashes in which each hash reps a given film\n # this collection will be the argument given to `print_movies`\n # and that method will do some nice presentation stuff like puts out a list\n # of movies by title. Have a play around with the puts with other info about a given film.\nend", "def get_character_movies_from_api(character)\n all_characters = RestClient.get('http://www.swapi.co/api/people/')\n character_hash = JSON.parse(all_characters)\n\n results = []\n still_searching = true\n\n while still_searching\n results << character_hash[\"results\"] # results pushed into results array on every loop iteration\n if character_hash[\"next\"]\n next_page = RestClient.get(character_hash[\"next\"])\n character_hash = JSON.parse(next_page)\n else\n still_searching = false\n end\n end\n\n results = results.flatten\n results = results.select {|chara| chara[\"name\"].downcase == character}\n # results is an array containing a hash\n\n if results.length > 0\n film_hash = results[0][\"films\"].map do |film_url|\n film = RestClient.get(film_url)\n film = JSON.parse(film)\n end\n end\nend", "def get_character_movies_from_api(character)\n #make the web request\n page = 1\n # iterate over the character hash to find the collection of `films` for the given\n # `character`\n # collect those film API urls,\n until page == 10\n all_characters = RestClient.get(\"https://swapi.co/api/people/?page=#{page}\")\n character_hash = JSON.parse(all_characters)\n\n character_hash[\"results\"].each do |value|\n if value[\"name\"] == character\n films_hash = value[\"films\"]\n end\n end\n page +=1\n end\n\nend", "def get_character_movies_from_api(character)\n #make the web request\n all_characters = RestClient.get('http://www.swapi.co/api/people/')\n character_hash = JSON.parse(all_characters)\n\n person_hash = []\n character_hash.each do |key, value|\n if key == \"results\"\n value.each do |info|\n if info[\"name\"].downcase == character.downcase\n person_hash = info\n binding.pry\n end\n end\n end\n end\n\n film_info = []\n films.each do |film_url|\n film_info.push(JSON.parse(RestClient.get(film_url)))\n end\n new_character = Character.new(person_hash)\nend", "def get_movie_characters_from_api(movie)\nmovie_hash = make_search('http://www.swapi.co/api/films/')\ncharacters_array = []\n movie_hash[\"results\"].each do |item|\n if item[\"title\"].downcase == movie\n item[\"characters\"].each do |character| #urls \n character_info_hash = make_search(character)\n characters_array << character_info_hash\n end \n end\n end \n #characters_array #all the info on films an array of hashes\n parse_movie_character(characters_array)\nend", "def get_character_movies_from_api(character)\n film_urls = get_film_urls(character)\n film_urls.collect do |movie_url|\n look_up(movie_url)\n end\nend", "def parse_character_movies(character)\n get_character_movies_from_api(character).collect do |film_name|\n film_resp_string = RestClient.get(film_name)\n JSON.parse(film_resp_string)\n end \n response_hash[\"results\"].each do |hash|\n if character == hash[\"name\"]\n desired_films = hash[\"films\"]\n end\nend\n desired_films\nend", "def get_movies_data(character_data)\n if character_data\n character_films = character_data[\"films\"]\n movie_response_string = character_films.map {|film_url| RestClient.get(film_url)}\n movie_response_string.map {|response_string| JSON.parse(response_string)}\n else\n nil\n end\nend", "def show_character_movies(character)\n urls_of_films = get_character_movies_from_api(character)\n films_hash = add_film_urls(urls_of_films)\n parse_character_movies(films_hash)\nend", "def get_character_movies_from_api(character)\n #make the web request\n link = \"http://www.swapi.co/api/people/\"\n character_hash = parse_json(link)\n link = character_hash[\"next\"]\n\n while link != nil\n character_hash[\"results\"] = character_hash[\"results\"].replace(parse_json(link)[\"results\"])\n break if check_for_character(character_hash[\"results\"], character)\n link = parse_json(link)[\"next\"]\n end\n\n char = get_character_info(character_hash, character)\n\nend", "def get_character_movies_from_api(name)\n parsed_data = get_results_array\n films = []\n parsed_data.map do |result_instance|\n if result_instance[\"name\"] == name \n # puts result_instance[\"name\"]\n films = result_instance[\"films\"]\n end\n end\n film_array = []\n films.map do |film_instance|\n film_data = RestClient.get(film_instance)\n parsed_film = JSON.parse(film_data)\n film_array << parsed_film\n end \n puts film_array\n\nend", "def show_character_movies(character)\n films = get_character_movies_from_api(character)\n #print_movies(films)\nend", "def show_character_movies(character)\n films = get_character_movies_from_api(character)\n print_movies(films)\n\n\n\nend", "def show_character_movies(character)\n films_hash = get_character_movies_from_api(character) #returns films list/url\n parse_character_movies(films_hash)\nend", "def get_character_movies_from_api(character)\n #make the web request\n all_characters = RestClient.get('http://www.swapi.co/api/people/') # web request\n character_hash = JSON.parse(all_characters)\n\n arr = nil\n character_hash[\"results\"].each do |key|\n if key[\"name\"] == character\n arr = key[\"films\"]\n end\n end\narr\nend", "def character_movies(character)\n output = []\n all_characters = RestClient.get('http://www.swapi.co/api/people/')\n character_hash = JSON.parse(all_characters)\n results = character_hash[\"results\"]\n results.each do |person|\n if person[\"name\"].downcase == character\n output = person[\"films\"]\n end\n end\n return output\nend", "def show_character_movies(character)\n get_character_movies_from_api(character)\n # parse_character_movies(films_hash)\nend", "def show_character_movies(character)\n films = get_character_movies_from_api(character)\n print_movies(films)\nend", "def show_character_movies(character)\n films_hash = get_character_movies_from_api(character)\n parse_character_movies(films_hash)\nend", "def show_character_movies(character)\n films_hash = get_character_movies_from_api(character)\n\n if films_hash\n parse_character_movies(films_hash)\n else\n puts \"Cannot find character\"\n end\nend", "def get_film_urls(character)\n character_hash = look_up('http://www.swapi.co/api/people/')\n film_urls = character_hash[\"results\"].find do |element|\n element[\"name\"].downcase == character\n end[\"films\"]\nend", "def fetchMovieData(movieID)\n puts \"HITTING THE NET\"\n #Construct the URL used to access the API\n url = \"http://api.themoviedb.org/3/movie/#{movieID}?api_key=#{$apiKey}\"\n #Preform a restful request to get the information\n #Uses the RestClient gem to preform the request\n data = RestClient.get(url)\n #Parse the JSON to get a simple hash (key value pairs) of info\n #Uses the JSON gem to avoid manual parsing\n data = JSON.parse(data)\n\n #Reformat some data to make it easier to work with later\n #2015-04 BN: added a translation step so that apostrophes, like \"he's\" willl get \n # passed correctly\n data[\"description\"] = data[\"overview\"][0..249]\n\n \n #Get the information that was not included in the first API call\n #Rating and date info\n ratingAndDate = fetchMovieRatingAndYear(movieID)\n #Add this data to the hash before returning it\n data[\"contentRating\"] = ratingAndDate[\"certification\"]\n data[\"year\"] = Date.parse(ratingAndDate[\"release_date\"]).year.to_s\n\n #Fetch the movie directors and actors and add them to the hash\n data[\"artist\"] = fetchMovieCast(movieID)\n data[\"directors\"] = fetchMovieDirectors(movieID)\n return data\nend", "def show_character_movies(character)\n if get_characters.include? character\n films_hash = get_character_movies_from_api(character)\n puts parse_character_movies(films_hash)\n else\n puts \"Have you even seen the movies?\"\n end\nend", "def print_movies(films)\n # some iteration magic and puts out the movies in a nice list\n films.each do |film|\n response_string = RestClient.get(film)\n response_hash = JSON.parse(response_string)\n puts response_hash[\"title\"]\n end\nend", "def get_characters_from_api\n #establish initial url from api\n url = 'http://www.swapi.co/api/people/'\n #get all data from first page of API\n page_of_characters = JSON.parse(RestClient.get(url))\n all_characters = page_of_characters\n \n next_call = page_of_characters[\"next\"]\n\n while next_call do\n next_page = next_call\n next_page_of_characters = JSON.parse(RestClient.get(next_page))\n (all_characters[\"results\"] << next_page_of_characters[\"results\"])\n next_call = next_page_of_characters[\"next\"]\n end\n\n all_characters\nend", "def get_movies_from_api\n all_films = RestClient.get('http://www.swapi.co/api/films/')\n film_hash = JSON.parse(all_films) \nend", "def callAPI(name)\n unless name.nil?\n # I chose to use the title_popular option over the title_exact option since\n # we don't know the full title and over the title_substring since it seemed\n # to return videos related to our search term instead of movies\n json = JSON.parse(open(\"http://www.imdb.com/xml/find?json=1&nr=1&tt=on&q=#{name}\") { |x| x.read })\n # Should do more date validation but I will assume it's always the first 4 characters\n return \"Title: \" + json[\"title_popular\"][0][\"title\"] + \"\\nYear: \" + json[\"title_popular\"][0][\"title_description\"][0..3] unless json[\"title_popular\"].nil?\n \"No movie with the specified title\"\n else\n \"Please specify a movie title\"\n end\nend", "def print_movies(films)\n list = films.map do |film|\n response_string = RestClient.get(film)\n response_hash = JSON.parse(response_string)\n response_hash[\"title\"]\n end\n puts list\n # some iteration magic and puts out the movies in a nice list\nend", "def parse_character_movies(films_hash)\n # some iteration magic and puts out the movies in a nice list\nall_movie_title=[]\nall_movie_descr=[]\n films_hash.map do |urls|\n movie = RestClient.get(urls)\n json = JSON.parse(movie)\n all_movie_title << json[\"title\"]\n all_movie_descr << json[\"opening_crawl\"]\n end\n\n # films_hash.map do |urls|\n # movie = RestClient.get(urls)\n # json = JSON.parse(movie)\n # all_movie_descr << json[\"opening_crawl\"]\n\n #end\n movie_hash={}\n all_movie_title.zip(all_movie_descr) do |key,value|\n movie_hash[key.to_sym]=value\n end\n movie_hash.each do |key,value|\n puts \"\\n Title: #{key.to_s} \\n Desciption: #{value.to_s} \\n\"\n\n #puts \"Desciption: #{value.to_s} \\n\"\n end\n#binding.pry\n #all_movie\n\nend", "def movie_search\n\n puts \"Please enter the name of the movie you would like to search\"\n input = gets.chomp\n system \"clear\"\n query_response = RestClient.get(\"http://www.omdbapi.com/?s=#{input}&apikey=a2d3299b\") #send query to database to search for movies containing the the user's input in the title\n\n parsed_response = JSON.parse(query_response) #parse the response into a hash\n\n movie_results = parsed_response[\"Search\"].map do |movie| #iterate through the hash and extract the movie titles into an array\n movie[\"Title\"] \n end\n puts \"Your search returned the following results:\"\n\n #todo !iterate through the hash again (movie_reslts) to get the release year of each movie\n movie_years = parsed_response[\"Search\"].map do |movie| #iterate through the hash and extract the movie year into an array\n movie[\"Year\"]\n end\n\n\n movie_results.each.with_index(1).map do |movie, index| #iterate through the array of movie titles and print them to the screen, along with their index # + 1\n puts \"#{index}. #{movie}\"\n end\n find_movie_from_list(movie_results) #allow the user to select a movie from their movie list\n end", "def parse_character_movies(films_hash)\n # binding.pry\n films_hash.each_with_index do |movie_url, num|\n get_movie_info = RestClient.get(movie_url)\n movie_info = JSON.parse(get_movie_info)\n title = movie_info[\"title\"]\n puts \"#{num+1}. #{title}\"\n end\n\nend", "def get_movies_by_film(title)\n all_movies = RestClient.get('http://www.swapi.co/api/films/')\n movies_hash = JSON.parse(all_movies)\n\n results = movies_hash[\"results\"].select {|movie| movie[\"title\"].downcase == title}\n # results is an array containing a hash\n\n if results[0].length > 0\n puts \"Title: #{results[0][\"title\"]}\"\n puts \"Director: #{results[0][\"director\"]}\"\n puts \"Release Date: #{results[0][\"release_date\"]}\"\n else\n puts \"Movie not found\"\n end\nend", "def get_all_actors_for_movie(movie)\n url = \"http://movies.api.mks.io/actors\"\n response = RestClient.get(url, accept: 'application/json')\n\nend", "def movie_data\n response = RestClient.get(\"critics.api.mks.io/movie-genres\")\n JSON.parse(response)\nend", "def get_character_info(character,response_hash)\n #response_string = RestClient.get('http://www.swapi.co/api/people/')\n #response_hash = JSON.parse(response_string)\n response_hash[\"results\"].each do |value|\n #/iterate over each element and check if value of the name key is equal to user input\n #binding.pry\n if value[\"name\"].downcase == character\n return value[\"films\"]\n end\n end\nend", "def print_movies(films_hash)\n#binding.pry\n films_hash.each do |film|\n\n # some iteration magic and puts out the movies in a nice list\n movie = RestClient.get(film)\n movie_hash = JSON.parse(movie)\n puts movie_hash[\"title\"]\n\n\n #movie_hash[\"results\"].each do |title|\n end\n\nend", "def get_movies_of_specific_character(specific_character_data)\n specific_character_films = specific_character_data.first[\"films\"]\nend", "def fetchMovieCast(movieID)\n #Construct the URL used to access the API\n url = \"http://api.themoviedb.org/3/movie/#{movieID}/credits?api_key=#{$apiKey}\"\n #RESTful request\n data = JSON.parse(RestClient.get(url))\n #Extract the cast data from the returned results\n castData = data[\"cast\"]\n #Remove everything except the names of the actors, maintaining the order\n #This line is converting an array of hashes into an array of strings\n #by mapping the values that correspond to the key \"name\" for each hash in \n #the array to the output array\n castNames = castData.map{ |castMember| castMember[\"name\"]}\n #Grab just the first three of the actors and then join them on the string \", \"\n return castNames[0..$numActors-1].join(\", \")\nend", "def find_films(character)\n target = find_character(character) #hash\n if target == nil\n return \"Please enter correct character name.\"\n else\n films_of_character = target[\"films\"]#an array of movies URLs\n end\nend", "def show\n @films_all = HTTParty.get('https://swapi.co/api/films',\n :headers =>{'Content-Type' => 'application/json'} )['results']\n @characters_all_1 = HTTParty.get('https://swapi.co/api/people',\n :headers =>{'Content-Type' => 'application/json'} )['results']\n @characters_all_2 = HTTParty.get('https://swapi.co/api/people/?page=2',\n :headers =>{'Content-Type' => 'application/json'} )['results']\n @characters_all_3 = HTTParty.get('https://swapi.co/api/people/?page=3',\n :headers =>{'Content-Type' => 'application/json'} )['results']\n @characters_all_4 = HTTParty.get('https://swapi.co/api/people/?page=4',\n :headers =>{'Content-Type' => 'application/json'} )['results']\n @characters_all_5 = HTTParty.get('https://swapi.co/api/people/?page=5',\n :headers =>{'Content-Type' => 'application/json'} )['results']\n @characters_all_6 = HTTParty.get('https://swapi.co/api/people/?page=6',\n :headers =>{'Content-Type' => 'application/json'} )['results']\n @characters_all_7 = HTTParty.get('https://swapi.co/api/people/?page=7',\n :headers =>{'Content-Type' => 'application/json'} )['results']\n @characters_all_8 = HTTParty.get('https://swapi.co/api/people/?page=8',\n :headers =>{'Content-Type' => 'application/json'} )['results']\n @characters_all_9 = HTTParty.get('https://swapi.co/api/people/?page=9',\n :headers =>{'Content-Type' => 'application/json'} )['results']\n @starships_all_1 = HTTParty.get('https://swapi.co/api/starships',\n :headers =>{'Content-Type' => 'application/json'} )['results']\n @starships_all_2 = HTTParty.get('https://swapi.co/api/starships/?page=2',\n :headers =>{'Content-Type' => 'application/json'} )['results']\n @starships_all_3 = HTTParty.get('https://swapi.co/api/starships/?page=3',\n :headers =>{'Content-Type' => 'application/json'} )['results']\n @starships_all_4 = HTTParty.get('https://swapi.co/api/starships/?page=4',\n :headers =>{'Content-Type' => 'application/json'} )['results']\n @planets_all_1 = HTTParty.get('https://swapi.co/api/planets',\n :headers =>{'Content-Type' => 'application/json'} )['results']\n @planets_all_2 = HTTParty.get('https://swapi.co/api/planets/?page=2',\n :headers =>{'Content-Type' => 'application/json'} )['results']\n @planets_all_3 = HTTParty.get('https://swapi.co/api/planets/?page=3',\n :headers =>{'Content-Type' => 'application/json'} )['results']\n @planets_all_4 = HTTParty.get('https://swapi.co/api/planets/?page=4',\n :headers =>{'Content-Type' => 'application/json'} )['results']\n @planets_all_5 = HTTParty.get('https://swapi.co/api/planets/?page=5',\n :headers =>{'Content-Type' => 'application/json'} )['results']\n @planets_all_6 = HTTParty.get('https://swapi.co/api/planets/?page=6',\n :headers =>{'Content-Type' => 'application/json'} )['results']\n @planets_all_7 = HTTParty.get('https://swapi.co/api/planets/?page=7',\n :headers =>{'Content-Type' => 'application/json'} )['results']\n\n\n\n\n \n @planet = HTTParty.get(\"https://swapi.co/api/planets/#{params[:id]}\",\n :headers =>{'Content-Type' => 'application/json'} )\n\n @characters = []\n @planet['residents'].each do |cha|\n cha_id = cha.split('/')[5]\n @characters.push(HTTParty.get(\"https://swapi.co/api/people/#{cha_id}\",\n :headers =>{'Content-Type' => 'application/json'} ))\n end\n\n @films = []\n @planet['films'].each do |film|\n film_id = film.split('/')[5]\n @films.push(HTTParty.get(\"https://swapi.co/api/films/#{film_id}\",\n :headers =>{'Content-Type' => 'application/json'} ))\n end\n\n end", "def movie_info(movie_url)\n movie_hash = get_movies_from_api\n movie_hash[\"results\"].find do |movie_info|\n movie_info[\"url\"] == movie_url\n end\nend", "def film_api(url)\n film_response = RestClient.get(url)\n film_hash = JSON.parse(film_response)\nend", "def get_all_character_apis\n\t\t\tjson(@@movie_api)[\"results\"].map { |movie| movie[\"characters\"]}.flatten\n end", "def show_character_stats(character,user_choice)\n #retrieve stat from api\n #stat can either be a string containing stat, a URL or array of URL's\n stat = get_character_stats_from_api(character, user_choice)\n #homeworld stat is a URL\n if user_choice == \"homeworld\"\n #get response from homeworld URL\n response_hash = get_response(stat)\n #display the homeworld name\n puts response_hash[\"name\"]\n puts\"*****************\\n\"\n\n elsif user_choice == \"films\"#get response from homeworld URL\n #get response from film URL\n #get name for each film and film array\n parsed_stats = parse_character_stats(stat, \"title\")\n print_stats(parsed_stats)\n\n elsif user_choice == \"species\"\n #get response from species URL\n parsed_stats = parse_character_stats(stat, \"name\")\n print_stats(parsed_stats)\n\n else\n \n puts stat\n puts \"*****************\\n\"\n end\n\nend", "def get_characters\n character_hash = look_up('http://www.swapi.co/api/people/')\n character_hash[\"results\"].collect do |element|\n element[\"name\"]\n end\nend", "def get_all_movies_for_actor(actor)\n url = \"http://movies.api.mks.io/movies\"\n response = RestClient.get(url, accept: 'application/json')\n\nend", "def fetch_list_characters\n response_string = RestClient.get('http://www.swapi.co/api/people/')\n response_hash = JSON.parse(response_string)\n\n character = response_hash[\"results\"].map {|char| char[\"name\"]}\nend", "def get_info_on_films(film_array) \n film_array.map do |film|\n film_info = JSON.parse(RestClient.get(film))\n film_info\n end\nend", "def parse_character_movies(films_hash)\n # some iteration magic and puts out the movies in a nice list\n return_array = []\n films_hash.each do |film|\n return_array.push(film[1][\"title\"])\n\n end\n return_array\nend", "def get_movie_info(movie_title)\n #page = HTTParty.get('http://www.imdb.com/title/tt0119081/')\n page = HTTParty.get(movie_title)\n # this is where we transform our http response into a nokogiri object so that we can parse it\n parse_page = Nokogiri::HTML(page)\n #now we grab the HTML content we want\n #GET TITLE\n movie_name = parse_page.xpath('//h1').text.strip\n p \"this is the movie_name \" + movie_name\n\n #GET Director\n director = parse_page.css('.credit_summary_item').text.gsub(\"\\n\",'').gsub(\"Director:\",\"\").strip\n director = director.split(\" \")[0]\n p \"this is the direcor \" + director\n\n\n #GET actors\n actors = []\n\n actor_1 = parse_page.xpath('//*[@id=\"title-overview-widget\"]/div[3]/div[2]/div[1]/div[4]/span[1]/a/span').inner_html\n actor_2 = parse_page.xpath('//*[@id=\"title-overview-widget\"]/div[3]/div[2]/div[1]/div[4]/span[2]/a/span').inner_html\n actor_3 = parse_page.xpath('//*[@id=\"title-overview-widget\"]/div[3]/div[2]/div[1]/div[4]/span[3]/a/span').inner_html\n p actors\n if actor_1 == \"\"\n p \"actors are NOT defined! ! ! \"\n actor_1 = parse_page.xpath('//*[@id=\"title-overview-widget\"]/div[3]/div[1]/div[4]/span[1]/a/span').inner_html\n actor_2 = parse_page.xpath('//*[@id=\"title-overview-widget\"]/div[3]/div[1]/div[4]/span[2]/a/span').inner_html\n actor_3 = parse_page.xpath('//*[@id=\"title-overview-widget\"]/div[3]/div[1]/div[4]/span[3]/a/span').inner_html\n else\n p \"it's all good homie.. here is actor _1 \"\n p actor_1\n end\n\n actors = [actor_1, actor_2, actor_3]\n\n p \"these are the main actors... \"\n p actors\n\n # characters = []\n # # char_1 = parse_page.xpath('//*[@id=\"titleCast\"]/table/tbody/tr[16]/td[4]/div/a')\n # char_1 = parse_page.xpath('//*[@id=\"titleCast\"]/table/tbody/tr[2]/td[4]/div/a').inner_html\n # char_2 = parse_page.xpath('//*[@id=\"titleCast\"]/table/tbody/tr[2]/td[4]').inner_html\n # # character_2 = parse_page.xpath('//*[@id=\"titleCast\"]/table/tbody/tr[3]/td[4]/div/a').inner_html\n # character_3 = parse_page.xpath('//*[@id=\"titleCast\"]/table/tbody/tr[4]/td[4]/div/a').inner_html\n # characters = [character_1, character_2, character_3]\n # p \"this the main characters... \"\n # p char_2\n\n # get rating\n rating = parse_page.xpath('//*[@id=\"title-overview-widget\"]/div[2]/div[2]/div/div[1]/div[1]/div[1]/strong/span').inner_html\n p \"this is the rating\"\n p rating\n new_rating = (rating.to_f)/10\n p \"this is the new rating\"\n p new_rating\n #GET TIME\n time = parse_page.xpath('//time').text.gsub(\"\\n\",'').strip[-7, 7]\n p \"this the time ... \"\n p time\n\n #GET plot\n # plot = parse_page.xpath('//*[@id=\"titleStoryLine\"]/div[1]/p').inner_html.gsub(\"\\n\",\" \")\n # plot = plot.split('<em', 2)\n # plot = plot[0].split('.',2)\n # plot_words = plot[1].scan(/\\w+ \\w+/)\n\n #GET keywords\n keywords = []\n kw_1 = parse_page.xpath('//*[@id=\"titleStoryLine\"]/div[2]/a[1]/span').inner_html\n kw_2 = parse_page.xpath('//*[@id=\"titleStoryLine\"]/div[2]/a[2]/span').inner_html\n kw_3 = parse_page.xpath('//*[@id=\"titleStoryLine\"]/div[2]/a[3]/span').inner_html\n kw_4 = parse_page.xpath('//*[@id=\"titleStoryLine\"]/div[2]/a[4]/span').inner_html\n keywords = [ kw_1,kw_2, kw_3, kw_4]\n p \"these are the keywords : \"\n p keywords\n\n # get tagline\n # tagline = parse_page.xpath('//*[@id=\"titleStoryLine\"]/div[3]').text\n # tagline = tagline.gsub(\"\\n\",\" \")\n # tagline = tagline.rpartition(\"Taglines:\")[2]\n # tagline = tagline.split(\"See more\")[0]\n\n\n #get review\n # review_page = movie_title.split('?', 2)\n # review_page = review_page[0] << \"reviews?ref_=tt_urv\"\n #\n # page = HTTParty.get(review_page)\n # # this is where we transform our http response into a nokogiri object so that we can parse it\n # parse_page = Nokogiri::HTML(page)\n # review = parse_page.xpath('//*[@id=\"tn15content\"]/p[10]').text.gsub(\"\\n\",\" \")\n\n\n movie_info = {\n time: time,\n actors: actors,\n # plot: plot,\n keywords: keywords,\n # characters: characters,\n director: director,\n movie_name: movie_name,\n # review: review,\n new_rating: new_rating,\n # tagline: tagline,\n }\n\n rescue\n end", "def get_film_info(film_link_array)\n film_link_array.map do |film_link|\n #puts film_link\n film_info = RestClient.get(film_link)\n film_info_hash = JSON.parse(film_info)\n end\nend", "def print_movies(films)\n # some iteration magic and puts out the movies in a nice list\n films.each do |film|\n puts \"---------- #{film[\"title\"]} ----------\\n\"\n #puts \"Title: #{film[\"title\"]}\"\n puts \"Episode: #{film[\"episode_id\"]}\"\n puts \"Director: #{film[\"director\"]}\"\n puts \"Producer(s): #{film[\"producer\"]}\"\n puts \"Release Date: #{film[\"release_date\"]}\"\n puts \"This move had: #{film[\"characters\"].length} character(s), #{film[\"species\"].length} specie(s) & #{film[\"planets\"].length} planet(s)!!\"\n\n # puts \"Opening Crawl: #{film[\"opening_crawl\"][0..100]}\" + \"...\"\n end\nend", "def movie_array(character)\n films_array = get_char_hash(character)[\"films\"]\n films_array.map do |movie_url|\n movie_info(movie_url)[\"title\"]\n end\nend", "def parse_character_movies(films_hash)\n # some iteration magic and puts out the movies in a nice list\nend", "def parse_api(link)\n movie_data ={}\n movie_url_link = RestClient.get(link)\n movie_data = JSON.parse(movie_url_link)\n # binding.pry\nend", "def parse_json(api)\n specific_movie = RestClient.get(api)\n movie_detail_hash = JSON.parse(specific_movie)\nend", "def print_movies(films)\n films.each do |film|\n puts film[\"title\"]\n end\nend", "def getMovieTitles titles\n url_base = URI('https://jsonmock.hackerrank.com/api/movies/search/?Title=spiderman&page=')\n page_num = 1\n limit = 100\n max_pages_reached = false\n while !max_pages_reached\n params = { :per_page => limit, :page => page_num }\n url_base.query = URI.encode_www_form(params)\n\n p url_base\n\n res = Net::HTTP.get_response(url_base)\n res_str = eval(res.body) if res.is_a?(Net::HTTPSuccess)\n res_str[:data].each { |v| titles << v[:Title] unless v[:Title].nil? }\n\n if params[:page] == res_str[:total_pages]\n max_pages_reached = true\n else\n page_num += 1\n end\n end\nend", "def parse_character_movies(films_hash)\n films_hash.each do |film|\n puts \"*\" * 20\n puts \"Title: #{film_title(film)}\"\n puts \"Episode: #{film_episode(film)}\"\n puts \"Director: #{film_director(film)}\"\n puts \"Producer(s): #{film_producer(film)}\"\n puts \"Release Date: #{film_release_date(film)}\"\n end\nend", "def find_movie_by_title(arg)\n query_response = RestClient.get(\"http://www.omdbapi.com/?t=#{arg}&apikey=a2d3299b\") #query the database\n parsed_response = JSON.parse(query_response) #parse the response into a useable hash\n movie_deets_hash = #extract relevant details from the hash\n {\"Title\" => parsed_response[\"Title\"],\n \"Released\" => parsed_response[\"Released\"].slice(-4..).to_i,\n \"Genre\" => parsed_response[\"Genre\"],\n \"Director\" => parsed_response[\"Director\"]}\n add_movie_to_database(movie_deets_hash) #create a movie_object for the selected movie, if it doesn't already exist\n end", "def get_movies\n\t\t@movies = Movie.order(\"RANDOM()\").where(\"release_date > ?\", 3.years.ago).order('random()').joins(:critic_movies).group('movies.id').having(\"count(movie_id) >= #{CUTOFF}\")\n\t\t.limit(750).to_a\n\t\t@movies.each do | movie | \n\t\t\tmovie.title = movie.title.split.map(&:capitalize).join(' ')\n\t\tend\n\t\t@movies = @movies.to_a.map(&:serializable_hash).to_json\n\t\trender :json => @movies\n\tend", "def fetchMovieRatingAndYear(movieID)\n #Construct the URL used to access the API\n url = \"http://api.themoviedb.org/3/movie/#{movieID}/releases?api_key=#{$apiKey}\"\n #RESTful request\n data = JSON.parse(RestClient.get(url))\n #Pull out the list of releases from the parsed request\n countries = data[\"countries\"]\n #Get just the US release (including date and rating info) and return it\n us = countries.select{ |country| country[\"iso_3166_1\"]==\"US\"}\n return us[0]\nend", "def get_data_from_api\n # address1 = address.parameterize('+')\n # state1 = state.parameterize('+')\n # city1 = city.parameterize('+')\n# \trequest_string = \"https://www.googleapis.com/civicinfo/v2/representatives/?address=#{address}%2C+#{city}%2C+#{state}%2C+#{zipcode}&levels=country&roles=legislatorLowerBody&key=AIzaSyDFYpjPCBUVQLyfS39-lBKRWCkD7-u4zug\" \n# \tcreates a url to access API data\n request_string = \"https://www.googleapis.com/civicinfo/v2/representatives/?address=9+Melrose+Dr.%2C+Livingston%2C+NJ%2C+07039&levels=country&roles=legislatorLowerBody&key=AIzaSyDFYpjPCBUVQLyfS39-lBKRWCkD7-u4zug\"\n\tsample_response = HTTParty.get(request_string) #go grab the data in the portal\n\tsample_parsedResponse = JSON.parse(sample_response.body, {:symbolize_names => true}) #makes data easy to read\n puts sample_parsedResponse[:officials][0][:name] \n puts sample_parsedResponse[:officials][0][:party] \n puts sample_parsedResponse[:officials][0][:phones] \n #returns first element in items array\n end", "def search_movies(name)\n # The TMDB api wrapper returns an instance of a 'results' object\n # This object (OpenStruct?) contains the meta data of the request made to the api\n # in a instance variable called table, which also contains a list of TMDB::Movie\n # Objects that represent the movies the api returned as results of the search\n\n # Store the raw results object from the api\n results_object = Tmdb::Search.movie(name)\n\n # Check if the part of the 'results' object that contains the actual list of movies\n # is empty and if it is return nil (Meaning movie was not found) and exit the function\n if results_object.instance_variable_get('@table')[:results][0] == nil\n return nil\n end\n\n # Strip the results object of the attributes and store them in the results hash\n results_hash = results_object.instance_variable_get('@table')\n # Get the list of movies and store them in an array\n movie_array = results_hash[:results]\n # map over the array to substitute a hash for each movie object containing only their\n # name and id (also stored under @table instance variable on the object)\n movie_array.map do |movie|\n {\n name: movie.instance_variable_get('@table')[:title],\n id: movie.instance_variable_get('@table')[:id]\n }\n end\n # returns the array\n end", "def print_movies(films)\n # some iteration magic and puts out the movies in a nice list\n films.each do |film_hash|\n puts film_hash[\"title\"]\n end\nend", "def get_all_characters(page=nil)\n\n if page\n response = RestClient.get(page)\n else\n response = RestClient.get(\"https://swapi.co/api/people\")\n end\n characters_array = JSON.parse(response.body)[\"results\"]\n\n characters_array.each do |character|\n StarWarsCliApi::Character.new(character)\n end\n\n # next_page = JSON.parse(response.body)[\"next\"]\n # if next_page\n # get_all_characters(next_page)\n # end\n end", "def index\n @movies = Movie.all\n\t# @alloCineJson = JSON.parse(open(\"http://api.allocine.fr/rest/v3/movielist?partner=YW5kcm9pZC12M3M&count=25&filter=nowshowing&order=toprank&format=json\").read)[\"feed\"]\n\t@alloCineJson = JSON.parse(open(\"http://api.allocine.fr/rest/v3/movielist?partner=YW5kcm9pZC12M3M&count=40&filter=nowshowing&order=toprank&format=json&profile=small\").read)[\"feed\"]\n\tresponse = {}\n\tmovies = []\n\t@alloCineJson[\"movie\"].each{ |mv|\n\t\tmovie=Movie.where(:alloCineCode => mv[\"code\"]).first\n\t\tif !movie\n\t\t\tmovie = Movie.create(:alloCineCode => mv[\"code\"], :title=>mv[\"title\"])\n\t\tend\n\t\tmovieHash = {}\n\t\tmovieHash[\"id\"] = movie.id\n\t\tmovieHash[\"code\"] = movie[\"title\"]\n\t\tmovieHash[\"code\"] = mv[\"title\"]\n\t\tmovieHash[\"title\"] = mv[\"title\"]\n\t\tmovieHash[\"poster\"] = mv[\"poster\"][\"href\"]\n\t\tmovies << movieHash\n\t}\n\tresponse[\"movies\"] = movies\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: response }\n end\n end", "def get_monster_info\n monster_string = RestClient.get('http://www.dnd5eapi.co/api/monsters/')\n monster_hash = JSON.parse(monster_string)\n monster_info = monster_hash[\"results\"]\n monster_info\nend", "def parse_character_movies(films_hash)\n films_hash.each do |film|\n puts # blank line\n puts \"Your character appears in:\"\n puts \"Star Wars Episode #{film[\"episode_id\"]}\"\n puts film[\"title\"]\n puts film[\"opening_crawl\"]\n end\nend", "def index\n console\n @api_key = ENV['OMDB_API_KEY']\n @searches = Search.all\n\n @title = \"\"\n @year = \"\"\n \n @movie = params[\"watchlist\"]\n \n if @movie.present?\n @title = @movie[\"title\"]\n @year = @movie[\"year\"]\n end\n\n unless @title.ascii_only? then\n @title = @title.delete!(\"^\\u{0000}-\\u{007F}\")\n end\n unless @year.ascii_only? then\n @year = @year.delete!(\"^\\u{0000}-\\u{007F}\")\n end\n \n if @year.nil?\n @datas = HTTParty.get('http://www.omdbapi.com/?apikey='+@api_key+'&t='+@title)\n elsif @title.nil?\n @datas = HTTParty.get('http://www.omdbapi.com/?apikey='+@api_key+'&y='+@year)\n elsif @title.nil? & @year.nil?\n @title = \"Avengers\" # Sample Movie from DataBase\n @year = \"2012\" # Sample Movie from DataBase\n @datas = HTTParty.get('http://www.omdbapi.com/?apikey='+@api_key+'&t='+@title+'&y='+@year)\n else\n @datas = HTTParty.get('http://www.omdbapi.com/?apikey='+@api_key+'&t='+@title+'&y='+@year)\n end\n \n #resp.body # => displays body of the response\n \n @parsed_json = JSON.parse(@datas.body) # => parses JSON if you need to parse it\n\n end", "def parse_character_movies(films_hash)\n films_hash.collect do |movie|\n movie[\"title\"]\n end\nend", "def show\n\t# require 'net/http'\n\trequire 'open-uri'\n\trequire 'json'\n\n @movie = Movie.find(params[:id])\n\tresponse = {}\n\t@alloCineJson = JSON.parse(open(\"http://api.allocine.fr/rest/v3/movie?partner=YW5kcm9pZC12M3M&format=json&filter=movie&profile=small&mediafmt=mp4&code=\"+ @movie.alloCineCode.to_s, :proxy => @@proxyUTC).read)[\"movie\"]\n\tresponse[\"title\"]=@alloCineJson[\"title\"]\n\tresponse[\"directors\"]=@alloCineJson[\"castingShort\"][\"directors\"]\n\tresponse[\"actors\"]=@alloCineJson[\"castingShort\"][\"actors\"]\n\tresponse[\"synopsisShort\"]=@alloCineJson[\"synopsisShort\"]\n\tresponse[\"releaseDate\"]=@alloCineJson[\"release\"][\"releaseDate\"]\n\tresponse[\"poster\"]=@alloCineJson[\"poster\"][\"href\"]\n\tresponse[\"runtime\"]=@alloCineJson[\"runtime\"]\n\t@trailerInfoJson = JSON.parse(open(\"http://api.allocine.fr/rest/v3/media?format=json&partner=aXBhZC12MQ&profile=small&mediafmt=mp4&code=\"+ @alloCineJson[\"trailer\"][\"code\"].to_s).read)[\"media\"]\n\tresponse[\"trailer\"]=@trailerInfoJson[\"rendition\"][0][\"href\"]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: response }\n end\n end", "def fetch_characters\n api = EVEAPI::API.new\n api.api_id = api_id\n api.v_code = v_code\n\n xml = api.get(\"account/APIKeyInfo\")\n characters = []\n xml.xpath(\"//row\").each do |row|\n characters << {\n :name => row['characterName'],\n :id => row['characterID'],\n :corporation_name => row['corporationName'],\n :corporation_id => row['corporationID'],\n :api_id => api_id,\n :v_code => v_code\n }\n end\n characters \n end", "def get_first_movies\n\t\t@movies = Movie.where(\"release_date > ?\", 3.years.ago).order('random()').joins(:critic_movies).group('movies.id').having(\"count(movie_id) > #{CUTOFF}\")\n\t\t.limit(1).to_a\n\t\t@movies.each do | movie | \n\t\t\tmovie.title = movie.title.split.map(&:capitalize).join(' ')\n\t\tend\n\t\t@movies = @movies.to_a.map(&:serializable_hash).to_json\n\t\trender :json => @movies\n\tend", "def get_latest_movies (vcdq_rss_url, movies_collection)\n # @TODO: Error checking.\n feed = Feedzirra::Feed.fetch_raw(vcdq_rss_url)\n feed_parsed = Feedzirra::Feed.parse(feed)\n\n current_date = Time.now\n\n i = 0\n feed_parsed.entries.each do |movie_item|\n movie_title_parts = movie_item.title.split('.')\n\n # puts movie_item\n $logger.debug(\"Processing title: #{movie_item.title}\")\n\n # Parse the title and categories for useful info.\n movie_info = get_movie_info(movie_title_parts, movie_item.categories)\n\n # If we couldn't parse any info, just log this incident and move on\n # @TODO: reformat to throw exception instead\n next if movie_info.nil?\n\n # Create a movie.\n movie_document_id = get_movie_document_id(movie_info[:title], movie_info[:year])\n movie = {\n _id: movie_document_id,\n title: movie_info[:title],\n title_lower: movie_info[:title].downcase,\n year: movie_info[:year],\n created: current_date,\n releases: Array.new\n }\n save_movie(movie, movies_collection)\n\n # Create a release\n release = {\n quality: movie_info[:quality],\n url: movie_item.url,\n date: movie_item.published,\n created: current_date\n }\n save_release(release, movie_document_id, movies_collection)\n\n # $logger.debug(\"Parsed movie info: #{movie_info}\")\n\n i += 1\n end\n\n $logger.debug(\"======== only #{i}/#{feed_parsed.entries.length} were good\")\nend", "def lookupMovie\n \n # Validation\n if self.tz_title.nil?\n logger.warn \"This movie doesn't have a title!\"\n return\n end\n \n if self.status == Movie::LOADED\n logger.warn \"This movie has already been loaded!\"\n return\n end\n \n logger.debug 'Loading movie...' + self.inspect\n begin\n # Search for the movie and grab the first result\n logger.debug \"Requesting the movie search URL...\" \n result = self.class.agent.get(Movie::ROTTEN_TOMATOES_SEARCH_URL + CGI::escape(self.tz_title))\n logger.debug \"Parsing result of RT search...\" \n doc = Nokogiri::HTML(Movie::EXTRACT_BODY_REGEX.match(result.body)[0])\n row = doc.css('#search_results_main table tbody tr:first')\n self.rt_link = Movie::ROTTEN_TOMATOES_URL + row.css('td:first a')[0]['href']\n self.year = row.css('td:last strong')[0].text.strip unless row.css('td:last strong')[0].nil?\n\n # Load the movie page\n result = self.class.agent.get(self.rt_link)\n body = Movie::EXTRACT_BODY_REGEX.match(result.body)[0]\n doc = Nokogiri::HTML(body)\n \n logger.debug \"Parsing the movie page...\"\n self.rt_title = doc.css('h1.movie_title')[0].content\n self.rt_img = doc.css('.movie_tools_area img:first')[0]['src'] unless doc.css('.movie_tools_area img:first')[0].nil?\n self.rt_rating = doc.css('#tomatometer_score span:first')[0].content unless doc.css('#tomatometer_score span:first')[0].nil?\n\n # Nokogiri gives encoding errors when outputting the contents of the #movie_info_box\n # so we have to use these convoluted regular expressions to get the content.\n #self.rt_info = Movie::EXTRACT_MOVIE_INFO_BOX.match(body)[0] #doc.css('#movie_info_box')[0].to_s unless doc.css('#movie_info_box')[0].nil?\n inner_divs = doc.css('#movie_info_box div').length\n rt_info = Movie::EXTRACT_MOVIE_INFO_REGEX.call(inner_divs).match(body)[0]\n rt_info.gsub!(Movie::EXTRACT_SCRIPT_REGEX, '')\n self.rt_info = rt_info\n \n rescue Exception\n logger.warn \"Failed loading movie #{self.tz_title} (Id: #{self.id}, Hash: #{self.tz_hash})\" \n self.status = Movie::FAILED\n \n else\n self.status = Movie::LOADED\n \n ensure\n self.save\n end\n\n self\n end", "def get_subjects(nums)\n subj_arr = []\n url_array = [\"http://www.swapi.co/api/people\", \"http://www.swapi.co/api/films\",\n \"http://www.swapi.co/api/planets\", \"http://www.swapi.co/api/starships\",\n \"http://www.swapi.co/api/species\"]\n api_array = [\"name\", \"title\", \"name\", \"name\", \"name\"]\n counter = 0\n counter2 = 0\n 10.times do\n if counter == 5\n counter = 0\n end\n url = url_array[counter] + \"/#{nums[counter2]}\"\n api_text = JSON.parse(RestClient.get(url.to_s))\n x = api_text[\"#{api_array[counter]}\"]\n subj_arr << x\n counter = counter + 1\n counter2 = counter2 + 1\n end # end of times loop\n subj_arr\n\nend", "def fetch_movie_data_and_cache_in_json_files\n query = Imdb::Top250.new\n movies = query.movies.map do |m|\n HTTParty.get(\"http://www.omdbapi.com/?i=tt#{m.id}&plot=short&r=json\")\n end\n movies = fetch_movie_data_from_list\n File.open('db/data/movie_data.json', 'w') { |file| file.write(movies.to_json) }\nend", "def scrape_movie(url)\n html_doc = parse_url(url)\n\n pattern = /^(?<title>.+)[[:space:]]\\((?<year>\\d{4})\\)$/\n\n match_data = html_doc.search(\"h1\").text.strip.match(pattern)\n title = match_data[:title]\n year = match_data[:year].to_i\n storyline = html_doc.search(\".summary_text\").text.strip\n director = html_doc.search(\".credit_summary_item a\").first.text\n\n cast_div = html_doc.search(\".credit_summary_item\")\n\n # cast = []\n # cast_div.last.search(\"a\").take(3).each do |element|\n # cast << element.text\n # end\n\n cast = cast_div.last.search(\"a\").take(3).map do |element|\n element.text\n end\n\n {\n title: title,\n year: year,\n storyline: storyline,\n director: director,\n cast: cast\n }\nend", "def view_api\n api_string = RestClient.get(\"https://itunes.apple.com/search?term=star+wars&entity=song&attribute=movieTerm\")\n api_hash = JSON.parse(api_string)\n\n end", "def parse_character_movies(films_array) #films_hash\n count = 1\n films_array.each do |current_film|\n puts \"#{count}. #{current_film['title']}, released: #{current_film['release_date']}\"\n count += 1\n end\nend", "def marvel_lookup(name)\n public_key = 'd7625a1b12e996ec43328e82331a3176'\n private_key = '2aa476235a3bfc3f78c873a80cd88ef1669d58a8'\n marvel_char = nil\n \n begin\n uri = URI('http://gateway.marvel.com/v1/public/characters')\n params = Hash.new\n params[\"apikey\"] = public_key\n params[\"ts\"] = ts\n params[\"hash\"] = request_hash(public_key,private_key)\n params[\"name\"] = name\n uri.query = URI.encode_www_form(params)\n \n res = Net::HTTP.get_response(uri)\n\n # puts \"response #{res.body}\"\n body_h = JSON.parse(res.body)\n #puts body_h\n res_arr = body_h[\"data\"][\"results\"]\n #puts res_arr\n res_arr.each do | char_item |\n #puts char_item\n marvel_char = Character.new\n marvel_char.marvel_id = char_item[\"id\"]\n marvel_char.name = char_item[\"name\"]\n marvel_char.desc = char_item[\"description\"]\n end\n rescue => e\n puts \"failed #{e}\"\n end\n marvel_char\n end", "def parse_api\n\t\t@api_data_on_electeds[\"results\"].map do |info|\n\t\t\tfirst_name = info[\"first_name\"]\n\t\t\tlast_name = info[\"last_name\"]\n\t\t\temail = info[\"oc_email\"]\n\t\t\tphone = info[\"phone\"]\n\t\t\ttwitter = info[\"twitter_id\"]\n\t\tputs \"Your elected official is #{first_name} #{last_name}. Their email is #{email} and you can call them at #{phone}. Also send them a tweet at @#{twitter}!\"\n\tend\nend", "def index\n # # if page value a param, use that, else ...\n # page = 3\n # request_url = MOVIE_DB_URL + \"&api_key=#{ENV[\"API_KEY\"]}\"\n genre_request_url = GENRE_URL + \"&api_key=#{ENV[\"API_KEY\"]}\"\n # request_url += \"&page=#{page}\"\n # if sort by release date\n # request_url += RELEASE_DATE_DESC_URL\n # if sort by title\n # request_url += RELEASE_DATE_DESC_URL;\n # @movies = Unirest.get(request_url).body[\"results\"]\n @genres = Unirest.get(genre_request_url).body[\"genres\"]\n # puts @genres\n end", "def similar_movie\n apikey = ENV['MOVIE_API_KEY']\n\n # pick random sample from list of liked movies\n seed = self.movies_liked.sample\n \n # collect movie JSON object of similar movies list\n similar_url = \"http://api.rottentomatoes.com/api/public/v1.0/movies/#{seed}/similar.json?limit=5&apikey=#{apikey}\"\n response = HTTParty.get(similar_url)\n json = JSON.parse(response.body)\n\n if json[\"movies\"].nil?\n #if the movies part of json is nil, return nil\n nil\n else\n # this function returns the first movie object whose id is neither not already in either the liked or disliked lists\n # it automatically returns 'nil' is no unique movie is found\n json[\"movies\"].detect { |m|\n !(self.movies_liked.include?(m[\"id\"])) and !(self.movies_disliked.include?(m[\"id\"]))\n }\n end\n\n end", "def pull_movies(options = {})\n response = HTTParty.get(build_url('movie', options), headers: HEADERS, debug_output: $stdout)\n JSON.parse(response.body)\n end", "def show\n tmdb_id = @movie.tmdb_id\n # mongo_movie = @cli[:TMDBMovies].find(:id => tmdb_id).first\n # @posters = mongo_movie[\"posters\"].uniq.take 5\n # videos = mongo_movie[\"youtube_trailers\"]\n # @urls = videos.map {|v| v[\"urL\"]}\n @crews = @movie.crew_relations.includes(:person).to_a\n @crews = @crews.take 5\n #@workers = @movie.crews\n @crews.sort_by! {|crew| crew.job} \n @casts = @movie.cast_relations.includes(:person).to_a\n @casts.reject! {|cast| cast.character.size == 0}\n @casts.sort_by! {|cast| cast.order}\n num = @movie.genres.size\n if num > 0\n rnd = Random.new\n offset = rnd.rand(num)\n @genre = @movie.genres[offset]\n @related_movies = @genre.movies.take 6\n @related_movies = @related_movies- [@movie]\n if @related_movies.size > 5\n @related_movies = @related_movies.take 5\n end\n else \n @related_movies = []\n end \n #@actors = @movie.casts\n end", "def basic_generate_all\r\n puts \"This is IMDb's Top 100 Scary Movie List....this could take a few minutes\"\r\n scraper = TopOneHundred::Scraper.new\r\n all_movies = scraper.initialize_all_movies\r\n all_movies.each{|movie| movie.print_details}\r\n all_movies\r\n end", "def index\n require 'json'\n \n AllgetsController.SetDefault(params[:query])\n AllgetsController.GetMembershipId()\n \n ##############Get Profile/clan ##########################\n @getProfile= AllgetsController.GetProfile()\n @getGroupID=AllgetsController.GetGroupID()\n \n ##############Get Character IDs/toons ##########################\n @arrayOfCharId = []\n @arrayOfCharId = AllgetsController.GetAllCharacterID()\n \n #Array of all toon for member\n @arrayOfCharacters = []\n @arrayOfCharacters = AllgetsController.GetCharacterID1()\n \n \n ################Disabled API Call #########################\n #@getActivityHistory = AllgetsController.GetActivityHistory()\n \n \n ################Debug section##############################disable when complete\n #puts @arrayOfCharacters\n #@getCharacterID2 = AllgetsController.GetCharacterID2()\n #@getCharacterID3 = AllgetsController.GetCharacterID3()\n \n \n \n #AllgetsController.GetCharacterStats()\n \n \n # @getAllCharacterID.each do |g|\n #puts g\n \n #end\n \n #getProfile()\n #getGroupID()\n #getGroupActivity()\n \n \n \n #puts hashConvert('4898834093')\n #matchMembership()\n \n #destinyRaceDefinition()\n \n \n \n end", "def get_uploads2( subscription_url )\n #raise ActiveSupport::Base64.decode64( subscription_url ).to_yaml\n movie = {}\n\n status = \"false\"\n count = ''\n upload_index = ''\n upload_counts = ''\n upload_index = \"1\"\n while status = \"false\"\n url = \"#{subscription_url}?start-index=#{upload_index}\"\n # uploadされている動画ごとのURLを配列で取得\n upload_counts,upload_index,item_counts_per_page,upload_feed_urls = \n get_uploads_entry_url( url )\n\n count = upload_counts - upload_index\n\n if item_counts_per_page > count\n status = \"true\"\n else\n upload_feed_urls.each do |upload_feed_url|\n upload_feed_xml = get_channnel_xml( upload_feed_url ) \n doc = REXML::Document.new( upload_feed_xml )\n # http://gdata.youtube.com/feeds/api/users/playyouhousejp/uploads/M8nu4gkOlbI\n id = doc.elements[\"/entry/id\"].text\n movie_title = doc.elements[\"/entry/media:group/media:title/\"].text\n movie_thumbnail = doc.elements[\"/entry/media:group/media:thumbnail/\"].attributes['url']\n movie_play_url = doc.elements[\"/entry/media:group/media:player/\"].attributes['url']\n\n # 各movie情報をIDをキーにして値に情報群のハッシュを配列構造を持たせる\n movie_array = [\n \"movie_title\" => movie_title,\n \"movie_thumbnail\" => movie_thumbnail,\n \"movie_play_url\" => movie_play_url,\n ]\n movie[\"#{id}\"] = movie_array\n end\n\n upload_index += 1\n end\n end\n\n return movie\n end", "def index\n page = 1\n request_url = MOVIE_DB_URL + \"&api_key=#{ENV[\"API_KEY\"]}\"\n request_url += \"&page=#{page}\"\n # if sort by release date\n # request_url += RELEASE_DATE_DESC_URL\n # if sort by title\n # request_url += RELEASE_DATE_DESC_URL;\n @movies = Unirest.get(request_url).body[\"results\"]\n end", "def search_by_keyword\n space(1)\n puts \"What do you want to search for?\"\n space(1)\n keyword = get_input\n url = \"https://app.ticketmaster.com/discovery/v2/events?apikey=pyLDDCYURYJ8LZfAUnOayESRsPBTWnKM&keyword=#{keyword}&locale=en&sort=date,asc\"\n response = RestClient.get(url)\n if JSON.parse(response)[\"_embedded\"][\"events\"]\n attractions = JSON.parse(response)[\"_embedded\"][\"events\"]\n attractions[0...20]\n else\n puts \"Sorry, your search returned no results. Try again.\"\n search_by_city\n end\nend", "def basic_generate_all\r\n puts \"This is IMDb's Top 100 Movie List.\"\r\n scraper = TopOneHundred::Scraper.new\r\n all_movies = scraper.initialize_all_movies\r\n all_movies.each{|movie| movie.print_details}\r\n all_movies\r\n end", "def scrape\n\tmonday = getMonday\n\n\t# create url to retrieve all movies from current date onwards\n\tallMoviesURL = getMoviesURL(monday)\n\t\n\t# retrieve page\n\tpage = Nokogiri::HTML(open(allMoviesURL))\n\n\t# select the movies\n\tmovieListingNodes = getMovieListingNodes(page)\n\n\t# parse the movies\n\tmovieListings = parseMovieListings(movieListingNodes)\n\t\n\treturn movieListings\nend", "def search_for_chars\n results = []\n response = client.characters(:nameStartsWith => user_search)\n response[\"data\"][\"results\"].each do |result|\n options = {}\n options[\"name\"] = result[\"name\"]\n if result[\"description\"] == \"\"\n options[\"description\"] = \"No description found\"\n else\n options[\"description\"] = result[\"description\"]\n end\n options[\"popularity\"] = result[\"comics\"][\"available\"]\n options[\"image\"] = result[\"thumbnail\"][\"path\"] + \".\" + result[\"thumbnail\"][\"extension\"] if result[\"thumbnail\"] != nil\n options[\"user_id\"] = user_id\n options[\"team_id\"] = 0\n results << Character.new(options)\n end\n results \n end", "def create\n # check if we want to bypass the API\n if movie_params[:bypassapi] == \"Bypass API\"\n @movie_info = movie_params.delete_if{|k,v| k == \"bypassapi\"}\n\n else\n # use the API and get the movie title via form\n if movie_params[:title].present?\n @movie_title = movie_params[:title].gsub(\" \",\"-\")\n @content = open(\"http://www.omdbapi.com/?t=#{@movie_title}&y=&plot=short&r=json\").read\n @results = JSON.parse(@content, symbolize_names: true)\n\n else\n @imdbID = movie_params[:imdbID]\n @content = open(\"http://www.omdbapi.com/?i=#{@imdbID}&plot=short&r=json\").read\n @results = JSON.parse(@content, symbolize_names: true)\n end\n\n # check if API has an error. if so, use movie_params\n if @results[:Error] == \"Movie not found!\"\n redirect_to new_movie_path, :alert => \"Title not found in the API. If you still want to add it,\n select the 'bypass the API' option\" and return\n\n else\n # parse the date\n @parsed_date = Date.new(movie_params[\"date_watched(1i)\"].to_i,\n movie_params[\"date_watched(2i)\"].to_i, movie_params[\"date_watched(3i)\"].to_i) unless ! movie_params[\"date_watched(1i)\"].present?\n\n # create the hash for the movie params\n @movie_info = { title: @results[:Title],\n imdb_url: \"http://www.imdb.com/title/#{@results[:imdbID]}/\",\n watch_url: movie_params[:watch_url],\n date_watched: @parsed_date,\n location_watched: movie_params[:location_watched],\n category_id: movie_params[:category_id],\n watchlist_id: movie_params[:watchlist_id],\n our_rating: movie_params[:our_rating],\n preview_link: movie_params[:preview_link],\n been_watched: movie_params[:been_watched],\n notes: movie_params[:notes],\n #imdb_artwork: @results[:Poster].gsub(\"N/A\", \"\"),\n imdb_artwork: \"http://img.omdbapi.com/?i=#{@results[:imdbID]}&apikey=#{ENV['poster_api_key']}\".gsub('N/A', ''),\n imdb_plot_summary: @results[:Plot],\n imdb_rating: @results[:imdbRating],\n imdb_genre: @results[:Genre],\n runtime: @results[:Runtime],\n year_released: @results[:Year],\n imdb_actors: @results[:Actors]}\n end #end of if/else based on API error\n end #end of if/else on whether or not to bypass the API\n\n # assign hash to a new movie object\n @movie = Movie.new(@movie_info)\n\n # save new movie object to the database\n respond_to do |format|\n if @movie.save\n format.html { redirect_to movies_url, notice: 'Movie was successfully created.' }\n format.json { render :show, status: :created, location: @movie }\n else\n format.html { render :new }\n format.json { render json: @movie.errors, status: :unprocessable_entity }\n end\n end\n end", "def main\n api = with_curl\n puts api.map { |api| api.slice 'html_url', 'full_name' }\nend", "def people\n Birdman::Requester.get(\"movies/#{id}/people\")\n end", "def pull_data\n @pulling = true\n\n model_updating\n\n # pull the page from the url\n page = Nokogiri::HTML(open(@url))\n \n # get the title for the film\n title = page.css(\"h1.film-title\").text\n define_singleton_method(:title, lambda{title})\n\n # get the runtime for the film\n runtime_cap = page.css(\".text-link\").text.match(/(\\d+) mins/)\n if runtime_cap\n runtime = runtime_cap.captures[0].to_i\n else\n runtime = 0\n end\n define_singleton_method(:runtime, lambda{runtime})\n\n # get the tagline for the film\n tagline = page.css(\".tagline\").text\n define_singleton_method(:tagline, lambda{tagline})\n\n # get the overview for the film\n overview = page.css(\"div.truncate\").text.strip\n define_singleton_method(:overview, lambda{overview})\n \n @pulled = true\n @pulling = false\n\n model_updated\n end", "def get_in_theaters\n\t\taction = \"movie/now_playing\"\n\t\targument = \"&language=en-US&page=1\"\n\t\tresponse = call_api(action, argument)\n\t\tmovies = process_results(response[\"results\"])\n\tend" ]
[ "0.9170631", "0.9160304", "0.8702584", "0.869801", "0.8504424", "0.8498081", "0.84607214", "0.84102666", "0.83005595", "0.8273107", "0.826059", "0.82492983", "0.82469255", "0.82446903", "0.8232902", "0.8192176", "0.8160529", "0.8107744", "0.8063357", "0.80191046", "0.79642296", "0.7858037", "0.7784667", "0.77332854", "0.7695749", "0.7420691", "0.73942816", "0.73534226", "0.73524386", "0.73036224", "0.72313935", "0.72056174", "0.72038525", "0.719245", "0.7181781", "0.7142033", "0.713475", "0.7113559", "0.7090546", "0.70729876", "0.70427674", "0.6997283", "0.6963223", "0.69041044", "0.69025046", "0.68958193", "0.6894412", "0.6822641", "0.68182796", "0.6818231", "0.67269033", "0.6687837", "0.66835254", "0.6633414", "0.66324776", "0.65694845", "0.6536993", "0.6527971", "0.65172255", "0.6509828", "0.6504812", "0.6500939", "0.6485776", "0.6438014", "0.63931143", "0.6378622", "0.6368676", "0.636515", "0.6340258", "0.63225436", "0.63019335", "0.6292992", "0.623688", "0.61650467", "0.61401683", "0.613712", "0.6123554", "0.61194074", "0.60941845", "0.60924214", "0.60377693", "0.6029481", "0.60262644", "0.6001024", "0.5995262", "0.5993847", "0.5974154", "0.5961083", "0.5950327", "0.59418815", "0.5929684", "0.5915395", "0.5896499", "0.5892679", "0.5890646", "0.58889455", "0.5882475", "0.58627677", "0.586039", "0.5849715", "0.58494145" ]
0.0
-1
GET /participant_quotes GET /participant_quotes.json
def index @participant_quotes = ParticipantQuote.all respond_to do |format| format.html # index.html.erb format.json { render json: @participant_quotes } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @participant_quote = ParticipantQuote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant_quote }\n end\n end", "def destroy\n @participant_quote = ParticipantQuote.find(params[:id])\n @participant_quote.destroy\n\n respond_to do |format|\n format.html { redirect_to participant_quotes_url }\n format.json { head :no_content }\n end\n end", "def quotes\n fetch('community.quotes')\n end", "def create\n @participant_quote = ParticipantQuote.new(params[:participant_quote])\n @participant_quote.user_id = current_user.id\n\n respond_to do |format|\n if @participant_quote.save\n format.html { redirect_to @participant_quote, notice: 'Participant quote was successfully created.' }\n format.json { render json: @participant_quote, status: :created, location: @participant_quote }\n else\n format.html { render :new }\n format.json { render json: @participant_quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def quote\n fetch('heroes_of_the_storm.quotes')\n end", "def quotes(**args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/quotes/latest\", options: params.compact).tap do |resp|\n resp.body = [resp.body]\n end\n end", "def quotes(args)\n if args.is_a?(Integer)\n get(\"/markets/quotes/#{args}\")['quotes']\n elsif args.is_a?(Array)\n get(\"/markets/quotes?ids=#{args.join(',')}\")['quotes']\n else\n fail \"Malformed argument: #{args}\"\n end\n end", "def new\n @participant_quote = ParticipantQuote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participant_quote }\n end\n end", "def quote\n fetch('princess_bride.quotes')\n end", "def index\n @quotes = Quote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @quotes }\n end\n end", "def quote\n fetch('harry_potter.quotes')\n end", "def show\n # Se o array de quotes for maior que zero, significa que as frases foram trazidas do banco de\n # dados\n if @quotes.size == 0\n # caso o array de quotes tenha tamanho zero, será feita a pesquisa das frase no \n # site http://quotes.toscrape.com/\n @quotes = WebCrawler.request(params[:tag].downcase)\n # Caso ocorra algum erro na pesquisa, é retornada uma lista vazia\n if @quotes == nil\n @quotes = []\n end\n end\n render json: {'quotes': @quotes.as_json.each{ |item| item.delete(\"_id\")}}, adapter: :json\n end", "def quote\n fetch('v_for_vendetta.quotes')\n end", "def quote\n fetch('hey_arnold.quotes')\n end", "def show\n quote = Quote.find(params[:id])\n render json: quote\n end", "def quote\n fetch('new_girl.quotes')\n end", "def index\n @quotes = current_user.quotes.all\n end", "def index\n @quotes = Quote.order('created_at DESC')\n @quote = Quote.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @quotes }\n end\n end", "def quote\n fetch('rick_and_morty.quotes')\n end", "def show\n quotes = OriginalQuote.all\n @quote = quotes.sample\n render json: @quote, status: 200\n end", "def index\n @quotes = @quotes.order(\"created_at DESC\")\n respond_with(@quotes)\n end", "def quote\n fetch('games.street_fighter.quotes')\n end", "def index\r\n @quote.get_a_quote\r\n @quotes = Quote.all\r\n end", "def show\n @quote = Quote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quote }\n end\n end", "def show\n @quote = Quote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quote }\n end\n end", "def show\n @quote = Quote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quote }\n end\n end", "def quote\n fetch('the_office.quotes')\n end", "def quote\n fetch('brooklyn_nine_nine.quotes')\n end", "def show\n @quote = Quote.first\n render json: @quote\n end", "def quote\n fetch('dumb_and_dumber.quotes')\n end", "def index\n @quote_list = QuoteList.find(params[:quote_list_id])\n @quotes = @quote_list.quotes.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @quotes }\n end\n end", "def show\n @quote_detail = QuoteDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quote_detail }\n end\n end", "def create\n @client=Client.find_by_id(params['q_param']['client'])\n title=params['q_param']['title']\n comment=params['q_param']['comment']\n list = [[\"\",\"\",\"1\",\"\"]]\n quote_p={:title=>title,:comment=>comment, :status=>1, :list=>list}\n @quote = @client.quotes.create(quote_p)\n render json: {:quote_id=>@quote.id}\n\n # respond_to do |format|\n # if @quote.save\n # format.html { redirect_to index, notice: 'Quote was successfully created.' }\n # # format.json { render action: 'show', status: :created, location: @quote }\n # else\n # format.html { render action: 'new' }\n # # format.json { render json: @quote.errors, status: :unprocessable_entity }\n # end\n # end\nend", "def index\n @quotes = Quote.all\n end", "def index\n @quotes = Quote.all\n end", "def index\n @quotes = Quote.all\n end", "def index\n @quotes = Quote.all\n end", "def quote\n fetch('simpsons.quotes')\n end", "def show\n\t\trender json: @participant\n\tend", "def index\n if params['length'].to_i & params['length'].to_i != 0\n @quotes = Quote.all.shuffle.first(params['length'].to_i)\n else\n @quotes = Quote.all.shuffle\n end\n\n #@quotes = Quote.all\n \n respond_to do |format|\n format.html\n format.json { render json: {:data => { :quotes => @quotes}, :result => { :errorcode => \"\", :messages => \"ok\", :rstatus => 1 }} }\n end\n end", "def create\n @quote.save\n respond_with(@quote, :location => person_quotes_path(@person))\n end", "def quotes_by_author\n @quotes = Quote.where(:author_slug => params[:name]).paginate(:page => params[:page], :per_page => 15)\n @author = @quotes.first.author unless @quotes.empty?\n respond_to do |format|\n format.html # show.html.erb\n format.js\n format.json { render json: @quote }\n end\n end", "def update\n @participant_quote = ParticipantQuote.find(params[:id])\n\n respond_to do |format|\n if @participant_quote.update_attributes(params[:participant_quote])\n format.html { redirect_to @participant_quote, notice: 'Participant quote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @participant_quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @favorite_quotes = FavoriteQuotes.find params[:id]\n end", "def index\n @incidents = @quote.incidents.all\n respond_to do |format|\n format.json { render :json => @incidents }\n end\n end", "def index\n @quotes = Quote.all\n end", "def quotations\n response = self.class.get('/quotations', OPTIONS)\n\n if response.success?\n parse_quotations(response)\n else\n []\n end\n end", "def show\n @quote_list = QuoteList.find(params[:quote_list_id])\n @quote = @quote_list.quotes.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @quote }\n end\n end", "def index\n @quotes = Quote.where(\"receiver_id = ? OR sender_id = ?\",current_user.id,current_user.id)\n end", "def quote\n @quote ||= Quote.get(params[:id])\n end", "def index\n if params[:book_id]\n @quotes = Book.find(params[:book_id]).quotes\n elsif params[:tag]\n @quotes = Quote.tagged_with(params[:tag]).order(:created_at)\n else\n @quotes = Quote.order(:created_at).limit(50)\n end\n respond_with(quotes: @quotes)\n end", "def create\n @quote = current_user.quotes.new(quote_params)\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Quote was successfully created.' }\n format.json { render :show, status: :created, location: @quote }\n else\n format.html { render :new }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_ticker_tape_info \n yahoo_client = YahooFinance::Client.new\n @ticker_data = yahoo_client.quotes([\"^GSPC\", \"^IXIC\", \"CL=F\", \"GC=F\", \"EURUSD=X\"], [:last_trade_price, :change, :change_in_percent])\n respond_to do |format|\n format.json { render json: @ticker_data, status: :ok }\n format.html { @ticker_data }\n end\n end", "def create\n @quoteable = find_quoteable\n @quote = @quoteable.quotes.build(params[:quote])\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Quote was successfully created.' }\n format.json { render json: @quote, status: :created, location: @quote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def search\n @quotes = QuoteCrawler.search_crawler(params[:search_tag])\n render json: @quotes, status: :ok\n end", "def index\n add_breadcrumb \"Your Quotes\"\n\n if current_admin\n @quotes = Quote.all\n @users = User.all\n else\n if user_signed_in? && current_user != []\n @quotes = current_user.quotes.all\n else\n respond_to do |format|\n format.html { redirect_to home_index_url, notice: \"There are no quotes created under your account\" }\n format.json { render notice: \"There are no quotes created under your account\", status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n quote = Quote.create({\n quote_text: params[:quote_text],\n author: params[:author]\n })\n render json: quote\n end", "def surveys\n person_id = params[:person_id]\n \n surveys = SurveyService.findSurveysForPerson person_id\n \n render json: surveys.to_json, :content_type => 'application/json'\n end", "def quote\n fetch('ghostbusters.quotes')\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kid_quote }\n end\n end", "def quote\n fetch('movie.quote')\n end", "def show\n @stock = Stock.find(params[:id])\n @quote = YahooFinance::get_standard_quotes(@stock.ticker)[@stock.ticker]\n @tweets = Twitter.search('$' + @stock.ticker).results\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end", "def quote\n fetch('stargate.quotes')\n end", "def index\n @favorite_quotes = FavoriteQuotes.all\n end", "def quotes_historical(**args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/quotes/historical\", options: params.compact).tap do |resp|\n resp.body = resp.body[:quotes]\n end\n end", "def show\n if signed_in?\n @quote = Quote.find_by_id(params[:id])\n else\n @quote = Quote.approved.find_by_id(params[:id])\n end\n\n respond_to do |format|\n unless @quote.nil?\n format.json { render :show, status: :ok, location: @quote }\n else\n format.json { render :show, status: :not_found }\n end\n end\n end", "def show\n @wedding_planner_quote = WeddingPlannerQuote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wedding_planner_quote }\n end\n end", "def index\n @favorite_quotes = FavoriteQuote.all\n end", "def index\n @trades = Trade\n .only(:created_at, :is_fair, :ash_pokemons, :brock_pokemons)\n respond_to do |format|\n format.json { render json: @trades }\n end\n end", "def show\n @quote = Quote.new\n @review = Review.new\n @accepted_quote = @service_request.quotes.find_by(status: \"Accepted\")\n @completed_quote = @service_request.quotes.find_by(status: \"Completed\")\n end", "def show\n @users = User.order(:id)\n @quotes = Quote.all\n end", "def index\n @quote_lines = QuoteLine.all\n end", "def create\n @quote = Quote.new(params[:quote])\n @quote.user_id = current_user.id\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Quote was successfully created.' }\n format.json { render json: @quote, status: :created, location: @quote }\n else\n @quotes = Quote.all\n format.html { render action: \"index\" }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n\t\t@participants = Participant.all\n\n\t\trender json: @participants\n\tend", "def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end", "def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end", "def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end", "def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end", "def quote\n fetch('games.league_of_legends.quote')\n end", "def show\n @quarter = Quarter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quarter }\n end\n end", "def show\n @participant = Participant.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end", "def fetch_quote\n uri = URI('http://www.iheartquotes.com/api/v1/random?format=text&max_lines=4&max_characters=320')\n #open(@url).read.to_s\n req = Net::HTTP.get(uri)\n #puts req\n end", "def show\n @thought = Thought.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @thought }\n end\n end", "def show\n respond_with(@quote)\n end", "def index\n @trades = Trade.all\n render json: @trades\n end", "def destroy\n @quote.destroy\n respond_with(@quote, :location => person_quotes_path(@person))\n end", "def couch_read_quotes(limit = 5)\n server = Couch::Server.new(Couchdb_server, Couchdb_server_port, Couchdb_user, Couchdb_password)\n response = server.get(\"#{Couchdb_db_path}/_design/quotes/_view/sortedByDate?include_docs=true&descending=true&limit=#{limit}\")\n # response = server.get(\"#{Couchdb_db_path}/_all_docs?include_docs=true&limit=#{limit}\")\n response = JSON.parse(response.body)\n\n # read all documents and create a QuotedArticle for them\n docs = response[\"rows\"].map do |d|\n # d[\"doc\"]\n QuotedArticle.new(d[\"doc\"])\n end\n\n return docs\n end", "def show\n @price_quote = PriceQuote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @price_quote }\n end\n end", "def quotes_historical(**args)\n valid_params?(args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/quotes/historical\", options: params.compact).tap do |resp|\n resp.body = [resp.body]\n end\n end", "def quotes_historical(**args)\n valid_params?(args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/quotes/historical\", options: params.compact).tap do |resp|\n resp.body = [resp.body]\n end\n end", "def index\n @quotes = Quote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @quotes }\n end\n end", "def show\n @quartet = Quartet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quartet }\n end\n end", "def index\n @quotes = Quote.order(:created_at => :desc).paginate(page: params[:page], per_page: 12)\n # @quotes = Quote.paginate(page: params[:page], per_page: 12)\n end", "def set_quote\n @quotes= Quote.find(params[:id])\n end", "def create\n text = quote_params[:text]\n\n if text == 'help' or text == ''\n json = { text: \"Utilize o comando `/novaquotes` para salvar frases ou citações hilárias que aconteceram na Novatics.\\nAlguns exemplos:\\n•`/novaquotes` Só sei que nada sei.\\n•`/novaquotes` Com grandes poderes vem grandes responsabilidades.\\n\\nPara abrir este menu de ajuda, use `/novaquotes help`.\\nPara ver todas as frases salvas: http://novaquote.herokuapp.com\" }\n respond_to { |format| format.json { render json: json, status: :ok, location: @quote } }\n return\n end\n\n begin\n user = get_user_profile(quote_params)\n rescue Exception => e\n json = { text: \"Ocorreu um erro: #{e.message}\" }\n respond_to { |format| format.json { render json: json, status: :ok, location: @quote } }\n return\n end\n\n phrase = text.capitalize\n @quote = Quote.new(author: user['real_name'], message: phrase, image: user['image_32'])\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Frase adicionada com sucesso.' }\n\n json = {\n text: \"Frase adicionada: #{phrase}.\",\n attachments: [{\n title: \"Ver todas as frases\",\n title_link: \"http://novaquote.herokuapp.com\",\n }]\n }\n format.json { render json: json, status: :ok, location: @quote }\n else\n format.html { render :new }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @favorite_quotes = FavoriteQuotes.new(favorite_quote_params)\n\n respond_to do |format|\n if @favorite_quotes.save\n format.html { redirect_to @favorite_quote, notice: 'Favorite quote was successfully created.' }\n format.json { render action: 'show', status: :created, location: @favorite_quote }\n else\n format.html { render action: 'new' }\n format.json { render json: @favorite_quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @quoteable = find_quoteable\n @quote = Quote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quote }\n end\n end", "def index\n @participates = Participate.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @participates }\n end\n end", "def show\n @trade = owned_trades_view.find(params[:id])\n\n # using render: @trade assumes that there is a route named trade_path,\n render json: @trade\n end", "def show_rounds\n\t\t@rounds = @participant.rounds\n\t\trender json: @rounds\n\tend" ]
[ "0.7152615", "0.6397558", "0.6345617", "0.6281185", "0.6272502", "0.62399006", "0.6232049", "0.62028545", "0.6193352", "0.61696094", "0.60210025", "0.60089386", "0.5990835", "0.5953325", "0.59272003", "0.59262174", "0.59074295", "0.59029293", "0.5901017", "0.5898677", "0.5870026", "0.58322674", "0.5782054", "0.57645106", "0.57645106", "0.57645106", "0.5748669", "0.57476103", "0.5730743", "0.56639045", "0.5634238", "0.56172866", "0.55909455", "0.55595577", "0.55595577", "0.55595577", "0.55595577", "0.55474997", "0.5547165", "0.5541382", "0.5533281", "0.55323756", "0.5526711", "0.54647857", "0.5459849", "0.5458324", "0.5448438", "0.5436354", "0.541775", "0.5400832", "0.5399539", "0.53986555", "0.53744", "0.5372608", "0.537155", "0.5370193", "0.53682625", "0.5361599", "0.5359078", "0.53425854", "0.53408045", "0.53402597", "0.53395295", "0.53289664", "0.5324267", "0.531309", "0.5312255", "0.5307309", "0.5301325", "0.52881354", "0.52815294", "0.52808094", "0.52796304", "0.5265779", "0.5261777", "0.5261777", "0.5261777", "0.5261777", "0.5259326", "0.5256826", "0.5250398", "0.52146685", "0.52142686", "0.520493", "0.5197418", "0.5195309", "0.5193475", "0.51827633", "0.51794034", "0.51794034", "0.5179244", "0.5172607", "0.51719046", "0.5167971", "0.5153662", "0.5150092", "0.514755", "0.5142472", "0.51404685", "0.513968" ]
0.75764847
0
GET /participant_quotes/1 GET /participant_quotes/1.json
def show @participant_quote = ParticipantQuote.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @participant_quote } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @participant_quotes = ParticipantQuote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @participant_quotes }\n end\n end", "def destroy\n @participant_quote = ParticipantQuote.find(params[:id])\n @participant_quote.destroy\n\n respond_to do |format|\n format.html { redirect_to participant_quotes_url }\n format.json { head :no_content }\n end\n end", "def new\n @participant_quote = ParticipantQuote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participant_quote }\n end\n end", "def create\n @participant_quote = ParticipantQuote.new(params[:participant_quote])\n @participant_quote.user_id = current_user.id\n\n respond_to do |format|\n if @participant_quote.save\n format.html { redirect_to @participant_quote, notice: 'Participant quote was successfully created.' }\n format.json { render json: @participant_quote, status: :created, location: @participant_quote }\n else\n format.html { render :new }\n format.json { render json: @participant_quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def quotes(**args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/quotes/latest\", options: params.compact).tap do |resp|\n resp.body = [resp.body]\n end\n end", "def show\n quote = Quote.find(params[:id])\n render json: quote\n end", "def index\n @quotes = Quote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @quotes }\n end\n end", "def quote\n fetch('princess_bride.quotes')\n end", "def quote\n fetch('heroes_of_the_storm.quotes')\n end", "def show\n quotes = OriginalQuote.all\n @quote = quotes.sample\n render json: @quote, status: 200\n end", "def show\n @quote = Quote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quote }\n end\n end", "def show\n @quote = Quote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quote }\n end\n end", "def show\n @quote = Quote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quote }\n end\n end", "def quotes(args)\n if args.is_a?(Integer)\n get(\"/markets/quotes/#{args}\")['quotes']\n elsif args.is_a?(Array)\n get(\"/markets/quotes?ids=#{args.join(',')}\")['quotes']\n else\n fail \"Malformed argument: #{args}\"\n end\n end", "def quotes\n fetch('community.quotes')\n end", "def index\n @quotes = Quote.order('created_at DESC')\n @quote = Quote.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @quotes }\n end\n end", "def show\n @quote = Quote.first\n render json: @quote\n end", "def show\n @quote_detail = QuoteDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quote_detail }\n end\n end", "def quote\n fetch('hey_arnold.quotes')\n end", "def quote\n fetch('harry_potter.quotes')\n end", "def quote\n fetch('new_girl.quotes')\n end", "def quote\n fetch('v_for_vendetta.quotes')\n end", "def index\n @quotes = @quotes.order(\"created_at DESC\")\n respond_with(@quotes)\n end", "def show\n # Se o array de quotes for maior que zero, significa que as frases foram trazidas do banco de\n # dados\n if @quotes.size == 0\n # caso o array de quotes tenha tamanho zero, será feita a pesquisa das frase no \n # site http://quotes.toscrape.com/\n @quotes = WebCrawler.request(params[:tag].downcase)\n # Caso ocorra algum erro na pesquisa, é retornada uma lista vazia\n if @quotes == nil\n @quotes = []\n end\n end\n render json: {'quotes': @quotes.as_json.each{ |item| item.delete(\"_id\")}}, adapter: :json\n end", "def create\n @client=Client.find_by_id(params['q_param']['client'])\n title=params['q_param']['title']\n comment=params['q_param']['comment']\n list = [[\"\",\"\",\"1\",\"\"]]\n quote_p={:title=>title,:comment=>comment, :status=>1, :list=>list}\n @quote = @client.quotes.create(quote_p)\n render json: {:quote_id=>@quote.id}\n\n # respond_to do |format|\n # if @quote.save\n # format.html { redirect_to index, notice: 'Quote was successfully created.' }\n # # format.json { render action: 'show', status: :created, location: @quote }\n # else\n # format.html { render action: 'new' }\n # # format.json { render json: @quote.errors, status: :unprocessable_entity }\n # end\n # end\nend", "def quote\n fetch('rick_and_morty.quotes')\n end", "def update\n @participant_quote = ParticipantQuote.find(params[:id])\n\n respond_to do |format|\n if @participant_quote.update_attributes(params[:participant_quote])\n format.html { redirect_to @participant_quote, notice: 'Participant quote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @participant_quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\r\n @quote.get_a_quote\r\n @quotes = Quote.all\r\n end", "def index\n if params['length'].to_i & params['length'].to_i != 0\n @quotes = Quote.all.shuffle.first(params['length'].to_i)\n else\n @quotes = Quote.all.shuffle\n end\n\n #@quotes = Quote.all\n \n respond_to do |format|\n format.html\n format.json { render json: {:data => { :quotes => @quotes}, :result => { :errorcode => \"\", :messages => \"ok\", :rstatus => 1 }} }\n end\n end", "def quote\n @quote ||= Quote.get(params[:id])\n end", "def quote\n fetch('brooklyn_nine_nine.quotes')\n end", "def index\n @quotes = current_user.quotes.all\n end", "def create\n @quote.save\n respond_with(@quote, :location => person_quotes_path(@person))\n end", "def quote\n fetch('games.street_fighter.quotes')\n end", "def quote\n fetch('dumb_and_dumber.quotes')\n end", "def show\n @quote_list = QuoteList.find(params[:quote_list_id])\n @quote = @quote_list.quotes.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @quote }\n end\n end", "def show\n @favorite_quotes = FavoriteQuotes.find params[:id]\n end", "def quote\n fetch('the_office.quotes')\n end", "def index\n @quote_list = QuoteList.find(params[:quote_list_id])\n @quotes = @quote_list.quotes.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @quotes }\n end\n end", "def get_ticker_tape_info \n yahoo_client = YahooFinance::Client.new\n @ticker_data = yahoo_client.quotes([\"^GSPC\", \"^IXIC\", \"CL=F\", \"GC=F\", \"EURUSD=X\"], [:last_trade_price, :change, :change_in_percent])\n respond_to do |format|\n format.json { render json: @ticker_data, status: :ok }\n format.html { @ticker_data }\n end\n end", "def get_one\n question_data = Question.new.get_one( params[:id] )\n return render json: question_data\n end", "def create\n @quoteable = find_quoteable\n @quote = @quoteable.quotes.build(params[:quote])\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Quote was successfully created.' }\n format.json { render json: @quote, status: :created, location: @quote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kid_quote }\n end\n end", "def index\n @quotes = Quote.all\n end", "def index\n @quotes = Quote.all\n end", "def index\n @quotes = Quote.all\n end", "def index\n @quotes = Quote.all\n end", "def quotes_by_author\n @quotes = Quote.where(:author_slug => params[:name]).paginate(:page => params[:page], :per_page => 15)\n @author = @quotes.first.author unless @quotes.empty?\n respond_to do |format|\n format.html # show.html.erb\n format.js\n format.json { render json: @quote }\n end\n end", "def show\n @price_quote = PriceQuote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @price_quote }\n end\n end", "def show\n @wedding_planner_quote = WeddingPlannerQuote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wedding_planner_quote }\n end\n end", "def show\n @quote = Quote.new\n @review = Review.new\n @accepted_quote = @service_request.quotes.find_by(status: \"Accepted\")\n @completed_quote = @service_request.quotes.find_by(status: \"Completed\")\n end", "def show\n\t\trender json: @participant\n\tend", "def quote\n fetch('simpsons.quotes')\n end", "def show\n @quarter = Quarter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quarter }\n end\n end", "def fetch_quote\n uri = URI('http://www.iheartquotes.com/api/v1/random?format=text&max_lines=4&max_characters=320')\n #open(@url).read.to_s\n req = Net::HTTP.get(uri)\n #puts req\n end", "def new\n @quoteable = find_quoteable\n @quote = Quote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quote }\n end\n end", "def edit\n quote = Quote.find(params[:id])\n url = \"quotes/#{params[:id]}\"\n render :json => {:data => quote, :url => url}\n end", "def create\n @quote = current_user.quotes.new(quote_params)\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Quote was successfully created.' }\n format.json { render :show, status: :created, location: @quote }\n else\n format.html { render :new }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @incidents = @quote.incidents.all\n respond_to do |format|\n format.json { render :json => @incidents }\n end\n end", "def show\n if signed_in?\n @quote = Quote.find_by_id(params[:id])\n else\n @quote = Quote.approved.find_by_id(params[:id])\n end\n\n respond_to do |format|\n unless @quote.nil?\n format.json { render :show, status: :ok, location: @quote }\n else\n format.json { render :show, status: :not_found }\n end\n end\n end", "def show\n @stock = Stock.find(params[:id])\n @quote = YahooFinance::get_standard_quotes(@stock.ticker)[@stock.ticker]\n @tweets = Twitter.search('$' + @stock.ticker).results\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end", "def index\n @quotes = Quote.all\n end", "def show\n @thought = Thought.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @thought }\n end\n end", "def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end", "def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end", "def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end", "def show\n @participant = Participant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end", "def create\n @quote = Quote.new(params[:quote])\n @quote.user_id = current_user.id\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Quote was successfully created.' }\n format.json { render json: @quote, status: :created, location: @quote }\n else\n @quotes = Quote.all\n format.html { render action: \"index\" }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @participant = Participant.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant }\n end\n end", "def index\n @quotes = Quote.where(\"receiver_id = ? OR sender_id = ?\",current_user.id,current_user.id)\n end", "def create\n quote = Quote.create({\n quote_text: params[:quote_text],\n author: params[:author]\n })\n render json: quote\n end", "def show\n @quize = Quize.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quize }\n end\n end", "def destroy\n @quote = Quote.find(params[:id])\n @quote.destroy\n\n respond_to do |format|\n format.html { redirect_to quotes_url }\n format.json { head :ok }\n end\n end", "def set_quote\n @quotes= Quote.find(params[:id])\n end", "def specific_quote(id)\n quote = @db.get_first_value(\"SELECT quote FROM quotes WHERE id = ? LIMIT 1;\",id)\n return quote\n end", "def new\n @quote = Quote.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quote }\n end\n end", "def destroy\n @quote = Quote.find(params[:id])\n @quote.destroy\n respond_to do |format|\n format.html { redirect_to quotes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quote = Quote.find(params[:id])\n @quote.destroy\n\n respond_to do |format|\n format.html { redirect_to quotes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quote = Quote.find(params[:id])\n @quote.destroy\n\n respond_to do |format|\n format.html { redirect_to quotes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quote = Quote.find(params[:id])\n @quote.destroy\n\n respond_to do |format|\n format.html { redirect_to quotes_url }\n format.json { head :no_content }\n end\n end", "def show\n respond_with(@quote)\n end", "def mad_orig\n mad_quotes = MadQuote.all\n mad_quote = mad_quotes.sample\n orig_quote = OriginalQuote.where(id: mad_quote.original_quote_id)\n render json: [mad_quote, orig_quote], status: 200\n end", "def show\n @quartet = Quartet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @quartet }\n end\n end", "def quote\n fetch('ghostbusters.quotes')\n end", "def show\n @customer_quote = CustomerQuote.find(params[:customer_quote_id])\n @customer_quote_line = @customer_quote.customer_quote_lines.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @customer_quote_line }\n end\n end", "def surveys\n person_id = params[:person_id]\n \n surveys = SurveyService.findSurveysForPerson person_id\n \n render json: surveys.to_json, :content_type => 'application/json'\n end", "def quotes_historical(**args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/quotes/historical\", options: params.compact).tap do |resp|\n resp.body = resp.body[:quotes]\n end\n end", "def getQuartier\r\n \tarrondissement = params[:id]\r\n \trender json: Quartier.where(arrondissement_id: arrondissement)\r\n end", "def show\n @quote = Quote.find(params[:quote_id])\n @quote_vendor = @quote.quote_vendors.find(params[:id])\n @attachable = @quote_vendor\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @quote_vendor }\n end\n end", "def show\n @qu = Qu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @qu }\n end\n end", "def create\n @favorite_quotes = FavoriteQuotes.new(favorite_quote_params)\n\n respond_to do |format|\n if @favorite_quotes.save\n format.html { redirect_to @favorite_quote, notice: 'Favorite quote was successfully created.' }\n format.json { render action: 'show', status: :created, location: @favorite_quote }\n else\n format.html { render action: 'new' }\n format.json { render json: @favorite_quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def quote\n fetch('movie.quote')\n end", "def show\n @trade = owned_trades_view.find(params[:id])\n\n # using render: @trade assumes that there is a route named trade_path,\n render json: @trade\n end", "def destroy\n @quote.destroy\n respond_with(@quote, :location => person_quotes_path(@person))\n end", "def show\n @quotation = Quotation.find(params[:id])\n cookies[:create_inv] = 0\n cookies.delete :create\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @quotation }\n format.json { render :json => @quotation }\n end\n end", "def show\n @qu = Qu.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @qu }\n end\n end", "def set_quote\n @quote = Quote.find(params[:id])\n end", "def create\n text = quote_params[:text]\n\n if text == 'help' or text == ''\n json = { text: \"Utilize o comando `/novaquotes` para salvar frases ou citações hilárias que aconteceram na Novatics.\\nAlguns exemplos:\\n•`/novaquotes` Só sei que nada sei.\\n•`/novaquotes` Com grandes poderes vem grandes responsabilidades.\\n\\nPara abrir este menu de ajuda, use `/novaquotes help`.\\nPara ver todas as frases salvas: http://novaquote.herokuapp.com\" }\n respond_to { |format| format.json { render json: json, status: :ok, location: @quote } }\n return\n end\n\n begin\n user = get_user_profile(quote_params)\n rescue Exception => e\n json = { text: \"Ocorreu um erro: #{e.message}\" }\n respond_to { |format| format.json { render json: json, status: :ok, location: @quote } }\n return\n end\n\n phrase = text.capitalize\n @quote = Quote.new(author: user['real_name'], message: phrase, image: user['image_32'])\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Frase adicionada com sucesso.' }\n\n json = {\n text: \"Frase adicionada: #{phrase}.\",\n attachments: [{\n title: \"Ver todas as frases\",\n title_link: \"http://novaquote.herokuapp.com\",\n }]\n }\n format.json { render json: json, status: :ok, location: @quote }\n else\n format.html { render :new }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @favorite_quotes = FavoriteQuotes.all\n end", "def responses\n question=Question.find(params[:questionId])\n render :json=> question.response\n end" ]
[ "0.75045645", "0.6509631", "0.6467268", "0.63699657", "0.62532365", "0.6225809", "0.6214231", "0.6205739", "0.6154353", "0.61189735", "0.6078182", "0.6078182", "0.6078182", "0.60727996", "0.60698277", "0.6067165", "0.60335726", "0.59817874", "0.5975427", "0.59591585", "0.5947841", "0.5921788", "0.5915492", "0.5913786", "0.59026504", "0.5883411", "0.58199495", "0.5807158", "0.57909864", "0.57703054", "0.57419306", "0.57167506", "0.56980246", "0.5685197", "0.5682965", "0.567759", "0.5669783", "0.5655326", "0.56535876", "0.55769676", "0.5571577", "0.5571064", "0.55706245", "0.55666065", "0.55666065", "0.55666065", "0.55666065", "0.55458146", "0.554017", "0.55200654", "0.55135906", "0.5512196", "0.5507837", "0.5501713", "0.5500737", "0.5495793", "0.5495034", "0.54939127", "0.54915553", "0.5484978", "0.54639435", "0.54621285", "0.5453345", "0.5446913", "0.5446913", "0.5446913", "0.5446913", "0.5442634", "0.54241574", "0.5417597", "0.54136515", "0.5395922", "0.5384837", "0.53798234", "0.5370623", "0.53696525", "0.5360238", "0.53555554", "0.53555554", "0.53555554", "0.53509706", "0.53448975", "0.53442323", "0.53360283", "0.53306186", "0.53212726", "0.5303377", "0.52963126", "0.52942735", "0.5289711", "0.5285357", "0.52799475", "0.5277429", "0.5273216", "0.5272459", "0.5260776", "0.5258397", "0.52579135", "0.52554893", "0.5240909" ]
0.7344995
1
GET /participant_quotes/new GET /participant_quotes/new.json
def new @participant_quote = ParticipantQuote.new respond_to do |format| format.html # new.html.erb format.json { render json: @participant_quote } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @quote = Quote.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quote }\n end\n end", "def new\n @quoteable = find_quoteable\n @quote = Quote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quote }\n end\n end", "def create\n @participant_quote = ParticipantQuote.new(params[:participant_quote])\n @participant_quote.user_id = current_user.id\n\n respond_to do |format|\n if @participant_quote.save\n format.html { redirect_to @participant_quote, notice: 'Participant quote was successfully created.' }\n format.json { render json: @participant_quote, status: :created, location: @participant_quote }\n else\n format.html { render :new }\n format.json { render json: @participant_quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @quote_detail = QuoteDetail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quote_detail }\n end\n end", "def new\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participant }\n end\n end", "def new\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participant }\n end\n end", "def new\n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participant }\n end\n end", "def new\n @thought = Thought.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thought }\n end\n end", "def create\n @client=Client.find_by_id(params['q_param']['client'])\n title=params['q_param']['title']\n comment=params['q_param']['comment']\n list = [[\"\",\"\",\"1\",\"\"]]\n quote_p={:title=>title,:comment=>comment, :status=>1, :list=>list}\n @quote = @client.quotes.create(quote_p)\n render json: {:quote_id=>@quote.id}\n\n # respond_to do |format|\n # if @quote.save\n # format.html { redirect_to index, notice: 'Quote was successfully created.' }\n # # format.json { render action: 'show', status: :created, location: @quote }\n # else\n # format.html { render action: 'new' }\n # # format.json { render json: @quote.errors, status: :unprocessable_entity }\n # end\n # end\nend", "def create\n quote = Quote.create({\n quote_text: params[:quote_text],\n author: params[:author]\n })\n render json: quote\n end", "def create\n @quote = current_user.quotes.new(quote_params)\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Quote was successfully created.' }\n format.json { render :show, status: :created, location: @quote }\n else\n format.html { render :new }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @qu = Qu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @qu }\n end\n end", "def new\n @qu = Qu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @qu }\n end\n end", "def new\n respond_with(@quote)\n end", "def new\n @price_quote = PriceQuote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @price_quote }\n end\n end", "def new\n @trade = Trade.new\n\n render json: @trade\n end", "def create\n @quote = Quote.new(quote_params)\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Quote was successfully created.' }\n format.json { render action: 'show', status: :created, location: @quote }\n else\n format.html { render action: 'new' }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @what = What.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @what }\n end\n end", "def new\n @quarter = Quarter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quarter }\n end\n end", "def create\n @quoteable = find_quoteable\n @quote = @quoteable.quotes.build(params[:quote])\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Quote was successfully created.' }\n format.json { render json: @quote, status: :created, location: @quote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @participate = Participate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participate }\n end\n end", "def new\n @quest = Quest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quest }\n end\n end", "def create\n @favorite_quotes = FavoriteQuotes.new(favorite_quote_params)\n\n respond_to do |format|\n if @favorite_quotes.save\n format.html { redirect_to @favorite_quote, notice: 'Favorite quote was successfully created.' }\n format.json { render action: 'show', status: :created, location: @favorite_quote }\n else\n format.html { render action: 'new' }\n format.json { render json: @favorite_quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quote = Quote.new(quote_params)\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Quote was successfully created.' }\n format.json { render :show, status: :created, location: @quote }\n else\n format.html { render :new }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quote = Quote.new(quote_params)\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Quote was successfully created.' }\n format.json { render :show, status: :created, location: @quote }\n else\n format.html { render :new }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quote.save\n respond_with(@quote, :location => person_quotes_path(@person))\n end", "def new\n @talk = Talk.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @talk }\n end\n end", "def new\n @talk = Talk.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @talk }\n end\n end", "def create\n @quote_detail = QuoteDetail.new(params[:quote_detail])\n\n respond_to do |format|\n if @quote_detail.save\n format.html { redirect_to @quote_detail, notice: 'Quote detail was successfully created.' }\n format.json { render json: @quote_detail, status: :created, location: @quote_detail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quote_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @trial = Trial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trial }\n end\n end", "def new\n @quote = Quote.new\n 3.times {@quote.tags.build}\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quote }\n end\n end", "def new\n @q = Q.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @q }\n end\n end", "def new\n @quartet = Quartet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quartet }\n end\n end", "def new\n @talk = Talk.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @talk }\n end\n end", "def new\n @track = Track.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @track }\n end\n end", "def new\n @track = Track.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @track }\n end\n end", "def new\n @track = Track.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @track }\n end\n end", "def new\n @party = Party.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @party }\n end\n end", "def new\n @quize = Quize.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quize }\n end\n end", "def new\n\tredirect_to root_url, :notice=>\"I will implement this feature once we have a decent number of tweets/likes ;)\"\n\treturn\n @quote = Quote.new\n \n\t\trespond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @quote }\n end\n end", "def new\n @trail = Trail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trail }\n end\n end", "def new\n @trail = Trail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trail }\n end\n end", "def new\n @quote_list = QuoteList.find(params[:quote_list_id])\n @page_section = @quote_list.page_section\n @page = @page_section.page\n @site_section = @page.site_section\n @quote = @quote_list.quotes.build\n\n respond_to do |format|\n format.js { render :partial => 'ajax_new' }\n format.html # new.html.erb\n format.xml { render :xml => @quote }\n end\n end", "def create\n @quote = Quote.new(quote_params)\n if @quote.save\n redirect_to quotes_path\n else\n render 'new'\n end\n end", "def index\n @quotes = Quote.order('created_at DESC')\n @quote = Quote.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @quotes }\n end\n end", "def new\n @interested = Interested.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interested }\n end\n end", "def new\n @quote = Quote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @quote }\n end\n end", "def create\n text = quote_params[:text]\n\n if text == 'help' or text == ''\n json = { text: \"Utilize o comando `/novaquotes` para salvar frases ou citações hilárias que aconteceram na Novatics.\\nAlguns exemplos:\\n•`/novaquotes` Só sei que nada sei.\\n•`/novaquotes` Com grandes poderes vem grandes responsabilidades.\\n\\nPara abrir este menu de ajuda, use `/novaquotes help`.\\nPara ver todas as frases salvas: http://novaquote.herokuapp.com\" }\n respond_to { |format| format.json { render json: json, status: :ok, location: @quote } }\n return\n end\n\n begin\n user = get_user_profile(quote_params)\n rescue Exception => e\n json = { text: \"Ocorreu um erro: #{e.message}\" }\n respond_to { |format| format.json { render json: json, status: :ok, location: @quote } }\n return\n end\n\n phrase = text.capitalize\n @quote = Quote.new(author: user['real_name'], message: phrase, image: user['image_32'])\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Frase adicionada com sucesso.' }\n\n json = {\n text: \"Frase adicionada: #{phrase}.\",\n attachments: [{\n title: \"Ver todas as frases\",\n title_link: \"http://novaquote.herokuapp.com\",\n }]\n }\n format.json { render json: json, status: :ok, location: @quote }\n else\n format.html { render :new }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quote = Quote.new(params[:quote])\n @quote.user_id = current_user.id\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Quote was successfully created.' }\n format.json { render json: @quote, status: :created, location: @quote }\n else\n @quotes = Quote.all\n format.html { render action: \"index\" }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @participation = Participation.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participation }\n end\n end", "def new\n @trick = Trick.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trick }\n end\n end", "def new\n @track = current_user.tracks.new\n\n respond_to do |format|\n format.html # new.html.haml\n format.json { render json: @track }\n end\n end", "def create\n @quote = Quote.new(params[:quote])\n @quote.user = current_user\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to :root, notice: 'Quote was successfully created.' }\n format.json { render json: @quote, status: :created, location: @quote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @qa = Qa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @qa }\n end\n end", "def new\n @quartier = Quartier.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quartier }\n end\n end", "def new\n @followup = Followup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @followup }\n end\n end", "def new\n @talk = Talk.new\n\n respond_to do |format|\n format.html # new.html.haml\n format.json { render json: @talk }\n end\n end", "def new\n @like = Like.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @like }\n end\n end", "def new\n @trading_strategy = TradingStrategy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trading_strategy }\n end\n end", "def new\n @have = Have.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @have }\n end\n end", "def new\n authenticate_user!\n\n @testimonial = Testimonial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @testimonial }\n end\n end", "def new\n @part = Part.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @part }\n end\n end", "def new\n head :status => 405\n return\n \n @participant = Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n #format.xml { render :xml => @participant }\n end\n end", "def new\n @chatline = Chatline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chatline }\n end\n end", "def new\n @testimonial = Testimonial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @testimonial }\n end\n end", "def new\n @tick_track = TickTrack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tick_track }\n end\n end", "def new\n @quote=Quote.new\n end", "def new\n @gotcha = Gotcha.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gotcha }\n end\n end", "def index\n @participant_quotes = ParticipantQuote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @participant_quotes }\n end\n end", "def new\n @track_dress = TrackDress.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @track_dress }\n end\n end", "def create\n @quote = Quote.new(params[:quote])\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to(@quote, :notice => 'Quote was successfully created.') }\n format.xml { render :xml => @quote, :status => :created, :location => @quote }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @quote.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @price_quote = PriceQuote.new(params[:price_quote])\n\n respond_to do |format|\n if @price_quote.save\n format.html { redirect_to @price_quote, notice: 'Price quote was successfully created.' }\n format.json { render json: @price_quote, status: :created, location: @price_quote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @price_quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\r\n @quote_box = QuoteBox.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @quote_box }\r\n end\r\n end", "def new\n @song_like = SongLike.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @song_like }\n end\n end", "def new\n @trackleague = Trackleague.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trackleague }\n end\n end", "def new\n @participant_old = Participant.find(:first, :conditions => [ \"worker_id = ?\", params[:workerId]])\n \n if @participant_old == nil\n @participant = Participant.new\n @participant.assignment_id = params[:assignmentId]\n @participant.hit_id = params[:hitId]\n @participant.worker_id = params[:workerId]\n @participant.ip_addr = request.remote_ip\n @participant.cond = rand(2)\n else\n @participant = @participant_old.dup\n @participant.assignment_id = params[:assignmentId]\n @participant.hit_id = params[:hitId]\n @participant.ip_addr = request.remote_ip\n end\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participant }\n end\n end", "def new\n @title = t('view.surveys.new_title')\n @survey = Survey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @survey }\n end\n end", "def new\n @follow = Follow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @follow }\n end\n end", "def new\n @follow = Follow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @follow }\n end\n end", "def new\n @completed_quest = CompletedQuest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @completed_quest }\n end\n end", "def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notes }\n end\n end", "def new\n @transcription = Transcription.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @transcription }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @part = Part.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @part }\n end\n end", "def new\n @trading_account = TradingAccount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trading_account }\n end\n end", "def new\n @question = Question.find(params[:question_id])\n @answer = Answer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer }\n end\n end", "def new\n @tweet = Tweet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tweet }\n end\n end", "def new\n @tweet = Tweet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tweet }\n end\n end", "def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @note }\n end\n end", "def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @note }\n end\n end", "def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @note }\n end\n end", "def new\n @note = Note.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @note }\n end\n end", "def new\n @intake_question = IntakeQuestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @intake_question }\n end\n end", "def new\n #@question = Question.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @artist = Artist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @artist }\n end\n end", "def show\n @participant_quote = ParticipantQuote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant_quote }\n end\n end" ]
[ "0.7353266", "0.7290599", "0.71510077", "0.69096905", "0.66836864", "0.66836864", "0.66836864", "0.66770554", "0.6649301", "0.66387993", "0.66115195", "0.66063255", "0.66063255", "0.6601417", "0.65713185", "0.6557265", "0.6540016", "0.6514769", "0.6510395", "0.6504937", "0.64996654", "0.6486742", "0.64854616", "0.6482667", "0.6482667", "0.6460255", "0.64454365", "0.64454365", "0.6438351", "0.6406174", "0.6403701", "0.6400565", "0.63851523", "0.6372006", "0.6368368", "0.6368368", "0.6368368", "0.63610125", "0.6345955", "0.6337731", "0.63357", "0.63357", "0.6322447", "0.63203204", "0.6317479", "0.63128537", "0.63098365", "0.63038945", "0.62986606", "0.6274883", "0.62745184", "0.6273092", "0.6269222", "0.62558264", "0.62548536", "0.62525797", "0.62525076", "0.6243259", "0.6230447", "0.6227048", "0.6200714", "0.61950004", "0.61920655", "0.6178785", "0.61783326", "0.6177715", "0.61740243", "0.6173342", "0.616814", "0.61660135", "0.61651796", "0.6164782", "0.6158218", "0.61574924", "0.61559504", "0.6155784", "0.6141519", "0.61402506", "0.61402506", "0.61354053", "0.6133917", "0.6133", "0.61320406", "0.61320406", "0.61320406", "0.61320406", "0.61320406", "0.6129075", "0.6120483", "0.6110489", "0.6100165", "0.6100165", "0.6098793", "0.6098793", "0.6098793", "0.6098793", "0.6091409", "0.60864794", "0.6084262", "0.60841197" ]
0.7997766
0
POST /participant_quotes POST /participant_quotes.json
def create @participant_quote = ParticipantQuote.new(params[:participant_quote]) @participant_quote.user_id = current_user.id respond_to do |format| if @participant_quote.save format.html { redirect_to @participant_quote, notice: 'Participant quote was successfully created.' } format.json { render json: @participant_quote, status: :created, location: @participant_quote } else format.html { render :new } format.json { render json: @participant_quote.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @client=Client.find_by_id(params['q_param']['client'])\n title=params['q_param']['title']\n comment=params['q_param']['comment']\n list = [[\"\",\"\",\"1\",\"\"]]\n quote_p={:title=>title,:comment=>comment, :status=>1, :list=>list}\n @quote = @client.quotes.create(quote_p)\n render json: {:quote_id=>@quote.id}\n\n # respond_to do |format|\n # if @quote.save\n # format.html { redirect_to index, notice: 'Quote was successfully created.' }\n # # format.json { render action: 'show', status: :created, location: @quote }\n # else\n # format.html { render action: 'new' }\n # # format.json { render json: @quote.errors, status: :unprocessable_entity }\n # end\n # end\nend", "def create\n @quote.save\n respond_with(@quote, :location => person_quotes_path(@person))\n end", "def create\n @quoteable = find_quoteable\n @quote = @quoteable.quotes.build(params[:quote])\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Quote was successfully created.' }\n format.json { render json: @quote, status: :created, location: @quote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n quote = Quote.create({\n quote_text: params[:quote_text],\n author: params[:author]\n })\n render json: quote\n end", "def create\n @quote = current_user.quotes.new(quote_params)\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Quote was successfully created.' }\n format.json { render :show, status: :created, location: @quote }\n else\n format.html { render :new }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @participant_quote = ParticipantQuote.find(params[:id])\n @participant_quote.destroy\n\n respond_to do |format|\n format.html { redirect_to participant_quotes_url }\n format.json { head :no_content }\n end\n end", "def create\n @user = current_user\n #quote_options = params[:quote]\n #tags_string = quote_options.delete(:tags)\n \n #@quote = @user.quotes.create(quote_options)\n \n #save the tags for the quote\n #if @quote\n # puts \"not working!\"\n # tags = Tag.tags_array(tags_string)\n # tags.each { |tag| @quote.tags.create(:text => tag)}\n #end\n \n @quote = Quote.new\n @quote.user = @user\n options = params[:quote]\n p options\n @quote.text = options[:text]\n @quote.author = options[:author]\n @quote.tags = Tag.tags_array(options[:tags])\n @quote.save\n\n respond_to do |format|\n if @quote\n format.html { redirect_to @quote, notice: 'Quote was successfully created.' }\n format.json { render json: @quote, status: :created, location: @quote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @participant_quotes = ParticipantQuote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @participant_quotes }\n end\n end", "def create\n text = quote_params[:text]\n\n if text == 'help' or text == ''\n json = { text: \"Utilize o comando `/novaquotes` para salvar frases ou citações hilárias que aconteceram na Novatics.\\nAlguns exemplos:\\n•`/novaquotes` Só sei que nada sei.\\n•`/novaquotes` Com grandes poderes vem grandes responsabilidades.\\n\\nPara abrir este menu de ajuda, use `/novaquotes help`.\\nPara ver todas as frases salvas: http://novaquote.herokuapp.com\" }\n respond_to { |format| format.json { render json: json, status: :ok, location: @quote } }\n return\n end\n\n begin\n user = get_user_profile(quote_params)\n rescue Exception => e\n json = { text: \"Ocorreu um erro: #{e.message}\" }\n respond_to { |format| format.json { render json: json, status: :ok, location: @quote } }\n return\n end\n\n phrase = text.capitalize\n @quote = Quote.new(author: user['real_name'], message: phrase, image: user['image_32'])\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Frase adicionada com sucesso.' }\n\n json = {\n text: \"Frase adicionada: #{phrase}.\",\n attachments: [{\n title: \"Ver todas as frases\",\n title_link: \"http://novaquote.herokuapp.com\",\n }]\n }\n format.json { render json: json, status: :ok, location: @quote }\n else\n format.html { render :new }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quote = Quote.new(quote_params)\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Quote was successfully created.' }\n format.json { render :show, status: :created, location: @quote }\n else\n format.html { render :new }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quote = Quote.new(quote_params)\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Quote was successfully created.' }\n format.json { render :show, status: :created, location: @quote }\n else\n format.html { render :new }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_submit_rent\n quote_details = SAMPLE_QUOTE_DETAILS.deep_dup\n quote_details['fixed_price_services_requested']['price'] = 1200\n params_hash = {\n udprn: '123456',\n services_required: SAMPLE_SERVICES_REQUIRED,\n payment_terms: SAMPLE_PAYMENT_TERMS,\n quote_details: quote_details.to_json\n }\n first_params_hash = params_hash.deep_dup\n first_params_hash[:quote_details] = SAMPLE_QUOTE_DETAILS.to_json\n post :new_quote_for_property, first_params_hash\n post :new, params_hash\n assert_response 200\n\n quote = Agents::Branches::AssignedAgents::Quote.last\n ### Now lets submit the quote\n post :submit, { udprn: '123456', quote_id: quote.id }\n response = Oj.load(@response.body)\n assert_response 200\n assert_equal response['message'], 'The quote is accepted'\n end", "def test_submit\n quote_details = SAMPLE_QUOTE_DETAILS.deep_dup\n quote_details['fixed_price_services_requested']['price'] = 1200\n params_hash = {\n udprn: SAMPLE_UDPRN,\n services_required: SAMPLE_SERVICES_REQUIRED,\n payment_terms: SAMPLE_PAYMENT_TERMS,\n quote_details: quote_details.to_json\n }\n first_params_hash = params_hash.deep_dup\n first_params_hash[:quote_details] = SAMPLE_QUOTE_DETAILS.to_json\n post :new_quote_for_property, first_params_hash\n post :new, params_hash\n assert_response 200\n\n quote = Agents::Branches::AssignedAgents::Quote.last\n ### Now lets submit the quote\n post :submit, { udprn: SAMPLE_UDPRN, quote_id: quote.id }\n response = Oj.load(@response.body)\n assert_response 200\n assert_equal response['message'], 'The quote is accepted'\n end", "def create\n @favorite_quotes = FavoriteQuotes.new(favorite_quote_params)\n\n respond_to do |format|\n if @favorite_quotes.save\n format.html { redirect_to @favorite_quote, notice: 'Favorite quote was successfully created.' }\n format.json { render action: 'show', status: :created, location: @favorite_quote }\n else\n format.html { render action: 'new' }\n format.json { render json: @favorite_quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @participant_quote = ParticipantQuote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @participant_quote }\n end\n end", "def create\n @quote = Quote.new(quote_params)\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Quote was successfully created.' }\n format.json { render action: 'show', status: :created, location: @quote }\n else\n format.html { render action: 'new' }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def quote(params)\n request(Resources::RESOURCE_QUOTE, HTTP_METHOD_POST, params)\n end", "def create\n @quote = Quote.new(params[:quote])\n @quote.user_id = current_user.id\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Quote was successfully created.' }\n format.json { render json: @quote, status: :created, location: @quote }\n else\n @quotes = Quote.all\n format.html { render action: \"index\" }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quote = Quote.new(quote_params)\n @quote.tag_list = params[:tags]\n\n respond_to do |format|\n if @quote.save\n format.json { render :show, status: :created, location: @quote }\n else\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kid_quote = KidQuote.new(kid_quote_params)\n respond_to do |format|\n if @kid_quote.save\n format.html { redirect_to kid_quotes_path, notice: 'Kid quote was successfully created.' }\n format.json { render json: @kid_quote, status: :created, location: @kid_quote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kid_quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quote = Core::Quote.new(quote_params)\n @quote.save\n end", "def quote_params\n params.require(:quote).permit(:text, :quoted, :user_id)\n end", "def create\n @quote = Quote.new(params[:quote])\n @quote.user = current_user\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to :root, notice: 'Quote was successfully created.' }\n format.json { render json: @quote, status: :created, location: @quote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quote_detail = QuoteDetail.new(params[:quote_detail])\n\n respond_to do |format|\n if @quote_detail.save\n format.html { redirect_to @quote_detail, notice: 'Quote detail was successfully created.' }\n format.json { render json: @quote_detail, status: :created, location: @quote_detail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quote_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @participant_quote = ParticipantQuote.find(params[:id])\n\n respond_to do |format|\n if @participant_quote.update_attributes(params[:participant_quote])\n format.html { redirect_to @participant_quote, notice: 'Participant quote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @participant_quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quote_line = QuoteLine.new(quote_line_params)\n\n respond_to do |format|\n if @quote_line.save\n format.html { redirect_to @quote_line, notice: 'Quote line was successfully created.' }\n format.json { render action: 'show', status: :created, location: @quote_line }\n else\n format.html { render action: 'new' }\n format.json { render json: @quote_line.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n if current_admin.blank? && current_user.blank?\n flash[:notice] = 'You must be logged in to send a quote.'\n redirect_to home_index_path\n else\n\n @quote = current_user.quotes.build(quote_params)\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Quote was successfully created.' }\n format.json { render :show, status: :created, location: @quote }\n else\n format.html { render :new }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n\n end\n end", "def create\n @quote_of_the_day = QuoteOfTheDay.new(quote_of_the_day_params)\n\n respond_to do |format|\n if @quote_of_the_day.save\n format.html { redirect_to quote_of_the_days_url, notice: \"Quote of the day was successfully created.\" }\n format.json { render :show, status: :created, location: @quote_of_the_day }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @quote_of_the_day.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quote = Quote.new(params[:quote])\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to(@quote, :notice => 'Quote was successfully created.') }\n format.xml { render :xml => @quote, :status => :created, :location => @quote }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @quote.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\n\t\t\t\ttparams = params.require(:testimony).permit :quote,:author\n\n\t\t\t\t@testimony = Testimony.new tparams\n\n\t\t\t\tif @testimony.save\n\n\t\t\t\t\trender json: @testimony,status: 201\n\n\t\t\t\telse\n\n\t\t\t\t\trender json: {errors: @testimony.errors},status: 422\n\n\t\t\t\tend\n\n\t\t\tend", "def create\n @quote = Quote.new(quote_params)\n if @quote.save\n redirect_to quotes_path\n else\n render 'new'\n end\n end", "def show\n @participant_quote = ParticipantQuote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant_quote }\n end\n end", "def kid_quote_params\n params.require(:kid_quote).permit(:quote, :name, :age)\n end", "def create\n @price_quote = PriceQuote.new(params[:price_quote])\n\n respond_to do |format|\n if @price_quote.save\n format.html { redirect_to @price_quote, notice: 'Price quote was successfully created.' }\n format.json { render json: @price_quote, status: :created, location: @price_quote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @price_quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_insurance_quote_using_post(insurance_quote, opts = {})\n data, _status_code, _headers = create_insurance_quote_using_post_with_http_info(insurance_quote, opts)\n data\n end", "def create\n @quote = Quote.new(params[:quote])\n\n @quote.name = params[:quote][:name].titleize\n\n # Calculate final quote\n @quote.final_quote = set_quote = @quote.set_quote\n @quote.final_quote = set_quote+750 if params[:quote][:ground_floor].eql?('Y')\n @quote.final_quote = @quote.final_quote+750 if params[:quote][:access_difficulty].eql?('Difficult')\n @quote.final_quote = @quote.final_quote+1000 if params[:quote][:full_renovation].eql?('Y')\n\n respond_to do |format|\n if @quote.save\n # QuoteMailer.delay({:run_at => 1.minutes.from_now}).quote_email(@quote)\n QuoteMailer.quote_email(@quote).deliver\n\n format.html { redirect_to new_quote_url, notice: 'Thank you for submitting your details. You will receive an email shortly with the quote.' }\n format.json { render json: @quote, status: :created, location: @quote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n @quote = Quote.new(params[:quote])\n\n \n \n\n\n respond_to do |format|\n @quote.update!(quote_params)\n # p '------------------'\n # p '------------------'\n # p @quote\n # p '------------------'\n # p '------------------'\n if @quote.save \n format.html { redirect_to @quote, notice: \"Save process completed!\" }\n format.json { render json: @quote, status: :created, location: @quote }\n else\n format.html { \n flash.now[:notice]=\"Save proccess coudn't be completed!\" \n render :new \n }\n format.json { render json: @quote.errors, status: :unprocessable_entity}\n end\n end\n end", "def quote\n fetch('princess_bride.quotes')\n end", "def create\n @quotation = Quotation.new(quotation_params)\n\tif(@quotation.user_id==nil) \n\t@quotation.user_id=current_user.id\n\tend\n\t#puts @myincidents\n respond_to do |format|\n if @quotation.save\n format.html { redirect_to @quotation, notice: 'Quotation was successfully created. Please Remember Your Identification number for later retrieve!' }\n format.json { render action: 'show', status: :created, location: @quotation }\n else\n format.html { render action: 'new' }\n format.json { render json: @quotation.errors, status: :unprocessable_entity }\n end\n end\n end", "def quote_params\n params.require(:quote).permit(:agent_code, :effective_date, :line, :state, :non_violence_duration, :prior_incident_forgiveness)\n end", "def create\n @favorite_quote = FavoriteQuote.where(quote_id: favorite_quote_params[:quote_id], user_id: favorite_quote_params[:user_id]).first\n @present = @favorite_quote.present?\n if !@present\n @favorite_quote = FavoriteQuote.new(favorite_quote_params)\n end\n\n respond_to do |format|\n if !@present && @favorite_quote.save\n format.html { redirect_to @favorite_quote, notice: 'Favorite quote was successfully created.' }\n format.json { render json: @favorite_quote, status: :created }\n format.js {}\n else\n if @favorite_quote.destroy\n format.html { redirect_to favorite_quotes_url, notice: 'Favorite quote was successfully destroyed.' }\n format.json { head :no_content }\n format.js {}\n else\n format.html { render :new }\n format.json { render json: @favorite_quote.errors, status: :unprocessable_entity }\n format.js {}\n end\n end\n end\n end", "def quote_params\n # params.fetch(:quote)\n params.require(:quote).permit(:quote_type, :user_id, :approved, :pending, :rejected, :product_id, quote_detail_attributes: [:quote_comments], questionaire_attributes: [ :user_id, :quote_id, :product_type, :comments])\n end", "def create\n @quotation = Quotation.new(quotation_params)\n authorize @quotation\n respond_to do |format|\n if @quotation.save\n format.html { redirect_to @quotation, notice: 'Quotation was successfully created.' }\n format.json { render :show, status: :created, location: @quotation }\n else\n format.html { render :new }\n format.json { render json: @quotation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quote = Quote.new(quote_params)\n @quote.effective_date ||= Date.today\n @quote.user = current_user\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to new_applicant_quote_path(@quote), notice: 'Quote was successfully created.' }\n format.json { render :show, status: :created, location: @quote }\n else\n format.html { render :new }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n @survey = Survey.new(json)\n respond_to do |format|\n if @survey.save\n format.html { redirect_to @survey, notice: 'Survey was successfully created.' }\n format.json { render json: @survey, status: :created, location: @survey }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quote = Quote.new(params[:quote])\n @quote.user = current_user\n assign_tags_to_user\n \n respond_to do |format|\n if @quote.save\n flash[:notice] = 'Quote was successfully saved.'\n format.html { redirect_to([@user, @quote]) }\n format.xml { render :xml => @quote, :status => :created, :location => @quote }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @quote.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @qweet = current_user.qweets.build(qweet_params)\n\n respond_to do |format|\n if @qweet.save\n format.html { redirect_to root_path, notice: \"Qweet was successfully created.\" }\n format.json { render :show, status: :created, location: @qweet }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @qweet.errors, status: :unprocessable_entity }\n end\n end\n end", "def quote_params\n params.require(:quote).permit(:text, :verified, :character_id, :source_id, :source_type, :topic_ids => [], quote_topics_attributes: [:id, :topic_id, :_destroy])\n end", "def quote\n fetch('heroes_of_the_storm.quotes')\n end", "def quote\n fetch('new_girl.quotes')\n end", "def create\n @sale = Sale.new(sale_params)\n respond_to do |format|\n if @sale.save\n quantity = params[:quotes_quantity].gsub(/[^\\d^\\.]/, '').to_i\n\n for i in 1..quantity\n @quote = Quote.new\n @quote.amount = (params[:amount]).gsub(/[^\\d^\\.]/, '').to_f\n @quote.is_paid = false\n @quote.number = i\n @quote.total = quantity\n @quote.mounth = (@sale.date + i.month).month\n @quote.year = (@sale.date + i.month).year\n @quote.sale = @sale\n @quote.save\n end\n\n format.html { redirect_to @sale, notice: 'Sale was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sale }\n else\n format.html { render action: 'new' }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end", "def favorite_quote_params\n params.require(:favorite_quote).permit(:quote_id, :user_id)\n end", "def quote_params\n params.require(:quote).permit(:author, :content)\n end", "def quote\n fetch('v_for_vendetta.quotes')\n end", "def create\n @participant = Participant.new(participant_create_params)\n @participant.save\n respond_with(@participant)\n end", "def create\n @participant = Participant.new(participant_create_params)\n @participant.save\n respond_with(@participant)\n end", "def create\n @question = Question.create!(question_params.merge({user_id: 1}))\n if question_params[:answers]\n question_params[:answers].with_indifferent_access.each do |answer|\n Answer.create!(name: answer[:name], question_id: @question.id)\n end\n end\n @question.prepare\n @question.broadcast\n render json: @question, status: :created\n end", "def create\n @quize = Quize.new(params[:quize])\n\n respond_to do |format|\n if @quize.save\n format.html { redirect_to @quize, notice: 'Quize was successfully created.' }\n format.json { render json: @quize, status: :created, location: @quize }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quize.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quote = Quote.new(quote_params)\n\n if user_signed_in?\n userCustomerList = Customer.where(:user_id => current_user.id)\n if userCustomerList.present?\n customer = userCustomerList.first\n @quote.CompanyName = userCustomerList.first.CompanyName\n @quote.Email = userCustomerList.first.EmailOfTheCompany\n\n subject = \"#{customer.NameOfContact} from #{customer.CompanyName}\"\n comment = \"The contact #{customer.NameOfContact} from company #{customer.CompanyName} can be reached at email #{customer.EmailOfTheCompany} and at phone number #{customer.CompanyContactPhone}. #{@quote.BuildingType} has a project named [PROJECT] which would require contribution from Rocket Elevators.\"\n ZendeskAPI::Ticket.create($zenclient, :subject => subject, :comment => { :value => comment }, :priority => \"normal\", :type => \"task\" ) # :email_ccs => [{ :user_email => :Email, :action => \"put\"}],\n\n end\n end\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: \"Quote was successfully created.\" }\n format.json { render :show, status: :created, location: @quote }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @qu = Qu.new(params[:qu])\n\n respond_to do |format|\n if @qu.save\n format.html { redirect_to @qu, :notice => 'Qu was successfully created.' }\n format.json { render :json => @qu, :status => :created, :location => @qu }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @qu.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @qu = Qu.new(params[:qu])\n\n respond_to do |format|\n if @qu.save\n format.html { redirect_to @qu, :notice => 'Qu was successfully created.' }\n format.json { render :json => @qu, :status => :created, :location => @qu }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @qu.errors, :status => :unprocessable_entity }\n end\n end\n end", "def quote_params\n params.require(:quote).permit(:name,:job_id,:quote_number,:sender_id, :receiver_id,:quote_elements_attributes => [ :id, :content,:quantity,:total, :price, :_destroy ])\n end", "def create\n @quarto = Quarto.new(quarto_params)\n\n respond_to do |format|\n if @quarto.save\n format.html { redirect_to @quarto, notice: 'Quarto was successfully created.' }\n format.json { render :show, status: :created, location: @quarto }\n else\n format.html { render :new }\n format.json { render json: @quarto.errors, status: :unprocessable_entity }\n end\n end\n end", "def follow_artist\n relationship = Relationship.create(params.require(:relationship).permit(:follower_id, :followed_id))\n render json: relationship\n end", "def create\n @quote = Quote.new(params[:quote])\n @quote.city_id = params[:company][:city_id]\n \n \n\n respond_to do |format|\n if @quote.save\n create_solicitations(@quote.id, params[:tags_name])\n format.html { redirect_to(@quote, :notice => 'Quote was successfully created.') }\n format.xml { render :xml => @quote, :status => :created, :location => @quote }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @quote.errors, :status => :unprocessable_entity }\n end\n end\n end", "def qweet_params\n params.require(:qweet).permit(:qweet)\n end", "def quote\n fetch('harry_potter.quotes')\n end", "def favorite_quote_params\n params.require(:favorite_quote).permit(:quote, :movie, :year)\n end", "def create\n @wedding_planner_quote = WeddingPlannerQuote.new(params[:wedding_planner_quote])\n \n respond_to do |format|\n if @wedding_planner_quote.save\n NoticeMailer.wedding_planner_email(@wedding_planner_quote, 'Nueva').deliver\n format.html { redirect_to @wedding_planner_quote, notice: 'Solicitud de Wedding Planner Ingresada' }\n format.json { render json: @wedding_planner_quote, status: :created, location: @wedding_planner_quote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wedding_planner_quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if params['q_param']['quote_id']!=nil\n @quote_id=params['q_param']['quote_id']\n @quote=Quote.find(@quote_id)\n client_id= @quote.client_id\n list=@quote.list\n total=@quote.total\n tax_rate=@quote.tax_rate\n @quote.update({:status=>2})\n title=@quote.title\n comment=@quote.comment\n else \n client_id=params['q_param']['client']\n @quote_id=nil\n list=nil\n total=nil\n tax_rate=nil\n title=params['q_param']['title']\n comment=params['q_param']['comment']\n end\n @client=Client.find_by_id(client_id)\n invoice_p={:title=>title,:comment=>comment,:quote_id=>@quote_id,:total=>total,:list=>list,:tax_rate=>tax_rate,}\n @invoice = @client.invoices.create(invoice_p)\n render json: {:invoice_id=>@invoice.id}\n end", "def quote_params\n params.require(:quote).permit(:my_query_id, :body, :user)\n end", "def policy_activities_actions_issue_quotes_post_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyActivitiesApi.v1_policy_activities_actions_issue_quotes_post ...'\n end\n # resource path\n local_var_path = '/v1/policy_activities/actions/issue_quotes'\n # query parameters\n query_params = opts[:query_params] || {}\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'text/plain', 'application/octet-stream', 'application/json-patch+json', 'text/json', 'application/*+json'])\n # form parameters\n form_params = opts[:form_params] || {}\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'request_body'])\n # return_type\n return_type = opts[:debug_return_type] || 'Array<CentralEntCoreFrameworkServiceLibraryApiModelIssueQuoteResponse>'\n # auth_names\n auth_names = opts[:debug_auth_names] || ['Bearer']\n new_options = opts.merge(\n :operation => :\"PolicyActivitiesApi.v1_policy_activities_actions_issue_quotes_post\",\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 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: PolicyActivitiesApi#v1_policy_activities_actions_issue_quotes_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def submit_form\n answers_params = params.permit!\n\n render json: Answer.insert_answers(answers_params, current_user[\"id\"])\n end", "def create\n @quartet = Quartet.new(params[:quartet])\n\n respond_to do |format|\n if @quartet.save\n format.html { redirect_to @quartet, notice: 'Quartet was successfully created.' }\n format.json { render json: @quartet, status: :created, location: @quartet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quartet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n @quote_item = QuoteItem.new(quote_item_params.merge(order_id: current_customer.order_id))\n if @quote_item.save\n format.html { redirect_to @quote_item, notice: 'Quote item was successfully created.' }\n format.json { render :show, status: :created, location: @quote_item }\n else\n format.html { render :new }\n format.json { render json: @quote_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def quote_like\n @quote = set_quote\n @quote.cnt += 1\n respond_to do |format|\n if @quote.save\n #format.html { redirect_to @quote, notice: 'Quote was successfully liked.' }\n #format.json { render :show, status: :created, location: @quote }\n format.json { render json: {:data => { :quotes => @quote}, :result => { :errorcode => \"\", :messages => \"ok\", :rstatus => 1 }} }\n else\n #format.html { render :new }\n #format.json { render json: @quote.errors, status: :unprocessable_entity }\n format.json { render json: { :result => { :errorcode => \"\", :messages => @quote.errors, :rstatus => 0 }} }\n end\n end\n end", "def quote_like\n @quote = set_quote\n @quote.cnt += 1\n respond_to do |format|\n if @quote.save\n #format.html { redirect_to @quote, notice: 'Quote was successfully liked.' }\n #format.json { render :show, status: :created, location: @quote }\n format.json { render json: {:data => { :quotes => @quote}, :result => { :errorcode => \"\", :messages => \"ok\", :rstatus => 1 }} }\n else\n #format.html { render :new }\n #format.json { render json: @quote.errors, status: :unprocessable_entity }\n format.json { render json: { :result => { :errorcode => \"\", :messages => @quote.errors, :rstatus => 0 }} }\n end\n end\n end", "def quote_params\n params.require(:quote).permit(:quote, :author, :cnt)\n end", "def quote_params\n params.require(:quote).permit(:company_name, :quote_information, :quote_amount, :quote_due_date, :artwork_due_date, :artwork_proof_link, :production_notes, :quote_status, :quote_link, :order_ship_date, :order_installation_date)\n end", "def create\n dish = Dish.where(name: params[:name]).first\n dish ||= Dish.create(name: params[:name], party: current_party, price: params[:price])\n\n OrderItem.create(user: current_user, dish: dish)\n\n render json: { :name => dish.name, :price => dish.price, :participants => [current_user.login] }\n end", "def create\n @quote = Quote.new(quote_params)\n\n respond_to do |format|\n if @quote.valid?\n Quoter.quote_email(@quote).deliver_now\n Quoter.confirm_email(@quote).deliver_now\n format.html { redirect_to root_url, notice: 'Cotización enviada' }\n\n else\n format.html { redirect_to root_url(@quote), notice: 'No se pudo enviar tu cotización'}\n\n end\n end\n end", "def create\n\tredirect_to root_url\n\treturn\n @quote = Quote.new(params[:quote])\n\t\t#default value (ideally should be in migration)\n\t\t@quote.matchups=0\n\t\t@quote.score=0\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to(@quote, :notice => 'Quote was successfully created.') }\n format.xml { render :xml => @quote, :status => :created, :location => @quote }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @quote.errors, :status => :unprocessable_entity }\n end\n end\n end", "def quote_params\n params.require(:quote).permit(:body, :description)\n end", "def create\n @question = SurveyQuestion.new(question_params)\n if @question.save\n render json: @question\n else\n render json: @question.errors.full_messages.join(\", \"), status: :unprocessable_entity\n end\n end", "def create\n @order = Order.new(order_params)\n @order.sponsors = params[:sponsors]\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'El pedido se creó correctamente.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n workout = Workout.find params[:workout_id]\n result = Question.create(workout, { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n @question = result[:question]\n\n respond_to do |format|\n unless @question.persisted?\n format.json { render :json => @question.errors.full_messages, :status => :unprocessable_entity }\n else\n format.json { render :json => @question.as_json({:include => :answers}) }\n end\n \n end\n\n end", "def create\n @quote = Quote.new(quote_params)\n\n respond_to do |format|\n if @quote.save\n format.html {\n if params[:quote][:redirect_to].present?\n redirect_to params[:quote][:redirect_to], notice: 'Quote was successfully created.'\n else\n redirect_to view_context.admin_model_url(@quote.source), notice: 'Quote was successfully created.'\n end\n }\n format.json { render :show, status: :created, location: @quote }\n else\n format.html {\n if params[:quote][:redirect_to].present?\n redirect_to params[:quote][:redirect_to], alert: 'Oops! an error occurred while creating the quote.'\n else\n redirect_to view_context.admin_model_url(@quote.source), alert: 'Oops! an error occurred while creating the quote.'\n end\n }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def quotes(args)\n if args.is_a?(Integer)\n get(\"/markets/quotes/#{args}\")['quotes']\n elsif args.is_a?(Array)\n get(\"/markets/quotes?ids=#{args.join(',')}\")['quotes']\n else\n fail \"Malformed argument: #{args}\"\n end\n end", "def create\n @participant = Participant.new(params[:participant])\n\n respond_to do |format|\n if @participant.save\n format.html { redirect_to participants_url, notice: 'Participant was successfully created.' }\n format.json { render json: @participant, status: :created, location: @participant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @participant.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quartier = Quartier.new(params[:quartier])\n\n respond_to do |format|\n if @quartier.save\n format.html { redirect_to @quartier, notice: 'Quartier was successfully created.' }\n format.json { render json: @quartier, status: :created, location: @quartier }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quartier.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @aspect = Aspect.where(id: params[:aspect_id])\n @indicator = Indicator.where(id: params[:indicator_id])\n params.delete :aspect_id, :indicator_id\n @question = Question.new(params[:question])\n @question.indicator = @indicator\n @question.aspect = @aspect\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, notice: 'Question was successfully created.' }\n format.json { render json: @question, status: :created, location: @question }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def submit_order()\n\tputs \"Submitting order\"\n\tdata = create_order()\n\tresponse = request_post(\"/api/order\", data)\n\tputs response.body\nend", "def save_quote\n event_id = params[\"event_id\"]\n for each in Specification.where(event_id: event_id).where(exclude_from_quote: nil)\n if params[\"quoted_price-#{each.id}\"] == nil\n each.quoted_price = 0\n else\n each.quoted_price = (params[\"quoted_price-#{each.id}\"].gsub(\",\" , \"\").to_f * 100).round(2)\n end\n items_cost = params[\"per_item_cost-#{each.id}\"].to_f * 100.0\n each.per_item_cost = items_cost.round(2)\n each.per_item_list_price = (params[\"per_item_list_price-#{each.id}\"].to_f * 100).round(2)\n each.extended_list_price = (params[\"extended_list_price-#{each.id}\"].to_f * 100).round(2)\n each.save!\n end\n quote = Quote.where(event_id: event_id).first\n quote.quote_name = params[\"quote_name\"]\n quote.quote_style = params[\"quote_style\"]\n quoted_total_price = 0\n quoted_total_cost = 0\n for each in Specification.where(event_id: event_id).where(exclude_from_quote: nil)\n if each.quoted_price == nil\n each.quoted_price = 0\n else # do nothing\n end\n quoted_total_price = quoted_total_price + each.quoted_price\n quoted_total_cost = quoted_total_cost + (((each.per_item_cost / 100.0) * (each.item_quantity / 100.0)).round(2) * 100.0).round(2)\n end \n quote.total_price = quoted_total_price\n quote.total_cost = quoted_total_cost\n if quoted_total_cost != 0\n quote.markup = (quoted_total_price / quoted_total_cost) * 100\n else # do nothing\n end\n quote.status = params[\"status\"]\n if params[\"status\"] != \"Completed\" && params[\"status\"] != \"Ordered\"\n quote.wholesale_order_date = nil\n else # do nothing\n end\n quote.save!\n event = Event.where(id: event_id).first\n event.event_status = params[\"status\"]\n event.quote_message = params[\"quote_message\"]\n event.save!\n redirect_to \"/generate_quote/#{event_id}\" and return\n end", "def create\n \n params[\"_json\"].each do |params_hash|\n puts params_hash.inspect\n @ticker_activity = TickerActivity.new(params_hash)\n @ticker_activity.save\n end\n\n #@ticker_activity = TickerActivity.new(params[:ticker_activity])\n\n respond_to do |format|\n if @ticker_activity.save\n format.html { redirect_to @ticker_activity, notice: 'Ticker was successfully created.' }\n format.json { render json: @ticker_activity, status: :created, location: @ticker_activity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ticker_activity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @qanote = current_user.qanotes.build(qanote_parameters)\n \n respond_to do |format|\n if @qanote.save\n QanoteMailer.newtag(current_user).deliver\n format.html { redirect_to @qanote, notice: 'Qanote was successfully created.' }\n format.json { render action: 'show', status: :created, location: @qanote }\n else\n format.html { render action: 'new' }\n format.json { render json: @qanote.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_new_rent\n quote_details = SAMPLE_QUOTE_DETAILS.deep_dup\n quote_details['fixed_price_services_requested']['price'] = 1200\n params_hash = {\n udprn: '123456',\n services_required: SAMPLE_SERVICES_REQUIRED,\n payment_terms: SAMPLE_PAYMENT_TERMS,\n quote_details: quote_details.to_json\n }\n first_params_hash = params_hash.deep_dup\n first_params_hash[:quote_details] = SAMPLE_QUOTE_DETAILS.to_json\n post :new_quote_for_property, first_params_hash\n prev_quote_count = Agents::Branches::AssignedAgents::Quote.count\n post :new, params_hash\n assert_response 200\n assert_equal Agents::Branches::AssignedAgents::Quote.count, (prev_quote_count + 1)\n end", "def talk_params\n params.require(:talk).permit(:body, :sender_id, :recepient_id)\n end", "def create_insurance_quote_using_post_with_http_info(insurance_quote, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InsuranceApi.create_insurance_quote_using_post ...'\n end\n # verify the required parameter 'insurance_quote' is set\n if @api_client.config.client_side_validation && insurance_quote.nil?\n fail ArgumentError, \"Missing the required parameter 'insurance_quote' when calling InsuranceApi.create_insurance_quote_using_post\"\n end\n # resource path\n local_var_path = '/insurance_quote'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(insurance_quote)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InsuranceQuote')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InsuranceApi#create_insurance_quote_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n question_response = QuestionResponse.build_response_essay(current_user, params)\n\n if question_response.try :save\n render json: { message: \"answer saved\" }\n else\n render json: { message: \"error\" }, status: :unprocessable_entity\n end\n end", "def test_new\n quote_details = SAMPLE_QUOTE_DETAILS.deep_dup\n quote_details['fixed_price_services_requested']['price'] = 1200\n params_hash = {\n udprn: SAMPLE_UDPRN,\n services_required: SAMPLE_SERVICES_REQUIRED,\n payment_terms: SAMPLE_PAYMENT_TERMS,\n quote_details: quote_details.to_json\n }\n first_params_hash = params_hash.deep_dup\n first_params_hash[:quote_details] = SAMPLE_QUOTE_DETAILS.to_json\n post :new_quote_for_property, first_params_hash\n prev_quote_count = Agents::Branches::AssignedAgents::Quote.count\n post :new, params_hash\n assert_response 200\n assert_equal Agents::Branches::AssignedAgents::Quote.count, (prev_quote_count + 1)\n end" ]
[ "0.65628976", "0.6458151", "0.64493793", "0.6426537", "0.6315236", "0.614887", "0.61268556", "0.60901684", "0.60508174", "0.60490125", "0.60490125", "0.60316014", "0.60283315", "0.6021632", "0.59683275", "0.5949569", "0.59227866", "0.5812546", "0.57873976", "0.5772727", "0.5761492", "0.5756432", "0.5731889", "0.56744903", "0.56720203", "0.56697387", "0.5620919", "0.5613909", "0.5537458", "0.5496904", "0.5490064", "0.54879636", "0.54650164", "0.54640424", "0.546176", "0.54509777", "0.5438583", "0.5434031", "0.54305303", "0.5420819", "0.5414734", "0.5392006", "0.5377685", "0.53551584", "0.5347099", "0.53446484", "0.53379923", "0.53046894", "0.5292006", "0.52887934", "0.52849567", "0.5278294", "0.5268451", "0.5267727", "0.5264039", "0.5264039", "0.5262031", "0.52521104", "0.5247935", "0.52447516", "0.52447516", "0.52443284", "0.5243101", "0.5234264", "0.5232714", "0.52301633", "0.5220462", "0.52168095", "0.5216613", "0.52136135", "0.52044886", "0.5199363", "0.51938194", "0.51895857", "0.51872677", "0.5186993", "0.5186993", "0.5182259", "0.5180755", "0.51752", "0.5170394", "0.51618856", "0.51590735", "0.51503414", "0.51460654", "0.5145534", "0.51425993", "0.5138005", "0.5133946", "0.512581", "0.5111911", "0.51102173", "0.5102462", "0.51008785", "0.51007766", "0.5100736", "0.50844115", "0.5081011", "0.5073129", "0.50681114" ]
0.74273187
0
PUT /participant_quotes/1 PUT /participant_quotes/1.json
def update @participant_quote = ParticipantQuote.find(params[:id]) respond_to do |format| if @participant_quote.update_attributes(params[:participant_quote]) format.html { redirect_to @participant_quote, notice: 'Participant quote was successfully updated.' } format.json { head :no_content } else format.html { render :edit } format.json { render json: @participant_quote.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @participant_quote = ParticipantQuote.new(params[:participant_quote])\n @participant_quote.user_id = current_user.id\n\n respond_to do |format|\n if @participant_quote.save\n format.html { redirect_to @participant_quote, notice: 'Participant quote was successfully created.' }\n format.json { render json: @participant_quote, status: :created, location: @participant_quote }\n else\n format.html { render :new }\n format.json { render json: @participant_quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @quote.update_attributes(params[:quote])\n respond_with(@quote)\n end", "def destroy\n @participant_quote = ParticipantQuote.find(params[:id])\n @participant_quote.destroy\n\n respond_to do |format|\n format.html { redirect_to participant_quotes_url }\n format.json { head :no_content }\n end\n end", "def update\n @quote = Quote.find(params[:id])\n @quote.update_attributes(quote_params)\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Quote was successfully created.' }\n format.json { render action: 'show', status: :created, location: @quote }\n else\n format.html { render action: 'new' }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @quote = Quote.find(params[:id])\n\n respond_to do |format|\n if @quote.update_attributes(params[:quote])\n format.html { redirect_to @quote, notice: 'Quote was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @quote = Quote.find(params[:id])\n\n respond_to do |format|\n if @quote.update_attributes(params[:quote])\n format.html { redirect_to @quote, notice: 'Quote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @quote = Quote.find(params[:id])\n\n respond_to do |format|\n if @quote.update_attributes(params[:quote])\n format.html { redirect_to @quote, notice: 'Quote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @quote = Quote.find(params[:id])\n\n respond_to do |format|\n if @quote.update_attributes(params[:quote])\n format.html { redirect_to @quote, notice: 'Quote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @quote.update(quote_params)\n format.html { redirect_to @quote, notice: \"Quote was successfully updated.\" }\n format.json { render :show, status: :ok, location: @quote }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @quote.update(quote_params)\n end", "def update\n respond_to do |format|\n if @quote.update(quote_params)\n format.html { redirect_to @quote, notice: 'Quote was successfully updated.' }\n format.json { render :show, status: :ok, location: @quote }\n else\n format.html { render :edit }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @quote.update(quote_params)\n format.html { redirect_to @quote, notice: 'Quote was successfully updated.' }\n format.json { render :show, status: :ok, location: @quote }\n else\n format.html { render :edit }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @quote.update(quote_params)\n format.html { redirect_to @quote, notice: 'Quote was successfully updated.' }\n format.json { render :show, status: :ok, location: @quote }\n else\n format.html { render :edit }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @quote.update(quote_params)\n format.html { redirect_to @quote, notice: 'Quote was successfully updated.' }\n format.json { render :show, status: :ok, location: @quote }\n else\n format.html { render :edit }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @quote.update(quote_params)\n format.html { redirect_to @quote, notice: 'Quote was successfully updated.' }\n format.json { render :show, status: :ok, location: @quote }\n else\n format.html { render :edit }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @quote.update(quote_params)\n format.html { redirect_to @quote, notice: 'Quote was successfully updated.' }\n format.json { render :show, status: :ok, location: @quote }\n else\n format.html { render :edit }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @quote.update(quote_params)\n format.html { redirect_to @quote, notice: 'Quote was successfully updated.' }\n format.json { render :show, status: :ok, location: @quote }\n else\n format.html { render :edit }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @quote.update(quote_params)\n format.html { redirect_to @quote, notice: 'QUOTE WAS SUCCESSFULLY UPDATED.' }\n format.json { render :show, status: :ok, location: @quote }\n else\n format.html { render :edit }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @favorite_quotes.update(favorite_quote_params)\n format.html { redirect_to @favorite_quote, notice: 'Favorite quote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @favorite_quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quote.save\n respond_with(@quote, :location => person_quotes_path(@person))\n end", "def update\r\n respond_to do |format|\r\n if @quote.update(quote_params)\r\n format.html { redirect_to @quote, notice: 'Quote was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @quote }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @quote.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @quote.update(quote_params)\n format.html { redirect_to @quote, notice: 'Quote was successfully updated.' }\n format.json { render :show, status: :ok, location: @quote }\n else\n format.html { render :edit }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n quote = Quote.find(params[:id])\n url = \"quotes/#{params[:id]}\"\n render :json => {:data => quote, :url => url}\n end", "def update\n quote = Quote.find(params[:id])\n response = Unirest.post \"https://twinword-sentiment-analysis.p.rapidapi.com/analyze/\",\n headers:{\n \"X-RapidAPI-Host\" => \"twinword-sentiment-analysis.p.rapidapi.com\",\n \"X-RapidAPI-Key\" => \"f8988f3300msh1bf9aec476d3e6fp11f826jsn5bb5ceaa92d7\",\n \"Content-Type\" => \"application/x-www-form-urlencoded\"\n },\n parameters:{\n \"text\" => quote.text\n }\n # puts response.body[\"type\"]\n\n @quote.update(\n saved: params[:saved],\n sentiment: response.body[\"type\"]\n )\n @quote.save\n end", "def update\n @quote = Quote.find(params[:id])\n\n respond_to do |format|\n if @quote.update_attributes(params[:quote])\n format.html { redirect_to(@quote, :notice => :quote_updated) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @quote.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_quote\n @quotes= Quote.find(params[:id])\n end", "def create\n @client=Client.find_by_id(params['q_param']['client'])\n title=params['q_param']['title']\n comment=params['q_param']['comment']\n list = [[\"\",\"\",\"1\",\"\"]]\n quote_p={:title=>title,:comment=>comment, :status=>1, :list=>list}\n @quote = @client.quotes.create(quote_p)\n render json: {:quote_id=>@quote.id}\n\n # respond_to do |format|\n # if @quote.save\n # format.html { redirect_to index, notice: 'Quote was successfully created.' }\n # # format.json { render action: 'show', status: :created, location: @quote }\n # else\n # format.html { render action: 'new' }\n # # format.json { render json: @quote.errors, status: :unprocessable_entity }\n # end\n # end\nend", "def update\n # exception if not HTTP POST\n raise \"Only POST to this route!\" unless env[\"REQUEST_METHOD\"] == \"POST\"\n body = env[\"rack.input\"].read\n astr = body.split(\"&\")\n params = {}\n astr.each do |a|\n name, val = a.split \"=\"\n params[name] = val\n end\n quote = FileModel.find(params[\"id\"].to_i)\n quote[\"submitter\"] = params[\"submitter\"]\n quote.save\n\n render :quote, :obj => quote\n end", "def update\n @quote = Quote.find(params[:id])\n\n respond_to do |format|\n if @quote.update_attributes(params[:quote])\n format.html { redirect_to(@quote, :notice => 'Quote was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @quote.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @quote = Quote.find(params[:id])\n\n respond_to do |format|\n if @quote.update_attributes(params[:quote])\n format.html { redirect_to(@quote, :notice => 'Quote was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @quote.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @quote_line.update(quote_line_params)\n format.html { redirect_to @quote_line, notice: 'Quote line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @quote_line.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @quote_detail = QuoteDetail.find(params[:id])\n\n respond_to do |format|\n if @quote_detail.update_attributes(params[:quote_detail])\n format.html { redirect_to @quote_detail, notice: 'Quote detail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quote_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @favorite_quote.update(favorite_quote_params)\n format.html { redirect_to @favorite_quote, notice: 'Favorite quote was successfully updated.' }\n format.json { render :show, status: :ok, location: @favorite_quote }\n else\n format.html { render :edit }\n format.json { render json: @favorite_quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_quote\n @quote = Quote.find(params[:id])\n end", "def update\n respond_to do |format|\n if @quote.update(quote_params)\n format.html { redirect_to edit_admin_quote_url(@quote), notice: 'Quote was successfully updated.' }\n format.json { render json: @quote, status: :ok }\n else\n format.html { redirect_to view_context.admin_model_url(@quote.source), notice: 'Oops! an error occurred while updating the quote.' }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_quote\r\n @quote = Quote.find(params[:id])\r\n end", "def create\n @quoteable = find_quoteable\n @quote = @quoteable.quotes.build(params[:quote])\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Quote was successfully created.' }\n format.json { render json: @quote, status: :created, location: @quote }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @quote.update(quote_params)\n format.html { redirect_to @quote, notice: 'Frase atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @quote }\n else\n format.html { render :edit }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\t\t\t\n\t\t\t\ttparams = params.require(:testimony).permit :quote,:author,:sort,:created_at,:updated_at\n\n\t\t\t\t@testimony = Testimony.find params[:id]\n\n\t\t\t\tif @testimony.update(tparams)\n\n\t\t\t\t\trender json: nil,status: 200\n\n\t\t\t\telse\n\n\t\t\t\t\trender json: nil,status: 422\n\n\t\t\t\tend\n\n\t\t\tend", "def set_quot\n @quote = Quote.find(params[:id])\n end", "def update\n @quote = Quote.find(params[:id])\n assign_tags_to_user\n \n respond_to do |format|\n if @quote.update_attributes(params[:quote])\n flash[:notice] = 'Quote was successfully updated.'\n format.html { redirect_to([@user, @quote]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @quote.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kid_quote.update(kid_quote_params)\n format.html { redirect_to kid_quotes_path, notice: 'Kid quote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kid_quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_quote\n @quote = current_user.quotes.find(params[:id])\n end", "def set_quote\n @quote = Quote.find(params[:id])\n end", "def set_quote\n @quote = Quote.find(params[:id])\n end", "def set_quote\n @quote = Quote.find(params[:id])\n end", "def set_quote\n @quote = Quote.find(params[:id])\n end", "def set_quote\n @quote = Quote.find(params[:id])\n end", "def set_quote\n @quote = Quote.find(params[:id])\n end", "def set_quote\n @quote = Quote.find(params[:id])\n end", "def set_quote\n @quote = Quote.find(params[:id])\n end", "def set_quote\n @quote = Quote.find(params[:id])\n end", "def set_quote\n @quote = Quote.find(params[:id])\n end", "def set_quote\n @quote = Quote.find(params[:id])\n end", "def set_quote\n @quote = Quote.find(params[:id])\n end", "def set_quote\n @quote = Quote.find(params[:id])\n end", "def set_quote\n @quote = Quote.find(params[:id])\n end", "def create\n @quote = current_user.quotes.new(quote_params)\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Quote was successfully created.' }\n format.json { render :show, status: :created, location: @quote }\n else\n format.html { render :new }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_my_quote\n\t\tif @user.update_attributes(my_quote: params[:my_quote])\n\t # response to the JSON\n\t\t\trender json: { success: true,message: \"My quote Successfully Updated.\", response: {my_quote: @user.my_quote} },:status=>200\n\t else\n\t render :json=> { success: false, message: @user.errors },:status=> 203\n\t end\t\n\tend", "def update\n @quote = Quote.find(params[:quote_id])\n @quote_vendor = @quote.quote_vendors.find(params[:id])\n\n respond_to do |format|\n if @quote_vendor.update_attributes(params[:quote_vendor])\n format.html { redirect_to(@quote, :notice => 'Quote vendor was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @quote_vendor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create \n @quote = Quote.new(params[:quote])\n\n \n \n\n\n respond_to do |format|\n @quote.update!(quote_params)\n # p '------------------'\n # p '------------------'\n # p @quote\n # p '------------------'\n # p '------------------'\n if @quote.save \n format.html { redirect_to @quote, notice: \"Save process completed!\" }\n format.json { render json: @quote, status: :created, location: @quote }\n else\n format.html { \n flash.now[:notice]=\"Save proccess coudn't be completed!\" \n render :new \n }\n format.json { render json: @quote.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n @quote = Quote.find(params[:id])\n title=params['q_param']['title']\n total=params['q_param']['total']\n tax_rate=params['q_param']['tax_rate']\n l=params['q_param']['list']\n comment=params['q_param']['comment']\n list=Array.new\n l.keys.each do |j|\n list << [l[j][0],l[j][1],l[j][2],l[j][3]]\n end\n quote_p={:title=>title,:total=>total,:list=>list,:tax_rate=>tax_rate,:comment=>comment}\n @quote.update(quote_p)\n\n # respond_to do |format|\n # if @quote.update(quote_p)\n # format.html {}\n format.json { head :no_content }\n # else\n # format.html {}\n # format.json { render json: @quote.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def update\n @price_quote = PriceQuote.find(params[:id])\n\n respond_to do |format|\n if @price_quote.update_attributes(params[:price_quote])\n format.html { redirect_to @price_quote, notice: 'Price quote was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @price_quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @quote.tag_list = params[:tags]\n respond_to do |format|\n if @quote.update(quote_params)\n format.json { render :show, status: :ok, location: @quote }\n else\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @quarter = Quarter.find(params[:id])\n\n respond_to do |format|\n if @quarter.update_attributes(params[:quarter])\n format.html { redirect_to @quarter, notice: 'Quarter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quarter.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_submit_rent\n quote_details = SAMPLE_QUOTE_DETAILS.deep_dup\n quote_details['fixed_price_services_requested']['price'] = 1200\n params_hash = {\n udprn: '123456',\n services_required: SAMPLE_SERVICES_REQUIRED,\n payment_terms: SAMPLE_PAYMENT_TERMS,\n quote_details: quote_details.to_json\n }\n first_params_hash = params_hash.deep_dup\n first_params_hash[:quote_details] = SAMPLE_QUOTE_DETAILS.to_json\n post :new_quote_for_property, first_params_hash\n post :new, params_hash\n assert_response 200\n\n quote = Agents::Branches::AssignedAgents::Quote.last\n ### Now lets submit the quote\n post :submit, { udprn: '123456', quote_id: quote.id }\n response = Oj.load(@response.body)\n assert_response 200\n assert_equal response['message'], 'The quote is accepted'\n end", "def quote_params\n params.require(:quote).permit(:text, :quoted, :user_id)\n end", "def update\n quotes = Quote.where(:sale_id => @sale.id)\n\n quotes.each { |q| q.destroy }\n\n respond_to do |format|\n if @sale.update(sale_params)\n quantity = params[:quotes_quantity].gsub(/[^\\d^\\.]/, '').to_i\n\n for i in 1..quantity\n @quote = Quote.new\n @quote.amount = (params[:amount]).gsub(/[^\\d^\\.]/, '').to_f\n @quote.is_paid = false\n @quote.number = i\n @quote.total = quantity\n @quote.mounth = (@sale.date + i.month).month\n @quote.year = (@sale.date + i.month).year\n @quote.sale = @sale\n @quote.save\n end\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n megam_rest.update_quotas(to_hash)\n end", "def update\n @quize = Quize.find(params[:id])\n\n respond_to do |format|\n if @quize.update_attributes(params[:quize])\n format.html { redirect_to @quize, notice: 'Quize was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @quize.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_submit\n quote_details = SAMPLE_QUOTE_DETAILS.deep_dup\n quote_details['fixed_price_services_requested']['price'] = 1200\n params_hash = {\n udprn: SAMPLE_UDPRN,\n services_required: SAMPLE_SERVICES_REQUIRED,\n payment_terms: SAMPLE_PAYMENT_TERMS,\n quote_details: quote_details.to_json\n }\n first_params_hash = params_hash.deep_dup\n first_params_hash[:quote_details] = SAMPLE_QUOTE_DETAILS.to_json\n post :new_quote_for_property, first_params_hash\n post :new, params_hash\n assert_response 200\n\n quote = Agents::Branches::AssignedAgents::Quote.last\n ### Now lets submit the quote\n post :submit, { udprn: SAMPLE_UDPRN, quote_id: quote.id }\n response = Oj.load(@response.body)\n assert_response 200\n assert_equal response['message'], 'The quote is accepted'\n end", "def index\n @participant_quotes = ParticipantQuote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @participant_quotes }\n end\n end", "def set_quote\n @quote = Core::Quote.find(params[:id])\n end", "def destroy\n @quote = Quote.find(params[:id])\n @quote.destroy\n\n respond_to do |format|\n format.html { redirect_to quotes_url }\n format.json { head :ok }\n end\n end", "def show\n @participant_quote = ParticipantQuote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @participant_quote }\n end\n end", "def update\n\tredirect_to root_url\n\treturn\n @quote = Quote.find(params[:id])\n\n respond_to do |format|\n if @quote.update_attributes(params[:quote])\n format.html { redirect_to(@quote, :notice => 'Quote was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @quote.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n @quote.destroy\n respond_with(@quote, :location => person_quotes_path(@person))\n end", "def update\n respond_to do |format|\n if @qweet.update(qweet_params)\n format.html { redirect_to @qweet, notice: \"Qweet was successfully updated.\" }\n format.json { render :show, status: :ok, location: @qweet }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @qweet.errors, status: :unprocessable_entity }\n end\n end\n end", "def favorite_quote_params\n params.require(:favorite_quote).permit(:quote_id, :user_id)\n end", "def create\n @quote = Quote.new(quote_params)\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Quote was successfully created.' }\n format.json { render :show, status: :created, location: @quote }\n else\n format.html { render :new }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quote = Quote.new(quote_params)\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Quote was successfully created.' }\n format.json { render :show, status: :created, location: @quote }\n else\n format.html { render :new }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_quote_line\n @quote_line = QuoteLine.find(params[:id])\n end", "def update\n respond_to do |format|\n if @jingle.update(jingle_params)\n format.html { redirect_to @jingle, flash: { notice: 'Jingle was successfully updated.' }}\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @jingle.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @favorite_quotes = FavoriteQuotes.new(favorite_quote_params)\n\n respond_to do |format|\n if @favorite_quotes.save\n format.html { redirect_to @favorite_quote, notice: 'Favorite quote was successfully created.' }\n format.json { render action: 'show', status: :created, location: @favorite_quote }\n else\n format.html { render action: 'new' }\n format.json { render json: @favorite_quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quote = Quote.new(params[:quote])\n @quote.user_id = current_user.id\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Quote was successfully created.' }\n format.json { render json: @quote, status: :created, location: @quote }\n else\n @quotes = Quote.all\n format.html { render action: \"index\" }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def kid_quote_params\n params.require(:kid_quote).permit(:quote, :name, :age)\n end", "def set_favorite_quote\n @favorite_quote = FavoriteQuotes.find(params[:id])\n end", "def destroy\n @quote = Quote.find(params[:id])\n @quote.destroy\n respond_to do |format|\n format.html { redirect_to quotes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quote = Quote.find(params[:id])\n @quote.destroy\n\n respond_to do |format|\n format.html { redirect_to quotes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quote = Quote.find(params[:id])\n @quote.destroy\n\n respond_to do |format|\n format.html { redirect_to quotes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quote = Quote.find(params[:id])\n @quote.destroy\n\n respond_to do |format|\n format.html { redirect_to quotes_url }\n format.json { head :no_content }\n end\n end", "def quote_params\n params.require(:quote).permit(:name,:job_id,:quote_number,:sender_id, :receiver_id,:quote_elements_attributes => [ :id, :content,:quantity,:total, :price, :_destroy ])\n end", "def create\n quote = Quote.create({\n quote_text: params[:quote_text],\n author: params[:author]\n })\n render json: quote\n end", "def update\n p = trial_params.clone\n if p[\"question_ids\"].nil?\n p[\"question_ids\"] = []\n end\n\n respond_to do |format|\n if @trial.update(p)\n format.html { redirect_to @trial, notice: 'Trial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trial.errors, status: :unprocessable_entity }\n end\n end\n end", "def update*args\n pp args: args\n\n @trade = owned_trades.find(params[:id])\n\n if @trade.update_attributes(params[:trade])\n @tradeViewRow = TradesView.find(@trade.id)\n render json: @tradeViewRow\n else\n render json: @trade.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @quote_item.update(quote_item_params)\n format.html { redirect_to @quote_item, notice: 'Quote item was successfully updated.' }\n format.json { render :show, status: :ok, location: @quote_item }\n else\n format.html { render :edit }\n format.json { render json: @quote_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quote = Quote.new(quote_params)\n\n respond_to do |format|\n if @quote.save\n format.html { redirect_to @quote, notice: 'Quote was successfully created.' }\n format.json { render action: 'show', status: :created, location: @quote }\n else\n format.html { render action: 'new' }\n format.json { render json: @quote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @participant.update(participant_update_params)\n respond_with(@participant)\n end", "def quote_like\n @quote = set_quote\n @quote.cnt += 1\n respond_to do |format|\n if @quote.save\n #format.html { redirect_to @quote, notice: 'Quote was successfully liked.' }\n #format.json { render :show, status: :created, location: @quote }\n format.json { render json: {:data => { :quotes => @quote}, :result => { :errorcode => \"\", :messages => \"ok\", :rstatus => 1 }} }\n else\n #format.html { render :new }\n #format.json { render json: @quote.errors, status: :unprocessable_entity }\n format.json { render json: { :result => { :errorcode => \"\", :messages => @quote.errors, :rstatus => 0 }} }\n end\n end\n end", "def quote_like\n @quote = set_quote\n @quote.cnt += 1\n respond_to do |format|\n if @quote.save\n #format.html { redirect_to @quote, notice: 'Quote was successfully liked.' }\n #format.json { render :show, status: :created, location: @quote }\n format.json { render json: {:data => { :quotes => @quote}, :result => { :errorcode => \"\", :messages => \"ok\", :rstatus => 1 }} }\n else\n #format.html { render :new }\n #format.json { render json: @quote.errors, status: :unprocessable_entity }\n format.json { render json: { :result => { :errorcode => \"\", :messages => @quote.errors, :rstatus => 0 }} }\n end\n end\n end" ]
[ "0.6646239", "0.6392883", "0.63439757", "0.6314633", "0.6243085", "0.62193173", "0.6218981", "0.6218981", "0.6170778", "0.61642927", "0.6139782", "0.6139782", "0.6139782", "0.6139782", "0.6139782", "0.6139782", "0.6139782", "0.6123719", "0.6117449", "0.60724217", "0.6052955", "0.59742254", "0.5944004", "0.59392554", "0.5924071", "0.5904746", "0.5898118", "0.58914304", "0.5883857", "0.5883857", "0.58822596", "0.5881965", "0.5880466", "0.5831274", "0.57941943", "0.57926464", "0.5785134", "0.57517797", "0.57497305", "0.57337064", "0.5730438", "0.57188773", "0.5714456", "0.5694901", "0.56943285", "0.56943285", "0.56943285", "0.56943285", "0.56943285", "0.56943285", "0.56943285", "0.56943285", "0.56943285", "0.56943285", "0.56943285", "0.56943285", "0.56943285", "0.56844896", "0.56567997", "0.56542623", "0.5647655", "0.56306833", "0.560858", "0.5607889", "0.5590039", "0.55810535", "0.5580427", "0.556277", "0.55599296", "0.5545001", "0.5512923", "0.5511837", "0.55082136", "0.55001426", "0.5489476", "0.5488709", "0.54811054", "0.54724795", "0.5471086", "0.5441548", "0.5441548", "0.5437004", "0.5435051", "0.543462", "0.5433099", "0.5430353", "0.54269564", "0.54268205", "0.5423471", "0.5423471", "0.5423471", "0.54050344", "0.5395214", "0.5390297", "0.53839844", "0.53830296", "0.53819346", "0.5368249", "0.53663915", "0.53663915" ]
0.74743
0
DELETE /participant_quotes/1 DELETE /participant_quotes/1.json
def destroy @participant_quote = ParticipantQuote.find(params[:id]) @participant_quote.destroy respond_to do |format| format.html { redirect_to participant_quotes_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @quote_line.destroy\n respond_to do |format|\n format.html { redirect_to quote_lines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kid_quote.destroy\n\n respond_to do |format|\n format.html { redirect_to kid_quotes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quote = Quote.find(params[:id])\n @quote.destroy\n\n respond_to do |format|\n format.html { redirect_to quotes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @quote.destroy\n respond_to do |format|\n format.html { redirect_to quotes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quote = Quote.find(params[:id])\n @quote.destroy\n\n respond_to do |format|\n format.html { redirect_to quotes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quote = Quote.find(params[:id])\n @quote.destroy\n\n respond_to do |format|\n format.html { redirect_to quotes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quote = Quote.find(params[:id])\n @quote.destroy\n\n respond_to do |format|\n format.html { redirect_to quotes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quote = Quote.find(params[:id])\n @quote.destroy\n respond_to do |format|\n format.html { redirect_to quotes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quote.destroy\n respond_with(@quote, :location => person_quotes_path(@person))\n end", "def destroy\n @quote.destroy\n respond_to do |format|\n format.html { redirect_to quotes_url, notice: 'Frase apagada' }\n format.json { head :no_content }\n end\n end", "def destroy\n @favorite_quotes.destroy\n respond_to do |format|\n format.html { redirect_to favorite_quotes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quote_detail = QuoteDetail.find(params[:id])\n @quote_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to quote_details_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quote.destroy\n respond_to do |format|\n format.html { redirect_to quotes_url, notice: 'QUOTE WAS SUCCESSFULLY DESTROYED.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @quote.destroy\n head :ok\n end", "def destroy\n @quote.destroy\n respond_to do |format|\n format.html { redirect_to quotes_url, notice: 'Quote was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @quote.destroy\n respond_to do |format|\n format.html { redirect_to quotes_url, notice: 'Quote was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @quote.destroy\n respond_to do |format|\n format.html { redirect_to quotes_url, notice: 'Quote was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @quote.destroy\n respond_to do |format|\n format.html { redirect_to quotes_url, notice: 'Quote was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @quote.destroy\n respond_to do |format|\n format.html { redirect_to quotes_url, notice: 'Quote was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @quote.destroy\n respond_to do |format|\n format.html { redirect_to quotes_url, notice: 'Quote was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @quote.destroy\n respond_to do |format|\n format.html { redirect_to quotes_url, notice: 'Quote was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @quote.destroy\n respond_to do |format|\n format.html { redirect_to quotes_url, notice: 'Quote was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @quote.destroy\n respond_to do |format|\n format.html { redirect_to quotes_url, notice: 'Quote was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @quote.destroy\n respond_to do |format|\n format.html { redirect_to quotes_url, notice: \"Quote was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @order_history_joint.destroy\n respond_to do |format|\n format.html { redirect_to order_history_joints_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @quote.destroy\r\n respond_to do |format|\r\n format.html { redirect_to quotes_url, notice: 'Quote was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url }\n format.json { head :no_content }\n end\n Partextra.where(participant_id: @participant.id).destroy_all\n Badge.where(participant_id: @participant.id).destroy_all\n end", "def destroy\n @quote = Quote.find(params[:id])\n @quote.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_quotes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @quote = Quote.find(params[:id])\n @quote.destroy\n\n respond_to do |format|\n format.html { redirect_to(quotes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @quote = Quote.find(params[:id])\n @quote.destroy\n\n respond_to do |format|\n format.html { redirect_to(quotes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @qu = Qu.find(params[:id])\n @qu.destroy\n\n respond_to do |format|\n format.html { redirect_to qus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @jingle.destroy\n respond_to do |format|\n format.html { redirect_to jingles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @price_quote = PriceQuote.find(params[:id])\n @price_quote.destroy\n\n respond_to do |format|\n format.html { redirect_to price_quotes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @qu = Qu.find(params[:id])\n @qu.destroy\n respond_to do |format|\n format.html { redirect_to qus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quote_of_the_day.destroy\n respond_to do |format|\n format.html { redirect_to quote_of_the_days_url, notice: \"Quote of the day was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @quotation.destroy\n respond_to do |format|\n format.html { redirect_to quotations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @participant.studysite.destroy_all\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url, notice: 'Participant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @thought = Thought.find(params[:id])\n @quast = @thought.quastion\n @thought.destroy\n\n respond_to do |format|\n format.html { redirect_to quastion_path(@quast) }\n format.json { head :no_content }\n end\n end", "def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wedding_planner_quote = WeddingPlannerQuote.find(params[:id])\n @wedding_planner_quote.destroy\n\n respond_to do |format|\n format.html { redirect_to wedding_planner_quotes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @rnaseq = Rnaseq.find(params[:id])\n @rnaseq.destroy\n\n respond_to do |format|\n format.html { redirect_to rnaseqs_url }\n format.json { head :no_content }\n end\n end", "def really_delete\n RankParticipant.only_deleted.find(params[:id]).really_destroy!\n\n respond_to do |format|\n format.html { redirect_to rank_participants_url, notice: 'RankParticipant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url, notice: '' }\n format.json { head :no_content }\n end\n end", "def destroy\n @qa_client = QaClient.find(params[:id])\n @qa_client.destroy\n\n respond_to do |format|\n format.html { redirect_to qa_clients_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @participant = Participant.find(params[:id])\n @participant.destroy\n\n respond_to do |format|\n format.html { redirect_to participants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @participant = Participant.find(params[:id])\n @participant.destroy\n\n respond_to do |format|\n format.html { redirect_to participants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @participant = Participant.find(params[:id])\n @participant.destroy\n\n respond_to do |format|\n format.html { redirect_to participants_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @quize = Quize.find(params[:id])\n @quize.destroy\n\n respond_to do |format|\n format.html { redirect_to quizes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # @participant.destroy\n # respond_to do |format|\n # format.html { redirect_to participants_url, notice: 'Participant was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def destroy\n @qa = Qa.find(params[:id])\n @qa.destroy\n\n respond_to do |format|\n format.html { redirect_to qas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quotation = Quotation.find(params[:id])\n @quotation.destroy\n\n respond_to do |format|\n format.html { redirect_to(quotations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @quotation.destroy\n respond_to do |format|\n format.html { redirect_to quotations_url, notice: 'Quotation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @quote_db.destroy\n respond_to do |format|\n format.html { redirect_to quote_dbs_url, notice: 'Quote db was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\tredirect_to root_url\n\treturn\n @quote = Quote.find(params[:id])\n @quote.destroy\n\n respond_to do |format|\n format.html { redirect_to(quotes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @quest = Quest.find(params[:id])\n @quest.destroy\n\n respond_to do |format|\n format.html { redirect_to quests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @gotcha = Gotcha.find(params[:id])\n @gotcha.destroy\n\n respond_to do |format|\n format.html { redirect_to gotchas_url, notice: 'Gotcha was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @trade_line.destroy\n respond_to do |format|\n format.html { redirect_to trade_lines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @qweet.destroy\n respond_to do |format|\n format.html { redirect_to qweets_url, notice: \"Qweet was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @quote.destroy\n end", "def destroy\n @quote = Quote.find(params[:id])\n @quote.destroy\n\n respond_to do |format|\n #format.html { redirect_to(admin_url) }\n format.html { redirect_to request.referer }\n format.xml { head :ok }\n end\n end", "def delete\n render json: Like.delete(params[\"id\"])\n end", "def destroy\n @quote_audit = QuoteAudit.find(params[:id])\n @quote_audit.destroy\n\n respond_to do |format|\n format.html { redirect_to(quote_audits_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @participate.destroy\n\n respond_to do |format|\n format.html { redirect_to participates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @q_response = QResponse.find(params[:id])\n @q_response.destroy\n\n respond_to do |format|\n format.html { redirect_to q_responses_url }\n format.json { head :ok }\n end\n end", "def destroy\n @unique_whiteline.destroy\n respond_to do |format|\n format.html { redirect_to unique_whitelines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quote_item.destroy\n respond_to do |format|\n format.html { redirect_to quote_items_url, notice: 'Quote item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @quartier = Quartier.find(params[:id])\n @quartier.destroy\n\n respond_to do |format|\n format.html { redirect_to quartiers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @participant.destroy\n respond_with(@participant)\n end", "def destroy\n @participant.destroy\n respond_with(@participant)\n end", "def destroy\n @quize.destroy\n respond_to do |format|\n format.html { redirect_to quizes_url, notice: 'Quize was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @quartet = Quartet.find(params[:id])\n @quartet.destroy\n\n respond_to do |format|\n format.html { redirect_to quartets_url }\n format.json { head :ok }\n end\n end", "def destroy\n @adaptive_thought.destroy\n respond_to do |format|\n format.html { redirect_to adaptive_thoughts_url, notice: 'Adaptive thought was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @todo3.destroy\n respond_to do |format|\n format.html { redirect_to todo3s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url, notice: 'Participant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url, notice: 'Participant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to participants_url, notice: 'Participant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @interested = Interested.find(params[:id])\n @interested.destroy\n\n respond_to do |format|\n format.html { redirect_to interesteds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @example_two.destroy\n respond_to do |format|\n format.html { redirect_to example_twos_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @qa.destroy\n respond_to do |format|\n format.html { redirect_to qas_url, notice: 'Qa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @chord.destroy\n respond_to do |format|\n format.html { redirect_to chords_url, notice: 'Chord was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @quarto.destroy\n respond_to do |format|\n format.html { redirect_to quartos_url, notice: 'Quarto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @testimonial = Testimonial.find(params[:id])\n @testimonial.destroy\n\n respond_to do |format|\n format.html { redirect_to testimonials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quinto.destroy\n respond_to do |format|\n format.html { redirect_to quintos_url, notice: 'Quinto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @note.destroy\n respond_to do |format|\n format.html { redirect_to participant_path(@participant), notice: 'Note was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cord.destroy\n respond_to do |format|\n format.html { redirect_to cords_url, notice: t('cords.destroy.success') }\n format.json { head :no_content }\n end\n end", "def destroy\n @participant.destroy\n respond_to do |format|\n format.html { redirect_to admin_participants_url, notice: 'Participant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @q = Q.find_by_unique_id(params[:id])\n @q.destroy\n\n respond_to do |format|\n format.html { redirect_to qs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @thought.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Thought was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @voice_part = VoicePart.find(params[:id])\n @voice_part.destroy\n\n respond_to do |format|\n format.html { redirect_to voice_parts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @quest.destroy\n respond_to do |format|\n format.html { redirect_to quests_url, notice: 'Quest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n answer = Answer.find(params[:answer_id])\n answer.destroy\n \n render json: {success: true}\n end", "def destroy\n @thirtyone.destroy\n respond_to do |format|\n format.html { redirect_to thirtyones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sidequest.destroy\n respond_to do |format|\n format.html { redirect_to sidequests_url, notice: 'Sidequest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @expectation = Expectation.find(params[:id])\n @expectation.destroy\n\n respond_to do |format|\n format.html { redirect_to expectations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @chatline = Chatline.find(params[:id])\n @chatline.destroy\n\n respond_to do |format|\n format.html { redirect_to chatlines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @testimonial.destroy\n respond_to do |format|\n format.html { redirect_to testimonials_url, notice: 'Testimonial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.7170655", "0.7156321", "0.7148859", "0.7135716", "0.71331376", "0.71331376", "0.71331376", "0.7118539", "0.70611763", "0.70055383", "0.69864243", "0.6945002", "0.6933887", "0.6926167", "0.69126016", "0.69126016", "0.69126016", "0.69126016", "0.69126016", "0.69126016", "0.69126016", "0.69126016", "0.69126016", "0.6905434", "0.6896789", "0.68446845", "0.6839134", "0.6836374", "0.6825431", "0.6825431", "0.6763644", "0.6756153", "0.67541426", "0.67381465", "0.67351896", "0.6734876", "0.6691366", "0.6687172", "0.6675139", "0.6675139", "0.66490483", "0.6644985", "0.66398835", "0.6628773", "0.6616891", "0.65995735", "0.65923804", "0.65923804", "0.6589208", "0.65834", "0.65727574", "0.6568088", "0.6567726", "0.6564759", "0.6561114", "0.6557592", "0.65398866", "0.6520414", "0.6519674", "0.65147406", "0.65117943", "0.6511116", "0.6508187", "0.6506671", "0.65023136", "0.65005493", "0.6498826", "0.6492962", "0.64901304", "0.6489571", "0.64876187", "0.64876187", "0.6486479", "0.6485269", "0.6479118", "0.6471988", "0.6469705", "0.6469705", "0.6469705", "0.64683276", "0.64538676", "0.6445711", "0.6441458", "0.6434534", "0.6433083", "0.6432509", "0.6410965", "0.64075696", "0.6402925", "0.6396286", "0.6394745", "0.6391991", "0.639068", "0.63896215", "0.6386759", "0.63865566", "0.63819605", "0.6380408", "0.6379757", "0.6378933" ]
0.7952621
0
Determines if a shell command exists by searching for it in ENV['PATH'].
def command_exists?(command) ENV['PATH'].split(File::PATH_SEPARATOR).any? {|d| File.exists? File.join(d, command) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shell_command_exists?(command)\n ENV['PATH'].split(File::PATH_SEPARATOR).any?{|d| File.exists? File.join(d, command) }\n end", "def command_exists(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n }\n end\n return nil\n end", "def command_exists?(command)\n ENV['PATH'].split(File::PATH_SEPARATOR).any? do |root|\n path = File.join(root, command)\n File.executable?(path) && File.file?(path)\n end\n end", "def command?(command)\n ENV['PATH'].split(':').any? do |directory|\n File.exists?(File.join(directory, command))\n end\nend", "def command_exists?(command)\n ENV['PATH'].split(File::PATH_SEPARATOR).any? {|d| File.exists? File.join(d, command) }\n end", "def command_exists?(command)\n ENV['PATH'].split(File::PATH_SEPARATOR).any? {|d| File.exists? File.join(d, command) }\n end", "def command_in_path?(command)\n found = ENV['PATH'].split(File::PATH_SEPARATOR).map do |p|\n File.exist?(File.join(p, command))\n end\n found.include?(true)\n end", "def command_in_path?(command)\n found = ENV['PATH'].split(File::PATH_SEPARATOR).map do |p|\n File.exist?(File.join(p, command))\n end\n found.include?(true)\n end", "def command_exist?(command)\n exts = env.fetch(\"PATHEXT\", \"\").split(::File::PATH_SEPARATOR)\n env.fetch(\"PATH\", \"\").split(::File::PATH_SEPARATOR).any? do |dir|\n file = ::File.join(dir, command)\n ::File.exist?(file) || exts.any? { |ext| ::File.exist?(\"#{file}#{ext}\") }\n end\n end", "def which(cmd)\n\tpaths = ENV[\"PATH\"].split(\":\")\n\tpaths.push(\"/usr/local/bin\", \"/usr/bin\", \"/bin\").uniq!\n\tpaths.each do |dir|\n\t\tfile = dir + \"/\" + cmd\n\t\tif File.file?(file) and File.executable?(file)\n\t\t\treturn true end\n\tend\n\treturn\nend", "def command?(command)\n system(\"which #{command} > /dev/null 2>&1\")\n end", "def command?(command)\n system(\"which #{command} > /dev/null 2>&1\")\n end", "def have_command?(command)\n # May be shell-dependent, OS-dependent\n # Kernel#system does not raise Errno::ENOENT when running under the Bundler\n !`which #{command}`.empty?\n end", "def command?(name)\n `which #{name}`\n $?.success?\nend", "def command?(name)\n `which #{name}`\n $?.success?\nend", "def command_available?(command)\n find = Releasy.win_platform? ? \"where\" : \"which\"\n # Call this Kernel version of `` so it can be mocked in testing.\n result = Kernel.`(\"#{find} #{command}\")\n return false unless $? == 0\n result\n end", "def has_executable(path)\n # Be smart: If the path includes a forward slash, we're checking\n # an absolute path. Otherwise, we're checking a global executable\n if path.include?('/')\n @commands << \"test -x #{path}\"\n else\n @commands << \"[ -n \\\"`echo \\\\`which #{path}\\\\``\\\" ]\"\n end\n end", "def has_executable(path)\n # Be smart: If the path includes a forward slash, we're checking\n # an absolute path. Otherwise, we're checking a global executable\n if path.include?('/')\n @commands << \"test -x #{path}\"\n else\n @commands << \"[ -n \\\"`echo \\\\`which #{path}\\\\``\\\" ]\"\n end\n end", "def exec_in_path(command)\n ENV['PATH'].split(':').collect {|d| Dir.entries d if Dir.exists? d}.flatten.include?(command)\n end", "def command_exist?(command)\r\n basename = File.basename(command)\r\n path = +\"\"\r\n print \"Checking #{basename}: \"\r\n begin\r\n if open(\"| which #{command} 2>/dev/null\") { |f| path = f.gets.strip }\r\n puts \"detected [#{path}]\"\r\n path.strip\r\n elsif open(\"| which #{basename} 2>/dev/null\") { |f| path = f.gets.strip }\r\n puts \"detected [#{path}]\"\r\n path.strip\r\n else\r\n puts \"#{basename} not found\"\r\n false\r\n end\r\n rescue StandardError\r\n puts \"#{basename} not found\"\r\n false\r\n end\r\n end", "def valid_command_path?(path)\n File.exist?(path) && File.executable?(path)\n end", "def which cmd\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which cmd\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(bin, *path)\n path = path + ['/usr/bin', '/usr/sbin', '/usr/local/bin', '/usr/local/sbin']\n path += ENV['PATH'].split(File::PATH_SEPARATOR)\n path.flatten.uniq.each do |dir|\n dest = File.join(dir, bin)\n return dest if FileTest.file? dest and FileTest.executable? dest\n end\n return false\n rescue StandardError => e\n logger.warn e\n return false\n end", "def which(cmd, extra_path: %w{/bin /usr/bin /sbin /usr/sbin}, path: nil)\n # If it was already absolute, just return that.\n return cmd if cmd =~ /^(\\/|([a-z]:)?\\\\)/i\n # Allow passing something other than the real env var.\n path ||= ENV['PATH']\n # Based on Chef::Mixin::Which#which\n # Copyright 2010-2015, Chef Softare, Inc.\n paths = path.split(File::PATH_SEPARATOR) + extra_path\n paths.each do |candidate_path|\n filename = ::File.join(candidate_path, cmd)\n return filename if ::File.executable?(filename)\n end\n false\n end", "def installed?\n !IO.popen(\"which #{self}\"){|i| i.read}.empty?\n end", "def which(cmd)\n ENV[\"PATH\"] = \"\" if ENV[\"PATH\"].nil?\n paths = (ENV['PATH'].split(::File::PATH_SEPARATOR) + %w(/bin /usr/bin /sbin /usr/sbin))\n\n paths.each do |path|\n possible = File.join(path, cmd)\n return possible if File.executable?(possible)\n end\n\n nil\n end", "def exec_exist?(*args)\n require 'tty-which'\n TTY::Which.exist?(*args)\n end", "def exec_exist?(*args)\n require 'tty-which'\n TTY::Which.exist?(*args)\n end", "def exec_exixts?(name)\n `which #{name}`.start_with?('/')\n end", "def shell_command?(variable)\n variable =~ /^`.*`$/m\n end", "def exec_exist?(*args)\n require \"tty-which\"\n TTY::Which.exist?(*args)\n end", "def which(cmd)\r\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\r\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\r\n exts.each { |ext|\r\n exe = File.join(path, \"#{cmd}#{ext}\")\r\n return exe if File.executable? exe\r\n }\r\n end\r\n return nil\r\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n end\n end\n\n nil\nend", "def check_path_for(command)\n unless FileTest.executable?(command) || system_path.split(\":\").any?{ |path| FileTest.executable?(File.join(path, command))}\n raise ExecutableNotFoundError, command\n end\n command\n end", "def which(cmd)\r\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\r\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\r\n exts.each do |ext|\r\n exe = File.join(path, \"#{cmd}#{ext}\")\r\n return exe if File.executable?(exe) && !File.directory?(exe)\r\n end\r\n end\r\n nil\r\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\nreturn nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each {|ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n }\n end\n nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n }\n end\n\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\nend", "def installed?(cmd)\n !Garcon::FileHelper.which(cmd).nil?\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |dir|\n exts.each do |ext|\n path = File.join(dir, \"#{cmd}#{ext}\")\n if File.executable?(path) && File.file?(path)\n return path\n end\n end\n end\n nil\n end", "def installed?(command)\n MakeMakefile.find_executable(command)\n end", "def find_executable_in_path(command_name)\n ENV['PATH'].split(/;|:/).each do |dir|\n path = File.join(dir, command_name)\n return path if File.executable?(path)\n end\n return nil\n end", "def find_executable_in_path(command_name)\n ENV['PATH'].split(/;|:/).each do |dir|\n path = File.join(dir, command_name)\n return path if File.executable?(path)\n end\n return nil\n end", "def has_executable_in_path(command_name)\n return nil != find_executable_in_path(command_name)\n end", "def which(cmd)\n exts = ENV[\"PATHEXT\"] ? ENV[\"PATHEXT\"].split(\";\") : [\"\"]\n ENV[\"PATH\"].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\nend", "def os_command?(str)\n str.start_with?('grep ', 'which ') or # common commands\n str.include?('|') or # probably a pipe, could be alternation\n str.match(/^[\\w]+$/) or # command name only\n str.match(/ --?[a-z]/i) # command-line flag\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n # return nil\n end", "def which command\n require 'open3'\n Open3.popen3(\"which #{command}\") do |stdin, stdout, stderr, wait_thr|\n if wait_thr.value.to_i == 0\n availability = true\n else\n availability = false\n end\n return availability\n end\n end", "def executable_exists?(executable_handle)\n %x[which #{executable_handle} 2>/dev/null][0] == \"/\"\n end", "def command?(name)\n !which(name).nil?\nend", "def in_path?(name)\n (`which #{name}`).to_s.strip.size > 0\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n }\n end\n return nil\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n }\n end\n return nil\n end", "def which(cmd)\r\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\r\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\r\n exts.each do |ext|\r\n exe = File.join(path, \"#{cmd}#{ext}\")\r\n return exe if File.executable?(exe) && !File.directory?(exe)\r\n end\r\n end\r\n nil\r\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n end\n end\n return nil\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n end\n end\n return nil\n end", "def check_command_existence(cmd_name)\n\tret = `type #{cmd_name} 1>/dev/null 2>/dev/null`\n\treturn $?.exitstatus == 0 ? true : false\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\n end", "def command_exists?\n COMMANDS.include? @command\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each {|ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n }\n end\n return nil\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n end\n end\n nil\n end", "def command_exists?\n File.exists? self.command_file\n end", "def which(cmd)\n\t# Stolen from http://stackoverflow.com/questions/210872\n\texts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n\tENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n\t\texts.each { |ext|\n\t\t\texe = File.join(path, \"#{cmd}#{ext}\")\n\t\t\treturn exe if File.executable? exe\n\t\t}\n\tend\n \treturn nil\nend", "def validate_command_path\n command = self.command\n # TODO/REFACTOR: We're finding the command using everything until the first space. Kind of lame...\n command_executable = command.match(/(^[^\\s]+)/).try(:[], 1) # Get the name of the actual command\n unless command_executable.present?\n errors.add(:command, \"must contain a valid, executable system command.\")\n return false\n end\n\n cmd_abs_path = `which #{command_executable}`.chomp # Check for existance in executable path, get full path\n unless $?.to_i == 0\n errors.add(:command, \"must contain a valid, executable system command.\")\n return false\n end\n\n if cmd_abs_path == command_executable\n return true\n else\n # TODO/REFACTOR: We're finding the command using everything until the first space. Kind of lame...\n self.command = command.sub(/(^[^\\s]+)/, cmd_abs_path); # Replace command with full-path command\n return true\n end\n end", "def program_in_path?(program)\n # Scan path to find the executable\n # Do this to help the user get a better error message.\n envpath = ENV[\"PATH\"].split(\":\")\n return envpath.select { |p| File.executable?(File.join(p, program)) }.any?\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\n end" ]
[ "0.86624485", "0.837481", "0.8278965", "0.82658935", "0.82646716", "0.81825876", "0.8114473", "0.8114473", "0.7852806", "0.7778245", "0.7777762", "0.7777762", "0.76492614", "0.75879896", "0.75879896", "0.7575491", "0.75593084", "0.7525238", "0.75060236", "0.74422103", "0.74252826", "0.72569543", "0.72569543", "0.7210396", "0.71960545", "0.7179515", "0.7133374", "0.71173465", "0.71173465", "0.7108796", "0.70989084", "0.7096337", "0.70736253", "0.70696354", "0.70696354", "0.70696354", "0.70696354", "0.70696354", "0.70696354", "0.70696354", "0.70696354", "0.70696354", "0.70696354", "0.70696354", "0.70696354", "0.70696354", "0.70696354", "0.7061703", "0.7061703", "0.70613676", "0.70613676", "0.70613676", "0.70613676", "0.70613676", "0.70613676", "0.70613676", "0.70599353", "0.7059471", "0.70593727", "0.705567", "0.7040317", "0.7040317", "0.7040317", "0.7040317", "0.7037711", "0.70363533", "0.70275515", "0.70266724", "0.70266724", "0.70266724", "0.70266724", "0.70253325", "0.7005737", "0.69938314", "0.69726926", "0.69726926", "0.6971177", "0.69679016", "0.69379365", "0.69143665", "0.69096214", "0.6905039", "0.69001895", "0.68805444", "0.6879168", "0.6879168", "0.68788606", "0.6873329", "0.6873329", "0.68657327", "0.6865213", "0.68594617", "0.68536526", "0.684802", "0.6835944", "0.6821796", "0.68154204", "0.68055034", "0.6800981", "0.6800981" ]
0.837463
2
Returns [width, height] of terminal when detected, nil if not detected. Think of this as a simpler version of Highline's Highline::SystemExtensions.terminal_size()
def detect_terminal_size if (ENV['COLUMNS'] =~ /^\d+$/) && (ENV['LINES'] =~ /^\d+$/) [ENV['COLUMNS'].to_i, ENV['LINES'].to_i] elsif (RUBY_PLATFORM =~ /java/ || (!STDIN.tty? && ENV['TERM'])) && command_exists?('tput') [`tput cols`.to_i, `tput lines`.to_i] elsif STDIN.tty? && command_exists?('stty') `stty size`.scan(/\d+/).map { |s| s.to_i }.reverse else nil end rescue nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detect_terminal_size\n if (ENV['COLUMNS'] =~ /^\\d+$/) && (ENV['LINES'] =~ /^\\d+$/)\n [ENV['COLUMNS'].to_i, ENV['LINES'].to_i]\n elsif (RUBY_PLATFORM =~ /java/ || (!STDIN.tty? && ENV['TERM'])) && command_exists?('tput')\n [`tput cols`.to_i, `tput lines`.to_i]\n elsif STDIN.tty? && command_exists?('stty')\n `stty size`.scan(/\\d+/).map { |s| s.to_i }.reverse\n else\n nil\n end\n rescue\n nil\n end", "def terminal_size\n if (ENV['COLUMNS'] =~ /^\\d+$/) && (ENV['LINES'] =~ /^\\d+$/)\n [ENV['COLUMNS'].to_i, ENV['LINES'].to_i]\n elsif (RUBY_PLATFORM =~ /java/ || (!STDIN.tty? && ENV['TERM'])) && command_exists?('tput')\n [`tput cols`.to_i, `tput lines`.to_i]\n elsif STDIN.tty? && command_exists?('stty')\n `stty size`.scan(/\\d+/).map { |s| s.to_i }.reverse\n else\n nil\n end\n rescue\n nil\n end", "def terminal_size\n if (ENV['COLUMNS'] =~ /^\\d+$/) && (ENV['LINES'] =~ /^\\d+$/)\n [ENV['COLUMNS'].to_i, ENV['LINES'].to_i]\n elsif (RUBY_PLATFORM =~ /java/ || (!STDIN.tty? && ENV['TERM'])) && command_exists?('tput')\n [`tput cols`.to_i, `tput lines`.to_i]\n elsif STDIN.tty? && command_exists?('stty')\n `stty size`.scan(/\\d+/).map{ |s| s.to_i }.reverse\n else\n nil\n end\n rescue\n nil\n end", "def terminal_size\n m_GetStdHandle = Win32API.new( 'kernel32',\n 'GetStdHandle',\n ['L'],\n 'L' )\n m_GetConsoleScreenBufferInfo = Win32API.new(\n 'kernel32', 'GetConsoleScreenBufferInfo', ['L', 'P'], 'L'\n )\n\n format = 'SSSSSssssSS'\n buf = ([0] * format.size).pack(format)\n stdout_handle = m_GetStdHandle.call(0xFFFFFFF5)\n \n m_GetConsoleScreenBufferInfo.call(stdout_handle, buf)\n bufx, bufy, curx, cury, wattr,\n left, top, right, bottom, maxx, maxy = buf.unpack(format)\n return right - left + 1, bottom - top + 1\n end", "def terminal_dimensions\n [0, 0] unless STDOUT.tty?\n [80, 40] if OS.windows?\n\n if ENV['COLUMNS'] && ENV['LINES']\n [ENV['COLUMNS'].to_i, ENV['LINES'].to_i]\n elsif ENV['TERM'] && command_in_path?('tput')\n [`tput cols`.to_i, `tput lines`.to_i]\n elsif command_in_path?('stty')\n `stty size`.scan(/\\d+/).map {|s| s.to_i }\n else\n [0, 0]\n end\n rescue\n [0, 0]\n end", "def terminal_height\n terminal_size.last\n end", "def terminal_size\n if /solaris/ =~ RUBY_PLATFORM && (`stty` =~ /\\brows = (\\d+).*\\bcolumns = (\\d+)/)\n w, r = [$2, $1]\n else\n w, r = `stty size`.split.reverse\n end\n w = `tput cols` unless w # last ditch effort to at least get width\n\n w = w.to_i if w\n r = r.to_i if r\n\n return w, r\n end", "def terminal_size\n if JRUBY_VERSION =~ /^1.7/\n [ @java_terminal.get_width, @java_terminal.get_height ]\n else\n [ @java_terminal.getTerminalWidth, @java_terminal.getTerminalHeight ]\n end\n end", "def terminal_size\n format = 'SSSSSssssSS'\n buf = ([0] * format.size).pack(format)\n stdout_handle = WinAPI.GetStdHandle(0xFFFFFFF5)\n\n WinAPI.GetConsoleScreenBufferInfo(stdout_handle, buf)\n _, _, _, _, _,\n left, top, right, bottom, _, _ = buf.unpack(format)\n return right - left + 1, bottom - top + 1\n end", "def get_terminal_size\n terminal_size ||= {}\n if ENV[\"LINES\"] && ENV[\"COLUMNS\"]\n terminal_size[\"lines\"] = ENV[\"LINES\"]\n terminal_size[\"columns\"] = ENV[\"COLUMNS\"]\n elsif (RUBY_PLATFORM =~ /java/ || (!STDIN.tty? && ENV['TERM'])) && shell_command_exists?('tput')\n terminal_size[\"lines\"] = `tput lines`.strip.to_i\n terminal_size[\"columns\"] = `tput cols`.strip.to_i\n elsif STDIN.tty? && shell_command_exists?('stty')\n terminal_size[\"lines\"], terminal_size[\"columns\"] = `stty size`.strip.split(/\\s/).map(&:to_i)\n else\n terminal_size[\"lines\"], terminal_size[\"columns\"] = 40, 90\n end\n terminal_size\n end", "def get_terminal_width\n if (ENV['COLUMNS'] =~ /^\\d+$/)\n ENV['COLUMNS'].to_i\n elsif (RUBY_PLATFORM =~ /java/ || (!STDIN.tty? && ENV['TERM'])) && command_exists?('tput')\n `tput cols`.to_i\n elsif STDIN.tty? && command_exists?('stty')\n `stty size`.scan(/\\d+/).map { |s| s.to_i }.reverse[0]\n else\n 80\n end\n rescue\n 80\n end", "def terminal_width\n terminal_size.first\n end", "def height\n Terminal.height\n end", "def terminal_size\n if /solaris/ =~ RUBY_PLATFORM and\n `stty` =~ /\\brows = (\\d+).*\\bcolumns = (\\d+)/\n [$2, $1].map { |c| x.to_i }\n else\n `stty size`.split.map { |x| x.to_i }.reverse\n end\n end", "def retrieve_terminal_width\n ts = TerminalSize::TerminalSize.new()\n @width = ts.columns - @entry_size - 3\n end", "def terminal_height; end", "def terminal_height; end", "def terminal_size\n size = [80, 40]\n FFI::NCurses.initscr\n begin\n size = FFI::NCurses.getmaxyx(FFI::NCurses.stdscr).reverse\n ensure\n FFI::NCurses.endwin\n end\n size\n end", "def terminal_size\n size = [80, 40]\n FFI::NCurses.initscr\n begin\n size = FFI::NCurses.getmaxyx(FFI::NCurses.stdscr).reverse\n ensure\n FFI::NCurses.endwin\n end\n size\n end", "def _rl_get_screen_size(tty, ignore_env)\r\n\r\n if @hConsoleHandle\r\n csbi = 0.chr * 24\r\n @GetConsoleScreenBufferInfo.Call(@hConsoleHandle,csbi)\r\n wc,wr = csbi[0,4].unpack('SS')\r\n # wr,wc, = `mode con`.scan(/\\d+\\n/).map{|x| x.to_i}\r\n @_rl_screenwidth = wc\r\n @_rl_screenheight = wr\r\n else\r\n wr, wc = 0\r\n retry_if_interrupted do\r\n wr, wc = `stty size`.split(' ').map { |x| x.to_i }\r\n end\r\n @_rl_screenwidth = wc\r\n @_rl_screenheight = wr\r\n if ignore_env==0 && ENV['LINES']\r\n @_rl_screenheight = ENV['LINES'].to_i\r\n end\r\n if ignore_env==0 && ENV['COLUMNS']\r\n @_rl_screenwidth = ENV['COLUMNS'].to_i\r\n end\r\n end\r\n\r\n # If all else fails, default to 80x24 terminal.\r\n if @_rl_screenwidth.nil? || @_rl_screenwidth <= 1\r\n @_rl_screenwidth = 80\r\n end\r\n if @_rl_screenheight.nil? || @_rl_screenheight <= 0\r\n @_rl_screenheight = 24\r\n end\r\n # If we're being compiled as part of bash, set the environment\r\n # variables $LINES and $COLUMNS to new values. Otherwise, just\r\n # do a pair of putenv () or setenv () calls.\r\n sh_set_lines_and_columns(@_rl_screenheight, @_rl_screenwidth)\r\n\r\n if !@_rl_term_autowrap\r\n @_rl_screenwidth-=1\r\n end\r\n @_rl_screenchars = @_rl_screenwidth * @_rl_screenheight\r\n end", "def terminal_width; end", "def terminal_width; end", "def terminal_width\n TerminalWidthCalculator.calculate\n end", "def terminal_width\n TerminalWidthCalculator.calculate\n end", "def terminal_width\n @terminal_width ||= (ENV[\"COLUMNS\"] || 80).to_i\nend", "def size\n $stdout.winsize.reverse rescue [80,25]\n end", "def output_cols\n return 80 unless @output.tty?\n terminal.terminal_size.first\n rescue NoMethodError\n return 80\n end", "def terminal_size; end", "def terminal_size; end", "def size_from_readline(verbose: false)\n require \"readline\" unless defined?(::Readline)\n\n return unless ::Readline.respond_to?(:get_screen_size)\n\n size = ::Readline.get_screen_size\n size if nonzero_column?(size[1])\n rescue LoadError\n warn \"no readline gem\" if verbose\n rescue NotImplementedError\n end", "def width\n Terminal.width\n end", "def terminal_width\n if ENV['THOR_COLUMNS']\n result = ENV['THOR_COLUMNS'].to_i\n else\n result = unix? ? dynamic_width : 80\n end\n (result < 10) ? 80 : result\n rescue\n 80\n end", "def term_width\n return @@terminal_width unless @terminal_width == nil\n begin\n require 'terminfo'\n @@terminal_width = TermInfo.screen_width - 1\n rescue\n @@terminal_width = 79\n end\n end", "def size_from_stty\n return unless @output.tty? && command_exist?(\"stty\")\n\n out = run_command(\"stty\", \"size\")\n return unless out\n\n size = out.split.map(&:to_i)\n size if nonzero_column?(size[1])\n end", "def get_winsize\n str = [0, 0, 0, 0].pack('SSSS')\n if STDIN.ioctl(TIOCGWINSZ, str) >= 0\n rows, cols, xpixels, ypixels = str.unpack(\"SSSS\")\n #rows, cols, xpixels, ypixels\n cols\n end\nend", "def from_stty\n return unless output.tty?\n size = run_command('stty', 'size').split.map(&:to_i)\n size if nonzero_column?(size[1])\n rescue Errno::ENOENT\n end", "def terminal_width\n return 80 unless unix?\n\n result = dynamic_width\n (result < 20) ? 80 : result\n rescue\n 80\n end", "def terminal_width\n return 80 unless unix?\n\n result = dynamic_width\n (result < 20) ? 80 : result\n rescue\n 80\n end", "def size_from_io_console(verbose: false)\n require \"io/console\" unless IO.method_defined?(:winsize)\n\n return unless @output.tty? && @output.respond_to?(:winsize)\n\n size = @output.winsize\n size if nonzero_column?(size[1])\n rescue Errno::EOPNOTSUPP\n # no support for winsize on output\n rescue LoadError\n warn \"no native io/console support or io-console gem\" if verbose\n end", "def size_from_tput\n return unless @output.tty? && command_exist?(\"tput\")\n\n lines = run_command(\"tput\", \"lines\")\n return unless lines\n\n cols = run_command(\"tput\", \"cols\")\n [lines.to_i, cols.to_i] if nonzero_column?(lines)\n end", "def size\n size = from_io_console\n size ||= from_readline\n size ||= from_tput\n size ||= from_stty\n size ||= from_env\n size ||= from_ansicon\n size || default_size\n end", "def size\n console.winsize\n end", "def winsize\n $stdout.winsize\nend", "def winsize; IO.console.winsize end", "def from_readline\n return unless defined?(Readline)\n size = Readline.get_screen_size\n size if nonzero_column?(size[1])\n rescue NotImplementedError\n end", "def screen_width\n @screen_width ||= begin\n `tput cols`.chomp.to_i\n rescue\n 80\n end\n end", "def get_window_size\n Ncurses.refresh\n cols, rows = [], []\n Ncurses.stdscr.getmaxyx rows, cols\n [rows.first, cols.first]\n end", "def console_col_size\n IO.console.winsize[1]\n end", "def screen_width(out=STDERR)\n default_width = ENV['COLUMNS'] || 76\n begin\n tiocgwinsz = 0x5413\n data = [0, 0, 0, 0].pack(\"SSSS\")\n if out.ioctl(tiocgwinsz, data) >= 0 then\n rows, cols, xpixels, ypixels = data.unpack(\"SSSS\")\n if cols >= 0 then cols else default_width end\n else\n default_width\n end\n rescue Exception\n default_width\n end\n end", "def size(input) \n\tinfo = `identify \"#{input}\"`\n\twidth, height = info.match(/(\\d+)x(\\d+)\\+/).captures\n\treturn width.to_i, height.to_i\nend", "def columns; IO.console.winsize[1] rescue 80; end", "def get_dimensions()\n frame_start\n label(:a) do\n puts \"Zadaj veľkosť bludiska (rozmery musia byť vačšie ako 0): X Y\"\n begin\n @width, @height = convert_s_array_to_i_array(gets.split(\" \"))\n raise(ArgumentError) if @width <= 0 or @height <= 0\n rescue ArgumentError\n puts \"Chybný vstup. Skús znova.\\n\"\n\n # znovu nacitanie vstupu\n goto :a\n end\n end\n frame_end\n end", "def determine_console_width(total_width)\n [[total_width / 4, 120].min, 80].max\nend", "def get_width\n # FIXME: I don't know how portable it is.\n default_width = 80\n begin\n tiocgwinsz = 0x5413\n data = [0, 0, 0, 0].pack(\"SSSS\")\n if @out.ioctl(tiocgwinsz, data) >= 0 then\n #rows, cols, xpixels, ypixels = data.unpack(\"SSSS\")\n cols = data.unpack(\"SSSS\")[1]\n if cols >= 0 then cols else default_width end\n else\n default_width\n end\n rescue Exception\n default_width\n end\n end", "def max_width\n FFI::NCurses.getmaxx FFI::NCurses.stdscr\n end", "def infer_console_width\n interactive? ? interaction_highline.output_cols-3 : 80\n end", "def max_height\n FFI::NCurses.getmaxy FFI::NCurses.stdscr\n end", "def columns\n IO.console.winsize.last\n end", "def output_rows\n return 24 unless @output.tty?\n terminal.terminal_size.last\n rescue NoMethodError\n return 24\n end", "def console_width\n @console_width ||= infer_console_width\n end", "def size\n res = %x( #{magick_bin_name(\"identify\")} -format \"%[fx:w]x%[fx:h]\" #{Shellwords.shellescape path} )\n if res.size > 0\n res.chomp.split(\"x\").map {|x| x.to_i}\n else\n nil\n end\n end", "def get_columns\n require 'io/console'\n n = ENV[\"COLUMNS\"]\n if n.nil? or n == \"\"\n rows, n = IO.console.winsize\t\n else\n n = n.to_i\n end\n return n\nend", "def size_from_env\n return unless @env[\"COLUMNS\"] =~ /^\\d+$/\n\n size = [(@env[\"LINES\"] || @env[\"ROWS\"]).to_i, @env[\"COLUMNS\"].to_i]\n size if nonzero_column?(size[1])\n end", "def height\n barcode.two_dimensional? ? (ydim * encoding.length) : (@height || 100)\n end", "def height\n barcode.two_dimensional? ? (ydim * encoding.length) : (@height || 100)\n end", "def window_width\n $game_system.macmm_command_width\n end", "def size\n prompt_size + text_size\n end", "def display_width\n @width ||= begin\n require 'curses'\n Curses.init_screen\n x = Curses.cols\n Curses.close_screen\n x\n rescue\n HELP_WIDTH\n end\n @width - HELP_INDENT\n end", "def detect_mode\n if ENV['NO_COLOR'] # see https://no-color.org/\n 0\n elsif RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ # windows\n if ENV['ANSICON']\n 16\n elsif ENV['ConEmuANSI'] == 'ON'\n TRUE_COLOR\n else\n 0\n end\n elsif ENV['TERM_PROGRAM'] == 'Apple_Terminal'\n 256\n else\n case ENV['TERM']\n when /^rxvt-(?:.*)-256color$/\n 256\n when /-color$/, /^rxvt/\n 16\n else # optimistic default\n TRUE_COLOR\n end\n end\n end", "def height\n dimensions()[:y]\n end", "def get_ScreenHeight\n System::get_property('screen_height')\n end", "def get_top_bar_height(id)\n (`xwininfo -id #{id}`).scan(/Relative.*Y:\\s*(\\d*)/)[0][0].to_i\nend", "def get_size(type)\n if type == :horizontal\n pane_size = Tmux.call \"list-panes | grep active | cut -dx -f1 | cut -d[ -f2\"\n else\n pane_size = Tmux.call \"list-panes | grep active | cut -dx -f2 | cut -d] -f1\"\n end\n pane_size.to_i\n end", "def get_space_height\n return get_keyword_value(\"SPACE-HEIGHT\").to_f\n end", "def dimensions\n height = count\n width = collect { |a| a.length }.max\n [width, height]\n end", "def width\n return nil unless @width ## this is required otherwise checking for nil will fail\n if @width < 0\n return ( FFI::NCurses.COLS + @width ) - self.col + 1\n end\n @width\n end", "def height\n size.first\n end", "def height\n size.first\n end", "def cursor_height\n return Font.default_size\n end", "def screen_size\n coords = execute_applescript(%Q`\n tell application \"Finder\"\n get bounds of window of desktop\n end tell\n `)\n coords = coords.split(\", \").collect {|c| c.to_i}\n to(*coords)\n end", "def find_ppi(width, height)\n sc = screen_config(width, height)\n return sc ? sc[:ppi] : nil\n end", "def height\n return nil unless @height\n if @height < 0\n return ((FFI::NCurses.LINES + @height) - self.row) + 1\n #return (FFI::NCurses.LINES + @height) \n end\n @height\n end", "def height\n @screenplay.line_height * @lines.size\n end", "def size_from_ansicon\n return unless @env[\"ANSICON\"] =~ /\\((.*)x(.*)\\)/\n\n size = [$2, $1].map(&:to_i)\n size if nonzero_column?(size[1])\n end", "def windows_width\n Graphics.width / 2 + 10 # + 64\n end", "def height\n @dimensions.y\n end", "def get_environment\n @last_scraped_page = 0\n @username = ENV['USER']\n @screen_size = `tput cols`.strip.to_i # gets the terminal output of `tput cols` and converts to int and stores as screen_size\n @prompt = TTY::Prompt.new\n end", "def height\n lines.size\n end", "def height\n lines.size\n end", "def size\n width_pointer = FFI::MemoryPointer.new :int, 1\n height_pointer = FFI::MemoryPointer.new :int, 1\n XDo::FFILib.xdo_get_window_size @_xdo_pointer, @_window, width_pointer,\n height_pointer\n [width_pointer.read_int, height_pointer.read_int]\n end", "def contents_height\n Graphics.height\n end", "def window_width\n Graphics.width / 2\n end", "def get_ScreenWidth\n System::get_property('screen_width')\n end", "def win_width\n Curses.cols - win_padding\n end", "def height\n image_ptr[:sy]\n end", "def from_io_console\n return false if jruby?\n try_io_console { |size| size if nonzero_column?(size[1]) }\n end", "def render_text_size(text = @text)\n lines = render_text_lines(text)\n width = lines.map(&:length).max\n height = lines.length\n { width: width, height: height }\n end", "def sizeY()\n return @device.sizeY() ;\n end", "def height\n ['N', 'S'].include?(@orientation) ? @height : @width\n end", "def from_tput\n return unless output.tty?\n lines = run_command('tput', 'lines').to_i\n cols = run_command('tput', 'cols').to_i\n [lines, cols] if nonzero_column?(lines)\n rescue Errno::ENOENT\n end" ]
[ "0.8195988", "0.80224055", "0.8019138", "0.79774195", "0.7969648", "0.78469956", "0.7764037", "0.77301234", "0.76883155", "0.7686057", "0.76576775", "0.76383364", "0.75278836", "0.7467008", "0.7451767", "0.74064183", "0.74064183", "0.7364724", "0.7248816", "0.7212738", "0.7041346", "0.7041346", "0.7003418", "0.7003418", "0.69903934", "0.6939807", "0.6921971", "0.6918009", "0.6918009", "0.6917622", "0.68911284", "0.6860597", "0.68349606", "0.67165744", "0.67097956", "0.670693", "0.66963685", "0.6693055", "0.6632364", "0.66287583", "0.6627342", "0.6616776", "0.659112", "0.6507664", "0.64934546", "0.642755", "0.64149505", "0.63356656", "0.62844616", "0.623575", "0.62230664", "0.6200563", "0.6195398", "0.6151499", "0.6082642", "0.6077922", "0.6036894", "0.59855866", "0.5985458", "0.5976544", "0.596498", "0.5901527", "0.5883304", "0.5878193", "0.5878193", "0.5866951", "0.5838467", "0.5836067", "0.5823085", "0.5822698", "0.5808378", "0.5761234", "0.57517666", "0.57370293", "0.57363284", "0.57146984", "0.57063705", "0.57063705", "0.5689556", "0.5678372", "0.56741256", "0.56721354", "0.56584907", "0.5635183", "0.56315404", "0.56034905", "0.559651", "0.55919474", "0.55919474", "0.558916", "0.5547684", "0.5545778", "0.55232584", "0.552267", "0.55185264", "0.5514393", "0.550919", "0.54879296", "0.547736", "0.5476946" ]
0.8007344
3
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
def production? ENV["JEKYLL_ENV"] == "production" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ios; end", "def private; end", "def platform_endpoint; end", "def host_os; end", "def host_os; end", "def api_mode; end", "def supports_streaming?; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def version; end", "def platform; end", "def platform; end", "def platform; end", "def standalone; end", "def storage_options; end", "def service_name; end", "def platform_end_point; end", "def transport; end", "def transport; end", "def transport; end", "def interface_cache; end", "def implementation; end", "def implementation; end", "def platform_endpoint=(_arg0); end", "def pausable; end", "def storage_instance; end", "def user_os_complex\r\n end", "def preflight; end", "def interface; end", "def interface; end", "def service; end", "def ready; end", "def ready; end", "def server_version; end", "def storage_failure; end", "def port; end", "def port; end", "def port; end", "def port; end", "def port; end", "def port; end", "def port; end", "def port; end", "def common_pods\n# pod 'AESCrypt-ObjC’\n pod 'AFNetworking’\n pod 'Aspects'\n \n pod 'FCUUID'\n pod 'FMDB'\n \n pod 'IQKeyboardManager'\n# pod 'iCarousel’\n \n# pod 'JPush'\n# pod 'JZLocationConverter'\n \n pod 'MBProgressHUD'\n pod 'MJExtension'\n pod 'MJRefresh'\n pod 'Masonry'\n \n# pod 'PopoverView'\n pod 'PPNumberButton'\n \n pod 'SDCycleScrollView'\n pod 'SDWebImage'\n pod 'SVProgressHUD'\n pod 'SocketRocket'\n pod 'Toast'\n \n# pod 'UICKeyChainStore'\n \n pod 'YBAttributeTextTapAction'\n \n# pod 'YYKit'\n pod 'YYCache'\n pod 'YYCategories'\n pod 'YYWebImage’\n pod 'YYModel’\n# pod 'YZPullDownMenu'\n# pod 'ZYCornerRadius'\n \n# pod 'UMengAnalytics-NO-IDFA'\n \n# pod 'AMapSearch-NO-IDFA'\n# pod 'AMapLocation-NO-IDFA'\n# pod 'AMapNavi-NO-IDFA'\n \n # 主模块(必须)\n# pod 'mob_sharesdk'\n# pod 'mob_sharesdk/ShareSDKUI'\n# pod 'mob_sharesdk/ShareSDKExtension'# 扩展模块(在调用可以弹出我们UI分享方法的时候是必需的)\n# pod 'mob_sharesdk/ShareSDKPlatforms/QQ'\n# pod 'mob_sharesdk/ShareSDKPlatforms/SinaWeibo'\n# pod 'mob_sharesdk/ShareSDKPlatforms/WeChatFull' #(微信sdk带支付的命令,和上面不带支付的不能共存,只能选择一个)\n# pod 'PromiseKit'\n\n pod 'NNGloble'\n pod 'NNCategoryPro'\n \n pod 'TZImagePickerController'\n \n# pod 'LookinServer', :configurations => ['Debug']\n# pod 'EchoSDK', :configurations => [\"Debug\"]\n pod 'Reveal-SDK', :configurations => ['Debug']\n\n end", "def internal; end", "def provider; end", "def service; raise NotImplementedError; end", "def default_adapter_options; end", "def default_adapter_options; end", "def bi_service\n end", "def started; end", "def target_version; end", "def available; end", "def available; end", "def initialize\n\n end", "def initialize\n\n end", "def compression_client; end", "def on_ready\n end", "def connection_status_server; end", "def protocol; end", "def protocol; end", "def protocol; end", "def protocol; end", "def getPath(path)\n return ENV['FASTLANE_HOME'] + '/Android/implementation/' + path \nend", "def do_adapter_specific_setup; end", "def storage; end", "def desc\n\t\t\"JavaPayload\"\n\tend", "def capabilities; end", "def capabilities; end", "def capabilities; end", "def host; end", "def host; end", "def host; end", "def host; end", "def host; end", "def host; end", "def host; end", "def host; end", "def host; end", "def vendor; end", "def initialize\n end" ]
[ "0.56878316", "0.56781626", "0.5379542", "0.50232434", "0.50232434", "0.49817264", "0.49791622", "0.4956793", "0.4956793", "0.4956793", "0.4956793", "0.4956793", "0.4956793", "0.4956793", "0.4956793", "0.4956793", "0.4956793", "0.4956793", "0.4956793", "0.4956793", "0.4956793", "0.4956793", "0.4956793", "0.4956793", "0.4956793", "0.4956793", "0.4956793", "0.4956793", "0.4956793", "0.4956793", "0.49457693", "0.49457693", "0.49457693", "0.49415067", "0.4937688", "0.4933545", "0.49098673", "0.48748782", "0.48748782", "0.48748782", "0.48728082", "0.485106", "0.485106", "0.48475373", "0.48461726", "0.48283595", "0.4826649", "0.48247233", "0.47864053", "0.47864053", "0.478587", "0.47810668", "0.47810668", "0.47808424", "0.4770458", "0.4770145", "0.4770145", "0.4770145", "0.4770145", "0.4770145", "0.4770145", "0.4770145", "0.4770145", "0.47698233", "0.47667292", "0.47645563", "0.47602704", "0.47504172", "0.47504172", "0.4746439", "0.47461113", "0.47443867", "0.47269502", "0.47269502", "0.4719675", "0.4719675", "0.4700001", "0.46983528", "0.46934515", "0.4685723", "0.4685723", "0.4685723", "0.4685723", "0.46842763", "0.4678236", "0.46736738", "0.46704784", "0.46605703", "0.46605703", "0.46605703", "0.465265", "0.465265", "0.465265", "0.465265", "0.465265", "0.465265", "0.465265", "0.465265", "0.465265", "0.46235237", "0.46158305" ]
0.0
-1
Marks a key readonly. Returns self.
def read_only! key set_data! key, :read_only, true self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readonly! #:nodoc:\n @readonly = true\n end", "def readonly!\n @readonly = true\n end", "def set_readonly\n readonly! if persisted? && !parent\n end", "def readonly=(value)\n if value\n self[:readonly] = ''\n else\n remove_attribute :readonly\n end\n end", "def key=(new_key)\n @key = new_key\n end", "def protect(key)\n @_protected << key.to_s\n end", "def lock(key)\n raise NotImplementedError\n end", "def updateKey; @key = getKey; self end", "def key=(key); end", "def set_read_for_key_only(policy, key)\n begin_cmd\n field_count = estimate_key_size(key)\n\n predexp_size = estimate_predexp(policy.predexp)\n field_count += 1 if predexp_size > 0\n\n exp_size = estimate_expression_size(@policy.filter_exp)\n field_count += 1 if exp_size > 0\n\n size_buffer\n write_header(policy, INFO1_READ | INFO1_GET_ALL, 0, field_count, 0)\n write_key(key)\n write_predexp(policy.predexp, predexp_size)\n write_filter_exp(@policy.filter_exp, exp_size)\n end_cmd\n end", "def store(type, key, file)\n raise Dis::Errors::ReadOnlyError if readonly?\n\n store!(type, key, file)\n end", "def to key, inclusive: false\n if inclusive\n @grpc.end_key_closed = key\n else\n @grpc.end_key_open = key\n end\n self\n end", "def with_lock(key)\n raise NotImplementedError\n end", "def key_attr_reader(key)\n define_method key do\n self[key]\n end\n end", "def enable(key)\n @status[key] = :prohibited\n end", "def readonly?; true; end", "def readonly?; true; end", "def readonly?; true; end", "def _format_input(type)\n @attr[:readonly] = :readonly\n super\n end", "def readonly?(key)\n return nil if not key\n\n key = key.to_sym if key.class == String\n section = ForjDefault.get_meta_section(key)\n\n rhGet(@oConfig.getAppDefault(:sections, section), key, :readonly)\n\n end", "def readonly\n true\n end", "def key_accessor *keys\n key_writer *keys\n key_reader *keys\n end", "def delete(type, key)\n raise Dis::Errors::ReadOnlyError if readonly?\n\n delete!(type, key)\n end", "def readonly?\n self.key == 'admin'\n end", "def key=(value)\n @key = value\n end", "def key=(value)\n @key = value\n end", "def ~\n KeyPath.new [self], true\n end", "def reserve_key(key); end", "def define_reader_for_role(rolekey)\n attr_reader rolekey\n private rolekey\n end", "def def_accessor(key)\n raise ArgumentError.new('Invalid entry type: %s' % key) if respond_to?(key)\n\n class << self; self end.class_eval do\n define_method(key) { |*args| val = args.first; val ? (self[key]=val) : self[key] }\n define_method(\"#{key}=\") { |val| self[key] = val }\n define_method(\"#{key}!\") { |val| cache[key] = val }\n end\n end", "def set_key\n @key = Key.find(params[:id])\n end", "def set_key_statement\n super\n end", "def restrict_primary_key\n clear_setter_methods_cache\n @restrict_primary_key = true\n end", "def restrict_primary_key\n clear_setter_methods_cache\n @restrict_primary_key = true\n end", "def []=(key, val)\n @write_lock ||= true\n @data ||= restore\n @data[key] = val\n end", "def set_key\n self.key = SecureRandom.urlsafe_base64(KEY_LENGTH)\n self.set_key if Url.exists?(key: self.key)\n end", "def key1=(val)\n self.key('key1',val)\n end", "def key=(key)\n PrivateKey.enforce_valid_key_type!(key)\n\n @key = key\n end", "def locked_state(id, key)\n # If there's no key, or no locked state for that key, just return public state\n locked = all_state(id)[:\"$#{key}\"]\n return public_state(id) if key.nil? || locked.nil?\n\n public_state(id).merge(:\"$#{key}\" => locked)\nend", "def []=(key, item)\n item = super\n item.lru_key = key\n lru_insert(item)\n end", "def readonly?\n @readonly\n end", "def key\n refresh_key unless key_valid?\n @key\n end", "def readonly! \n elements.each { |e|\n e.readonly! \n }\n end", "def attr_readonly(*attributes)\n write_inheritable_attribute(:attr_readonly, Set.new(attributes.map(&:to_s)) + (readonly_attributes || []))\n end", "def []=(key, val)\n @write_lock ||= true\n @data ||= @dbman.restore\n @data[key] = val\n end", "def set_readonly(*field_names)\n field_names.each { |field|\n @element_map[field.to_s].readonly!\n }\n end", "def is_read_only=(value)\n @is_read_only = value\n end", "def key(method)\n @_key = method\n end", "def key=(value)\n attributes['key'] = value\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def set_readonly_option!(options) #:nodoc:\n if options[:piggy]\n options[:readonly] = true\n else\n old_set_readonly_option!(options)\n end\n end", "def key_id=(value)\n @key_id = value\n end", "def key_id=(value)\n @key_id = value\n end", "def key_id=(value)\n @key_id = value\n end", "def read_only?; end", "def read_only?; end", "def mark_as_read\n self.update(read: true)\n end", "def write_key(*key); end", "def []=(key, val)\n this = self\n unless respond_to?(key)\n self.define_singleton_method(key) do\n this[key]\n end\n end\n unless respond_to?(\"#{key}=\".to_sym)\n self.define_singleton_method(\"#{key}=\".to_sym) do |v|\n this[key] = v\n end\n end\n return super(key, val)\n end", "def readonly?\n @readonly == true\n end", "def readonly?\n @readonly == true\n end", "def set_key(exponent_hex_string, modulus_hex_string)\n @key = RsaKey.new exponent_hex_string, modulus_hex_string\n end", "def readonly_attributes\n read_inheritable_attribute(:attr_readonly)\n end", "def root_key!\n @_key = true\n @_key_for_collection = true\n end", "def invoke_write_key(key)\n write_key(key)\n end", "def restore_original_key\n self.send(:\"#{self.class.key_method_name}=\", @original_key)\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def readonly?\n true\n end", "def key=(_); end", "def key=(_); end", "def key(key)\n raise \"key must be a boolean.\" unless is_bool? key\n raise \"Only Edm.String fields can be keys.\" unless @type == \"Edm.String\"\n @key = key\n self\n end", "def access_key=(key)\n configatron.ramazon.access_key = key\n end", "def prohibit(key)\n @status[key] = :prohibited\n end", "def readonly?\n false\n end", "def lock(key, expiration)\n timeout = (expiration * 1000).to_i\n if @redis.set(\"SimpleRedisLock:#{key}\", Time.now.strftime('%Y-%m-%d %H:%M:%S.%L %z'), nx: true, px: timeout)\n if block_given?\n begin\n yield\n ensure\n release key\n end\n else\n true\n end\n end\n end", "def with_keys_disabled\n disable_keys\n yield\n enable_keys\n end", "def set_key(key, text)\n return if key == self.key and text == self.text\n @key = key\n @text = text\n refresh\n end", "def setbit(key, offset, value); end", "def setbit(key, offset, value); end", "def [](key)\n super(convert_key(key))\n end", "def with_keys_disabled\n disable_keys\n yield\n enable_keys\n end", "def read_only\n @attributes[:read_only]\n end", "def set_otp_key(id, key)\n @otp_keys[id] = encrypt(key.to_s) unless key.to_s.empty?\n end", "def key=(key)\n key = key.to_s\n\n if registered?\n bibliography.entries.delete(@key)\n key = register(key)\n end\n\n @key = key\n rescue => e\n raise BibTeXError, \"failed to set key to #{key.inspect}: #{e.message}\"\n end", "def allow(key)\n @status[key] = :allowed\n end", "def read_only\n true\n end", "def set_primary_key(key)\n clear_setter_methods_cache\n if key.is_a?(Array)\n if key.length < 2\n key = key.first\n else\n key = key.dup.freeze\n end\n end\n self.simple_pk = if key && !key.is_a?(Array)\n (@dataset || db).literal(key).freeze\n end\n @primary_key = key\n end", "def set_primary_key(key)\n clear_setter_methods_cache\n if key.is_a?(Array)\n if key.length < 2\n key = key.first\n else\n key = key.dup.freeze\n end\n end\n self.simple_pk = if key && !key.is_a?(Array)\n (@dataset || db).literal(key).freeze\n end\n @primary_key = key\n end", "def rekey_as_needed; end" ]
[ "0.6546846", "0.65401816", "0.59213346", "0.5785873", "0.57742524", "0.56710845", "0.5644326", "0.54534036", "0.545066", "0.54113257", "0.5361511", "0.5348421", "0.53416693", "0.5333156", "0.5306583", "0.5305598", "0.5305598", "0.5305598", "0.5298332", "0.52912545", "0.52863336", "0.52700144", "0.526984", "0.5252465", "0.5205888", "0.5205888", "0.51938313", "0.51926154", "0.517636", "0.5173291", "0.5159975", "0.51330477", "0.5111452", "0.5111452", "0.51100296", "0.50989276", "0.50961274", "0.5084576", "0.5064973", "0.5063266", "0.50574315", "0.5049049", "0.5045818", "0.504262", "0.5032298", "0.5026867", "0.500296", "0.49984393", "0.4995859", "0.49957862", "0.49593297", "0.49485037", "0.4943958", "0.4943958", "0.4943958", "0.49224237", "0.49224237", "0.49208486", "0.49154052", "0.49148968", "0.49118465", "0.49118465", "0.49057943", "0.48990792", "0.489711", "0.48916253", "0.48863786", "0.48801017", "0.48801017", "0.48801017", "0.48801017", "0.48801017", "0.48801017", "0.48801017", "0.48801017", "0.48801017", "0.48801017", "0.48801017", "0.48801017", "0.4879028", "0.4879028", "0.48726532", "0.48707095", "0.48670807", "0.48559806", "0.48541412", "0.4849568", "0.4848009", "0.48393768", "0.48393768", "0.48336792", "0.4817858", "0.48092562", "0.48023698", "0.48015448", "0.479736", "0.47966108", "0.47933587", "0.47933587", "0.47919133" ]
0.7547733
0
Returns true if the value for key is marked 'inherited'. If so, any attempt to call []= will be ignored and the value returned from [] will the ENV[key] value at initialization.
def inherit? key ! ! (data(key, INHERIT) && data(key, DEFAULT)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inherits_key? k\n !(@hash.key? k) && (!! @parents.find {|parent| parent.key? k } )\n end", "def inherits_key? k\n !(@hash.key? k) && (!! @parents.find {|parent| parent.key? k } )\n end", "def env?(key)\n blank?(ENV[key])\n end", "def key_inheritable_in_parent?(*key)\n !key_nonheritable_in_parent?(format_key(key.first))\n end", "def directory_key?(key)\n raise \"subclass responsibility\"\n end", "def valid?\n env_keys.all? { |k| env.key?(k) }\n end", "def setting_provided?(key)\n !settings[key].nil?\n end", "def has_key?(key)\n local?(key) || (!@parent.nil? && @parent.key?(key))\n end", "def inheritable?\n @klass.columns_hash.has_key?( inheritance_column )\n end", "def include? key\n\t\t@data_base.has_key? key\n\tend", "def api_key?\n ENV.has_key?(\"#{sub_klass.upcase}_URL_KEY\")\n end", "def from_env\n ENV_VARS.any? { |key| @env.key?(key) } || NoValue\n end", "def key_nonheritable_in_parent?(*key)\n parent_nonheritable_keys.include?(format_key(key.first))\n end", "def defined?(value_key)\n true\n end", "def value_set? key\n local_value_set = @values.key? @schema.resolve_key! key\n parent_value_set = @parent_config.value_set? key\n local_value_set || parent_value_set\n end", "def env(key) \n str = key.to_s \n env?(str) ? ENV[str] : nil\n end", "def env?(*keys)\n if keys.respond_to?(:all?)\n !keys.all? { |k| ENV[k].blank? }\n else\n !ENV[keys].blank?\n end\n end", "def has_key?(key)\n super(convert_key(key))\n end", "def has_key?(key)\n super(convert_key(key))\n end", "def key_set?\n !attributes['key'].nil?\n end", "def has_setting?(symbol_or_name, include_inherited = true)\n found = find_setting(symbol_or_name.to_s) != nil\n if found\n return found\n elsif include_inherited && has_parent?\n return parent.__send__(:has_setting?, symbol_or_name)\n end\n false\n end", "def inheritable?\n @inherit\n end", "def ENV_boolean(\n key,\n true: [],\n false: [],\n # By default the true: and false: options get appended to the internal defaults, but you can\n # override internal defaults, too, if you want. \n true_values: ['1', 'true' ] + Array(binding.local_variable_get('true')),\n false_values: ['0', 'false'] + Array(binding.local_variable_get('false')),\n default: nil,\n missing: default, # (missing_default)\n invalid: default # (invalid_default)\n )\n unless ENV.key?(key)\n if [:raise, :fail, :abort].include? missing\n message = %(Environment variable \"#{key}\" was missing.)\n send(missing, message)\n else\n return missing\n end\n end\n\n allowed_values = true_values + false_values\n value = ENV[key]\n case value\n when *true_values; true\n when *false_values; false\n else\n if [:string, :to_s].include?(invalid)\n value\n elsif [:symbol, :to_sym].include?(invalid)\n value.to_sym\n elsif [:integer, :to_i].include?(invalid)\n value.to_i\n elsif [:raise, :fail, :abort].include?(invalid)\n message = %(Environment variable \"#{key}\" (#{value.inspect}) was not one of the allowed values (#{allowed_values}).)\n send(invalid, message)\n else\n invalid\n end\n end\n end", "def any_key?\n @keys == UndefinedSetting\n end", "def configured?(key)\n case key\n when :namespaces\n # Because we mutate the default value for the `namespaces` setting, rather\n # than assign a new one, to check if it's configured we must see whether any\n # namespaces have been added\n !config.namespaces.empty?\n else\n config._settings[key].input_defined?\n end\n end", "def all_base_attributes_present?\n BASE_ATTRIBUTES.all? { |attribute| self.send(\"#{attribute}?\") }\n end", "def cache?\n self.inherited_groups.empty?\n end", "def knows_key?( name )\n return true if has_key?( name )\n return parent.knows_key?( name ) if parent\n false\n end", "def read_inheritable_attr(key)\n inheritable_attrs[key]\n end", "def defines_setting?(key)\n @settings.key?(key)\n end", "def instance_attribute_defined?(key)\n case key\n when Symbol\n return instance_variable_defined?(\"@#{key}\")\n when String\n return instance_variable_defined?(\"@#{key}\")\n end\n end", "def myservices_environment_details_override?\n !ENV['ENV_DETAILS'].nil?\n end", "def env_set?(*vars)\n vars.map{ |v| ENV.has_key?(v) }.all?\n end", "def has_key?(key)\n key.kind_of?(Symbol) ? self.has_key?(key.to_s) : super(key)\n end", "def valid?\n return false if !key || key_defined? || global_key?\n\n true\n end", "def has_environment_variable(name, value = nil)\n name, value = name.to_s, value.to_s\n if ENV['os'] =~ /win/i\n # use set | findstr to avoid shell substitution, which does not appear to work reliably with Kernel.system\n command = \"set #{name} | findstr /c:\\\"#{name}=\\\"\"\n command << \" | findstr /r /c:\\\"^.*=#{Regexp.quote value}$\\\"\" unless value.empty?\n command << ' > NUL 2>&1' unless logger.debug?\n else\n command = value.nil? ? \"test -n $#{name}\" : \"test $#{name} == \\\"#{value}\\\"\"\n end\n @commands << command\n end", "def exist?(key)\n raise \"subclass responsibility\"\n end", "def key?(key)\n @attr.key?(key)\n end", "def has_key?(key)\n @configuration.has_key?(key.to_sym)\n end", "def subconfig? key\n @schema.subconfig? key\n end", "def inherit_views?\n !!read_inheritable_attribute('inherit_views')\n end", "def subconfig? key\n @validators[String(key).to_sym] == SUBCONFIG\n end", "def env(key)\n if key.nil?\n nil\n elsif override_env.present?\n override_env[key]\n else\n ENV[key]\n end\n end", "def is_top_level_key\n return [\n '/plist/dict/key'\n ].any? { |bc|\n @breadcrumb === bc\n }\n end", "def has?(key)\n value = self[key]\n boolean_typecast(key, value)\n end", "def config(key)\n env_key = ENV[key.upcase.gsub(/[\\.-]/, '_')]\n return env_key if env_key and not env_key.strip.empty?\n\n str_to_bool `git config --global --get-all #{key}`.strip\n end", "def key?(key)\n configuration.key?(key.to_sym) || config_contexts.key?(key.to_sym)\n end", "def has_key?(key)\n return self.fetch(key) ? true : false\n end", "def has_key?(key)\n configs.has_key?(key) || store.has_key?(key) \n end", "def unqualify?(key)\n key[0, 1] == \":\"\n end", "def is_set?(*key)\n synchronize do\n val = @data.get(*key)\n return false if val.nil?\n return false if val.is_a?(MonitorMixin::ConditionVariable)\n true\n end\n end", "def key?(key)\n @configuration.key?(key)\n end", "def key?(key)\n super(convert_key(key))\n end", "def key?(key)\n super(convert_key(key))\n end", "def IsKnowledgeBase # rubocop:disable Style/MethodName\n @attrs[:IsKnowledgeBase] == 'True' ? true : false\n end", "def include?(propkey)\n @liveprops.include?(propkey)\n end", "def include_key?(key)\n\t\t\ttrue\n\t\tend", "def key?(key)\n !self[key].nil?\n end", "def within_env?(path)\n path.include?(\"/#{Terraspace.env}/\")\n end", "def key_value?(key, locale = base_locale)\n !t(key, locale).nil?\n end", "def attribute?(key)\n self.class.attributes.include? key.to_sym\n end", "def set?\n\t\t\tbegin\n\n\t\t\t\tvalue = @lookup.inject(@obj_with_keys) { |deep_obj, this_key|\n\t\t\t\t\t# Has to be an object that can have keys\n\t\t\t\t\treturn false unless deep_obj.respond_to?(:[])\n\n\t\t\t\t\tif deep_obj.respond_to?(:fetch)\n\t\t\t\t\t\t# Hash, Array and Struct all respond to fetch\n\t\t\t\t\t\t# We've monkeypatched fetch to Struct\n\t\t\t\t\t\tif deep_obj.is_a?(Array)\n\t\t\t\t\t\t\t# Check array separately as must fetch numeric key\n\t\t\t\t\t\t\treturn false unless Keys.index?(this_key)\n\t\t\t\t\t\tend\n\t\t\t\t\t\tnext_obj = deep_obj.fetch(this_key, Keys::MISSING)\n\t\t\t\t\telse\n\t\t\t\t\t\treturn false\n\t\t\t\t\tend\n\n\t\t\t\t\t# No need to go any further\n\t\t\t\t\treturn false if Keys::MISSING == next_obj\n\n\t\t\t\t\t# Reinject value to next loop\n\t\t\t\t\tnext_obj\n\t\t\t\t}\n\n\t\t\trescue\n\t\t\t\t# If fetch throws a wobbly at any point, fail gracefully\n\t\t\t\treturn false\n\t\t\tend\n\t\t\t# No errors - yield the value if desired\n\t\t\tif block_given?\n\t\t\t\tyield(value)\n\t\t\tend\n\t\t\t# Return true\n\t\t\treturn true\n\t\tend", "def key?(key)\n configuration.key?(key)\n end", "def has_key? k\n host_hash.has_key?(k) || options.has_key?(k)\n end", "def parent?\n if defined?(@parent_cookie_class) && defined?(@parent_cookie_key)\n true\n else\n false\n end\n end", "def _key_paths?(value)\n value.is_a?(Enumerable) && !value.is_a?(File)\n end", "def key?(key)\n super(convert_key(key))\n end", "def has_key?(key)\n @stored[key] && !@stored[key].empty? ? true : false\n end", "def is_zz?\n zz[:app_config] != nil\n end", "def inherit_views?\n read_inheritable_attribute('inherit_views') ? true : false\n end", "def get_env(key)\n\n end", "def inherit(key)\n noninheritable.delete(key)\n end", "def key?(key)\n return false if key.nil?\n return true if self.class.mutable? && mutations.key?(key)\n\n respond_to?(key) || fallback_data.key?(key)\n end", "def has_singleton?(key)\n return false unless @extensions\n @extensions.key?(key) || @extensions.key?(key.downcase)\n end", "def has_singleton?(key)\n return false unless @extensions\n @extensions.key?(key) || @extensions.key?(key.downcase)\n end", "def has_key?(key)\n @config.has_key? key\n end", "def inherit?\n @base_class != @owner\n end", "def env(key)\n if key.nil?\n nil\n else\n ENV[key]\n end\n end", "def lookup_allowed?(key)\n allowed = true\n unless node['bag_config']['bag_whitelist'].empty?\n allowed = node['bag_config']['bag_whitelist'].map(&:to_s).include?(key.to_s)\n end\n if allowed && !node['bag_config']['bag_blacklist'].empty?\n allowed = !node['bag_config']['bag_blacklist'].map(&:to_s).include?(key.to_s)\n end\n Chef::Log.debug(\"BagConfig not allowed to fetch config for base key: #{key}\") unless allowed\n allowed\n end", "def configured?(key)\n if _configured.include?(key) && _settings[key].cloneable?\n return _values[key] != _settings[key].to_value\n end\n\n _configured.include?(key)\n end", "def value_set? key\n @values.key? @schema.resolve_key! key\n end", "def valid_environment?\n env['USER'] == config.user && env['HOME'] == config.home_path\n end", "def inheritable_setting\n @inheritable_setting ||= Grape::Util::InheritableSetting.new.tap { |new_settings| new_settings.inherit_from top_level_setting }\n end", "def has_key?(value)\n ensure_loaded\n value = lookup_key(value)\n (@info.has_key?(value) || @new_info.has_key?(value)) && !!(self[value])\n end", "def needs_environment_scoping?(data)\n repository_depth(data) == 0\n end", "def key?(key)\n config.resolver.key?(_container, key)\n end", "def getenv(key=nil)\n if @rye_getenv && @rye_getenv.empty? && self.can?(:env)\n vars = self.quietly { env } rescue []\n vars.each do |nvpair| \n # Parse \"GLORIA_HOME=/gloria/lives/here\" into a name/value\n # pair. The regexp ensures we split only at the 1st = sign\n n, v = nvpair.scan(/\\A([\\w_-]+?)=(.+)\\z/).flatten\n @rye_getenv[n] = v\n end\n end\n key.nil? ? @rye_getenv : @rye_getenv[key.to_s]\n end", "def all_env_variables_non_nil?\n return FastlaneCI.env.all.none? { |_k, v| v.nil? || v.empty? }\n end", "def write_inheritable_attr(key, value)\n inheritable_attrs[key] = value\n end", "def base?\n if self.base != nil\n true\n else\n false\n end\n end", "def are_only_global?\n self.keys.size == 1 && self.keys[0] == '*'\n end", "def property?(key)\n @_values.include? key.to_sym\n end", "def has_key?(key)\n !!fetch(key)\n rescue ContextMiss\n false\n end", "def hierarchical?\n @hierarchical ||= !klass.fact_model.hierarchical_levels.empty?\n end", "def running_protected_environment?\n protected_environments.collect(&:to_sym).include?(Rails.env.to_sym)\n end", "def __empty?\n return false unless super\n __empty(__value)\n end", "def has_env_or_config?(variable)\n # Make sure the configured configuration is loaded, if possible\n init\n\n return self.has_env?(variable) || self.has_config?(variable)\n end", "def attr_dirty?(key)\n @dirty_attribute_keys ||= []\n @dirty_attribute_keys.include?(key.to_sym)\n end", "def has_property?(key)\n has_key?(key) or has_key?(alternate_key(key))\n end", "def include?(key)\n has_key?(key)\n end" ]
[ "0.65181106", "0.6462525", "0.63119984", "0.59950995", "0.5760447", "0.57421875", "0.572275", "0.5683113", "0.5676117", "0.56717056", "0.56517655", "0.563552", "0.5634367", "0.5627991", "0.55664897", "0.5558068", "0.5545557", "0.55309534", "0.54966104", "0.54808336", "0.5471482", "0.54703975", "0.5450295", "0.54185945", "0.54174745", "0.54015654", "0.5386373", "0.53738165", "0.5352093", "0.5342881", "0.53389734", "0.5335963", "0.52863103", "0.52643067", "0.5258471", "0.52564687", "0.52533066", "0.5238853", "0.5232004", "0.5202185", "0.52004623", "0.5193595", "0.5191269", "0.51842564", "0.5177846", "0.517378", "0.5161833", "0.51610374", "0.51584387", "0.5147958", "0.51477647", "0.51454926", "0.5134407", "0.5134407", "0.5115392", "0.5115377", "0.5106044", "0.51034445", "0.50951695", "0.5090818", "0.50825584", "0.50782126", "0.5071988", "0.50696176", "0.5068761", "0.50551033", "0.5053743", "0.50472194", "0.50454944", "0.5034714", "0.5020562", "0.50204545", "0.50148916", "0.49942625", "0.49942625", "0.4993865", "0.49938548", "0.49893", "0.49805942", "0.49736536", "0.49735633", "0.49700427", "0.4966001", "0.49659103", "0.4963985", "0.49539635", "0.49531966", "0.495108", "0.49406418", "0.49340022", "0.49311936", "0.49279377", "0.49262542", "0.49168035", "0.4916138", "0.49127412", "0.4912712", "0.49124235", "0.4911988", "0.4910862" ]
0.70132136
0
Returns true if the value for key is marked 'locked' If so, any attempt to call []= will be ignored.
def locked? key ! ! data(key, LOCKED) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def locked?(key)\n raise NotImplementedError\n end", "def locked?\n @locked\n end", "def locked?\n @locked\n end", "def locked?\n @locked\n end", "def locked?\n @locked\n end", "def locked?\n @locked\n end", "def locked?\n @locked\n end", "def is_locked?\n locked\n end", "def locked?\n\t\t\t@locked\n\t\tend", "def locked?\n return @locked\n end", "def locked?\n !locked_at.nil?\n end", "def locked?\n if defined?(@locked)\n @locked\n else\n false\n end\n end", "def access_locked?\n !!locked_at && !lock_expired?\n end", "def locked?\n\t\t#puts \"Came to check locked.\"\n\t\tif $redis.get(get_race_condition_key_name).blank?\n\t\t\t#puts \"the key is blank\"\n\t\t\tfalse\n\t\telse\n\t\t #puts \"key is not blank\"\n\t\t #puts \"key is: #{$redis.get(get_race_condition_key_name)}\"\n\t\t $redis.get(get_race_condition_key_name) == LOCKED\n\t\tend\n\tend", "def is_locked=(value)\n @is_locked = value\n end", "def locked?\n self.is_locked\n end", "def lockable?\n @lockable\n end", "def locked?(*args)\n inspect_lock(:redis_lock_key, *args)\n end", "def unlocked?\n @unlocked\n end", "def unlocked?\n !locked?\n end", "def locked?\n end", "def locked?\n locksmith.locked?\n end", "def lock_status?\n return @unlocked == true\n end", "def unlocked?\n not locked?\n end", "def locked?\n (status & (1 << 0)).zero?\n end", "def locked?\n fetch_lock_info\n\n obj_exists_and_is_not_type? obj: @lock_info, type: []\n end", "def locked?\n not @lock_name.nil?\n end", "def locked?\n revision.locked == 1\n end", "def locked?\n @mutex.locked?\n end", "def unlocked?\n unlocked, _, @active_worker_timestamp = Sidekiq.redis do |redis| \n redis.multi do\n redis.setnx(@locking_key, @current_worker_timestamp)\n redis.expire(@locking_key, 600)\n redis.get(@locking_key)\n end\n end\n unlocked\n end", "def is_locked\n return @is_locked\n end", "def is_locked\n @attributes[:is_locked]\n end", "def locking?\n @locking\n end", "def locked?\n !!read\n end", "def locked?\n !status_flag?(:kSecUnlockStateStatus)\n end", "def locked?\n self.released?\n end", "def locked?(obj)\n RedisMutexer.config.redis.exists(key(obj))\n end", "def locked?\n !!@owner\n end", "def lock_present?(keyspace)\n @storage.read(keyspace.lock_key) == LOCK_VALUE\n end", "def lock(key, admin = false)\n if @lockable and not @locked and (@keys.include? key or admin)\n @locked = true\n\n if self.can? :connected_to\n other = $manager.find self.connected_to\n other.lock(key, admin) if other.can? :lock\n end\n\n true\n else\n false\n end\n end", "def locked?(certifier = nil)\n if certifier\n return self.certifier_id.present? && self.certifier_id != certifier.id\n end\n\n return self.locked.present?\n end", "def queueing_locked?\n should_lock_on_queueing? && lock_present?\n end", "def lock?\n return true if @_lock_type\n false\n end", "def lock?\n record.unlocked? && (director?(record.event) || competition_admin? || super_admin?)\n end", "def mark?(key)\n\t\t\t\tif key\n\t\t\t\t\tif value = @keyed[key]\n\t\t\t\t\t\tvalue.mark!\n\t\t\t\t\t\t\n\t\t\t\t\t\treturn true\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn false\n\t\t\tend", "def locked?\n approved? or rejected?\n end", "def locked_according_to_internal_state?\n @state_mutex.synchronize do\n unsynced_locked_according_to_internal_state?\n end\n end", "def mon_locked?\n @mon_data.mon_locked?\n end", "def locking_enabled?\n lock_optimistically && columns_hash[locking_column]\n end", "def locked?\n raise NotImplementedError\n end", "def is_locked?\n return true if have_lock?\n begin\n return true unless acquire_lock\n ensure\n release_lock\n end\n false\n end", "def already_locked?\n lock_stack.last == lock_stack_item\n end", "def locked?\n !!locked_by && !!locked_at && (locked_at + Delayed::Worker.max_run_time) >= Delayed::Job.db_time_now\n end", "def id_locked?(id_to_check)\n @con.hexists(\"#{@lock_map_key}_h\", id_to_check)\n end", "def locked?\n submitted?\n end", "def lock!\n map.each do |key, matchers|\n matchers.each do |matcher|\n matcher[:locked] = true\n end\n end\n @locked = true\n end", "def locked?\n locked_by.present? && locked_at.present? && locked_at > 10.minutes.ago\n end", "def locked? disk\n\t\t@json.fetch(disk) == LOCKED\n\tend", "def key_held?(key)\n @held_interval[key] == G.kb_held_interval\n end", "def if_access_locked; end", "def access_locked?; end", "def supports_locking?\n false #true\n end", "def lock\n if unlocked_status == false\n raise ArgumentError.new(\"You cannot lock this door - it is already locked\")\n else\n door_hash[:unlocked_status] = false\n end\n end", "def locked?\n if sha1 = @eval_is_locked\n 1 == eval_safe(sha1, @ns_names)\n else\n redis_pool.exists @ns_names.first\n end\n end", "def lock\n # locking will automatically trigger reload\n # locker older than 1 hour is considered stale\n if !is_locked || (is_locked && locked_at < Time.now - 3600)\n self.is_locked = true\n self.locked_at = Time.now\n save!\n else\n false\n end\n end", "def is_set?(*key)\n synchronize do\n val = @data.get(*key)\n return false if val.nil?\n return false if val.is_a?(MonitorMixin::ConditionVariable)\n true\n end\n end", "def locked_at=(_locked)\n if _locked.to_i > 0\n self[:locked_at] = Time.now\n else\n self[:locked_at] = nil\n end\n end", "def locked_at=(_locked)\n if _locked.to_i > 0\n self[:locked_at] = Time.now\n else\n self[:locked_at] = nil\n end\n end", "def has_lock?\n @has_lock || false\n end", "def unlocked?\n ! File.exist?(lock_file)\n end", "def lock\n if @unlocked == false\n raise Exception.new(\"a locked door needith not to be locked\")\n else\n return @unlocked = false\n end\n end", "def locked_open?\n lock == :open\n end", "def access_locked?\n\n super && date_restricted?\n\n end", "def loner_locked?(*args)\n locked?(*args) || (loner && enqueued?(*args))\n end", "def locked?\n File.exist?(lock_file)\n end", "def write_locked?\n @counter.value >= RUNNING_WRITER\n end", "def locked?\n File.exist?(lock_file)\n end", "def mon_locked?\n (defined?(@mon_data) ? @mon_data : use_monitor_core).locked?\n end", "def self_locked?\n results = mysql2.query(%Q[select is_used_lock('#{key}')], as: :array)\n lock_id = results.to_a.first.first\n return nil if lock_id.nil?\n results = mysql2.query(%Q[select connection_id()], as: :array)\n self_id = results.to_a.first.first\n self_id == lock_id\n end", "def locked?\n @bridge.device_locked?\n end", "def can_lock?\n SpaceRequestPolicy.can_lock?(current_user, object)\n end", "def have_lock?\n !!@handle\n end", "def allowed?(key)\n @status[key] == :allowed\n end", "def partial_locked?\n !(to_editable? && from_editable?)\n end", "def is_editable?(key)\n (@options[:editable] || {})[key.to_sym] || true\n end", "def key?\n return true if @key; false\n end", "def try_lock\n if locked_out?\n false\n else\n lock\n true\n end\n end", "def has_key? key\n @lock.read_sync{ @data.has_key? key }\n end", "def lock_is_exclusive?\n lockscope == 'exclusive'\n end", "def locked?\n locked = false\n status_constant == OldOrder::UNPROCESSED ? locked = false : locked = true\n locked = true unless invoice.blank?\n return locked\n end", "def readonly?\n self.key == 'admin'\n end", "def unlock(key, admin = false)\n if @lockable and @locked and (@keys.include? key or admin)\n @locked = false\n\n if self.can? :connected_to\n other = $manager.find self.connected_to\n other.unlock(key, admin) if other.can? :lock\n end\n\n true\n else\n false\n end\n end", "def []=(_key, _value)\n false\n end", "def locked=(status = nil)\n self.submitted_at = Time.now if (status && status == true)\n locked?\n end", "def locked_closed?\n lock == :closed\n end", "def inspect_lock(lock_key_method, *args)\n lock_until = lock_redis.get(self.send(lock_key_method, *args))\n return (lock_until.to_i > Time.now.to_i) if lock_timeout > 0\n !lock_until.nil?\n end", "def can_lock?(current_user)\n return false if current_user.anonymous?\n\n not is_locked?\n end", "def key?(key)\n\t\t\t\tif key\n\t\t\t\t\t@keyed.key?(key)\n\t\t\t\tend\n\t\t\tend", "def locked?\n\t\t\t!lockoutTime.nil? && lockoutTime.to_i != 0\n\t\tend", "def lock!(certifier)\n return false if self.locked? # already locked?\n# NCID staff determined it was best to disable these checks to allow people to recertify things\n# return false if self.certifier.present? # already claimed?\n# return false unless self.certified_at.nil? # already certified?\n\n return self.update_attributes!(:certifier_id => certifier.id, :locked => true)\n end" ]
[ "0.7454825", "0.7390553", "0.73161703", "0.73161703", "0.73161703", "0.73161703", "0.72735626", "0.72596794", "0.7245564", "0.7153851", "0.7130027", "0.7127562", "0.70990014", "0.70923525", "0.70795846", "0.7079581", "0.70446825", "0.6998114", "0.6977817", "0.69634235", "0.6946123", "0.6939987", "0.6916913", "0.6830735", "0.68173724", "0.67386615", "0.671619", "0.66959786", "0.6669895", "0.6642884", "0.66290796", "0.6597793", "0.6577364", "0.656018", "0.6553003", "0.6549632", "0.6506562", "0.64714533", "0.6460821", "0.64496404", "0.6449108", "0.64455605", "0.64386004", "0.6416746", "0.6416017", "0.6399068", "0.6380637", "0.63674486", "0.6345885", "0.63317883", "0.63253134", "0.63037634", "0.62999547", "0.62368214", "0.6195049", "0.61792684", "0.6168046", "0.61637735", "0.61610264", "0.6159093", "0.61589384", "0.6148626", "0.6145497", "0.6111546", "0.60983145", "0.6090707", "0.60887945", "0.60887945", "0.608428", "0.60720795", "0.6071155", "0.60598654", "0.6055539", "0.6036594", "0.6027612", "0.60273695", "0.60253644", "0.59984773", "0.5983958", "0.5977155", "0.59770393", "0.5965251", "0.59587467", "0.5949672", "0.5947666", "0.5922474", "0.59187573", "0.5910333", "0.5910017", "0.590391", "0.5888863", "0.588381", "0.5869034", "0.584918", "0.5843782", "0.5826575", "0.5817577", "0.581481", "0.58143497", "0.58134663" ]
0.8380538
0
Executes block while setting dst with each element of env. dst is restored after completion of the block. nil values are equivalent to deleting the dst element dst defaults to the global ENV NOT THREADSAFE if dst == ENV
def with dst = nil dst ||= ENV with_env(@h, dst) do yield end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def with_env(options, &block)\n backup = ENV.to_h\n ENV.clear\n ENV.update(options)\n yield\nensure\n ENV.clear\n ENV.update(backup)\nend", "def withenv(env, &block)\n original = ENV.to_hash\n reset(original.merge(env))\n block.call\n ensure\n reset(original)\n end", "def _post_eval\n @environments << @env if @env_used\n @env = nil\n @options = nil\n end", "def with_environment(env)\n save_vals = env.keys.collect { |k| [k, ENV[k.to_s]] }\n begin\n env.each { |k, v| ENV[k.to_s] = v }\n yield\n ensure\n save_vals.each { |k, v| ENV[k.to_s] = v }\n end\nend", "def with_environment(env)\n old_env = {}\n env.each do |var, value|\n old_env[var] = ENV[var.to_s]\n ENV[var.to_s] = value\n end\n\n yield\n ensure\n old_env.each { |var, value| ENV[var.to_s] = value }\n end", "def with_env(vars) #, &block)\n return if !block_given?\n #vars.each {|v| ENV[v] = eval(v, block.binding)}\n temp = {}\n vars.each do |k, v|\n temp[k.to_s] = ENV[k.to_s]\n ENV[k.to_s] = v\n end\n output = yield\n vars.each do |k,v|\n if temp[k.to_s] \n ENV[k.to_s] = temp[k.to_s]\n else\n ENV.delete(k.to_s)\n end\n end\n return output\n end", "def save_env\n [@src, @tree, @block_ial, @stack, @text_type]\n end", "def restore_env(env); end", "def with_env(hash)\n old = {}\n hash.each do |k,v|\n old[k] = ENV[k]\n ENV[k] = v\n end\n begin\n yield\n ensure\n hash.each do |k,v|\n ENV[k] = old[k]\n end\n end\n end", "def wrap_env(envs = {})\n original_envs = ENV.select{ |k, _| envs.has_key? k }\n envs.each{ |k, v| ENV[k] = v }\n\n yield\n ensure\n envs.each{ |k, _| ENV.delete k }\n original_envs.each{ |k, v| ENV[k] = v }\n end", "def with_env(env={})\n overrides = {}\n begin\n ENV.keys.each do |key|\n if key =~ /^GIT_/\n overrides[key] = ENV.delete(key)\n end\n end\n\n env.each_pair do |key, value|\n overrides[key] ||= nil\n ENV[key] = value\n end\n\n yield\n ensure\n overrides.each_pair do |key, value|\n if value\n ENV[key] = value\n else\n ENV.delete(key)\n end\n end\n end\n end", "def restore_env(env)\n @src, @tree, @block_ial, @stack, @text_type = *env\n end", "def reset_env(opts = T.unsafe(nil)); end", "def _save_env\n require 'yaml'\n w_var = @var.dup\n @var[:blacklist_env].each { |b| w_var.delete b } if @var[:blacklist_env]\n _open_sefile('env3.yml', 'w') { |f| YAML.dump(w_var, f) }\nend", "def with_env(env)\n begin\n current = set_env(env)\n yield\n ensure\n set_env(current)\n end\n end", "def finish\n super\n @_env[ENV_KEY] = self\n end", "def save_env; end", "def apply!\n each do |k, v|\n if v =~ /^keyth\\:(.*)/\n ENV[k] = Keyth.get_key_safe(Regexp.last_match[1]) || ''\n else\n ENV[k] = v\n end\n end\n end", "def env=(environment); end", "def env=(environment); end", "def cleanup\n return unless @dst\n\n @dst.unlink\n @dst = nil\n end", "def mock_env(partial_env_hash)\n old = ENV.to_hash\n ENV.update partial_env_hash\n begin\n yield\n ensure\n ENV.replace old\n end\n end", "def with_temp_env(environment)\n # Build up the new environment, preserving the old values so we\n # can replace them back in later.\n old_env = {}\n environment.each do |key, value|\n old_env[key] = ENV[key]\n ENV[key] = value\n end\n\n # Call the block, returning its return value\n return yield\n ensure\n # Reset the environment no matter what\n old_env.each do |key, value|\n ENV[key] = value\n end\n end", "def visit_EnvNode(node)\n node.env.each_pair do |key,val|\n ENV[key] = val\n end\n Yap::Shell::Execution::Result.new(status_code:0, directory:Dir.pwd, n:1, of:1)\n end", "def with_env(name, value)\n saved, ENV[name] = ENV[name], value\n yield\n ensure\n ENV[name] = saved\n end", "def with_env(name, value)\n saved, ENV[name] = ENV[name], value\n yield\n ensure\n ENV[name] = saved\n end", "def with_env(name, value)\n saved, ENV[name] = ENV[name], value\n yield\n ensure\n ENV[name] = saved\n end", "def build_environment(env, env_yaml, platform)\n # substitute vcenter resources from vcenter.yml for location defined in environment file\n env_yaml['vcenter'] = platform.vcenter[env_yaml['vcenter']]\n # merge component resources from environment file and platform definition\n # platform info will be inserted where not found in env files, env overrides will be unchanged\n #\n # Note: this function does not do error checking for components that exist in env file but\n # not in Platform definition. Such files will be retained but not have any Platform\n # component info. The Build command will run error checking before building, but to support\n # the debugging value of the list command only hash.merge! is performed at this point.\n platform.components.each do |component, _config|\n env_yaml['components'][component].merge!(platform.components[component]) { |_key, v1, _v2| v1 } unless env_yaml['components'][component].nil?\n end\n # substitute network and components for specified values from platform definition files\n env_yaml['components'].each do |component, _config|\n env_yaml['components'][component]['network'] = platform.network[env_yaml['components'][component]['network']]\n env_yaml['components'][component]['compute'] = platform.compute[env_yaml['components'][component]['compute']]\n unless env_yaml['components'][component]['runlist'].nil?\n env_yaml['components'][component]['runlist'] = run_list(env_yaml['components'][component]['runlist'], env_yaml['components'][component]['componentrole'], component)\n end\n end\n unless env_yaml['vcenter'].nil?\n # append env name to destination folder if appendenv == true\n env_yaml['vcenter']['destfolder'] += (env_yaml['vcenter']['appendenv'] ? '/' + env.to_s : '')\n # prepend app name to domain if appenddomain == true\n env_yaml['vcenter']['appenddomain'] ? env_yaml['vcenter']['domain'] = '.' + platform.name + '.' + env_yaml['vcenter']['domain'] : ''\n end\n env_yaml\n end", "def exec_bundle\n ENV_EXPORTERS.each do |exporter|\n ENV[\"VER_#{exporter.upcase}\"] = ENV[\"TM_#{exporter.upcase}\"] =\n send(\"exec_env_#{exporter}\").to_s\n end\n\n yield if block_given?\n end", "def with_clean_env(&block); end", "def mirror_env_to_profile_d env_file\n if /opensuse|sles-/.match?(self[:platform])\n @logger.debug(\"mirroring environment to /etc/profile.d on opensuse/sles platform host\")\n cur_env = exec(Beaker::Command.new(\"cat #{env_file}\")).stdout\n shell_env = ''\n cur_env.each_line do |env_line|\n shell_env << \"export #{env_line}\"\n end\n # here doc it over\n exec(Beaker::Command.new(\"cat << EOF > #{self[:profile_d_env_file]}\\n#{shell_env}EOF\"))\n # set permissions\n exec(Beaker::Command.new(\"chmod +x #{self[:profile_d_env_file]}\"))\n # keep it current\n exec(Beaker::Command.new(\"source #{self[:profile_d_env_file]}\"))\n else\n # noop\n @logger.debug(\"will not mirror environment to /etc/profile.d on non-sles platform host\")\n end\n end", "def set_env!(request, env_key, value)\n if block_given?\n old_value = request.env[env_key]\n request.env[env_key] = value\n yield\n request.env[env_key] = old_value\n else\n request.env[env_key] = value\n end\nend", "def export_env(env = {})\n @env = env\n end", "def process\n @src ||= @original\n @dst ||= @original.temp_path\n\n return unless yield @src, @dst\n\n @result = @dst\n if @src == @original\n @src, @dst = @dst, nil\n else\n @src, @dst = @dst, @src\n end\n end", "def visit_EnvNode(node)\n debug_visit(node)\n node.env.each_pair do |key, arg_node|\n world.env[key] = process_EnvArgumentNode(arg_node)\n end\n Yap::Shell::Execution::Result.new(status_code:0, directory:Dir.pwd, n:1, of:1)\n end", "def config=(env, override_configurations = T.unsafe(nil)); end", "def environment(matches={}, &block)\n if matches.any?{ |e, m| m === ENV[e] }\n block.call\n end\n end", "def set_remote_env(env); end", "def with_original_env\n with_env(original_env) { yield }\n end", "def with_custom_env_variables(&block)\n saved_env = {}\n begin\n Git::Lib::ENV_VARIABLE_NAMES.each { |k| saved_env[k] = ENV[k] }\n return block.call\n ensure\n Git::Lib::ENV_VARIABLE_NAMES.each { |k| ENV[k] = saved_env[k] }\n end\n end", "def apply_variables_to_environment!(options = {})\n variables_to_apply = variables.except(\"RACK_ENV\", \"RAILS_ENV\")\n \n variables_to_apply.each do |key, value|\n if !ENV.has_key?(key.to_s) || options[:overwrite] == true\n ENV[key.to_s] = value.to_s\n end\n end\n \n variables_to_apply\n end", "def update_asset_settings!\n AssetSettings[:development].files[@file_id] = @sfiles.map(&:local_url)\n return unless AssetMapper.compile?\n\n AssetSettings[:production].files[@file_id] = @cloud_files.map(&:production_url)\n AssetSettings[:production].files[@file_id] << @tfile.production_url if @tfile.production_url\n\n AssetSettings[:local_assets].files[@file_id] = @cloud_files.map(&:local_url)\n AssetSettings[:local_assets][@file_id] << @tfile.local_url if @tfile.local_url\n end", "def save\n\t\t\tsuper\n\t\t\t@@env = self\n\t\tend", "def put_dest(mode, dst_r)\n case mode\n when 1 # Register direct\n temp = @reg[dst_r]\n x = yield temp\n @reg[dst_r] = x\n when 2 # Indirect\n dst_address = @mem.read(@pc)\n @pc += 1\n temp = @mem.read(dst_address)\n new_value = yield temp\n @mem.write(dst_address, new_value)\n when 3 # Register indirect\n dst_address = @reg[dst_r]\n temp = @mem.read(dst_address)\n new_value = yield temp\n @mem.write(dst_address, new_value)\n end\n end", "def env(variable_name, variable_value, &block); end", "def with_env(env={}, replace=false)\n current_env = nil\n begin\n current_env = set_env(env, replace)\n yield\n ensure\n if current_env\n set_env(current_env, true)\n end\n end\n end", "def environment *environments, &block\n old = @environments\n @environments = @environments.dup.concat environments.map { |e| e.to_s }\n\n instance_eval(&block)\n ensure\n @environments = old\n end", "def reset(env)\n env.each_pair do |key, value|\n ENV[key] = value\n end\n\n (ENV.keys - env.keys).each do |key|\n ENV.delete(key)\n end\n end", "def _env_change\n if @env_used\n @environments << @env\n @env = Bcpm::Tests::Environment.new\n @env_used = false\n end\n end", "def copy_assets(&block)\n app = ::Rails.application\n\n ::Sprockets::Environment.new(app.root.to_s) do |env|\n env.version = app.config.assets.version\n\n env.context_class.class_eval do\n # Import some voodoo from Sprockets Rails. See\n # `https://github.com/rails/sprockets-rails/blob/v3.2.0/lib/sprockets/railtie.rb#L132-L135`.\n include ::Sprockets::Rails::Context\n\n self.assets_prefix = app.config.assets.prefix\n self.digest_assets = app.config.assets.digest\n self.config = app.config.action_controller\n end\n\n # Use the application configuration's search paths. These can be overridden with `clear_paths`.\n app.config.assets.paths.each { |path| env.append_path(path) }\n\n # Since this is mostly likely a single-use environment, we don't intend to cache anything.\n env.cache = nil\n\n # No CSS compression.\n env.css_compressor = nil\n\n # No JS compression.\n env.js_compressor = nil\n\n # Enable further customization by the user.\n block.call(env) \\\n if block\n end\n end", "def scan\n @mapping.each do |key, values|\n @overrides[key] = values.pop if values.last.is_a? Proc\n env_name = values.find { |v| ENV[v] }\n @storage[key] = if env_name\n ENV[env_name].empty? ? '' : YAML.parse(ENV[env_name]).to_ruby\n end\n end\n end", "def with_env_vars(vars = {})\n vars_cache = ENV.slice(*vars.keys)\n vars.each { |k, v| ENV[k] = v }\n yield\n vars.each { |k, _| ENV[k] = vars_cache[k] }\n end", "def apply_environment!(hook_context, env); end", "def successor_environment(env)\n (options[:environment_successors] || {})[env]\n end", "def overwriting_argv(value, &block)\n original_argv = ARGV\n Object.const_set :ARGV, value\n block.call\n ensure\n Object.const_set :ARGV, original_argv\n end", "def overwriting_argv(value, &block)\n original_argv = ARGV\n Object.const_set :ARGV, value\n block.call\n ensure\n Object.const_set :ARGV, original_argv\n end", "def environment *environments, &block\n old = @environments.dup\n @environments.concat environments.map { |e| e.to_s }\n\n begin\n yield\n ensure\n @environments = old\n end\n end", "def with_clean_env\n bundled_env = ENV.to_hash\n %w(BUNDLE_GEMFILE RUBYOPT BUNDLE_BIN_PATH).each{ |var| ENV.delete(var) }\n yield\nensure\n ENV.replace(bundled_env.to_hash)\nend", "def with_clean_env\n bundled_env = ENV.to_hash\n %w(BUNDLE_GEMFILE RUBYOPT BUNDLE_BIN_PATH).each{ |var| ENV.delete(var) }\n yield\nensure\n ENV.replace(bundled_env.to_hash)\nend", "def scope\n @env.unshift({})\n begin\n yield\n ensure\n @env.shift\n raise \"You went too far unextending env\" if @env.empty?\n end\n end", "def set_env(env)\n current = Thread.current[ENVIRONMENT]\n Thread.current[ENVIRONMENT] = env\n current\n end", "def clean_env!\n ENV.replace(@base_env.dup)\n scrub_env(ENV)\n if(defined?(Bundler))\n Bundler.with_clean_env{ yield }\n else\n yield\n end\n end", "def original_env; end", "def stage_cmd_env(compressed_script, env_suffix = Rex::Text.rand_text_alpha(8))\n # Check to ensure script is encoded and compressed\n if compressed_script =~ /\\s|\\.|\\;/\n compressed_script = compress_script(compressed_script)\n end\n\n # Divide the encoded script into 8000 byte chunks and iterate\n index = 0\n count = 8000\n while index < compressed_script.size - 1\n # Define random, but serialized variable name\n env_variable = format(\"%05d%s\", ((index + 8000) / 8000), env_suffix)\n\n # Create chunk\n chunk = compressed_script[index, count]\n\n # Build the set commands\n set_env_variable = \"[Environment]::SetEnvironmentVariable(\" \\\n \"'#{env_variable}',\" \\\n \"'#{chunk}', 'User')\"\n\n # Compress and encode the set command\n encoded_stager = encode_script(compress_script(set_env_variable))\n\n # Stage the payload\n print_good \" - Bytes remaining: #{compressed_script.size - index}\"\n execute_script(encoded_stager, false)\n\n index += count\n end\n\n # Build the script reassembler\n reassemble_command = \"[Environment]::GetEnvironmentVariables('User').keys|\"\n reassemble_command += \"Select-String #{env_suffix}|Sort-Object|%{\"\n reassemble_command += \"$c+=[Environment]::GetEnvironmentVariable($_,'User')\"\n reassemble_command += \"};Invoke-Expression $($([Text.Encoding]::Unicode.\"\n reassemble_command += \"GetString($([Convert]::FromBase64String($c)))))\"\n\n # Compress and encode the reassemble command\n encoded_script = encode_script(compress_script(reassemble_command))\n\n encoded_script\n end", "def visit_EnvWrapperNode(node)\n with_env do\n node.env.each_pair { |env_var_name,value| ENV[env_var_name] = value }\n node.node.accept(self)\n end\n end", "def default_environment=(env); end", "def execute_for_all_envs\n # 1\n schemeList = Dir.glob(\".env.*\")\n # 2\n schemeList.each do |file|\n # 3\n Dotenv.overload(file)\n # 4\n yield\n end\n end", "def reload_environment\n CloudCrooner.instance_variables.each do |var|\n CloudCrooner.instance_variable_set(var, nil)\n end\n\n Post.instance_variable_set(:@compiled_content_dir, nil) if defined?(Post)\n end", "def forward_local_env(env_variable_patterns); end", "def with env, opts = {}\n merge_opts_with_env opts\n yield if block_given?\n end", "def static_env=(_arg0); end", "def static_env=(_arg0); end", "def static_env=(_arg0); end", "def with_env_vars(filename = nil, &_block)\n original_env_vars = ENV.to_hash\n Dotenv.load(filename) if filename\n yield\nensure\n ENV.replace(original_env_vars)\nend", "def []= key, value\n ENV[envify(key)] = value\n end", "def clear_env\n DataCache.env_hash = {}\n end", "def environment\n return @vars unless @vars.nil?\n\n # If not set, Try to find them...\n glob_path = File.join(@deployment_home, @settings.env_file_glob_path)\n regexp_find = glob_path.gsub(/\\*/, '(.*)')\n Dir[glob_path].each do | file_name |\n # Get the environment name from the file part of the glob path:\n # e.g. given ./environments/ci_mgt/kb8or.yaml\n # get ci_mgt from ./environments/*/kb8or.yaml\n /#{regexp_find}/.match(file_name)\n env_name = $1\n if env_name == @env_name\n debug \"env=#{env_name}\"\n # Ensure we set the defaults as vars BEFORE we add environment specifics:\n @vars = @settings.defaults\n env_vars = Context.resolve_env_file(file_name)\n @vars = @vars.merge(env_vars)\n @vars = @vars.merge(@overridden_vars)\n @vars['env'] = env_name\n @environment_file = file_name\n break\n end\n end\n # Now finaly, update the settings now we know the environment!\n unless @vars\n @vars = {}\n end\n @settings = @settings.new(@vars)\n update_k8context\n debug \"vars=#{vars}\"\n @vars\n end", "def set_env_variables(container_names = '*', block: false, timeout: 60, polling: 5, **env)\n env_strings = env.map { |k, v| v ? \"#{k}=#{v}\" : \"#{k}-\" }\n log.info \"Setting env variables (#{env_strings}) for #{name}/#{container_names}\"\n @parent.execute('set env', \"dc/#{name}\", *env_strings, containers: container_names)\n sleep polling\n wait_for_deployments(timeout: timeout, polling: polling) if block\n reload(true)\n @_env = nil\n end", "def em_async_schedule\n o = self.class.environment\n self.class.set :environment, :normal\n async_schedule { yield }\n ensure\n self.class.set :environment, o\n end", "def prepare_bundle_env_for_env(standalone: false)\n path = File.join(DESTROOT, \"bundle\", \"bin\", \"bundle-env\")\n content = File.read(path)\n placeholder = \"{{IS_STANDALONE}}\"\n raise \"Could not find placeholder #{placeholder} in '#{path}'\" unless content.include?(placeholder)\n content.gsub!(placeholder, standalone.to_s)\n if !standalone\n homebrew_placeholder = \"{{IS_INSTALLED_VIA_HOMEBREW}}\"\n raise \"Could not find placeholder #{homebrew_placeholder} in '#{path}'\" unless content.include?(homebrew_placeholder)\n content.gsub!(homebrew_placeholder, standalone.to_s)\n end\n File.write(path, content)\n puts \"Updated '#{path}' for IS_STANDALONE environment '#{standalone}'\"\n end", "def restore_env_branch\n original_travis_branch = (defined?(@original_travis_branch) && @original_travis_branch) || nil\n original_circle_branch = (defined?(@original_circle_branch) && @original_circle_branch) || nil\n original_bitrise_branch = (defined?(@original_bitrise_branch) && @original_bitrise_branch) || nil\n original_github_pull_request_builder_plugin_branch = (defined?(@original_github_pull_request_builder_plugin_branch) && @original_github_pull_request_builder_plugin_branch) || nil\n original_git_plugin_branch = (defined?(@original_git_plugin_branch) && @original_git_plugin_branch) || nil\n ENV['TRAVIS_BRANCH'] = original_travis_branch\n ENV['CIRCLE_BRANCH'] = original_circle_branch\n ENV['BITRISE_GIT_BRANCH'] = original_bitrise_branch\n ENV['ghprbSourceBranch'] = original_github_pull_request_builder_plugin_branch\n ENV['GIT_BRANCH'] = original_git_plugin_branch\n end", "def env(env=nil)\n env ||= 'default'\n e = @environments[env] ||= Environment.new\n yield e if block_given?\n e\n end", "def replace_znc_config env\n FileUtils.rm_rf(config_path) if File.directory?(config_path)\n FileUtils.cp_r config_template_path(env), config_path\n end", "def visit_EnvWrapperNode(node)\n debug_visit(node)\n with_env do\n node.env.each_pair do |env_var_name, arg_node|\n world.env[env_var_name] = process_EnvArgumentNode(arg_node)\n end\n node.node.accept(self)\n end\n end", "def stash_env_branch\n @original_travis_branch = ENV['TRAVIS_BRANCH']\n @original_circle_branch = ENV['CIRCLE_BRANCH']\n @original_bitrise_branch = ENV['BITRISE_GIT_BRANCH']\n @original_github_pull_request_builder_plugin_branch = ENV['ghprbSourceBranch']\n @original_git_plugin_branch = ENV['GIT_BRANCH']\n ENV.delete 'TRAVIS_BRANCH'\n ENV.delete 'CIRCLE_BRANCH'\n ENV.delete 'BITRISE_GIT_BRANCH'\n ENV.delete 'ghprbSourceBranch'\n ENV.delete 'GIT_BRANCH'\n end", "def prepare_env(load_stage = stage)\n \n load_stage = load_stage.to_s\n \n if !db_config \n Wpcap::Utility.error(\"No Database Configurations Found\")\n abort \n end\n \n if remote_config(:db_priv_pass).nil?\n Wpcap::Utility.error \"This no privileged user for this server found in servers ssh environment profile (did you set it up with wpcap?)\" \n abort\n end\n \n set(:local_dump) { \"/tmp/#{application}.sql.bz2\" }\n \n if db_config[load_stage]\n \n set(:db_priv_user) { remote_config(:db_priv_user).nil? ? db_config[load_stage][\"username\"] : remote_config(:db_priv_user) }\n set(:db_priv_pass) { remote_config(:db_priv_pass).nil? ? db_config[load_stage][\"password\"] : remote_config(:db_priv_pass) }\n set(:db_host) { db_config[load_stage][\"host\"] }\n set(:db_database) { db_config[load_stage][\"database\"] }\n set(:db_username) { db_config[load_stage][\"username\"] }\n set(:db_password) { db_config[load_stage][\"password\"] }\n set(:db_encoding) { db_config[load_stage][\"encoding\"] }\n set(:db_prefix) { db_config[load_stage][\"prefix\"] } \n \n else\n\n set :db_priv_user , remote_config(:db_priv_user) \n set :db_priv_pass , remote_config(:db_priv_pass) \n set :db_username , \"#{application.split(\".\").first}_#{stage}\"\n set :db_database , \"#{application.split(\".\").first}_#{stage}\"\n set :db_password , random_password(16)\n set :db_prefix , \"wp_\" || db_config[\"development\"][\"prefix\"]\n \n run \"mkdir -p #{shared_path}/config\"\n template \"mysql.yml.erb\", \"#{shared_path}/config/database.yml\"\n server_yaml = capture \"cat #{shared_path}/config/database.yml\"\n server_mysql_config_yaml = YAML.load(server_yaml)\n update_db_config(server_mysql_config_yaml)\n db_config(true)\n end\n \n end", "def set_config(env, override_configurations = T.unsafe(nil)); end", "def bundler_with_clean_env(&block)\n if defined?(Bundler)\n begin\n orig_env = ENV.to_hash\n ENV.delete_if { |k,_| k[0,7] == 'BUNDLE_' }\n if ENV.has_key? 'RUBYOPT'\n ENV['RUBYOPT'] = ENV['RUBYOPT'].sub '-rbundler/setup', ''\n end\n %w[RUBYLIB GEM_HOME].each {|key| ENV.delete(key) }\n yield\n ensure\n ENV.replace(orig_env)\n end\n else\n yield\n end\n end", "def mutate_config(*args)\n raise RuntimeError, \"can't modify immutable cached environment\"\n end", "def load_env!(options = {})\n source = load_yaml_file(\"env.yml\")\n source = source.fetch(options[:env_section] || env_section, {})\n \n source.each do |key, value|\n if !ENV.has_key?(key) || options[:overwrite] == true\n ENV[key.to_s.upcase] = value.to_s\n end\n end\n end", "def reset_env(opts = {})\n opts = {text_type: :raw_text, stack: []}.merge(opts)\n @src = opts[:src]\n @tree = opts[:tree]\n @block_ial = opts[:block_ial]\n @stack = opts[:stack]\n @text_type = opts[:text_type]\n end", "def redis_save(src, dst, eta)\n @redis.set redis_key(src, dst), eta\n end", "def with_modified_env(env)\n if defined?(ClimateControl) || climate_control?\n ClimateControl.modify(env, &Proc.new)\n else\n yield\n end\n end", "def setenv( vm, host )\n return unless host.key?('env')\n cmd=\"tee -a \\\"/etc/profile.d/setenv.sh\\\" > \\\"/dev/null\\\" <<ENDHERE\"\n host['env'].each do |key, val|\n cmd=\"#{cmd}\\nexport #{key}=\\\"#{val}\\\"\"\n end\n cmd=\"#{cmd}\\nENDHERE\"\n vm.provision \"shell\", inline: cmd, run: \"always\"\nend", "def replace_env(target)\n REPLACE_ENV.inject(target) do |memo, var|\n value = ENV[var]\n if value\n memo.gsub(/\\$\\{?#{var}\\}?/, value)\n else\n memo\n end\n end\nrescue => e\n puts \"Could not replace environment variables in: '#{target}'\"\nend", "def load_from_env(env_name, name, hash, &block)\n if ENV[env_name].present?\n if block_given?\n hash[name] = yield(ENV[env_name])\n else\n hash[name] = ENV[env_name] \n end\n end\nend", "def []= name, val\n hash = @env.find { |closure| closure.key? name } || current\n hash[name] = val\n end", "def set_env\n env = (container[:env] ||= [])\n\n # static data\n metadata = release_doc_metadata\n [:REVISION, :TAG, :DEPLOY_ID, :DEPLOY_GROUP].each do |k|\n env << {name: k, value: metadata.fetch(k.downcase).to_s}\n end\n\n [:PROJECT, :ROLE].each do |k|\n env << {name: k, value: template[:spec][:template][:metadata][:labels][k.downcase].to_s}\n end\n\n # dynamic lookups for unknown things during deploy\n {\n POD_NAME: 'metadata.name',\n POD_NAMESPACE: 'metadata.namespace',\n POD_IP: 'status.podIP'\n }.each do |k, v|\n env << {\n name: k,\n valueFrom: {fieldRef: {fieldPath: v}}\n }\n end\n\n if needs_secret_sidecar?\n vault_config = VaultClient.client.config_for(@doc.deploy_group.vault_instance)\n raise StandardError, \"Could not find Vault config for #{@doc.deploy_group.permalink}\" unless vault_config\n\n sidecar_env = (sidecar_container[:env] ||= [])\n {\n VAULT_ADDR: vault_config['vault_address'],\n VAULT_SSL_VERIFY: vault_config['tls_verify']\n }.each do |k, v|\n sidecar_env << {\n name: k,\n value: v.to_s\n }\n end\n end\n end", "def environment=(env_options)\n env_options.each do |key, value|\n ENV[key] = value\n end\n end", "def vectorize_local_to_storage(src, dst, storage, options=nil)\r\n vectorize(src, dst, true, false, options, storage)\r\n end" ]
[ "0.5675896", "0.5532706", "0.5494883", "0.5427228", "0.53598213", "0.5304405", "0.5263251", "0.5195921", "0.5178359", "0.5156537", "0.5153828", "0.51467794", "0.50784034", "0.5068004", "0.5047206", "0.50176156", "0.500382", "0.49426588", "0.49259073", "0.49259073", "0.49149776", "0.48798692", "0.48673618", "0.48033157", "0.48024547", "0.48024547", "0.47933426", "0.47746983", "0.47710982", "0.47636592", "0.4730235", "0.47132346", "0.47050318", "0.46946532", "0.46942422", "0.46833396", "0.46826297", "0.4673623", "0.4659367", "0.46564013", "0.46540928", "0.4639299", "0.4628508", "0.46155363", "0.46054518", "0.46037796", "0.45869744", "0.45831054", "0.45669612", "0.4566723", "0.45627236", "0.4546175", "0.45424306", "0.45299998", "0.4512351", "0.4512351", "0.44768444", "0.44758078", "0.44758078", "0.44619018", "0.44498906", "0.44473416", "0.44469163", "0.44407102", "0.43972546", "0.43819553", "0.43625313", "0.43527347", "0.43304798", "0.43211973", "0.43193066", "0.43193066", "0.43193066", "0.43105406", "0.43053716", "0.43036488", "0.4301682", "0.42986202", "0.4285634", "0.42823264", "0.4281819", "0.4271552", "0.42692286", "0.42612475", "0.4241314", "0.42357105", "0.42338282", "0.42312032", "0.42267495", "0.4226201", "0.421901", "0.41982976", "0.41939974", "0.41904184", "0.41868192", "0.41749746", "0.41690284", "0.41611403", "0.41555387", "0.41526535" ]
0.64974326
0
Use callbacks to share common setup or constraints between actions.
def set_grupo_material @grupo_material = GrupoMaterial.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
Only allow a trusted parameter "white list" through.
def grupo_material_params params.require(:grupo_material).permit(:codigo, :nome) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "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 filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n 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 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 [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\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 filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\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 additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; 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 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 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 paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "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 valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\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 filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\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 argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\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 sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\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 parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\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 special_device_list_params\n params.require(:special_device_list).permit(:name)\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" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
Remembers a user in a persistent session.
def remember(user) user.set_remember_token cookies.permanent.signed[:user_id] = user.id #user.remember_token is the User::remember_token class variable, #no getters on the rails train... cookies.permanent[:remember_token] = user.remember_token end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_user\n return unless exists?(:previous_user)\n set :user, fetch(:previous_user)\n unset :previous_user\n clear_sessions\n end", "def change_password\n @user = User.find_by_id(session[:remember_token])\n end", "def log_in_user!(user)\n session[:session_token] = user.reset_session_token!\n end", "def log_in_user!(user)\n session[:session_token] = user.reset_session_token!\n end", "def user_remember(user)\n user.remember_user\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def user_remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def sign_in(user)\n remember_token = User.new_remember_token\n cookies.permanent[:remember_token] = remember_token\n user.update_attribute(:remember_token, User.hash(remember_token))\n self.current_user = user\n end", "def sign_in(user)\n remember_token = User.new_remember_token\n cookies.permanent[:remember_token] = remember_token\n user.update_attribute(:remember_token, User.hash(remember_token))\n self.current_user = user\n end", "def set_session_current_user(user)\n self.current_user = user\n # Try to reuse existing sessions.\n if session[:authpwn_suid]\n token = Tokens::SessionUid.with_code(session[:authpwn_suid]).first\n if token\n if token.user == user\n token.touch\n return user\n else\n token.destroy\n end\n end\n end\n if user\n session[:authpwn_suid] = Tokens::SessionUid.random_for(user,\n request.remote_ip, request.user_agent || 'N/A').suid\n else\n session.delete :authpwn_suid\n end\n end", "def set_user\n zeus = User.find(@zeus_user.id)\n zeus.state = User.states['retrieved_password']\n zeus.save!\n \n request.session[:rbac_user_id] = @zeus_user.id\n end", "def login(user)\n session[:session_token] = user.reset_session_token\n end", "def set_user\n @user = User.find_by(username: params[:user][:username])\n session[:user_id] = @user.id\n end", "def remember user\n # generates the remember token and saves it's encrypted form to the db\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n # abort(@session[:user_id].to_s)\n # cookies.permanent.signed[:user_id] = user.id\n # cookies.permanent[:remember_token] = user.remember_token\n end", "def set_user_session\n @user = user_session.find(params[:id])\n end", "def login!(user)\n session[:session_token] = user.reset_session_token!\n end", "def login_user!(user)\n user.reset_session_token!\n session[:session_token] = user.session_token\n end", "def set_current_user(user)\n sha1 = Digest::SHA1.hexdigest(user.id.to_s + Time.now.to_i.to_s)\n cookies[:remember_token] = { :value => sha1, :expires => 3.years.from_now }\n user.remember_token = sha1\n user.save\n @current_user = user\n end", "def login(user)\n session[:session_token] = user.reset_session_token!\n end", "def switch_user\n session[:user_id] = params[:user_id]\n redirect_to \"/admin/account\"\n end", "def log_in_user!(a_user)\n session[:session_token] = a_user.reset_session_token!\n end", "def set_user_session(user)\n session[:logged_in_users_id] = user.id\n end", "def remember(user)\n user.persist\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def save_session user\n # The password_seed method is used to generate the stored token.\n # The remember_token is then stored as a signed cookie along with the\n # user's ID from the database.\n remember_token = password_seed\n cookies.permanent.signed[:remember_user_id] = user.id\n cookies.permanent.signed[:remember_user_token] = remember_token\n \n # The WHIRLPOOL hash of remember_token and the user's password seed is\n # then stored in the database.\n remember_hash = Digest::Whirlpool.hexdigest(remember_token +\n user.password_seed)\n user.update_attributes(:remember_hash => remember_hash)\n user.save\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def login!(user)\n @current_user = user\n session[:session_token] = user.reset_session_token!\n end", "def sign_in(user)\n # Issues new random piece of text (aka\n # remember_token) to user\n remember_token = User.new_remember_token\n # Giving user plain text token\n cookies.permanent[:remember_token] = remember_token\n # Hashing the version of the remember_token which the host maintains.\n user.update_attribute(:remember_token, User.hash(remember_token))\n #sets the one who signed in (user) to current user\n self.current_user=user\n end", "def current_user=(new_user)\n current_session.user = new_user\n end", "def login!(user)\n @current_user = user;\n session[:session_token] = user.reset_session_token!\n end", "def remember(user)\n user.save_remember_digest\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def login!(user)\n user.reset_session_token!\n # curr_session_token == user.session_token\n # sets user.curr_session_token and persists to UserSessionsOwnership table\n user.set_curr_session_token\n @current_user = user # set current_user upon login\n # session[:session_token] = user.session_token\n session[:session_token] = user.curr_session_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id # encrypt the user_id instead of plaintext\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember (user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember!\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def load_user(user)\n session[:user_id] = user.id\n session_reset_timeout!\n user.update_attributes last_login_on: Time.now, login_count: user.login_count + 1\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\nend", "def sign_in(user)\n remember_token = User.new_token\n cookies.permanent[:remember_token] = remember_token\n user.update_attribute(:remember_digest, User.digest(remember_token))\n cookies.permanent.signed[:user_id] = user.id\n self.current_user = user\n end", "def log_in(user)\n current_user = user\n session[:session_token] = user.reset_session_token!\n end", "def restore_last_user\n return @last_user if @last_user\n if session[:last_user_id].present?\n @last_user = User.find_by_id(session[:last_user_id])\n message = translate(\"users.sign_in_back\", user: @last_user.name)\n set_flash_message(message, :success, false)\n session.destroy()\n session[:id] = @last_user.id if @last_user.present?\n return @last_user\n end\n end", "def set_user\n @user = User.find(session[:user_id])\n end", "def sign_in(user)\n remember_token = User.new_remember_token # create a new remember token\n cookies.permanent[:remember_token] = remember_token # save the remember token on the client side as a cookie\n user.update_attributes remember_token: User.hash(remember_token) # save the remember token on the server side in the DB\n self.current_user = user\n end", "def user_log_in(user)\n session[:user_id] = user.id\n end", "def with_user(new_user, &block)\n begin\n set_user(new_user)\n yield exists?(:previous_user) ? fetch(:previous_user) : nil\n ensure\n reset_user\n end\n \n clear_sessions\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.token\n end", "def switch\n authorize!(:manage, :all)\n user = User.find_by(login: params[:login].upcase)\n if user\n session[:original_user_id] = session[:user_id]\n session[:user_id] = user.id\n redirect_to root_url, notice: \"Sie sind nun der Nutzer mit dem Login #{user.login}.\"\n else\n redirect_to root_url, notice: \"Der Nutzer existiert nicht im System.\"\n end\n end", "def remember(user)\n user.remember # Calls model\n cookies.permanent.signed[:user_id] = user.id # Save off encryped user ID\n cookies.permanent[:remember_token] = user.remember_token # Save off random thing for validation\n end", "def set_user_session\n UserSession.current_user = current_user\n end", "def remember(user)\n user.remember\n # The \"signed\" method encrypts the user_id, since cookies are not themselves encrypted\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def set_user\n @user = User.find(session[:id]) if @user.nil && session[:id]\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def set_user\n require_logged_in\n @user = User.find_by(id: session[:user_id])\n end", "def remember(user) \n user.remember # the method creates remember_token for that user and saves the hashed the version in the db \n cookies.permanent.signed[:user_id] = user.id # This stores the user.ID(encrypted) in the browser cookie\n cookies.permanent[:remember_token] = user.remember_token # This stores the remember token(encrypted) in the cookie \n # the remember token was created in the first line of code \"user.remember\"\n end", "def set_user\n @user = User.find(session[:user_id])\n end", "def set_user\n @user = User.find(session[:user_id])\n end", "def remember(user)\n user.remember\n cookies.permanent.encrypted[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def destroy\n User.find(current_user.id)\n reset_session\n redirect_to new_user_path\n end", "def forget_everything\n empty_session!\n PersistentUser.new(@user).delete\n end", "def set_user\n @user = User.find(session[:user_id])\n end", "def remember(user)\nuser.remember\ncookies.permanent.signed[:user_id] = user.id\ncookies.permanent[:remember_token] = user.remember_token\nend", "def auto_login(user, should_remember = false)\n session[:user_id] = user.id.to_s\n @current_user = user\n remember_me! if should_remember\n end", "def set_user\n UserInfo.current_user = session[:user]\n end", "def remember\n self.remember_token = Incline::User::new_token\n update_attribute(:remember_digest, Incline::User::digest(self.remember_token))\n end", "def set_user_session\n @user_session = UserSession.find\n end", "def lookup_user\n reset_session #use this when they ask you to find a user\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id]= user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def log_on_user(user, session, cookies)\n cookies.permanent[TOKEN_COOKIE] = { value: user.id, httponly: true }\n @env[CURRENT_USER_KEY] = user\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent.signed[:remember_token] = user.remember_token\n end", "def remember(user)\n\t\t#calls the remember method in AdminUser model\n\t\tuser.remember\n\t\t#cookies method helps to do permanent sessions. This is actually a syntactic sugar for a bigger thing. \n\t\tcookies.permanent.signed[:user_name] = user.username\n\t\t#save the remembertoken as well. this dosent need to be encrypted\n\t\tcookies.permanent[:remember_token] = user.remember_token\n\tend", "def remember\n self.remember_token = User.new_token\n self.remember_digest = User.digest(self.remember_token)\n update_attribute(:remember_digest, self.remember_digest) #for new user, this creates record\n end", "def remember\n self.remember_token = User.new_token\n update remember_digest: User.digest(remember_token)\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end" ]
[ "0.675591", "0.6644072", "0.6311052", "0.6311052", "0.62816244", "0.62358135", "0.6200064", "0.6200064", "0.6180077", "0.61798525", "0.6169222", "0.6156497", "0.6137487", "0.61251116", "0.6117853", "0.6090493", "0.60684174", "0.6063047", "0.60603493", "0.605217", "0.6049069", "0.6048137", "0.60210264", "0.6017216", "0.6016608", "0.6014918", "0.60103375", "0.60053235", "0.6001431", "0.59950596", "0.59910667", "0.5990275", "0.5989106", "0.5979459", "0.5968974", "0.59596485", "0.5959282", "0.59570605", "0.5956767", "0.5945443", "0.594528", "0.59439903", "0.594214", "0.5941698", "0.59361553", "0.5927905", "0.59277105", "0.59229356", "0.5917268", "0.5917268", "0.5917268", "0.5917268", "0.5917268", "0.5917268", "0.5917268", "0.5917268", "0.5917268", "0.5917268", "0.5917268", "0.5917268", "0.5917268", "0.5917268", "0.5917268", "0.5917268", "0.5917268", "0.5917268", "0.5917268", "0.5917268", "0.5917268", "0.5917268", "0.5917268", "0.5917268", "0.5917268", "0.5917268", "0.5917268", "0.5917268", "0.5917268", "0.5916376", "0.59157735", "0.59098774", "0.59082294", "0.5899883", "0.5899883", "0.5896879", "0.588365", "0.58773607", "0.5867109", "0.58667296", "0.58655554", "0.58610237", "0.585902", "0.5856854", "0.5842479", "0.5838615", "0.58343583", "0.5832638", "0.5827982", "0.5823784", "0.58181304", "0.58150756", "0.58150756" ]
0.0
-1
The current incarnation of the data is each byte is separated by a white space
def save(arr, fname) f = File.open(fname, 'w') begin arr.shift x = arr.shift arr.shift y = arr.shift f.puts "#{x} #{y}" end until arr.empty? f.close end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data\n @buffer.string\n end", "def data_encoding\n encoded_characters.join(spacing_encoding)\n end", "def chars; self[:data].to_a ; end", "def hexdump( data )\n\t\t\tdata.bytes.to_a.map {|byte| sprintf('%#02x',byte) }.join( ' ' )\n\t\tend", "def packetize_data data\n data = data.chars if data.is_a? String\n data.unshift(0x40.chr).push(0x41.chr)\n end", "def orig_text\n orig_data[4..orig_data.size-1].tr(\"\\x00\", '')\n end", "def data_as_bytes\n data = []\n data << @status\n data << @meta_type\n data << 2\n data << @data[0]\n data << (@data[1] ? 1 : 0)\n end", "def do_encode # :nodoc:\n case\n when encoded_to_s.length <= 78\n encoded_to_s\n when encoded_to_s.length > 78\n @folded_line = []\n @unfolded_line = encoded_to_s\n wspp = @unfolded_line =~ /[ \\t]/\n fold\n @folded_line.join(\"\\r\\n\\t\")\n end\n end", "def data_as_bytes\n data = []\n data << @status\n data << @meta_type\n data << 4\n data << @data[0]\n data << @data[1]\n data << @data[2]\n data << @data[3]\n end", "def get_data\n return @data.unpack(\"S>*\")\n end", "def data\n bytes = lp_data.bytes.to_a.pack('C*')\n case lp_type\n when 1,2\n bytes.force_encoding('utf-16le').strip\n when 3\n bytes\n when 4\n bytes.unpack('V').first\n when 5\n bytes.unpack('N').first\n when 7\n str = bytes.force_encoding('utf-16le')\n str.split(\"\\0\".encode('utf-16le'))\n when 11\n bytes.unpack('Q<').first\n else\n \"\"\n end\n end", "def byte_size(); @data.byte_size + 4; end", "def to_s\n pad_field :data\n recalc_block_len\n super\n end", "def data\n dis_data.read\n end", "def data\n @data ||= \"O\" * size\n end", "def bytes; end", "def to_raw_data\n @letters.join(SEPARATOR)\n end", "def bytesize\n self.data.bytesize\n end", "def encode\n return @_data unless @_data.nil?\n @_data = [@bin_data].pack( 'm' ).chomp if @bin_data \n @_data\n end", "def get_data\n return @data.unpack(\"C*\")\n end", "def normalize\n @data << \"\"\n end", "def encrypt message\n raw = message.bytes.reverse!\n raw << raw.size\n # strip_leading_zero_bytes raw\n raw.each do |item|\n puts item\n end\nend", "def data4\n self[:data4].pack('c*').unpack('C*')\n end", "def raw_characters\n data.split(//)\n end", "def convert_to_string\n @data.join(\"\\n\")\n end", "def gets_data_s(*a)\n arr = gets_bytestr\n arr.map { |msg| msg[:data] }.join\n end", "def ie_padding(data)\r\n\t\tret = 0\r\n\t\tidx = 0\r\n\t\tlen = 0\r\n\r\n\t\twhile(idx < data.length)\r\n\t\t\tlen = data[idx+1]\r\n\t\t\tif (! len)\r\n\t\t\t\tdata << \"\\x00\"\r\n\t\t\t\tlen = 0\r\n\t\t\tend\r\n\r\n\t\t\tidx += len + 2\r\n\t\tend\r\n\r\n\t\tdata << yield(idx - data.length)\r\n\tend", "def data\n unless @data\n stream.pos = header.sh_offset\n @data = stream.read(header.sh_size).force_encoding('ascii-8bit')\n end\n @data\n end", "def store_field(data)\n @io.write [data.size].pack(\"V\") \n offset = @io.pos\n @io.write data\n @io.write \"\\0\"\n offset \n end", "def print_data(data, padding)\n p = \"\"\n (0..padding.length - data.to_s.length).map {p += \" \"}\n print data.to_s + p\n end", "def each_byte\n end", "def bytesize(enc)\n end", "def read_data_byte(offset) [offset + 1, get_byte(offset)] end", "def data\n self.data_pointer.read_string(self.data_size)\n end", "def byte32(data, size=32)\n return data.to_s.rjust(size*2, '0') # Add zeros to the left\n end", "def data_len_bytes()\n 2\n end", "def data_len_bytes()\n 2\n end", "def data_len_bytes()\n 2\n end", "def to_s\n [0xFF, 0xFF, 0xFF, 0xFF, @header_data, @content_data.string].pack('c5a*')\n end", "def bytes\r\n @bytes.dup\r\n end", "def receive_data data\n\t\tputs \"............>>>#{data.length}\"\n\tend", "def puts_s(data)\r\n data = data.dup\r\n output = []\r\n until (str = data.slice!(0, 2)) == ''\r\n output << str.hex\r\n end\r\n puts_bytes(*output)\r\n true\r\n end", "def to_bin\n [\n \"data\",\n [body.size].pack(\"V\"),\n body\n ].join\n end", "def to_s\n [0, 32, @device_token, @payload.length, @payload ].pack(\"CnH*na*\")\n end", "def data_len_bytes()\n 1\n end", "def normal_data_start(text)\n text.index(\"\\1\\n\", 2) + 2\n end", "def unpack\n @data.unpack('A4cN') \n end", "def to_s\n\t\t\treturn self.each_byte.to_a.pack( 'C*' )\n\t\tend", "def size\n self.data.length + 4\n end", "def bytes()\n #This is a stub, used for indexing\n end", "def all_bytes\n end", "def get_data_offset(data_array)\n\t#This will be returned as an int indicating the byte the data starts at\n\tdata_array.reverse.map{|e| \"%08b\" % e}.join.to_i(2)\nend", "def to_s(); self.unpad[0] end", "def bytes\n self\n end", "def bytes\n map { |e| e.bytes }.reduce(:+)\n end", "def bytes\n\t\tbin.unpack('C*')\n\tend", "def bytes_inflated\n @inflate.total_out\n end", "def strand; @data[8]; end", "def content\n \"\".b\n end", "def printpacketdata\n puts \"@@packetdata =>\" + @@packetdata.bytes.to_s\nend", "def content\n [width, height, depth, color, compression, filtering, interlace].pack('NNC5')\n end", "def to_s\n @data.map(&:to_s).join(\"\\n\")\n end", "def data\n identifier = @identifier || 0\n expiry = @expiry || 0\n size = [payload].pack(\"a*\").size\n data_array = [1, identifier, expiry, 32, token, size, payload]\n data_array.pack(\"cNNnH*na*\")\n end", "def bytes\n [self].pack(\"q>\").bytes.to_a.drop_while{|x| x == 0}\n end", "def content\n [\n width,\n height,\n depth,\n color,\n compression,\n filtering,\n interlace,\n ].pack(\"NNC5\")\n end", "def setalldata(inndata)\n size = @@numpixels * 3 # Number of LED's times the number of colours per LED (3)\n# puts \"size 1 =>\" + size.to_s\n puts \"Set all data to =>\" + inndata.to_s\n @@temp_packetdata = String.new\n @@temp_packetdata = \" \"\n temp = [0]\n @@temp_packetdata[0] = temp.pack(\"C\")\n @@temp_packetdata[1] = temp.pack(\"C\")\n @@temp_packetdata[2] = temp.pack(\"C\")\n packetlen = [size]\n @@temp_packetdata[3] = packetlen.pack(\"C\")\n i = 4\n t = -1\n temp = [inndata,inndata,inndata] \n# temp = [128,128,128] # something is wrong - this is a array\n puts \"Inndata ->\" + temp.inspect\n until t >= (size - 1) do \n t = t + 1\n puts t\n @@temp_packetdata[i + t] = temp.pack(\"C\")\n end\n puts \"Size =>\" + @@temp_packetdata.size.to_s\n puts \"setalldata =>\" + @@temp_packetdata.bytes.to_s\n @@output.print(@@temp_packetdata)\nend", "def receive_data(data)\n data.each_char do |char|\n if char == @end_seq[ @end_i ]\n if @end_i == @end_seq.size-1\n @minerd.send_detach\n EM.stop\n return\n end\n\n @end_i += 1\n\n if @end_i == 1\n @private_buffer += char\n\n else\n @buffer += char\n end\n\n elsif char == @end_seq.first\n @private_buffer += char\n\n else\n @end_i = 0\n\n unless @private_buffer.empty?\n @buffer += @private_buffer\n @private_buffer.clear\n end\n\n @buffer += char\n end\n end\n\n @minerd.send_write(@buffer)\n @buffer.clear\n end", "def bytes(val)\n val = val.to_s\n\n # Pad with zeros until length is a multiple of 4\n while val.length % 4 != 0 do\n val += \"\\0\"\n end\n\n @io.write(val)\n end", "def octets\n smsc_info_octets.size.chr +\n smsc_info_octets +\n sms_deliver_octets\n end", "def get\n self.data.force_encoding(Encoding::UTF_16BE).encode(Encoding::UTF_8)\n end", "def total_char_split\n messageData = @data\n output = []\n\n char_me = 0\n msg_me = 0\n char_them = 0\n msg_them = 0\n\n messageData.each do |name, messages|\n\n messages.each do |message|\n if message[2].to_i == 2\n char_me = char_me + message[1].size\n msg_me = msg_me + 1\n else\n char_them = char_them + message[1].size\n msg_them = msg_them + 1\n end\n end\n output << [name, char_me, msg_me, char_them, msg_them]\n char_me = 0\n char_them = 0\n msg_me = 0\n msg_them = 0\n end\n return output\n\n end", "def unpack(data); end", "def x\n\t\tt =\"\"; \n\t\tself.each_byte do |a| \n\t\t\tif a == \"\\r\"[0] then\n\t\t\t\tt << \"\\\\r\"\n\t\t\telsif a == \"\\t\"[0] then\n\t\t\t\tt << \"\\\\r\"\n\t\t\telsif a == \"\\n\"[0] then\n\t\t\t\tt << \"\\\\n\"\n\t\t\telsif a == \"\\b\"[0] then\n\t\t\t\tt << \"\\\\b\"\n\t\t\telsif a > 0 && a < 32 then\n\t\t\t\tt << (\"\\\\x%2.2d\" % a)\n\t\t\telse \n\t\t\t\tt << a.chr\n\t\t\tend\n\t\tend\n\t\tt\n\t\t#return gsub(/\\r/, \"\\\\r\").gsub(/\\n/, \"\\\\n\").gsub(/\\t/, \"\\\\t\")\n\tend", "def initialize_content\n content = []\n num = 0\n (0..@size).each do\n num = 0 if (num != 0 && num % ((@size+1)/8) == 0)\n content << num.to_s(16)\n num+=1\n end\n content\n end", "def bytes()\n\t\t\treturn [\n\t\t\t\t(@addr >> 40 & 0xff).to_s(16).rjust(2, \"0\"),\n\t\t\t\t(@addr >> 32 & 0xff).to_s(16).rjust(2, \"0\"),\n\t\t\t\t(@addr >> 24 & 0xff).to_s(16).rjust(2, \"0\"),\n\t\t\t\t(@addr >> 16 & 0xff).to_s(16).rjust(2, \"0\"),\n\t\t\t\t(@addr >> 8 & 0xff).to_s(16).rjust(2, \"0\"),\n\t\t\t\t(@addr & 0xff).to_s(16).rjust(2, \"0\"),\n\t\t\t\t]\n\t\tend", "def to_s\n\t\t\treturn @buffer.to_s\n\t\tend", "def buffer_s\n buffer.join\n end", "def eos\n '. '\n end", "def data\n data = 0\n each_with_index { |pin, i| data |= pin.data << (size - i - 1) }\n data\n end", "def buffer; end", "def buffer; end", "def buffer; end", "def get_char_info(data, p)\n lines = data[0..p].pack('c*').split(\"\\n\")\n \n char = data[p].chr\n char = '<space>' if char == ' '\n char = '<newline>' if char == \"\\n\"\n char = '<tab>' if char == \"\\t\"\n \n info = {\n :line => lines.length,\n :pos => lines[-1].length,\n :char => char\n }\n return info\n end", "def read_wide\r\n self[/^.*?(?=\\x00{2})/].delete(0.chr)\r\n end", "def next_msg\n @socket.readline.chomp.split(\" \")\n end", "def to_s\n [0xFFFFFFFF, @content_data.string].pack('Va*')\n end", "def header_data\n\t\treturn self.normalized_headers.to_s\n\tend", "def parse(data)\n return 0 unless data && data.bytesize > 0\n if data.bytesize < @bytes_expected\n @buffer << data\n @bytes_expected -= data.bytesize\n return data.bytesize\n else\n @buffer << data[0..@bytes_expected]\n bytes_parsed = parse_chunk(@buffer)\n return 0 if bytes_parsed == 0 # This is an error\n @bytes_expected -= bytes_parsed\n @buffer = String.new\n if @bytes_expected == 0\n @parsed = true\n elsif (data.bytesize-bytes_parsed) > 0\n bytes_parsed += parse(data[bytes_parsed..-1])\n end\n return bytes_parsed \n end\n end", "def receive_data data\n @buf.extract(data).each do |line|\n @lines_received += 1\n @bytes_received += line.bytesize\n\n receive_line line.chomp\n end\n end", "def space()\n # pocitanie riadkov\n self.line.push position if /\\n/ === data[position]\n /\\s/ === data[position]\n\n end", "def b2h\n hex = self.unpack(\"H*\")[0]\n hex.scan(/.{,32}/).map{|s|\n s.scan(/../) * \" \"\n } * \"\\n\"\n end", "def get\n to_array.join(\"\\r\\n\")\n end", "def cstr\n r = @data.unpack(\"@#{pos}Z*\")[0]\n @pos += r.bytesize + 1\n r\n end", "def bytes(*args); data(1, *args); end", "def convert_data(command)\n converted = ''\n command.each do |c|\n converted << c.chr\n end\n converted\n end", "def bytes_consumed\n self.bytesize# + 1\n end", "def to_s\n pad_field :data, :options\n recalc_block_len\n to_a.map(&:to_s).join\n end", "def splitencrypt(data)\n\tlengthkey = data.length / 8;\n\ttemp = 0\n\tarray = Hash.new\n\tif data.length % 8 != 0\n\t temp = data.length - (8 * lengthkey)\n\t lengthkey += 1;\n\tend\n\tstart = 0\n\tfor i in 1..lengthkey\n\t array[i-1] = data.to_str.slice(start,8)\n\t start +=8\n\tend\n\tif temp != 0\n\t for k in 0...(8-temp)\n\t\tarray[i-1] << [\"00\"].pack('H*')\n\t end\n\tend\n\treturn array\n end", "def receive_data(data)\n data.chomp!\n @@count = @@count + 1\n puts(\"Count : #{@@count} - Data : #{data}\")\n end", "def normalize(data)\n data.gsub(/\\r/, '')\n end", "def normalize(data)\n data.gsub(/\\r/, '')\n end" ]
[ "0.6218854", "0.62049764", "0.61739343", "0.6133536", "0.60920405", "0.60174584", "0.60120386", "0.5925902", "0.5912589", "0.58969426", "0.58807725", "0.5875881", "0.58721304", "0.5837854", "0.5809333", "0.5802576", "0.5789737", "0.5737537", "0.5733365", "0.5729798", "0.5707728", "0.5703515", "0.5691432", "0.56730384", "0.5659442", "0.565545", "0.5649587", "0.56266576", "0.56211805", "0.5605511", "0.558663", "0.5581083", "0.557235", "0.55592895", "0.55506885", "0.55504763", "0.55504763", "0.5550002", "0.554923", "0.5528775", "0.55257064", "0.5521429", "0.5516509", "0.5506968", "0.5477726", "0.5476867", "0.54741526", "0.54674125", "0.5462704", "0.54484785", "0.5445067", "0.54236394", "0.54198", "0.5419576", "0.5417339", "0.5406919", "0.54023445", "0.5395636", "0.5394736", "0.5389554", "0.5386076", "0.5382425", "0.53727174", "0.5367969", "0.53587264", "0.53449494", "0.53444046", "0.5337059", "0.5334121", "0.53320754", "0.53153133", "0.5313525", "0.53102064", "0.5304858", "0.52971745", "0.52891", "0.5289099", "0.52842414", "0.52689326", "0.5266239", "0.5266239", "0.5266239", "0.52618307", "0.5258701", "0.52579373", "0.52528095", "0.523873", "0.52362454", "0.52360976", "0.5233839", "0.5224727", "0.5224564", "0.5210068", "0.5202604", "0.5201742", "0.51989645", "0.5198047", "0.5196521", "0.5195953", "0.5192207", "0.5192207" ]
0.0
-1
Guarantee to read n bytes
def read_bytes(sd, n) out = [] while (n > out.size) data = sd.read_bytes(n - out.size) break unless data out = out + data end return out end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(n)\n end", "def read(n)\n Buffer.new(slice!(0, n))\n end", "def readpartial(size, buffer = T.unsafe(nil)); end", "def readpartial(size, buffer = T.unsafe(nil)); end", "def readpartial(size, buffer = T.unsafe(nil)); end", "def recvExactNBytes(n)\n buffer = \"\" ;\n while(buffer.size < n)\n IO::select([@socket]) ;\n buf = @socket.recv(n-buffer.size) ;\n if(buf == \"\") # in the case of EOF\n raise SumoException.new(\"TCP socket return EOF\",\n { :n => n }) ;\n end\n buffer << buf ;\n end\n return buffer ;\n end", "def recv(n)\n until(buffer.length >= n)\n read_stream\n sleep(0.1) unless buffer.length >= n\n end\n buffer.slice!(0, n)\n end", "def read_n_bytes_from_remote(start_at, n_bytes)\n range = (start_at..(start_at + n_bytes - 1))\n request_range(range)\n end", "def fill(n = 8192)\n input.consume!\n data = recv(n)\n debug { \"read #{data.length} bytes\" }\n input.append(data)\n return data.length\n rescue EOFError => e\n @input_errors << e\n return 0\n end", "def msg_read(n_bytes)\n\t@msg_buf += get_bytes(n_bytes)\n\t@msg_buf.flatten!\n\treturn @msg_buf[-1]\n end", "def first n\n @b.byteslice 0, n\n end", "def read_more(size); end", "def read(count = T.unsafe(nil), _buffer = T.unsafe(nil)); end", "def readpartial(maxlen=99, buf=\"buffer\") end", "def readpartial(size)\n rescue_readable do\n socket.read_nonblock(size)\n end\n end", "def read(length=99, buf=\"buffer\") end", "def read_available(length = T.unsafe(nil)); end", "def first! n\n slice = @b.byteslice 0, n\n @b = @b.byteslice n, -1\n slice\n end", "def readpartial(size = T.unsafe(nil)); end", "def read_bytes_full\n @_io.read\n end", "def read(n_bytes = nil)\n @remote_size ||= request_object_size\n\n # If the resource is empty there is nothing to read\n return nil if @remote_size.zero?\n\n maximum_avaialable = @remote_size - @pos\n n_bytes ||= maximum_avaialable # nil == read to the end of file\n return '' if n_bytes.zero?\n raise ArgumentError, \"No negative reads(#{n_bytes})\" if n_bytes < 0\n\n n_bytes = clamp(0, n_bytes, maximum_avaialable)\n\n read_n_bytes_from_remote(@pos, n_bytes).tap do |data|\n if data.bytesize != n_bytes\n raise \"Remote read returned #{data.bytesize} bytes instead of #{n_bytes} as requested\"\n end\n @pos = clamp(0, @pos + data.bytesize, @remote_size)\n end\n end", "def read_nonblock(maxlen=99, buf=\"buffer\") end", "def receive_n_bytes(sizemax,looping=false,&b)\n s=sizemax\n if self.data_readed.size>=sizemax\n buff,self.data_readed=self.data_readed[0..sizemax-1],self.data_readed[sizemax..-1]\n buff=b.call(buff) if block_given?\n return buff unless looping\n end\n s=sizemax-self.data_readed.size\n loop do\n #p [\"waiting \",s,data_readed]\n sd=s>1024 ? 1024 : s\n data=(self.recv(sd) rescue (p $!;nil))\n #p \"nrec: w#{sizemax}/ rec:#{(data||'').size} / #{sd} old=#{data_readed.size} /// #{(data||'').size<70 ? data : \".\"}\"\n if data && data.size>0\n self.data_readed=self.data_readed+data\n s=sizemax-self.data_readed.size\n if s<=0\n buff,self.data_readed=self.data_readed,\"\"\n s=sizemax\n buff=b.call(buff) if block_given?\n return buff unless looping\n end\n else\n close rescue nil\n break # socket close\n end\n end #loop\n end", "def read(length)\n return nil if (@offset + length) > @buffer.bytesize\n\n chunk = @buffer.byteslice(@offset, length)\n @offset += chunk.bytesize\n\n prune if @offset > MINIMUM_AUTOMATIC_PRUNE_OFFSET\n\n return chunk\n end", "def read(count = T.unsafe(nil)); end", "def read_blocking(count)\n bytes = ''\n while bytes.length < count\n bytes += read_non_blocking(count).to_s\n sleep 0.001\n end\n bytes\n end", "def read n = nil\n buf = nil\n if n\n until rbuf.size >= n\n rbuf << recv\n end\n buf = rbuf[0, n]\n self.rbuf = rbuf[n, rbuf.size - n]\n else\n begin\n loop{ rbuf << recv }\n rescue EOFError\n end\n buf = rbuf.dup\n self.rbuf = ''\n end\n return buf\n end", "def recvn(num_bytes, timeout: nil)\n @timer.countdown(timeout) do\n fillbuffer while @timer.active? && @buffer.size < num_bytes\n @buffer.size >= num_bytes ? @buffer.get(num_bytes) : ''\n end\n end", "def read_bytes(count)\n result = @content.byteslice(@cursor, count)\n @cursor += count\n result\n end", "def prim_read length\n buf = \"\".encode Encoding::BINARY\n if length.nil?\n buf << b until (b = _read_byte).nil?\n else\n until length.zero? || (b = _read_byte).nil?\n buf << b\n length -= 1\n end\n end\n return buf\n end", "def long_read_len()\n #This is a stub, used for indexing\n end", "def check_read(file, bytes); end", "def check_read(file, bytes); end", "def read(n=nil)\n if @response == nil\n raise IOError, \"No response available.\"\n end\n return @remaining_body.read(n)\n end", "def read(bytes = @length)\n return nil if @pos >= @length\n bytes = @length - @pos if bytes.nil?\n bytes = @length - @pos if @pos + bytes > @length\n\n out = @data[@pos, bytes] if @data.kind_of?(String)\n out = @data.read(bytes) if @data.kind_of?(NTFS::DataRun)\n\n @pos += out.size\n out\n end", "def __slice(i, n)\n\t\tif i < 0 || i >= size then\n\t\t\traise IndexError\n\t\tend\n\t\treturn Buffer.__new__(@bytes[i, [i + n, size - 1].min])\n\tend", "def read_partial(length = nil)\n if @buffer\n buffer = @buffer\n @buffer = nil\n else\n buffer = read_next\n end\n\n if buffer and length\n if buffer.bytesize > length\n # This ensures the subsequent `slice!` works correctly.\n buffer.force_encoding(Encoding::BINARY)\n\n @buffer = buffer.byteslice(length, buffer.bytesize)\n buffer.slice!(length, buffer.bytesize)\n end\n end\n\n return buffer\n end", "def data_seek(n)\n @result.data_seek(n)\n end", "def readpartial(size)\n reset_timer\n\n loop do\n result = socket.read_nonblock(size, :exception => false)\n if result.nil?\n return :eof\n elsif result != :wait_readable\n return result\n end\n\n IO.select([socket], nil, nil, time_left)\n log_time\n end\n end", "def read(length = bytes_remaining)\n value = @data.byteslice(@pos, length)\n @pos += length\n value\n end", "def read_bytes(amount, mut)\n amount.times.each_with_object([]) { |_idx, arr| arr << read_byte(false, mut) }\n end", "def readpartial(size, buffer = nil)\n timeout = false\n loop do\n result = @socket.read_nonblock(size, buffer, :exception => false)\n\n return :eof if result.nil?\n return result if result != :wait_readable\n\n raise TimeoutError, \"Read timed out after #{@read_timeout} seconds\" if timeout\n\n # marking the socket for timeout. Why is this not being raised immediately?\n # it seems there is some race-condition on the network level between calling\n # #read_nonblock and #wait_readable, in which #read_nonblock signalizes waiting\n # for reads, and when waiting for x seconds, it returns nil suddenly without completing\n # the x seconds. In a normal case this would be a timeout on wait/read, but it can\n # also mean that the socket has been closed by the server. Therefore we \"mark\" the\n # socket for timeout and try to read more bytes. If it returns :eof, it's all good, no\n # timeout. Else, the first timeout was a proper timeout.\n # This hack has to be done because io/wait#wait_readable doesn't provide a value for when\n # the socket is closed by the server, and HTTP::Parser doesn't provide the limit for the chunks.\n timeout = true unless @socket.to_io.wait_readable(@read_timeout)\n end\n end", "def read_byte; end", "def read_bytes(count)\n result = new_buffer\n result << read_outstanding(0, count)\n @outstanding = read_outstanding(count..-1)\n result << read_bytes!(count - result.size) until result.size == count\n result\n ensure\n @recent << result\n end", "def pread_pass_through(nbytes:, offset:, buffer:, timeout:)\n invalidate!\n @io.__pread__(nbytes: nbytes, offset: offset, buffer: buffer, timeout: timeout)\n end", "def test_line_buffer_size\n wrapper = S3io::ReadWrapper.new(@s3object, :line_buffer_size => 25)\n\n wrapper.lines.each_with_index do |line, index|\n break if index == 1 # skip two buffered reads\n end\n\n assert_equal(50, wrapper.pos)\n assert_equal(S3_TEST_DATA[50..-1], wrapper.read)\n end", "def read_bytes(count, into_buffer)\n data = \"\\0\" * count\n data = data.to_java_bytes\n count = @input.read(data, 0, count)\n if (count == -1)\n return nil\n end\n into_buffer.replace String.from_java_bytes(data[0,count])\n return into_buffer\n end", "def read_byte\n @buffer.shift(BYTE_LENGTH).join.to_i(2) if @buffer.length >= BYTE_LENGTH\n end", "def read!(count = T.unsafe(nil)); end", "def read() end", "def read_fully(count, timeout = nil)\n return nil if @__bunny_socket_eof_flag__\n\n value = ''\n begin\n loop do\n value << read_nonblock(count - value.bytesize)\n break if value.bytesize >= count\n end\n rescue EOFError => e\n @__bunny_socket_eof_flag__ = true\n rescue OpenSSL::SSL::SSLError => e\n if e.message == \"read would block\"\n if IO.select([self], nil, nil, timeout)\n retry\n else\n raise Timeout::Error, \"IO timeout when reading #{count} bytes\"\n end\n else\n raise e\n end\n rescue *READ_RETRY_EXCEPTION_CLASSES => e\n if IO.select([self], nil, nil, timeout)\n retry\n else\n raise Timeout::Error, \"IO timeout when reading #{count} bytes\"\n end\n end\n value\n end", "def read(bytes)\n raise \"read(bytes) must be overridden\"\n end", "def read(len = nil)\n return nil if @read >= @size\n len ||= @size - @read\n max_read = [len, @size - @read].min\n ret = @io.read(max_read)\n @read += bytesize(ret)\n ret\n end", "def read(num_bytes)\n buffer = String.new\n\n until buffer.length >= num_bytes\n begin\n # Unlike plain TCP sockets, SSL sockets don't support IO.select\n # properly.\n # Instead, timeouts happen on a per read basis, and we have to\n # catch exceptions from read_nonblock and gradually build up\n # our read buffer.\n buffer << @ssl_socket.read_nonblock(num_bytes - buffer.length)\n rescue IO::WaitReadable\n if select_with_timeout(@ssl_socket, :read)\n retry\n else\n raise Errno::ETIMEDOUT\n end\n rescue IO::WaitWritable\n if select_with_timeout(@ssl_socket, :write)\n retry\n else\n raise Errno::ETIMEDOUT\n end\n end\n end\n\n buffer\n end", "def read_fully(count, timeout = nil)\n value = ''\n\n begin\n loop do\n value << read_nonblock(count - value.bytesize)\n break if value.bytesize >= count\n end\n rescue EOFError\n # JRuby specific fix via https://github.com/jruby/jruby/issues/1694#issuecomment-54873532\n IO.select([self], nil, nil, timeout)\n retry\n rescue *READ_RETRY_EXCEPTION_CLASSES\n if IO.select([self], nil, nil, timeout)\n retry\n else\n raise Timeout::Error, \"IO timeout when reading #{count} bytes\"\n end\n end\n\n value\n end", "def read(length = 65535)\n if length < 0\n length = 65535\n end\n return sysread(length)\n end", "def have?(length)\n return length <= @buffer.bytesize \n end", "def readbyte\n end", "def read_until(bytes)\n out = \"\"\n size = bytes.size\n\n if @buffer && !@buffer.empty?\n if @buffer.include?(bytes)\n offset = @buffer.index(bytes) + size\n return head(offset)\n else\n out << head(@buffer.size)\n end\n end\n\n loop do\n out << @io.read(1)\n if out[-1 * size,size].eql?(bytes)\n out = out[0, out.size - size]\n seek(pos - size)\n break\n end\n end\n out\n end", "def read(byte_count)\n buffer = @current_io.read(byte_count)\n if !buffer\n select_next_io\n @current_io.read(byte_count)\n else\n buffer\n end\n end", "def read(bytes)\n @reader.read_nonblock(bytes)\n rescue Errno::EAGAIN\n # it simply means that there's nothing in\n # the output buffer.\n rescue Errno::EIO => msg\n @pid = nil\n rescue EOFError => msg\n @pid = nil\n end", "def read\n serial_port.read_nonblock(4096)\n rescue EOFError\n end", "def read_packed_bytes n = 1, from:, as: 'C'\n raw = from.read(n)\n raise FormatError if raw.nil? or raw.length != n\n \n raw.unpack(as).first\n end", "def read(n)\n r = pop(n)\n needs = n - r.length\n\n if needs > 0 && !@secondary.closed?\n sec = \"\"\n\n begin\n protect do\n sec = @secondary.readpartial(needs)\n end\n rescue EOFError\n close\n end\n\n r << (sec || \"\")\n\n # Finally, if there's nothing at all returned then this is bad.\n if r.length == 0\n raise HTTPClientError, \"Server returned empty response.\"\n end\n end\n\n reset\n return r\n end", "def read!(handle, offset, length, &callback)\n wait_for(read(handle, offset, length, &callback), :data)\n end", "def long_read_len= fixnum\n #This is a stub, used for indexing\n end", "def read(size)\n data = @data.byteslice(@pos, size)\n @pos += size\n data\n end", "def consume(n); end", "def read_available(length = nil)\n input.read(length || available)\n end", "def drop(n)\n if is_eos?\n return 0\n end\n size_dropped = 0\n while (n > 0)\n if !@is_eos or (@cur_buf != @buf_tail_idx)\n if (@offset + n < buf_size(@cur_buf))\n size_dropped += n\n @offset += n\n n = 0\n else\n size = buf_size(@cur_buf) - @offset\n size_dropped += size\n n -= size\n @offset = 0\n unless rel_buf\n unless add_buf\n break\n end\n @cur_buf = @buf_tail_idx\n end\n end\n end\n end\n size_dropped\n end", "def read(meta = @meta)\n buffer, size = next_read(meta)\n size == 0 ? nil : buffer.get_bytes(size)\n end", "def read_from_socket maxlen\n socket.read_nonblock maxlen\n rescue IO::WaitReadable\n :wait_readable\n end", "def read(length=4096,buffer='')\n @socket.read(length,buffer)\n end", "def sysread(amt=99) end", "def read(length=nil, buffer=nil)\n nil\n end", "def __read(buffer_length, buffer = nil)\n @io.read_nonblock(buffer_length, buffer)\n rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::EINTR\n Minx.yield\n retry\n end", "def read(sz)\n raise NotImplementedError\n end", "def read_buffer; end", "def consume n=1, as=:data\n if @pos + n > @size\n return nil\n end\n v = @data[@pos, n]\n @pos += n\n case as\n when :data\n # assume data - high bit must be clear\n v.each do |vv|\n if vv > 127\n STDERR.puts \"*** Data 0x%02x\" % vv\n end\n end\n when :command\n # command - high bit must be set\n c = v[0]\n if c < 128\n raise \"Command 0x%02x\" % c\n end\n n = 1\n when :any\n else\n raise \"Unknown consume mode #{as.inspect}\"\n end\n (n == 1) ? v[0] : v\n end", "def readpartial(maxlen, outbuf=nil)\n read_nonblock(maxlen, outbuf)\n rescue IO::WaitReadable\n block_until_readable\n retry\n end", "def read_abs(size, pos)\n @data.byteslice(pos, size)\n end", "def read(io, size)\n io.read_nonblock(size)\n rescue IO::WaitReadable\n IO.select([io])\n retry\n rescue EOFError\n nil\n end", "def read_all(into_buffer)\n while (read_bytes(4096, into_buffer))\n # work is in the loop condition.\n end\n return into_buffer\n end", "def read_into_buffer(buffer, size)\n tmp = read_all(size)\n i = 0\n tmp.each_byte do |byte|\n Bytes.set_string_byte(buffer, i, byte)\n i += 1\n end\n i\n end", "def read_binary length\n if @split\n if @split.first.size >= length\n result = @split.shift[0...length]\n unshift_split if @split.size == 1\n return result\n end\n unshift_split\n end\n unless @pending\n size = reduce(0){|x,y|x+y.size}\n return nil unless size >= length\n @pending = dup\n clear\n remainder = size - length\n if remainder > 0\n last_string = @pending[-1]\n @pending[-1] = last_string[0...-remainder]\n push last_string[-remainder..-1]\n end\n end\n # eat newline\n return nil unless read_line\n result = @pending.join\n @pending = nil\n result\n end", "def read_bit\n @buffer.shift if @buffer.length >= 1\n end", "def read(offset, how_much)\n @stream.read(how_much)\n end", "def readData(socket)\n data = socket.read(512)\n if data.nil?\n raise RetryException.new(true), \"transient read error\"\n end\n # .. normal processing\nend", "def reads\n (1..read_count).to_a\n end", "def readpartial(len, buf = +'', buffer_pos = 0, raise_on_eof = true)\n result = Polyphony.backend_read(self, buf, len, false, buffer_pos)\n raise EOFError if !result && raise_on_eof\n\n result\n end", "def read(position)\n @file.seek(position)\n size = @file.readbytes(4).unpack('N').first\n @file.readbytes(size)\n end", "def bytes_consumed\n self.bytesize# + 1\n end", "def read(offset, how_much)\n @stream.read(how_much)\n end", "def standard_read_chunk(size)\n unless size.is_a?(Integer) && size > 0\n raise ArgumentError,\n \"Read size (#{size.inspect}) must be greater than 0.\"\n end\n if @pushback\n chunk = @pushback\n @pushback = nil\n elsif ! @input.nil?\n chunk = @input.read(size)\n end\n return chunk\n end", "def read_available(length = nil)\n @input.read(length || available)\n end", "def skip(meta = @meta)\n _, size = next_read(meta)\n size\n end", "def consume(n)\n @memo = {}\n @pos += n\n readline while @line && @line.length <= @pos\n #puts \"consume[#{n}]: '#{buffer}'\" if $verbose\n end", "def read(maxlen = nil, buf = nil, buffer_pos = 0)\n return readpartial(maxlen, buf, buffer_pos) if buf\n\n buf = +''\n return readpartial(maxlen, buf) if maxlen\n\n readpartial(4096, buf, -1) while true\n rescue EOFError\n buf\n end", "def _do_num_bytes\n raise NotImplementedError\n end", "def integer(buf, n)\n limit = 2**n - 1\n i = !n.zero? ? (buf.getbyte & limit) : 0\n\n m = 0\n while (byte = buf.getbyte)\n i += ((byte & 127) << m)\n m += 7\n\n break if (byte & 128).zero?\n end if (i == limit)\n\n i\n end" ]
[ "0.7577687", "0.73801863", "0.7329298", "0.7329298", "0.7329298", "0.7244138", "0.7131295", "0.70470035", "0.70083845", "0.6996167", "0.6858447", "0.6833026", "0.6775157", "0.6770802", "0.6766239", "0.6728644", "0.6709728", "0.66529816", "0.66504604", "0.66234726", "0.6621393", "0.6576394", "0.6499725", "0.6488712", "0.6487303", "0.6456201", "0.64503163", "0.64400816", "0.63911784", "0.6369394", "0.6363656", "0.6349363", "0.6349363", "0.63346887", "0.63227236", "0.6317687", "0.62802505", "0.62711096", "0.6265428", "0.6242377", "0.62277657", "0.6221567", "0.6221158", "0.6220672", "0.6214927", "0.6198532", "0.61953264", "0.6186313", "0.61667955", "0.6134077", "0.61272925", "0.6117588", "0.60999376", "0.609865", "0.60780853", "0.6042177", "0.6038458", "0.60173833", "0.6007507", "0.60051316", "0.60009164", "0.5988746", "0.5987772", "0.5957337", "0.5951523", "0.59496677", "0.59494483", "0.5947873", "0.59458476", "0.59453005", "0.5940446", "0.5929999", "0.5927419", "0.5927356", "0.5924107", "0.5921504", "0.5919656", "0.5914385", "0.5914256", "0.59034336", "0.5896478", "0.5893413", "0.5874321", "0.5870836", "0.5866928", "0.5855923", "0.58558893", "0.58531547", "0.5846325", "0.58309567", "0.5828909", "0.58283854", "0.5826105", "0.5819768", "0.58171105", "0.5810564", "0.5807896", "0.580677", "0.5795115", "0.5793291" ]
0.73996717
1
GET /user/add GET /user/add.json
def add @user = current_user unless current_user.user_info.blank? current_user.user_info.each do | key , value| m = "#{key}=" unless key.to_str == "avatar" @user.send( m, current_user.user_info[key] ) if @user.respond_to?( m ) end end end respond_to do |format| format.html # add.html.erb format.json { render json: @user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 create\n @add = Add.new(add_params)\n @add.user = current_user\n\n respond_to do |format|\n if @add.save\n format.html { redirect_to @add, notice: 'Add was successfully created.' }\n format.json { render :show, status: :created, location: @add }\n else\n format.html { render :new }\n format.json { render json: @add.errors, status: :unprocessable_entity }\n end\n end\n end", "def add\n @user = User.find_by(email: params[:email])\n if @user \n @usertrip = UserTrip.find_by(user_id: @user.id, trip_id: params[:trip_id])\n if !@usertrip\n @usertrip = UserTrip.create(user_id: @user.id, trip_id: params[:trip_id], paid:0)\n render json: [@user, @usertrip]\n else \n render json: {error: [\"User already on trip.\"]}\n end\n else \n render json: {error: [\"No existing User by that email.\"]}\n end\n end", "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 add\n @user = User.new\n end", "def add\n @user = User.new(:username => params[:user], :password => params[:password])\n respond_to do |f|\n @user[:count] = 1\n if @user.save\n # Successfully added to DB\n output = { :errCode => 1, :count => @user[:count] }\n else\n # Failed, need to figure out error code\n error = @user.errors.full_messages[0]\n if error.include? \"taken\"\n output = { :errCode => -2 }\n elsif error.include? \"Password\"\n output = { :errCode => -4 }\n else\n output = { :errCode => -3 }\n end\n end\n f.json { render :json => output }\n end\n end", "def add\n #handle unexpected error with status code 500\n begin\n if request.env['CONTENT_TYPE'].include?('application/json') \n @client = Client.new\n @username = params[:user]\n @password = params[:password]\n errCode = @client.add(params[:user], params[:password])\n if errCode > 0\n dic = {:errCode => 1, :count => errCode}\n respond_to do |format|\n format.json { render json: dic, :status => 200 }\n end\n else\n dic = {:errCode => errCode}\n respond_to do |format|\n format.json { render json: dic, :status => 200 }\n end\n end\n else\n render :json => { :errors => \"Wrong Content-Type on Request'\" }, :status => 500\n end\n rescue\n render :json => { :errors => \"Unknown Errors\" }, :status => 500\n end\n end", "def mf_api_manually_add_user\n\n # Create new User\n user = User.new\n\n # Populate User\n user.clientid = params[:client_id]\n user.email = params[:email]\n\n user.save\n\n response = {\n success: true,\n message: 'New User Created!'\n }\n\n render json: response\n\n end", "def add_user(user)\n self.users.create(id: user.id)\n end", "def get\n new_user = User.new(user_params)\n @user = User.find_by(number: new_user.number)\n \n if not @user.nil?\n render json: @user\n else \n new_user.save\n render json: new_user\n end\n end", "def add_user(user)\n @users << user\n end", "def add\n request('add').auth_required!\n end", "def add_user(name)\n\t@users << {:name => name}\n end", "def create\n user = User.create(user_params) \n render json: user, status: :created\n end", "def add_user_task\n task = Task.create(task_params)\n puts \"New task: #{task}\"\n if task\n render json: {task: task}\n else\n render json: task.error.full_messages, status: 402\n end\n end", "def create\n if params[\"id\"] == \"_empty\" || params[\"id\"].blank?\n @user = User.new(params[:user])\n respond_to do |format|\n if @user.save\n format.json {\n @message[\"status\"] << ('add ok')\n render json: [true,@message]\n }\n else\n format.json {\n @message[\"status\"] << @user.errors.full_messages.join(\"<br />\")\n render json: @message,status: :unprocessable_entity\n }\n\n end\n end\n end\n end", "def create\n user= User.create(user_params)\n render json: user\n end", "def create_new_user\r\n touch(\"* id:'#{add}'\")\r\n end", "def add_new_user()\n new_user_link.click\n end", "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 create\n # render json: params\n render json: Users.create(params[\"user\"])\n end", "def new2\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def create\n user = User.new(user_params)\n render json: { status: 200, msg: 'User was created.', data: \"User Id #{user.id}\" } if user.save\n end", "def create\n user = User.new(user_params)\n if user.save\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end", "def create\n\t\tputs user_params\n\t\tuser = User.new(user_params)\n\t\tif user.save\n\t\t\trender json: { user: user, status: :success }\n\t\telse\n\t\t\trender json: { status: :failure, errors: user.errors.full_messages.join('') }\n\t\tend\n\tend", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: {status: 1, id: @user.id.to_s, notice: \"新增成功W\", errors: []}\n else\n render json: {status: -1, notice: \"新增失败\", errors: @user.errors.full_messages}\n end\n end", "def create\n @user = User.new user_params(params[:user])\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new user_params(params[:user])\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def add(params)\n post 'add', params\n end", "def create\n @trip = Trip.new(trip_params)\n @trip.user = @current_user\n @trip.users.append(current_user)\n respond_to do |format|\n if @trip.save\n\n\n format.html { redirect_to @trip, notice: 'Trip was successfully created.' }\n format.json { render json: {message: 'Utworzono tripa.', admin_id: @trip.user_id}, status: :ok }\n else\n format.html { render :new }\n format.json {\n render json:\n {errors: @trip.errors}, status: :unprocessable_entity \n }\n end\n end\n end", "def create\n\n puts '-----------------------create in user controller'\n\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n\n end", "def create\n puts '>>> params:'\n puts params.inspect\n @user = User.new(params[:user])\n puts '>>> User:'\n puts @user.inspect\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def new\n @user = User.new\n\n render json: @user\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 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 params[:user][\"_id\"] = params[:user][:name]\n @user = User.new(params[:user])\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 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 end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\trender json: @user, status: :created, location: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend", "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_add(username, password, permissions, type)\n payload = {\n :username => username, \n :password => password, \n :permissions => permissions, \n :type => type, \n :json => 1\n }\n http_post(:uri=>\"/users\", :fields=>x_cookie, :data=>payload)\n end", "def create\n user = User.create(user_params)\n if user.save\n render json: user\n else\n render json: user.errors, status: :bad\n end\n end", "def create\n @user = User.create user_params\n \n if @user.save\n respond_with(@user) do |format|\n format.json {render}\n end\n end\n end", "def create\n @user = User.new(user_params(params))\n \n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def new\n @user = User.new\n render :json => @user\n end", "def new\n @user = User.new\n \n drop_breadcrumb('新增')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def create\n @user = User.new(user_params(params))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params(params))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n logger.debug user_params\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :not_acceptable\n end\n end", "def create\n @user = User.new(user_params)\n \n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def new\n @user = user.new\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def backend_addUser(param) \n @Users.push(param) \n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = User.create(user_params)\n render json: user, message: 'user succefully create', status: 200\n end", "def user(*args)\n @users << User.add(*args)\n end", "def create\n user = User.new(\n username: user_params[:username],\n password: user_params[:password])\n if user.save\n create_example_collection(user)\n render json: user, except: [:password_digest, :created_at, :updated_at]\n else\n render json: {errors: user.errors.full_messages}\n end\n end", "def add_user(user)\n @users[user.name] = user\n end", "def create\n authorize :user, :create?\n @user = User.new(user_params)\n @user.save\n\n respond_to do |format|\n format.html\n format.json { render :json => @user, status: 200 }\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n render json: { user: @user, success: 'User registration successful' }\n else\n render json: { error: 'User registration unsuccessful' }\n end\n end", "def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n \n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n \n end", "def goals_add\n @goal = Goal.create(goal_params)\n goal = GoalsUser.create({user_id:@user.id,goal_id:@goal.id})\n respond_to do |f|\n f.html {redirect_to goals_path(@user)}\n f.json {render json: {new_goal:goal,success: true}}\n end\n end", "def new\n @title = \"sign up\"\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def create\n @user = User.new(params[:user])\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, :notice => \"User was successfully created. #{undo_link}\" }\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 end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, :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 end", "def add\n \turi = \"#{APP_CONFIG[:API_BASE_URL]}/users.json\"\n \tresponse = RestClient.get uri\n \tusers = JSON.parse(response, symbolize_names: true)\n \tbegin\n\t\tusers.each do |user|\n\t\t\tConsumer.create(username:user[:username], phone: user[:phone])\n\t\tend\n\t\tredirect_to consumers_url, status: :ok, notice: 'Consumers are successfully added from api.'\n \trescue Exception => e\n \t\tredirect_to consumers_url, status: :unprocessable_entity, notice: \"#{e.message}\"\n \tend\n end", "def create\n @user = User.new(params[:user])\n\t\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 end", "def create\n user = User.new(user_params)\n\n respond_to do |format|\n if user.save\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def create_user\n @user = User.new(user_params)\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n puts params\n @user = User.new(params[:user])\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 json: @user.as_json(user: current_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 end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save \n format.html { redirect_to users_url, notice: \"User #{@user.name} 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 end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n\t\tresp = {} \n user = User.create(user_params)\n \tif user.valid?\n if user.save\n return render :json => user.as_json\n end\n end\n render json: user.errors.full_messages \n\tend", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, 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 end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, 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 end", "def create\n user = User.new(user_params)\n if user.save\n render :json => user, :status => :created\n else\n render :json => {:ok => false, :message => user.errors}, :status => :unprocessable_entity\n end\n end", "def create\n user = User.create!(user_params)\n session[:user_id] = user.id\n render json: user, status: :created\n end", "def create\n @user = User.new(form_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: { users: @user }, status: :created }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'user.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 end", "def new\n @user = User.new\n @action = \"new\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end", "def create\n @user = User.new(params[:user])\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 :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 end", "def create\n user = User.new(user_params)\n if user.save\n render json: {status: 200, msg: 'User was created.'}\n else\n render json: {errors: user.errors.messages}\n end\n end", "def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: { error: I18n.t('user_create_error') }, status: :unprocessable_entity\n end\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 user_repository\n @user_repository.add(new_user)\n end", "def create(options = {})\n request(:post, '/users.json', default_params(options))\n end", "def create\n user = User.create(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors, status: :unprocessable_entity\n end\n end", "def new\r\n @user = User.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @user }\r\n end\r\n end", "def create\n # @user = User.new(params[:user])\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 :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 end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end" ]
[ "0.7502071", "0.71875316", "0.71781707", "0.7165432", "0.7112938", "0.70435095", "0.7010005", "0.69172835", "0.6905096", "0.6856762", "0.67331874", "0.6704436", "0.6678484", "0.66718376", "0.6659172", "0.6657718", "0.6625392", "0.66139007", "0.6605221", "0.6604092", "0.65883195", "0.6552872", "0.6525185", "0.65046215", "0.65044504", "0.6502614", "0.65014696", "0.65014696", "0.6498943", "0.6498052", "0.64848703", "0.6484682", "0.64844924", "0.64784414", "0.6477967", "0.6474407", "0.64624685", "0.64624685", "0.64624685", "0.6454113", "0.6451445", "0.6450487", "0.64502794", "0.64439756", "0.64310664", "0.64256483", "0.64254576", "0.6422112", "0.6422112", "0.64190656", "0.64131606", "0.64002925", "0.6394788", "0.6379018", "0.6378589", "0.63738364", "0.6364769", "0.6364473", "0.6350316", "0.6344273", "0.6334114", "0.63305914", "0.63267976", "0.6322243", "0.6320436", "0.6314387", "0.63128", "0.63079315", "0.6302177", "0.6296525", "0.6296486", "0.62952876", "0.62952876", "0.6286964", "0.6286496", "0.6285193", "0.62805307", "0.6278865", "0.6277941", "0.6277595", "0.6275721", "0.6274041", "0.6271665", "0.62711823", "0.62688315", "0.62646234", "0.62638587", "0.62632906", "0.6263213", "0.6263213", "0.6263213", "0.62627655", "0.6261669", "0.62600696", "0.62564486", "0.6255038", "0.6254135", "0.6252263", "0.6252263", "0.6252263" ]
0.6699861
12
GET /customers GET /customers.json
def index @customers = Customer.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @customers = @user.customers.all\n render json: @customers\n end", "def customers(options = {})\n perform_get_with_object('/customers', options, Epages::CustomersResponse)\n end", "def index\n @user = current_user\n @customers = @user.customers\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end", "def customer_list\n perform_get_request('/customer/list')\n end", "def get_customers\n return ShopifyAPI::Customer.all\n end", "def index\n \tcustomers = Customer.all\n \trender json: customers\n \tend", "def customers\n ShopifyAPI::Customer.all\n end", "def get_customer(id)\n get(\"customers/#{id}\")\n end", "def get_customer(id)\n get(\"customers/#{id}\")\n end", "def customer(options = nil)\n request = Request.new(@client)\n path = \"/authorization-requests/\" + CGI.escape(@id) + \"/customers\"\n data = {\n\n }\n\n response = Response.new(request.get(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"customer\"]\n customer = Customer(self._client)\n return_values.push(customer.fill_with_data(body))\n\n \n return_values[0]\n end", "def index\n @customers = Customer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end", "def list\n @customers = Customer.all\n\n respond_to do |format|\n format.html { render action: \"index\" }\n format.json { render json: @customers }\n end\n end", "def get_all_customers\r\n begin\r\n @logger.info(\"get_all_customers called.\")\r\n\r\n # prepare query url\r\n @logger.info(\"Preparing query URL for get_all_customers.\")\r\n _query_builder = Configuration.get_base_uri().clone\r\n _query_builder << '/customers'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n @logger.info(\"Preparing headers for get_all_customers.\")\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # prepare and execute HttpRequest\r\n @logger.info('Preparing and executing HttpRequest for get_all_customers.')\r\n _request = @http_client.get _query_url, headers: _headers\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request, name: 'get_all_customers')\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n @logger.info(\"Returning response for get_all_customers.\")\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n return decoded.map{|element| CustomerModel.from_hash(element)}\r\n\r\n rescue Exception => e\r\n @logger.error(e)\r\n raise e\r\n end\r\n end", "def customer(customer_id)\n client.get \"customers/#{inst_id}/#{customer_id}\"\n end", "def index\n if current_user.role == 'customer_admin'\n render json: current_user.customer and return\n else\n authorize! :read_all, Customer\n customers = Customer.order('name asc')\n render json: customers and return\n end\n end", "def index\n @customers = Customer.where(:company_id => current_user.company.id).paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end", "def customer(customer_id)\n perform_get_request(\"/customer/#{customer_id}\")\n end", "def customers\n @customers ||= new_resource(self, :customer, :customers)\n end", "def index\n if params[:search_term]\n customers = Customer.search_customer(params[:search_term])\n else\n if read_from_cache(\"customers\")\n customers = read_from_cache(\"customers\")\n else\n customers = apply_scopes(Customer).all\n write_to_cache(\"customers\", customers)\n end\n end\n\n if params[:page_no]\n result = pagy(customers)\n else\n result = customers\n end\n render :json => result\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def get_customers(opts = {})\n data, _status_code, _headers = get_customers_with_http_info(opts)\n data\n end", "def show\n render json: Customer.find(params[:id]).to_response, status: :ok\n end", "def customer(id)\n response = get(\"customers/#{id}\")\n response.customer\n end", "def get_customers(opts = {})\n data, _status_code, _headers = get_customers_with_http_info(opts)\n return data\n end", "def show\r\n @customer = Customer.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render :json => @customer }\r\n end\r\n end", "def index\n respond_to do |format|\n format.html\n format.json { render json: CustomersDatatable.new(view_context) }\n end\n @customers = Customer.all\n end", "def customers\n Easybill::Api::Customers\n end", "def all(params = {})\n handle_all_request(\"/customers\", :customers, params)\n end", "def index\n respond_to do |format|\n format.html { @customers = Customer.all }\n format.json { @customers = Customer.order(:name) }\n end\n end", "def show\n @cust = Cust.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cust }\n end\n end", "def show\n @customers = Customer.all\n end", "def show\n @customers = Customer.all\n end", "def show\n @customer = Customer.includes(:invoices).find(params[:id].split(\",\"))\n\n render json: @customer\n end", "def get_customers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomerApi.get_customers ...\"\n end\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 10000000\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling CustomerApi.get_customers, must be smaller than or equal to 10000000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling CustomerApi.get_customers, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"size\"]\" when calling CustomerApi.get_customers, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"size\"]\" when calling CustomerApi.get_customers, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = \"/v1/customer\"\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'CustomerSearch')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#get_customers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n customer = Customer.find(params[:id])\n authorize! :read, customer\n render json: customer\n end", "def list_customers(opts = {})\n operation('ListCustomers')\n .add(opts)\n\n run\n end", "def retrieve_customer(customer_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/customers/{customer_id}',\n 'default')\n .template_param(new_parameter(customer_id, key: 'customer_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def show\n @customer = Customer.find(params[:customer_id])\n @contact = @customer.contacts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render \"show.html.erb\", :layout => false }\n end\n end", "def index\n\t@customers = Customer.all()\n end", "def show\n @customer = Customer.find(params[:id])\n #@customer_types = CustomerType.find_all_by_customer_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cust_contact }\n end\n end", "def all(options = { page: 1, page_size: 10 })\n response = JSON.parse(@client.get('Customers', options).body)\n customers = response.key?('Items') ? response['Items'] : []\n customers.map { |attributes| Unleashed::Customer.new(@client, attributes) }\n end", "def get_customers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomersApi.get_customers ...'\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling CustomersApi.get_customers, must be smaller than or equal to 250.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling CustomersApi.get_customers, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/customers'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil?\n query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].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/vnd.conekta-v2.1.0+json'])\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'CustomersResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"CustomersApi.get_customers\",\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: CustomersApi#get_customers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def customer\n @customer ||= fetcher.get(Customer, customer_id)\n end", "def index\n #data = HTTParty.get(\"http://localhost:8081/customers.json\")\n #p data.parsed_response[0]['email']\n if params[:customerId].present?\n @orders = Order.where(\"customerId\": params[:customerId].to_i)\n render json: @orders, status: 200\n elsif params[:id].present?\n @orders = Order.find_by id: params[:id]\n render json: @orders, status:200\n elsif params[:email].present?\n res = HTTParty.get(\"http://localhost:8081/customers/?email=#{params['email']}\")\n p res\n res = res.parsed_response\n @orders = Order.where(\"customerId\": res['id'].to_i)\n render json: @orders, status:200\n else\n @orders = Order.all\n end\n end", "def get_customer(opts = {})\n data, _status_code, _headers = get_customer_with_http_info(opts)\n data\n end", "def customerGet(options={})\n assert_valid_keys(options, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:customerGet, options)\n end", "def customerGet(options={})\n assert_valid_keys(options, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:customerGet, options)\n end", "def show\n @customer = customers.find(params[:id])\n end", "def retrieve(params = {})\n req = WebPay::CustomerIdRequest.create(params)\n raw_response = @client._request(:get, 'customers' + '/' + req.id.to_s, req)\n WebPay::CustomerResponse.new(raw_response)\n end", "def index\n @my_customers = MyCustomer.all\n end", "def customer(customer)\n id = epages_id(customer)\n perform_get_with_object(\"/customers/#{id}\", {}, Epages::Customer)\n end", "def index\n @customers_addresses = CustomersAddress.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers_addresses }\n end\n end", "def index\n @customers = Customer.where(user_id: current_user.id)\n end", "def get_customer_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.get_customer_all_using_get ...'\n end\n # resource path\n local_var_path = '/customer'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageCustomer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#get_customer_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_customer_profile\n authenticate_request!\n json_response(current_customer)\n end", "def listall\n return render :json => Customer.all.as_json(:only => [:id, :custID, :interested, :bought])\n end", "def index\n @clients = current_user.clients\n render json: @clients\n end", "def all_customers\n if @customer_records_file.nil? || !File.exist?(@customer_records_file)\n raise ArgumentError, 'Customer records file must be provided'\n end\n\n File.open(@customer_records_file, 'r') do |f|\n f.each_line.map do |line|\n JSON.parse(line)\n end\n end\n end", "def index\n #byebug\n #CHECK AUTHORIZATION HERE NOT JUST JUST AUTHENTICATION\n \n render json: {farmers: Farmer.all, customers: CustomerUser.all} #User.all #CustomerUser.all #{users: User.all, customers: Customer_User.all}\n end", "def all(params = {})\n req = WebPay::BasicListRequest.create(params)\n raw_response = @client._request(:get, 'customers', req)\n WebPay::CustomerResponseList.new(raw_response)\n end", "def index\n @users = User.fetch_all_customers\n end", "def index\n @customer_infos = CustomerInfo.all\n end", "def show\n @potential_customer = PotentialCustomer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @potential_customer }\n end\n end", "def list_customers_with_http_info(authorization, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomerApi.list_customers ...\"\n end\n # verify the required parameter 'authorization' is set\n fail ArgumentError, \"Missing the required parameter 'authorization' when calling CustomerApi.list_customers\" if authorization.nil?\n # resource path\n local_var_path = \"/v2/customers\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'Authorization'] = authorization\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ListCustomersResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#list_customers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @customers = get_customers(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.haml\n format.js # index.js.rjs\n format.xml { render :xml => @customers }\n end\n end", "def find(id)\n response = JSON.parse(@client.get(\"Customers/#{id}\").body)\n Unleashed::Customer.new(@client, response)\n end", "def index\n @customers = current_user.customers.paginate(:per_page => 20, :page => params[:page], :order => 'name', :include => :transactions)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @customers }\n end\n end", "def customer_single_orders\n @orders = Order.where(customer_id: current_user.customer_id, category: :single)\n render json: @orders, status: 200\n\n end", "def get_buildings_for_customer\n puts \"get_buildings_for_customer\"\n puts params\n @buildings = Building.where(\"customer_id = ?\", params[:customer_id])\n puts \"here are the buildings:\"\n puts @buildings\n respond_to do |format|\n format.json { render :json => @buildings }\n end\n end", "def show\n @custo = Custo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @custo }\n end\n end", "def customers\r\n @customers ||= CustomersController.new(configuration: @configuration)\r\n end", "def list\n display_customers\n end", "def index\n if !session[:user_id]\n redirect_to customer_path(session[:customer_id]) , notice: 'Access Denied'\n return\n else\n @customers = Customer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end\n end", "def show\n @user = User.find(params[:user_id])\n @customer = @user.customers.find(params[:id])\n @album = Album.new\n @albums = @customer.albums\n @notes = @customer.notes.order(\"created_at DESC\")\n @note = Note.new\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def retrieve_customer(customer_id:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/customers/{customer_id}'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'customer_id' => { 'value' => customer_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end", "def show\n @address_customer = AddressCustomer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @address_customer }\n end\n end", "def get_customer_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.get_customer ...'\n end\n # unbox the parameters from the hash\n customer_id = opts[:'customer_id']\n # verify the required parameter 'customer_id' is set\n if @api_client.config.client_side_validation && customer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'customer_id' when calling CustomerApi.get_customer\"\n end\n # resource path\n local_var_path = '/customer/{customer_id}'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\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] || 'CustomerResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"CustomerApi.get_customer\",\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: CustomerApi#get_customer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_customers()\n customers = Customer.where(company_id: self.id).order(:name)\n\n return customers\n end", "def get_customers()\n customers = Customer.where(company_id: self.id).order(:name)\n\n return customers\n end", "def get_customers()\n customers = Customer.where(company_id: self.id).order(:name)\n\n return customers\n end", "def show\n @customers_address = CustomersAddress.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customers_address }\n end\n end", "def show\n @customer = current_user.customers.find(params[:id], :include => :orders)\n @orders = @customer.orders.paginate(:per_page => current_user.profile.orders_per_page, :page => params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @customer }\n end\n end", "def customerGet(options = {})\n assert_valid_keys(options, :accessKey, :testMode, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:customerGet, options)\n end" ]
[ "0.80477434", "0.7958279", "0.78736347", "0.7785999", "0.7759871", "0.7743631", "0.7737657", "0.7650475", "0.7650475", "0.7644552", "0.76392215", "0.7563173", "0.7439835", "0.74304175", "0.74225414", "0.7395726", "0.72824943", "0.72764957", "0.7261613", "0.72505057", "0.72505057", "0.72505057", "0.72505057", "0.72505057", "0.72505057", "0.7246176", "0.7164159", "0.71540767", "0.71252036", "0.70998544", "0.7064369", "0.7044635", "0.704376", "0.7032128", "0.70233333", "0.701189", "0.701189", "0.7005285", "0.70026886", "0.6963286", "0.69387186", "0.69202554", "0.68890417", "0.6884998", "0.68841976", "0.68797255", "0.68703926", "0.68688864", "0.6851613", "0.6848811", "0.68399435", "0.6809864", "0.6809864", "0.6806203", "0.6769007", "0.67645335", "0.6760816", "0.6709328", "0.6703903", "0.6700306", "0.6696879", "0.6674654", "0.66438556", "0.6619208", "0.66068345", "0.6605628", "0.6602157", "0.65904576", "0.65882844", "0.6588044", "0.65839577", "0.6561115", "0.6544067", "0.6523796", "0.6518941", "0.650751", "0.6504687", "0.65005046", "0.6484343", "0.64840835", "0.6483176", "0.64816195", "0.6471336", "0.64588046", "0.64588046", "0.64588046", "0.6435654", "0.6434578", "0.64324784" ]
0.6973055
46
GET /customers/1 GET /customers/1.json
def show @customers = Customer.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_customer(id)\n get(\"customers/#{id}\")\n end", "def get_customer(id)\n get(\"customers/#{id}\")\n end", "def index\n @customers = @user.customers.all\n render json: @customers\n end", "def index\n @user = current_user\n @customers = @user.customers\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end", "def index\n \tcustomers = Customer.all\n \trender json: customers\n \tend", "def customer(customer_id)\n client.get \"customers/#{inst_id}/#{customer_id}\"\n end", "def index\n @customers = Customer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end", "def show\n render json: Customer.find(params[:id]).to_response, status: :ok\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def list\n @customers = Customer.all\n\n respond_to do |format|\n format.html { render action: \"index\" }\n format.json { render json: @customers }\n end\n end", "def customer(options = nil)\n request = Request.new(@client)\n path = \"/authorization-requests/\" + CGI.escape(@id) + \"/customers\"\n data = {\n\n }\n\n response = Response.new(request.get(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"customer\"]\n customer = Customer(self._client)\n return_values.push(customer.fill_with_data(body))\n\n \n return_values[0]\n end", "def customers\n ShopifyAPI::Customer.all\n end", "def show\n @cust = Cust.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cust }\n end\n end", "def show\r\n @customer = Customer.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render :json => @customer }\r\n end\r\n end", "def customer(customer_id)\n perform_get_request(\"/customer/#{customer_id}\")\n end", "def index\n @customers = Customer.where(:company_id => current_user.company.id).paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end", "def customer_list\n perform_get_request('/customer/list')\n end", "def customers(options = {})\n perform_get_with_object('/customers', options, Epages::CustomersResponse)\n end", "def show\n @customer = Customer.includes(:invoices).find(params[:id].split(\",\"))\n\n render json: @customer\n end", "def customer(id)\n response = get(\"customers/#{id}\")\n response.customer\n end", "def index\n if current_user.role == 'customer_admin'\n render json: current_user.customer and return\n else\n authorize! :read_all, Customer\n customers = Customer.order('name asc')\n render json: customers and return\n end\n end", "def get_customers\n return ShopifyAPI::Customer.all\n end", "def retrieve_customer(customer_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/customers/{customer_id}',\n 'default')\n .template_param(new_parameter(customer_id, key: 'customer_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def index\n if params[:search_term]\n customers = Customer.search_customer(params[:search_term])\n else\n if read_from_cache(\"customers\")\n customers = read_from_cache(\"customers\")\n else\n customers = apply_scopes(Customer).all\n write_to_cache(\"customers\", customers)\n end\n end\n\n if params[:page_no]\n result = pagy(customers)\n else\n result = customers\n end\n render :json => result\n end", "def show\n customer = Customer.find(params[:id])\n authorize! :read, customer\n render json: customer\n end", "def show\n @customer = Customer.find(params[:id])\n #@customer_types = CustomerType.find_all_by_customer_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def show\n @customer = customers.find(params[:id])\n end", "def index\n #data = HTTParty.get(\"http://localhost:8081/customers.json\")\n #p data.parsed_response[0]['email']\n if params[:customerId].present?\n @orders = Order.where(\"customerId\": params[:customerId].to_i)\n render json: @orders, status: 200\n elsif params[:id].present?\n @orders = Order.find_by id: params[:id]\n render json: @orders, status:200\n elsif params[:email].present?\n res = HTTParty.get(\"http://localhost:8081/customers/?email=#{params['email']}\")\n p res\n res = res.parsed_response\n @orders = Order.where(\"customerId\": res['id'].to_i)\n render json: @orders, status:200\n else\n @orders = Order.all\n end\n end", "def retrieve(params = {})\n req = WebPay::CustomerIdRequest.create(params)\n raw_response = @client._request(:get, 'customers' + '/' + req.id.to_s, req)\n WebPay::CustomerResponse.new(raw_response)\n end", "def index\n respond_to do |format|\n format.html\n format.json { render json: CustomersDatatable.new(view_context) }\n end\n @customers = Customer.all\n end", "def index\n respond_to do |format|\n format.html { @customers = Customer.all }\n format.json { @customers = Customer.order(:name) }\n end\n end", "def show\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cust_contact }\n end\n end", "def customer_single_orders\n @orders = Order.where(customer_id: current_user.customer_id, category: :single)\n render json: @orders, status: 200\n\n end", "def show\n @customer = Customer.find(params[:customer_id])\n @contact = @customer.contacts.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render \"show.html.erb\", :layout => false }\n end\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def index\n @customers = Customer.all\n end", "def get_customers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CustomerApi.get_customers ...\"\n end\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 10000000\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling CustomerApi.get_customers, must be smaller than or equal to 10000000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"page\"]\" when calling CustomerApi.get_customers, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"size\"]\" when calling CustomerApi.get_customers, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"size\"]\" when calling CustomerApi.get_customers, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = \"/v1/customer\"\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['basicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'CustomerSearch')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#get_customers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_all_customers\r\n begin\r\n @logger.info(\"get_all_customers called.\")\r\n\r\n # prepare query url\r\n @logger.info(\"Preparing query URL for get_all_customers.\")\r\n _query_builder = Configuration.get_base_uri().clone\r\n _query_builder << '/customers'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n @logger.info(\"Preparing headers for get_all_customers.\")\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # prepare and execute HttpRequest\r\n @logger.info('Preparing and executing HttpRequest for get_all_customers.')\r\n _request = @http_client.get _query_url, headers: _headers\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request, name: 'get_all_customers')\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n @logger.info(\"Returning response for get_all_customers.\")\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n return decoded.map{|element| CustomerModel.from_hash(element)}\r\n\r\n rescue Exception => e\r\n @logger.error(e)\r\n raise e\r\n end\r\n end", "def show\n @potential_customer = PotentialCustomer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @potential_customer }\n end\n end", "def show\n @custo = Custo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @custo }\n end\n end", "def customers\n @customers ||= new_resource(self, :customer, :customers)\n end", "def customer\n @customer ||= fetcher.get(Customer, customer_id)\n end", "def index\n\t@customers = Customer.all()\n end", "def find(id)\n response = JSON.parse(@client.get(\"Customers/#{id}\").body)\n Unleashed::Customer.new(@client, response)\n end", "def show\n @address_customer = AddressCustomer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @address_customer }\n end\n end", "def show\n @credit = Credit.find_by_customer_id(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @credit }\n end\n end", "def index\n @customers_addresses = CustomersAddress.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers_addresses }\n end\n end", "def show\n @customer = Customer.find(params[:id])\n end", "def show\n @customer = Customer.find(params[:id])\n end", "def index\n @my_customers = MyCustomer.all\n end", "def show\n @type_customer = TypeCustomer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @type_customer }\n end\n end", "def get_buildings_for_customer\n puts \"get_buildings_for_customer\"\n puts params\n @buildings = Building.where(\"customer_id = ?\", params[:customer_id])\n puts \"here are the buildings:\"\n puts @buildings\n respond_to do |format|\n format.json { render :json => @buildings }\n end\n end", "def customer(customer)\n id = epages_id(customer)\n perform_get_with_object(\"/customers/#{id}\", {}, Epages::Customer)\n end", "def show\n @customers_address = CustomersAddress.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customers_address }\n end\n end", "def customerGet(options={})\n assert_valid_keys(options, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:customerGet, options)\n end", "def customerGet(options={})\n assert_valid_keys(options, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:customerGet, options)\n end", "def all(params = {})\n handle_all_request(\"/customers\", :customers, params)\n end", "def index\n @clients = current_user.clients\n render json: @clients\n end", "def retrieve_customer(customer_id:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/customers/{customer_id}'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'customer_id' => { 'value' => customer_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end", "def show\n @customer_bill = CustomerBill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer_bill }\n end\n end", "def index\n @customers = get_customers(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.haml\n format.js # index.js.rjs\n format.xml { render :xml => @customers }\n end\n end", "def show\n @customer = Customer.find(params[:id])\t\n end", "def customers\n Easybill::Api::Customers\n end", "def show\n @customer = Customer.where(:id => params[:id], :company_id => current_user.company.id).first\n @appointments = Appointment.where(:company_id => current_user.company.id, :customer_id => @customer.id).order('starts_at DESC').paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def get_customer_profile\n authenticate_request!\n json_response(current_customer)\n end", "def get_customers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomersApi.get_customers ...'\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling CustomersApi.get_customers, must be smaller than or equal to 250.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling CustomersApi.get_customers, must be greater than or equal to 1.'\n end\n\n # resource path\n local_var_path = '/customers'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'search'] = opts[:'search'] if !opts[:'search'].nil?\n query_params[:'next'] = opts[:'_next'] if !opts[:'_next'].nil?\n query_params[:'previous'] = opts[:'previous'] if !opts[:'previous'].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/vnd.conekta-v2.1.0+json'])\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'CustomersResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"CustomersApi.get_customers\",\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: CustomersApi#get_customers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def listall\n return render :json => Customer.all.as_json(:only => [:id, :custID, :interested, :bought])\n end", "def show_customer\n @customer = Customer.find(params[:id])\n end", "def index\n @single_customers = SingleCustomer.managed_by_users(current_user.direct_subordinates_with_self.collect(&:id)).page params[:page]\n end", "def show\n @offer_customer = OfferCustomer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @offer_customer }\n end\n end", "def index\n @customer_infos = CustomerInfo.all\n end", "def get_customer_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.get_customer_all_using_get ...'\n end\n # resource path\n local_var_path = '/customer'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageCustomer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#get_customer_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n client = Client.retrieve_by_id(params[:id])\n\n render json: client, serializer: SingleClientSerializer\n end", "def index\n @customers = Customer.where(user_id: current_user.id)\n end", "def show\n @user = User.find(params[:user_id])\n @customer = @user.customers.find(params[:id])\n @album = Album.new\n @albums = @customer.albums\n @notes = @customer.notes.order(\"created_at DESC\")\n @note = Note.new\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer }\n end\n end", "def get_customers(opts = {})\n data, _status_code, _headers = get_customers_with_http_info(opts)\n data\n end", "def index\n if !session[:user_id]\n redirect_to customer_path(session[:customer_id]) , notice: 'Access Denied'\n return\n else\n @customers = Customer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end\n end", "def show\n @customer_asset = CustomerAsset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer_asset }\n end\n end", "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end", "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end", "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end", "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end", "def new\n @customer = Customer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end", "def get_customer_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.get_customer ...'\n end\n # unbox the parameters from the hash\n customer_id = opts[:'customer_id']\n # verify the required parameter 'customer_id' is set\n if @api_client.config.client_side_validation && customer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'customer_id' when calling CustomerApi.get_customer\"\n end\n # resource path\n local_var_path = '/customer/{customer_id}'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\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] || 'CustomerResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"CustomerApi.get_customer\",\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: CustomerApi#get_customer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end" ]
[ "0.78568625", "0.78568625", "0.7680524", "0.76006114", "0.7533196", "0.7516672", "0.7499743", "0.7383202", "0.7336955", "0.7336955", "0.7336955", "0.7336955", "0.7336955", "0.7336955", "0.73160666", "0.7308929", "0.7281901", "0.71956944", "0.71879476", "0.7172753", "0.71692395", "0.71651024", "0.71575785", "0.7128045", "0.70640624", "0.70486444", "0.7040905", "0.70112205", "0.69684595", "0.69478357", "0.6923017", "0.6914811", "0.6899282", "0.68961483", "0.68751276", "0.68733865", "0.6847531", "0.6834625", "0.6787304", "0.6736609", "0.6736609", "0.6736609", "0.6736609", "0.6736609", "0.6736609", "0.6736609", "0.6736609", "0.6736609", "0.6736609", "0.6736609", "0.6736609", "0.67166287", "0.67157066", "0.6701329", "0.66979706", "0.66899294", "0.664262", "0.6638948", "0.6638699", "0.66256464", "0.6612287", "0.6589643", "0.6586362", "0.6586362", "0.6585877", "0.65791094", "0.6562901", "0.6549532", "0.65362877", "0.6534878", "0.6534878", "0.6519208", "0.6502856", "0.65015984", "0.6494427", "0.649186", "0.648083", "0.6476878", "0.64692754", "0.6462475", "0.64510953", "0.64132655", "0.6413201", "0.6410462", "0.6410319", "0.6399712", "0.63972795", "0.638939", "0.6388907", "0.6388785", "0.63808906", "0.6345776", "0.6345376", "0.6339171", "0.6339171", "0.6339171", "0.6339171", "0.6339171", "0.6324645" ]
0.6743695
40
POST /customers POST /customers.json
def create # whitelist params @customer = Customer.new(customer_params) respond_to do |format| if @customer.save format.html { redirect_to customers_path } format.json { render :show, status: :ok, location: @customer } format.json { render :json => @objects.map(&:attributes) } else format.html { render :new, warning: "Customer record was NOT saved."} format.json { render json: @customer.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @customer = @user.customers.build(customer_params)\n if @customer.save\n render json: @customer, status: :created\n else\n render json: @customer.errors, status: :unprocessable_entity\n end\n\n end", "def create_customer(*args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = post(\"customers\",options)\n if response['success']\n return response['results']['customer']\n else\n return response\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n if @customer.save\n render json: @customer, status: :created, location: @customer\n else\n ap errors(@customer.errors)\n render json: errors(@customer.errors), status: :unprocessable_entity\n end\n end", "def send_customer(customer)\n request(customer, \"customer\", :post, {method: \"add\"})\n end", "def create(payload)\n client.post(make_path('/customers'), payload)\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to customers_path, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully added.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :index }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params.map{|k,v| {k.to_sym => v.class == ActionController::Parameters ? [v.to_hash] : v.to_s}}.reduce({}, :merge))\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to action: \"index\", notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer(options = {})\n perform_post_with_object('/customers', options, Epages::Customer)\n end", "def create_customer(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/customers',\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 create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer(customer_info, password)\n post_wrapper('/V1/customers',\n { customer: customer_info,\n password: password }.to_json,\n admin_headers)\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: \"Customer was successfully created.\" }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n \n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def createCustomer(customer_properties)\n url_data = \"/api/customers/\"\n @json_customer_properties = customer_properties.to_json\n options = {\n :digest_auth => @auth_digest,\n :body => @json_customer_properties\n }\n url_request = \"#{url_data}\"\n postData(url_request, options)\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Cliente cadastrado com sucesso!' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authorize! :create, Customer\n @customer = Customer.new(customer_params)\n @customer.customer_admin = current_user\n\n if @customer.save\n render json: nil, status: :created\n else\n render json: @customer.errors.full_messages, status: :unprocessable_entity\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @customer = Customer.new(params[:customer])\r\n\r\n respond_to do |format|\r\n if @customer.save\r\n format.html { redirect_to '/auth/identity/register', :notice => 'Customer was successfully created.' }\r\n format.json { render :json => @customer, :status => :created, :location => @customer }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.json { render :json => @customer.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def create_customer\n begin\n customer = Stripe::Customer.create\n # Create customer successful - return its id\n log_info(\"Customer created with ID #{customer[:id]}\")\n rescue Stripe::StripeError => e\n return_error 402, \"Error creating customer #{e.message}\"\n end\n status 201\n { customer_id: customer.id }.to_json\n end", "def create\n #@customer = Customer.new(params[:customer].merge(:user_id => current_user.id))\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to customers_path, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to admin_customer_path(@customer), notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(params[:customer])\n @customer.company = Company.find(current_user.company.id)\n\n respond_to do |format|\n if @customer.save\n format.html {\n flash[:notice] = I18n.t(:successfully_created, :model_name => Customer.model_name.human)\n redirect_to action: 'index'\n }\n format.json {\n render :json => {\n :listPartial => render_to_string(\n 'customers/_list',\n :formats => [:html],\n :layout => false,\n :locals => {\n :customers => Customer.where(:company_id => current_user.company.id).paginate(:page => params[:page])\n }\n ),\n status: :created,\n location: @customer\n }\n }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @customer = Customer.new(customer_params)\n @user = current_user\n respond_to do |format|\n if @customer.save\n @customer.update!(user_id: @user.id)\n format.html { redirect_to customers_path, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: t(\"activerecord.controller_msg.customer.created\", :default => 'Customer was successfully created.') }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, \n notice: \"Customer #{@customer.email} was successfully created.\" }\n format.json { render action: \"show\", status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer_customer = Customer::Customer.new(customer_customer_params)\n @customer_customer.admin = current_admin\n\n respond_to do |format|\n if @customer_customer.save\n format.html { redirect_to @customer_customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer_customer }\n else\n format.html { render :new }\n format.json { render json: @customer_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @customers = @user.customers.all\n render json: @customers\n end", "def customer(options = nil)\n request = Request.new(@client)\n path = \"/authorization-requests/\" + CGI.escape(@id) + \"/customers\"\n data = {\n\n }\n\n response = Response.new(request.get(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"customer\"]\n customer = Customer(self._client)\n return_values.push(customer.fill_with_data(body))\n\n \n return_values[0]\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to [:admin, @customer], notice: t('messages.created', model:Customer.model_name.human) }\n format.json { render action: 'show', status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n @customer.user = current_user\n authorize @customer, :create?\n\n respond_to do |format|\n if @customer.save\n @customer.works.create!(trackable_url: \"#{customer_path(@customer)}\", action: :create, user: current_user, \n parameters: @customer.to_json(except: {customer: [:fullname_and_address_and_pesel_nip_and_birth_date]}, \n include: { \n user: {\n only: [:id, :name, :email] } \n }))\n\n flash_message :success, t('activerecord.messages.successfull.created', data: @customer.fullname)\n format.html { redirect_to @customer }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = current_user.customers.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.xml { render :xml => @customer, :status => :created, :location => @customer }\n format.js\n else\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end", "def create\n @cust = Cust.new(params[:cust])\n\n respond_to do |format|\n if @cust.save\n format.html { redirect_to @cust, notice: 'Cust was successfully created.' }\n format.json { render json: @cust, status: :created, location: @cust }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cust.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @user = current_user\n @customer = @user.customers.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end", "def customers\n @customers ||= new_resource(self, :customer, :customers)\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n #format.html { redirect_to new_work_servey_path(:customer_id => @customer.id), notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer_using_post_with_http_info(customer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomerApi.create_customer_using_post ...'\n end\n # verify the required parameter 'customer' is set\n if @api_client.config.client_side_validation && customer.nil?\n fail ArgumentError, \"Missing the required parameter 'customer' when calling CustomerApi.create_customer_using_post\"\n end\n # resource path\n local_var_path = '/customer'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(customer)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Customer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomerApi#create_customer_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def test_create_customer()\n # Parameters for the API call\n body = APIHelper.json_deserialize(\n '{\"given_name\":\"Amelia\",\"family_name\":\"Earhart\",\"email_address\":\"Amelia.Ear'\\\n 'hart@example.com\",\"address\":{\"address_line_1\":\"500 Electric Ave\",\"address_l'\\\n 'ine_2\":\"Suite 600\",\"locality\":\"New York\"},\"phone_number\":\"1-212-555-4240\",\"'\\\n 'reference_id\":\"YOUR_REFERENCE_ID\",\"note\":\"a customer\"}'\n )\n\n # Perform the API call through the SDK function\n result = @controller.create_customer(body: body)\n\n # Test response code\n assert_equal(200, @response_catcher.response.status_code)\n end", "def create\n @customer = Customer.new(customer_params)\n @projects = Project.all\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer(body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/customers'\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json',\n 'content-type' => 'application/json; charset=utf-8'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.post(\n _query_url,\n headers: _headers,\n parameters: body.to_json\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end", "def customer_create\n @customer = Person.new(person_params)\n respond_to do |format|\n if @customer.save\n format.html { redirect_to new_customer_path, notice: 'データが新規作成されました。' }\n format.json { render :customer_show, status: :created, location: @customer }\n else\n format.html { redirect_to new_customer_path }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer_with_http_info(customer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomersApi.create_customer ...'\n end\n # verify the required parameter 'customer' is set\n if @api_client.config.client_side_validation && customer.nil?\n fail ArgumentError, \"Missing the required parameter 'customer' when calling CustomersApi.create_customer\"\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/customers'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(customer)\n\n # return_type\n return_type = opts[:debug_return_type] || 'CustomerResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"CustomersApi.create_customer\",\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: CustomersApi#create_customer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @customer = Customer.where(:fullname => params[:customer][:fullname], :phone => params[:customer][:phone]).first\n\n if @customer\n respond_to do |format|\n #format.html { redirect_to :back }\n format.json { render :json => @customer, :status => 200 }\n end\n else\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n #format.html { redirect_to customers_path, notice: 'Customer was successfully created.' }\n format.json { render :json=> @customer, :status=> :created }\n else\n #format.html { render action: \"new\" }\n format.json { render :json=> @customer.errors, :status=> :unprocessable_entity }\n end\n end\n end\n end", "def create_customer\n @customer = ::Customer.create!(client_id: @client.id,\n status: GlobalConstant::Customer.active_status,\n details: @customer_details\n )\n success\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n UserMailer.welcome_customer(@customer).deliver\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n if @customer.save\n # render json: {name:@customer.name,mobile:@customer.mobile,email:@customer.email,state_name:@customer.state.name,\n # city_name:@customer.city.name,state_id:@customer.state_id,city_id:@customer.city_id}\n render json: @customer.attributes.merge(state_name:@customer.state.name,city_name:@customer.city.name,customer_count:Customer.count);\n else\n render json:{error: @customer.errors.full_messages}\n end\n end", "def create\n @customer_add = CustomerAdd.new(customer_add_params)\n\n respond_to do |format|\n if @customer_add.save\n format.html { redirect_to @customer_add, notice: 'Customer add was successfully created.' }\n format.json { render :show, status: :created, location: @customer_add }\n else\n format.html { render :new }\n format.json { render json: @customer_add.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(cust_token, data = {})\n pdata = build_payment_info(data)\n data = FiveDL.build_params(data.merge!(transtype: 'updatecustomer', token: cust_token).merge!(pdata))\n FiveDL::Response.new( FiveDL::Gateway.post('/Payments/Services_api.aspx', data) )\n end", "def customer(customer_id)\n perform_get_request(\"/customer/#{customer_id}\")\n end", "def customers(options = {})\n perform_get_with_object('/customers', options, Epages::CustomersResponse)\n end", "def customer(customer_id)\n client.get \"customers/#{inst_id}/#{customer_id}\"\n end", "def create\n @customer = customer_scope.new(customer_params)\n @customer.company_type_name = :customer\n\n puts \">>>>> Customer params\"\n puts customer_params.inspect\n\n respond_to do |format|\n if @customer.save\n CompanyRegisterMailer.send_request(@customer.id).deliver\n if customer_params[:plan_id].present?\n PlanRequest.upgrade(@customer.id, customer_params[:plan_id], current_user.id, true)\n end\n\n format.html {\n redirect = customer_path(@customer)\n redirect = company_reseller_path(current_company, @customer.parent_id) if params[:reseller_id]\n redirect = root_path() if params[:registration]\n redirect_to redirect, notice: I18n.t('customers.successfully_created')\n }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @user = current_user\n @customers = @user.customers\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n session[:customer_id] = @customer.id\n format.html { redirect_to new_order_path, method: :get, notice: \"Your account was successfully created.\" }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.new(params[:cust_contact])\n\n respond_to do |format|\n if @cust_contact.save\n format.html { redirect_to @cust_contact.customer, :notice => 'Contact was successfully created.' }\n format.json { render :json => @cust_contact, :status => :created, :location => @cust_contact }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @cust_contact.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @address_customer = AddressCustomer.new(params[:address_customer])\n\n respond_to do |format|\n if @address_customer.save\n format.html { redirect_to @address_customer, notice: 'Address customer was successfully created.' }\n format.json { render json: @address_customer, status: :created, location: @address_customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @address_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_customer(body)\r\n begin\r\n @logger.info(\"create_customer called.\")\r\n\r\n # validate required parameters\r\n @logger.info(\"Validating required parameters for create_customer.\")\r\n validate_parameters({\r\n 'body' => body\r\n })\r\n\r\n # prepare query url\r\n @logger.info(\"Preparing query URL for create_customer.\")\r\n _query_builder = Configuration.get_base_uri().clone\r\n _query_builder << '/customers'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n @logger.info(\"Preparing headers for create_customer.\")\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'content-type' => 'application/json; charset=utf-8'\r\n }\r\n\r\n # prepare and execute HttpRequest\r\n @logger.info('Preparing and executing HttpRequest for create_customer.')\r\n _request = @http_client.post _query_url, headers: _headers, parameters: body.to_json\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request, name: 'create_customer')\r\n validate_response(_context)\r\n\r\n # return appropriate response type\r\n @logger.info(\"Returning response for create_customer.\")\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n return CustomerModel.from_hash(decoded)\r\n\r\n rescue Exception => e\r\n @logger.error(e)\r\n raise e\r\n end\r\n end", "def add_customer_data(post, options)\n a = options[:address] || {} # shipping address\n \n phone = get_phone_number(a[:phone])\n \n c = {\n :firstname => options[:first_name],\n :lastname => options[:last_name],\n :email => options[:email],\n :zippostal => a[:zip],\n :city => a[:city],\n :address1 => a[:address1],\n :address2 => nil,\n :stateregioniso => a[:state],\n :countryiso => iso_code_for(a[:country]),\n \n :phone1phone => phone[:number],\n :phone1country => phone[:country],\n :phone1area => phone[:area],\n \n :phone2phone => nil,\n :phone2country => nil,\n :phone2area => nil,\n \n :birthday => options[:birth_day] || 01,\n :birthmonth => options[:birth_month] || 01,\n :birthyear => options[:birth_year] || 1980,\n :ipaddress => options[:ip],\n :accountid => options[:id]\n }\n\n post[:customer] = c\n post\n end", "def create\n @customer = User.new(customer_params)\n @customer.authority = 'customer'\n respond_to do |format|\n if @customer.save\n if !current_user\n log_in @customer, :customer\n end\n format.html {redirect_to customer_path(@customer), notice: 'Customer was successfully created.'}\n format.json {render :show, status: :created, location: @customer}\n else\n format.html {render :new}\n format.json {render json: @customer.errors, status: :unprocessable_entity}\n end\n end\n end", "def create_customer_phone(customer_id, data)\n post(\"customers/#{customer_id}/phones\", { body: data })\n end", "def create\n @customer_detail = CustomerDetail.new(customer_detail_params)\n # When we make a new CustomerDetail, also make a Customer to go with it, using the Email from CustomerDetail\n customer_info = customer_detail_params['customer_attributes']\n customer_info['email'] = customer_detail_params['email']\n @customer = Customer.create(customer_info)\n @customer_detail.customer = @customer\n\n respond_to do |format|\n if @customer_detail.save\n format.html { redirect_to wines_url,\n notice: \"User #{@customer_detail.email} was successfully created. Please proceed to Login.\" }\n format.json { render :show, status: :created, location: @customer_detail }\n else\n format.html { render :new }\n format.json { render json: @customer_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer_detail = CustomerDetail.new(customer_detail_params)\n\n respond_to do |format|\n if @customer_detail.save\n format.html { redirect_to @customer_detail, notice: \"Customer detail was successfully created.\" }\n format.json { render :show, status: :created, location: @customer_detail }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @customer_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = customers.new(params[:customer])\n\n if @customer.save\n redirect_to customers_path, notice: '客户信息保存成功' \n else\n render action: \"new\" \n end\n end", "def index\n \tcustomers = Customer.all\n \trender json: customers\n \tend", "def customers\n ShopifyAPI::Customer.all\n end", "def update_customer(id, data)\n put(\"customers/#{id}\", { body: data })\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n set_favorite\n format.html { redirect_to @customer,\n notice: I18n.t('saved') }\n format.json { render action: 'show',\n status: :created, location: @customer }\n else\n format.html { render action: 'new' }\n format.json { render json: @customer.errors,\n status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = @representative.customers.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n flash[:notice] = 'Customer was successfully created.'\n format.html { redirect_to(representative_customers_path(@representative)) }\n format.xml { render :xml => @customer, :status => :created, :location => @customer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Cliente registrado exitosamente.' }\n else\n format.html { render :new }\n end\n end\n end", "def create\n @customer_info = CustomerInfo.new(customer_info_params)\n\n respond_to do |format|\n if @customer_info.save\n format.html { redirect_to @customer_info, notice: 'Customer info was successfully created.' }\n format.json { render :show, status: :created, location: @customer_info }\n else\n format.html { render :new }\n format.json { render json: @customer_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def customer_list\n perform_get_request('/customer/list')\n end", "def create\n params[:customer][:admitted_on] = Chronic.parse(params[:customer][:admitted_on])\n params[:customer][:released_on] = Chronic.parse(params[:customer][:released_on])\n unless params[:customer][:program].nil?\n params[:customer][:program] = Program.find(params[:customer][:program])\n end\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n flash[:notice] = 'Customer was successfully created.'\n format.html { redirect_to new_customer_path }\n format.xml { render :xml => @customer, :status => :created, :location => @customer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def customer_params\n params.require(:customer).permit(:user_id, :company_name, requests_attributes: [:id, :customer_id, :contact_firstname, :contact_lastname, :title, :email, :phone, :street_address, :city, :date, :zip_code])\n end", "def index\n @customers = Customer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers }\n end\n end", "def customer_params\n params.require(:customer).permit(:title, :first_name, :last_name, :email, :phone, :address, :city, :state, :zip, :country, :reservation_ids => [])\n end", "def search_customers(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/customers/search',\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 create_customer_using_post(customer, opts = {})\n data, _status_code, _headers = create_customer_using_post_with_http_info(customer, opts)\n data\n end", "def create\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to(@customer, :notice => 'Customer was successfully created.') }\n format.xml { render :xml => @customer, :status => :created, :location => @customer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.new(customer_params)\n\n respond_to do |format|\n if @customer.save\n UserMailer.activation_email(@customer.user).deliver_now\n format.html { redirect_to home_path, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def customer_params\n params.require(:customer).permit(:code, :name, :customer_category_id, :user_id, :notes,\n {customer_branches_attributes: [:_destroy, :id, :name, :address, :notes]},\n {customer_contacts_attributes: [:_destroy, :id, :name, :phones, :email, :notes]})\n end", "def create(options = {})\n post(\"customers/#{customer_id}/deliveries\", options)\n end", "def create\n @customer_account = CustomerAccount.new(customer_account_params)\n\n respond_to do |format|\n if @customer_account.save\n flash[:success] = \"Customer account was successfully created!\"\n format.html { redirect_to @customer_account }\n format.json { render :show, status: :created, location: @customer_account }\n else\n format.html { render :new }\n format.json { render json: @customer_account.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #render :text => params.inspect and return false\n params[:customer][:country] = params[:country]\n params[:customer][:status] = params[:status]\n @customer = Customer.new(params[:customer])\n \n # render :text => @customer.inspect and return false\n respond_to do |format|\n if @customer.save\n flash[:msg] = 'Customer was successfully created.'\n format.html { redirect_to :controller => 'customers', :action => 'index' }\n #format.json { render json: @customer, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def customer_params\n params.require(:customer).permit(:name, :phone_1, :phone_2, :email, :notes)\n end", "def customer_params\n params.require(:customer).permit(:name, :company_name, :address1, :address2, :postal_code)\n end", "def create\n @customer = Customer.new(params[:customer])\n @customer_types =\n CustomerType.new(\n :customer_type => params[:customer_type],\n :customer_type_name => params[:customer_type_name],\n :zip_number => params[:zip_number],\n :prefecture_cd => params[:prefecture_cd],\n :city => params[:city],\n :oaza => params[:oaza],\n :town => params[:town],\n :building_name => params[:building_name],\n :customer_type_memo => params[:customer_type_memo])\n\n @customer.customer_types << @customer_types\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: '以下の情報が登録されました。' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @customer = Customer.new\n @customer_types = [CustomerType.new]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @customer }\n end\n end", "def create(attributes)\n id = attributes[:Guid].present? ? attributes[:Guid] : ''\n response = JSON.parse(@client.post(\"Customers/#{id}\", attributes).body)\n Unleashed::Customer.new(@client, response)\n end", "def customer_params\n params.require(:customer).permit(:first_name, :last_name, :phone, :query, :email,\n :street_address, :city, :acct_open_date, :agreement_status, :trans_type,\n :last_trans_date, :street_address2, :postal, :province, :notes)\n end" ]
[ "0.7583026", "0.7368963", "0.72758555", "0.7225672", "0.7224766", "0.7142322", "0.7116918", "0.7109281", "0.7102696", "0.70753646", "0.7068943", "0.7054525", "0.70359194", "0.70359194", "0.70350176", "0.703466", "0.70175", "0.7017294", "0.7017294", "0.7017294", "0.7017294", "0.7017294", "0.7017294", "0.7011197", "0.6984326", "0.6953537", "0.69506246", "0.6950355", "0.693838", "0.69177485", "0.690329", "0.68956757", "0.6893036", "0.689211", "0.68855834", "0.6819733", "0.6735079", "0.67301786", "0.67179143", "0.6695761", "0.6675084", "0.66611797", "0.6654872", "0.6638326", "0.6629095", "0.6591667", "0.65913165", "0.65908194", "0.65799236", "0.65622944", "0.65583175", "0.6558022", "0.6556248", "0.6537413", "0.65248156", "0.6519175", "0.65181625", "0.6511338", "0.64996046", "0.6488794", "0.64813", "0.6452624", "0.64486706", "0.6442164", "0.6440251", "0.6437413", "0.6432282", "0.6407193", "0.6400671", "0.6399971", "0.6389764", "0.6381177", "0.6377061", "0.63661236", "0.63508", "0.6346849", "0.6346006", "0.63451076", "0.63423294", "0.6333185", "0.63303983", "0.63239366", "0.6321749", "0.63213986", "0.63082653", "0.6301424", "0.62783664", "0.62691015", "0.62592316", "0.6255516", "0.6247079", "0.6246658", "0.6242503", "0.62380147", "0.6217102", "0.6215618", "0.6212986", "0.6212601", "0.6211069", "0.62105036" ]
0.6992751
24
PATCH/PUT /customers/1 PATCH/PUT /customers/1.json
def update respond_to do |format| if @customer.update(customer_params) format.html { redirect_to customers_path, success: "Customer record updated"} else format.html { render :edit } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_customer(id, data)\n put(\"customers/#{id}\", { body: data })\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n #format.html { redirect_to customers_path }\n format.json { head :ok }\n else\n #format.html { render action: \"edit\" }\n format.json { render :json=> @customer.errors, :status=> :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n if @customer.update(customer_params)\n head :no_content\n else\n render json: @customer.errors, status: :unprocessable_entity\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to action:\"index\", notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_customer(customer_id:,\n body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::PUT,\n '/v2/customers/{customer_id}',\n 'default')\n .template_param(new_parameter(customer_id, key: 'customer_id')\n .should_encode(true))\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\n respond_to do |format|\n if @customer.update(customer_params)\n format.html {redirect_to customer_path(@customer), notice: 'Customer was successfully updated.'}\n format.json {render :show, status: :ok, location: @customer}\n else\n format.html {render :edit}\n format.json {render json: @customer.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.json { render action: 'show', status: :created, location: @customer }#format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to customers_path, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, \n notice: \"Customer #{@customer.email} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n\n respond_to do |format|\n if @customer.update(customer_params)\n @@current_customer = @customer.id\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to [:admin, @customer], notice: t('messages.updated', model:Customer.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, @customer\n update_customer_params = ( current_user.role == 'kanari_admin' ? admin_customer_params : customer_params)\n if @customer.update(update_customer_params)\n render json: nil, status: 200\n else\n render json: @customer.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n #@customer.progress!\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cust = Cust.find(params[:id])\n\n respond_to do |format|\n if @cust.update_attributes(params[:cust])\n format.html { redirect_to @cust, notice: 'Cust was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cust.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # it is impossible for a customer to update a referral, so no need to modify.\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to [@selector, @customer], :notice => 'Customer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer_customer.update(customer_customer_params)\n format.html { redirect_to @customer_customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer_customer }\n else\n format.html { render :edit }\n format.json { render json: @customer_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: \"Customer was successfully updated.\" }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.find(params[:id])\n\n respond_to do |format|\n if @cust_contact.update_attributes(params[:cust_contact])\n format.html { redirect_to customer_path(@customer), :notice => 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @cust_contact.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n \n if @customer.update(customer_params.keep_if{|p,q| q.class != ActionController::Parameters}) \n @customer.address.update(customer_params[:address_attributes])\n @customer.contact.update(customer_params[:contact_attributes])\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :show }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @Customer = Customer.find params[:id]\n if @Customer.update_attributes (customer_params)\n render :json => { :success => true, :Customer => @Customer, :message => 'customer add ok ' }\n else\n render :json => {:success => false, :message => \"Existe un error\"}\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: t(\"activerecord.controller_msg.customer.updated\", :default => 'Customer was successfully updated.') }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to customer_path(session[:customer_id]), notice: 'Your account was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @my_customer.update(my_customer_params)\n format.html { redirect_to @my_customer, notice: 'My customer was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_customer }\n else\n format.html { render :edit }\n format.json { render json: @my_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Cliente editado com sucesso!' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n set_favorite\n format.html { redirect_to @customer,\n notice: I18n.t('updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer.errors,\n status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.where(:id => params[:id], :company_id => current_user.company.id).first\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html {\n redirect_to @customer,\n notice: I18n.t(:successfully_updated, :model_name => Customer.model_name.human)\n }\n format.json { head :no_content }\n else\n @customer.errors.each do |name, error|\n flash[name] = error\n end\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def customer_update\n respond_to do |format|\n if @customer.update(person_params)\n format.html { redirect_to customer_path, notice: 'データが更新されました。' }\n format.json { render :customer_show, status: :ok, location: @customer }\n else\n format.html { redirect_to edit_customer_path }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_customer(customer, id)\n request(customer, \"customer\", :post, {id: id, method: \"edit\"})\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Your Customer Account was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer_set.update(customer_set_params)\n format.html { redirect_to @customer_set, notice: 'Customer set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @customer_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params[:customer][:admitted_on] = Chronic.parse(params[:customer][:admitted_on])\n params[:customer][:released_on] = Chronic.parse(params[:customer][:released_on])\n @customer = Customer.find(params[:id])\n unless params[:customer][:program].nil?\n params[:customer][:program] = Program.find(params[:customer][:program])\n end\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n flash[:notice] = 'Customer was successfully updated.'\n format.html { redirect_to(@customer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @customer = current_user.customers.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.xml { head :ok }\n format.js\n else\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n format.js\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 @self_service_customer = SelfService::Customer.find(params[:id])\n\n respond_to do |format|\n if @self_service_customer.update_attributes(params[:self_service_customer])\n format.html { redirect_to(@self_service_customer, :notice => 'Customer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @self_service_customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to(@customer, :notice => 'Customer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to(:action => 'index', :notice => 'Customer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Personendaten wurden erfolgreich aktualisiert.' }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(params = {})\n req = WebPay::CustomerRequestUpdate.create(params)\n raw_response = @client._request(:post, 'customers' + '/' + req.id.to_s, req)\n WebPay::CustomerResponse.new(raw_response)\n end", "def update_customer(customer)\n respond_with customer.to_vaulted_billing\n end", "def update_customer(customer)\n respond_with customer.to_vaulted_billing\n end", "def update\n @customer.user = current_user\n authorize @customer, :update?\n\n respond_to do |format|\n if @customer.update(customer_params)\n @customer.works.create!(trackable_url: \"#{customer_path(@customer)}\", action: :update, user: current_user, \n parameters: @customer.to_json(except: {customer: [:fullname_and_address_and_pesel_nip_and_birth_date]}, \n include: { \n user: {\n only: [:id, :name, :email] } \n }))\n\n flash_message :success, t('activerecord.messages.successfull.updated', data: @customer.fullname)\n format.html { redirect_to @customer }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n @cPhone = CustomerPhone.where('customer_id=? and phone_id=?', params[:customer_id], phone_params[:id]).first \n @phone = @cPhone.phone\n \n respond_to do |format|\n if @phone.update(phone_params)\n format.json { head :no_content }\n else\n format.json { render json: @phone.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n flash[:notice] = 'Customer was successfully updated.'\n format.html { redirect_to(representative_customers_path(@representative)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @customer = customer_scope.find(params[:id])\n\n respond_to do |format|\n if params[:company][:avatar] && @customer.update_attribute(:avatar, params[:company][:avatar])\n format.html { render action: \"edit\" }\n format.js #\n elsif @customer.update_attributes(customer_params)\n if customer_params[:plan_id].present?\n PlanRequest.upgrade(@customer.id, customer_params[:plan_id], current_user.id, true)\n end\n format.html {\n redirect = customer_path(@customer)\n redirect = root_path if current_company.is_customer?\n redirect = company_reseller_path(current_company, @customer.parent_id) if params[:reseller_id]\n redirect = company_reseller_customer_path(current_company, @customer.parent_id, @customer) if session[:by_reseller] && @customer.parent && @customer.parent.is_partner?\n redirect = step3_homes_path if session['homes.step'] == 2\n redirect_to redirect, notice: I18n.t('commons.successfully_updated')\n }\n format.json { head :no_content }\n format.js #\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer_detail.update(customer_detail_params)\n format.html { redirect_to @customer_detail, notice: \"Customer detail was successfully updated.\" }\n format.json { render :show, status: :ok, location: @customer_detail }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @customer_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_customer(customer, options = {})\n id = epages_id(customer)\n perform_patch_with_object(\"/customers/#{id}\", options, Epages::Customer)\n end", "def update\n @address_customer = AddressCustomer.find(params[:id])\n\n respond_to do |format|\n if @address_customer.update_attributes(params[:address_customer])\n format.html { redirect_to @address_customer, notice: 'Address customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:customer_id])\n @contact = @customer.contacts.find(params[:id])\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to([@contact.customer, @contact], :notice => t('forms.update.sucess')) }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @contact.errors, :status => :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n respond_to do |format|\n if @customer_add.update(customer_add_params)\n format.html { redirect_to @customer_add, notice: 'Customer add was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer_add }\n else\n format.html { render :edit }\n format.json { render json: @customer_add.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer_info.update(customer_info_params)\n format.html { redirect_to @customer_info, notice: 'Customer info was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer_info }\n else\n format.html { render :edit }\n format.json { render json: @customer_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @potential_customer = PotentialCustomer.find(params[:id])\n\n respond_to do |format|\n if @potential_customer.update_attributes(params[:potential_customer])\n format.html { redirect_to @potential_customer, notice: 'Potential customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @potential_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: 'Cliente editado exitosamente.' }\n else\n format.html { render :edit }\n end\n end\n end", "def update\n @custo = Custo.find(params[:id])\n\n respond_to do |format|\n if @custo.update_attributes(params[:custo])\n format.html { redirect_to @custo, notice: 'Custo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @custo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n format.html { redirect_to @customer, notice: t('views.flash_update_message') }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer.update(customer_params)\n migrate_to_dropbox\n format.html { redirect_to @customer, notice: \"Customer was successfully updated.\" }\n format.json { render :show, status: :ok, location: @customer }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = Customer.find(params[:id])\n @user = User.find(session[:user_id])\n @customer.modified_by = @user.name\n respond_to do |format|\n if @customer.update_attributes(params[:customer])\n format.html { redirect_to(customers_path, :notice => 'Customer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n if @customer.update customer_params\n redirect_to @customer\n else\n render 'edit'\n end\n end", "def update\n @customer_bill = CustomerBill.find(params[:id])\n\n respond_to do |format|\n if @customer_bill.update_attributes(params[:customer_bill])\n format.html { redirect_to @customer_bill, notice: 'Customer bill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customer_bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_customer(customer_id:,\n body:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/customers/{customer_id}'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'customer_id' => { 'value' => customer_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json',\n 'content-type' => 'application/json; charset=utf-8'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.put(\n _query_url,\n headers: _headers,\n parameters: body.to_json\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end", "def update_customer_with_http_info(id, update_customer, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CustomersApi.update_customer ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling CustomersApi.update_customer\"\n end\n # verify the required parameter 'update_customer' is set\n if @api_client.config.client_side_validation && update_customer.nil?\n fail ArgumentError, \"Missing the required parameter 'update_customer' when calling CustomersApi.update_customer\"\n end\n allowable_values = [\"es\", \"en\"]\n if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])\n fail ArgumentError, \"invalid value for \\\"accept_language\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/customers/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.1.0+json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?\n header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil?\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body] || @api_client.object_to_http_body(update_customer)\n\n # return_type\n return_type = opts[:debug_return_type] || 'CustomerResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['bearerAuth']\n\n new_options = opts.merge(\n :operation => :\"CustomersApi.update_customer\",\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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CustomersApi#update_customer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @offer_customer = OfferCustomer.find(params[:id])\n\n respond_to do |format|\n if @offer_customer.update_attributes(params[:offer_customer])\n format.html { redirect_to @offer_customer, notice: 'Offer customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer_customer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @type_customer = TypeCustomer.find(params[:id])\n\n respond_to do |format|\n if @type_customer.update_attributes(params[:type_customer])\n format.html { redirect_to @type_customer, notice: 'Type customer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @type_customer.errors, status: :unprocessable_entity }\n end\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 @customers_address = CustomersAddress.find(params[:id])\n\n respond_to do |format|\n if @customers_address.update_attributes(params[:customers_address])\n format.html { redirect_to @customers_address, notice: 'Customers address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @customers_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @service = Service.find(params[:id])\n respond_to do |format|\n if @service.update_attributes(service_params)\n format.html { redirect_to @customer, success: 'Service was successfully updated.' }\n format.json { respond_with_bip(@service) }\n else\n format.html { render action: 'edit'}\n format.json { respond_with_bip(@service) }\n end\n end\n end", "def update\n respond_to do |format|\n if @customerservice.update(customerservice_params)\n format.html { redirect_to @customerservice, notice: 'Customerservice was successfully updated.' }\n format.json { render :show, status: :ok, location: @customerservice }\n else\n format.html { render :edit }\n format.json { render json: @customerservice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = customers.find(params[:id])\n\n if @customer.update_attributes(params[:customer])\n redirect_to customers_path, notice: '客户信息更新成功' \n else\n render action: \"edit\" \n end\n end", "def update\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\tLOG.debug (fname) {\"params=#{params.inspect}\"}\n\t\t@customer = Customer.find(params[:id])\n\t\t@types = Typesobject.get_types(:customer)\n\t\t@status = Statusobject.find_for(@customer)\n\t\t@customer.update_accessor(current_user)\n\t\tif commit_promote?\n\t\t\tctrl_promote(@customer)\n\t\telse\n\t\t\trespond_to do |format|\n\t\t\t\tif @customer.update_attributes(params[:customer])\n\t\t\t\t\tflash[:notice] = t(:ctrl_object_updated, :typeobj => t(:ctrl_customer), :ident => @customer.ident)\n\t\t\t\t\tformat.html { redirect_to(@customer) }\n\t\t\t\t\tformat.xml { head :ok }\n\t\t\t\telse\n\t\t\t\t\tflash[:error] = t(:ctrl_object_notupdated, :typeobj => t(:ctrl_customer), :ident => @customer.ident)\n\t\t\t\t\tformat.html { render :action => :edit }\n\t\t\t\t\tformat.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend" ]
[ "0.6988014", "0.6921667", "0.6921389", "0.6746401", "0.6746401", "0.6746401", "0.6746401", "0.6746401", "0.6746401", "0.6746401", "0.67379916", "0.6729548", "0.669213", "0.669213", "0.669213", "0.6614732", "0.66107404", "0.6601309", "0.6599307", "0.6581087", "0.65642476", "0.65528435", "0.65495336", "0.6525123", "0.6525123", "0.6525123", "0.6525123", "0.6525123", "0.6525123", "0.6525123", "0.6525123", "0.6525123", "0.6525123", "0.6525123", "0.6525123", "0.6525123", "0.6525123", "0.6525123", "0.6525123", "0.6525123", "0.65224195", "0.6521344", "0.6517462", "0.6504792", "0.6493295", "0.64776856", "0.6457318", "0.6456203", "0.64549035", "0.64447165", "0.6439166", "0.64264", "0.6406883", "0.6396675", "0.6395213", "0.6387667", "0.63603675", "0.6351255", "0.6351143", "0.6297615", "0.62898433", "0.62882054", "0.6285952", "0.6271253", "0.6269422", "0.6253447", "0.6251907", "0.6244198", "0.6244198", "0.6213548", "0.61861336", "0.61684984", "0.61539996", "0.61523414", "0.6127079", "0.6125767", "0.6121538", "0.61150646", "0.61145186", "0.6112347", "0.6089436", "0.6088314", "0.6070272", "0.60669667", "0.6055655", "0.6049337", "0.60488063", "0.6045963", "0.60332125", "0.6032371", "0.6016146", "0.60120237", "0.6011633", "0.60063666", "0.60063666", "0.59956974", "0.5966501", "0.59659606", "0.5965954", "0.5965705" ]
0.62460697
67
DELETE /customers/1 DELETE /customers/1.json
def destroy @customer.destroy respond_to do |format| format.html { redirect_to customers_url,flash[:success] = "Customer record successfully deleted." } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @customer = Customer.find(params[:id])\r\n @customer.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to customers_url }\r\n format.json { head :ok }\r\n end\r\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n head :no_content\n end", "def destroy\n \n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to user_customers_url(current_user) }\n format.json do\n render json: {\n customer: @customer,\n status: :deleted\n }.to_json\n end\n end\n end", "def destroy\n @single_customer.destroy\n respond_to do |format|\n format.html { redirect_to single_customers_url, notice: 'Single customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cust = Cust.find(params[:id])\n @cust.destroy\n\n respond_to do |format|\n format.html { redirect_to custs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.where(:id => params[:id], :company_id => current_user.company.id).first\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_path, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: \"Customer was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: \"Customer was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # @customer.destroy\n # respond_to do |format|\n # format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end", "def destroy\n @customer_customer.destroy\n respond_to do |format|\n format.html { redirect_to customer_customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'データが削除されました。' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to admin_customers_url, notice: 'Customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_customer_by_id(customer_id)\n host = Swagger.configuration.host\n api_key = Swagger.configuration.private_api_key\n\n conn = Faraday.new\n resp = conn.delete do |req|\n req.url \"https://#{host}/api/customer/#{customer_id}\"\n req.headers['Content-Type'] = 'application/json'\n req.headers['Authorization'] = 'Basic ' + [\"#{api_key}:\"].pack('m').delete(\"\\r\\n\")\n end\n body = JSON.parse(resp.body)\n Swagger::Response.new(resp.status, body)\n return body\n end", "def delete_index\n @customer = Customer.with_deleted.find(params[:id])\n if params[:type]=='normal'\n @customer.delete\n elsif params[:type]=='restore'\n @customer.restore\n @customer.update(deleted_at: nil)\n end\n\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_path, notice: 'Customer was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def delete(params = {})\n req = WebPay::CustomerIdRequest.create(params)\n raw_response = @client._request(:delete, 'customers' + '/' + req.id.to_s, req)\n WebPay::CustomerResponse.new(raw_response)\n end", "def customer_destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'データが削除されました。' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to(customers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to(customers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to(customers_url) }\n format.xml { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @my_customer.destroy\n respond_to do |format|\n format.html { redirect_to my_customers_url, notice: 'My customer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n #format.html { redirect_to customers_index_path }\n format.json { head :ok }\n format.js { render :nothing => true }\n end\n end", "def destroy\n authorize @customer, :destroy?\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n\n respond_to do |format|\n if @customer.destroy\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n else\n format.html { redirect_to customer_url(@customer), :notice => \"customer can't be destroyed\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end \n end\n end", "def destroy\n find_customer\n @customer.destroy\n\n respond_to do |format|\n format.html { redirect_to('/customers/overview') }\n format.xml { head :ok }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Person wurde erfolgreich gelöscht.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @self_service_customer = SelfService::Customer.find(params[:id])\n @self_service_customer.destroy\n\n respond_to do |format|\n format.html { redirect_to(self_service_customers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @custo = Custo.find(params[:id])\n @custo.destroy\n\n respond_to do |format|\n format.html { redirect_to custos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @customer_add.destroy\n respond_to do |format|\n format.html { redirect_to customer_adds_url, notice: 'Customer add was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:customer_id])\n @cust_contact = @customer.cust_contacts.find(params[:id])\n @cust_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to customer_url(@customer) }\n format.json { head :no_content }\n end\n end", "def delete_customer(customer_id:,\n version: nil)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::DELETE,\n '/v2/customers/{customer_id}',\n 'default')\n .template_param(new_parameter(customer_id, key: 'customer_id')\n .should_encode(true))\n .query_param(new_parameter(version, key: 'version'))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def destroy\n @address_customer = AddressCustomer.find(params[:id])\n @address_customer.destroy\n\n respond_to do |format|\n format.html { redirect_to address_customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @type_customer = TypeCustomer.find(params[:id])\n @type_customer.destroy\n\n respond_to do |format|\n format.html { redirect_to type_customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Cliente eliminado exitosamente.' }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: t(\"activerecord.controller_msg.customer.destroyed\", :default => 'Customer was successfully destroyed.') }\n format.json { head :no_content }\n end\n end", "def delete(customer_id)\n response, status = BeyondApi::Request.delete(@session, \"/customers/#{customer_id}\")\n\n handle_response(response, status, respond_with_true: true)\n end", "def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n @customer.destroy\n redirect_to customers_url\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n Customer.destroy params #[not sure what to put in the params]\n redirect_to customers_path\n end", "def destroy\n @customer_detail.destroy\n respond_to do |format|\n format.html { redirect_to customer_details_url, notice: \"Customer detail was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer_detail.destroy\n respond_to do |format|\n format.html { redirect_to customer_details_url, notice: 'Customer detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer = Customer.find(params[:id])\n @customer.destroy\n redirect_to(action: \"index\")\n end", "def destroy\n @shop_customer.destroy\n respond_to do |format|\n format.html { redirect_to shop_customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url, notice: 'Customer was successfully destroyed.' }\n end\n end", "def delete_customer(customer_id:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/customers/{customer_id}'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'customer_id' => { 'value' => customer_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.delete(\n _query_url,\n headers: _headers\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end", "def destroy\n @customerservice.destroy\n respond_to do |format|\n format.html { redirect_to customerservices_url, notice: 'Customerservice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete()\n sql = \"DELETE from customers WHERE id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\n# => Deleting customer record, nothing to return\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def destroy\n if params[:customers]\n customers.where(id: params[:customers].values).delete_all\n elsif params[:id]\n customers.find_by_id(params[:id]).try(:destroy)\n end\n redirect_to customers_url(search: params[:search])\n end", "def destroy\n @customer.destroy\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @customer_info.destroy\n respond_to do |format|\n format.html { redirect_to customer_infos_url, notice: 'Customer info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reach_out_to_customer.destroy\n respond_to do |format|\n format.html { redirect_to reach_out_to_customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer_set.destroy\n respond_to do |format|\n format.html { redirect_to customer_sets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sixmonth_customer = SixmonthCustomer.find(params[:id])\n @sixmonth_customer.destroy\n\n respond_to do |format|\n format.html { redirect_to sixmonth_customers_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Users.delete(params[\"id\"])\n end", "def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.7459997", "0.7459997", "0.74485695", "0.74485695", "0.74485695", "0.74485695", "0.74485695", "0.74485695", "0.74485695", "0.7435839", "0.7429404", "0.7429404", "0.7429404", "0.7429404", "0.7429404", "0.7429404", "0.7429404", "0.7429404", "0.7364333", "0.732843", "0.72985286", "0.72831863", "0.7236284", "0.71671945", "0.71460426", "0.71443635", "0.7143448", "0.7143448", "0.7141246", "0.7141246", "0.7141246", "0.7141246", "0.7141246", "0.7141246", "0.7141246", "0.7141246", "0.7141246", "0.7141246", "0.7141246", "0.7141246", "0.7141246", "0.7141246", "0.7141246", "0.7141246", "0.7141246", "0.7141246", "0.71409726", "0.7135988", "0.71215165", "0.7119578", "0.7108053", "0.7100693", "0.7094806", "0.709428", "0.7090288", "0.7078817", "0.7078817", "0.7078817", "0.70757055", "0.7075676", "0.7058505", "0.7056407", "0.7037161", "0.7028059", "0.70055234", "0.6980533", "0.69780326", "0.69721895", "0.6955825", "0.69444925", "0.69270974", "0.69230574", "0.6898595", "0.68974566", "0.68970734", "0.6892207", "0.68822056", "0.68665344", "0.6862874", "0.6862019", "0.6833437", "0.6830371", "0.6830244", "0.6823991", "0.6812947", "0.6811358", "0.6802542", "0.6769426", "0.67567897", "0.67558765", "0.67558765", "0.6755757", "0.67547226", "0.67405546", "0.67126524", "0.6710435", "0.6703614", "0.67006505", "0.67001665", "0.6699188" ]
0.69809604
65
Use callbacks to share common setup or constraints between actions.
def set_customer @customer = Customer.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 customer_params params.require(:customer).permit(:first_name, :last_name, :phone, :query, :email, :street_address, :city, :acct_open_date, :agreement_status, :trans_type, :last_trans_date, :street_address2, :postal, :province, :notes) 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
do eth protocol handshake and return status
def send_handshake(network_id, total_difficulty, head_hash, genesis_hash) status = Status.new(protocol_version: 63, network_id: network_id, total_difficulty: total_difficulty, current_block: head_hash, genesis_block: genesis_hash) @context.send_data(Status::CODE, status.rlp_encode) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connection_status_handshake; end", "def handshake\n end", "def handshake\n data = \"email=#{@email}&password=#{@password}\"\n headers = { 'User-agent' => USER_AGENT }\n\n begin\n resp = @http.post(API_HANDSHAKE_PATH, data, headers)\n rescue SocketError\n return false\n end\n\n debug \"[HANDSHAKE]\" do puts resp.body end\n\n return (resp.code == \"200\" && !resp.body[\"login failure\"])\n end", "def handshake\n @state = :handshake\n thread\n\n if options[:type] == :client\n message = send :protocol_version, Supernova::VERSION\n response = response_to message\n check_versions response\n handle_encryption\n else\n\n wait_for_protocol_version\n handle_server_encryption\n end\n\n @state = :online\n end", "def begin_handshake\n if incoming? && !@node.accept_connections?\n return close_connection unless @node.config[:connect].include?([@host, @port.to_s])\n end\n log.info { \"Established #{@direction} connection\" }\n @node.connections << self\n @state = :handshake\n send_version\n rescue Exception\n log.fatal { \"Error in #begin_handshake\" }\n p $!; puts *$@\n end", "def connect\n ssl_socket.connect\n handshake.execute!\n end", "def on_handshake_begin\n @state = :handshake\n from = \"#{@node.external_ip}:#{@node.config[:listen][1]}\"\n version = Bitcoin::Protocol::Version.new({\n :version => 70001,\n :last_block => @node.store.get_depth,\n :from => from,\n :to => @host,\n :user_agent => \"/bitcoin-ruby:#{Bitcoin::VERSION}/\",\n #:user_agent => \"/Satoshi:0.8.1/\",\n })\n send_data(version.to_pkt)\n log.debug { \"<< version (#{Bitcoin.network[:protocol_version]})\" }\n end", "def tls_successful_handshake\n logdebug \"Succesful handshake!\"\n end", "def send_handshake(socket)\n\n\t# Get the first line when available\n\trequest_line = socket.gets\n\n\t# Get the header from the line read\n\theader = get_header(socket)\n\n\t# Attempt to parse the request line\n\t# We aren't going to pay attention to the header fields in the request\n \tif (request_line =~ /GET #{@path} HTTP\\/1.1/) && (header =~ /Sec-WebSocket-Key: (.*)\\r\\n/)\n\t \t\n\t \t# Create and return the initializing acceptance handshale\n\t \tws_accept = create_websocket_accept($1)\n\t\tsend_handshake_response(socket, ws_accept)\n\n\t\t# Let the handling class know everything went ok.\n\t\treturn true\n\n\tend\n\n\t# If we failed to parse the header, return a 400.\n\tsend_400(socket)\n\n\t# Let the handling class know we encountered an issue.\n\tfalse\n\n end", "def check(host, port = 443)\n # Connect\n s = TCPSocket.new(host, port)\n\n # Send ClientHello message\n s.write(TLS_HANDSHAKE)\n\n # Foolishly wait for ServerHelloDone message\n loop until read_tls_header_type(s) == 22 and read_tls_handshake_type(s) == 14\n\n # Send Heartbeat Request message\n s.write(TLS_HEARTBEAT)\n\n # Read Heartbeat Response message if any\n if read_tls_header_type(s) == 24\n data = read_tls_heartbeat_data(s)\n if !data.nil? and data.size > 3\n puts \"Host #{host}:#{port} is vulnerable! Heartbeat response payload :\"\n puts Hexdump.dump(data)\n else\n puts \"Host #{host}:#{port} is safe\"\n end\n else\n puts \"Host #{host}:#{port} seems safe\"\n end\n\n # Disconnect\n s.close()\nend", "def ssl_handshake_completed\n connected!\n end", "def ssl_handshake_completed\n log_system_debug(\"TLS connection established to \" << remote_desc) if $oversip_debug\n\n # @connected in TlsClient means \"TLS connection\" rather than\n # just \"TCP connection\".\n @connected = true\n @timer_tls_handshake.cancel if @timer_tls_handshake\n\n # Run OverSIP::SipEvents.on_server_tls_handshake.\n ::Fiber.new do\n if @callback_on_server_tls_handshake\n log_system_debug \"running OverSIP::SipEvents.on_server_tls_handshake()...\" if $oversip_debug\n begin\n ::OverSIP::SipEvents.on_server_tls_handshake self, @server_pems\n rescue ::Exception => e\n log_system_error \"error calling OverSIP::SipEvents.on_server_tls_handshake():\"\n log_system_error e\n close_connection\n end\n\n # If the user or peer has closed the connection in the on_server_tls_handshake() callback\n # then notify pending transactions.\n if @local_closed or error?\n log_system_debug \"connection closed, aborting\" if $oversip_debug\n @pending_client_transactions.each do |client_transaction|\n client_transaction.tls_validation_failed\n end\n @pending_client_transactions.clear\n @pending_messages.clear\n @state = :ignore\n end\n end\n\n @pending_client_transactions.clear\n @pending_messages.each do |msg|\n send_data msg\n end\n @pending_messages.clear\n end.resume\n end", "def handshake\n return if @scrobble_session_id\n timestamp = Time.now.utc.to_i.to_s\n authentication_token = md5(secret + timestamp)\n parameters = {\n \"hs\" => \"true\",\n \"p\" => \"1.2.1\",\n \"c\" => CLIENT_ID,\n \"v\" => CLIENT_VERSION,\n \"u\" => user,\n \"t\" => timestamp,\n \"a\" => authentication_token,\n \"api_key\" => api_key,\n \"sk\" => session_key }\n body = get(\"http://post.audioscrobbler.com/\", parameters)\n status,\n @scrobble_session_id,\n @now_playing_url,\n @submission_url, =\n split_plain_text_response(body)\n raise HandshakeError, status unless status == \"OK\"\n end", "def handshake_peer (port, to, key_private)\r\n timestamp = Time.now.to_i\r\n signature = sign_block(key_private, timestamp)\r\n Faraday.post(\"#{URL}:#{to}/peer_handshake\", port: port, signature: signature, timestamp: timestamp)\r\nend", "def connection_status_crypt_response; end", "def connect(url, options={})\n puts \"start ***************\"\n return if @socket\n @url = url\n uri = URI.parse url\n @socket = TCPSocket.new(uri.host,\n uri.port || (uri.scheme == 'wss' ? 443 : 80))\n if ['https', 'wss'].include? uri.scheme\n ctx = OpenSSL::SSL::SSLContext.new\n ctx.ssl_version = options[:ssl_version] || 'SSLv23'\n ctx.verify_mode = options[:verify_mode] || OpenSSL::SSL::VERIFY_NONE #use VERIFY_PEER for verification\n cert_store = OpenSSL::X509::Store.new\n cert_store.set_default_paths\n ctx.cert_store = cert_store\n @socket = ::OpenSSL::SSL::SSLSocket.new(@socket, ctx)\n @socket.connect\n end\n puts url\n @handshake = ::WebSocket::Handshake::Client.new :url => url, :headers => options[:headers]\n puts @handshake.to_s\n @handshaked = false\n @pipe_broken = false\n frame = ::WebSocket::Frame::Incoming::Client.new\n @closed = false\n once :__close do |err|\n puts \"clooooseeee ***********\"\n close\n emit :close, err\n end\n puts frame\n @thread = Thread.new do\n puts \"start while!!!!***********\"\n while !@closed do\n begin\n # puts \"1 ***************\"\n unless recv_data = @socket.getc\n puts \"2 ***************\"\n sleep 1\n next\n end\n unless @handshaked\n # puts \"3 ***************\"\n @handshake << recv_data\n if @handshake.finished?\n @handshaked = true\n puts \"Open!!!\"\n emit :open\n end\n else\n puts \"4 ***************\"\n frame << recv_data\n while msg = frame.next\n puts \"msg ***************\"\n emit :message, msg\n end\n end\n rescue => e\n puts \"error ***************\"\n emit :error, e\n end\n end\n end\n puts \"write ***************\"\n @socket.write @handshake.to_s\n end", "def check_protocol(data)\n input = data.unpack(\"a4a4a4a4a4a4a4a4\")\n #puts \"CHECK: #{input.inspect}\"\n unless input[0] == \"Rsrv\"\n raise Rserve::Connection::IncorrectServerError, \"Handshake failed: Rsrv signature expected, but received [#{input[0]}]\"\n end\n @rsrv_version = input[1].to_i\n if @rsrv_version > 103\n raise Rserve::Connection::IncorrectServerVersionError, \"Handshake failed: The server uses more recent protocol than this client.\"\n end\n @protocol = input[2]\n if @protocol != \"QAP1\"\n raise Rserve::Connection::IncorrectProtocolError, \"Handshake failed: unsupported transfer protocol #{@protocol}, I talk only QAP1.\"\n end\n (3..7).each do |i|\n # TODO: This is most likely going to fail miserably\n attr=input[i]\n if (attr==\"ARpt\")\n if (!auth_req) # this method is only fallback when no other was specified\n auth_req=true\n auth_type = Rserve::Connection::AT_plain\n end\n end\n if (attr==\"ARuc\")\n auth_req=true\n authType = Rserve::Connection::AT_crypt\n end\n if (attr[0]=='K')\n key=attr[1,3]\n end\n\n end\n state :initialized\n end", "def connection_status_crypt_wait_response; end", "def handshake(features=GDB_FEATURES)\n send_cmd features\n read_response # lots of flags, nothing interesting\n end", "def _post_connect()\n return unless (@connect_headers[:\"accept-version\"] && @connect_headers[:host]) # 1.0\n if @connection_frame.command == Stomp::CMD_ERROR\n @connection_frame.headers = _decodeHeaders(@connection_frame.headers)\n return\n end\n # We are CONNECTed\n cfh = @connection_frame.headers.symbolize_keys\n @protocol = cfh[:version]\n if @protocol\n # Should not happen, but check anyway\n raise Stomp::Error::UnsupportedProtocolError unless Stomp::SUPPORTED.index(@protocol)\n else # CONNECTed to a 1.0 server that does not return *any* 1.1 type headers\n @protocol = Stomp::SPL_10 # reset\n return\n end\n # Heartbeats\n return unless @connect_headers[:\"heart-beat\"]\n _init_heartbeats()\n end", "def check_proto\n send(\"MYTH_PROTO_VERSION #{@protocol_version}\")\n response = recv\n unless response[0] == \"ACCEPT\" && response[1] == @protocol_version.to_s\n close\n raise ProtocolError, response.join(\": \")\n end\n end", "def check ()\n\t return \"OK\" if @simulate\n\t return \"IES\" unless @sock\n\t @sock.readline().chomp\n\tend", "def ssl_handshake_completed\n begin\n return unless @@options[:verify_ssl]\n close_connection unless Http::SSLValidator.validate(@certs, @host)\n rescue Exception => e\n @@logger.error(\"Error in ssl_handshake_completed: #{e}\")\n raise e\n end\n end", "def on_handshake_succeeded( fd, endpoint )\n\t\t\tself.log.debug \"Client socket on FD %d handshake succeeded\" % [ fd ]\n\t\tend", "def ssl_handshake_completed\n return unless @tls_options[:verify_peer]\n @client_cert = get_peer_cert\n close_connection if @client_cert && !valid_client?(@client_cert)\n end", "def check_connection\n return\n check = HTTParty.get(\"#{@host}/api/process/check_connection?api_key=#{@api_key}\")\n if check.nil? || check[\"status\"][\"code\"] < 0\n @helper.terminate(\"Script was unable to establish connection with dFlow at #{@host}\")\n end\n end", "def on_verack\n log.debug { \">> verack\" }\n complete_handshake if outgoing?\n end", "def ensure_device_status\n\n $test_logger.log(\"Inside ensure_device_status for Thrift Protocol\")\n\n max_retry = 5\n retry_count = 0\n @is_reconnected = false \n begin\n begin\n #Increment current retry\n retry_count += 1\n\n $test_logger.log(\"Ensure device status for MA1000! trial = '#{retry_count}'\")\n\n #Reset connection after second trial onwards\n if retry_count > 1\n reset_connection\n elsif !@transport.open?\n #Connect to device if transport is not open\n connect_to_device\n end\n\n #Initialize retry flag to false\n to_retry = false\n\n #Sending check status cmd\n begin\n #Ping data\n ping_data = \"\\x7\\x45\\x67\\x50\"\n\n #Ping and check terminal status\n ping_res = call_thrift{terminal_echo(ping_data)}\n\n $test_logger.log \"Ping reply '#{Common.unpackbytes(ping_res)}'\"\n\n raise \"Ping response mismatch! Expected='#{Common.unpackbytes(ping_data)}', Actual='#{Common.unpackbytes(ping_res)}'\" if ping_res != ping_data\n rescue Exception => ex\n raise(ex, \"Error while checking terminal status!\\n#{ex.message}\", ex.backtrace)\n end\n\n #Handle exception\n rescue Exception => main_ex\n \n @is_reconnected = true\n \n #Raise exception in case of max trials\n raise(main_ex, \"Error while re-connecting to terminal!\\n#{main_ex.message}\", main_ex.backtrace) if retry_count >= max_retry\n\n #Log error\n $test_logger.log_e(\"Could not ensure terminal connection! Trial = '#{retry_count}/#{max_retry}'\", main_ex)\n\n #Set to_retry flag\n to_retry = true\n\n #Wait for 5 seconds before reconnecting\n sleep 5\n end\n\n end while(to_retry)\n\n end", "def get_ssl_hash_verify\n # Not supported unless we have a socket with SSL enabled\n return nil unless self.client.sock.type? == 'tcp-ssl'\n\n request = Packet.create_request(COMMAND_ID_CORE_TRANSPORT_GETCERTHASH)\n response = client.send_request(request)\n\n return response.get_tlv_value(TLV_TYPE_TRANS_CERT_HASH)\n end", "def ssl_connect()\n $log.debug(\"Initiating SSL Connect Test\")\n disable_validations\n s = timeout(@open_timeout) { TCPSocket.open(conn_address(), conn_port()) }\n s = OpenSSL::SSL::SSLSocket.new(s, @ssl_context)\n s.sync_close = true\n\n @socket = BufferedIO.new(s)\n @socket.read_timeout = @read_timeout\n @socket.debug_output = @debug_output\n\n if proxy?\n @socket.writeline sprintf('CONNECT %s:%s HTTP/%s', @address, @port, HTTPVersion)\n @socket.writeline \"Host: #{@address}:#{@port}\"\n @socket.writeline ''\n HTTPResponse.read_new(@socket).value\n end\n\n begin\n s.connect\n return ResultContainer.new(true, nil)\n rescue OpenSSL::SSL::SSLError => ex\n return ResultContainer.new(false, ex)\n rescue => ex2\n return ResultContainer.new(false, ex2)\n end\n end", "def wait_connect(trycnt=10)\n trycnt.times do\n case sts = status\n when 0x00; return\n when 0x23; raise \"SSID not configured\"\n when 0x24; raise \"Encryption key invalid\"\n when 0x27; raise \"SSID was found, but join failed\"\n # else; Object.puts \"status = 0x#{sts.to_s(16)}\"\n end\n end\n raise \"Cannot connect to target\"\n end", "def handshake(server)\n bb = server.handshake(user.username, aa)\n validate_ephemeral(bb)\n @bb = bb\n end", "def ssl_check_peer_state\n super\n end", "def check\n tcp_socket_request\n mark_message \"Ping check to #{host}:#{port} successful\"\n rescue => e\n mark_message \"Error: '#{e}'\"\n mark_failure\n end", "def handshake(message, local = false, &callback)\n response = make_response(message)\n response['version'] = BAYEUX_VERSION\n\n response['error'] = Error.parameter_missing('version') if message['version'].nil?\n\n client_conns = message['supportedConnectionTypes']\n\n response['supportedConnectionTypes'] = CONNECTION_TYPES\n\n if client_conns\n common_conns = client_conns.select { |c| CONNECTION_TYPES.include?(c) }\n response['error'] = Error.conntype_mismatch(*client_conns) if common_conns.empty?\n else\n response['error'] = Error.parameter_missing('supportedConnectionTypes')\n end\n\n response['successful'] = response['error'].nil?\n return callback.call(response) unless response['successful']\n\n @engine.create_client do |client_id|\n response['clientId'] = client_id\n callback.call(response)\n end\n end", "def connection_status_crypt_request; end", "def connection_completed\n @connection_completed = true\n begin_handshake\n rescue Exception\n log.fatal { \"Error in #connection_completed\" }\n p $!; puts *$@\n end", "def _pre_connect()\n @connect_headers = @connect_headers.symbolize_keys\n raise Stomp::Error::ProtocolErrorConnect if (@connect_headers[:\"accept-version\"] && !@connect_headers[:host])\n raise Stomp::Error::ProtocolErrorConnect if (!@connect_headers[:\"accept-version\"] && @connect_headers[:host])\n return unless (@connect_headers[:\"accept-version\"] && @connect_headers[:host]) # 1.0\n # Try 1.1 or greater\n @hhas10 = false\n okvers = []\n avers = @connect_headers[:\"accept-version\"].split(\",\")\n avers.each do |nver|\n if Stomp::SUPPORTED.index(nver)\n okvers << nver\n @hhas10 = true if nver == Stomp::SPL_10\n end\n end\n raise Stomp::Error::UnsupportedProtocolError if okvers == []\n @connect_headers[:\"accept-version\"] = okvers.join(\",\") # This goes to server\n # Heartbeats - pre connect\n return unless @connect_headers[:\"heart-beat\"]\n _validate_hbheader()\n end", "def enable_ssl_hash_verify\n # Not supported unless we have a socket with SSL enabled\n return nil unless self.client.sock.type? == 'tcp-ssl'\n\n request = Packet.create_request(COMMAND_ID_CORE_TRANSPORT_SETCERTHASH)\n\n hash = Rex::Text.sha1_raw(self.client.sock.sslctx.cert.to_der)\n request.add_tlv(TLV_TYPE_TRANS_CERT_HASH, hash)\n\n client.send_request(request)\n\n return hash\n end", "def connection_completed\n log_debug '[client-cnxn] Established server connection, sending request'\n send_request unless error?\n rescue\n fail(:RPC_ERROR, 'Connection error: %s' % $!.message) unless failed?\n end", "def authenticate\n @socket.write(0.chr)\n next_authenticator\n @state = :Starting\n while @state != :Authenticated\n r = next_state\n return r if not r\n end\n true\n end", "def make_handshake\n gps_api_adapter = GpsApiAdapter.new(self)\n gps_api_adapter.get_verification_details\n end", "def connect\n self.send({\n msg: :connect,\n version: @version,\n support: @support\n })\n\n #handle incoming response form the server\n self.onmessage = lambda do |event|\n\n res = JSON.parse(event.data)\n\n if res.has_key? 'session'\n #connection is successful - update session and record version\n @session = res['session'].to_s\n @@last_suc_version = @version\n\n else #there was a failed connection\n @version = res['version']\n #retry the send request with the version specified by the server\n self.send({\n msg: :connect\n version: @version,\n support: @support\n })\n end\n\n end\n end", "def handshake(options = {})\n options = {\n readcode: false,\n manual_stop: false, # set a 2nd CPU flag in case 1st flag is automatically cleared\n }.merge(options)\n if options[:readcode]\n set_code(options[:readcode])\n end\n if options[:manual_stop]\n cycle(microcode: \"#{@microcode[:enable]} (#{@flags[1]})\")\n cycle(microcode: \"#{@microcode[:set_flag]} (#{@flags[0]} #{@flags[1]})\")\n cycle(microcode: \"loop_here_#{@unique_counter}: if (flag) jump loop_here_#{@unique_counter}\")\n else\n cycle(microcode: \"#{@microcode[:set_flag]} (#{@flags[0]})\")\n cycle(microcode: \"loop_here_#{@unique_counter}: if (#{@flags[0]}) jump loop_here_#{@unique_counter}\")\n end\n @unique_counter += 1 # Increment so a different label will be applied if another\n # handshake is called in the same pattern\n end", "def check_connection\n return\n check = HTTParty.get(\"#{@host}/api/check_connection?api_key=#{@api_key}\")\n if check.nil? || check[\"status\"][\"code\"] < 0\n @helper.terminate(\"Script was unable to establish connection with dFile at #{@host}\")\n end\n end", "def complete_handshake\n if @state == :handshake\n log.debug { 'Handshake completed' }\n @state = :connected\n @started = Time.now\n @node.push_notification(:connection, info.merge(type: :connected))\n @node.addrs << addr\n end\n send_data P::Addr.pkt(@node.addr) if @node.config[:announce]\n end", "def read_tls_handshake_type (socket)\n handshake = socket.read(4)\n hs_type, hs_length = handshake.unpack('CH6')\n hs_length = hs_length.to_i(16)\n hs_data = socket.read(hs_length)\n return hs_type\nend", "def test_connection(ip,port)\n\t\tbegin\n\t\t\tsock = Rex::Socket::Tcp.create(\n\t\t\t\t'PeerHost' => ip,\n\t\t\t\t'PeerPort' => port,\n\t\t\t\t'Timeout' => 1\n\t\t\t\t)\n\t\trescue Rex::ConnectionError\n\t\t\treturn :down\n\t\tend\n\t\tsock.close\n\t\treturn :up\n\tend", "def _connect\n return if @ssl_connected\n\n Error.translate do\n @plaintext_connected ||= super\n return if !@plaintext_connected\n\n # Mark the connection as not connected due to the pending SSL handshake.\n @connected = false\n\n @socket.connect_nonblock\n @ssl_connected = @connected = true\n end\n rescue IO::WaitReadable, IO::WaitWritable, Errno::EINPROGRESS\n rescue Error => e\n close e\n end", "def on_handshake_failed_protocol( fd, endpoint )\n\t\t\tself.log.debug \"Client socket on FD %d handshake failed: protocol error\" % [ fd ]\n\t\tend", "def starttls(value)\n send_text(\"220 2.0.0 TLS go ahead\")\n LOG.info(@mail[:mail_id]) {\"<-> (handshake)\"} if LogReceiverConversation\n conn = @connection.deepclone # save the unencrypted connection in case of error\n begin\n @connection.accept\n @mail[:encrypted] = @encrypted = true\n rescue OpenSSL::SSL::SSLError => e\n # STARTTLS failed: restore the unencrypted connection\n LOG.error(@mail[:mail_id]) {\"Error during STARTTLS: #{e}\"}\n @connection = conn # restore original\n @mail[:encrypted] = @encrypted = false\n return \"500 5.0.0 STARTTLS failed: #{e}\"\n end\n return nil\n end", "def proceed\n @stream.start_tls\n success\n end", "def connect_ssl; end", "def send_handshake_response(socket, ws_accept)\n\tsocket << \"HTTP/1.1 101 Switching Protocols\\r\\n\" +\n\t\"Upgrade: websocket\\r\\n\" +\n\t\"Connection: Upgrade\\r\\n\" +\n\t\"Sec-WebSocket-Accept: #{ws_accept}\\r\\n\"\n end", "def verify\n @request = Net::HTTP::Get.new(@uri.path)\n @request.basic_auth @username, @password\n\n @response = @http.request(@request)\n @response.code.to_i == 200\n\n rescue Errno::ETIMEDOUT, Exception\n false\n end", "def request_success(packet); end", "def connection_action\n @sslsocket.connect_nonblock\n end", "def check\n # we want to handle cases where the port/target isn't open/listening gracefully\n begin\n # only catch the response if we're going to use it, in this case we do for the version\n # detection.\n res = send_request_cgi(\n 'uri' => normalize_uri(target_uri.path, 'index.php'),\n 'method' => 'GET'\n )\n # gracefully handle if res comes back as nil, since we're not guaranteed a response\n # also handle if we get an unexpected HTTP response code\n fail_with(Failure::UnexpectedReply, \"#{peer} - Could not connect to web service - no response\") if res.nil?\n fail_with(Failure::UnexpectedReply, \"#{peer} - Check URI Path, unexpected HTTP response code: #{res.code}\") if res.code == 200\n\n # here we're looking through html for the version string, similar to:\n # Version 1.2\n /Version: (?<version>[\\d]{1,2}\\.[\\d]{1,2})<\\/td>/ =~ res.body\n\n if version && Gem::Version.new(version) <= Gem::Version.new('1.3')\n vprint_good(\"Version Detected: #{version}\")\n Exploit::CheckCode::Appears\n end\n rescue ::Rex::ConnectionError\n fail_with(Failure::Unreachable, \"#{peer} - Could not connect to the web service\")\n end\n Exploit::CheckCode::Safe\n end", "def run\n buf = @ssl.read\n @out.call(buf)\n @bytes += buf.size\n @pkts += 1\n end", "def ssl_handshake_completed\n auth_data = {\n api_key: client.api_key,\n instance: client.instance_name,\n 'user-agent' => \"syncano-ruby-#{Syncano::VERSION}\"\n }\n\n auth_data[:auth_key] = client.auth_key if client.auth_key.present?\n\n client.connection = self\n\n send_data \"#{auth_data.to_json}\\n\"\n end", "def return_handshake\n YoolkAuth::ConnectionMock::HTTPResponseMock.new(yoolk_auth_config.merge(logged_in: yoolk_auth_logged_in?).to_json, yoolk_auth_handshake_response_code)\n end", "def _startConnection()\r\n #puts \"startConnection() called.\"\r\n valid_tag = \"ACCEPT\";\r\n # The client initiates the transaction\r\n mesg = \"CONNECT: WiKID Ruby Client v#{@@VERSION}\"\r\n mesg = \"<transaction> <type>1</type> <data> <client-string>wClient Ruby #{@@VERSION}</client-string> <server-string>null</server-string> <result>null</result> </data> </transaction>\r\n \"\r\n\r\n xml = _request(mesg);\r\n result = XPath.first(xml, '//data/result')\r\n if result == \"ACCEPT\"\r\n #puts \"wClient connection ACCEPTED\"\r\n @isConnected = true\r\n else\r\n #puts \"wClient connection FAILED\"\r\n @isConnected = false\r\n end\r\n return @isConnected\r\n end", "def eth_cnt_rst; eth_ctrl_bit(8); end", "def check_ok_response( socket, msg )\n result = socket.recv( 100 )\n logger.debug( \"Result for #{msg} : #{result}\" )\n raise \"Invalid response for #{msg}\" unless result == \"OK\\n\"\n end", "def test_conn_1p_0110\n @conn.disconnect\n #\n cha = get_conn_headers() \n cha[\"heart-beat\"] = \"0,0\" # No heartbeats\n conn = nil\n conn = Stomp::Connection.open(user, passcode, host, port, false, 5, cha)\n good_data = [\n \"\\x41\\xc3\\xb1\\x42\",\n \"\\xc2\\x80\", # 2 byte characters\n \"\\xc2\\xbf\",\n \"\\xdf\\x80\",\n \"\\xdf\\xbf\",\n \"\\xe0\\xa0\\x80\", # 3 byte characters\n \"\\xe0\\xbf\\x80\",\n \"\\xe0\\xa0\\xbf\",\n \"\\xe0\\xbf\\xbf\",\n \"\\xf1\\x80\\x80\\x80\", # 4 byte characters\n \"\\xf1\\xbf\\xbf\\xbf\",\n \"\\xf2\\x80\\x80\\x80\",\n \"\\xf2\\xbf\\xbf\\xbf\",\n \"\\xf3\\x80\\x80\\x80\",\n \"\\xf3\\xbf\\xbf\\xbf\",\n ]\n good_data.each do |string|\n assert conn.valid_utf8?(string), \"good unicode specs 01: #{string}\"\n end\n conn.disconnect\n end", "def run\r\n Settings::DEFAULT_TRIGGERS.each_key{|k| load_trigger(k, true)}\r\n Settings::TRIGGERS.each_key{|k| load_trigger(k)}\r\n @socket = TCPSocket.open(self.server, self.port)\r\n\r\n $log.info(\"Initiating handshake with server...\")\r\n say \"USER #{nick} 0 * #{nick}\"\r\n say \"NICK #{nick}\"\r\n\r\n until @socket.eof? do\r\n msg = @socket.gets\r\n msg = (msg.split(\" \")[1] == \"PRIVMSG\" ? PrivateMessage.new(msg) : Message.new(msg))\r\n\r\n if msg.type == \"PRIVMSG\"\r\n cache_message(msg)\r\n fire_triggers(msg)\r\n end\r\n\r\n #keep alive\r\n if msg.parts[0] == \"PING\"\r\n say \"PONG :pingis\"\r\n else\r\n case msg.parts[1]\r\n when \"001\"\r\n $log.info(\"Processing connection to server...\")\r\n when \"376\"\r\n $log.info(\"Connected to server, joining channel...\")\r\n join_chan(self.chan)\r\n when \"366\"\r\n @in_chan = true\r\n $log.info(\"Successfully joined ##{self.chan}\")\r\n else\r\n end\r\n end\r\n #output to terminal window whatever the server is giving our socket\r\n $log.info(\"#{msg.stringify}\")\r\n end\r\n end", "def check_connection\n one_wait = 5\n max_wait = 5\n request = Net::HTTP::Get.new('/')\n wait = 0;\n while (wait < max_wait)\n begin\n response = Net::HTTP.start(@url.host, @url.port) {|http|\n http.request(request)\n }\n break if Net::HTTPForbidden === response\n break if Net::HTTPNotFound === response\n break if Net::HTTPSuccess === response\n # When we try to connect to a down server with an Apache proxy, \n # we'll get Net::HTTPBadGateway and get here\n rescue Errno::ECONNREFUSED\n # When we try to connect to a down server without an Apache proxy, \n # such as a dev instance, we'll get here\n end\n sleep one_wait;\n wait += one_wait\n end\n if (wait == max_wait)\n puts(\"-- ERROR: couldn't connect to test host on \" + @url.host.to_s)\n return false\n end\n puts(\"-- SUCCESS: test host is alive !\\n\")\n return true\nend", "def protocol_failure(ctx, **)\n true\n end", "def response(env)\n env.trace 'open send connection'\n env.logger.debug \"Begin send request\"\n validate_send_params # Ensure required parameters\n if authenticate\n [200, {}, prepare_send_request]\n else\n [401, {}, \"Unauthorized\"]\n end\n end", "def mssql_send_prelogin_response()\n return [\n Constants::TDS_MSG_RESPONSE,\n 1, # status\n 0x002b, # length\n \"0000010000001a00060100200001020021000103002200000400220001ff0a3206510000020000\"\n ].pack(\"CCnH*\")\n end", "def check_router\n # checks if the router is ready for us ?\n out_socket.send( \"READY\\n\", 0 )\n result = out_socket.recv( 100 )\n logger.debug( \"RESP TO READY #{result}\" )\n raise \"The router does not seem ready to receive commands\" unless result == \"YES\\n\" \n end", "def start( port = 24842 )\n server = TCPServer.new( port )\n\n while @session = server.accept\n username = converse()\n salt = generate_salt\n auth_string = converse( salt )\n if authenticate?( username, salt, auth_string )\n result = \"AUTHORIZED\"\n else\n result = \"NOT AUTHORIZED\"\n end\n @session.puts( result )\n @session.close\n end\n \n # returning last result\n return result\n\n end", "def starttls?; end", "def accept\n\tsocket = @server.accept\n\tsend_handshake(socket) && Connection.new(socket)\n end", "def test_conn_1p_0030\n @conn.disconnect\n #\n cha = get_conn_headers()\n conn = nil\n assert_nothing_raised do\n conn = Stomp::Connection.open(user, passcode, host, port, false, 5, cha)\n conn.disconnect\n end\n assert conn.protocol >= Stomp::SPL_11\n end", "def conn_start host, port, ssl\n con = Net::HTTP.new(host, port)\n if ssl\n con.use_ssl = true\n con.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n con.start\n if block_given?\n begin\n return yield(con)\n ensure\n con.finish\n end\n end\n con\nend", "def test_conn_1p_0010\n @conn.disconnect\n #\n cha = {:host => \"localhost\"}\n assert_raise Stomp::Error::ProtocolErrorConnect do\n conn = Stomp::Connection.open(user, passcode, host, port, false, 5, cha)\n end \n #\n chb = {\"accept-version\" => \"1.0\"}\n assert_raise Stomp::Error::ProtocolErrorConnect do\n conn = Stomp::Connection.open(user, passcode, host, port, false, 5, chb)\n end \n end", "def establishSession(identKey,srcIP,srcPort,dstIP,dstPort,config)\n\t# Send SYN\n\tflags = [0,0,0,0,1,0]\n\tpayload = \"\"\n\ttcpPacket = tcpConstruct(identKey,srcIP,srcPort,dstIP,dstPort,flags, payload)\n\ttcpPacket.to_w # Sent\n\tprint \"Session request sent, waiting for reply.\\n\"\n\t# Wait for Response\n\t\n\t\tstatus = Timeout::timeout($timeout) {\n\t\t\tcapturedTCP = PacketFu::Capture.new(:iface => config[:iface], :start => true, :promisc => true, :filter => \"tcp and src host #{dstIP}\")\n\t\t\tcapturedTCP.stream.each { |packet|\n\t\t\t\tpkt = Packet.parse packet\n\t\t\t\t# Check that it is a UDP packet\n\t\t\t\tif pkt.is_tcp?\n\t\t\t\t\t# Is it one of ours?\n\t\t\t\t\tputs \"is it ours? #{identKey}\"\n\t\t\t\t\tif pkt.ip_id == identKey\n\t\t\t\t\t\t# Should be a SYN/ACK to Confirm Session\n\t\t\t\t\t\tif pkt.tcp_flags.syn == 1 && pkt.tcp_flags.ack == 1\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\treturn true\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t}\n\t\t}\n\t\trescue Timeout::Error\n\t\t\tprint \"Error: No Response before Timout\\n\"\n\t\t\treturn false\nend", "def gets\n method_invocation_log << [:gets]\n raise MPD::ConnectionError unless connected\n (server_response_lines.shift || 'ACK') + \"\\n\"\n end", "def connection_action\n @sslsocket.accept_nonblock\n end", "def next_state\n msg = next_msg\n if @state == :Starting\n case msg[0]\n when \"CONTINUE\"\n @state = :WaitingForData\n when \"OK\"\n @state = :WaitingForOk\n end\n end\n case @state\n when :WaitingForData\n case msg[0]\n when \"DATA\"\n chall = msg[1]\n resp, chall = @authenticator.data(chall)\n case resp\n when :AuthContinue\n send(\"DATA\", chall)\n @state = :WaitingForData\n when :AuthOk\n send(\"DATA\", chall)\n @state = :WaitingForOk\n when :AuthError\n send(\"ERROR\")\n @state = :WaitingForData\n end\n when \"REJECTED\"\n next_authenticator\n @state = :WaitingForData\n when \"ERROR\"\n send(\"CANCEL\")\n @state = :WaitingForReject\n when \"OK\"\n send(\"BEGIN\")\n @state = :Authenticated\n else\n send(\"ERROR\")\n @state = :WaitingForData\n end\n when :WaitingForOk\n case msg[0]\n when \"OK\"\n send(\"BEGIN\")\n @state = :Authenticated\n when \"REJECT\"\n next_authenticator\n @state = :WaitingForData\n when \"DATA\", \"ERROR\"\n send(\"CANCEL\")\n @state = :WaitingForReject\n else\n send(\"ERROR\")\n @state = :WaitingForOk\n end\n when :WaitingForReject\n case msg[0]\n when \"REJECT\"\n next_authenticator\n @state = :WaitingForOk\n else\n @socket.close\n return false\n end\n end\n return true\n end", "def socket?() end", "def do_secure(handshake_method, timeout=nil)\n # SSLSocket#connect_nonblock will do the SSL/TLS handshake.\n # TODO(sissel): refactor this into a method that both secure and connect\n # methods can call.\n start = Time.now\n begin\n @socket.send(handshake_method)\n rescue IO::WaitReadable, IO::WaitWritable\n # The ruby OpenSSL docs for 1.9.3 have example code saying I should use\n # IO::WaitReadable, but in the real world it raises an SSLError with\n # a specific string message instead of Errno::EAGAIN or IO::WaitReadable\n # explicitly...\n #\n # This SSLSocket#connect_nonblock raising WaitReadable (Technically,\n # OpenSSL::SSL::SSLError) is in contrast to what Socket#connect_nonblock\n # raises, WaitWritable (ok, Errno::EINPROGRESS, technically)\n # Ruby's SSL exception for 'this call would block' is pretty shitty.\n #\n # So we rescue both IO::Wait{Readable,Writable} and keep trying\n # until timeout occurs.\n #\n \n if !timeout.nil?\n time_left = timeout - (Time.now - start)\n raise SecureHandshakeTimeout.new if time_left < 0\n r, w, e = IO.select([@socket], [@socket], nil, time_left)\n else\n r, w, e = IO.select([@socket], [@socket], nil, timeout)\n end\n\n # keep going if the socket is ready\n retry if r.size > 0 || w.size > 0\n rescue => e\n @logger.warn(e)\n raise e\n end\n\n @secure = true\n end", "def hmac_server; end", "def establish_connection\n LOG.debug self.inspect\n LOG.debug \"establish_connection:\"\n LOG.debug([@config['CONNECTION_HOST'], @config['CONNECTION_PORT']].inspect)\n @socket = TCPSocket.new(@config['CONNECTION_HOST'], @config['CONNECTION_PORT']) # The port should be an arg.\n handshake_data_hash = {:ident => @config['IDENT'], :pid => Process.pid}\n @socket.write_object(handshake_data_hash)\n end", "def negotiate!(socket, timeout); end", "def connection_check\n handle_action_exceptions(__method__) do\n check_connection\n end\n rescue RToolsHCKConnectionError => e\n if @json\n { 'result' => 'Failure', 'message' => e.message }\n else\n puts \"WARNING: #{e.message}\"\n false\n end\n end", "def validate_handshake(handshake, env)\n # is the handshake token expired?\n token_create_time = handshake[:token_create_time]\n raise InvalidHandshake, \"token creation time missing\" unless token_create_time\n now = Time.now.to_i\n token_age = now - token_create_time\n raise InvalidHandshake, \"token has is expired\" unless token_age < @enforced_lifetime\n # ok, we can accept this token, but does the source want us to?\n raise InvalidHandshake, \"token has outlived requested expiration\" if handshake[:requested_lifetime] and token_age > handshake[:requested_lifetime]\n\n # cool, token is not expired\n # is it for the right domain?\n this_request = Rack::Request.new(env)\n raise InvalidHandshake, \"target domain mismatch\" unless handshake[:tgt_domain] == env['HTTP_HOST'] || this_request.host\n\n # it's FOR the right domain\n # is it FROM the right domain?\n # SKIP THIS CHECK\n # 'referrer' is not reliable, is up to the client to send, and we may not always be coming from a redirect\n # raise InvalidHandshake, \"source domain mismatch\" unless handshake[:src_domain] == URI::parse(this_request.referrer).host\n\n # finally, is this the same client that was associated with the source session?\n # this really should be the case unless some shenanigans is going on (either somebody is replaying the token\n # or there is some client balancing or proxying going on)\n raise InvalidHandshake, \"client ip mismatch\" unless handshake[:request_ip] = this_request.ip\n end", "def chap_login(session,new_body)\n authen_start = session.authen_start\n new_body.server_msg = \"Username or password incorrect.\"\n\n if (!authen_start.header.minor_version_one?) # requires minor version 1\n new_body.status_fail!\n new_body.server_msg = \"Client sent malformed packet to server for CHAP login. \" +\n \"Minor version in TACACS+ header should be 1 but was #{authen_start.header.minor_version}.\"\n @tacacs_daemon.log(:error,['msg_type=Authentication', \"message=#{new_body.server_msg}\",\"status=#{new_body.xlate_status}\"],authen_start,@peeraddr)\n elsif (authen_start.body.user_len != 0 && authen_start.body.data_len != 0)\n # get ppp_id, challenge, and response. ppp_id = 1 octet, response = 16 octets, challenge = remainder\n challenge_len = authen_start.body.data_len - 17\n ppp_id = authen_start.body.data[0].chr\n challenge = authen_start.body.data[1,challenge_len]\n response = authen_start.body.data[challenge_len+1, authen_start.body.data_len-1]\n\n username = authen_start.body.user\n user = @tacacs_daemon.users(username) if (username)\n if (user && user.login_password)\n if (Digest::MD5.digest(ppp_id + user.login_password + challenge) == response)\n if (user.login_password_expired?)\n new_body.status_fail!\n new_body.server_msg = @tacacs_daemon.password_expired_prompt\n elsif (user.login_acl)\n match_results = user.login_acl.match(@peeraddr)\n if ( match_results[:permit] )\n new_body.status_pass!\n new_body.server_msg = \"\"\n else\n new_body.status_fail!\n new_body.server_msg = \"Authentication denied due to ACL restrictions on user.\"\n @tacacs_daemon.log(:info,['msg_type=Authentication', 'message=User attempted CHAP login to restricted device.',\"status=#{new_body.xlate_status}\"],authen_start,@peeraddr)\n end\n\n elsif (@tacacs_daemon.default_policy == :deny)\n new_body.status_fail!\n new_body.server_msg = \"Authentication denied due to ACL restrictions on user.\"\n @tacacs_daemon.log(:info,['msg_type=Authentication', 'message=CHAP login denied due to default policy.',\"status=#{new_body.xlate_status}\"],authen_start,@peeraddr)\n\n else\n @tacacs_daemon.log(:info,['msg_type=Authentication', 'message=CHAP login permitted due to default policy.',\"status=#{new_body.xlate_status}\"],authen_start,@peeraddr)\n new_body.status_pass!\n new_body.server_msg = \"\"\n end\n else\n new_body.status_fail!\n end\n else\n new_body.status_fail!\n end\n\n else\n new_body.status_fail!\n new_body.server_msg = \"Client requested CHAP login without providing both username and password.\"\n @tacacs_daemon.log(:warn,['msg_type=Authentication', \"message=#{new_body.server_msg}\",\"status=#{new_body.xlate_status}\"],authen_start,@peeraddr)\n end\n\n if (new_body.status_pass?)\n @tacacs_daemon.log(:warn,['msg_type=Authentication', 'message=Authentication successful.',\"status=#{new_body.xlate_status}\"],authen_start,@peeraddr)\n end\n\n return(nil)\n end", "def test_connection\n response = send_api_request(:index)\n response[:returncode]\n end", "def test_connection\n response = send_api_request(:index)\n response[:returncode]\n end", "def connection_status_mcnet_login; end", "def accept( &block )\n # Start by accepting a connection:\n @connection = @server.accept\n\n # The first request ever should be the handshake:\n http_request = \"\"\n while line = @connection.gets and line != \"\\r\\n\" do\n http_request += line\n end\n \n # If it contains a secret key, use it to send the appropriate\n # handshake response:\n if matches = http_request.match( /^Sec-WebSocket-Key: (\\S+)/ ) then\n @connection.write \"HTTP/1.1 101 Switching Protocols\\n\" +\n \"Upgrade: websocket\\n\" +\n \"Connection: Upgrade\\n\" +\n \"Sec-WebSocket-Accept: \" +\n Digest::SHA1.base64digest(\n [ matches[ 1 ], \"258EAFA5-E914-47DA-95CA-C5AB0DC85B11\" ].join\n ) +\n \"\\n\\n\"\n \n # If it doesn't, close the connection and move on:\n else\n @connection.close\n return\n end\n\n # Now, let's start reading the real data from the websocket:\n loop do\n type, data = read true\n\n # Stop on connection closing:\n break if type == :closed\n\n # Make sure the block can handle the textual or binary data:\n if [ :text, :binary ].include? type then\n yield type, data\n end\n end\n end", "def print_shake\n puts \"SHAKE SHAKE SHAKE\"\n end", "def post_init\n if incoming?\n begin_handshake\n end\n rescue Exception\n log.fatal { \"Error in #post_init\" }\n p $!; puts *$@\n end", "def connection\n begin\n connection = nextPendingConnection\n url = nil\n body = \"\"\n headers = \"\"\n while connection.isOpen\n if connection.canReadLine\n line = connection.readLine.to_s\n if line =~ /(GET|POST)\\s+(.*)\\s+HTTP/\n url = Qt::Url.new($2)\n break\n else\n break # some kind of error?\n end\n else\n connection.waitForReadyRead(100)\n end\n end\n \n while connection.isOpen\n if connection.canReadLine\n line = connection.readLine.to_s\n if line.chomp == \"\"\n break\n else\n headers << line\n end\n else\n connection.waitForReadyRead(100)\n end\n end\n \n if connection.isOpen\n body = connection.readAll.to_s\n end\n \n if url && url.path =~ /\\/turtle\\/(.*)/\n command = $1\n param = URI.decode(url.encodedQuery.to_s)\n if command == \"init_turtle\"\n @turtle.init_turtle\n connection.write validResponse(\"OK\")\n elsif command == \"command_turtle\"\n @turtle.command_turtle(param)\n connection.write validResponse(\"OK\")\n elsif command == \"background\"\n @turtle.background(param)\n connection.write validResponse(\"OK\")\n elsif command == \"width\"\n connection.write validResponse(@turtle.width)\n elsif command == \"height\"\n connection.write validResponse(@turtle.height)\n else\n connection.write errorResponse\n end\n elsif url && url.path =~ /\\/(.*)/\n command = $1\n if command == \"alert\"\n param = URI.decode(url.encodedQuery.to_s)\n @parent.alert(param)\n connection.write validResponse(\"OK\")\n elsif command == \"ask\"\n param = URI.decode(url.encodedQuery.to_s)\n connection.write validResponse(@parent.ask(param)) \n elsif command == \"append\"\n param = URI.decode(url.encodedQuery.to_s) \n @parent.append(param)\n connection.write validResponse(\"OK\")\n elsif command == \"appendError\"\n param = URI.decode(url.encodedQuery.to_s)\n @parent.appendError(param)\n connection.write validResponse(\"OK\")\n elsif command == \"gets\"\n connection.write validResponse(@parent.gets) \n else\n connection.write errorResponse\n end\n else\n connection.write errorResponse\n end\n\n connection.disconnectFromHost()\n rescue \n puts \"ERROR #{$!}\"\n end\n end", "def on_handshake_failed( fd, endpoint )\n\t\t\tself.log.debug \"Client socket on FD %d handshake failed\" % [ fd ]\n\t\tend", "def connect\n disconnect if connected?\n @socket = TCPSocket.new(@host, @port)\n @socket.setsockopt(::Socket::SOL_SOCKET, ::Socket::SO_KEEPALIVE, true)\n read_line # \"BOB 00.00.0D\"\n read_line # \"OK\"\n self\n end", "def check_login\n action = \"check_login\"\n url = build_url(action)\n\n # Create data for post\n data = post_data(action)\n\n # The raw should be the terminal number on success\n response = parse(ssl_post(url, data)) { |raw| { code: raw[0..6] } }\n success = response[:code] == @options[:terminal_no] ? true : false\n Response.new(\n success,\n \"\",\n response,\n authorization: \"\",\n test: test?\n )\n end", "def attempt_connection\n begin\n response = Net::HTTP.get_response(uri)\n unless response.code == \"200\"\n Puppet.notice \"HTTP request (#{uri}) failed: (#{response.code} #{response.body})\"\n return false\n end\n return true\n rescue Errno::ECONNREFUSED => e\n Puppet.notice \"Unable to establish HTTP connection to '#{uri}'; #{e}\"\n return false\n end\n end" ]
[ "0.7307283", "0.7283943", "0.70012474", "0.67481685", "0.6678453", "0.66775495", "0.66749024", "0.6552309", "0.64215875", "0.6379187", "0.6174187", "0.6080506", "0.6062216", "0.6033216", "0.60274047", "0.59281015", "0.5879561", "0.5857275", "0.58226174", "0.5820995", "0.58109975", "0.5806568", "0.5794682", "0.57479733", "0.5728537", "0.56946486", "0.56518483", "0.5629088", "0.5621956", "0.5607928", "0.5586743", "0.55831003", "0.55784845", "0.55659634", "0.55335975", "0.55261153", "0.5509183", "0.5501973", "0.54915756", "0.54665554", "0.54343605", "0.54109514", "0.53955805", "0.5394319", "0.53724676", "0.5371918", "0.53682864", "0.53392506", "0.53336555", "0.5330161", "0.5329564", "0.5318533", "0.53167516", "0.530452", "0.53042966", "0.53014755", "0.5300449", "0.52925944", "0.52793175", "0.5276589", "0.526948", "0.5259171", "0.5235362", "0.52283686", "0.5224289", "0.5215878", "0.5207608", "0.52056724", "0.5195608", "0.5183801", "0.51836056", "0.5170803", "0.5170571", "0.51491153", "0.5146034", "0.5140926", "0.5121808", "0.511478", "0.5114665", "0.511187", "0.5110948", "0.5110565", "0.51094276", "0.5105208", "0.5098022", "0.5094403", "0.5092475", "0.5080456", "0.5079345", "0.5078627", "0.5078627", "0.50668794", "0.50652957", "0.5053425", "0.50437814", "0.50408167", "0.5039739", "0.5039164", "0.50360507", "0.50323564" ]
0.6641958
7