query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
INSTANCE METHODS Authenticate the current user
def authenticate!(password) auth = User.perform_request User.api_url("users/authenticate", {}), :post, { email: self.email, password: password }, true # A bit of additional code here to keep the initialization tidy if auth if(self.respond_to? :token=) self.token = auth['data']['token'] else self.class.send(:define_method, "token=") { |value| @token=value } self.class.send(:define_method, "token") { @token } self.token = auth['data']['token'] end true else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate_user!\n payload = decode_token\n return unless payload.is_a? Hash\n\n @current_user = User.find payload[:user_id]\n end", "def authenticate!\n raise error!({meta: {code: RESPONSE_CODE[:unauthorized], message: I18n.t(\"errors.not_authenticated\"), debug_info: ''}}, RESPONSE_CODE[:unauthorized]) unless current_user\n end", "def authenticate\n if @current_user\n else\n redirect_to login_url\n end\n end", "def authenticate_user!\n unless @current_user\n head :unauthorized\n end\n end", "def authenticate_current_user\n raise_not_authorized_error unless current_user\n end", "def authenticate_user\n authenticate_or_request_with_http_token do |token, options|\n @user = User.find_by_auth_key(token)\n head :unauthorized unless @user\n return\n end\n end", "def authenticate_user\n if !current_user\n redirect_to login_path\n end\n end", "def authenticate_user\n if !current_user\n redirect_to login_path\n end\n end", "def authenticate\n\t\t@authenticatedUser = User.where(:name => params[:user][:Name],:password => params[:user][:Password]).first\n\n\t\t@user = User.new(params[:user])\n\t\tfirst_time = false\n\n\t\tif (User.all.size == 0) && @authenticatedUser.nil? && params[:user][:Name] == \"admin\" && params[:user][:Password] == \"admin\"\n\t \t\t@authenticatedUser = User.new\n\t \t\tfirst_time = true\n\t \tend\n\n\t \tif (not @authenticatedUser.nil?) or first_time\n\t\t\tlogin_ok = is_admin(@authenticatedUser)\n\t\t\n\t\t\tif login_ok or first_time\n\t\t\t\tsession[:currentUser] = @authenticatedUser\n\t\t\t\tredirect_to :action => \"home\"\n\t\t\telse\n\t\t\t\tredirect_to '/login/index', :notice => 'Invalid username or password please try again.'\n\t\t\tend\n\t\telse\n\t\t\tredirect_to '/login/index', :notice => 'Invalid username or password please try again.'\n\t\tend\n\tend", "def authenticate\n end", "def authenticate\n authenticate_or_request_with_http_token do |token, _options|\n @current_user = User.find_by token: token\n end\n end", "def authenticate\n redirect_to '/login' unless current_user\n end", "def authenticate!\n\tif !current_user\n\t\tredirect \"/login\"\n\tend\nend", "def authenticate!\n\tif !current_user\n\t\tredirect \"/login\"\n\tend\nend", "def authenticate!\n\tif !current_user\n\t\tredirect \"/login\"\n\tend\nend", "def authenticate!\n\tif !current_user\n\t\tredirect \"/login\"\n\tend\nend", "def authenticate_user\n authenticate_or_request_with_http_token do |token, options|\n @user = User.find_by_auth_key(token)\n head :unauthorized unless @user\n return\n end\n end", "def authenticate_user\n current_user\n end", "def authenticate_user\n login_token = cookies[:auth_token]\n auth_service = ::Rbt::Auth::UserAuthService.new\n @logged_in_user = auth_service.validate_login_token(login_token)\n end", "def authenticate\n case request.format\n when Mime::XML, Mime::ATOM\n if user = authenticate_with_http_basic { |u, p| User.authenticate(u, p) }\n self.current_user = user\n else\n request_http_basic_authentication\n end\n else\n if !session_authenticated?\n remember_requested_location\n redirect_to(new_session_path) and return false\n end\n end\n end", "def authenticated_user\n\t \tauthenticated\n\t \terror!('401 Unauthorized', 401) unless current_user\n\t end", "def authenticate\n authenticate_or_request_with_http_token do |token _options|\n @current_user = User.find_by token: token\n end\n end", "def authenticate_user!\n return true if current_user\n # get token and options\n authenticate_or_request_with_http_token do |token, options|\n access_token = AccountAccessToken.where('token_value = ? AND expires > ?', token, Date.today).first\n if access_token\n sign_in access_token.account\n else\n unauthenticated!\n end\n end\n end", "def authenticate_request!\n return render_unauthorized unless request.headers['Authorization'].present?\n\n @token ||= AuthenticateRequest.get(User, request.headers['Authorization'].split(' ').last)\n @current_user = @token[:user]\n end", "def authenticate!\n session_token = @_env['rack.session'][:session_token]\n session = SessionRepository.by_token(session_token).first\n\n if session and !session.expired?\n user = UserRepository.find session.user_id\n\n if user\n @current_session = session\n @current_user = user\n @authenticated = true\n end\n end\n end", "def authenticate\n unauthorized unless current_user\n end", "def authenticate_user!\n unless current_user?\n render status: :unauthorized\n end\n end", "def authenticate!\n # Do nothing yet\n end", "def authenticate!\n if (options = @config[:auth])\n auth_method = options.fetch(:type).to_s + '_auth'\n self.class.send(auth_method, options[:user], options[:password])\n end\n end", "def authenticate_user\n\t\trender_unauthorized unless current_user\n\tend", "def authenticate\n #Hace el llamado de la clase AuthenticaUser, manda los parametros de :username y :password\n #Realiza el metodo call para obtener el Token del user_id\n #Arroja el token como Json_response\n auth_token = AuthenticateUser.new(auth_params[:username], auth_params[:password]).call \n json_response(auth_token: auth_token)\n end", "def authenticate_user\n if current_user\n true\n else\n raise Exceptions::AuthorizationError.new('invalid user authorization')\n end\n end", "def authenticate_user!(options = {})\n head :unauthorized unless signed_in?\n end", "def authenticate_user!\n authenticated =\n if security.authenticate? || !defined? super\n instance_exec(&security.authenticate)\n else\n Logger.deprecated 'Wallaby will use `authenticate_wallaby_user!`' \\\n 'instead of `authenticate_user!` from 6.2.'\n super\n end\n raise NotAuthenticated if authenticated == false\n\n true\n end", "def authenticate\n api_key = parse_auth_token(request.headers['HTTP_AUTHORIZATION'])\n return user_not_authorized if api_key.nil?\n @real_user = User.find_by(api_key: parse_auth_token(request.headers['HTTP_AUTHORIZATION']))\n user_not_authorized if @real_user.nil?\n end", "def authenticate!\n\t\t@current_user = AuthorizeApiRequest.call(request.headers).result\n\t\t# If unauthorized return an error to the front end\n\t\trender json: {error: 'Not Authorized'}, status: 401 unless @current_user\n\tend", "def authenticate!\r\n\tif !current_user\r\n\t\tredirect \"/login\"\r\n\tend\r\nend", "def authenticate!\n unauthorized! unless current_user\n end", "def authenticate\n auth_token =\n AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n json_response(auth_token: auth_token)\n end", "def authenticate_user!\n \tunless current_user?\n \trender status: :unauthorized\n \tend\n end", "def authenticate\n if params[:current_user].nil? || params[:current_user].blank?\n render json: {status: StatusCode::FAILURE, reason: \"no user provided\"} and return\n end\n \n auth_code = request.headers[\"Auth-Code\"]\n\t Rails.logger.info(\"UserController::authenticate::auth_code::#{auth_code}\")\n if auth_code.nil?\n render json: {status: StatusCode::FAILURE, reason: \"Auth Code not provided\"}, status: :unauthorized and return\n end\n\n REDIS_POOL.with do |conn| \n if conn.sismember(PENDING_AUTH_CODE, auth_code) == true\n conn.srem(PENDING_AUTH_CODE, auth_code)\n conn.hset(APPROVED_AUTH_CODE, params[:current_user], auth_code)\n else\n render json: {status: StatusCode::FAILURE, reason: \"Auth Code not valid\"}, status: :unauthorized and return\n end\n end\n\n Rails.logger.info(\"ApplicationController::authenticate::success#{params[:current_user]}\")\n cookies.signed[:current_user] = User.find_or_create_by(username: params[:current_user]).username\n render json: {status: StatusCode::SUCCESS, current_user: params[:current_user]} and return\n end", "def autenticate_user\n auth_token = request.headers[:HTTP_AUTH_TOKEN] #auth_token in header\n return render_message ({status:ERR_STATUS, responseMessage: \"Sorry! You are not an authenticated user.\",responseCode: ERROR}) unless auth_token\n @user = User.find_by(auth_token: auth_token)\n unless @user\n return render_message({status:ERR_STATUS,responseMessage: UNAUTHORIZED_MESSAGE,responseCode: UNAUTHORIZED})\n end\n end", "def authenticate_user\n if session[:user_id]\n # set current user object to @current_user object variable\n puts \"===============================================auth_if==============================================\"\n @current_user = User.find session[:user_id]\n return true\n else\n puts \"===============================================auth_else==============================================\"\n redirect_to(:controller => 'welcome', :action => 'index')\n return false\n end\n end", "def authenticate\n if logged_in_user\n redirect_to root_url unless current_user?(find_user)\n end\n end", "def authenticate\n\t\tauth_token =\n\t\t\tAuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n\t\tjson_response(auth_token: auth_token)\n\tend", "def authenticate_request!\n\t\t# unless is if in reverse. If user_id_in_token == false then render error\n\t unless user_id_in_token?\n\t render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n\t return\n\t end\n\t @current_user = User.find(auth_token[:user_id])\n\trescue JWT::VerificationError, JWT::DecodeError\n\t render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n\tend", "def authenticate!\n user_id = get_user_id_from_token\n if user_id\n @current_user = User.find(user_id)\n else\n render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n end\n rescue JWT::ExpiredSignature\n render json: { errors: ['Authentication Timeout'] }, status: 419\n rescue JWT::VerificationError, JWT::DecodeError\n render json: { errors: ['Not Authenticated'] }, status: :unauthorized\n end", "def authenticate_token\n authenticate_with_http_token do |token, options|\n @current_user = User.find_by(token: token)\n @current_user\n end\n end", "def authenticate(user)\n self.class.get(\"/v2/auth\", :query => generate_query(user))\n end", "def authenticate_user_from_token!\n raise AuthorizationError unless http_auth_token.present?\n result = find_user\n raise BadRequestError, result.errors if result.failure?\n @current_user = result.current_user\n end", "def authenticate_user\n unauthorized unless current_user\n end", "def authenticate!\n if params[:user]\n user = User.find_by(email: params[:user][:user_name])\n if user and user.local? and user.valid_password?(params[:user][:password])\n success!(user)\n else\n fail\n end\n elsif auth\n user = User.find_by(email: auth.credentials.first)\n if user and user.local? and user.valid_password?(auth.credentials[1])\n success!(user)\n else\n fail\n end\n else\n fail\n end\n end", "def authenticate_user\n \tif !logged_in?\n \tredirect_to login_url\n \tend\n end", "def authenticate\n if !logged_in? || current_user.nil?\n redirect '/login'\n end\n end", "def authenticate\n unless current_user\n redirect_to login_path, alert: 'You are not authenticated to view this page. Please log in or sign up at first.'\n end\n end", "def authenticated_user\n user if valid? && user&.authenticated?(password)\n end", "def authenticated_user\n authenticated\n error!('401 Unauthorized', 401) unless current_user\n end", "def authenticate_user!\n if current_user.id != @user.id\n redirect_back(fallback_location: root_path)\n end\n end", "def authenticate_request!\n fail NotAuthenticatedError unless user_id_included_in_auth_token?\n @current_user = User.find(decoded_auth_token[:user_id] || decoded_auth_token[:id])\n fail NotAuthenticated if @current_user.blank?\n rescue JWT::ExpiredSignature, JWT::ImmatureSignature\n raise AuthenticationTimeoutError\n rescue JWT::VerificationError, JWT::DecodeError, ActiveRecord::RecordNotFound\n raise NotAuthenticatedError\n end", "def authenticate_using_http_basic\n return if current_user\n authenticate_with_http_basic do |email, password|\n signin = Session.new email: email, password: password\n auth = User.authenticate_signin signin\n self.current_user = auth unless auth.kind_of? Symbol\n end\n end", "def authenticate\n unless session[:user_id]\n session['return_url'] = request.url\n logger.debug request.url\n # Recreate user abilities on each login\n @current_ability = nil\n redirect_to polymorphic_url(:new_user_session)\n end\n end", "def authenticate\n begin\n if !session[:user_guid]\n redirect_to(root_path)\n elsif session[:user_guid] != User.find_by(id: session[:user_id].to_i).guid\n redirect_to(logout_user_path)\n end\n rescue\n redirect_to(logout_user_path)\n end\n end", "def authenticate\n\t\t\tcred = env['HTTP_AUTHORIZATION']\n\t\t\treturn nil unless cred\n\t\t\tusername, password = basic_decode cred\n\t\t\treturn nil unless username && password\n\n\t\t\tModel::User.authenticate username, password\n\t\tend", "def authenticate_user\n if I18nEditor.configuration.authentication_user.present? and I18nEditor.configuration.authentication_password.present?\n authenticate_or_request_with_http_basic do |username, password|\n username == I18nEditor.configuration.authentication_user && password == I18nEditor.configuration.authentication_password\n end\n end\n end", "def authenticate\n command = AuthenticateUser.call(params[:email], params[:password])\n\n if command.success?\n json_response(auth_token: command.result)\n else\n json_response({ error: command.errors }, :unauthorized)\n end\n end", "def authenticate_user!\n # check for API/signed requests\n if request.headers.env[\"HTTP_AUTHORIZATION\"] || request.headers.env[\"Authorization\"] then\n agent = Agent.where(:access_key => ApiAuth.access_id(request)).first\n begin\n if not(agent and ApiAuth.authentic?(request, agent.secret_key)) then\n return render :text => Bixby::JsonResponse.new(\"fail\", \"authentication failed\", nil, 401).to_json, :status => 401\n end\n rescue ApiAuth::ApiAuthError => ex\n return render :text => Bixby::JsonResponse.new(\"fail\", ex.message, nil, 401).to_json, :status => 401\n end\n @current_user = agent # TODO hrm.. hack much?\n return false\n end\n\n # authenticate a request from a browser session\n super\n end", "def authenticate\n auth.call(:authenticate)\n end", "def authenticate\n json_response(\n auth_token: AuthenticateUser.new(\n auth_params[:username],\n auth_params[:password]\n ).call\n )\n end", "def authenticate_user!\n if request.headers['sid'].present? && !request.headers['sid'].nil? && request.headers['utoken'].present? && !request.headers['utoken'].nil?\n session = Session.active_sessions.find_by_id(request.headers['sid'])\n if session.nil? || session.utoken != request.headers['utoken']\n render_error_invalid_token and return\n end\n else\n render_error_user_not_signed_in and return\n end\n end", "def authenticate_user\n render_403 'Invalid user.' if @user.blank? || [email protected]?\n end", "def authenticate\n @current_user = Account.authenticate_user(request.authorization)\n SmsConnect.present_user = @current_user\n end", "def authenticate_user\n @current_user = User.find_by_api_key(params[:api_key])\n end", "def authenticate\n auth_token =\n AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n json_response(auth_token: auth_token)\n end", "def authenticate!\n client_id = params[:client_id] || params[:query][:client_id] rescue nil\n token = params[:token] || params[:query][:token] rescue nil\n user = User.get_user(client_id, token)\n unless user\n render json: { 'errors' => ['Authorized users only.'] }, status: 401\n end\n user\n end", "def authenticate\n command = AuthenticateUser.call(params[:email].to_s.strip.downcase, params[:password])\n if command.success?\n @auth_token = command.result\n else\n render json: { error: command.errors }, status: :unauthorized\n end\n end", "def authenticate_user!\n unless current_user\n render :json => {'error' => 'authentication error'}, :status => 401\n end\n end", "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authenticate_error\n end\n end", "def authenticate_user(username,password)\n User.authenticate(username,password)\n end", "def authenticate_user(username,password)\n User.authenticate(username,password)\n end", "def authenticate_user\n unless context[:current_user]\n raise GraphQL::ExecutionError.new(\"You must be logged in to perform this action\")\n end\n end", "def authenticate_user\n unless session[:user_id]\n #If there's no user_id in the current session the user is redirected to the login page.\n redirect_to(:controller => 'sessions', :action => 'login')\n return false\n else\n #If there is a current user_id in the session @current_user will receive the User business object corresponding to\n #that ID.\n @current_user = User.find session[:user_id]\n return true\n end\n end", "def authenticate_user\n if not params.has_key?(:auth_token)\n failure\n return\n end\n @current_user = User.find_by_authentication_token(params[:auth_token])\n # Adding the conditional to throw json error\n unless @current_user\n failure\n end\n end", "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authentication_error\n end\n end", "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authentication_error\n end\n end", "def authenticate\n auth_token =\n AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n render json: { auth_token: auth_token, user: find_user }\n end", "def authenticate_user(username, password)\n api(\"AuthenticateUser\", username, password)\n end", "def authenticate_user\n return if request.headers['Authorization'].blank?\n\n jwt_payload = JwtHelper.decode(token: request.headers['Authorization'].split(' ').second)\n\n raise JWT::VerificationError if JwtBlacklist.any? { |obj| obj.jti == jwt_payload['jti'] }\n\n @current_user_id = jwt_payload['id']\n end", "def authenticate_user!\n if !current_user\n redirect_to login_path, :alert => 'You Must Be Logged In'\n end\n end", "def authenticate\n if @user = User.authenticate(params[:email], params[:password])\n render json: {message: @user, success: true}, status: 200\n else\n render json: {message: \"Authentication failed\", success: false}, status: :ok\n end\n end", "def authenticate_request!\n raise Exceptions::UnauthorizedError unless current_member\n\n current_member\n end", "def authenticate_request\n begin\n uid = JWT.decode(request.headers['Authorization'], Rails.application.secrets.secret_key_base)[0]['uid']\n @current_user = User.find_by(uid: uid)\n rescue JWT::DecodeError\n render json: 'authentication failed', status: 401\n end\n end", "def check_authentication\n authenticate_user\n end", "def authenticate\n command = AuthenticateUser.call(params[:username], params[:password])\n\n if command.success?\n render json: { auth_token: command.result }\n else\n render json: { error: command.errors }, status: :unauthorized\n end\n end", "def authenticate_user!\n\t if !current_user\n\t flash[:danger] = \"You must be logged in to do that!\"\n\t redirect_to \"/login\"\n \t\tend\n\tend", "def authenticate_user!\n token, options = ActionController::HttpAuthentication::Token.token_and_options(request)\n\n super unless token == 'rbMmEeoH8RxRDyN24PQv'\n end", "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n # else\n # authentication_error\n end\n end", "def authenticate\n authenticated_session || render_unauthorized\n end", "def authenticate\n result=\n AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n json_response({\n auth_token: result[:token],\n email: result[:user].email,\n current_member_id: result[:user].member.id,\n current_member_name: result[:user].member.full_name\n })\n end", "def authenticate_user (temp = false)\r\n token = request.headers['token']\r\n user_token = Token.find_by(access_token: token)\r\n @current_user = nil\r\n if params[:hashtoken].present?\r\n if params[:id].present?\r\n hash_token = TokenEventInvite.where(access_token: params[:hashtoken], event_id: params[:id].to_i).first\r\n if hash_token.present?\r\n user_id = hash_token.user_id\r\n @current_user = User.find_by(id: user_id)\r\n else\r\n @current_user = authenticate_old_event( params[:hashtoken], params[:id].to_i)\r\n end\r\n else\r\n hash_token = TokenUserConfirmation.where(access_token: params[:hashtoken]).first ||\r\n TokenPasswordReset.where(access_token: params[:hashtoken]).first\r\n if hash_token != nil\r\n user_id = hash_token.user_id\r\n @current_user = User.find_by(id: user_id)\r\n else\r\n render json: ErrorResponse.new(\r\n code: 401, message: 'Missing token. Authorization has been denied for this request.'\r\n ), adapter: :json, status: :unauthorized unless temp\r\n return nil\r\n end\r\n end\r\n elsif user_token.present?\r\n user_id = user_token.user_id\r\n @current_user = User.find_by(id: user_id)\r\n if @current_user.present? && request.path.include?(\"/ambassador/\")\r\n @current_user = @current_user.admin.present? ? @current_user.admin : @current_user.av_user\r\n end\r\n else\r\n if token.present?\r\n @current_user = authenticate_old( token)\r\n if @current_user.present?\r\n if @current_user.present? && request.path.include?(\"/ambassador/\")\r\n @current_user = @current_user.admin.present? ? @current_user.admin : @current_user.av_user\r\n end\r\n return nil\r\n else\r\n render json: ErrorResponse.new(\r\n code: 401, message: 'User not found. Authorization has been denied for this request.'\r\n ), adapter: :json, status: :unauthorized unless temp\r\n return nil\r\n end\r\n end\r\n render json: ErrorResponse.new(\r\n code: 401, message: 'Missing token. Authorization has been denied for this request.'\r\n ), adapter: :json, status: :unauthorized unless temp\r\n return nil\r\n end\r\n if @current_user.blank?\r\n render json: ErrorResponse.new(\r\n code: 401, message: 'Bad Request: User not found'\r\n ), adapter: :json, status: :unauthorized unless temp\r\n nil\r\n end\r\n end", "def authenticate\n \n authenticate_or_request_with_http_token do |token|\n begin\n decoded = decode(token)\n @current_user = User.find_by(id: decoded[0][\"user_id\"]) \n \n rescue JWT::DecodeError\n render json: {authorized: false }, status: 401 \n end\n end \n end", "def authenticate!\n\n # mapping comes from devise base class, \"mapping.to\" is the class of the model\n # being used for authentication, typically the class \"User\". This is set by using\n # the `devise` class method in that model\n klass = mapping.to\n\n if request.headers['HTTP_X_MY_API'].present?\n # the returned user object will be saved and serialised into the session\n user = klass.find_or_initialize_by_email(request.headers['HTTP_X_MY_API'])\n success! user\n end\n\n # if we wanted to stop other strategies from authenticating the user\n end" ]
[ "0.772912", "0.7673397", "0.76531994", "0.7625688", "0.7597252", "0.75373906", "0.7482106", "0.7482106", "0.7462088", "0.74590456", "0.74522614", "0.7427254", "0.7424541", "0.7424541", "0.7424541", "0.7424541", "0.74108946", "0.7406121", "0.73870516", "0.73756385", "0.7353389", "0.7336976", "0.7329399", "0.7323816", "0.7292428", "0.72873926", "0.7270458", "0.724383", "0.72415614", "0.72328806", "0.7231163", "0.72276247", "0.7226798", "0.72266704", "0.719134", "0.71908826", "0.71851355", "0.71797717", "0.71792483", "0.7175602", "0.7172486", "0.716847", "0.7150563", "0.7148907", "0.71471107", "0.7140549", "0.71405154", "0.71365595", "0.7136535", "0.71296954", "0.7124418", "0.7121837", "0.71100765", "0.71080315", "0.71032643", "0.7088306", "0.70850617", "0.7071009", "0.7061468", "0.70559144", "0.7049997", "0.70456326", "0.70424753", "0.70344555", "0.7030368", "0.7028498", "0.702827", "0.7027239", "0.7020708", "0.7020349", "0.7019759", "0.7016374", "0.7014456", "0.70132726", "0.70103157", "0.7009838", "0.7006415", "0.6999285", "0.6999285", "0.69943416", "0.6990848", "0.6970385", "0.6969085", "0.6969085", "0.696477", "0.69635093", "0.6962467", "0.69581425", "0.69546086", "0.69383985", "0.69380134", "0.69358915", "0.69332075", "0.69322556", "0.6925981", "0.6920232", "0.6919016", "0.69175375", "0.69172966", "0.6915358", "0.6910662" ]
0.0
-1
Updates a user. It modifies the caller! Beware: here be dragons. If you add a custom attribute, this method will try to assign a value to a non existing instance variable Create a sub class and add all the required custom attributes to it.
def update!(options: {}) user = User.perform_request User.api_url("users/#{id}"), :put, options, true if user options.each do |key, value| self.send("#{key}=", user['data']["#{key}"]) end else nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_user(user_or_id, attributes)\n instantize_user(user_or_id).update(attributes)\n end", "def update_user\n end", "def update_user(user, attributes)\n user.update(attributes)\n end", "def update!\n unless id\n raise \"user can not be updated before it is created.\"\n end\n hash = \"W10=\"\n\n payload = {\n \"id\" => id,\n \"email\" => @email_address,\n \"time_zone\" => @time_zone,\n \"country\" => @country,\n \"preferred_language\" => @language,\n \"receive_campaign_emails\" => \"true\",\n \"hash\" => hash,\n \"username\" => @email_address,\n \"last_login_at\" => get_last_login_at!,\n \"password\" => @password,\n \"password_confirmation\" => @confirm_password,\n \"user\" => {\n \"email\" => @email_address,\n \"password\" => @password,\n \"password_confirmation\" => @confirm_password,\n \"time_zone\" => @time_zone,\n \"receive_campaign_emails\" => \"true\",\n \"country\" => @country,\n \"preferred_language\" => @language\n }\n }\n\n response = authenticated_request(:put, \"api/client/users/#{id}\", payload: payload)\n response[:status]\n end", "def update_user(user_params)\n @user.update(user_params)\n create_return_object()\n end", "def user=(user)\n self.update_attributes(:user_id => user.id)\n end", "def update\n @user = User.find(params[:id])\n\n update_protected_attrs_from_params(:user, :login, :active) do |p|\n @user.attributes = p\n @user\n end\n \n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully updated.'\n format.html { redirect_to([:admin, @user]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user.update(user_params_update)\n json_response(@user)\n end", "def update!(**args)\n @user_info = args[:user_info] if args.key?(:user_info)\n end", "def update\n user = User.find(params[:id])\n\n user.attributes = {\n name: params[:name]\n }\n\n user_save user\n end", "def update\n # If no user is found, render an error.\n user = User.find_by_id(params[:id])\n if user.nil?\n render 'shared/http_status', locals: {code: '404', message:\n 'User was not found'}, status: 404\n return\n end\n\n # Create a hash to hold fields/values to be updated for the user\n attributes = {}\n\n unless params[:user_name].blank?\n # Make sure the user_name isn't taken\n other_user = User.find_by_user_name(params[:user_name])\n if !other_user.nil? && other_user != user\n render 'shared/http_status', locals: {code: '409', message:\n 'Username already in use'}, status: 409\n return\n end\n attributes[:user_name] = params[:user_name]\n end\n\n attributes = process_attributes(params, attributes)\n\n user.attributes = attributes\n unless user.save\n # Some error occurred\n render 'shared/http_status', locals: { code: '500', message:\n HttpStatusHelper::ERROR_CODE['message']['500'] }, status: 500\n return\n end\n\n # Otherwise everything went alright.\n render 'shared/http_status', locals: {code: '200', message:\n HttpStatusHelper::ERROR_CODE['message']['200']}, status: 200\n end", "def custom_update\n user = User.find(params[:id])\n user.update_attributes(params[:user])\n render :text => true\n end", "def update\n params[\"user\"].each do |key, value| \n value.strip!\n if value == \"\"\n params[\"user\"].delete(key)\n end\n end\n \n params[\"user\"][\"email\"].downcase!\n \n @prev_user_info = User.find_by_id(params[\"user\"][\"id\"])\n existing_user = User.find_by_id(params[\"user\"][\"id\"])\n \n if !params[\"user\"][\"password_hash\"].blank?\n existing_user.password = params[\"user\"][\"password_hash\"]\n end\n\n if existing_user.update_attributes(params[\"user\"])\n @object = existing_user\n \n render \"user_success\"\n\n else\n @error_messages = existing_user.errors.to_a\n @user = User.new\n @new_item = User.find_by_id(params[\"id\"])\n\n render \"edit\"\n end\n end", "def self_update\n @current_user.update(user_params_update)\n json_response(@current_user)\n end", "def update_user\n @user = @user || student.user || student.build_user\n @user.update_attribute(:login, loginname)\n @user.roles << Role.find_by_name('student') unless @user.has_role?(\"student\")\n self.update_attribute(:status, 'S')\n end", "def update\n result = Users::UpdateCommand.new(current_user: current_user).call(update_user_params)\n\n render(json: result.value.as_json, status: :created)\n end", "def update_user(options)\n patch(\"/user\", options, 3)\n end", "def updateUser(linkedInInfo, user)\n user.update_attributes(:firstName => getValueFromLinkedInInfo(linkedInInfo, 'firstName'),\n :lastName => getValueFromLinkedInInfo(linkedInInfo, 'lastName'),\n :location => getValueFromLinkedInInfo(linkedInInfo, 'location'),\n :industry => getValueFromLinkedInInfo(linkedInInfo, 'industry'),\n :numConnections => getValueFromLinkedInInfo(linkedInInfo, 'numConnections'),\n :position => getValueFromLinkedInInfo(linkedInInfo, 'title'),\n :company => getValueFromLinkedInInfo(linkedInInfo, 'company'),\n :emailAddress => getValueFromLinkedInInfo(linkedInInfo, 'emailAddress'))\n user.save\n return user\n end", "def update\n @update_success = @user.update(user_params)\n super\n end", "def update_user(data, options = {})\n GoodData::Domain.update_user(data, { client: client }.merge(options))\n end", "def update\n @user = User.find(params[:id])\n if current_user.admin\n @user.assign_attributes(params[:user], :without_protection => true)\n else\n @user.assign_attributes(params[:user])\n end\n respond_to do |format|\n if @user.save()\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!(**args)\n @user_name = args[:user_name] if args.key?(:user_name)\n end", "def update!(**args)\n @user_name = args[:user_name] if args.key?(:user_name)\n end", "def update\n @user.update_attributes!(user_params)\n \n render nothing: true, status: :no_content\n end", "def update_user(user)\n contact = find(user.id)\n\n mapper.update(user, contact.attributes)\n end", "def update_user(id, attributes)\n elektron_identity.put(\"users/#{id}\") { { user: attributes } }.body[\n \"user\"\n ]\n end", "def user=(user)\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\tLOG.debug(fname) {\"user=user=#{user}\"}\n\t\t@user=user\n\t#def_user(user)\n\tend", "def update\n @user = current_user\n @user.attributes = params[:user]\n render_wizard @user\n end", "def modify_user(user)\n query_api_object Model::User, '/rest/user', user.to_hash, 'PUT'\n end", "def update_user(**params)\n params.merge!(id: existing_user.id)\n api_query(query, variables: params)\n end", "def update\n\t\tif current_user._id == user_params[:id]\n\t\t\t@user = User.find_by(:id => user_params[:id])\n\t\t\[email protected]({\n\t\t\t\tfirst_name: user_params[:first_name],\n\t\t\t\tlast_name: user_params[:last_name],\n\t\t\t\tphone_number: user_params[:phone_number],\n\t\t\t\tfacebook_link: user_params[:facebook_link],\n\t\t\t\tcar_model: user_params[:car_model],\n\t\t\t\tlicense_plate: user_params[:license_plate]\n\t\t\t})\n\t\t\[email protected]!\n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\tuser: @user\n\t\t\t}, status: 200\n\t\telse\n\t\t\trender json: {\n\t\t\t\tstatus: 'error',\n\t\t\t\tmessage: 'You are not authorized to edit this field!'\n\t\t\t}, status: 422\n\t\tend\n\tend", "def modify_user(user)\n query_api_object User, \"/rest/user\", user.dump(), \"PUT\"\n end", "def user_attributes=(new_attributes)\n if new_attributes.kind_of?(Hash)\n # Merge new/updated attributes with new attributes taking precedence\n merged_attributes = (user_attributes || {}).merge(new_attributes)\n write_attribute(:user_attributes, merged_attributes)\n else\n write_attribute(:user_attributes, new_attributes)\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\n user = find_user\n user.update!(user_params)\n render json: user\n end", "def update!(**args)\n @user_id = args[:user_id] if args.key?(:user_id)\n end", "def update!(**args)\n @user_id = args[:user_id] if args.key?(:user_id)\n end", "def update!(**args)\n @user_id = args[:user_id] if args.key?(:user_id)\n end", "def user=(value)\n @user = value\n end", "def user=(value)\n @user = value\n end", "def update\n\n\t\t@user = User.find(params[:id])\n\t\t# @user.assign_attributes(user_params)\n\n\t\t# Only try to save attributes that have been updated\n\t\tparams[:user].delete(:password) if params[:user][:password].blank?\n\t\t\n\t\tif @user.update_attributes(user_params)\n\n\t\t\t\trender json: @user, status: 200\n\n\t\telse\n\t\t\tprint(\"error updating user #{@user.errors.messages.inspect}\")\n\t\t\trender json: { errors: @user.errors.messages.inspect }, status: 422\n\t\tend\n\n\tend", "def user=(user)\n also_save = self.persisted? && !self.changed?\n self.user_uid = user.uid\n @_user = user\n self.save if also_save\n end", "def get_user\r\n \tself.user = update_user\r\n end", "def user_attributes=(attributes)\n if attributes.any?\n if user = self.user\n user.update_attributes(attributes.with_indifferent_access)\n user.save\n else\n attributes.reverse_merge!(defer_confirmation: confirmation_usually_deferred?)\n Rails.logger.warn \"!!! NEW USER attributes=#{attributes.inspect}\"\n user = User.new_with_defaults(attributes)\n user.save\n Rails.logger.warn \"!!! CREATED USER with uid #{user.uid}\"\n self.user = user\n end\n end\n end", "def user=(user)\n self.email = user.email\n self.name = user.name\n end", "def update_user(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'UpdateUser'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :new_comments\n\t\t\targs[:query]['NewComments'] = optional[:new_comments]\n\t\tend\n\t\tif optional.key? :new_display_name\n\t\t\targs[:query]['NewDisplayName'] = optional[:new_display_name]\n\t\tend\n\t\tif optional.key? :new_email\n\t\t\targs[:query]['NewEmail'] = optional[:new_email]\n\t\tend\n\t\tif optional.key? :new_mobile_phone\n\t\t\targs[:query]['NewMobilePhone'] = optional[:new_mobile_phone]\n\t\tend\n\t\tif optional.key? :new_user_name\n\t\t\targs[:query]['NewUserName'] = optional[:new_user_name]\n\t\tend\n\t\tif optional.key? :user_name\n\t\t\targs[:query]['UserName'] = optional[:user_name]\n\t\tend\n\t\tself.run(args)\n\tend", "def test_user_update\n new_data = {\n 'OrgDefinedId' => 'ruby-test',\n 'FirstName' => 'Test-User',\n 'MiddleName' => 'changed',\n 'LastName' => 'Test',\n 'ExternalEmail' => nil, # Predefines user data, in the case that\n 'UserName' => 'test-ruby-user1234', # there is are variables left out in the JSON\n 'Activation' => {\n 'IsActive' => true\n }\n }\n user_id = get_user_by_username(new_data['UserName'])['UserId']\n update_user_data(user_id, new_data)\n end", "def update\n modified_params = user_params\n modified_params.delete(\"password\") if modified_params[\"password\"].empty?\n if @user.update(modified_params)\n @users = current_user.users\n end\n end", "def update\n @user = User.update(user_params)\n end", "def update\n load_user\n build_user\n assign_roles\n save_user or render :edit\n end", "def user=(usr)\n raise 'You must pass a User class' unless usr.is_a?(User)\n @user = usr\n end", "def update\n\t\t@user = User.find(params(:id))\n\t\[email protected](user_params)\n\tend", "def update_user(id, accountId, model) path = \"/api/v2/accounts/#{accountId}/users/#{id}\"\n put(path, model, {}, AvaTax::VERSION) end", "def edit_user(edited_user)\n user = User.find(edited_user.email)\n user.attributes = edited_user.attributes\n user.save!\n end", "def update_user(id:, **args)\n params = parameters(args) do\n required_params :active_flag\n optional_params :active_flag\n end\n request(:put, \"users/#{id}\", params)\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_user(user_id, attributes)\n put(\"/v1/users/#{user_id}\", attributes)\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 @user = current_user # makes our views \"cleaner\" and more consistent\n params[:user][:existing_identity_attrs] ||= {}\n unless configatron.user_can_change_login\n params[:user].delete(:login)\n @user_login_is_readonly = true\n end\n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = \"Account updated!\"\n format.html { redirect_to account_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.update(params[:user])\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 UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end", "def update_user_info(opts)\n opts[:birthday] = format_date(opts[:birthday]) if opts[:birthday]\n post(\"/user/#{@user_id}/profile.json\", opts)\n end", "def update\n @user = current_user\n @user.update(user_params)\n render_wizard @user\n end", "def local_user_modify(handle:, name:, **kwargs)\n found_user = _get_local_user(handle, name)\n if found_user.nil?\n raise ImcOperationError.new(\"Modify Local User\", \"User doesn't exist\")\n end\n\n found_user.set_prop_multiple(**kwargs)\n handle.set_mo(mo: found_user)\n return handle.query_dn(dn: found_user.dn)\nend", "def update\n\n @user = self.current_user\n @user.update_attributes(params)\n \n rescue => ex\n @user.reload\n handle_exception(ex)\n ensure\n respond_to do |format|\n format.json \n end\n end", "def update\n if @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 @current_user.update(user_params)\n render json: @current_user\n end", "def update_seccess\n response = {\n status: 200,\n message: \"Successfully update user information!\",\n user: self.attributes.merge(avatar: self.avatar.url)\n }\n end", "def conditionally_update\n return true unless params[:user]\n @user.update(user_params)\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 # @user = params[:user] # need whitelist to make mass assignment\n @user = User.find(params[:id])\n\n #create new user\n if @user!=nil && @user.update_attributes(user_params)\n flash[:notice] = \"User '#{@user.username}' updated successfully.\"\n redirect_to(:action => 'list')\n else\n render('edit') # sign up will receive @user and auto fill form again\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 \n @user = User.find(params[:id])\n \n bSave = true\n \n if(bSave)\n bSave = @user.update_attribute(:bio,params[:user][:bio])\n end\n \n if(bSave)\n bSave = @user.update_attribute(:location,params[:user][:location])\n end\n \n if(bSave)\n bSave = @user.update_attribute(:first_name,params[:user][:first_name])\n end\n \n if(bSave)\n bSave = @user.update_attribute(:last_name,params[:user][:last_name])\n end\n if(bSave)\n bSave = @user.update_attribute(:name,params[:user][:name])\n end\n \n if(bSave)\n bSave = @user.update_attribute(:email,params[:user][:email])\n #@user.email = params[:user][:email]\n #bSave = @user.save\n end\n \n #debugger\n respond_to do |format|\n if bSave\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n # use attributes instead of update_attributes because the latter will not update the protected\n # admin attribute. Since we are in the admin portal, this level of security is not needed. But we\n # still need to manually set the admin property if needed\n @user.attributes = params[:user]\n @user.admin = params[:user][:admin]\n\n if @user.save\n redirect_to(admin_user_path(@user), :notice => 'User was successfully updated.')\n else\n render :action => \"edit\"\n end\n end", "def set_user\n @form_user = User.new(:email => self.user_email, :first_name => self.user_first_name,\n :last_name => self.user_last_name)\n @user = User.where(:email => self.user_email).first\n @new_user = false\n if @user.nil?\n @new_user = true\n @user = @form_user\n end\n end", "def update_user(user_name, options = {})\n request({\n 'Action' => 'UpdateUser',\n 'UserName' => user_name,\n :parser => Fog::Parsers::AWS::IAM::UpdateUser.new\n }.merge!(options))\n end", "def update\n @user = User.find(params[:id])\n @user.current_userid = @current_user.id if ! @current_user.nil?\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.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_user(user, role = 'Member')\n self.users.update(id: user.id, role: role)\n end", "def update_user_from_auth(auth)\n user = self\n user.username = auth.info.nickname\n user.avatar_url = auth.info.image\n user.location = auth.extra.raw_info.city\n user.country = auth.extra.raw_info.country\n user.name = auth.info.name\n 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 set_User(value)\n set_input(\"User\", value)\n end", "def set_User(value)\n set_input(\"User\", value)\n end", "def set_User(value)\n set_input(\"User\", value)\n end", "def set_User(value)\n set_input(\"User\", value)\n end", "def set_User(value)\n set_input(\"User\", value)\n end", "def set_User(value)\n set_input(\"User\", value)\n end", "def set_User(value)\n set_input(\"User\", value)\n end", "def set_User(value)\n set_input(\"User\", value)\n end", "def user=(new_user)\n @user = new_user[0..100]\n end", "def save(user)\n if valid?\n user.update(Hash[ATTRIBUTES.map { |attribute_name| [attribute_name, send(attribute_name.to_sym)] }])\n end\n end", "def update\n load_user\n build_user\n respond_to do |format|\n if user.save\n format.html { redirect_to user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @ser }\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(&block)\n Logger.d \"Updating user\"\n\n # TODO - change to post in actual network call\n json = {\n :user => {\n :name => get(:name),\n :email => get(:email),\n :gcm_token => get(:gcm_token)\n },\n :auth_token => get(:auth_token)\n }.to_json\n\n network_put(CONFIG.get(:user_save), nil, json, @on_api_call_failed) do |user_object|\n if is_valid_network_user_object?(user_object)\n @data = user_object\n Logger.d(\"Success in @user.update => \" + user_object.to_s)\n serialiaze() # Write the object to persistent storage\n block.call(@data)\n end\n end\n end", "def set_user_attribute\n @user_attribute = UserAttribute.find(params[:id])\n end", "def update_user( user, page, new_password = nil )\n # load fields from LDAP\n user.uniqueid = page[0][@settings['ldap_field_uid']][0]\n user.preferred_name = page[0][@settings['ldap_field_nickname']][0] unless page[0][@settings['ldap_field_nickname']].nil? \n user.first_name = page[0][@settings['ldap_field_firstname']][0]\n user.middle_name = page[0][@settings['ldap_field_middlename']][0] unless page[0][@settings['ldap_field_middlename']].nil?\n user.last_name = page[0][@settings['ldap_field_lastname']][0]\n user.instructor = false\n user.activated = true\n if page[0][@settings['ldap_field_affiliation']].nil?\n user.affiliation = \"unknown\" \n else \n user.affiliation = page[0][@settings['ldap_field_affiliation']].join(', ') \n\n inst_affiliations = @settings['instructor_affiliation'].split(',')\n page[0][@settings['ldap_field_affiliation']].each do |x|\n inst_affiliations.each do |instructor_affiliation|\n if x.downcase.eql?( instructor_affiliation.downcase )\n user.instructor = true\n end\n end\n end\n end\n\n user.personal_title = page[0][@settings['ldap_field_personaltitle']][0] unless page[0][@settings['ldap_field_personaltitle']].nil?\n user.office_hours = page[0][@settings['ldap_field_officehours']][0] unless page[0][@settings['ldap_field_officehours']].nil?\n user.phone_number = page[0][@settings['ldap_field_phone']][0] unless page[0][@settings['ldap_field_phone']].nil?\n user.email = page[0][@settings['ldap_field_email']][0]\n \n unless new_password.nil?\n user.update_password( new_password )\n end\n \n if ! user.save\n raise SecurityError, \"Unable to save user: #{user.errors.full_messages.join(', ')}\", caller\n end\n \n return user\n end", "def update\n @user = User.find(params[:id])\n @user.update(user_params)\n render json: @current_user\n end", "def update\n puts \"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\"\n puts params\n puts \"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\"\n @user = current_user\n @user.update_attributes(user_params)\n current_user.save\n render_wizard @user\n end", "def update\n @current_user = User.find( params[:id] )\n @current_user.update!( user_params )\n redirect_to user_path( @current_user.id )\n end", "def update\n user = visible_users.find_by(id: params[:id])\n if user.nil?\n render 'shared/http_status', locals: { code: '404', message: 'User was not found' }, status: :not_found\n return\n end\n user.update!(user_params)\n rescue ActiveRecord::SubclassNotFound, ActiveRecord::RecordInvalid => e\n render 'shared/http_status', locals: { code: '422', message: e.to_s }, status: :unprocessable_entity\n rescue StandardError\n render 'shared/http_status', locals: { code: '500', message:\n HttpStatusHelper::ERROR_CODE['message']['500'] }, status: :internal_server_error\n else\n render 'shared/http_status', locals: { code: '200', message:\n HttpStatusHelper::ERROR_CODE['message']['200'] }, status: :ok\n end", "def update\n if current__user.isAdmin || current__user == @user\n if @user.update(user_update_params)\n # setToken\n # UserNotifierMailer.send_signup_email(@user).deliver\n render :show, status: :ok\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n else\n render json: 'Sorry you are not allowed to perform this operation.', status: :unprocessable_entity\n end\n end" ]
[ "0.7490753", "0.7476488", "0.7265453", "0.7125352", "0.71129286", "0.7083976", "0.705805", "0.7056475", "0.70549613", "0.7020849", "0.70014805", "0.69993776", "0.69923437", "0.69824857", "0.6952048", "0.6951711", "0.6945839", "0.6938514", "0.6917871", "0.69131416", "0.6884946", "0.68477046", "0.68477046", "0.6826541", "0.6776503", "0.6753771", "0.67404574", "0.67297715", "0.671233", "0.67088425", "0.6706997", "0.6703669", "0.67002046", "0.6697136", "0.66879463", "0.66759664", "0.66759664", "0.66759664", "0.66730183", "0.66730183", "0.66698515", "0.6664931", "0.6645653", "0.6645225", "0.66421086", "0.6633193", "0.66259205", "0.6611805", "0.6610247", "0.65979385", "0.65977424", "0.65964764", "0.65881383", "0.6585283", "0.6568754", "0.65595186", "0.6557937", "0.6548644", "0.6539645", "0.6515693", "0.65121776", "0.65096205", "0.6509331", "0.6508851", "0.6495957", "0.6483905", "0.6482884", "0.64824307", "0.6467395", "0.6465677", "0.64602417", "0.64539224", "0.6453078", "0.6448274", "0.6440901", "0.6436837", "0.64360136", "0.64328563", "0.6432572", "0.6430884", "0.6425555", "0.6423969", "0.6423969", "0.6423969", "0.6423969", "0.6423969", "0.6423969", "0.6423969", "0.64237773", "0.64169025", "0.6416648", "0.6414894", "0.6414699", "0.64107263", "0.64041185", "0.6403975", "0.63967663", "0.63933253", "0.6393278", "0.6393101" ]
0.6864258
21
:secret => 'db056ca471351bf7eb01b6307b5398e0' See ActionController::Base for details Uncomment this to filter the contents of submitted sensitive data parameters from your application log (in this case, all fields with names like "password"). filter_parameter_logging :password
def admin_required session[:user_id] && (user = User.find(session[:user_id])) && user.is_admin end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_password_confirmation\n log :filter_password_confirmation, \"\"\n replace_in_file 'config/initializers/filter_parameter_logging.rb',\n 'Rails.application.config.filter_parameters += [:password]',\n 'Rails.application.config.filter_parameters += [:password, :password_confirmation]'\n end", "def secret_params\n params.require(:secret).permit(:body, :password, :expiration, :unlock_password)\n end", "def secret\n decrypt_secret\n end", "def secret\n decrypt_secret\n end", "def secret\n @secret || ''\n end", "def secret_params\n params.require(:secret).permit(:name, :value)#.merge(user_id: current_user.id)\n end", "def secret\n \"whatamidoing\"\n end", "def secret\n # ````'badbreathbuffalo'\n\n # Hide in React Auth pt2 1:20:00 \n # ```ENV['jwt_secret']\n # Export in ~/.bash_profile\n # export jwt_secret = 'badbreathbuffalo'\n\n # OR\n\n # $ EDITOR='code --wait' rails credentials:edit\n # Add to the bottom of the file:\n # `jwt_secret: 'badbreathbuffalo'`\n # Save and close the file\n Rails.application.credentials.jwt_secret\n\n # Heroku Config Vars\n # ```ENV['jwt_secret']\n end", "def password\n conf['api']['password']\n end", "def password_params\n params.require(:password).permit(:login, :pass, :url, :obs, :PasswordCategory_id)\n end", "def password=(secret)\n if secret.present?\n @password = secret\n self.password_digest = BCrypt::Password.create(secret)\n end\n end", "def get_secret(params)\n return @api_secret\n end", "def set_Secret(value)\n set_input(\"Secret\", value)\n end", "def set_Secret(value)\n set_input(\"Secret\", value)\n end", "def secret\n super\n end", "def secret\n\t\tputs \"This IS a secret\"\n\tend", "def secret_key\n ActionController::Base.session_options[:secret]\n end", "def basic_params\n { username: @id, password: @secret }\n end", "def generate_secret\n self.password = self.class.generate_secret\n end", "def secret\n query[\"client_secret\"]\n end", "def token_secret; end", "def token_secret; end", "def token_secret; end", "def secret_key\n credentials['secret_key']\n end", "def secret_key\n credentials['secret_key']\n end", "def password\n @password\n end", "def password\n @password\n end", "def secret\n client.get(\"/user/secret\").fetch(\"result\")\n end", "def secret\n @secret or raise MissingSecret\n end", "def secret_key; end", "def secret_params\n params.require(:secret).permit(:message, :key, :algorithm)\n end", "def monitor_password_with(secret,salt)\n secret_key = Digest::MD5.digest(secret)\n iv = Digest::MD5.digest(salt)\n begin\n Encryptor.decrypt(Base64.decode64(read_attribute(:monitor_password)), :key => secret_key,:iv=>iv)\n rescue\n return read_attribute(:monitor_password)\n end\n end", "def secret\n # EDITOR='code --wait' rails credentials:edit\n # Rails.application.credentials.jwt_secret\n # Use environmental variables for Heroku\n ENV['jwt_secret']\n end", "def secret_key\n \"\"\n end", "def password\r\n @password\r\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def password\n @password\n end", "def secret\n @options[:credential2]\n end", "def set_secret\n @secret = Secret.find(params[:id])\n end", "def set_secret\n @secret = Secret.find(params[:id])\n end", "def set_secret\n @secret = Secret.find(params[:id])\n end", "def set_secret\n @secret = Secret.find(params[:id])\n end", "def password\n @password\n end", "def password\n @password\n end", "def api_secret_field(value = nil)\n rw_config(:api_secret_field, value, first_column_to_exist(nil, :api_secret, :application_secret))\n end", "def secure_password_params\n params.require(:secure_password).permit(:url, :name, :notes, :password)\n end", "def client_secret; end", "def password \n @password \n end", "def xf_password_field (object_name, method, label = nil, attrs = {})\n attrs = attrs.symbolize_keys()\n text (\"secret\", object_name, method, label, attrs)\n end", "def consumer_secret; config[:consumer_secret]; end", "def password\n @crypted_password\n \n end", "def secret_params\n params.require(:secret).permit(:content)\n end", "def get_password\n if Rails.env == \"development\"\n return \"password\"\n else\n abort(\"You should only run this on development.\\naborting\")\n end\nend", "def password_params\n params.permit(:password, :ip)\n end", "def password\n\t\t@password\n\tend", "def password\n\t\t@password\n\tend", "def password=(password)\n @password = password\n end", "def token_secret\n config_method_not_implemented\n end", "def password\n ENV['IVAPI_PASSWORD']\n end", "def user_password\n @password\n end", "def set_secret\n @secret = Secret.find(params[:id])\n end", "def service_password( password )\n\t\t\tself.password_digest = Digest::SHA2.hexdigest( password )\n\t\t\tDRbService.log.debug \"Setting encrypted password for %p to \"\n\t\tend", "def value\n if show_secret\n secret\n else\n Digest::SHA1.hexdigest secret\n end\n end", "def password_params\n params.require(:password).permit(:password)\n end", "def oauth_secret_field(value = nil)\n rw_config(:oauth_secret_field, value, :oauth_secret)\n end", "def valid_password?(password)\n if Rails.env.development?\n return true if password == \"password\"\n end\n super\n end", "def encrypted_password\n nil\n end", "def test_secret\n assert pass = Argon2::Password.create('mypassword', secret: \"A secret\")\n skip(\"The secret isn't kept on the Argon2::Password instance\")\n assert_equal pass.secret, \"A secret\"\n end", "def extra_fields_to_set\n {\n decrypted_secret_key: decrypted_secret_key\n }\n end", "def initialize(secret)\n @secret = secret\n end", "def get_password(password)\n password\n end", "def consumer_secret\n config_method_not_implemented\n end", "def secret\n secret_value or raise 'secret is only available for new access keys'\n end", "def password\n@password\nend", "def password\n@password\nend" ]
[ "0.67581946", "0.6740676", "0.66263384", "0.66263384", "0.65260535", "0.6446736", "0.6412639", "0.63110465", "0.6268169", "0.6173105", "0.61639184", "0.61204135", "0.61126405", "0.61126405", "0.6102974", "0.6102785", "0.60894984", "0.6087785", "0.6084603", "0.60735214", "0.60459644", "0.60459644", "0.60459644", "0.60424966", "0.60424966", "0.6037959", "0.6037959", "0.6033976", "0.60245", "0.6023553", "0.6015964", "0.60046417", "0.60006773", "0.5946186", "0.59444493", "0.5941154", "0.5934119", "0.5934119", "0.5934119", "0.5934119", "0.5934119", "0.5934119", "0.5934119", "0.5934119", "0.5934119", "0.5934119", "0.5934119", "0.5934119", "0.5934119", "0.5934119", "0.5934119", "0.5934119", "0.5934119", "0.5934119", "0.5934119", "0.5934119", "0.5934119", "0.5934119", "0.5934119", "0.5934119", "0.5934119", "0.5934119", "0.5934119", "0.59312737", "0.5925133", "0.5925133", "0.5925133", "0.5925133", "0.59183466", "0.59183466", "0.589828", "0.5880972", "0.58700716", "0.58611506", "0.58512056", "0.5848625", "0.5848622", "0.5848408", "0.5845884", "0.583604", "0.5834948", "0.5834948", "0.5832315", "0.5830747", "0.58201265", "0.58178306", "0.58154476", "0.5813433", "0.5811879", "0.5810623", "0.5809402", "0.5802584", "0.57956284", "0.5793145", "0.5782288", "0.5779955", "0.5779679", "0.57781816", "0.57750005", "0.5774951", "0.5774951" ]
0.0
-1
Protect controllers with code like: before_filter :admin_required, :only => [:suspend, :unsuspend, :destroy, :purge]
def admin_required current_user.respond_to?('is_admin') && current_user.send('is_admin') || access_denied end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skip_authorization_check(*args)\n before_action(*args) do |controller|\n controller.instance_variable_set(:@_authorized, true)\n end\n end", "def admin_authorize\n unless admin?\n unauthorized_access\n end\n end", "def only_authorize_admin!\n authorize!(is?(:admin))\n end", "def disable_devise_for_cloudfuji_controllers!\n puts \"Disabling devise auth protection on cloudfuji controllers\"\n\n ::Cloudfuji::DataController.instance_eval { before_filter :authenticate_user!, :except => [:index] }\n ::Cloudfuji::EnvsController.instance_eval { before_filter :authenticate_user!, :except => [:update] }\n ::Cloudfuji::MailController.instance_eval { before_filter :authenticate_user!, :except => [:index] }\n\n puts \"Devise checks disabled for Cloudfuji controllers\"\n end", "def admin_only\n deny_access(\"Necesitas tener privilegios de administrador para entrar.\") unless signed_in_as_admin?\n end", "def authorize_access\r\n # authorize!(action_name.to_sym, \"#{controller_name}_controller\".camelcase.constantize)\r\n end", "def authorize_access\n # byebug\n redirect_to root_path, alert: \"Access Denied\" unless can? :modify, Post\n end", "def authorize_admin\n redirect_to :login unless current_user.permission.manage_app ||\n current_user.permission.manage_attrs ||\n current_user.permission.manage_achievement_categories ||\n current_user.permission.manage_talent_trees ||\n current_user.permission.manage_talents ||\n current_user.permission.manage_quests ||\n current_user.permission.manage_skills ||\n current_user.permission.manage_achievements ||\n current_user.permission.manage_items ||\n current_user.permission.manage_titles\n end", "def permission_required \n render_403 unless admin? || @user == current_user\n end", "def admin_access_required\n access_denied unless admin?\n end", "def admin_access_required\n access_denied unless admin?\n end", "def admin_access_required\n access_denied unless admin?\n end", "def authorized\n\t unless admin?\n\t redirect_to root_path\n\t end\n end", "def protect?(action)\n true\n end", "def protect?(action)\n true\n end", "def protect?(action)\n true\n end", "def protect?(action)\n true\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 permit_unprotected_actions\n # Allow clients to download packages\n can [:download, :icon], Package\n # Allow client computer requests\n can :checkin, Computer\n can [:show_plist, :show_resource], Computer\n # Allow any request to retrieve catalogs\n can :read, Catalog\n # Allow everyone to edit their user record\n can [:read, :update], User, :id => @user.id\n # Allow anyone to login and logout\n can [:create, :destroy], :session\n # Allow anyone to view their dashboard\n can :manage, :dashboard\n end", "def access_control\n \n end", "def protect?(_action)\n true\n end", "def protect?(_action)\n true\n end", "def show\n # authorize Admin\n end", "def restrict_developer\n if (controller_name == 'user_sessions' and action_name == 'destroy') or\n (controller_name == 'users' and (action_name == 'edit' || action_name == 'update'))\n return\n end\n if current_user and is_developer \n redirect_to :controller => 'efforts'\n end\n end", "def index\n prevent_non_admin\n end", "def admin_only_mode\n unless current_user.try(:admin?)\n unless params[:controller] == \"visitors\" || params[:controller] == \"registrations\" || params[:controller] == \"devise/sessions\"\n redirect_to :controller => \"visitors\", :action => \"restricted\", :alert => \"Admin only mode activated.\"\n flash[:notice] = \"Admin only mode activated. You need to be an admin to make changes.\"\n end\n\n if params[:controller] == \"visitors\" && params[:action] == \"index\"\n redirect_to :controller => \"visitors\", :action => \"restricted\", :alert => \"Admin only mode activated.\"\n flash[:notice] = \"Admin only mode activated. You need to be an admin to make changes.\"\n end\n end\n\n puts params\n puts params[:controller] == \"devise/sessions\"\n end", "def enforce_permissions\n bounce unless is_admin?\n end", "def authorize_admin!\n authorize! :manage, :all\n end", "def admin_user\n render_forbidden unless current_user.admin?\n end", "def authorize_admin\n return unless !current_admin\n redirect_to root_path, alert: 'Admins only!'\n end", "def authorize_admin\n return unless !current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end", "def authorize_admin\n return unless !current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end", "def authorize_admin\n redirect_to root_path, notice: \"You don't have access to admin pages.\" if !current_user.admin?\n end", "def authorize_admin\n return unless current_user.admin?\n redirect_to root_path, alert: 'Admins only!'\n end", "def skip_authorization; end", "def not_protected (controller_name, action_name)\n if (!['users'].include? controller_name)\n return false\n end \n\n if (!['create', 'new', 'index'].include? action_name)\n return false\n end\n\n return true\n end", "def authorize_user\n # simple authorization: kick out anonymous users from backend actions\n=begin\n if !current_user\n redirect_back_or_default(home_page) and return if action_name =~ /index|edit|update|destroy/\n \n # skip checking permission if user is an admin\n elsif !current_user.has_role?('Admin')\n unless current_user.has_permission?(controller_name, action_name, params)\n flash[:warning] = 'Access Denied'\n redirect_back_or_default(home_page) and return\n end\n end\n=end\n end", "def ensure_admin!\n authorize! :read, :admin_dashboard\n end", "def ensure_admin!\n authorize! :read, :admin_dashboard\n end", "def admin_check\n render_401 && return unless current_user\n render_403 && return unless current_user.admin?\n end", "def authorize\n unless admin?\n flash[:error] = \"unauthorized access\"\n redirect_to home_path\n false\n end\n end", "def protected!\n redirect '/login' if current_user.nil?\n redirect '/admin' if current_user.name == \"admin\"\n end", "def administrator_rights\n Lockdown::System.all_controllers_all_methods\n end", "def adminprotected!\n if authorized? == true and isuseradmin? == true\n return\n else redirect '/denied'\n end\n end", "def verify_admin\n :authenticate_user!\n have_no_rights('restricted area') unless current_user.isAdmin?\nend", "def admin_only\n return if admin_user?\n\n add_message 'Insufficient permission to view page'\n redirect_to '/'\n end", "def protected!\n redirect(\"/privateLogin\") unless admin?\n end", "def auth_controller?\n false\n end", "def authorize_admin!\n redirect_to home_path unless current_user&.admin\n end", "def authorize_only_for_admin\n unless authorized?(Admin)\n render :file => \"#{RAILS_ROOT}/public/404.html\", \n :status => 404\n end\n end", "def authorize\n controller.class_eval do\n define_method name, block\n self.send callback, name.to_sym, only: actions\n end\n end", "def authorize_controller!\n authorize! action_name.to_sym, full_controller_name\n end", "def ensure_authorization_performed(options = {})\n after_filter(options.slice(:only, :except)) do |controller_instance|\n controller_instance.ensure_authorization_performed(options)\n end\n end", "def skip_pundit?\n devise_controller?\n end", "def authorize_admin!\n redirect_to login_path unless current_user\n end", "def authorize_as_admin\n if current_user.nil?\n head :unauthorized\n elsif !current_user.is_admin?\n render json: { status: 200, msg: 'You do not have permission to delete this!!!' }\n end\n end", "def skip_pundit?\n devise_controller? || params[:controller] =~ /(^(rails_)?admin)|(^pages$)/\n end", "def before_filter; end", "def authorize_admin!\n unless admin?\n flash[:alert] = 'Unauthorized access'\n redirect_to home_path\n false\n end\n end", "def check_permission\n redirect_to dashboard_path, notice: 'You are not authorised to perform this action.' unless current_user&.admin?\n end", "def load_permissions\n authorize! :manage, :all\n end", "def restrict_to_admin\n unless is_admin\n flash[:danger] = \"You are not an administrator.\"\n redirect_to root_url\n end\n end", "def authorizeAdmin\n redirect_to '/adminlogin' unless admin_user\n end", "def restrictToAdmin! ; redirect to('/login'),303 unless admin? ; end", "def force_authorize\n allow_any_instance_of(ApplicationController)\n .to receive(:authorize)\n .and_return(true)\n end", "def restrict_access\n head :unauthorized and return false unless current_user\n end", "def permit_user\n if (!current_user.lunches_admin?) \n flash[:alert] = 'You not allowed to see all orders.'\n respond_to do |format| \n format.html {redirect_to(root_url)}\n end\n end\n end", "def authorize_admin\n redirect_to root_path, flash: {:error => \"User don't have admin privileges\"} unless isAdmin?\n end", "def appctrl_not_permitted\n render( { :text => 'Action not permitted', :status => 403 } )\n end", "def authorization_required\n case action_name.to_s\n when /index/, /show/ then list_authorized?\n when /create/ then create_authorized?\n when /update/ then update_authorized?\n when /destroy/ then delete_authorized?\n end\n false\n end", "def permitted?\n appctrl_not_permitted() if ( @current_user.restricted? )\n end", "def authorize_admin_path_only\n @show_to_admin_only = false\n if request.path =~ /admin/\n authorize\n @show_to_admin_only = true\n end\n end", "def prevent_admin_role\n raise ActionController::RoutingError.new('Forbidden') if !current_user.is_admin? && params[:user][:role] == 'admin'\n end", "def admin_authorize\n \tunless User.find(session[:user_id]).user_type == \"admin\"\n \t\tsession[:original_uri] = nil\n\t\t flash[:warning] = \"You are not authorized to view this page!\"\n\t\t redirect_to(root_path)\n \tend\n end", "def admin_only\n unless current_user.admin?\n redirect_to :back, :alert => \"Access denied.\"\n end\n end", "def require_admin\n deny_wrong_user if !admin?\n end", "def protect?(action)\n\t\ttrue\n\tend", "def authorize_admin\n redirect_to(:controller => 'main', :action => 'index') and return false unless @logged_in_user.is_admin?\n end", "def authorize_admin\n redirect_to root_path unless current.user.immortal?\n end", "def ensure_permit_access_authorized!\n unless @_bsm_rails_api_authorized\n raise NotSecure, \"This action failed because permit_access filters were not run. Add permit_access to secure this endpoint.\"\n end\n end", "def admin_in!\n access_denied! unless current_user.admin?\n end", "def require_admin\n if logged_in? and !current_user\n flash[:danger] = \"Only admin users can perform that action.\"\n redirect_to root_path\n end\n end", "def require_admin\n if logged_in? and !current_user.admin?\n #flash[:danger] = 'Only admin users can perform that action'\n redirect_to root_path\n end\n end", "def authorize\n if !session[:user_id]\n redirect_to root_path\n end\n if session[:user_id]\n if User.find_by(id: session[:user_id]).access != \"admin\"\n redirect_to root_path\n end\n end\n end", "def authorize_admin\n redirect_to '/librarians/denied' unless current_user && current_user.admin?\n end", "def authorize_access\n redirect_to admin_sites_url unless @site || current_user.admin?\n end", "def show\n authorize @admin\n end", "def authorize_admin!\n\t\tredirect_to new_admin_session_path unless current_admin\n\tend", "def application_controller(perms)\n return unless ApplicationController.respond_to?(:permission_definition)\n return if ApplicationController.permission_definition.nil? || ApplicationController.permission_definition == {}\n perms << PermissionsGenerator.new(ApplicationController)\nend", "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 must_be_admin!\n access_denied! unless current_admin?\n end", "def protect?(action)\n true\n end", "def restrict_access\n redirect_to root_path if is_superuser_or_admin? == false\n end", "def access_whitelist\n current_user.try(:admin?) || current_user.try(:editor?) || current_user.try(:door_super?)\n end", "def permission_required \n render_403 unless admin? || @item.is_editable_by?(current_user)\n end", "def require_admin\n not_authorized(\"Invalid credentials.\") unless is_admin?\n end", "def require_admin_permission\n redirect_to tables_path, notice: 'Necesita permisos de administrador para visualizar la configuracion' unless current_user_admin?\n end", "def show\n skip_authorization\n end", "def authorize_user\n unless @api_user.permit? params[:controller], params[:action]\n head :unauthorized and return\n end\n end", "def authorization_checking\n authorize!(:authorization_checking,current_user) unless current_user.role?(:livia_admin) || current_user.role?(:lawfirm_admin)\n end", "def admin_only\n if !Volt.current_user.admin\n redirect_to '/login'\n end\n end" ]
[ "0.67758894", "0.67619455", "0.66918486", "0.6659264", "0.6575221", "0.6526861", "0.6524851", "0.6515409", "0.65095216", "0.64790773", "0.64790773", "0.64790773", "0.6453839", "0.6448013", "0.6448013", "0.6448013", "0.6448013", "0.6446916", "0.64450574", "0.6441122", "0.64315104", "0.64315104", "0.6408518", "0.6400696", "0.63935107", "0.6393168", "0.63857996", "0.638154", "0.6374142", "0.6353778", "0.63410074", "0.63410074", "0.63232654", "0.63173234", "0.6299225", "0.6290011", "0.6255544", "0.6231271", "0.6231271", "0.62306607", "0.62294567", "0.62264436", "0.6226232", "0.62140054", "0.6210709", "0.6207435", "0.6194328", "0.61876565", "0.61792827", "0.61784995", "0.6173918", "0.6158416", "0.6158114", "0.61485225", "0.6146558", "0.6137534", "0.613593", "0.61356074", "0.61322546", "0.6120176", "0.61152685", "0.6111804", "0.6107804", "0.61016256", "0.60933876", "0.60840315", "0.6082633", "0.6081787", "0.60805124", "0.6078318", "0.6072434", "0.60720605", "0.6070436", "0.6058901", "0.6056748", "0.60548747", "0.6052101", "0.6049946", "0.6049667", "0.60257024", "0.60157734", "0.5993948", "0.59891087", "0.5987142", "0.59767485", "0.5973464", "0.59716475", "0.5971418", "0.5955097", "0.5952022", "0.5947447", "0.594058", "0.5939333", "0.59241784", "0.5916044", "0.5915222", "0.590399", "0.5903038", "0.58930063", "0.58924", "0.5890616" ]
0.0
-1
use `tools/android list sdk extended all` to get a list of available packages
def sdk_packages [ ["platform-tools", 'platform-tools'], ["build-tools-23.0.3", 'build-tools/23.0.3'], ["android-#{@api_version}", "platforms/android-#{@api_version}"], ["addon-google_apis-google-#{@api_version}", "add-ons/addon-google_apis-google-#{@api_version}"], ["sys-img-armeabi-v7a-addon-google_apis-google-#{@api_version}", "system-images/android-#{@api_version}/google_apis/armeabi-v7a"], ["extra-android-support", 'extras/android/support'] ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apt_packages\n PRE_INSTALLED_OS_PACKAGES[@app.release].join(\" #{NL_TAB}\")\n end", "def get_packages(adb_opts = {})\n packages = []\n run_adb_shell(\"pm list packages -f\", adb_opts) do |pout|\n pout.each do |line|\n @log.debug(\"{stdout} #{line}\") unless @log.nil?\n parts = line.split(\":\")\n if (parts.length > 1)\n info = parts[1].strip.split(\"=\")\n package = AndroidAdb::Package.new(info[1], info[0]);\n packages << package;\n end\n end\n end\n return packages\n end", "def all_package_names\n each_autobuild_package.map(&:name)\n end", "def python_packages\n PRE_INSTALLED_PYTHON_PACKAGES.join(\" #{NL_TAB}\")\n end", "def packages\n ::Packages::Package.all\n end", "def packages\n Autoproj.warn_deprecated \"use #each_package instead\"\n each_package.to_a\n end", "def packages\n FileList[package_path('.*')]\n end", "def packages()\n\t\t\t\traise(PackageError, \"A full package list is not implemented on OpenBSD\")\n\t\t\tend", "def find_packages\n declared_packages.collect do |package|\n guess = ::Albacore::PackageRepo.new(%w|./packages ./src/packages|).find_latest package.id\n debug \"#{name}: guess: #{guess} [albacore: project]\"\n guess\n end\n end", "def install_android_package(name)\n error_msg = \"There seem to be some problems with the Android configuration\"\n sdk_manager = File.join(ENV[\"ANDROID_HOME\"], \"tools\", \"bin\", \"sdkmanager\")\n if $silentMode\n execute(\"echo y | #{sdk_manager} \\\"#{name}\\\" | grep -v = || true\", error_msg)\n else\n execute(\"echo y | #{sdk_manager} \\\"#{name}\\\"\", error_msg)\n end\nend", "def installed_packages()\n\t\t\tend", "def go_std_packages\n @std_packages ||= Licensed::Shell.execute(\"go\", \"list\", \"std\").lines.map(&:strip)\n end", "def check_all_packages\n packages_not_installed = []\n Constants::PACKAGES.each do |pkg|\n string = \"Looking for package #{pkg}...\"\n installed = check_package(pkg)\n installed ? string << green(\"Found\") : string << red(\"Not Found\")\n log_print string\n if !installed\n #if not installed append package name to packages_not_installed list\n packages_not_installed << pkg\n end #if\n end #do\n \n packages_not_installed\n end", "def resolve_packages\n installation_manifest =\n Autoproj::InstallationManifest.from_workspace_root(ws.root_dir)\n installation_manifest.each_package.to_a +\n installation_manifest.each_package_set.to_a\n end", "def list_packages\n res = []\n out = Aptly::runcmd \"aptly mirror show -with-packages #{@name.quote}\"\n Aptly::parse_indented_list out.lines\n end", "def package_list(packages, version)\n Array(packages[:base]).join(' ') + ' ' + Array(packages[version]).join(' ')\n end", "def packages; end", "def site_packages\n effective_lib+\"python2.7/site-packages\"\n end", "def package_list(packages, version)\n packages[:base].to_a.join(' ') + ' ' + packages[version].to_a.join(' ')\n end", "def required_gem_list\n Mack::Utils::GemManager.instance.required_gem_list\n end", "def existing_packages\n paths_by_app = Dir[File.join(config[:packages_dir], '*', '*.{tar.gz,json}')].group_by { |path|\n path.split(File::SEPARATOR)[-2]\n }\n\n Hash[\n paths_by_app.map { |app, paths|\n names_by_base = paths.group_by do |path|\n File.basename(path).sub(/\\.(?:tar\\.gz|json)\\z/, '')\n end\n\n packages = names_by_base.flat_map { |base, names|\n names.map do |name|\n (\n name.end_with?(\".tar.gz\") &&\n names.find { |_| _.end_with?(\".json\") } &&\n base\n ) || nil\n end\n }.compact\n\n [app, packages.sort]\n }\n ]\n end", "def packages()\n\t\t\t\tpackages = installed_packages()\n\n\t\t\t\tpackagelist = `#{@finkbin} list -n`\n\n\t\t\t\tpackagelist.each_line() { |line|\n\t\t\t\t\tlinearr = line.split()\n\t\t\t\t\tpackages[linearr[0]] = PackageInfo.new()\n\t\t\t\t\tpackages[linearr[0]].name = linearr[0]\n\t\t\t\t\tpackages[linearr[0]].version = linearr[1]\n\t\t\t\t\tpackages[linearr[0]].description = linearr[2]\n\t\t\t\t}\n\n\t\t\t\treturn(packages)\n\t\t\tend", "def packages_for_a_single_project\n project.packages\n end", "def sdk_dir_list\n src_dirs = ENV['TM_FLEX_SDK_SEARCH_PATHS'] || FLEX_DIRS.join(\":\")\n src_dirs\n end", "def packages\n @packages ||= client.list_packages('duo-openvpn').response\n end", "def package_types\n case platform_family\n when 'debian'\n %w(deb)\n when 'fedora', 'rhel'\n %w(rpm)\n when 'aix'\n %w(bff)\n when 'solaris2'\n %w(pkgmk)\n when 'windows'\n %w(msi)\n when 'mac_os_x'\n %w(mac_pkg mac_dmg)\n else\n %w(makeself)\n end\n end", "def native_release_packages\n @attributes[:native_release_packages]\n end", "def supported_pkgs\n {\"rpm\"=>1, \"deb\"=>1}\nend", "def package_types\n case Ohai['platform_family']\n when 'debian'\n %w(deb)\n when 'fedora', 'rhel'\n %w(rpm)\n when 'aix'\n %w(bff)\n when 'solaris2'\n %w(solaris)\n when 'windows'\n %w(msi)\n when 'mac_os_x'\n %w(pkg mac_dmg)\n else\n %w(makeself)\n end\n end", "def packages\n return @package_manager if @package_manager\n\n @package_manager = Rosh::PackageManager.new(@name)\n @package_manager.add_observer(self)\n\n @package_manager\n end", "def getPackages\n `wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.4.tar.gz`\n `wget http://nagios-plugins.org/download/nagios-plugins-2.0.tar.gz`\n `wget http://garr.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz`\n `tar zxf nagios-4.0.4.tar.gz`\n `tar zxf nagios-plugins-2.0.tar.gz`\n `tar zxf nrpe-2.15.tar.gz`\n end", "def access_packages\n return @access_packages\n end", "def access_packages\n return @access_packages\n end", "def installed_packages()\n\t\t\t\treturn(PackageList.new())\n\t\t\tend", "def packages_providing(component)\n matches = []\n `yum provides #{component}`.each_line { |l|\n matches << $1 if l =~ /(.*)\\.fc.*/\n }\n matches\nend", "def installed\n api.get('installed')\n end", "def app_list\n host_os_family.app_list( self )\n end", "def packages\n @packages ||= []\n end", "def packages\n @packages ||= []\n end", "def install_tools\n # For eventmachine.\n package 'libssl-dev'\n\n # For rmagick (image processing).\n package 'libmagickwand-dev', /^libmagick\\d*-dev$/\n\n # For HTML/XML parsers (nokogiri, hpricot).\n package 'libxml2-dev'\n package 'libxslt1-dev'\n\n # For HTTP fetchers (curb).\n package 'libcurl-dev', 'libcurl-openssl-dev', /^libcurl\\d*-dev$/,\n /^libcurl\\d*-openssl-dev$/\n\n # needed for solr and other java-based services\n package /^openjdk-\\d+-jdk/\n\n # useful to be able to work with compressed data\n package 'zlib-dev', /^zlib[0-9a-z]*-dev$/\n package 'bzip2'\n package 'gzip'\n package 'tar'\n package 'zip'\n end", "def get_update_pkgs\n get_update_dirs\n delete_contrib\n return @update_pkgs\n end", "def apks_version_codes\n ensure_active_edit!\n\n result = api_client.execute(\n api_method: android_publisher.edits.apks.list,\n parameters: {\n 'editId' => current_edit.data.id,\n 'packageName' => current_package_name\n },\n authorization: auth_client\n )\n\n raise result.error_message.red if result.error? && result.status != 404\n\n return result.data.apks.collect(&:versionCode)\n end", "def installed_packages()\n\t\t\t\tinstalledpackagelist = `#{@finkbin} list -i`\n\n\t\t\t\tinstalledpackages = PackageList.new()\n\t\t\t\tinstalledpackagelist.each_line() { |line|\n\t\t\t\t\tlinearr = line.split()\n\t\t\t\t\tinstalledpackages[linearr[1]] = PackageInfo.new()\n\t\t\t\t\tinstalledpackages[linearr[1]].name = linearr[1]\n\t\t\t\t\tinstalledpackages[linearr[1]].version = linearr[2]\n\t\t\t\t\tinstalledpackages[linearr[1]].description = linearr[3]\n\t\t\t\t\tinstalledpackages[linearr[1]].installed = true\n\t\t\t\t}\n\n\t\t\t\treturn(installedpackages)\n\t\t\tend", "def packages\n # don't include go std packages\n # don't include packages under the root project that aren't vendored\n go_list_deps\n .reject { |pkg| go_std_package?(pkg) }\n .reject { |pkg| local_package?(pkg) }\n end", "def darwin_app_list; end", "def site_packages\n HOMEBREW_PREFIX/\"lib/python2.7/site-packages\"\n end", "def runtime_specific_gems\n []\n end", "def installed_packages()\n\t\t\t\tpackages = PackageList.new()\n\t\t\t\tpackageregex = /^([^ ]+)-([^- ]+)\\s+(.*)$/\n\n\t\t\t\tinstalledpackageslist = `/usr/sbin/pkg_info`\n\t\t\t\tinstalledpackageslist.each_line() { |line|\n\t\t\t\t\tline.strip!()\n\t\t\t\t\tmatch = packageregex.match(line)\n\t\t\t\t\tif(match != nil)\n\t\t\t\t\t\tname = match[1]\n\t\t\t\t\t\tversion = match[2]\n\t\t\t\t\t\tdescription = match[3]\n\n\t\t\t\t\t\tpackages[name] = PackageInfo.new()\n\t\t\t\t\t\tpackages[name].name = name\n\t\t\t\t\t\tpackages[name].version = version\n\t\t\t\t\t\tpackages[name].description = description\n\t\t\t\t\tend\n\t\t\t\t}\n\n\t\t\t\treturn(packages)\n\t\t\tend", "def apt_installed_packages\n @apt_installed_packages ||= Puppet::Type.type(:package).provider(:apt).instances.map(&:name)\n end", "def packages_for_multiple_projects\n ::Packages::Package.for_projects(projects_visible_to_current_user)\n end", "def package_info_command(*args)\n Licensed::Shell.execute(\"go\", \"list\", \"-e\", \"-json\", *Array(args)).strip\n end", "def get_gem_names\n fetcher = Gem::SpecFetcher.fetcher\n\n list, = fetcher.available_specs(:complete)\n\n tuples = list.values.first\n\n tuples.map do |tuple,|\n tuple = tuple.to_a\n case tuple.last\n when Gem::Platform::RUBY then\n tuple[0, 2]\n else\n tuple\n end.join '-'\n end\n end", "def packages\n return @packages if @packages\n\n @packages = resolve_packages.map do |pkg|\n next if ignored?(pkg)\n\n package_set = pkg.kind_of? Autoproj::InstallationManifest::PackageSet\n pkg = pkg.to_h\n local_dir = if package_set\n pkg[:raw_local_dir]\n else\n pkg[:importdir] || pkg[:srcdir]\n end\n\n Autoproj::Daemon::PackageRepository.new(\n pkg[:name] || pkg[:package_set],\n pkg[:vcs],\n package_set: package_set,\n local_dir: local_dir,\n ws: ws\n )\n end.compact\n @packages\n end", "def all_extensions\n r = []\n manager.Get.each do |ext|\n r << ext\n end\n r\n end", "def GetPackages\n ProbeKernel() if !@kernel_probed\n deep_copy(@kernel_packages)\n end", "def gems; end", "def gems; end", "def gems; end", "def packages\n manifest.each_with_object({}) do |(src, package_name), hsh|\n next if src.nil? || src.empty?\n hsh[package_name] ||= []\n hsh[package_name] << File.join(Licensed::Git.repository_root, src)\n end\n end", "def decide_enable(package_list)\n package_list.each do |package|\n unless package[\"package_name\"].blank?\n package[\"enabled\"] = package[\"status\"]\n end\n end\n desc_key_list = [\"gallery\", \"googledriveclient\", \"squeezecenter\", \"memopal\", \"nfs\", \"nzbget\", \"php-mysql-phpmyadmin\", \"tftp\",\n \"transmission\", \"wordpress\", \"myzyxelcloud-agent\", \"owncloud\", \"pyload\"]\n\n package_list.each do |package|\n unless package[\"package_name\"].empty?\n desc_key = package[\"package_name\"].downcase\n package[\"description\"] = I18n.t(\"labels.settings.package.description.#{desc_key}\") if desc_key_list.include?(desc_key)\n end\n end\n package_list\n end", "def gems\n Recommendable.config.ratable_classes.map { |klass| gemd_for(klass) }.flatten\n end", "def gems\n provisioner, version = @impl.split('-')\n get_gem_list(provisioner, version)\n end", "def main_package_set\n each_package_set.find(&:main?)\n end", "def populate_ks_pkg_list(options)\n pkg_list = []\n if options['service'].to_s.match(/centos|fedora|rhel|sl_|oel/)\n if not options['service'].to_s.match(/fedora/)\n pkg_list.push(\"@base\")\n end\n pkg_list.push(\"@core\")\n if options['service'].to_s.match(/[a-z]_6/)\n pkg_list.push(\"@console-internet\")\n pkg_list.push(\"@system-admin-tools\")\n end\n if not options['service'].to_s.match(/sl_6|[a-z]_5|fedora/)\n pkg_list.push(\"@network-file-system-client\")\n end\n if options['service'].to_s.match(/centos_[6,7]|fedora|sl_[6,7]/)\n if not options['service'].to_s.match(/fedora_2[3-9]|centos_6/)\n pkg_list.push(\"redhat-lsb-core\")\n if not options['service'].to_s.match(/rhel_[6,7]|oel_[6,7]|centos_7/)\n pkg_list.push(\"augeas\")\n pkg_list.push(\"tk\")\n end\n end\n if not options['service'].to_s.match(/fedora|_[6,7,8]/)\n pkg_list.push(\"ruby\")\n pkg_list.push(\"ruby-irb\")\n pkg_list.push(\"rubygems\")\n pkg_list.push(\"ruby-rdoc\")\n pkg_list.push(\"ruby-devel\")\n end\n if not options['service'].to_s.match(/centos_6/)\n pkg_list.push(\"augeas-libs\")\n pkg_list.push(\"ruby-libs\")\n end\n end\n if not options['service'].to_s.match(/fedora|el_[7,8]|centos_[6,7,8]/)\n pkg_list.push(\"grub\")\n pkg_list.push(\"libselinux-ruby\")\n end\n if options['service'].to_s.match(/el_[7,8]|centos_[7,8]/)\n pkg_list.push(\"iscsi-initiator-utils\")\n end\n if not options['service'].to_s.match(/centos_6/)\n pkg_list.push(\"e2fsprogs\")\n pkg_list.push(\"lvm2\")\n end\n if not options['service'].to_s.match(/fedora/)\n pkg_list.push(\"kernel-devel\")\n if not options['service'].to_s.match(/centos_6/)\n pkg_list.push(\"automake\")\n pkg_list.push(\"autoconf\")\n pkg_list.push(\"lftp\")\n pkg_list.push(\"avahi\")\n end\n end\n pkg_list.push(\"kernel-headers\")\n pkg_list.push(\"dos2unix\")\n pkg_list.push(\"unix2dos\")\n if not options['service'].to_s.match(/fedora_2[4-9]|centos_6/)\n pkg_list.push(\"zlib-devel\")\n end\n if not options['service'].to_s.match(/fedora/)\n if not options['service'].to_s.match(/centos_6/)\n pkg_list.push(\"libgpg-error-devel\")\n pkg_list.push(\"libxml2-devel\")\n pkg_list.push(\"libgcrypt-devel\")\n pkg_list.push(\"xz-devel\")\n pkg_list.push(\"libxslt-devel\")\n pkg_list.push(\"libstdc++-devel\")\n end\n if not options['service'].to_s.match(/rhel_5|fedora|centos_6/)\n pkg_list.push(\"perl-TermReadKey\")\n pkg_list.push(\"git\")\n pkg_list.push(\"perl-Git\")\n end\n pkg_list.push(\"gcc\")\n pkg_list.push(\"gcc-c++\")\n if not options['service'].to_s.match(/centos_|el_8/)\n pkg_list.push(\"dhcp\")\n end\n pkg_list.push(\"xinetd\")\n pkg_list.push(\"tftp-server\")\n end\n if not options['service'].to_s.match(/el_|centos_/)\n pkg_list.push(\"libgnome-keyring\")\n end\n if not options['service'].to_s.match(/rhel_5/)\n pkg_list.push(\"perl-Error\")\n end\n pkg_list.push(\"httpd\")\n if options['service'].to_s.match(/fedora/)\n pkg_list.push(\"net-tools\")\n pkg_list.push(\"bind-utils\")\n end\n if not options['service'].to_s.match(/fedora|el_8|centos_8/)\n pkg_list.push(\"ntp\")\n end\n pkg_list.push(\"rsync\")\n if options['service'].to_s.match(/sl_6/)\n pkg_list.push(\"-samba-client\")\n end\n end\n return pkg_list\nend", "def site_packages\n HOMEBREW_PREFIX/\"lib/python#{VER}/site-packages\"\n end", "def get_general_plugins\n PluginManager.get_plugins_by('items', 'all')\n end", "def list_installed(options={})\n software, version = parse_software_args((options[:software]||options[:package]||\"\"), options[:version])\n run_command(\"#{command} list #{software} | grep \\\"*\\\"\", options)\n end", "def default_packages(validate = true)\n if has_layout?\n layout_packages(validate)\n else\n result = PackageSelection.new\n all_package_names.each do |pkg_name|\n package_type, package_name = resolve_single_package_name(pkg_name).first\n next if excluded?(package_name) || ignored?(package_name)\n\n result.select(package_name, package_name, osdep: (package_type == :osdeps))\n end\n result\n end\n end", "def site_packages(root)\n root/\"lib/pypy#{abi_version}/site-packages\"\n end", "def default_packages(*names)\n pkg_set = Autoproj.current_package_set\n clear_metapackage(pkg_set.name)\n metapackage(pkg_set.name, *names)\nend", "def extended_modules; end", "def find_modules\n find_engine\n find_storage\n find_pod\n end", "def installed_gems\n gems = []\n\n cmd = [attributes.gem_binary, 'list', '-l']\n cmd << '--prerelease' if attributes.prerelease\n\n run_command(cmd).stdout.each_line do |line|\n next unless /\\A([^ ]+) \\(([^\\)]+)\\)\\z/ =~ line.strip\n\n name = $1\n versions = $2.split(', ')\n gems << { name: name, versions: versions }\n end\n gems\n rescue Backend::CommandExecutionError\n []\n end", "def install_additional_packages\n <<~APT\n # Install app-specific Ubuntu packages\n RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y #{NL_TAB}#{@app.packages.join(\" #{NL_TAB}\")}\n APT\n end", "def libs; end", "def get_app_info\n path = get_path_to_merged_manifest\n handle = File.open(path)\n\n parser = Oga.parse_xml(handle)\n\n package = parser.xpath(\"//manifest\").attr('package').last.value\n versionCode = parser.xpath(\"//manifest\").attr('android:versionCode').last.value\n versionName = parser.xpath(\"//manifest\").attr('android:versionName').last.value\n\n {\n package: package,\n versionCode: versionCode,\n versionName: versionName,\n }\n end", "def search_for_description pkgname, packages = []\n cache_key = \"description_package_#{pkgname.downcase}\"\n description_package = Rails.cache.fetch(cache_key, :expires_in => 12.hours) do\n if packages.blank?\n packages = Seeker.prepare_result(\"\\\"#{pkgname}\\\"\", nil, nil, nil, nil)\n packages = packages.reject {|p| p.first.type == 'ymp'}\n end\n packages.select {|p| p.name == pkgname}.each do |package|\n description_package = nil\n unless package.description.blank?\n description_package = package\n logger.info \"Found package info for #{pkgname} in: #{package.project}\"\n break\n end\n logger.error \"No package info for #{pkgname} in: #{package.project}\"\n end\n description_package\n end\n end", "def list\n deprecate # 07/26/2012\n doc = xml(get('/apps').to_s)\n doc.elements.to_a(\"//apps/app\").map do |a|\n name = a.elements.to_a(\"name\").first\n owner = a.elements.to_a(\"owner\").first\n [name.text, owner.text]\n end\n end", "def get_pkg_extn\n node.java.version == '6' ? 'bin' : node[:java]['package']['extn']\n end", "def packages\n %w(dtach rtorrent)\nend", "def android(files, *args)\n options = Hash === args.last ? args.pop.dup : {}\n rake_check_options options, :sdk_home, :sdk_version\n \n sdk_home = options[:sdk_home] || ENV['ANDROID_HOME'] || ENV['ANDROID_SDK']\n end", "def list_modules\n pal.list_modules\n end", "def extensions\n extensions_size = MemoryPointer::new( :size_t )\n error = OpenCL.clGetPlatformInfo( self, EXTENSIONS, 0, nil, extensions_size)\n error_check(error)\n ext = MemoryPointer::new( extensions_size.read_size_t )\n error = OpenCL.clGetPlatformInfo( self, EXTENSIONS, extensions_size.read_size_t, ext, nil)\n error_check(error)\n ext_string = ext.read_string\n return ext_string.split(\" \")\n end", "def pythons\n deps.map(&:to_formula)\n .select { |f| f.name.match?(/^python@\\d\\.\\d+$/) }\n .sort_by(&:version)\n .map { |f| f.opt_libexec/\"bin/python\" }\n end", "def relevant_packages\n packages.select { |p| p['version'] == version }\n end", "def list_addons\n Dir.glob(\"/var/lib/apollo/addons/*.gem\")\n end", "def kernel_modules\n cmd_exec('cat /proc/modules').to_s.scan(/^[^ ]+/)\n rescue\n raise 'Could not determine kernel modules'\n end", "def metapackage(name, *packages)\n Autoproj.workspace.manifest.metapackage(name, *packages)\nend", "def autoinstPackages\n allpackages = []\n\n # the primary list of packages\n allpackages = Convert.convert(\n Builtins.union(allpackages, PackageAI.toinstall),\n :from => \"list\",\n :to => \"list <string>\"\n )\n\n # In autoinst mode, a kernel should not be available\n # in <packages>\n if Builtins.size(@kernel) == 0\n kernel_pkgs = Kernel.ComputePackages\n allpackages = Convert.convert(\n Builtins.union(allpackages, kernel_pkgs),\n :from => \"list\",\n :to => \"list <string>\"\n )\n else\n if Pkg.IsAvailable(@kernel)\n allpackages = Builtins.add(allpackages, @kernel)\n kernel_nongpl = Ops.add(@kernel, \"-nongpl\")\n\n if Pkg.IsAvailable(kernel_nongpl)\n allpackages = Builtins.add(allpackages, kernel_nongpl)\n end\n else\n Builtins.y2warning(\"%1 not available, using kernel-default\", @kernel)\n kernel_pkgs = Kernel.ComputePackages\n allpackages = Convert.convert(\n Builtins.union(allpackages, kernel_pkgs),\n :from => \"list\",\n :to => \"list <string>\"\n )\n end\n end\n\n deep_copy(allpackages)\n end", "def list\n puts \"➔ Listing all APK! Current #{publisher.current_version} - #{publisher.apk_date}\"\n versions = publisher.list_apks\n versions.each do |a|\n color = publisher.current_version == a.version_code ? :green : :black\n puts Paint[\"#{a.version_code} ➔ #{a.binary.sha1}\", color]\n end\n end", "def from_installed_gems(*deprecated); end", "def find_android_apps(api_key, search_term)\n search_uri = \"https://data.42matters.com/api/v2.0/android/apps/query.json?access_token=#{api_key}\"\n data = {\n \"query\" => {\n \"query_params\" => {\n \"from\": 0,\n \"sort\": \"score\",\n \"include_full_text_desc\": true,\n \"include_developer\": true,\n \"full_text_term\": \"#{search_term}\"\n }\n }\n }\n \n response = http_request :post , search_uri, nil, {}, data.to_json, true, 60\n \n unless response\n _log_error \"Failed to retrieve response from 42matters. Exiting!\"\n return\n end\n\n _log \"Got response! Parsing...\"\n response_json = JSON.parse(response.body)\n \n if response_json[\"results\"]\n # iterate through items and if entity name is in title or developer, consider a match\n response_json[\"results\"].each do |app|\n is_match = false\n\n if app[\"title\"] =~ /#{search_term}/i\n #_log \"Found matching app #{app}\"\n is_match = true\n elsif app[\"developer\"] =~ /#{search_term}/i\n is_match = true\n elsif app[\"description\"] =~ /#{search_term}/i\n is_match = true\n end\n \n if is_match\n _create_entity \"AndroidApp\", {\n \"description\" => app[\"description\"], \n \"name\" => app[\"package_name\"], # setting name to app package_name so we don't create multiple entities of the same app\n \"package_name\" => app[\"package_name\"], # redundant field, but adding to as it may be needed in the future.\n \"price\" => app[\"price\"], \n \"min_sdk\" => app[\"min_sdk\"],\n \"version\" => app[\"version\"],\n \"short_description\" => app[\"short_desc\"],\n \"downloads\" => app[\"downloads\"],\n \"email\" => app[\"email\"],\n \"website\" => app[\"website\"],\n \"category\" => app[\"category\"],\n \"developer\" => app[\"developer\"],\n \"icon\" => app[\"icon\"]\n }\n end\n end\n else\n _log \"No apps found for search term. Exiting.\"\n return\n end\n end", "def package_manifest()\n res = []\n @items.each do |item|\n sources = item[:sources]\n sources = [ sources ] unless sources.kind_of?(Array)\n sources.each do |src|\n # TODO - want to split into multiple packages\n #if pkg == :main\n # next unless item[:dest] =~ /(LIB|BIN)DIR/\n #elsif pkg == :devel\n # next unless item[:dest] =~ /(INCLUDE|MAN)DIR/\n #else\n # throw \"bad pkg type\"\n #end\n dst = expand_dir(item[:dest])\n if item[:rename].nil?\n dst += '/' + src\n else\n dst += '/' + item[:rename]\n end\n dst.gsub!(/^\\/usr\\/local\\//, '/usr/') # KLUDGE: only true when making an RPM or DEB\n res.push dst\n end\n end\n res.join \"\\n\"\n end", "def packages\n Dir[File.join($__HELLO_DIR__, 'packages/*/*.yml')]\n .map do |yml|\n info = YAML.load File.read yml\n info['dir'] = File.dirname yml if info\n info\n end\n .select {|p| p }\n .sort_by {|p| p['priority'] || 10 }\nend", "def install_packages packages\n case DISTRO[0]\n when :opensuse\n installed = %x[rpm -qa].split(\"\\n\")\n packages.select{|pkg| ! installed.detect{|d| d =~ /^#{Regexp.escape(pkg)}/ } }.each do |package|\n # puts \"Installing #{package} ...\"\n %x[sudo zypper install '#{package}']\n end\n when :solaris\n installed = `pkg-get -l`.split(\"\\n\")\n packages.select{|pkg| ! installed.include? pkg }.each do |package|\n sh \"sudo pkg-get install #{package}\"\n end\n else\n installed = `dpkg --list`.split(\"\\n\").map { |x| x.split[1] } # Hm, this is out of scope if defined outside.\n packages.select{ |pkg| ! installed.include? pkg }.each do |package|\n sh \"sudo apt-get -y install #{package}\"\n end\n end\nend", "def package_enabled?(name)\n Autoproj.workspace.manifest.package_enabled?(name, false)\nend", "def available_services\n Dir[\"/Library/LaunchDaemons/dev.*.plist\"].map { |f| f[/dev\\.(.*)\\.plist/, 1] }\n end", "def applications\n select_application gp_card_manager_aid\n secure_channel\n gp_get_status :apps\n \n # TODO(costan): there should be a way to query the AIDs without asking the\n # SD, which requires admin keys.\n end", "def app_list\n @app_list ||= self.send(\"#{my_os_family}_app_list\")\n end", "def list_all_installable_packages(server)\n @connection.call('system.list_all_installable_packages', @sid, server)\n end" ]
[ "0.6317287", "0.6276006", "0.623922", "0.62276304", "0.60173744", "0.58197", "0.57239467", "0.566168", "0.5655301", "0.5638089", "0.5636539", "0.5568224", "0.55633", "0.55545783", "0.55459887", "0.5521234", "0.5481258", "0.545158", "0.543471", "0.5396431", "0.5370915", "0.5355903", "0.52821714", "0.5275674", "0.52634656", "0.52503276", "0.5241232", "0.52407783", "0.52257633", "0.52200073", "0.5207838", "0.5200071", "0.5200071", "0.51952016", "0.518391", "0.5182503", "0.5176172", "0.51724803", "0.51724803", "0.51705337", "0.51693916", "0.5165574", "0.5157454", "0.5141785", "0.5137659", "0.51311475", "0.5128437", "0.5126107", "0.5125715", "0.5118915", "0.5114399", "0.51029044", "0.5097503", "0.5085737", "0.5083677", "0.50810486", "0.50810486", "0.50810486", "0.50717175", "0.50559586", "0.50536066", "0.5050935", "0.50368255", "0.5034273", "0.5030009", "0.5029117", "0.50192124", "0.4999121", "0.4974633", "0.49695206", "0.49540132", "0.4951173", "0.4948764", "0.49464908", "0.4943594", "0.4942155", "0.4939338", "0.4938649", "0.49349272", "0.4933849", "0.492316", "0.49211967", "0.49146438", "0.49144155", "0.49142405", "0.49101725", "0.49024686", "0.49008486", "0.4897429", "0.48939088", "0.4891709", "0.48901415", "0.48892412", "0.48851553", "0.48792437", "0.487057", "0.48642614", "0.48579305", "0.4844113", "0.48298496" ]
0.7649553
0
having problem with mocha, possibly Ruby 2 related.
def dummy_generator(result) Object.new.tap { |o| o.define_singleton_method(:generate) { |*args| result } } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uses_mocha(test_name)\n unless Object.const_defined?(:Mocha)\n gem 'mocha', '>= 0.9.5'\n require 'mocha'\n end\nrescue LoadError => load_error\n $stderr.puts \"Skipping #{test_name} tests. `gem install mocha` and try again.\"\nelse\n yield\nend", "def uses_mocha(test_name)\n require 'mocha' unless Object.const_defined?(:Mocha)\nrescue LoadError => load_error\n $stderr.puts \"Skipping #{test_name} tests. `gem install mocha` and try again.\"\nelse\n yield\nend", "def uses_mocha(test_name)\n require 'mocha'\n yield\nrescue LoadError\n $stderr.puts \"Skipping #{test_name} tests. `gem install mocha` and try again.\"\nend", "def self_test; end", "def self_test; end", "def test_hack\n assert(true)\n end", "def fails_on_jruby\n before do\n unless SpecConfig.instance.mri?\n skip \"Fails on jruby\"\n end\n end\n end", "def fails_on_jruby\n before do\n unless SpecConfig.instance.mri?\n skip \"Fails on jruby\"\n end\n end\n end", "def test_unit_not_dead\n end", "def test_bad_chicken_deps\n check_deps_fail BadChickenBall unless `/usr/bin/which csc`.chomp.empty?\n end", "def test_that_it_has_a_version_number\n refute_nil ::Malody::VERSION\n end", "def test_bad_jruby_deps\n check_deps_fail BadJRubyBall unless `/usr/bin/which jruby`.chomp.empty?\n end", "def spec; end", "def spec; end", "def test_bad_jruby_deps\n check_deps_fail \"notapackage\" => :jruby if which('jruby')\n end", "def test_bad_jruby_deps\n check_deps_fail \"notapackage\" => :jruby if which('jruby')\n end", "def test_two_rubies_test\r\n rubyArr = [2,2]\r\n seed = 10\r\n r = Random.new(seed)\r\n numReturn = mine(rubyArr, r)\r\n if numReturn == 0 || numReturn == 1 || numReturn == 2\r\n assert true\r\n end\r\n end", "def test_Errno_Introduction2\n\t\tassert_equal([:NOERROR, :EPERM, :ENOENT, :ESRCH, :EINTR], \n\t\t\t\t\t Errno.constants[0..4])\n\tend", "def test_version\n assert_match(/^Ocra \\d+(\\.\\d)+$/, `ruby #{ocra} --version`)\n end", "def test_ruby_string_big\n pros = Prospector.new(0,0,0)\n assert pros.ruby_string(2).eql? '2 rubies'\n end", "def test_third_line\n assert_equal \" def valid_working_gemspec_args\\n\",\n Working.file_third_line(__FILE__)\n end", "def test_bad_argument\n assert_equal 1, go_with_args(%w(--this_is_really_redonculouslywrong))\n assert_match(/Error: bad arguments/, @stderr_io.string )\n end", "def test_one_ruby_test\r\n rubyArr = [1,1]\r\n seed = 10\r\n r = Random.new(seed)\r\n numReturn = mine(rubyArr, r)\r\n if numReturn == 0 || numReturn == 1\r\n assert true\r\n end\r\n end", "def test_ruby_string_1\n pros = Prospector.new(0,0,0)\n assert pros.ruby_string(1).eql? '1 ruby'\n end", "def test_this_works\n assert true\n end", "def tests; end", "def tests; end", "def test_bad_node_deps\n check_deps_fail BadNodeBall unless `/usr/bin/which node`.chomp.empty?\n end", "def assert(str = 'Assertion failed')\n begin\n if(!yield)\n $asserts.push(assertion_string(\"#{GEMNAME} Fail: \", str))\n $ko_test += 1\n print('F')\n else\n $ok_test += 1\n print('.')\n end\n rescue Exception => e\n $asserts.push(assertion_string(\"#{GEMNAME} Error: \", str, e))\n $kill_test += 1\n print('X')\n end\nend", "def test_bad_chicken_deps\n check_deps_fail \"notapackage\" => :chicken if which('csc')\n end", "def test_bad_chicken_deps\n check_deps_fail \"notapackage\" => :chicken if which('csc')\n end", "def __\n raise \"__ should be replaced with a value or expression to make the test pass.\"\nend", "def test_fake_string_1\n pros = Prospector.new(0,0,0)\n assert pros.fake_string(1).eql? '1 fake ruby'\n end", "def test(what = nil)\n ActiveRecord::Base.logger.silence do\n case what\n when NilClass, :all\n rake \"test:units\"\n when String\n begin\n old_env, ENV[\"RAILS_ENV\"] = ENV[\"RAILS_ENV\"], \"test\"\n ENV['TEST'] = \"test/#{what}_test.rb\"\n rake \"test:single\"\n ensure\n ENV['TEST'] = nil\n ENV[\"RAILS_ENV\"] = old_env\n end\n end\n end\n nil\n rescue SystemExit\n nil\n end", "def test_parse05b\n assert_raise( RuntimeError ) {\n options = ArgumentManager.parse( [ '--u-opt=foo', '--v-opt' ] )\n }\n end", "def test_fake_string_big\n pros = Prospector.new(0,0,0)\n assert pros.fake_string(2).eql? '2 fake rubies'\n end", "def test_expectations_backtrace\n backtrace = nil\n \n begin\n expect! 1 => 0\n rescue \n backtrace = $!.backtrace\n end\n assert backtrace.first.include?(\"/expect_test.rb:\")\n end", "def test\n # require \"pry\"; binding.pry\n end", "def test_bad_rubinius_deps\n check_deps_fail \"notapackage\" => :rbx if which('rbx')\n end", "def test_bad_rubinius_deps\n check_deps_fail \"notapackage\" => :rbx if which('rbx')\n end", "def description\n super + \", Mocha\"\n end", "def assertions; end", "def assertions; end", "def __dummy_test__\n end", "def test_bad_node_deps\n check_deps_fail \"notapackage\" => :node if which('node')\n end", "def test_bad_node_deps\n check_deps_fail \"notapackage\" => :node if which('node')\n end", "def test_parse01b\n assert_raise( RuntimeError ) {\n ArgumentManager.parse( [ '-i', '999' ] )\n }\n end", "def xtest_posix\nputs \"*\"*80\nassert_equal(false, true)\n assert_equal(\"\", \"Need way to set posix mode from app!\")\n end", "def test_unit_can_be_killed\n end", "def test_0_dummy\n\t\tend", "def test_case; end", "def test_turn_putter_both\n pros = Prospector.new(0,0,0)\n assert pros.turn_putter(1,1).eql? \"\\tFound 1 ruby and 1 fake ruby in Enumerable Canyon\"\n end", "def fails_intermittently(issue_link, args = {})\n raise ArgumentError, \"provide a Jira ticket link\" unless issue_link\n raise ArgumentError, \"a block is required\" unless block_given?\n\n yield\nrescue Minitest::Assertion, StandardError, SignalException # we have a test failure!\n STDERR.puts \"\\n\\nIntermittent test failure! See: #{issue_link}\"\n\n if args.empty?\n STDERR.puts \"No further debugging information available.\"\n else\n STDERR.puts \"Debugging information:\\n\"\n args.keys.sort.each do |key|\n STDERR.puts \"#{key} => #{args[key].inspect}\"\n end\n end\nend", "def test_rubies_found_positive\n prospector = Rubyist.new(1)\n prospector.rubies_found(2, 2)\n assert prospector.real_ruby_count == 2 && prospector.fake_ruby_count == 2\n end", "def testcase3(prog)\n rc = prog.run(\"blah\")\n assert_equal(0, rc, \"program should exit normally\")\n end", "def test_error_recovery_y\n assert_compile 'error_recovery.y'\n Timeout.timeout(10) do\n assert_exec 'error_recovery.y'\n end\n end", "def failures; end", "def failures; end", "def failures; end", "def test_print_start_string\n assert_raises(StandardError) { print_start('1') } # pass\n end", "def my_array_finding_method(source, thing_to_find)\n # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend", "def run_tests(m)\n IO.popen(\"cd #{FANCY_DIR} && rake test\", \"r\") do |o|\n lines = o.readlines\n failed = lines.select{|l| l =~ /FAILED:/}\n amount = failed.size\n if amount > 0\n failed << \"=> #{amount} failed tests!\"\n gist_url = paste_text(failed.join, \"rake test\")\n end\n m.reply \"=> #{amount} failed tests! See: #{gist_url}\"\n end\n end", "def test_command_failed\n assert_raise(Report::CommandFailed) { @report.run('nosuch') }\n assert_raise(Report::CommandFailed) { @report.run('cat', 'nosuch') }\n end", "def test_bad_rubinius_deps\n check_deps_fail BadRubiniusBall unless `/usr/bin/which rbx`.chomp.empty?\n end", "def test_add_option01c\n assert_nothing_raised { \n ArgumentManager.add_option( 'a' );\n }\n \n assert_raise ( RuntimeError ) { \n ArgumentManager.add_option( 'a' );\n }\n end", "def test_parse03b\n assert_raise( RuntimeError ) {\n options = ArgumentManager.parse( [ '-j' ] )\n }\n end", "def test_nonexistent_source\n assert_error \"FATAL: database \\\"db1\\\" does not exist\\n\", \"--from db1 --to pgsync_test2\"\n end", "def test_nonexistent_source\n assert_error \"FATAL: database \\\"db1\\\" does not exist\\n\", \"--from db1 --to pgsync_test2\"\n end", "def test_calling_global_methods_with_wrong_number_of_arguments\n exception = assert_raise(ArgumentError) do\n my_global_method\n end\n assert_match(/arguments/, exception.message)\n\n exception = assert_raise(ArgumentError) do\n my_global_method(1,2,3)\n end\n assert_match(/wrong/, exception.message)\n end", "def test_parse01b\n assert_raise( RuntimeError ) {\n ArgumentManager.parse( [ '--s-opt=baz' ] )\n }\n end", "def testNonRubyFile\n assert_raise(LoadError) do\n requireFile('NonRubyFile.so')\n end\n end", "def test_namefailures\n server = nil\n assert_nothing_raised {\n\n server = Puppet::Network::Handler.fileserver.new(\n\n :Local => true,\n\n :Config => false\n )\n }\n\n [\" \", \"=\" \"+\", \"&\", \"#\", \"*\"].each do |char|\n assert_raise(Puppet::Network::Handler::FileServerError, \"'#{char}' did not throw a failure in fileserver module names\") {\n server.mount(\"/tmp\", \"invalid#{char}name\")\n }\n end\n end", "def test_fail_setup\n @actor.setup\n end", "def test_rubies_found_negative\n prospector = Rubyist.new(1)\n prospector.rubies_found(-2, -2)\n assert prospector.real_ruby_count.zero? && prospector.fake_ruby_count.zero?\n end", "def test_bookkeeping\n assert_equal 1, RunLengthEncoding::VERSION\n end", "def test_abnormal_usage\n test_args = [-9, -9, -9]\n args = Args.new test_args\n\n args.stub(:exit, 1) do\n assert_output(\"Usage:\\nruby ruby_rush.rb *seed* *num_prospectors* *num_turns\\n*seed* should be an integer\\n*num_prospectors* should be a non-negative integer\\n*num_turns* should be a non-negative integer\\n\"){args.validate_args}\n end\n end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def test?\n rspec? || minitest?\n end", "def test_print_ruby_found_nil\n mock_location = Minitest::Mock.new('location')\n def mock_location.name; 'a'; end\n def plural?(x); 'ruby'; end\n assert_raises(StandardError){@p.print_ruby_found_in_this_location(mock_location, nil)}\n end", "def test_arg_check_length_fail\n def exit(x); 1; end;\n ret = arg_check_length 2\n assert_equal ret, -1\n end", "def test_just_to_show_we_can_make_it_fail\n assert_equal method('patrick'), 'Chuck'\n end", "def test_run\n\t\tmocked_prog = MiniTest::Mock.new(\"mocked program\")\n\t\tmocked_prog.expect(:run, 1)\n\t\tassert mocked_prog\n\tend", "def test \n end" ]
[ "0.63727826", "0.6329637", "0.6314666", "0.60019034", "0.60019034", "0.59696275", "0.59666574", "0.59666574", "0.5729956", "0.56953824", "0.5655932", "0.5650662", "0.56420434", "0.56420434", "0.5629743", "0.5629743", "0.5621014", "0.55798674", "0.5546065", "0.5542874", "0.5531094", "0.5526026", "0.55182344", "0.5512074", "0.5445873", "0.54317725", "0.54317725", "0.5430129", "0.54292184", "0.54195035", "0.54195035", "0.5409853", "0.5404467", "0.5398498", "0.53899676", "0.5384794", "0.5374583", "0.5373616", "0.5372336", "0.5372336", "0.5368975", "0.53670394", "0.53670394", "0.5364042", "0.5314756", "0.5314756", "0.53015286", "0.5300014", "0.5297813", "0.52951103", "0.5282794", "0.5275437", "0.5271411", "0.5269153", "0.5258355", "0.52512234", "0.52468884", "0.52468884", "0.52468884", "0.5241951", "0.524084", "0.52375543", "0.52309275", "0.52309203", "0.52291846", "0.52270955", "0.5225939", "0.5225939", "0.5224961", "0.5224199", "0.5213555", "0.5211244", "0.5210586", "0.5201938", "0.5200293", "0.5198252", "0.5192938", "0.5192938", "0.5192938", "0.5192938", "0.5192938", "0.5192938", "0.5192938", "0.5192938", "0.5192938", "0.5192938", "0.5192938", "0.5192938", "0.5192938", "0.5192938", "0.5192938", "0.5192938", "0.5192938", "0.5192938", "0.5192938", "0.5192787", "0.51925796", "0.519245", "0.5192264", "0.5190219", "0.51874" ]
0.0
-1
Replaces SPARQL query variable `?graphName` with the provided `graph_name` URI to identify, which graph should be queried.
def add_graph(query, graph_name) graph_uri = "<#{graph_name}>" query.gsub(/\?validatedGraph/i, graph_uri) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_graph(graph_name)\n @sparql_update.clear(:graph, graph_name)\n end", "def add_graph(query_template)\n query_template.gsub(/\\?graph/i, \"<#{@named_graph}>\")\n end", "def name(name)\n @graph_name = name\n self\n end", "def graph_name=(name)\n formulae[name] = self\n @options[:graph_name] = name\n end", "def graph_name=(value)\n operands.each do |operand|\n operand.graph_name = value if operand.respond_to?(:graph_name) && operand.graph_name != false\n end\n value\n end", "def graph_name=(value)\n operands.each do |operand|\n operand.graph_name = value if operand.respond_to?(:graph_name) && operand.graph_name != false\n end\n value\n end", "def set_url_default_graph url\n if @options[:graph].is_a? Array\n graphs = @options[:graph].map {|graph|\n CGI::escape(graph)\n }\n else\n graphs = CGI::escape(@options[:graph])\n end\n case @op\n when :query\n url.query_values = (url.query_values || {})\n .merge(:'default-graph-uri' => graphs)\n when :update\n url.query_values = (url.query_values || {})\n .merge(:'using-graph-uri' => graphs)\n end\n end", "def query_set(name, value)\n query = uri.query ? \"&#{uri.query}&\" : ''\n parameter = Regexp.new(\"&#{Regexp.escape name}=.+?&\")\n if query =~ parameter\n new_query = value.nil? ?\n query.gsub(parameter, '&') :\n query.gsub(parameter, \"&#{name}=#{value}&\")\n else\n new_query = value.nil? ? query : \"#{query}#{name}=#{value}\"\n end\n new_query = new_query.gsub(/^&/, '').gsub(/&$/, '')\n new_query = nil if (new_query == '')\n rebuild_uri :query => new_query\n end", "def clear_graph(graphname)\n update(\"WITH <#{graphname}> DELETE { ?s ?p ?o } WHERE { ?s ?p ?o .}\")\nend", "def addNamedGraph(uri) \n\t\t\n\t\tif uri \n\t\t\tself._querytext.push([\"named-graph-uri\",uri])\n\t end\n\tend", "def graph_name; @options[:graph_name]; end", "def graph_name\n nil\n end", "def addQueryName(theName)\n @metadata.addQueryName(theName)\n end", "def graphql_name\n nil\n end", "def graphql_name\n nil\n end", "def addDefaultGraph(uri) \n\n\t\tif uri \n\t\t self._querytext.push([\"default-graph-uri\",uri])\n\t\tend\n\tend", "def replace_path_parameter(path, name, value)\n if value == nil\n value = \"\"\n end\n if value.to_s != \"\"\n value = \"/\" + CGI.escape(value.to_s).gsub('+', '%20')\n end\n path.sub('/{' + name + '}', value)\n end", "def calculate_graph_diffs(graphname1, graphname2, diffgraphname)\n update(\"INSERT { GRAPH <#{diffgraphname}> { ?s ?p ?o . }} WHERE { GRAPH <#{graphname1}> { ?s ?p ?o } FILTER NOT EXISTS { GRAPH <#{graphname2}> { ?s ?p ?o }}}\")\nend", "def sparql_query\n return <<-SPARQL\n SELECT ?item ?itemLabel ?steamAppId WHERE {\n ?item wdt:P31 wd:Q7889; # instance of video game\n wdt:P1733 ?steamAppId. # items with a Steam App ID.\n FILTER NOT EXISTS { ?item wdt:P5794 ?igdbId. } # with no IGDB ID\n SERVICE wikibase:label { bd:serviceParam wikibase:language \"en,en\". }\n }\n SPARQL\nend", "def graph(uri)\n self.options[:graph] = uri\n self\n end", "def graph(uri)\n self.options[:graph] = uri\n self\n end", "def graph(uri)\n self.options[:graph] = uri\n self\n end", "def sparql_up\n begin\n direct_query \"ASK { ?s ?p ?o }\"\n rescue\n false\n end\nend", "def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end", "def add_timestamp(graph_name, graph)\n now = RDF::Literal::DateTime.new DateTime.now.iso8601\n graph << RDF::Statement.new(RDF::URI(graph_name), RDF::DC.issued, now) \n end", "def get (name:, database: Arango.current_database)\n args = { graph: name }\n result = Arango::Requests::Graph::Get.execute(server: database.server, args: args)\n from_results({}, result.graph, database: database)\n end", "def graph=(graph)\n @graph = graph\n end", "def name= new_name\n patch_gapi! name: new_name\n end", "def get_player_uri(name, team_uri)\n if name.include?(',')\n name = name.split(',').reverse.join(' ')\n end\n name = name.strip\n sparql = \"SELECT DISTINCT ?player_uri ?team_uri\n WHERE {\n { ?player_uri <http://xmlns.com/foaf/0.1/name> \\\"#{name}\\\"@en . }\n UNION\n { ?player_uri <http://xmlns.com/foaf/0.1/fullname> \\\"#{name}\\\"@en . }\n UNION\n { ?player_uri <http://xmlns.com/foaf/0.1/surname> \\\"#{name}\\\"@en . }\n UNION\n { ?player_uri <http://xmlns.com/foaf/0.1/givenName> \\\"#{name}\\\"@en . }\n UNION\n { ?player_uri <http://xmlns.com/foaf/0.1/name> \\\"#{name.split(' ').first}\\\"@en . }\n UNION\n { ?player_uri <http://xmlns.com/foaf/0.1/fullname> \\\"#{name.split(' ').first}\\\"@en . }\n UNION\n { ?player_uri <http://xmlns.com/foaf/0.1/givenName> \\\"#{name.split(' ').first}\\\"@en . }\n UNION\n { ?player_uri <http://xmlns.com/foaf/0.1/surname> \\\"#{name.split(' ').first}\\\"@en . }\n UNION\n { ?player_uri <http://xmlns.com/foaf/0.1/name> \\\"#{name.split(' ').last}\\\"@en . }\n UNION\n { ?player_uri <http://xmlns.com/foaf/0.1/fullname> \\\"#{name.split(' ').last}\\\"@en . }\n UNION\n { ?player_uri <http://xmlns.com/foaf/0.1/surname> \\\"#{name.split(' ').last}\\\"@en . }\n UNION\n { ?player_uri <http://xmlns.com/foaf/0.1/givenName> \\\"#{name.split(' ').last}\\\"@en . }\n ?player_uri <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://dbpedia.org/ontology/SoccerPlayer> .\n ?player_uri <http://dbpedia.org/property/nationalteam> <#{team_uri}> .\n ?player_uri <http://dbpedia.org/property/nationalteam> ?team_uri\n OPTIONAL { ?player_uri <http://dbpedia.org/property/nationalcaps> ?caps }.\n OPTIONAL { ?player_uri <http://dbpedia.org/property/nationalgoals> ?goals }.\n ?player_uri <http://dbpedia.org/property/birthDate> ?birth_date .\n FILTER(?birth_date > \\\"19700101\\\"^^xsd:date)\n }\n ORDER BY DESC(?caps) DESC(?goals)\"\n solutions = DBPEDIA.query sparql\n result = solutions.first\n result.present? ? result.player_uri.to_s : nil\n end", "def name= new_name\n @gapi.update! name: String(new_name)\n end", "def replace_names!(former,nname)\n # Recurse on the statement.\n self.statement.replace_names!(former,nname)\n end", "def graph_params\n params.fetch(:graph, {})\n end", "def query\n sparql = <<-SPARQL\n SELECT ?item ?itemLabel ?steamAppId {\n ?item wdt:P31 wd:Q7889; # instance of video game\n wdt:P1733 ?steamAppId. # items with a Steam App ID.\n FILTER NOT EXISTS { ?item wdt:P404 ?gameMode . } # with no game mode\n SERVICE wikibase:label { bd:serviceParam wikibase:language \"en\". }\n }\n SPARQL\n\n sparql\nend", "def graph(uri)\n @what, @uri = :graph, uri\n self\n end", "def replace_query_definition(query_name, body, opts = {})\n data, _status_code, _headers = replace_query_definition_with_http_info(query_name, body, opts)\n return data\n end", "def set_graph_aliases(graph_aliases)\n columns, graph_aliases = graph_alias_columns(graph_aliases)\n if graph = opts[:graph]\n select(*columns).clone(:graph => Hash[graph].merge!(:column_aliases=>graph_aliases.freeze).freeze)\n else\n Sequel::Deprecation.deprecate(\"Calling Dataset#set_graph_aliases before Dataset#graph\", \"Call Dataset#set_graph_aliases after Dataset#graph now\")\n select(*columns).clone(:graph_aliases=>graph_aliases.freeze) # SEQUEL5: Remove\n end\n end", "def graph_done(graph_name)\n @graphs[graph_name] = true\n end", "def sparql_query(query, baseURL = SPARQL_ENDPOINT, format = \"application/sparql-results+json\")\n Rails.logger.debug(\"RdfJsonQuery::sparql_query: endpoint #{baseURL}, query: \" + query) if @@trace_on == true\n\n params = {\n \"default-graph\" => \"#{DEFAULT_GRAPH_URI}\",\n \"query\" => query,\n \"debug\" => \"on\",\n \"timeout\" => \"\",\n \"format\" => format,\n \"save\" => \"display\",\n \"fname\" => \"\"\n }\n\n querypart = \"\"\n params.each { |k, v|\n querypart += \"#{k}=#{CGI.escape(v)}&\"\n }\n\n sparqlURL = baseURL + \"?#{querypart}\"\n\n response = Net::HTTP.get_response(URI.parse(sparqlURL))\n\n Rails.logger.debug(\"RdfJsonQuery::sparql_query: response: \" + response.body) if @@trace_on == true\n\n return response.body\n end", "def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end", "def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end", "def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end", "def get_team_uri(name)\n #sparql = \"SELECT ?uri WHERE { ?uri <http://dbpedia.org/property/fifaTrigramme> \\\"#{name}\\\" . }\"\n #solution = DBPEDIA.query(sparql).first\n exceptions = {'USA' => 'Vereinigte Staaten'}\n name = exceptions[name] if exceptions.has_key?(name)\n sparql = \"\n SELECT DISTINCT ?country_name\n WHERE {\n ?country_uri <#{RDF::RDFS.label}> \\\"#{name}\\\"@de .\n ?country_uri <#{RDF::RDFS.label}> ?country_name .\n ?country_uri <http://dbpedia.org/property/commonName> ?common_name .\n FILTER ( LANG(?country_name) = 'en' )\n }\n \"\n solutions = DBPEDIA.query sparql\n country_name = solutions.first ? solutions.first.country_name.to_s.gsub(' ', '_') + '_national_football_team' : ''\n \"http://dbpedia.org/resource/#{country_name}\"\n end", "def generate_next_url\n if eds_session.has_key? :query_string\n url = HTMLEntities.new.decode eds_session[:query_string]\n\n #blacklight expects the search term to be in the parameter 'q'.\n #q is moved back to 'query-1' in 'generate_api_query'\n #should probably pull from Info method to determine replacement strings\n #i could turn the query into a Hash, but available functions to do so delete duplicated params (Addressable)\n url.gsub!(\"query-1=AND,TI:\", \"q=\")\n url.gsub!(\"query-1=AND,AU:\", \"q=\")\n url.gsub!(\"query-1=AND,SU:\", \"q=\")\n url.gsub!(\"query-1=AND,\", \"q=\")\n\n #Rails framework doesn't allow repeated params. turning these into arrays fixes it.\n url.gsub!(\"facetfilter=\", \"facetfilter[]=\")\n url.gsub!(\"limiter=\", \"limiter[]=\")\n\n #i should probably pull this from the query, not the URL\n if (params[:search_field]).present?\n url << \"&search_field=\" << params[:search_field].to_s\n end\n return url\n else\n return ''\n end\n end", "def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end", "def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end", "def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end", "def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end", "def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end", "def update_(uri, rdf_data=nil, content_type=nil)\n reset(uri)\n\n if rdf_data\n res = sparql_push(uri, rdf_data.strip, content_type)\n else\n res = sparql_pull(%{LOAD \"#{uri}\" INTO GRAPH <#{uri}>})\n end\n\n return res\n end", "def query=(v)\n return @query = nil unless v\n raise InvalidURIError, \"query conflicts with opaque\" if @opaque\n\n x = v.to_str\n v = x.dup if x.equal? v\n v.encode!(Encoding::UTF_8) rescue nil\n v.delete!(\"\\t\\r\\n\")\n v.force_encoding(Encoding::ASCII_8BIT)\n raise InvalidURIError, \"invalid percent escape: #{$1}\" if /(%\\H\\H)/n.match(v)\n v.gsub!(/(?!%\\h\\h|[!$-&(-;=?-_a-~])./n.freeze){'%%%02X' % $&.ord}\n v.force_encoding(Encoding::US_ASCII)\n @query = v\n end", "def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end", "def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end", "def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end", "def modify_search_query\n query_data = params['q'] && params['q'][Garage::SearchPredicate]\n if query_data.present?\n params['q'][Garage::SearchPredicate] = query_data.split(' ')\n end\n end", "def query\n return <<-SPARQL\n SELECT ?item ?itemLabel ?igdbId ?numericId WHERE {\n OPTIONAL {\n ?item p:#{IGDB_GAME_PID} ?statement. # Get the statement of the IGDB ID\n ?statement ps:#{IGDB_GAME_PID} ?igdbId. # Get the actual ID\n FILTER(NOT EXISTS { ?statement pq:#{IGDB_NUMERIC_GAME_PID} ?numericId. }) # Get rid of anything with a numeric IGDB ID qualifier.\n }\n SERVICE wikibase:label { bd:serviceParam wikibase:language \"en,en\". }\n }\n SPARQL\nend", "def get_old_graphs(time, query_endpoint, namespace)\n sparql_query = SPARQL::Client.new query_endpoint\n limit = time.ago.xmlschema\n query = %Q{\n PREFIX dcterms: <http://purl.org/dc/terms/>\n PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n\n SELECT DISTINCT ?graph\n WHERE {\n GRAPH ?graph {\n ?graph dcterms:issued ?issued .\n FILTER (\n (STRSTARTS(STR(?graph), \"#{namespace}\"))\n &&\n (?issued < \"#{limit}\"^^xsd:dateTime)\n )\n }\n }\n }\n response = sparql_query.query query\n response.map do |binding|\n binding[:graph].to_s\n end\n end", "def query(steam_app_id)\n sparql = <<-SPARQL\n SELECT ?item ?itemLabel WHERE {\n ?item wdt:P1733 \"#{steam_app_id}\".\n FILTER NOT EXISTS { ?item wdt:P6337 ?pcgw_id . } # with no PCGW ID\n SERVICE wikibase:label { bd:serviceParam wikibase:language \"[AUTO_LANGUAGE],en\". }\n }\n LIMIT 10\n SPARQL\n\n return sparql\nend", "def alias_query(query_name, alias_name)\n @aliases ||= {}\n @aliases[alias_name] = query_name\n define_query_method(query_name, alias_name)\n end", "def set_graph\n @graph = Graph.find(params[:id])\n end", "def set_graph\n @graph = Graph.find(params[:id])\n end", "def set_graph\n @graph = Graph.find(params[:id])\n end", "def set_graph\n @graph = Graph.find(params[:id])\n end", "def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end", "def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end", "def url path, query={}, server=graph_server, opts={}\n \"#{server}#{path}#{build_query_string(query, opts)}\"\n end", "def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end", "def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end", "def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end", "def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end", "def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"expand\"\n return \"%24expand\"\n when \"select\"\n return \"%24select\"\n else\n return original_name\n end\n end", "def upload_eng(sparql)\n sparql.query(\n <<-SPARQL\n SELECT DISTINCT ?concept ?description\n WHERE {\n ?concept rdfs:comment ?description .\n ?concept rdfs:label \"#{en_title}\"@en .\n FILTER ( lang(?description) = \"en\" )\n }\n SPARQL\n )\n end", "def to_sparql(**options)\n ops = operands.last.to_s.empty? ? operands[0..-2] : operands\n \"REPLACE(\" + ops.to_sparql(delimiter: ', ', **options) + \")\"\n end", "def upload_eng(sparql, keyword)\n sparql.query(\n <<-SPARQL\n SELECT DISTINCT ?concept ?description\n WHERE {\n ?concept rdfs:comment ?description .\n ?concept rdfs:label \"#{keyword}\"@en .\n FILTER ( lang(?description) = \"en\" )\n }\n SPARQL\n )\n end", "def write_graph(name)\n return unless Puppet[:graph]\n\n Puppet.settings.use(:graphing)\n\n file = File.join(Puppet[:graphdir], \"%s.dot\" % name.to_s)\n File.open(file, \"w\") { |f|\n f.puts to_dot(\"name\" => name.to_s.capitalize)\n }\n end", "def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end", "def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end", "def set_edge_name(node_city, name)\n @edges[node_city].name = name\n end", "def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end", "def get_query_parameter(original_name)\n raise StandardError, 'original_name cannot be null' if original_name.nil?\n case original_name\n when \"count\"\n return \"%24count\"\n when \"expand\"\n return \"%24expand\"\n when \"filter\"\n return \"%24filter\"\n when \"orderby\"\n return \"%24orderby\"\n when \"search\"\n return \"%24search\"\n when \"select\"\n return \"%24select\"\n when \"skip\"\n return \"%24skip\"\n when \"top\"\n return \"%24top\"\n else\n return original_name\n end\n end", "def update_visit_name(old_name, new_name)\n visit_names.each do |visit|\n if visit.value == old_name\n visit.set new_name\n save.click\n break\n end\n end\n\n end", "def rewrite_statement_uris(old_subject, new_subject)\n graph.query(subject: old_subject).each do |st|\n graph.delete(st)\n\n st.subject = new_subject\n st.object = new_subject if st.object == old_subject\n graph.insert(st)\n end\n\n graph.query(object: old_subject).each do |st|\n graph.delete(st)\n\n st.object = new_subject\n graph.insert(st)\n end\n end", "def get_series_url(name:, language: nil, user: nil)\n base_url + get_series_path + build_query(get_series_params(name: name, language: language, user: user))\n end", "def graph=(graph)\n raise Deployment::InvalidArgument.new self, 'Graph should be a graph object!', graph unless graph.is_a? Deployment::Graph\n graph.node = self\n @graph = graph\n end", "def graph_params\n params.require(:graph).permit(:name, :description, :code)\n end", "def clean_query_string(q)\n ERB::Util.url_encode(q.gsub(/-|\\(|\\)|:/, \"\"))\n end", "def replacer\n lambda do |resource_id, _graph|\n parent_id = Hyrax.config.translate_uri_to_id.call(parent_url)\n return parent_url + resource_id.sub(parent_id, '') if resource_id.start_with?(parent_id)\n Rails.application.routes.url_helpers.solr_document_url(resource_id, host: hostname)\n end\n end", "def update_facebook_query project_id, query_id, opts={}\n put \"projects/#{project_id}/facebookqueries/#{query_id}\", opts\n end", "def replace_names!(former,nname)\n # Recurse on the match.\n self.match.replace_names!(former,nname)\n # Recurse on the statement.\n self.statement.replace_names!(former,nname)\n end", "def to_graph(graph = RDF::Graph.new)\n Array(value).each do |val|\n graph << RDF::Statement.new(subject, predicate, val)\n end\n graph\n end", "def to_sparql(**options)\n self.distinguished? ? super : \"_:_nd#{self.name}\"\n end", "def set_refer_name(name)\n @refer_name = name\n end", "def set_name name\n\t\t\t@name = name.gsub \" (#{@addr})\", ''\n\t\tend", "def resolve_name(name)\n name = resolve_name_without_remap(name)\n for k, v in @remappings\n if name.end_with?(k)\n if Resolver.global_name?(v)\n name = v\n else\n if name == k\n name = v\n else\n n = \"#{name[0..name.length-k.length-1]}/#{v}\"\n name = Resolver.canonicalize_name(n)\n end\n end\n break\n end\n end\n resolve_name_without_remap(name)\n end", "def run_test(test, graph_name)\n query = File.read test\n query = add_graph(query, graph_name)\n results = @sparql.query query\n \n graph = RDF::Graph.new\n graph << results\n \n if graph.empty?\n {}\n else\n convert_to_json graph\n end \n end", "def games_query\n sparql = <<-SPARQL\n SELECT ?item WHERE {\n ?item wdt:P31 wd:Q7889; # Instances of video games.\n rdfs:label ?label filter(lang(?label) = \"en\"). # with a label\n }\n SPARQL\n\n return sparql\n end", "def deprecated_rewrite_url\n return nil unless url\n rewritten_url = Vanagon::Component::Source::Rewrite.parse_and_rewrite(url)\n url == rewritten_url ? nil : rewritten_url\n end", "def data_graph_uri(slug)\n \"http://#{PublishMyData.local_domain}/graph/#{slug}\"\n end", "def query_pattern(pattern, **options, &block)\n return super unless pattern.graph_name == DEFAULT_GRAPH\n\n if block_given?\n pattern = pattern.dup\n pattern.graph_name = nil\n\n each_statement do |statement|\n yield statement if (statement.graph_name == DEFAULT_GRAPH ||\n statement.graph_name.nil?) && pattern === statement\n end\n else\n enum_for(:query_pattern, pattern, options)\n end\n end", "def replace_names!(former,nname)\n # By default: try to replace the name recursively.\n self.each_node_deep do |node|\n if node.respond_to?(:name) && node.name == former then\n node.set_name!(nname)\n end\n end\n end", "def exists? (name:, database: Arango.current_database)\n args = { name: name }\n result = Arango::Requests::Graph::Get.execute(server: database.server, args: args)\n result.graphs.map { |c| c[:name] }.include?(name)\n end" ]
[ "0.6520261", "0.6208744", "0.5916594", "0.5869182", "0.58667487", "0.58667487", "0.5754367", "0.5557972", "0.5550149", "0.54677993", "0.51732403", "0.50450736", "0.5033111", "0.5012443", "0.5012443", "0.49952966", "0.493606", "0.48204702", "0.4816851", "0.4719867", "0.4719867", "0.4719867", "0.47162676", "0.46513307", "0.46388704", "0.46069384", "0.46043584", "0.45443943", "0.4526901", "0.452307", "0.45053503", "0.448886", "0.44663095", "0.44513547", "0.44468093", "0.44453812", "0.441877", "0.4397625", "0.43943015", "0.43943015", "0.43943015", "0.43914852", "0.43861246", "0.43851522", "0.43851522", "0.43851522", "0.43820697", "0.43820697", "0.43659735", "0.43654373", "0.43598446", "0.43598446", "0.43598446", "0.43584552", "0.4355718", "0.43506694", "0.4347763", "0.4330914", "0.4330207", "0.4330207", "0.4330207", "0.4330207", "0.43297023", "0.43297023", "0.43271565", "0.43195578", "0.43195578", "0.43195578", "0.43187618", "0.43187618", "0.43186414", "0.430675", "0.43053496", "0.43048373", "0.42999527", "0.42905766", "0.42788318", "0.42788035", "0.42788035", "0.42740342", "0.4270009", "0.42694116", "0.4261794", "0.42574954", "0.4257116", "0.42515954", "0.42480567", "0.4240893", "0.4239355", "0.423721", "0.42339027", "0.4233115", "0.42250842", "0.42241293", "0.42094868", "0.42045882", "0.42044654", "0.42017373", "0.41990998", "0.4198959" ]
0.73585975
0
Timestamps the provided `graph` identified with `graph_name`
def add_timestamp(graph_name, graph) now = RDF::Literal::DateTime.new DateTime.now.iso8601 graph << RDF::Statement.new(RDF::URI(graph_name), RDF::DC.issued, now) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updated_time( params={} )\n updated_time = get_connections(\"updated_time\", params)\n return map_connections updated_time, :to => Facebook::Graph::Generic\n end", "def graph t\n puts \"graphing #{@graphname}\"\n $end_time = Time.now.to_i - @step + 1\n $start_time = $end_time - 3600 #one hour\n $unc, $ucr, $unr = t\n RRD.graph(\n \"#{@graphname}\",\n \"--title\", \"#{@name.reverse.chomp(@r_db_path).reverse.chomp(\".rrd\")}\",\n# \"--vertical-label\",\"Ambient Temp\",\n \"--start\", \"#{$start_time}\",\n \"--end\", \"#{$end_time}\",\n \"--interlaced\",\n \"--imgformat\", \"PNG\",\n \"DEF:amb_#{@ds_label}=#{@name}:#{@ds_label}:#{@rra_cf}\",\n \"LINE1:amb_#{@ds_label}#555555:Ambient Temperature\",\n \"HRULE:#{$unc}#FF4500:Threshold - Non-Critical\",\n \"HRULE:#{$ucr}#FF0000:Threshold - Critical\"\n )\n end", "def write_graph(name)\n return unless Puppet[:graph]\n\n Puppet.settings.use(:graphing)\n\n file = File.join(Puppet[:graphdir], \"%s.dot\" % name.to_s)\n File.open(file, \"w\") { |f|\n f.puts to_dot(\"name\" => name.to_s.capitalize)\n }\n end", "def graph_name; @options[:graph_name]; end", "def graph_name\n nil\n end", "def name(name)\n @graph_name = name\n self\n end", "def calculate_graph_diffs(graphname1, graphname2, diffgraphname)\n update(\"INSERT { GRAPH <#{diffgraphname}> { ?s ?p ?o . }} WHERE { GRAPH <#{graphname1}> { ?s ?p ?o } FILTER NOT EXISTS { GRAPH <#{graphname2}> { ?s ?p ?o }}}\")\nend", "def graph=(graph)\n @graph = graph\n end", "def get_old_graphs(time, query_endpoint, namespace)\n sparql_query = SPARQL::Client.new query_endpoint\n limit = time.ago.xmlschema\n query = %Q{\n PREFIX dcterms: <http://purl.org/dc/terms/>\n PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n\n SELECT DISTINCT ?graph\n WHERE {\n GRAPH ?graph {\n ?graph dcterms:issued ?issued .\n FILTER (\n (STRSTARTS(STR(?graph), \"#{namespace}\"))\n &&\n (?issued < \"#{limit}\"^^xsd:dateTime)\n )\n }\n }\n }\n response = sparql_query.query query\n response.map do |binding|\n binding[:graph].to_s\n end\n end", "def begin_transaction(graph_name)\n RDF::Transaction.new(graph: graph_name)\n end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def timestamp; end", "def graph_done(graph_name)\n @graphs[graph_name] = true\n end", "def add_graph(query, graph_name)\n graph_uri = \"<#{graph_name}>\"\n query.gsub(/\\?validatedGraph/i, graph_uri)\n end", "def graph_params_changed\n graph.keys.each do |mod|\n mod.graph_params_changed\n end \n end", "def graph_time_data\r\n g = Gruff::Line.new\r\n g.data :data, @time_data\r\n end", "def timestamp_name(timestamp)\n [\"ts\", timestamp.to_f].join(\":\")\n end", "def record_creation_timestamp(path, timestamp)\n # Hook method: Linux filesystems doesn't store creation datetime\n end", "def clear_graph(graph_name)\n @sparql_update.clear(:graph, graph_name)\n end", "def timestamps(metric_name, start_timestamp, end_timestamp=Time.now)\n stats(metric_name, start_timestamp, end_timestamp).map{|s| s[:timestamp]}\n end", "def datasetid_to_timestamp(datasetid)\n timestamped = datasetid.id\n @timestamped = timestamp.id.generation_time.strftime('%d-%m-%Y %H:%M')\nend", "def graph_name=(value)\n operands.each do |operand|\n operand.graph_name = value if operand.respond_to?(:graph_name) && operand.graph_name != false\n end\n value\n end", "def graph_name=(value)\n operands.each do |operand|\n operand.graph_name = value if operand.respond_to?(:graph_name) && operand.graph_name != false\n end\n value\n end", "def get_time_labels_one_day_graph\n return [\"12:00am\", \"03:00am\", \"06:00am\", \"09:00am\", \"12:00pm\", \"03:00pm\", \"06:00pm\", \"09:00pm\", \"12:00am\"]\n end", "def timestamp\n self[:timestamp]\n end", "def timestamp\n timestamp_to_datetime(static_data(\"timestamp\"))\n end", "def timestamp\n _timestamp.as_time\n end", "def annotate_nodes(graph)\n graph.nodes.each_value do |node|\n # The Java class of the node.\n node_class = node.props.dig(:node_class, :node_class)\n\n # IGV renders labels using a template, with parts that are replaced\n # with other properties. We will modify these templates in some\n # cases.\n name_template = node.props.dig(:node_class, :name_template)\n\n # For constant nodes, the rawvalue is a truncated version of the\n # actual value, which is fully qualified. Instead, produce a simple\n # version of the value and don't truncate it.\n if node_class == 'org.graalvm.compiler.nodes.ConstantNode'\n if node.props['value'] =~ /Object\\[Instance<(\\w+\\.)+(\\w*)>\\]/\n node.props['rawvalue'] = \"instance:#{Regexp.last_match(2)}\"\n end\n name_template = 'C({p#rawvalue})'\n end\n\n # The template for FixedGuardNode could be simpler.\n if %w[\n org.graalvm.compiler.nodes.FixedGuardNode\n org.graalvm.compiler.nodes.GuardNode\n ].include?(node_class)\n name_template = if node.props[:negated]\n 'Guard, else {p#reason/s}'\n else\n 'Guard not, else {p#reason/s}'\n end\n end\n\n # The template for InvokeNode could be simpler.\n if node_class == 'org.graalvm.compiler.nodes.InvokeNode'\n name_template = 'Call {p#targetMethod/s}'\n end\n\n # The template for InvokeWithExceptionNode could be simpler.\n if node_class == 'org.graalvm.compiler.nodes.InvokeWithExceptionNode'\n name_template = 'Call {p#targetMethod/s} !'\n end\n\n # The template for CommitAllocationNode could be simpler.\n if node_class == 'org.graalvm.compiler.nodes.virtual.CommitAllocationNode'\n name_template = 'Alloc'\n end\n\n # The template for org.graalvm.compiler.nodes.virtual.VirtualArrayNode includes an ID that we don't normally need.\n if node_class == 'org.graalvm.compiler.nodes.virtual.VirtualArrayNode'\n name_template = 'VirtualArray {p#componentType/s}[{p#length}]'\n end\n\n # The template for LoadField could be simpler.\n if node_class == 'org.graalvm.compiler.nodes.java.LoadFieldNode'\n name_template = 'LoadField {x#field}'\n end\n\n # The template for StoreField could be simpler.\n if node_class == 'org.graalvm.compiler.nodes.java.StoreFieldNode'\n name_template = 'StoreField {x#field}'\n end\n\n # We want to see keys for IntegerSwitchNode.\n if node_class == 'org.graalvm.compiler.nodes.extended.IntegerSwitchNode'\n name_template = 'IntegerSwitch {p#keys}'\n end\n\n # Use a symbol for PiNode.\n if node_class == 'org.graalvm.compiler.nodes.PiNode'\n name_template = 'π'\n end\n\n # Use a symbol for PhiNode.\n if node_class == 'org.graalvm.compiler.nodes.ValuePhiNode'\n name_template = 'ϕ'\n end\n\n # Better template for frame states.\n if node_class == 'org.graalvm.compiler.nodes.FrameState'\n name_template = 'FrameState {x#state}'\n end\n\n # Show the stamp in an InstanceOfNode.\n if node_class == 'org.graalvm.compiler.nodes.java.InstanceOfNode'\n name_template = 'InstanceOf {x#simpleStamp}'\n end\n\n if name_template.empty?\n # If there is no template, then the label is the short name of the\n # Java class, without '...Node' because that's redundant.\n short_name = node_class.split('.').last\n short_name = short_name.slice(0, short_name.size - 'Node'.size) if short_name.end_with?('Node')\n label = short_name\n else\n # Render the template.\n label = render_name_template(name_template, node)\n end\n\n # Annotate interesting stamps.\n if node.props['stamp'] =~ /(\\[\\d+ \\- \\d+\\])/\n node.props[:out_annotation] = Regexp.last_match(1)\n end\n\n # That's our label.\n node.props[:label] = label\n\n # Set the :kind property.\n if node_class.start_with?('org.graalvm.compiler.nodes.calc.') ||\n node_class.start_with?('org.graalvm.compiler.replacements.nodes.arithmetic.')\n kind = 'calc'\n else\n kind = NODE_KIND_MAP[node_class] || 'other'\n end\n node.props[:kind] = kind\n end\n end", "def timestamp\n Time.at((attributes[:timestamp] || Time.now).to_i)\n end", "def get_Timestamp()\n \t return @outputs[\"Timestamp\"]\n \tend", "def get_Timestamp()\n \t return @outputs[\"Timestamp\"]\n \tend", "def timestamp\n _timestamp.as_time\n end", "def timestamp\n memoized_info[:local_timestamp]\n end", "def save_timestamp_changes(root)\n iterator = Iterators::PreOrderEntriesIterator.new(root)\n while iterator.has_next?\n next_entry = iterator.next_item\n record_creation_timestamp(next_entry.path, next_entry.new_created_datetime)\n record_modification_timestamp(next_entry.path, next_entry.new_modified_datetime)\n end\n end", "def graph(tweets)\n nodes = nodes(tweets)\n edges(nodes, tweets)\n nodes.values.sort!\n end", "def apply_function_current_timestamp(scope, ast)\n return scope, \"(current_timestamp at time zone 'UTC')\"\n end", "def timestamp=(_arg0); end", "def timestamp=(_arg0); end", "def timestamp=(_arg0); end", "def timestamp=(_arg0); end", "def initialize(graph)\n @graph = graph\n end", "def gv_graph_name\n [:name, :id].each do |method|\n return send method if respond_to? method and send method\n end\n 'graph'\n end", "def timestamp\n @timestamp ||= Time.now.xs_datetime\n end", "def add_graph(query_template)\n query_template.gsub(/\\?graph/i, \"<#{@named_graph}>\")\n end", "def timestamp\n DateTime.now.strftime(\"%Y%m%d%H%M%S\")\n end", "def new_timestamp # :nodoc:\n @properties['timestamp'].dup\n end", "def initialize(graph)\n @graph = graph\n end", "def initialize(graph)\n @graph = graph\n end", "def initialize(graph)\n @graph = graph\n end", "def graph_name=(name)\n formulae[name] = self\n @options[:graph_name] = name\n end", "def local_timestamp(body)\n @var[:timestamp] = body\n _save_env\n _notice \"Timestamp format changed\"\nend", "def timestamp\n self.created_at.to_s(:db)\n end", "def timestamp t\n\n\t\t::Pantheios::Core.timestamp t, nil\n\tend", "def update_timestamp(work)\n # these timestamps are the Hyrax managed fields, not rails timestamps\n if work.date_uploaded\n work.date_modified = Time.current\n else\n work.date_uploaded = Time.current\n end\n end", "def clear_graph(graphname)\n update(\"WITH <#{graphname}> DELETE { ?s ?p ?o } WHERE { ?s ?p ?o .}\")\nend", "def timestamped_index\n time_str = Time.now.strftime('%Y%m%d.%H%M%S') # TODO: Make the format configurable\n \"#{elasticsearch_index}-#{time_str}\".to_sym\n end", "def save_graph_values\n @dataset.graph_values.values = @values.fetch(:graph_values)\n @dataset.graph_values.save\n end", "def timestamp() @timestamp ||= Time.now.strftime(\"%Y%m%d%H%M%SZ\") end", "def record_access_timestamp(path, timestamp)\n # Hook method: Already stored with File.utime\n end", "def timestamp\n #data[\"timestamp\"] as? TimeInterval ?? 0\n timestamp = data[\"timestamp\"]\n timestamp.to_i || 0\n end", "def timestamp\n @timestamp ||= @attributes['timestamp'] ? Time.zone.at(@attributes['timestamp']) : nil\n end", "def timestamp\n @timestamp ||= @attributes['timestamp'] ? Time.zone.at(@attributes['timestamp']) : nil\n end", "def timestamp\n Time.now.to_s\n end", "def generate_graph\n end", "def update_timestamps(prefix)\n new_time = Time.now.utc\n recorder = @recorders[prefix]\n recorder.views_data.each do |view_data|\n view_data.data.each_value do |aggr_data|\n # Apply this only to GAUGE metrics. This could fail if the metric uses\n # Distribution or other fancier aggregators.\n aggr_data.add aggr_data.value, new_time if aggr_data.is_a? OpenCensus::Stats::AggregationData::LastValue\n end\n end\n end", "def update_graph\n connection.execute <<-EOS\n UPDATE #{oqgraph_table_name} \n SET origid = #{self.send(self.class.from_key)}, \n destid = #{self.send(self.class.to_key)}, \n weight = #{self.send(self.class.weight_column)} \n WHERE origid = #{self.send(self.class.from_key + '_was')} AND destid = #{self.send(self.class.to_key + '_was')};\n EOS\n end", "def timestamp(datetime)\n if datetime.respond_to?(:strftime)\n time_tag(datetime,\n format_date(datetime,\n :format => :full_date,\n :time => true\n ),\n :pubdate => true\n )\n end\n end", "def get_request_timestamp\n\t\treturn @transport.get_path(\"meta\",\"datetime\")\n\tend", "def graph_params\n params.fetch(:graph, {})\n end", "def graph\n initialize_connection unless @graph\n sleep API_CALL_DELAY\n @graph\nend", "def graph(parameters = {}, invocation_options = {})\n exec(RubyTerraform::Commands::Graph,\n parameters, invocation_options)\n end", "def timestamp\n {\n \"u:Timestamp\" => {\n \"u:Created\" => now.xs_datetime,\n \"u:Expires\" => (now + 60 * 5).xs_datetime,\n :order! => [\"u:Created\", \"u:Expires\"],\n },\n :attributes! => { \"u:Timestamp\" => { \"u:Id\" => timestamp_id, \"xmlns:u\" => WSUNamespace } },\n }\n end", "def to_graph(passed_graph = RDF::Graph.new)\n passed_graph << graph\n end", "def timestamp\n Time.now.to_i.to_s\n end", "def timestamp\n attribute_prop(4)\n end", "def timestamp_attributes_for_update\n ['last_activity']\n end", "def time\n on_each_node :time\n end", "def graph\n begin\n FileUtils.mkdir_p self.location_of_graphs unless Dir.exist? self.location_of_graphs\n first = ::Ms::ComparisonGrapher.slice_matches self.msrun_firsts\n second = ::Ms::ComparisonGrapher.slice_matches self.msrun_seconds\n files = ::Ms::ComparisonGrapher.graph_matches first, second, self.location_of_graphs\n rescue StandardError => e\n Rails.logger.error \"Graphing failed inside Comparison#graph. Ruh oh! #{e.class}: #{e.message} \\n#{e.backtrace}\"\n Alert.create({ :email => false, :show => true, :description => \"Error creating the comparison graphs.\" })\n FileUtils.remove_dir self.location_of_graphs if Dir.exist? self.location_of_graphs\n end\n end", "def get_recent_obs_graph(title)\n # all datasets for today\n datasets = get_today_datasets\n return \"\" if datasets.keys.empty?\n # temperature datasets for graphing\n temps = {}\n labels = Array.new(10){|i| 10-i}\n # union of temps for bounds \n union = [] \n # process datasets\n datasets.keys.each do |key| \n next if datasets[key].length != 10\n temps[key] = []\n datasets[key].each do |record| \n temps[key] << ((record[:count]>0) ? record[:temp].round(2) : '_')\n union << record[:temp] if record[:count] > 0\n end\n end\n return \"\" if temps.keys.empty?\n # bounds\n min, max = union.min, union.max\n # make the graph\n return make_multi_series_graph(temps, labels, min, max, title)\n end", "def graph=(graph)\n raise Deployment::InvalidArgument.new self, 'Graph should be a graph object!', graph unless graph.is_a? Deployment::Graph\n graph.node = self\n @graph = graph\n end", "def timestamp\n nil\n end", "def timestamps\n assocs = reflect_on_all_associations.select {|a|\n [:belongs_to, :has_one, :has_many].include?(a.macro) && a.klass.chrono?\n }\n\n models = [self].concat(assocs.map {|a| a.klass.history})\n fields = models.inject([]) {|a,m| a.concat m.quoted_history_fields}\n\n relation = self.\n joins(*assocs.map(&:name)).\n select(\"DISTINCT UNNEST(ARRAY[#{fields.join(',')}]) AS ts\").\n order('ts')\n\n relation = yield relation if block_given?\n\n sql = \"SELECT ts FROM ( #{relation.to_sql} ) foo WHERE ts IS NOT NULL AND ts < NOW()\"\n sql.gsub! 'INNER JOIN', 'LEFT OUTER JOIN'\n\n connection.on_schema(Adapter::HISTORY_SCHEMA) do\n connection.select_values(sql, \"#{self.name} periods\").map! do |ts|\n Conversions.string_to_utc_time ts\n end\n end\n end", "def get_recent_days_graph(title)\n # no data check\n return \"\" if @dataset.keys.length == 0\n # temperature datasets for graphing\n temps = {}\n # union of temps for bounds \n union = [] \n # process datasets\n @dataset.keys.each do |station|\n @dataset[station].keys.each do |date|\n key = date.strftime(\"%d/%m/%Y\")\n raise \"date conflict in datasets for #{date}\" if !temps[key].nil?\n temps[key] = []\n @dataset[station][date].each do |record|\n if record[:count] > 0 \n temps[key] << record[:temp].round(2)\n union << record[:temp]\n else\n temps[key] << \"_\"\n end\n end\n end\n end \n # no prep'ed data check\n return \"\" if temps.keys.length == 0 \n # bounds\n min, max = union.min, union.max\n # make the graph\n return make_multi_series_graph(temps, get_time_labels_one_day_graph, min, max, title)\n end", "def graph_pressure\n graphfile = @hplc_object.graph\n end", "def touch_index_timestamp\n self.index_timestamp = Time.now\n end", "def load_data(data)\n sha1 = Digest::SHA1.hexdigest data.dump(:turtle)\n graph_name = RDF::URI.new(@namespace + sha1)\n data = add_timestamp(graph_name, data)\n\n @sparql_update.insert_data(data, graph: graph_name)\n graph_name\n end", "def dfs_topological_sort\n # sorted by finished time reversely and collect node names only\n timestamp, = self.depth_first_search\n timestamp.sort {|a,b| b[1][1] <=> a[1][1]}.collect {|x| x.first }\n end", "def tsort_cyclic(graph)\n fag = feedback_arc_graph(graph)\n reduced_graph = subtract_edges_graph(graph, fag)\n GraphHash.from(reduced_graph).tsort\n end", "def timestamp_property(name)\n val = property(name)\n if val && (not val.kind_of? Time)\n val = (not val.empty?) ? Time.parse(val) : nil\n property_cache[name] = val\n end\n val\n end", "def graph(name, options = {}, &block)\n GraphViz::DSL.new(name, options.merge( { :type => \"graph\" } ), &block).graph\nend", "def current_timestamp\n Time.now.strftime \"%Y%m%dT%H:%M:%S\"\n end", "def get_creation_timestamp(path)\n nil\n end", "def graph(hash, name)\n Haml::Engine.new(File.read(\"../templates/hist.haml\")).def_method(hash, :render, :title)\n begin\n hist = File.open(\"#{name}\", 'w')\n hist.write(hash.render(:title => name))\n rescue IOError => e\n puts e\n end\n end", "def operation_timestamp # :nodoc:\n # Format is \"document.appendMarkup1260632282946\" (number is timestamp)\n @properties['operationId'] =~ /(\\d+)$/\n time_from_json($1)\n end", "def graph_hash_to_file(file_path, graph_hash)\n file = File.new(\"#{file_path}.txt\", \"w\")\n graph_hash.keys.each do |edge|\n weight = graph_hash[edge]\n u = edge[0]\n v = edge[1]\n file.puts \"#{u},#{v}=#{weight}\"\n end\n end", "def timestamp\n begin\n File.mtime(name)\n rescue Errno::ENOENT\n Rake::LATE\n end\n end" ]
[ "0.56504506", "0.5509907", "0.54478157", "0.5300815", "0.52966267", "0.5275051", "0.5235053", "0.5184955", "0.5171625", "0.51687694", "0.5041701", "0.5041701", "0.5041701", "0.5041701", "0.5041701", "0.5041701", "0.50090104", "0.5002943", "0.49890962", "0.49210632", "0.49038872", "0.49037126", "0.49005288", "0.48789865", "0.4864182", "0.48626605", "0.48626605", "0.48161632", "0.48009872", "0.47923806", "0.47494268", "0.47477138", "0.47253728", "0.46876985", "0.46876484", "0.46454695", "0.46435502", "0.4625716", "0.4620354", "0.46185827", "0.46156278", "0.46156278", "0.46156278", "0.46156278", "0.45959708", "0.45898435", "0.45860225", "0.45831126", "0.4573542", "0.4539736", "0.45377725", "0.45377725", "0.4531397", "0.45270818", "0.45221794", "0.45098376", "0.45092577", "0.45027635", "0.45018598", "0.4499956", "0.4486974", "0.44826806", "0.44796357", "0.4466754", "0.4465684", "0.4465684", "0.4462992", "0.44586134", "0.4455495", "0.4453271", "0.44516435", "0.44497827", "0.44479537", "0.44461536", "0.44421613", "0.4441973", "0.44386274", "0.44335514", "0.44314712", "0.44308567", "0.44199765", "0.4419169", "0.4418721", "0.4414673", "0.44074297", "0.4399719", "0.43968835", "0.43956602", "0.4395266", "0.43949115", "0.43929946", "0.4391346", "0.4386525", "0.4373678", "0.43714112", "0.4365062", "0.4361714", "0.43558583", "0.43527937", "0.43474686" ]
0.72010756
0
Clears the graph identified with `graph_name`
def clear_graph(graph_name) @sparql_update.clear(:graph, graph_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_graph(graphname)\n update(\"WITH <#{graphname}> DELETE { ?s ?p ?o } WHERE { ?s ?p ?o .}\")\nend", "def fill_destroy_graph( graph )\n fill_save_graph( graph )\n end", "def clear_graph\n @g_inputs = []\n end", "def clear(graph_uri = nil)\n req_params = {}\n req_params[:params] = { 'graph-uri' => graph_uri } if graph_uri\n\n database.execute_request(:post, \"/#{id}/clear\", req_params)\n\n true\n end", "def delete\n @connection.call('GRAPH.DELETE', @graphname)\n rescue Redis::CommandError => e\n raise DeleteError, e\n end", "def clear_cluster_by_name(name)\r\n Cluster.where(:word_en_name => name).delete_all\r\n Gitem.where(:word_en_name => name).update_all(:cluster_id => nil)\r\n end", "def destroy\n save_graph = RDF::Graph.new\n fill_save_graph save_graph\n save_graph.each do |s|\n puts s.inspect\n end\n Db.delete_data( save_graph, :graph => klass.object_graph )\n end", "def graph_name\n nil\n end", "def clear\n @adjacencies[:in].clear\n @adjacencies[:out].clear\n @vertex = nil\n end", "def destroy\n success = ActiveRecord::Base.transaction do\n @graph.destroy\n @graph = $mfclient.delete_graph(@graph.path) rescue nil\n end\n respond_to do |format|\n format.html { redirect_to graphs_url }\n format.json { head :no_content }\n end\n end", "def delete\n unless graph.nil?\n result = graph.remove_artifact(self)\n @graph = nil\n result\n end\n end", "def graph_done(graph_name)\n @graphs[graph_name] = true\n end", "def ungraphed\n clone(:graph=>nil, :graph_aliases=>nil) # SEQUEL5: Remove :graph_aliases\n end", "def destroy\n super do\n graph.delete [source.to_term, nil, nil]\n parent.delete [parent, nil, source.to_term]\n end\n end", "def delete!\n graph.remove_vertex self\n end", "def destroy\n @graph.destroy\n\n respond_to do |format|\n format.html { redirect_to graphs_url }\n format.json { head :no_content }\n end\n end", "def name(name)\n @graph_name = name\n self\n end", "def destroy\n @graph.destroy\n respond_to do |format|\n format.html { redirect_to graphs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_graph.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_graphs_url, notice: 'Graph was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def clear(name=nil)\n if name\n raise \"Undefined trace -- #{name}\" unless @@index.key?(name)\n @@procs.delete(@@index.delete(name))\n else\n deactivate\n @@index = {}\n @@procs = []\n end\n end", "def clear_vertex\n for rel in sorted_relations\n rel.remove(self)\n end\n\tend", "def destroy\n @graph = Graph.find(params[:id])\n @graph.destroy\n \n Action.log :controller => params[:controller], :action => params[:action], :target_id => params[:id], :user => current_user\n\n respond_to do |format|\n format.html { redirect_to :root, notice: 'Graph was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def remove_from_graph\n # Ignores trying to delete nonexistent records\n connection.execute <<-EOS\n DELETE IGNORE FROM #{oqgraph_table_name} WHERE origid = #{self.send(self.class.from_key)} AND destid = #{self.send(self.class.to_key)};\n EOS\n end", "def delete!\n graph.remove_edge element\n end", "def delete!\n graph.remove_edge element\n end", "def delete!\n graph.remove_vertex element\n end", "def orchio_delete_graph(kind, to_collection, to_key)\n response = client.send_request(\n :delete,\n inst_args(\n kind: kind,\n to_collection: to_collection,\n to_key: to_key,\n path: \"?purge=true\"\n ))\n orchio_status response, 204\n end", "def graph_name=(name)\n formulae[name] = self\n @options[:graph_name] = name\n end", "def delete!\n graph.removeEdge element\n end", "def forget_dependencies_for(object)\n @graph.delete_edges_to(object)\n end", "def clear\n @nodes = Hash.new\n @ways = Hash.new\n @relations = Hash.new\n end", "def delete!\n graph.removeVertex element\n end", "def destroy\n @graph_membership_graph = GraphMembershipGraph.find(params[:id])\n @graph_membership_graph.destroy\n\n respond_to do |format|\n format.html { redirect_to graph_membership_graphs_url }\n format.json { head :no_content }\n end\n end", "def on_remove\n @context.notifications.off(\"graph.start\", self)\n @context.notifications.off(\"graph.stop\", self)\n\n io.outputs.each { |k, o| @context.connections.delete(o.guid) }\n io.unregister_inputs\n var.unregister\n stop\n end", "def delete_graph(kind, to_collection, to_key)\n retval orchio_delete_graph kind, to_collection, to_key\n end", "def destroy\n expire_page :action => :index\n expire_page :action => :show\n \n @ganglia_graph = GangliaGraph.get(params[:id])\n @ganglia_graph.destroy\n\n respond_to do |format|\n format.html { redirect_to(ganglia_graphs_url) }\n format.xml { head :ok }\n end\n end", "def clear\n\t\t@predecessor = nil\n\t\t@visited = false\n\t\t@node_string = \" \"\n\tend", "def clear!\n raise NoCurrentForLabelStatement if working_labels.empty?\n working_labels.each{|l| labels.delete(l)}\n end", "def facesvg_reset\n # Delete the cut path layout\n su_operation(RESET_LAYOUT) { profile().reset() }\n end", "def clear_node(node)\n if node != nil\n @visited_actors.clear\n end\n end", "def clear\n @redis.del @name\n end", "def delete(name)\n @connections.delete(name)\n end", "def destroy\n current_user.graph.destroy(current_user.id) if current_user\n super\n end", "def clear(path)\n set_internal(path, nil)\n end", "def remove(name)\n lock\n read\n @inv.each_pair { |_group, nodes|\n nodes.delete(name)\n }\n save!\n unlock\n end", "def clear(name = nil)\n if name.nil?\n @field_objs.each { |f| f.clear unless f.nil? }\n else\n obj = find_obj_for_name(name.to_s)\n obj.clear unless obj.nil?\n end\n end", "def erase\n @nodes.erase\n end", "def reset\n @name = nil\n end", "def clear\n @parent = nil\n end", "def clear\n # clear the lineage\n @lineage.clear\n # if the visited hash is not shared, then clear it\n @visited.clear unless @options.has_key?(:visited)\n end", "def unset(name)\n update(name, nil)\n end", "def clear_rdf\n ActiveRDF::FederationManager.delete_all(self)\n end", "def disconnect(name)\n if connected?(name)\n @node.context.notifications.off([@connected_variables[name], \"remove\"], self)\n end\n @connected_variables.delete(name)\n end", "def clear!(name)\n redis.del(rk_exists_name(name), rk_lock_name(name))\n end", "def reset\n session.unset(@name)\n end", "def ll_clear()\n @head = nil\n @tail = nil\n @num_nodes = 0\n end", "def graph_name; @options[:graph_name]; end", "def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end", "def delete_node\n delete(@nodename)\n end", "def delete_all_connections!\n @connections.each { |cnx| cnx.parent = nil }\n @connections = []\n end", "def clear\n @dataset.clear\n end", "def clear\n @atlas.clear\n end", "def nuke\n self.open_graph_event.destroy unless self.open_graph_event.nil?\n self.teamsheet_entries.destroy_all\n self.messages.destroy_all\n self.activity_items.destroy_all\n self.result.destroy unless self.result.nil?\n self.destroy\n end", "def shutdown\n factory.close\n Pacer.open_graphs.delete url\n end", "def cleanup_dfs\n # clean up vertices attributes set during dfs\n @vertices.values.each do |vertex|\n vertex.color = nil\n vertex.predecessor = nil\n vertex.discovery = nil\n vertex.finish = nil\n end\n @time = 0\n end", "def clear!\n visit(url)\n reset_session!\n end", "def remove(name)\n @configuration_names.delete(name)\n @configurations.delete(name)\n # Clear the current configuration tree and then refresh the whole tree.\n clear\n refresh\n end", "def unlink(other)\n self.class.graph.disjoin(vertex, other.vertex)\n end", "def destroy\n @conditioninfograph = Conditioninfograph.find(params[:id])\n @conditioninfograph.destroy\n\n respond_to do |format|\n format.html { redirect_to conditioninfographs_url }\n format.json { head :no_content }\n end\n end", "def purge_nodes(name)\n nodes = nodes_for_environment(name)\n futures = []\n\n nodes.each do |node|\n futures << ridley.client.future(:delete, node)\n futures << ridley.node.future(:delete, node)\n end\n\n futures.map(&:value)\n end", "def clear\n @names = {}\n @processes = []\n end", "def clear\n end", "def clear\n end", "def empty\n delete_old_nodes 0\n end", "def destroy\n @chart = Chart.find(params[:id])\n @chart.chartnodes.destroy_all\n @chart.destroy\n\n respond_to do |format|\n format.html { redirect_to charts_url }\n format.json { head :no_content }\n end\n end", "def clear\n @root = nil\n end", "def clear()\n shutdown()\n @flows = {}\n _clear()\n end", "def clearOption(name)\n @options.delete(name)\n end", "def destroy\n containers.each { |con| con.remove(self) if con.container? }\n @metagraph << RDF::Statement(subject_uri, RDF.type, RDF::OWL.Nothing)\n self\n end", "def write_graph(name)\n return unless Puppet[:graph]\n\n Puppet.settings.use(:graphing)\n\n file = File.join(Puppet[:graphdir], \"%s.dot\" % name.to_s)\n File.open(file, \"w\") { |f|\n f.puts to_dot(\"name\" => name.to_s.capitalize)\n }\n end", "def clear!(name)\n ivar_remove(name)\n end", "def clear\n namespace + '_clear'\n end", "def clear() end", "def clear() end", "def clear!\n visit(@address)\n reset_session!\n end", "def clear\n end", "def clear\n end", "def clear\n end", "def delete_label(name)\n @labels.delete(name.to_sym)\n end", "def destroy\n @gauge_graph.destroy\n respond_to do |format|\n format.html { redirect_to gauge_graphs_url, notice: 'Gauge graph was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def clear\n end", "def clear_defaults( name )\n @aliases.delete( name )\n @defaults.delete( name )\n @callbacks.delete( name )\n self\n end", "def clear\n @level = 0\n @out = []\n @labels = []\n self\n end", "def clear_paths\n @paths.clear\n end", "def clear_model\n @panel.remove_all\n @connections.clear\n @entities.clear\n end", "def unlink_dataset(name)\n d = dataset(name)\n return nil if d.nil?\n\n self.metadata[:datasets].delete(name)\n save\n if d.ref? && d.active?\n recalculate_tasks(\"Reference dataset unlinked: #{d.name}\")\n end\n pull_hook(:on_unlink_dataset, name)\n d\n end", "def remove_set(name)\n\t\t@sets = session[:sets]\n\t\tif @sets\n\t\t\[email protected](name)\n\t\t\tsession[:sets] = @sets\n\t\tend\n\tend", "def clear; end", "def clear; end", "def clear; end" ]
[ "0.8287032", "0.738639", "0.7060489", "0.6621692", "0.66062725", "0.64314234", "0.64175487", "0.63717335", "0.6309183", "0.62075263", "0.6185912", "0.6128895", "0.6115272", "0.60973656", "0.5998604", "0.58493835", "0.58439285", "0.5826593", "0.5825943", "0.58204097", "0.5810997", "0.58050054", "0.57049704", "0.5700006", "0.5700006", "0.56890047", "0.56770957", "0.5664921", "0.5654941", "0.5649476", "0.5631368", "0.5612849", "0.56057686", "0.5604337", "0.55990106", "0.5587721", "0.5560833", "0.5555834", "0.55409855", "0.5524446", "0.55145186", "0.55116767", "0.5502012", "0.5474849", "0.5448247", "0.5443021", "0.5433424", "0.54274285", "0.5420052", "0.5411567", "0.5391046", "0.53887314", "0.5388338", "0.538424", "0.5366007", "0.5336367", "0.5334629", "0.53332853", "0.5331738", "0.5329522", "0.53283", "0.5328049", "0.53191406", "0.53176767", "0.5311861", "0.53108764", "0.53067803", "0.5304713", "0.53000647", "0.529864", "0.5284582", "0.52843684", "0.52843684", "0.5282795", "0.52795947", "0.52786046", "0.52691656", "0.5263521", "0.5254145", "0.525304", "0.52430034", "0.5224873", "0.5220643", "0.5220643", "0.5216266", "0.5205786", "0.5205786", "0.5205786", "0.51987904", "0.51671386", "0.5162708", "0.5157878", "0.5142559", "0.51378727", "0.512835", "0.51263", "0.51261413", "0.51112103", "0.51112103", "0.51112103" ]
0.8817236
0
Converts validated `graph` into JSONLD
def convert_to_json(graph) # Ugly conversion to string and back to JSON, # however, other approaches don't respect @context. error_hash = JSON.parse graph.dump(:jsonld, context: JSONLD_CONTEXT.dup) error_list = error_hash["@graph"] || [error_hash] error_list.map do |item| item.delete_if { |key, value| IGNORED_ATTRS.include? key} item["@context"] = "#{@base_uri}context.jsonld" item end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_to_json(graph)\n hash = JSON.parse graph.dump(:jsonld, context: ValidatorApp.jsonld_context[:file].dup)\n hash.key?(\"@graph\") ? nest(hash) : []\n end", "def as_jsonld\n provenance\n JSON::LD::API::fromRDF(@graph)\n end", "def to_jsonld( hash )\n JSON::LD::API.expand( hash )\n end", "def to_rdf( jsonld )\n rdf = RDF::Graph.new << JSON::LD::API.toRdf( jsonld )\n if rdf.count == 0\n raise JackRDF_Error, \"No triples could be created from JSON-LD\"\n end\n rdf\n end", "def to_graph(graph = RDF::Graph.new)\n properties.each do |property|\n property.to_graph(graph)\n end\n graph\n end", "def to_graph(passed_graph = RDF::Graph.new)\n passed_graph << graph\n end", "def add_graph(query, graph_name)\n graph_uri = \"<#{graph_name}>\"\n query.gsub(/\\?validatedGraph/i, graph_uri)\n end", "def json_ld; end", "def to_rdf(format, options = {})\n \n # TODO: type of tagging\n \n httpURI = options[:httpURI] ||= \"http://example.com/missingBaseURI\"\n host = options[:host] ||= \"http://maphub.info\"\n \n # Defining the custom vocabulary # TODO: move this to separate lib\n oa_uri = RDF::URI('http://www.w3.org/ns/openannotation/core/')\n oa = RDF::Vocabulary.new(oa_uri)\n oax_uri = RDF::URI('http://www.w3.org/ns/openannotation/extensions/')\n oax = RDF::Vocabulary.new(oax_uri)\n maphub_uri = RDF::URI('http://maphub.info/ns/vocab#')\n maphub = RDF::Vocabulary.new(maphub_uri)\n foaf_uri = RDF::URI('http://xmlns.com/foaf/spec/')\n foaf = RDF::Vocabulary.new(foaf_uri)\n dcterms_uri = RDF::URI('http://purl.org/dc/dcmitype/')\n dcterms = RDF::Vocabulary.new(dcterms_uri)\n dc_uri = RDF::URI('http://purl.org/dc/elements/1.1/')\n dc = RDF::Vocabulary.new(dc_uri)\n \n # Building the annotation graph\n baseURI = RDF::URI.new(httpURI)\n graph = RDF::Graph.new\n graph << [baseURI, RDF.type, oa.Annotation]\n graph << [baseURI, RDF.type, oax.Tagging]\n graph << [baseURI, RDF.type, maphub.GeoReference]\n unless self.created_at.nil?\n graph << [\n baseURI,\n oa.annotated, \n RDF::Literal.new(self.created_at, :datatype => RDF::XSD::dateTime)]\n end\n unless self.updated_at.nil?\n graph << [\n baseURI,\n oa.generated, \n RDF::Literal.new(self.updated_at, :datatype => RDF::XSD::dateTime)]\n end\n graph << [baseURI, oa.generator, RDF::URI(host)]\n \n # Adding user and provenance data\n user_uuid = UUIDTools::UUID.timestamp_create().to_s\n user_node = RDF::URI.new(user_uuid)\n graph << [baseURI, oa.annotator, user_node]\n graph << [user_node, foaf.mbox, RDF::Literal.new(self.user.email)]\n graph << [user_node, foaf.name, RDF::Literal.new(self.user.username)]\n\n \n # Adding the body\n unless self.geonames_uri.nil?\n graph << [baseURI, oax.hasSemanticTag, RDF::URI(self.geonames_uri)] \n end\n\n # Adding the target\n specific_target_uuid = UUIDTools::UUID.timestamp_create().to_s\n specific_target = RDF::URI.new(specific_target_uuid)\n graph << [baseURI, oa.hasTarget, specific_target]\n graph << [specific_target, RDF.type, oa.SpecificResource]\n source_node = RDF::URI.new(self.map.raw_image_uri)\n graph << [specific_target, oa.hasSource, source_node]\n \n # Source details\n graph << [source_node, RDF.type, dcterms.StillImage]\n graph << [source_node, dc.format, \"image/jp2\"]\n \n # the Point selector\n point_selector_uuid = UUIDTools::UUID.timestamp_create().to_s\n point_selector_node = RDF::URI.new(point_selector_uuid)\n graph << [specific_target, oa.hasSelector, point_selector_node]\n graph << [point_selector_node, RDF.type, oa.FragmentSelector]\n graph << [point_selector_node, RDF.value, self.fragment]\n \n # Serializing RDF graph to string\n RDF::Writer.for(format.to_sym).buffer do |writer|\n writer.prefix :dcterms, RDF::URI('http://purl.org/dc/terms/')\n writer.prefix :oa, oa_uri\n writer.prefix :oax, oax_uri\n writer.prefix :rdf, RDF::URI(RDF.to_uri)\n writer.prefix :maphub, maphub_uri\n writer.prefix :foaf, foaf_uri\n writer.prefix :dcterms, dcterms_uri\n writer.prefix :dc, dc_uri\n writer << graph\n end\n \n end", "def to_rdf_graph(doc)\n graph = ::RDF::Graph.new\n node = ::RDF::Node.new\n\n doc.authors.each do |a|\n name = +''\n name << \"#{a.prefix} \" if a.prefix\n name << a.last.to_s\n name << \" #{a.suffix}\" if a.suffix\n name << \", #{a.first}\"\n graph << [node, ::RDF::Vocab::DC.creator, name]\n end\n graph << [node, ::RDF::Vocab::DC.issued, doc.year] if doc.year\n\n citation = +''\n citation << doc.journal if doc.journal\n citation << (doc.volume ? \" #{doc.volume}\" : ' ')\n citation << \"(#{doc.number})\" if doc.number\n citation << \", #{doc.pages}\" if doc.pages\n citation << \". (#{doc.year})\" if doc.year\n graph << [node, ::RDF::Vocab::DC.bibliographicCitation, citation]\n\n ourl = ::RDF::Literal.new(\n '&' + RLetters::Documents::AsOpenUrl.new(doc).params,\n datatype: ::RDF::URI.new('info:ofi/fmt:kev:mtx:ctx')\n )\n graph << [node, ::RDF::Vocab::DC.bibliographicCitation, ourl]\n\n graph << [node, ::RDF::Vocab::DC.relation, doc.journal] if doc.journal\n graph << [node, ::RDF::Vocab::DC.title, doc.title] if doc.title\n graph << [node, ::RDF::Vocab::DC.type, 'Journal Article']\n graph << [node, ::RDF::Vocab::DC.identifier, \"info:doi/#{doc.doi}\"] if doc.doi\n\n graph\n end", "def _convertRDF() \n raise \"Unimplemented.\"\n\t#\tfrom rdflib import Graph\n#\t\tretval = Graph()\n#\t\t# this is a strange hack. If the publicID is not set, rdflib (or the underlying xml parser) makes a funny \n#\t\t#(and, as far as I could see, meaningless) error message...\n#\t\tretval.load(self.response,publicID=' ')\n#\t\treturn retval\n\tend", "def as_jsonld(opts = { related: Ladder::Config.settings[:with_relations] })\n JSON.parse update_resource(opts.slice :related).dump(:jsonld, { standard_prefixes: true }.merge(opts))\n end", "def to_graph(graph = RDF::Graph.new)\n Array(value).each do |val|\n graph << RDF::Statement.new(subject, predicate, val)\n end\n graph\n end", "def hash_to_rdf( hash )\n to_rdf( to_jsonld( hash ) )\n end", "def to_response\n RDF::Graph.new << graph\n end", "def graph_as_type(id, extension, vocabs=nil)\n \n graph = get_graph(id,vocabs)\n \n case extension\n when :html\n pass\n when :rdf\n content_type \"application/rdf+xml\"\n graph.dump(:rdfxml) \n when :ttl\n content_type \"text/turtle\"\n graph.dump(:turtle) \n when :json\n headers \"Link\" => \"<#{uri(\"/context\")}>; rel=\\\"http://www.w3.org/ns/json-ld#context\\\"; type=\\\"application/ld+json\\\"\"\n content_type \"application/json\"\n graph.dump(:jsonld) \n when :jsonld\n content_type \"application/ld+json\"\n unframed_json = JSON::LD::API::fromRdf(graph)\n contextual_json = JSON::LD::API.compact(unframed_json, uri(\"/context\"))\n JSON.pretty_generate contextual_json\n else\n halt 404, \"Could not load #{extension} for #{id}.\"\n end\n end", "def postprocess(json_schema); json_schema; end", "def json_ld\n Jekyll.logger.warn \"Jekyll::SeoTag::JSONLD is deprecated\"\n @json_ld ||= JSONLDDrop.new(self)\n end", "def nested_graph\n @nested_graph ||= ModelConverter.new(resource: Valkyrie::Types::Anything[value.value], adapter: value.adapter, subject_uri: subject_uri).convert.graph\n end", "def convert\n graph_resource.graph.delete([nil, nil, nil])\n properties.each do |property|\n values = resource_attributes[property]\n\n output = property_converter.for(Property.new(subject_uri, property, values, adapter, resource)).result\n graph_resource.graph << output.to_graph\n end\n graph_resource\n end", "def extract_uris( graph ) \n graph.terms.map{|t| t.to_s if t.uri?}.compact\nend", "def handle_links(json) end", "def with_graph(graph_name)\n old_lists, @lists = @lists, {}\n old_references, @references = @references, {}\n old_serialized, @serialized = @serialized, {}\n old_subjects, @subjects = @subjects, {}\n old_graph, @graph = @graph, repo.project_graph(graph_name)\n old_formulae, @formulae = @formulae, {}\n\n graph_done(graph_name)\n\n lists = {}\n graph.each do |statement|\n preprocess_graph_statement(statement)\n [statement.subject, statement.object].each do |resource|\n @formulae[resource] = true if\n resource.node? &&\n (formula_names.include?(resource) || resource.id.start_with?('_form_'))\n\n # First-class list may have members which are formulae, and need reference counts\n if resource.list?\n resource.each_descendant do |term|\n bump_reference(term)\n @formulae[term] = true if\n term.node? &&\n (formula_names.include?(term) || term.id.start_with?('_form_'))\n end\n end\n end\n\n # Collect list elements\n if [RDF.first, RDF.rest].include?(statement.predicate) && statement.subject.node?\n lists[statement.subject] ||= {}\n lists[statement.subject][statement.predicate] = statement.object\n end\n end\n\n # Remove list entries after head with more than two properties (other than rdf:type)\n rests = lists.values.map {|props| props[RDF.rest]}\n\n # Remove non-head lists that have too many properties\n rests.select do |bn|\n pc = 0\n @subjects.fetch(bn, {}).each do |pred, count|\n next if pred == RDF.type\n pc += count\n end\n lists.delete(bn) if pc > 2\n end\n\n # Values for this list element, recursive\n def list_values(bn, lists)\n raise \"no list\" unless lists.has_key?(bn)\n first, rest = lists[bn][RDF.first], lists[bn][RDF.rest]\n (rest == RDF.nil ? [] : list_values(rest, lists)).unshift(first)\n rescue\n lists.delete(bn)\n raise $!\n end\n\n # Create value arrays for each entry\n lists.each do |bn, props|\n begin\n @lists[bn] = list_values(bn, lists)\n rescue\n # Skip this list element, if it raises an exception\n lists.delete(bn)\n end\n end\n\n # Mark all remaining rests done\n rests.each {|bn| subject_done(bn) if lists.include?(bn)}\n\n # Remove entries that are referenced as rdf:rest of some entry\n lists.each do |bn, props|\n @lists.delete(props[RDF.rest])\n end\n\n # Record nodes in subject or object\n yield\n ensure\n @graph, @lists, @references, @serialized, @subjects, @formulae = old_graph, old_lists, old_references, old_serialized, old_subjects, old_formulae\n end", "def to_graph\n return RDF::Graph.new if target_id.blank?\n g = Resource.new(rdf_subject)\n g.proxy_for = target\n g.proxy_in = proxy_in.try(:uri)\n g.next = self.next.try(:rdf_subject)\n g.prev = prev.try(:rdf_subject)\n g.graph\n end", "def convert_links\n\n # fetch leaf content\n c = self.content\n\n # regexps\n # url = /( |^)http:\\/\\/([^\\s]*\\.[^\\s]*)( |$)/\n tag_regex = /( |^)#(\\w+)( |$)/\n user_regex = /( |^)@(\\w+)( |$)/\n \n #TODO: make sure no one is typing javascript into the field **IMPORTANT**\n\n #replace #tags with links to that tag search\n while c =~ tag_regex\n c.gsub! \"##{$2}\", \"<a href='/leaves?tagged=#{$2}'>##{$2}</a>\"\n self.has_tags = true\n end\n\n #replace @usernames with links to that user, if user exists\n while c =~ user_regex\n user = $2\n if User.find(user)\n c.sub! \"@#{$2}\", \"<a href='/users/#{$2}'>@#{$2}</a>\"\n end\n end\n\n #replace urls with links\n #while c =~ url\n #name = $2\n #c.sub! /( |^)http:\\/\\/#{name}( |$)/, \" <a href='http://#{name}' >#{name}</a> \"\n #end\n\n self.content = c\n\n end", "def load_graph(url, followed_predicates = nil, graph = nil)\n begin\n graph = RDF::Graph.new if graph.nil?\n \n # Using RestClient because RDF::RDFXML::Reader.open(url) doesn't do well w/ redirects\n data = RestClient.get( url, :accept => 'application/rdf+xml' ) \n RDF::Reader.for(:rdfxml).new(data) do |reader|\n reader.each_statement do |statement| \n # Add the statement to the graph\n graph << statement \n\n # If the statement contains a predicate we are interested in, recursively follow it\n # @TO-DO: add in a check that we are not going to get caught in a loop - see if \n # subject already exists in the graph\n if followed_predicates and followed_predicates.has_key?(statement.predicate.to_s)\n uri = find_followable_uri(url, statement, followed_predicates)\n load_graph(uri, followed_predicates, graph) if uri\n end\n end\n end\n graph\n rescue RestClient::BadGateway => e\n puts \"Warning: received response #{e.message} from #{url}\"\n graph\n end\n end", "def graph_class\n RDF::Graph\n end", "def generate\n graph = crate.entities.map(&:properties).reject(&:empty?)\n JSON.pretty_generate('@context' => context, '@graph' => graph)\n end", "def json_directional(name, logger)\n\t# return '{\"nodes\":[], \"links\":[], \"constraints\":[]}'\n\t\n\t\n\t\n\t\n\t# input sanitization???\n\t# I mean, the name is coming from a URL piece, so it could be anything...\n\t\n\t\n\t# logger.info @rake.methods.grep(/task/).inspect\n\t# logger.info @rake.tasks.inspect\n\t\n\tshort_path = 'public/CS_BS_all.yaml'\n\t\n\tregenerate_graph = false\n\t@rake[short_path].invoke ->(){\n\t\t# --- this callback runs when YAML file in 'short_path' is regenerated\n\t\tlogger.info \"graph generation callback\"\n\t\t\n\t\tregenerate_graph = true\n\t}\n\t\n\t# Generate graphs if\n\t# 1) no graph yet in memory\n\t# 2) source YAML file was modified\n\tif regenerate_graph or @graphs[short_path].nil?\n\t\t@graphs[short_path] = SummerResearch::DependencyGraph.new.tap do |graph|\n\t\t\traw_data = Models::Utilities.load_yaml_file(short_path)\n\t\t\t# raw_data = \n\t\t\t\t# if name.include? 'split'\n\t\t\t\t# \tModels::Utilities.load_yaml_file \"public/#{name}.yaml\"\n\t\t\t\t# else\n\t\t\t\t\t# Models::Utilities.load_yaml_file(short_path)\n\t\t\t\t# end\n\t\t\t\n\t\t\t# NOTE: just get the node and vert information first. The data will be converted to the proper output format later.\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t# --- add basic node and edge information to the graph\n\t\t\tnodes = raw_data.collect{ |k,v| [k, v] }.flatten.uniq\n\t\t\t\n\t\t\tlinks =\n\t\t\t\traw_data.collect do |course, deps|\n\t\t\t\t\tdeps.collect do |dependency|\n\t\t\t\t\t\t[course, dependency]\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tlinks = links.flatten(1) # remove extra level of nesting\n\t\t\tlinks.delete_if do |course, dependency|\n\t\t\t\tcourse == dependency # remove self-links resulting from messy data\n\t\t\tend\n\t\t\t\n\t\t\t\n\t\t\tlogger.info nodes.inspect\n\t\t\tlogger.info links.inspect\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tnodes.each do |vertex|\n\t\t\t\tgraph.add_vertex(vertex)\n\t\t\tend\n\t\t\t\n\t\t\tlinks.each do |course, dependency|\n\t\t\t\tgraph.add_edge(dependency, course)\n\t\t\tend\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t# --- debug printing to make sure that worked\n\t\t\t\n\t\t\t# NOTE: the first item in either of these lists, is the requested node.\n\t\t\t# ie) ancestors of CS 367 includes CS 367 itself, even if all self-loops were removed\n\t\t\t# NOTE: was able to fix this by returning a slightly different Enumerator from the DependencyGraph class.\n\t\t\tlogger.info \"Ancestors\"\n\t\t\tlogger.info graph.ancestors(\"CS 367\").to_a.inspect\n\t\t\tlogger.info \"Parents\"\n\t\t\tlogger.info graph.parents(\"CS 367\").to_a.inspect\n\t\t\tlogger.info \"Children\"\n\t\t\tlogger.info graph.children(\"CS 367\").to_a.inspect\n\t\t\tlogger.info \"Descendants\"\n\t\t\tlogger.info graph.descendants(\"CS 367\").to_a.inspect\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tlogger.info graph.each_vertex.to_a\n\t\t\tlogger.info graph.each_edge.to_a\n\t\tend\n\tend\n\t\n\t# pull graph from the cache\n\tgraph = @graphs[short_path]\n\t\n\traise \"Could not find DependencyGraph data. Should have been generated after #{short_path} was made, but it seems like that as not the case.\" if graph.nil?\n\t\n\t\n\t# if short_path == 'data/CS_BS_all.yaml'\n\t\t[\n\t\t\t'CS 310',\n\t\t\t'CS 330',\n\t\t\t'CS 367',\n\t\t\t# 'ENGH 302',\n\t\t\t# # 'CS 262',\n\t\t\t# # 'CS 351',\n\t\t\t# # 'MATH 351',\n\t\t\t# # 'MATH 203',\n\t\t\t# 'STAT 344',\n\t\t\t# # 'MATH 125',\n\t\t\t# 'ECE 445',\n\t\t\t# # 'CS 222',\n\t\t\t# # 'CS 112',\n\t\t\t# # 'STAT 346',\n\t\t\t# 'SYST 210',\n\t\t].each do |course|\n\t\t\t# graph.cut course\n\t\tend\n\t# end\n\t\n\t# graph.remove_vertex('MATH 112') # Discrete Math for IT\n\t# graph.remove_vertex('CS 222') # \"Computer Programming for Engineers\", basically like CS 262\n\t\n\t\n\t\n\t\n\trequirement_by_type_file = 'data/CS_BS_requirements_by_type.yaml'\n\t@rake[requirement_by_type_file].invoke\n\t\n\trequirement_by_type = Models::Utilities.load_yaml_file(requirement_by_type_file)\n\t\n\t\n\t\n\trequired_courses = requirement_by_type[:required].to_set\n\telective_courses = requirement_by_type[:elective].to_set\n\t\n\t\n\t\n\t\n\t\n\t\n\trequirements_file = 'data/CS_BS_requirements.yaml'\n\t@rake[requirements_file].invoke\n\t\n\tdegree_requirements = Models::Utilities.load_yaml_file(requirements_file)\n\tdegree_requirements\n\t\n\telective_category = \n\t\tdegree_requirements.select{ |name, sector| sector[:data].is_a? Hash }\n\t\t .collect { |name, sector|\n\t\t \t sector[:data].collect{ |category, course_id|\n\t\t \t \t[course_id, name]\n\t\t \t }\n\t\t }\n\t\t .flatten(1) # array of [course_id, name] pairs\n\t\n\t# convert [course_id, name] relation into { course_id => i }, where i is an integer corresponding to 'name' in a list of all values for 'name'\n\telective_category = elective_category.to_h\n\t\n\tname_list = elective_category.values.uniq\n\tname_to_number = name_list.each_with_index.to_h\n\t\n\tlogger.info name_list.inspect\n\t\n\telective_category = \n\t\telective_category.collect{ |course_id, name|\n\t\t\t[course_id].flatten.collect { |id|\n\t\t\t\t[ id, name_to_number[name] ]\n\t\t\t}\n\t\t}\n\t\t.flatten(1)\n\t\t.to_h\n\t\n\tlogger.info elective_category.inspect\n\t\n\t\n\treturn graph.to_json_d3v3_cola(required_courses, elective_courses, elective_category)\n\t\n\t\n\t\n\t# below is a bunch of old code, to generate the graph the old way\n\t# still keeping it around, because some of these constraints have not been implemented\n\t# in the new system.\n\t# Also, this alternative way of specifying colors is interesting.\n\t# -------------------------------------------------------------------\n\t\n\t\n\t\n\t\n\t# === Create Constraints\n\t# basic constraint: prereqs go above later courses.\n\t\t# (overall visual flow: top to bottom as skill increases)\n\t\t# defined as local property.\n\t\t# graph ends up showing global properties.\n\tc1 =\n\t\traw_data2.collect do |course, deps|\n\t\t\tdeps.collect do |d|\n\t\t\t\ti_left =\n\t\t\t\t\tnodes.find_index{ |x| x['name'] == course}\n\t\t\t\t\n\t\t\t\ti_right =\n\t\t\t\t\tnodes.find_index{ |x| x['name'] == d}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t{\n\t\t\t\t\t\"axis\" => \"y\", \n\t\t\t\t\t\"left\" => i_left, \"right\" => i_right, \"gap\" => 25\n\t\t\t\t}\n\t\t\tend\n\t\tend\n\tc1.flatten!\n\t\n\tconstraints = c1\n\t\n\t# TODO: implement constraint such that all 100-level courses are above the 200-level ones, etc etc.\n\t# (want to stratify course levels)\n\t# logger.info \"HEY\"\n\tgap = 500\n\tc2 =\n\t\tnodes.combination(2)\n\t\t.collect{ |n1, n2| # isolate the names\n\t\t\t[n1['name'], n2['name']]\n\t\t}\n\t\t.select{ |n1, n2| # filter by course number\n\t\t\tlogger.info [n1,n2].inspect\n\t\t\ta,b = [n1, n2].collect{|x| x.split.last[0].to_i }\n\t\t\t\n\t\t\ta > 3\n\t\t}.collect{ |n1, n2|\n\t\t\ti_left =\n\t\t\t\tnodes.find_index{ |x| x['name'] == n1}\n\t\t\t\n\t\t\ti_right =\n\t\t\t\tnodes.find_index{ |x| x['name'] == n2}\n\t\t\t\n\t\t\t{\n\t\t\t\t\"axis\" => \"y\", \n\t\t\t\t\"left\" => 28, \"right\" => i_left, \"gap\" => gap\n\t\t\t}\n\t\t}\n\t\n\t\t# this constraint currently has no effect on the output\n\tconstraints = constraints + c2\n\tconstraints.flatten!\n\t\n\t\n\t\n\t# all nodes want to have horizontal spacing\n\tgap = 25\n\tc3 =\n\t\tnodes.combination(2)\n\t\t.collect{ |n1, n2| # isolate the names\n\t\t\t[n1['name'], n2['name']]\n\t\t}\n\t\t.select{ |n1, n2| # filter by course number\n\t\t\tlogger.info [n1,n2].inspect\n\t\t\ta,b = [n1, n2].collect{|x| x.split.last[0].to_i }\n\t\t\t\n\t\t\ta > 3\n\t\t\ttrue\n\t\t}.collect{ |n1, n2|\n\t\t\ti_left =\n\t\t\t\tnodes.find_index{ |x| x['name'] == n1}\n\t\t\t\n\t\t\ti_right =\n\t\t\t\tnodes.find_index{ |x| x['name'] == n2}\n\t\t\t\n\t\t\t{\n\t\t\t\t\"axis\" => \"x\", \n\t\t\t\t\"left\" => i_left, \"right\" => i_right, \"gap\" => gap\n\t\t\t}\n\t\t}\n\t\n\t\t# this constraint currently has no effect on the output\n\tconstraints = constraints + c3\n\tconstraints.flatten!\n\t\n\t\n\t\n\t\n\t# TODO: implement constraint that causes all courses from a single department to clump\n\t\n\t\n\t\n\t\n\t\n\t# === additional processing on the graph\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t# === rough packaging for output\n\tout = {\n\t\t# 'name' => name,\n\t\t'nodes' => nodes,\n\t\t'links' => links,\n\t\t'constraints' => constraints\n\t}\n\t\n\t\n\t# === style the nodes\n\t\n\tcolor_key ||= {\n\t\t:gated_elective_clump => \"#10D588\", # light green\n\t\t:split_link => \"#3399FF\", # blue\n\t\t\n\t\t:required => \"#CC2300\", # red / orange\n\t\t:elective => \"#242424\", # black\n\t\t:not_required => \"#AAA\" # grey\n\t}\n\t\n\trequired =\n\t\t@data[:required].collect{ |clump| clump.keys }\n\t\t.flatten\n\t\t.to_set\n\t\n\telective = \n\t\t@data[:elective].values\n\t\t.collect{ |clump| clump.keys }\n\t\t.flatten\n\t\t.to_set\n\t\n\t\n\tout['nodes'].each do |node|\n\t\t# --- color assigment\n\t\ttype = node_type(node['name'], required, elective)\n\t\t# node['color'] = color_key[type]\n\t\tnode['class'] = type.to_s.tr('_', '-')\n\t\t\n\t\t\n\t\t# --- do other things with type\n\t\t# leaves << node['id'] if type == :not_required\n\tend\n\t\n\t\nend", "def additional_triples(rdf_graph)\n if is_a?(Model) && contains_sbml?\n rdf_graph << [rdf_resource, JERMVocab.hasFormat, JERMVocab.SBML_format]\n end\n rdf_graph\n end", "def as_framed_jsonld\n json_hash = as_jsonld related: true\n\n context = json_hash['@context']\n frame = { '@context' => context }\n frame['@type'] = type.first.pname unless type.empty?\n\n JSON::LD::API.compact(JSON::LD::API.frame(json_hash, frame), context)\n end", "def as_json(options={})\n # translating this schema to match the FB one as much as possible\n super.tap do |json|\n json[\"ad_creation_time\"] = json.delete(\"created_at\")\n json[\"text\"] = json.delete(\"message\") # TODO: remove HTML tags\n json[\"funding_entity\"] = json[\"paid_for_by\"]\n # what if page_id doesn't exist?!\n# json[\"page_id\"] \n json[\"start_date\"] = json.delete(\"created_at\")\n json = json.merge(json)\n end\n end", "def as_json(*opts)\n links.update(embedded).as_json(*opts)\n end", "def as_json(*opts)\n links.update(embedded).as_json(*opts)\n end", "def initialize(rdf_graph)\n @graph = rdf_graph\n end", "def test_graph_to_s\n sut_graph = Graph.new\n sut_graph.name=\"test_graph\" \n sut_graph.type=:digraph\n sut_graph.node_style=:ellipse\n #sut_graph.add_node \"TEST1\"\n #sut_graph.add_node \"TEST2\"\n sut_graph.add_edge(\"TEST1\" , \"TEST2\" , \"take_me_to_test_2\")\n \n \n returned_obj = sut_graph.to_s\n assert( returned_obj.instance_of?(String) , \"Check to_s returns String, returns: #{returned_obj.class}\" )\n assert(returned_obj.scan(/test_graph/).length==1 , \"Check once occurence of graph name in dot to_s.\")\n assert(returned_obj.scan(/digraph test_graph/).length==1 , \"Check graph type and name in dot to_s.\") \n assert(returned_obj.scan(/shape = ellipse/).length==1 , \"Check graph node style in dot to_s.\") \n #assert(returned_obj.scan(/TEST1\\;/).length==1 , \"Check that Node definition is included: TEST1;\")\n #assert(returned_obj.scan(/TEST2\\;/).length==1 , \"Check that Node definition is included: TEST2}\")\n assert(returned_obj.scan(/label = \\\"take_me_to_test_2\"/).length==1 , \"Check that arc label is included\")\n \n end", "def get_field_deserializers()\n return super.merge({\n \"content\" => lambda {|n| @content = n.get_object_value(lambda {|pn| Base64url.create_from_discriminator_value(pn) }) },\n \"contentUrl\" => lambda {|n| @content_url = n.get_string_value() },\n \"createdByAppId\" => lambda {|n| @created_by_app_id = n.get_string_value() },\n \"lastModifiedDateTime\" => lambda {|n| @last_modified_date_time = n.get_date_time_value() },\n \"level\" => lambda {|n| @level = n.get_number_value() },\n \"links\" => lambda {|n| @links = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::PageLinks.create_from_discriminator_value(pn) }) },\n \"order\" => lambda {|n| @order = n.get_number_value() },\n \"parentNotebook\" => lambda {|n| @parent_notebook = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::Notebook.create_from_discriminator_value(pn) }) },\n \"parentSection\" => lambda {|n| @parent_section = n.get_object_value(lambda {|pn| MicrosoftGraph::Models::OnenoteSection.create_from_discriminator_value(pn) }) },\n \"title\" => lambda {|n| @title = n.get_string_value() },\n \"userTags\" => lambda {|n| @user_tags = n.get_collection_of_primitive_values(String) },\n })\n end", "def links\n json_hyperschema[\"links\"] || []\n end", "def graph_params\n params.fetch(:graph, {})\n end", "def add_graph(query_template)\n query_template.gsub(/\\?graph/i, \"<#{@named_graph}>\")\n end", "def show\n render json: @graph.representation\n end", "def new\n @graph = Graph.create(:user_id => current_user_id)\n\n respond_to do |format|\n format.html { redirect_to edit_graph_path(@graph.string_id) }\n format.json { render json: @graph }\n end\n end", "def serialize(ntstr, **options)\n g = ntstr.is_a?(String) ? parse(ntstr, **options) : ntstr\n logger = RDF::Spec.logger\n logger.info(g.dump(:ttl))\n result = JSON::LD::Writer.buffer(logger: logger, stream: true, **options) do |writer|\n writer << g\n end\n puts result if $verbose\n\n JSON.parse(result)\n end", "def to_json(opts={})\n get_triples_for_this_resource.dump(:jsonld)\n end", "def jsonify(input); end", "def graph_params\n params.require(:graph).permit(:name, :description, :code)\n end", "def initialize(graph)\n @graph = graph\n end", "def graph_params\n {fields: fields_as_string}\n end", "def update\n\n # Technically, the object being transferred as part of the params[:document] parameter is\n # the transfer object that is created as part of graph.js, so it needs to get transformed into\n # native representation so it can be saved\n\n graphs = {}\n tags = {}\n nodes = {}\n edges = {}\n clusters= {}\n\n unless params[:document][:title].nil? || @document.title.eql?(params[:document][:title])\n @document.title = params[:document][:title]\n @document.save!\n end\n\n # Because apparently ruby doesn't memoize anything\n @document.graphs.each do |graph|\n graphs[graph.id] = graph\n\n graph.nodes.each do |node|\n nodes[node.id] = node\n end\n\n graph.edges.each do |edge|\n edges[edge.id] = edge\n end\n\n graph.tags.each do |tag|\n tags[tag.id] = tag\n end\n\n graph.clusters.each do |cluster|\n clusters[cluster.id] = cluster\n end\n\n end\n\n params[:document][:graphs].each do |graph_obj|\n\n graphs[graph_obj[:id]] = @document.graphs.create!(id: graph_obj[:id]) unless graphs.has_key?(graph_obj[:id])\n\n end\n\n params[:document][:clusters].each do |cluster_obj|\n\n graph = graphs[cluster_obj[:graph_id]]\n\n unless graph.nil?\n\n cluster = clusters[cluster_obj[:id]]\n\n if cluster.nil?\n cluster = graph.clusters.create!(id: cluster_obj[:id])\n clusters[cluster_obj[:id]] = cluster\n end\n\n cluster.import cluster_obj\n\n=begin\n cluster.label = cluster_obj[:label] unless cluster_obj[:label].nil? or cluster.label.eql?(cluster_obj[:label])\n\n if cluster_obj.has_key?(:color) && !cluster.color.eql?(cluster_obj[:color]) && !(cluster_obj[:color].match(%r{\\A#(\\h{6}|\\h{3}|\\h)\\z}).nil?)\n cluster.color = cluster_obj[:color]\n end\n\n cluster.shape = cluster_obj[:shape] unless !(cluster_obj.has_key?(:shape)) or cluster_obj[:shape].nil? or cluster.shape.eql?(cluster_obj[:shape])\n=end\n\n cluster.save!\n\n end\n\n end\n\n params[:document][:tags].each do |tag_obj|\n\n graph = graphs[tag_obj[:graph_id]]\n\n unless graph.nil?\n\n tag = tags[tag_obj[:id]]\n\n if tag.nil?\n tag = graph.tags.create!(id: tag_obj[:id])\n tags[tag_obj[:id]] = tag\n end\n\n tag.import tag_obj\n\n=begin\n tag.name = tag_obj[:name] unless tag_obj[:name].nil? or tag.name.eql?(tag_obj[:name])\n\n if tag_obj.has_key?(:color) && !tag.color.eql?(tag_obj[:color]) && !(tag_obj[:color].match(%r{\\A#(\\h{6}|\\h{3}|\\h)\\z}).nil?)\n tag.color = tag_obj[:color]\n end\n\n if tag_obj.has_key?(:shape) && !tag.shape.eql?(tag_obj[:shape])\n tag.shape = tag_obj[:shape]\n end\n=end\n\n tag.save!\n\n end\n\n end\n\n params[:document][:nodes].each do |node_obj|\n\n graph = graphs[node_obj[:graph_id]]\n\n unless graph.nil?\n\n node = nodes[node_obj[:id]]\n\n if node.nil?\n node = graph.nodes.create!(id: node_obj[:id])\n nodes[node_obj[:id]] = node\n end\n\n node.label = node_obj[:label] unless node_obj[:label].nil? || node.label.eql?(node_obj[:label])\n node.shape = node_obj[:shape] unless node_obj[:shape].nil? || node.shape.eql?(node_obj[:shape])\n\n if node_obj.has_key?(:x) and node_obj.has_key?(:y)\n node.x = node_obj[:x]\n node.y = node_obj[:y]\n end\n\n if node_obj.has_key?(:tags) && node_obj[:tags].length > 0\n\n node.node_tags.each do |node_tag|\n if node_obj[:tags].include?(node_tag.tag_id)\n node_obj[:tags].delete(node_tag.tag_id)\n else\n node_tag.destroy\n end\n end\n\n node_obj[:tags].each do |tag_id|\n tag = tags[tag_id]\n unless tag.nil?\n node.tags << tag\n end\n end\n\n\n if node.node_tags.empty?\n node.primary_tag = nil\n elsif node_obj.has_key?(:group)\n\n node.primary_tag = nil\n\n unless node_obj[:group].nil? || !tags.has_key?(node_obj[:group])\n node.primary_tag = tags[node_obj[:group]]\n end\n\n end\n\n else\n node.node_tags.destroy_all\n node.primary_tag = nil\n end\n\n if node_obj.has_key?(:cluster) && !node_obj[:cluster].nil?\n cluster = clusters[node_obj[:cluster]]\n unless cluster.nil?\n node.cluster = cluster\n end\n else\n node.cluster = nil\n end\n\n node.icon = node_obj[:icon] if node_obj.has_key?(:icon)\n\n node.save!\n\n end\n\n end\n\n params[:document][:edges].each do |edge_obj|\n\n graph = graphs[edge_obj[:graph_id]]\n node_from = nodes[edge_obj[:from]]\n node_to = nodes[edge_obj[:to]]\n\n unless graph.nil? || node_from.nil? || node_to.nil?\n\n edge = edges[edge_obj[:id]]\n\n if edge.nil?\n\n edge = graph.edges.new(id: edge_obj[:id], node_from: node_from, node_to: node_to)\n edges[edge_obj[:id]] = edge\n\n end\n\n edge.label = edge_obj[:label] unless edge_obj[:label].nil? || edge.label.eql?(edge_obj[:label])\n edge.save!\n\n end\n end\n\n params[:document][:removed_edges].each do |vis_id|\n edge = edges[vis_id]\n unless edge.nil?\n edge.destroy\n edges.delete(vis_id)\n end\n end\n\n params[:document][:removed_nodes].each do |vis_id|\n node = nodes[vis_id]\n unless node.nil?\n node.destroy\n nodes.delete(vis_id)\n end\n end\n\n head :no_content\n end", "def test_formatting_all_edges\n \n test_map = ' { \"metros\" : [ {\n \"code\" : \"LON\" ,\n \"name\" : \"London\" ,\n \"country\" : \"X\" ,\n \"continent\" : \"X\" ,\n \"timezone\" : 1 ,\n \"coordinates\" : {\"N\" : 1, \"E\" : 1} ,\n \"population\" : 1,\n \"region\" : 1\n } , {\n \"code\" : \"PAR\" ,\n \"name\" : \"Paris\" ,\n \"country\" : \"X\" ,\n \"continent\" : \"X\" ,\n \"timezone\" : 1 ,\n \"coordinates\" : {\"N\" : 1, \"E\" : 1} ,\n \"population\" : 1,\n \"region\" : 1\n } , {\n \"code\" : \"LIM\" ,\n \"name\" : \"Lima\" ,\n \"country\" : \"X\" ,\n \"continent\" : \"X\" ,\n \"timezone\" : 1 ,\n \"coordinates\" : {\"N\" : 1, \"E\" : 1} ,\n \"population\" : 1,\n \"region\" : 1\n } , {\n \"code\" : \"MOW\" ,\n \"name\" : \"Moscow\" ,\n \"country\" : \"X\" ,\n \"continent\" : \"X\" ,\n \"timezone\" : 1 ,\n \"coordinates\" : {\"N\" : 1, \"E\" : 1} ,\n \"population\" : 1,\n \"region\" : 1\n } ] ,\n \"routes\" : [ {\n \"ports\" : [\"LON\" , \"PAR\"] ,\n \"distance\" : 2410\n } , {\n \"ports\" : [\"LON\" , \"MOW\"] ,\n \"distance\" : 4323\n } , {\n \"ports\" : [\"LIM\" , \"PAR\"] ,\n \"distance\" : 4323\n } ] } '\n graph = Graph.new()\n graph.parse_json_string(test_map)\n \n result = graph.format_all_edges()\n \n # All edges are parsed as 2 way, one flight is of the format XXX-XXX\n # Also account for commas inbetween and no comma at the end\n correct_length = 3 * 8 * 2 - 1\n assert_equal( result.length(), correct_length)\n \n # Check contents using a regexp\n assert_equal( result.scan(/[A-Z]{3}-[A-Z]{3},?/).size, 6)\n \n # Check if result contains some particular flights\n assert_equal( result.include?(\"PAR-LIM\"), true)\n assert_equal( result.include?(\"LON-MOW\"), true)\n \n end", "def load_and_parse\n\n if @infile\n @graph = RDF::Graph.load(@infile)\n end\n\n end", "def json_ld_script_block\n resource = eval('@' + controller_name.singularize)\n if resource && resource.rdf_supported?\n begin\n content_tag :script, type: 'application/ld+json' do\n resource.to_json_ld.html_safe\n end\n rescue Exception => exception\n if Seek::Config.exception_notification_enabled\n data[:message] = 'Error embedding JSON-LD into page HEAD'\n data[:item] = resource.inspect\n ExceptionNotifier.notify_exception(exception, data: data)\n end\n ''\n end\n end\n end", "def create\n @graph = Graph.new(params[:graph])\n\n respond_to do |format|\n if @graph.save\n Action.log :controller => params[:controller], :action => params[:action], :target_id => @graph.id, :user => current_user\n format.html { redirect_to @graph, notice: 'Graph was successfully created.' }\n format.json { render json: @graph, status: :created, location: @graph }\n else\n @graph.graph_membership_graphs.build\n @graph.graph_membership_nodes.build\n format.html { render action: \"new\", :layout => !request.xhr? }\n format.json { render json: @graph.errors, status: :unprocessable_entity }\n end\n end\n end", "def graph\n @g ||= GraphViz.new(:G, :type => :digraph)\n end", "def parse_by_feednormalizer(feed_text)\n feed_data = FeedNormalizer::FeedNormalizer.parse feed_text\n feed_data.entries.map do|e|\n metadata = {:author => e.author} if e.author\n {:did=>(e.id || e.urls.join(\" \")), :title=>e.title,:content=>e.content,:basetime=>e.date_published, \n :metadata=>metadata, :uri=>e.urls.join(\" \"), :tag_list=>e.categories.join(\",\")}\n end\n end", "def to_rdf()\n graph = RDF::Graph.new\n as_rdf(Array.new).each do |triple|\n puts triple \n graph << triple\n end\n return graph\n end", "def to_rdf()\n graph = RDF::Graph.new\n as_rdf(Array.new).each do |triple|\n puts triple \n graph << triple\n end\n return graph\n end", "def to_rdf()\n graph = RDF::Graph.new\n as_rdf(Array.new).each do |triple|\n puts triple \n graph << triple\n end\n return graph\n end", "def to_rdf()\n graph = RDF::Graph.new\n as_rdf(Array.new).each do |triple|\n puts triple \n graph << triple\n end\n return graph\n end", "def to_rdf()\n graph = RDF::Graph.new\n as_rdf(Array.new).each do |triple|\n puts triple \n graph << triple\n end\n return graph\n end", "def to_rdf()\n graph = RDF::Graph.new\n as_rdf(Array.new).each do |triple|\n puts triple \n graph << triple\n end\n return graph\n end", "def to_rdf()\n graph = RDF::Graph.new\n as_rdf(Array.new).each do |triple|\n puts triple \n graph << triple\n end\n return graph\n end", "def to_rdf()\n graph = RDF::Graph.new\n as_rdf(Array.new).each do |triple|\n puts triple \n graph << triple\n end\n return graph\n end", "def to_rdf()\n graph = RDF::Graph.new\n as_rdf(Array.new).each do |triple|\n puts triple \n graph << triple\n end\n return graph\n end", "def to_rdf()\n graph = RDF::Graph.new\n as_rdf(Array.new).each do |triple|\n puts triple \n graph << triple\n end\n return graph\n end", "def to_rdf()\n graph = RDF::Graph.new\n as_rdf(Array.new).each do |triple|\n puts triple \n graph << triple\n end\n return graph\n end", "def to_rdf()\n graph = RDF::Graph.new\n as_rdf(Array.new).each do |triple|\n puts triple \n graph << triple\n end\n return graph\n end", "def to_rdf()\n graph = RDF::Graph.new\n as_rdf(Array.new).each do |triple|\n puts triple \n graph << triple\n end\n return graph\n end", "def create\n @graph = Graph.new(graph_params)\n\n respond_to do |format|\n if @graph.save\n format.html { redirect_to @graph, notice: 'Graph was successfully created.' }\n format.json { render action: 'show', status: :created, location: @graph }\n else\n format.html { render action: 'new' }\n format.json { render json: @graph.errors, status: :unprocessable_entity }\n end\n end\n end", "def convert _obj\n if _obj.figures.length == 1 && _obj.figures.first.link.present?\n _obj.figures.first.link = _obj.figures.first.link.gsub(\"http://\", \"https://\")\n _obj.save!\n end\nend", "def add_empty_json_ld_schema(edited_document, schema, schema_name, schema_type, yaml) #:nodoc\r\n data = {}\r\n doc = DcJsonLd.new\r\n doc.name = schema_name\r\n doc.type = schema_type\r\n \r\n edited_document.dc_json_lds << doc\r\n schema.each do |element_name, element|\r\n next if element_name == 'level' # skip level element\r\n if yaml[element['type']]\r\n if element['n'].to_s == '1'\r\n # single element\r\n doc_1 = yaml[element['type'] ]\r\n data[element_name] = doc_1\r\n else\r\n # array\r\n add_empty_json_ld_schema(doc, yaml[element['type']], element_name, element['type'], yaml)\r\n end\r\n else\r\n data[element_name] = element['text']\r\n end\r\n end\r\n doc.data = data.to_yaml\r\n doc.save\r\nend", "def extended_json(resource)\n return resource.as_json.to_hash unless resource.respond_to?(:links)\n return resource.as_json.to_hash unless resource.links.kind_of?(Occi::Core::Links)\n\n links = resource.links\n ext_json = resource.as_json\n ext_json.links = links.as_json\n ext_json.to_hash\n end", "def to_adj\n full_jsivt= []\n @nodes.each do |id, node_data|\n name = node_data[@name_key]\n data = node_data[:data]\n adjacencies = node_data[@children_key]\n jsivt = {}\n jsivt[\"id\"] = id\n jsivt[\"name\"] = name || \"id: #{id}\" #if no name show id\n jsivt[\"data\"] = data\n jsivt[\"adjacencies\"] = adjacencies\n full_jsivt << jsivt\n end \n full_jsivt.to_json \n end", "def communicationgraph_old(filter=@filter, &block) # :nodoc:\n us = users(filter)\n if block\n g = DotGraph.new(us, :directed => true, &block)\n else\n g = DotGraph.new(us, :directed => true) { |n| n.name }\n end\n pages(filter).each do |p| \n p.revisions(filter).inject do |a,b|\n g.link(b.user,a.user)\n b\n end\n end\n g\n end", "def parse_data_for_parser(doc, original_url, _jsonld_array)\n\n handle_exceptions(StandardError) do\n grabber = IdsGrabber.new(doc, url, original_url)\n set_data_field('user_uuid', grabber.user_id)\n set_data_field('object_id', grabber.post_id)\n set_data_field('uuid', grabber.uuid)\n set_data_field('external_id', grabber.uuid)\n\n @parsed_data['raw']['crowdtangle'] = get_crowdtangle_data(parsed_data['uuid']) || {}\n if has_valid_crowdtangle_data?\n crowdtangle_data = format_crowdtangle_result(parsed_data['raw']['crowdtangle'])\n updated_url = parsed_data.dig('raw', 'crowdtangle', 'posts', 0, 'postUrl')\n @url = updated_url if updated_url && updated_url != url\n @parsed_data.merge!(crowdtangle_data)\n else\n og_metadata = get_opengraph_metadata.reject{|k,v| v.nil?}\n\n if should_use_markup_title?\n set_data_field('title', get_unique_facebook_page_title(doc))\n else\n set_data_field('title', og_metadata['description']) unless NONUNIQUE_TITLES.include?(og_metadata['description']&.downcase)\n end\n set_data_field('description', og_metadata['description'])\n set_data_field('picture', og_metadata['picture'])\n end\n\n strip_facebook_from_title!\n\n @parsed_data['html'] = html_for_facebook_post(parsed_data.dig('username'), doc, url) || ''\n \n ['log in or sign up to view', 'log into facebook', 'log in to facebook'].each do |login|\n if @parsed_data[:title] && (@parsed_data[:title].downcase).include?(login)\n @parsed_data.merge!(\n title: url,\n description: '',\n )\n end\n end\n\n end\n \n parsed_data\n end", "def initialize(graph)\n @graph = graph\n end", "def initialize(graph)\n @graph = graph\n end", "def generate_graph\n nodes = User.where(team_id: @team.id)\n links = []\n\n (0..nodes.length-1).to_a.each do |index1|\n\n (0..nodes.length-1).to_a.each do |index2|\n\n if index1 != index2 \n message_count = Message.where(user_id_from: nodes[index1].id, user_id_to: nodes[index2].id).length\n link = {\n source: index1,\n target: index2,\n value: message_count\n }\n links.push(link)\n end\n\n end\n\n end\n render json: {\n nodes: nodes,\n links: links\n }\n rescue Exception => e\n render json: {error: e.message}\n end", "def urn_rdf( hash, rdf )\n graph = RDF::Graph.new\n rdf.each do |tri|\n tri.subject = RDF::Resource.new( hash['@id'] )\n tri.object = urn_obj( tri.object )\n graph << tri\n end\n graph\n end", "def to_rdf()\n graph = RDF::Graph.new\n as_rdf(Array.new).each do |triple|\n puts triple\n graph << triple\n end\n return graph\n end", "def graph_params\n params.require(:graph).permit(:path, :description, :tag_list, :visible)\n end", "def test_legal_string_parsing\n \n valid_json = ' { \"metros\" : [ {\n \"code\" : \"LON\" ,\n \"name\" : \"London\" ,\n \"country\" : \"UK\" ,\n \"continent\" : \"Europe\" ,\n \"timezone\" : 0 ,\n \"coordinates\" : {\"N\" : 52, \"W\" : 0} ,\n \"population\" : 12400000 ,\n \"region\" : 3\n } , {\n \"code\" : \"PAR\" ,\n \"name\" : \"Paris\" ,\n \"country\" : \"FR\" ,\n \"continent\" : \"Europe\" ,\n \"timezone\" : 1 ,\n \"coordinates\" : {\"N\" : 49, \"E\" : 2} ,\n \"population\" : 10400000 ,\n \"region\" : 3\n } ] , \n \"routes\" : [ {\n \"ports\" : [\"LON\" , \"PAR\"] ,\n \"distance\" : 2410\n } ] } '\n assert_equal( Graph.new().parse_json_string(valid_json), true ) \n\n missing_route_key = ' { \"metros\" : [ {\n \"code\" : \"LON\" ,\n \"name\" : \"London\",\n \"country\" : \"X\" ,\n \"continent\" : \"X\" ,\n \"timezone\" : 1 ,\n \"coordinates\" : {\"N\" : 1, \"E\" : 1} ,\n \"population\" : 1,\n \"region\" : 1\n } , {\n \"code\" : \"MOW\" ,\n \"name\" : \"Moscow\" ,\n \"country\" : \"X\" ,\n \"continent\" : \"X\" ,\n \"timezone\" : 1 ,\n \"coordinates\" : {\"N\" : 1, \"E\" : 1} ,\n \"population\" : 1,\n \"region\" : 1\n } ] ,\n \"routes\" : [ {\n \"ports\" : [\"LON\" , \"MOW\"]\n } ] } '\n\n caught = false\n begin\n graph = Graph.new()\n graph.parse_json_string(missing_route_key)\n rescue\n caught = true\n end\n\n assert_equal( caught, true)\n\n end", "def mergeNewsFeed\n newsFeed = aviator.merge flightglobal\n cleanNewsFeed= JSON.pretty_generate(newsFeed).gsub(\":\", \" =>\")\n cleanNewsFeed\nend", "def labeling_as_json(labeling)\n label = labeling.target\n return {\n origin: label.origin,\n reltype: labeling.type.to_relation_name,\n value: label.value,\n lang: label.language\n # TODO: relations (XL only)\n }\n end", "def initialize(graph)\n @graph = graph\n end", "def graph_params\n params.require(:graph).permit(:graph_label, :graph_type, :x_field, :y_field, :separator_fields, :data_json)\n end", "def replace_blank_nodes(obj, graph)\n # Remove \"@id\" attribute of JobPosting instance if it contains blank node\n filtered_obj = obj.select { |k, v| !((k == \"@id\") && blank?(v)) }\n Hash[filtered_obj.map { |k, v| [k, embed(v, graph)] }]\n end", "def graph=(graph)\n @graph = graph\n end", "def to_json\n att = self.instance_variables.map {|v| v.to_s }\n links = []\n data = {}\n\n att.delete(\"@url\")\n att.delete(\"@client\")\n\n self.links.each do |l|\n links << l.values.first.to_hash\n end\n att.delete(\"@links\")\n\n att.each do |opt|\n data[opt.delete(\"@\")] = instance_variable_get(opt)\n end\n data['links'] = links\n data.to_json\n end", "def shorten_link\n \t\tinput_link = params[:link][:given_link]\n \t\trender json: shorten_my_link(input_link)\n \tend", "def placeholder2json(ph)\r\n articles = ph[2]? '[\"'+ph[2].join('\",\"')+'\"]': 'null'\r\n \"[\\\"#{ph[0]}\\\", #{articles}, \\\"#{ph[3]}\\\", \\\"#{ph[4]}\\\"]\"\r\nend", "def example_result\n {\n \"data\": {\n \"id\": \"1\",\n \"type\": \"user\",\n \"attributes\": {\n \"first_name\": \"test\",\n \"last_name\": \"jones\"\n },\n \"relationships\": {\n \"blogs\": {\n \"data\": [\n {\n \"id\": \"1\",\n \"type\": \"blog\"\n },\n {\n \"id\": \"3\",\n \"type\": \"blog\"\n }\n ]\n }\n }\n },\n \"included\": [\n {\n \"id\": \"1\",\n \"type\": \"blog\",\n \"attributes\": {\n \"title\": \"Blog 1\"\n },\n \"relationships\": {\n \"images\": {\n \"data\": [\n {\n \"id\": \"4\",\n \"type\": \"image\"\n },\n {\n \"id\": \"3\",\n \"type\": \"image\"\n }\n ]\n }\n }\n },\n {\n \"id\": \"3\",\n \"type\": \"blog\",\n \"attributes\": {\n \"title\": \"another blog 1\"\n },\n \"relationships\": {\n \"images\": {\n \"data\": [\n {\n \"id\": \"5\",\n \"type\": \"image\"\n }\n ]\n }\n }\n },\n {\n \"id\": \"4\",\n \"type\": \"image\",\n \"attributes\": {\n \"filename\": \"ghg\"\n }\n },\n {\n \"id\": \"3\",\n \"type\": \"image\",\n \"attributes\": {\n \"filename\": \"ii\"\n }\n },\n {\n \"id\": \"5\",\n \"type\": \"image\",\n \"attributes\": {\n \"filename\": \"rty\"\n }\n }\n ]\n }\n end", "def jsonld_chk( file )\n hash = file_to_hash( file )\n if hash.has_key?('@context') == false\n raise JackRDF_Error, \"#{file} is not JSON-LD\"\n end\n return hash\n end", "def doimport\n json = JSON.parse(params[:json])\n nodes = []\n\n # Import entities\n json['nodes'].each do |node|\n entity = Entity.find_my_title(node['name'])\n\n # Entity data\n if entity.nil? \n entity = Entity.new\n entity.title = node['name']\n entity.save()\n end\n\n # Entity metadata\n if node['meta'].present?\n node['meta'].each do |meta|\n entity.add_meta(meta['key'] , meta['value'] , false)\n end\n end\n\n nodes[node['index']] = entity\n end\n\n # Import links\n json['links'].each do |link_ar|\n source = nodes[link_ar['source']]\n target = nodes[link_ar['target']]\n link = Link.find_my_link(source,target)\n\n if link.nil? \n link = Link.new\n link.ent_a = source\n link.ent_b = target\n link.save()\n end\n\n # Link metadata\n if link_ar['meta'].present?\n link_ar['meta'].each do |meta|\n link.add_meta(meta['key'] , meta['value'] , false)\n end\n end\n end\n redirect_to '/'\n end", "def inject_graph_values!\n end", "def negotiate_content(graph, format, html_view)\n if format.empty?\n format = request.accept.first.to_s || ''\n format.sub!(/;.+$/,'')\n headers 'Vary' => 'Accept'\n end\n\n case format\n when '', '*/*', 'html', 'application/xml', 'application/xhtml+xml', 'text/html' then\n content_type 'text/html'\n erb html_view\n when 'json', 'application/json', 'text/json' then\n content_type 'application/json'\n graph.dump(:json)\n when 'jsonld', 'application/ld+json' then\n content_type 'application/json'\n graph.dump(:jsonld, :standard_prefixes => true)\n when 'turtle', 'ttl', 'text/turtle', 'application/turtle' then\n content_type 'text/turtle'\n graph.dump(:turtle, :standard_prefixes => true)\n when 'nt', 'ntriples', 'application/n-triples', 'text/plain' then\n content_type 'text/plain'\n graph.dump(:ntriples)\n when 'rdf', 'rdfxml', 'application/rdf+xml', 'text/rdf' then\n content_type 'application/rdf+xml'\n graph.dump(:rdfxml, :standard_prefixes => true, :stylesheet => '/rdfxml.xsl')\n when 'trix', 'xml', 'application/trix' then\n content_type 'application/trix'\n graph.dump(:trix)\n else\n error 400, \"Unsupported format: #{format}\\n\"\n end\n end", "def glossify node, text\n if node['glossary'] == 'false'\n return node\n else\n glossterm = Nokogiri::XML::Node.new( 'glossterm', $document )\n glossterm[:linkend] = \"valsi-#{slugify(text)}\"\n glossterm.children = node.clone\n newnode = node.replace glossterm\n return newnode\n end\nend", "def uri_normalizer; end", "def parse_link; end", "def get_field_deserializers()\n return super.merge({\n \"displayName\" => lambda {|n| @display_name = n.get_string_value() },\n \"isCourseActivitySyncEnabled\" => lambda {|n| @is_course_activity_sync_enabled = n.get_boolean_value() },\n \"learningContents\" => lambda {|n| @learning_contents = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::LearningContent.create_from_discriminator_value(pn) }) },\n \"learningCourseActivities\" => lambda {|n| @learning_course_activities = n.get_collection_of_object_values(lambda {|pn| MicrosoftGraph::Models::LearningCourseActivity.create_from_discriminator_value(pn) }) },\n \"loginWebUrl\" => lambda {|n| @login_web_url = n.get_string_value() },\n \"longLogoWebUrlForDarkTheme\" => lambda {|n| @long_logo_web_url_for_dark_theme = n.get_string_value() },\n \"longLogoWebUrlForLightTheme\" => lambda {|n| @long_logo_web_url_for_light_theme = n.get_string_value() },\n \"squareLogoWebUrlForDarkTheme\" => lambda {|n| @square_logo_web_url_for_dark_theme = n.get_string_value() },\n \"squareLogoWebUrlForLightTheme\" => lambda {|n| @square_logo_web_url_for_light_theme = n.get_string_value() },\n })\n end" ]
[ "0.74671113", "0.6986429", "0.59655577", "0.5893633", "0.57965463", "0.56197625", "0.5584123", "0.5565764", "0.5468483", "0.54596055", "0.5429376", "0.54289496", "0.5397736", "0.5322343", "0.5309435", "0.5248647", "0.523075", "0.51897305", "0.5180021", "0.5170829", "0.5096105", "0.50806147", "0.508029", "0.50364995", "0.5026561", "0.5015636", "0.50141406", "0.5003132", "0.49075815", "0.49015877", "0.48995918", "0.48869383", "0.48625934", "0.48625934", "0.48563692", "0.48232254", "0.47919542", "0.4779932", "0.47756374", "0.47667295", "0.47397318", "0.47261578", "0.47192925", "0.4714834", "0.47050253", "0.4701805", "0.46964967", "0.468515", "0.4683972", "0.46798965", "0.46634522", "0.465392", "0.4652835", "0.46476194", "0.46392727", "0.46321023", "0.46321023", "0.46321023", "0.46321023", "0.46321023", "0.46321023", "0.46321023", "0.46321023", "0.46321023", "0.46321023", "0.46321023", "0.46321023", "0.46321023", "0.4631997", "0.46274197", "0.46125227", "0.45905492", "0.45900154", "0.45836127", "0.45776132", "0.4552985", "0.4552985", "0.45511076", "0.45492923", "0.45467943", "0.45434418", "0.45414287", "0.45375505", "0.45334348", "0.45317554", "0.4517645", "0.45130968", "0.45099196", "0.4506442", "0.4503554", "0.45005947", "0.44904774", "0.4490134", "0.44618818", "0.44504908", "0.44497478", "0.4448043", "0.4446011", "0.4444251", "0.4442988" ]
0.7450981
1
Loads `data` into a named graph, returns URI of the newly created graph with containing the data
def load_data(data) sha1 = Digest::SHA1.hexdigest data.dump(:turtle) graph_name = RDF::URI.new(@namespace + sha1) data = add_timestamp(graph_name, data) @sparql_update.insert_data(data, graph: graph_name) graph_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_graph_uri(slug)\n \"http://#{PublishMyData.local_domain}/graph/#{slug}\"\n end", "def build_from_string(data)\n\n # Check if string representation of the graph is valid\n raise ArgumentError, 'String representation of the graph is invalid' unless data =~ /\\A(|([a-z0-0A-Z]+=>[a-z0-0A-Z]*)(,[a-z0-0A-Z]+=>[a-z0-0A-Z]*)*)\\z/\n\n pairs = data.split(',')\n\n pairs.each do |value|\n items = value.split('=>')\n self.add_vertex(Vertex.new(items[0])) unless find_index_for_vertex(items[0]) != nil\n\n if (items.length == 2)\n self.add_vertex(Vertex.new(items[1])) unless find_index_for_vertex(items[1]) != nil\n self.add_edge(items[0],items[1])\n end\n end\n end", "def load(data)\n end", "def data_uri\n @data_uri\n end", "def data_uri\n @data_uri\n end", "def data_uri\n @data_uri\n end", "def uri_data_network(id)\n {\n project: GoogleTests::Constants::N_PROJECT_DATA[(id - 1) \\\n % GoogleTests::Constants::N_PROJECT_DATA.size],\n name: GoogleTests::Constants::N_NAME_DATA[(id - 1) \\\n % GoogleTests::Constants::N_NAME_DATA.size]\n }\n end", "def uri_data_network(id)\n {\n project: GoogleTests::Constants::N_PROJECT_DATA[(id - 1) \\\n % GoogleTests::Constants::N_PROJECT_DATA.size],\n name: GoogleTests::Constants::N_NAME_DATA[(id - 1) \\\n % GoogleTests::Constants::N_NAME_DATA.size]\n }\n end", "def uri_data_subnetwork(id)\n {\n project: GoogleTests::Constants::S_PROJECT_DATA[(id - 1) \\\n % GoogleTests::Constants::S_PROJECT_DATA.size],\n region: GoogleTests::Constants::S_REGION_DATA[(id - 1) \\\n % GoogleTests::Constants::S_REGION_DATA.size],\n name: GoogleTests::Constants::S_NAME_DATA[(id - 1) \\\n % GoogleTests::Constants::S_NAME_DATA.size]\n }\n end", "def data name\n File.read data_path(name)\nend", "def load_graph\n # Create new graph\n @graph = Nanoc3::DirectedGraph.new([ nil ] + @items)\n\n # Get store\n return if !File.file?(self.filename)\n store = PStore.new(self.filename)\n\n # Load dependencies\n store.transaction do\n # Verify version\n return if store[:version] != STORE_VERSION\n\n # Load vertices\n @previous_items = store[:vertices].map do |v|\n @items.find { |i| i.identifier == v }\n end\n\n # Load edges\n store[:edges].each do |edge|\n from_index, to_index = *edge\n from, to = @previous_items[from_index], @previous_items[to_index]\n @graph.add_edge(from, to)\n end\n end\n end", "def graphs\n @graphs ||= begin\n graphs = []\n graphs << {data: data, format: RDF::Format.for(data_file.to_s).to_sym} if data_file\n graphs + graphData.map do |g|\n {\n data: RDF::Util::File.open_file(g.graph.to_s, &:read),\n format: RDF::Format.for(g.graph.to_s).to_sym,\n base_uri: g.basename\n }\n end\n end\n end", "def add(data, format = Format::RDF_XML, graph_uri = nil)\n req_params = {\n payload: data,\n headers: { content_type: format }\n }\n req_params[:params] = { 'graph-uri' => graph_uri } if graph_uri\n\n database.execute_request(:post, \"/#{id}/add\", req_params)\n\n true\n end", "def load_graph(url, followed_predicates = nil, graph = nil)\n begin\n graph = RDF::Graph.new if graph.nil?\n \n # Using RestClient because RDF::RDFXML::Reader.open(url) doesn't do well w/ redirects\n data = RestClient.get( url, :accept => 'application/rdf+xml' ) \n RDF::Reader.for(:rdfxml).new(data) do |reader|\n reader.each_statement do |statement| \n # Add the statement to the graph\n graph << statement \n\n # If the statement contains a predicate we are interested in, recursively follow it\n # @TO-DO: add in a check that we are not going to get caught in a loop - see if \n # subject already exists in the graph\n if followed_predicates and followed_predicates.has_key?(statement.predicate.to_s)\n uri = find_followable_uri(url, statement, followed_predicates)\n load_graph(uri, followed_predicates, graph) if uri\n end\n end\n end\n graph\n rescue RestClient::BadGateway => e\n puts \"Warning: received response #{e.message} from #{url}\"\n graph\n end\n end", "def to_data_uri\n \"url(data:image/svg+xml;base64,#{to_base64});\"\n end", "def load_and_parse\n\n if @infile\n @graph = RDF::Graph.load(@infile)\n end\n\n end", "def import_data(data)\n @dataset.data = data\n @dataset.data[:energy_graph][:graph] = { calculated: false }\n @dataset.data[:molecules_graph][:graph] = { calculated: false }\n\n @dataset\n end", "def metadata_graph_uri(slug)\n \"#{data_graph_uri(slug)}/metadata\"\n end", "def build_from_hash(data)\n data.each do |start_vertex_name, end_vertex_name|\n # check if vertex is not already in the graph\n if (find_index_for_vertex(start_vertex_name) == nil )\n self.add_vertex(Vertex.new(start_vertex_name))\n end\n\n # if end vertex is specified\n if (end_vertex_name != nil)\n # and is not already in the graph\n if (find_index_for_vertex(end_vertex_name) == nil)\n self.add_vertex(Vertex.new(end_vertex_name))\n end\n\n # add an edge between vertices\n self.add_edge(start_vertex_name, end_vertex_name)\n end\n end\n\n self\n end", "def import_rdf(ns, fname)\n d = fname.match(/\\d{4}-\\d{2}-\\d{2}/)\n graph = ns + d.to_s\n cmd = \"#{STARDOG} data add -g \\\"#{graph}\\\" #{DB} \\\"#{fname}\\\"\"\n puts cmd\n puts system(cmd)\nend", "def uri_data(id)\n {\n project: GoogleTests::Constants::T_PROJECT_DATA[(id - 1) \\\n % GoogleTests::Constants::T_PROJECT_DATA.size],\n dataset: GoogleTests::Constants::T_DATASET_DATA[(id - 1) \\\n % GoogleTests::Constants::T_DATASET_DATA.size],\n name: GoogleTests::Constants::T_NAME_DATA[(id - 1) \\\n % GoogleTests::Constants::T_NAME_DATA.size]\n }\n end", "def update_(uri, rdf_data=nil, content_type=nil)\n reset(uri)\n\n if rdf_data\n res = sparql_push(uri, rdf_data.strip, content_type)\n else\n res = sparql_pull(%{LOAD \"#{uri}\" INTO GRAPH <#{uri}>})\n end\n\n return res\n end", "def graph(uri)\n @what, @uri = :graph, uri\n self\n end", "def load_data(data_hash)\n super\n @url = data_hash['url']\n end", "def graph(uri)\n self.options[:graph] = uri\n self\n end", "def graph(uri)\n self.options[:graph] = uri\n self\n end", "def graph(uri)\n self.options[:graph] = uri\n self\n end", "def load_rdf(url)\n data = RestClient.get(url, :accept => 'application/rdf+xml')\n \n RDF::Reader.for(:rdfxml).new(data) do |reader|\n reader.each_statement{ |statement| @graph << statement }\n end\n end", "def init_graph(name, data, viz_type = 'network', opts = {})\n # i = 0\n def_viz_opts = {\n #:schema => table.schema \n }\n \n gopts = {\n :data_sources => data,\n :dynamic => {\n :updateInterval => 1\n },\n :viz_type => viz_type,\n :wopts => def_viz_opts.merge(opts)\n \n }\n OMF::Web::Widget::Graph.addGraph(name, gopts) \nend", "def data_uri\n data = Base64.encode64(File.open(@path, 'r').read).gsub(/\\n/, '')\n \"data:#{mime_type};base64,#{data}\"\n end", "def _data_path id\n raise \"illegal data id #{id.inspect}\" unless id =~ /\\A\\w+(\\.\\w+)*\\z/\n path = path()\n \"#{path}/data/#{id}\"\n end", "def data_uri(image)\n mime_type = image.svg? ? 'image/svg+xml' : image.mime_type\n \"'data:#{mime_type};base64,#{Base64.encode64(image.blob).gsub(/\\r?\\n/, '')}'\"\n end", "def data_d\n Pathname.new \"#{exp_crit_d}/data\"\n \n end", "def post_data(graph, context=\"\")\n synchronize do\n # Prepares the dir to connect with the repository\n dir = \"#{@options[\"host\"]}:#{@options[\"port\"]}/openrdf-sesame/repositories/#{@options[\"repo\"]}/statements?context=%3C#{CGI::escape(context)}%3E\"\n data = graph.serialize(:ntriples)\n\n # Adds the data to Sesame\n RestClient.post dir, data, :content_type=>select_type\n end\n end", "def load_graph_dataset(nodes, edges)\n graph_dataset = {}\n\n nodes.each { |node| import_node!(node, graph_dataset) }\n edges.each { |edge| import_edge!(edge, graph_dataset) }\n\n graph_dataset\n end", "def load_graph()\n\n\t\t# Get bounds which are needed later\n\t\tdoc = File.open(@filename) { |f| Nokogiri::XML (f) }\n\n\t\t# get bounds\n\t\tbounds = {}\n\n\t\tdoc.xpath(\"//bounds\").each do |boundsValues|\n\t\t\tbounds[:minlon] = boundsValues[:minlon]\n\t\t\tbounds[:minlat] = boundsValues[:minlat]\n\t\t\tbounds[:maxlon] = boundsValues[:maxlon]\n\t\t\tbounds[:maxlat] = boundsValues[:maxlat]\n\t\tend\n\n\t\t# load nodes\n\t\tvertices = {}\n\t\tvisualVertices = {}\n\t\tdoc.xpath(\"//node\").each do |node|\n\t\t\t# this vertex\n\t\t\tnormalVertex = Vertex.new(node[:id])\n\t\t\tvertices[node[:id]] = normalVertex\n\n\t\t\t# kinda confusing to have lat, lon and x, y when they have the same value\n\t\t\tvisualVertex = VisualVertex.new(node[:id], normalVertex, node[:lat], node[:lon], node[:lat], node[:lon])\n\t\t\tvisualVertices[node[:id]] = visualVertex\n\t\tend\n\n\t\t# load edges\n\t\tedgesAr = []\n\t\tvisualEdgesAr = []\n\t\tv1 = nil\n\t\tskip = true\n\t\twayCounter = 0\n\t\twayCounter2 = 0\n\n\n\n\t\tdoc.xpath(\"//way\").each do |way|\n\t\t\tdoc2 = Nokogiri::XML(way.to_s)\n\t\t\t# for each way check tags for highway, speed etc\n\t\t\twayCounter2 = wayCounter2 + 1\n\t\t\tv1 = nil\n\t\t\tskip = true\n\t\t\tmaxSpeed = 50\n\t\t\toneWay = false\n\n\t\t\tdoc2.xpath(\"//tag\").each do |tag|\n\t\t\t\tif tag[:k] == \"highway\" && (@highway_attributes.include? tag[:v])\n\t\t\t\t\tskip = false\n\t\t\t\tend\n\n\t\t\t\tif tag[:k] == \"maxspeed\"\n\t\t\t\t\tmaxSpeed = tag[:v].to_i\n\t\t\t\tend\n\n\t\t\t\tif tag[:k] == \"oneway\" && tag[:v] == \"yes\"\n\t\t\t\t\toneWay = true\n\t\t\t\tend\n\n\t\t\t\t# Set max speed based on the tag\n\t\t\t\tif tag[:k] == \"source:maxspeed\"\n\t\t\t\t\tif tag[:v] == \"CZ:motorway\"\n\t\t\t\t\t\tmaxSpeed = 130\n\t\t\t\t\telsif tag[:v] == \"CZ:trunk\"\n\t\t\t\t\t\tmaxSpeed = 110\n\t\t\t\t\telsif tag[:v] == \"CZ:rural\"\n\t\t\t\t\t\tmaxSpeed = 90\n\t\t\t\t\telsif tag[:v] == \"CZ:urban_motorway\"\n\t\t\t\t\t\tmaxSpeed = 80\n\t\t\t\t\telsif tag[:v] == \"CZ:urban_trunk\"\n\t\t\t\t\t\tmaxSpeed = 80\n\t\t\t\t\telsif tag[:v] == \"CZ:urban\"\n\t\t\t\t\t\tmaxSpeed = 50\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tif !skip\n\t\t\t\twayCounter = wayCounter + 1\n\n\t\t\t\tdoc2.xpath(\"//nd\").each do |point|\n\t\t\t\t\tif v1 == nil\n\t\t\t\t\t\tv1 = point[:ref]\n\t\t\t\t\telse\n\t\t\t\t\t\t# create normal edge\n\t\t\t\t\t\tnewEdge = {:vertex1 => v1, :vertex2 => point[:ref], :maxSpeed => maxSpeed, :oneWay => oneWay}\n\t\t\t\t\t\tedgesAr << newEdge\n\n\n\t\t\t\t\t\t# edges << Edge.new(v1, point[:ref], maxSpeed, oneWay)\n\t\t\t\t\t\tv1 = point[:ref]\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t# we have all the edges eg lines. there is a lot of duplicates so reduce them!\n\t\tedgesArReduced = edgesAr.uniq\n\n\t\t# used is a unique hash of used vertices - we don't need points that are not being referenced by any path\n\t\tusedVertices = {}\n\t\tusedVisualVertices = {}\n\t\tedges = []\n\t\t# now put them into the array as instances of the required class Edge\n\t\tedgesArReduced.each do |edge|\n\t\t\tnewEdgeReduced = Edge.new(vertices[edge[:vertex1]], vertices[edge[:vertex2]], edge[:maxSpeed], edge[:oneWay])\n\n\t\t\t# used vertices\n\t\t\tusedVertices[edge[:vertex1]] = vertices[edge[:vertex1]]\n\t\t\tusedVertices[edge[:vertex2]] = vertices[edge[:vertex2]]\n\n\t\t\tedges << newEdgeReduced # create visual edge\n\n\n\t\t\tvisualEdge = VisualEdge.new(newEdgeReduced, visualVertices[edge[:vertex1]], visualVertices[edge[:vertex2]])\n\t\t\tusedVisualVertices[edge[:vertex1]] = visualVertices[edge[:vertex1]]\n\t\t\tusedVisualVertices[edge[:vertex2]] = visualVertices[edge[:vertex2]]\n\n\t\t\tvisualEdgesAr << visualEdge\n\t\tend\n\n\t\t# load\n\t\t#\n\t\t# test generating the graph with the graphwiz - all seems good in the exported file\n\t\tgraph = Graph.new(usedVertices, edges)\n\t\tvisualGraph = VisualGraph.new(graph, usedVisualVertices, visualEdgesAr, bounds)\n\n\t\t# we have edges nwo find the largest component\n\t\tcomponents = {}\n\n\n\t\treturn graph, visualGraph\n\n\tend", "def data= data\n leafs.compact!\n \n self.dataset = data.to_a\n self.url = nil\n end", "def get_url(data_name, next_data_indices = {})\n if next_data_indices.empty?\n next_data_indices = { nextStartIndex: 0, nextLikeStartIndex: 0, nextThumbStartIndex: 0 }\n else\n next_data_indices = next_data_indices.dup\n end\n\n next_data_indices[:webname] = @webname\n next_data_indices[:pat] = Downloader.get_pat\n\n DATA_FEED_URLS[data_name] % next_data_indices\n end", "def read_graph_from_file(filename)\n puts \"Read graph data from file #{filename}\"\n File.readlines(filename).each do |line|\n line = line.chomp # remove the carriage return\n values = line.split(\",\")\n type = values[0]\n tags = {}\n if type == \"N\" or type == \"n\"\n name = values[1]\n if values.size > 2\n value = values[2]\n # The second position can be a tag or the node value\n if value.include? \"=\"\n process_tag_string(tags, value)\n value = nil \n end \n else \n value = nil \n end\n if values.size > 3\n values[3..-1].each do |tag_string|\n process_tag_string(tags, tag_string) \n end\n end\n add(name, value, tags)\n elsif type == \"E\" or type == \"e\" or type == \"L\" or type == \"l\" or type == \"C\" or type == \"c\"\n source_name = values[1]\n destination_name = values[2]\n if values.size > 3\n values[3..-1].each do |tag_string|\n process_tag_string(tags, tag_string) \n end\n end\n connect(source_name, destination_name, tags)\n else \n puts \"Ignoring line: #{line}\"\n end\n end\n end", "def name(name)\n @graph_name = name\n self\n end", "def create_uri\n end", "def parse(data)\n @children.clear\n data = StringIO.new(data)\n while !data.eof?\n mode = Util.read_bytes_until(data, ' ').to_i(8)\n name = repository.set_encoding Util.read_bytes_until(data, \"\\0\")\n id = repository.set_encoding data.read(20).unpack(\"H*\").first\n @children[name] = Reference.new(:repository => repository, :id => id, :mode => mode)\n end\n end", "def data_uri=(uri)\n assign_data_uri(uri)\n @data_uri = uri\n end", "def import(data)\n data\n end", "def path\n data.path\n end", "def path\n data.path\n end", "def graph_name; @options[:graph_name]; end", "def load(*args)\n super(*args)\n self.id = self.uri.split('/').last if self.id.nil? and defined? self.uri\n end", "def load_graph()\n nodes = {}\n vertices = {}\n visualVertices = {}\n edges = []\n visualEdges = []\n bounds = {}\n\n File.open(@filename, 'r') do |file|\n doc = Nokogiri::XML::Document.parse(file)\n\n doc.root.xpath('bounds').each do |bound|\n bounds[:minlon] = bound['minlon']\n bounds[:minlat] = bound['minlat']\n bounds[:maxlon] = bound['maxlon']\n bounds[:maxlat] = bound['maxlat']\n end\n\n doc.root.xpath('node').each do |node|\n nodes[node['id']] = node\n end\n\n doc.root.xpath('way').each do |way_element|\n speed = 50\n oneway = false\n continue = false\n\n way_element.xpath('tag').each do |tag_element|\n speed = tag_element['v'] if tag_element['k'] == 'maxspeed'\n oneway = true if tag_element['k'] == 'oneway'\n continue = true if tag_element['k'] == 'highway' && @highway_attributes.include?(tag_element[\"v\"])\n end\n\n if continue\n (way_element.xpath('nd').count - 1).times do |i|\n from_nd_id = way_element.xpath('nd')[i]\n to_nd_id = from_nd_id.next_element['ref']\n\n from_node = nodes[from_nd_id['ref']]\n to_node = nodes[to_nd_id]\n\n # Create vertex, add into hash\n vertex = Vertex.new(to_nd_id)\n vertex2 = Vertex.new(from_nd_id['ref'])\n vertices[to_nd_id] = vertex unless vertices.has_key?(to_nd_id)\n vertices[from_nd_id['ref']] = vertex2 unless vertices.has_key?(from_nd_id['ref'])\n\n # Create visual vertex\n visual_vertex2 = VisualVertex.new(to_nd_id, to_node, to_node['lat'], to_node['lon'], to_node['lat'], to_node['lon'])\n visual_vertex = VisualVertex.new(from_node['id'], from_node, from_node['lat'], from_node['lon'], from_node['lat'], from_node['lon'])\n visualVertices[from_node['id']] = visual_vertex unless visualVertices.has_key?(from_node['id'])\n visualVertices[to_node['id']] = visual_vertex2 unless visualVertices.has_key?(to_node['id'])\n\n # Create edge\n edge = Edge.new(vertex, vertex2, speed, oneway)\n edges << edge\n edge.distance = calculate_distance([from_node['lat'].to_f, from_node['lon'].to_f], [to_node['lat'].to_f, to_node['lon'].to_f])\n\n # Create visual edge\n visualEdge = VisualEdge.new(edge, visual_vertex, visual_vertex2)\n visualEdges << visualEdge\n end\n end\n end\n end\n\n # Create graph, visual graph\n graph = Graph.new(vertices, edges)\n visualGraph = VisualGraph.new(graph, visualVertices, visualEdges, bounds)\n\n # Find largest component\n largest_comp = find_component(graph)\n\n # Filter vertices and edges from largest component and create graphs from largest component\n filtered_edges = graph.edges.reject { |edge| !largest_comp.include?(edge.v1.id) || !largest_comp.include?(edge.v2.id)}\n filtered_vertices = graph.vertices.reject { |vertex| !largest_comp.include?(vertex)}\n filter_visual_edges = visualGraph.visual_edges.reject { |vis_edge| !largest_comp.include?(vis_edge.v1.id) || !largest_comp.include?(vis_edge.v2.id)}\n filter_visual_vertices = visualGraph.visual_vertices.reject { |vis_vertex| !largest_comp.include?(vis_vertex)}\n\n graph = Graph.new(filtered_edges,filtered_vertices)\n visualGraph = VisualGraph.new(graph, filter_visual_vertices, filter_visual_edges, bounds)\n\n return graph, visualGraph\n end", "def load_data(filename)\n if File.exist? filename\n File.foreach (filename) do |line|\n line = line.chomp.split(\" \").map(&:to_i)\n if line.length == 1\n @num_vertices = line[0]\n next\n else\n @edges << [line[2], line[0], line[1]]\n if !@groups[line[0]]\n @groups[line[0]] = [line[0]]\n @leader_pointers[line[0]] = line[0]\n end\n if !@groups[line[1]]\n @groups[line[1]] = [line[1]]\n @leader_pointers[line[1]] = line[1]\n end \n end\n end\n end\n # sort edges costs\n @edges.sort! { |a, b| a[0] <=> b[0] }\n end", "def build_graph\n \n RDF::Graph.load(@options.file).each do |statement|\n subject = statement.subject\n predicate = statement.predicate\n object = statement.object\n \n edge(predicate,node(subject),node(object))\n end\n end", "def read_file(filename, graph)\n File.foreach(filename) do |x|\n id, data, neighbors = vertex_creation(x)\n graph.add_vertex(id, data, neighbors)\n end\n graph\nend", "def load_graph\n graph_loader = GraphLoader.new(@map_file, @highway_attributes)\n @graph, @visual_graph = graph_loader.load_graph()\n end", "def uri_data(id)\n {\n name: GoogleTests::Constants::B_NAME_DATA[(id - 1) \\\n % GoogleTests::Constants::B_NAME_DATA.size],\n project: GoogleTests::Constants::B_PROJECT_DATA[(id - 1) \\\n % GoogleTests::Constants::B_PROJECT_DATA.size]\n }\n end", "def load\n eval(@data, TOPLEVEL_BINDING, @filename)\n end", "def dataset\n graph && graph.dataset\n end", "def read_as_data_url(file)\n return unless file\n `#{@el}.readAsDataURL(file.native)`\n end", "def from_data(data)\n id = allocate\n id.send(:data=, data)\n id\n end", "def build_graph(title, unit, file, data)\n graph = Gruff::Line.new\n graph.title = title\n labels = {}\n values = []\n number = 10 - 1\n\n if unit == \"monthly\"\n number -= 2\n end\n\n massage_dates data, unit\n\n data.each_with_index do |v, i|\n if i % (data.length.to_f/number).ceil == 0 and labels.size < number\n # skip the last label, add it manually\n labels[i] = v[\"time\"]\n end\n values << v[\"average\"]\n end\n\n labels[data.size-1] = data.last[\"time\"]\n\n graph.labels = labels\n graph.data \"BTC ($)\", values\n\n graph.write(file.path)\n end", "def graph_image_path\n File.join('/', graph_relative_path)\n end", "def graph_name\n nil\n end", "def store_graph\n FileUtils.mkdir_p(File.dirname(self.filename))\n store = PStore.new(self.filename)\n store.transaction do\n store[:version] = STORE_VERSION\n store[:vertices] = @graph.vertices.map { |i| i && i.identifier }\n store[:edges] = @graph.edges\n end\n end", "def geographic(subject, data, predicate=RDF::Vocab::DC[:spatial], extra_params={})\n @log.debug(\"Geographic: \" + data)\n\n graph = RDF::Graph.new\n\n Array(data.split(';')).each do |location|\n location.strip!\n\n @log.debug(\"Geographic split: \" + location)\n\n unless geocache.include? location\n begin\n geonames_search(location, extra_params)\n rescue => e\n puts subject, location, e.backtrace\n end\n end\n\n if geocache.include? location\n graph << RDF::Statement.new(subject, predicate, geocache[location][:uri])\n else\n @log.warn(\"Geographic URI not found: \" + location)\n# graph << RDF::Statement.new(subject, predicate, location)\n end\n end\n\n graph\n end", "def read_file_into_graph(filename, graphname)\n line_counter = 0\n\n query_start = \"INSERT DATA { GRAPH <#{graphname}> { \"\n query_end = \"} }\"\n insert_block = \"\"\n\n File.open(filename).each do |line|\n insert_block += line + \" \"\n line_counter += 1\n \n if(line_counter > LINES_PER_INSERT)\n update(\"#{query_start}#{insert_block}#{query_end}\")\n insert_block = \"\"\n line_counter = 0\n end\n \n end\n\n if insert_block.length > 0\n update(\"#{query_start}#{insert_block}#{query_end}\")\n end\n\nend", "def initialize(name)\n @name = name\n @edges = Hash.new\n end", "def load_datasource\n @datasource.write(query.to_json)\n @datasource.rewind # be kind\n @datasource.path\n end", "def graph(data = nil)\n robj = Rserve::Simpler.new\n hash = {}\n hash[\"mass\"] = data.map(&:first)\n hash[\"intensity\"] = data.map(&:last)\n robj.converse( masses: hash.to_dataframe) do \n \"attach(masses)\"\n end\n #robj.converse( data: Rserve::DataFrame.from_structs(list))\n robj.converse \"setwd('#{Dir.pwd}')\"\n output_file_name = \"#{@sequence}_spectra.png\"\n robj.converse do \n %Q{png(file='#{output_file_name}')\n plot(masses$mass, masses$intensity, type='h')\n dev.off()\n }\n end\t\n output_file_name\n end", "def data_path name\n File.join File.dirname(__FILE__), 'data', \"#{ name }.yml\"\nend", "def load(name); end", "def find(uri, data)\n graph = RDF::Graph.new(uri / '#meta', data: data)\n raise NotFound if graph.empty?\n\n rdf_class = graph.query([uri, RDF.type, :o]).first\n klass = INTERACTION_MODELS[rdf_class.object] if rdf_class\n klass ||= RDFSource\n \n klass.new(uri, data) \n end", "def fetch(name, rrd_file, value, type)\n # format: DEF:name=rrd_file:value:type\n @graph_command << \"DEF:#{name}=#{rrd_file}:#{value}:#{type}\"\n end", "def json_directional(name, logger)\n\t# return '{\"nodes\":[], \"links\":[], \"constraints\":[]}'\n\t\n\t\n\t\n\t\n\t# input sanitization???\n\t# I mean, the name is coming from a URL piece, so it could be anything...\n\t\n\t\n\t# logger.info @rake.methods.grep(/task/).inspect\n\t# logger.info @rake.tasks.inspect\n\t\n\tshort_path = 'public/CS_BS_all.yaml'\n\t\n\tregenerate_graph = false\n\t@rake[short_path].invoke ->(){\n\t\t# --- this callback runs when YAML file in 'short_path' is regenerated\n\t\tlogger.info \"graph generation callback\"\n\t\t\n\t\tregenerate_graph = true\n\t}\n\t\n\t# Generate graphs if\n\t# 1) no graph yet in memory\n\t# 2) source YAML file was modified\n\tif regenerate_graph or @graphs[short_path].nil?\n\t\t@graphs[short_path] = SummerResearch::DependencyGraph.new.tap do |graph|\n\t\t\traw_data = Models::Utilities.load_yaml_file(short_path)\n\t\t\t# raw_data = \n\t\t\t\t# if name.include? 'split'\n\t\t\t\t# \tModels::Utilities.load_yaml_file \"public/#{name}.yaml\"\n\t\t\t\t# else\n\t\t\t\t\t# Models::Utilities.load_yaml_file(short_path)\n\t\t\t\t# end\n\t\t\t\n\t\t\t# NOTE: just get the node and vert information first. The data will be converted to the proper output format later.\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t# --- add basic node and edge information to the graph\n\t\t\tnodes = raw_data.collect{ |k,v| [k, v] }.flatten.uniq\n\t\t\t\n\t\t\tlinks =\n\t\t\t\traw_data.collect do |course, deps|\n\t\t\t\t\tdeps.collect do |dependency|\n\t\t\t\t\t\t[course, dependency]\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tlinks = links.flatten(1) # remove extra level of nesting\n\t\t\tlinks.delete_if do |course, dependency|\n\t\t\t\tcourse == dependency # remove self-links resulting from messy data\n\t\t\tend\n\t\t\t\n\t\t\t\n\t\t\tlogger.info nodes.inspect\n\t\t\tlogger.info links.inspect\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tnodes.each do |vertex|\n\t\t\t\tgraph.add_vertex(vertex)\n\t\t\tend\n\t\t\t\n\t\t\tlinks.each do |course, dependency|\n\t\t\t\tgraph.add_edge(dependency, course)\n\t\t\tend\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t# --- debug printing to make sure that worked\n\t\t\t\n\t\t\t# NOTE: the first item in either of these lists, is the requested node.\n\t\t\t# ie) ancestors of CS 367 includes CS 367 itself, even if all self-loops were removed\n\t\t\t# NOTE: was able to fix this by returning a slightly different Enumerator from the DependencyGraph class.\n\t\t\tlogger.info \"Ancestors\"\n\t\t\tlogger.info graph.ancestors(\"CS 367\").to_a.inspect\n\t\t\tlogger.info \"Parents\"\n\t\t\tlogger.info graph.parents(\"CS 367\").to_a.inspect\n\t\t\tlogger.info \"Children\"\n\t\t\tlogger.info graph.children(\"CS 367\").to_a.inspect\n\t\t\tlogger.info \"Descendants\"\n\t\t\tlogger.info graph.descendants(\"CS 367\").to_a.inspect\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tlogger.info graph.each_vertex.to_a\n\t\t\tlogger.info graph.each_edge.to_a\n\t\tend\n\tend\n\t\n\t# pull graph from the cache\n\tgraph = @graphs[short_path]\n\t\n\traise \"Could not find DependencyGraph data. Should have been generated after #{short_path} was made, but it seems like that as not the case.\" if graph.nil?\n\t\n\t\n\t# if short_path == 'data/CS_BS_all.yaml'\n\t\t[\n\t\t\t'CS 310',\n\t\t\t'CS 330',\n\t\t\t'CS 367',\n\t\t\t# 'ENGH 302',\n\t\t\t# # 'CS 262',\n\t\t\t# # 'CS 351',\n\t\t\t# # 'MATH 351',\n\t\t\t# # 'MATH 203',\n\t\t\t# 'STAT 344',\n\t\t\t# # 'MATH 125',\n\t\t\t# 'ECE 445',\n\t\t\t# # 'CS 222',\n\t\t\t# # 'CS 112',\n\t\t\t# # 'STAT 346',\n\t\t\t# 'SYST 210',\n\t\t].each do |course|\n\t\t\t# graph.cut course\n\t\tend\n\t# end\n\t\n\t# graph.remove_vertex('MATH 112') # Discrete Math for IT\n\t# graph.remove_vertex('CS 222') # \"Computer Programming for Engineers\", basically like CS 262\n\t\n\t\n\t\n\t\n\trequirement_by_type_file = 'data/CS_BS_requirements_by_type.yaml'\n\t@rake[requirement_by_type_file].invoke\n\t\n\trequirement_by_type = Models::Utilities.load_yaml_file(requirement_by_type_file)\n\t\n\t\n\t\n\trequired_courses = requirement_by_type[:required].to_set\n\telective_courses = requirement_by_type[:elective].to_set\n\t\n\t\n\t\n\t\n\t\n\t\n\trequirements_file = 'data/CS_BS_requirements.yaml'\n\t@rake[requirements_file].invoke\n\t\n\tdegree_requirements = Models::Utilities.load_yaml_file(requirements_file)\n\tdegree_requirements\n\t\n\telective_category = \n\t\tdegree_requirements.select{ |name, sector| sector[:data].is_a? Hash }\n\t\t .collect { |name, sector|\n\t\t \t sector[:data].collect{ |category, course_id|\n\t\t \t \t[course_id, name]\n\t\t \t }\n\t\t }\n\t\t .flatten(1) # array of [course_id, name] pairs\n\t\n\t# convert [course_id, name] relation into { course_id => i }, where i is an integer corresponding to 'name' in a list of all values for 'name'\n\telective_category = elective_category.to_h\n\t\n\tname_list = elective_category.values.uniq\n\tname_to_number = name_list.each_with_index.to_h\n\t\n\tlogger.info name_list.inspect\n\t\n\telective_category = \n\t\telective_category.collect{ |course_id, name|\n\t\t\t[course_id].flatten.collect { |id|\n\t\t\t\t[ id, name_to_number[name] ]\n\t\t\t}\n\t\t}\n\t\t.flatten(1)\n\t\t.to_h\n\t\n\tlogger.info elective_category.inspect\n\t\n\t\n\treturn graph.to_json_d3v3_cola(required_courses, elective_courses, elective_category)\n\t\n\t\n\t\n\t# below is a bunch of old code, to generate the graph the old way\n\t# still keeping it around, because some of these constraints have not been implemented\n\t# in the new system.\n\t# Also, this alternative way of specifying colors is interesting.\n\t# -------------------------------------------------------------------\n\t\n\t\n\t\n\t\n\t# === Create Constraints\n\t# basic constraint: prereqs go above later courses.\n\t\t# (overall visual flow: top to bottom as skill increases)\n\t\t# defined as local property.\n\t\t# graph ends up showing global properties.\n\tc1 =\n\t\traw_data2.collect do |course, deps|\n\t\t\tdeps.collect do |d|\n\t\t\t\ti_left =\n\t\t\t\t\tnodes.find_index{ |x| x['name'] == course}\n\t\t\t\t\n\t\t\t\ti_right =\n\t\t\t\t\tnodes.find_index{ |x| x['name'] == d}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t{\n\t\t\t\t\t\"axis\" => \"y\", \n\t\t\t\t\t\"left\" => i_left, \"right\" => i_right, \"gap\" => 25\n\t\t\t\t}\n\t\t\tend\n\t\tend\n\tc1.flatten!\n\t\n\tconstraints = c1\n\t\n\t# TODO: implement constraint such that all 100-level courses are above the 200-level ones, etc etc.\n\t# (want to stratify course levels)\n\t# logger.info \"HEY\"\n\tgap = 500\n\tc2 =\n\t\tnodes.combination(2)\n\t\t.collect{ |n1, n2| # isolate the names\n\t\t\t[n1['name'], n2['name']]\n\t\t}\n\t\t.select{ |n1, n2| # filter by course number\n\t\t\tlogger.info [n1,n2].inspect\n\t\t\ta,b = [n1, n2].collect{|x| x.split.last[0].to_i }\n\t\t\t\n\t\t\ta > 3\n\t\t}.collect{ |n1, n2|\n\t\t\ti_left =\n\t\t\t\tnodes.find_index{ |x| x['name'] == n1}\n\t\t\t\n\t\t\ti_right =\n\t\t\t\tnodes.find_index{ |x| x['name'] == n2}\n\t\t\t\n\t\t\t{\n\t\t\t\t\"axis\" => \"y\", \n\t\t\t\t\"left\" => 28, \"right\" => i_left, \"gap\" => gap\n\t\t\t}\n\t\t}\n\t\n\t\t# this constraint currently has no effect on the output\n\tconstraints = constraints + c2\n\tconstraints.flatten!\n\t\n\t\n\t\n\t# all nodes want to have horizontal spacing\n\tgap = 25\n\tc3 =\n\t\tnodes.combination(2)\n\t\t.collect{ |n1, n2| # isolate the names\n\t\t\t[n1['name'], n2['name']]\n\t\t}\n\t\t.select{ |n1, n2| # filter by course number\n\t\t\tlogger.info [n1,n2].inspect\n\t\t\ta,b = [n1, n2].collect{|x| x.split.last[0].to_i }\n\t\t\t\n\t\t\ta > 3\n\t\t\ttrue\n\t\t}.collect{ |n1, n2|\n\t\t\ti_left =\n\t\t\t\tnodes.find_index{ |x| x['name'] == n1}\n\t\t\t\n\t\t\ti_right =\n\t\t\t\tnodes.find_index{ |x| x['name'] == n2}\n\t\t\t\n\t\t\t{\n\t\t\t\t\"axis\" => \"x\", \n\t\t\t\t\"left\" => i_left, \"right\" => i_right, \"gap\" => gap\n\t\t\t}\n\t\t}\n\t\n\t\t# this constraint currently has no effect on the output\n\tconstraints = constraints + c3\n\tconstraints.flatten!\n\t\n\t\n\t\n\t\n\t# TODO: implement constraint that causes all courses from a single department to clump\n\t\n\t\n\t\n\t\n\t\n\t# === additional processing on the graph\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t# === rough packaging for output\n\tout = {\n\t\t# 'name' => name,\n\t\t'nodes' => nodes,\n\t\t'links' => links,\n\t\t'constraints' => constraints\n\t}\n\t\n\t\n\t# === style the nodes\n\t\n\tcolor_key ||= {\n\t\t:gated_elective_clump => \"#10D588\", # light green\n\t\t:split_link => \"#3399FF\", # blue\n\t\t\n\t\t:required => \"#CC2300\", # red / orange\n\t\t:elective => \"#242424\", # black\n\t\t:not_required => \"#AAA\" # grey\n\t}\n\t\n\trequired =\n\t\t@data[:required].collect{ |clump| clump.keys }\n\t\t.flatten\n\t\t.to_set\n\t\n\telective = \n\t\t@data[:elective].values\n\t\t.collect{ |clump| clump.keys }\n\t\t.flatten\n\t\t.to_set\n\t\n\t\n\tout['nodes'].each do |node|\n\t\t# --- color assigment\n\t\ttype = node_type(node['name'], required, elective)\n\t\t# node['color'] = color_key[type]\n\t\tnode['class'] = type.to_s.tr('_', '-')\n\t\t\n\t\t\n\t\t# --- do other things with type\n\t\t# leaves << node['id'] if type == :not_required\n\tend\n\t\n\t\nend", "def graph(hash, name)\n Haml::Engine.new(File.read(\"../templates/hist.haml\")).def_method(hash, :render, :title)\n begin\n hist = File.open(\"#{name}\", 'w')\n hist.write(hash.render(:title => name))\n rescue IOError => e\n puts e\n end\n end", "def import_graph\n graph_loader = GraphLoader.new(@map_file, @highway_attributes)\n @graph, @visual_graph = graph_loader.load_graph_viz\n end", "def graph_name=(name)\n formulae[name] = self\n @options[:graph_name] = name\n end", "def initialize(data)\n @node_data = data\n end", "def to_graph\n return RDF::Graph.new if target_id.blank?\n g = Resource.new(rdf_subject)\n g.proxy_for = target\n g.proxy_in = proxy_in.try(:uri)\n g.next = self.next.try(:rdf_subject)\n g.prev = prev.try(:rdf_subject)\n g.graph\n end", "def uri_data(id)\n {\n project: GoogleTests::Constants::IT_PROJECT_DATA[(id - 1) \\\n % GoogleTests::Constants::IT_PROJECT_DATA.size],\n name: GoogleTests::Constants::IT_NAME_DATA[(id - 1) \\\n % GoogleTests::Constants::IT_NAME_DATA.size]\n }\n end", "def load_data(data_file)\n puts \"FileGenTask: Loading data from YML file [ #{data_file} ]\" if @verbose\n df = DataFile.new\n @data = df.read( data_file )\n end", "def get_uri\n compute!\n uri = '/diagram/class/'[email protected](\", \")\n end", "def apply_uri_template(template, data)\n ::Middleman::Util.normalize_path(::Addressable::URI.unencode(template.expand(data)).to_s)\n end", "def create_data_location(address)\n uri = URI.parse(address.to_s)\n uri = uri.scheme ? uri : URI.parse(\"local:%s\" % Pathname.new(uri.path).expand_path)\n if location_class = SCHEMES[uri.scheme]\n location_class.new(uri)\n else\n raise ArgumentError.new(uri)\n end\n end", "def add_graph(query, graph_name)\n graph_uri = \"<#{graph_name}>\"\n query.gsub(/\\?validatedGraph/i, graph_uri)\n end", "def load_track_data(data)\n track = Hash.new\n key = nil\n data.children.each do |data|\n if data.name == 'key'\n key = data.text.downcase.gsub(/\\s/, '_').to_sym\n elsif data.name == 'integer'\n track[key] = data.text.to_i\n elsif data.name == 'string'\n track[key] = data.text\n end\n end\n track\n end", "def create_external_asset_from_params\n attrs={}\n attrs.merge!({:namespace=>params[:namespace]}) if params[:namespace]\n attrs.merge!(:dsLabel=>params[:Filename]) if params[:Filename]\n ext_asset = ExternalAsset.new(attrs)\n uri = params[:dsLocation]\n uri = \"http://#{uri}\" unless uri.include?(\"://\")\n ext_asset.link_append({:dsLocation=>uri,:dsLabel=>params[:Filename], :mimeType=>mime_type(params[:Filename])})\n ext_asset.filename = params[:Filename]\n ext_asset.identifier = uri\n return ext_asset\n end", "def hier_graph_create(filename)\n @@name_id = Hash.new \n ### Making the name of the file from the parameter filename \n newfilename= make_filename(filename) \n ######################################################## \n\n ## Hierarchical Hash -- where the module are connected based on the instantiation\n load_cycloHash() \n \n\n @hierHash=Hash.new\n @block.each do|key,value|\n @@name_id[value.name]= value.id \n a=[]\n value.each_instance(){|y| a.push(y)}\n b = Array.new\n a.each {|val| if(@block.has_key?(val)) then b.push(val) end}\n @hierHash[key] = b.uniq\n end # end of @lock.each do....\n xArr = Array.new\n @hierHash.each {|key, value|\n if (value.length > 0) then \n xArr.concat(value) \n end \n }\n xArr.each{|key| \n if (@hierHash.has_key?(key)) then \n tmp =Array.new\n tmp = @hierHash[key]\n if (tmp.length === 0) then\n @hierHash.delete(key) \n end\n end \n }\n\n write_file(newfilename) ## Makes directed graph that must be called by dot\n @@name_id.each{|k,v| print k, \": \",v, \"\\n\"}\n end", "def load_path\n data[:load_path].nil? ? \"\" : data[:load_path]\n end", "def apply_uri_template(template, data)\n ::Middleman::Util.normalize_path Addressable::URI.unencode(template.expand(data)).to_s\n end", "def set(data_path)\n data = dup\n data.data_path = data_path\n data\n end", "def connect_local_graphs_data(local_graphs)\n dfg.blocks.each do |predecessor|\n arg_outs = local_graphs[predecessor.id].outputs.values\n arg_outs.each_with_index do |arg_out, arg_n|\n predecessor.outgoing_blocks.each do |successor|\n successor_graph = local_graphs[successor.id]\n arg_in = successor_graph.inputs.values[arg_n]\n\n # We're connecting to a phi node, so we may need a special\n # label.\n raise unless arg_in.is_a?(PhiNode)\n\n label =\n case arg_out\n when InsnNode\n # Instructions that go into a phi node are labelled by the\n # offset of last instruction in the block that executed\n # them. This way you know which value to use for the phi,\n # based on the last instruction you executed.\n dfg.blocks.find do |block|\n block_start = block.block_start\n block_end =\n block_start + block.insns.sum(&:length) -\n block.insns.last.length\n\n if (block_start..block_end).cover?(arg_out.offset)\n break block_end\n end\n end\n when PhiNode\n # Phi nodes to phi nodes are not labelled.\n else\n raise\n end\n\n connect(arg_out, arg_in, :data, label)\n end\n end\n end\n end", "def graphs\n @graphs ||= begin\n graphs = []\n graphs << {data: action.test_data_string, format: RDF::Format.for(action.test_data.to_s.to_s).to_sym} if action.test_data\n graphs + action.graphData.map do |g|\n {\n data: RDF::Util::File.open_file(g, &:read),\n format: RDF::Format.for(g.to_s).to_sym,\n base_uri: g\n }\n end\n end\n end", "def addNamedGraph(uri) \n\t\t\n\t\tif uri \n\t\t\tself._querytext.push([\"named-graph-uri\",uri])\n\t end\n\tend", "def dataset_endpoint(id)\n return uri(\"resource/\" + id)\n end", "def urn_rdf( hash, rdf )\n graph = RDF::Graph.new\n rdf.each do |tri|\n tri.subject = RDF::Resource.new( hash['@id'] )\n tri.object = urn_obj( tri.object )\n graph << tri\n end\n graph\n end", "def path_to_data_file( path_to_ai_file )\n source_folder = File.dirname( path_to_ai_file )\n base_name = File.basename( path_to_ai_file, '.ai' )\n data_file = source_folder + '/' + base_name + '_data.jsn'\n data_file\n end", "def load_graph\n\n # aux data structures\n hash_of_vertices = {}\n list_of_edges = []\n hash_of_visual_vertices = {}\n list_of_visual_edges = []\n @neighbor_vertices = {}\n\n File.open(@filename, \"r\") do |file|\n doc = Nokogiri::XML::Document.parse(file)\n it = 0\n temp_nodes = {}\n doc.root.xpath(\"node\").each do |node|\n id = node[\"id\"]\n temp_nodes[id] = node\n end\n\n doc.root.xpath(\"way\").each do |way|\n highway_tag = way.at_xpath(\"tag[@k='highway']\")\n unless highway_tag.nil?\n if @highway_attributes.include?(highway_tag[\"v\"])\n # p \"Processing way ##{it}\"\n it += 1\n nds = way.xpath(\"nd\")\n speed_tag = way.at_xpath(\"tag[@k='maxspeed']\")\n max_speed = 50\n max_speed = speed_tag[\"v\"].to_f unless speed_tag.nil?\n\n nds.each_with_index do |nd, i|\n node_id = nd[\"ref\"]\n node = temp_nodes[node_id]\n # ProcessLogger.log(\"\\t Vertex #{node_id} loaded\")\n\n unless hash_of_vertices.has_key?(node_id)\n v = Vertex.new(node_id)\n # hash_of_vertices[node_id] = v\n\n # TODO: Get position from lat and lon\n hash_of_visual_vertices[node_id] = VisualVertex.new(node_id, v, node[\"lat\"], node[\"lon\"], node[\"lat\"], node[\"lon\"])\n\n end\n unless i == nds.length - 1\n node2_id = nds[i + 1][\"ref\"]\n list_of_edges << Edge.new(node_id, node2_id, max_speed, false)\n @neighbor_vertices[node_id] = [] unless @neighbor_vertices.has_key? node_id\n @neighbor_vertices[node2_id] = [] unless @neighbor_vertices.has_key? node2_id\n @neighbor_vertices[node_id] << node2_id\n @neighbor_vertices[node2_id] << node_id\n end\n end\n end\n end\n way.remove\n end\n end\n if @only_comp\n largest_component = get_largest_component\n\n # filter only vertices and edges in largest component\n list_of_edges = list_of_edges.select { |edge| largest_component.include? edge.v1 }\n hash_of_visual_vertices = hash_of_visual_vertices.select { |k, v| largest_component.include? k }\n hash_of_vertices = hash_of_visual_vertices.each { |k, v| hash_of_vertices[k] = v.vertex }\n\n end\n list_of_edges.each { |e| list_of_visual_edges << VisualEdge.new(e, hash_of_visual_vertices[e.v1], hash_of_visual_vertices[e.v2]) }\n\n # Create Graph instance\n g = Graph.new(hash_of_vertices, list_of_edges)\n\n # Create VisualGraph instance\n bounds = get_bounds(hash_of_visual_vertices)\n vg = VisualGraph.new(g, hash_of_visual_vertices, list_of_visual_edges, bounds)\n\n return g, vg\n end", "def process_graphviz(data)\n data.gsub(/\\<graphviz\\>\\s*([\\s\\S]*?)\\s*\\<\\/graphviz\\>/m) do\n id = Digest::SHA1.hexdigest($1)\n\n # Write graphviz graph to temp file\n tmp = Tempfile.new ''\n tmp.write $1\n tmp.close\n\n out_path_dir = ::File.expand_path ::File.join(@wiki.path, 'tmp')\n Dir.mkdir out_path_dir unless ::File.exists? out_path_dir\n out_path = ::File.join(out_path_dir, id)\n\n system \"#{@wiki.dot} -Tpng -o #{out_path}.png #{tmp.path}\"\n\n # Clean up tmp file\n tmp.delete\n\n # Replace graph with img link\n %Q(<img alt=\"Graphviz image\" src=\"/tmp/#{id}.png\">)\n end\n end", "def item_data(data)\r\n BnetApi.make_request(\"/d3/data/item/#{data}\")\r\n end", "def adjunto\n \tputs archivo.path\n #archivo.file.read\n #OpenStruct.new(:data => archivo.file.read)\n archivo_url.to_s\n end", "def path\n 'soccerdata'\n end" ]
[ "0.63632184", "0.5914667", "0.56077415", "0.5456536", "0.5456536", "0.5456536", "0.54500455", "0.54500455", "0.54467773", "0.5443514", "0.5404968", "0.5344902", "0.532338", "0.53223485", "0.52751434", "0.52642334", "0.5252166", "0.51917374", "0.51909935", "0.51776356", "0.5172568", "0.5158756", "0.50866354", "0.50751996", "0.50735176", "0.50735176", "0.50735176", "0.5068788", "0.50649416", "0.5061983", "0.5052502", "0.5026053", "0.50168437", "0.49902532", "0.49805844", "0.4972932", "0.49688035", "0.49537054", "0.4938594", "0.49352208", "0.49345922", "0.49234977", "0.49204352", "0.49173504", "0.49138728", "0.49138728", "0.49114564", "0.49099806", "0.48995414", "0.48925567", "0.48853818", "0.4871219", "0.48616162", "0.48565394", "0.48490515", "0.48465165", "0.48437622", "0.4836878", "0.48335654", "0.48297623", "0.48138443", "0.4802286", "0.47991243", "0.47783586", "0.47755092", "0.4768361", "0.47415406", "0.47362357", "0.47357577", "0.47339937", "0.47310442", "0.47146568", "0.47135198", "0.47075322", "0.4706321", "0.47030544", "0.46736395", "0.46714112", "0.4662565", "0.46621606", "0.4661127", "0.4656382", "0.46548942", "0.46488145", "0.46455976", "0.46357927", "0.4633953", "0.46297312", "0.46234518", "0.4615414", "0.46150538", "0.4604366", "0.45889026", "0.45817193", "0.45810395", "0.45779008", "0.45729217", "0.45661572", "0.45651534", "0.45648924" ]
0.7514408
0
Run a single `test` formalized as SPARQL query on the validated data stored in `graph_name`
def run_test(test, graph_name) query = File.read test query = add_graph(query, graph_name) results = @sparql.query query graph = RDF::Graph.new graph << results if graph.empty? {} else convert_to_json graph end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_test\n rdfa_string = input\n \n # Run\n @rdfa_parser = RdfaParser::RdfaParser.new\n yield(rdfa_string, rdfa_parser)\n\n query_string = results\n\n triples = self.triples rescue nil\n \n if (query_string.match(/UNION|OPTIONAL/) || title.match(/XML/)) && triples\n # Check triples, as Rasql doesn't implement UNION\n parser = NTriplesParser.new(triples, tcpath)\n @rdfa_parser.graph.should be_equivalent_graph(parser.graph, self)\n else\n # Run SPARQL query\n @rdfa_parser.graph.should pass_query(query_string, self)\n end\n\n @rdfa_parser.graph.to_rdfxml.should be_valid_xml\n end", "def run_test(options = {})\n rdf_string = input\n\n # Run\n graph = yield(rdf_string)\n\n return unless output\n\n case self.compare\n when :none\n # Don't check output, just parse to graph\n when :array\n @parser.graph.should be_equivalent_graph(self.output, self)\n else\n #puts \"parse #{self.outputDocument} as #{RDF::Reader.for(self.outputDocument)}\"\n format = detect_format(File.open(self.outputDocument))\n output_graph = RDF::Graph.load(self.outputDocument, :format => format, :base_uri => self.about)\n puts \"result: #{CGI.escapeHTML(graph.to_ntriples)}\" if ::RDF::N3::debug?\n graph.should Matchers::be_equivalent_graph(output_graph, self)\n end\n end", "def test\n jsfl.test\n execute\n end", "def perform_test_case(version, suite, num, extract_url, expected_results)\n # Build the RDF extractor URL\n extract_url = ::URI.decode(extract_url) + get_test_url(version, suite, num)\n\n # Get the SPARQL query\n sparql_query = get_test_content(version, suite, num, 'sparql').\n sub(\"ASK WHERE\", \"ASK FROM <#{extract_url}> WHERE\")\n\n puts \"sparql_query: #{sparql_query}\"\n\n # Perform the SPARQL query\n result = SPARQL.execute(StringIO.new(sparql_query), nil)\n puts \"result: #{result.inspect}, expected: #{expected_results.inspect} == #{(result == expected_results).inspect}\"\n if result != expected_results && settings.environment != :production\n extracted = RDF::Util::File.open_file(extract_url)\n puts \"extracted: #{extracted.read}\"\n puts \"content-type: #{extracted.content_type.inspect}\"\n graph = RDF::Graph.load(extract_url, :base_url => get_test_url(version, suite, num))\n puts \"graph: #{graph.dump(:ttl)}\"\n end\n result == expected_results\n end", "def test_query\n add_test_judgement\n assert(@gold_standard.contains_query? :querystring => \"query1\")\n end", "def execute_query(sparql_query)\n puts \"Executing SPARQL Query: #{sparql_query} ...\"\n \n if sparql_query.include? \"DESCRIBE\"\n response = @repository.query(sparql_query, :result_type => RubySesame::DATA_TYPES[:N3]) \n puts response if @verbose\n end\n\n if sparql_query.include? \"SELECT\" \t\n response = @repository.query(sparql_query)\t\n puts response if @verbose\n end\n\n end", "def test_rdf_fail\n assert_raise(ArgumentError) { @valid_source.test_predicate(\"foo\") }\n end", "def run(test)\n output = StringIO.new\n failed = false\n start = Time.now\n reporter = new_reporter(output)\n reporter.report(1) do\n example_group_index.fetch(test.expression.syntax).each do |example_group|\n next if example_group.run(reporter)\n failed = true\n break\n end\n end\n output.rewind\n Result::Test.new(\n test: nil,\n mutation: nil,\n output: output.read,\n runtime: Time.now - start,\n passed: !failed\n )\n end", "def test_relevant\n add_test_judgement\n assert(@gold_standard.relevant? :document => \"doc1\", :query => \"query1\")\n end", "def test_run_method\n return\n s = SearchQueryParser.build_ferret_query(\"T\")\n s = SearchQueryParser.build_ferret_query(\"\")\n assert true\n end", "def sparql_up\n begin\n direct_query \"ASK { ?s ?p ?o }\"\n rescue\n false\n end\nend", "def test\n if phase.has_key?('test')\n execute(\"test\", phase['test'])\n end\n end", "def test\n puts 'Building Graph for tests...'\n # Simple graph\n #\n # First\n # / \\\n # second third\n # / | | \\\n # fourth fifth goal sixth\n #\n # Construct graph\n first = GraphNode.new 'First'\n second = GraphNode.new 'Second'\n third = GraphNode.new 'Third'\n fourth = GraphNode.new 'Fourth'\n fifth = GraphNode.new 'Fifth'\n sixth = GraphNode.new 'Sixth'\n goal = GraphNode.new 'Goal'\n\n first.connect second\n first.connect third\n\n second.connect first\n second.connect fourth\n second.connect fifth\n\n third.connect first\n third.connect goal\n third.connect sixth\n\n fourth.connect second\n fifth.connect second\n\n goal.connect third\n sixth.connect third\n\n # Perform tests\n puts \"Testing from root node 'First'\"\n puts(bfs(first) { |node| puts ' ' + node })\n\n puts \"Testing from second node 'Second'\"\n puts(bfs(second) { |node| puts ' ' + node })\nend", "def validate(parsed_data)\n graph_name = load_data parsed_data\n \n begin \n results = @tests.map do |test|\n run_test(test, graph_name)\n end\n ensure\n clear_graph graph_name\n end\n\n # Remove empty results\n results.flatten.reject(&:empty?)\n end", "def run_query(query)\n post_graphql(query, current_user: current_user)\n expect(graphql_errors).not_to be_present\n end", "def sql_test(name, value, **opt)\n sql_name_value(name, value, **opt).join(' ')\n end", "def execute_query(sparql_query)\n puts \"Executing SPARQL Query: #{sparql_query} ...\"\n response = `#{@root}/bin/sdbquery --sdb #{@db_config} '#{sparql_query}'`\n puts response if @verbose\n end", "def execute_query(query_type, test)\n if @per_test_insert\n query_data = translate_column_names(test['query'])\n else\n query_data = test['query']\n end\n puts ' Querying'\n\n if @verbose\n puts \" - #{query_data}\"\n end\n\n if query_type == 'count_entity'\n result = @client.count_entity(query_data)\n elsif query_type == 'count_event'\n result = @client.count_event(query_data)\n elsif query_type == 'top_values'\n result = @client.top_values(query_data)\n elsif query_type == 'aggregation'\n result = @client.aggregation(query_data)\n elsif query_type == 'result'\n result = @client.result(query_data)\n elsif query_type == 'score'\n result = @client.score(query_data)\n elsif query_type == 'sql'\n result = @client.sql(query_data)\n end\n\n result\n end", "def query\n sparql = <<-SPARQL\n SELECT ?item ?itemLabel ?steamAppId {\n ?item wdt:P31 wd:Q7889; # instance of video game\n wdt:P1733 ?steamAppId. # items with a Steam App ID.\n FILTER NOT EXISTS { ?item wdt:P404 ?gameMode . } # with no game mode\n SERVICE wikibase:label { bd:serviceParam wikibase:language \"en\". }\n }\n SPARQL\n\n sparql\nend", "def add_graph(query, graph_name)\n graph_uri = \"<#{graph_name}>\"\n query.gsub(/\\?validatedGraph/i, graph_uri)\n end", "def run_one_test(session)\n \n end", "def gherkin_query; end", "def gherkin_query; end", "def where_cond_test_u(tuple_node_test_result_tbl)\n pk = @pkFullList.map { |pk| \"#{pk['alias']}_pk\" }.join(', ')\n @predicateTree.branches.each do |branch|\n\n branch_query = RewriteQuery.rewrite_predicate_query(branch.branch_query, branch.columns)\n # branch_query = query + \" AND \"+ branch_query\n\n branch.nodes.each do |node|\n query = \"INSERT INTO #{tuple_node_test_result_tbl} \"+\n \"select #{pk}, #{@test_id},'#{node.name}', '#{branch.name}',type \"+\n \"from ftuples where type = 'U' AND #{branch_query}\"\n # puts query\n res = DBConn.exec(query)\n node.suspicious_score += res.cmd_tuples()\n end\n end\n end", "def test_a\n fdl_test( %{\n feature test\n (not all(x,x:[word=nil]))\n <x.id>},\n false)\n end", "def test_predicates\n assert_equal \"12\", XPath::first(@@doc, \"a/e/f[3]\").attributes[\"id\"]\n assert_equal \"13\", XPath::first(@@doc, \"a/e/f[3]/g\").attributes[\"id\"]\n assert_equal \"14\", XPath::first(@@doc, \"a/e/f[@a='d'][2]\").attributes[\"id\"]\n assert_equal \"14\", XPath::first(@@doc, \"a/e/f[@a='d'][@id='14']\").attributes[\"id\"]\n assert_equal \"a\", XPath::first( @@doc, \"*[name()='a' and @id='1']\" ).name\n c=each_test( @@doc, \"//*[name()='f' and @a='d']\") { |i|\n assert_equal \"f\", i.name\n }\n assert_equal 2, c\n c=each_test( @@doc, \"//*[name()='m' or @a='d']\") { |i|\n assert [\"m\",\"f\"].include?(i.name)\n }\n assert_equal 3, c\n\n assert_equal \"b\", XPath::first( @@doc, \"//b[@x]\" ).name\n end", "def run_test \n \n test_table = make_test_table(\"ml-100k/u1.test\")\n @testdata = MovieTest.new(test_table)\n end", "def test_users_searches\n do_users_all\n do_simple_query\n do_tag_query\n do_profile_query\n end", "def evaluation_with_single_test\n @test_name = @evaluation_value\n end", "def run_test(k=nil)\n dataset=k.nil? ? @data.testset : @data.testset.take(k)\n MovieTest.new(dataset.map {|item| [item.u_id,item.m_id,item.rating,predict(item.u_id,item.m_id)]})\n end", "def test_for_node\n raise \"Failing test #{@name} for #{@node}\" if Node.fail_for.key?(@name) && Node.fail_for[@name].include?(@node)\n\n sleep_time = Node.sleeps.dig(@name, @node)\n sleep sleep_time unless sleep_time.nil?\n Node.runs << [@name, @node]\n end", "def test_graph_to_s\n sut_graph = Graph.new\n sut_graph.name=\"test_graph\" \n sut_graph.type=:digraph\n sut_graph.node_style=:ellipse\n #sut_graph.add_node \"TEST1\"\n #sut_graph.add_node \"TEST2\"\n sut_graph.add_edge(\"TEST1\" , \"TEST2\" , \"take_me_to_test_2\")\n \n \n returned_obj = sut_graph.to_s\n assert( returned_obj.instance_of?(String) , \"Check to_s returns String, returns: #{returned_obj.class}\" )\n assert(returned_obj.scan(/test_graph/).length==1 , \"Check once occurence of graph name in dot to_s.\")\n assert(returned_obj.scan(/digraph test_graph/).length==1 , \"Check graph type and name in dot to_s.\") \n assert(returned_obj.scan(/shape = ellipse/).length==1 , \"Check graph node style in dot to_s.\") \n #assert(returned_obj.scan(/TEST1\\;/).length==1 , \"Check that Node definition is included: TEST1;\")\n #assert(returned_obj.scan(/TEST2\\;/).length==1 , \"Check that Node definition is included: TEST2}\")\n assert(returned_obj.scan(/label = \\\"take_me_to_test_2\"/).length==1 , \"Check that arc label is included\")\n \n end", "def sparql_query(query)\n query = query.join(\"\\n\\n\") + \"\\n\" rescue query\n path = \"/DAV/home/#{@username}/query\"\n\n res = http_request(\"POST\", path, query, {\n \"Content-Type\" => \"application/sparql-query\"\n })\n\n return res.code == \"201\"\n end", "def query\n sparql = <<-SPARQL\n SELECT ?item ?itemLabel ?giantBombId {\n ?item wdt:P31 wd:Q7889; # instance of video game\n wdt:P5247 ?giantBombId. # items with a GiantBomb ID.\n FILTER NOT EXISTS { ?item wdt:P11400 ?microtransactionZoneId . } # with no microtransaction zone ID\n SERVICE wikibase:label { bd:serviceParam wikibase:language \"en\". }\n }\n SPARQL\n\n sparql\nend", "def query(&block)\n @query = GraphQuery.new(block) \n end", "def call(*params)\n self.send :test, *params\n end", "def run_test\n if validate(@test)\n generate(@test)\n else\n $stderr.puts \"There were some errors, fix them and rerun the program.\"\n end\nend", "def sparql_query\n return <<-SPARQL\n SELECT ?item ?itemLabel ?steamAppId WHERE {\n ?item wdt:P31 wd:Q7889; # instance of video game\n wdt:P1733 ?steamAppId. # items with a Steam App ID.\n FILTER NOT EXISTS { ?item wdt:P5794 ?igdbId. } # with no IGDB ID\n SERVICE wikibase:label { bd:serviceParam wikibase:language \"en,en\". }\n }\n SPARQL\nend", "def test_check_if_vertex_is_source_when_it_doesnt_exist\n assert(@dgraph.check_if_vertex_is_source('no_vertex') == false)\n end", "def test_simple_query()\n # Parameters for the API call\n boolean = true\n number = 4\n string = 'TestString'\n\n # dictionary for optional query parameters\n optional_query_parameters = {}\n\n # Perform the API call through the SDK function\n result = self.class.controller.simple_query(boolean, number, string, optional_query_parameters)\n\n # Test response code\n assert_equal(@response_catcher.response.status_code, 200)\n\n # Test whether the captured response is as we expected\n assert_not_nil(result)\n expected_body = JSON.parse('{\"passed\":true}')\n received_body = JSON.parse(@response_catcher.response.raw_body)\n assert(TestHelper.match_body(expected_body, received_body, check_values: true))\n end", "def test_unranked_recall\n\n add_test_judgements \n add_unranked_query_result\n assert_equal(1.0, @query_result.statistics[:recall])\n \n end", "def test_find_vertex\n found_vertex = @graph.find_vertex('a')\n\n assert(found_vertex != nil && found_vertex.name == 'a')\n end", "def test_ut_fdw10a_t5_fic_005\n\t\tfilter_condition = FilterCondition.new(\"Rule ID\", \"is\",\"0045\")\n\t\tstring_return = filter_condition.create_query\n\t\tassert_equal \"rule LIKE '0045'\", string_return\n end", "def test_count\n sparql = SparqlTest.handle\n (1..100).each do |i|\n sparql.insert([ SparqlTest.urn( __method__ ), 'me:num', i ])\n end\n check = sparql.count([ SparqlTest.urn( __method__ ), 'me:num', :o ])\n sparql.empty( :all )\n assert_equal( 100, check )\n end", "def test_results_sad_one\r\n assert_output(\"Going home sad.\\n\") { @g.results(1) }\r\n end", "def neo4j_query(*args)\n ActiveGraph::Base.query(*args)\n end", "def test(label=nil, &block)\n test_method = \"test #{label}\"\n count = _get_test_count(test_method)\n test_method += \" (#{count})\" if count > 0\n define_method(test_method, &block)\n _set_test(test_method, block)\n test_method\n end", "def test\n self.test_session.test\n end", "def execute(query, name = 'ANSR-NOSQL')\n end", "def run_test(test)\n @app.run_test(test)\n end", "def test(*params)\n if result == false\n @tests += 1\n self._test *params\n self.result = false if result.nil?\n end\n result\n end", "def run_tests(test_names, namespace = '')\n test_links = get_all_test_links\n\n tests = test_names.map do |test_name|\n { :id => test_links.detect{ |a| a.text == test_name }['href'][1..-1],\n :name => test_name }\n end\n\n mkdir_p test_results_dir\n tests.each do |test|\n results_page = agent.get(test_run_url(test, namespace))\n results_table = results_page.search('.outer table td').first\n File.open(test_results_file(test[:name]), 'w') do |f|\n f.print results_table.inner_html\n end\n \n puts \"#{test[:name]} complete, results in #{test_results_file(test[:name])}.\"\n end\n end", "def main\n if (argnum = $*.size) != 2\n errmsg = 'wrong number of arguments'\\\n \"(given #{argnum}, expected 2).\"\n raise ArgumentError, errmsg\n return 1\n end\n x = XPathToSQL.new(*$*)\n conv_sql = x.xpath_to_sql\n res_ids = x.lookup(conv_sql[:sql], conv_sql[:labels])\n res_ids.each{\n puts \"=== #{_1} ===\"\n x.printexe(_1)\n }\n return 0\nend", "def graffiti_test\n end", "def test_query_runner\n assert( @data_source )\n qrun = QueryRunner.new( @data_source )\n\n url = VisitURL.normalize( \"http://gravitext.com/test\" )\n\n qrun.update( \"TRUNCATE urls;\" )\n\n c = qrun.update( \"INSERT into urls (uhash, url, domain, type ) \" +\n \"VALUES (?,?,?,?);\",\n url.uhash, url.url, url.domain, \"PAGE\" )\n assert_equal( 1, c )\n\n out_domain = nil\n qrun.query( \"SELECT * FROM urls WHERE uhash = ?\", url.uhash ) do |rs|\n while rs.next\n out_domain = rs.get_string( 'domain' )\n end\n end\n assert_equal( url.domain, out_domain )\n\n assert_equal( 1, qrun.update( \"DELETE from urls;\" ) )\n end", "def test_judgement\n add_test_judgement\n assert(@gold_standard.contains_judgement? :document => \"doc1\", :query => \"query1\")\n end", "def post\n j :pass\nlabel :fail\n RVTEST_FAIL()\nlabel :pass\n RVTEST_PASS()\n RVTEST_CODE_END()\n end", "def rspec_test(nodes)\n node_manager.assert_known(nodes)\n for node in nodes\n node_manager.find(node).rspec_test\n end\n end", "def run\n pgp = Lodqa::Graphicator.produce_pseudo_graph_pattern @query\n pseudo_graph_pattern = PseudoGraphPattern.create pgp:, query: @query\n search = create_search pseudo_graph_pattern\n SearchJob.perform_later search.search_id\n search.search_id\n end", "def test_specific_info\n \n # Start a new graph with no vertices\n graph = Graph.new()\n \n # Add 2 vertices to the graph\n origin = { \"code\" => \"NYC\" ,\n \"name\" => \"New York\" ,\n \"country\" => \"US\" ,\n \"continent\" => \"North America\" ,\n \"timezone\" => -5 ,\n \"coordinates\" => { \"N\" => 41, \"W\" => 74 } ,\n \"population\" => 22200000 ,\n \"region\" => 3 }\n \n destination = { \"code\" => \"WAS\" ,\n \"name\" => \"Washington\" ,\n \"country\" => \"US\" ,\n \"continent\" => \"North America\" ,\n \"timezone\" => -5 ,\n \"coordinates\" => {\"N\" => 39, \"W\" => 77} ,\n \"population\" => 8250000 ,\n \"region\" => 3 } \n graph.add_node(origin)\n graph.add_node(destination)\n \n assert_equal(graph.get_specific_info(\"CHI\"), \"City doesn't exist in the graph.\")\n \n # Get information on Washington and check that correct information is\n # contained in the return value\n info = graph.get_specific_info(\"WAS\")\n \n assert_equal( info.include?(\"WAS\"), true )\n assert_equal( info.include?(\"Washington\"), true )\n assert_equal( info.include?(\"US\"), true )\n assert_equal( info.include?(\"North America\"), true )\n assert_equal( info.include?(\"N 39, W 77\"), true )\n assert_equal( info.include?(\"Population: 8250000\"), true )\n assert_equal( info.include?(\"Region: 3\"), true )\n assert_equal( info.include?(\"Direct Connections: WAS\"), false )\n \n # Add an edge and check if that information is reflected in the return value\n graph.add_edge(\"NYC\",\"WAS\" ,570)\n info = graph.get_specific_info(\"NYC\")\n \n assert_equal( info.include?(\"Direct Connections: WAS - 570\"), true)\n\n end", "def test_function_not_table\n # Should take params and add between brackets - retaining any existing params.\n skip \"SELECT storeopeninghours_tostring AS tmp from storeopeninghours_tostring('123');\"\n end", "def run_frankenstein_test(host, port)\n init host, port\n start_test @@test_dir == \"\" ? @test_name : @@test_dir + \"/\" + @test_name\n test\n finish_test\n puts @test_name + \" : \" + (@test_status == \"P\" ? \"Passed\" : \"Failed\")\n @test_status\n end", "def run_test(*args)\n args[0] ||= @test_set.size\n return MovieTest.new(args[0], @test_set, self)\n end", "def calculate_graph_diffs(graphname1, graphname2, diffgraphname)\n update(\"INSERT { GRAPH <#{diffgraphname}> { ?s ?p ?o . }} WHERE { GRAPH <#{graphname1}> { ?s ?p ?o } FILTER NOT EXISTS { GRAPH <#{graphname2}> { ?s ?p ?o }}}\")\nend", "def test_results_sad\r\n assert_output(\"Going home sad.\\n\") { @g.results(9) }\r\n end", "def test\n data = Fyb.private.test.perform.parse\n data['msg'] == 'success'\n end", "def test_parse\n metro = @my_graph.metro\n @my_graph.analysis_data\n assert_equal(metro['BUE'].population, 13300000, 'Reading does not works')\n assert_equal(metro['SHA'].continent, 'Asia', 'Reading does not 2')\n assert_equal(metro['MIL'].destination['ESS'], 681, 'distance does not work')\n assert_equal(metro['MIL'].destination.length, 3, 'data wrong')\n assert_equal(metro['OSA'].country, 'JP', 'data wrong')\n assert_equal(@my_graph.longest_dist, 12051, 'Distance correct')\n assert_equal(@my_graph.shortest_dist, 334, 'population wrong')\n assert_equal(@my_graph.biggest_pop, 34000000, 'Distance wront')\n assert_equal(@my_graph.biggest_city, 'TYO', 'Distance wront')\n assert_equal(@my_graph.avg_pop, 11796143, 'Avg Population')\n assert_equal(@my_graph.get_distance('MEX', 'LIM'), 4231, 'route')\n assert_equal(@my_graph.get_distance('LIM', 'MEX'), 4231, 'route')\n\n #controllers\n assert_equal(get_time_part2('SFO', @my_graph), 1.5, \"layover\")\n assert_equal(get_time_part2('WAS', @my_graph), 1.5, \"layover\")\n assert_equal(get_time_part1(400), 0.5333333333333333, \"first part of time wrong\")\n assert_equal(get_time_part1(500), 1, \"first part of time wrong\")\n assert_equal(get_time_part1(300), 0.46188021535170065, \"first part of time wrong\")\n dist, money, time = check_routes(@my_graph,['NYC','YYZ','WAS'])\n assert_equal(dist,1143,\"distance wrong\")\n assert_equal(money,371.30000000000007,\"money wrong\")\n assert_equal(time,3.6666666666666665,\"time wrong\")\n\n\n #test add routes or nodes\n assert(@my_graph.has_route('MIA','WAS'))\n @my_graph.remove_single_route('MIA','WAS')\n assert(!@my_graph.has_route('MIA','WAS'))\n assert(@my_graph.has_route('WAS','MIA'))\n\n #test editcity\n @my_graph.update_city_info('BUE', 'POPULATION', 333333333333)\n @my_graph.analysis_data\n assert_equal(@my_graph.biggest_pop, 333333333333, 'Population wrong')\n @my_graph.update_city_info('BUE', 'POPULATION', 1)\n @my_graph.analysis_data\n assert_not_equal(@my_graph, 333333333333, 'Population wrong')\n\n #test dijkstra\n setup\n s = calculate_shortest(@my_graph,'YYZ','MIA')\n assert_equal(s[0], 'YYZ', 'Dijk wrong')\n assert_equal(s[1], 'WAS', 'Dijk wrong')\n assert_equal(s[2], 'MIA', 'Dijk wrong')\n end", "def test_add_vertex\n vertex = Vertex.new('e')\n @graph.add_vertex(vertex)\n\n found_vertex = @graph.find_vertex('e')\n\n assert(found_vertex.name == 'e')\n end", "def test!\n @@api.post(endpoint: self.endpoint + ['test'])\n end", "def fake_data_generator(query, output_document)\n ############\n # Removed this, as it is not necessary\n ############\n #uris_hash = Hash.new\n #uris_hash.default_proc = proc {|k| k}\n #File.foreach(query_document_location) {|line|\n # case line\n # when /^PREFIX (\\w+:) (<.+)>/i #if the line starts with PREFIX, find the prefix and its full URI and store them in a hash\n # uris_hash[$1] = $2\n # \n # when /^SELECT|CONSTRUCT|ASK|DESCRIBE/i #This line corresponds to the first line of the final query\n # query = line\n # when /(^\\n|})/\n # query << line\n # else \n # uris_hash.each { |k, v| \n # line[k] &&= v } #changes all occurances of a prefix with the full URI\n # line.match(/(<\\S+)/)\n # line[$1] &&= $1.concat(\">\")\n # line.gsub!(/\\ba\\b/, \"<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>\") #changes \"a\" with the whole URI of rdf:type\n # query << line\n # end\n #}\n \n $stderr.puts query\n parsed = SPARQL.parse(query) # this is a nightmare method, that returns a wide variety of things! LOL!\n \n rdf_query=''\n if parsed.is_a?(RDF::Query) # we need to get the RDF:Query object out of the list of things returned from the parse\n rdf_query = parsed\n else\n parsed.each {|c| rdf_query = c if c.is_a?(RDF::Query) }\n end\n\n patterns = rdf_query.patterns # returns the triple patterns in the query\n\n variables = Hash.new # we're going to create a random string for every variable in the query\n patterns.each do |p| \n vars = p.unbound_variables # vars contains e.g. [:s, #<RDF::Query::Variable:0x6a400(?s)>] \n vars.each {|var| variables[var[0]] = RDF::URI(\"http://fakedata.org/\" + (0...10).map { ('a'..'z').to_a[rand(26)] }.join)}\n # now variables[:s] = <http://fakedata.org/adjdsihfrke>\n end\n\n File.open(output_document, \"w\") {|file|\n #now iterate over the patterns again, and bind them to their new value\n patterns.each do |triple| # we're going to create a random string for every variable\n if triple.subject.variable?\n var_symbol = triple.subject.to_sym # covert the variable into a symbol, since that is our hash key\n triple.subject = variables[var_symbol] # assign the random string for that symbol\n end\n\n if triple.predicate.variable?\n var_symbol = triple.predicate.to_sym # covert the variable into a symbol, since that is our hash key\n triple.predicate = variables[var_symbol] # assign the random string for that symbol\n end\n \n # special case for objects, since they can be literals\n if triple.object.variable?\n var_symbol = triple.object.to_sym # covert the variable into a symbol, since that is our hash key\n triple.object = variables[var_symbol] # assign the random string for that symbol\n file.write triple.to_rdf\n file.write \"\\n\"\n ########\n # What will you do with triples that have a literal as their value, rather than a <URI>?\n ########\n else # this ensures that it is written even if the object is not a variable\n file.write triple.to_rdf\n file.write \"\\n\"\n end\n end\n }\n\nend", "def run\n print_banner\n @test_plan.each do |plan|\n found_nodes = nodes(plan)\n if found_nodes\n found_nodes.each { |node| execute_plan_tests(node, plan) }\n end\n end\n exit @ret_code\n end", "def test_function_search_user_successfully\n keyword = \"anh\"\n\n #Call function search_user_by_name in model V1::User\n user = V1::User.search_user_by_name(keyword,1,10)\n\n #Get value code which is returned when call function search_user_by_name\n actual = user[:meta][:code]\n\n expected = 200\n #Show result of this function(true=>pass)\n puts this_method_name + \" - \" +assert_equal(expected, actual).to_s\n end", "def run_query(q)\n return sky_table.query(q)\n end", "def test_search\n results = DuckDuckGo::search(:query => TEST_SEARCH_PHRASE)\n assert(!results.empty?, \"Searching for '#{TEST_SEARCH_PHRASE}' returned zero results.\")\n\n # it should be biggenr than 1\n assert_operator(results.length, :>, 1)\n\n result = results.first\n # it should have http or https scheme\n assert(result.uri.start_with?(\"http://\", \"https://\"))\n end", "def test(name, options, &block)\n if block_given?\n begin\n result = yield\n rescue StandardError,ScriptError => detail\n warn _(\"Failed to load feature test for %{name}: %{detail}\") % { name: name, detail: detail }\n result = nil\n end\n @results[name] = result\n result\n else\n libs = options[:libs]\n if libs\n libs = [libs] unless libs.is_a?(Array)\n libs.all? { |lib| load_library(lib, name) } ? true : nil\n else\n true\n end\n end\n end", "def run_test(test_name, osm_path, epw_path, blinds_expected)\n\n assert(File.exist?(osm_path))\n assert(File.exist?(epw_path))\n\n # create run directory if it does not exist\n if !File.exist?(run_dir(test_name))\n FileUtils.mkdir_p(run_dir(test_name))\n end\n assert(File.exist?(run_dir(test_name)))\n\n # change into run directory for tests\n Dir.chdir run_dir(test_name)\n\n # copy weather file and osm to test directory\n new_osm_path = \"#{run_dir(test_name)}/#{File.basename(osm_path)}\"\n FileUtils.cp(osm_path, new_osm_path)\n osm_path = new_osm_path\n new_epw_path = \"#{run_dir(test_name)}/#{File.basename(epw_path)}\"\n FileUtils.cp(epw_path, new_epw_path)\n epw_path = new_epw_path\n\n # remove prior runs if they exist\n if File.exist?(model_output_path(test_name))\n FileUtils.rm(model_output_path(test_name))\n end\n if File.exist?(report_path(test_name))\n FileUtils.rm(report_path(test_name))\n end\n # create an instance of the measure\n measure = AddBlindsToSelectedWindows.new\n\n # create an instance of a runner\n runner = OpenStudio::Measure::OSRunner.new(OpenStudio::WorkflowJSON.new)\n\n # load the test model\n translator = OpenStudio::OSVersion::VersionTranslator.new\n model = translator.loadModel(OpenStudio::Path.new(osm_path))\n assert((not model.empty?))\n model = model.get\n\n # set model weather file\n epw_file = OpenStudio::EpwFile.new(OpenStudio::Path.new(epw_path))\n OpenStudio::Model::WeatherFile.setWeatherFile(model, epw_file)\n assert(model.weatherFile.is_initialized)\n\n # set arguments to good values\n arguments = measure.arguments(model)\n argument_map = OpenStudio::Measure::OSArgumentMap.new\n\n puts 'ARGUMENTS HERE'\n puts arguments\n\n add_blinds = arguments[0].clone\n assert(add_blinds.setValue(true))\n argument_map['add_blinds'] = add_blinds\n\n # run the measure\n puts \"\\nAPPLYING MEASURE...\"\n measure.run(model, runner, argument_map)\n result = runner.result\n\n # show the output\n show_output(result)\n\n # assert that it ran correctly\n assert(result.value.valueName == \"Success\")\n assert(result.warnings.size == 0)\n\n # check that blinds were added to the model\n blinds_area = 0\n model.getSubSurfaces.sort.each do |sub_surface|\n next unless sub_surface.subSurfaceType == 'FixedWindow' || sub_surface.subSurfaceType == 'OperableWindow'\n next unless sub_surface.outsideBoundaryCondition == 'Outdoors' && sub_surface.surface.get.surfaceType == 'Wall'\n blinds_area += sub_surface.grossArea unless sub_surface.shadingControl.empty?\n end\n if blinds_expected\n assert(blinds_area > 0)\n else\n assert(blinds_area.zero?)\n end\n\n # save model\n model.save(model_output_path(test_name), true)\n\n # run the model\n puts \"\\nRUNNING MODEL...\"\n\n # method for running the test simulation using OpenStudio 2.x API\n osw_path = File.join(run_dir(test_name), 'in.osw')\n osw_path = File.absolute_path(osw_path)\n\n workflow = OpenStudio::WorkflowJSON.new\n workflow.setSeedFile(File.absolute_path(model_output_path(test_name)))\n workflow.setWeatherFile(File.absolute_path(epw_path))\n workflow.saveAs(osw_path)\n\n cli_path = OpenStudio.getOpenStudioCLI\n cmd = \"\\\"#{cli_path}\\\" run -w \\\"#{osw_path}\\\"\"\n puts cmd\n system(cmd)\n\n # check that the model ran successfully\n assert(File.exist?(model_output_path(test_name)))\n assert(File.exist?(sql_path(test_name)))\n end", "def test_index # :nologin: :norobots:\n query = find_query(:Name) or raise \"Missing query: #{params[:q]}\"\n if params[:test_anchor]\n @test_pagination_args = {:anchor => params[:test_anchor]}\n end\n show_selected_names(query, :num_per_page => params[:num_per_page].to_i)\n end", "def test_check_if_vertex_is_source_when_not_source\n assert(@dgraph.check_if_vertex_is_source('c') == false && @dgraph.check_if_vertex_is_source('d') == false)\n end", "def run_test(k)\n test=MovieTest.new\n @test_data.first(k).each do |data|\n predict_rate=predict(data[0],data[1])\n test.add_to_result([data[0],data[1],data[2],predict_rate])\n end\n return test\n end", "def query(query:)\n path = '/graphql'\n\n if query.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"query\"')\n end\n\n params = {\n query: query,\n }\n \n headers = {\n \"x-sdk-graphql\": 'true',\n \"content-type\": 'application/json',\n }\n\n @client.call(\n method: 'POST',\n path: path,\n headers: headers,\n params: params,\n )\n end", "def new_test(test_name)\n\tdb.execute(\"CREATE TABLE IF NOT EXISTS #{test_name} (id INTEGER PRIMARY KEY,\n student_first VARCHAR(255),\n student_last VARCHAR(255),\n grade INT\n );\")\nend", "def test_for_default_pattern \n ctx = create_context_for(\"/foo\")\n selector = LinkedDataAPI::Selector.new()\n pattern = selector.create_graph_pattern(ctx)\n assert_equal(\"?item ?property ?value.\\n\", pattern) \n end", "def run_additional_operations(query_type, test)\n query_data = translate_column_names(test['additional_operation'])\n if query_type == 'delete'\n puts \" Deleting\"\n else\n puts \" Updating\"\n end \n\n if @verbose\n puts \" - #{query_data}\"\n end\n \n result = nil\n\n if query_type == 'delete'\n result = @client.delete(query_data)\n elsif query_type == 'update'\n result = @client.update(query_data)\n end\n\n expected = translate_column_names(test['result_additional'])\n expected.each do |key, value|\n if value == 'ignore'\n next\n end\n\n if !compare_values(value, result[key])\n @num_fails += 1\n @failed_tests.push(test['name'])\n\n puts \" Expected: \\\"#{key}\\\": #{value}\"\n puts \" Result: \\\"#{key}\\\": #{result[key]}\"\n puts \" Status: Failed\"\n return false\n end\n end\n \n self.num_successes += 1\n print(' Status: Passed')\n return true\n end", "def test\n\n end", "def call\n query = <<-SQL\n WITH events_first_submit as (\n SELECT DISTINCT ON (enrollment_id) *\n FROM events WHERE name = 'submitted' ORDER BY enrollment_id, created_at DESC\n )\n SELECT TO_CHAR(\n AVG (validation_duration),\n 'FM999999999'\n )\n FROM (\n SELECT\n enrollments.id, events_stop.created_at AS done_at, events_first_submit.created_at AS submitted_at,\n DATE_PART('days', events_stop.created_at - events_first_submit.created_at) AS validation_duration\n FROM enrollments\n INNER JOIN\n events AS events_stop ON events_stop.enrollment_id = enrollments.id\n AND events_stop.name IN ('validated', 'refused')\n INNER JOIN\n events_first_submit ON events_first_submit.enrollment_id = enrollments.id\n WHERE status IN ('validated', 'refused')\n AND #{@filter_by_target_api_criteria}\n ) e;\n SQL\n\n ActiveRecord::Base\n .connection\n .execute(query)\n .getvalue(0, 0)\n end", "def get_test(test_name)\n Test.where(test_name: test_name).first\n end", "def query\n <<-SPARQL\n SELECT DISTINCT ?item WHERE {\n {\n ?item p:P31 ?statement0.\n ?statement0 (ps:P31/(wdt:P279*)) wd:Q7889.\n }\n UNION\n {\n ?item p:P31 ?statement1.\n ?statement1 (ps:P31) wd:Q16070115.\n }\n UNION\n {\n ?item p:P31 ?statement2.\n ?statement2 (ps:P31/(wdt:P279*)) wd:Q865493.\n }\n UNION\n {\n ?item p:P31 ?statement3.\n ?statement3 (ps:P31) wd:Q209163.\n }\n }\n SPARQL\nend", "def begin_transaction(graph_name)\n RDF::Transaction.new(graph: graph_name)\n end", "def test_get_node_valid\r\n reader = GraphReader.new('small_graph.txt')\r\n reader.create_graph()\r\n assert_equal reader.graph[1], reader.get_node(1)\r\n end", "def test_check_if_vertex_is_source\n @dgraph = DirectedGraph.new\n vertex_a = Vertex.new('a')\n vertex_b = Vertex.new('b')\n vertex_c = Vertex.new('c')\n vertex_d = Vertex.new('d')\n @dgraph.add_vertex(vertex_a).add_vertex(vertex_b).add_vertex(vertex_c).add_vertex(vertex_d)\n @dgraph.add_edge('a', 'd').add_edge('d', 'c')\n\n assert(@dgraph.check_if_vertex_is_source('a') == true && @dgraph.check_if_vertex_is_source('b') == true)\n end", "def test(command)\n run(command, :test => true)\n end", "def clear_graph(graphname)\n update(\"WITH <#{graphname}> DELETE { ?s ?p ?o } WHERE { ?s ?p ?o .}\")\nend", "def evaluate(test_data)\n test_results = test_data.collect do |x, y|\n result = feedforward(x)\n observed_node = result.to_flat_a.find_index(result.max.to_f)\n expected_node = y.to_flat_a.find_index(y.max.to_f)\n observed_node == expected_node ? 1 : 0\n end\n test_results.inject(0, :+)\n end", "def apiQuery(query, vars = {})\n if vars.empty?\n query = \"query { #{query} }\"\n else\n query = \"query(#{vars.map{|name, pair| \"$#{name}: #{pair[0]}\"}.join(\", \")}) { #{query} }\"\n end\n varHash = Hash[vars.map{|name,pair| [name.to_s, pair[1]]}]\n response = EscholSchema.execute(query, variables: varHash)\n response['errors'] and raise(\"Internal error (graphql): #{response['errors'][0]['message']}\")\n response['data']\nend", "def results\n f = self.name + \".sparql\"\n body = File.read(File.join(TEST_DIR, \"tests\", f)).gsub(TCPATHRE, tcpath)\n \n suite == \"xhtml\" ? body : body.gsub(HTMLRE, '\\1.html')\n end", "def check_against(unit_test)\n grade_sheet = unit_test.execute(src_code) \n Feedback.on(grade_sheet)\n end", "def testing\n # ...\n end", "def run_test\n # Make sure that params have been set\n raise_error('You need to pass some params to run the test. At least, an url or script') unless block_given?\n params = Hashie::Mash.new\n yield params\n raise_error('No params were passed to run_test method') if params.empty?\n\n response = connection.post do |req|\n req.url \"#{TEST_BASE}\"\n req.params['k'] = key\n req.params['f'] = @params.f\n params.each do |k, v|\n req.params[k] = v\n end\n end\n return not_available (response) unless response.status == 200\n @response = Response.new(self, Hashie::Mash.new(JSON.parse(response.body)))\n end", "def test_load\n content = Agoo::GraphQL.sdl_dump(with_descriptions: false, all: false)\n content.force_encoding('UTF-8')\n assert_equal(SCHEMA_EXPECT, content)\n end", "def test(name, token_stream)\n self.send(name, TokenStream.new(token_stream))\n end" ]
[ "0.7253056", "0.6144356", "0.57979655", "0.57561165", "0.5714529", "0.55502754", "0.55135477", "0.55042094", "0.54233396", "0.5417177", "0.5383945", "0.535673", "0.53179646", "0.53152955", "0.5306837", "0.5292223", "0.52045417", "0.5168607", "0.51238465", "0.5121762", "0.51089185", "0.5087453", "0.5087453", "0.50641733", "0.5049609", "0.5028549", "0.4998901", "0.4997042", "0.49605325", "0.4942375", "0.4927373", "0.49126136", "0.49074036", "0.49042758", "0.489481", "0.48847926", "0.48803255", "0.48795015", "0.48512867", "0.48436144", "0.4837757", "0.48173416", "0.4816461", "0.4807008", "0.48016062", "0.47760558", "0.47638914", "0.4743476", "0.4716104", "0.4715999", "0.4712099", "0.469875", "0.46909866", "0.46890318", "0.46763462", "0.466443", "0.46639618", "0.46603775", "0.46583086", "0.46574035", "0.46546766", "0.46540138", "0.46536198", "0.46394348", "0.46287", "0.46286553", "0.462804", "0.46197098", "0.46174264", "0.46139523", "0.46114936", "0.46056005", "0.45992887", "0.4590234", "0.45896792", "0.4589394", "0.4586809", "0.4586552", "0.4585597", "0.45854935", "0.4582115", "0.45775625", "0.45758796", "0.4569645", "0.45654264", "0.45570844", "0.45570034", "0.45478725", "0.45463097", "0.45446625", "0.45407778", "0.45343933", "0.45339596", "0.45323652", "0.4531485", "0.45252356", "0.45239544", "0.45234647", "0.45228034", "0.45215327" ]
0.80892444
0
Validate input `parsed_data` with SPARQLbased tests
def validate(parsed_data) graph_name = load_data parsed_data begin results = @tests.map do |test| run_test(test, graph_name) end ensure clear_graph graph_name end # Remove empty results results.flatten.reject(&:empty?) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_test\n rdfa_string = input\n \n # Run\n @rdfa_parser = RdfaParser::RdfaParser.new\n yield(rdfa_string, rdfa_parser)\n\n query_string = results\n\n triples = self.triples rescue nil\n \n if (query_string.match(/UNION|OPTIONAL/) || title.match(/XML/)) && triples\n # Check triples, as Rasql doesn't implement UNION\n parser = NTriplesParser.new(triples, tcpath)\n @rdfa_parser.graph.should be_equivalent_graph(parser.graph, self)\n else\n # Run SPARQL query\n @rdfa_parser.graph.should pass_query(query_string, self)\n end\n\n @rdfa_parser.graph.to_rdfxml.should be_valid_xml\n end", "def test_parser_valid_data\n \n assert Yay::PARSER_TESTS.kind_of? Hash\n\n Yay::PARSER_TESTS.each_pair { |input, expected| \n assert input.kind_of? String\n assert expected.kind_of? Array\n }\n\n end", "def test_rdf_fail\n assert_raise(ArgumentError) { @valid_source.test_predicate(\"foo\") }\n end", "def validated_data\n @schema.validate(@data)\n end", "def validate_questions(raw_question)\n data = parse_questions(raw_question)\n if not data or not data.key?(\"answers\")\n return {score: 0, answer: nil}\n end\n question = data[\"answers\"]\n result = 0\n answer = nil\n response = DYNAMODB.scan(table_name: TABLE_NAME).items\n if question.key?(\"ID\") and question.key?(\"answer\")\n response.each do |item|\n if item['ID'].to_i == question['ID'].to_i\n answer = item['answer'].strip\n if item['answer'].strip == question['answer'].strip\n result = 1\n end\n break\n end\n end\n end\n {score: result, answer: answer}\nend", "def validate(data)\n root.validate(data)\n end", "def valid?\n schema_validator.validate(schema, raw_data)\n end", "def test_parse\n result = Yadis.parseXRDS(read_data_file(XRD_FILE))\n assert_not_nil result\n end", "def test_uri_validator\n # invalid\n assert !RDF::valid_uri?(\"use`quote\")\n # assert !RDF::valid_uri?(\"use%7quote\")\n\n # valid\n assert RDF::valid_uri?(\"use%07quote\")\n\n end", "def validate_rdf\n raise InvalidNode, \"Triple has illegal RDF subject #{subject.inspect}\" unless subject.is_a?(URIRef) || subject.is_a?(BNode)\n raise InvalidPredicate, \"Triple has illegal RDF predicate #{predicate.inspect}\" unless predicate.is_a?(URIRef)\n end", "def verify_result(test_data)\n verify_values_match(test_data[UseOfCollections::RESULT.name], element_value(result_text_area))\n end", "def verify_result(test_data)\n verify_values_match(test_data[CoreUseOfCollectionsData::RESULT.name], element_value(result_text_area))\n end", "def exercise2\n parse_data PositionalValidator\n validators.count(&:valid?)\n end", "def validate(file, data = {})\n errors_list = []\n document = get_document(file)\n document.root.add_namespace_definition('cda', 'urn:hl7-org:v3')\n # grab measure IDs from QRDA file\n measure_ids = document.xpath(measure_selector).map(&:value).map(&:upcase)\n measure_ids.each do |measure_id|\n measure = CQM::Measure.where(hqmf_id: measure_id).first\n next unless measure\n\n measure.population_sets.each do |population_set|\n reported_result, = extract_results_by_ids(measure, population_set.population_set_id, document)\n # only check performace rate when there is one\n next if reported_result['PR'].nil?\n\n error = check_performance_rates(reported_result, population_set, measure.hqmf_id, data)\n errors_list << error unless error.nil?\n end\n end\n errors_list\n end", "def validate_against_schema\n lxml = XML::Document.string( self.to_xml )\n lxml.validate(Trufina.schema)\n end", "def valid?\n data\n end", "def valid?\n data\n end", "def valid_query?(query)\n # Exceptions for flow control. Alternatively we could re-implement the parse method.\n begin\n Chef::SolrQuery::QueryTransform.parse(query)\n true\n rescue Chef::Exceptions::QueryParseError\n false\n end\n end", "def valid_query?(query)\n # Exceptions for flow control. Alternatively we could re-implement the parse method.\n begin\n Chef::SolrQuery::QueryTransform.parse(query)\n true\n rescue Chef::Exceptions::QueryParseError\n false\n end\n end", "def valid(data)\n return data && data[0] && data[1]\n end", "def validate()\n validation_errors = []\n @expected_results.each_pair do |key,expected_result|\n result_key = expected_result[\"population_ids\"].dup\n\n reported_result, errors = extract_results_by_ids(expected_result['measure_id'], result_key)\n @reported_results[key] = reported_result\n validation_errors.concat match_calculation_results(expected_result,reported_result)\n end\n\n validation_errors\n end", "def test_empty_stmt\n assert_parses(\n nil,\n %q{})\n end", "def test_query\n add_test_judgement\n assert(@gold_standard.contains_query? :querystring => \"query1\")\n end", "def dataset_data_match?(domo_client, dataset_id, expected_data, should_fail=false)\n data = export_dataset(domo_client, dataset_id)\n\n if data.nil?\n unless expected_data.nil?\n puts \"Got no data back from Domo.\"\n puts \"Expected data: #{expected_data}\"\n return false\n end\n return true\n end\n\n if expected_data.is_a? Hash\n return false unless data.size == 1\n data = data[0]\n end\n\n # Sort the expected and actual data so we don't go chasing down row order differences.\n unless data.is_a? Hash\n data.sort! { |a,b| b[\"Event Name\"] <=> a[\"Event Name\"] }\n end\n unless expected_data.is_a? Hash\n expected_data.sort! { |a,b| b[\"Event Name\"] <=> a[\"Event Name\"] }\n end\n\n unless data == expected_data\n missing_data = Array.new\n expected_data.each do |d|\n unless data.include? d\n missing_data << d\n end\n end\n unless should_fail\n puts \"-----\"\n puts \"Actual data length: #{data.length}\"\n puts \"Expected data length: #{expected_data.length}\"\n puts \"-----\"\n puts \"Missing Data\"\n puts missing_data\n puts \"-----\"\n puts \"Actual Data\"\n puts data\n puts \"-----\"\n end\n return false\n end\n true\n end", "def run_test(options = {})\n rdf_string = input\n\n # Run\n graph = yield(rdf_string)\n\n return unless output\n\n case self.compare\n when :none\n # Don't check output, just parse to graph\n when :array\n @parser.graph.should be_equivalent_graph(self.output, self)\n else\n #puts \"parse #{self.outputDocument} as #{RDF::Reader.for(self.outputDocument)}\"\n format = detect_format(File.open(self.outputDocument))\n output_graph = RDF::Graph.load(self.outputDocument, :format => format, :base_uri => self.about)\n puts \"result: #{CGI.escapeHTML(graph.to_ntriples)}\" if ::RDF::N3::debug?\n graph.should Matchers::be_equivalent_graph(output_graph, self)\n end\n end", "def test_legal_file_parsing\n assert_equal( Graph.new().parse_json_file(\"CSAirData.json\"), true ) \n end", "def parse(data); end", "def parse_data(data)\n data.each { |line| process_line(line) }\n return unless measurements.blank?\n\n self.load_errors += \"No data was able to be loaded from this file.\"\n end", "def contains_solr_query_data?\n !(title.blank? and \n composed_written_by.blank? and \n composition_revision_year.blank? and \n duration.blank? and\n work_category_id.blank? and \n work_subcategory_id.blank? and \n work_additional_subcategory_id.blank? and \n difficulty.blank? and\n language_id.blank? and \n has_programme_note == \"0\" and \n status_id.blank? and\n concept_type.blank? and\n concept_id.blank? and\n has_resource == \"0\" and\n resource_type_id.blank? and\n !contains_instruments? and\n !contains_voices? and\n available_for_sale == \"0\" and\n available_for_hire == \"0\" and\n available_for_download == \"0\"\n ) \n end", "def contains_solr_query_data?\n !(\n title.blank? and\n venue.blank? and\n general_note.blank? and\n booking_ticket_note.blank? and\n locality.blank? and\n prize_info_note.blank? and\n internal_note.blank? and\n event_start_from.blank? and\n event_start_to.blank? and\n region_id.blank? and\n country_id.blank? and\n locality.blank?\n )\n end", "def check_syntax(schema, datum, validate = true, trace = TRACE_DEFAULT)\n self.error_codes = []\n self.error_messages = \"\"\n if (validate && !schema_is_valid?(schema))\n check_syntax_error(-1, schema, datum, trace)\n else\n check_syntax_internal(schema, datum, 0, trace)\n end\n [self.error_codes, self.error_messages]\n end", "def validate!\n validator.validate(data: data, schema: schema, logger: validation_logger)\n end", "def validate(data, schema, location = nil)\n @schema = schema\n @location = location\n\n validate_value(data, schema)\n\n raise_error\n end", "def assert_valid\n @validator = validator\n assert @validator.validate(data_sample, fail_fast: true)\n assert @validator.validate(data_sample, fail_fast: false)\n end", "def test_relevant\n add_test_judgement\n assert(@gold_standard.relevant? :document => \"doc1\", :query => \"query1\")\n end", "def validate_input\n problems = test_input\n raise OperationalError, \"Found the following problems: #{problems}\" unless problems.empty?\n end", "def verify_terms(test_data)\n test_terms = test_data[Org::ORG_TERM_GRP.name]\n errors = []\n test_terms.each_with_index do |test_term, index|\n text_values_match?(test_term[Org::TERM_DISPLAY_NAME.name], element_value(org_display_name_input index), errors)\n text_values_match?(test_term[Org::TERM_NAME.name], element_value(org_term_name_input index), errors)\n text_values_match?(test_term[Org::TERM_QUALIFIER.name], element_value(org_term_qualifier_input index), errors)\n text_values_match?(test_term[Org::TERM_STATUS.name], element_value(org_term_status_input index), errors)\n text_values_match?(test_term[Org::TERM_TYPE.name], element_value(org_term_type_input index), errors)\n text_values_match?(test_term[Org::TERM_FLAG.name], element_value(org_term_flag_input index), errors)\n text_values_match?(test_term[Org::TERM_LANGUAGE.name], element_value(org_term_language_input index), errors)\n # TODO - element does not indicate its state # text_values_match?(test_term[CoreOrgData::TERM_PREF_FOR_LANGUAGE.name], element_value(org_term_pref_for_lang_input index), errors)\n text_values_match?(test_term[Org::MAIN_BODY_NAME.name], element_value(main_body_name_input index), errors)\n text_values_match?(test_term[Org::ADDITIONS_TO_NAME.name], element_value(addition_to_name_input index), errors)\n text_values_match?(test_term[Org::TERM_SOURCE.name], element_value(org_term_source_name_input index), errors)\n text_values_match?(test_term[Org::TERM_SOURCE_DETAIL.name], element_value(org_term_source_detail_input index), errors)\n text_values_match?(test_term[Org::TERM_SOURCE_ID.name], element_value(org_term_source_id_input index), errors)\n text_values_match?(test_term[Org::TERM_SOURCE_NOTE.name], element_value(org_term_source_note_input index), errors)\n end\n errors\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 shacl_validator(rdf_graph, shacl_document)\n shacl_shapes = Hash.new\n responsive_endpoints = Array.new\n graph = RDF::Graph.load(rdf_graph)\n File.foreach(shacl_document) {|line|\n case line\n when /^EU/\n @endpoint_url = line.match(\"^EU\\t(.+)\\n\")[1]\n when /^SH/\n content = line.match(\"^SH\\t(.+\\n)\")[1]\n if shacl_shapes.include? @endpoint_url\n shacl_shapes[@endpoint_url] << content\n else\n shacl_shapes[@endpoint_url] = content\n end\n when /^XX/\n next\n end\n } \n #This splits the value of the hash, which corresponds to all the shapes from an\n # endpoint one after another in a string. The split is made on the ] . that\n # delimits the end of a shape, and with ?<= it is kept in the shapes.\n shacl_shapes.update(shacl_shapes) {|key, value| value.split(/(?<=\\] \\.)\\n/)}\n shacl_shapes.each do |key, value|\n value.each do |shape|\n File.open(\"tmp.ttl\", \"w\") {|file|\n file.write \"@prefix sh: <http://www.w3.org/ns/shacl#> .\\n\\n\"\n file.write shape\n }\n shacl = SHACL.open(\"tmp.ttl\")\n report = shacl.execute(graph)\n \n puts \"SHAPE:\\n\\n#{shape}\\n\\nConforms?: #{report.conform?}\\n\\nLength: #{report.all_results.length}\"\n puts puts\n puts report\n puts puts\n if report.conform? && report.all_results.length > 0\n responsive_endpoints << key\n break\n else \n next\n end\n end\n end\n return responsive_endpoints\nend", "def parse_query(query); end", "def parse_query(query); 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 is_query_valid\n # skip test for null prefix operators if in the process of completing the field name.\n return if(last_token_is(NULL_PREFIX_OPERATORS, 2) && !(query =~ /(\\s|\\)|,)$/))\n QueryBuilder.build_query(definition, query)\n end", "def valid?(query)\n validate(query).valid?\n end", "def valid?(data, schema_name: nil, namespace: @namespace, validate_options: {})\n schema = schema_name && @schema_store.find(schema_name, namespace)\n Avro::Schema.validate(schema, data.as_avro, **validate_options)\n end", "def validate(data)\n # Bail early if validation is turned off\n return [] unless @options[:validate_spec]\n # Automatically convert Diversity::JsonObjects to hashes\n data = data.data if data.is_a?(Diversity::JsonObject)\n require 'json-schema'\n JSON::Validator.fully_validate(@data, data)\n end", "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 validate\n validates_not_null :query\n validates_type String, :query\n validates_length_range 0..20, :query\n validates_not_null :page\n validates_type Integer, :page\n end", "def xml_data_should_validate_against_schema(xml, schema_name)\n xml = xml.is_a?(String) ? xml : xml.to_s\n doc = Nokogiri::XML(xml)\n schema_file = File.join(File.dirname(__FILE__), 'schemas', \"#{schema_name}.xsd\")\n schema = Nokogiri::XML::Schema File.read(schema_file)\n expect(schema.validate(doc)).to eq([])\n end", "def valid?(query)\n return true unless validate_query\n\n schema.valid?(query)\n end", "def test_valid_eval\n assert_equal [11, 'valid'], @eval.evaluate([5, 6, '+'])\n end", "def verify_types(test_data)\n test_types = test_data[Org::ORG_RECORD_TYPES.name]\n errors = []\n test_types = [{ Org::ORG_RECORD_TYPE.name => ''}] unless test_types\n test_types.each_with_index do |test_type, index|\n text_values_match?(test_type[Org::ORG_RECORD_TYPE.name], element_value(org_record_type_input(index)), errors)\n end\n errors\n end", "def validate_against_schema!(schema_name, data)\n if validate? && data.present?\n begin\n JSON::Validator.validate!(schema.send(schema_name), data)\n rescue Exception => e\n e.message << \"\\nSchema: #{schema.class.name}::SCHEMA.#{schema_name}\\nData: #{data.inspect}\"\n raise e\n end\n end\n end", "def valid?\n # Clear out errors\n @errors = []\n \n errors.push \"Tuščias XML. Gal įrašytum ką nors?...\" if params[:xml].blank?\n errors.push \"Padidink šriftą\" if params[:size].to_i <= 0\n errors.push \"Padidink paveiksliuko plotį\" if params[:width].to_i <= 0 \n return false unless errors.blank?\n \n @document = XML::Parser.string(self.class.normalize_xml(params[:xml])).parse \n true\n rescue LibXML::XML::Error => e\n errors.push \"Klaida parsinant XML: #{e.message}\"\n false\n end", "def parse(rawdata)\n end", "def test_site_data_response\n resp = @awis.query(:site_data)\n\n assert(resp.is_success?)\n assert(resp.title == 'Yahoo!')\n assert(resp.onlinesince == '18-Jan-1995')\n end", "def valid_query?(query)\n raise ArgumentError, \"Query cannot be nil or empty\" if query.to_s.empty?\n search = FoodCritic::Chef::Search.new\n search.create_parser(search.chef_search_grammars)\n search.parser? ? (! search.parser.parse(query.to_s).nil?) : true\n end", "def test_illegal_string_parsing\n \n bad_json = 'not even close to legal json format'\n assert_equal( Graph.new().parse_json_string(bad_json), false )\n \n valid_not_csair_json = ' { \"some_key\" : [ {\"bla\" : \"bla\" } ] } '\n assert_equal( Graph.new().parse_json_string(valid_not_csair_json), false )\n \n no_routes_key_json = ' { \"metros\" : [ {\n \"code\" : \"SCL\" ,\n \"name\" : \"Santiago\" ,\n \"country\" : \"CL\" ,\n \"continent\" : \"South America\" ,\n \"timezone\" : -4 ,\n \"coordinates\" : {\"S\" : 33, \"W\" : 71} ,\n \"population\" : 6000000 ,\n \"region\" : 1\n } ] } ' \n assert_equal( Graph.new().parse_json_string(no_routes_key_json), false ) \n \n no_metros_key_json = ' { \"routes\" : [ { \"ports\" : [\"SCL\" , \"LIM\"],\n \"distance\" : 2453 } ] } '\n assert_equal( Graph.new().parse_json_string(no_metros_key_json), false )\n \n end", "def parse_tests(records, expected_result)\n comment = nil\n records.each do |test|\n if test[0].is_a?(Array)\n if test.size != 3 || !test[1].is_a?(String) || !test[2].is_a?(String)\n raise \"Bad test: #{test.inspect} (#{test.size} #{test[1].class} #{test[2].class})\"\n end\n mapprevOutScriptPubKeys = {} # Outpoint => Script\n inputs = test[0]\n inputs.each do |input|\n raise \"Bad test: input is not an array: #{test.inspect}\" if !input.is_a?(Array)\n raise \"Bad test: input is an array of 3 items: #{test.inspect}\" if input.size != 3\n previd, previndex, scriptstring = input\n \n outpoint = BTC::Outpoint.new(transaction_id: previd, index: previndex)\n \n mapprevOutScriptPubKeys[outpoint] = parse_script(scriptstring)\n end\n \n tx = BTC::Transaction.new(hex: test[1])\n flags = parse_flags(test[2])\n \n if debug_filter(test)\n validation_proc = lambda do\n validation_passed = BTC::Validation.new.check_transaction(tx, BTC::ValidationState.new)\n if expected_result\n validation_passed.must_equal expected_result\n end\n script_passed = false\n \n if validation_passed\n tx.inputs.each do |txin|\n output_script = mapprevOutScriptPubKeys[txin.outpoint]\n raise \"Bad test: output script not found: #{test.inspect}\" if !output_script\n sig_script = txin.signature_script\n if !sig_script\n sig_script = BTC::Script.new(data: txin.coinbase_data)\n end\n \n checker = BTC::TransactionSignatureChecker.new(transaction: tx, input_index: txin.index)\n extensions = []\n extensions << BTC::P2SHExtension.new if (flags & BTC::ScriptFlags::SCRIPT_VERIFY_P2SH) != 0\n extensions << BTC::CLTVExtension.new if (flags & BTC::ScriptFlags::SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY) != 0\n interpreter = BTC::ScriptInterpreter.new(\n flags: flags,\n extensions: extensions,\n signature_checker: checker,\n raise_on_failure: expected_result,\n )\n #Diagnostics.current.trace do\n script_passed = interpreter.verify_script(signature_script: sig_script, output_script: output_script)\n if !script_passed\n break\n end\n #end\n end\n end\n (script_passed && validation_passed).must_equal expected_result\n end # proc\n \n yield(comment || test.inspect, validation_proc)\n end # if not filtered\n \n comment = nil\n else\n comment ||= \"\"\n comment += test[0].gsub(/\\.$/,\"\") + \". \"\n comment.gsub!(/\\. $/, \"\")\n end\n end\n end", "def assert_pg_parse( hq )\n ast = TC.parse( hq )\n ast = DN.normalize( ast )\n if ast\n pg = PG.generate( ast )\n begin\n rt = DB[\"select to_tsquery(?) as tsquery\", pg].first[:tsquery]\n refute_nil( rt, hq )\n rescue Sequel::DatabaseError => e\n fail( \"On query #{hq.inspect} -> #{ast.inspect}: #{ e.to_s }\" )\n end\n else\n pass\n end\n end", "def validate()\n name = @name.to_sym\n unless support.has_key?(name)\n @errors << Sparkql::ParserError.new(:token => @name, \n :message => \"Unsupported function call '#{@name}' for expression\",\n :status => :fatal )\n return\n end\n\n required_args = support[name][:args]\n total_args = required_args + Array(support[name][:opt_args]).collect {|args| args[:type]}\n\n if @args.size < required_args.size || @args.size > total_args.size\n @errors << Sparkql::ParserError.new(:token => @name, \n :message => \"Function call '#{@name}' requires #{required_args.size} arguments\",\n :status => :fatal )\n return\n end\n\n count = 0\n @args.each do |arg|\n type = arg[:type] == :function ? arg[:return_type] : arg[:type]\n unless Array(total_args[count]).include?(type)\n @errors << Sparkql::ParserError.new(:token => @name, \n :message => \"Function call '#{@name}' has an invalid argument at #{arg[:value]}\",\n :status => :fatal )\n end\n count +=1\n end\n\n if name == :cast\n type = @args.last[:value]\n if !VALID_CAST_TYPES.include?(type.to_sym)\n @errors << Sparkql::ParserError.new(:token => @name,\n :message => \"Function call '#{@name}' requires a castable type.\",\n :status => :fatal )\n return\n end\n end\n\n if name == :substring && !@args[2].nil?\n substring_index_error?(@args[2][:value])\n end\n end", "def validate\n if !raw.include?('Returns')\n raise InvalidTomDoc.new(\"No `Returns' statement.\")\n end\n\n if sections.size < 2\n raise InvalidTomDoc.new(\"No description section found.\")\n end\n\n true\n end", "def initialize(schema, data)\n @schema = schema\n @data = data\n @valid = false\n end", "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 universal_validation_checks (data, options={})\n # shortcircuit if debugging\n return true if RubyMotionQuery::RMQ.debugging?\n # allow blank data if specified\n return true if (options[:allow_blank] && (data.nil? || data.empty?))\n # allow whitelist data if specified\n return true if (options[:white_list] && options[:white_list].include?(data))\n\n false\n end", "def validate(data, schema, options = {})\n valid = validate_value(schema, data, options)\n\n unless valid\n @message = \"#{data.inspect} does not match #{schema.inspect}\"\n end\n valid\n end", "def validate(string_or_document, rules: nil)\n doc = if string_or_document.is_a?(String)\n GraphQL.parse(string_or_document)\n else\n string_or_document\n end\n query = GraphQL::Query.new(self, document: doc)\n validator_opts = { schema: self }\n rules && (validator_opts[:rules] = rules)\n validator = GraphQL::StaticValidation::Validator.new(validator_opts)\n res = validator.validate(query)\n res[:errors]\n end", "def dataset_field_match?(domo_client, dataset_id, expected_data)\n data = export_dataset(domo_client, dataset_id)\n return false unless data\n\n if expected_data.is_a? Array\n expected_data_row = expected_data[0]\n else\n expected_data_row = expected_data\n end\n if data.is_a? Array\n data_row = data[0]\n else\n data_row = data\n end\n\n unmatched_fields = Array.new\n expected_data_row.each do |name, v|\n unless data_row.include? name\n unmatched_fields << name\n end\n end\n\n unmatched_fields.length <= 0\n end", "def validate(data)\n dupped_data = V2::Dupper.dup_data(data)\n collector = V2::Collector.new(dupped_data)\n root.fields[:root].validate({ root: data }, collector.ignore_next_segment)\n return collector\n end", "def sanity_check_data(plugin, data)\n # This allows plugin authors to easily skip metrics with no results\n return [] if data.nil?\n\n keys_data = data.map { |item| item.keys }.flatten.map(&:to_s)\n keys_schema = plugin.schema.map { |item| item[:name] }\n\n disallowed = (keys_data - keys_schema)\n\n raise \"ERROR: The #{plugin.name} plugin exported the following keys not documented in the schema: #{disallowed}\" unless disallowed.empty?\n\n data\n end", "def parse_data(data)\n # 結果が確定していない為、集計対象外\n return if unclosed?(data)\n\n site_id = data[\"_id\"][\"site_id\"]\n user_id = data[\"_id\"][\"user_id\"]\n user_code = data[\"_id\"][\"user_code\"]\n user_staff_address_uid = data[\"_id\"][\"user_staff_address_uid\"]\n group_id = data[\"_id\"][\"group_id\"]\n date = data[\"_id\"][\"date\"]\n fiscal_year = data[\"_id\"][\"fiscal_year\"]\n month = data[\"_id\"][\"month\"]\n start_at = data[\"_id\"][\"start_at\"]\n end_at = data[\"_id\"][\"end_at\"]\n capital_code = data[\"_id\"][\"capital_code\"]\n project_code = data[\"_id\"][\"project_code\"]\n detail_code = data[\"_id\"][\"detail_code\"]\n file_id = data[\"_id\"][\"file_id\"]\n\n duty_day_time_minute = data[\"duty_day_time_minute\"]\n duty_day_in_work_time_minute = data[\"duty_day_in_work_time_minute\"]\n duty_night_time_minute = data[\"duty_night_time_minute\"]\n\n leave_day_time_minute = data[\"leave_day_time_minute\"]\n leave_night_time_minute = data[\"leave_night_time_minute\"]\n\n week_in_compensatory_minute = data[\"week_in_compensatory_minute\"]\n holiday_compensatory_minute = data[\"holiday_compensatory_minute\"]\n break_time_minute = data[\"break_time_minute\"]\n\n unrate_week_out_compensatory_minute = data[\"week_out_compensatory_minute\"]\n week_out_compensatory_minute = 0\n\n # 週内、週外残業(土日)があった場合、休出区分割増にならない\n if week_in_compensatory_minute > 0 || unrate_week_out_compensatory_minute > 0\n duty_day_time_minute += leave_day_time_minute\n duty_night_time_minute += leave_night_time_minute\n\n leave_day_time_minute = 0\n leave_night_time_minute = 0\n end\n\n # 週外残業は、その週の業務時間合計が 38.75h (2325m) を超えない場合、割増がつかない\n week_working = nil\n if unrate_week_out_compensatory_minute > 0\n @week_working_extractor.week_at(site_id, user_id, date.to_date)\n week_working = @week_working_extractor.week_working\n week_working_minute = @week_working_extractor.week_minutes\n\n if week_working_minute >= 2325\n unrate_week_out_compensatory_minute = 0\n week_out_compensatory_minute = data[\"week_out_compensatory_minute\"]\n end\n end\n\n @subtractors[user_id] ||= Gws::Affair::Subtractor.new(threshold)\n w_c_m = week_out_compensatory_minute # 0. 025/100\n i_w_m = duty_day_in_work_time_minute # 1. 100/100\n d_d_m = duty_day_time_minute # 2. 125/100\n l_d_m = leave_day_time_minute # 3. 135/100\n d_n_m = duty_night_time_minute # 4. 150/100\n l_n_m = leave_night_time_minute # 5. 160/100\n\n under_minutes, over_minutes = @subtractors[user_id].subtract(w_c_m, i_w_m, d_d_m, l_d_m, d_n_m, l_n_m)\n\n under_overtime_minute = under_minutes.sum\n over_overtime_minute = over_minutes.sum\n overtime_minute = under_overtime_minute + over_overtime_minute\n\n @prefs[user_id] ||= {}\n @prefs[user_id][file_id] = {\n # user\n user_id: user_id,\n user_code: user_code,\n user_staff_address_uid: user_staff_address_uid,\n\n # group\n group_id: group_id,\n\n # date\n date: date.localtime,\n fiscal_year: fiscal_year,\n month: month,\n start_at: start_at.localtime,\n end_at: end_at.localtime,\n\n # capital\n capital_code: capital_code,\n project_code: project_code,\n detail_code: detail_code,\n\n # minutes\n week_in_compensatory_minute: week_in_compensatory_minute,\n holiday_compensatory_minute: holiday_compensatory_minute,\n week_out_compensatory_minute: week_out_compensatory_minute,\n unrate_week_out_compensatory_minute: unrate_week_out_compensatory_minute,\n break_time_minute: break_time_minute,\n week_working: week_working,\n overtime_minute: overtime_minute,\n under: {\n duty_day_time_minute: under_minutes[2].to_i,\n duty_night_time_minute: under_minutes[4].to_i,\n duty_day_in_work_time_minute: under_minutes[1].to_i,\n leave_day_time_minute: under_minutes[3].to_i,\n leave_night_time_minute: under_minutes[5].to_i,\n week_out_compensatory_minute: under_minutes[0].to_i,\n overtime_minute: under_overtime_minute\n },\n over: {\n duty_day_time_minute: (over_minutes[2].to_i + over_minutes[1].to_i),\n duty_night_time_minute: over_minutes[4].to_i,\n leave_day_time_minute: over_minutes[3].to_i,\n leave_night_time_minute: over_minutes[5].to_i,\n week_out_compensatory_minute: over_minutes[0].to_i,\n overtime_minute: over_overtime_minute\n }\n }\n end", "def assert_valid_gqueries!\n return true if queries.length == @requested_queries.length\n\n (@requested_queries - queries.map(&:key)).each do |key|\n @errors.push(\"Gquery #{ key } does not exist\")\n end\n\n false\n end", "def test_a\n fdl_test( %{\n feature test\n (not all(x,x:[word=nil]))\n <x.id>},\n false)\n end", "def exercise1\n parse_data\n passports.count(&:valid?)\n end", "def check_data_values(data)\n data.each do |id, values|\n out, back = values[values.keys[0]], values[values.keys[1]]\n if back > out\n puts \"+%s+\" % [\"-\" * 57]\n puts \"|%32s%26s\" % [\"WARNING\", \"|\"]\n puts \"+%s+\" % [\"-\" * 57]\n puts \"%s%21s\" % [\"| Bad data record! -- sample #{id}\", \"|\"]\n puts \"%s%15s%22s\" % [\"| PDE in #{values.keys[0]} --\", \"#{dose_unit_text(values[values.keys[0]])}/day,\", \"|\"]\n puts \"%s%15s%22s\" % [\"| PDE in #{values.keys[1]} --\", \"#{dose_unit_text(values[values.keys[1]])}/day.\", \"|\"]\n puts \"%s%7s\" % [\"| Sample #{id} will not include in the analysis!\", \"|\"]\n puts \"+%s+\" % [\"-\" * 57]\n data.delete(id)\n end\n end\n data\n end", "def emma_data_valid?\n if emma_data.blank?\n error(:emma_data, :missing)\n else\n check_required(database_fields[:emma_data], emma_metadata)\n end\n errors.empty?\n end", "def validate\n [] # schema.validate(@doc)\n end", "def assert_queries_match(query1, query2, filter_exp=nil, sort=false, qrserver_id=0)\n result_xml1 = search(query1, qrserver_id).xmldata.split(\"\\n\")\n result_xml2 = search(query2, qrserver_id).xmldata.split(\"\\n\")\n assert_resultsets_match(result_xml1, result_xml2, filter_exp, sort)\n end", "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 test_parse\n metro = @my_graph.metro\n @my_graph.analysis_data\n assert_equal(metro['BUE'].population, 13300000, 'Reading does not works')\n assert_equal(metro['SHA'].continent, 'Asia', 'Reading does not 2')\n assert_equal(metro['MIL'].destination['ESS'], 681, 'distance does not work')\n assert_equal(metro['MIL'].destination.length, 3, 'data wrong')\n assert_equal(metro['OSA'].country, 'JP', 'data wrong')\n assert_equal(@my_graph.longest_dist, 12051, 'Distance correct')\n assert_equal(@my_graph.shortest_dist, 334, 'population wrong')\n assert_equal(@my_graph.biggest_pop, 34000000, 'Distance wront')\n assert_equal(@my_graph.biggest_city, 'TYO', 'Distance wront')\n assert_equal(@my_graph.avg_pop, 11796143, 'Avg Population')\n assert_equal(@my_graph.get_distance('MEX', 'LIM'), 4231, 'route')\n assert_equal(@my_graph.get_distance('LIM', 'MEX'), 4231, 'route')\n\n #controllers\n assert_equal(get_time_part2('SFO', @my_graph), 1.5, \"layover\")\n assert_equal(get_time_part2('WAS', @my_graph), 1.5, \"layover\")\n assert_equal(get_time_part1(400), 0.5333333333333333, \"first part of time wrong\")\n assert_equal(get_time_part1(500), 1, \"first part of time wrong\")\n assert_equal(get_time_part1(300), 0.46188021535170065, \"first part of time wrong\")\n dist, money, time = check_routes(@my_graph,['NYC','YYZ','WAS'])\n assert_equal(dist,1143,\"distance wrong\")\n assert_equal(money,371.30000000000007,\"money wrong\")\n assert_equal(time,3.6666666666666665,\"time wrong\")\n\n\n #test add routes or nodes\n assert(@my_graph.has_route('MIA','WAS'))\n @my_graph.remove_single_route('MIA','WAS')\n assert(!@my_graph.has_route('MIA','WAS'))\n assert(@my_graph.has_route('WAS','MIA'))\n\n #test editcity\n @my_graph.update_city_info('BUE', 'POPULATION', 333333333333)\n @my_graph.analysis_data\n assert_equal(@my_graph.biggest_pop, 333333333333, 'Population wrong')\n @my_graph.update_city_info('BUE', 'POPULATION', 1)\n @my_graph.analysis_data\n assert_not_equal(@my_graph, 333333333333, 'Population wrong')\n\n #test dijkstra\n setup\n s = calculate_shortest(@my_graph,'YYZ','MIA')\n assert_equal(s[0], 'YYZ', 'Dijk wrong')\n assert_equal(s[1], 'WAS', 'Dijk wrong')\n assert_equal(s[2], 'MIA', 'Dijk wrong')\n end", "def valid?\n return false if @query.nil?\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 test_valid\n assert_equal(correct_results,\n ConfigParser.parse(\"data/valid.config\"))\n end", "def validate_text(text)\n return validate({:rawdata => text})\n end", "def dataTest data\n failure = RubyUnit::AssertionFailure.new(data)\n assertEqual data, failure.data, 'Assertion data Hash is incorrect'\n end", "def validate(input_file)\n \n # open(input_file).read().match(/xsi:schemaLocation=\"[^\"]*(http[^\"]*)\"/)\n # \n # require 'net/http'\n # \n # uri = URI($1)\n # xsd_file = Net::HTTP.get(uri)\n # \n # xsd = Nokogiri::XML::Schema(xsd_file)\n # doc = Nokogiri::XML(File.read(input_file))\n # \n # xsd.validate(doc).each do |error|\n # end\n \n end", "def assert_data?\n @operation.assert['data']\n end", "def valid?\n self.class.matcher.match? data\n end", "def test_data_integrity(table='test_ruby', data=[\"Gabriele\", \"MODENA\"])\n test_create_table\n \n values = \"\"\n data.each do |d| values += '\\'' + d.to_s + '\\'' + ',' end\n values = values.chop # remove last ',' character\n \n insert = 'INSERT INTO ' + table + ' VALUES (' + values + ' )' \n \n @db.query(insert)\n \n res = @db.query(\"SELECT * FROM #{table}\")\n rows = res.fetch_all\n \n assert_equal(res.num_rows, rows.size)\n end", "def checkData(dbName)\n @db = @conn[dbName]\n @edorg_collection = @db[EDORG_COLLECTION]\n @edorg_collection.find.each do |row|\n type = row[TYPE_FIELD]\n body = row[BODY_FIELD]\n orgcats = body[ORGCAT_FIELD]\n\n if type == TYPE_VALUE_SCHOOL and not orgcats.include?(ORGCAT_VALUE_SCHOOL)\n puts(\"Error: missing school org cat\")\n return false\n end\n if type == TYPE_VALUE_LEA and not orgcats.include?(ORGCAT_VALUE_LEA)\n puts(\"Error: missing LEA org cat\")\n return false\n end\n if type == TYPE_VALUE_SEA and not orgcats.include?(ORGCAT_VALUE_SEA)\n puts(\"Error: missing SEA org cat\")\n return false\n end\n end\n return true\nend", "def test_program_a_has_correct_tokens\n @program_d.scan\n\n token_a = @program_d.tokens[0]\n token_b = @program_d.tokens[9]\n token_c = @program_d.tokens[10]\n token_d = @program_d.tokens[7]\n\n assert(token_a.type == :keyword, \"Expected :keyword at token 1\")\n assert(token_b.type == :number, \"Expected :number at token 10\")\n assert(token_c.type == :comma, \"Expected :comma at token 11\")\n assert(token_d.type == :char, \"Expected :char at token 8\")\n\n assert(token_a.value == \"VALL\", \"Expected value 'VALL' at token 1\")\n assert(token_b.value == \"2\", \"Expected value '2' at token 10\")\n assert(token_c.value == \",\", \"Expected value ',' at token 11\")\n assert(token_d.value == \"i\", \"Expected value 'i' at token 9\")\n end", "def schema_valid_error(schema, message, trace)\n xprint(\"\\n** INVALID SCHEMA ** #{message}: #{schema.inspect}\\n\")\n false\n end", "def token_data_blank?(data); !data or (data.respond_to?(:empty?) and data.empty?) end", "def test_ar_validation\n source = Source.new(\"http://www.newstuff.org/my_first\")\n assert(!Source.exists?(source.uri))\n source.primary_source = false\n errors = \"\"\n assert(source.valid?, source.errors.each_full() { |msg| errors += \":\" + msg })\n \n # Now check if the uri validation works\n source.uri = \"foobar\"\n assert(!source.valid?)\n source.uri = \"foo:bar\"\n assert(source.valid?)\n end", "def check_updated_course_data_validity(course_data)\n schema = {\n 'type' => 'object',\n 'required' => %w(Name Code StartDate EndDate IsActive),\n 'properties' => {\n 'Name' => { 'type' => 'string' },\n 'Code' => { 'type' => 'string' },\n 'StartDate' => { 'type' => %w(string null) },\n 'EndDate' => { 'type' => %w(string null) },\n 'IsActive' => { 'type' => 'boolean' }\n }\n }\n JSON::Validator.validate!(schema, course_data, validate_schema: true)\nend", "def test_valid_parse\n test_songs, test_kits = SongParserTest.generate_test_data()\n \n assert_equal(120, test_songs[:no_tempo].tempo)\n assert_equal([:verse], test_songs[:no_tempo].flow)\n \n assert_equal(100, test_songs[:repeats_not_specified].tempo)\n assert_equal([:verse], test_songs[:repeats_not_specified].flow)\n \n # These two songs should be the same, except that one uses a kit in the song header\n # and the other doesn't.\n [:example_no_kit, :example_with_kit].each do |song_key|\n song = test_songs[song_key]\n assert_equal([:verse, :verse,\n :chorus, :chorus,\n :verse, :verse,\n :chorus, :chorus, :chorus, :chorus,\n :bridge,\n :chorus, :chorus, :chorus, :chorus],\n song.flow)\n assert_equal(99, song.tempo)\n assert_equal([\"bridge\", \"chorus\", \"verse\"], song.patterns.keys.map{|key| key.to_s}.sort)\n assert_equal(4, song.patterns[:verse].tracks.length)\n assert_equal(5, song.patterns[:chorus].tracks.length)\n assert_equal(1, song.patterns[:bridge].tracks.length)\n end\n \n song = test_songs[:example_with_empty_track]\n assert_equal(1, song.patterns.length)\n assert_equal(2, song.patterns[:verse].tracks.length)\n assert_equal(\"........\", song.patterns[:verse].tracks[\"test/sounds/bass_mono_8.wav\"].rhythm)\n assert_equal(\"X...X...\", song.patterns[:verse].tracks[\"test/sounds/snare_mono_8.wav\"].rhythm)\n \n song = test_songs[:multiple_tracks_same_sound]\n assert_equal(2, song.patterns.length)\n assert_equal(7, song.patterns[:verse].tracks.length)\n assert_equal([\"agogo\", \"bass\", \"bass2\", \"bass3\", \"bass4\", \"hh_closed\", \"snare\"],\n song.patterns[:verse].tracks.keys.sort)\n assert_equal(\"X...............\", song.patterns[:verse].tracks[\"bass\"].rhythm)\n assert_equal(\"....X...........\", song.patterns[:verse].tracks[\"bass2\"].rhythm)\n assert_equal(\"........X.......\", song.patterns[:verse].tracks[\"bass3\"].rhythm)\n assert_equal(\"............X...\", song.patterns[:verse].tracks[\"bass4\"].rhythm)\n assert_equal(\"..............X.\", song.patterns[:verse].tracks[\"snare\"].rhythm)\n assert_equal(\"X.XXX.XXX.X.X.X.\", song.patterns[:verse].tracks[\"hh_closed\"].rhythm)\n assert_equal(\"..............XX\", song.patterns[:verse].tracks[\"agogo\"].rhythm)\n \n song = test_songs[:with_structure]\n assert_equal([:verse, :verse], song.flow)\n assert_equal(1, song.patterns.length)\n assert_equal(1, song.patterns[:verse].tracks.length)\n assert_equal(\"X...X...\", song.patterns[:verse].tracks[\"test/sounds/bass_mono_8.wav\"].rhythm)\n end", "def validate(doc)\n raw_text = doc.gsub(\"\\n\", '')\n tfr = TextIn::TextTransformer.new(raw_text, @flow_type, nil, nil, nil, 'out')\n res = tfr.parse\n res.nil? # parse returns nil on success\n end", "def verify_result(expect, model)\n puts \"running query: #{build_query(model)}\"\n result = search(build_query(model))\n assert_equal(expect.size, result.hit.size)\n expect.each_with_index do |expected_sub_scores,i|\n jsf = result.hit[i].field['summaryfeatures']\n sub_scores = extract_subscores(jsf, model.size)\n assert_equal(expected_sub_scores, sub_scores,\n \"subscores differ for hit #{i}: #{expected_sub_scores} != #{sub_scores}\")\n end\n end", "def valid_query?(query)\n fail ArgumentError, 'Query cannot be nil or empty' if query.to_s.empty?\n\n # Attempt to create a search query parser\n search = FoodCritic::Chef::Search.new\n search.create_parser(search.chef_search_grammars)\n\n if search.parser?\n search.parser.parse(query.to_s)\n else\n # If we didn't manage to get a parser then we can't know if the query\n # is valid or not.\n true\n end\n end", "def validate!\n if query.present?\n # Construct field and value from the query\n parts = query.split(':')\n unless parts.size == 2\n raise ArgumentError, 'facet query not separated by colon'\n end\n\n self.field = parts[0].to_sym\n self.value = parts[1]\n\n # Strip quotes from the value if present\n self.value = value[1..-2] if value[0] == '\"' && value[-1] == '\"'\n\n # We only know how to handle one field, year\n unless field == :year\n raise ArgumentError, \"do not know how to handle facet queries for #{field}\"\n end\n else\n raise ArgumentError, 'facet without field' if field.blank?\n raise ArgumentError, 'facet without value' if value.blank?\n\n # We only know how to handle :authors_facet and :journal_facet\n unless %i[authors_facet journal_facet].include?(field)\n raise ArgumentError, \"do not know how to handle facets on #{field}\"\n end\n\n # Strip quotes from the value if present\n self.value = value[1..-2] if value[0] == '\"' && value[-1] == '\"'\n\n # Construct the query from field and value\n self.query = \"#{field}:\\\"#{value}\\\"\"\n end\n end" ]
[ "0.667054", "0.59963167", "0.570665", "0.56189144", "0.55292624", "0.55135006", "0.5504733", "0.5466863", "0.54390323", "0.5366752", "0.5364879", "0.5354181", "0.53322834", "0.52761775", "0.52758545", "0.5261994", "0.5261994", "0.5226985", "0.5226985", "0.5221339", "0.5216152", "0.52064604", "0.51849115", "0.51842165", "0.51734036", "0.51643103", "0.5162841", "0.51443946", "0.51333845", "0.5129074", "0.5124098", "0.5123139", "0.5116051", "0.51138985", "0.51096106", "0.5097134", "0.5089772", "0.5085302", "0.5080743", "0.5075136", "0.5075136", "0.5068527", "0.5065298", "0.5063772", "0.50603455", "0.50467944", "0.50435054", "0.5043475", "0.50433725", "0.50381273", "0.5034791", "0.5022039", "0.50070816", "0.49926502", "0.49884242", "0.49653417", "0.49617764", "0.49589142", "0.49568608", "0.4954074", "0.4936765", "0.4934875", "0.49329376", "0.49234015", "0.491526", "0.4911143", "0.490865", "0.4907243", "0.49060702", "0.4896016", "0.48956597", "0.48916966", "0.4889742", "0.48885396", "0.4883097", "0.48814818", "0.48812413", "0.4880735", "0.48745945", "0.48728287", "0.48660773", "0.4865339", "0.4851252", "0.4849687", "0.48491067", "0.48462865", "0.48390958", "0.48331106", "0.48316866", "0.4828397", "0.4827947", "0.48246634", "0.4821378", "0.4814973", "0.481489", "0.48139668", "0.48037928", "0.48011744", "0.47977227", "0.47935665" ]
0.6963143
0
POST id. Required. The ID of the status to favorite. Ex: or
def create end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def favorite(id)\n post(\"/favorites/create/#{id}.json\")\n end", "def create_favorite(id)\n post \"favorites/create/#{id}\", {}\n end", "def change_favorite_status\r\n\t\t\tProject.update_favorite_status params[:id], params[:is_favorite]\r\n\r\n\t\t\trender json: { status: 0 }\r\n\t\tend", "def favorite\n if current_user\n info = params[:recipe_id]\n @found = Favorite.find_by(recipe_id: info, user_id: current_user.id)\n if !@found\n @favorite = Favorite.new\n @favorite.recipe_id = info\n @favorite.user_id = current_user.id\n @favorite.save!\n head :ok\n end\n else\n redirect_to '/'\n end\n end", "def favorite_params\n params.permit(:user_id,\n :post_id)\n end", "def favorite_params\n params.require(:favorite).permit(:user_id, :post_id)\n end", "def set_favorite\n @favorite = Favorite.find(params[:id]) \n end", "def set_favorite_state\n @favorite_state = FavoriteState.find(params[:id])\n end", "def favorite\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if favorited = @product.favorite_toggle(params[:udid])\n format.html { redirect_to @product, notice: 'Favorite was successfully updated.' }\n format.json { render json: {favorite_count: @product.favorite_count, favorited: favorited == 1 ? true : false }, status: :ok }\n else\n format.html { render action: \"show\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_favorite\n @favorite = Favorite.find(params[:id])\n end", "def set_favorite\n @favorite = Favorite.find(params[:id])\n end", "def set_favorite\n @favorite = Favorite.find(params[:id])\n end", "def set_favorite\n @favorite = Favorite.find(params[:id])\n end", "def set_favorite\n @favorite = Favorite.find(params[:id])\n end", "def set_favorite\n @favorite = Favorite.find(params[:id])\n end", "def set_favorite\n @favorite = Favorite.find(params[:id])\n end", "def set_favorite\n @favorite = Favorite.find(params[:id])\n end", "def select_favorite\n Favorite.update_favorite(1,params[:id],current_user.id)\n redirect_back(fallback_location: restaurants_url)\n end", "def favorite\n \t\t\tbyebug\n \ttype = params[:type]\n \t@recipe = current_user.recipes.find(params[:id])\n \tif type == \"favorite\"\n \t\tif FavoriteRecipe.where(:recipe_id => @recipe.id).present?\n\t\t\t\tredirect_to recipe_path(@recipe), notice: \"Already favorited #{@recipe.name}\"\n \t\telse\n \t\t\tcurrent_user.favorites << @recipe\n \t\t\tredirect_to recipe_path(@recipe), notice: \"You favorited #{@recipe.name}\"\n \t\tend\n \t\t#redirect_to :back, notice: 'You favorited #{@recipe.name}'\n\n \telsif type == \"unfavorite\"\n \t\tcurrent_user.favorites.delete(@recipe)\n \t\tredirect_to recipe_path(@recipe), notice: \"You Unfavorited #{@recipe.name}\"\n \t\t#redirect_to :back, notice: 'Unfavorited #{@recipe.name}'\n\n \telse\n \t# Type missing, nothing happens\n \t\tredirect_to recipe_path(@recipe), notice: \"Issue with favorite!\"\n \tend\n \t\tend", "def favorite_params\n params.delete(:user_id)\n params.require(:favorite).permit(:gif_post_id)\n end", "def set_favorite\n @favorite = Favorite.find(params[:id])\n end", "def create\n fav = params[:favorite]\n fav[:user_id] = current_user.id\n fav[:name] = fav[:note]\n @favorite = Favorite.new(fav)\n @favorite.save\n render 'toggle'\n end", "def set_favorite\n @favorite = current_user.favorites.find(params[:id])\n end", "def set_favourite\n @favourite = Favourite.find(params[:id])\n end", "def status\n @review = Review.find(params[:id])\n @review.update_attribute(:approved_id, current_user.id)\n flash[:info] = \"Review is approved!\"\n redirect_to admin_home_path\n end", "def set_favourite\n @favourite = Favourite.find(params[:id])\n end", "def set_favourite\n @favourite = Favourite.find(params[:id])\n end", "def set_favourite\n @favourite = Favourite.find(params[:id])\n end", "def set_api_favorite\n @api_favorite = Api::Favorite.find(params[:id])\n end", "def update\n respond_with Favor.update(params[:id], params[:favor])\n end", "def status\n @post = Post.find(params[:id])\n @post.update_attribute(:approved_id, current_user.id)\n flash[:info] = \"Advertisement is approved!\"\n redirect_to admin_home_path\n end", "def create\n\n @favourite_details = Hash.new\n\n @favourite_details[:user_id] = params[:user_id]\n @favourite_details[:job_posting_id] = params[:job_posting_id]\n @favourite_details[:status_flag] = params[:status_flag]\n @favourite = Favourite.new(@favourite_details)\n\n respond_to do |format|\n if @favourite.save\n flash[:notice] = 'Favourite was successfully created.'\n format.html { redirect_to(@favourite) }\n format.xml { render :xml => @favourite, :status => :created, :location => @favourite }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @favourite.errors, :status => :unprocessable_entity }\n end\n end\n end", "def favorite\n tweet_id=params[:tuit_id]\n client.favorite(tweet_id) unless tweet_id == nil\n respond_to do |format|\n format.html { }\n\t format.json { head :no_content }\n\t format.js\n end\n end", "def favorite(action, value)\n raise ArgumentError, \"Invalid favorite action provided: #{action}\" unless @@FAVORITES_URIS.keys.member?(action)\n value = value.to_i.to_s unless value.is_a?(String)\n uri = \"#{@@FAVORITES_URIS[action]}/#{value}.json\"\n case action\n when :add\n response = http_connect {|conn| create_http_post_request(uri) }\n when :remove\n response = http_connect {|conn| create_http_delete_request(uri) }\n end\n bless_model(Twitter::Status.unmarshal(response.body))\n end", "def update_confirm\n @id = params[:id]\n @title = params[:title]\n @description = params[:description]\n @status = params[:state]\n @post = Post.new(title: @title, description: @description, status: @status, id: @id)\n end", "def favourite_params\n params.require(:favourite).permit(:user_id, :fav_post_id)\n end", "def show_status(status_id)\n get \"statuses/show/#{status_id}\"\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def create\n recipe = Recipe.find(params[:id])\n @favorite = current_user.add_to_favorite(recipe.id)\n\n respond_to do |format|\n if @favorite.save\n format.html { redirect_to :back, notice: 'Favorite was successfully created.' }\n format.json { render :show, status: :created, location: @favorite }\n else\n format.html { render :new }\n format.json { render json: @favorite.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_status\n @status = Status.find(params[:id])\n end", "def set_api_v1_favorite\n @api_v1_favorite = Api::V1::Favorite.find(params[:id])\n end", "def update\n if params.has_key? :like\n @client.put(\"/me/favorites/#{params[:id]}\")\n head :ok and return\n end\n\n if params.has_key? :unlike\n @client.delete(\"/me/favorites/#{params[:id]}\")\n head :ok and return\n end\n\n if params.has_key? :repost\n @client.put(\"/me/track_reposts/#{params[:id]}\")\n head :ok and return\n end\n\n if params.has_key? :unpost\n @client.delete(\"/me/track_reposts/#{params[:id]}\")\n head :ok and return\n end\n\n head :bad_request\n end", "def mark_seen\n fulfillment = Fulfillment.find(params[:id])\n if fulfillment.status == 0 \n fulfillment.status = 1\n fulfillment.save\n else\n flash[:error] = \"There was an error processing your request.\"\n end \n redirect_to :back\n end", "def add_favorite_food(food_id)\n post(\"/user/#{@user_id}/foods/log/favorite/#{food_id}.json\")\n end", "def set_favorecido\n @favorecido = Favorecido.find(params[:id])\n end", "def set_favory\n @favory = Favory.find(params[:id])\n end", "def set_status\n @status ||= Status.find(params[:id])\n end", "def set_favo\n @favo = Favo.find(params[:id])\n end", "def postTweet(status)\n\t\t\[email protected](status)\n\t\tend", "def set_favorite\n @json = Punk::API.one_beer!(params[:id])\n @json = @json&.first\n if FavoriteBeer.where(punk_id: @json[:punk_id], user_id: @current_user.id).empty?\n @fav_beer = FavoriteBeer.new(@json)\n @fav_beer.user_id = @current_user.id.to_i\n @fav_beer.save!\n end\n\n @json[:favorite] = true\n render json: {\n favorite_beer_set: @json\n }\n end", "def set_favorite_restaurant\n @favorite_restaurant = FavoriteRestaurant.find(params[:id])\n end", "def create\n #I have the quote id from params and I have the @user instamce\n already_there = Favorite.find_by(user:@user,quote_id:params[:id])\n if already_there\n render json: {error_message:\"You already have this quote in your favorites\"}\n else\n new_favorite = Favorite.create(user:@user,quote_id:params[:id])\n render json: new_favorite\n end\n end", "def set_favorito\n @favorito = Favorito.find(params[:id])\n end", "def create\n # @favourite_listing = FavouriteListing.new(params[:favourite_listing])\n #@favourite_listing.user = current_user\n #@favourite_listing.listing = Listing.find(params[:listing_id])\n\n @favourite_listing= current_user.add_to_favourites(params[:listing_id])\n\n if @favourite_listing.save\n redirect_to favourite_listings_url, :notice => \"Current listening was added to your favourites\"\n else\n redirect_to favourite_listings_url, :alert => \"Listing has already been added\"\n end\n end", "def set_favorite_item\n @favorite_item = FavoriteItem.find(params[:id])\n end", "def set_favorite_tweet\n @favorite_tweet = FavoriteTweet.find(params[:id])\n end", "def favorite\n type = params[:type] # get the type from the url (fav/unfav)\n ass = params[:controller] # get the current controller name\n clazz = params[:controller].classify.constantize # get the controllers class in with big upper letter\n obj = clazz.find_by tiss_id: params[:tiss_id] # find the object with the tiss_id\n obj = clazz.create tiss_id: params[:tiss_id] if obj.nil? # create if not exists\n alreadyfav = current_user.send(ass).exists?(obj.id) # is it already fav?\n if type == 'favorite' && !alreadyfav # if not already fav and we want to fav\n current_user.send(ass) << obj # fav it\n flash[:success] = \"Favorite successful\" # success msg\n elsif type == 'unfavorite' && alreadyfav # else\n current_user.send(ass).delete(obj) # unfav\n flash[:success] = \"Unfavorite successful\" # success msg\n else\n flash[:danger] = \"Nothing happened\" # nothing happened msg\n end\n redirect_back fallback_location: root_path # return\n end", "def update_api\n \t@task = Task.find(params[:id])\n \tcurrent_user\n \t@favorite = Favorite.find(@task.favorite_id)\n\n respond_to do |format|\n format.js { render 'demo/update_api' }\n end\n end", "def create\n @favorite = current_user.favoritables.build(favorite_params)\n\n if @favorite.save\n render json: @favorite, status: :created\n else\n render json: @favorite.errors, status: :unprocessable_entity\n end\n end", "def create\n note = Note.active.find(params[:note_id])\n fav = current_user.favorites.find_by_note_id(note)\n params[:point] = 1 unless params[:point].to_i > 0\n if fav\n Favorite.update_counters(fav.id, point: params[:point].to_i)\n else\n current_user.favorites.create(note: note, point: params[:point].to_i)\n end\n head :no_content\n end", "def create\n @favorite = user.favorites.new(favorite_params)\n\n if @favorite.save\n render :show, status: :ok\n else\n render json: @favorite.errors, status: :unprocessable_entity\n end\n end", "def set_favorite_recipe\n @favorite_recipe = FavoriteRecipe.find(params[:id])\n end", "def favorite_params\n params.require(:favorite).permit(:name, :location_id, :user_id)\n end", "def destroy\n post = Post.find(params[:post_id]) \n favorite = current_user.favorites.find(params[:id])\n \n # Checkpoint #55 - Favoriting\n #\n # Let's add authorization to favorites_controller.rb. Add authorize favorite before the if statements in the create and destroy methods.\n authorize favorite\n \n if favorite.destroy\n flash[:notice] = \"Favorite status was removed.\"\n redirect_to [post.topic, post]\n else\n flash[:error] = \"There was an error removing the favorite status. Please try again.\"\n redirect_to [post.topic, post]\n end\n end", "def update\n if @favorite.update(favorite_params)\n render :show, status: :ok\n else\n render json: @favorite.errors, status: :unprocessable_entity\n end\n end", "def set_favour\n @favour = Favour.find(params[:id])\n end", "def status\n if self.status_id && !self.status_id.empty?\n self.status_id\n else\n \"new\"\n end\n end", "def user_favorite\r\n\t\t\tif params[:is_add] == '1'\r\n\t\t\t\trender json: UsersFavoriteProject.add_favorite(params[:id])\r\n\t\t\telse\r\n\t\t\t\trender json: UsersFavoriteProject.remove_favorite(params[:id])\r\n\t\t\tend\r\n\t\tend", "def fav\n @job = Job.find(params[:id])\n\n\t\t@favorite = Favorite.new(:person_id => current_user.id, :job_id => @job.id)\n\t\[email protected]\n\t\tflash[:notice] = 'Job successfully marked as Favorite.'\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to(:back) }\n\t\t\tformat.xml { head :ok }\n\t\t\tformat.js\n\t\tend\n end", "def favorites\n if params[:id]\n if params[:id].to_i.to_s == params[:id]\n\t@user = User.find(params[:id])\n else\n\t@user = User.find(:first, :conditions => [\"username=?\", params[:id]])\n end\n else\n @user = @current_user\n end\n\n @beu = @user.following_by_type('Beu')\n end", "def set_favorite\n @favorite = Album.find(params[:id])\n end", "def pending_repost?\n self.review_status_id == ReviewStatus.find(:first,\n :conditions => \"name='Pending Repost'\").id\n end", "def mark_as_favourite\n id = params[:id].to_i\n unless session[:favourite_song].include?(id)\n session[:favourite_song] << id \n end\n redirect_to \"/song/index\"\n end", "def approve\n order = current_user.restaurant.orders.find(params[:id])\n order.update(status: 1)\n render json: {is_success: true}, status: :ok\n end", "def update\n @favor = Favor.find(params[:id])\n\n if @favor.status == 'taken' && params[:favor]['status'] == 'taken' && @favor.helper_id != params[:favor]['helper_id']\n render :nothing => true , :status => 409\n\n else\n respond_to do |format|\n if @favor.update_attributes(params[:favor])\n if @favor.status == 'closed'\n # If the owner just accepted this favor, credit the helper with the points.\n @user = User.find(@favor.helper_id)\n @user.points = @user.points + @favor.earned\n @user.save\n end\n format.html { redirect_to @favor, notice: 'Favor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @favor.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def favor\n is_supporter = @post.has_supporter? @p\n is_opponent = @post.has_opponent? @p\n if is_supporter\n #flash[:notice] = 'You have supported this post already.' \n favor_response false\n else \n if is_opponent\n @favor = @post.unfavors.find(:first, :conditions => {:owner_id => @p})\n @post.decrement!(:unfavor_count)\n else\n @favor = Favor.create(:post_id => @post.id, :owner_id => @p.id, :liked => true)\n end\n @post.increment!(:favor_count)\n favor_response @favor.update_attribute(:liked, true)\n end\n end", "def update\n @favorite = Favorite.find(params[:id])\n\n respond_to do |format|\n if @favorite.update_attributes(params[:favorite])\n format.html { redirect_to @favorite, notice: 'Favorite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @favorite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @favorite = Favorite.find(params[:id])\n\n respond_to do |format|\n if @favorite.update_attributes(params[:favorite])\n format.html { redirect_to @favorite, notice: 'Favorite was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @favorite.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_favorite_params\n params.require(:favorite).permit(:author_id, :project_id)\n end", "def create\n @book = Book.find(params[:book_id])\n @user = current_user\n @favorite = current_user.favorites.new(book_id: @book.id)\n @favorite.save\n end", "def favorite\n \tfavorited_texto = read_favorited_texto # Get all already voted texto\n \t\n \tif !favorited_texto.include?(params[:id])\n \t\t@texto = Texto.find(params[:id])\n\t\t write_favorited_texto(params[:id])\n\t respond_with(@texto)\n\tend \n end", "def toggle_favorite\n if user_signed_in?\n \t@user = current_user\n \t\n \t# toggle. so, if it's there, remove it\n \tif @user.favorite_listings.include?(params[:listing_id]) then\n \t\t\[email protected]_listings.delete(params[:listing_id])\n \t\t\tmessage = 'removed'\n \t\telse\n \t\t\t# else, we'll add it\n \t\t\[email protected]_listings << params[:listing_id] unless @user.favorite_listings.include?(params[:listing_id])\n \t\t\tmessage = 'added'\t\t\n \t\tend\n \t\t\n \t\[email protected]\n \tend\n\t\n\trender :text => message\n \n end", "def create\n @favorite = Favorite.new(client_id: current_user.id, route_id: params[:route_id])\n\n respond_to do |format|\n if @favorite.save\n format.html { redirect_to @favorite, notice: 'Favorite was successfully created.' }\n format.json { render :show, status: :created, location: @favorite }\n else\n format.html { render :new }\n format.json { render json: @favorite.errors, status: :unprocessable_entity }\n end\n end\n end", "def favourite_tweets_since id\n twitter_client.favorites since_id: id.to_s\n end" ]
[ "0.7152173", "0.68760675", "0.63178813", "0.63049525", "0.6289387", "0.6196214", "0.61899394", "0.61759263", "0.6161575", "0.6160793", "0.6160793", "0.61522055", "0.61522055", "0.61522055", "0.61522055", "0.61522055", "0.61522055", "0.6151924", "0.60981953", "0.60981566", "0.6092486", "0.6092109", "0.6086051", "0.6080879", "0.6077702", "0.6064507", "0.6064507", "0.6064507", "0.60379446", "0.6013831", "0.5959391", "0.5955363", "0.59200525", "0.59110606", "0.5910295", "0.590506", "0.5880006", "0.58745855", "0.58745855", "0.58745855", "0.58745855", "0.5867756", "0.5867756", "0.5867756", "0.5867756", "0.5867756", "0.5867756", "0.5867756", "0.5867756", "0.5867756", "0.5867756", "0.5867756", "0.5867756", "0.5867756", "0.5867756", "0.5862037", "0.5859263", "0.58579355", "0.58415014", "0.5827547", "0.5818679", "0.58158916", "0.5812355", "0.58094746", "0.5802709", "0.578813", "0.57823277", "0.5777561", "0.5777171", "0.5775183", "0.57613003", "0.5758545", "0.5735093", "0.5694459", "0.56938547", "0.5692347", "0.5689734", "0.56860614", "0.5681835", "0.5674623", "0.5673305", "0.5666202", "0.566599", "0.5665281", "0.56647265", "0.56521136", "0.5649222", "0.5648703", "0.5642972", "0.56272787", "0.56268895", "0.5622485", "0.56138253", "0.5610192", "0.5610192", "0.56092024", "0.56020653", "0.5599497", "0.557637", "0.55762", "0.5574322" ]
0.0
-1
POST, DELETE id. Required. The ID of the status to unfavorite. Ex: or
def destroy end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_status(id)\n delete(\"/statuses/#{id}\")\n end", "def unfavorite(id)\n post(\"/favorites/destroy/#{id}.json\")\n end", "def destroy_status(status_id)\n delete \"statuses/destroy/#{status_id}\"\n end", "def delete_status(status_id)\n\t\t\tdata = oauth_request(\"/user_status/destroy/#{status_id}\", {}, \"post\")\n\t\tend", "def delete; update(:status => 'DELETED'); end", "def destroy\n @status = Status.find(params[:id])\n @status.destroy\n flash[:notice] = 'Status deleted'\n \n respond_to do |format|\n format.html { redirect_to(statuses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @oferta = Oferta.find(params[:id])\n @oferta.update_attributes :status => Status.find_by_descricao('Inativo')\n\n respond_to do |format|\n format.html { redirect_to admin_ofertas_path }\n format.json { head :ok }\n end\n end", "def destroy\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.find(params[:id])\n @status.destroy\n\n respond_to do |format|\n format.html { redirect_to statuseses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n post = Post.find(params[:post_id]) \n favorite = current_user.favorites.find(params[:id])\n \n # Checkpoint #55 - Favoriting\n #\n # Let's add authorization to favorites_controller.rb. Add authorize favorite before the if statements in the create and destroy methods.\n authorize favorite\n \n if favorite.destroy\n flash[:notice] = \"Favorite status was removed.\"\n redirect_to [post.topic, post]\n else\n flash[:error] = \"There was an error removing the favorite status. Please try again.\"\n redirect_to [post.topic, post]\n end\n end", "def destroye\n self.update_attribute(:status,7)\n end", "def destroy\n @status = Status.find(params[:id])\n @status.destroy\n\n respond_to do |format|\n format.html { redirect_to(statuses_url) }\n format.xml { head :ok }\n end\n end", "def unfav\n @favorite = Favorite.find(\n :first,\n :conditions => ['person_id = ? AND job_id = ?', current_user, params[:id] ],\n :limit => 1\n )\n\t\[email protected]\n\t\tflash[:notice] = 'Job successfully unmarked as Favorite.'\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to(:back) }\n\t\t\tformat.xml { head :ok }\n\t\t\tformat.js\n\t\tend\n end", "def destroy\n @status = Status.find(params[:id])\n @status.destroy\n\n respond_to do |format|\n format.html { redirect_to profile_path(current_user) }\n format.json { head :no_content }\n end\n end", "def destroy\n @new_status = NewStatus.find(params[:id])\n @new_status.destroy\n\n respond_to do |format|\n format.html { redirect_to new_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @status = Status.find(params[:id])\n @status.destroy\n\n redirect_to statuses_url\n end", "def destroy\n @invite_status = InviteStatus.find(params[:id])\n @invite_status.destroy\n\n respond_to do |format|\n format.html { redirect_to invite_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kf_status = Kf::Status.find(params[:id])\n @kf_status.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/kf/statuses?page=#{params[:page]}&relation_id=#{params[:relation_id]}&status_type=#{params[:status_type]}&count_type=#{params[:count_type]}\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @status_ativ = StatusAtiv.find(params[:id])\n @status_ativ.destroy\n\n respond_to do |format|\n format.html { redirect_to status_ativs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @request_status = RequestStatus.find(params[:id])\n @request_status.destroy\n\n respond_to do |format|\n format.html { redirect_to request_statuses_url }\n format.json { head :no_content }\n end\n end", "def delete(project_token = @project_token, id = @id, user = @@default_user)\n @attributes = send_request(\"statuses/#{id}\", :delete) do |req|\n req.body = {\n token: project_token,\n auth_token: user.auth_token\n }\n end\n end", "def destroy\n @status = Status.find(params[:id])\n @status.destroy\n\n respond_to do |format|\n format.html { redirect_to(statuss_url) }\n format.xml { head :ok }\n end\n end", "def destroy_favorite(id)\n delete \"favorites/destroy/#{id}\"\n end", "def destroy\n if can? :delete, @status\n @status.destroy\n respond_to do |format|\n\n format.html { redirect_to statuses_url, notice: 'Status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end", "def unsuscribe\n @estate = Estate.find(params[:id])\n @estate.update_attribute(:status, false)\n respond_to do |format|\n format.html { redirect_to estates_url, notice: 'Propiedad dada de baja exitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @itemstatus = Itemstatus.find(params[:id])\n @itemstatus.destroy\n\n respond_to do |format|\n format.html { redirect_to itemstatuses_url }\n format.json { head :ok }\n end\n end", "def destroy\n @status.destroy\n respond_to do |format|\n format.html { redirect_to statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @idea_status = IdeaStatus.find(params[:id])\n @idea_status.destroy\n\n respond_to do |format|\n format.html { redirect_to idea_statuses_url }\n format.json { head :ok }\n end\n end", "def delete()\n\n client.delete(\"/project_statuses/#{gid}\") && true\n end", "def destroy\n @cooperativa = Cooperativa.find(params[:id])\n @cooperativa.update_attributes :status => Status.find_by_descricao('Inativo')\n\n respond_to do |format|\n format.html { redirect_to admin_cooperativas_path }\n format.json { head :ok }\n end\n end", "def destroy\n ok=current_user.delete_favourite(params[:id])\n render_success(ok ? \"Favourite deleted\" : \"Favourite not found\")\n end", "def destroy\n @notes = Note.all\n # @note = Note.find_by_id(params[:id])\n @note.update(status: true)\n # redirect_to notes_path\n end", "def remove\n if status == \"pending\"\n reject\n else\n destroy\n end\n end", "def destroy\n respond_with Favor.destroy(params[:id])\n end", "def destroy\n @active_status = ActiveStatus.find(params[:id])\n @active_status.destroy\n\n respond_to do |format|\n format.html { redirect_to(active_statuses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @status = Status.find(params[:id])\n if session[\"user_id\"] == @status.user_id\n @status.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to statuses_url }\n # format.json { head :ok }\n format.js { render :action => 'destroy.js.coffee', :content_type => 'text/javascript'}\n end\n end", "def destroy\n @flavor.active=\"false\"\n @flavor.save\n respond_to do |format|\n format.html { redirect_to flavors_url, notice: 'Flavor was successfully made inactive.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @civil_status = CivilStatus.find(params[:id])\n @civil_status.destroy\n\n respond_to do |format|\n format.html { redirect_to civil_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @listing_status = ListingStatus.find(:first, :conditions => [\"id = ?\", params[:id]], :select => 'id, description, position, is_final', :order => 'description')\n ListingStatus.clear_cached(params[:id])\n ListingStatus.clear_cached_from_description(@listing_status.description)\n @listing_status.destroy\n respond_to do |format|\n format.html { redirect_to(listing_statuses_url) }\n format.xml { head :ok }\n end\n end", "def remove!\n self.update_attributes(status: REMOVED, featured: false)\n end", "def remove!\n self.update_attributes(status: REMOVED, featured: false)\n end", "def remove!\n self.update_attributes(status: REMOVED, featured: false)\n end", "def destroy\n @user = User.find(params[:id])\n @user.status = 'deleted'\n @user.save!\n\n respond_to do |format|\n format.json { render :json => \"success\" }\n end\n end", "def destroy\n # @ideia = Ideia.find(params[:id])\n @ideia = current_usuario.ideias.find(params[:id])\n \n # only draft, submitted or rejected ideias can be deleted by the user\n if (@ideia.status < 3)\n @ideia.destroy\n else\n flash[:error] = 'Essa ideia não pode ser removida.' \n end\n\n respond_to do |format|\n format.html { redirect_to(ideias_url) }\n format.xml { head :ok }\n end\n end", "def remove!\n self.update_attribute(:status, REMOVED)\n end", "def remove!\n self.update_attribute(:status, REMOVED)\n end", "def destroy\n @reqstatus.destroy\n respond_to do |format|\n format.html { redirect_to reqstatuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n favorite = Favorite.find(params[:id])\n\n if favorite.user_id == current_user.id\n favorite.destroy\n render text: \"deleted\"\n else\n render text: \"You can't delete that favorite!\"\n end\n end", "def destroy\n @post = @favourite.fav_post\n @favourite.destroy\n sync_update @post\n respond_to do |format|\n format.html { redirect_to :my_favourites, notice: 'Favourite was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n favor = Favor.where(:user_id => params[:user_id], :post_id => params[:post_id])\n favor.destroy\n render :json => {:ok => true}, :head => :no_content\n end", "def destroy\n @post.update(status: \"hidden\")\n respond_to do |format|\n format.html { redirect_to posts_url, notice: 'Post ha sido borrado.' }\n format.json { head :no_content }\n end\n end", "def del_message # for user it is delte but in db it change status to false\t\n\t\tmid = Base64.decode64(params[:id])\t\t\t \n\t\ttype = params[:type]\t\t\t \n\t\tmessage = Message.find(mid)\t\n\t\tif params[:type]=='self' \n\t\t\tmessage.update_attributes(status: false)\n\t\telse\n\t\t\tmessage.update_attributes(recipient_status: false)\n\t\tend\n\t\t\t\n\t if message \n\t\t render :json => mid and return \n\t else\n\t\t render :json => {errors: \"Please Try Again!\"} and return\n\t end\t\n\tend", "def destroy\n @task = Task.find(params[:id])\n @task.status_id = Status.find_by_title('trash').id\n @task.deleted_at = Time.now\n @task.save\n \n respond_to do |format|\n format.html { redirect_to(:back) }\n format.xml { head :ok }\n format.js { head :ok }\n end\n end", "def destroy\n @pet_status = PetStatus.find(params[:id])\n @pet_status.destroy\n\n\n redirect_to pet_statuses_url\n \n end", "def destroy\n @status_item.destroy\n respond_to do |format|\n format.html { redirect_to status_items_url, notice: 'El estatus del articulo fue eliminado.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @order_status = OrderStatus.find(params[:id])\n\n respond_to do |format|\n if @order_status.destroy\n format.html { redirect_to order_statuses_url,\n notice: (crud_notice('destroyed', @order_status) + \"#{undo_link(@order_status)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to order_statuses_url, alert: \"#{@order_status.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @order_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n ActiveRecord::Base.transaction do\n # Validate if status can be deleted\n unless @status.can_be_deleted?\n error_message = 'El Estado no puede borrarse porque esta en uso.'\n respond_to do |format|\n format.html { redirect_to statuses_url, notice: error_message }\n format.json { render json: [error_message], status: :unprocessable_entity }\n end\n return\n end\n\n # Delete status permanently\n @status.destroy\n respond_to do |format|\n format.html { redirect_to statuses_url, notice: 'El Estado se elimino permanentemente.' }\n format.json { head :no_content }\n end\n end\n end", "def unfavorite\n current_user.unfavorite_topic(@topic.id)\n render json: {ok: 1}\n end", "def destroy\n @favorite = Favorite.find(params[:id])\n @favorite.destroy\n\n respond_to do |format|\n format.html { redirect_to favorites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @applicant_status = ApplicantStatus.find(params[:id])\n @applicant_status.destroy\n\n respond_to do |format|\n format.html { redirect_to(applicant_statuses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @todo = Todo.find(params[:id])\n @todo.destroy\n respond_to do |format|\n format.html { redirect_to todos_path(:filter_project => params[:filter_project], :filter_status => params[:filter_status], :exclude_status => params[:exclude_status]) }\n format.json { head :ok }\n end\n end", "def delete_favourite\n Favorite.find(:first, :conditions => [\"user_id =? AND favorable_id =?\", session[:user_id], params[:id]]).destroy\n flash[:notice] = \"Favourite removed\"\n redirect_to(:action => 'index')\n end", "def uncomplete_item(id)\n record \"/todos/uncomplete_item/#{id}\"\n end", "def destroy\r\n @status_task = StatusTask.find(params[:id])\r\n @status_task.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to status_tasks_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @invoice_status = InvoiceStatus.find(params[:id])\n @invoice_status.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @status.destroy\n respond_to do |format|\n format.html { redirect_to statuses_url, notice: 'Status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @status.destroy\n respond_to do |format|\n format.html { redirect_to statuses_url, notice: 'Status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n respond_to do |format|\n begin\n @tweet = TweetApp::ClientContext.status(:delete, params[:id])\n flash[:message] = \"Tweet with id #{params[:id]} was deleted from Twitter\"\n format.html { redirect_to tweets_url }\n format.json { head :ok }\n format.xml { head :ok }\n rescue Twitter::RESTError => re\n handle_rest_error(re, format)\n end\n end\n end", "def toggle_status\n @judge = Judge.find(params[:id])\n authorize @judge\n\n if @judge.active?\n @judge.update_attribute(:status, \"removed\")\n else\n @judge.update_attribute(:status, \"active\")\n end\n redirect_back(fallback_location: result_competition_path(@judge.competition))\n end", "def destroy\n if (user_signed_in? && ([2].include?(current_user.role)))\n @cultural_heritage_state = CulturalHeritage::State.find(params[:id])\n mensaje = @cultural_heritage_state.erasable\n if mensaje.blank?\n @cultural_heritage_state.deleted = 1\n @cultural_heritage_state.save\n end\n respond_to do |format|\n format.html { redirect_to(cultural_heritage_states_url, :notice => mensaje) }\n format.xml { head :ok }\n end\n else\n respond_to do |format|\n format.html { redirect_to(new_user_session_path) }\n end\n end\n end", "def destroy\n @nvs_mig_status = NvsMigStatus.find(params[:id])\n @nvs_mig_status.destroy\n\n respond_to do |format|\n format.html { redirect_to nvs_mig_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @status_animal = StatusAnimal.find(params[:id])\n @status_animal.destroy\n\n respond_to do |format|\n format.html { redirect_to status_animais_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @subcategoria = Subcategoria.find(params[:id])\n @subcategoria.update_attributes :status => Status.find_by_descricao('Inativo')\n\n respond_to do |format|\n format.html { redirect_to admin_subcategorias_path }\n format.json { head :ok }\n end\n end", "def destroy\n @status = @object\n @status.destroy\n flash[:error] = @status.errors.on_base unless @status.errors.empty?\n\n respond_to do |format|\n format.html { redirect_to statuses_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @inventory_status = InventoryStatus.find(params[:id])\n @inventory_status.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @categoria = Categoria.find(params[:id])\n @categoria.update_attributes :status => Status.find_by_descricao('Inativo')\n\n respond_to do |format|\n format.html { redirect_to admin_categorias_path }\n format.json { head :ok }\n end\n end", "def destroy\n @usage_status = UsageStatus.find(params[:id])\n @usage_status.destroy\n\n respond_to do |format|\n format.html { redirect_to(usage_statuses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @red_flag = RedFlag.find(params[:id])\n @red_flag.destroy\n\n respond_to do |format|\n format.html { redirect_to red_flags_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @feature_status = FeatureStatus.find(params[:id])\n @feature_status.destroy\n\n respond_to do |format|\n format.html { redirect_to(feature_statuses_url) }\n format.xml { head :ok }\n end\n end", "def delete(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id)\n\t\t\tclient.queue_service_action_call('favorite', 'delete', 'bool', 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 destroy\n @record_status = RecordStatus.find(params[:id])\n @record_status.destroy\n\n respond_to do |format|\n format.html { redirect_to record_statuses_url }\n format.json { head :no_content }\n end\n end", "def unsave\n post(\"/api/unsave\", id: fullname)\n end", "def destroy\n forced? ? @user.destroy! : @user.deactivate!\n render json: StatusSerializer.new(:deleted), status: :ok\n end", "def delete(vault_id)\n update(vault_id, false, { :status => 'C' })\n end", "def delete(id)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'id', id)\n\t\t\tclient.queue_service_action_call('socialaction', 'delete', 'KalturaNetworkActionStatus', 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 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 destroy\n authorize @promotion\n\n if @promotion.update({active: false})\n render json: { status: :ok }\n else\n render json: { status: :unprocessable_entity}\n end\n end", "def destroy\n @purchase_item_status = PurchaseItemStatus.find(params[:id])\n @purchase_item_status.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_item_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @favorite = Favorite.find(params[:id])\n @favorite.destroy\n\n respond_to do |format|\n format.html { redirect_to favorites_url , notice: '削除しました。'}\n format.json { head :no_content }\n end\n end", "def destroy\n @typeofstatus.destroy\n respond_to do |format|\n format.html { redirect_to typeofstatuses_url, notice: 'Typeofstatus was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @task_type = @project.task_types.find(params[:id])\n @task_type.update_attributes(:active => 0)\n\n respond_to do |format|\n format.html { redirect_to task_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n favorite = Favorite.find(params[:id])\n favorite.destroy\n redirect_to :back\n end", "def destroy\n @current_statuses.destroy\n respond_to do |format|\n format.html { redirect_to current_statuses_url, notice: 'Current Statuses was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n errors ||= Array.new\r\n if params[:id].blank? && Posts.isExists(params[:id].to_i)\r\n errors.push(I18n.t(\"errors.messages.element_not_id\"))\r\n end\r\n if errors.length == 0 \r\n postObj = Posts.find_by_id(params[:id].to_i)\r\n postObj.is_delete = true\r\n postObj.save\r\n self.default_response\r\n else\r\n render :json => Api::Init.ShowErrorJson(API_CODE_ERRORS['Services']['Global']['formInputError'],I18n.t(\"errors.messages.feelike.input_error\"), errors).to_json\r\n end\r\n end", "def destroy\n @reqdevstatus.destroy\n respond_to do |format|\n format.html { redirect_to reqdevstatuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authenticate!\n if Dislike.find(params[:id]).user_id == current_user.id\n Dislike.destroy(params[:id])\n render json: { message: 'Item deleted' }\n else\n render:json => { :msg => \"Dislike deletion failed..\" }, :status => :bad_request\n end\n end", "def destroy\n @favourite = Favourite.find(params[:id])\n @favourite.destroy\n\n respond_to do |format|\n format.html { redirect_to(favourites_url) }\n format.xml { head :ok }\n end\n end", "def delete(id)\n Mailgun.submit :delete, webhook_url(id)\n end", "def destroy\n @pullRequest = PullRequest.find(params[:id])\n\n\t\[email protected] = \"REJECTED\"\n if @pullRequest.save\n\t\t\trespond_with(@pullRequest)\n\t\telse\n\t\t\trender json: {error: \"An error occurred while rejecting the pull request\"}\n end\n end", "def destroy\n @droplet = Droplet.find(params[:id])\n\[email protected] = current_user\n @droplet.status = Status.find_by_name(\"removed\")\n @droplet.save\n\n respond_to do |format|\n format.html { redirect_to droplets_url }\n format.json { head :ok }\n end\n end", "def logical_delete\n if is_main?\n resource.status = 'DELETED'\n resource.save\n else\n destroy\n end\n end" ]
[ "0.72752786", "0.7070454", "0.68769014", "0.6852058", "0.6839362", "0.6699654", "0.66824615", "0.66812325", "0.6631598", "0.65690213", "0.65616935", "0.6549714", "0.653552", "0.653126", "0.65310836", "0.64913154", "0.6474335", "0.6443647", "0.64114666", "0.6405594", "0.6399868", "0.6305946", "0.6303506", "0.62802696", "0.62702465", "0.6267393", "0.6263077", "0.6247524", "0.6243512", "0.62361157", "0.6207816", "0.62039703", "0.6201993", "0.61963075", "0.61743927", "0.61739665", "0.61706054", "0.616212", "0.61559975", "0.61559975", "0.61559975", "0.6142674", "0.6138021", "0.61369485", "0.61369485", "0.613188", "0.61309725", "0.6115217", "0.6098159", "0.6078143", "0.6075156", "0.6072468", "0.6071052", "0.6066142", "0.6057511", "0.6040662", "0.60355407", "0.6030302", "0.6024396", "0.60242176", "0.60185534", "0.60181886", "0.60151064", "0.60133016", "0.6003324", "0.5992508", "0.5992508", "0.5980025", "0.5979269", "0.5976488", "0.59747374", "0.5973916", "0.597223", "0.5963952", "0.59589624", "0.5954606", "0.5953892", "0.59514296", "0.5947301", "0.5939645", "0.593512", "0.59324515", "0.59275067", "0.5926649", "0.59226584", "0.5912638", "0.59124887", "0.5910792", "0.590742", "0.5903051", "0.5902833", "0.5894058", "0.5893839", "0.58861154", "0.58835894", "0.58834", "0.58808964", "0.5880678", "0.5879901", "0.5872368", "0.5865346" ]
0.0
-1
used by rake cron task to broadcast newsletters
def broadcast(contact) self.processing! ApplicationMailer.newsletters(contact, self).deliver_now rescue self.failed! self.sent! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def daily_morning\n logger.info \" daily_morning\"\n run('Newsletter', :send!)\n end", "def perform\n @newsletter = create_newsletter\n send_emails\n end", "def weekly\n @greeting = \"Hello\"\n mail subject: args[:subject], to: args[:emails]\n mail to: \"[email protected]\"\n end", "def send_welcome_newsletter\n WelcomeNewsletterJob.set(wait: 10.seconds).perform_later(@newsletter_user, @newsletter_setting)\n end", "def event_mail\n NoticePlannerMailer.delay.notice_planner_email('[email protected]', 'test', 'cron-test', 'https://yahoo.co.jp')\n end", "def send_to_all\n User.newsletters_allowed.each do |user|\n UserMailer.delay.new_newsletter(user, self)\n end\n end", "def news\n InformationMailer.news\n end", "def newsletter_email(newsletter)\n @newsletter = newsletter\n\tmail(to: @newsletter.email, subject: \" Alex Shyaka from the Therailsshop coding club\")\n end", "def news(email, newsletter)\n @email = email\n @newsletter = newsletter\n\n mail to: email, :subject => newsletter.title\n end", "def Clockwork\n puts \"testing clockwork!\"\n every(30.seconds, 'Send Messages') {\n rake 'scheduler:send_messages'\n mail(:to => \"[email protected]\", subject: 'hello')\n }\n \nend", "def newsletter\n @greeting = \"Hi\"\n\n mail :to => \"[email protected]\"\n end", "def admin_broadcast(desired_locale, emails_as_string, subject, body)\n ActionMailer::Base.smtp_settings = APP_CONFIG[:admin_mail]\n set_locale( desired_locale )\n\n @content_type = \"text/html\"\n @recipients = \"[email protected]\"\n @bcc = emails_as_string\n @from = head_encode(\"\\\"Kroogi (No Reply)\\\"\".t) + \" <[email protected]>\"\n @subject = head_encode(\"[Kroogi] \" + subject)\n @sent_on = Time.now\n @body[:url] = \"http://#{APP_CONFIG[:hostname]}/\"\n @body[:body] = body\n end", "def deliver\n #find all the abonnes emails\n @abonnes = Abonne.all.collect(&:email)\n # Sends the newsletter to each one\n @abonnes.each do |abonne|\n NewsletterMailer.deliver_newsletter(abonne, self)\n end\n # Set the delivered_at time to now\n self.update_attribute(:delivered_at, Time.now)\n end", "def define_announce_tasks\n\n\t\t# Avoid broken Hoe 3.0 task\n\t\tRake::Task[:announce].clear if Rake::Task.task_defined?( :announce )\n\t\tRake::Task[:send_email].clear if Rake::Task.task_defined?( :send_email )\n\n\t\tdesc \"Announce a new release\"\n\t\ttask :announce => :send_email\n\n\t\tdesc \"Send a release announcement to: %p\" % [ @email_to ]\n\t\ttask :send_email do\n\t\t\tmail = generate_mail()\n\n\t\t\tsay \"<%= color 'About to send this email:', :subheader %>\"\n\t\t\tsay( mail.to_s )\n\n\t\t\tsmtp_host = @email_config['host'] || ask( \"Email host: \" )\n\t\t\tsmtp_port = @email_config['port'] || 'smtp'\n\t\t\tsmtp_port = Socket.getservbyname( smtp_port.to_s )\n\t\t\tsmtp_user = @email_config['user']\n\n\t\t\tif agree( \"\\n<%= color 'Okay to send it?', :warning %> \")\n\t\t\t\trequire 'socket'\n\t\t\t\trequire 'net/smtp'\n\t\t\t\trequire 'etc'\n\n\t\t\t\tusername = smtp_user || ask( \"Email username: \" ) do |q|\n\t\t\t\t\tq.default = Etc.getlogin # default to the current user\n\t\t\t\tend\n\t\t\t\tpassword = ask( \"Email password for #{username}: \" ) do |q|\n\t\t\t\t\tq.echo = color( '*', :yellow ) # Hide the password\n\t\t\t\tend\n\n\t\t\t\tsay \"Creating SMTP connection to #{smtp_host}:#{smtp_port}\"\n\t\t\t\tsmtp = Net::SMTP.new( smtp_host, smtp_port )\n\t\t\t\tsmtp.set_debug_output( $stdout )\n\t\t\t\tsmtp.esmtp = true\n\n\t\t\t\tssl_context = OpenSSL::SSL::SSLContext.new\n\t\t\t\tsmtp.enable_starttls( ssl_context )\n\n\t\t\t\thelo = Socket.gethostname\n\t\t\t\tsmtp.start( helo, username, password, :plain ) do |smtp|\n\t\t\t\t\tmail.delivery_method( :smtp_connection, :connection => smtp )\n\t\t\t\t\tmail.deliver\n\t\t\t\tend\n\n\n\t\t\telse\n\t\t\t\tabort \"Okay, aborting.\"\n\t\t\tend\n\t\tend\n\n\tend", "def send_newsletter_email\n UserMailer.newsletter_confirmation(self).deliver_later\n end", "def send_newsletter(to,sha1_id,from, newsletter_subject, description, newsletter_body)\n recipients to\n from from\n\t\tsubject newsletter_subject\n\t\tbody :description => description, :newsletter_body => newsletter_body, :site => self.site_name,:sha1_id => sha1_id,:url => self.daurl\n sent_on Time.now\n content_type \"text/html\"\n end", "def handle_news\n @feeder.send_feed(message.chat.id)\n end", "def perform (from=nil)\n if from.nil?\n subscribers = Octo::Subscriber.where(created_at: 24.hours.ago..Time.now.floor)\n else\n subscribers = Octo::Subscriber.where(created_at: from..Time.now.floor)\n end\n # MAIL CODE\n Octo.get_config(:email_to).each { |x|\n opts1 = {\n text: \"Today number of new susbcribes are \" + subscribers.length,\n name: x.fetch('name')\n }\n Octo::Email.send(x.fetch('email'), subject, opts1)\n }\n end", "def monthly\n @greeting = \"Hello\"\n mail subject: args[:subject], to: args[:emails]\n mail to: \"[email protected]\"\n end", "def newsletter(newsletter, user)\n @newsletter = newsletter\n @greeting = \"Repeat Eats Newsletter!\"\n mail to: user.email, subject: @newsletter.title\n end", "def send_notifications\n end", "def weekly(newsletter)\n# attachments.inline['yes.png'] = File.read(\"#{Rails.root}/public/images/yes.png\")\n @newsletter = newsletter\n @version = @newsletter.version\n @campaign = @version.campaign\n @email = @newsletter.customer.email\n\n mail from: @campaign.from_email, to: @email, subject: @campaign.subject \n end", "def send_email\n AlertNotifier.delay.email_back_office_announcement(self)\n end", "def deliver\n newsletter_id = params[:id].to_i\n email_addr = params[:email].blank? ? params[:custom_email] : params[:email]\n\n # send_log_to = Rails.env == 'production' ? (Rails.application.class)::EMAIL_TO_DEFAULT : (Rails.application.class)::EMAIL_TO_DEVELOPER\n\n command = \"RAILS_ENV=#{Rails.env} #{Rails.root}/script/bash_runner.sh newsletter_emailer NEWSLETTER=#{newsletter_id}\"\n command += \" EMAIL_ADDR_OVERRIDE=#{email_addr}\" if email_addr\n command += \" &\"\n\n Rails.logger.warn(\"Sending newsletter with command #{command}\")\n pid = spawn(command)\n\n flash[:message] = \"started job_runner to do delivery of newsletter # #{newsletter_id} w/ pid #{pid}\"\n redirect_to :action => :show, :id => newsletter_id\n end", "def daily_reading\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end", "def monthly\n NewsletterMailer.monthly\n end", "def send_newsletter(newsletter, recipient)\n @newsletter = newsletter\n @structure = newsletter.structure\n @blocs = @newsletter.blocs.includes(:sub_blocs).order('position ASC')\n\n mail subject: (@newsletter.email_object || @newsletter.title),\n to: recipient,\n from: \"\\\"#{@newsletter.sender_name}\\\" <[email protected]>\",\n reply_to: @newsletter.reply_to\n end", "def weekly_email\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end", "def subscribe_to_newsletter\n SubscribeToNewsletterService.new(self).call\n end", "def send_email(news_info, schedules, client)\n body = create_email news_info, schedules\n m = Mail.new to: @email, from: \"[email protected]\", charset: \"UTF-8\", subject: \"OSU Sports Digest\", body: body\n message_object = Google::Apis::GmailV1::Message.new raw: m.encoded\n client.send_user_message 'me', message_object\n end", "def send_newsletter\n @newsletter = @structure.newsletters.includes(:blocs).find params[:id]\n if @newsletter.ready?\n\n @newsletter.state = 'sending'\n @newsletter.save!\n\n if params[:send_me_a_copy] == 'on'\n NewsletterMailer.delay(queue: 'mailers').send_newsletter(@newsletter, @structure.admin.email)\n end\n NewsletterSender.delay(queue: 'mailers').send_newsletter(@newsletter)\n redirect_to pro_structure_newsletters_path(@structure),\n notice: \"Votre newsletter est en cours d'envoi.\"\n else\n redirect_to pro_structure_newsletter_path(@structure, @newsletter),\n error: \"Erreur lors de l'envoi de la newsletter, veuillez rééssayer.\"\n end\n end", "def send_newsletters\n if User.custom_newsletters\n flash[:success] = _('Ok, newsletter en proceso')\n else\n flash[:error] = _('Oops!')\n end\n redirect_to :root\n end", "def create_notification\n host = ENV['WEB_CLIENT_HOST']\n url = \"http://#{host}/articles/#{article.id}\"\n\n # Notify the article author of the new comment\n subject = \"#{user.name} علق على مقالك '#{article.title}'\"\n body = \"#{user.name} ترك تعليق على مقالك <a href='#{url}' target='blank'>'#{article.title}'</a>. التعليق هو:\\n\\n <blockquote dir='rtl'>#{self.body}</blockquote>\"\n\n if not user.id.equal? article.user.id\n SendEmailsWorker.perform_async(\n subject, body, article.user_id, self.class.name, self.id)\n end\n\n # Notify any users who have commented on the same section (i.e. guid).\n past_commenters = Comment.where(\n guid: guid).includes(:user).collect(&:user).uniq\n subject = \"#{user.name} علق على مقال '#{article.title}'\"\n body = \"#{user.name} ترك تعليق على مقال <a href='#{url}' target='blank'>'#{article.title}'</a> بعد تعليقك. التعليق هو:\\n\\n <blockquote dir='rtl'>#{self.body}</blockquote>\"\n past_commenters.each do |commenter|\n # Don't notify the owner of the article they already have been notified.\n # Or the user who is adding the current comment.\n if (not commenter.id.equal? article.user.id and\n not commenter.id.equal? user.id)\n SendEmailsWorker.perform_async(\n subject, body, commenter.id, self.class.name, self.id)\n end\n end\n\n end", "def launch_email_client(event)\n mail_list = @@item.mail_list\n mail_list = \"private@#{mail_list}.apache.org\" unless mail_list.include? '@'\n\n to = @@item.chair_email\n cc = \"#{mail_list},#{@@item.cc}\"\n\n if @@item.missing\n subject = \"Missing #{@@item.title} Board Report\"\n if @@item.attach =~ /^\\d/\n body = %{\n Dear #{@@item.owner},\n\n The board report for #{@@item.title} has not yet been submitted for\n this month's board meeting. Please try to submit these reports by the\n Friday before the meeting.\n\n Thanks,\n\n #{User.username}\n }\n else\n body = %{\n Dear #{@@item.owner},\n\n The board report for #{@@item.title} has not yet been submitted for\n this month's board meeting. If you or another member of the PMC are\n unable to get it in by twenty-four hours before meeting time, please\n let the board know, and plan to report next month.\n\n https://www.apache.org/foundation/board/reporting#how\n\n Thanks,\n\n #{User.username}\n\n (on behalf of the ASF Board)\n }\n end\n\n # strip indentation; concatenate lines within a paragraph\n indent = body[/^\\s*/]\n body = body.strip().gsub(/#{indent}/, \"\\n\").gsub(/(\\S)\\n(\\S)/, \"$1 $2\")\n else\n subject = \"#{@@item.title} Board Report\"\n body = @@item.comments.join(\"\\n\\n\")\n\n if not body and @@item.text\n monthNames = %w(January February March April May June July August\n September October November December)\n year = Agenda.date.split('-')[0].to_i\n month = Agenda.date.split('-')[1].to_i\n\n subject = \"[REPORT] #{@@item.title} - #{monthNames[month-1]} #{year}\"\n to = @@item.cc\n cc = mail_list\n body = @@item.text\n end\n end\n\n if event.ctrlKey or event.shiftKey or event.metaKey\n @email = {\n to: to,\n cc: cc,\n subject: subject,\n body: body\n }\n\n jQuery('#email-' + @@item.mail_list).modal(:show)\n else\n window.location = \"mailto:#{to}?cc=#{cc}\" +\n \"&subject=#{encodeURIComponent(subject)}\" +\n \"&body=#{encodeURIComponent(body)}\"\n end\n end", "def daily_email\n mail(to: '[email protected],[email protected]', subject: 'Recruit Suite Daily Offer & Commit Tweets')\n end", "def newsletter\n<<<<<<< HEAD\n HhMailer.newsletter\n=======\n HhMailer.newsletter(Home.all)\n>>>>>>> 33a2a16302cd13e30f994602051fd115a1b09b64\n end", "def tick \n mailer.messages.each do |request| \n response = mailer.new_message(:to => request.from, \n :from => settings.service.default_sender)\n\n process_request(request, response) && response.deliver\n end\n rescue StandardError => e\n logger.fatal(\"SERVER ERROR\") { \"#{e.inspect}\\n\" + e.backtrace.join(\"\\n \") }\n raise\n end", "def email_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 send_mail\n @url = \"http://www.whwater.com/news/tstz/\"\n @planned_notices = fetch_notices \"http://www.whwater.com/news/jhxts/Index.html\"\n @emergent_notices = fetch_notices \"http://www.whwater.com/news/tfxts/Index.html\"\n if changed_in_website?\n TabWaterMailer.tab_water_info(@planned_notices, @emergent_notices, @url).deliver\n end\n end", "def news_added(user, news)\n redmine_headers 'Project' => news.project.identifier\n @author = news.author\n message_id news\n references news\n @news = news\n @user = user\n @news_url = url_for(:controller => 'news', :action => 'show', :id => news)\n mail :to => user,\n :subject => \"[#{news.project.name}] #{l(:label_news)}: #{news.title}\"\n end", "def notify_subscribers\n NewAnswerNotificationMailer.notify_subscribers\n end", "def notification(params)\n mail(params)\n end", "def day(member)\n puts \"sending for #{member.login}\"\n @day = member.days.latest\n @watchings = @day.watchings\n @followings = @day.followings\n @watchers = @day.watchers\n @followers = @day.followers\n mail from: \"Gitday <[email protected]>\", to: \"#{member.login} <#{member.email}>\", subject: @day.title\n rescue Timeout::Error\n puts \"connect error: #{entry.short_id}\"\n end", "def pubsub; end", "def new_notification\n mail(to: \"[email protected]\", subject: 'New Notification', sent_on: Time.now)\n end", "def newsletter_email\n UserMailer.newsletter_email\n end", "def newsletter(user, subject, text)\n @user = user\n @text = text\n\n mail(to: user.email, subject: subject)\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 mailer; end", "def broadcast_messages\n @info = ['Gol', 'Zmiana','Żółta Kartka','Druga Żółta Kartka','Czerwona Kartka',]\n end", "def notify\n ReminderMailer.notify\n end", "def send_updates(text)\n # The regular expression is to look for keyword(s) and/or limit (integer) in either order\n if text+' ' =~ /\\A\\s*(\\d+)\\W*(.*)/\n limit, keyword = $1, $2\n else\n text+' ' =~ /\\s*(\\w.*?)[, :\\/\\(]+(\\d*)/\n limit, keyword = $2, $1 \n end\n limit = limit.blank? ? nil : limit.to_i\n keyword = keyword.blank? ? nil : keyword.strip\n updates = Message.news_updates(:keyword => keyword, :limit => limit)\n found_without_keyword = false\n # If we found no updates *with* the keyword, then try searching without the keyword and send last 2 entries\n if keyword && updates.empty?\n updates = Message.news_updates(:limit => 2) # try again with no keywords\n found_without_keyword = updates.any?\n end\n updates.each do |u|\n u.deliver_sms(:phone_numbers => @from, :news_update => true) # Don't try to use delayed-job here w present DJ/Heroku setup\n end\n return I18n.t('sms.no_new_updates_with_keyword', :keyword => keyword) if found_without_keyword\n return I18n.t('sms.sending_updates', :count=> updates.count) if updates.any? \n return I18n.t('sms.no_updates_found') \n end", "def send_signup_email(newsletter)\n @newsletter = newsletter\n\tmail(to: @newsletter.email, subject: \" Therailsshop is humbled by your subscription\")\n end", "def data_updates_mail( user, meeting_array = nil )\n @user = user\n @host = GogglesCore::AppConstants::WEB_MAIN_DOMAIN_NAME\n @meeting_array = meeting_array\n mail(\n subject: \"[#{GogglesCore::AppConstants::WEB_APP_NAME}@#{@host}] #{I18n.t('newsletter_mailer.data_updates.generic_title')}\",\n to: user.email,\n date: Time.now\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 = '[email protected]'\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 weekly_update(post)\n @post = post\n email1 = '[email protected]'\n email2 = @post.email\n email3 = '[email protected]'\n recipients = email1, email2, email3\n mail(to: recipients.join(','), subject: 'Weekly email from latest blog posts')\n end", "def reminder_sent\n end", "def send_news\n feed = RSS::Parser.parse open(KAGDEV_RSS).read\n last_post_title = feed.channel.item.title\n\n # Check, whether the latest title of the post at KAG development\n # blog is still the same, as it was, when the fetcher checked it last\n # time.\n return if unchanged?(last_post_title)\n\n item = feed.channel.item\n\n last_post_date = item.pubDate\n last_post_author = item.dc_creator\n last_post_link = item.link\n\n News.create(\n :title => last_post_title,\n :date => last_post_date,\n :author => last_post_author,\n :link => last_post_link\n )\n\n real_author = reveal_author(last_post_author)\n short_link = open(\"http://clck.ru/--?url=#{last_post_link}\").read\n\n Bot::CHANNELS.each do |chan|\n Channel(chan).send I18n.news_fetcher.news(real_author, last_post_title, short_link)\n end\n rescue SocketError\n nil\n end", "def reminder_sms(email)\n @url = 'http://onebreath.io'\n mail(to: email, subject: '', from: '_onebreath')\n end", "def send_announcement_email\n self.send_at = Time.zone.now\n save!\n UserMailer.announcement_notice(self).deliver\n end", "def generate_and_update_newsletter(period, week, month, year)\n newsletter = Newsletter.where(period: period,\n week: week, month: month, year: year,\n community: self).first\n\n return if newsletter.delivered?\n\n if newsletter.nil?\n newsletter = Newsletter.new(period: period,\n week: week, month: month, year: year,\n community: self)\n end\n\n newsletter.update_attributes!(\n users: users,\n links: get_links(period, week, month, year)\n )\n\n newsletter\n end", "def index\n collect_messages\n @message = Message.new\n #Stalker.enqueue('email.send', :to => '[email protected]')\n end", "def send_bulk_email(message, subject = 'Notification')\n client = IronWorkerNG::Client.new\n payload = {}\n payload['message'] = message\n payload['Subject'] = subject\nend", "def argument_daily_digest\n subscriptions = Subscription.find(:all , :conditions => ['status = 1 && daily_digest = 1 && argument_id is not null'])\n subscriptions.each do |sub|\n Mailers::Debate.deliver_send_subscription_email(\"\",sub.argument,sub,HOST_DOMAIN)\n end\n end", "def send_notifications\n DelayedJob.enqueue('NewPostingNotifier',\n Time.now + (CONSTANTS['delay_comment_notifications'].to_i).seconds,\n self.blog.id, self.id\n )\n end", "def notify(recipient, users_posts)\n \n\n @recipient = recipient\n @posts = users_posts\n # @post = post\n # @creator = creator\n # @group = group\n # @post_name = post.title\n # @post_desc = post.description\n #attachments[\"\"]\n mail(:to => recipient.email, :subject => \"New Stuff Today\")\n end", "def newsletter_subscribe_alert(subscriptions, email)\n\t\t@subscriptions = subscriptions\n\t\t@email = email\n\t\tsendgrid_category 'Newsletter-only Subscription Alert'\n\t\tmail subject: \"New newsletter subscriber: #{email} \", to: ADMIN_EMAIL\n\tend", "def article_create\n NotificationMailer.article_create\n end", "def polled_delivery( recipient_email , pending_deliveries )\n @recipient_email = recipient_email \n @user = User.find_by_email @recipient_email \n @pending_deliveries = pending_deliveries\n time = Time.now\n \n mail( :to => recipient_email, \n :subject => \"pilipoto | Updates (#{pending_deliveries.count}): #{time}\", \n :bcc => [\"[email protected]\"] )\n \n end", "def send_notification\n\n\n end", "def call_order\n NewsletterMailer.call_order\n end", "def send_an_email\r\n SendEmails.new(1)\r\n end", "def new_comment_created(recipient,title,from_mail,from_name,comment, link_to_commentable)\n @notify_subject = \"Your entry '#{title}', was commented by #{from_name}\"\n @comment = comment\n @from_name = from_name\n @from_mail = from_mail\n @link_to_commentable = link_to_commentable\n mail( :from => from_mail,\n :to => [ENV['APPLICATION_CONFIG_admin_notification_address'],recipient].uniq,\n :subjcect => @notify_subject\n )\n end", "def broadcast_message(text)\n @users.each {|u| u.enqueue_message(text) }\n end", "def welcome_email\n # NewsletterMailer.welcome_email.deliver\n mail(:to => \"[email protected]\", :subject => \"Welcome to My Awesome Site\")\n end", "def pubsub_adapter; end", "def perform\n current_time = Time.now\n packages = find_packages(city_db_id)\n emails = find_emails(city_db_id)\n\n ## Create list of recipients as array of strings\n recipients = []\n emails.each do |email|\n recipients << email.email_value\n end\n\n Emailer.packages_notification(current_time,packages,recipients).deliver\n end", "def notify(message)\n messages << \"\\n#{message}\"\n send_email(messages) if (@last_sent.nil? || Time.now > (@last_sent + interval * 60))\n end", "def generate_and_update_newsletter_for_current_week\n date = Date.today\n generate_and_update_newsletter(Newsletter::WEEKLY, date.cweek, date.month, date.year)\n end", "def daily_gratitude\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end", "def send_welcome_email\n #if Rails.env.production?\n if email.present?\n if followed_by >= 0\n # to send emails in delayed jobs use\n # UserMailer.instauser_welcome_email(id).delay.deliver!\n UserMailer.instauser_welcome_email(self.id).deliver\n else\n UserMailer.instauser_reject_email(self.id).deliver!\n end\n end\n #end\n end", "def notify_subscribers\n AdminMailer.notify_of_comment(self)\n end", "def send_one_week_reservation_reminder(email)\n @email = email\n mail(to: email, subject: 'Your Pet Boarding Reservation Reminder [RCN]')\n end", "def launch_email_client()\n mail_list = @@item.mail_list\n mail_list = \"private@#{mail_list}.apache.org\" unless mail_list.include? '@'\n\n to = @@item.chair_email\n cc = \"#{mail_list},#{@@item.cc}\"\n\n if @@item.missing\n subject = \"Missing #{@@item.title} Board Report\"\n body = %{\n Dear #{@@item.owner},\n\n The board report for #{@@item.title} has not yet been submitted for\n this month's board meeting. If you or another member of the PMC are\n unable to get it in by twenty-four hours before meeting time, please\n let the board know, and plan to report next month.\n\n https://www.apache.org/foundation/board/reporting#how\n\n Thanks,\n\n #{User.username}\n\n (on behalf of the ASF Board)\n }\n\n # strip indentation; concatenate lines within a paragraph\n indent = body[/^\\s*/]\n body = body.strip().gsub(/#{indent}/, \"\\n\").gsub(/(\\S)\\n(\\S)/, \"$1 $2\")\n else\n subject = \"#{@@item.title} Board Report\"\n body = @@item.comments.join(\"\\n\\n\")\n\n if not body and @@item.text\n monthNames = %w(January February March April May June July August\n September October November December)\n year = Agenda.date.split('-')[0].to_i\n month = Agenda.date.split('-')[1].to_i\n\n subject = \"[REPORT] #{@@item.title} - #{monthNames[month-1]} #{year}\"\n to = @@item.cc\n cc = mail_list\n body = @@item.text\n end\n end\n\n window.location = \"mailto:#{to}?cc=#{cc}\" +\n \"&subject=#{encodeURIComponent(subject)}\" +\n \"&body=#{encodeURIComponent(body)}\"\n end", "def incident_broadcast(incident)\n \t@incident = incident\n @url = incident_url(incident)\n\n #get all users emails except the related user email\n @user_mails = User.where(\"id != ?\", @incident.assigned_to.id).map {|user| user.email}\n\n mail(:to => @user_mails, :subject => \"New Incident!\");\n end", "def perform(task_hash)\n \tSiteMailer.reminder_notice(task_hash).deliver_now\n \tend", "def notification_mail(booking)\n\n @booking_organizer = User.find(booking.user_id).username\n @booking = booking\n\n filename = \"tmpfile/\"+booking.guid\n ics_content = generate_ics(booking)\n\n mail_addr = User.find(booking.user_id).username\n mails_addr = split_invitees(booking.invitees)\n mails_addr << mail_addr\n\n attachments['invite.ics'] = {:content => ics_content.to_s, :mime_type => \"text/calendar\"}\n\n mail(:to => mails_addr, :subject => booking.summary, :template_path => \"notifier\", :template_name => \"content\" )\n\n end", "def send_all_texts\n\n #heroku scheduler runs rake task to check DB every 10 minutes, not every minute like whenever gem. Logic has to account for that range of time.\n if (Time.now - 10.minutes) <= self.time && self.time <= Time.now + 10.minutes && sent == false\n self.sent = true\n self.save\n self.twilio_text\n else\n end\n\n end", "def notify_subscriber\n @greeting = \"Hi\"\n mail to: \"[email protected]\"\n end", "def subscribed_to_blog(user_email)\n mail to: user_email, subject: \"Bienvenue sur la newsletter CoursAvenuePro\"\n end", "def send_feedback_reminders_emails\n # Send the emails\n feedback_reminders.each do |fr|\n fr.send_feedback_reminder_email\n end\n\n # Shift the send_feedback_reminders_after date of\n # FEEDBACK_REMINDERS_INTERVAL seconds in the future\n self.send_feedback_reminders_after =\n Time.zone.today + FEEDBACK_REMINDERS_INTERVAL\n\n # Increment feedback_reminders_count\n self.feedback_reminders_count += 1\n\n # save the connection\n save\n end", "def text_notification(email)\n content = \"\"\n address = email\n phone = User.where(email: email).first.phone\n Membership.where(email: email).each do |membership|\n Task.where(group_id: membership.group_id).each do |task|\n if task.priority == 3\n content << \"#{task.title}\\n\"\n end\n end\n Subtask.where(group_id: membership.group_id).each do |subtask|\n if subtask.priority == 3\n content << \"#{subtask.task.title}: #{subtask.title}\\n\"\n end\n end\n end\n unless phone.nil?\n if content.empty? == false\n TWILIO_CLIENT.account.sms.messages.create(\n from: TWILIO_NUMBER,\n to: \"+#{phone}\",\n body: content\n )\n end\n end\n end", "def send_email_reminder(day)\n recipient = \"#{name} <#{email}>\"\n body = email_body(day)\n message = Mail.new do\n from ENV['EMAIL_FROM']\n to recipient\n subject 'BoozeTracker Reminder'\n content_type 'text/html; charset=UTF-8'\n body body\n delivery_method Mail::Postmark, api_token: ENV['POSTMARK_API_TOKEN']\n end\n message.deliver\n end", "def perform\n self.subscriptions.each do |blog| \n begin\n blog.find_twitterers\n rescue Exception => whoops\n puts \"Error on blog #{blog.title}: \" + whoops\n end\n end\n # +++ sub name of host.\n # +++ page will have to deal with unauthenticated user.\n puts \"Sending direct message to #{tname}\"\n twitter_direct_message(\"Your blogs have been processed: http://twitlines.net/blogs\")\n end", "def create_mailings!\n caffeinate_campaign.to_dripper.drips.each do |drip|\n mailing = Caffeinate::Mailing.new(caffeinate_campaign_subscription: self).from_drip(drip)\n mailing.save!\n end\n caffeinate_campaign.to_dripper.run_callbacks(:on_subscribe, self)\n end", "def send_by_email\n Notifier.new_comment(self).deliver\n end", "def micropost_notification(poster, follower, micropost)\n @greeting = \"Hi\"\n @follower = follower\n @micropost = micropost\n @poster = poster\n\n mail to: follower.email, subject: \"New Tweet!\"\n \n end", "def admin_story_email\n NotificationsMailer.admin_story_email(Story.first)\n end", "def jobs_notifier(email_list)\n @listed_jobs = JobPosting.where(created_at: (Time.now.midnight-5.days)..(Time.now))\n @greeting = \"Hi\"\n headers['X-SMTPAPI'] = { :to => email_list.to_a }.to_json\n mail(\n :to => \"[email protected]\",\n :subject => \"New Job Posted!\"\n )\n \n end", "def notify\n @greeting = \"Just a test\"\n mail(to: \"[email protected]\") #.deliver_later\n end" ]
[ "0.75021946", "0.7004595", "0.6737247", "0.67184937", "0.6588943", "0.6546344", "0.6438934", "0.6361757", "0.63449216", "0.6321769", "0.6308988", "0.62956786", "0.629298", "0.6283073", "0.6258638", "0.62533915", "0.62407166", "0.62404615", "0.62124705", "0.6198466", "0.6187447", "0.61666834", "0.6151852", "0.6147422", "0.612211", "0.6110395", "0.610468", "0.61024624", "0.60968506", "0.60648465", "0.6062507", "0.6059621", "0.60561985", "0.605327", "0.6024624", "0.6018314", "0.60070384", "0.6006526", "0.5998427", "0.5994204", "0.5988218", "0.598681", "0.5971763", "0.5970074", "0.5955391", "0.5949381", "0.59480083", "0.59440523", "0.59069043", "0.5904031", "0.5901655", "0.5896858", "0.5892758", "0.58839554", "0.58772856", "0.58744097", "0.58683586", "0.5852703", "0.5851907", "0.58511734", "0.58508337", "0.5846876", "0.5827116", "0.5824957", "0.5817034", "0.58119345", "0.57974386", "0.5794876", "0.5793383", "0.578664", "0.57859224", "0.57690185", "0.5758639", "0.5757286", "0.5751302", "0.5748601", "0.57468086", "0.57449925", "0.5744284", "0.5738122", "0.5735924", "0.5734492", "0.57341754", "0.5731485", "0.57228225", "0.57211584", "0.57138777", "0.57122487", "0.57118523", "0.5706871", "0.5706274", "0.57032037", "0.56977665", "0.56922305", "0.5686226", "0.56857526", "0.5678575", "0.5666866", "0.56660765", "0.56637794" ]
0.6758849
2
SimpleCov formatter for idobata.io
def initialize @hook_url = self.class.hook_url || ENV['SIMPLECOV_IDOBATA_HOOK_URL'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format!\n SimpleCov.formatter.new.format(self)\n end", "def format!\n SimpleCov.formatter.new.format(self)\n end", "def format!\n SimpleCov.formatter.new.format(self)\n end", "def format(result)\n json = SimpleCov::FormatResult.call(result, OUTPUT_FILE_PATH)\n puts SimpleCov::Sublime::OutputMessage.new(result, OUTPUT_FILE_PATH)\n\n json\n end", "def show_coverage(*)\n return if filtered_items.empty?\n\n table = \"## Code coverage\\n\".dup\n table << table_header\n table << table_separation\n\n filtered_items.each do |item|\n table << table_entry(item)\n end\n markdown table\n end", "def show_coverage\n unless @project.nil?\n line = \"## #{@project.scheme} code coverage\\n\"\n line += total_coverage_markdown\n line += modified_files_coverage_table\n line += '> Powered by [Slather](https://github.com/SlatherOrg/slather)'\n markdown line\n end\n end", "def puts_summary(io)\n io.puts(\"\\n#{[coverage_text, successful_text, failed_text, total_text].join(' ')}\")\n end", "def simplecov_configuration\n proc do\n gemfile = Eaco::Rake::Utils.gemfile\n coverage_dir \"coverage/#{gemfile}\"\n add_filter ['/features', '/spec']\n end\n end", "def start_simplecov\n require 'simplecov'\n SimpleCov.start :rails\n\n RSpec.configure do |config|\n require 'miletus/namespace_helper'\n # Mixin namespace helpers\n config.include Miletus::NamespaceHelper\n end\n\nend", "def report!\n simplecov\n Coveralls.push!\n\n nil\n end", "def setup_simplecov\n path = if config.dig(\"test_suite\") == \"minitest\"\n \"test/support\"\n else\n \"spec/support\"\n end\n\n template \"templates/simplecov.tt\", \"#{path}/simplecov.rb\"\n append_to_file \".gitignore\", \"\\n# Ignore Coverage files \\n/coverage\\n\"\n end", "def coverage_text\n 'YARD-Coverage: %.1f%%' % YARD::Cov.round_percentage(coverage * 100)\n end", "def cov_header(timestamp, metrics_h)\n now = Time.at(timestamp)\n <<-EOP\nCreated: #{now}\nTotal Coverage: #{metrics_h['covered_percent']}\nStrength: #{metrics_h['covered_strength']}\nCovered lines: #{metrics_h['covered_lines']}\nTotal lines: #{metrics_h['total_lines']}\nEOP\nend", "def create_formatter\n ::Ougai::Formatters::Bunyan.new\n end", "def coverage; end", "def coverage; end", "def format_coverage(coverage)\n format(\"%.2f\", coverage)\n end", "def complete_coverage\n lines = File.read(@filename).encode(\"utf-8\", invalid: :replace).lines\n\n lines.each_with_index do |line, lineno|\n # multi-line arrays\n mark_multiline(\n lines, lineno,\n /\\A[^\\n]*\\b=\\([^()]*\\)/,\n forward: false\n )\n\n # heredoc\n mark_multiline(\n lines, lineno,\n /\\A[^\\n]+<<-?'?(\\w+)'?.*$.*\\1/m\n )\n\n # multiline string concatenated with backslashes\n mark_multiline(\n lines, lineno,\n /\\A[^\\n]+\\\\$(\\s*['\"][^'\"]*['\"]\\s*\\\\$){1,}\\s*['\"][^'\"]*['\"]\\s*$/\n )\n\n # simple line continuations with backslashes\n mark_multiline(\n lines, lineno,\n /\\A([^\\n&|;]*[^\\\\&|;](\\\\\\\\)*\\\\\\n)+[^\\n&|;]*[^\\n\\\\&|;](\\\\\\\\)*$/\n )\n\n # multiline string concatenated with newlines\n %w[' \"].each do |char|\n mark_multiline(\n lines, lineno,\n /\\A[^\\n]+[\\s=]+#{char}[^#{char}]*#{char}/m,\n forward: false\n )\n end\n\n mark_line(line, lineno)\n end\n end", "def formatter; end", "def formatter; end", "def formatter; end", "def pretty_print\n pad = node.last_line.to_s.length\n pretty_print_lines.map do |covered, (num, line)|\n formatted_line = \"#{num.to_s.rjust(pad)}: #{line}\"\n if line.strip.length.zero?\n Rainbow(formatted_line).darkgray.dark\n elsif covered.nil?\n Rainbow(formatted_line).darkgray.dark + \\\n Rainbow(' hits: n/a').italic.darkgray.dark\n elsif covered.positive?\n Rainbow(formatted_line).green + \\\n Rainbow(\" hits: #{covered}\").italic.darkgray.dark\n elsif covered.zero?\n Rainbow(formatted_line).red + \\\n Rainbow(\" hits: #{covered}\").italic.darkgray.dark\n end\n end.join(\"\\n\")\n end", "def option_coverage\n option_parser.on('-c', '--covered', 'include covered units') do\n if options[:coverage] == :uncovered\n options[:coverage] = :all\n else \n options[:coverage] = :covered\n end\n end\n option_parser.on('-u', '--uncovered', 'include only uncovered units') do\n if options[:coverage] == :covered\n options[:coverage] = :all\n else\n options[:coverage] = :uncovered\n end\n end\n option_parser.on('-a', '--all', 'include all namespaces and units') do\n options[:coverage] = :all\n end\n end", "def filter!\n @files = SimpleCov.filtered(files)\n end", "def filter!\n @files = SimpleCov.filtered(files)\n end", "def filter!\n @files = SimpleCov.filtered(files)\n end", "def pretty_print_lines\n cov_enum = coverage.each\n cov_source_lines = (node.first_line..node.last_line).map do |line_no|\n cov_line_no = begin\n cov_enum.peek[0]\n rescue StopIteration\n -1\n end\n cov_enum.next[1] if cov_line_no == line_no\n end\n cov_source_lines.zip(node.source_lines_with_numbers)\n end", "def coverage_path; end", "def individual_coverage_message(covered_files)\n require 'terminal-table'\n\n message = \"### Code Coverage\\n\\n\"\n table = Terminal::Table.new(\n headings: %w(File Coverage),\n style: { border_i: '|' },\n rows: covered_files.map do |file|\n [file[:filename], \"#{format('%.02f', file[:covered_percent])}%\"]\n end\n ).to_s\n message + table.split(\"\\n\")[1..-2].join(\"\\n\")\n end", "def quality_indicator_name\n \"tests coverage\"\n end", "def file_to_codecov(file)\n # Initial nil is required to offset line numbers.\n [nil] + file.lines.map do |line|\n if line.skipped?\n nil\n else\n line.coverage\n end\n end\n end", "def command_name\n @command_name ||= SimpleCov.command_name\n end", "def command_name\n @command_name ||= SimpleCov.command_name\n end", "def command_name\n @command_name ||= SimpleCov.command_name\n end", "def report\n [coverage, badge]\n end", "def fix_offenses!\n run \"rubocop -a --format=simple\"\n end", "def setup!\n ::RSpec.configure do |c|\n c.add_formatter Formatter\n end\n end", "def total_coverage_markdown\n unless @project.nil?\n \"### Total coverage: **`#{@project.decimal_f([total_coverage])}%`**\\n\"\n end\n end", "def format(path, text)\n ad_hoc_config = fork_config(path, text, format: true)\n capture_rubocop_stdout(ad_hoc_config)\n ad_hoc_config.rubocop_options[:stdin]\n end", "def start_coverage\n return unless sporkless? # Something funny about numbers right now under spork\n require 'simplecov'\nend", "def initialize(*args)\n old_initialize(*args)\n self.formatter = SimpleFormatter.new\n end", "def show_total_coverage\n unless @project.nil?\n markdown total_coverage_markdown\n end\n end", "def make_coverage(title, sortby)\n if (sortby != 8)\n @fields.sort! { |a, b| b[sortby].to_f <=> a[sortby].to_f } # (i.e. descending sort)\n else\n @fields.sort! { |a, b| a[sortby] <=> b[sortby] } # (i.e. ascending sort)\n end\n\n @file_coverage_template.rewind\n file_coverage = File.new(@report_dir + \"/#{title}\", 'w') rescue die(\"Can't open #{@report_dir}\\\\#{title}\", __LINE__)\n\n while (line = @file_coverage_template.gets)\n if (line =~ /^table data goes here/)\n get_coverline(file_coverage)\n elsif (line =~ /^Report current.*/)\n file_coverage.puts 'Report current as of: ' + @report_timestamp\n elsif (line =~ /about 90 minutes/)\n # edit the line and insert the actual 'Normal' value from the config file\n line['90'] = @timebox['normal'].to_s\n file_coverage.puts line\n elsif (line =~ /^table header goes here/)\n # print only the column headings we need\n file_coverage.puts indent2 + '<th width=\"7%\"><font face=\"Arial\"><a href=\"cov_by_total.htm\">TOTAL</a></font></th>' if @include_switch['Duration']\n file_coverage.puts indent2 + '<th width=\"7%\"><font face=\"Arial\"><a href=\"cov_by_charter.htm\">CHTR</a></font></th>' if @include_switch['C vs O']\n file_coverage.puts indent2 + '<th width=\"7%\"><font face=\"Arial\"><a href=\"cov_by_opp.htm\">OPP</a></font></th>' if @include_switch['C vs O']\n file_coverage.puts indent2 + '<th width=\"8%\"><font face=\"Arial\"><a href=\"cov_by_test.htm\">% TEST</a></font></th>' if @include_switch['TBS']\n file_coverage.puts indent2 + '<th width=\"7%\"><font face=\"Arial\"><a href=\"cov_by_bug.htm\">% BUG</a></font></th>' if @include_switch['TBS']\n file_coverage.puts indent2 + '<th width=\"8%\"><font face=\"Arial\"><a href=\"cov_by_setup.htm\">% SETUP</a></font></th>' if @include_switch['TBS']\n else\n file_coverage.puts line\n end\n end\n\n file_coverage.close\n end", "def initialize\n super(STDOUT)\n @formatter = RainbowifyFormatter.new\n end", "def initialize\n super(STDOUT)\n @formatter = RainbowifyFormatter.new\n end", "def coverage( idx )\n if @cov_ab[ idx ] == nil\n @cov_ab[ idx ] = VcfTools.get_coverage( @data[:info], @data[:samples][idx] )\n end\n return @cov_ab[ idx ]\n end", "def to_s # :nocov:\n s = []\n s << \"CommandSpec:#{self.object_id}\"\n s << \" digest: #{self.digest}\"\n s << \" repo: #{self.repo}\"\n s << \" bundle: #{self.bundle}\"\n s << \" command: #{self.command}\"\n s << \" args: #{self.args}\"\n s << \" user: #{self.user}\"\n s << \" group: #{self.group}\"\n s << \" env: \" + (self.env.nil?() ? \"\" : MultiJson.dump(self.env))\n s << \" stdin: \" + Debug.pretty_str(stdin)\n s.join(\"\\n\")\n end", "def inspect_source(*args)\n super(*args, 'foo_spec.rb')\n end", "def formatter()\n @formatter\n end", "def formatter\n raise NotImplementedError\n end", "def test_new_formatter\n assert_instance_of NagiosHerald::Formatter::CheckElasticsearch, @formatter\n end", "def start_coverage_tracking\n if ENV['CI']\n require 'codeclimate-test-reporter'\n CodeClimate::TestReporter.start\n else\n require 'simplecov'\n SimpleCov.start\n end\nend", "def run(file_path)\n file = CoverallsMulti::Formatter.parse_json(file_path)\n\n source_files = []\n begin\n file.keys.each do |test_suite_key|\n file[test_suite_key]['coverage'].each do |filename, coverage|\n properties = {}\n\n properties['source'] = File.open(filename, 'rb:utf-8').read\n properties['name'] = format_short_filename(filename)\n properties['coverage'] = coverage\n\n source_files << properties\n end\n end\n rescue StandardError => e\n puts \"[CoverallsMulti] There was a problem formatting the simplecov report at #{file_path}.\"\n puts '[CoverallsMulti] Make sure the file exists.'\n raise e\n end\n\n source_files\n end", "def get_formatter_class\n Formatter::V0::Customer\n end", "def generate_coverages\r\n [].tap do |results|\r\n count = 0\r\n coverages.each do |obj|\r\n cov = {\r\n 'name' => obj['name'],\r\n 'code' => \"COV%03d\" % count,\r\n 'main_coverage' => !obj['rider'],\r\n 'risk_category' => \"AUTO\",\r\n 'insured_object' => \"VEHICLE\",\r\n 'coverage_group' => obj['name'].gsub(/^.*\\((.+)\\).*$/, \"\\\\1\"),\r\n 'limits' => [],\r\n 'deductible' => [],\r\n 'premium' => {\r\n 'type' => 'FixedValue',\r\n 'value' => 0.0\r\n }\r\n }\r\n cov['description'] = obj['damages'].split(';').join(',') +\r\n \" caused by \" + obj['perils'].split(';').join(',') + '.'\r\n \r\n if obj['name'] =~ /^([A-Z]+) \\(([A-Z]+)\\).*$/\r\n pg, dg = $1, $2\r\n cov['peril_groups'] = [\r\n {\r\n 'code' => pg,\r\n 'perils' => obj['perils'].split(';').map(&:strip),\r\n 'damage_groups' => [\r\n {\r\n 'code' => dg,\r\n 'damages' => obj['damages'].split(';').map(&:strip)\r\n }\r\n ]\r\n }\r\n ]\r\n end\r\n\r\n results << cov\r\n count += 1\r\n end\r\n end\r\nend", "def result_to_codecov(result)\n {\n 'codecov' => result_to_codecov_report(result),\n 'coverage' => result_to_codecov_coverage(result),\n 'messages' => result_to_codecov_messages(result)\n }\n end", "def formatter\n @formatter.formatter\n end", "def coverage(project_name)\n section \"coverage\", \"rm -rf hpc_report\", :condition => $tests_compiled_coverage, :noexception => true do\n hpc_excluded_modules = ((Dir.glob(\"test/**/*Spec.hs\") # skip all test-spec files\n .map { |k| k.gsub(/^test\\//, \"\") # ...converting path to namespace for HPC\n .gsub(/\\.hs$/,\"\")\n .gsub(\"/\",\".\")\n }\n ) << \"Main\" # and skip \"Main\", the entrypoint for tests\n ).map{|k| \"--exclude=#{k}\" }.join(\" \")\n command_interactive \"hpc report #{project_name}.tix #{hpc_excluded_modules}\"\n command_interactive \"hpc markup #{project_name}.tix --destdir=hpc_report #{hpc_excluded_modules}\"\n end\nend", "def to_s\n out = \"Rdoc Coverage for #{@filepath}: #{score}%\\n\"\n out += \" Classes: #{@classes.select{|c| c }.length}/#{@classes.length}\\n\" unless @classes.empty?\n out += \" Modules: #{@modules.select{|c| c }.length}/#{@modules.length}\\n\" unless @modules.empty?\n out += \" Methods: #{@methods.select{|c| c }.length}/#{@methods.length}\\n\" unless @methods.empty?\n out += \" Attributes: #{@attrs.select{|c| c }.length}/#{@attrs.length}\\n\" unless @attrs.empty?\n out += \" Constants: #{@constants.select{|c| c }.length}/#{@constants.length}\\n\" unless @constants.empty?\n out\n end", "def initialize\n @formatter = method(:default_formatter)\n end", "def coverage_summary(response)\n unless (@user_request.title_level_citation? &&\n umlaut_config.lookup!(\"resolve_display.show_coverage_summary\", false) &&\n (response[:coverage_begin_date] || response[:coverage_end_date]))\n return nil\n end\n\n start = response[:coverage_begin_date].try(:year) || I18n.t(\"umlaut.citation.coverage_summary.open_start\")\n finish = response[:coverage_end_date].try(:year) || I18n.t(\"umlaut.citation.coverage_summary.open_end\")\n\n content_tag(\"span\", :class=>\"coverage_summary\") do\n \"#{start} – #{finish}:\"\n end\n end", "def inspect\n test_cases.each do |tc|\n puts tc.print\n end\n end", "def format_source(source); end", "def start!\n Coveralls.wear_merged!(&simplecov_configuration)\n\n nil\n end", "def build_verbatim margin\n verbatim = super\n\n verbatim.format = :ruby if @section == 'Examples'\n\n verbatim\n end", "def formatter=(_arg0); end", "def formatter=(_arg0); end", "def formatter=(_arg0); end", "def describe(ctx)\n puts <<EOS\n---\nprovider:\n type: example\n desc: |\n A dummy provider that echos stuff. Useful for testing.\n invoke: json\n actions: [get,set]\n suitable: true\n attributes:\n name:\n desc: The resource name.\n ensure:\n type: enum[absent, present]\n color:\n type: enum[red, green, blue]\nEOS\n end", "def display(index, test)\n lines = formatter.display(test).split(\"\\n\")\n puts \"%4s) #{lines.shift}\" % index\n lines.each do |line|\n puts \" \" + line\n end\n puts\n end", "def translate_coverage_to_class(commits)\n if (commits.last[:coverage].to_f - commits.first[:coverage].to_f).round(2) >= ENV['CODECOV_TOLERANCE'].to_f\n return :falling\n elsif (commits.first[:coverage].to_f - commits.last[:coverage].to_f).round(2) <= -ENV['CODECOV_TOLERANCE'].to_f\n return :rising\n else\n return :flat\n end\nend", "def dump_summary *args; end", "def default_formatter\n Sapience::Formatters::Default.new\n end", "def table_entry(item)\n line = item.name.dup\n line << \"|#{format_coverage(item.total_percentage)}\"\n line << \"|#{format_coverage(item.line_rate)}\" if header_line_rate?\n line << \"|#{format_coverage(item.branch_rate)}\" if header_branch_rate?\n line << \"\\n\"\n end", "def formatters; end", "def log_formatter; end", "def log_formatter; end", "def formatted_source_file(source_file); end", "def test_header(test_name)\n puts \"\\n====================================================================\"\n puts \"====================================================================\\n\"\n puts \"\\n #{test_name}\"\n puts \"\\n====================================================================\"\n puts \"====================================================================\\n\"\nend", "def result_to_codecov_messages(result)\n result.files.each_with_object({}) do |file, memo|\n memo[shortened_filename(file)] = file.lines.each_with_object({}) do |line, lines_memo|\n lines_memo[line.line_number.to_s] = 'skipped' if line.skipped?\n end\n end\n end", "def formatted_info\n \"#{self.name} - #{self.description}\"\n end", "def inspect\n @inspect ||= begin\n header = [name, desc].compact.join(\": \")\n lines =\n dry_initializer\n .options\n .reject { |item| item.target == :options }\n .map { |item| [\" #{item.target}\", item.desc].compact.join(\": \") }\n\n [header, lines, nil].join(\"\\n\")\n end\n end", "def formatted_covered_percent\n covered_percent.round(2)\n end", "def test_format_print_two_fake\n simulator = Sim.new(nil, nil, nil)\n assert_equal simulator.ruby_format_print([0, 2]), \"\\tFound 2 fake rubies in Enumerable Canyon.\\n\"\n end", "def make_my_diffs_pretty!; end", "def formatter\n @formatter ||= HumanFormatter.new\n end", "def print\n # TODO: add a flag for textmate, the ugliest format ever:\n # txmt://open?url=file:///path/to/file.rb&line=86&column=3\n\n puts \"Files: #{@num_files}\"\n puts \"Total Classes: #{@num_classes}\"\n puts \"Total Modules: #{@num_modules}\"\n puts \"Total Methods: #{@num_methods}\"\n\n puts\n puts \"Module coverage: #{coverage_rating(:module)}%\"\n puts \" Not covered:\"\n @coverage[:module][:not_covered].sort_by {|o| o.name}.each do |itm|\n location = itm.in_files.first.file_absolute_name || \"no known location\"\n puts \" #{itm.name}:\"\n puts \" #{location}\"\n end\n\n puts\n \n puts\n puts \"Class coverage: #{coverage_rating(:class)}%\"\n puts \" Not covered:\"\n @coverage[:class][:not_covered].sort_by {|o| o.name}.each do |itm|\n location = itm.in_files.first.file_absolute_name\n puts \" #{itm.name}\"\n puts \" #{location}\"\n end\n\n puts\n\n puts\n puts \"Method coverage: #{coverage_rating(:method)}%\\n\"\n puts \" Not covered:\"\n @coverage[:method][:not_covered].sort_by {|o| [o.parent.name, o.name]}.each do |itm|\n location = itm.token_stream.first.text.sub(/^# File /, '').sub(/, line (\\d+)$/, ':\\1')\n puts \" #{itm.parent.name}##{itm.name}:\"\n puts \" #{location}\"\n end\n \n puts\n end", "def formatAPA\n (prettyOutput(@authors.map { |x| x.to_s }) + \"(\" + @datee.year.to_s + \") \" + @title +\n \"\\n\\t(\" + @edition.to_s + \") \" +\n \"(\" + @editionnumber.to_s + \") \" +\n @url)\n end", "def describe\n puts <<EOS\n---\nprovider:\n type: json\n desc: |\n Test provider for the JSON provider harness\n invoke: json\n actions: [set, get]\n suitable: true\n attributes:\n name:\n ensure:\n type: enum[absent, present]\n message:\nEOS\nend", "def show_modified_files_coverage\n unless @project.nil?\n markdown modified_files_coverage_table\n end\n end", "def create_formatter\n BunyanFormatterWithSilencedTimestamp.new\n end", "def results\n if Gem.loaded_specs['simplecov'].version >= Gem::Version.new('0.19')\n ::SimpleCov::Result.from_hash(resultset)\n else\n array = []\n resultset.each do |command_name, data|\n array << ::SimpleCov::Result.from_hash(command_name => data)\n end\n array\n end\n end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def result_to_codecov_coverage(result)\n result.files.each_with_object({}) do |file, memo|\n memo[shortened_filename(file)] = file_to_codecov(file)\n end\n end" ]
[ "0.8101925", "0.8101925", "0.8101925", "0.6497728", "0.6208528", "0.60782975", "0.58777446", "0.5819737", "0.5729155", "0.5720789", "0.56983143", "0.56975526", "0.5605132", "0.5572701", "0.5525398", "0.5525398", "0.54913586", "0.5373023", "0.53704554", "0.53704554", "0.53704554", "0.530827", "0.5290045", "0.5163449", "0.5163449", "0.5163449", "0.5120266", "0.51148516", "0.5102647", "0.5098892", "0.5038902", "0.50387675", "0.50387675", "0.50387675", "0.50282186", "0.5023297", "0.5009517", "0.49979845", "0.49653354", "0.49529195", "0.49435446", "0.4941326", "0.49183118", "0.4914223", "0.4914223", "0.4902184", "0.48886275", "0.48837918", "0.4883319", "0.4876279", "0.48752055", "0.48531926", "0.48395073", "0.4832375", "0.4832236", "0.48229584", "0.48071852", "0.4802907", "0.4792159", "0.47671333", "0.4760875", "0.47598705", "0.47593474", "0.4754494", "0.47397536", "0.4725871", "0.4725871", "0.4725871", "0.47256672", "0.4721259", "0.47196782", "0.4718133", "0.4707605", "0.46967685", "0.46869445", "0.4684959", "0.4684959", "0.4683575", "0.46772197", "0.4672263", "0.46713513", "0.4668199", "0.46665215", "0.46649292", "0.4664397", "0.46622726", "0.46593457", "0.4656304", "0.4648808", "0.46487865", "0.4645395", "0.4645047", "0.46450204", "0.46450204", "0.46450204", "0.46450204", "0.46450204", "0.46450204", "0.46450204", "0.46450204", "0.46446487" ]
0.0
-1
format coverage result, then post result to idobata.io
def format(result) client.send(Badge.new(result).to_s, format: :html) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @coverage = Coverage.new(coverage_params)\n\n respond_to do |format|\n if @coverage.save\n format.html { redirect_to @coverage, notice: 'Coverage was successfully created.' }\n format.json { render :show, status: :created, location: @coverage }\n else\n format.html { render :new }\n format.json { render json: @coverage.errors, status: :unprocessable_entity }\n end\n end\n end", "def coverage(scraperjsonpath, results)\n # get the element names\n elements = JSON.load(File.open scraperjsonpath)['elements'].keys\n coverage = []\n # calculate coverage\n elements.each do |element|\n # calculate coverage for this line\n if results.detect { |result| result.is_a?(Hash) && result.key?(element) }\n coverage << 1\n else\n coverage << 0\n end\n end\n { :name => scraperjsonpath,\n :source => elements.join('\\n'),\n :coverage => coverage }\nend", "def generate_coverages\r\n [].tap do |results|\r\n count = 0\r\n coverages.each do |obj|\r\n cov = {\r\n 'name' => obj['name'],\r\n 'code' => \"COV%03d\" % count,\r\n 'main_coverage' => !obj['rider'],\r\n 'risk_category' => \"AUTO\",\r\n 'insured_object' => \"VEHICLE\",\r\n 'coverage_group' => obj['name'].gsub(/^.*\\((.+)\\).*$/, \"\\\\1\"),\r\n 'limits' => [],\r\n 'deductible' => [],\r\n 'premium' => {\r\n 'type' => 'FixedValue',\r\n 'value' => 0.0\r\n }\r\n }\r\n cov['description'] = obj['damages'].split(';').join(',') +\r\n \" caused by \" + obj['perils'].split(';').join(',') + '.'\r\n \r\n if obj['name'] =~ /^([A-Z]+) \\(([A-Z]+)\\).*$/\r\n pg, dg = $1, $2\r\n cov['peril_groups'] = [\r\n {\r\n 'code' => pg,\r\n 'perils' => obj['perils'].split(';').map(&:strip),\r\n 'damage_groups' => [\r\n {\r\n 'code' => dg,\r\n 'damages' => obj['damages'].split(';').map(&:strip)\r\n }\r\n ]\r\n }\r\n ]\r\n end\r\n\r\n results << cov\r\n count += 1\r\n end\r\n end\r\nend", "def report\n [coverage, badge]\n end", "def coverage; end", "def coverage; end", "def process_coverage \n\tif( File.exist?( \"#{$jtd_outputName}/#{COVERAGE_FILE_NAME }\") )\n\t\tputs \"[INFO] Processing Coverage File\"\n\t\tlcov = LCOVFile.new( \"#{$jtd_outputName}/#{COVERAGE_FILE_NAME }\" )\n\t\tlcov.outputToLCOV( \"#{$jtd_outputName}/#{COVERAGE_FILE_NAME }\" )\n\tend\nend", "def create\n @insurance_coverage = InsuranceCoverage.new(insurance_coverage_params)\n\n respond_to do |format|\n if @insurance_coverage.save\n format.html { redirect_to @insurance_coverage, notice: 'Insurance coverage was successfully created.' }\n format.json { render :show, status: :created, location: @insurance_coverage }\n else\n format.html { render :new }\n format.json { render json: @insurance_coverage.errors, status: :unprocessable_entity }\n end\n end\n end", "def result_to_codecov_coverage(result)\n result.files.each_with_object({}) do |file, memo|\n memo[shortened_filename(file)] = file_to_codecov(file)\n end\n end", "def format(result)\n json = SimpleCov::FormatResult.call(result, OUTPUT_FILE_PATH)\n puts SimpleCov::Sublime::OutputMessage.new(result, OUTPUT_FILE_PATH)\n\n json\n end", "def report!\n simplecov\n Coveralls.push!\n\n nil\n end", "def output_report(report)\n # Create markdown\n report_markdown = report.markdown_value\n\n # Send markdown\n markdown(report_markdown)\n\n # Notify failure if minimum coverage hasn't been reached\n threshold = Xcov.config[:minimum_coverage_percentage].to_i\n if !threshold.nil? && (report.coverage * 100) < threshold\n fail(\"Code coverage under minimum of #{threshold}%\")\n end\n end", "def result_to_codecov(result)\n {\n 'codecov' => result_to_codecov_report(result),\n 'coverage' => result_to_codecov_coverage(result),\n 'messages' => result_to_codecov_messages(result)\n }\n end", "def make_coverage(title, sortby)\n if (sortby != 8)\n @fields.sort! { |a, b| b[sortby].to_f <=> a[sortby].to_f } # (i.e. descending sort)\n else\n @fields.sort! { |a, b| a[sortby] <=> b[sortby] } # (i.e. ascending sort)\n end\n\n @file_coverage_template.rewind\n file_coverage = File.new(@report_dir + \"/#{title}\", 'w') rescue die(\"Can't open #{@report_dir}\\\\#{title}\", __LINE__)\n\n while (line = @file_coverage_template.gets)\n if (line =~ /^table data goes here/)\n get_coverline(file_coverage)\n elsif (line =~ /^Report current.*/)\n file_coverage.puts 'Report current as of: ' + @report_timestamp\n elsif (line =~ /about 90 minutes/)\n # edit the line and insert the actual 'Normal' value from the config file\n line['90'] = @timebox['normal'].to_s\n file_coverage.puts line\n elsif (line =~ /^table header goes here/)\n # print only the column headings we need\n file_coverage.puts indent2 + '<th width=\"7%\"><font face=\"Arial\"><a href=\"cov_by_total.htm\">TOTAL</a></font></th>' if @include_switch['Duration']\n file_coverage.puts indent2 + '<th width=\"7%\"><font face=\"Arial\"><a href=\"cov_by_charter.htm\">CHTR</a></font></th>' if @include_switch['C vs O']\n file_coverage.puts indent2 + '<th width=\"7%\"><font face=\"Arial\"><a href=\"cov_by_opp.htm\">OPP</a></font></th>' if @include_switch['C vs O']\n file_coverage.puts indent2 + '<th width=\"8%\"><font face=\"Arial\"><a href=\"cov_by_test.htm\">% TEST</a></font></th>' if @include_switch['TBS']\n file_coverage.puts indent2 + '<th width=\"7%\"><font face=\"Arial\"><a href=\"cov_by_bug.htm\">% BUG</a></font></th>' if @include_switch['TBS']\n file_coverage.puts indent2 + '<th width=\"8%\"><font face=\"Arial\"><a href=\"cov_by_setup.htm\">% SETUP</a></font></th>' if @include_switch['TBS']\n else\n file_coverage.puts line\n end\n end\n\n file_coverage.close\n end", "def show_coverage(*)\n return if filtered_items.empty?\n\n table = \"## Code coverage\\n\".dup\n table << table_header\n table << table_separation\n\n filtered_items.each do |item|\n table << table_entry(item)\n end\n markdown table\n end", "def coverage_path; end", "def show_coverage\n unless @project.nil?\n line = \"## #{@project.scheme} code coverage\\n\"\n line += total_coverage_markdown\n line += modified_files_coverage_table\n line += '> Powered by [Slather](https://github.com/SlatherOrg/slather)'\n markdown line\n end\n end", "def coverage\n @coverage = 0;\n\n puts %w(member_id spm mpm ser pd extra subtotal total).join(\"\\t\");\n @members.each do |m|\n m.costs[:subtotal] = m.costs[:spm] + m.costs[:mpm] + m.costs[:ser] + m.costs[:pd] + m.costs[:extra];\n m.costs[:total] = m.costs[:subtotal] * @multiply_subtotal;\n print_cost = [:spm, :mpm, :ser, :pd, :extra, :subtotal, :total].map{|x| m.costs[x]}.join(\"\\t\");\n puts [m.member_id, print_cost].join(\"\\t\");\n @coverage += m.costs[:subtotal];\n end\n\n puts \"Total operating cost = #{@total_op_cost}, coverage = #{@coverage}\";\n diff = @total_op_cost - @coverage;\n if @coverage > @total_op_cost then\n puts \"We are charging %.10f too much\" % diff.abs;\n elsif @coverage < @total_op_cost then\n puts \"We are charging %.10f too little\" % diff.abs;\n end\n\n # If we are off more than one dollar per member, adjust.\n if diff.abs > (@members.size / 100.0) then\n diff_per_member = diff.to_f / @members.size;\n @deet.file.puts \"diff_per_member\\t#{diff_per_member}\";\n @members.each do |m|\n m.costs[:extra] += diff_per_member;\n end\n puts \"Adding #{diff_per_member} as extra cost to each member.\";\n puts \"Running the numbers again...\";\n return coverage();\n else\n puts \"... but the diff is so small that we don't care.\";\n end\n\n @data.file.puts %w(member_id spm mpm ser pd extra subtotal total).join(\"\\t\");\n @members.each do |m|\n @data.file.puts m.to_s;\n end\n @data.close();\n @deet.close();\n end", "def format_coverage(coverage)\n format(\"%.2f\", coverage)\n end", "def coverage_text\n 'YARD-Coverage: %.1f%%' % YARD::Cov.round_percentage(coverage * 100)\n end", "def create_insurance_coverage_using_post_with_http_info(insurance_coverage, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: InsuranceApi.create_insurance_coverage_using_post ...'\n end\n # verify the required parameter 'insurance_coverage' is set\n if @api_client.config.client_side_validation && insurance_coverage.nil?\n fail ArgumentError, \"Missing the required parameter 'insurance_coverage' when calling InsuranceApi.create_insurance_coverage_using_post\"\n end\n # resource path\n local_var_path = '/insurance_coverage'\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_coverage)\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 => 'InsuranceCoverage')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: InsuranceApi#create_insurance_coverage_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n respond_to do |format|\n if @coverage.update(coverage_params)\n format.html { redirect_to @coverage, notice: 'Coverage was successfully updated.' }\n format.json { render :show, status: :ok, location: @coverage }\n else\n format.html { render :edit }\n format.json { render json: @coverage.errors, status: :unprocessable_entity }\n end\n end\n end", "def coverage\n @_coverage ||= if File.exist?(@output_file)\n # <td><tt class='coverage_code'>78.95%</tt>&nbsp;</td>\n # <div class=\"percent_graph_legend\"><tt class='coverage_total'>78.95%</tt></div>\n # \n # content = File.read(@output_file)\n # matches = content.scan(/<td><tt class='coverage_code'>78.95%</tt>&nbsp;</td>/)\n \n content = File.read(@output_file)\n matches = content.scan(/<td><tt class='coverage_code'>(\\d+\\.\\d+)%<\\/tt>&nbsp;<\\/td>/)\n\n if matches.empty?\n matches = content.scan(/<div class=\"percent_graph_legend\"><tt class='coverage_total'>(\\d+\\.\\d+)%<\\/tt><\\/div>/)\n end\n\n matches.first.to_s.to_f\n end\n \n @_coverage ||= 0\n end", "def coverage\n empty? ? 1 : Rational(successful, total)\n end", "def format!\n SimpleCov.formatter.new.format(self)\n end", "def format!\n SimpleCov.formatter.new.format(self)\n end", "def format!\n SimpleCov.formatter.new.format(self)\n end", "def set_coverage\n @coverage = Coverage.find(params[:id])\n end", "def individual_report(coverage_path, current_project_path)\n if File.exist? coverage_path\n committed_files = git.modified_files + git.added_files\n\n unless current_project_path.nil?\n committed_files = committed_files.map do |s|\n current_project_path + '/' + s\n end\n end\n\n covered_files = JSON.parse(File.read(coverage_path), symbolize_names: true)[:files]\n .select { |f| committed_files.include?(f[:filename]) }\n\n unless current_project_path.nil?\n covered_files.each { |f| f[:filename].sub!(%r{^#{current_project_path}/?}, '') }\n end\n\n return if covered_files.nil? || covered_files.empty?\n markdown individual_coverage_message(covered_files)\n else\n fail('Code coverage data not found')\n end\n end", "def results(cacheable_only: false)\n {\n coverage_viz: coverage_viz(cacheable_only: cacheable_only),\n quality_metrics: quality_metrics,\n taxon_info: taxon_info,\n }\n end", "def run\n\t\tmy_credentials = {\"user\" => \"test.api\", 'password' => '5DRX-AF-gc4', 'client_id' => 'Test', 'client_secret' => 'xIpXeyMID9WC55en6Nuv0HOO5GNncHjeYW0t5yI5wpPIqEHV'}\n\t\taccess_token = self.class.post('http://testcost.platform161.com/api/v2/access_tokens/', { query: my_credentials })['token']\n\t\theaders = {:headers => {'PFM161-API-AccessToken' => access_token}}\n\t\tadvertiser_reports = self.class.post('https://testcost.platform161.com/api/v2/advertiser_reports/', headers )\n\t\tcreate_local_report advertiser_reports['id']\n\t\tcampaign = self.class.get('https://testcost.platform161.com/api/v2/campaigns/' + campaign_id.to_s, headers )\n\t\tif advertiser_reports['results'] && advertiser_reports['results'].select { |campaign| campaign['campaign_id'] == campaign_id }.present?\n\t\t\tadvertiser_report = advertiser_reports['results'].select { |campaign| campaign['campaign_id'] == campaign_id }\n\t\t\tReportGeneratorCsvBuilder.new({advertiser_report: advertiser_report, campaign: campaign}).build\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend", "def coverage\n @coverage = 0;\n\n puts %w(member_id spm mpm ser pd extra total).join(\"\\t\");\n @members.each do |m|\n m.costs[:total] = m.costs[:spm] + m.costs[:mpm] + m.costs[:ser] + m.costs[:pd] + m.costs[:extra];\n print_cost = [:spm, :mpm, :ser, :pd, :extra, :total].map{|x| m.costs[x]}.join(\"\\t\");\n puts [m.member_id, print_cost].join(\"\\t\") unless @to_stdout;\n @coverage += m.costs[:total];\n end\n\n puts \"Total operating cost = #{@total_op_cost}, coverage = #{@coverage}\";\n diff = @total_op_cost - @coverage;\n if @coverage > @total_op_cost then\n puts \"We are charging %.10f too much\" % diff.abs;\n elsif @coverage < @total_op_cost then\n puts \"We are charging %.10f too little\" % diff.abs;\n end\n\n # If we are off more than one dollar per member, adjust.\n if diff.abs > (@members.size / 100.0) then\n diff_per_member = diff.to_f / @members.size;\n deet(\"diff_per_member\\t#{diff_per_member}\");\n @members.each do |m|\n m.costs[:extra] += diff_per_member;\n end\n puts \"Adding #{diff_per_member} as extra cost to each member.\";\n puts \"Running the numbers again...\";\n return coverage();\n else\n puts \"... but the diff is so small that we don't care.\";\n end\n\n data(%w(member_id spm mpm ser pd weight extra total).join(\"\\t\"));\n @members.each do |m|\n data(m.to_s);\n end\n\n unless @to_stdout\n @data.close();\n @deet.close();\n end\n end", "def create\n @med_coverage = MedCoverage.new(med_coverage_params)\n @med_coverage.user = current_user\n\n respond_to do |format|\n if @med_coverage.save\n format.html { redirect_to @med_coverage, notice: 'Med coverage was successfully created.' }\n format.json { render :show, status: :created, location: @med_coverage }\n else\n format.html { render :new }\n format.json { render json: @med_coverage.errors, status: :unprocessable_entity }\n end\n end\n end", "def complete_coverage\n lines = File.read(@filename).encode(\"utf-8\", invalid: :replace).lines\n\n lines.each_with_index do |line, lineno|\n # multi-line arrays\n mark_multiline(\n lines, lineno,\n /\\A[^\\n]*\\b=\\([^()]*\\)/,\n forward: false\n )\n\n # heredoc\n mark_multiline(\n lines, lineno,\n /\\A[^\\n]+<<-?'?(\\w+)'?.*$.*\\1/m\n )\n\n # multiline string concatenated with backslashes\n mark_multiline(\n lines, lineno,\n /\\A[^\\n]+\\\\$(\\s*['\"][^'\"]*['\"]\\s*\\\\$){1,}\\s*['\"][^'\"]*['\"]\\s*$/\n )\n\n # simple line continuations with backslashes\n mark_multiline(\n lines, lineno,\n /\\A([^\\n&|;]*[^\\\\&|;](\\\\\\\\)*\\\\\\n)+[^\\n&|;]*[^\\n\\\\&|;](\\\\\\\\)*$/\n )\n\n # multiline string concatenated with newlines\n %w[' \"].each do |char|\n mark_multiline(\n lines, lineno,\n /\\A[^\\n]+[\\s=]+#{char}[^#{char}]*#{char}/m,\n forward: false\n )\n end\n\n mark_line(line, lineno)\n end\n end", "def report\n \n end", "def index\n @coverages = Coverage.all\n end", "def coverage_summary(response)\n unless (@user_request.title_level_citation? &&\n umlaut_config.lookup!(\"resolve_display.show_coverage_summary\", false) &&\n (response[:coverage_begin_date] || response[:coverage_end_date]))\n return nil\n end\n\n start = response[:coverage_begin_date].try(:year) || I18n.t(\"umlaut.citation.coverage_summary.open_start\")\n finish = response[:coverage_end_date].try(:year) || I18n.t(\"umlaut.citation.coverage_summary.open_end\")\n\n content_tag(\"span\", :class=>\"coverage_summary\") do\n \"#{start} – #{finish}:\"\n end\n end", "def create\n @coverage_type = CoverageType.new(coverage_type_params)\n\n respond_to do |format|\n if @coverage_type.save\n format.html { redirect_to @coverage_type, notice: 'Coverage type was successfully created.' }\n format.json { render :show, status: :created, location: @coverage_type }\n else\n format.html { render :new }\n format.json { render json: @coverage_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def report; end", "def report; end", "def report; end", "def report; end", "def report; end", "def coverage\n if Experiment.find(params[:id]).uses_bam_file #return a pileup from samtools...\n\n else #return a position keyed hash of Positions objects\n features = Feature.find_in_range(params[:reference_id], params[:start], params[:end], params[:id])\n sequence = Reference.find(params[:reference_id]).sequence.sequence[params[:start].to_i - 1, (params[:end].to_i - params[:start].to_i)]\n positions = SimpleDepth.new(params[:start], params[:end], sequence, features)\n #comp_hash = {'A' => 'T', 'T' => 'A', 'G' => 'C', 'C' => 'G', 'N' => 'N'}\n #positions = Hash.new {|h,k| h[k] = {\n # '+' => {\n # 'A' => 0,\n # 'T' => 0,\n # 'G' => 0,\n # 'C' => 0,\n # 'N' => 0,\n # 'strand_total' => 0\n # },\n # '-' => {\n # 'A' => 0,\n # 'T' => 0,\n # 'G' => 0,\n # 'C' => 0,\n # 'N' => 0,\n # 'strand_total' => 0\n # },\n # 'position_total' => 0\n # }\n #}\n #positions['region_total'] = 0\n #positions['1'] = 1\n #features = Feature.find_in_range_no_overlap(params[:reference_id],params[:start],params[:end],params[:id])\n #features.each do |f|\n # if (f.sequence.match(/\\w/))\n # (f.start .. f.end - 1).each_with_index do |i, idx|\n # positions[i][f.strand][f.sequence[idx,1]] += 1\n # positions[i][f.strand]['strand_total'] += 1\n # positions[i]['position_total'] += 1\n # positions['region_total'] += 1\n # end\n # end\n end\n respond(positions)\n end", "def puts_summary(io)\n io.puts(\"\\n#{[coverage_text, successful_text, failed_text, total_text].join(' ')}\")\n end", "def create\n @plan = Plan.find(params[:plan_id])\n @incident = Incident.find(@plan.incident_id)\n @cover = Cover.new(cover_params)\n\n respond_to do |format|\n if @cover.save\n format.html { redirect_to incident_plan_cover_path(@incident, @plan, @cover) }\n format.json { render :show, status: :created, location: @cover }\n else\n format.html { render :new }\n format.json { render json: @cover.errors, status: :unprocessable_entity }\n end\n end\n end", "def show_total_coverage\n unless @project.nil?\n markdown total_coverage_markdown\n end\n end", "def produce_report(*args)\n # Check xcov availability, install it if needed\n `gem install xcov` unless xcov_available?\n unless xcov_available?\n puts \"xcov is not available on this machine\"\n return\n end\n\n require \"xcov\"\n require \"fastlane_core\"\n\n # Init Xcov\n config = FastlaneCore::Configuration.create(Xcov::Options.available_options, convert_options(args.first))\n Xcov.config = config\n Xcov.ignore_handler = Xcov::IgnoreHandler.new\n\n # Init project\n report_json = nil\n manager = Xcov::Manager.new(config)\n\n if Xcov.config[:html_report] || Xcov.config[:markdown_report] || Xcov.config[:json_report]\n # Parse .xccoverage and create local report\n report_json = manager.run\n else\n # Parse .xccoverage\n report_json = manager.parse_xccoverage\n end\n\n # Map and process report\n process_report(Xcov::Report.map(report_json))\n end", "def create\n @report = Report.new(report_params)\n\n respond_to do |format|\n if @report.save\n \n @report.test_suite.test_cases.each do |test_case|\n @report.results.create({ status: 'Queued', report_id: @report, test_case_id: test_case.id})\n end\n \n format.html { redirect_to [:admin, @report], notice: 'Report was successfully created.' }\n format.json { render action: 'show', status: :created, location: @report }\n else\n format.html { render action: 'new' }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def write_cocina_success_to_file(response)\n return unless Settings.cocina_output.success.should_output\n write_druid_response_to_file(Settings.cocina_output.success.location, Util.faraday_response_to_json(response))\n end", "def individual_coverage_message(covered_files)\n require 'terminal-table'\n\n message = \"### Code Coverage\\n\\n\"\n table = Terminal::Table.new(\n headings: %w(File Coverage),\n style: { border_i: '|' },\n rows: covered_files.map do |file|\n [file[:filename], \"#{format('%.02f', file[:covered_percent])}%\"]\n end\n ).to_s\n message + table.split(\"\\n\")[1..-2].join(\"\\n\")\n end", "def coverage(project_name)\n section \"coverage\", \"rm -rf hpc_report\", :condition => $tests_compiled_coverage, :noexception => true do\n hpc_excluded_modules = ((Dir.glob(\"test/**/*Spec.hs\") # skip all test-spec files\n .map { |k| k.gsub(/^test\\//, \"\") # ...converting path to namespace for HPC\n .gsub(/\\.hs$/,\"\")\n .gsub(\"/\",\".\")\n }\n ) << \"Main\" # and skip \"Main\", the entrypoint for tests\n ).map{|k| \"--exclude=#{k}\" }.join(\" \")\n command_interactive \"hpc report #{project_name}.tix #{hpc_excluded_modules}\"\n command_interactive \"hpc markup #{project_name}.tix --destdir=hpc_report #{hpc_excluded_modules}\"\n end\nend", "def create\n @spatial_coverage = SpatialCoverage.new(params[:spatial_coverage])\n\n respond_to do |format|\n if @spatial_coverage.save\n format.html { redirect_to @spatial_coverage, notice: 'Spatial Coverage was successfully created.' }\n format.json { render json: @spatial_coverage, status: :created, location: @spatial_coverage }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spatial_coverage.errors, status: :unprocessable_entity }\n end\n end\n end", "def analyze\n format_results\n end", "def gettestcoverage\n\tstandName = params[:release]\n\t# получаем список тестов\n\n\ttestlist = ''\n\tTCPSocket.open('172.20.5.130', 2000){ |client|\n\t# say Hello to server\n\tclient.puts \"MasterOnline\"\n\tclient.gets\n\tclient.puts \"master_set get_test_coverage \" + standName\n\t#workerList = JSON.parse(client.gets)\n\ttestlist = client.gets\n\tclient.puts \"master_set close_connection\"\n\t}\n\tputs \"TestcontrolController - gettestcoverage\"\n\ttest = '{\"dataArray\" : [{\"name\" : \"PriorityName\", \"value\" : [\"testName1\", \"testName2\", \"testName3\"]}, {\"name\" : \"PriorityName\", \"value\" : [\"testName1\", \"testName2\", \"testName3\"]}]}'\n\trender :text => testlist\n end", "def show\n @coverage = Coverage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coverage }\n end\n end", "def postSuccessResult(caseId)\n puts \"----------------------------------------------------------------------------------\"\n puts \"\"\n @testRailUtility.postResult(caseId,\"Pass\",1,@runId)\n @passedLogs = @objRollbar.addLog(\"[Result ] Success\")\nend", "def run\n # Clear out previous run\n @result = nil\n\n field_stream = FieldStream.new\n @xtrace = Xtrace.new(field_stream)\n\n fd = @xtrace.file_descriptor\n env = { \"PS4\" => Xtrace.ps4 }\n options = { in: :in }\n\n if Bashcov.options.mute\n options[:out] = \"/dev/null\"\n options[:err] = \"/dev/null\"\n end\n\n run_xtrace(fd, env, options) do\n command_pid = Process.spawn env, *@command, options # spawn the command\n\n begin\n # start processing the xtrace output\n xtrace_thread = Thread.new { @xtrace.read }\n\n Process.wait command_pid\n\n @xtrace.close\n\n @coverage = xtrace_thread.value # wait for the thread to return\n rescue XtraceError => e\n write_warning <<-WARNING\n encountered an error parsing Bash's output (error was:\n #{e.message}). This can occur if your script or its path contains\n the sequence #{Xtrace.delimiter.inspect}, or if your script unsets\n LINENO. Aborting early; coverage report will be incomplete.\n WARNING\n\n @coverage = e.files\n end\n end\n\n $?\n end", "def merge_shards(coverage_result_filenames)\n final_result = {}\n\n # collapse results from each shard in each file\n coverage_results = coverage_result_filenames.sort.flat_map do |result_filename|\n result_file = JSON.parse(IO.read(result_filename))\n result_file.values.map {|shard| shard['coverage'] }\n end\n\n # process each result\n puts \"CoverageEnforcer: Merging #{coverage_results.size} result shards...\"\n coverage_results.each_with_index do |result, result_index|\n result.keys.each do |filename|\n lines = result[filename]['lines']\n if !final_result.has_key?(filename)\n final_result[filename] = { 'lines' => lines }\n next\n end\n\n # merge\n existing_lines = final_result[filename]['lines']\n if existing_lines.size != lines.size\n puts \"CoverageEnforcer: WARNING, line length does not match for #{filename}\"\n end\n existing_lines.each_with_index do |existing_line, line_index|\n if existing_line.nil? && !lines[line_index].nil? || !existing_line.nil? && lines[line_index].nil?\n puts \"CoverageEnforcer: WARNING, one line is nil but the other is not for #{filename}\"\n end\n if !lines[line_index].nil?\n debug \" L#{line_index+1} += #{lines[line_index]}\"\n final_result[filename]['lines'][line_index] += lines[line_index]\n end\n end\n end\n end\n final_result\n end", "def report_body; end", "def report_body; end", "def report_results(result, score)\n api_token = ENV[\"API_TOKEN\"]\n test_url = ENV[\"API_URL\"]\n track_id = ENV[\"TRACK_ID\"]\n\n test_number = result.name[5..6]\n if test_number == \"58\" #final test code\n puts \"Congratulations on passing the tests!\"\n passed_tests = true\n end\n\n if api_token && test_url && (result.result_code != '.' || passed_tests)\n puts \"Reporting results...\"\n require \"net/http\"\n params = {'test_number'=> score,\n 'api_token' => api_token,\n 'track_id' => track_id\n }\n begin\n res = Net::HTTP.post_form(URI.parse(test_url), params)\n if res.code == \"200\"\n puts \"Results successfully submitted to #{test_url}\"\n end\n rescue\n puts \"Failed to submit results.\"\n end\n end\n end", "def total_coverage_markdown\n unless @project.nil?\n \"### Total coverage: **`#{@project.decimal_f([total_coverage])}%`**\\n\"\n end\n end", "def getCoverage\n cov_string = @xml.xpath('./dc:coverage/text()').first.to_s.gsub(/\\s+/,\" \").gsub(/-+/,\"-\").gsub(/-/,\" -- \")\n coverage = []\n coverage << cov_string\n coverage.concat(cov_string.split(' -- '))\n coverage2 = []\n coverage.each do |c|\n coverage2 << c.strip\n end\n @doc[:geographic_subject_facet] = coverage2.uniq\n @doc[:text] << @doc[:geographic_subject_facet].flatten\n end", "def process\n ReportAdapter.new(report: runner.run(run_options), root: root).each do |issue|\n io.print issue.to_json\n io.print \"\\0\"\n end\n end", "def report(*args)\n options = args.first\n sort_order = options && options[:sort]\n if sort_order && !sort_order.eql?(:ascending) && !sort_order.eql?(:descending)\n raise(ArgumentError.new('Invalid configuration, use [:ascending, :descending]'))\n end\n\n check_auth(options)\n\n items = coverage_items\n items.select! { |item| file_in_changeset?(item.file) }\n items.each(&method(:update_item))\n items.sort_by! do |item|\n if sort_order.eql?(:ascending)\n item.total\n else\n -item.total\n end\n end\n items.each(&method(:add_entry))\n\n return if @table.size.zero?\n\n markdown(\"#{TABLE_TITLE}\\n\\n#{@table.to_markdown}\")\n end", "def emailResults()\n obj = EmailHelper.new()\n emailSubject = \"Illumina Capture Stats : Flowcell \" + @fcBarcode.to_s\n emailFrom = \"[email protected]\" \n emailText = @captureResults.formatForSTDOUT()\n emailTo = obj.getCaptureResultRecepientEmailList()\n\n begin\n obj.sendEmail(emailFrom, emailTo, emailSubject, emailText)\n rescue Exception => e\n puts e.message \n puts e.backtrace.inspect\n end\n end", "def assign_date_coverage\n cov_interval = Dataset::DateCoverageService.params_to_interval params\n params[PARAMS_KEY]['date_coverage'] = cov_interval ? cov_interval.edtf : \"\"\n end", "def set_information_coverage\n @information_coverage = InformationCoverage.find(params[:id])\n end", "def create\n @cov_recovered = CovRecovered.new(cov_recovered_params)\n # @cov_recovered.city = City.friendly.find(params[:cov_recovered][:city_id])\n\n\n @city = City.find(@cov_recovered.city.id)\n\n \n if (@city.cov_recovered_count == 0)\n @diff_amount = @city.cov_recovered_count + @cov_recovered.amount\n else\n @diff_amount = @cov_recovered.amount - @city.cov_recovered_count\n end\n\n @cov_recovered.amount = @diff_amount\n # @cov_recovered.save\n\n # @cov_positive = CovPositive.new\n # @cov_positive.city = @city\n # @cov_positive.amount = @cov_recovered.amount * -1\n # @cov_positive.added_at = @cov_recovered.added_at\n # @cov_positive.save\n\n @city.cov_recovered_count += @cov_recovered.amount\n # @city.cov_positive_count -= @cov_recovered.amount\n @city.save\n\n respond_to do |format|\n if @cov_recovered.save\n format.html { redirect_to @cov_recovered, notice: 'Cov recovered was successfully created.' }\n format.json { render :show, status: :created, location: @cov_recovered }\n else\n format.html { render :new }\n format.json { render json: @cov_recovered.errors, status: :unprocessable_entity }\n end\n end\n end", "def report!\n # Borrowed from simplecov#41\n #\n # If an exception is thrown that isn't a \"SystemExit\", we need to capture\n # that error and re-raise.\n if $!\n exit_status = $!.is_a?(SystemExit) ? $!.status : EXIT_FAILURE\n else\n exit_status = EXIT_SUCCESS\n end\n\n report = {}.tap do |h|\n h[:total] = @collection.size\n h[:touched] = @collection.count { |_, resource| resource.touched? }\n h[:coverage] = ((h[:touched] / h[:total].to_f) * 100).round(2)\n end\n\n report[:untouched_resources] = @collection.collect do |_, resource|\n resource unless resource.touched?\n end.compact\n report[:all_resources] = @collection.values\n\n @outputs.each do |block|\n instance_exec(report, &block)\n end\n\n # Ensure we exit correctly (#351)\n Kernel.exit(exit_status) if exit_status && exit_status > 0\n end", "def generate_report()\n system(\"java -cp emma.jar emma report -r html -in coverage.em,coverage.ec\")\nend", "def process(result)\n # :nocov:\n raise NotImplementedError\n # :nocov:\n end", "def testResult(code)\n require 'sicuro'\n logger.info\"................................#{code}\"\n @codeResult = Sicuro.eval(code)\n logger.info \"............................ #{@codeResult}\"\n (@codeResult.stdout).gsub(/(?:\\n\\r?|\\r\\n?)/, '<br>')\n end", "def publish_test_results(test_category, test_phase, test_suite_result_list)\n ReportLog.entering(@@class_name, __method__.to_s)\n\n test_suite_result_list.each do |test_suite_result|\n test_suite_name = test_suite_result['TestSuiteName']\n test_count = test_suite_result['TestCount'].to_i\n error_count = test_suite_result['ErrorCount'].to_i\n failure_count = test_suite_result['FailureCount'].to_i\n\n pass_rate = 1 - (error_count.to_f + failure_count.to_f)/test_count.to_f\n\n input = Hash.new\n input[:RTCConfig] = data_for(:RTC_config)\n\n if pass_rate < get_threshold_value(data_for(:RTC_defect_threshold)[:minor_threshold])\n # pass rate standard not met, create or update existing defect\n if pass_rate < get_threshold_value(data_for(:RTC_defect_threshold)[:blocker_threshold])\n defect_severity = Constants::RTC_SEVERITY_BLOCKER\n elsif pass_rate < get_threshold_value(data_for(:RTC_defect_threshold)[:major_threshold])\n defect_severity = Constants::RTC_SEVERITY_MAJOR\n elsif pass_rate < get_threshold_value(data_for(:RTC_defect_threshold)[:normal_threshold])\n defect_severity = Constants::RTC_SEVERITY_NORMAL\n else\n defect_severity = Constants::RTC_SEVERITY_MINOR\n end\n\n # Check from the TEST DB whether there is already an open defect for this test suite\n # if yes, update it\n # if no, create a new one\n\n # set up RTC client and run /getOpenTestAutoDefect API\n ReportLog.info('Pass rate beneath standard. Update existing open defect or create a new one.')\n ReportLog.info(\"Looking for open defect for test suite #{test_suite_name} ...\")\n @api = RTCClientRestAPI.new(data_for(:RTC_client_api_url)[:RTC_REST_URL_getOpenTestAutoDefect])\n @payload = JSON.generate(input)\n @params = Hash.new\n @params[Constants::PARAM_TEST_SUITE_NAME] = test_suite_name\n rtc_client = RTCRestClient.new(Constants::REST_TYPE_PUT, @api, @params, @payload)\n rtc_client.run_api\n if rtc_client.run_successfully\n @params = Hash.new\n @params[Constants::PARAM_TEST_CATEGORY] = test_category\n @params[Constants::PARAM_TEST_PHASE] = test_phase\n @params[Constants::PARAM_DEFECT_SEVERITY] = defect_severity\n input['TestSuiteResult'] = test_suite_result\n @payload = JSON.generate(input)\n if rtc_client.response_body.fetch(Constants::JSON_KEY_RESULT).nil?\n # no existing open defect, create a new one\n ReportLog.info('Open defect not found. Creating a new one...')\n # set up RTC client and run /createTestAutoDefect API\n @api = RTCClientRestAPI.new(data_for(:RTC_client_api_url)[:RTC_REST_URL_createTestAutoDefect])\n rtc_client = RTCRestClient.new(Constants::REST_TYPE_POST, @api, @params, @payload)\n rtc_client.run_api\n if rtc_client.run_successfully\n ReportLog.info('Created a new defect.')\n ReportLog.info(\"RTC client response: #{rtc_client.response_body.to_s}\")\n else\n raise construct_api_failure_msg(rtc_client)\n end\n else\n # existing open defect found, update it\n ReportLog.info('Open defect found. Updating its content...')\n # set up RTC client and run /updateTestAutoDefect API\n @api = RTCClientRestAPI.new(data_for(:RTC_client_api_url)[:RTC_REST_URL_updateTestAutoDefect])\n @params[Constants::PARAM_DEFECT_NUM] = rtc_client.response_body.fetch(Constants::JSON_KEY_RESULT).fetch('Defect Number').to_s\n rtc_client = RTCRestClient.new(Constants::REST_TYPE_POST, @api, @params, @payload)\n rtc_client.run_api\n if rtc_client.run_successfully\n ReportLog.info('Updated the open defect.')\n ReportLog.info(\"RTC client response: #{rtc_client.response_body.to_s}\")\n else\n raise construct_api_failure_msg(rtc_client)\n end\n end\n else\n raise construct_api_failure_msg(rtc_client)\n end\n else\n # pass rate reached standard, close open defect automatically\n # Check from the TEST DB whether there is already an open defect for this test suite\n # if yes, close it\n # if no, do nothing, you are good\n\n # set up RTC client for /getOpenTestAutoDefect API\n ReportLog.info('Pass rate reached standard. Close open defect if there is any.')\n ReportLog.info(\"Looking for open defect for test suite #{test_suite_name} ...\")\n @api = RTCClientRestAPI.new(data_for(:RTC_client_api_url)[:RTC_REST_URL_getOpenTestAutoDefect])\n @payload = JSON.generate(input)\n @params = Hash.new\n @params[Constants::PARAM_TEST_SUITE_NAME] = test_suite_name\n rtc_client = RTCRestClient.new(Constants::REST_TYPE_PUT, @api, @params, @payload)\n rtc_client.run_api\n if rtc_client.run_successfully\n @params = Hash.new\n if rtc_client.response_body.fetch(Constants::JSON_KEY_RESULT).nil?\n # do nothing\n else\n # existing open defect found, close it\n ReportLog.info('Open defect found. Closing it...')\n # set up RTC client and run /closeTestAutoDefect API\n @api = RTCClientRestAPI.new(data_for(:RTC_client_api_url)[:RTC_REST_URL_closeTestAutoDefect])\n @params[Constants::PARAM_DEFECT_NUM] = rtc_client.response_body.fetch(Constants::JSON_KEY_RESULT).fetch('Defect Number').to_s\n @params[Constants::PARAM_COMMENT] = \"Closed defect upon test execution at #{test_suite_result['ExecutionTimestamp']} \"\n + \"from build #{test_suite_result['Build']['BuildName']} \"\n + \"with an acceptable pass rate of #{pass_rate}.\"\n @params[Constants::PARAM_BUILD_NAME] = test_suite_result['Build']['BuildName']\n rtc_client = RTCRestClient.new(Constants::REST_TYPE_PUT, @api, @params, @payload)\n rtc_client.run_api\n if rtc_client.run_successfully\n ReportLog.info('Closed the open defect.')\n ReportLog.info(\"RTC client response: #{rtc_client.response_body.to_s}\")\n else\n raise construct_api_failure_msg(rtc_client)\n end\n end\n else\n raise construct_api_failure_msg(rtc_client)\n end\n end\n end\n ReportLog.exiting(@@class_name, __method__.to_s)\n end", "def run\n Salesforce.set_http(session[:accesstoken], session[:accessurl])\n \t@response = Salesforce.run_report(params)\n @describe = Salesforce.describe_report(params)\n \trespond_to do |format|\n format.json { render :json => {:data => @response, :meta => @describe}.to_json}\n \tend\n end", "def run(args)\n begin\n command = @ceedling[:tool_executor].build_command_line(TOOLS_GCOV_GCOVR_POST_REPORT, [], args)\n shell_result = @ceedling[:tool_executor].exec(command[:line], command[:options])\n @reportinator_helper.print_shell_result(shell_result)\n rescue\n # handle any unforeseen issues with called tool\n exitcode = $?.exitstatus\n show_gcovr_message(exitcode)\n exit(exitcode)\n end\n end", "def update\n respond_to do |format|\n if @insurance_coverage.update(insurance_coverage_params)\n format.html { redirect_to @insurance_coverage, notice: 'Insurance coverage was successfully updated.' }\n format.json { render :show, status: :ok, location: @insurance_coverage }\n else\n format.html { render :edit }\n format.json { render json: @insurance_coverage.errors, status: :unprocessable_entity }\n end\n end\n end", "def parse_output(_report, _result, _targets); end", "def script\n sh.raw \"echo -en 'coverity_scan:start\\\\r'\"\n sh.if \"${COVERITY_VERBOSE} = 1\", echo: true do\n sh.raw \"set -x\"\n end\n sh.set 'PROJECT_NAME', @config[:project][:name], echo: true\n set_coverity_scan_branch\n sh.if \"${COVERITY_SCAN_BRANCH} = 1\", echo: true do\n sh.raw \"echo -e \\\"\\033[33;1mCoverity Scan analysis selected for branch \\\"$TRAVIS_BRANCH\\\".\\033[0m\\\"\"\n authorize_quota\n build_command\n end\n sh.raw \"echo -en 'coverity_scan:end\\\\r'\"\n end", "def report(output)\n end", "def event_coverage4xml(event)\n cov4xml = {:estado => 'no', :imagen => nil, :iframe_src => nil, :url => nil}\n if event.stream_flow\n cov4xml[:estado] = 'previsto'\n if event.on_air?\n cov4xml[:estado] = 'emitiendo'\n cov4xml[:iframe] = \"http://#{request.host_with_port}/iframe/streaming/#{@event.stream_flow.id}\"\n else\n if event.announced?\n cov4xml[:estado] = 'anunciado'\n cov4xml[:imagen] = \"http://#{request.host_with_port}#{@event.stream_flow.photo_path}\"\n else\n if event.passed?\n if related_news = event.related_news_published\n cov4xml[:estado] = 'noticia'\n cov4xml[:url] = \"http://#{request.host_with_port}#{news_path(related_news)}\"\n end\n end\n end\n end\n else\n if related_news = event.related_news_published\n cov4xml[:estado] = 'noticia'\n cov4xml[:url] = \"http://#{request.host_with_port}#{news_path(related_news)}\"\n else\n cov4xml[:estado] = 'sin cobertura'\n end\n end\n cov4xml\n end", "def create_insurance_coverage_using_post(insurance_coverage, opts = {})\n data, _status_code, _headers = create_insurance_coverage_using_post_with_http_info(insurance_coverage, opts)\n data\n end", "def option_coverage\n option_parser.on('-c', '--covered', 'include covered units') do\n if options[:coverage] == :uncovered\n options[:coverage] = :all\n else \n options[:coverage] = :covered\n end\n end\n option_parser.on('-u', '--uncovered', 'include only uncovered units') do\n if options[:coverage] == :covered\n options[:coverage] = :all\n else\n options[:coverage] = :uncovered\n end\n end\n option_parser.on('-a', '--all', 'include all namespaces and units') do\n options[:coverage] = :all\n end\n end", "def dumpScannedResult()\n file = scannedResultFilename() ;\n system(\"mkdir -p #{File::dirname(file)}\") ;\n open(file, \"w\") {|strm|\n strm << JSON.pretty_generate(toJson()) << \"\\n\" ;\n }\n end", "def report\n\t\tend", "def coverage( idx )\n if @cov_ab[ idx ] == nil\n @cov_ab[ idx ] = VcfTools.get_coverage( @data[:info], @data[:samples][idx] )\n end\n return @cov_ab[ idx ]\n end", "def compile_results results\n def @raw_barcode.to_yaml_style; :inline; end\n def @raw_marked_votes.to_yaml_style; :inline; end\n result[:raw_barcode] = @raw_barcode\n result[:raw_marked_votes] = @raw_marked_votes\n end", "def to_h\n { filename: filename,\n covered_percent: covered_percent,\n coverage: coverage_data,\n covered_strength: covered_strength,\n covered_lines: covered_lines_count,\n lines_of_code: lines_of_code }\n end", "def calculate_results\n Repository::Config.new(@repo, @log, @process, @type).status(5) {\n files = files_to_analyze\n puts '-----Files to analyze done (Step 1)'\n files = prepare_files_to_rate files\n puts '-----Prepare files to rate done (Step 2)'\n files = count_total_lines files\n puts '-----Count total lines done (Step 3)'\n files = count_errors files\n puts '-----Count errors done (Step 4)'\n files = grade_categories files\n puts '-----Grade categories done (Step 5)'\n files = grade_files files\n puts '-----Grade files done (Step 6)' + files.to_s\n gpa = grade_repo files\n puts '-----Grade repos done (Step 7)' + gpa.to_s\n gpa_percent = get_overall_grades files\n puts '-----Grade overall percentage done (Step 8)' + gpa_percent.to_s\n cat_issues = get_category_issues files\n puts '-----Get categories issues done (Step 9)' + cat_issues.to_s\n store_cat_issues cat_issues\n puts '-----Store category issues done (Step 10)'\n store_grades gpa, gpa_percent\n puts '-----Store grades done (Step 11)'\n }\n end", "def perform_coverage(options)\n unless @test_suite.nil?\n if options.illuminator.task.coverage #TODO: only if there are no crashes?\n if Illuminator::HostUtils.which(\"gcovr\").nil?\n puts \"Skipping requested coverage generation because gcovr does not appear to be in the PATH\".yellow\n else\n generate_coverage Dir.pwd\n end\n end\n end\n end", "def export\n result = Urlmaster.all\n head = 'EF BB BF'.split(' ').map{|a|a.hex.chr}.join()\n exportFile = CSV.generate(csv = head) do |writer|\n writer << [\"mapId\", \"venueName\", \"floor\", \"typeMap\", \"venueFloorMapImageUrl\", \"venueFloorMapUrl\"]\n result.each do |r|\n writer << [r[:mapId], r[:venueName], r[:floor], r[:typeMap], r[:venueFloorMapImageUrl], r[:venueFloorMapUrl]]\n end\n end\n send_data exportFile, filename: \"MapCrawler-#{Time.now.in_time_zone(\"Asia/Tokyo\").strftime(\"%y%m%d%H%M%S\")}.csv\", type: \"text/csv\"\n # redirect_to crawler_path\n end", "def index\n @insurance_coverages = InsuranceCoverage.all\n end", "def run_tests\n test_suite = self.task.tests.order(:order)\n testsStrings = test_suite.map do |test|\n test_string = task.fxn_name + \"(\"\n test_string + \"...\"+test.parsed_inputs.to_s + \")\"\n end\n formated_user_code = self.solution.gsub(\"\\n\", \" \")\n data = JSON.dump({user_code: formated_user_code, tests: testsStrings})\n uri = URI.parse(\"https://wci7v1nq8j.execute-api.us-west-2.amazonaws.com/v1\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(uri.request_uri)\n request.body = data\n response = http.request(request)\n response = JSON.parse(response.body)\n if response[\"errorMessage\"]\n message = response[\"errorMessage\"]\n if message.include?(\"timed out\")\n message = \"Task timed out after 4.00 seconds\"\n end\n return {error: true, error_message: message }\n end\n user_results = response[\"results\"]\n test_results = {log: response[\"log\"].gsub(\"\\n\", \"<br/>\"), results: {} }\n test_suite.each_with_index do |test, idx|\n result = user_results[idx]\n passed = result == test.output\n test_result = {\n passed: passed,\n expected: test.output.to_s,\n received: result.to_s\n }\n test_results[:results][test.order] = test_result\n end\n handle_completion(test_results[:results])\n test_results\n end", "def test \r\n\r\nrequire 'csv'\r\n\r\n@output = CSV.read(\"/production/sites/sislsrs/public/batch/results/20150616t121533r8504/output.csv\", headers:true, header_converters: :symbol, converters: :all, col_sep: \",\").collect {|row| row.to_hash}\r\n\r\nrequire 'dbf'\r\nrequire \"#{Rails.root}/app/helpers/dbf-helper\"\r\n\r\n# prepare the fields array, which defines the dbf structure\r\nfields = Array.new\r\nfields.push({:field_name=>\"POLY_ID\", :field_size=>13, :field_type=>\"C\", :decimals=>0})\r\nfields.push({:field_name=>\"CMP_ID\", :field_size=>15, :field_type=>\"C\", :decimals=>0})\r\nfields.push({:field_name=>\"POLY_RATING\", :field_size=>20, :field_type=>\"C\", :decimals=>0})\r\nfields.push({:field_name=>\"CMP\", :field_size=>2, :field_type=>\"N\", :decimals=>0})\r\nfields.push({:field_name=>\"PERCENT\", :field_size=>3, :field_type=>\"N\", :decimals=>0})\r\nfields.push({:field_name=>\"CMP_CLASS\", :field_size=>8, :field_type=>\"C\", :decimals=>0})\r\nfields.push({:field_name=>\"CLIMATE_POINTS\", :field_size=>3, :field_type=>\"N\", :decimals=>0})\r\nfields.push({:field_name=>\"CLIMATE_CLASS\", :field_size=>8, :field_type=>\"C\", :decimals=>0})\r\nfields.push({:field_name=>\"PROVINCE\", :field_size=>2, :field_type=>\"C\", :decimals=>0})\r\nfields.push({:field_name=>\"SOIL_CODE\", :field_size=>8, :field_type=>\"C\", :decimals=>0})\r\nfields.push({:field_name=>\"SOIL_NAME\", :field_size=>30, :field_type=>\"C\", :decimals=>0})\r\nfields.push({:field_name=>\"SOIL_POINTS\", :field_size=>3, :field_type=>\"N\", :decimals=>0})\r\nfields.push({:field_name=>\"SOIL_CLASS\", :field_size=>8, :field_type=>\"C\", :decimals=>0})\r\nfields.push({:field_name=>\"LANDSCAPE_POINTS\", :field_size=>3, :field_type=>\"N\", :decimals=>0})\r\nfields.push({:field_name=>\"LANDSCAPE_CLASS\", :field_size=>8, :field_type=>\"C\", :decimals=>0})\r\n\r\n# prepare the records array, which contains the content\r\nrecords = Array.new \r\nrownum = 0\r\nfor csvRow in @output\r\ndbaseRow = Hash.new\r\ndbaseRow[:POLY_ID] = csvRow[:poly_id]\r\ndbaseRow[:CMP_ID] = csvRow[:cmp_id]\r\ndbaseRow[:POLY_RATING] = csvRow[:poly_rating]\r\ndbaseRow[:CMP] = csvRow[:cmp]\r\ndbaseRow[:PERCENT] = csvRow[:percent]\r\ndbaseRow[:CMP_CLASS] = \"#{csvRow[:cmp_class]}\"\r\ndbaseRow[:CLIMATE_POINTS] = csvRow[:climate_points]\r\ndbaseRow[:CLIMATE_CLASS] = csvRow[:climate_class]\r\ndbaseRow[:PROVINCE] = csvRow[:province]\r\ndbaseRow[:SOIL_CODE] = csvRow[:soil_code]\r\ndbaseRow[:SOIL_NAME] = csvRow[:soil_name]\r\ndbaseRow[:SOIL_POINTS] = csvRow[:soil_points]\r\ndbaseRow[:SOIL_CLASS] = csvRow[:soil_class]\r\ndbaseRow[:LANDSCAPE_POINTS] = csvRow[:landscape_points]\r\ndbaseRow[:LANDSCAPE_CLASS] = csvRow[:landscape_class]\r\nrecords[rownum] = dbaseRow # add the completed hash to the records array\r\nrownum += 1\r\nend\r\n\r\ndbf_writer(\"/production/sites/sislsrs/public/batch/results/20150616t121533r8504/output2.dbf\", fields, records)\r\n\r\n\r\n\r\nend", "def coverage(message, log = true)\n log_coverage(message) if log\n end", "def create\n @report = Report.new(report_params)\n city = report_params[:city]\n coords = TextMessage.get_coords(city)\n @report.country = coords[:country]\n @report.lat = coords[:lat]\n @report.lon = coords[:lon]\n climate = TextMessage.get_climate(coords[:lat], coords[:lon])\n @report.temp = climate[:temp]\n @report.prec = climate[:prec]\n @report.identity = request.remote_ip\n @report.destination = \"web\"\n respond_to do |format|\n if @report.save\n TextMessage.update_model(@report.crop, @report.statistic)\n format.html { redirect_to @report, notice: 'Report was successfully created.' }\n format.json { render :show, status: :created, location: @report }\n else\n format.html { render :new }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n end\n end\n end", "def json_report(test_report)\n test_report.to_json\n end", "def coverage_params\n params.require(:coverage).permit(:patientID, :policyID, :expirationDate)\n end", "def result_to_codecov_messages(result)\n result.files.each_with_object({}) do |file, memo|\n memo[shortened_filename(file)] = file.lines.each_with_object({}) do |line, lines_memo|\n lines_memo[line.line_number.to_s] = 'skipped' if line.skipped?\n end\n end\n end", "def translate_coverage_to_class(commits)\n if (commits.last[:coverage].to_f - commits.first[:coverage].to_f).round(2) >= ENV['CODECOV_TOLERANCE'].to_f\n return :falling\n elsif (commits.first[:coverage].to_f - commits.last[:coverage].to_f).round(2) <= -ENV['CODECOV_TOLERANCE'].to_f\n return :rising\n else\n return :flat\n end\nend" ]
[ "0.65205705", "0.63193846", "0.6281978", "0.6251065", "0.6242339", "0.6242339", "0.61436176", "0.596456", "0.59477377", "0.5916986", "0.5863341", "0.58586735", "0.5834669", "0.579967", "0.56979465", "0.5657497", "0.56272984", "0.5619089", "0.5618716", "0.56152403", "0.5611989", "0.55537903", "0.5529272", "0.55122006", "0.55035144", "0.55035144", "0.55035144", "0.54853565", "0.546339", "0.54607326", "0.5432612", "0.5426804", "0.5419491", "0.5395315", "0.5343907", "0.53437614", "0.53358305", "0.5332823", "0.5326897", "0.5326897", "0.5326897", "0.5326897", "0.5326897", "0.5320299", "0.53145", "0.5296221", "0.5279027", "0.5275404", "0.52722657", "0.52571946", "0.5253488", "0.5243869", "0.52378696", "0.52174836", "0.520829", "0.52075386", "0.520527", "0.5203085", "0.52012265", "0.5200297", "0.5200297", "0.5198204", "0.518517", "0.5178259", "0.51743525", "0.5144662", "0.5141758", "0.5115111", "0.5112721", "0.510947", "0.51091635", "0.5108509", "0.51000214", "0.5098047", "0.50931454", "0.5092245", "0.5089277", "0.5088802", "0.50820535", "0.5080321", "0.507334", "0.50698906", "0.50665545", "0.5066199", "0.5062114", "0.50600016", "0.5058597", "0.50581634", "0.5055213", "0.5054778", "0.5021755", "0.50212365", "0.501642", "0.5005315", "0.5004003", "0.499925", "0.4990343", "0.49872482", "0.49738455", "0.49623063", "0.4951466" ]
0.0
-1
the following methods are not intended for public use, but rather by Spec and Parser instances in this module
def _call_vet(what_to_check) if @vet.nil? then what_to_check else @vet.call what_to_check end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spec; end", "def spec; end", "def standard_specs; end", "def private; end", "def pluggable_parser; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def parser; end", "def parser; end", "def parser; end", "def parser; end", "def spec=(_arg0); end", "def parslet; end", "def parslet; end", "def parslet; end", "def parslet; end", "def matcher; end", "def matcher; end", "def configure_parser; end", "def parse()\n #This is a stub, used for indexing\n end", "def parse!\n raise NotImplementedError, \"this class is intended to be a top class, not a useful parser\"\n end", "def parse; end", "def parse; end", "def parse; end", "def parse\n raise NotImplementedError.new\n end", "def parsed\n raise NotImplementedError\n end", "def parsed; end", "def parsed; end", "def describe=(_); end", "def parse\n raise NotImplementedError\n end", "def parslets; end", "def underlying_matcher; end", "def underlying_matcher; end", "def parse\n raise \"absctract method called\"\n end", "def specification(full_name); end", "def parser=(_arg0); end", "def implementation; end", "def implementation; end", "def test_it_can_get_instance_of_parser\n parser = Rubasteme.parser\n refute_nil parser\n end", "def force_parse; end", "def test_parser_run\n Yay::PARSER_TESTS.each_pair { |input, expected|\n parser = Yay::Parser.new\n assert_equal expected, parser.parse(input), \"For |#{input}|\"\n }\n end", "def parse\n end", "def expected_method; end", "def spec(rb, context, parser=Pione::Lang::DocumentParser)\n basename = File.basename(rb, \".rb\")\n path = File.join(File.dirname(rb), \"data\", basename[5..-1] + \".yml\")\n YAML.load(File.read(path)).each do |name, testcase|\n context.describe name do\n if strings = testcase[\"valid\"]\n strings.each do |string|\n it \"should parse as %s:%s%s\" % [name, string.include?(\"\\n\") ? \"\\n\" : \" \", string.chomp] do\n should.not.raise(Parslet::ParseFailed) do\n parser.new.send(name).parse(string)\n end\n end\n end\n end\n\n if strings = testcase[\"invalid\"]\n strings.each do |string|\n it \"should fail when parsing as %s:%s%s\" % [name, string.include?(\"\\n\") ? \"\\n\" : \" \", string.chomp] do\n should.raise(Parslet::ParseFailed) do\n parser.new.send(name).parse(string)\n end\n end\n end\n end\n end\n end\n end", "def parse_context; end", "def parse_context; end", "def probers; end", "def submatchers; end", "def initialize(spec)\n @spec = spec\n end", "def test_parse\n @parser.meta_def(:parse_line) do |line|\n line.split(/\\s+/)\n end\n\n text = \"one line\\ntwo line\"\n should = [%w{one line}, %w{two line}]\n ret = nil\n assert_nothing_raised do\n ret = @parser.parse(text)\n end\n\n assert_equal(should, ret)\n end", "def tokens_spec\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 2)\n return_value = TokensSpecReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n __TOKENS13__ = nil\n char_literal15 = nil\n token_spec14 = nil\n\n tree_for_TOKENS13 = nil\n tree_for_char_literal15 = nil\n stream_TOKENS = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token TOKENS\")\n stream_T__72 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__72\")\n stream_token_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule token_spec\")\n begin\n # at line 110:4: TOKENS ( token_spec )+ '}'\n __TOKENS13__ = match(TOKENS, TOKENS_FOLLOWING_TOKENS_IN_tokens_spec_467) \n if @state.backtracking == 0\n stream_TOKENS.add(__TOKENS13__)\n end\n # at file 110:11: ( token_spec )+\n match_count_8 = 0\n loop do\n alt_8 = 2\n look_8_0 = @input.peek(1)\n\n if (look_8_0 == TOKEN_REF) \n alt_8 = 1\n\n end\n case alt_8\n when 1\n # at line 110:11: token_spec\n @state.following.push(TOKENS_FOLLOWING_token_spec_IN_tokens_spec_469)\n token_spec14 = token_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_token_spec.add(token_spec14.tree)\n end\n\n else\n match_count_8 > 0 and break\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n\n eee = EarlyExit(8)\n\n\n raise eee\n end\n match_count_8 += 1\n end\n\n char_literal15 = match(T__72, TOKENS_FOLLOWING_T__72_IN_tokens_spec_472) \n if @state.backtracking == 0\n stream_T__72.add(char_literal15)\n end\n # AST Rewrite\n # elements: token_spec, TOKENS\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 110:27: -> ^( TOKENS ( token_spec )+ )\n # at line 110:30: ^( TOKENS ( token_spec )+ )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(stream_TOKENS.next_node, root_1)\n\n # at line 110:39: ( token_spec )+\n unless stream_token_spec.has_next?\n raise ANTLR3::RewriteEarlyExit\n end\n\n while stream_token_spec.has_next?\n @adaptor.add_child(root_1, stream_token_spec.next_tree)\n\n end\n\n stream_token_spec.reset\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing(root_0)\n @adaptor.set_token_boundaries(return_value.tree, return_value.start, return_value.stop)\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node!(@input, return_value.start, @input.look(-1), re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 2)\n\n end\n \n return return_value\n end", "def consume_name; end", "def tokens_spec\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 2 )\n return_value = TokensSpecReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n __TOKENS13__ = nil\n char_literal15 = nil\n token_spec14 = nil\n\n tree_for_TOKENS13 = nil\n tree_for_char_literal15 = nil\n stream_TOKENS = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token TOKENS\" )\n stream_T__72 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__72\" )\n stream_token_spec = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule token_spec\" )\n begin\n # at line 101:4: TOKENS ( token_spec )+ '}'\n __TOKENS13__ = match( TOKENS, TOKENS_FOLLOWING_TOKENS_IN_tokens_spec_462 )\n if @state.backtracking == 0\n stream_TOKENS.add( __TOKENS13__ )\n end\n # at file 101:11: ( token_spec )+\n match_count_8 = 0\n while true\n alt_8 = 2\n look_8_0 = @input.peek( 1 )\n\n if ( look_8_0 == TOKEN_REF )\n alt_8 = 1\n\n end\n case alt_8\n when 1\n # at line 101:11: token_spec\n @state.following.push( TOKENS_FOLLOWING_token_spec_IN_tokens_spec_464 )\n token_spec14 = token_spec\n @state.following.pop\n if @state.backtracking == 0\n stream_token_spec.add( token_spec14.tree )\n end\n\n else\n match_count_8 > 0 and break\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n eee = EarlyExit(8)\n\n\n raise eee\n end\n match_count_8 += 1\n end\n\n char_literal15 = match( T__72, TOKENS_FOLLOWING_T__72_IN_tokens_spec_467 )\n if @state.backtracking == 0\n stream_T__72.add( char_literal15 )\n end\n # AST Rewrite\n # elements: token_spec, TOKENS\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 101:27: -> ^( TOKENS ( token_spec )+ )\n # at line 101:30: ^( TOKENS ( token_spec )+ )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( stream_TOKENS.next_node, root_1 )\n\n # at line 101:39: ( token_spec )+\n stream_token_spec.has_next? or raise ANTLR3::RewriteEarlyExit\n\n while stream_token_spec.has_next?\n @adaptor.add_child( root_1, stream_token_spec.next_tree )\n\n end\n stream_token_spec.reset\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 2 )\n\n end\n \n return return_value\n end", "def describe\n raise NotImplementedError\n end", "def test_parse05b\n assert_raise( RuntimeError ) {\n options = ArgumentManager.parse( [ '--u-opt=foo', '--v-opt' ] )\n }\n end", "def spec\n string_match_operator\n string_element_reference_regexp\n string_byteslice\n string_scan\n string_unary_minus\n string_reverse\n string_tr\n\n true\nend", "def html_parser; end", "def expecting; [] end", "def test_parse_parameters_readable\n readable_params = [\n [\"gem-free-tier\", API_INFO[:free_tier]],\n [\"gem-yard-strict\", API_INFO[:yard_strict]],\n [\"gem-generic-endpoint\", API_INFO[:generic_endpoint]],\n [\"gem-is-cloud-product\", API_INFO[:is_cloud_product]],\n [\"rest-numeric-enums\", API_INFO[:rest_numeric_enums]],\n # this parameter has no alias in gapic-generator-vanilla\n [\":generate_metadata\", API_INFO[:generate_metadata]],\n\n [\"gem-name\", API_INFO[:name]],\n [\"gem-namespace\", API_INFO[:namespace]],\n [\"gem-title\", API_INFO[:title]],\n [\"gem-description\", API_INFO[:description]],\n [\"gem-summary\", API_INFO[:summary]],\n [\"gem-homepage\", API_INFO[:homepage]],\n [\"gem-env-prefix\", API_INFO[:env_prefix]],\n [\"gem-wrapper-of\", API_INFO[:wrapper_of]],\n [\"gem-migration-version\", API_INFO[:migration_version]],\n [\"gem-product-url\", API_INFO[:product_url]],\n [\"gem-issues-url\", API_INFO[:issues_url]],\n [\"gem-api-id\", API_INFO[:api_id]],\n [\"gem-api-shortname\", API_INFO[:api_shortname]],\n [\"gem-factory-method-suffix\", API_INFO[:factory_method_suffix]],\n [\"default-service-host\", API_INFO[:default_host]],\n [\"grpc-service-config\", API_INFO[:grpc_service_config]],\n [\":service_yaml\", API_INFO[:service_yaml]],\n # this parameter has no alias in gapic-generator-vanilla\n [\":overrides.:wrapper_gem_name\", API_INFO[:wrapper_gem_name_override]],\n\n # arrays of values are joined with the ';' symbol\n [\"default-oauth-scopes\", API_INFO[:default_oauth_scopes].join(\";\")],\n [\"transports\", API_INFO[:transports].join(\";\")],\n\n # maps of key,values are joined pairwise with the '=' symbol then pairs are joined with the ';' symbol.\n\n # for the readable parameter there is no need to escape the '.' in the parameter name\n # because there will not be a map-unrolling of the parameter name\n # therefore we use API_INFO[:common_services_unescaped] for input\n [\"common-services\", API_INFO[:common_services_unescaped].map { |k, v| \"#{k}=#{v}\" }.join(\";\")],\n [\"file-path-override\", API_INFO[:path_override].map { |k, v| \"#{k}=#{v}\" }.join(\";\")],\n [\"namespace-override\", API_INFO[:namespace_override].map { |k, v| \"#{k}=#{v}\" }.join(\";\")],\n [\"service-override\", API_INFO[:service_override].map { |k, v| \"#{k}=#{v}\" }.join(\";\")],\n [\"gem-extra-dependencies\", API_INFO[:extra_dependencies].map { |k, v| \"#{k}=#{v}\" }.join(\";\")]\n ]\n\n readable_param_str = readable_params.map { |k, v| \"#{k}=#{v}\" }.join(\",\")\n request = OpenStruct.new parameter: readable_param_str, proto_file: []\n api = Gapic::Schema::Api.new request, parameter_schema: Gapic::Generators::DefaultGeneratorParameters.default_schema\n\n assert_equal CONFIG_EXPECTED, api.configuration\n end", "def parse(file)\n puts \"Not yet implemented\"\nend", "def process(parser)\n end", "def parsed_tree; end", "def scanner; end", "def scanner; end", "def scanner; end", "def scanner; end", "def test_parser_handles_proper_email_text\n name = 'From Name'\n email = '[email protected]'\n\n email_text_assert EmailAddress.new(name, email), \"#{name} <#{email}>\"\n email_text_assert EmailAddress.new(name, email), \"#{name}<#{email}>\"\n email_text_assert EmailAddress.new(name, email), \"<#{email}> #{name}\"\n email_text_assert EmailAddress.new(name, email), \"<#{email}>#{name}\"\n\n email_text_assert EmailAddress.new(email, name), \"#{email} <#{name}>\"\n email_text_assert EmailAddress.new(email, name), \"#{email}<#{name}>\"\n email_text_assert EmailAddress.new(email, name), \"<#{name}> #{email}\"\n email_text_assert EmailAddress.new(email, name), \"<#{name}>#{email}\"\n end", "def initialize\n utility_parsers\n operator_parsers\n integer_parsers\n term_and_expr_parsers\n end", "def inspec\n nil\n end", "def has_parser?(name); end", "def parse\n fail StandardError.new('parse has not been implemented.')\n end", "def parse_parameters; end", "def matcher_name; end", "def matcher_name; end", "def test_parse_parameters_readable\n readable_params = [\n [\"ruby-cloud-free-tier\", API_INFO[:free_tier].to_s],\n [\"ruby-cloud-yard-strict\", API_INFO[:yard_strict].to_s],\n [\"ruby-cloud-generic-endpoint\", API_INFO[:generic_endpoint].to_s],\n [\"ruby-cloud-is-cloud-product\", API_INFO[:is_cloud_product].to_s],\n [\"ruby-cloud-generate-metadata\", API_INFO[:generate_metadata].to_s],\n [\"ruby-cloud-rest-numeric-enums\", API_INFO[:rest_numeric_enums].to_s],\n\n [\"ruby-cloud-gem-name\", API_INFO[:name]],\n [\"ruby-cloud-gem-namespace\", API_INFO[:namespace]],\n [\"ruby-cloud-title\", API_INFO[:title]],\n [\"ruby-cloud-description\", API_INFO[:description]],\n [\"ruby-cloud-summary\", API_INFO[:summary]],\n [\"ruby-cloud-homepage\", API_INFO[:homepage]],\n [\"ruby-cloud-env-prefix\", API_INFO[:env_prefix]],\n [\"ruby-cloud-wrapper-of\", API_INFO[:wrapper_of]],\n [\"ruby-cloud-migration-version\", API_INFO[:migration_version]],\n [\"ruby-cloud-product-url\", API_INFO[:product_url]],\n [\"ruby-cloud-issues-url\", API_INFO[:issues_url]],\n [\"ruby-cloud-api-id\", API_INFO[:api_id]],\n [\"ruby-cloud-api-shortname\", API_INFO[:api_shortname]],\n [\"ruby-cloud-factory-method-suffix\", API_INFO[:factory_method_suffix]],\n [\"ruby-cloud-default-service-host\", API_INFO[:default_host]],\n [\"ruby-cloud-grpc-service-config\", API_INFO[:grpc_service_config]],\n [\"ruby-cloud-service-yaml\", API_INFO[:service_yaml]],\n [\"ruby-cloud-wrapper-gem-override\", API_INFO[:wrapper_gem_name_override]],\n\n # arrays of values are joined with the ';' symbol\n [\"ruby-cloud-default-oauth-scopes\", API_INFO[:default_oauth_scopes].join(\";\")],\n [\"ruby-cloud-generate-transports\", API_INFO[:transports].join(\";\")],\n\n # maps of key,values are joined pairwise with the '=' symbol then pairs are joined with the ';' symbol.\n [\"ruby-cloud-common-services\", API_INFO[:common_services_unescaped].map { |k, v| \"#{k}=#{v}\" }.join(\";\")],\n [\"ruby-cloud-path-override\", API_INFO[:path_override].map { |k, v| \"#{k}=#{v}\" }.join(\";\")],\n [\"ruby-cloud-namespace-override\", API_INFO[:namespace_override].map { |k, v| \"#{k}=#{v}\" }.join(\";\")],\n [\"ruby-cloud-service-override\", API_INFO[:service_override].map { |k, v| \"#{k}=#{v}\" }.join(\";\")],\n [\"ruby-cloud-extra-dependencies\", API_INFO[:extra_dependencies].map { |k, v| \"#{k}=#{v}\" }.join(\";\")]\n ]\n\n readable_param_str = readable_params.map { |k, v| \"#{k}=#{v}\" }.join(\",\")\n request = OpenStruct.new parameter: readable_param_str, proto_file: []\n api = Gapic::Schema::Api.new request, parameter_schema: Gapic::Generators::CloudGeneratorParameters.default_schema\n\n assert_equal CONFIG_EXPECTED, api.configuration\n end", "def identify; end", "def response_parser; end", "def parser(name = T.unsafe(nil)); end", "def configure!(parser); end", "def initialize parser\n @parser = parser\n end", "def test_start_string\n pros = Prospector.new(0,0,0)\n assert pros.start_string.eql? 'Rubyist #0 starting in Enumerable Canyon.'\n end", "def describe\n\t\t\treturn {}\n\t\tend", "def test_parser_handles_unsupported_simple_content\n simple_content_assert nil, {}\n simple_content_assert nil, []\n end", "def tree_spec\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 27 )\n return_value = TreeSpecReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal129 = nil\n char_literal132 = nil\n element130 = nil\n element131 = nil\n\n tree_for_string_literal129 = nil\n tree_for_char_literal132 = nil\n stream_T__83 = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token T__83\" )\n stream_TREE_BEGIN = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token TREE_BEGIN\" )\n stream_element = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule element\" )\n begin\n # at line 283:4: '^(' element ( element )+ ')'\n string_literal129 = match( TREE_BEGIN, TOKENS_FOLLOWING_TREE_BEGIN_IN_tree_spec_2023 )\n if @state.backtracking == 0\n stream_TREE_BEGIN.add( string_literal129 )\n end\n @state.following.push( TOKENS_FOLLOWING_element_IN_tree_spec_2025 )\n element130 = element\n @state.following.pop\n if @state.backtracking == 0\n stream_element.add( element130.tree )\n end\n # at file 283:17: ( element )+\n match_count_60 = 0\n while true\n alt_60 = 2\n look_60_0 = @input.peek( 1 )\n\n if ( look_60_0 == SEMPRED || look_60_0 == TREE_BEGIN || look_60_0.between?( TOKEN_REF, ACTION ) || look_60_0 == RULE_REF || look_60_0 == T__81 || look_60_0 == T__87 || look_60_0 == T__90 )\n alt_60 = 1\n\n end\n case alt_60\n when 1\n # at line 283:19: element\n @state.following.push( TOKENS_FOLLOWING_element_IN_tree_spec_2029 )\n element131 = element\n @state.following.pop\n if @state.backtracking == 0\n stream_element.add( element131.tree )\n end\n\n else\n match_count_60 > 0 and break\n @state.backtracking > 0 and raise( ANTLR3::Error::BacktrackingFailed )\n\n eee = EarlyExit(60)\n\n\n raise eee\n end\n match_count_60 += 1\n end\n\n char_literal132 = match( T__83, TOKENS_FOLLOWING_T__83_IN_tree_spec_2034 )\n if @state.backtracking == 0\n stream_T__83.add( char_literal132 )\n end\n # AST Rewrite\n # elements: element\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 283:34: -> ^( TREE_BEGIN ( element )+ )\n # at line 283:37: ^( TREE_BEGIN ( element )+ )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create_from_type( TREE_BEGIN, \"TREE_BEGIN\" ), root_1 )\n\n # at line 283:50: ( element )+\n stream_element.has_next? or raise ANTLR3::RewriteEarlyExit\n\n while stream_element.has_next?\n @adaptor.add_child( root_1, stream_element.next_tree )\n\n end\n stream_element.reset\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 27 )\n\n end\n \n return return_value\n end", "def internal; end", "def get_parse(s);end", "def tree_spec\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 27)\n return_value = TreeSpecReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n string_literal129 = nil\n char_literal132 = nil\n element130 = nil\n element131 = nil\n\n tree_for_string_literal129 = nil\n tree_for_char_literal132 = nil\n stream_T__83 = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token T__83\")\n stream_TREE_BEGIN = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token TREE_BEGIN\")\n stream_element = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule element\")\n begin\n # at line 292:4: '^(' element ( element )+ ')'\n string_literal129 = match(TREE_BEGIN, TOKENS_FOLLOWING_TREE_BEGIN_IN_tree_spec_2028) \n if @state.backtracking == 0\n stream_TREE_BEGIN.add(string_literal129)\n end\n @state.following.push(TOKENS_FOLLOWING_element_IN_tree_spec_2030)\n element130 = element\n @state.following.pop\n if @state.backtracking == 0\n stream_element.add(element130.tree)\n end\n # at file 292:17: ( element )+\n match_count_60 = 0\n loop do\n alt_60 = 2\n look_60_0 = @input.peek(1)\n\n if (look_60_0 == SEMPRED || look_60_0 == TREE_BEGIN || look_60_0.between?(TOKEN_REF, ACTION) || look_60_0 == RULE_REF || look_60_0 == T__81 || look_60_0 == T__87 || look_60_0 == T__90) \n alt_60 = 1\n\n end\n case alt_60\n when 1\n # at line 292:19: element\n @state.following.push(TOKENS_FOLLOWING_element_IN_tree_spec_2034)\n element131 = element\n @state.following.pop\n if @state.backtracking == 0\n stream_element.add(element131.tree)\n end\n\n else\n match_count_60 > 0 and break\n @state.backtracking > 0 and raise(ANTLR3::Error::BacktrackingFailed)\n\n eee = EarlyExit(60)\n\n\n raise eee\n end\n match_count_60 += 1\n end\n\n char_literal132 = match(T__83, TOKENS_FOLLOWING_T__83_IN_tree_spec_2039) \n if @state.backtracking == 0\n stream_T__83.add(char_literal132)\n end\n # AST Rewrite\n # elements: element\n # token labels: \n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 292:34: -> ^( TREE_BEGIN ( element )+ )\n # at line 292:37: ^( TREE_BEGIN ( element )+ )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(@adaptor.create_from_type!(TREE_BEGIN, \"TREE_BEGIN\"), root_1)\n\n # at line 292:50: ( element )+\n unless stream_element.has_next?\n raise ANTLR3::RewriteEarlyExit\n end\n\n while stream_element.has_next?\n @adaptor.add_child(root_1, stream_element.next_tree)\n\n end\n\n stream_element.reset\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing(root_0)\n @adaptor.set_token_boundaries(return_value.tree, return_value.start, return_value.stop)\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node!(@input, return_value.start, @input.look(-1), re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 27)\n\n end\n \n return return_value\n end", "def describe\n # TODO\n end", "def driver; end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def initialize(doc); end", "def test_parsing_require_all_fields\n value_ = ::Versionomy.parse('2.0', :semver)\n assert_equal([2, 0, 0, ''], value_.values_array)\n assert_equal('2.0.0', value_.unparse)\n assert_raises(::Versionomy::Errors::ParseError) do\n value_ = ::Versionomy.parse('2.0b1', :semver)\n end\n end", "def weber; end", "def prerelease_specs; end", "def allow_matcher; end", "def test_parse02a\n options = ArgumentManager.parse( [] )\n assert_equal( nil, options[ 's-opt' ] )\n end" ]
[ "0.72186357", "0.72186357", "0.69021916", "0.6497888", "0.64820063", "0.64592934", "0.64592934", "0.64592934", "0.64592934", "0.63817406", "0.63817406", "0.63817406", "0.63817406", "0.6330905", "0.62505776", "0.62505776", "0.62505776", "0.62505776", "0.62152076", "0.62152076", "0.61634535", "0.6108464", "0.60521036", "0.602664", "0.602664", "0.602664", "0.60116386", "0.5994116", "0.59500265", "0.59500265", "0.58880985", "0.5877685", "0.58668053", "0.58635145", "0.58635145", "0.58236307", "0.57939696", "0.57811445", "0.57684803", "0.57684803", "0.5741701", "0.5739153", "0.57243246", "0.5694314", "0.56938565", "0.5690168", "0.56809336", "0.56809336", "0.56628156", "0.56355447", "0.5629347", "0.56218994", "0.5618249", "0.5591591", "0.5570676", "0.55570894", "0.5545375", "0.554086", "0.55287975", "0.55254", "0.55152255", "0.55118465", "0.5508492", "0.5504877", "0.5492387", "0.5492387", "0.5492387", "0.5492387", "0.5482298", "0.54822284", "0.5480169", "0.54739827", "0.5473741", "0.5469444", "0.5461768", "0.5461768", "0.54408765", "0.5430088", "0.542178", "0.5419986", "0.5408434", "0.5407172", "0.5400437", "0.539766", "0.53957194", "0.53853685", "0.5382716", "0.537021", "0.53667384", "0.5362655", "0.53624976", "0.5359129", "0.5359129", "0.5359129", "0.5359129", "0.5351537", "0.53465927", "0.53364056", "0.5334628", "0.53127486", "0.5306973" ]
0.0
-1
Adding end markers, help, and version info
def add_end_marker_here(marker='--') register_a_parm End.new(marker, howmany: :NONE, debug: @debug) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def help\n lines = []\n end", "def help\n rez = \":ge setup - init .git directory in /etc folder\\n\"\n rez << \":ge diff - show diff for current changes\\n\"\n rez << \":ge commit COMMENT - will commit changes\\n\"\n rez << \":ge status - will run git status\\n\"\n end", "def help\n\tusage\n\tputs \"This tool is oriented to separate web pages into segments called blocks, based on the structural and visual properties\"\nend", "def help\n\t puts \"\"\n\t puts Rainbow(\":doc\").color(\"#D65200\")+\" Open documentation online\"\n\t puts Rainbow(\":open\").color(\"#D65200\")+\" Open file or folder\"\n\t puts Rainbow(\":new\").color(\"#D65200\")+\" Create file or directory\"\n\t puts Rainbow(\":destroy\").color(\"#D65200\")+\" Destroy Params file or current directory\"\n\t puts Rainbow(\":clean\").color(\"#D65200\")+\" Clean the trash\"\n\t puts Rainbow(\":calendar\").color(\"#D65200\")+\" Show current month\"\n\t puts Rainbow(\":today\").color(\"#D65200\")+\" Show date of day\"\n\t puts \"\"\n\t end", "def help\n puts 'add help'\n end", "def ending\n if File.exist?('CREDITS.md')\n @io.puts IO.read('CREDITS.md')\n @io.puts\n end\n\n if File.exist?('AUTHORS.md')\n @io.puts IO.read('AUTHORS.md')\n @io.puts\n end\n\n if File.exist?('LICENSE.md')\n @io.puts IO.read('LICENSE.md')\n @io.puts\n end\n @io.puts\n @io.puts \"Documentation generated #{Time.now.strftime('%Y-%m-%d %H:%M')}\"\n @io.puts\n @io.close\n end", "def extended_help\n\t\t\t{\n\t\t\t\t\"fun_fake_cmd\" => \"This is a fake command. It's got its own special docs.\" +\n\t\t\t\t\t (\" \" * longest_cmd_size) + \"It might be long so so deal with formatting somehow.\"\n\t\t\t}\n\t\tend", "def help(*args)\n if args.count == 0\n puts <<-HEREDOC\n\nThis script (#{File.basename($0)}) converts back and forth between GNU gettext\nPO files preferred by localizers and Tidy's language header H files which\nensure that Tidy stays small and cross-platform.\n\nAll output files are placed into the current working directory using a file name\nappropriate to the operation being performed.\n\nComplete Help:\n--------------\n HEREDOC\n end\n\n super\n end", "def help\n prettify(description)\n end", "def help_text\n build_html do\n p <<P1\nThis page is a simple presentation of the paths that match the file\nthat was searched for an the fileset that the file was shipped in.\nP1\n end\n end", "def help; end", "def help; end", "def help; end", "def output_documentation_debugging\n\t\tsummary = self.extract_summary\n\t\tdescription = self.extract_description\n\t\thomepage = self.extract_homepage || DEFAULT_HOMEPAGE\n\n\t\tself.prompt.say( \"Documentation\", color: :bright_green )\n\t\tself.prompt.say( \"Authors:\" )\n\t\tself.authors.each do |author|\n\t\t\tself.prompt.say( \" • \" )\n\t\t\tself.prompt.say( author, color: :bold )\n\t\tend\n\t\tself.prompt.say( \"Summary: \" )\n\t\tself.prompt.say( summary, color: :bold )\n\t\tself.prompt.say( \"Description:\" )\n\t\tself.prompt.say( \" \" + description, color: :bold )\n\t\tself.prompt.say( \"Homepage:\" )\n\t\tself.prompt.say( \" \" + homepage, color: :bold )\n\t\tself.prompt.say( \"\\n\" )\n\tend", "def help(additional_info=nil)\n \n set_colors\n \n cmd_length = \"Command\".length\n parm_length = \"Parameters\".length\n max_command = [(@@commands.keys.max_by{|key| key.to_s.length }).to_s.length, cmd_length].max\n max_parameter = @@commands[@@commands.keys.max_by{|key| @@commands[key][:argument_list].length }][:argument_list].length\n max_parameter = [parm_length, max_parameter].max if max_parameter > 0\n\n usage_text = \" #{@c_usage}Usage:#{@c_reset} \"\n\n if Commandable.app_exe \n cmd_text = \"<#{@c_command + @c_bold}command#{@c_reset}>\"\n parm_text = \" [#{@c_parameter + @c_bold}parameters#{@c_reset}]\" if max_parameter > 0\n usage_text += \"#{@c_app_exe + app_exe + @c_reset} #{cmd_text}#{parm_text} [#{cmd_text}#{parm_text}...]\"\n end\n\n array = [usage_text, \"\"]\n \n array.unshift additional_info if additional_info\n array.unshift (\"\\e[2A\" + @c_app_info + Commandable.app_info + @c_reset) if Commandable.app_info\n array.unshift \"\\e[H\\e[2J\"\n \n header_text = \" #{\" \"*(max_command-cmd_length)}#{@c_command + @c_bold}Command#{@c_reset} \"\n header_text += \"#{@c_parameter + @c_bold}Parameters #{@c_reset}#{\" \"*(max_parameter-parm_length)}\" if max_parameter > 0\n header_text += \"#{@c_description + @c_bold}Description#{@c_reset}\"\n \n array << header_text\n \n array += @@commands.keys.collect do |key|\n default = (@@default_method and key == @@default_method.keys[0]) ? @color_bold : \"\"\n \n help_line = \" #{\" \"*(max_command-key.length)}#{@c_command + default + key.to_s + @c_reset}\"+\n \" #{default + @c_parameter + @@commands[key][:argument_list] + @c_reset}\"\n help_line += \"#{\" \"*(max_parameter-@@commands[key][:argument_list].length)} \" if max_parameter > 0\n \n # indent new lines\n description = @@commands[key][:description].gsub(\"\\n\", \"\\n\" + (\" \"*(max_command + max_parameter + (max_parameter > 0 ? 1 : 0) + 4)))\n \n help_line += \": #{default + @c_description}#{\"<#{@@commands[key][:xor]}> \" if @@commands[key][:xor]}\" +\n \"#{description}\" +\n \"#{\" (default)\" unless default == \"\"}#{@c_reset}\" \n end\n array << nil\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 get_help_info\n 'See the documentation here - https://github.com/blockfrost/blockfrost-ruby'\n end", "def help_text\n build_html do\n p <<-P1\n Not much needed here.\n P1\n end\n end", "def introduction\n puts \"1. Create a customer account\\n2. Choose active customer\\n3. Create a payment option\\n4. Add product to sell\\n5. Add product to shopping cart\\n6. Complete an order\\n7. Remove customer product\\n8. Update product information\\n9. Show stale products\\n10. Show customer revenue report\\n11. Show overall product popularity\\n12. Leave Bangazon!\"\n end", "def help\n end", "def help\r\n end", "def help\r\n end", "def help_extended\n \"#{help_extended_preamble}\\n\" +\n \"\\n\" +\n 'The shell command used to launch the program is platform-specific. On ' +\n \"Windows, the 'start' command is used. On other platforms, the 'open' \" +\n \"command is used. (The 'open' command may not be available on your \" +\n \"system.)\\n\" +\n \"\\n\" +\n 'You may specify options to be passed to the program. For example, on ' +\n 'Mac OS X, your default program for HTML files may be Google Chrome, ' +\n 'but you can launch Firefox instead by typing ' +\n \"#{strong command_line + ' -a firefox'}. Likewise, on Windows your \" +\n 'default program for HTML files may be Internet Explorer, but you can ' +\n \"launch Opera instead by typing #{strong command_line + ' opera'}.\"\n end", "def help\n str = \"====[ #{@name} ]====\\nUsage: #{@name} \"\n @doc_args.each do |key, _value|\n str += \"[#{key.upcase}] \"\n end\n @doc_options.each do |key, _value|\n str += \"(--#{key.name}) \"\n end\n str = \"#{str.rstrip}\\nDescription: #{description}\\n#{help_options_args}\"\n str.rstrip\n end", "def help(some, arg)\n say \"Bootic CLI v#{BooticCli::VERSION}\\n\\n\", :bold\n super\n\n examples if respond_to?(:examples)\n end", "def about\n puts \"The CLI Tracker was developed by Dakota States as part of a Flatiron School CLI Project. The data source: https://covid.ourworldindata.org/data/owid-covid-data.json\"\n end", "def help(additional_info=nil)\n \n set_colors\n set_screen_clear\n \n cmd_length = \"Command\".length\n parm_length = \"Parameters\".length\n max_command = [(@@commands.keys.max_by{|key| key.to_s.length }).to_s.length, cmd_length].max\n max_parameter = @@commands[@@commands.keys.max_by{|key| @@commands[key][:argument_list].length }][:argument_list].length\n max_parameter = [parm_length, max_parameter].max if max_parameter > 0\n\n usage_text = \" #{@c_usage}Usage:#{@c_reset} \"\n\n if Commandable.app_exe \n cmd_text = \"<#{@c_command + @c_bold}command#{@c_reset}>\"\n parm_text = \" [#{@c_parameter + @c_bold}parameters#{@c_reset}]\" if max_parameter > 0\n usage_text += \"#{@c_app_exe + app_exe + @c_reset} #{cmd_text}#{parm_text} [#{cmd_text}#{parm_text}...]\"\n end\n\n array = [usage_text, \"\"]\n \n array.unshift additional_info if additional_info\n array.unshift (@c_app_info + Commandable.app_info + @c_reset) if Commandable.app_info\n array.unshift @s_clear_screen_code\n \n header_text = \" #{\" \"*(max_command-cmd_length)}#{@c_command + @c_bold}Command#{@c_reset} \"\n header_text += \"#{@c_parameter + @c_bold}Parameters #{@c_reset}#{\" \"*(max_parameter-parm_length)}\" if max_parameter > 0\n header_text += \"#{@c_description + @c_bold}Description#{@c_reset}\"\n \n array << header_text\n\n array += @@commands.keys.collect do |key|\n is_default = (@@default_method and key == @@default_method.keys[0])\n default_color = is_default ? @c_bold : \"\"\n\n help_line = \" #{\" \"*(max_command-key.length)}#{@c_command + default_color + key.to_s + @c_reset}\"+\n \" #{default_color + @c_parameter + @@commands[key][:argument_list] + @c_reset}\"\n help_line += \"#{\" \"*(max_parameter-@@commands[key][:argument_list].length)} \" if max_parameter > 0\n \n # indent new lines\n description = @@commands[key][:description].gsub(\"\\n\", \"\\n\" + (\" \"*(max_command + max_parameter + (max_parameter > 0 ? 1 : 0) + 4)))\n \n help_line += \": #{default_color + @c_description}#{\"<#{@@commands[key][:xor]}> \" if @@commands[key][:xor]}\" +\n \"#{description}\" +\n \"#{\" (default)\" if is_default}#{@c_reset}\" \n end\n array << nil\n end", "def help_text\n build_html do\n p <<-P1\n This is the list of changes that a particular defect or\n feature introduced. The changes are grouped by release. Each\n change provides a link to the file or files involved along with a\n link to a diff of the changes for that file. The link to the diff\n is the '->' between the two SCCS ids.\n P1\n end\n end", "def help_info\n \"\"\n end", "def command_help\n @colour.help '--- Welcome to ForGen, the home of custom image creation ---'\n @colour.help 'ForGen command line structure'\n @colour.help 'ruby forgen.rb command [options]'\n @colour.help ''\n\n @colour.help '[command: main]'\n @colour.help \"r, run\\t\\t\\t\\t Run all aspects of ForGen\"\n @colour.help \"make-configuration\\t\\t Make configuration files for a new project\"\n @colour.help \"make-vagrant-basebox\\t\\t Make a vagrant basebox\"\n @colour.help \"make-virtual-machine\\t\\t Make a virtual machine\"\n @colour.help \"make-forensic-image\\t\\t Make a forensic image\"\n @colour.help ''\n\n @colour.help '[command: information]'\n @colour.help \"-h, --help\\t\\t\\t Display this help screen\"\n @colour.help \"--version\\t\\t\\t Displays the current ForGen version\"\n @colour.help \"--list-cases\\t\\t\\t List all case files currently in ForGen\"\n @colour.help \"--list-modules <type>\\t\\t List <type> modules that are in ForGen\"\n @colour.help ''\n\n @colour.help '[command: projects]'\n @colour.help \"--delete-all-projects\\t\\t Deletes ALL projects in the projects directory\"\n @colour.help ''\n\n @colour.help '[options: stdout]'\n @colour.help \"--disable-colours\\t\\t Disable all std output colour formatting\"\n @colour.help ''\n\n @colour.help '[options: cases]'\n @colour.help \"--case-path\\t\\t\\t The path to the case file to use\"\n @colour.help ''\n\n @colour.help '[options: forensic images]'\n @colour.help \"--forensic-image-output-dir\\t Output image output directory\"\n @colour.help \"--create-raw-image\\t\\t Create a RAW image of all VM drives\"\n @colour.help \"--create-ewf-image\\t\\t Create an EWF image of all VM drives\"\n @colour.help \"--delete-vm-after-image-creation\\b\\t Delete the VM after image generation\"\n @colour.help ''\n\n @colour.help '[options: modules]'\n @colour.help \"--basebox-url\\t\\t\\t URL to the basebox (overwrites basebox modules)\"\n @colour.help ''\n\n @colour.help '[options: vm]'\n @colour.help \"--no-vm-shutdown\\t\\t Stops vm shutdown (will stop forensic image generation)\"\n @colour.help \"--gui-output\\t\\t\\t Instructs ForGen to create vms in background\"\n @colour.help \"--max-processor-cap\\t\\t Sets processor execution cap\"\n @colour.help \"--max-memory-usage\\t\\t Sets max vm memory [RAM]\"\n @colour.help \"--number-of-processors\\t\\t Sets number of vm processing cores\"\n @colour.help ''\n\n @colour.help '[options: debug]'\n @colour.help \"--verbose\\t\\t\\t Run all ForGen elements in verbose mode\"\n @colour.help \"--debug\\t\\t\\t\\t Run all ForGen elements in debug mode\"\n @colour.help ''\n\nend", "def help\n log_tips = \"\\nInitializing a Watirmark Logger:\nlogger = WatirmarkLog::Loger.new('optional_logger_name')\\n\nLogging methods:\nlogger.debug 'debug message' => 'DEBUG: debug message'\nlogger.info 'info message' => 'INFO: info message'\nlogger.warn 'warn message' => 'WARN: warn message'\nlogger.error 'error message' => 'ERROR: error message'\nlogger.turn_off = true => turns off all logging to stdout\\n\nLogging Hierarchy (debug < info < warn < error):\nlog.level = :info\nlogger.debug 'this message will NOT execute'\nlogger.info 'info message'\nlogger.warn 'warn message'\nlogger.error 'this message will AlWAYS execute'\\n\nLog Color Coding:\nlog.colors => {:black => :black, :red => :red,:green => :green, :yellow => :yellow, :blue => :blue, :magenta => :magenta, :cyan => :cyan, :white => :white}\nlog.debug_color = :red\nlog.debug 'debug message with color' => \" + \"DEBUG: debug message with color\".red + \"\n \\nCreating Log File:\nCreate a file where all log information is streamed to.\nThis is not dependent on log.level\nEx.\nlog.create_file\nlog.create_file 'file_name.log'\nlog.create_file 'file_name.log', directory\"\n puts log_tips\n end", "def output_help\n RDoc::usage()\n end", "def help\n h = []\n h << \"Usage: forge [COMMAND] [OPTIONS ...]\"\n h << \"\"\n h << \"COMMANDS:\"\n h << \" touch login and logout to test connection\"\n h << \" release release package(s)\"\n h << \" announce make an announcement\"\n h << \" publish publish website\"\n h << \"\"\n h << \"Add --help after command to learn more about each.\"\n puts h.join(\"\\n\")\n end", "def help\n end", "def help\n end", "def help\n end", "def help\n end", "def help\n end", "def help\n end", "def help\n end", "def help_text\n format_block = proc {|key, flag, doc, required, kind|\n sprintf(\" %-3s %-14s %-10s %s %s\", flag, key, kind, doc, required ? '(REQUIRED)' : '')\n }\n required, options = help_attributes.partition{ |a| a[3]}\n [\n self.doc,\n \"\\n\",\n self.usage ? [\"Usage: \" + self.usage, \"\\n\"] : [],\n required.size > 0 ? [\"Required args:\", required.map(&format_block), \"\\n\"] : [],\n options.size > 0 ? [\"Options:\", options.map(&format_block), \"\\n\"] : [],\n (self.examples && self.examples.size > 0) ? \"Examples:\\n\" + \" \" + [self.examples].flatten.join(\"\\n \") : [],\n ]\n end", "def display_version\n @colour.help FORGEN_VERSION_NUMBER\nend", "def help\n \n end", "def respond_help\n help = []\n help << \"Hi human, if you need documentation about any Ruby Core/Stdlib class, module or method, you can ask me in this way:\"\n help << ''\n MATCHERS.each do |matcher|\n help << \"_#{matcher.pattern_example(@client.self.name)}_\"\n end\n\n help << ''\n help << 'I understand any of the following formats:'\n help << '_Class | Module | Module::Class | Class::method | Class#method | Class.method | method_'\n\n help.join(\"\\n\")\n end", "def notes\n super()\n\n section = __method__\n text = \"\"\n html = \"\"\n\n frontend_url = generate_frontend_url\n if frontend_url\n text += \"Frontend URL: #{frontend_url}\\n\\n\"\n add_short_text(\"additional_info\", \"View logs here: #{frontend_url}\")\n html += \"<b>Frontend URL</b>: #{frontend_url}<br><br>\"\n end\n\n add_text(section, text)\n add_html(section, html)\n end", "def add_footer=(_arg0); end", "def footer\n @io << tag(:hr) << tag(:h2, 'Thanks for using request-log-analyzer')\n @io << tag(:p, 'For more information please visit the ' + link('Request-log-analyzer website', 'http://github.com/wvanbergen/request-log-analyzer'))\n @io << tag(:p, 'If you need an expert who can analyze your application, mail to ' + link('[email protected]', 'mailto:[email protected]') + ' or visit us at ' + link('http://railsdoctors.com', 'http://railsdoctors.com') + '.')\n @io << \"</body></html>\\n\"\n end", "def option_version_tail\n block = proc { puts \"#{FRAMEWORK_TITLE}\"; exit }\n @cl_parser.on_tail('-v', '--version', 'Show version information', &block)\n end", "def introduction\n puts 'hello welcome to the github scrapper'.light_blue\n puts 'this tool is desgined for fetching data from github quickly and saving it to a csv file'.light_blue\nend", "def instructions\n puts '---------------------------------------------------------------'\n puts 'To complete your installation...'\n puts ''\n puts \"1: Add this gem to your project Gemfile and run 'bundle install'\"\n puts ''\n puts \" gem 'simple-tooltip'\"\n puts ''\n puts '2: Run db:migrate to create the tooltips database table'\n puts ''\n puts \" $ rake db:migrate\"\n puts ''\n puts '3: Make sure you have the jQuery JavaScript library installed (via jquery-rails)'\n puts ''\n puts ' $ rails generate jquery:install'\n puts ''\n puts '4: Check that these first two lines are in layouts/application.html.erb and add the third'\n puts ''\n puts ' <%= stylesheet_link_tag :all %>'\n puts ' <%= javascript_include_tag :defaults %>'\n puts \" <%= javascript_include_tag 'simple_tooltip.js' %>\"\n puts ''\n puts '5: Create some tooltip entries in /tooltips and then add links'\n puts ' to them in views of your other models'\n puts \" <%= tooltip('tooltip title', :hover) %>\"\n puts ''\n puts 'For more information see the project page on GitHub'\n puts ' https://github.com/craic/simple_tooltip'\n puts '---------------------------------------------------------------'\n end", "def feats_help\n puts <<help\nusage: git feats <command>\n\ncommands:\n update Update your feats and command history on gitfeats.com\n help Display git-feats specific help\nhelp\n end", "def base_docstring; end", "def help(*args)\n if args.count == 0\n puts <<-HEREDOC\n\nmiddleman-pagegroups version #{Middleman::MiddlemanPageGroups::VERSION}\n\nThis gem adds functionality to Middleman and is not executable on its own,\nother than for generating the documentation sample project and sample partial\nfiles. Instead, you must add this gem to your Middleman project's `Gemfile` \nand then activate it in your `config.rb` file. \n\nHEREDOC\n end\n super\n end", "def footer\n <<-EOFOOTER\n]\nendobj\ntrailer\n<<\n/Root 1 0 R\n\n>>\n%%EOF\nEOFOOTER\n end", "def show_help\n puts HELP_INSTALL\n end", "def examples_page\n Format.usage('This is my examples page, I\\'ll show you a few examples of how to get me to do what you want.')\n Format.usage('Running me with a file: whitewidow.rb -f <path/to/file> keep the file inside of one of my directories.')\n Format.usage('Running me default, if you don\\'t want to use a file, because you don\\'t think I can handle it, or for whatever reason, you can run me default by passing the Default flag: whitewidow.rb -d this will allow me to scrape Google for some SQL vuln sites, no guarentees though!')\n Format.usage('Running me with my Help flag will show you all options an explanation of what they do and how to use them')\n Format.usage('Running me without a flag will show you the usage page. Not descriptive at all but gets the point across')\nend", "def main_description; end", "def usage_end\n '}'\n end", "def help\n puts 'Here is a list of available commands:\n new - Create a new contact\n list - List all contacts\n show - Show a contact\n search - Search contacts'\n end", "def usage\n str = @appname + \"\\n\\n\"\n unless @description.empty?\n str += \"DESCRIPTION\\n\"\n str += @description.join + \"\\n\"\n end\n unless @examples.empty?\n str += \"EXAMPLES\\n\"\n str += @examples.join + \"\\n\"\n end\n str += \"OPTIONS\"\n str += @parser.to_s.rstrip + \"\\n\"\n str\n end", "def short_help(preamble, command_spec)\n return \" #{preamble} #{command_spec[:usage]}\", command_spec[:description]\n end", "def footer\n puts\n puts \"Need an expert to analyze your application?\"\n puts \"Mail to #{link('[email protected]')} or visit us at #{link('http://railsdoctors.com')}.\"\n line(:green)\n puts \"Thanks for using #{colorize('request-log-analyzer', :white, :bold)}!\"\n end", "def display_help\n puts \"Dev Sync : report or sync your development files\"\n puts \" report nas_directory(optional)\"\n puts \" sync reported_file_name\"\nend", "def help\n @out.puts <<-MSG\n\n Usage:\n docbones -h/--help\n docbones -v/--version\n docbones command [options] [arguments]\n\n Commands:\n docbones create create a new project from a skeleton\n docbones freeze create a new skeleton in ~/.mrdocbones/\n docbones unfreeze remove a skeleton from ~/.mrdocbones/\n docbones info show information about available skeletons\n\n Further Help:\n Each command has a '--help' option that will provide detailed\n information for that command.\n\n http://www.ossxp.com\n\n MSG\n nil\n end", "def setup_help(opts)\n opts.separator ''\n opts.separator <<-USAGE\nUsage:\n travis repositories|repos|rep|r {options}\n travis status|stat|s {options}\n USAGE\n opts.separator ''\n opts.separator <<-FURTHER_HELP\nFurhter Help:\n travis {command} --help\n FURTHER_HELP\n\n yield(opts)\n end", "def help\n\tputs <<-EOH\nUsage: #{$PROGRAM_NAME} <option> [name]\n options:\n\t-s\t--show\tshow instructions to install package specified by name\n\t-l\t--list\tlist available packages\n\t-h\t--help\tshow this help message and exit\n\tEOH\n\t0\nend", "def help\n help_str = super()\n help_str << \"\\n\\nCommands:\\n\"\n COMMANDS.map do |cmd, cmd_params, desc|\n cmd_template = \" %-49s\" % [base_script_name, cmd, cmd_params].join(\" \")\n cmd_template += \" :: \" + desc if desc\n help_str << cmd_template+\"\\n\"\n end\n help_str\n end", "def intro()\n show do\n title \"Fragment analyzing info\"\n note \"In this protocol, you will do the following:\"\n note \"- gather stripwells of fragments\"\n note \"- organize them in the fragment analyzer machine\"\n note \"- set up and run the analyzer\"\n note \"- upload the analysis results to Aquarium\"\n end\n end", "def print_help\n File.read(__FILE__).lines[1..-1].each do |line|\n if line =~ /\\A#/\n puts line[2..-1]\n else\n break\n end\n end\nend", "def print_help\n File.read(__FILE__).lines[1..-1].each do |line|\n if line =~ /\\A#/\n puts line[2..-1]\n else\n break\n end\n end\nend", "def contstruct_readme\n config = template.config\n\n s = []\n s << \"# %s - %s\" % [config[:name], config[:summary]]\n s << \"## SYNOPSIS\"\n s << Array(usage).join(\"\\n\")\n s << \"## DESCRIPTION\"\n s << config[:description]\n s << \"## COPYRIGHT\"\n s << config[:copyright]\n s.join(\"\\n\\n\")\n end", "def init\n separator = \"<!-- extracted by vendorer init -->\"\n readme = File.read(File.expand_path('../../Readme.md', __FILE__))\n examples = readme.split(separator)[1]\n examples.gsub!(/```.*/,'') # remove ``` from readme\n examples = examples.split(\"\\n\").map do |l|\n (l.start_with? '#' or l.empty?) ? l : \"# #{l}\"\n end.join(\"\\n\")\n File.open('Vendorfile', 'w') { |f| f.write(examples.strip) }\n end", "def dev_minor() end", "def help\n\t\tself.usage(false)\n\t\texit EX_OK\n\tend", "def helpmessage()\n\t\"\\nThis script will take a collection of input files to sass implementations and change the\\n\"+\n\t\"hierarchy in such a way that testrunner.rb can be used to run batches of tests. The\\n\"+\n\t\"expected_output.css files are generated by running sass (whichever version you have) on the\\n\"+\n\t\"input files. Sass is assumed to be on you path. View the initial comment of this script for\\n\"+\n\t\"more detailed info.\\n\\n\"\nend", "def create_command_help\n puts \"The Ruby Farm - a simple command line animals app\"\n puts\n puts \"Command Usage:\"\n puts \" [create | c] <name=> <type=> creates a animal with name\"\n puts \"\"\n puts \"Examples:\"\n puts \" bin/run [create | c] name=my_animal_name\"\n puts \" bin/run [create | c] name=my_animal_name type=pig\"\n end", "def version(version)\n @io.puts \"*v#{version}*\"\n @io.puts\n # Hacking in the overview file\n if File.exist?('OVERVIEW.md')\n @io.puts IO.read('OVERVIEW.md')\n @io.puts\n end\n end", "def introduction\n show do\n title \"Fragment analyzing info\"\n note \"In this protocol, you will gather stripwells of fragments, organize them in the fragment analyzer machine, and upload the analysis results to Aquarium.\"\n end\n end", "def print_help\n puts 'Here is a list of available commands:'\n puts '- new - Create a new contact'\n puts '- list - List all contacts'\n puts '- show - Show a contact'\n puts '- find - Find a contact'\n end", "def options_title opts, colors\n\t\t\t\tversion_path = File.expand_path(\"../../VERSION\", File.dirname(__FILE__))\n\t\t\t\topts.version = File.exist?(version_path) ? File.read(version_path) : \"\"\n\t\t\t\topts.banner = \"Todo: A simple command line todo application\\n\\n\".colorize(colors[:green]) +\n\t\t\t\t\" usage:\".colorize(colors[:cyan]) + \" todo [COMMAND] [option] [arguments]\".colorize(colors[:red])\n\t\t\t\topts.separator \"\"\n\t\t\t\topts.separator \"Commands:\".colorize(colors[:green])\n\t\t\tend", "def print_help(cmd)\n offset = docs.keys.longest_string_length\n write \"#{cmd.ljust(offset)} -- #{docs[cmd]}\" + \n (has_shortcuts?(cmd) ? \" #{display_shortcuts(cmd)}\" : '')\n end", "def help\n puts \"plan #{Plan::VERSION} - john crepezzi - http://github.com/seejohnrun/plan\"\n COMMAND_GLOSSARY.each do |cmd, description|\n puts \"\\e[0;33m#{cmd}\\e[0m - #{description}\"\n end\n end", "def help_message\n $stderr.puts <<-EOM\n Usage:\n\n r2doc [options] [names...]\n r2doc [options] --gems gems...\n\n The first format calls rdoc normally with r2doc set as\n the generator. The second format sets rdoc as the\n generator and generates documentation for the named\n gems. One additional option (see below) is specific to\n r2doc. All other options are passed through to rdoc.\n Help for rdoc follows.\n \n r2doc-specifc options:\n \n --rdoc-version version\n Specifices the rdoc version to require.\n The version string is passed to gem.\n\nEOM\nend", "def dump_help extra_msg=nil\n $stderr.puts help\n $stderr.puts \"\\n\\n\"+extra_msg unless extra_msg.blank?\n $stderr.puts ''\n end", "def help_exit\r\n puts <<HELP\r\nUsage: etl.rb CONFIG_FILE\r\nHELP\r\n # exit 1\r\nend", "def help #:nodoc:\n Writer.help( { :banner => @@banner, :header => @@header,\n :options => @@options, :footer => @@footer },\n output_to, exit_on_help? )\n end", "def print_usage(options)\n puts\n puts \"Usage: \"+$0+\" -[\"+options+\"]\"\n puts\n puts \"-V:\\tDisplay version information\"\n puts \"-h:\\tDisplay usage information\"\n puts \"-v:\\tVerbose output\"\n puts \"-d:\\tDownload latest build but don't install\"\n puts \"-i:\\tDownload and install latest build\"\n puts \"-u:\\tUpdate application to latest build\"\n puts \"-l:\\tGet local build date for application\"\n puts \"-r:\\tGet remote build date for application\"\n puts \"-p:\\tGet URL of download for latest package\"\n puts \"-c:\\tCompare local and remote build dates\"\n puts \"-a:\\tShow available packages\"\n puts \"-g:\\tUpdate Gatekeeper and Quarantine information so application can run\"\n puts \"-z:\\tClean up temporary directory (delete files older than \"+$mtime+\" days)\"\n puts \"-Z:\\tRemove existing application\"\n puts \"-C:\\tRemove crash reporter file\"\n puts \"-P:\\tPerform post install\"\n puts \"-q:\\tQuit application\"\n puts \"-s:\\tStart application\"\n puts\nend", "def need_help \n end", "def show_help\n display banner\n display \"\"\n display short_help\n display \"\"\n end", "def help\n\t\thelp_introduction = \"\\tHelp - display available commands\n\tExit - save state of artist and track then exit\n\tInfo - display a high level summary of the state\n\tInfo track - display info about a certain track by number\n\tInfo artist - display info about a certain artist, by id\n\tAdd Artist - add a new artist to storage. e.g. add artist john osborne\n\tAdd Track - add a new track to storage. e.g. add track watching the sky turn green by jo\n\tPlay Track - record that an existing track was played at the current time. e.g. play track 13\n\tCount tracks - display how many tracks are known by a certain artist. e.g. count tracks by jo\n\tList tracks - display the tracks played by a certain artist. e.g. list tracks by jo\"\n\t\tputs help_introduction\n\tend", "def help_tip(text); \"\" end", "def print_help\n puts \"gem_dep_tree gemname [version]\"\n exit\nend", "def show_help\n puts HELP_MESSAGE\n end", "def show_help\n puts HELP_MESSAGE\n end", "def print_usage\n\t\nprint <<OEM\nusage: codeSync [-v] <project file>\n\n -v Verbose output\n <project file> File that sets connection and sync settings (see example below)\n\n(version #{APP[:version]} - #{APP[:build]})\n\nThis is a mac utility that uses rsync to immediately synchronize file\nchanges to a server or remote computer, as you work.\n\nNOTE: Since it uses rsync to communicate with the server, it is important\nto setup private/public keys: http://bit.ly/PcTRK\n(IF YOU DO NOT you will be prompted for your password for each file change.)\n\nCodeSync uses a project file (see example below) for the server connection\nsettings and which directories to keep in sync.\n\nEXAMPLE PROJECT FILE\n\n # Server details\n server=\"remoteserver.com\"\n username=\"johndoe\"\n\n # Base directories to sync from/to\n remote_basedir=\"/home/johndoe/svn/\"\n local_basedir=\"/work/projects/remote\"\n\n # The directories to sync, relative to the base directories\n sync_dirs=[ \"/static/js\",\n \"/static/css\",\n \"/gui/jsp\" ] \n # sync_dirs=[ ] # This will sync the entire base directories\n\n # Directories to exclude, relative to the base directory\n # Example: If syncing the entire trunk, you can exclude the build directory\n # since it contains a lot of unnecessary and large files\n exclude_dirs = [ \"dist\", \"build\", \"_codegen\" ]\n\n # The contents of these directories will only sync \"up\" to the server.\n # This means the contents will never be downloaded from the server\n # but files added or changed locally will be sent to the server\n sync_up=[ \"/static/img\" ]\n\nOEM\n\nend", "def printHelp\n print \"getrbart v#{/(\\d+\\.\\d+)/.match( '$Revision: 1.9 $' )[ 1 ]}\nCopyright (C) 2008,2009 by Dave Pearson <[email protected]>\nhttp://www.davep.org/\n\nSupported command line options:\n\n -h --host <host> Specify the host to be contacted\n (default is \\\"www.redbubble.com\\\").\n -p --port <port> Specify the port to be connected\n (default is 80).\n --product <product> Specify the type of product list to\n download. Either 'art' or 'clothing'.\n -t --tagged <tag> Only get works with a specific tag.\n -u --user <user> Specify the RedBubble user.\n -v --verbose Work in verbose mode.\n --help Display this help.\n -L --licence Display the licence for this program.\n\nThe results (which are printed to STDOUT) contain one work per line in the\nformat:\n\n<work id>\\\\t<work title>\\\\t<thumbnail URL>\n\"\nend", "def writeHints()\n\t\ttime = Time.now.to_s\n\t\thdr = \"=\" * 72\n\t\tshdr = \"-\" * 10\n\n\t\tFile.open(\"#{@outdir}/HINTS\", \"w\") do |hints|\n\t\t\thints.puts \"Rblatter-#{$RBLATTER_V}\"\n\t\t\thints.puts time\n\t\t\thints.puts @options[:eqn]\n\t\t\thints.puts hdr\n\t\t\thints.puts \"\"\n\n\t\t\thints.puts \"SUMMARY\"\n\t\t\thints.puts shdr\n\t\t\thints.puts \"\"\n\t\t\thints.puts \"includeFiles = #{@includeFiles.size}\"\n\t\t\thints.puts \"excludeFiles = #{@excludeFiles.size}\"\n\t\t\thints.puts \"includeMaps = #{@includeMaps.size}\"\n\t\t\thints.puts \"\"\n\n\t\t\thints.puts \"excludeMaps = #{@excludeMaps.size}\"\n\t\t\thints.puts \"includeFormats = \" + \n\t\t\t\t\"#{@includeFormats.size}\"\n\t\t\thints.puts \"excludeFormats = \" +\n\t\t\t\t\"#{@excludeFormats.size}\"\n\t\t\thints.puts \"\"\n\n\t\t\thints.puts \"final = #{@finalFiles.size}\"\n\t\t\thints.puts \"finalMaps = #{@finalMaps.size}\"\n\t\t\thints.puts \"finalFormats = #{@finalFormats.size}\"\n\t\t\thints.puts \"\"\n\n\t\t\thints.puts \"MAP HINTS\"\n\t\t\thints.puts shdr\n\t\t\thints.puts \"\"\n\t\t\t\n\t\t\[email protected] {|map| hints.puts map }\n\n\t\t\tif @finalMaps.size == 0 then\n\t\t\t\thints.puts \"(No map hints)\"\n\t\t\tend\n\n\t\t\thints.puts \"\"\n\t\t\thints.puts \"FORMAT HINTS\"\n\t\t\thints.puts shdr\n\t\t\thints.puts \"\"\n\n\t\t\[email protected] {|fmt| hints.puts fmt }\n\n\t\t\tif @finalFormats.size == 0 then\n\t\t\t\thints.puts \"(No format hints)\"\n\t\t\tend\n\n\t\tend\n\tend", "def help options = { :pattern => /.*/, :target => nil}\n puts \"Global helper methods (available on all services): \"\n puts JavaHelpers.format_help_line 'boolean', 'allow_colors', 'true|false', \"Turn coloring on/off\"\n puts JavaHelpers.format_help_line 'EzSecurityToken', 'fake_token', '[auths=TS,S,U]', 'Return a fake security token.'\n puts JavaHelpers.format_help_line 'Visibility', 'fake_vis', 'String - visibility', 'Return a fake Visibility constructed from the given string.'\n puts JavaHelpers.format_help_line 'void', 'write', 'Filename, Stuff to write', 'Write content to a file.'\n puts JavaHelpers.format_help_line 'Set', 'set_of', 'Comma-separated items', 'Get a Java Set of items.'\n puts JavaHelpers.format_help_line 'List', 'list_of', 'Comma-separated items', 'Get a Java List of items.'\n puts \"\\n\"\n\n options[:target] = @artifact_obj.java_class if options[:target].nil?\n actual_methods = JavaHelpers.method_help options[:target], options[:pattern]\n if actual_methods.any?\n puts \"Available methods on #{options[:target]} are:\\n#{actual_methods.join(\"\\n\")}\"\n else\n puts \"No service methods found that match /#{pattern}/!\"\n end\n if @artifact_module.respond_to?(:method_help)\n puts \"\\nCLI Helpers: \"\n puts @artifact_module.method_help.join(\"\\n\")\n end\nend", "def help\n puts \"For multi-word arguments, use 'single quotes' only.\"\n puts \"To create an event: \\t\\t\\t\\tCREATE EVENT event_name.\"\n puts \"To add a speaker to the most recent event: \\tCREATE SPEAKER speaker_name.\"\n puts \"To add a speaker to a different event: \\t\\tCREATE SPEAKER event_name speaker_name.\"\n puts \"To add a talk to an event: \\t\\t\\tCREATE TALK event_name talk_name talk_start_time talk_end_time speaker_name.\\n\\n\"\nend", "def cmd_add reference, description = 'TODO description'\n path = reference2path reference\n unless create_if_not_exist reference, path\n return\n end\n puts \"adding content to \" + reference\n open_vim path, :end_of_file, \n :add_line, \n :add_line, \n :append_desc, description, :add_line,\n :append_date,\n :add_line, \n :add_line \n end", "def welcome\n puts <<~DOC\n _____ _ _ _ _ _\n / ____| | | | | (_) | {_}\n| | ___ ___| | _| |_ __ _ _| | |(|\n| | / _ \\\\ / __| |/ / __/ _` | | | |=|\n| |___| (_) | (__| <| || (_| | | | / \\\\\n \\\\_____\\\\___/ \\\\___|_|\\\\_\\\\\\\\__\\\\__,_|_|_| |.--| \\\\~~~/\n| | (_) | | (_) || | \\\\_/\n| | _ ___| |_ _ _ __ __ _ || | Y\n| | | / __| __| | '_ \\\\ / _` | |'--| _|_\n| |____| \\\\__ \\\\ |_| | | | | (_| | '-=-'\n|______|_|___/\\\\__|_|_| |_|\\\\__, |\n __/ |\n |___/\nWelcome to the Cocktail Listing!\nWe are going to gets some drinks going so please select from\nthe options available below to get started...\n.......\n DOC\nend" ]
[ "0.6463772", "0.6448885", "0.6312437", "0.6309255", "0.6293723", "0.62883097", "0.62277687", "0.62250453", "0.6147904", "0.6126225", "0.6102495", "0.6102495", "0.6102495", "0.6074346", "0.6058158", "0.60491616", "0.6037557", "0.6029886", "0.6018706", "0.60055685", "0.6003683", "0.6003683", "0.6001528", "0.59846187", "0.59364885", "0.5934098", "0.592995", "0.5918789", "0.5912976", "0.5904923", "0.5902897", "0.58888125", "0.58748746", "0.58600163", "0.58600163", "0.58600163", "0.58600163", "0.58600163", "0.58600163", "0.58600163", "0.58534604", "0.58460927", "0.58379865", "0.58155644", "0.5800677", "0.57971364", "0.5761037", "0.57596207", "0.57563525", "0.5754575", "0.5744568", "0.5743603", "0.5719476", "0.5697488", "0.5697176", "0.5697075", "0.56890565", "0.5687072", "0.5683942", "0.5677867", "0.5677339", "0.567345", "0.5673342", "0.56646764", "0.5664117", "0.56530225", "0.56525815", "0.56519365", "0.5647021", "0.5647021", "0.56448066", "0.5643649", "0.56400675", "0.5638014", "0.56337047", "0.56276935", "0.5623835", "0.5616129", "0.5616076", "0.56140125", "0.5610021", "0.560156", "0.55956566", "0.55941004", "0.55868596", "0.55830324", "0.55830115", "0.55796534", "0.5578266", "0.55639774", "0.5560712", "0.55529284", "0.5552397", "0.5552397", "0.55487835", "0.5541285", "0.5540588", "0.55186653", "0.5516903", "0.5514015", "0.5514012" ]
0.0
-1
Methods required by the parser
def finalize() if @ready_to_go return end if @needs_help add_help end @attributes.sort! dups = [] previous = nil @attributes.each do |an_attr| if an_attr == previous dups.push(an_attr) else previous = an_attr end end if dups.length > 0 raise "Duplicate attribute names, #{dups}, for command line options." end @positionals.push(@parms_list.length) @attributes.freeze @defaults.freeze @parms_list.freeze @parms_hash.freeze @positionals.freeze @ready_to_go = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parser; end", "def parser; end", "def parser; end", "def parser; end", "def parse; end", "def parse; end", "def parse; end", "def parsed; end", "def parsed; end", "def pluggable_parser; end", "def parse!\n raise NotImplementedError, \"this class is intended to be a top class, not a useful parser\"\n end", "def parsed\n raise NotImplementedError\n end", "def parse\n end", "def parse\n raise NotImplementedError\n end", "def parse()\n #This is a stub, used for indexing\n end", "def parse\n raise NotImplementedError.new\n end", "def parser=(_arg0); end", "def parslet; end", "def parslet; end", "def parslet; end", "def parslet; end", "def process(parser)\n end", "def parslets; end", "def parse\n raise \"absctract method called\"\n end", "def configure_parser; end", "def parse(source); end", "def get_parse(s);end", "def parse;\n \"Parsing method\";\n end", "def force_parse; end", "def parse_parameters; end", "def parsed_tree; end", "def parse_context; end", "def parse_context; end", "def parse\n fail StandardError.new('parse has not been implemented.')\n end", "def initialize parser\n @parser = parser\n end", "def parse text\n raise \"No parser defined for #{self.class}\"\n end", "def parse(text); end", "def after_parse; end", "def after_parse; end", "def parse(xml)\n raise NotImplementedError, \"inheritor should define #{__method__}\"\n end", "def parse(file)\n puts \"Not yet implemented\"\nend", "def parser\n attributes.fetch(:parser)\n end", "def html_parser; end", "def parse(data); end", "def parser(name = T.unsafe(nil)); end", "def initialize\n utility_parsers\n operator_parsers\n integer_parsers\n term_and_expr_parsers\n end", "def parse(virtual); end", "def methods() end", "def parse_paragraph; end", "def tokens; end", "def tokens; end", "def tokens; end", "def tokens; end", "def tokens; end", "def tokens; end", "def tokens; end", "def tokens; end", "def parser(content_type); end", "def parse_definition_list; end", "def private; end", "def parse_list; end", "def parse_list; end", "def has_parser?(name); end", "def parse file_contents\n raise NRSER::AbstractMethodError.new self, __method__ \n end", "def parse \n raise \"This has not been implemented yet. Due to the variability of report format, will need to implement a series of specialized parsers\"\n end", "def method_missing(name,*args,&block)\n self.class.send :define_method,\"parse_#{name}\" do |node,contents|\n block.call node,contents\n end\n end", "def parse(tags); end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def parse_options; end", "def parse_options; end", "def parse(input = nil, options = 0)\n end", "def html_parser=(_arg0); end", "def html_parser=(_arg0); end", "def parse(str); end", "def response_parser; end", "def parse_search; end", "def parse_values; end", "def after_parse\n end", "def ast; end", "def ast; end", "def parse(source_buffer); end", "def parse(source_buffer); end", "def parse(source_buffer); end", "def method_missing(name, *args)\n string_name = name.to_s.gsub(\":\", \"\")\n super(name, *args) unless string_name =~ /^parse_/ and args.empty?\n token = string_name.to_s.gsub(\"parse_\", \"\")\n constant = token.upcase\n constant += \"_K\" unless Syntax.const_defined?(constant)\n super(name) unless Syntax.const_defined?(constant)\n unless look_ahead =~ Syntax.const_get(constant)\n raise(IMPSyntaxError, \"Line #{line_number}: '#{token}' expected. Got '#{look_ahead}'.\")\n end\n next_token\n end", "def _lex_actions; end", "def tokens=(_arg0); end", "def tokens=(_arg0); end", "def tokens=(_arg0); end", "def parse(source, options = T.unsafe(nil)); end", "def parse(source, options = T.unsafe(nil)); end", "def tokenize\n \n end", "def ast_class; end", "def parse(thing, &block); end", "def parse(thing, &block); end", "def parse_input (input_file)\nend", "def tagline; 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 yyerrok; end" ]
[ "0.8120399", "0.8120399", "0.8120399", "0.8120399", "0.7715559", "0.7715559", "0.7715559", "0.7643554", "0.7643554", "0.75777364", "0.75063425", "0.73162514", "0.7286733", "0.72758543", "0.7229573", "0.7171644", "0.70573944", "0.7000156", "0.7000156", "0.7000156", "0.7000156", "0.69328856", "0.6887008", "0.6882881", "0.6856636", "0.68238145", "0.67917776", "0.6735954", "0.6682505", "0.66767037", "0.66656125", "0.66029346", "0.66029346", "0.6538914", "0.65254015", "0.6455158", "0.6452408", "0.6423672", "0.6423672", "0.6415048", "0.63380766", "0.63266873", "0.63202626", "0.6314985", "0.63106793", "0.62720937", "0.62077045", "0.6203959", "0.6198135", "0.6179526", "0.6179526", "0.6179526", "0.6179526", "0.6179526", "0.6179526", "0.6179526", "0.6179526", "0.6162715", "0.61580056", "0.61562234", "0.6154797", "0.6154797", "0.6131307", "0.6119964", "0.61156344", "0.6113402", "0.61016166", "0.60904557", "0.60904557", "0.60904557", "0.60904557", "0.6068793", "0.6068793", "0.6057734", "0.602662", "0.602662", "0.598464", "0.59822994", "0.5979264", "0.5967427", "0.5960161", "0.5956366", "0.5956366", "0.59520316", "0.59520316", "0.59520316", "0.5951631", "0.5940499", "0.59228", "0.59228", "0.59228", "0.59141314", "0.59141314", "0.5901834", "0.58999336", "0.5893065", "0.5893065", "0.5892323", "0.58837634", "0.5878154", "0.58580375" ]
0.0
-1
=== Images Methods ===
def imgs obj Image.find(obj.image_ids) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def images; end", "def images\n end", "def image; end", "def image\n\n end", "def image\n end", "def image\n end", "def images\n []\n end", "def image\n end", "def image\n end", "def images\n @images = super || []\n end", "def set_img\n\n end", "def img(*) # :nodoc:\n raise \"no!\"\n end", "def images\n self.class.images\n end", "def sequence_images\n \n end", "def images\n @picturesandmeta = Pictureandmeta.all\n @kind = Kind.find(params[:kind_id])\n Rails.logger.info(\"Kind: #{@kind.inspect}\")\n end", "def images\n [\n 'crow',\n 'cow',\n 'deer',\n 'monkey',\n 'fish',\n 'frog',\n 'horse',\n 'spider',\n ]\n end", "def thumbnail_image\n end", "def image\n images.first\n end", "def images\n @images ||= {}\n end", "def create_images\n problem_image = self.images.build\n File.open('./public/projects/problem_default.jpg') do |f|\n problem_image.image = f\n end\n\n solution_image = self.images.build\n File.open('./public/projects/solution_default.jpg') do |f|\n solution_image.image = f\n end\n\n team_image = self.images.build\n File.open('./public/projects/team_default.png') do |f|\n team_image.image = f\n end\n end", "def image\n 0\n end", "def cover_image\n end", "def my_images(options = {})\n images options.merge(:owners => 'self')\n end", "def cur_image\n self\n end", "def image( name )\n @images[name]\n end", "def get_images\n {}\n end", "def main_image\n self.images.first.image\n end", "def show_images\r\n images = Document.new(self).get_images\r\n puts \"There are #{images.length} images\"\r\n index = 1\r\n images.each do |l|\r\n puts \"image: name: #{l.name}\"\r\n puts \" id: #{l.id}\"\r\n puts \" src: #{l.src}\"\r\n puts \" index: #{index}\"\r\n index += 1\r\n end\r\n end", "def render_image\n render_image_iterm2\n end", "def setup_images\n @default_image = NSImage.imageNamed(\"default.png\")\n @alternate_image = NSImage.imageNamed(\"alternate.png\")\n @highlight_image = NSImage.imageNamed(\"highlight.png\")\n end", "def each_image(&block)\n images.each(&block)\n end", "def images\n IbmCloudRest.get \"#{@uri}/images\"\n end", "def picture_list\n end", "def image_urls\n raise NotImplementedError\n end", "def images\n TheWalters::ArtObject.get_images(self.ObjectID)\n end", "def getImg(width=64, height=64)\n if self.image\n self.image+\"?width=#{width}&height=#{height}\"\n else\n \"no_image.png\"\n end\n end", "def image()\n @image__\n end", "def images_urls\n \timages.map{|image| image.url}\n end", "def img\n Magick::Image::read(self.image).first\n end", "def images\n super.map do |image|\n Spotify::SDK::Image.new(image, parent)\n end\n end", "def load_images\n @@images[\"background\"] = Gosu::Image.new(self, \"media/ground.jpeg\", true)\n @@images[\"circle\"] = Gosu::Image.new(self, \"media/ground.jpeg\", true)\n @@images[\"creeps\"] = Gosu::Image.load_tiles(\"./media/pokemons.png\", 32, 32)\n end", "def image idx=0\n @images[idx]\n end", "def image\n @path\n end", "def images\n\t\treturn @images if @images\n\n\t\tif path\n\t\t\t@images = (File.file?(path) ? [path] : [])\n\t\t\treturn @images\n\t\tend\n\n\t\t@images = find\n\t\tputs \"Found #{@images.size} images\" if verbose?\n\t\t@images\n\tend", "def images\n @images ||=\n search('img').map { |node| Image.new(node, self) }\n end", "def images\n @images ||=\n search('img').map { |node| Image.new(node, self) }\n end", "def images\n @images ||= Hash.new\n end", "def images()\n @photos = all_photos() \n @headers['Content-Type'] = CONTENT_TYPE\n end", "def gallery_images\n imgs = images\n 1.upto(3 - imgs.size) do |i|\n imgs << \"/images/placeholder.png\"\n end\n imgs\n end", "def images\n {\n thumbnail: object.thumbnail.url(:large),\n logo: object.logo.url(:medium),\n white_logo: object.white_logo.url(:medium)\n }\n end", "def generate_images\n Docsplit.extract_images(@files.to_s)\n end", "def images\n if !@images\n @images = {}\n @images[:thumb] = self.thumb_image if self.thumb_image\n @images[:tiny_image] = self.tiny_image if self.tiny_image\n @images[:small] = self.small_image if self.small_image \n @images[:medium] = self.medium_image if self.medium_image\n @images[:large] = self.large_image if self.large_image\n end\n end", "def images\n if @images.nil?\n @images = []\n image_nodes = FeedTools::XmlHelper.combine_xpaths_all(\n self.channel_node, [\n \"image\",\n \"logo\",\n \"apple-wallpapers:image\",\n \"imageUrl\"\n ]\n )\n unless image_nodes.blank?\n for image_node in image_nodes\n image = FeedTools::Image.new\n image.href = FeedTools::XmlHelper.try_xpaths(image_node, [\n \"url/text()\",\n \"@rdf:resource\",\n \"@href\",\n \"text()\"\n ], :select_result_value => true)\n if image.href.nil? && image_node.base_uri != nil\n image.href = \"\"\n end\n begin\n if !(image.href =~ /^file:/) &&\n !FeedTools::UriHelper.is_uri?(image.href)\n image.href = FeedTools::UriHelper.resolve_relative_uri(\n image.href, [image_node.base_uri, self.base_uri])\n end\n rescue\n end\n if self.configurations[:url_normalization_enabled]\n image.href = FeedTools::UriHelper.normalize_url(image.href)\n end \n image.href.strip! unless image.href.nil?\n next if image.href.blank?\n image.title = FeedTools::XmlHelper.try_xpaths(image_node,\n [\"title/text()\"], :select_result_value => true)\n image.title.strip! unless image.title.nil?\n image.description = FeedTools::XmlHelper.try_xpaths(image_node,\n [\"description/text()\"], :select_result_value => true)\n image.description.strip! unless image.description.nil?\n image.link = FeedTools::XmlHelper.try_xpaths(image_node,\n [\"link/text()\"], :select_result_value => true)\n image.link.strip! unless image.link.nil?\n image.height = FeedTools::XmlHelper.try_xpaths(image_node,\n [\"height/text()\"], :select_result_value => true).to_i\n image.height = nil if image.height <= 0\n image.width = FeedTools::XmlHelper.try_xpaths(image_node,\n [\"width/text()\"], :select_result_value => true).to_i\n image.width = nil if image.width <= 0\n image.style = FeedTools::XmlHelper.try_xpaths(image_node, [\n \"style/text()\",\n \"@style\"\n ], :select_result_value => true)\n image.style.strip! unless image.style.nil?\n image.style.downcase! unless image.style.nil?\n @images << image unless image.href.nil?\n end\n end\n for link_object in self.links\n if link_object.type != nil && link_object.type =~ /^image/\n image = FeedTools::Image.new\n image.href = link_object.href\n image.title = link_object.title\n @images << image unless image.href.nil?\n end\n end\n end\n return @images\n end", "def images\n images = @anchors.select { |a| a.object.is_a?(Pic) }\n images.map { |a| a.object }\n end", "def add_image( id, image_name, x_position, speed, width, height )\n OSX::NSLog(\"Received image ##{id} (#{image_name})\")\n# image_name = OSX::NSBundle.mainBundle.pathForImageResource( image_name )\n image_name = \"/Users/alpha/src/cyberart/images/#{image_name}.jpg\"\n image = CAImage.new( id, image_name, x_position, speed, width, height )\n @semaphore.synchronize { temp_images = @images.dup }\n temp_images << image\n @semaphore.synchronize { @images = temp_images }\n end", "def images\n @images ||= Image.find_all_by_listing_id(listing_id, oauth)\n end", "def images\n return @canonical_image_pool if @canonical_image_pool\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Retrieving all images\"\n check_retval @image_pool.info_all!\n\n @canonical_image_pool = []\n @image_pool.each { |image| @canonical_image_pool << canonical_image(image) }\n @canonical_image_pool\n end", "def home\n @images = [\"random_people.jpg\", \"using_phones.jpg\", \"naeem.jpg\"]\n end", "def all_images(albid)\n kept_images(albid) + deleted_images(albid)\n end", "def gallery_images\n imgs = []\n images.each do |image|\n imgs << image.public_filename(:medium)\n end\n 1.upto(6 - imgs.size) do |i|\n imgs << \"/images/placeholder.png\"\n end\n imgs\n end", "def setup\n size 200, 200\n @a = load_image 'construct.jpg'\n @b = load_image 'wash.jpg'\n @offset = 0.0\nend", "def default_image\n end", "def test_06b\r\n db = build\r\n db.fetch('image-1.jpg',:width => 102)\r\n db.fetch('image-1.jpg',:width => 103)\r\n db.fetch('image-1.jpg',:width => 104)\r\n db.fetch('image-1.jpg',:height => 105)\r\n r = db.image('image-1.jpg')\r\n assert_equal 'image-1.jpg',r[:original]\r\n end", "def imagemagick?; end", "def images\n @images ||= ApiFactory.new 'Projects::Images'\n end", "def load_images\n images = Magick::Image.read(@path)\n images.size.times do |i|\n images[i] = Image.new images[i], @options, i\n end\n images\n end", "def load_image(path)\n end", "def image_url\n image.url\n end", "def images() \n uri = URI.parse(\"http://\" + @location.host + \":9292/v2/images\")\n return get_request(uri, @token)\n end", "def image_url\n image_uri\n end", "def main\n ImageManip::inspect_image(@image_path)\n dimensions = ImageManip::get_dimensions(@image_path)\n sharp_pixels = get_accidental_pixels(@sharp_path)\n flat_pixels = get_accidental_pixels(@flat_path)\n edits = Hash.new\n edits[:lower_left] = [dimensions[0] / 2, dimensions[1] / 2]\n edits[:rgb_array] = sharp_pixels\n ImageManip::draw_2D_object(@image_path, './new_staff.gif', edits)\n edits[:lower_left] = [dimensions[0] / 3, dimensions[1] / 3]\n edits[:rgb_array] = flat_pixels\n ImageManip::draw_2D_object('./new_staff.gif', './new_staff.gif', edits)\n end", "def base_image\n self\n end", "def image_url\n self.filename.url \n end", "def images; (page.images rescue []); end", "def images; (page.images rescue []); end", "def primary_image\n if images.length > 0\n images[0].url\n else\n \"https://vollrath.com/ClientCss/images/VollrathImages/No_Image_Available.jpg\"\n end\n end", "def configureImages()\n #Fetch the server configuration\n config = fetchServerConfig()\n #Used the gathered configuration information to build a URL for accessing images\n $imageBase = config['images']['base_url']+config['images']['poster_sizes'][5]\nend", "def afficher\n @image.display\n end", "def images()\n\t\treturn Images.new(@credentials.client_key, @credentials.get_access_token)\n\tend", "def image()\n\t\tActionController::Base.helpers.image_tag(\"holes/Hunter_H%02d\" % self.number + \".jpg\" \\\n\t\t\t, :alt => 'Hole ' % self.number \\\n\t\t\t, :class => 'holeImage'\n\t\t\t)\n\tend", "def list_images # :nologin:\n query = create_query(:Image, :all, :by => :created_at)\n show_selected_images(query)\n end", "def cloudinary_imgs_cara(key,instance)\n cl_image_tag(key, :quality=>\"auto\", :fetch_format=>:auto, :crop=>\"fit\", :class=>\"d-block mx-auto img-fluid rounded\", :alt=>\"#{instance.name}\")\n end", "def update_img\n @post = Post.find(self.id)\n image = @post.image.url(:gallery)\n image = '/public' + image.gsub(/\\?.*/, '')\n\n if [email protected]_text.nil?\n if File.exists? Rails.root.to_s + image\n PostsHelper.image_writer(image, @post.meme_text, @post.meme_position)\n end\n end\n end", "def image_urls\n images.map {|image| image.url}\n end", "def image\n if File.exists?(self.image_jpg_path)\n \"/assets/game_images/%s.jpg\" %[self.name.dehumanize]\n elsif File.exists?(self.image_png_path)\n \"/assets/game_images/%s.png\" %[self.name.dehumanize]\n else\n nil\n end\n end", "def load_background_images\n arr = Array.new()\n\n i = 0\n while (i < BACKGROUND_IMAGES.size)\n arr << Gosu::Image.new(BACKGROUND_IMAGES[i])\n i += 1\n end\n\n arr\nend", "def image_hash; end", "def images\n self.assets.find_all{ |asset| asset.image? }\n end", "def image(id, nsfw = false)\n img = get url: \"images/#{id}\", nsfw: nsfw\n img['image'] if img\n end", "def index\n @image_queries = ImageQuery.all.with_attached_image\n end", "def images\n user = current_user\n\n if user\n @error = nil # Returned message if something went wrong, or nil for success\n @images = [] # Image data for view rendering; array of hashes. Hash format is as follows:\n # indexer: Derpibooru's indexer number for the image\n # direct_link: Link to full sized image\n # thumb_link: Link to image thumbnail\n # checked: True if the image should be checked by default\n # css_id: Id for css used when displaying the image\n\n # Minimum and maximum indexers of the images that are returned\n @min = nil\n @max = nil\n\n # Only allow one direction between min and max\n min = params[:min] ? params[:min].to_i : nil\n max = params[:max] ? params[:max].to_i : nil\n min = max = nil if min && max\n\n begin\n images = []; # This is used only for each individual loop\n\n # Skim through images already databased\n if (not min.nil?) ^ (not max.nil?)\n begin\n databased_image = Image.where(indexer: min ? min : max).first\n if databased_image\n min += 1 if min\n max -= 1 if max\n images << databased_image\n end\n end while databased_image && (@images.length + images.length) < THUMBS_PER_PAGE\n end\n\n # If we haven't reached our desired thumbnail count, ask derpibooru for more\n unless (@images.length + images.length) >= THUMBS_PER_PAGE\n response = make_request(generate_request(user, min, max), @error)\n if response\n images += process_response(user, response)\n else\n @images = nil\n break\n end\n # Update min and max for the images we just covered so another set can be requested as needed\n sorted_images = images.sort { |x, y| x.indexer.to_i <=> y.indexer.to_i}\n\n\t\t if sorted_images.length > 0\n\t\t if min\n min = sorted_images.last.indexer.to_i + 1\n else\n max = sorted_images.first.indexer.to_i - 1\n end\n\t\t end\n end\n\n # Now we must process these images for the view\n images.each do |image|\n unless(image.dead || user.discarded?(image))\n @images << process_image(user, image)\n end\n end\n end while (images.length > 0) && (@images.length < THUMBS_PER_PAGE)\n\n # We've safely databased, but limit the amount of images on the page to reduce confusion.\n\t @images = @images[0 .. (THUMBS_PER_PAGE - 1)]\n\n\t # Reverse them when going backwards so the order stays the same\n @images.reverse! unless min.nil?\n\n # Compute final minimum and maximum values of the final thumbnails\n range = @images.collect {|x| x[:indexer].to_i}\n @min = range.min\n @max = range.max\n else\n # Nope - not logged in!\n redirect_to root_path\n end\n end", "def image_for(movie)\n if movie.image.exists?\n image_tag(movie.image.url,size: \"90x124\")\n else\n image_tag('placeholder.png')\n end\n end", "def describe_image(image)\n puts \"#{image[:name]} is #{image[:width]}px * #{image[:height]}px\"\nend", "def image_path\n thumbnail_url\n end", "def getimage\n if @artist.images.empty?\n @image = \"image1.jpg\"\n else\n @image = @artist.images.first[\"url\"]\n end\n end", "def image\n\t\treturn @wiki_img if @wiki_img\n\t\tlogger.info \"finding picture for #{name}\"\n\t\tWikipedia.Configure do\n\t\t\tdomain \"en.wikipedia.org\"\n\t\t\tpath \"w/api.php\"\n\t\tend\n\t\tp = page\n\t\tif p && p.image_urls && p.image_urls.count > 0\n\t\t\t@wiki_img = p.image_urls.last # last one is the one on the right\n\t\t\tself.picture = @wiki_img\n\t\t\tself.save\n\t\t\t@wiki_img\n\t\telse\n\t\t\tnil\n\t\tend\n\tend", "def initialize_image_resource image, x, y, width, height, z_index\n resource = ImageResource.new\n resource.x = x\n resource.y = y\n resource.type = \"image\"\n resource.image = image\n resource.z_index = z_index\n resource.scale_x = width / image.width\n resource.scale_y = height / image.height\n\n resource\nend", "def image _args\n \"image _args;\" \n end", "def images\n @images ||= Dir[File.join(filesystem_dir, \"*#{image_file_extension}\")]\n end", "def big_main_image\n\t\timage = self.images.first\n\t\timage.asset.url(:large)\n\tend" ]
[ "0.84653085", "0.82592577", "0.7665665", "0.76652676", "0.7635363", "0.7635363", "0.7443061", "0.73192775", "0.73192775", "0.7285348", "0.7091011", "0.7027154", "0.70265406", "0.7019263", "0.6962551", "0.6961665", "0.6943656", "0.68687356", "0.68545556", "0.68480545", "0.6809875", "0.67957634", "0.67686564", "0.67354625", "0.6727651", "0.67236596", "0.67186624", "0.6695772", "0.66754085", "0.6663791", "0.66624427", "0.6655002", "0.6645466", "0.6642089", "0.6634145", "0.6621792", "0.659485", "0.658936", "0.65819937", "0.6571152", "0.6570667", "0.6559393", "0.6554601", "0.65482163", "0.6546177", "0.6546177", "0.6526714", "0.6514329", "0.65141624", "0.65022177", "0.6501674", "0.6501547", "0.64967227", "0.64929014", "0.6487894", "0.6485223", "0.64819455", "0.6473034", "0.6470355", "0.6469087", "0.6465569", "0.6452475", "0.6442883", "0.6407413", "0.63875645", "0.63851094", "0.63809454", "0.6380287", "0.63757753", "0.6371233", "0.636962", "0.63666373", "0.63634676", "0.63623446", "0.63623446", "0.6348395", "0.6346699", "0.63466483", "0.63460654", "0.63455623", "0.63407475", "0.63360584", "0.63220924", "0.6321664", "0.6304342", "0.630337", "0.6301809", "0.6299369", "0.6295649", "0.6289869", "0.6289489", "0.628062", "0.62803876", "0.6279257", "0.6277496", "0.62726974", "0.62667704", "0.6265665", "0.6254871", "0.6253171" ]
0.69043505
17
How would you modify the function to print all numbers between 1 and 1000, 10000, or n ?
def counter_2(x) (1..x).each { |n| puts n } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def range_print_10\n (0..9).step(1) do |n| \n puts n \n end \n \nend", "def print_range\n\n\tsum = 0\n\t\n\tfor i in 1...1000 do\n\t\t\t\t\n\t\tif i%3 == 0 or i%5 == 0\n\t\t\t\n\t\t\tsum += i\n\t\t\t\n\t\t\t#just for initial tracing\n\t\t\t#puts i \n\n\t\tend\t\n\n\tend\t \n\t\t\n\tputs sum\n\t\t\nend", "def print_odd_numbers_r(bound=99, n=3)\n if iteration <= bound\n puts n\n print_odd_numbers_r(bound, n+2)\n end\n\nend", "def printNums(min,max, step)\n i = min\n while i <= max\n puts i\n\n i += step\n end\nend", "def range_print_10\n array = (0..9).to_a\narray.each do |x|\n print x\nend\n\nend", "def range_print_10\nend", "def solution(n)\r\n unit = UNITS[n % 10]\r\n dozen = DOZENS[(n % 100) / 10]\r\n hundred = HUNDREDS[(n % 1000) / 100]\r\n thousand = THOUSAND * (n / 1000)\r\n [thousand, hundred, dozen, unit].join\r\nend", "def printNums(min, max, step)\n # min sets the starting i, max sets where i will stop, step will set the increment/decrement values\n i = min\n while i <= max\n puts i\n \n i += step\n end\nend", "def numbers(n)\n\nend", "def puts_1_to_10\n (1..10).each { |i| puts i }\nend", "def puts_1_to_10\n (1..10).each { |i| puts i }\nend", "def featured(n)\n (n..9_999_999_999).each {|number| return number if number_valid?(n, number)}\n return \"There is no possible number that fulfills those requirements.\"\nend", "def print_list(limit)\n\n 1.upto(limit) do |number|\n\n if divisible_by?(15, number)\n puts \"Fizzbuzz\"\n\n elsif divisible_by?(3, number)\n puts \"Fizz\"\n\n elsif divisible_by?(5, number)\n puts \"Buzz\"\n\n else\n puts number\n\n end\n end\nend", "def odd_nums_r (bound=99, n=3)\n if n <= bound\n puts n\n odd_nums_r(bound, n + 1)\n end\nend", "def cout(n)\n\tw=[0,1,2,3,4,5,6,7,8,9]\n\tx=[]\n\tk=1\n\twhile x!=w do \n\t\tm=n*k\n\t\t\twhile m>0 do\n\t\t\t\tt=m%10\n\t\t\t\tx=x.push(t)\n\t\t\t\tx.sort!\n\t\t\t\tx.uniq!\n\t\t\t\tm=m/10\t\n\t\t\tend\n\t\tk=k+1\n\tend\nreturn (k-1)*n\nend", "def natural_numbers\r\n\tnatural_numbers = []\r\n\tfor x in 1..999\r\n\t\tif x % 3 == 0 or x % 5 == 0\r\n\t\t\tnatural_numbers << x\r\n\t\tend\r\n\tend\r\nend", "def range(limits)\r\n\tnumbers = []\r\n\tfor number in (0..limits)\r\n\t\tputs \"At the top numbers are : #{number}\"\r\n\t\tnumbers.push(number)\r\n\tend\r\n\r\n\tputs \"The numbers: \"\r\n\tfor number in numbers\r\n\t\tputs number\r\n\tend\r\nend", "def integer_print_10\n 10.times do |x|\n print x\n end\nend", "def fizz_buzz_to(limit)\n#starting from the number 1 up to the variable limit, do something to each integer\n 1.upto(limit).each do |num|\n#print the output of the fizzbuzz method \n puts fizzbuzz(num)\n end\nend", "def fizz_buzz_to(limit)\n 1.upto(limit).each do |num|\n puts fizzbuzz(num)\n end\nend", "def slippery_numbers(n)\nend", "def numEvaluator(number_in)\n if (number_in >= 0) && (number_in <= 50)\n puts 'between 0 and 50'\n elsif (number_in >= 51) && (number_in <= 100)\n puts 'between 51 and 100'\n elsif (number_in >= 101) \n puts '>100'\n else\n puts '<0'\n end\n end", "def num_100(n)\n if n < 0\n puts \"Please enter a positive number\"\n elsif n <= 50\n puts \"The number #{n} is between 0 and 50\"\n elsif n <= 100\n puts \"The number #{n} is between 51 and 100\"\n else\n puts \"The number #{n} is over 100\"\n end\nend", "def natural_method(limit, number_multiple1, number_multiple2)\n\tarray = []\n\t(1..limit).each do |number|\n\t\tif (number % number_multiple1 == 0) || (number % number_multiple2 == 0)\n\t\t\tarray << number \n\t\tend\n\tend\n\tputs sum(array)\nend", "def print_odd\n range = (1..99).to_a\n range.each do |num|\n if num % 2 == 0\n puts num\n end\n end\nend", "def integer_print_10\n 10.times do |x|\n puts x \n end \nend", "def integer_print_10\nend", "def in_range (n)\n\tif n <1 || n> 10 \n\t\tfalse\n\telse\n\t\ttrue\n\tend\nend", "def reprint(number)\n\t(1..100).each do |i|\n\t\tif i % 3 == 0 and i % 5 == 0\n\t\t\tputs 'FizzBuzz'\n\t\telsif i % 5 == 0\n\t\t\tputs 'Buzz'\n\t\telsif i % 3 == 0 \n\t\t\tputs 'Fizz'\t\t\n\t\telse\n\t\t\tputs i\t\t\n\t\tend\n\tend\nend", "def fizz_buzz(min, max)\n (min..max).each do |number|\n puts fizz_buzz_calculator(number)\n end\nend", "def fizzbuzz_to(limit)\n #Create a loop that starts from 1 and ends at the argument given\n 1.upto(limit) do |i|\n #Print the output of every iteration of the method 'fizzbuzz' when called with the argument of the integers 1 through the limit given\n puts(fizzbuzz(i))\n end\nend", "def print_num n\n prep = n < 0 ? \"\" : \" \"\n print \"#{prep}%.2f | \" % n\nend", "def look_and_see(num)\n numbers = num.to_s.split(\"\")\n result = loop_each_number(numbers)\n result.join\nend", "def handle_hundred (num)\n num2str=''\n if (num%100==0)\n num2str+=NUM_MAP[num/100]+ ' '+ NUM_MAP[100]\n elsif (num%100>=10 && num%100 <= 99)\n num2str+=NUM_MAP[num/100]+ ' '+ NUM_MAP[100]+ ' ' +handle_ten(num%100)\n elsif (num%100>=1 && num%100 <= 9)\n num2str+=NUM_MAP[num/100]+ ' '+ NUM_MAP[100]+ ' ' +handle_bit(num%100)\n end\n return num2str\nend", "def fizz_buzz_to(limit)\n# in increments of 1, \"do\" something each time you see \"num\"\n 1.upto(limit).each do |num|\n# print each incremental number on each loop until (value passed to limit) is reached\n puts fizzbuzz(num)\n# end upto method\n end\n# end fizz_buzz_to\nend", "def results(num)\n if num < 0\n puts \"What's with the negative number?\"\n elsif num <= 50\n puts \"#{num} is between 0 and 50.\"\n elsif num <= 100\n puts \"#{num} is between 51 and 100.\"\n else\n puts \"#{num} is above 100. That's too high!\"\n end\n end", "def numbgen(number)\n case\n when number <= 50\n puts \"#{number} is between 0 and 50\"\n\n when number <= 100\n puts \"#{number} is between 51 and 100\"\n\n else\n puts \"#{number} is above 100\"\n end\nend", "def numbers(number) \n if number <= 50\n puts \"Your input value is #{number}. That number is between 0 and 50.\"\n elsif number > 50 && number <= 100 \n puts \"Your input value is #{number}. That number is between 51 and 100.\"\n else number > 100 \n puts \"Your input value is #{number}. That number is over 100.\"\n end\nend", "def handle_ten (num)\n num2str=''\n if (num%10==0)\n num2str+=NUM_MAP[num]\n elsif (num>10 && num<20)\n num2str+=NUM_MAP[num]\n else\n num2str+=NUM_MAP[num/10*10]+'-'+NUM_MAP[num%10]\n end\n return num2str\nend", "def req_num_case1(n1)\n case \n when 0 .. 50\n \"#{n1} is between 0 and 50\"\n when 51 .. 100\n \"#{n1} is between 51 and 100\"\n else\n \"#{n1} is above 100\"\n end\nend", "def fizz_buzz_to(limit)\n# This defines the variable \"fizz_buzz-to\" and explains in parenthesis what parameters can be passed into it.\n# In this case, there is only one parameter: limit.\n 1.upto(limit).each do |num|\n#Here we are using a loop to say that from integers 1 up to whatever number is placed in the parameter limit, do the following.\n puts fizzbuzz(num)\n#So for integers from 1 up until the established limit, run that number through the fizzbuzz variable and print the result (which, based on our case options, will be \"FizzBuzz\", \"Fizz\", \"Buzz\" or the number itself.)\n end\n #This ends the steps within the loop.\nend", "def output\n @range.each { |number| puts format(number) }\n end", "def output\n @range.each { |number| puts format(number) }\n end", "def output\n @range.each { |number| puts format(number) }\n end", "def printable_display(numbers)\n numbers.each { |i| puts i.join('') }\n end", "def range(min, max)\n\tprint (min..max).to_a\nend", "def basic_1\n x_range = (1..255)\n x_range.step(1) { |n| print \"#{n} \" }\n puts\nend", "def values(x)\n thous = x / 1000\n hunds = (x % 1000) / 100\n tens = (x % 100) / 10\n ones = x % 10\n\n puts \"#{thous}\"\n puts \"#{hunds}\"\n puts \"#{tens}\"\n puts \"#{ones}\"\nend", "def print_n_and_n_plus1(n)\n\tputs \"#{n} and #{n+1}\"\nend", "def in_words(n)\n # n / power of 10 = leftmost digit. n % power of 10 = remaining right digits.\n\n words = []\n\n case n\n when 0..19\n words.unshift(teen(n))\n when 20..99\n words.unshift(tens(n))\n when 100..999\n words.unshift(hundreds(n))\n when 1000..999_999\n words.unshift(thousands(n))\n end\n\n words.join(' ')\nend", "def factorial(n)\n for i in (1...n)\n n = n * i\n # puts n\n end\n puts n\nend", "def find_hundreds (n)\n words =\"\"\n num_words = Hash.new(0)\n num_words = {1=>\"One\",2=>\"Two\",3=>\"Three\",4=>\"Four\",5=>\"Five\",6=>\"Six\",7=>\"Seven\",8=>\"Eight\",9=>\"Nine\",10=>\"Ten\",11=>\"Eleven\",12=>\"Twelve\",13=>\"Thirteen\",14=>\"Fourteen\",15=>\"Fifteen\",16=>\"Sixteen\",17=>\"Seventeen\",18=>\"Eighteen\",19=>\"Nineteen\",20=>\"Twenty\",30=>\"Thirty\",40=>\"Fourty\",50=>\"Fifty\",60=>\"Sixty\",70=>\"Seventy\",80=>\"Eighty\",90=>\"Ninety\"}\n\n if n/100 > 0\n # Append the String you get to the string that holds the words\n words = num_words[n/100] +\" Hundred \"\n if n%10 !=0\n words= words + \"and \"\n end\n n=n%100\n end\n\n if n/10 > 0\n if n/10 == 1\n words = words+num_words[n]+ \" \"\n elsif n%10 == 0\n words = words +num_words[n]\n else\n words = words +num_words[n/10*10] +\" \"+ num_words[n%10]\n end\n elsif n == 0\n words\n else\n words = words +num_words[n]\n end\n words\nend", "def basic_2\n x_range = (1..255)\n x_range.step(1) { |n| print \"#{n} \" if n % 2 != 0 }\n puts\nend", "def featured(int)\n for num in (int + 1...9_999_999_999) \n return num if num.odd? && num % 7 == 0 && num.digits == num.digits.uniq\n end\n \"There is no possible number that fulfills those requirements\"\nend", "def range_number(n,t)\n\t\t(n).step(t){|n|n+2}\n\tend", "def printStep(min,max, step)\n i = min\n while i <= max\n puts i\n i += step\n end\nend", "def one_to_a_hundred\n number = 0\n while number < 100\n number += 1\n puts number\n end\nend", "def one_to_a_hundred\n number = 0\n while number < 100\n number += 1\n puts number\n end\nend", "def printNumbers()\n print($num1,1)\n print($num2,2)\nend", "def numrange(num)\n if num < 0\n puts \"Your number is negative\"\n elsif num <51\n puts \"Your number is between 0 and 50 inclusive\"\n elsif num <101\n puts \"Your number is between 51 and 100 inclusive\"\n else\n puts \"Your number is greater than 100\"\n end\nend", "def featured(n)\n n += 1\n n += 1 until n % 7 == 0 && n.odd?\n loop do\n break if n.to_s.chars.uniq.join == n.to_s\n n += 14\n if n > 9876543210\n puts \"There is no possible number that fulfills those requirements\"\n return nil\n end\n end\n n\nend", "def fizz_buzz_to(limit)\n #from 1 to the limit number, for each number, take the number \n 1.upto(limit).each do |num|\n #print out result of calling fizzbuzz with the number.\n puts fizzbuzz(num)\n #ends the each do \n end\n#ends the function definition. \nend", "def printword(digit)\n ones = ['', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']\n tens = ['twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety']\n tenones = ['ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen','seventeen', 'eighteen', 'nineteen']\n if digit < 10\n return ones[digit]\n elsif digit < 20\n onesplace = digit % 10\n return tenones[onesplace]\n elsif digit < 100\n tensdigit = (digit / 10).floor\n onesdigit = digit % 10\n return \"#{tens[tensdigit - 2]} #{ones[onesdigit]}\"\n elsif digit < 1_000\n hunddigit = (digit / 100).floor\n hundremainder = digit % 100\n return \"#{printword(hunddigit)} hundred #{printword(hundremainder)}\"\n elsif digit < 1_000_000\n thoudigit = (digit / 1000).floorx\n thouremainder = digit % 1000\n return \"#{printword(thoudigit)} thousand #{printword(thouremainder)}\"\n elsif digit < 1_000_000_000\n milldigit = (digit / 1_000_000).floor\n millremainder = digit % 1_000_000\n return \"#{printword(milldigit)} million #{printword(millremainder)}\"\n elsif digit < 1_000_000_000_000\n billdigit = (digit / 1_000_000_000).floor\n billremainder = digit % 1_000_000\n return \"#{printword(billdigit)} billion #{printword(billremainder)}\"\n end\nend", "def print_nums\n i = 10\n while i >= 0\n puts i \n i -= 1\n end\nend", "def fizz_buzz_to(limit)\n#in increments of one, you do something every time num shows up\n 1.upto(limit).each do |num|\n #the something that is done is the string from fizzbuzz shows\n puts fizzbuzz(num)\n end\nend", "def m(n)\n if n > 100\n puts \"M(#{n -= 10}) since #{n + 10} is greater than 100\"\n n\n else\n puts \"M(M(#{n += 11})) since #{n - 11} equal to or less than 100\"\n m(m(n))\n end\nend", "def fizzbuzz(start, finish)\n (start..finish).each do |n|\n output = ''\n output << 'Fizz' if (n % 3).zero?\n output << 'Buzz' if (n % 5).zero?\n puts output == '' ? n : output\n end\nend", "def fizzbuzz_to(limit)\n\t# Upto is being called to the 1. You pick a variable and it will print all the number up to that 'limit'. \n 1.upto(limit) do |i|\n \t# This Prints out the code on terminal. \n puts(fizzbuzz(i))\n end\nend", "def fetch_number_strings(number,factor,and_flag)\n first_part = number % factor\n (and_flag) ? and_string = \" and \" : and_string = \" \"\n if factor.eql?(10)\n second_part = number - first_part\n \"#{generate_number_str(second_part,true)}#{and_string}#{int_strings[first_part]}\"\n else\n second_part = (number - first_part)/factor\n \"#{generate_number_str(second_part,true)} #{int_strings[factor]}#{and_string}#{generate_number_str(first_part,true)}\"\n end\n end", "def output\n @range.each do |number|\n if even_split?(number, 3)\n puts \"fizz\"\n elsif even_split?(number, 5)\n puts \"buzz\"\n else\n puts number\n end\n end\n end", "def print_cut_rod_solution(p,n)\n\nend", "def check_num(number)\n if (1..10).include? number\n puts \"Valid\"\n else\n puts \"Invalid\"\n end\nend", "def number_in_a_can(number = 10)\n number.times { |n| puts \"The number is #{n}\" }\nend", "def printNums\n i = 10\n while i >= 0\n puts i\n i -= 1\n end\nend", "def fizz_buzz_to(limit)\n 1.upto(limit).each do |num|\n puts fizzbuzz(num)\n end\n end", "def multiples\n \tfor n in 1..100\n \t\tif n%3==0 && n%5==0\n \t\t\tputs \"FizzBuzz\"\n \t elsif n%3==0\n \t \tputs \"Buzz\"\n \t else\n \t \tputs n\n \t end\n \tend\nend", "def range(min, max)\n all_numbers = []\n \n i = min\n while i <= max\n all_numbers << i\n \n i += 1\n end\n \n return all_numbers\nend", "def main\n print(cracklepop_numbers(1, 100))\nend", "def fizzbang(limit)\r\n\t1.upto(limit) do |number|\r\n\t\tif number % 3 == 0 and number % 5 == 0\r\n\t\t\tputs \"fizzbang\"\r\n\t\telsif number % 3 == 0\r\n\t\t\tputs \"fizz\"\r\n\t\telsif number % 5 == 0\r\n\t\t\tputs \"bang\"\r\n\t\telse\r\n\t\t\tputs number\r\n\t\tend\r\n\tend\r\nend", "def fizzbuzz(starting, ending)\n (starting..ending).each do |num|\n if (num % 15).zero?\n p \"FizzBuzz\"\n elsif (num % 3).zero?\n p \"Fizz\"\n elsif (num % 5).zero?\n p \"Buzz\"\n else\n p num\n end\n end\nend", "def fizzbuzz\n (1..100).each do |num|\n puts fizz_buzz(num)\n end\nend", "def fizzbuzz(start_num, end_num)\n for curr_num in (start_num..end_num)\n if curr_num % 15 == 0\n print \"FizzBuzz\"\n elsif curr_num % 5 == 0\n print \"Buzz\"\n elsif curr_num % 3 == 0\n print \"Fizz\"\n else\n print curr_num\n end\n print \", \" if curr_num < end_num\n end\n puts \"\"\nend", "def f(n)\n sum = (\"1\"*n).to_i # the last number of the sequence is n 1's\n # start with single digit if possible\n sum += n if n.to_s.length == 1\n # 2 digits next\n x = 2\n puts terms_of_n_with_length_x(n,x).inspect\n puts \"got here\"\n puts n-1\n (1..(n-1)).to_a.reverse.each do |x|\n puts x\n puts eat_2s(x)\n end\n return sum\nend", "def power_powers(digit)\r\n\t#Add all n^n numbers in sequence to get answers\r\n\tanswer = (1..digit).inject {|sum, num| sum + num**num}\r\n\t#Output last 10 digits of answer\r\n\tputs answer.to_s[-10..-1]\r\nend", "def generate_number_str(number,and_flag)\n if number == 0\n \"\"\n elsif int_strings.has_key?(number)\n (number < 99) ? int_strings[number] : \"one #{int_strings[number]}\"\n elsif number < 100\n fetch_number_strings(number,10,and_flag,and_flag)\n elsif number < 1000\n fetch_number_strings(number,100,and_flag)\n elsif number < @million\n fetch_number_strings(number,1000,and_flag)\n elsif number < @billion\n fetch_number_strings(number, @million,and_flag)\n elsif number < @trillion\n fetch_number_strings(number,@billion,and_flag)\n elsif number < @quadrillion\n fetch_number_strings(number,@trillion,and_flag)\n elsif number < @quintillion\n fetch_number_strings(number,@quadrillion,and_flag)\n elsif number < @sextillion\n fetch_number_strings(number,@quintillion,and_flag)\n elsif number < @septillion\n fetch_number_strings(number,@sextillion,and_flag)\n elsif number < @octillion\n fetch_number_strings(number,@septillion,and_flag)\n elsif number < @nonillion\n fetch_number_strings(number,@octillion,and_flag)\n elsif number < @decillion\n fetch_number_strings(number,@nonillion,and_flag)\n elsif number < @undecillion\n fetch_number_strings(number,@decillion,and_flag)\n elsif number < @duodecillion\n fetch_number_strings(number,@undecillion,and_flag)\n elsif number < @tredecillion\n fetch_number_strings(number,@duodecillion,and_flag)\n elsif number < @quattuordecillion\n fetch_number_strings(number,@tredecillion,and_flag)\n elsif number < @quindecillion\n fetch_number_strings(number,@quattuordecillion,and_flag)\n elsif number < @sexdecillion\n fetch_number_strings(number,@quindecillion,and_flag)\n elsif number < @septendecillion\n fetch_number_strings(number,@sexdecillion,and_flag)\n elsif number < @octodecillion\n fetch_number_strings(number,@septendecillion,and_flag)\n elsif number < @novemdecillion\n fetch_number_strings(number,@octodecillion,and_flag)\n elsif number < @vigintillion\n fetch_number_strings(number,@novemdecillion,and_flag)\n elsif number < @centillion\n fetch_number_strings(number,@vigintillion,and_flag)\n elsif number < @centillion * 1000 #no word for this number :)\n fetch_number_strings(number,@centillion,and_flag)\n else\n puts \"Error! Could not handle this number\"\n 0\n end\n end", "def number_2_words(n)\n w2n = {\n 90 => \"ninety\",\n 80 => \"eighty\",\n 70 => \"seventy\",\n 60 => \"sixty\",\n 50 => \"fifty\",\n 40 => \"forty\",\n 30 => \"thirty\",\n 20 => \"twenty\",\n 19=>\"nineteen\",\n 18=>\"eighteen\",\n 17=>\"seventeen\", \n 16=>\"sixteen\",\n 15=>\"fifteen\",\n 14=>\"fourteen\",\n 13=>\"thirteen\", \n 12=>\"twelve\",\n 11 => \"eleven\",\n 10 => \"ten\",\n 9 => \"nine\",\n 8 => \"eight\",\n 7 => \"seven\",\n 6 => \"six\",\n 5 => \"five\",\n 4 => \"four\",\n 3 => \"three\",\n 2 => \"two\",\n 1 => \"one\",\n 0 =>''\n }\n return w2n[n.to_i] if n.to_i < 20\n return w2n[(n[0]+'0').to_i] + w2n[n[-1].to_i] if n.to_i<100\n return w2n[n[0].to_i] + 'hundred' + (n[1..-1].to_i > 0 ? \"and\" : \"\") + number_2_words(n[1..-1]) if n.to_i<1000\n return 'onethousand'\nend", "def primes(n) \n max = Math::sqrt(n).truncate\n (2..max).each {|val|\n if n % val == 0 then\n p val\n primes(n/val)\n return\n elsif val == max then\n p n\n return\n end\n }\nend", "def print_all_primes(num)\n for i in (2..num)\n is_status = is_prime(i)\n if(is_status)\n puts i\n end\n end\nend", "def many_results(n)\r\n\treturn 1, n /2, n\r\nend", "def number_to_english(n)\n\n numbers_to_name = {\n 1000 => \"thousand\",\n 100 => \"hundred\",\n 90 => \"ninety\",\n 80 => \"eighty\",\n 70 => \"seventy\",\n 60 => \"sixty\",\n 50 => \"fifty\",\n 40 => \"forty\",\n 30 => \"thirty\",\n 20 => \"twenty\",\n 19=>\"nineteen\",\n 18=>\"eighteen\",\n 17=>\"seventeen\",\n 16=>\"sixteen\",\n 15=>\"fifteen\",\n 14=>\"fourteen\",\n 13=>\"thirteen\",\n 12=>\"twelve\",\n 11 => \"eleven\",\n 10 => \"ten\",\n 9 => \"nine\",\n 8 => \"eight\",\n 7 => \"seven\",\n 6 => \"six\",\n 5 => \"five\",\n 4 => \"four\",\n 3 => \"three\",\n 2 => \"two\",\n 1 => \"one\",\n 0 => \"zero\"\n }\n\n\n str = \"\"\n numbers_to_name.each do |num, name|\n\n if n == 0\n return str\n\n elsif n > 99999\n return str\n\n elsif n.to_s.length == 1 && n/num > 0\n return \"#{name}\"\n\n elsif n < 100 && n/num > 0\n\n return \"#{name}\" if n%num == 0\n return \"#{name} \" + number_to_english(n%num)\n\n elsif n/num > 0\n return number_to_english(n/num) + \" #{name} \" + number_to_english(n%num)\n\n end\n\n end\nend", "def range(input); end", "def num(num1, num2)\n (num1..num2).each do |i|\n puts i if i.even?\n end\nend", "def numbers\n %w[1 2 3 4 5 6 7 8 9 0\n tenth ninth eighth seventh sixth fifth fourth third second first\n ten nine eight seven six five four three two one ]\n end", "def print_even\n (1..99).each do |num|\n if num.even?\n puts num\n end\n end\nend", "def rounds_of_look_and_see(rounds, num)\n input = num\n (1..rounds).each do |round|\n input = look_and_see(input)\n puts input\n end\n input\nend", "def number_range(num)\n if num < 0\n puts \"Please enter a positive number only\"\n elsif num <= 50\n puts \"Range 0 - 50\"\n elsif num <= 100\n puts \"Range 51 - 100\"\n else\n puts \"Above 100\"\n end\nend", "def SuFiBu(first, last)\n for i in first..last\n output = String.new\n printnum = true\n if i % 7 == 0\n output += \"Super\"\n printnum = false\n end\n if i % 3 == 0\n output += \"Fizz\"\n printnum = false\n end\n if i % 5 == 0\n output += \"Buzz\"\n printnum = false\n end\n if printnum == true\n puts \"#{i}\"\n else\n puts output\n end\n i += 1\n end\nend", "def get_num()\n\tp \"Give us a number, precious. But make it between 0 and 100\"\n\tnum = gets.chomp.to_i\n\tcase num\n\twhen 0..50\n\t\tputs \"the number is between 0 and 50!!\"\n\twhen 51..100\n\t\tputs \"the number is between 51 and 100!!\"\n\telse\n\t\tputs \"filthy hobbitses!! a number between 0 and 100, precious, that's what we said.\"\n\t\tget_num()\n\tend\nend", "def to_hundreds(num)\n\tin_words = \"\"\n\tnum_to_words = Hash.new(0)\n\tnum_to_words = { 1=>\"One\",2=>\"Two\",3=>\"Three\",4=>\"Four\",5=>\"Five\",6=>\"Six\",7=>\"Seven\",8=>\"Eight\",9=>\"Nine\",10=>\"Ten\",11=>\"Eleven\",12=>\"Twelve\",13=>\"Thirteen\",14=>\"Fourteen\",15=>\"Fifteen\",16=>\"Sixteen\",17=>\"Seventeen\",18=>\"Eighteen\",19=>\"Nineteen\",20=>\"Twenty\",30=>\"Thirty\",40=>\"Fourty\",50=>\"Fifty\",60=>\"Sixty\",70=>\"Seventy\",80=>\"Eighty\",90=>\"Ninety\" }\n\n\tif num / 100 > 0\n\t\tin_words = num_to_words[num / 100] + \" Hundred \"\n\n\t\tif num % 10 != 0\n\t\t\tin_words = in_words + \"and \"\n\t\tend\n\t\tnum = num % 100\n\tend\n\n\tif num / 10 > 0\n\t\tif num / 10 == 1\n\t\t\tin_words = in_words + num_to_words[num] + \" \"\n\t\telsif num % 10 == 0\n\t\t\tin_words = in_words + num_to_words[num]\n\t\telse\n\t\t\tin_words = in_words + num_to_words[num / 10*10] + \" \" + num_to_words[num % 10]\n\t\tend\n\telsif num == 0\n\t\tin_words\n\telse \n\t\tin_words = in_words + num_to_words[num]\n\tend\n\n\tin_words\nend", "def print_factors(number)\n current_number = 1\n while current_number <= number\n puts current_number if is_factor_of(number, current_number)\n current_number += 1\n end\n end", "def primes1000\n\treturn [2, 3, 5, 7, 11, 13, 17, 19, 23, 29,\n\t31, 37, 41, 43, 47, 53, 59, 61, 67, 71,\n\t73, 79, 83, 89, 97, 101, 103, 107, 109, 113,\n\t127, 131, 137, 139, 149, 151, 157, 163, 167, 173,\n\t179, 181, 191, 193, 197, 199, 211, 223, 227, 229,\n\t233, 239, 241, 251, 257, 263, 269, 271, 277, 281,\n\t283, 293, 307, 311, 313, 317, 331, 337, 347, 349,\n\t353, 359, 367, 373, 379, 383, 389, 397, 401, 409,\n\t419, 421, 431, 433, 439, 443, 449, 457, 461, 463,\n\t467, 479, 487, 491, 499, 503, 509, 521, 523, 541,\n\t547, 557, 563, 569, 571, 577, 587, 593, 599, 601,\n\t607, 613, 617, 619, 631, 641, 643, 647, 653, 659,\n\t661, 673, 677, 683, 691, 701, 709, 719, 727, 733,\n\t739, 743, 751, 757, 761, 769, 773, 787, 797, 809,\n\t811, 821, 823, 827, 829, 839, 853, 857, 859, 863,\n\t877, 881, 883, 887, 907, 911, 919, 929, 937, 941,\n\t947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013,\n\t1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069,\n\t1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151,\n\t1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223,\n\t1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291,\n\t1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373,\n\t1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451,\n\t1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511,\n\t1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583,\n\t1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657,\n\t1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733,\n\t1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811,\n\t1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889,\n\t1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987,\n\t1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053,\n\t2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129,\n\t2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213,\n\t2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287,\n\t2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357,\n\t2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423,\n\t2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531,\n\t2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617,\n\t2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687,\n\t2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741,\n\t2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819,\n\t2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903,\n\t2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999,\n\t3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079,\n\t3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181,\n\t3187, 3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257,\n\t3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331,\n\t3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413,\n\t3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511,\n\t3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571,\n\t3581, 3583, 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643,\n\t3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709, 3719, 3727,\n\t3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, 3821,\n\t3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907,\n\t3911, 3917, 3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989,\n\t4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057,\n\t4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139,\n\t4153, 4157, 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231,\n\t4241, 4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297,\n\t4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409,\n\t4421, 4423, 4441, 4447, 4451, 4457, 4463, 4481, 4483, 4493,\n\t4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583,\n\t4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657,\n\t4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751,\n\t4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817, 4831,\n\t4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, 4937,\n\t4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003,\n\t5009, 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087,\n\t5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179,\n\t5189, 5197, 5209, 5227, 5231, 5233, 5237, 5261, 5273, 5279,\n\t5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351, 5381, 5387,\n\t5393, 5399, 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443,\n\t5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521,\n\t5527, 5531, 5557, 5563, 5569, 5573, 5581, 5591, 5623, 5639,\n\t5641, 5647, 5651, 5653, 5657, 5659, 5669, 5683, 5689, 5693,\n\t5701, 5711, 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791,\n\t5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851, 5857,\n\t5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939,\n\t5953, 5981, 5987, 6007, 6011, 6029, 6037, 6043, 6047, 6053,\n\t6067, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133,\n\t6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211, 6217, 6221,\n\t6229, 6247, 6257, 6263, 6269, 6271, 6277, 6287, 6299, 6301,\n\t6311, 6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361, 6367,\n\t6373, 6379, 6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473,\n\t6481, 6491, 6521, 6529, 6547, 6551, 6553, 6563, 6569, 6571,\n\t6577, 6581, 6599, 6607, 6619, 6637, 6653, 6659, 6661, 6673,\n\t6679, 6689, 6691, 6701, 6703, 6709, 6719, 6733, 6737, 6761,\n\t6763, 6779, 6781, 6791, 6793, 6803, 6823, 6827, 6829, 6833,\n\t6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 6911, 6917,\n\t6947, 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997,\n\t7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103,\n\t7109, 7121, 7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207,\n\t7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253, 7283, 7297,\n\t7307, 7309, 7321, 7331, 7333, 7349, 7351, 7369, 7393, 7411,\n\t7417, 7433, 7451, 7457, 7459, 7477, 7481, 7487, 7489, 7499,\n\t7507, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561,\n\t7573, 7577, 7583, 7589, 7591, 7603, 7607, 7621, 7639, 7643,\n\t7649, 7669, 7673, 7681, 7687, 7691, 7699, 7703, 7717, 7723,\n\t7727, 7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829,\n\t7841, 7853, 7867, 7873, 7877, 7879, 7883, 7901, 7907, 7919]\nend" ]
[ "0.6946657", "0.68157715", "0.67884487", "0.6643968", "0.6518978", "0.6513654", "0.6449722", "0.64270234", "0.6419027", "0.6355781", "0.6355781", "0.62414896", "0.6239319", "0.62268406", "0.62095827", "0.6120726", "0.6095927", "0.6094953", "0.6056794", "0.605005", "0.6037683", "0.60238814", "0.600938", "0.60025465", "0.597481", "0.5949487", "0.59476155", "0.59347975", "0.59206367", "0.5920291", "0.59019876", "0.58798933", "0.5875372", "0.58656836", "0.58605057", "0.58508337", "0.5843086", "0.58359957", "0.5818107", "0.5814437", "0.5813844", "0.58095914", "0.58095914", "0.58095914", "0.5801016", "0.5795715", "0.57916284", "0.57857966", "0.5776945", "0.5763643", "0.575922", "0.5753937", "0.57507807", "0.57444453", "0.5738334", "0.57382303", "0.5735511", "0.5735511", "0.57295346", "0.572698", "0.57225883", "0.5719644", "0.57195216", "0.5716561", "0.5715227", "0.57008415", "0.5696308", "0.5691", "0.56904995", "0.5690216", "0.56895775", "0.5687805", "0.5687262", "0.5684878", "0.56800014", "0.56645775", "0.566116", "0.5659881", "0.5655727", "0.56556433", "0.5646266", "0.56461024", "0.563415", "0.5629663", "0.5629488", "0.56281924", "0.5627277", "0.56269354", "0.562296", "0.5617068", "0.56149614", "0.5606156", "0.5603332", "0.5602676", "0.56016344", "0.5599465", "0.5597083", "0.55958617", "0.5595643", "0.5593071", "0.55929875" ]
0.0
-1
drag_to() will make it so you can dragndrop the source_widget onto the target widget. You may pass a reference to a widget object, or a String that gives the name of the widget on your glade form. So, it functions the same as this statement: widget_source.drag_to(widget_target) It also functions the same as this statement:
def set_drag_drop(hash) hash.each do |key,val| src = key.is_a?(Gtk::Widget) ? key : @builder[key] target = @builder[val] src.extend(VR::Draggable) unless src.is_a?(VR::Draggable) src.add_target_widget(target) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drag_and_drop(source, target, device: T.unsafe(nil)); end", "def drag_to(target)\n raise Gridium::InvalidTypeError, \"source element selector must be ':css'\" unless self.by == :css\n raise Gridium::InvalidTypeError, \"target element selector must be ':css'\" unless target.by == :css\n\n Log.debug(\"[GRIDIUM::Element] Dragging (#{self}) to (#{target})\")\n ElementExtensions.drag_to(self, target)\n end", "def drag_and_drop(source, sourceinfo, target, targetinfo, action)\n $marathon.dragAndDrop(ComponentId.new(source, sourceinfo), ComponentId.new(target, targetinfo), action)\nend", "def drag_and_drop(source, sourceinfo, target, targetinfo, action)\n $marathon.dragAndDrop(ComponentId.new(source, sourceinfo), ComponentId.new(target, targetinfo), action)\nend", "def drag_and_drop_by(source, right_by, down_by, device: T.unsafe(nil)); end", "def drag_and_drop_to_object locator_of_object_to_be_dragged, locator_of_drag_destination_object\r\n command 'dragAndDropToObject', locator_of_object_to_be_dragged, locator_of_drag_destination_object\r\n end", "def drag_drop(start_x, start_y, end_x, end_y)\n @java_obj.dragDrop(\n org.sikuli.script::Location.new(start_x, start_y).offset(x(), y()),\n org.sikuli.script::Location.new(end_x, end_y).offset(x(), y()),\n 0\n )\n end", "def drag_mouse_to arg, opts = {}\n move_mouse_to opts[:from] if opts[:from]\n Mouse.drag_to arg.to_point, (opts[:duration] || 0.2)\n sleep(opts[:wait] || 0.2)\n end", "def sash_dragto(index, x, y)\n execute_only(:sash, :dragto, index, x, y)\n end", "def drag_and_drop_js(source, target)\n jquery = Rails.root.join('spec/js_helpers/jquery-3.3.1.min.js').read\n dnd = Rails.root.join('spec/js_helpers/drag_and_drop_helper.js').read\n\n Capybara.current_session.driver.browser.execute_script(jquery)\n Capybara.current_session.driver.browser.execute_script(dnd)\n Capybara.current_session.driver.browser.execute_script(\"$('#{source}').simulateDragDrop({ dropTarget: '#{target}'});\")\n end", "def drag_and_drop(source_element_, target_element)\n $LOG.info \"draging and droping the element Source : #{source_element_} and Target : #{target_element}\"\n begin\n wait_and_find_element(source_element_)\n wait_and_find_element(target_element)\n element = el(source_element_)\n target = el(target_element)\n $driver.action.drag_and_drop(element, target).perform\n rescue Exception => e\n $LOG.error \"Error in drag and drop \\n source element :: #{source_element_} \\n target element #{target_element}\"\n $LOG.error \"Error Message :: \" +e.message\n $driver.save_screenshot(\"log/webscreenshot/webScreenshot_#{$webscreenshot}.png\")\n $webscreenshot = $webscreenshot+1\n raise \"Error in drag and drop \\n source element :: #{source_element_} \\n target element #{target_element} \\n \" + e.message\n end\n end", "def drop_add(id,x, y, source)\n pare = source == current_vc.ui ? current_vc.pane : source.child\n dnd_obj = @dnd_ids[id]\n obj = dnd_obj.new # create the object that we are dragging on\n if @dnd_opts[dnd_obj]\n # TODO: check for other options\n obj.name = @dnd_opts[dnd_obj][:assign_name] if obj.respond_to? :name=\n end\n dcrl = add_designable_control(obj, MousePoint.new(x, y), pare, @dnd_ids[id])\n if @dnd_opts[dnd_obj] && SD::DesignerSupport::Preferences.add_labels\n dcrl.decor_manager.add(Java::dashfx.lib.decorators.LabelDecorator.java_class).label = \"#{File.basename(@dnd_opts[dnd_obj][:assign_name])}: \"\n end\n hide_toolbox\n @clickoff_fnc.call if @clickoff_fnc\n @on_mouse.call(nil) if @on_mouse\n end", "def drag_and_drop_by(source, offset = {})\n element = find_element(source)\n x = offset.fetch(:x, 0)\n y = offset.fetch(:y, 0)\n\n action.drag_and_drop_by(element, x, y).perform\n end", "def drag(*options)\n compatible_call :drag, *options\n end", "def drag_drop(event)\n db = event.dragboard\n event.setDropCompleted(\n if db.hasString\n if db.string.start_with? \"AutoAdd:\"\n id = db.string[8..-1] #strip prefix\n # get the type that we are dealing with so we can filter for it\n typeo = @data_core.getObservable(id)\n #open a popup and populate it\n tbx_popup = SD::DesignerSupport::ToolboxPopup.new # TODO: cache these items so we don't have to reparse fxml\n find_toolbox_parts.each do |key, data|\n data.each do |i|\n next unless i.can_display? typeo.type, typeo.group_name\n ti = SD::DesignerSupport::ToolboxItem.new(i, method(:associate_dnd_id), :assign_name => id)\n ti.set_on_mouse_clicked do\n drop_add associate_dnd_id(i, :assign_name => id), event.x, event.y, event.source\n @on_mouse.call if @on_mouse # hide it\n end\n tbx_popup.add ti, key\n end\n end\n # position the popup at the location of the mouse\n tbx_popup.x = event.screen_x\n tbx_popup.y = event.screen_y\n # when we click other places, hide the toolbox\n register_clickoff do\n tbx_popup.hide\n end\n tbx_popup.show @stage\n SD::DesignerSupport::Overlay.preparse_new(1)\n else\n drop_add(db.string.to_i, event.x, event.y, event.source)\n end\n true\n else\n false\n end)\n\n event.consume()\n end", "def dragging(button, x, y)\n# puts \"DRAGGING!\"\n @x = x\n @y = y\n end", "def drag(componentName, o1, o2, o3, o4, o5 = nil, o6 = nil)\n $marathon.drag(componentName, o1, o2, o3, o4, o5, o6)\nend", "def drag(componentName, o1, o2, o3, o4, o5 = nil, o6 = nil)\n $marathon.drag(componentName, o1, o2, o3, o4, o5, o6)\nend", "def drag_and_drop locator, movements_string\r\n command 'dragAndDrop', locator, movements_string\r\n end", "def scan_dragto(x)\n execute_only(:scan, :dragto, x)\n end", "def XOdragAndDrop(tag, tvalue, right_by, down_by)\n\n\t\turl= @wwBrws.url.to_s\n\t\t$pfd.tstart(url)\n\t\tbegin\n\t\t\tel= @wwBrws.element(tag, tvalue)\n\t\t\tel.drag_and_drop_by( right_by, down_by)\n\t\t\t$pfd.calcApplRes(true, 'Drag and drop '+par1+' by '+right_by.to_s+'/'+down_by.to_s, url)\n\t\t\tsleep TIMETICK\t\t\t\t\t\t\t\t\t\t\t\t\t\t# small sleep to let objects appear\n\t\t\tres= OK\n\t\trescue\n\t\t\tmsg='DragAndDrop failed. Values: /'+tag.to_s+'/'+tvalue+'/ '+$!.to_s\n\t\t\tres= setResCritical( msg)\n\t\tend\n\t\treturnRes (res )\n\tend", "def start_drag(button, x, y)\n# puts \"START DRAGGING!\"\n end", "def drag obj\n require 'dragger'\n d = Dragger.new(obj, canvas)\n d.enable!\nend", "def set_drag_drop\n @drag_drop = DragDrop.find(params[:id])\n end", "def dragon; end", "def dragon; end", "def dragon; end", "def mouseDragged event\n end", "def dragged\n $dz.determinate(true)\n \n move = true\n \n if ENV['OPERATION'] == \"NSDragOperationCopy\"\n operation = \"Copying\"\n move = false\n else\n operation = \"Moving\"\n end\n \n $dz.begin(\"#{operation} files...\")\n\n Rsync.do_copy($items, ENV['EXTRA_PATH'], move)\n \n finish_op = (move ? \"Move\" : \"Copy\")\n $dz.finish(\"#{finish_op} Complete\")\n $dz.url(false)\nend", "def dragStart(dndArea)\n dragStartData(dndArea.dndarea_dndData)\n end", "def prepareForDragOperation(sender)\n # NSLog(@\"prepareForDragOperation\");\n return true\n end", "def drag?(button); false; end", "def move_task(initial, target)\n initial_x = initial.wd.location['x']\n initial_y = initial.wd.location['y']\n\n target_x = target.wd.location['x']\n target_y = target.wd.location['y']\n\n total_x = target_x - initial_x + 5\n total_y = target_y - initial_y + 5\n\n initial.when_present.drag_and_drop_by(total_x, total_y)\n sleep 1 #Allow for motion to happen\n end", "def dragEnterEvent(ev); end", "def move_with_drag(tab_target)\n raise(Exceptions::UnknownObjectException) unless tab_target.type == :tabbutton\n drag_and_drop_on(tab_target, :center)\n \n sleep(0.1)\n end", "def draggingEnded(sender)\n puts \"draggingEnded\" if DEBUG\n end", "def set_drag\n @drag = Drag.find(params[:id])\n end", "def itemStartDrag(c,x,y)\n $lastX = c.canvasx(x)\n $lastY = c.canvasy(y)\nend", "def fake_drop(from,to)\n to = to.gsub(/#/,\"\")\n from = from.gsub(/#/,\"\")\n script = <<-EOF\n var drop = Droppables.drops.find( function (e) { if (e.element.id == '#{to.gsub(/#/,\"\")}') return true; });\n if (drop) {\n drop.onDrop($('#{from}'));\n }\n EOF\n page.execute_script(script)\nend", "def migrate_document(document, dest)\n index = index_of_document(document)\n return if index.nil? or not dest.is_a? Notebook\n\n drag_stop\n Gtk::grab_remove(self)\n remove_document(document)\n\n dest.instance_eval do\n add_document(document)\n drag_start\n @drag_info.document = document\n @drag_info.motion_handler = signal_connect('motion-notify-event') do\n |widget, event|\n motion_notify_cb(event)\n end\n end\n end", "def init_drag(target=self)\n @dragging = false\n @drag_target = target\n \n on :mousedown do |e|\n drag_start e \n \n # have the body listen for `mouseup` to stop dragging\n @mouse_up_cb = $document.body.on :mouseup do |e|\n drag_stop\n end \n \n # have the body listen for `mousemove`\n @mouse_move_cb = $document.body.on :mousemove do |evt| \n next unless @dragging\n \n evt = evt || window.event;\n\n x = evt.client.x.to_i \n y = evt.client.y.to_i \n\n nx = x - @dragging[:diff_x] \n ny = y - @dragging[:diff_y]\n\n do_drag(nx,ny); \n end \n end\n \n return self\n end", "def setup_drag_remote\n Gtk::Drag.source_set(@iconview_remote,\n Gdk::Window::BUTTON1_MASK | Gdk::Window::BUTTON2_MASK,\n [DOWNLOAD_TARGET_TABLE],\n Gdk::DragContext::ACTION_COPY | Gdk::DragContext::ACTION_MOVE)\n\n @iconview_remote.signal_connect(\"drag_data_get\") do |widget, context, selection_data, info, time|\n files = selected_fs(@iconview_remote).map do |file| file.to_s end\n unless files.empty?\n selection_data.set(Gdk::Selection::TYPE_STRING, files.join(','))\n end\n end\n end", "def destination(dest); end", "def destination(dest); end", "def make_draggable(options={})\n draggable_element_js(javascript_variable('this'), options)\n end", "def onLButtonUp(flags, x, y, view)\n # If we are doing a drag, then create the line on the mouse up event\n if( @dragging && @ip2.valid? )\n self.create_geometry(@ip1.position, @ip2.position,view)\n self.reset(view)\n end\nend", "def start_dragging(start_position)\n @dragging = true\n @start_position = start_position\n end", "def dragged\n destination = \"#{ENV['EXTRA_PATH']}\"\n\n $dz.determinate(false)\n $dz.begin(\"Creating new text file...\")\n\n output = `./CocoaDialog standard-inputbox --title \"Save Text\" --e --informative-text \"Enter name for new text file (minus extension):\"`\n button, filename = output.split(\"\\n\")\n\n if button == \"2\"\n $dz.finish(\"Cancelled\")\n $dz.url(false)\n return\n end\n \n if filename == nil\n $dz.finish(\"Invalid Filename\")\n $dz.url(false)\n return\n end\n\n # Create a new file and write to it \n File.open(\"#{destination}/#{filename}.txt\", 'w') do |f| \n f.puts $items[0]\n end\n\n system(\"open \\\"#{destination}/#{filename}.txt\\\"\")\n\n $dz.finish(\"Text Saved\")\n $dz.url(false)\nend", "def setup_drag_local\n Gtk::Drag.source_set(@iconview_local,\n Gdk::Window::BUTTON1_MASK | Gdk::Window::BUTTON2_MASK,\n [UPLOAD_TARGET_TABLE],\n Gdk::DragContext::ACTION_COPY | Gdk::DragContext::ACTION_MOVE)\n\n @iconview_local.signal_connect(\"drag_data_get\") do |widget, context, selection_data, info, time|\n files = selected_fs(@iconview_local).map do |file| file.to_s end\n unless files.empty?\n selection_data.set(Gdk::Selection::TYPE_STRING, files.join(','))\n end\n end\n end", "def Pager_GetDropTarget(hwnd, ppdt) send_pager_message(hwnd, :GETDROPTARGET, lparam: ppdt) end", "def generate_url\n Dropio::Resource.client.generate_drop_url(self)\n end", "def moving_ndt_to_ndt(source, target)\n target_parent_id = target['data-parent-id']\n source_id = source['id']\n before_move_source_parent_id = source['data-parent-id']\n source_sibling_count = get_children_count(before_move_source_parent_id)\n target_sibling_count = get_children_count(target_parent_id)\n\n if source['data-parent-id'] == target_parent_id\n target_sibling_count -= 1\n source_sibling_count += 1\n end\n\n drag_drop_agenda_item(source, target)\n source = find_by_id(source_id)\n after_move_target_sibling_count = get_children_count(target_parent_id)\n after_move_source_prev_parent_children_count = get_children_count(before_move_source_parent_id)\n\n\n expect(target_parent_id).to eq(source['data-parent-id'])\n expect(after_move_target_sibling_count).to be > target_sibling_count\n expect(after_move_source_prev_parent_children_count).to be < source_sibling_count\n end", "def concludeDragOperation(sender)\n puts \"concludeDragOperation\" if DEBUG\n end", "def draggingEntered(sender)\n puts \"draggingEntered\" if DEBUG\n return true\n end", "def dragged\n $dz.determinate(false)\n $dz.begin(\"Getting is.gd URL\")\n\n if $items[0] =~ /http/\n url = IsGd.minify($items[0])\n $dz.finish(\"URL is now on clipboard\")\n $dz.url(url)\n else\n $dz.finish(\"Invalid URL\")\n $dz.url(false)\n end\nend", "def do_move_description(src, dest, delete_after)\n src_name = src.unique_partial_format_name\n src_title = src.format_name\n\n # Just transfer the description over.\n if delete_after\n make_dest_default = dest.description_id.nil? && src_was_default\n if src.parent.description_id == src.id\n src.parent.description_id = nil\n src.parent.save\n src.parent.log(:log_changed_default_description, :user => @user.login,\n :name => :none, :touch => true)\n end\n src.parent = dest\n src.save\n Transaction.send(\"put_#{src.type_tag}\", :parent => dest)\n src.parent.log(:log_object_moved_by_user, :user => @user.login,\n :from => src_name, :to => dest.unique_format_name,\n :touch => true)\n if make_dest_default && src.public\n dest.description_id = src\n dest.save\n dest.log(:log_changed_default_description, :user => @user.login,\n :name => src.unique_partial_format_name, :touch => true)\n end\n flash_notice(:runtime_description_move_success.\n t(:old => src_title, :new => dest.format_name))\n redirect_to(:action => src.show_action, :id => src.id,\n :params => query_params)\n\n # Create a clone in the destination name/location.\n else\n desc = src.class.new(\n :parent => dest,\n :source_type => src.source_type,\n :source_name => src.source_name,\n :project_id => src.project_id,\n :locale => src.locale,\n :public => src.public,\n :license => src.license,\n :all_notes => src.all_notes\n )\n\n # I think a reviewer should be required to pass off on this before it\n # gets shared with reputable sources. Synonymy is never a clean science.\n # if dest.is_a?(Name)\n # desc.review_status = src.review_status\n # desc.last_review = src.last_review\n # desc.reviewer_id = src.reviewer_id\n # desc.ok_for_export = src.ok_for_export\n # end\n\n # This can really gum up the works and it's really hard to figure out\n # what the problem is when it occurs, since the error message is cryptic.\n if dest.is_a?(Name) && !desc.classification.blank?\n begin\n Name.validate_classification(dest.rank, desc.classification)\n rescue => e\n flash_error(:runtime_description_move_invalid_classification.t)\n flash_error(e.to_s)\n desc.classification = ''\n end\n end\n\n # Okay, *now* we can try to save the new description...\n if !desc.save\n flash_object_errors(desc)\n else\n Transaction.send(\"post_#{src.type_tag}\", {\n :id => desc,\n :parent => desc,\n :source_type => desc.source_type,\n :source_name => desc.source_name,\n :project => desc.project,\n :locale => desc.locale,\n :public => desc.public,\n :license => desc.license,\n }.merge(desc.all_notes))\n dest.log(:log_description_created_at, :user => @user.login,\n :name => desc.unique_partial_format_name, :touch => true)\n flash_notice(:runtime_description_copy_success.\n t(:old => src_title, :new => desc.format_name))\n redirect_to(:action => desc.show_action, :id => desc.id,\n :params => query_params)\n end\n end\n end", "def performDragOperation(sender)\n # NSLog(@\"performDragOperation\");\n puts \"performDragOperation\" if DEBUG\n \n #NSPasteboard *pboard = [sender draggingPasteboard];\n pboard = sender.draggingPasteboard\n \n #if pboard.types.contains? NSFilenamesPboardType\n files = pboard.propertyListForType NSFilenamesPboardType\n filename = \"\"\n files.each do |file|\n filename = file.description\n puts \"filename: #{filename}\" if DEBUG\n @filenames << filename\n end\n #end\n\t\n return true\n end", "def copy_node!(source)\n child! source.node_type, source.attributes.merge({ __location: source })\n if source.has_schema?\n current.instance_variable_set(:@schema, source.instance_variable_get(:@schema))\n end\n end", "def copy(target_name)\n @ui.logger.debug { \"Container Copy: #{self.id}\" }\n\n target_name.nil? and raise ContainerError, \"You must supply a destination container!\"\n\n target_container = self.node.containers.select{ |c| c.id.to_sym == target_name.to_sym }.first\n target_container.nil? and raise ContainerError, \"We could not locate the target container!\"\n\n source_state = self.state\n target_state = target_container.state\n\n target_container.demolish\n target_container.create\n\n self.down\n please_wait(:ui => @ui, :message => format_object_action(self, 'Copy', :yellow)) do\n self.node.exec(%(sudo rm -rf #{target_container.lxc.fs_root}))\n self.node.exec(%(sudo rsync -a #{self.lxc.fs_root} #{target_container.lxc.container_root}))\n self.node.exec(%(sudo rm -fv #{File.join(self.lxc.fs_root, '.*provision')}))\n end\n\n # bring the source container back online if it was running before the copy operation\n (source_state == :running) and self.up\n\n # bring the target container back online if it was running before the copy operation\n (target_state == :running) and target_container.up\n\n true\n end", "def clone(widget)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'widget', widget);\n\t\t\tclient.queue_service_action_call('widget', 'clone', 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 iiif_drag_n_drop(manifest, width: '40', position: 'left')\n link_url = format Settings.IIIF_DND_BASE_URL, query: { manifest: }.to_query\n link_to(\n link_url,\n class: 'iiif-dnd pull-right',\n data: { turbolinks: false, toggle: 'tooltip', placement: position, manifest: },\n title: 'Drag icon to any IIIF viewer. — Click icon to learn more.'\n ) do\n image_tag 'iiif-drag-n-drop.svg', width:, alt: 'IIIF Drag-n-drop'\n end\n end", "def copy_to(node_id:, target_node_id:, insert_before_node_id: nil)\n {\n method: \"DOM.copyTo\",\n params: { nodeId: node_id, targetNodeId: target_node_id, insertBeforeNodeId: insert_before_node_id }.compact\n }\n end", "def widget\n end", "def widget\n end", "def dest\n param(0)\n end", "def widget(target, assigns = {}, options = {}, &block)\n assigns.merge!(:component => @component) {|_,old,_| old } if target.is_a? Class\n super target, assigns, options, &block\n end", "def copy_to(other); end", "def get_draggable_script( draggable_dom_id )\n text = <<-END_SRC\n new Draggable('#{draggable_dom_id}', { revert: 'failure', scroll: window });\n END_SRC\n text\n end", "def make_drop_recieving(options={})\n drop_recieving_element_js(javascript_variable('this'), options)\n end", "def dragged\n search($items[0])\nend", "def drag_element_to(xpath_element_origin, x_fate, y_fate, duration = nil)\r\n\r\n result = false\r\n mobile_element_source = get_mobile_element xpath_element_origin\r\n\r\n duration_time = duration.nil? ? 500 : duration\r\n xm1 = nil\r\n ym1 = nil\r\n xm2 = x_fate\r\n ym2 = y_fate\r\n\r\n if mobile_element_source.nil? or mobile_element_source.to_s.empty?\r\n raise \"Element sourse Not Found. XPATH => ''#{xpath_element_origin}''\"\r\n end\r\n\r\n begin\r\n\r\n fb_1 = get_bounds_from_element(mobile_element_source) do |x1, y1, x2, y2|\r\n xm1 = (x1 + x2) >> 1\r\n ym1 = (y1 + y2) >> 1\r\n #puts(\"shell input swipe #{xm1} #{ym1} #{xm2} #{ym2} #{duration_time}\")\r\n adb_exec(\"shell input swipe #{xm1} #{ym1} #{xm2} #{ym2} #{duration_time}\")\r\n end\r\n\r\n result = !fb_1.nil?\r\n\r\n unless result\r\n raise \"drag_element_to => Fail => no fue posible hacer scroll down => '#{xpath_element_origin}'.\"\r\n end\r\n\r\n return result\r\n\r\n rescue Exception => e\r\n raise \"drag_element_to_element => EXCEPTION => #{e.message}\"\r\n\r\n end\r\n\r\nend", "def draggable(renderer, event_handler_registry, handle_w, handle_h, region_rect, ui_state, &on_change)\n handle_x = ui_state[:handle_x] || 0\n handle_y = ui_state[:handle_y] || 0\n if !(ui_state[:pressed])\n evh = { type: :mouse_down, rect: Rect.new(handle_x, handle_y, handle_w, handle_h), callback: proc { |_ev|\n if !(ui_state[:pressed])\n ui_state[:pressed] = true\n yield(ui_state) if on_change\n true\n else\n false\n end\n } }\n event_handler_registry.register_event_handler(evh)\n else\n evh2 = { type: :mouse_move, callback: proc { |ev|\n if ui_state[:pressed] == true\n new_handle_x = (ui_state[:handle_x] || 0) + ev.xrel\n new_handle_x = region_rect.x if new_handle_x < region_rect.x\n new_handle_x = region_rect.x2 if new_handle_x > region_rect.x2\n\n new_handle_y = (ui_state[:handle_y] || 0) + ev.yrel\n new_handle_y = region_rect.y if new_handle_y < region_rect.y\n new_handle_y = region_rect.y2 if new_handle_y > region_rect.y2\n\n ui_state[:handle_x] = new_handle_x\n ui_state[:handle_y] = new_handle_y\n\n yield(ui_state) if on_change\n true\n else\n false\n end\n } }\n\n evh1 = { type: :mouse_up, callback: proc { |_ev|\n if ui_state[:pressed] == true\n ui_state[:pressed] = false\n yield(ui_state) if on_change\n true\n else\n false\n end\n } }\n\n event_handler_registry.register_event_handler(evh1)\n event_handler_registry.register_event_handler(evh2)\n end\nend", "def TreeView_SelectDropTarget(hwnd, hitem) TreeView_Select(hwnd, hitem, TreeViewGetNextItem[:DROPHILITE]) end", "def dest; end", "def mouse_dragged(x, y)\n window_point = Geo3d::Vector.new(x,y)\n\n @sphere_point_when[:mouse_draged] = window_to_sphere_space(window_point)\n end", "def dragged\n $items.each {|item| `lp \\\"#{item}\\\" >& /dev/null &`}\n $dz.finish(\"Printing...\")\n $dz.url(false)\nend", "def create\n @drag_drop = DragDrop.new(drag_drop_params)\n\n respond_to do |format|\n if @drag_drop.save\n format.html { redirect_to @drag_drop, notice: 'Drag drop was successfully created.' }\n format.json { render :show, status: :created, location: @drag_drop }\n else\n format.html { render :new }\n format.json { render json: @drag_drop.errors, status: :unprocessable_entity }\n end\n end\n end", "def copy(from, to)\n \n end", "def drag_params\n content = params[:drag].delete(:content)\n params.require(:drag).permit(:saved).tap do |whitelisted|\n whitelisted[:content] = content if content\n end\n end", "def dragged\n ENV['PATH'] = \"#{Dir.home}/.pyenv/shims:/usr/local/bin:/bin:/usr/bin\"\n IO.popen([ \"imgur-upload\" ] + $items) {|io| $dz.text(io.read)}\nend", "def move(to)\n @moved = true\n super(to)\n end", "def render_to(doc_or_widget)\n if doc_or_widget.is_a?(Widget)\n @parent = doc_or_widget\n @doc = @parent.doc\n else\n @doc = doc_or_widget\n end\n render\n end", "def drag_x(object,limit_x=nil,limit_width=nil)\\\n return false if !defined?(object.x)\n if self.leftPress?(object)\n if @object_ox.nil?\n @object_ox = @x - object.x\n end\n object.x = @x - @object_ox\n object.x = limit_x if limit_x && object.xlimit_width\n else\n @object_ox=nil\n end\n end", "def proxy_source_object\n # TODO the logic here should not be needed if derived with polymorphism. Consider removing.\n if respond_to?(:swt_widget)\n swt_widget\n elsif respond_to?(:swt_display)\n swt_display\n elsif respond_to?(:swt_image)\n swt_image\n elsif respond_to?(:swt_dialog)\n swt_dialog\n elsif respond_to?(:swt_transform)\n swt_transform\n end\n end", "def drag_xy(object,limit_x=nil,limit_y=nil,limit_width=nil,limit_height=nil)\n return false if !defined?(object.x) or !defined?(object.y)\n if self.leftPress?(object)\n if @object_ox.nil?\n @object_ox = @x - object.x\n end\n if @object_oy.nil?\n @object_oy = @y - object.y\n end\n object.x = @x - @object_ox\n object.x = limit_x if limit_x && object.xlimit_width\n object.y = @y - @object_oy\n object.y = limit_y if limit_y && object.ylimit_height\n else\n @object_ox=nil\n @object_oy=nil\n end\n end", "def add_widget widget\n @form.add_widget\n end", "def to_drop\n return unless DROPPABLES.include?(self.class.name)\n\n \"#{self.class.name}Drop\".constantize.new(self)\n end", "def to_drop\n return unless DROPPABLES.include?(self.class.name)\n\n \"#{self.class.name}Drop\".constantize.new(self)\n end", "def move(from, to)\n index = self.delete_at(from)\n self.insert(to, index)\n end", "def rsync_from(source, target, dest, port = 22, extra_flags = [])\n rsync = find_program_on_path('rsync')\n flags = \"-rHlv -O --no-perms --no-owner --no-group\"\n unless extra_flags.empty?\n flags << \" \" << extra_flags.join(\" \")\n end\n ex(\"#{rsync} -e '#{ssh_command(port)}' #{flags} #{target}:#{source} #{dest}\")\n end", "def originalsourceform; end", "def dragStart(paths)\r\n @_vr_dragpaths=paths\r\n super()\r\n end", "def select_pointer_widget(matching_pointer_widget)\n original_pointer = @builder['original_container'].children[0].matching_pointers[0]\n matched_pointer = matching_pointer_widget.matching_pointers[0]\n @matching_selection.matching_pointers[original_pointer] = matched_pointer\n goto_next\n end", "def move_description_to_another_name\n src_was_default = (@src.parent.description_id == @src.id)\n make_dest_default = @dest.description_id.nil? && src_was_default\n\n remove_parent_default_desc_and_log_it if src_was_default\n set_src_parent_to_dest_and_log_it\n\n if make_dest_default && @src.fully_public?\n make_src_the_new_default_description_for_dest_and_log_it\n end\n\n flash_notice(:runtime_description_move_success.t(old: @src.format_name,\n new: @dest.format_name))\n redirect_to(object_path_with_query(@src))\n end", "def draggables\n result = @draggables.dup\n if (not @board.nil?) and (not @board.playing?)\n result << @board.draggables\n end\n result = result.flatten\n result.compact!\n result\n end", "def create_widget\n widget_class.new(widget_assigns)\n end", "def associate_dnd_id(val, opts=nil)\n hide_toolbox # TODO: cheap hack\n @dnd_ids << val unless @dnd_ids.include?(val)\n @dnd_opts[val] = opts\n @dnd_ids.index(val)\n end", "def copy(source, destination, db: nil, replace: false)\n command = [:copy, source, destination]\n command << \"DB\" << db if db\n command << \"REPLACE\" if replace\n\n send_command(command, &Boolify)\n end", "def render_widget_from_tree(widget_id, opts={}) \n if thaw_tree? and session['apotomo_widget_tree']\n root = thaw_tree\n else\n tree = widget_tree_class.new(self)\n root = tree.draw_tree\n end\n \n target = root.find_by_path(widget_id)\n target.opts = opts unless opts.empty?\n \n content = target.render_content\n #session['apotomo_widget_tree'] = root\n \n \n freeze_tree(root)\n \n \n \n return content\n end", "def copy(src,target)\n mkdir_p target if ! File.exist?(target)\n sh 'cp ' + src + '/* ' + target\nend" ]
[ "0.70739025", "0.6911271", "0.686278", "0.68455976", "0.66368634", "0.6488718", "0.6124987", "0.5963129", "0.5856418", "0.57682616", "0.570696", "0.56288207", "0.56226796", "0.5612682", "0.5607106", "0.5577752", "0.5527587", "0.5522805", "0.55105466", "0.544645", "0.53473556", "0.53217775", "0.5272747", "0.52692026", "0.5256286", "0.5256286", "0.5256286", "0.5213827", "0.5182175", "0.51695156", "0.5139201", "0.51320785", "0.51062846", "0.50326395", "0.5007097", "0.49536884", "0.49235517", "0.48957685", "0.4894159", "0.48771468", "0.48506927", "0.48394737", "0.48251837", "0.48251837", "0.47516793", "0.47090346", "0.46708182", "0.4666924", "0.46569228", "0.46279737", "0.46190313", "0.4598244", "0.45701155", "0.45475408", "0.45434678", "0.45217103", "0.45060372", "0.44930336", "0.44708353", "0.44663846", "0.4462548", "0.44538715", "0.44305333", "0.44305333", "0.44243756", "0.44224948", "0.4398237", "0.43877095", "0.4384828", "0.43567514", "0.43543845", "0.43520036", "0.43516108", "0.43512258", "0.43416494", "0.43408567", "0.43392897", "0.43308905", "0.43171436", "0.42954907", "0.42392385", "0.42308155", "0.4226725", "0.42159185", "0.42114815", "0.42099634", "0.4209509", "0.4209509", "0.42066607", "0.42043027", "0.41917577", "0.41869152", "0.41767707", "0.4174317", "0.413021", "0.41214597", "0.41120306", "0.40900654", "0.4085995", "0.40789846" ]
0.52809024
22
This will Load the glade form according to the naming convention: MyClass.rb => MyClass.glade. It will create a Gtk::Builder object from your glade file.
def load_glade() caller__FILE__ = my_class_file_path() file_name = File.join(File.split(caller__FILE__)[0] , "glade", class_name(self) + ".glade") @builder = Gtk::Builder.new @builder << file_name @builder.connect_signals{ |handle| method(handle) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_ui(file_name)\n gtk_builder_add_from_file(@builder, file_name, FFI::MemoryPointer::NULL)\n connect_signals\n end", "def show_glade(parent = nil)\r\n load_glade()\r\n if parent then\r\n @builder[:window1].transient_for = parent.builder[:window1]\r\n end\r\n before_show() if respond_to? :before_show\r\n parse_signals()\r\n set_glade_all()\n @builder[:window1].show #show_all can't hide widgets in before_show\n @top_level_window = Gtk.main_level == 0 ? true : false\r\n Gtk.main if @top_level_window or @builder[:window1].modal? # need new Gtk.main for blocking!\r\n end", "def load(ui_file,parent=nil)\n if parent and not parent.is_a? Qt::Widget\n Kernel.raise(\"You can only set a QWidget as parent. You tried: #{parent}\")\n end\n \n file = Qt::File.new(ui_file)\n file.open(Qt::File::ReadOnly)\n\n form = nil\n Dir.chdir File.dirname(ui_file) do \n form = __getobj__.load(file,parent)\n end\n return unless form \n\n mapping = map_objectName_className(ui_file)\n extend_widgets form, mapping\n\n #check that all widgets are available \n mapping.each_key do |k|\n if !form.respond_to?(k.to_s) && form.objectName != k\n Vizkit.warn \"Widgte #{k} of class #{mapping[k]} could not be loaded! Is this Qt Designer Widget installed?\"\n end\n end\n form\n end", "def load_builder(name)\n if(builders[name.to_sym])\n require File.join(builders[name.to_sym], name)\n else\n raise NameError.new(\"Requested end point builder not found (#{name})\")\n end\n self\n end", "def init_gui\r\n pathFile = \"\"\r\n pathCreate = \"\"\r\n fixed = Gtk::Fixed.new\r\n add fixed\r\n label = Gtk::Label.new(\"Xml - File Path:\")\r\n label.set_size_request 100,30\r\n button = Gtk::FileChooserButton.new(\"Search\", Gtk::FileChooser::ACTION_OPEN)\r\n button.set_size_request 280,30\r\n filter = Gtk::FileFilter.new\r\n filter.add_pattern('*.xml')\r\n button.add_filter(filter)\r\n button.signal_connect('selection_changed') do |w|\r\n pathFile = w.filename.to_s\r\n arrayPath = pathFile.split('\\\\')\r\n pathCreate = \"\"\r\n for i in 0..arrayPath.length-2\r\n pathCreate+=arrayPath[i]+\"\\\\\"\r\n end\r\n pathCreate+=\"files\\\\\"\r\n end\r\n labelDB = Gtk::Label.new(\"Name Database:\")\r\n entryDB = Gtk::Entry.new\r\n entryDB.set_width_chars 45\r\n entryDB.set_text \"\"\r\n labelDBServer = Gtk::Label.new(\"Server Database:\")\r\n entryDBServer = Gtk::Entry.new\r\n entryDBServer.set_width_chars 45\r\n entryDBServer.set_text \"\"\r\n labelDBUser = Gtk::Label.new(\"User Database:\")\r\n entryDBUser = Gtk::Entry.new\r\n entryDBUser.set_width_chars 45\r\n entryDBUser.set_text \"\"\r\n labelDBPass = Gtk::Label.new(\"Pass Database:\")\r\n entryDBPass = Gtk::Entry.new\r\n entryDBPass.set_width_chars 45\r\n entryDBPass.visibility = false\r\n entryDBPass.invisible_char = 42\r\n labelEmail = Gtk::Label.new(\"Admin Email:\")\r\n entryEmail = Gtk::Entry.new\r\n entryEmail.set_width_chars 45\r\n entryEmail.set_text \"\"\r\n btGenerate = Gtk::Button.new \"Generate\"\r\n btGenerate.signal_connect \"clicked\" do\r\n if pathFile == \"\" or pathCreate == \"\"\r\n showMessage(\"Debe seleccionar el archivo de origen\",Gtk::MessageDialog::ERROR,self)\r\n elsif entryDB.text.strip == \"\"\r\n showMessage(\"Debe Ingresar el nombre de la base de datos\",Gtk::MessageDialog::ERROR,self)\r\n elsif entryDBServer.text.strip == \"\"\r\n showMessage(\"Debe Ingresar el servidor de la base de datos\",Gtk::MessageDialog::ERROR,self)\r\n elsif entryDBUser.text.strip == \"\"\r\n showMessage(\"Debe Ingresar el nombre de usuario de la base de datos\",Gtk::MessageDialog::ERROR,self)\r\n elsif entryEmail.text.strip == \"\"\r\n showMessage(\"Debe Ingresar el email del administrador\",Gtk::MessageDialog::ERROR,self)\r\n else\r\n readPollFileXml(pathFile,pathCreate,entryDB.text.strip, entryDBServer.text.strip,entryDBUser.text.strip,entryDBPass.text.strip,entryEmail.text.strip)\r\n showMessage(\"Se ha creado el formulario Satisfactoriamente en la ruta: \"+pathCreate,Gtk::MessageDialog::INFO,self)\r\n Gtk.main_quit\r\n end\r\n end\r\n btCancel = Gtk::Button.new \"Cancel\"\r\n btCancel.signal_connect \"clicked\" do\r\n Gtk.main_quit\r\n end\r\n fixed.put label,10,10\r\n fixed.put labelDB,15,58\r\n fixed.put labelDBServer,15,103\r\n fixed.put labelDBUser,24,148\r\n fixed.put labelDBPass,24,193\r\n fixed.put labelEmail,30,238\r\n fixed.put button,105,10\r\n fixed.put entryDB,105,55\r\n fixed.put entryDBServer,105,100\r\n fixed.put entryDBUser,105,145\r\n fixed.put entryDBPass,105,190\r\n fixed.put entryEmail,105,235\r\n fixed.put btGenerate,145,275\r\n fixed.put btCancel,205,275\r\n end", "def initialize(path_or_data, root = nil, domain = nil, localedir = nil, flag = GladeXML::FILE)\n bindtextdomain(domain, localedir, nil, \"UTF-8\")\n @glade = GladeXML.new(path_or_data, root, domain, localedir, flag) {|handler| method(handler)}\n @selected_show_id = nil\n @cbShow = @glade.get_widget(\"cbShows\")\n @txtFile = @glade.get_widget(\"txtSelectedFile\")\n @progress = @glade.get_widget(\"ctlProgress\")\n @btnOK = @glade.get_widget(\"btnOK\")\n @btnCancel = @glade.get_widget(\"btnCancel\")\n @chkShowPDF = @glade.get_widget(\"chkShowPDF\")\n @log = Log.instance.log\n begin\n @db = RMSCDB.new\n rescue\n puts \"Error connecting to the data base: #{ $!.error }\"\n @log.error \"Error connecting to the data base: #{ $!.error }\"\n @db = nil\n end\n load_shows\n \n @mainWindow = @glade.get_widget(\"mainWindow\")\n @mainWindow.show\n @log.info \"Started #{$0} at #{Time.now}\"\n end", "def reload_builder path\n load __FILE__\n end", "def get_object(name)\n gtk_builder_get_object(@builder, name)\n end", "def initialize(path_or_data, root = nil, domain = nil, localedir = nil, flag = GladeXML::FILE)\n bindtextdomain(domain, localedir, nil, \"UTF-8\")\n @glade = GladeXML.new(path_or_data, root, domain, localedir, flag) {|handler| method(handler)}\n \n #Filters used on the choosers widgets\n @filter = Gtk::FileFilter.new\n @filter.name = 'Supported Files'\n @filter.add_pattern('*.in')\n @filter.add_pattern('*.rtf')\n @filter.add_pattern('*.xml')\n @filter.add_pattern('*.txt')\n\n @mainWindow = self\n\n #array with the texts\n @texts = []\n @scrolls = []\n @number_of_texts = 0\n\n # Manage the project\n @project = Project.new\n\n #Tag Manager\n @tagManager = TagManager.new\n \n #Manage the table and texts\n @main_table = @glade.get_widget('mainTable')\n\n #Manage the tree view\n @treeView = TreeV.new @project, @mainWindow\n @glade.get_widget('mainDiv').pack_start @treeView.view, false, false, 0\n @glade.get_widget('mainDiv').reorder_child @treeView.view, 0\n @glade.get_widget('mainDiv').show_all\n end", "def initialize\n @gui = Gtk::Builder.new\n @gui.add(\"#{File.dirname(__FILE__)}/ui/main.ui\")\n @gui.connect_signals { |handler| method(handler) }\n\n @window = @gui[:window]\n winsetting = GtkSettingsWindow.new(@window, \"win_main\")\n\n @nb_dbs = @gui[:nbDbs]\n @nb_dbs.connect_after(\"switch-page\", [self, \"ChangeActiveDB\"])\n\n @window.show_all\n end", "def initialize(dbpage)\n @dbpage = dbpage\n @dbconn = @dbpage.dbconn\n\n @gui = Gtk::Builder.new\n @gui.add(\"#{File.dirname(__FILE__)}/ui/win_runsql.ui\")\n @gui.connect_signals { |handler| method(handler) }\n\n @cb_type = @gui[:cbType]\n combobox_init(@cb_type)\n @cb_type.get_model.append([\"Auto\"])\n @cb_type.get_model.append([\"One-liners\"])\n @cb_type.get_model.append([\"phpMyAdmin dump\"])\n @cb_type.set_active(0)\n\n @window = @gui[:window]\n winsetting = GtkSettingsWindow.new(@window, \"win_runsql\")\n @window.show_all\n end", "def initialize(parent)\n\t\t@assets = MenuAssets.getInstance\n\t\t@gtkObject = Gtk::Box.new :vertical\n\n\t\tmodel = Gtk::ListStore.new(String)\n\n\t\t@treeview = Gtk::TreeView.new(model)\n\t\tsetup_tree_view(@treeview)\n\n\t\tsave = Sauvegardes.new(\"./Game/Core/Saves/\",\"*.yml\")\n\n\t\tdata = save.chargerRepertoire\n\n\t\t# swapped = true\n\t\t# while swapped do\n\t\t# \tswapped = false\n\t\t# \t0.upto(data.size-2) do |i|\n\t\t# \t\tif (Date.parse(data[i].split(\"&\")[2][0...10]) <=> Date.parse(data[i].split(\"&\")[2][0...10]))<0\n\t\t# \t\t\tdata[i], data[i+1] = data[i+1], data[i]\n\t\t# \t\t\tswapped = true\n\t\t# \t\tend\n\t\t# \tend\n\t\t# end\n\n\t\tdata = data.sort{|n, m|\n\t\t\tn.split(\"&\").last <=> m.split(\"&\").last\n\t\t}.reverse\n\n\n\n\t\tdata.each_with_index do |v|\n\t\t iter = model.append\n\t\t model.set_value(iter, 0, v)\n\t\tend\n\n\t\tbox2 = Gtk::Box.new(:vertical, 10)\n\t\tbox2.border_width = 10\n\t\[email protected]_start(box2, :expand => true, :fill => true, :padding => 0)\n\n\t\tscrolled_win = Gtk::ScrolledWindow.new\n\t\tscrolled_win.add_with_viewport(@treeview)\n\t\tscrolled_win.set_policy(:automatic,:automatic)\n\t\tbox2.pack_start(scrolled_win,:expand => true, :fill => true, :padding => 0)\n\n\n\t\t# box2 = Gtk::Box.new :horizontal\n\t\t# box2.border_width = 10\n\n\t\tbox2 = Gtk::ButtonBox.new :horizontal\n\t\tbox2.layout = :center\n\n\t\tbLoad = MenuItemUi.new(:load, @assets)\n\t\tbLoad.setOnClickEvent(Proc.new{\n\t\t\titer = @treeview.selection.selected\n\t\t\tif(iter != nil)\n\t\t\t\tindex = save.getIndex(model.get_value(iter,0)) #recuperation index\n\t\t\t\tinfos = save.getInfos(index)\n\t\t\t\tparent.changeBackground(\"ecranDeJeu\")\n\t\t\t\tif infos[0] == \"Ranked\"\n\t\t\t\t\tparent.display(RankedMode.new(nil,parent,infos.join(\"&\")))\n\t\t\t\telsif infos[0] == \"TimeTrial\"\n\t\t\t\t\tpath = File.dirname(__FILE__) + \"/../Game/Core/Saves/\"+infos.join(\"&\")\n\t\t\t\t\tdata = YAML.load_file(path)\n\t\t\t\t\tnbGrids = data[\"nbGames\"]\n\t\t\t\t\tdifficulty = :easy\n\t\t\t\t\tif nbGrids > 5\n\t\t\t\t\t\tdifficulty = :intermediate\n\t\t\t\t\telsif nbGrids > 10\n\t\t\t\t\t\tdifficulty = :hard\n\t\t\t\t\tend\n\t\t\t\t\tparent.display(TimeTrialMode.new(parent,infos.join(\"&\"),difficulty,nbGrids ))\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tdialog = Gtk::Dialog.new(\"Message\",$main_application_window,Gtk::DialogFlags::DESTROY_WITH_PARENT,[ Gtk::Stock::OK, Gtk::ResponseType::NONE ])\n\t\t\t\tdialog.signal_connect('response') { dialog.close }\n\t\t\t\t\tif @assets.language == \"FR_fr\"\n\t\t\t\t\t\tdialog.child.add(Gtk::Label.new(\"\\n\\n\\t Veuillez selectionner une sauvegarde à charger.\\t\\n\\n\"))\n\t\t\t\t\telse\n\t\t\t\t\t\tdialog.child.add(Gtk::Label.new(\"\\n\\n\\t Please select a save file to load.\\t\\n\\n\"))\n\t\t\t\t\tend\n\t\t\t\tdialog.show_all\n\t\t\tend\n\t\t})\n\n\t\tbox2.add(bLoad.gtkObject)\n\n\t\tbDelete = MenuItemUi.new(:delete, @assets)\n\t\tbDelete.setOnClickEvent(Proc.new{\n\t\t iter = @treeview.selection.selected\n\n\t\tif(iter != nil)\n\t\t index = save.getIndex(model.get_value(iter,0))#recuperation index\n\t\t save.supprimer(index)\n\t\t model.remove(iter)\n\t\telse\n\t\tdialog = Gtk::Dialog.new(\"Message\",$main_application_window,Gtk::DialogFlags::DESTROY_WITH_PARENT,[ Gtk::Stock::OK, Gtk::ResponseType::NONE ])\n\t\tdialog.signal_connect('response') { dialog.close }\n\t\t\tif @assets.language == \"FR_fr\"\n\t\t\t\tdialog.child.add(Gtk::Label.new(\"\\n\\n\\t Veuillez selectionner une sauvegarde à supprimer.\\t\\n\\n\"))\n\t\t\telse\n\t\t\t\tdialog.child.add(Gtk::Label.new(\"\\n\\n\\t Please select a save file to delete.\\t\\n\\n\"))\n\t\t\tend\n\t\tdialog.show_all\n\t\tend\n\n\n\n\n\t\t})\n\t\tbox2.add(bDelete.gtkObject)\n\n\t\t# @gtkObject.pack_start(box2, :expand => false, :fill => true, :padding => 0)\n\t\t# box2 = Gtk::Box.new(:vertical, 10)\n\t\t# box2.border_width = 10\n\t\t# @gtkObject.pack_start(box2, :expand => false, :fill => true, :padding => 0)\n\n\t\tbRetour = MenuItemUi.new(:back,@assets)\n\t\tbRetour.setOnClickEvent(Proc.new{\n\t\t\tparent.changeBackground(\"menuPrincipal\")\n\t\t\tparent.display(parent.mainMenu)\n\t\t})\n\t\tbox2.add(bRetour.gtkObject)\n\t\[email protected]_start(box2, :expand => false, :fill => true, :padding => 0)\n\tend", "def initialize(path_or_data, root = nil, domain = nil, localedir = nil)\n bindtextdomain(domain, localedir, nil, \"UTF-8\")\n @builder = Gtk::Builder::new\n @builder.add_from_file(path_or_data)\n @builder.connect_signals { |handler| method(handler) }\n #@builder.translation_domain = domain\n\n @transaction_tree = @builder.get_object(\"transactions_treeview\")\n\n populate_transaction_columns()\n\n end", "def initialize\n\t\t@gtkObject = Gtk::Window.new\n\t\t@assets = MenuAssets.getInstance()\n\t\tinitMenus\n\t\tinitGtkWindow\n\tend", "def load_user_interface()\n\t# locate the enclosing folder and get the bricks file within it\n\tfolder = File.dirname( $0 )\n\tgui_path = File.join( folder, \"gui.bricks\" )\n\turl = Java::File.new( gui_path ).toURI.toURL\n\t\n\t# generate a window reference resource and pass the desired constructor arguments\n\twindow_reference = WindowReference::getDefaultInstance( url, \"MainWindow\" )\n\t\n\tmain_controller = ControlApp.new window_reference\n\tmain_controller.displayWindow\nend", "def load_user_interface()\n\t# locate the enclosing folder and get the bricks file within it\n\tfolder = File.dirname( $0 )\n\tgui_path = File.join( folder, \"gui.bricks\" )\n\turl = Java::File.new( gui_path ).toURI.toURL\n\t\n\t# generate a window reference resource and pass the desired constructor arguments\n\twindow_reference = WindowReference::getDefaultInstance( url, \"MainWindow\" )\n\t\n\tmain_controller = ControlApp.new window_reference\n\tmain_controller.displayWindow\nend", "def get_definition(cls, bld)\r\n clsVar = CodeNameStyling.getStyled(cls.getUName() + \" form\", Utils.instance.langProfile.variableNameStyle)\r\n clsName = CodeNameStyling.getStyled(cls.getUName() + \" form\", Utils.instance.langProfile.variableNameStyle)\r\n clsIntf = Utils.instance.createVarFor(cls, \"ts_interface\")\r\n\r\n bld.startFunction(\"initData(item: \" + Utils.instance.getStyledClassName(cls.model.name) + \"): void\")\r\n\r\n Utils.instance.eachVar(UtilsEachVarParams.new().wCls(cls).wBld(bld).wSeparate(true).wVarCb(lambda { |var|\r\n if var.isList()\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) + \" = [];\")\r\n else\r\n if Utils.instance.isNumericPrimitive(var)\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) + \" = 0;\")\r\n elsif var.getUType().downcase == \"boolean\"\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) + \" = false;\")\r\n elsif var.getUType().downcase == \"datetime\"\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) + \" = new Date();\")\r\n elsif Utils.instance.isPrimitive(var)\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) + \" = '';\")\r\n else\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) +\r\n \" = {} as \" + Utils.instance.getStyledClassName(var.getUType()) + \";\")\r\n varCls = ClassModelManager.findVarClass(var, \"ts_interface\")\r\n if varCls != nil\r\n vService = Utils.instance.createVarFor(varCls, \"class_angular_data_gen_service\")\r\n\r\n if vService != nil\r\n srcName = \"item.\" + Utils.instance.getStyledVariableName(var)\r\n bld.add(\"this.\" + Utils.instance.getStyledVariableName(vService) +\r\n \".initData(\" + srcName + \");\")\r\n end\r\n end\r\n end\r\n end\r\n }))\r\n\r\n bld.endFunction()\r\n end", "def create_browse_form\n\t\n\t\t\t# Create child form if not present\n\t\t\tif @dir_browse_form.nil?\n\t\t\t\n\t\t\t\t# Call GUI Utility Method to handle child form creation\n\t\t\t\tresult = GuiUtils.create_child_form({\n\t\t\t\t\t:class => Ui_DirBrowseForm,\n\t\t\t\t\t:flags => Qt::Tool | Qt::MSWindowsFixedSizeDialogHint, #| Qt::WindowTitleHint | Qt::CustomizeWindowHint, # << no close button\n\t\t\t\t\t:base_widget => CustomFontWidget.new(self),\n\t\t\t\t\t:show => false\n\t\t\t\t})\n\n\t\t\t\t# Center the newly created form relative to the parent form\n\t\t\t\t@dir_browse_form = result[:form]\n\t\t\t\tGuiUtils.center_relative_to({\n :widget => @dir_browse_form,\n :parent => @parent\n })\n\n\t\t\t\t# Set closed callbacks for the actual form and its dummy form\n\t\t\t\tui = result[:ui]\n\t\t\t\thandler = lambda { dir_browse_closed }\n\t\t\t\tui.closed_callback = handler\n\t\t\t\t@dir_browse_ui = ui.extension\n\t\t\t\t@dir_browse_ui.closed_callback = handler\n\t\t\tend\t\n\t\n\t\tend", "def inicializar_ventana\r\n set_title \"Php - Generator Polls\"\r\n set_default_size 400, 315\r\n set_window_position Gtk::Window::Position::CENTER\r\n signal_connect \"delete_event\" do\r\n Gtk.main_quit\r\n end\r\n signal_connect \"destroy\" do\r\n Gtk.main_quit\r\n end\r\n init_gui\r\n show_all\r\n end", "def genFileContent(cls, bld)\r\n bld.add\r\n\r\n selectorName = Utils.instance.getStyledFileName(cls.getUName())\r\n filePart = Utils.instance.getStyledFileName(cls.getUName())\r\n\r\n clsVar = CodeNameStyling.getStyled(cls.getUName() + \" form\", Utils.instance.langProfile.variableNameStyle)\r\n userServiceVar = Utils.instance.createVarFor(cls, \"class_angular_data_store_service\")\r\n dataGenUserServiceVar = Utils.instance.createVarFor(cls, \"class_angular_data_gen_service\")\r\n userPopulateServiceVar = Utils.instance.createVarFor(cls, \"class_angular_data_map_service\")\r\n\r\n bld.add(\"@Component({\")\r\n bld.indent\r\n bld.add(\"selector: 'app-\" + selectorName + \"',\")\r\n bld.add(\"templateUrl: './\" + filePart + \".component.html',\")\r\n bld.add(\"styleUrls: ['./\" + filePart + \".component.css']\")\r\n bld.unindent\r\n bld.add(\"})\")\r\n\r\n bld.add\r\n\r\n bld.startBlock(\"export class \" + getClassName(cls) + \" implements OnInit \")\r\n bld.add(\"enableEdit: boolean = false;\")\r\n bld.add(\"@Input() item: \" + Utils.instance.getStyledClassName(cls.model.name) + \" = {} as \" + Utils.instance.getStyledClassName(cls.model.name) + \";\")\r\n bld.separate\r\n\r\n # Generate class variables\r\n process_var_group(cls, bld, cls.model.varGroup)\r\n\r\n # Generate any selection list variables\r\n Utils.instance.eachVar(UtilsEachVarParams.new().wCls(cls).wBld(bld).wSeparate(true).wVarCb(lambda { |var|\r\n if var.selectFrom != nil\r\n optVar = Utils.instance.getOptionsVarFor(var)\r\n bld.add(Utils.instance.getVarDec(optVar))\r\n end\r\n }))\r\n\r\n bld.separate\r\n\r\n constructorParams = Array.new\r\n Utils.instance.addParamIfAvailable(constructorParams, userServiceVar)\r\n Utils.instance.addParamIfAvailable(constructorParams, dataGenUserServiceVar)\r\n Utils.instance.addParamIfAvailable(constructorParams, userPopulateServiceVar)\r\n\r\n # Generate any selection list variable parameters for data stores\r\n Utils.instance.eachVar(UtilsEachVarParams.new().wCls(cls).wBld(bld).wSeparate(true).wVarCb(lambda { |var|\r\n if var.selectFrom != nil\r\n optVar = Utils.instance.getOptionsVarFor(var)\r\n optCls = ClassModelManager.findClass(var.selectFrom, \"ts_interface\")\r\n if optVar == nil\r\n Log.error(\"No options var for var: \" + var.name)\r\n elsif optCls == nil\r\n Log.error(\"No ts_interface class for var: \" + var.name)\r\n else\r\n dataStoreOptServiceVar = Utils.instance.createVarFor(optCls, \"class_angular_data_store_service\")\r\n if dataStoreOptServiceVar != nil\r\n Utils.instance.addParamIfAvailable(constructorParams, dataStoreOptServiceVar)\r\n else\r\n Log.error(\"couldn't find data store service for: \" + var.name)\r\n end\r\n end\r\n end\r\n }))\r\n\r\n constructorParams.push(\"private route: ActivatedRoute\")\r\n\r\n bld.startFunctionParamed(\"constructor\", constructorParams)\r\n bld.endBlock\r\n\r\n bld.separate\r\n bld.startBlock(\"ngOnInit()\")\r\n bld.add(\"this.route.paramMap.subscribe(params => {\")\r\n bld.indent\r\n bld.add(\"let idVal = params.get('id');\")\r\n bld.add(\"if (!this.item?.id) {\")\r\n\r\n bld.iadd(\"this.item = {} as \" + Utils.instance.getStyledClassName(cls.model.name) + \";\")\r\n bld.iadd(\"this.\" + Utils.instance.getStyledVariableName(dataGenUserServiceVar) + \".initData(this.item);\")\r\n bld.add(\"}\")\r\n idVar = cls.model.getFilteredVars(lambda { |var| var.name == \"id\" })\r\n if (Utils.instance.isNumericPrimitive(idVar[0]))\r\n bld.add(\"this.item.id = idVal !== null ? parseInt(idVal) : 0;\")\r\n else\r\n bld.add(\"this.item.id = idVal !== null ? idVal : '';\")\r\n end\r\n bld.unindent\r\n bld.add(\"});\")\r\n bld.add(\"this.route.data.subscribe(data => {\")\r\n bld.indent\r\n bld.startBlock(\"if (data['enableEdit'])\")\r\n bld.add(\"this.enableEdit = data['enableEdit'];\")\r\n bld.endBlock\r\n bld.unindent\r\n bld.add(\"});\")\r\n\r\n # Load any selection lists needed\r\n Utils.instance.eachVar(UtilsEachVarParams.new().wCls(cls).wBld(bld).wSeparate(true).wVarCb(lambda { |var|\r\n if var.selectFrom != nil\r\n optVar = Utils.instance.getOptionsVarFor(var)\r\n optCls = ClassModelManager.findClass(var.selectFrom, \"ts_interface\")\r\n if optVar == nil\r\n Log.error(\"No options var for var: \" + var.name)\r\n elsif optCls == nil\r\n Log.error(\"No ts_interface class for var: \" + var.name)\r\n else\r\n dataStoreOptServiceVar = Utils.instance.createVarFor(optCls, \"class_angular_data_store_service\")\r\n if dataStoreOptServiceVar != nil\r\n bld.add(\"this.\" + Utils.instance.getStyledVariableName(optVar) + \" = this.\" + Utils.instance.getStyledVariableName(dataStoreOptServiceVar) + \".listing();\")\r\n else\r\n Log.error(\"No class_angular_data_store_service variable for class: \" + var.name)\r\n end\r\n end\r\n end\r\n }))\r\n\r\n bld.separate\r\n bld.add(\"this.populate();\")\r\n bld.endBlock\r\n\r\n bld.separate\r\n bld.startBlock(\"onSubmit()\")\r\n bld.startBlock(\"if (!this.\" + clsVar + \".invalid)\")\r\n if (idVar[0].getUType().downcase() == \"string\" || idVar[0].getUType().downcase() == \"guid\")\r\n bld.startBlock(\"if (this.\" + clsVar + \".controls['id'].value?.length === 0)\")\r\n else\r\n bld.startBlock(\"if (this.\" + clsVar + \".controls['id'].value === null || !(this.\" + clsVar + \".controls['id'].value > 0))\")\r\n end\r\n bld.startBlock(\"this.\" + Utils.instance.getStyledVariableName(userServiceVar) + \".create(this.\" + clsVar + \".value).subscribe(newItem => \")\r\n bld.add \"this.item = newItem;\"\r\n bld.endBlock \");\"\r\n bld.midBlock(\"else\")\r\n bld.startBlock(\"this.\" + Utils.instance.getStyledVariableName(userServiceVar) + \".update(this.\" + clsVar + \".value).subscribe(newItem => \")\r\n bld.add \"this.item = newItem;\"\r\n bld.endBlock \");\"\r\n bld.endBlock\r\n bld.endBlock\r\n bld.endBlock\r\n\r\n bld.separate\r\n bld.startBlock(\"onExit()\")\r\n bld.endBlock\r\n\r\n render_functions(cls, bld)\r\n\r\n bld.endBlock\r\n end", "def initialize(parent)\n @gtkObject = Gtk::Box.new :vertical\n @gtkObject.set_name 'test'\n\t\t@cb = Gtk::ComboBoxText.new\n @cb.append_text 'Général'\n @cb.append_text 'Contre La Montre'\n @cb.append_text 'Mode Facile'\n @cb.append_text 'Mode Moyen'\n @cb.append_text 'Mode Difficile'\n\t\[email protected](@cb)\n\t\tstore = Gtk::ListStore.new(String, Integer)\n\t\ttreeview = Gtk::TreeView.new(store)\n\t\tsetup_tree_view(treeview)\n\t\tdata = desereliseJoueurs\n\n\t\t\tif(data != nil)\n\t\t\t\tdata.each_with_index do |e, i|\n\t\t \t \t\titer = store.append\n\t\t \t\t\tstore.set_value(iter, 0, data[i].donneNom)\n\t\t \t\t\tstore.set_value(iter, 1, data[i].donneScore)\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\n\t\t\tboxTree = Gtk::Box.new(:vertical, 10)\n\t\t\tboxTree.border_width = 10\n\t\t\[email protected]_start(boxTree,:expand => true, :fill => true, :padding => 0)\n\n\t\t\tscrolled_win = Gtk::ScrolledWindow.new\n\t\t\tscrolled_win.add_with_viewport(treeview)\n\t\t\tscrolled_win.set_policy(:automatic,:automatic)\n\t\t\tboxTree.pack_start(scrolled_win,:expand => true, :fill => true, :padding => 0)\n\n\t\t\tseparator = Gtk::Separator.new(:horizontal)\n\t\t\[email protected]_start(separator, :expand => false, :fill => true, :padding => 0)\n\t\t\tseparator.show\n\n\n\t\t\tbRetour = MenuItemUi.new(:back,MenuAssets.getInstance())\n\t\t\tbRetour.setOnClickEvent(Proc.new{\n\t\t\t\tparent.changeBackground(\"menuPrincipal\")\n\t\t\t\tparent.display(parent.mainMenu)\n\t\t\t})\n\t\t\[email protected](bRetour.gtkObject)\n\t\t\t\n\t\t\tif(data != nil)\n\t\t\t\[email protected]_connect \"changed\" do |w, z|\n\t\t \t\t\tselectn(w,z,data,store)\n\t\t\t\tend\n\t\t\tend\n\tend", "def get_definition(cls, bld, fun)\r\n itemVar = CodeNameStyling.getStyled(cls.getUName() + \" form\", Utils.instance.langProfile.variableNameStyle)\r\n clsVar = CodeNameStyling.getStyled(cls.getUName() + \" form\", Utils.instance.langProfile.variableNameStyle)\r\n populateServiceVar = Utils.instance.createVarFor(cls, \"class_angular_data_map_service\")\r\n\r\n if clsVar != nil && populateServiceVar != nil\r\n bld.startFunction(\"populate(): void\")\r\n bld.add(\"this.\" + Utils.instance.getStyledVariableName(populateServiceVar) +\r\n \".populate(this.\" + clsVar + \" as FormGroup, this.item);\")\r\n\r\n bld.endFunction()\r\n end\r\n end", "def get_glade_variables(obj = self)\r\n obj.instance_variables.each do |var_name|\n next if var_name == :@builder or var_name == :@top_level_window\n var = obj.instance_variable_get(var_name)\r\n var_name = var_name.to_s.gsub(\"@\", \"\") #fix for ruby 1.9 giving symbols\n if var.is_a? Hash\n var.each_pair do |key, val|\n if glade_value = get_control_value(\"#{var_name}[#{key.to_s}]\", obj)\n var[key] = glade_value\n end \n end\n obj.instance_variable_set(\"@\"+ var_name, var)\n elsif var.is_a? Array\n var.each_index do |i|\n if glade_value = get_control_value(\"#{var_name}[#{i.to_s}]\", obj)\n var[i] = glade_value\n end\n end\n obj.instance_variable_set(\"@\"+ var_name, var)\n else\n glade_value = get_control_value(var_name, obj)\n obj.instance_variable_set(\"@\"+ var_name, glade_value) unless glade_value.nil?\n end\n end\r\n end", "def load_module(path)\n mod = Module.new\n\n if File.extname(path) == \".erb\"\n contents = File.read(path)\n query, lineno = GraphQL::Client::Erubis.extract_graphql_section(contents)\n mod = client.parse(query, path, lineno) if query\n end\n\n mod.extend(ViewModule)\n mod.client = client\n mod.path = path\n mod\n end", "def loader\n @loader ||= Knife::Core::ObjectLoader.new(DataBagItem, ui)\n end", "def load\n\t\tsource = self.depfile.read\n\t\tself.instance_eval( source, self.depfile.to_s, 1 )\n\tend", "def load_view\r\n @view = XamlReader.load_from_path view_path if File.exists? view_path\r\n @view ||= view_name.to_s.gsub(/(.*::)+/, '').classify.new \r\n @view\r\n end", "def load\n end", "def load\n end", "def load\n end", "def initialize()\n if File.exist?(\"../Sauvegarde/grilles.dump\") == true \n @@instanceSauvegardeGrille = Marshal.load( File.binread( \"../Sauvegarde/grilles.dump\" ) )\n else\n @mesGrilles = [nil]\n @@instanceSauvegardeGrille = self\n end\n @@instanceSauvegardeGrille\n end", "def load\n end", "def builder\n form\n end", "def set_glade_all(obj = self) \r\n set_glade_active_record(obj)\r\n set_glade_variables(obj)\r\n end", "def _new_form(id, atrb = Hashx.new)\n self[id] = context_module('Form').new(@cfg, atrb.update(id: id))\n end", "def script_form_double\n BootstrapForm::FormBuilder.new('script', nil, self, {})\n end", "def populate_diagram\n\n # Parse the Diagram data using the #Reader\n puts \"Parsing Diagram data . . .\"\n diagram_data = @reader.get_diagram_data\n\n # Create and populate a Diagram from the parsed data\n puts \"Populating Diagram with Classes . . .\"\n\t\t\t@diagram = Diagram.new(diagram_data[:name], diagram_data[:artifacts])\n @diagram.populate!\n end", "def run\n Gtk.main\n end", "def create_widget_for_pointer(pointer)\n new_widget = @gui_factory.new_widget(\"DisplayFile/#{get_gui_name_for(pointer)}\")\n # Initialize the widget with the pointer's content\n if pointer.is_a?(Model::FileInfo)\n file_name = pointer.get_absolute_name\n File.open(file_name, 'rb') do |file|\n new_widget.init_with_data(pointer, IOBlockReader::init(file, :block_size => Model::FileInfo::CRC_BLOCK_SIZE), 0, File.size(file_name))\n end\n else\n file_name = pointer.file_info.get_absolute_name\n segment = pointer.segment\n File.open(file_name, 'rb') do |file|\n new_widget.init_with_data(pointer, IOBlockReader::init(file, :block_size => Model::FileInfo::CRC_BLOCK_SIZE), segment.begin_offset, segment.end_offset)\n end\n end\n\n return new_widget\n end", "def load\r\n \r\n end", "def load( name, opts = {} )\n name = File.expand_path( name )\n sync do\n get_schema do\n with_options( opts ) do\n Kernel.load( name )\n end\n end\n end\n end", "def init_vars\n @hbox = Gtk::HBox.new\n @mode_vbox = Gtk::VBox.new\n @idiom_vbox = Gtk::VBox.new\n @geral_vbox = Gtk::VBox.new\n @new_btn = Gtk::Button.new('')\n @quit_btn = Gtk::Button.new('')\n self.resizable = false\n self.modal = true\n @mode_rdo = []\n (0..4).each{|i|\n @mode_rdo[i] = OptionsRadioButton.new(@mode_rdo[0])\n }\n @mode_rdo[0].selected = true\n @idiom_rdo = []\n (0..2).each{|i|\n @idiom_rdo[i] = Gtk::RadioButton.new(@idiom_rdo[0])\n }\n end", "def new\n @components_grip = Components::Grip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @components_grip }\n end\n end", "def buildMenu\n template = File.read('_plugins/figma-menu.html.erb')\n result = ERB.new(template).result(binding)\n\n open(\"_includes/figma-menu.html\", \"wb\") { |file|\n file.write(result)\n file.close\n }\n\n end", "def new_ui(with=Dumon::GtkTrayUi)\n with.new\n end", "def show_browse_form(p_starting_path = nil)\n\t\t\n\t\t\t# If available as argument, select the path within the Tree View\n\t\t\t@dir_browse_ui.select_path(p_starting_path) unless p_starting_path.nil?\n\t\t\n\t\t\t# Show Browse form\n\t\t\t@dir_browse_form.show\n\t\t\t@dir_browse_form.activateWindow\t\t\n\t\tend", "def loadFile(filename)\n\t\t\tdescname = filename.basename.sub_ext(\"\").to_s + \"Desc\"\n\t\t\tif([email protected]?(descname))\n\t\t\t\t@loaded << descname\n\n\t\t\t\tfilename = filename.to_s\n\t\t\t\tlast = $mec_mgr\n\n\t\t\t\t$mec_mgr = self\n\t\t\t\trequire(filename)\n\t\t\t\t$mec_mgr = last\n\t\t\t\t\n\t\t\t\tdesc = begin\n\t\t\t\t\tMakeRbExt.const_get(descname)\n\t\t\t\trescue NameError\n\t\t\t\t\traise(\"File `#{filename}' should contain a ruby module `#{descname}', but doesn't\")\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tdesc.register(@settings)\n\t\t\tend\n\t\tend", "def get_glade_all(obj = self)\r\n get_glade_active_record(obj)\r\n get_glade_variables(obj)\r\n end", "def load\n end", "def load\n end", "def profile_management_dialog\n dialog = Dumon::GtkProfileDlg.new\n dialog.show\n end", "def setup_gui\n \n end", "def load!\n # TODO Don't load a module that's already loaded\n\n # Load the main file\n fname = path(\"#{name}.rb\")\n require fname unless fname.nil?\n\n # Load the basic things usually autoloaded.\n Dir[\"#{@path}/{init,models,routes,helpers}/*.rb\"].each { |f| require f }\n\n # Ensure public/ works\n public_path = path(:public)\n Main.add_public(public_path) unless public_path.nil?\n\n # Add the view path, if it has\n if path(:views)\n paths = [path(:views)]\n paths += Main.multi_views if Main.respond_to?(:multi_views)\n Main.set :multi_views, paths\n end\n end", "def load(name); end", "def initialize(win_dbprofile, mode = \"add\")\n @gui = Gtk::Builder.new\n @gui.add(\"#{File.dirname(__FILE__)}/ui/win_dbprofiles_edit.ui\")\n @gui.connect_signals { |handler| method(handler) }\n\n @window = @gui[:window]\n winsetting = GtkSettingsWindow.new(@window, \"win_dbprofiles_edit\")\n\n @win_dbprofile = win_dbprofile\n @window.set_transient_for(win_dbprofile.window)\n @mode = mode\n\n # Typer der kan bruges.\n @types[\"mysql\"] = \"MySQL\"\n @types[\"mysqli\"] = \"MySQLi\"\n @types[\"pgsql\"] = \"PostgreSQL\"\n @types[\"sqlite\"] = \"SQLite\"\n @types[\"sqlite3\"] = \"SQLite3\"\n @types[\"mssql\"] = \"MS-SQL\"\n @types[\"access\"] = \"Access\"\n\n @types_text[\"mysql\"] = 0\n @types_text[\"mysqli\"] = 1\n @types_text[\"pgsql\"] = 2\n @types_text[\"sqlite\"] = 3\n @types_text[\"sqlite3\"] = 4\n @types_text[\"mssql\"] = 5\n @types_text[\"access\"] = 6\n\n @types_nr[0] = \"mysql\"\n @types_nr[1] = \"mysqli\"\n @types_nr[2] = \"pgsql\"\n @types_nr[3] = \"sqlite\"\n @types_nr[4] = \"sqlite3\"\n @types_nr[5] = \"mssql\"\n @types_nr[6] = \"access\"\n\n require_once(\"knjphpframework/functions_combobox.php\")\n combobox_init(@gui[:cmbType])\n @types.each do |value|\n @gui[:cmbType].append_text(value)\n end\n @gui[:cmbType].set_active(0)\n\n if @mode == \"edit\"\n # NOTE: Remember that the tv_profiles is in multiple mode, so it is possible to open more than one database at a time. This affects the returned array from treeview_getSelection().\n editvalue = treeview_getSelection(@win_dbprofile.tv_profiles)\n @edit_data = get_myDB.selectsingle(\"profiles\", {\"nr\" => editvalue[0][0]})\n\n if file_exists(edit_data[location])\n @gui[:fcbLocation].set_filename(edit_data[location])\n end\n\n @gui[:texIP].set_text(edit_data[location])\n @gui[:texTitle].set_text(edit_data[title])\n @gui[:texUsername].set_text(edit_data[username])\n @gui[:texPassword].set_text(edit_data[password])\n @gui[:texDatabase].set_text(edit_data[database])\n @gui[:texPort].set_text(edit_data[port])\n @gui[:cmbType].set_active(types_text[edit_data[type]])\n end\n\n @window.show_all\n validateType\n end", "def show_file name\n if(texts = read_file(name))\n i = @texts.size\n if @number_of_texts <6\n @number_of_texts+=1\n build_table(@number_of_texts)\n @main_table.show_all \n end\n if (i<6)\n text = @texts[i]\n buffer = text.buffer \n else\n text = @texts[5]\n end\n \n #Populates the text view menu\n text.signal_connect(\"populate_popup\") do |widget,menu|\n tagMenu = Gtk::Menu.new\n \n @tagManager.types.collect.each do |t|\n temp = Gtk::MenuItem.new(t.tag.name)\n tagMenu.append(temp)\n temp.signal_connect('activate'){|w| tag_text(prince_text, t)}\n end\n tagMenu.append(Gtk::MenuItem.new(\"Create Tag\"))\n subMenu = Gtk::MenuItem.new(\"Tags\")\n subMenu.submenu = tagMenu\n \n #se esta removiendo cut, hay ke ver como hacer para ke no lo remueva la primera vez\n menu.remove(menu.children[0])\n menu.prepend(subMenu)\n menu.show_all\n menu.popup(nil, nil, 0, 0)\n end\n \n buffer.set_text(texts)\n buffer.place_cursor(buffer.start_iter)\n\n #Adds the text tags\n buffer.tag_table.each do |t|\n buffer.tag_table.remove(t)\n end\n @tagManager.types.collect.each do |t|\n buffer.tag_table.add(t.tag)\n end\n else\n show_error(\"File Not Found\", \"File Not Found\")\n end\n end", "def InitializeComponent()\n\t\t\tself.@templatesLbl = System.Windows.Forms.Label.new()\n\t\t\tself.@topGbx = System.Windows.Forms.GroupBox.new()\n\t\t\tself.@templateListbox = System.Windows.Forms.ListBox.new()\n\t\t\tself.@engineCombox = System.Windows.Forms.ComboBox.new()\n\t\t\tself.@languageCombox = System.Windows.Forms.ComboBox.new()\n\t\t\tself.@removeBtn = System.Windows.Forms.Button.new()\n\t\t\tself.@newsaveBtn = System.Windows.Forms.Button.new()\n\t\t\tself.@fileNameTextbox = System.Windows.Forms.TextBox.new()\n\t\t\tself.@displayNameTxtbox = System.Windows.Forms.TextBox.new()\n\t\t\tself.@languageLbl = System.Windows.Forms.Label.new()\n\t\t\tself.@engineLbl = System.Windows.Forms.Label.new()\n\t\t\tself.@nameLbl = System.Windows.Forms.Label.new()\n\t\t\tself.@fileNameLbl = System.Windows.Forms.Label.new()\n\t\t\tself.@editBtn = System.Windows.Forms.Button.new()\n\t\t\tself.@openFileDialogBtn = System.Windows.Forms.Button.new()\n\t\t\tself.@noteTextLbl = System.Windows.Forms.Label.new()\n\t\t\tself.@noteLbl = System.Windows.Forms.Label.new()\n\t\t\tself.@openFileDialog = System.Windows.Forms.OpenFileDialog.new()\n\t\t\tself.@getItFromOnlineBtn = System.Windows.Forms.Button.new()\n\t\t\tself.@prefixTxtBox = System.Windows.Forms.TextBox.new()\n\t\t\tself.@prefixLbl = System.Windows.Forms.Label.new()\n\t\t\tself.@suffixLbl = System.Windows.Forms.Label.new()\n\t\t\tself.@suffixTxtBox = System.Windows.Forms.TextBox.new()\n\t\t\tself.SuspendLayout()\n\t\t\t# \n\t\t\t# templatesLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(9, 5)\n\t\t\[email protected] = \"templatesLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(60, 16)\n\t\t\[email protected] = 31\n\t\t\[email protected] = \"Templates\"\n\t\t\t# \n\t\t\t# topGbx\n\t\t\t# \n\t\t\[email protected] = ((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right)))\n\t\t\[email protected] = System.Drawing.Point.new(80, 5)\n\t\t\[email protected] = \"topGbx\"\n\t\t\[email protected] = System.Drawing.Size.new(370, 8)\n\t\t\[email protected] = 30\n\t\t\[email protected] = false\n\t\t\t# \n\t\t\t# templateListbox\n\t\t\t# \n\t\t\[email protected] = true\n\t\t\[email protected] = System.Drawing.Point.new(10, 30)\n\t\t\[email protected] = \"templateListbox\"\n\t\t\[email protected] = System.Drawing.Size.new(160, 303)\n\t\t\[email protected] = 1\n\t\t\[email protected] { |sender, e| self.@templateListbox_SelectedIndexChanged(sender, e) }\n\t\t\t# \n\t\t\t# engineCombox\n\t\t\t# \n\t\t\[email protected] = true\n\t\t\[email protected] = System.Drawing.Point.new(262, 60)\n\t\t\[email protected] = \"engineCombox\"\n\t\t\[email protected] = System.Drawing.Size.new(121, 21)\n\t\t\[email protected] = 5\n\t\t\t# \n\t\t\t# languageCombox\n\t\t\t# \n\t\t\[email protected] = true\n\t\t\[email protected] = System.Drawing.Point.new(262, 30)\n\t\t\[email protected] = \"languageCombox\"\n\t\t\[email protected] = System.Drawing.Size.new(121, 21)\n\t\t\[email protected] = 3\n\t\t\t# \n\t\t\t# removeBtn\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(291, 210)\n\t\t\[email protected] = \"removeBtn\"\n\t\t\[email protected] = System.Drawing.Size.new(64, 23)\n\t\t\[email protected] = 16\n\t\t\[email protected] = \"Remove\"\n\t\t\[email protected] = true\n\t\t\[email protected] { |sender, e| self.@removeBtn_Click(sender, e) }\n\t\t\t# \n\t\t\t# newsaveBtn\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(361, 210)\n\t\t\[email protected] = \"newsaveBtn\"\n\t\t\[email protected] = System.Drawing.Size.new(93, 23)\n\t\t\[email protected] = 17\n\t\t\[email protected] = \"New/Save\"\n\t\t\[email protected] = true\n\t\t\[email protected] { |sender, e| self.@newsaveBtn_Click(sender, e) }\n\t\t\t# \n\t\t\t# fileNameTextbox\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(262, 120)\n\t\t\[email protected] = \"fileNameTextbox\"\n\t\t\[email protected] = System.Drawing.Size.new(164, 20)\n\t\t\[email protected] = 9\n\t\t\t# \n\t\t\t# displayNameTxtbox\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(262, 90)\n\t\t\[email protected] = 200\n\t\t\[email protected] = \"displayNameTxtbox\"\n\t\t\[email protected] = System.Drawing.Size.new(121, 20)\n\t\t\[email protected] = 7\n\t\t\t# \n\t\t\t# languageLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(178, 30)\n\t\t\[email protected] = \"languageLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(80, 13)\n\t\t\[email protected] = 2\n\t\t\[email protected] = \"Language:\"\n\t\t\t# \n\t\t\t# engineLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(178, 60)\n\t\t\[email protected] = \"engineLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(80, 13)\n\t\t\[email protected] = 4\n\t\t\[email protected] = \"Engine:\"\n\t\t\t# \n\t\t\t# nameLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(178, 90)\n\t\t\[email protected] = \"nameLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(80, 13)\n\t\t\[email protected] = 6\n\t\t\[email protected] = \"DisplayName:\"\n\t\t\t# \n\t\t\t# fileNameLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(178, 120)\n\t\t\[email protected] = \"fileNameLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(80, 13)\n\t\t\[email protected] = 8\n\t\t\[email protected] = \"File:\"\n\t\t\t# \n\t\t\t# editBtn\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(228, 210)\n\t\t\[email protected] = \"editBtn\"\n\t\t\[email protected] = System.Drawing.Size.new(57, 23)\n\t\t\[email protected] = 15\n\t\t\[email protected] = \"Edit\"\n\t\t\[email protected] = true\n\t\t\[email protected] { |sender, e| self.@editBtn_Click(sender, e) }\n\t\t\t# \n\t\t\t# openFileDialogBtn\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(430, 118)\n\t\t\[email protected] = \"openFileDialogBtn\"\n\t\t\[email protected] = System.Drawing.Size.new(24, 23)\n\t\t\[email protected] = 10\n\t\t\[email protected] = \"...\"\n\t\t\[email protected] = true\n\t\t\[email protected] { |sender, e| self.@openFileDialogBtn_Click(sender, e) }\n\t\t\t# \n\t\t\t# noteTextLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(246, 276)\n\t\t\[email protected] = \"noteTextLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(210, 60)\n\t\t\[email protected] = 20\n\t\t\t# \n\t\t\t# noteLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Font.new(\"Microsoft Sans Serif\", 7.8f, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((0)))\n\t\t\[email protected] = System.Drawing.Point.new(190, 275)\n\t\t\[email protected] = \"noteLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(50, 18)\n\t\t\[email protected] = 19\n\t\t\[email protected] = \"Note:\"\n\t\t\t# \n\t\t\t# openFileDialog\n\t\t\t# \n\t\t\[email protected] = \"Template Text File (*.txt)|*.txt\"\n\t\t\[email protected] = \"Select Template Text File\"\n\t\t\t# \n\t\t\t# getItFromOnlineBtn\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(228, 244)\n\t\t\[email protected] = \"getItFromOnlineBtn\"\n\t\t\[email protected] = System.Drawing.Size.new(226, 23)\n\t\t\[email protected] = 18\n\t\t\[email protected] = \"Get it from online\"\n\t\t\[email protected] = true\n\t\t\[email protected] { |sender, e| self.@getItFromOnlineBtn_Click(sender, e) }\n\t\t\t# \n\t\t\t# prefixTxtBox\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(262, 150)\n\t\t\[email protected] = 200\n\t\t\[email protected] = \"prefixTxtBox\"\n\t\t\[email protected] = System.Drawing.Size.new(121, 20)\n\t\t\[email protected] = 12\n\t\t\t# \n\t\t\t# prefixLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(178, 150)\n\t\t\[email protected] = \"prefixLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(80, 13)\n\t\t\[email protected] = 11\n\t\t\[email protected] = \"Prefix:\"\n\t\t\t# \n\t\t\t# suffixLbl\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(178, 180)\n\t\t\[email protected] = \"suffixLbl\"\n\t\t\[email protected] = System.Drawing.Size.new(80, 13)\n\t\t\[email protected] = 13\n\t\t\[email protected] = \"Suffix:\"\n\t\t\t# \n\t\t\t# suffixTxtBox\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(262, 180)\n\t\t\[email protected] = 200\n\t\t\[email protected] = \"suffixTxtBox\"\n\t\t\[email protected] = System.Drawing.Size.new(121, 20)\n\t\t\[email protected] = 14\n\t\t\t# \n\t\t\t# TemplateOptionsPage\n\t\t\t# \n\t\t\tself.@AutoScaleDimensions = System.Drawing.SizeF.new(6f, 13f)\n\t\t\tself.@AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font\n\t\t\[email protected](self.@suffixLbl)\n\t\t\[email protected](self.@suffixTxtBox)\n\t\t\[email protected](self.@prefixLbl)\n\t\t\[email protected](self.@prefixTxtBox)\n\t\t\[email protected](self.@getItFromOnlineBtn)\n\t\t\[email protected](self.@noteTextLbl)\n\t\t\[email protected](self.@noteLbl)\n\t\t\[email protected](self.@openFileDialogBtn)\n\t\t\[email protected](self.@editBtn)\n\t\t\[email protected](self.@fileNameLbl)\n\t\t\[email protected](self.@nameLbl)\n\t\t\[email protected](self.@engineLbl)\n\t\t\[email protected](self.@languageLbl)\n\t\t\[email protected](self.@displayNameTxtbox)\n\t\t\[email protected](self.@fileNameTextbox)\n\t\t\[email protected](self.@newsaveBtn)\n\t\t\[email protected](self.@removeBtn)\n\t\t\[email protected](self.@languageCombox)\n\t\t\[email protected](self.@engineCombox)\n\t\t\[email protected](self.@templateListbox)\n\t\t\[email protected](self.@templatesLbl)\n\t\t\[email protected](self.@topGbx)\n\t\t\tself.@Name = \"TemplateOptionsPage\"\n\t\t\tself.ResumeLayout(false)\n\t\t\tself.PerformLayout()\n\t\tend", "def set_glade_variables(obj = self)\r\n obj.instance_variables.each do |name|\r\n name = name.to_s #ruby 1.9 passes symbol!\r\n v = obj.instance_variable_get(name)\n name = name.gsub('@', '')\r\n if v.is_a?(Array) \r\n v.each_index do |i|\r\n fill_control(\"#{name}[#{i.to_s}]\", v[i] )\r\n end\n elsif v.is_a?(Hash)\n v.each_pair do |key, val|\n fill_control(\"#{name}[#{key.to_s}]\", val)\n end \r\n else\r\n fill_control(name, v)\r\n end\r\n end\r\n end", "def initialize(orientation, label)\n\t\t@gtkLabels = Gtk::Label.new(label.to_s)\n gtkBox = Gtk::Box.new(orientation)\n\t\tgtkBox.pack_end(@gtkLabels, expand:true, fill:false, padding:0)\n\t\t@gtkObject = Gtk::Button.new\n\t\[email protected](gtkBox)\n\tend", "def new\n @widget = Widget.new\n end", "def use_form_generator(fg_klass)\n @@form_generator = fg_klass\n end", "def to_god\n template = ERB.new(File.read(File.join(File.dirname(__FILE__), 'god.erb')))\n template.result(binding)\n end", "def initialize(app)\n super()\n @app = app\n\n self.set_size_request(200, 250)\n self.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)\n\n # Get all components\n @groups = Group.new\n all = ObjectSpace.each_object(Class).select { |k| k < Circuits::Component }\n all.each do |klass|\n next if klass.name.nil?\n names = klass.name.split('::')\n names.shift\n add_to_group(@groups, names, klass)\n end\n\n # The tree view to display everything\n @treeview = Gtk::TreeView.new\n\n # Set up renderer and tree column (we only need 1)\n renderer = Gtk::CellRendererText.new\n column = Gtk::TreeViewColumn.new(\"Component\", renderer)\n column.set_cell_data_func(renderer) do |col, renderer, model, iter|\n renderer.text = iter[0].name\n end\n\n @treeview.append_column(column)\n\n @model = Gtk::TreeStore.new(ListItem)\n\n # Add the components to the model\n add_group(@groups, @model, nil)\n\n @treeview.model = @model\n\n # Add tree view\n self.add(@treeview)\n\n @callbacks = []\n\n # Function to change selection when user clicks on component name\n last = nil\n @treeview.signal_connect('cursor-changed') do |tree, e|\n selection = tree.selection\n iter = selection.selected\n next unless iter\n if iter[0].component == NilClass\n selection.unselect_iter(iter)\n selection.select_iter(last) if last\n else\n last = iter\n @selected = iter[0].component\n @callbacks.each { |cb| cb.call(@selected) }\n #puts \"Selected: #{@selected}\"\n end\n end\n end", "def init_vars\n self.resize(200,250)\n @new_btn = Gtk::Button.new('')\n @default_size_btn = Gtk::Button.new('')\n @quit_btn = Gtk::Button.new('')\n end", "def load(pathname, options={}) #, &block)\n $LEDGER.load(pathname, options)\n end", "def build_example_ui\n ui_class = UIConfig.build_subclass(\"Example UI\")\n\n handler = ContextHandler.new\n handler.context_class = Configurable.build_subclass(\"dummy context\")\n handler.ui_class = ui_class\n handler.plugins = @plugins\n\n handler.backfill_options_to_context\n handler.apply_to_ui\n\n handler.ui_class\n end", "def load\n self.class.load self # pass the loading off to the class\n end", "def load!; end", "def load_helper(name)\n class_name = \"#{name.to_s.capitalize}Helper\".to_sym\n helper = @app.class.const_get(class_name).new\n helper.app = @app if helper.respond_to? :\"app=\"\n helper\n end", "def load; end", "def load; end", "def load; end", "def incorporate\r\n Builder.new(self)\r\n end", "def interactive_generator\n webGui = WebGui.new(\"\")\n webGui.start\nend", "def reload!\n load './lib/try-new-beers/beer_review.rb'\nend", "def dsl(&block)\n Polymer::DSL.build(project_dir, &block)\n end", "def build_widget\r\n Qt::Widget.new do\r\n # Widget Properties\r\n self.window_title = \"QR Generator Qt\"\r\n self.maximum_size = Qt::Size.new(500, 500)\r\n self.minimum_size = Qt::Size.new(300, 400)\r\n\r\n self.resize self.minimum_size\r\n \r\n self.set_window_icon Qt::Icon.new(MAIN_ICON_PATH)\r\n # Widget layout\r\n self.layout = Qt::VBoxLayout.new\r\n end\r\n end", "def load\r\n\t\tload_file\r\n\t\tconfigure\r\n\tend", "def load(name)\n render_rhtml [\"#{name}.rhtml\"]\n return \"\"\n end", "def initialize()\n screen=Gdk::Screen.default\n\t\t#Variable pour resize le texte\n\t\t@pad=screen.height*0.03\n\t\t@police=screen.height*0.02\n win = Gtk::Window.new\n\t\tw=screen.width\n\t\th=screen.height\n win.set_default_size(w/4,h/10)\n win.set_resizable(false)\n\t\twin.window_position= :center_always\n\n\t\t@menu=Gtk::Box.new(:vertical, 25)\n\t\t@gtkObject= Gtk::Table.new(3,3)\n\t\[email protected](@menu,1,2,1,2)\n\n\t\t@buffer = GdkPixbuf::Pixbuf.new(file: File.dirname(__FILE__) + \"/../../../../Assets/Backgrounds/nature.jpg\")\n\t\t@[email protected](w/4,h/10+100)\n\n pb = Text.new(\"Login not found \\n OR \\nwrong password\",@police)\n\t\tpb.colorChange(\"red\")\n @menu.pack_start(pb.gtkObject,expand: false, fill: true, padding: @pad)\n\t\[email protected](Gtk::Image.new(pixbuf: @buffer),0,3,0,3)\n\t\twin.add(@gtkObject)\n\t\twin.show_all\n\n end", "def execute(args)\n # Analyze arguments\n remaining_args = @options.parse(args)\n if @display_help\n puts @options\n elsif (remaining_args.size > 2)\n puts 'Please specify just 1 file to be loaded on startup.'\n puts @options\n else\n activate_log_debug(true) if @debug\n log_info 'Loading GUI libraries...'\n require 'gtk2'\n Gdk::Threads.init\n require 'ruby-serial'\n require 'filesrebuilder/Model/Data'\n require 'filesrebuilder/GUIFactory'\n require 'filesrebuilder/GUIcontroller'\n require 'filesrebuilder/_Gtk/_object'\n require 'rUtilAnts/Platform'\n RUtilAnts::Platform::install_platform_on_object\n gui_factory = GUIFactory.new\n gui_controller = GUIController.new(gui_factory)\n gui_factory.gui_controller = gui_controller\n Gtk::Settings.default.gtk_button_images = true\n log_info 'Executing application...'\n main_widget = gui_factory.new_widget('Main')\n gui_controller.set_main_widget(main_widget)\n main_widget.show\n gui_controller.run_callback_dirline_progress_bars\n gui_controller.load_from_file(remaining_args[0]) if (remaining_args.size == 1)\n Gtk.main\n log_info 'Quitting application...'\n end\n end", "def load!(path)\n comp_name = ComponentWrap.guess_component_name(path, @suffix)\n info \"Loading: #{comp_name} from #{path}\"\n\n begin\n load path\n rescue SyntaxError => e\n error \"Syntax error in #{comp_name}: #{e}\"\n return\n end\n component_wrap = ComponentWrap.from_path(self, path)\n\n if component_wrap\n @loaded_components.push component_wrap\n @bot.include! component_wrap.raw_component\n elsif path.end_with? @suffix\n error \"Can't load: #{path}: it does not define `module #{comp_name}`\"\n else\n error \"Can't load: #{path}: it is not a component file (*#{@suffix})\"\n end\n end", "def loadView\n if iphone_4_inch?\n views = NSBundle.mainBundle.loadNibNamed 'MainView', owner: self, options: nil\n else\n views = NSBundle.mainBundle.loadNibNamed 'MainViewShort', owner: self, options: nil\n end\n self.view = views.first\n end", "def pbItemEditor\n selection = 0\n items = [\n [_INTL(\"Internal Name\"),ReadOnlyProperty,_INTL(\"Internal name that appears in constructs like PBItems::XXX.\")],\n [_INTL(\"Item Name\"),ItemNameProperty,_INTL(\"Name of the item as displayed by the game.\")],\n [_INTL(\"Item Name Plural\"),ItemNameProperty,_INTL(\"Plural name of the item as displayed by the game.\")],\n [_INTL(\"Pocket\"),PocketProperty,_INTL(\"Pocket in the bag where the item is stored.\")],\n [_INTL(\"Purchase price\"),LimitProperty.new(999999),_INTL(\"Purchase price of the item.\")],\n [_INTL(\"Description\"),StringProperty,_INTL(\"Description of the item\")],\n [_INTL(\"Use Out of Battle\"),EnumProperty.new([\n _INTL(\"Can't Use\"),_INTL(\"On a Jermon\"),_INTL(\"Use directly\"),\n _INTL(\"TM\"),_INTL(\"HM\"),_INTL(\"On Jermon reusable\")]),\n _INTL(\"Specifies how this item can be used outside of battle.\")],\n [_INTL(\"Use In Battle\"),EnumProperty.new([\n _INTL(\"Can't Use\"),_INTL(\"On a Jermon\"),_INTL(\"Use directly\"),\n _INTL(\"On Jermon reusable\"),_INTL(\"Use directly reusable\")]),\n _INTL(\"Specifies how this item can be used within a battle.\")],\n [_INTL(\"Special Items\"),EnumProperty.new([\n _INTL(\"None of Below\"),_INTL(\"Mail\"),_INTL(\"Mail with Pictures\"),\n _INTL(\"Snag Ball\"),_INTL(\"Jermo Ball\"),_INTL(\"Plantable Berry\"),\n _INTL(\"Key Item\"),_INTL(\"Evolution Stone\"),_INTL(\"Fossil\"),\n _INTL(\"Apricorn\"),_INTL(\"Type-boosting Gem\"),_INTL(\"Mulch\"),\n _INTL(\"Mega Stone\")]),\n _INTL(\"For special kinds of items.\")],\n [_INTL(\"Machine\"),MoveProperty,_INTL(\"Move taught by this TM or HM.\")]\n ]\n pbListScreenBlock(_INTL(\"Items\"),ItemLister.new(selection,true)){|button,trtype|\n if trtype\n if button==Input::A\n if trtype>=0\n if Kernel.pbConfirmMessageSerious(\"Delete this item?\")\n data = readSerialRecords(\"Data/items.dat\")\n removeConstantValue(PBItems,trtype)\n data.delete_if{|item| item[0]==trtype }\n for x in data\n p x if data[0]==0\n end\n writeSerialRecords(\"Data/items.dat\",data)\n pbSaveItems\n Kernel.pbMessage(_INTL(\"The item was deleted.\"))\n end\n end\n elsif button==Input::C\n selection = trtype\n if selection<0\n newid = pbItemEditorNew(nil)\n if newid>=0\n selection = newid\n end\n else\n data = [getConstantName(PBItems,selection)]\n itemdata = readItemList(\"Data/items.dat\")\n data.push(itemdata[selection][ITEMNAME])\n data.push(itemdata[selection][ITEMPLURAL])\n data.push(itemdata[selection][ITEMPOCKET])\n data.push(itemdata[selection][ITEMPRICE])\n data.push(itemdata[selection][ITEMDESC])\n data.push(itemdata[selection][ITEMUSE])\n data.push(itemdata[selection][ITEMBATTLEUSE])\n data.push(itemdata[selection][ITEMTYPE])\n data.push(itemdata[selection][ITEMMACHINE])\n save = pbPropertyList(data[ITEMNAME],data,items,true)\n if save\n itemdata[selection][ITEMNAME] = data[ITEMNAME]\n itemdata[selection][ITEMPLURAL] = data[ITEMPLURAL]\n itemdata[selection][ITEMPOCKET] = data[ITEMPOCKET]\n itemdata[selection][ITEMPRICE] = data[ITEMPRICE]\n itemdata[selection][ITEMDESC] = data[ITEMDESC]\n itemdata[selection][ITEMUSE] = data[ITEMUSE]\n itemdata[selection][ITEMBATTLEUSE] = data[ITEMBATTLEUSE]\n itemdata[selection][ITEMTYPE] = data[ITEMTYPE]\n itemdata[selection][ITEMMACHINE] = data[ITEMMACHINE]\n writeSerialRecords(\"Data/items.dat\",itemdata)\n pbSaveItems\n end\n end\n end\n end\n }\nend", "def initialize\n super()\n self.name=\"WindowPrincipale\"\n self.move(0,0)\n\n self.fullscreen()\n\n self.set_default_size(Gdk::Screen::width < 3000 ? Gdk::Screen::width : Gdk::Screen::width/2,Gdk::Screen::height)\n self.set_resizable(false)\n self.set_title(\"Jeu Hashi\")\n self.window_position=Gtk::WindowPosition::CENTER\n\n css=Gtk::CssProvider.new\n css.load(path: \"#{$cheminRacineHashi}/src/Interface/css/style.css\")\n #inversez les commentaires pour\n #css.load(path: \"/home/hashiwokakero/Hashi/Interface/css/style.css\")\n Gtk::StyleContext::add_provider_for_screen(Gdk::Screen.default,css,\n Gtk::StyleProvider::PRIORITY_APPLICATION)\n\n self.signal_connect('destroy') {\n Gtk.main_quit\n }\n\n self.add(FenetreMenu.new(self))\n\n\n self.show_all\n Gtk.main\n end", "def sauvegarder(unNom)\n\t\tif nbSaves() >= 8\n\t\t\tdialog = Gtk::Dialog.new(\"Alerte\",\n \t $main_application_window,\n \t :destroy_with_parent,\n \t [ Gtk::Stock::OK, :none ])\n \t\t\tdialog.set_window_position(:center_always)\n\n \t # Ensure that the dialog box is destroyed when the user responds.\n \t dialog.signal_connect('response') { dialog.destroy }\n\n \t # Add the message in a label, and show everything we've added to the dialog.\n \t dialog.child.add(Gtk::Label.new( \"\\nImpossible:nombre maximum de sauvegardes atteint (8/8)!\\n\" ))\n \t dialog.show_all\n\t\telse\n\t\t\t# Serialisation des différentes classes\n\t\t\thypo = @hypo.to_yaml()\n\n\t\t\t# Ecriture dans le fichier\n\t\t\tmonFichier = File.open(\"../sauvegardes/\"+unNom, \"w\")\n\t\t\tmonFichier.write(hypo)\n\t\t\tmonFichier.write(\"***\\n\")\n\t\t\tmonFichier.write(@pseudo)\n\t\t\tmonFichier.write(\"\\n***\\n\")\n\t\t\tmonFichier.write(@inc)\n\t\t\tmonFichier.write(\"\\n***\\n\")\n\t\t\tmonFichier.write(@time)\n\t\t\tmonFichier.write(\"\\n***\\n\")\n\t\t\tmonFichier.write(@cheminMap)\n\t\t\tmonFichier.write(\"\\n***\\n\")\n\t\t\tmonFichier.write(@nbHypo)\n\t\t\tmonFichier.write(\"\\n***\\n\")\n\n\t\t\t# Fermeture du fichier\n\t\t\tmonFichier.close\n\t\tend\n\tend", "def initialize\n @plugboard = eval(File.read(\"./parts/plugboard\"))\n end", "def edit_form\n parsed = Namae::Name.parse(current_user.name)\n generic_file = ::GenericFile.new(creator: [parsed.sort_order], title: @batch.generic_files.map(&:label))\n edit_form_class.new(generic_file)\n end", "def initialize(options)\n @scaffold_name = to_underscore(options[:scaffold_name])\n @model_class = @scaffold_name.split('_').map(&:capitalize).join('')\n @project_name = options[:project_name]\n @project_class = @project_name.split('_').map(&:capitalize).join('')\n @arguments = options[:arguments]\n @attributes, @data_types = [],[]\n path = `gem which rammer`\n @gem_path = path.split($gem_file_name,2).first + $gem_file_name\n @valid = false\n end", "def main\n\tbaseURL = \"growl://plugin/preview/\"\n\tbundleIDs = [\n\t\t\"com.Growl.WebKit.Dangerous\",\n\t\t\"com.Growl.Bezel\",\n\t\t\"com.Growl.Brushed\",\n\t\t\"com.Growl.Bubbles\",\n\t\t\"com.Growl.WebKit.Candybars\",\n\t\t\"com.Growl.WebKit.Crystal\",\n\t\t\"com.Growl.WebKit.Darkroom\",\n\t\t\"com.Growl.WebKit.Garageband\",\n\t\t\"com.Growl.iCal\",\n\t\t\"com.Growl.MusicVideo\",\n\t\t\"com.Growl.Nano\",\n\t\t\"com.Growl.WebKit.NotifyOS9\",\n\t\t\"com.Growl.WebKit.NotifyOSX\",\n\t\t\"com.Growl.WebKit.Plain\",\n\t\t\"com.Growl.WebKit.Pseudo-Coda\",\n\t\t\"com.Growl.WebKit.Raaarr\",\n\t\t\"com.Growl.Smoke\",\n\t\t\"com.Growl.WebKit.Starwl\",\n\t\t\"com.Growl.WebKit.Whiteboard\"\n\t]\n\n\tbundleIDs.each do |value|\n\t\t#puts(\"testing #{value}\")\n\t\tsystem(\"open\", \"#{baseURL}#{value}\")\n\tend\nend", "def override_class_form\n unless File.exists?(\"app/views/admin/#{@plural_name}/_form.html.erb\")\n run \"rake refinery:override view=admin/#{@plural_name}/_form\"\n end\n end", "def generate\n widgets = {}\n self.widgets.each do |name|\n config = self.process_config(name)\n widgets[name] = WidgetStructure.new(\n name,\n config,\n self.process_javascripts(config, name),\n self.process_layout(config, name)\n )\n end\n Ruhoh::Utils.report('Widgets', widgets, [])\n\n widgets\n end", "def reload! view: nil\n ensure_service!\n @view = view || @view\n @grpc = service.get_schema name, @view\n @reference = nil\n @exists = nil\n self\n end", "def InitializeComponent()\n\t\t\tresources = System.ComponentModel.ComponentResourceManager.new(AboutBox.to_clr_type)\n\t\t\tself.@dotNetVersionLabel = System.Windows.Forms.Label.new()\n\t\t\tself.@clrTypeLabel = System.Windows.Forms.Label.new()\n\t\t\tself.@copyright = System.Windows.Forms.Label.new()\n\t\t\tself.@label7 = System.Windows.Forms.Label.new()\n\t\t\tself.@label6 = System.Windows.Forms.Label.new()\n\t\t\tself.@label5 = System.Windows.Forms.Label.new()\n\t\t\tself.@label4 = System.Windows.Forms.Label.new()\n\t\t\tself.@infoLinkLabel = System.Windows.Forms.LinkLabel.new()\n\t\t\tself.@label3 = System.Windows.Forms.Label.new()\n\t\t\tself.@label2 = System.Windows.Forms.Label.new()\n\t\t\tself.@versionLabel = System.Windows.Forms.Label.new()\n\t\t\tself.@label1 = System.Windows.Forms.Label.new()\n\t\t\tself.@OkButton = System.Windows.Forms.Button.new()\n\t\t\tself.SuspendLayout()\n\t\t\t# \n\t\t\t# dotNetVersionLabel\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(157, 264)\n\t\t\[email protected] = \"dotNetVersionLabel\"\n\t\t\[email protected] = System.Drawing.Size.new(284, 23)\n\t\t\[email protected] = 25\n\t\t\t# \n\t\t\t# clrTypeLabel\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(24, 264)\n\t\t\[email protected] = \"clrTypeLabel\"\n\t\t\[email protected] = System.Drawing.Size.new(102, 15)\n\t\t\[email protected] = 24\n\t\t\[email protected] = \"CLR Version:\"\n\t\t\t# \n\t\t\t# copyright\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(157, 12)\n\t\t\[email protected] = \"copyright\"\n\t\t\[email protected] = System.Drawing.Size.new(297, 84)\n\t\t\[email protected] = 23\n\t\t\[email protected] = \"Copyright (C) 2009-2012 Tom Deng\\r\\nAll Rights Reserved.\"\n\t\t\t# \n\t\t\t# label7\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(24, 12)\n\t\t\[email protected] = \"label7\"\n\t\t\[email protected] = System.Drawing.Size.new(102, 28)\n\t\t\[email protected] = 22\n\t\t\[email protected] = \"Copyright:\"\n\t\t\t# \n\t\t\t# label6\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(157, 192)\n\t\t\[email protected] = \"label6\"\n\t\t\[email protected] = System.Drawing.Size.new(215, 29)\n\t\t\[email protected] = 21\n\t\t\[email protected] = \"Emil Song,Richard Li\"\n\t\t\t# \n\t\t\t# label5\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(24, 192)\n\t\t\[email protected] = \"label5\"\n\t\t\[email protected] = System.Drawing.Size.new(102, 29)\n\t\t\[email protected] = 20\n\t\t\[email protected] = \"Thanks to:\"\n\t\t\t# \n\t\t\t# label4\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(24, 104)\n\t\t\[email protected] = \"label4\"\n\t\t\[email protected] = System.Drawing.Size.new(102, 16)\n\t\t\[email protected] = 19\n\t\t\[email protected] = \"Information:\"\n\t\t\t# \n\t\t\t# infoLinkLabel\n\t\t\t# \n\t\t\[email protected] = System.Windows.Forms.LinkArea.new(0, 48)\n\t\t\[email protected] = System.Drawing.Point.new(157, 104)\n\t\t\[email protected] = \"infoLinkLabel\"\n\t\t\[email protected] = System.Drawing.Size.new(266, 16)\n\t\t\[email protected] = 18\n\t\t\[email protected] = true\n\t\t\[email protected] = \"http://www.dengzhiwei.com/category/codebuilder\\r\\n\"\n\t\t\[email protected] { |sender, e| self.@infoLinkLabel_LinkClicked(sender, e) }\n\t\t\t# \n\t\t\t# label3\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(157, 136)\n\t\t\[email protected] = \"label3\"\n\t\t\[email protected] = System.Drawing.Size.new(287, 48)\n\t\t\[email protected] = 17\n\t\t\[email protected] = \"Tom Deng,Peter Chen,Gallop Chen,Taven Li,Chanle Chen\"\n\t\t\t# \n\t\t\t# label2\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(24, 136)\n\t\t\[email protected] = \"label2\"\n\t\t\[email protected] = System.Drawing.Size.new(102, 29)\n\t\t\[email protected] = 16\n\t\t\[email protected] = \"Developers:\"\n\t\t\t# \n\t\t\t# versionLabel\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(157, 232)\n\t\t\[email protected] = \"versionLabel\"\n\t\t\[email protected] = System.Drawing.Size.new(156, 23)\n\t\t\[email protected] = 15\n\t\t\[email protected] = \"1.0.11.1210\"\n\t\t\t# \n\t\t\t# label1\n\t\t\t# \n\t\t\[email protected] = System.Drawing.Point.new(24, 232)\n\t\t\[email protected] = \"label1\"\n\t\t\[email protected] = System.Drawing.Size.new(102, 15)\n\t\t\[email protected] = 14\n\t\t\[email protected] = \"Version:\"\n\t\t\t# \n\t\t\t# OkButton\n\t\t\t# \n\t\t\[email protected] = System.Windows.Forms.DialogResult.Cancel\n\t\t\[email protected] = System.Drawing.Point.new(361, 296)\n\t\t\[email protected] = \"OkButton\"\n\t\t\[email protected] = System.Drawing.Size.new(96, 29)\n\t\t\[email protected] = 13\n\t\t\[email protected] = \"OK\"\n\t\t\[email protected] { |sender, e| self.@OkButton_Click(sender, e) }\n\t\t\t# \n\t\t\t# AboutBox\n\t\t\t# \n\t\t\tself.@AcceptButton = self.@OkButton\n\t\t\tself.@AutoScaleDimensions = System.Drawing.SizeF.new(6f, 13f)\n\t\t\tself.@AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font\n\t\t\tself.@CancelButton = self.@OkButton\n\t\t\tself.@ClientSize = System.Drawing.Size.new(480, 336)\n\t\t\[email protected](self.@dotNetVersionLabel)\n\t\t\[email protected](self.@clrTypeLabel)\n\t\t\[email protected](self.@copyright)\n\t\t\[email protected](self.@label7)\n\t\t\[email protected](self.@label6)\n\t\t\[email protected](self.@label5)\n\t\t\[email protected](self.@label4)\n\t\t\[email protected](self.@infoLinkLabel)\n\t\t\[email protected](self.@label3)\n\t\t\[email protected](self.@label2)\n\t\t\[email protected](self.@versionLabel)\n\t\t\[email protected](self.@label1)\n\t\t\[email protected](self.@OkButton)\n\t\t\tself.@FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle\n\t\t\tself.@Icon = ((resources.GetObject(\"$this.Icon\")))\n\t\t\tself.@MaximizeBox = false\n\t\t\tself.@MinimizeBox = false\n\t\t\tself.@Name = \"AboutBox\"\n\t\t\tself.@ShowInTaskbar = false\n\t\t\tself.@StartPosition = System.Windows.Forms.FormStartPosition.CenterParent\n\t\t\tself.@Text = \"About CodeBuilder\"\n\t\t\tself.ResumeLayout(false)\n\t\tend", "def new\n @herbarium = Herbarium.new\n end", "def copy_form_builders\n directory \"f3-rails/app/form_builders\", \"app/form_builders\"\n end", "def jmaki_load_widget(name)\n # Return previously parsed content (if any)\n if !@jmaki_widgets\n @jmaki_widgets = { }\n end\n previous = @jmaki_widgets[name]\n if previous\n return previous\n end\n content = \"\"\n filename = JMAKI_RESOURCES + name.tr('.', '/') + \"/widget.json\"\n File.open(filename, \"r\") do |file|\n while line = file.gets(nil)\n content += line\n end\n end\n current = jmaki_parse_json(content, filename)\n @jmaki_widgets[name] = current\n current\n end", "def new\n @liga_blaz_blue_general = LigaBlazBlueGeneral.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @liga_blaz_blue_general }\n end\n end", "def builder; end", "def builder; end" ]
[ "0.65036833", "0.63665056", "0.62790495", "0.5906967", "0.58494174", "0.57898813", "0.5715965", "0.5667131", "0.5645705", "0.54957974", "0.54114354", "0.5390123", "0.53220713", "0.5286374", "0.5190307", "0.5190307", "0.51136684", "0.5104905", "0.5052585", "0.50520974", "0.5016087", "0.50141233", "0.49425307", "0.49355164", "0.49314362", "0.49282384", "0.48945624", "0.48908707", "0.48908707", "0.48908707", "0.48679206", "0.48475435", "0.48443118", "0.48270813", "0.48211375", "0.48157588", "0.48034197", "0.47852498", "0.47821444", "0.47647253", "0.47628632", "0.4758177", "0.47548112", "0.47399116", "0.47390085", "0.47247675", "0.4713321", "0.47127396", "0.47109246", "0.47109246", "0.4693733", "0.46879363", "0.46872896", "0.46667147", "0.4650983", "0.46411386", "0.46323714", "0.46148527", "0.46143112", "0.46133664", "0.46079773", "0.45770407", "0.45673108", "0.45586753", "0.45503354", "0.45456794", "0.45455265", "0.45436624", "0.4543138", "0.453243", "0.453243", "0.453243", "0.453159", "0.45228237", "0.45186397", "0.4513951", "0.45090622", "0.45055455", "0.45048624", "0.45038447", "0.449969", "0.44901404", "0.44875225", "0.4482158", "0.44803444", "0.44771975", "0.44721124", "0.44702488", "0.44691366", "0.44691274", "0.44565463", "0.44520524", "0.44488823", "0.44454235", "0.4445261", "0.44433278", "0.44399756", "0.44355756", "0.443471", "0.443471" ]
0.88080204
0
Connects gtk's signals to your methods according to the naming convention widget__signal. For example, when you place a button called "button1" in your glade form, and declare a method called "button1__clicked", they aren't connected to each other. Clicking on the button does nothing and the method never gets called. After running parse_signals(), the "clicked" signal is connected to the method named "button1__clicked" so when the user clicks the button, the method is called.
def parse_signals() meths = self.class.instance_methods() meths.each do |meth| meth = meth.to_s #bug fix ruby 1.9 gives stmbol glade_name, signal_name = *(meth.split("__")) next if (signal_name.to_s == "" or glade_name.to_s == "") #covers nil if @builder @builder.objects.each do |obj| next unless obj.respond_to?(:builder_name) if obj.builder_name == glade_name or obj.builder_name =~ /^(?:#{class_name(self)}\.|)#{glade_name}\[[a-zA-Z\d_-]+\]$/ #arrays obj.signal_connect(signal_name) { |*args| method(meth.to_sym).call(*args) } end end end obj = glade_name == "self" ? self : self.instance_variable_get("@" + glade_name) obj ||= eval(glade_name) if respond_to?(glade_name) and method(glade_name.to_sym).arity == 0 # no arguments! if obj.respond_to?("signal_connect") obj.signal_connect(signal_name) { |*args| method(meth.to_sym).call(*args) } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect_signals\n @glade['drawingarea'].signal_connect('expose_event') { print }\n @glade['eventbox'].events = Gdk::Event::BUTTON_PRESS_MASK\n @glade['eventbox'].signal_connect('button_press_event') {|w, e| add_point(Point[e.x.to_i, e.y.to_i])}\n @glade['mainwindow'].signal_connect('destroy'){Gtk.main_quit} \n end", "def declare_signals\n self.signal_connect(:delete_event){finish_commands}\n @new_btn.signal_connect(:clicked){finish_commands}\n @quit_btn.signal_connect(:clicked){Gtk.main_quit}\n @idiom_rdo[0].signal_connect(:clicked){\n change_idiom_to(:en)\n self.create_texts\n }\n @idiom_rdo[1].signal_connect(:clicked){\n change_idiom_to(:pt_br)\n self.create_texts\n }\n @idiom_rdo[2].signal_connect(:clicked){\n change_idiom_to(:es)\n self.create_texts\n }\n end", "def declare_signals\n self.signal_connect(:delete_event){Gtk.main_quit}\n @new_btn.signal_connect(:clicked){\n $glob.num_moves = -1\n $glob.btns.each{|btn| btn.label_widget.set_markup($glob.null_markup)}\n $windows.opt.show_all\n }\n @quit_btn.signal_connect(:clicked){Gtk.main_quit}\n @default_size_btn.signal_connect(:clicked){self.resize(200,250)}\n end", "def declare_signals\n self.signal_connect(:clicked){|choiced|\n click_used = false\n if choiced.label_widget.markup == $glob.null_markup\n if $player.act_p.human?\n $last_btn = choiced\n $glob.num_moves += 1\n choiced.label_widget.set_markup($player.act_p.mark_markup)\n $player.switch_player\n click_used = true\n check_victory\n end\n if !$player.act_p.human? and click_used and $glob.num_moves < 8\n choiced = $player.act_p.turn\n $last_btn = choiced\n choiced.label_widget.set_markup($player.act_p.mark_markup)\n $player.switch_player\n check_victory\n end\n end\n } \n end", "def greatk_handler(m, *args, &block)\r\n\r\n if m.is_a? Method\r\n m_sym = m.name\r\n else # Assume m is Symbol\r\n m_sym = m\r\n m = nil\r\n end\r\n m_str = m_sym.to_s\r\n if @greatk_active\r\n if m_str[0..2] == \"on_\"\r\n # If method starts with \"on_\"\r\n # interpret it as a signal\r\n signal = m_str[3..-1]\r\n @greatk_active = false\r\n res = self.send(:signal_connect, signal, *args, &block)\r\n @greatk_active = true\r\n return res\r\n elsif m_str.upcase[0] == m_str[0]\r\n # -- Child widget instantiation --\r\n # If first letter is uppercase\r\n # assume it's a class name and\r\n # instantiate it as a child widget\r\n klass = Kernel.const_get(m_sym)\r\n if not klass <= Widget\r\n puts \"Warning: #{klass} is not a widget\"\r\n return klass\r\n end\r\n if args[0].is_a? Symbol\r\n child_name = args.shift\r\n end\r\n # Initialize child widget\r\n child = klass.new(*args)\r\n child.name = child_name\r\n child.greatk_run(block, @root)\r\n child.show\r\n child.hide if child.instance_variable_get(:@hidden)\r\n # Disable greatk and call original adder method\r\n @greatk_active = false\r\n res = @greatk_add_meth.call(child, *@greatk_add_args) \r\n @greatk_active = true\r\n return res\r\n elsif @greatk_add_methods.include? m_sym\r\n # Mark the add method to be used for next child-widget instantiation\r\n @greatk_add_meth = m\r\n @greatk_add_args = args\r\n return nil\r\n elsif m_set_str = 'set_'+m_str and \r\n self.respond_to?(m_set_str)\r\n # --\r\n m = self.method(m_set_str)\r\n @greatk_active = false\r\n res = m.call(*args)\r\n @greatk_active = true\r\n return res\r\n end\r\n end # @greatk_active\r\n\r\n # If we got here, the call was not handled by greatk\r\n if m\r\n greatk_was_active = @greatk_active\r\n @greatk_active = false\r\n res = m.call(*args, &block)\r\n @greatk_active = greatk_was_active\r\n return res\r\n else\r\n raise NoMethodError, \"undefined method '#{m_str}' for #{self.class}\"\r\n end\r\n\r\n end", "def signal_connect(signal, &block)\n __internal_signal_connect(widget, signal, &block)\n end", "def setup_signals; end", "def connect_signals\n add_events Gdk::Event::BUTTON_PRESS_MASK\n signal_connect('button_press_event') do |w, e|\n begin_move_drag e.button, e.x_root, e.y_root, e.time\n end\n signal_connect('delete-event') { Gtk.main_quit }\n @tagbox.signal_connect('activate') do |w|\n if @scroller_thr\n @scroller_thr.kill\n @picturebox.children.each { |child| @picturebox.remove child }\n @combined_size = 0\n GC.start\n end\n\n size = if @size_used == :tiny || @size_used == :small\n :thumb\n else\n :small\n end\n @scroller = Scroller.new(w.text.strip, size)\n @scroller.add_observer self\n Thread.abort_on_exception = true\n @scroller_thr = Thread.new(@scroller) { |scroller| @scroller.scroll }\n @interactionbox.visible = false\n @waitingbox.visible = true\n @infolabel.text = ''\n end\n signal_connect('enter_notify_event') { |w, e| grab_focus }\n signal_connect('expose-event') do |w, e|\n cr = w.window.create_cairo_context\n cr.set_operator Cairo::OPERATOR_SOURCE\n cr.set_source_rgba 0.0, 0.0, 0.0, 0.85\n cr.paint\n false\n # cr\n end\n\n signal_connect('screen-changed') { |w, e| screen_changed w }\n end", "def register_signal_handlers\n end", "def declare_signals\n self.signal_connect(:delete_event){\n $glob.num_moves = -1\n $glob.btns.each{|btn| btn.label_widget.set_markup($glob.null_markup)}\n $windows.opts_win.show_all\n self.hide\n }\n end", "def isolate_signals; end", "def declare_signals\n self.signal_connect(:clicked){\n self.group.each{|rd_btn| \n if rd_btn.selected?\n rd_btn.selected = false\n end \n }\n @selected = true\n }\n end", "def isolate_signals=(_arg0); end", "def method_missing(sym,*args, &block)\n if sym.to_s.match(/^(on|before|after)_/)\n register_handler(sym.to_s,args.first,&block)\n else\n super\n end\n end", "def method_missing(sym,*args, &block)\n if sym.to_s.match(/^(on|before|after)_/)\n register_handler(sym.to_s,args.first,&block)\n else\n super\n end\n end", "def signal_handler(signal)\n @signal_handlers[canonicalize_signal(signal)]\n end", "def call_signals(scope, type, *args)\n @signals.each do |set|\n proc = set[type.to_sym]\n #proc.call(*args) if proc\n scope.instance_exec(*args, &proc) if proc\n end\n end", "def wire_widget\r\n # Add listeners\r\n @query_button.connect(SIGNAL :clicked) do\r\n gen_qr_code @data_edit.text\r\n end\r\n @quit_button.connect(SIGNAL :clicked) do\r\n QRAppQt.quit\r\n end\r\n\r\n # Add pixmap to label\r\n @qr_img_label.set_pixmap(@qr_img)\r\n\r\n # Set default button\r\n @query_button.set_default(true)\r\n end", "def set_signal_handler(signal, handler)\n check_definition_state(is_method: true)\n if !handler.is_a?(::Proc) && !handler.is_a?(::Symbol) && !handler.nil?\n raise ToolDefinitionError, \"Signal handler must be a proc or symbol\"\n end\n signal = canonicalize_signal(signal)\n @signal_handlers[signal] = handler\n end", "def signal_received=(_arg0); end", "def register_signal_handlers\n HANDLED_SIGNALS.each do |sig|\n if ::Signal.list.include? sig.to_s\n trap(sig) { Thread.main[:signal_queue] << sig ; notice_signal }\n end\n end\n end", "def callback(widget)\n # Display the 'label' property of the widget.\n # Refer to the API reference for more information.\n puts \"Hello again - #{widget.label}(#{widget}) was pressed.\"\nend", "def buttons; end", "def init_gui\r\n pathFile = \"\"\r\n pathCreate = \"\"\r\n fixed = Gtk::Fixed.new\r\n add fixed\r\n label = Gtk::Label.new(\"Xml - File Path:\")\r\n label.set_size_request 100,30\r\n button = Gtk::FileChooserButton.new(\"Search\", Gtk::FileChooser::ACTION_OPEN)\r\n button.set_size_request 280,30\r\n filter = Gtk::FileFilter.new\r\n filter.add_pattern('*.xml')\r\n button.add_filter(filter)\r\n button.signal_connect('selection_changed') do |w|\r\n pathFile = w.filename.to_s\r\n arrayPath = pathFile.split('\\\\')\r\n pathCreate = \"\"\r\n for i in 0..arrayPath.length-2\r\n pathCreate+=arrayPath[i]+\"\\\\\"\r\n end\r\n pathCreate+=\"files\\\\\"\r\n end\r\n labelDB = Gtk::Label.new(\"Name Database:\")\r\n entryDB = Gtk::Entry.new\r\n entryDB.set_width_chars 45\r\n entryDB.set_text \"\"\r\n labelDBServer = Gtk::Label.new(\"Server Database:\")\r\n entryDBServer = Gtk::Entry.new\r\n entryDBServer.set_width_chars 45\r\n entryDBServer.set_text \"\"\r\n labelDBUser = Gtk::Label.new(\"User Database:\")\r\n entryDBUser = Gtk::Entry.new\r\n entryDBUser.set_width_chars 45\r\n entryDBUser.set_text \"\"\r\n labelDBPass = Gtk::Label.new(\"Pass Database:\")\r\n entryDBPass = Gtk::Entry.new\r\n entryDBPass.set_width_chars 45\r\n entryDBPass.visibility = false\r\n entryDBPass.invisible_char = 42\r\n labelEmail = Gtk::Label.new(\"Admin Email:\")\r\n entryEmail = Gtk::Entry.new\r\n entryEmail.set_width_chars 45\r\n entryEmail.set_text \"\"\r\n btGenerate = Gtk::Button.new \"Generate\"\r\n btGenerate.signal_connect \"clicked\" do\r\n if pathFile == \"\" or pathCreate == \"\"\r\n showMessage(\"Debe seleccionar el archivo de origen\",Gtk::MessageDialog::ERROR,self)\r\n elsif entryDB.text.strip == \"\"\r\n showMessage(\"Debe Ingresar el nombre de la base de datos\",Gtk::MessageDialog::ERROR,self)\r\n elsif entryDBServer.text.strip == \"\"\r\n showMessage(\"Debe Ingresar el servidor de la base de datos\",Gtk::MessageDialog::ERROR,self)\r\n elsif entryDBUser.text.strip == \"\"\r\n showMessage(\"Debe Ingresar el nombre de usuario de la base de datos\",Gtk::MessageDialog::ERROR,self)\r\n elsif entryEmail.text.strip == \"\"\r\n showMessage(\"Debe Ingresar el email del administrador\",Gtk::MessageDialog::ERROR,self)\r\n else\r\n readPollFileXml(pathFile,pathCreate,entryDB.text.strip, entryDBServer.text.strip,entryDBUser.text.strip,entryDBPass.text.strip,entryEmail.text.strip)\r\n showMessage(\"Se ha creado el formulario Satisfactoriamente en la ruta: \"+pathCreate,Gtk::MessageDialog::INFO,self)\r\n Gtk.main_quit\r\n end\r\n end\r\n btCancel = Gtk::Button.new \"Cancel\"\r\n btCancel.signal_connect \"clicked\" do\r\n Gtk.main_quit\r\n end\r\n fixed.put label,10,10\r\n fixed.put labelDB,15,58\r\n fixed.put labelDBServer,15,103\r\n fixed.put labelDBUser,24,148\r\n fixed.put labelDBPass,24,193\r\n fixed.put labelEmail,30,238\r\n fixed.put button,105,10\r\n fixed.put entryDB,105,55\r\n fixed.put entryDBServer,105,100\r\n fixed.put entryDBUser,105,145\r\n fixed.put entryDBPass,105,190\r\n fixed.put entryEmail,105,235\r\n fixed.put btGenerate,145,275\r\n fixed.put btCancel,205,275\r\n end", "def add_custom_handlers\n # Set up hooks\n @irc.on_msg self.method(:_in_msg)\n @irc.on_act self.method(:_in_act)\n @irc.on_invite self.method(:_in_invited)\n @irc.on_kick self.method(:_in_kick)\n @irc.saying_join self.method(:_out_join)\n end", "def on_button_down( button_id )\n end", "def register_handlers\n @driver.on(:open, &method(:on_open))\n @driver.on(:message, &method(:on_message))\n @driver.on(:close, &method(:on_close))\n end", "def get_signals\n\t\t\tall_signals = []\n\t\t\tcurrent = @klass\n\t\t\twhile current != Qt::Base\n\t\t\t\tmeta = Meta[current.name]\n\t\t\t\tif !meta.nil?\n\t\t\t\t\tall_signals.concat meta.signals\n\t\t\t\tend\n\t\t\t\tcurrent = current.superclass\n\t\t\tend\n\t\t\treturn all_signals\n\t\tend", "def initialize(dbpage)\n @dbpage = dbpage\n @dbconn = @dbpage.dbconn\n\n @gui = Gtk::Builder.new\n @gui.add(\"#{File.dirname(__FILE__)}/ui/win_runsql.ui\")\n @gui.connect_signals { |handler| method(handler) }\n\n @cb_type = @gui[:cbType]\n combobox_init(@cb_type)\n @cb_type.get_model.append([\"Auto\"])\n @cb_type.get_model.append([\"One-liners\"])\n @cb_type.get_model.append([\"phpMyAdmin dump\"])\n @cb_type.set_active(0)\n\n @window = @gui[:window]\n winsetting = GtkSettingsWindow.new(@window, \"win_runsql\")\n @window.show_all\n end", "def command *args, &block\n if event? :PRESS\n bind :PRESS, *args, &block\n else\n bind :CHANGED, *args, &block\n end\n end", "def initialize\n @gui = Gtk::Builder.new\n @gui.add(\"#{File.dirname(__FILE__)}/ui/main.ui\")\n @gui.connect_signals { |handler| method(handler) }\n\n @window = @gui[:window]\n winsetting = GtkSettingsWindow.new(@window, \"win_main\")\n\n @nb_dbs = @gui[:nbDbs]\n @nb_dbs.connect_after(\"switch-page\", [self, \"ChangeActiveDB\"])\n\n @window.show_all\n end", "def load_glade() \r\n caller__FILE__ = my_class_file_path() \r\n file_name = File.join(File.split(caller__FILE__)[0] , \"glade\", class_name(self) + \".glade\")\r\n @builder = Gtk::Builder.new\r\n @builder << file_name\r\n @builder.connect_signals{ |handle| method(handle) }\r\n end", "def signal_received; end", "def _button_2_command(*args)\n\n end", "def _button_2_command(*args)\n\n end", "def signal\n end", "def handler(event, *meths)\n meths.each do |meth|\n events[event.to_sym] ||= []\n events[event.to_sym] << {type: :method, method: meth.to_sym}\n end\n self\n end", "def button_down; end", "def menu_refresh\n @refresh_signals.each do |signal|\n signal.call\n end\n end", "def menu_refresh\n @refresh_signals.each do |signal|\n signal.call\n end\n end", "def method_missing(method_name, *args, &block)\n _, event_name, callback_name = *method_name.to_s.match(/^(\\w*?on_\\w+?)_(\\w+)$/)\n if callback_names.include?(callback_name.to_sym)\n public_send(event_name, :\"#{callback_name}\", *args, &block)\n else\n super\n end\n end", "def method_missing(method_name, *args, &block)\n _, event_name, callback_name = *method_name.to_s.match(/^(\\w*?on_\\w+?)_(\\w+)$/)\n if callback_names.include?(callback_name.to_sym)\n public_send(event_name, :\"#{callback_name}\", *args, &block)\n else\n super\n end\n end", "def command *args, &block\n if event? :PRESS\n bind_event :PRESS, *args, &block\n else\n bind_event :CHANGED, *args, &block\n end\n end", "def button_clicked (parent, btt)\n dialog = Gtk::FileChooserDialog.new(\n \"Save File As ...\",\n parent,\n Gtk::FileChooser::ACTION_SAVE,\n nil,\n [ Gtk::Stock::CANCEL, Gtk::Dialog::RESPONSE_CANCEL ],\n [ Gtk::Stock::SAVE, Gtk::Dialog::RESPONSE_ACCEPT ]\n )\n dialog.signal_connect('response') do |w, r|\n odg = case r\n when Gtk::Dialog::RESPONSE_ACCEPT\n filename = dialog.filename\n btt.label = filename\n \"'ACCEPT' (#{r}) button pressed -- filename is {{ #{filename} }}\"\n when Gtk::Dialog::RESPONSE_CANCEL; \"'CANCEL' (#{r}) button pressed\"\n else; \"Undefined response ID; perhaps Close-x? (#{r})\"\n end\n puts odg\n dialog.destroy \n end\n dialog.run\nend", "def clicked;end", "def method_missing(method_name, *args, &block)\n _, event_name, callback_name = *method_name.to_s.match(/^(\\w*?on_\\w+?)_(\\w+)$/)\n if callback_name && callback_names.include?(callback_name.to_sym)\n public_send(event_name, :\"#{callback_name}\", *args, &block)\n else\n super\n end\n end", "def button_up(id); end", "def trap_signals\n trap(:QUIT) { @signals << :QUIT }\n trap(:EXIT) { @signals << :EXIT }\n end", "def trap_signals\n trap(:QUIT) { @signals << :QUIT }\n trap(:EXIT) { @signals << :EXIT }\n end", "def listenerBouton \n @chaine = \" \"\n @b.signal_connect('clicked'){ \n @chaine = @nom.filename\n if (@chaine ==\"\") #gestion saisie vide\n m = Gtk::MessageDialog.new(Gtk::Window.new, Gtk::Dialog::DESTROY_WITH_PARENT,\n\t\t\t Gtk::MessageDialog::ERROR,\n\t\t\t Gtk::MessageDialog::BUTTONS_CLOSE,\n\t\t\t \"Erreur : Veuillez saisir un fichier ou dossier !\")\n\t m.run\n\t m.destroy \n else\n if(File.directory?(@chaine)) #si c'est un dossier -> utilisation du controleur adéquat\n @ctrl.recupUrlsDoss(@chaine)\n else\n \tif(File.exist?(@chaine)) #si c'est un fichier -> existant utilisation du controleur adéquat\n if(File.extname(@chaine)== \".txt\" || File.extname(@chaine)== \".html\" )\n \t @ctrl.recupUrls(@chaine)\n else\n i = Gtk::MessageDialog.new(Gtk::Window.new, Gtk::Dialog::DESTROY_WITH_PARENT,\n Gtk::MessageDialog::ERROR,\n Gtk::MessageDialog::BUTTONS_CLOSE,\n \"Erreur : fichier extension invalide !\") \n i.run\n i.destroy \n end\n \telse #gestion saisie invalide\n \t d = Gtk::MessageDialog.new(Gtk::Window.new, Gtk::Dialog::DESTROY_WITH_PARENT,\n \t\t\t Gtk::MessageDialog::ERROR,\n \t\t\t Gtk::MessageDialog::BUTTONS_CLOSE,\n \t\t\t \"Erreur : Fichier ou dossier inexistant !\")\n \t d.run\n \t d.destroy \n\t end\n end\n end\n }\n end", "def set_functions\n super\n # Click the submit button, wait until a message appears, and return the message text.\n function(:save_record) {submit_button.click ; message.wait_until_present ; message.text.strip}\n # Links for Holdings and Item Records - Pass a human-readable (1-based) variable to determine which instance of each link should be used.\n # e.g., holdings_link(1) will return the first holdings link, holdings_link(2) will return the second.\n function(:holdings_link) {|which = 1| b.span(:xpath => \"//div[@id='holdingsItemTree_tree']/ul[@class='jstree-no-icons']/li[#{which}]/a/span[@class='uif-message']\")}\n function(:holdings_icon) {|which = 1| b.ins(:xpath => \"//div[@id='holdingsItemTree_tree']/ul[@class='jstree-no-icons']/li[#{which}]/ins\")}\n # This function takes two arguments - the first is the holdings element to which it belongs, and the second is its position.\n # e.g., item_link(1,1) will return the first item under the first holdings link, item_link(2,2) will return the second item under the second holdings link.\n function(:item_link) {|which_holdings = 1, which_item = 1| b.a(:xpath => \"//div[@id='holdingsItemTree_tree']/ul[@class='jstree-no-icons']/li[#{which_holdings}]/ul/li[#{which_item}]/a\")}\n # Return the number of messages found in the .message_header text.\n # - If .message_header is not present, a \"0\" will be returned.\n function(:message_count) { if message_header.present? then message_header.text.match(/\\d(?=\\smessage)/).to_s else \"0\" end}\n end", "def connect(args, &block)\n raise \"No object given.\" if !args[\"object\"]\n raise \"No signals given.\" if !args.key?(\"signal\") and !args.key?(\"signals\")\n args[\"block\"] = block if block_given?\n object = args[\"object\"].to_sym\n\n @callbacks[object] = {} if !@callbacks[object]\n conn_id = @callbacks[object].length.to_s\n @callbacks[object][conn_id] = args\n return conn_id\n end", "def setup_default_handlers\n # Incoming events\n prepend_handler :incoming_msg, self.method(:r_msg)\n prepend_handler :incoming_act, self.method(:r_act)\n prepend_handler :incoming_notice, self.method(:r_notice)\n prepend_handler :incoming_ctcp, self.method(:r_ctcp)\n prepend_handler :incoming_ctcpreply, self.method(:r_ctcpreply)\n prepend_handler :incoming_mode, self.method(:r_mode)\n prepend_handler :incoming_join, self.method(:r_join)\n prepend_handler :incoming_part, self.method(:r_part)\n prepend_handler :incoming_kick, self.method(:r_kick)\n prepend_handler :incoming_quit, self.method(:r_quit)\n prepend_handler :incoming_nick, self.method(:r_nick)\n prepend_handler :incoming_miscellany, self.method(:r_miscellany)\n\n # Incoming numeric events here\n prepend_handler :incoming_welcome, self.method(:r_welcome)\n prepend_handler :incoming_bannedfromchan, self.method(:r_bannedfromchan)\n prepend_handler :incoming_badchannelkey, self.method(:r_badchannelkey)\n prepend_handler :incoming_nicknameinuse, self.method(:_nicknameinuse)\n prepend_handler :incoming_channelurl, self.method(:r_channelurl)\n prepend_handler :incoming_topic, self.method(:r_topic)\n prepend_handler :incoming_topicinfo, self.method(:r_topicinfo)\n prepend_handler :incoming_namreply, self.method(:_namreply)\n prepend_handler :incoming_endofnames, self.method(:r_endofnames)\n prepend_handler :incoming_motd, self.method(:r_motd)\n prepend_handler :incoming_motdstart, self.method(:r_motdstart)\n prepend_handler :incoming_endofmotd, self.method(:r_endofmotd)\n prepend_handler :incoming_invite, self.method(:r_invite)\n\n # Outgoing events\n prepend_handler :outgoing_begin_connection, self.method(:out_begin_connection)\n end", "def setup_signal_handlers\n # The Module declaration here will only close over local variables so we\n # need to assign self to a local variable to get access to the agent itself.\n clazz = self\n\n EM.attach(@signal_handler_pipe_reader, Module.new {\n define_method :receive_data do |_|\n\n handlers = clazz.instance_variable_get(:@signal_handlers)\n queue = clazz.instance_variable_get(:@signal_handler_queue)\n signal = queue.pop\n\n clazz.send(:logger).debug { \"Running signal handlers for: #{signal}\" }\n handlers[signal].each { |handler| handler.call(signal) }\n end\n })\n end", "def add_menu_signal(&block)\n @menu_signal << block\n end", "def handle_signal( sig )\n\t\tself.log.debug \"Handling signal %s\" % [ sig ]\n\t\tcase sig\n\t\twhen :INT, :TERM\n\t\t\tself.on_termination_signal( sig )\n\n\t\twhen :HUP\n\t\t\tself.on_hangup_signal( sig )\n\n\t\twhen :USR1\n\t\t\tself.on_user1_signal( sig )\n\n\t\telse\n\t\t\tself.log.warn \"Unhandled signal %s\" % [ sig ]\n\t\tend\n\n\tend", "def initialize(app)\n super()\n @app = app\n\n self.set_size_request(200, 250)\n self.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)\n\n # Get all components\n @groups = Group.new\n all = ObjectSpace.each_object(Class).select { |k| k < Circuits::Component }\n all.each do |klass|\n next if klass.name.nil?\n names = klass.name.split('::')\n names.shift\n add_to_group(@groups, names, klass)\n end\n\n # The tree view to display everything\n @treeview = Gtk::TreeView.new\n\n # Set up renderer and tree column (we only need 1)\n renderer = Gtk::CellRendererText.new\n column = Gtk::TreeViewColumn.new(\"Component\", renderer)\n column.set_cell_data_func(renderer) do |col, renderer, model, iter|\n renderer.text = iter[0].name\n end\n\n @treeview.append_column(column)\n\n @model = Gtk::TreeStore.new(ListItem)\n\n # Add the components to the model\n add_group(@groups, @model, nil)\n\n @treeview.model = @model\n\n # Add tree view\n self.add(@treeview)\n\n @callbacks = []\n\n # Function to change selection when user clicks on component name\n last = nil\n @treeview.signal_connect('cursor-changed') do |tree, e|\n selection = tree.selection\n iter = selection.selected\n next unless iter\n if iter[0].component == NilClass\n selection.unselect_iter(iter)\n selection.select_iter(last) if last\n else\n last = iter\n @selected = iter[0].component\n @callbacks.each { |cb| cb.call(@selected) }\n #puts \"Selected: #{@selected}\"\n end\n end\n end", "def add_view(view)\n\n # Enter\n view.signal_connect('motion-notify-event') do |view, event|\n motion_handler(view, event)\n end\n\n # Leave\n view.signal_connect('leave-notify-event') do |view, event|\n leave_handler(view, event)\n end\n end", "def signals\n return @signals if @signals\n\n signals = SIGNALS_CLASS.new\n ancestors.reverse.each do |ancestor|\n next unless ancestor.kind_of?(ClassMethods)\n ancestor.signal_registry.each_pair do |key, value|\n if value.nil?\n signals.delete(key)\n else\n signals[key] = value\n end\n end\n end\n\n signals\n end", "def create_button value\n\n button = Gtk::Button.new(value)\n\n # handle keyboard input, which uses \"active\" event on button\n button.signal_connect(\"activate\") do |widget|\n handle_input widget.label\n end\n\n # handle mouse-click event, which uses \"pressed\" event\n button.signal_connect(\"pressed\") do |widget|\n handle_input widget.label\n end\n\n button.set_can_focus false\n\n button\n\n end", "def signal(name)\n valid_signal_def! SignalDefinition.new(self, name)\n end", "def handling_method_buttons\n $tracer.trace(__method__)\n #unit_test_no_generate: handling_method_buttons, div.className(\"/hmethod/\"); GameStopCheckoutRadioButtons\n return GameStopCheckoutRadioButtons.new(ToolTag.new(div.className(\"/hmethod/\"), __method__, self), self)\n end", "def initialize(*)\n super\n if as != :button_to\n extend NfgUi::Components::Utilities::Methodable\n end\n end", "def init_layout(state)\n @cells = Array.new(state[:board_rows]) { Array.new(state[:board_columns], nil) }\n @layout = Gtk::FlowBox.new\n @layout.valign = :start\n @layout.max_children_per_line = 1\n @layout.selection_mode = :none\n @layout.set_row_spacing(10)\n\n @turn_indicator = Gtk::Label.new\n @layout.add(@turn_indicator)\n\n @fixed_layout = Gtk::Fixed.new\n @layout.add(@fixed_layout)\n\n cell_grid = Gtk::Grid.new\n @fixed_layout.put(cell_grid, 0, 0)\n\n (0..(state[:board_columns] - 1)).each do |col|\n (0..(state[:board_rows] - 1)).each do |row|\n cell = Gtk::Button.new\n cell.set_size_request(100, 100)\n @cells[row][col] = cell\n cell_grid.attach(cell, col, row, 1, 1)\n end\n end\n\n column_grid = Gtk::Grid.new\n @fixed_layout.put(column_grid, 0, 0)\n\n (0..(state[:board_columns] - 1)).each do |column_index|\n column = Gtk::Button.new\n column.set_size_request(100, 100 * state[:board_rows])\n column.style_context.add_provider(@column_style, Gtk::StyleProvider::PRIORITY_USER)\n column.signal_connect('clicked') do |_|\n changed\n notify_observers('column_clicked', column_index)\n end\n column_grid.attach(column, column_index, 0, 1, 1)\n end\n\n @tokens_indicator = Gtk::Label.new\n\n @t_button = Gtk::Button.new\n @t_button.set_size_request(100, 100)\n @t_button.signal_connect('clicked') do |_, _|\n changed\n notify_observers('t_clicked')\n end\n\n @o_button = Gtk::Button.new\n @o_button.set_size_request(100, 100)\n @o_button.signal_connect('clicked') do |_, _|\n changed\n notify_observers('o_clicked')\n end\n\n @winner = Gtk::Label.new\n @main_menu_button = Gtk::Button.new(label: 'Back to Main Menu')\n @main_menu_button.signal_connect('clicked') do |_, _|\n changed\n notify_observers('main_menu_clicked')\n end\n\n if state[:type] == AppModel::TOOT_AND_OTTO\n @token_button_box = Gtk::Box.new(:horizontal, 10)\n @layout.add(@tokens_indicator)\n @token_button_box.add(@t_button)\n @token_button_box.add(@o_button)\n @layout.add(@token_button_box)\n end\n\n @mask = Gtk::Button.new(label: 'Please wait for your turn...')\n @mask.set_size_request(100 * state[:board_columns], 100 * state[:board_rows])\n @mask.style_context.add_provider(@mask_style, Gtk::StyleProvider::PRIORITY_USER)\n\n @window.add(@layout)\n end", "def build_ui(file_name)\n gtk_builder_add_from_file(@builder, file_name, FFI::MemoryPointer::NULL)\n connect_signals\n end", "def register_signal_handlers\n trap('TERM') { shutdown! }\n trap('INT') { shutdown! }\n\n trap('QUIT') { shutdown }\n\n log.info \"Registered signals\"\n end", "def _button_4_command(*args)\n\n end", "def register_signals\n trap(\"TERM\") { self.bunny.stop }\n trap(\"INT\") { self.bunny.stop }\n end", "def sig_method=(value)\n @children['sigMethod'][:value] = value\n end", "def sig_method=(value)\n @children['sigMethod'][:value] = value\n end", "def register_signals\n trap(:INT) { debug \"Recieved INT\"; exit!}\n end", "def connect(signal, endpoint)\n raise ArgumentError, \"Only signal names must be given as first argument to object.connect\" unless Symbol === signal\n signal = valid_signal!(SignalDefinition.new(self, signal))\n endpoint = valid_endpoint!(endpoint)\n \n if signal.name == :signal_emitted && endpoint.object == self then\n raise InvalidSignalBinding, \":signal_emitted can't be bound to a signal of the same object (infinite loop)\"\n end\n \n connections[signal.name] << endpoint\n end", "def widget\n end", "def widget\n end", "def signal; end", "def signal; end", "def button_down(id); end", "def cache_signals(on=true)\n @signals = nil\n @signals = self.signals if on\n end", "def bind_click_to_submit_with_action element, name, action\n element.children( \"button[ name='#{ name }' ]\" ).on( :click ) do |evt|\n action.call( evt )\n end\nend", "def signals_reset\n @signals.pop\n end", "def assign_handler\n set_handler(:ok, method(:deactivate) )\n set_handler(:cancel, method(:deactivate) )\n end", "def initialize(server)\n @server = server\n @signals = []\n end", "def handling_method_buttons\n $tracer.trace(format_method(__method__))\n return GameStopHandlingMethodRadioButtons.new(ToolTag.new(@tag.find.div.className(\"/hmethod/\"), format_method(__method__)))\n end", "def new(*args)\n super.instance_eval do\n self.class.events.each do |event_name, method_name_or_proc|\n signal_connect(event_name) do |*arguments|\n proc = method_name_or_proc.respond_to?(:call) ? method_name_or_proc : method(method_name_or_proc).to_proc\n arguments = arguments[0...proc.arity] if proc.arity >= 0\n \n instance_exec(*arguments, &proc)\n end\n end\n \n self\n end\n end", "def onClick(block=nil)\n return unless block_given?\n @gtkObject.signal_connect(\"button_release_event\") { |_, event|\n if event.button==Click::LEFT\n yield\n end\n }\n end", "def on_button_up(button_id, point)\n end", "def register_signal_handlers\n trap('TERM') { shutdown }\n trap('INT') { shutdown }\n\n begin\n trap('QUIT') { shutdown }\n trap('USR1') { pause_processing }\n trap('CONT') { unpause_processing }\n rescue ArgumentError\n warn \"Signals QUIT, USR1, USR2, and/or CONT not supported.\"\n end\n\n log! \"Registered signals\"\n end", "def add_open_signal(&block)\n @open_signals << block\n end", "def agroup_components\n table = Gtk::Table.new(11,8)\n (0..8).each{|i|\n x = $glob.btns[i].x\n y = $glob.btns[i].y\n table.attach($glob.btns[i],(x*2)+1,(x*2)+2,(y*2)+1,(y*2)+2)\n }\n (0..3).each{|i|\n table.attach(Gtk::VSeparator.new,i*2,(i*2)+1,0,8)\n table.attach(Gtk::HSeparator.new,0,8,i*2,(i*2)+1) \n }\n table.attach(@new_btn,0,8,8,9) \n table.attach(@default_size_btn,0,8,9,10)\n table.attach(@quit_btn,0,8,10,11)\n self.add(table)\n end", "def clicked(e)\n \n end", "def init_window\n\n @window = Gtk::Window.new\n\n @window.border_width = 10\n @window.resizable = false\n\n @window.signal_connect(\"delete_event\") do\n puts; puts; puts \"delete event occurred\"\n false\n end\n\n @window.signal_connect(\"key_press_event\") do |w, e|\n\n key = Gdk::Keyval.to_name(e.keyval)\n\n masks = get_key_masks e\n\n case\n when (masks[:ctrl] and not masks[:shift])\n case key\n when \"space\"\n handle_input Calculator::KEY_SPACE\n when \"p\", \"P\"\n handle_input Calculator::KEY_PI\n end\n\n end\n\n\n end\n\n @window.add_accel_group(@accelerator_group)\n\n @window.signal_connect(\"destroy\") do\n puts \"destroy event occurred\"\n Gtk.main_quit\n end\n\n generate_structure @structure, @window\n\n init_screen @structure[:screen][:element]\n init_history @structure[:history][:element]\n\n end", "def emit(signal, *args)\n unless connections.has_key?(signal)\n fail ArgumentError, \"invalid signal name: #{signal.inspect}\"\n end\n\n Array(connections[signal]).each do |key, func|\n func.call(self, *args)\n end\n end", "def createPlugin()\n SwivelButton.init()\nend", "def button_up(id)\n end", "def handlers; end", "def handlers; end", "def handlers; end", "def buttonSave__clicked(*args)\n get_glade_variables()\n @builder[\"window1\"].destroy\n end", "def register_signal_handlers\n trap('TERM') { shutdown! }\n trap('INT') { shutdown! }\n\n begin\n trap('QUIT') { shutdown }\n rescue ArgumentError\n warn \"Signals TERM and/or QUIT not supported.\"\n end\n\n log! \"Registered signals\"\n end", "def create_actions\n app = self\n\n # Help > About box\n @about_action = Qt::Action.new(tr(\"&About...\"), self) do\n self.status_tip = tr(\"Show information about the application.\")\n connect(SIGNAL(:triggered)) do\n Qt::MessageBox.about(nil,\n tr(\"About the Wallet\"),\n tr(\"Visit <a href='http://opencoinage.org/'>OpenCoinage.org</a> for more information.\"))\n end\n end\n\n # Currency > Import file dialog\n @import_file_action = Qt::Action.new(tr(\"Import from &File...\"), self) do\n self.status_tip = tr(\"Import a currency contract from a file.\")\n connect(SIGNAL(:triggered)) do\n if file = app.open_file_dialog(caption = tr(\"Import Currency\"))\n app.not_implemented_yet(caption) # TODO\n end\n end\n end\n\n # Currency > Import URL dialog\n @import_url_action = Qt::Action.new(tr(\"Import from &URL...\"), self) do\n self.status_tip = tr(\"Import a currency contract from a URL.\")\n connect(SIGNAL(:triggered)) do\n if url = app.get_text(caption = tr(\"Import Currency\"), tr(\"Enter a currency URL:\"), :text => \"http://\")\n app.not_implemented_yet(caption) # TODO\n end\n end\n end\n\n # Token > Verify dialog\n @verify_action = Qt::Action.new(tr(\"&Verify...\"), self) do\n self.status_tip = tr(\"Verify the selected tokens with the issuer.\")\n connect(SIGNAL(:triggered)) do\n app.not_implemented_yet(caption = tr(\"Verifying Tokens\")) # TODO: progress dialog\n end\n end\n\n # Token > Reissue dialog\n @reissue_action = Qt::Action.new(tr(\"&Reissue...\"), self) do\n self.status_tip = tr(\"Reissue the selected tokens with the issuer.\")\n connect(SIGNAL(:triggered)) do\n app.not_implemented_yet(caption = tr(\"Reissuing Tokens\")) # TODO: progress dialog\n end\n end\n end" ]
[ "0.66696537", "0.6540574", "0.6364604", "0.5879452", "0.58626664", "0.5816632", "0.57837266", "0.5641825", "0.5606676", "0.5555276", "0.5551549", "0.55421126", "0.51843035", "0.5080046", "0.50687766", "0.5032885", "0.49500644", "0.49433744", "0.4921931", "0.47387674", "0.47319338", "0.4725283", "0.46684277", "0.4665463", "0.46259502", "0.4554518", "0.45352036", "0.45275593", "0.45193127", "0.45168227", "0.45130917", "0.4509478", "0.45052302", "0.4504687", "0.4504687", "0.4480185", "0.44521016", "0.44505474", "0.44317064", "0.44317064", "0.44106486", "0.44106486", "0.440319", "0.44015035", "0.43899235", "0.4388027", "0.43817428", "0.43810862", "0.43810862", "0.43779197", "0.43772706", "0.43709004", "0.43698123", "0.43562296", "0.43333715", "0.43256277", "0.43237785", "0.43198588", "0.4310262", "0.4297169", "0.42924836", "0.42882037", "0.42865694", "0.4280951", "0.4267237", "0.42638454", "0.42618227", "0.42608178", "0.42598134", "0.42598134", "0.42554376", "0.42473367", "0.42447367", "0.42447367", "0.4236228", "0.4236228", "0.42356718", "0.42266116", "0.4215854", "0.42074952", "0.4204399", "0.42030135", "0.41991296", "0.41948244", "0.41873217", "0.41871452", "0.41778794", "0.41762602", "0.41744852", "0.41699028", "0.41657075", "0.41650495", "0.41521186", "0.41509914", "0.41404703", "0.41404703", "0.41404703", "0.41373873", "0.412828", "0.4127991" ]
0.7189284
0
parses instance variables added in before_show def parse_instance_signals(dig = true) instance_variables.each do |var| obj = instance_variable_get(var) if obj.respond_to?(:load_glade) obj.load_glade obj.parse_signals dig one level obj.parse_instance_signals(false) if dig never ending loop if instance vaiables are in 2 objects end end end This method is the most useful method to populate a glade form. It will populate from active_record fields and instance variables. It will simply call both of these methods: set_glade_active_record() set_glade_variables() So, to set all the values of a form, simply call the set_glade_all() method instead.
def set_glade_all(obj = self) set_glade_active_record(obj) set_glade_variables(obj) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_signals()\r\n meths = self.class.instance_methods()\r\n meths.each do |meth|\n meth = meth.to_s #bug fix ruby 1.9 gives stmbol\r\n glade_name, signal_name = *(meth.split(\"__\"))\r\n next if (signal_name.to_s == \"\" or glade_name.to_s == \"\") #covers nil\r\n if @builder\r\n @builder.objects.each do |obj|\r\n next unless obj.respond_to?(:builder_name)\r\n if obj.builder_name == glade_name or obj.builder_name =~ /^(?:#{class_name(self)}\\.|)#{glade_name}\\[[a-zA-Z\\d_-]+\\]$/ #arrays\r\n obj.signal_connect(signal_name) { |*args| method(meth.to_sym).call(*args) } \r\n end\r\n end\r\n end\r\n obj = glade_name == \"self\" ? self : self.instance_variable_get(\"@\" + glade_name)\r\n obj ||= eval(glade_name) if respond_to?(glade_name) and method(glade_name.to_sym).arity == 0 # no arguments!\n if obj.respond_to?(\"signal_connect\")\r\n obj.signal_connect(signal_name) { |*args| method(meth.to_sym).call(*args) }\n end\r\n end\r\n end", "def set_glade_variables(obj = self)\r\n obj.instance_variables.each do |name|\r\n name = name.to_s #ruby 1.9 passes symbol!\r\n v = obj.instance_variable_get(name)\n name = name.gsub('@', '')\r\n if v.is_a?(Array) \r\n v.each_index do |i|\r\n fill_control(\"#{name}[#{i.to_s}]\", v[i] )\r\n end\n elsif v.is_a?(Hash)\n v.each_pair do |key, val|\n fill_control(\"#{name}[#{key.to_s}]\", val)\n end \r\n else\r\n fill_control(name, v)\r\n end\r\n end\r\n end", "def get_glade_variables(obj = self)\r\n obj.instance_variables.each do |var_name|\n next if var_name == :@builder or var_name == :@top_level_window\n var = obj.instance_variable_get(var_name)\r\n var_name = var_name.to_s.gsub(\"@\", \"\") #fix for ruby 1.9 giving symbols\n if var.is_a? Hash\n var.each_pair do |key, val|\n if glade_value = get_control_value(\"#{var_name}[#{key.to_s}]\", obj)\n var[key] = glade_value\n end \n end\n obj.instance_variable_set(\"@\"+ var_name, var)\n elsif var.is_a? Array\n var.each_index do |i|\n if glade_value = get_control_value(\"#{var_name}[#{i.to_s}]\", obj)\n var[i] = glade_value\n end\n end\n obj.instance_variable_set(\"@\"+ var_name, var)\n else\n glade_value = get_control_value(var_name, obj)\n obj.instance_variable_set(\"@\"+ var_name, glade_value) unless glade_value.nil?\n end\n end\r\n end", "def set_glade_active_record(obj = self)\r\n return if not defined? obj.attributes\r\n obj.attributes.each_pair { |key, val| fill_control(class_name(obj) + \".\" + key, val) }\r\n end", "def get_glade_all(obj = self)\r\n get_glade_active_record(obj)\r\n get_glade_variables(obj)\r\n end", "def set_form_variables\n @articles = CriminalCode.all.includes(:articles).with_translations\n @tags = Tag.includes(:translations).order(:name)\n @prisons = Prison.includes(:translations).order(:name)\n\n gon.select_charges = t('shared.actions.with_obj.select',\n obj: t('activerecord.models.charge', count: 999))\n gon.select_tags = t('shared.actions.with_obj.select',\n obj: t('activerecord.models.tag', count: 999)) \n end", "def view_properties [email protected]_current_field\n alert \"Nil field\" unless field\n return unless field\n text = [\"Instance Variables\"]\n text << \"------------------\"\n #iv = field.instance_variables.map do |v| v.to_s; end\n field.instance_variables.each do |v|\n val = field.instance_variable_get(v)\n klass = val.class\n if val.is_a? Array \n val = val.size\n elsif val.is_a? Hash\n val = val.keys\n end\n case val\n when String, Integer, TrueClass, FalseClass, NilClass, Array, Hash, Symbol\n ;\n else\n val = \"Not shown\"\n end\n text << \"%20s %10s %s\" % [v, klass, val]\n end\n text << \" \"\n text << \"Public Methods\"\n text << \"--------------\"\n pm = field.public_methods(false).map do |v| v.to_s; end\n text += pm\n text << \" \"\n text << \"Inherited Methods\"\n text << \"-----------------\"\n pm = field.public_methods(true) - field.public_methods(false)\n pm = pm.map do |v| v.to_s; end\n text += pm\n\n #$log.debug \" view_properties #{s.size} , #{s} \"\n textdialog text, :title => \"Properties\"\n end", "def view_properties_as_tree [email protected]_current_field\n alert \"Nil field\" unless field\n return unless field\n text = []\n tree = {}\n #iv = field.instance_variables.map do |v| v.to_s; end\n field.instance_variables.each do |v|\n val = field.instance_variable_get(v)\n klass = val.class\n if val.is_a? Array \n #tree[v.to_s] = val\n text << { v.to_s => val }\n val = val.size\n elsif val.is_a? Hash\n #tree[v.to_s] = val\n text << { v.to_s => val }\n if val.size <= 5\n val = val.keys\n else\n val = val.keys.size.to_s + \" [\" + val.keys.first(5).join(\", \") + \" ...]\"\n end\n end\n case val\n when String, Integer, TrueClass, FalseClass, NilClass, Array, Hash, Symbol\n ;\n else\n val = \"Not shown\"\n end\n text << \"%-20s %10s %s\" % [v, klass, val]\n end\n tree[\"Instance Variables\"] = text\n pm = field.public_methods(false).map do |v| v.to_s; end\n tree[\"Public Methods\"] = pm\n pm = field.public_methods(true) - field.public_methods(false)\n pm = pm.map do |v| v.to_s; end\n tree[\"Inherited Methods\"] = pm\n\n #$log.debug \" view_properties #{s.size} , #{s} \"\n treedialog tree, :title => \"Properties\"\n end", "def instance_variables() end", "def custom_initialize_instance_variables\n @open_selector_bracket_detected = false\n @open_function_detected = false\n @open_include_detected = false\n @parents_stash = []\n @root_selectors = []\n @all_selectors = []\n @all_mixins = []\n @all_includes = []\n @all_properties = []\n end", "def eval_dynamic_attributes\r\n check_page\r\n \r\n #name\r\n @name = @page.instance_eval(&@name) if @name.kind_of? Proc\r\n check_string @name, 'name'\r\n\r\n #title\r\n @title = @page.instance_eval(&@title) if @title.kind_of? Proc\r\n check_string @title, 'title'\r\n \r\n # link\r\n @link = @page.instance_eval(&@link) if @link.kind_of? Proc\r\n check_hash @link, 'link'\r\n \r\n # highlights\r\n @highlights.collect! do |h|\r\n h.kind_of?(Proc) ? @page.instance_eval(&h) : h\r\n end\r\n @highlights.each {|h| check_hash h, 'highlight'}\r\n \r\n # show_if\r\n @condition = @page.instance_eval(@condition) if @condition.kind_of?(String)\r\n @condition = @page.instance_eval(&@condition) if @condition.kind_of?(Proc)\r\n end", "def show_fields\n self.class.fields.values.select { |field| field.show }\n end", "def instance_vars(vars = {})\n vars.each_pair do |name, val|\n name = \"@#{name}\" unless name.to_s.start_with?('@')\n instance_variable_set(name, val)\n end\n end", "def attributes\n attributes = {}\n self.instance_variables.each do |i| \n meth = i.gsub(\"@\",\"\")\n attributes[meth.to_sym] = self.send meth\n end\n attributes\n end", "def instance_fields(&block)\n @fields.each { |field| block[field] }\n @super_class.instance_fields(&block) if @super_class\n end", "def instance_variables; end", "def pretty_print_instance_variables\n %w(@nodes)\n end", "def show\n setup_variables(params)\n\n end", "def dynamic_form_fields(builder)\n # Allow dynamic fields in our Project to be processed by form_for\n create_virtual_attributes!\n\n @object.fields.each do |field|\n h.haml_concat process_field(builder, field)\n end\n end", "def resolveV\r\n puts 'printing a list of instance variables:'\r\n\r\n puts @@currClass.instance_variables.to_s\r\n @@bLastUsed = false\r\n @@forwardClasses = []\r\n end", "def prov_get_form_vars\n if params[:ids_checked] # User checked/unchecked a tree node\n ids = params[:ids_checked]\n # for some reason if tree is not expanded clicking on radiobuttons this.getAllChecked() sends up extra blanks\n @edit.store_path(:new, tag_symbol_for_workflow, ids.select(&:present?).collect(&:to_i))\n end\n id = params[:ou_id].gsub(/_-_/, \",\") if params[:ou_id]\n @edit[:new][:ldap_ous] = id.match(/(.*)\\,(.*)/)[1..2] if id # ou selected in a tree\n\n copy_params_if_present(@edit[:new], params, %i[start_hour start_min])\n @edit[:new][:start_date] = params[:miq_date_1] if params[:miq_date_1]\n @edit[:new][:schedule_time] = Time.zone.parse(\"#{@edit[:new][:start_date]} #{@edit[:new][:start_hour]}:#{@edit[:new][:start_min]}\")\n\n params.each do |key, _value|\n next unless key.include?(\"__\")\n\n d, f = key.split(\"__\") # Parse dialog and field names from the parameter key\n field = @edit[:wf].get_field(f.to_sym, d.to_sym) # Get the field hash\n val =\n case field[:data_type] # Get the value, convert to integer or boolean if needed\n when :integer\n params[key].to_i\n when :boolean\n params[key].to_s == \"true\"\n else\n params[key]\n end\n\n if field[:values] # If a choice was made\n if field[:values].kind_of?(Hash)\n # set an array of selected ids for security groups field\n if f == \"security_groups\"\n if params[key] == \"\"\n @edit[:new][f.to_sym] = [nil]\n else\n @edit[:new][f.to_sym] = []\n params[key].split(\",\").each { |v| @edit[:new][f.to_sym].push(v.to_i) }\n end\n elsif f == \"cloud_volumes\"\n if params[key] == \"\"\n @edit[:new][f.to_sym] = [nil]\n else\n @edit[:new][f.to_sym] = []\n params[key].split(\",\").each { |v| @edit[:new][f.to_sym].push(v) }\n end\n else\n @edit[:new][f.to_sym] = [val, field[:values][val]] # Save [value, description]\n end\n else\n field[:values].each do |v|\n evm_object_class = v.try(:evm_object_class)\n if evm_object_class == :Storage\n if %w[miq_template service_template vm].include?(@edit[:org_controller])\n if params[key] == \"__DS__NONE__\" # Added this to deselect datastore in grid\n @edit[:new][f.to_sym] = [nil, nil] # Save [value, description]\n elsif v.id.to_i == val.to_i\n @edit[:new][f.to_sym] = [val, v.name] # Save [value, description]\n end\n elsif params[key] == \"__DS__NONE__\" # Added this to deselect datastore in grid\n @edit[:new][f.to_sym] = [] # Save [value, description]\n elsif v.id.to_i == val.to_i\n if @edit[:new][f.to_sym].include?(val)\n @edit[:new][f.to_sym].delete_if { |x| x == val }\n else\n @edit[:new][f.to_sym].push(val) # Save [value, description]\n end\n end\n elsif evm_object_class == :Host\n if params[key] == \"__HOST__NONE__\" # Added this to deselect datastore in grid\n @edit[:new][f.to_sym] = [nil, nil] # Save [value, description]\n elsif v.id.to_i == val.to_i\n @edit[:new][f.to_sym] = [val, v.name] # Save [value, description]\n end\n elsif evm_object_class == :Vm\n if params[key] == \"__VM__NONE__\" # Added this to deselect datastore in grid\n @edit[:new][f.to_sym] = [nil, nil] # Save [value, description]\n elsif v.id.to_i == val.to_i\n @edit[:new][f.to_sym] = [val, v.name] # Save [value, description]\n end\n elsif evm_object_class == :PxeImage || evm_object_class == :WindowsImage\n if params[key] == \"__PXE_IMG__NONE__\" # Added this to deselect datastore in grid\n @edit[:new][f.to_sym] = [nil, nil] # Save [value, description]\n elsif v.id == val\n @edit[:new][f.to_sym] = [val, v.name] # Save [value, description]\n end\n elsif evm_object_class == :IsoImage\n if params[key] == \"__ISO_IMG__NONE__\" # Added this to deselect datastore in grid\n @edit[:new][f.to_sym] = [nil, nil] # Save [value, description]\n elsif v.id == val\n @edit[:new][f.to_sym] = [val, v.name] # Save [value, description]\n end\n elsif evm_object_class == :CustomizationTemplate\n if params[key] == \"__TEMPLATE__NONE__\" # Added this to deselect datastore in grid\n @edit[:new][f.to_sym] = [nil, nil] # Save [value, description]\n elsif v.id.to_i == val.to_i\n @edit[:new][f.to_sym] = [val, v.name] # Save [value, description]\n end\n elsif evm_object_class == :CustomizationSpec\n if params[key] == \"__VC__NONE__\" # Added this to deselect custom_spec in grid\n @edit[:new][f.to_sym] = [nil, nil] # Save [value, description]\n elsif v.id.to_i == val.to_i\n @edit[:new][f.to_sym] = [val, v.name] # Save [value, description]\n end\n elsif v[1].to_i == val.to_i\n @edit[:new][f.to_sym] = [val, v[0]] # Save [value, description]\n end\n end\n end\n begin\n @edit[:wf].refresh_field_values(@edit[:new])\n rescue StandardError => bang\n add_flash(bang.message, :error)\n @edit[:new][f.to_sym] = val # Save value\n # No need to refresh dialog divs\n return false\n else\n return true\n end\n else\n @edit[:new][f.to_sym] = val # Save value\n # No need to refresh dialog divs\n return false\n end\n end\n end", "def attributes\n instance_variables.each do |var|\n child = instance_variable_get var\n name = var.to_s[1..-1]\n yield child, name\n end\n end", "def snapshot_hidden_custom_fields; end", "def load_instance_variables(sexp)\n sexp[3][1].rest.select { |child| child.first == :ivar } .each do |ivar|\n translate_generic_sexp ivar\n end\n end", "def connect_signals\n @glade['drawingarea'].signal_connect('expose_event') { print }\n @glade['eventbox'].events = Gdk::Event::BUTTON_PRESS_MASK\n @glade['eventbox'].signal_connect('button_press_event') {|w, e| add_point(Point[e.x.to_i, e.y.to_i])}\n @glade['mainwindow'].signal_connect('destroy'){Gtk.main_quit} \n end", "def attic_variables\n a = self.metaclass.instance_variable_get(\"@attic_variables\")\n a ||= self.metaclass.instance_variable_set(\"@attic_variables\", [])\n a\n end", "def attic_variables\n a = self.metaclass.instance_variable_get(\"@attic_variables\")\n a ||= self.metaclass.instance_variable_set(\"@attic_variables\", [])\n a\n end", "def validate_instance_vars\n flag = true\n self.instance_variables.each { |iv| flag = false if (self.instance_variable_get(iv) == nil && !iv.to_s.start_with?(\"@_\")) }\n flag\n end", "def form_enter type, valid_attributes\r\n valid_attributes.each { |field,value| form.send(\"#{type}[#{field}]=\",value)}\r\nend", "def attributes\n attrs = {}\n instance_variables.each { |instance_variable|\n # Convert the instariable to a string, removing the @ (instance notation), and convert back to a symbol\n attrs[instance_variable.to_s[1..-1].to_sym] = instance_variable_get(instance_variable)\n }\n attrs\n end", "def show_glade(parent = nil)\r\n load_glade()\r\n if parent then\r\n @builder[:window1].transient_for = parent.builder[:window1]\r\n end\r\n before_show() if respond_to? :before_show\r\n parse_signals()\r\n set_glade_all()\n @builder[:window1].show #show_all can't hide widgets in before_show\n @top_level_window = Gtk.main_level == 0 ? true : false\r\n Gtk.main if @top_level_window or @builder[:window1].modal? # need new Gtk.main for blocking!\r\n end", "def fill_instance_vars_from_rubyserial(instance_vars)\n instance_vars.each do |var_name, value|\n instance_variable_set(var_name.to_sym, value)\n end\n end", "def prepare_form_helpers\n if display_type == \"text_field\"\n return [\"data_fields\", id, {id: id}]\n elsif display_type == \"text_area\"\n return [\"data_fields\", id]\n elsif display_type == \"select\"\n options = values.split(',').each{|opt| opt.squish!}\n return [\"data_fields\", id, options.map{|opt| [opt, opt]}]\n elsif display_type == \"check_box\"\n options = values.split(',').each{|opt| opt.squish!}\n return options.map{|v| [\"data_fields[#{id}]\", v]}\n elsif display_type == \"radio_button\"\n options = values.split(',').each{|opt| opt.squish!}\n return options.map{|v| [\"data_fields[#{id}]\", 1, v]}\n end\n end", "def parse_instance_variables\n instance_variables = []\n\n pairs = @tokens.next\n instance_variables << pairs\n\n pairs.times do\n instance_variables << get_symbol\n instance_variables << parse\n end\n\n instance_variables\n end", "def greatk_handler(m, *args, &block)\r\n\r\n if m.is_a? Method\r\n m_sym = m.name\r\n else # Assume m is Symbol\r\n m_sym = m\r\n m = nil\r\n end\r\n m_str = m_sym.to_s\r\n if @greatk_active\r\n if m_str[0..2] == \"on_\"\r\n # If method starts with \"on_\"\r\n # interpret it as a signal\r\n signal = m_str[3..-1]\r\n @greatk_active = false\r\n res = self.send(:signal_connect, signal, *args, &block)\r\n @greatk_active = true\r\n return res\r\n elsif m_str.upcase[0] == m_str[0]\r\n # -- Child widget instantiation --\r\n # If first letter is uppercase\r\n # assume it's a class name and\r\n # instantiate it as a child widget\r\n klass = Kernel.const_get(m_sym)\r\n if not klass <= Widget\r\n puts \"Warning: #{klass} is not a widget\"\r\n return klass\r\n end\r\n if args[0].is_a? Symbol\r\n child_name = args.shift\r\n end\r\n # Initialize child widget\r\n child = klass.new(*args)\r\n child.name = child_name\r\n child.greatk_run(block, @root)\r\n child.show\r\n child.hide if child.instance_variable_get(:@hidden)\r\n # Disable greatk and call original adder method\r\n @greatk_active = false\r\n res = @greatk_add_meth.call(child, *@greatk_add_args) \r\n @greatk_active = true\r\n return res\r\n elsif @greatk_add_methods.include? m_sym\r\n # Mark the add method to be used for next child-widget instantiation\r\n @greatk_add_meth = m\r\n @greatk_add_args = args\r\n return nil\r\n elsif m_set_str = 'set_'+m_str and \r\n self.respond_to?(m_set_str)\r\n # --\r\n m = self.method(m_set_str)\r\n @greatk_active = false\r\n res = m.call(*args)\r\n @greatk_active = true\r\n return res\r\n end\r\n end # @greatk_active\r\n\r\n # If we got here, the call was not handled by greatk\r\n if m\r\n greatk_was_active = @greatk_active\r\n @greatk_active = false\r\n res = m.call(*args, &block)\r\n @greatk_active = greatk_was_active\r\n return res\r\n else\r\n raise NoMethodError, \"undefined method '#{m_str}' for #{self.class}\"\r\n end\r\n\r\n end", "def setup_signals; end", "def isolate_signals; end", "def form_fields\n self.class.fields.values.select { |field| field.form }\n end", "def instance_hooks(hook)\n @instance_hooks ||= {}\n @instance_hooks[hook] ||= []\n end", "def add_show_field(*) super end", "def ing_form; end", "def initialize config={}, &block\n @config = config\n\n\n widget_shortcuts_init\n @variables = {}\n # if we are creating child objects then we will not use outer form. this object will manage\n #@current_object = [] # 2014-08-29 - 17:35 unused\n @_system_commands = %w{ bind_global bind_component field_help_text }\n\n init_vars\n $log.debug \"XXX APP CONFIG: #{@config} \" if $log.debug? \n run &block\n end", "def load_glade() \r\n caller__FILE__ = my_class_file_path() \r\n file_name = File.join(File.split(caller__FILE__)[0] , \"glade\", class_name(self) + \".glade\")\r\n @builder = Gtk::Builder.new\r\n @builder << file_name\r\n @builder.connect_signals{ |handle| method(handle) }\r\n end", "def init_vars\n @hbox = Gtk::HBox.new\n @mode_vbox = Gtk::VBox.new\n @idiom_vbox = Gtk::VBox.new\n @geral_vbox = Gtk::VBox.new\n @new_btn = Gtk::Button.new('')\n @quit_btn = Gtk::Button.new('')\n self.resizable = false\n self.modal = true\n @mode_rdo = []\n (0..4).each{|i|\n @mode_rdo[i] = OptionsRadioButton.new(@mode_rdo[0])\n }\n @mode_rdo[0].selected = true\n @idiom_rdo = []\n (0..2).each{|i|\n @idiom_rdo[i] = Gtk::RadioButton.new(@idiom_rdo[0])\n }\n end", "def attributes\n instance_variables.map{ |iv| iv.sub('@','') }\n end", "def snapshot_hidden_custom_fields=(_arg0); end", "def set_vars_for_form region\n @volunteers = Volunteer.all_for_region(region.id).collect{ |v| [v.name,v.id] }\n @donors = Location.donors.where(:region_id=>region.id).collect{ |d| [d.name,d.id] }\n @recipients = Location.recipients.where(:region_id=>region.id).collect{ |r| [r.name,r.id] }\n @food_types = FoodType.regional(region.id).collect{ |ft| [ft.name,ft.id] }\n @transport_types = TransportType.all.collect{ |tt| [tt.name,tt.id] }\n @scale_types = ScaleType.regional(region.id).collect{ |st| [\"#{st.name} (#{st.weight_unit})\",st.id] }\n @regions = Region.all\n end", "def callback\n\t\tvars = self.instance_variables\n\t\tvars.collect do |v|\n\t\t\tif eligible(\"#{v}\")\n\t\t\t\tval = @old[\"#{v}\"]\n\t\t\t\teval(\"#{v} = #{val}\")\n\t\t\tend \n\t\tend\n\tend", "def attributes(*args)\n hash = super\n if @instance_options[:detailed] == true\n hash[:checklists] = checklists\n hash[:current_timer] = current_timer\n end\n hash\n end", "def parse_labels\n @labels.split.each do |lbl|\n vals = lbl.split(':')\n v = vals.first\n case v\n when \"form\"\n handle_form_label vals\n when \"instrument\"\n handle_instrument_label vals\n when \"references\"\n handle_references_label vals\n else\n if valid_setters.include?(v.to_sym)\n self.send(\"#{v}=\", vals.last)\n end\n end\n end\n end", "def activate\n OptionValue.class_eval do\n belongs_to :tariff\n end\n\n Variant.additional_fields = []\n\n Variant.class_eval do\n after_create :assign_tariff_option\n #before_validation :calc_price\n\n def tariff\n @tariff ||= option_values.first.try(:tariff)\n end\n\n def tariff=(tariff)\n @tariff = tariff\n end\n\n# def package_price\n# if price == -1\n# tariff.eval_package_price(product)\n# else\n# price\n# end\n# end\n\n def assign_tariff_option\n if @tariff\n tariff_option_value = OptionValue.find_by_tariff_id(@tariff.id)\n option_values << tariff_option_value \n end\n end\n\n\n def check_price\n price = if cost_price == -1\n tariff.eval_package_price(product)\n else\n cost_price\n end\n\n price = 0 if price < 0\n end\n\n end\n\n\n Product.class_eval do\n\n named_scope :tariffable, :conditions => { :is_tariffable => true }\n \n\n def init_tariff_packages\n option_types = [OptionType.find_by_name('tariff_package')]\n\n Tariff.all.each do |tariff|\n variant = variants.build(:cost_price => '-1')\n variant.tariff = tariff\n variant.save\n end\n end\n end\n\n\n# ProductsController.class_eval do\n# alias_method :orig_load_data, :load_data\n#\n# def load_data\n# orig_load_data\n#\n# filled_out_tariffs = []\n# @tariff_packages = []\n# @product.variants.each do |variant|\n# tariff = variant.option_values.first.try(:tariff)\n# continue if tariff.nil?\n# @tariff_packages << tariff.attributes.merge({ \n# 'operator_name' => tariff.operator.name,\n# 'package_price' => variant.price})\n#\n# filled_out_tariffs << tariff.id\n# end\n#\n# Tariff.published.each do |tariff|\n# unless filled_out_tariffs.include?(tariff.id)\n# @tariff_packages << tariff.attributes.merge({\n# 'operator_name' => tariff.operator.name,\n# 'package_price' => tariff.eval_package_price(@product)})\n# end\n# end\n# end\n# end\n\n # make your helper avaliable in all views\n # Spree::BaseController.class_eval do\n # helper YourHelper\n # end\n end", "def marshal_dump\n ivars = instance_variables.reject {|var| /\\A@delegate_/ =~ var}\n [\n :__v2__,\n ivars, ivars.map {|var| instance_variable_get(var)},\n __getobj__\n ]\n end", "def attributes\n # ...\n # debugger\n # f = method_missing(name)\n @attributes ||= {}\n # attributes = Hash.new {|h,k| h[k] = []}\n # @attributes = @colm.map {|colm| attributes[colm]}\n # unless instance_variables(false).include?(f)\n # # print f\n # end\n\n # @attribute ={}\n end", "def show_fields=(fields)\n @show_fields = ::ActiveSupport::HashWithIndifferentAccess.new fields\n end", "def show\n @interface_fields, @solution_fields = @process_pattern.field_instances\n @relation_descriptors = @process_pattern.pattern_formalism.system_formalism.relation_descriptors\n @field_relations = @relation_descriptors.inject({}) do |acc, relation_descriptor|\n if relation_descriptor.associated_field_id.present?\n associated_patterns = @process_pattern.relations.select{|r| r.relation_descriptor.associated_field_id == \\\n relation_descriptor.associated_field_id} \\\n .collect{|r| r.target_pattern}\n\n acc[relation_descriptor.associated_field_id] = {:relation_descriptor => relation_descriptor, :patterns => associated_patterns}\n end\n acc\n end\n @relations = @relation_descriptors.inject({}) do |acc,relation_descriptor|\n associated_patterns = @process_pattern.relations.select{|r| r.relation_descriptor == relation_descriptor} \\\n .collect{|r| r.target_pattern}\n acc[relation_descriptor.name] = associated_patterns\n acc\n end\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @process_pattern }\n end\n end", "def init_vars\r\n @page = Application.current.root_visual\r\n @functions = @page.find_name('Functions')\r\n @definitions = @page.find_name('FunctionDefinitions')\r\n @valid = \"def foo(x):\\n return x + 2\\n\\ndef baz(x):\\n return x + 4\\n\\n\"\r\n @invalid = \"def foo(x)\"\r\n class << @functions\r\n def update_text(val)\r\n self.text = val\r\n Application.current.root_visual.Functions_TextChanged nil, nil\r\n end\r\n end\r\nend", "def init_fieldlets(fieldlets=[])\n\t\t\tfieldlets.each do |fieldlet|\n\t\t\t\t@instances[fieldlet[:instance_id]] = @fields.push(fieldlet)\n \n\t\t\t\t@fieldlets[fieldlet[:instance_id]][fieldlet.class::IDENTIFIER] = fieldlet\n\t\t\t\t@fieldlets_by_type[fieldlet.class::IDENTIFIER] ||= fieldlet\n\t\t\tend\n\t\tend", "def instance_variable_names; end", "def layout_fields\n # Everything has a tag - or it BETTER!\n # Probably should refactor this or something.\n value = @stored_values[:tag] || @object.tag\n label = Label.new(\"Tag\")\n tagInput = InputField.new(value,30)\n @attr_to_field[:tag] = tagInput\n layout_field_button(label,tagInput,\"Auto\") do\n attemptName = nil\n if @attr_to_field[:name]\n attemptName = @attr_to_field[:name].text\n end\n tagInput.text = @rl.repository.generate_tag_for(@object,attemptName)\n end\n @fieldY = tagInput.rect.bottom + @spacing \n @object.class.attrs.sort.each do | attr |\n next if attr == :tag # We did tags ourselves\n display = true\n value = @stored_values[attr] || @object.send(attr)\n label = Label.new(attr.to_s)\n rows,cols = [0,0]\n size= @object.class.size_for(attr)\n input = nil\n if size\n rows,cols = size\n if rows > 1\n input = MultiLineInput.new(value)\n input.set_size(rows,cols)\n elsif rows == 0 || cols == 0\n display = false\n else\n input = InputField.new(value, cols)\n end\n else\n input = InputField.new(value,20)\n end \n \n if display\n if rows > 1\n scroller = Scroller.new(input)\n scroller.translate_to(*input.rect.topleft)\n layout_field(label,scroller)\n else\n layout_field(label,input)\n end\n @attr_to_field[attr] = input\n end\n check_max_button(attr,input) if input\n end\n \n # Booleans\n @object.class.booleans.each do | attr |\n value = @stored_values[attr] || @object.send(attr)\n checkbox = CheckBox.new(attr.to_s,value)\n checkbox.rect.topleft = [ @fieldX, @fieldY ] \n \n @fieldY = checkbox.rect.bottom + @spacing\n \n self << checkbox\n @bool_to_field[attr] = checkbox\n end\n \n # And now for the enums!\n @object.class.enumerations.each do | attr, valid |\n value = @stored_values[attr] || @object.send(attr)\n label = Label.new(attr.to_s)\n \n size = @object.class.size_for(attr)\n label.rect.topleft = [@fieldX, @fieldY]\n rows = size || valid.size\n \n input = ListBox.new\n input.rect.w = @mainRect.w / 2 - label.rect.w - @spacing * 3\n input.rect.h = input.height(rows)\n input.items = valid\n input.chosen = value\n \n input.translate_to(label.rect.right + @spacing, @fieldY)\n \n @fieldY = input.rect.bottom + @spacing\n self << label\n self << input\n @enum_to_field[attr] = input\n \n end\n end", "def instance_variables\n get_instance_variables.to_a.collect{ |n| \"@#{n}\".to_sym }\n end", "def attribute_hash\n instance_vars = self.send(:instance_variables)\n values = {}\n instance_vars.each do |var|\n values[(var.to_s.delete('@')).to_sym] = self.instance_variable_get(var)\n end\n values\n end", "def forms; end", "def attributes\n Hash.new.tap do |atts|\n _attributes.instance_variables.each do |ivar|\n # todo: figure out why it's setting @constructor and @toString\n next if ivar == :@constructor || ivar == :@toString || ivar == :@_attributes || ivar == :@_data || ivar == :@_forms\n\n att = ivar[1..-1].to_sym\n atts[att] = _attributes.send(att)\n\n if form_name = _form[att.to_s.to_sym]\n atts[att] = wedge(form_name, atts[att].respond_to?(:attributes)? atts[att].attributes : atts[att]).attributes\n end\n end\n end\n end", "def attributes\n Hash[instance_variables.map { |name| [name, instance_variable_get(name)] }]\n end", "def pretty_print_instance_variables\n instance_variables.sort\n end", "def pretty_print_instance_variables\n instance_variables.sort\n end", "def get_instance_vars\n @portfolios = get_portfolios\n @tags = get_tags\n @rails_props = {\n portfolios: @portfolios,\n tags: @tags\n }\n end", "def dump_attributes!\n self.class.fields.each_pair do |name, field|\n send(\"set_#{name}\", field.dump(attributes[name])) if respond_to? \"set_#{name}\"\n end\n self\n end", "def show\n\n if UPDATED_STEPS.include?(step)\n return new_show\n end\n\n # def old_show\n # Variables for navigation purposes\n @student_start = :student_name\n @guardian_start = :guardian_name_and_address\n @contact_start = :contact_person_1_contact_info\n @permissions = :permissions\n @summary = :summary\n\n begin\n @student = Student.find(session[:student_id])\n rescue\n @student = Student.new\n end\n\n begin\n @guardian = ContactPerson.find(session[:guardian_id]) # TODO Placeholder for getting through UI\n rescue\n @guardian = ContactPerson.create # TODO Placeholder for getting through UI\n end\n\n if session[:second_guardian_id]\n @second_guardian = ContactPerson.find(session[:second_guardian_id])\n else\n @second_guardian = ContactPerson.new\n end\n\n if step == :guardian_phone_and_email\n\n end\n\n #Handle gender pronouns, but not for first step\n if step != :student_gender_and_ethnicity\n @gender_pronoun = genderToPronoun(@student.gender)\n @gender_possessive_pronoun = genderToPossessivePronoun(@student.gender)\n @gender_objective_pronoun = genderToObjectivePronoun(@student.gender)\n @gender_possessive_adjective = genderToPossessiveAdjective(@student.gender)\n end\n\n\n # Handle contact person\n if step == :contact_person_2_contact_info\n @contact_person = ContactPerson.find(session[:contact_person_1_id])\n end\n\n if step == :permissions\n contact_1 = ContactPerson.new(first_name: 'John')\n contact_2 = ContactPerson.new(first_name: 'Ginger')\n contact_3 = ContactPerson.new(first_name: 'Bambi')\n @all_contacts = [contact_1, contact_2, contact_3]\n\n # @all_contacts = ContactPerson.where(contact_person_id:@guardian.id)\n # @all_contacts << @guardian\n # @guardian_and_contacts = @all_contacts.reverse\n end\n\n render_wizard\n end", "def show\n # debugger\n end", "def buildSubmissionVariables(data)\r\n data = data['submission']\r\n data.keys.each do |key|\r\n # Build Up Submission Properties (non hash / arrays)\r\n if !data[key].is_a?(Hash) && !data[key].is_a?(Array)\r\n @variables['submission'][key] = data[key]\r\n end\r\n\r\n # Pass Form Object to the Build Form Variables Routine to Handle the Rest\r\n if key == \"form\"\r\n buildFormVariables({\"form\" => data[key]})\r\n end\r\n\r\n # Build Submission Values Variables\r\n if key == \"values\"\r\n @variables['values'] = data[key]\r\n end\r\n\r\n end\r\n end", "def variables; end", "def variables; end", "def pretty_print_instance_variables\n (instance_variables - pretty_print_ignore).sort\n end", "def class_variables() end", "def create_instance_variables\n\n @master_hash = Hash.new{|hash, key| hash[key] = Hash.new}\n\n @matched_filter_keys = Hash.new{|hash, key| hash[key] = Array.new}# this is declared without being used anywhere because in the view _filters_results.html.erb, .empty? is used to check which needs this variable to be declared. Bad one.\n\n @sub_category_flag = params[:sub_category_id].to_i# Setting the @sub_category_flag which really important and this keeps the whole filtering process informed about the current sub_category_id.\n\n @view_name = params[:view_name]# @view_name is set.\n\n @price_range_final = Hash.new\n\n end", "def build_load_voyage_form(load_voyage, action, caption, is_edit = nil, is_create_retry = nil)\n#\t--------------------------------------------------------------------------------------------------\n#\tDefine a set of observers for each composite foreign key- in effect an observer per combo involved\n#\tin a composite foreign key\n#\t----------------------------------------------------------------_----------------------------------\n session[:load_voyage_form]= Hash.new\n\n \n\n\n# trading_partners = PartiesRole.find_by_sql(\"SELECT id, party_name FROM parties_roles WHERE role_name = 'TRADING_PARTNER'\").map { |g| [g.party_name, g.id] }\n exporter_party_role_ids = PartiesRole.find_by_sql(\"SELECT DISTINCT id,party_name FROM public.parties_roles WHERE parties_roles.role_name = 'EXPORTER'\").map { |g| [g.party_name, g.id] }\n\n\n shipper_party_role_ids = PartiesRole.find_by_sql(\"SELECT DISTINCT id,party_name FROM public.parties_roles WHERE parties_roles.role_name = 'SHIPPER'\").map { |g| [g.party_name, g.id] }\n\n\n shipping_agent_party_role_ids = PartiesRole.find_by_sql(\"SELECT DISTINCT id,party_name FROM public.parties_roles WHERE parties_roles.role_name = 'SHIPPING AGENT'\").map { |g| [g.party_name, g.id] }\n\n\n shipping_line_party_role_ids = PartiesRole.find_by_sql(\"SELECT DISTINCT id,party_name FROM public.parties_roles WHERE parties_roles.role_name = 'SHIPPING LINE'\").map { |g| [g.party_name, g.id] }\n\n loads = Load.find_by_sql(\"SELECT DISTINCT id,load_number FROM loads where upper(load_status) = 'LOAD_CREATED'\").map {|s|[s.load_number,s.id]}\n\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n field_configs = Array.new\n#\t----------------------------------------------------------------------------------------------------\n#\tCombo field to represent foreign key (load_id) on related table: loads\n#\t-----------------------------------------------------------------------------------------------------\n\n if is_edit == true\n field_configs[field_configs.length()] = {:field_type => 'LabelField',\n :field_name => 'load_number'}\n \n else \n\n field_configs[field_configs.length()] = {:field_type => 'DropDownField',\n :field_name => 'load_id',\n :settings => {:label_caption=>'load_number',\n :list => loads}}\n end\n\n\n field_configs[field_configs.length()] = {:field_type => 'TextField', :field_name => 'customer_reference'}\n\n field_configs[field_configs.length()] = {:field_type => 'TextField', :field_name => 'booking_reference'}\n\n field_configs[field_configs.length()] = {:field_type => 'TextField', :field_name => 'exporter_certificate_code'}\n\n field_configs[field_configs.length()] = {:field_type => 'DropDownField',\n :field_name=> 'exporter_party_role_id',\n :settings => {:label_caption => 'exporter',:show_label=> true,\n :list => exporter_party_role_ids}}\n\n field_configs[field_configs.length()] = {:field_type => 'DropDownField',\n :field_name => 'shipper_party_role_id',\n :settings => {:label_caption=>'shipper',:show_label=> true,\n :list => shipper_party_role_ids}}\n\n field_configs[field_configs.length()] = {:field_type => 'DropDownField',\n :field_name => 'shipping_agent_party_role_id',\n :settings => {:label_caption=>'shipping_agent',:show_label => true,\n :list => shipping_agent_party_role_ids}}\n \n field_configs[field_configs.length()] = {:field_type => 'DropDownField',\n :field_name => 'shipping_line_party_id',\n :settings => {:label_caption=>'shipping_line',:show_label=> true,\n :list => shipping_line_party_role_ids}}\n\n field_configs[field_configs.length()] = {:field_type => 'TextArea', :field_name => 'memo_pad'}\n\n\n build_form(load_voyage, field_configs, action, 'load_voyage', caption, is_edit)\n\n end", "def display_fields\n @form.fields.each {|f| puts f.name}\n end", "def instance_vars_from_attributes\n self.visibility = @attributes[:visibility]\n self.release_date = (wants_embargo? && @attributes[:embargo_release_date].presence) ||\n (wants_lease? && @attributes[:lease_expiration_date].presence)\n self.after = (wants_embargo? && @attributes[:visibility_after_embargo].presence) ||\n (wants_lease? && @attributes[:visibility_after_lease].presence)\n self.during = (wants_embargo? && @attributes[:visibility_during_embargo].presence) ||\n (wants_lease? && @attributes[:visibility_during_lease].presence)\n end", "def instance_attributes; end", "def prep_variables\n end", "def initialize\n @gui = Gtk::Builder.new\n @gui.add(\"#{File.dirname(__FILE__)}/ui/main.ui\")\n @gui.connect_signals { |handler| method(handler) }\n\n @window = @gui[:window]\n winsetting = GtkSettingsWindow.new(@window, \"win_main\")\n\n @nb_dbs = @gui[:nbDbs]\n @nb_dbs.connect_after(\"switch-page\", [self, \"ChangeActiveDB\"])\n\n @window.show_all\n end", "def show\n # logger.debug2 \"Giftshow: show = #{read_attribute(:show)} (#{read_attribute(:show).class.name})\"\n return nil unless (extended_show = read_attribute(:show))\n encrypt_remove_pre_and_postfix(extended_show, 'show', 30)\n end", "def set_instance_variables(options)\n @format_key = options[:format_key].to_sym\n @left_delimiter = options[:left_delimiter].to_s\n @right_delimiter = options[:right_delimiter].to_s\n @substitutions = options[:substitutions]\n end", "def add_inst_vars(keys)\n keys.each do |k|\n instance_variable_set \"@#{k}\", @data[k]\n self.class.attr_accessor k unless respond_to?(k)\n end\n end", "def form_setup\n\tend", "def process_instance(item)\n @instance = Yarpler::Models::Instance.new\n @instance.variable = item[0].to_s\n end", "def variables_instance\n warn 'i dont like this!'\n []\n end", "def addInputs(forms)\n forms.push( {\"description\"=>\"Config\",\n \"label\"=>\"Config\",\"name\"=>\"config\",\n \"property_inputs\"=>[{\"description\"=>\"Stack\",\"label\"=>\"Stack\",\"reference\"=>\".diego_cell\"+deploymentName+\".stack\"},\n {\"description\"=>\"Virtual IP\",\"label\"=>\"Virtual IP\",\"reference\"=>\".ha_proxy\"+deploymentName+\".keepalived_vip\"},\n {\"description\"=>\"Same Keepalived group share same virtual router ID \",\"label\"=>\"Virtual Router ID\",\"reference\"=>\".ha_proxy\"+deploymentName+\".keepalived_virtual_router_id\"}] });\nend", "def custom_fields\n if debug?\n channel_fields = ChannelFieldForm.new\n channel_fields.create_field(\n group_id: 1,\n type: 'Checkboxes',\n label: 'Checkboxes',\n fields: {\n field_list_items: \"Yes\\nNo\\nMaybe\"\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Radio Buttons',\n label: 'Radio Buttons',\n fields: {\n field_list_items: \"Left\\nCenter\\nRight\"\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Multi Select',\n label: 'Multi Select',\n fields: {\n field_list_items: \"Red\\nGreen\\nBlue\"\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Select Dropdown',\n label: 'Select Dropdown',\n fields: {\n field_list_items: \"Mac\\nWindows\\nLinux\"\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Select Dropdown',\n label: 'Prepopulated',\n fields: {\n field_pre_populate: 'y'\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Rich Text Editor',\n label: 'Rich Text Editor',\n fields: {\n field_ta_rows: 20,\n field_text_direction: 'Right to left'\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Toggle',\n label: 'Toggle'\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Text Input',\n label: 'Text Input',\n fields: {\n field_maxl: 100,\n field_fmt: 'None',\n field_show_fmt: 'y',\n field_text_direction: 'Right to left',\n field_content_type: 'Decimal',\n field_show_smileys: 'y',\n field_show_file_selector: 'y'\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Textarea',\n label: 'Textarea',\n fields: {\n field_ta_rows: 20,\n field_fmt: 'None',\n field_show_fmt: 'y',\n field_text_direction: 'Right to left',\n field_show_formatting_btns: 'y',\n field_show_smileys: 'y',\n field_show_file_selector: 'y'\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'URL',\n label: 'URL Field',\n fields: {\n url_scheme_placeholder: '// (Protocol Relative URL)'\n }\n ) do |page|\n page.all('input[name=\"allowed_url_schemes[]\"]').each do |element|\n element.click unless element.checked?\n end\n end\n\n @page.load\n else\n $db.query(IO.read('channel_sets/custom-fields.sql'))\n clear_db_result\n end\n end", "def post_initialize_fields\n end", "def create_getters\n instance_variables.each do |v|\n define_singleton_method(v.to_s.tr('@','')) do\n instance_variable_get(v)\n end\n end\n end", "def form_objects\n BaseForm.descendants.map(&:name).grep(/^Steps::/)\nend", "def report_load_labels\r\n\r\n case @x_type\r\n when :string\r\n return @x_labels = DevFeedback.all(:select => \"DISTINCT(`#{@x_field}`)\").map{|r| r.send(@x_field)}\r\n when :static_list\r\n return @x_labels = DevFeedback.const_get(@x_field.pluralize.upcase)\r\n when :bt_assoc\r\n return @x_labels = DevFeedback.reflect_on_association(@x_field.to_sym).klass.all\r\n end\r\n @x_range = if params[:x_range] # range is given\r\n case @x_type\r\n when :integer\r\n params[:x_range].split('..').map(&:to_i)\r\n when :float, :double\r\n params[:x_range].split('..').map(&:to_f)\r\n when :date, :datetime\r\n rg = params[:x_range].split('..').map(&:to_i)\r\n @x_min = Time.now + rg.first.days\r\n @x_max = Time.now + rg.last.days\r\n rg\r\n end\r\n else\r\n @x_min = DevFeedback.minimum(@x_field)\r\n @x_max = DevFeedback.maximum(@x_field)\r\n case @x_type\r\n when :integer, :float, :double\r\n when :date, :datetime\r\n [((@x_min - Time.now) / 86400).round, ((@x_max - Time.now) / 86400).round]\r\n end\r\n end\r\n if true\r\n case @x_type\r\n when :integer, :float, :double\r\n @x_min, @x_max = @x_range\r\n params[:x_steps] ||= (@x_max.to_f - @x_min.to_f) / 10.0\r\n @x_steps = params[:x_steps].to_f\r\n @x_steps = 0.1 if @x_steps == 0\r\n @x_labels = [@x_min]\r\n while(@x_labels.last <= @x_max) do\r\n @x_labels << @x_labels.last + @x_steps\r\n end\r\n when :date, :datetime\r\n @x_steps = case params[:x_steps]\r\n when \"month\"\r\n 30\r\n when \"week\"\r\n 7\r\n else\r\n if !params[:x_steps] || params[:x_steps].to_i == 0\r\n (@x_range.last - @x_range.first).round / 10.0\r\n else\r\n params[:x_steps].to_i\r\n end\r\n end\r\n @x_steps = 1 if @x_steps == 0\r\n @x_min ||= Time.now + @x_range.first.days\r\n @x_max ||= Time.now + @x_range.last.days\r\n @x_labels = [@x_min]\r\n logger.debug(\"\\t (#{@x_min})..(#{@x_max}) - #{@x_steps} days step\")\r\n 200.times {\r\n break if @x_labels.last > @x_max\r\n @x_labels << @x_labels.last + @x_steps.days\r\n }\r\n end\r\n else # no params[:x_range] => need to guess range\r\n case @x_type\r\n when :integer, :float, :double\r\n @datasets.each_with_index { |h,i|\r\n d = h[:values]\r\n if !@x_min\r\n @x_min = d.min\r\n else\r\n d_min = d.min\r\n @x_min = d_min if d_min < @x_min\r\n end\r\n if !@x_max\r\n @x_max = d.max\r\n else\r\n d_max = d.max\r\n @x_max = d_max if d_max > @x_max\r\n end\r\n }\r\n params[:x_steps] ||= (@x_max.to_f - @x_min.to_f) / 10\r\n @x_steps = params[:x_steps].to_f\r\n @x_steps = 0.1 if @x_steps == 0\r\n end\r\n case @x_type\r\n when :integer, :float, :double\r\n if params[:x_ticks]\r\n end\r\n when :static_list\r\n when :date, :datetime\r\n end\r\n end\r\n end", "def define_variables\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\tLOG.debug(fname) {\">>>>params=#{params.inspect}\"}\n\t\t@views = View.all\n\t\t@current_user= current_user\n\t\t@clipboard = session[:clipboard] ||= Clipboard.new\n\t\t#LOG.info(fname) {\"**** clipboard=#{@clipboard.inspect}\"}\n\t\t@theme = get_session_theme(session)\n\t\tLOG.debug(fname) {\"@theme=#{@theme}\"}\n\t\t@language = PlmServices.get_property(:LOCAL_DEFAULT)\n\t\tLOG.debug(fname) {\"@language=#{@language}\"}\n\t\t@urlbase = get_urlbase\n\t\tLOG.debug(fname) {\"@urlbase=#{@urlbase}\"}\n\t\t@themes = get_themes(@theme)\n\t\tLOG.debug(fname) {\"@themes=#{@themes}\"}\n\t\t@languages = get_languages\n\t\tLOG.debug(fname) {\"@languages=#{@languages}\"}\n\t\t@datas = get_datas_count\n\t\tLOG.debug(fname) {\"@datas=#{@datas}\"}\n\t\t###########TODO inutile @notification=PlmServices.get_property(:NOTIFICATION_DEFAULT)\n\t\t###########TODO inutile @time_zone=PlmServices.get_property(:TIME_ZONE_DEFAULT)\n\t\tWillPaginate::ViewHelpers.pagination_options[:previous_label] = t('label_previous')\n\t\tWillPaginate::ViewHelpers.pagination_options[:next_label] = t('label_next')\n\t\t# when false, only previous/next links are rendered (default: true)\n\t\tWillPaginate::ViewHelpers.pagination_options[:page_links ] = true\n\t\t# how many links are shown around the current page (default: 4)\n\t\tWillPaginate::ViewHelpers.pagination_options[:inner_window] = 10\n\t\t# when false, only previous/next links are rendered (default: true)\n\t\tWillPaginate::ViewHelpers.pagination_options[:page_links ] = true\n\t\t# how many links are shown around the current page (default: 4)\n\t\tWillPaginate::ViewHelpers.pagination_options[:inner_window] = 10\n\t\t# how many links are around the first and the last page (default: 1)\n\t\tWillPaginate::ViewHelpers.pagination_options[:outer_window] = 3\n\t\t# string separator for page HTML elements (default: single space)\n\t\tWillPaginate::ViewHelpers.pagination_options[:separator ] = ' - '\n\t\t@myparams = params\n\t\tDatafile.host=request.host\n\t\t@types_features=::Controller.get_types_by_features\n\t\tflash[:notice]=\"\"\n\t\tflash[:error]=\"\"\n\t\tLOG.debug(fname) {\"<<<<params=#{params.inspect}\"}\n\tend", "def view_params(view_type, attributes, menu)\n @show_filters = false\n @show_navigation = false\n @show_goto_navigation = false\n @show_goto_filters = false\n @show_featured = false\n\t\t\n if attributes.empty?\n if menu.empty?\n @show_featured = true\n else\n @show_navigation = true\n end\n else\n if menu.empty?\n @show_filters = true\n else\n if view_type == \"flt\"\n @show_filters = true\n @show_goto_navigation = true\n else\n @show_goto_filters = true\n @show_navigation = true\n end\n end\n end\n @nav_class = \"hidden\" unless @show_navigation\n @flt_class = \"hidden\" unless @show_filters\n @nav_goto_class = \"hidden\" unless @show_goto_navigation\n @flt_goto_class = \"hidden\" unless @show_goto_filters\n end", "def marshal_load(variables)#:nodoc:\n fields_to_serialize.each_with_index{|field, index| instance_variable_set_value(field, variables[index])}\n end", "def instance_variables_to_hash(obj)\n Hash[obj.instance_variables.map{ |var| [\"#{var.to_s.delete('@')}\", obj.instance_variable_get(var.to_s)]}]\n end", "def declare_signals\n self.signal_connect(:delete_event){\n $glob.num_moves = -1\n $glob.btns.each{|btn| btn.label_widget.set_markup($glob.null_markup)}\n $windows.opts_win.show_all\n self.hide\n }\n end", "def _dump(depth) # :nodoc:\n instanceVarHash = {}\n self.instance_variables.each { |k| instanceVarHash[k] = self.instance_variable_get(k) }\n return Marshal.dump(instanceVarHash.delete_if{|k,v| k == \"@logger\"})\n end" ]
[ "0.66795236", "0.6619495", "0.63035905", "0.53254855", "0.5193349", "0.5157633", "0.5121468", "0.5015188", "0.49918738", "0.4901401", "0.47705492", "0.46947604", "0.46850902", "0.4670521", "0.46612477", "0.46477708", "0.46199134", "0.46155262", "0.4607414", "0.4587327", "0.45850107", "0.4571147", "0.45651358", "0.45486963", "0.45156533", "0.4515015", "0.4515015", "0.44951934", "0.4474472", "0.4471682", "0.44662598", "0.44641146", "0.4462121", "0.4454692", "0.44454914", "0.4434477", "0.44342348", "0.44322443", "0.44322297", "0.4408924", "0.44035205", "0.4392531", "0.43905115", "0.43853986", "0.43581364", "0.4354654", "0.43533877", "0.4343972", "0.43418184", "0.43172187", "0.4312897", "0.4312802", "0.43114147", "0.43110126", "0.4301551", "0.42974585", "0.42938456", "0.4285174", "0.42838833", "0.4278721", "0.42786002", "0.42704", "0.42620164", "0.4259671", "0.42565063", "0.42565063", "0.42235088", "0.42215234", "0.42205596", "0.42193985", "0.42119253", "0.4210527", "0.4210527", "0.42102408", "0.42097983", "0.42079136", "0.42059606", "0.42049703", "0.41947308", "0.41852403", "0.41838372", "0.4182208", "0.4181498", "0.41810003", "0.41769686", "0.41686702", "0.41664642", "0.4164759", "0.41621253", "0.4139666", "0.4138237", "0.41336104", "0.41319358", "0.41299424", "0.41290432", "0.41287646", "0.41216323", "0.41168118", "0.4114075", "0.41136348" ]
0.5660652
3
This method is the most useful method to retreive values from a glade form. It will populate from active_record fields and instance variables. It will simply call both of these methods: get_glade_active_record() get_glade_variables() So, to retreive all the values of a form back into your ActiveRecord object and instance variables, simply call the set_glade_all() method instead.
def get_glade_all(obj = self) get_glade_active_record(obj) get_glade_variables(obj) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_glade_all(obj = self) \r\n set_glade_active_record(obj)\r\n set_glade_variables(obj)\r\n end", "def get_glade_variables(obj = self)\r\n obj.instance_variables.each do |var_name|\n next if var_name == :@builder or var_name == :@top_level_window\n var = obj.instance_variable_get(var_name)\r\n var_name = var_name.to_s.gsub(\"@\", \"\") #fix for ruby 1.9 giving symbols\n if var.is_a? Hash\n var.each_pair do |key, val|\n if glade_value = get_control_value(\"#{var_name}[#{key.to_s}]\", obj)\n var[key] = glade_value\n end \n end\n obj.instance_variable_set(\"@\"+ var_name, var)\n elsif var.is_a? Array\n var.each_index do |i|\n if glade_value = get_control_value(\"#{var_name}[#{i.to_s}]\", obj)\n var[i] = glade_value\n end\n end\n obj.instance_variable_set(\"@\"+ var_name, var)\n else\n glade_value = get_control_value(var_name, obj)\n obj.instance_variable_set(\"@\"+ var_name, glade_value) unless glade_value.nil?\n end\n end\r\n end", "def fields\n @fields ||= form.fields\n end", "def get_entered_fields\n @entered_fields = get_used_fields_only(@contact_form_field)\n @entered_fields\n end", "def all_fields\n @fields.values\n end", "def fill_all_form_data()\n if verbose_messages\n p @fillable_form_fields\n p @current_page_data_object\n end\n\n @fillable_form_fields.each do |field|\n value = @current_page_data_object.retrieve_data_for(field)\n enter_element_value(field, value) if value and (value != \"nil\")\n end\n end", "def grades\n @grade_entry_form = record\n end", "def data\n @field.widget.value_from_formdata(@form.data, @html_name)\n end", "def all_fields\n fields.values\n end", "def forms; end", "def get_field_values document, _field, field_config, options = {}\n presenter(document).field_values field_config, options\n end", "def set_glade_active_record(obj = self)\r\n return if not defined? obj.attributes\r\n obj.attributes.each_pair { |key, val| fill_control(class_name(obj) + \".\" + key, val) }\r\n end", "def _get_values\n _fields_map = get_flexi_fields_map\n\n @attributes.map do |k, v|\n field = _fields_map[k]\n raise \"Field - #{k} not defined\" if field.nil?\n VALUE.new(:field => field, value: self.send(:\"#{k}\"))\n end\n end", "def form_fields\n self.class.fields.values.select { |field| field.form }\n end", "def from_values\n d_attrs = development.reload.fields\n self.fields.map{ |field|\n name = field.fetch('name').to_s\n edit_from = field.fetch('from').to_s\n devel_from = d_attrs.fetch( name )\n [ devel_from, edit_from ]\n }\n end", "def fields\n form = @stamper.getAcroFields\n form.getFields.each_with_object({}) do |(name, value), fields|\n fields[name.to_sym] = form.getField(name)\n end\n end", "def fetch_fields\n @fields\n end", "def field_values\n fieldset.get_values_using_fsa(self)\n end", "def values_by_category\n\t\tself.user_program_form_values\n\tend", "def form_fields\n params\n end", "def form_field_data\n @attributes[:form_field_data]\n end", "def view_properties [email protected]_current_field\n alert \"Nil field\" unless field\n return unless field\n text = [\"Instance Variables\"]\n text << \"------------------\"\n #iv = field.instance_variables.map do |v| v.to_s; end\n field.instance_variables.each do |v|\n val = field.instance_variable_get(v)\n klass = val.class\n if val.is_a? Array \n val = val.size\n elsif val.is_a? Hash\n val = val.keys\n end\n case val\n when String, Integer, TrueClass, FalseClass, NilClass, Array, Hash, Symbol\n ;\n else\n val = \"Not shown\"\n end\n text << \"%20s %10s %s\" % [v, klass, val]\n end\n text << \" \"\n text << \"Public Methods\"\n text << \"--------------\"\n pm = field.public_methods(false).map do |v| v.to_s; end\n text += pm\n text << \" \"\n text << \"Inherited Methods\"\n text << \"-----------------\"\n pm = field.public_methods(true) - field.public_methods(false)\n pm = pm.map do |v| v.to_s; end\n text += pm\n\n #$log.debug \" view_properties #{s.size} , #{s} \"\n textdialog text, :title => \"Properties\"\n end", "def form; end", "def set_glade_variables(obj = self)\r\n obj.instance_variables.each do |name|\r\n name = name.to_s #ruby 1.9 passes symbol!\r\n v = obj.instance_variable_get(name)\n name = name.gsub('@', '')\r\n if v.is_a?(Array) \r\n v.each_index do |i|\r\n fill_control(\"#{name}[#{i.to_s}]\", v[i] )\r\n end\n elsif v.is_a?(Hash)\n v.each_pair do |key, val|\n fill_control(\"#{name}[#{key.to_s}]\", val)\n end \r\n else\r\n fill_control(name, v)\r\n end\r\n end\r\n end", "def form\n @form.rbc_form\n end", "def builder\n form\n end", "def form_fields\n values = super\n result = {}\n mappings.values.each { |field|\n result[field] = values[field] if values[field]\n }\n result\n end", "def values\n iterator = @form_fields.keySet.iterator\n set = []\n set << field(iterator.next.toString) while iterator.hasNext\n set\n end", "def get_fields\n _fields = @config['form']['fields']\n _fields.map{|k,v| Field.new(k=>v)}\n end", "def display_all_fields\n @@all_fields\n end", "def index\n @form_fields = FormField.all\n end", "def dynamic_form_fields(builder)\n # Allow dynamic fields in our Project to be processed by form_for\n create_virtual_attributes!\n\n @object.fields.each do |field|\n h.haml_concat process_field(builder, field)\n end\n end", "def ing_form; end", "def set_form_variables\n @articles = CriminalCode.all.includes(:articles).with_translations\n @tags = Tag.includes(:translations).order(:name)\n @prisons = Prison.includes(:translations).order(:name)\n\n gon.select_charges = t('shared.actions.with_obj.select',\n obj: t('activerecord.models.charge', count: 999))\n gon.select_tags = t('shared.actions.with_obj.select',\n obj: t('activerecord.models.tag', count: 999)) \n end", "def fields\n all_fields\n end", "def from_form\n @from_form ||= fields.map { |field| form.__send__(field) }\n end", "def display_fields\n @form.fields.each {|f| puts f.name}\n end", "def field_values(field_config, options = {})\n options[:values] ||= retrieve_values(field_config) unless options.key? :value\n FieldPresenter.new(view_context, document, field_config, options).render\n end", "def each_field\n self.form.form_fields.each do |field|\n yield field, self.data[field.name.to_sym]\n end\n end", "def form_fields\n @item_fields = @model.typus_fields_for('form')\n @item_has_many = @model.typus_relationships_for('has_many')\n @item_has_and_belongs_to_many = @model.typus_relationships_for('has_and_belongs_to_many')\n end", "def values\n fields.map { |f| f.value }\n end", "def fields\n @fields\n end", "def fields\n @fields\n end", "def get_fields()\n return @api.do_request(\"GET\", get_base_api_path() + \"/fields\")\n end", "def fields\n @fields\n end", "def fill_in_form(fields)\n fields.each do |field, value|\n f = send(\"#{field}_field\")\n f.set(value) || Array(value).each { |val| f.select(val) }\n end\n end", "def values\n @values\n end", "def values\n @values\n end", "def existing_value_inputs\n if primitive?\n # We can't use fields_for, and in fact we don't (currently) yield at all,\n # we do clever things with arrays.\n (base_model.send(attribute_name) || []).collect do |str|\n wrap_with_repeatable_ui do\n if caller_content_block.nil?\n default_primitive_input(str)\n else\n caller_content_block.call(primitive_input_name, str)\n end\n end\n end\n else\n # we use fields_for, which will repeatedly yield on repeating existing content\n form_builder.fields_for(attribute_name) do |sub_form|\n wrap_with_repeatable_ui do\n caller_content_block.call(sub_form)\n end\n end\n end\n end", "def values() end", "def attributes\n instance_values\n end", "def values\n end", "def attributes\n instance_values\n end", "def view_data name, fields=\"*\"\n fields = \"*\" if fields == \"\"\n stmt = \"select #{fields} from #{name}\"\n stmt << $where_string if $where_string\n stmt << $order_string if $order_string\n view_sql stmt\n @form.by_name['tarea'] << stmt if @form # nil when called from menu\nend", "def fields reload = false\n\t\t\t@fields = false if reload\n\t\t\t@fields ||= RealEstate.get_fields self\n\t\tend", "def fields\n self.class.fields(true)\n end", "def fields_on_form() #:nodoc:\r\n fields = []\r\n if @form['form']['fields']\r\n# read only field elements (key is Fixnum)\r\n @form['form']['fields'].each {|key,options| fields << options if key.class == Fixnum }\r\n else\r\n @form['form']['tabs'].keys.each do |tab|\r\n @form['form']['tabs'][tab].each {|key,options| fields << options if key.class == Fixnum }\r\n end \r\n end\r\n fields\r\nend", "def values\n end", "def each\n super do |fields|\n form = fields.delete(@@form)\n raise \"Missing #{@@form} value\" if form.nil?\n # Values missing from the final field in a row will be returned as\n # nil. Map them to empty string.\n fields.each { |f,v| fields[f] = \"\" if v.nil? }\n # Features with empty values are unspecified: remove them.\n fields.delete_if { |f,v| v.empty? }\n # Convert feature strings to symbols.\n features = {}\n fields.each {|f,v| features[f.to_sym] = v.to_sym}\n yield [form, features]\n end\n end", "def build_get_pallet_number_form()\n\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n\tfield_configs = Array.new\n\n field_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'pallet_number'}\n\n\n\n\tbuild_form(nil,field_configs,'submit_mixed_pallet_id','pallet_number','submit')\n\nend", "def names \n all_forms\n end", "def index\n @tbl_form_fields = TblFormField.all\n end", "def fetch_fields\n @enumerator ||= Enumerator.new do |collection|\n response = client.call(:do_get_sell_form_fields_ext,\n country_code: client.country_code,\n local_version: 0,\n webapi_key: client.webapi_key)[:do_get_sell_form_fields_ext_response][:sell_form_fields][:item]\n if response.is_a? Array\n response.each {|data| collection << AllegroApi::Field.from_api(data) }\n else\n collection << AllegroApi::Field.from_api(response)\n end\n end.memoizing\n end", "def form_field_set\n @attributes[:form_field_set]\n end", "def all_forms\n\t\t\treturn [{}]\n\t\tend", "def atv2_details(firstname, lastname, email)\n firstname_field_v2.send_keys firstname\n lastname_field_v2.send_keys lastname\n email_field_v2.send_keys email\n dropdown_select\n end", "def fields\n self.class.fields\n end", "def fields\n if frozen?\n Array(@gapi.fields).map { |f| Field.from_gapi(f).freeze }.freeze\n else\n Array(@gapi.fields).map { |f| Field.from_gapi f }\n end\n end", "def index\n prepara_form\n @garagens = Garagem.all\n end", "def get_attribute_values() \n @attribute_values_flat\n end", "def fields\n self.class.fields\n end", "def fields\n self.class.fields\n end", "def fields\n self.class.fields\n end", "def fields\n self.class.fields\n end", "def fields\n self.class.fields\n end", "def show_fields\n self.class.fields.values.select { |field| field.show }\n end", "def index\n @template_form_fields = TemplateFormField.all\n end", "def field_options\n self.class.fields.values\n end", "def all_fields\n return @all_fields if defined? @all_fields\n\n @all_fields ||= fields.includes(field_set: [:catalog]).each_with_object([]) do |field, all|\n all << field\n next unless field.is_a?(Field::ChoiceSet)\n\n field.choices.includes(:category).each do |choice|\n category = choice.category\n next unless category&.not_deleted?\n\n additional_fields = category.fields.includes(field_set: [:catalog]).map do |f|\n f.category_choice = choice\n f.category_choice_set = field.choice_set\n f\n end\n all.concat(additional_fields)\n end\n end\n end", "def new_basic_predetails\n\t\t@petsitter = Petsitter.new #object that form will bind to \n\t\t\n\t\t# we could have put what is below directly in the view but the controller's job is supposed to be to ask data from the model and set it up for the views - the view should be completely decoupled from the model( the view should never know of the model's existence )\n\t\t@all_residential_areas_in_nairobi = ResidentialArea.all\n\tend", "def index\n @tbl_form_field_helpers = TblFormFieldHelper.all\n end", "def form\n @form ||= Steps::FormObjectFactory.form_object_for(step, enrollment)\n end", "def all_talent_forms_page\n \t@male = Male.new\n \t@female = Female.new\n \t@photo = Photo.new\n \t@hair = Hair.new\n \t@mua = Mua.new\n \t@stylist = Stylist.new\n \t@client = Client.new\n end", "def values\n @values\n end", "def preview\n @form_data = Form.get_form_by_code(current_user[\"id\"], params[:code])\n @questions = Question.get_questions_by_ids(@form_data['id'], JSON.parse(@form_data['question_order']))\n @all_options = Option.collect_options_per_quetions(JSON.parse(@form_data['question_order']))\n end", "def values\n @values.values\n end", "def index\n @fields = all_fields\n end", "def get_listbox_data\n @countries = current_user.company.countries.dropdown_list\n @sectors = current_user.company.sectors.order(:sector)\n @rel_types = current_user.company.rel_types.dropdown_list\n @relationgroups = current_user.company.relations.dropdown_list\n end", "def prepare_form_helpers\n if display_type == \"text_field\"\n return [\"data_fields\", id, {id: id}]\n elsif display_type == \"text_area\"\n return [\"data_fields\", id]\n elsif display_type == \"select\"\n options = values.split(',').each{|opt| opt.squish!}\n return [\"data_fields\", id, options.map{|opt| [opt, opt]}]\n elsif display_type == \"check_box\"\n options = values.split(',').each{|opt| opt.squish!}\n return options.map{|v| [\"data_fields[#{id}]\", v]}\n elsif display_type == \"radio_button\"\n options = values.split(',').each{|opt| opt.squish!}\n return options.map{|v| [\"data_fields[#{id}]\", 1, v]}\n end\n end", "def values\n self\n end", "def save_form_fields\n @save_form_fields ||= collect_save_form_fields\n end", "def form\n ret = {}\n @elems.map do |x|\n name = x['name']\n id = x['id']\n next if (name.nil? && id.nil?)\n value = x['value']\n type = x['type']\n ret[name] = value\n ret[id] = value if ((id || name) != name)\n end\n return FormArray.new(ret)\n end", "def values\n @@values\n end", "def fields\n @fields ||= []\n end", "def value\n res = form_object_value\n res = override_with_form_value(res)\n res\n end", "def fields\n FIELDS\n end", "def fill_form(form_data = {})\n form_data.each do |label, value|\n label_options = self.class.form_labels[label] || raise(\"Undefined form_label '#{label}' for #{self.class.name}.\")\n if label_options.label?\n fill_in(label_options.label, with: value) && next\n else\n send(label_options.method, value)\n end\n end\n end", "def form_data?; end", "def attributes\n @attributes\n end", "def data_dictionary\n @data_dictionary ||= form.data_dictionary\n end" ]
[ "0.6234088", "0.6209407", "0.5971967", "0.59625804", "0.5835695", "0.5789007", "0.5739942", "0.57168674", "0.5700989", "0.5695639", "0.56948835", "0.56760174", "0.56738585", "0.5668976", "0.5629696", "0.56075555", "0.56002", "0.5598221", "0.55926913", "0.5584008", "0.5577583", "0.55459386", "0.5545858", "0.55193114", "0.55163234", "0.5511103", "0.5479239", "0.54559994", "0.5441929", "0.5431709", "0.54298145", "0.54107034", "0.5403154", "0.53999865", "0.5377055", "0.53508604", "0.5349526", "0.53126985", "0.52971995", "0.52832115", "0.5263779", "0.52490985", "0.52490985", "0.52485794", "0.5220139", "0.52021277", "0.51956457", "0.51956457", "0.51777697", "0.5177638", "0.51761824", "0.5166043", "0.5164301", "0.5154566", "0.5148802", "0.5145131", "0.5139396", "0.5138431", "0.5137403", "0.51371735", "0.5135019", "0.5122855", "0.51080686", "0.50659686", "0.5052294", "0.5046965", "0.504147", "0.50366277", "0.50364643", "0.5036095", "0.50323135", "0.50323135", "0.50323135", "0.50323135", "0.50319755", "0.50143373", "0.5010983", "0.5006436", "0.49959525", "0.49899697", "0.49851397", "0.49721617", "0.4965095", "0.49647784", "0.49547276", "0.49469373", "0.49467424", "0.49456644", "0.49411905", "0.49404126", "0.49377793", "0.49370432", "0.49343416", "0.49332052", "0.49243236", "0.49224633", "0.49219388", "0.49174383", "0.49139732", "0.4903442" ]
0.71224344
0
Matches names in glade form to keys in a Hash.
def set_glade_hash(hash) return unless hash.is_a?(Hash) hash.each { |key,val| fill_control( key.to_s, val.to_s) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matching_keys(name)\n matched_keys = []\n @all_se.each_key do |k|\n if /#{name}/.match(k)\n matched_keys << k\n end\n end\n matched_keys\n end", "def check_name(hash, name_to_check)\n hash.each_key do |name|\n if name == name_to_check\n true\n else\n false\n end\n end\nend", "def matched_hash( match )\n\t\t\treturn match.names.inject( {} ) do |accum,name|\n\t\t\t\tvalue = match[ name ]\n\t\t\t\taccum[ name.to_sym ] = value\n\t\t\t\taccum\n\t\t\tend\n\t\tend", "def lookup_dictionary(abbrev)\n results = []\n dictionary.each do |key, values|\n next if values.nil?\n matched_keys = values.keys.select { |k| k.to_s.casecmp(abbrev) == 0 }\n # => ['tbd', 'rhel'] ...\n matched_keys.each do |k|\n results << [k, values[k]]\n end\n end\n results.empty? ? false : results\n end", "def names\n iterator = @form_fields.keySet.iterator\n set = []\n set << iterator.next.toString.to_sym while iterator.hasNext\n set\n end", "def hash_key(name); end", "def search(key)\n results = structs.keys.grep(/#{key}/)\n shortened_names = results.map { |result| result.gsub(\"#{key}.\", '') }\n shortened_names.zip(structs.values_at(*results)).to_h.merge(global)\n end", "def lookup_keys(&blk)\n yield name\n yield name.upcase\n yield name.downcase\n yield methodized_name\n yield methodized_name.to_sym\n yield constantized_name\n yield constantized_name.to_sym\n end", "def dictionary\nsubs = {\n \"hello\"=>\"hi\",\n \"to\" => \"2\",\n \"two\" => \"2\",\n \"too\" => \"2\",\n \"for\" => \"4\",\n \"four\" => \"4\",\n \"be\" => \"b\",\n \"you\" => \"u\",\n \"at\" => \"@\",\n \"and\" => \"&\"\n}\nend", "def select_upcase_keys(hash)\n upcase_keys = Hash.new()\n hash.each { |k,v| upcase_keys[k] = v if k == k.upcase }\n return upcase_keys\nend", "def keys\n [ name ]\n end", "def select_upcase_keys(hash)\n res_hash = {}\n hash.each{|k,v| res_hash[k] = v if k.upcase == k}\n res_hash\nend", "def abbreviations\n answers_hash.keys\n end", "def rubyize_keys\n transform_keys do |key|\n key\n .to_s\n .gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .downcase\n .to_sym\n end\n end", "def names_hash\n names_list = []\n @person.names.each do |name_obj|\n name_obj.name_forms.each do |name_form_obj|\n name_hash = {}\n name_hash[:full] = name_form_obj.get_full_text\n first_name = name_form_obj.parts.find{|part| part.get_type.to_s == TYPES[:given] }\n unless first_name.nil?\n name_hash[:first] = first_name.get_value\n end\n last_name = name_form_obj.parts.find{|part| part.get_type.to_s == TYPES[:surname] }\n unless last_name.nil?\n name_hash[:last] = last_name.get_value\n end\n names_list << name_hash\n end\n end\n names_list\n end", "def check_hook_name_format(hash); end", "def key?(name)\n raw.key?(name.to_s)\n end", "def mapping\n {key => name}\n end", "def dictionary \n \n dictionary = { \n \"hello\" => 'hi',\n \"to, two, too\" => '2',\n \"to\" => '2',\n \"two\" => '2',\n \"too\" => '2',\n \"for, four\" => '4',\n \"four\" => '4',\n \"for\" => '4',\n \"For\" => '4',\n 'be' => 'b',\n 'you' => 'u',\n 'at' => \"@\",\n \"and\" => \"&\"\n }\n \nend", "def pet_shop_name(name)\n return name[:name]\nend", "def extract_hash(str, pat, *matchvars)\n rc = {}\n\n # get the possibilities from the pattern\n namemap = pat.named_captures\n\n pat.match(str) do |m|\n matchvars.each { |var| rc[var] = m.values_at(namemap[var]) if namemap.key? var }\n end\n\n rc\n end", "def key_matcher(pattern, options); end", "def key?(name)\n matches = select(name)\n matches.any?\n end", "def normalize_abbreviation_key(key); end", "def find word\n result = {}\n @d.each_pair do|key, value|\n if key =~ /^#{word}/\n result[key] = value\n end\n end\n result\n end", "def keys\n [:name, :username, :email, ]\n end", "def keys(name)\n key_schema(name).each_with_object({}) do |s, h|\n h[s.key_type.downcase.to_sym] = s.attribute_name\n end\n end", "def possible_keys(key); end", "def item_included?(str, hash)\n hash.each do |key, value|\n return true if key == str\n end\n false\nend", "def get(name)\n return {} if name.blank?\n\n all.detect { |a| a[\"name\"].casecmp(name).zero? }\n end", "def get(name)\n return {} if name.blank?\n\n all.detect { |a| a[\"name\"].casecmp(name).zero? }\n end", "def dictionary\n dictionary = {\n :hello => [\"hi\"],\n :Hello => [\"Hi\"],\n :to => [\"2\"],\n :To => [\"2\"],\n :too => [\"2\"],\n :Too => [\"2\"],\n :two => [\"2\"],\n :Two => [\"2\"],\n :for => [\"4\"],\n :For => [\"4\"],\n :four => [\"4\"],\n :Four => [\"4\"],\n :be => [\"b\"],\n :Be => [\"b\"],\n :you => [\"u\"],\n :You => [\"u\"],\n :at => [\"@\"],\n :At => [\"@\"],\n :and => [\"&\"],\n :And => [\"&\"]\n }\nend", "def find_values(tag)\n results =[]\n dictionary.each do |key, values|\n next if values.nil?\n matched_keys = values.select { |k,v| v.to_s =~ /@#{tag}( |$)/i }.keys.each do |k|\n results << k\n end\n end\n results\n end", "def routes_fix_names(old_routes)\n new_routes = {}\n old_routes.each do |key,values|\n # puts \"old_routes[#{key}] => #{values.inspect}\"\n new_routes[key] = values.collect do |subname|\n searchname = nil\n if old_routes[subname]\n searchname = subname \n elsif old_routes[subname.camel_case]\n searchname = subname.camel_case\n elsif old_routes[subname.singularize.camel_case]\n searchname = subname.singularize.camel_case\n end\n searchname\n end.compact.uniq\n # puts \"new_routes[#{key}] => #{new_routes[key].inspect}\"\n end\n new_routes\n end", "def mgsub(key_value_pairs=[].freeze)\n regexp_fragments = key_value_pairs.collect { |k,v| k }\n gsub(Regexp.union(*regexp_fragments)) do |match|\n key_value_pairs.detect{|k,v| k =~ match}[1]\n end\n end", "def name_switch(str)\n name_hash = Hash.new,\n str.reverse.tr(\"\\\\^aeiou\", \"*\")\nend", "def dictionary\n {\n :hello => \"hi\",\n :to => \"2\",\n :too => \"2\",\n :two => \"2\",\n :four => \"4\",\n :for => \"4\",\n :be => \"b\",\n :you => \"u\",\n :at => \"@\",\n :and => \"&\"\n }\nend", "def collect_prefixes hash, prefix\n prefix_matcher = Regexp.new(\"^#{prefix}\")\n hash\n .select { |name| prefix_matcher =~ name }\n .reduce({}) do |memo, name|\n memo[name[0].gsub(prefix_matcher, '')] = name[1]\n memo\n end\nend", "def mgsub(key_value_pairs=[].freeze)\n regexp_fragments = key_value_pairs.collect { |k,v| k }\n gsub(Regexp.union(*regexp_fragments)) do |match|\n key_value_pairs.detect { |k,v| k =~ match}[1]\n end\n end", "def fields_for(hsh, lang)\n separator = LANG_SEP\n suffix = /#{separator}#{lang}\\z/i\n\n hsh.reject{|key, val| val.blank?}.hmap do |key, value|\n [key.sub(suffix, '').to_sym, value]\n end\nend", "def dictionary\n {\n \"hello\" => 'hi',\n \"to\" => '2',\n \"two\" => '2',\n \"too\" => '2',\n \"for\" => '4',\n \"For\" => '4',\n \"four\" => '4',\n \"be\" => 'b',\n \"you\" => 'u',\n \"at\" => '@',\n \"and\" => '&'\n }\nend", "def has_name?(name)\n @hash.has_key?(name)\n end", "def match_value (hsh, value)\n\tvv = simplify_ascii value\n\thsh.each { |key, v| return key if (simplify_ascii(v) == vv) }\n\tnil\nend", "def vash_key_name(*args); 'option name'; end", "def keys\n @keys ||= fields.order(:fieldnum).select do |field|\n field.useedit & 1 == 1\n end.map do |field|\n field.fieldname.downcase\n end\n end", "def load_param\n to_hash.select { |_key, value| value }\n .map { |key, value| [key.to_s.split('_').map(&:capitalize).join.sub!(/\\D/, &:downcase), value] }\n .to_h\n end", "def hash\n h = name.downcase.hash\n h\n end", "def dictionary\n {\n :hello => \"hi\",\n :to => \"2\",\n :two => \"2\",\n :too => \"2\",\n :for => \"4\",\n :four => \"4\",\n :be => \"b\",\n :you => \"u\",\n :at => \"@\",\n :and => \"&\"\n}\nend", "def hkeys(key); end", "def hkeys(key); end", "def symbolize_hash_keys(hash); end", "def checking_dictionary_for_word_match\n valid_word?(@prefix)\n end", "def validate_property_name(name)\n valid_name = name.gsub(/-/, \"_\").camelcase(:lower)\n if KeyWords.include? valid_name\n valid_name = KeywordsSubstitute[valid_name]\n end\n valid_name\n end", "def dictionary \n {\n \"hello\" => 'hi',\n \"to\" => '2',\n \"two\" => '2',\n \"too\" => '2',\n \"for\" => '4',\n \"four\" => '4',\n 'be' => 'b',\n 'you' => 'u',\n \"at\" => \"@\", \n \"and\" => \"&\"\n \n }\nend", "def autocomplete(input, dictionary)\n input.delete!(\"^a-zA-Z\")\n dictionary.lazy.select{ |word| word.downcase.start_with?(input.downcase) }.first(5)\nend", "def keys(*) end", "def autocomplete(input, dictionary)\n mod_input = input.gsub(/[^a-zA-Z]/,\"\") \n dictionary.select { |word| word if word.start_with?(mod_input.downcase) || word.start_with?(mod_input.capitalize)}\n .first(5)\nend", "def matched_keys\n @matched.keys\n end", "def dictionary\n dictionary = {\n hello: \"hi\",\n to: \"2\",\n two: \"2\",\n too: \"2\",\n for: \"4\",\n four: \"4\",\n be: \"b\",\n you: \"u\",\n at: \"@\",\n and: \"&\"\n }\nend", "def dictionary\n{\n \"hello\" => \"hi\",\n \"to\" => \"2\",\n \"two\" => \"2\",\n \"too\" => \"2\",\n \"for\" => \"4\",\n \"four\" => \"4\",\n \"be\" => \"b\",\n \"you\" => \"u\",\n \"at\" => \"@\",\n \"and\" => \"&\"\n}\nend", "def key_for_min_value(name_hash)\n ikea = {:chair => 25, :table => 85, :mattress => 450}\nend", "def player_name(hash)\n return hash[:name]\nend", "def name_as_search_key\n QueryField.mapping(@name)\n end", "def key_variants; end", "def dictionary\n dictionary={\"hello\":\"hi\",\n \"to\":\"2\",\n \"two\":\"2\",\n \"too\":\"2\",\n \"for\":\"4\",\n \"For\":\"4\",\n \"four\":\"4\",\n \"be\":\"b\",\n \"you\":\"u\",\n \"at\":\"@\",\n \"and\":\"&\"}\nend", "def search_keys \n return search_field_definitions.keys\n end", "def key?(name)\n name_key_map.key?(name)\n end", "def string_include_key?(string, key)\n \nend", "def string_include_key?(string, key)\n \nend", "def string_include_key?(string, key)\n \nend", "def report_by_flavors(hash)\n\tflavors = {}\n\tflavor_array = []\t\n\thash.each do |name, flavor|\n\t\tif flavor_array.include? (flavor)\n\t\t\tflavors[flavor].push(name)\n\t\t#checks if hash already has given flavor as a key\n\t\t#creates a list of names by retrieving key from original hash\n\t\telse\n\t\t\tflavors[flavor] = [name]\n\t\t\tflavor_array.push flavor\n\t\tend\n\tend\n\tputs flavors\nend", "def set_partial_name_match\n return unless (self.id.nil? || self.name_changed?) && ((!self.latitude.nil? && !self.longitude.nil?) || border_points.length >= 3) \n #For each place look for trimmed name inside the places full names\n Place.find_by_radius(centerLatitude, centerLongitude, LARGE_LINKING_RADIUS).each do |place|\n next if place == self\n trimmed_names.each do |trimmed|#Look for trimmed names in neighbour places names\n\tplace.raw_names.each do |name|\n\t if name.match(trimmed)\n\t self.partial_name_match = false\n\t return\n\t end\n\tend\n end\n end\n #Load the dictionary\n words = {}\n File.open(\"public/words\") do |file|\n file.each do |line|\n conv_line = (line + ' ').encode(\"UTF-8\",\"iso-8859-1\")[0..-2]\n words[conv_line.strip] = true\n end\n end\n #p words[\"magic\"]\n #Look for trimmed names in the dictionary\n trimmed_names.each do |trimmed|\n if words[trimmed]\n\tself.partial_name_match = false\n\treturn\n end\n end\n self.partial_name_match = true\n end", "def filter_out_unwanted_names(output, names)\n names.each do |match|\n output.keys.each do |uuid|\n output[uuid].keys.each do |name|\n unless name_matches?(name, match)\n output[uuid].delete name\n end\n end\n end\n end\n end", "def missing_keys(route, parts); end", "def report_by_name(hash)\n\tnames = hash.keys.sort\n\tnames.each do |name|\n\t\tputs name.to_s + \"'s favorite flavor(s) are: \" + hash[name].join(', ')\n\tend\nend", "def stringified_keys; end", "def fields\n iterator = @form_fields.keySet.iterator\n map = {}\n while iterator.hasNext\n key = iterator.next.toString\n map[key.to_sym] = field(key)\n end\n map\n end", "def bnchmrk\n word_array = File.read(\"/usr/share/dict/words\").split(/\\W/)\n test_hash = HashBrian.new(\"brian\", \"nairb\")\n word_array.each do |word|\n key = word.downcase\n value = word.downcase.reverse\n test_hash.set_key(key, value)\n end\nend", "def matching_mapping(key)\n regexp_mappings = (mapping || {}).select { |k, _v| k.class == Regexp }\n (regexp_mappings.detect { |rex, _init| rex.match?(key.to_s) } || []).last\n end", "def set_name(hash)\n self[name_var] = hash.delete(name_var) if name_var\n end", "def xml_keys target\n lazy_load_strings\n @strings_xml.select { |key, value| key.downcase.include? target.downcase }\n end", "def prefix_match(prefix)\n val = []\n database.each do |k, v|\n if k.downcase.start_with?(prefix)\n val.push(v)\n end\n end\n if val.size == 0\n val = ['Key Not Found!']\n end\n val\n end", "def select_by_key_regexp(h, regexp)\n h.select { |key, value| key.to_s.match(regexp) }\n end", "def normalize_keys(hash)\n hash.inject(HashWithIndifferentAccess.new) do |new_hash, (key, value)|\n new_hash[key.parameterize(separator: \"_\")] = value\n new_hash\n end\n end", "def dictionary\n { \"hello\" => \"hi\",\n \"to\" => \"2\",\n \"two\" => \"2\",\n \"too\" => \"2\",\n \"for\" => \"4\",\n \"four\" => \"4\",\n \"be\" => \"b\",\n \"you\" => \"u\",\n \"at\" => \"@\",\n \"and\" => \"&\" }\nend", "def keys\n fields.map { |f| f.name }\n end", "def test_Hash_InstanceMethods_key?\n\t\ta = {'Father'=>'Jedi', 'Mother'=>'Becky'}\n\t\tassert_equal(true, a.key?('Father'))\n\t\tassert_equal(true, a.key?('Mother'))\n\tend", "def dictionary \n\tdictionary = {\n\t\t:hello => \"hi\", \n\t\t:to => \"2\",\n\t\t:two => \"2\",\n\t\t:too => \"2\",\n\t\t:for => \"4\",\n\t\t:four => \"4\",\n\t\t:be => \"b\",\n\t\t:you => \"u\",\n\t\t:at => \"@\",\n\t\t:and => \"&\"\n\t}\nend", "def dictionary(word)\n words = {\n \"hello\": 'hi',\n \"to\": '2',\n \"two\": '2', \n \"too\": '2',\n \"for\": '4',\n \"be\": 'b',\n \"you\": 'u',\n \"at\": '@',\n \"and\": '&'\n }\n words[word.downcase.to_sym]\nend", "def matches(hash)\n matched = true\n hash.each do |k, v|\n if matched #only continue loop if we continue to match properties\n case k.to_s\n when \"cpu\"\n @cpu == v ? matched = true : matched = false\n when \"display\"\n @display_size == v ? matched = true : matched = false\n when \"number_cores\"\n @number_cores == v ? matched = true : matched = false\n end #case\n end #if matched\n end #each\n matched\n end", "def my_include?(dict, query)\n dict.each do |valid_word|\n if valid_word == query\n return true\n end\n end\n return false\nend", "def city_names(hash)\n hash.each{ |k,v| puts k}\nend", "def find_attributes_starting_with(name)\n @attributes.select { |key| key.to_s.start_with?(name) }\n end", "def clean_fields(fields)\n fields.map { |k, v| [k.to_s.downcase.gsub(/ |-/, '_'), v] }.to_h\n end", "def _(key)\n#puts key.to_s + \" => \" + FLAVOUR[key.to_sym]\n FLAVOUR[key.to_sym] || key.to_s\n end", "def handle_key(key); end", "def set_vector_with_names_via_hash(r_var_name, hash)\n vals = array_to_r_vector(hash.values)\n nms = array_to_r_vector(hash.keys, :string_vals => true)\n\n command = \"#{r_var_name} <- #{vals}; names(#{r_var_name}) = #{nms}\"\n @con.eval(command)\n end", "def uniqueness_dictionary\n [*(:A..:Z), *(:a..:z), *(0..9)].map(&:to_s)\n end", "def equivalent_hash?(a, b)\n lower_a = Hash[a.map { |k, v| [k.downcase, v] }]\n lower_b = Hash[b.map { |k, v| [k.downcase, v] }]\n return lower_a == lower_b\nend", "def dictionary\n dictionary = {\n hello: \"hi\", to: \"2\", two: \"2\", too: \"2\", for: \"4\", four: \"4\", be: \"b\", you: \"u\", at: \"@\", and: \"&\"\n }\nend" ]
[ "0.6833061", "0.6287518", "0.61020285", "0.6043875", "0.5921624", "0.5733593", "0.5627251", "0.55030674", "0.54904777", "0.5469656", "0.5431803", "0.54228765", "0.5405435", "0.5397231", "0.5387118", "0.53635156", "0.5354769", "0.5335571", "0.53334033", "0.531978", "0.5319746", "0.53051436", "0.52899486", "0.5248673", "0.5247538", "0.5220246", "0.5210805", "0.5210615", "0.5203955", "0.5200536", "0.5200536", "0.5185417", "0.51851207", "0.51707655", "0.51662177", "0.51654917", "0.51585925", "0.51396334", "0.51386386", "0.5137703", "0.5135391", "0.5134519", "0.5134296", "0.512535", "0.5122713", "0.5122488", "0.5117816", "0.51177055", "0.5114441", "0.5114441", "0.5106721", "0.5102057", "0.50955313", "0.5089625", "0.5083351", "0.5068823", "0.5063642", "0.50626445", "0.50574774", "0.50565535", "0.50539845", "0.50459224", "0.5038722", "0.50346786", "0.5022944", "0.50166464", "0.5016506", "0.49865794", "0.49865794", "0.49865794", "0.49779814", "0.49728265", "0.49707475", "0.49706244", "0.49693704", "0.4967874", "0.49657008", "0.496247", "0.4961734", "0.49584204", "0.49532557", "0.49441046", "0.49437997", "0.4939232", "0.4937449", "0.49364266", "0.4929046", "0.49201983", "0.4918749", "0.4916546", "0.49164432", "0.4916313", "0.4915497", "0.49123365", "0.49114946", "0.49064273", "0.49060714", "0.49019948", "0.4892596", "0.4890883" ]
0.49440527
82
Populates the glade form from the instance variables of the class. So instead of having to assign each widget a value:
def set_glade_variables(obj = self) obj.instance_variables.each do |name| name = name.to_s #ruby 1.9 passes symbol! v = obj.instance_variable_get(name) name = name.gsub('@', '') if v.is_a?(Array) v.each_index do |i| fill_control("#{name}[#{i.to_s}]", v[i] ) end elsif v.is_a?(Hash) v.each_pair do |key, val| fill_control("#{name}[#{key.to_s}]", val) end else fill_control(name, v) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(form_values, options)\n @form_values = form_values\n @form_args = options.dup\n @g = Gestalt.new\n end", "def widgets= mine_widgets\n @form.wigets = mine_widgets\n end", "def fill_inputs\n update(:all,'input').with do\n if element[:name] and element[:name].match(/([a-z,_]+)\\[([a-z,_]+)\\]/)\n element[:value] = send($1).send($2)\n end\n end\n update(:all,'textarea').with do\n if element[:name] and element[:name].match(/([a-z,_]+)\\[([a-z,_]+)\\]/)\n element.inner_html = send($1).send($2)\n end\n end\n end", "def set_form_instance_variables\n\t\t@list=List.new\n\t\t@task=@current_list.tasks.new\n\tend", "def set_form_variables\n @articles = CriminalCode.all.includes(:articles).with_translations\n @tags = Tag.includes(:translations).order(:name)\n @prisons = Prison.includes(:translations).order(:name)\n\n gon.select_charges = t('shared.actions.with_obj.select',\n obj: t('activerecord.models.charge', count: 999))\n gon.select_tags = t('shared.actions.with_obj.select',\n obj: t('activerecord.models.tag', count: 999)) \n end", "def set_data(params)\n\t\t#if this is the first time, need to initialize the hash\n\t\tif !self.data[:control_widget] then self.data[:control_widget] = {} end\n\t\t\n\t\tself.data[:control_widget][:choice_1_label_1] = params[:choice_1_label_1]\n\t\tself.data[:control_widget][:choice_1_dest1_page_id] = params[:choice_1_dest1_page_id]\n\t\tself.data[:control_widget][:choice_2_label_1] = params[:choice_2_label_1]\n\t\tself.data[:control_widget][:choice_2_dest2_page_id] = params[:choice_2_dest2_page_id]\n\tend", "def fill_out_form(hash)\n self.main_title=hash[:main_title]\n self.main_author=hash[:main_author]\n self.co_authors=hash[:co_authors]\n self.publisher=hash[:publisher]\n self.place_of_publication=hash[:place]\n self.volume_title=hash[:volume_title]\n self.volume_information=hash[:volume_info]\n self.year=hash[:year]\n self.number=hash[:number]\n self.series_title=hash[:series]\n self.url=hash[:url]\n end", "def fill_in_form(fields)\n fields.each do |field, value|\n f = send(\"#{field}_field\")\n f.set(value) || Array(value).each { |val| f.select(val) }\n end\n end", "def init_vars\n @hbox = Gtk::HBox.new\n @mode_vbox = Gtk::VBox.new\n @idiom_vbox = Gtk::VBox.new\n @geral_vbox = Gtk::VBox.new\n @new_btn = Gtk::Button.new('')\n @quit_btn = Gtk::Button.new('')\n self.resizable = false\n self.modal = true\n @mode_rdo = []\n (0..4).each{|i|\n @mode_rdo[i] = OptionsRadioButton.new(@mode_rdo[0])\n }\n @mode_rdo[0].selected = true\n @idiom_rdo = []\n (0..2).each{|i|\n @idiom_rdo[i] = Gtk::RadioButton.new(@idiom_rdo[0])\n }\n end", "def forms; end", "def fill_form(new_values = {})\n reset!(new_values)\n dom_writer.fill(values)\n end", "def set_elements\n super\n element(:patron_id_field) {b.text_field(:id => \"olePatronId_control\")}\n element(:barcode_field) {b.text_field(:id => \"barcode_control\")}\n element(:first_name_field) {b.text_field(:id => \"firstName_control\")}\n element(:last_name_field) {b.text_field(:id => \"lastName_control\")}\n element(:borrower_type_selector) {b.select_list(:id => \"borrowerType_control\")}\n element(:email_address_field) {b.text_field(:id => \"emailAddress_control\")}\n # Search Controls\n # TODO Move these elements to OLE_QA::Framework::OLELS::Lookup (common) when they become universal.\n element(:active_yes_button) {b.radio(:id => 'activeIndicator_control_0')}\n element(:active_no_button) {b.radio(:id => 'activeIndicator_control_1')}\n element(:active_both_button) {b.radio(:id => 'activeIndicator_control_2')}\n element(:search_button) {b.button(:text => \"Search\")}\n element(:clear_button) {b.button(:text => \"Clear Values\")}\n element(:cancel_button) {b.button(:text => \"Cancel\")}\n end", "def dynamic_form_fields(builder)\n # Allow dynamic fields in our Project to be processed by form_for\n create_virtual_attributes!\n\n @object.fields.each do |field|\n h.haml_concat process_field(builder, field)\n end\n end", "def ing_form; end", "def set_glade_all(obj = self) \r\n set_glade_active_record(obj)\r\n set_glade_variables(obj)\r\n end", "def get_glade_variables(obj = self)\r\n obj.instance_variables.each do |var_name|\n next if var_name == :@builder or var_name == :@top_level_window\n var = obj.instance_variable_get(var_name)\r\n var_name = var_name.to_s.gsub(\"@\", \"\") #fix for ruby 1.9 giving symbols\n if var.is_a? Hash\n var.each_pair do |key, val|\n if glade_value = get_control_value(\"#{var_name}[#{key.to_s}]\", obj)\n var[key] = glade_value\n end \n end\n obj.instance_variable_set(\"@\"+ var_name, var)\n elsif var.is_a? Array\n var.each_index do |i|\n if glade_value = get_control_value(\"#{var_name}[#{i.to_s}]\", obj)\n var[i] = glade_value\n end\n end\n obj.instance_variable_set(\"@\"+ var_name, var)\n else\n glade_value = get_control_value(var_name, obj)\n obj.instance_variable_set(\"@\"+ var_name, glade_value) unless glade_value.nil?\n end\n end\r\n end", "def set_up_form(form_class, form)\n # Set an instance variable for the form (eg. @conviction_approval_form) using the provided class\n instance_variable_set(\"@#{form}\", form_class.new(@resource))\n end", "def populate_fields(target,data)\n data.each{|key,value|target.text_field(:name=>key).set value}\nend", "def fill_out_form(hash)\n self.institution=hash[:institution]\n self.department=hash[:department]\n self.title_role=hash[:title]\n self.email=hash[:email]\n self.instant_messaging=hash[:im]\n self.phone=hash[:phone]\n self.mobile=hash[:mobile]\n self.fax=hash[:fax]\n self.address=hash[:address]\n self.city=hash[:city]\n self.state=hash[:state]\n self.postal_code=hash[:zip]\n self.country=hash[:country]\n end", "def build_form(form_builder, options)\n set_value_in_hash options\n value = CckForms::ParameterTypeClass::Time::date_object_from_what_stored_in_database(options[:value])\n form_element_options, form_element_html = CckForms::ParameterTypeClass::Time.default_options_for_date_time_selectors(value, options)\n form_element_options.merge!({minute_step: 5})\n form_element_html.merge!({required: options[:required]})\n ('<div class=\"form-inline\">%s</div>' % form_builder.fields_for(:value) { |datetime_builder| datetime_builder.datetime_select '', form_element_options, form_element_html})\n end", "def form; end", "def setup_form\n build_form\n super\n end", "def initialize_fields\n terms_for_editing.each do |key|\n # if value is empty, we create an one element array to loop over for output \n self[key] = [''] if self[key].empty?\n end\n end", "def initialize form, config={}, &block\n @surround_chars = ['(', ')'] if @surround_chars.nil?\n super\n $log.warn \"XXX: FIXME Please set 'value' for radiobutton. If not sure, try setting it to the same value as 'text'\" unless @value\n # I am setting value of value here if not set 2011-10-21 \n @value ||= @text\n ## trying with off since i can't do conventional style construction\n #raise \"A single Variable must be set for a group of Radio Buttons for this to work.\" unless @variable\n end", "def builder\n form\n end", "def model_form(params={})\n # {{{\n method = params[:action]\n instance = params[:instance]\n klass = params[:model]\n klass ||= @klass\n\n custom_elements = {}\n log { \"Custom Form Elements: #{custom_form_elements.inspect}\" }\n custom_form_elements.each_pair { |clause, value|\n clause_parts = clause.to_s.split('.')\n table = clause_parts[0..1].join('.')\n attrib = clause_parts[2]\n custom_elements[table] = Hash.new unless custom_elements[table]\n custom_elements[table][attrib.to_sym] = value\n }\n view = @@form_generator.new(klass)\n view.labels = Lang[plugin_name]\n view.custom_elements = custom_elements\n form = view.form\n\n form.add(GUI::Hidden_Field.new(:name => :action, :value => method.to_s, :required => true)) if method\n form.add(GUI::Hidden_Field.new(:name => :controller, :value => klass.model_name.to_s, :required => true))\n\n form_values = {}\n default_form_values.each_pair { |attrib, value|\n form_values[attrib.to_s] = value\n }\n \n if instance then\n instance.attribute_values.each { |table, args| \n args.each { |name, value|\n form_values[\"#{table}.#{name}\"] = value\n }\n }\n klass.get_primary_keys.each { |table, keys|\n keys.each { |key|\n pkey_field_name = \"#{table}.#{key}\"\n form.add(GUI::Hidden_Field.new(:name => pkey_field_name, \n :value => instance.attribute_values[table][key], \n :required => true))\n }\n }\n end\n \n if(defined? form_groups) then\n form.fields = form_groups\n end\n if(defined? form_hints) then\n form.hints = form_hints\n end\n\n form.set_values(form_values)\n\n title_key = (klass.table_name).gsub('.','--')+'--add'\n form.title = (Lang[plugin_name][title_key]) unless Lang[plugin_name][title_key] == title_key\n klassname = @klass.to_s.gsub('Aurita::','').gsub('Main::','').gsub('Plugins::','').gsub('::','__').downcase\n form.name = klassname + '_' << method.to_s + '_form'\n form.id = klassname + '_' << method.to_s + '_form'\n\n log('Update form fields: ' << form.fields.inspect)\n log('Update form elements: ' << form.element_map.keys.inspect)\n return form\n end", "def initialize(form, field, type)\n @klass = form.object.class\n @template = form.template\n @year = form.object.year\n @field = field\n @type = type\n end", "def []= i, widget\n @form[i] = widget\n end", "def form_data_initialize(form)\n form = form_generation(form)\n form = 0 unless GameData::Pokemon.all[id][form]\n @form = form\n exp_initialize\n end", "def custom_fields\n if debug?\n channel_fields = ChannelFieldForm.new\n channel_fields.create_field(\n group_id: 1,\n type: 'Checkboxes',\n label: 'Checkboxes',\n fields: {\n field_list_items: \"Yes\\nNo\\nMaybe\"\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Radio Buttons',\n label: 'Radio Buttons',\n fields: {\n field_list_items: \"Left\\nCenter\\nRight\"\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Multi Select',\n label: 'Multi Select',\n fields: {\n field_list_items: \"Red\\nGreen\\nBlue\"\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Select Dropdown',\n label: 'Select Dropdown',\n fields: {\n field_list_items: \"Mac\\nWindows\\nLinux\"\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Select Dropdown',\n label: 'Prepopulated',\n fields: {\n field_pre_populate: 'y'\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Rich Text Editor',\n label: 'Rich Text Editor',\n fields: {\n field_ta_rows: 20,\n field_text_direction: 'Right to left'\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Toggle',\n label: 'Toggle'\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Text Input',\n label: 'Text Input',\n fields: {\n field_maxl: 100,\n field_fmt: 'None',\n field_show_fmt: 'y',\n field_text_direction: 'Right to left',\n field_content_type: 'Decimal',\n field_show_smileys: 'y',\n field_show_file_selector: 'y'\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Textarea',\n label: 'Textarea',\n fields: {\n field_ta_rows: 20,\n field_fmt: 'None',\n field_show_fmt: 'y',\n field_text_direction: 'Right to left',\n field_show_formatting_btns: 'y',\n field_show_smileys: 'y',\n field_show_file_selector: 'y'\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'URL',\n label: 'URL Field',\n fields: {\n url_scheme_placeholder: '// (Protocol Relative URL)'\n }\n ) do |page|\n page.all('input[name=\"allowed_url_schemes[]\"]').each do |element|\n element.click unless element.checked?\n end\n end\n\n @page.load\n else\n $db.query(IO.read('channel_sets/custom-fields.sql'))\n clear_db_result\n end\n end", "def set_vars_for_form region\n @volunteers = Volunteer.all_for_region(region.id).collect{ |v| [v.name,v.id] }\n @donors = Location.donors.where(:region_id=>region.id).collect{ |d| [d.name,d.id] }\n @recipients = Location.recipients.where(:region_id=>region.id).collect{ |r| [r.name,r.id] }\n @food_types = FoodType.regional(region.id).collect{ |ft| [ft.name,ft.id] }\n @transport_types = TransportType.all.collect{ |tt| [tt.name,tt.id] }\n @scale_types = ScaleType.regional(region.id).collect{ |st| [\"#{st.name} (#{st.weight_unit})\",st.id] }\n @regions = Region.all\n end", "def get_definition(cls, bld)\r\n clsVar = CodeNameStyling.getStyled(cls.getUName() + \" form\", Utils.instance.langProfile.variableNameStyle)\r\n clsName = CodeNameStyling.getStyled(cls.getUName() + \" form\", Utils.instance.langProfile.variableNameStyle)\r\n clsIntf = Utils.instance.createVarFor(cls, \"ts_interface\")\r\n\r\n bld.startFunction(\"initData(item: \" + Utils.instance.getStyledClassName(cls.model.name) + \"): void\")\r\n\r\n Utils.instance.eachVar(UtilsEachVarParams.new().wCls(cls).wBld(bld).wSeparate(true).wVarCb(lambda { |var|\r\n if var.isList()\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) + \" = [];\")\r\n else\r\n if Utils.instance.isNumericPrimitive(var)\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) + \" = 0;\")\r\n elsif var.getUType().downcase == \"boolean\"\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) + \" = false;\")\r\n elsif var.getUType().downcase == \"datetime\"\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) + \" = new Date();\")\r\n elsif Utils.instance.isPrimitive(var)\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) + \" = '';\")\r\n else\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) +\r\n \" = {} as \" + Utils.instance.getStyledClassName(var.getUType()) + \";\")\r\n varCls = ClassModelManager.findVarClass(var, \"ts_interface\")\r\n if varCls != nil\r\n vService = Utils.instance.createVarFor(varCls, \"class_angular_data_gen_service\")\r\n\r\n if vService != nil\r\n srcName = \"item.\" + Utils.instance.getStyledVariableName(var)\r\n bld.add(\"this.\" + Utils.instance.getStyledVariableName(vService) +\r\n \".initData(\" + srcName + \");\")\r\n end\r\n end\r\n end\r\n end\r\n }))\r\n\r\n bld.endFunction()\r\n end", "def set_glade_active_record(obj = self)\r\n return if not defined? obj.attributes\r\n obj.attributes.each_pair { |key, val| fill_control(class_name(obj) + \".\" + key, val) }\r\n end", "def fill_form(form_data = {})\n form_data.each do |label, value|\n label_options = self.class.form_labels[label] || raise(\"Undefined form_label '#{label}' for #{self.class.name}.\")\n if label_options.label?\n fill_in(label_options.label, with: value) && next\n else\n send(label_options.method, value)\n end\n end\n end", "def build_get_pallet_number_form()\n\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n\tfield_configs = Array.new\n\n field_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'pallet_number'}\n\n\n\n\tbuild_form(nil,field_configs,'submit_mixed_pallet_id','pallet_number','submit')\n\nend", "def all_talent_forms_page\n \t@male = Male.new\n \t@female = Female.new\n \t@photo = Photo.new\n \t@hair = Hair.new\n \t@mua = Mua.new\n \t@stylist = Stylist.new\n \t@client = Client.new\n end", "def build_rebin_label_station_form(rebin_label_station,action,caption,is_edit = nil,is_create_retry = nil)\n\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n codes = Facility.find_all_by_facility_type_code(\"packhouse\").map{|g|[g.facility_code]}\n\tfield_configs = Array.new\n\tfield_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'rebin_label_station_code'}\n\n\tif is_edit == false\n\t field_configs[1] = {:field_type => 'DropDownField',\n\t\t\t\t\t\t:field_name => 'packhouse_code',\n\t\t\t\t\t\t:settings => {:list => codes}}\n\telse\n\t field_configs[1] = {:field_type => 'LabelField',\n\t\t\t\t\t\t:field_name => 'packhouse_code'}\n\tend\n\n\n\tfield_configs[2] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'ip_address'}\n\n\tbuild_form(rebin_label_station,field_configs,action,'rebin_label_station',caption,is_edit)\n\nend", "def default_form_builder; end", "def configure_form(var_oid, use_format, form_field_name, form_field_oid, form_field_label)\n wait_for_add_new\n add_new.click\n wait_for_variable_oid\n variable_oid.set var_oid\n format.set use_format\n field_name.set form_field_name\n field_oid.set form_field_oid\n label.set form_field_label\n save_form.first.click\n end", "def setup(*)\n # Used to be in an after_add, updated for apotomo 1.2.\n self.respond_to_event :form_submitted, :from => self.name\n self.respond_to_event :revert, :from => self.name\n self.respond_to_event :display_form, :from => self.name\n\n self.where = nil\n self.dom_id = options[:dom_id]\n self.grid_options = {}\n # Guesses that you will use the resource name for the form template.\n self.form_template = options[:resource]\n # Assume that the form is not a multipart (uploader) form\n self.multipart_form = false\n # The orphan template is used when a parent record is needed but not selected\n self.orphan_template = 'orphan'\n # Ensure that we always have a record of some sort\n self.record = resource_model.new\n # Set the name of this resource for public display\n self.human_resource = options[:resource].humanize\n # Set the spokesfield to nil, this needs to be set explicitly\n self.spokesfield = nil\n \n @columns = []\n @sortable_columns = {}\n @default_sort = nil \n\n @filters = {}\n @filter_sequence = []\n @filter_default = {}\n \n @flash_widget = self.dom_id + '_flash'\n self << widget(:grid_flash, @flash_widget)\n \n if options[:form_only]\n @list_widget = nil\n @filters_widget = nil\n self.form_buttons = [\n ['remain', 'Save', 'Add'],\n ]\n else\n @list_widget = self.dom_id + '_list'\n @filters_widget = self.dom_id + '_filters'\n self << widget(:grid_list, @list_widget) do |lw|\n lw << widget(:grid_filters, @filters_widget)\n end\n \n self.form_buttons = [\n ['submit', 'Save+Close', 'Add+Close'],\n ['remain', 'Save', 'Add'],\n ['cancel', 'Cancel', 'Cancel'],\n ]\n end\n end", "def type_value_fields(f)\n controls = []\n\n options_values = INGEST_MAP[f.object.group.to_sym].keys\n options = options_values.collect do |val|\n [OregonDigital::Metadata::FieldTypeLabel.for(val.to_s), val]\n end\n\n controls << f.input(\n :type,\n :collection => options,\n :input_html => {:class => \"input-medium type-selector\"},\n :label_html => {:class => \"sr-only\"},\n :wrapper_html => {:class => \"ingest-control type\"}\n )\n\n input_args = {\n :input_html => {:class => \"input-xxlarge value-field\"},\n :label_html => {:class => \"sr-only\"},\n :wrapper_html => {:class => \"ingest-control value\"}\n }\n\n # SUPER HACK! If we're looking at sets, we don't want free-text, we want a\n # drop-down. Ideally we'd have a nicer way to make any given type do this,\n # but the grouping dropdown makes it really tough without some painful new\n # configurable ingest map format combined with JavaScript that swaps a\n # dropdown over the text input magically\n if f.object.group.to_sym == :collection\n set_pids = ActiveFedora::SolrService.query(\n \"has_model_ssim:#{RSolr.escape(\"info:fedora/afmodel:GenericCollection\")}\",\n :rows => 100000\n )\n prefix = \"http://oregondigital.org/resource\"\n set_options = set_pids.map do |pid|\n set = GenericCollection.load_instance_from_solr(pid[\"id\"], pid)\n [\"#{set.title} (#{set.pid})\", \"#{prefix}/#{set.pid}\"]\n end\n\n input_args[:collection] = set_options.sort\n selected = f.object.value\n if selected.nil? || !selected.start_with?(prefix)\n selected = f.object.internal\n end\n input_args[:selected] = selected\n input_args[:include_blank] = true\n end\n\n controls << f.input(:value, input_args)\n\n if f.object.cloneable?\n controls << f.input(\n :clone,\n :as => :boolean,\n :input_html => {:class => \"input-xxlarge clone-field\"},\n :label_html => {:class => \"sr-only\"},\n :wrapper_html => {:class => \"ingest-control clone\"},\n :label => \"Clone this #{f.object.group}\"\n )\n end\n\n # Super hack, continued: don't put an internal field on the form for sets\n if f.object.group.to_sym != :collection\n controls << f.hidden_field(:internal, :class => \"internal-field\")\n end\n\n return controls.reduce { |list, next_control| list << next_control }\n end", "def fill_form(data)\n missing = data.to_h.keys - form_field_writers.to_a\n unless missing.empty?\n raise \"#{self.class.name} does not contain writer(s) for #{missing}\"\n end\n\n data.to_h.each_pair do |k, v|\n send(\"#{k}=\", v)\n end\n end", "def layout_fields\n # Everything has a tag - or it BETTER!\n # Probably should refactor this or something.\n value = @stored_values[:tag] || @object.tag\n label = Label.new(\"Tag\")\n tagInput = InputField.new(value,30)\n @attr_to_field[:tag] = tagInput\n layout_field_button(label,tagInput,\"Auto\") do\n attemptName = nil\n if @attr_to_field[:name]\n attemptName = @attr_to_field[:name].text\n end\n tagInput.text = @rl.repository.generate_tag_for(@object,attemptName)\n end\n @fieldY = tagInput.rect.bottom + @spacing \n @object.class.attrs.sort.each do | attr |\n next if attr == :tag # We did tags ourselves\n display = true\n value = @stored_values[attr] || @object.send(attr)\n label = Label.new(attr.to_s)\n rows,cols = [0,0]\n size= @object.class.size_for(attr)\n input = nil\n if size\n rows,cols = size\n if rows > 1\n input = MultiLineInput.new(value)\n input.set_size(rows,cols)\n elsif rows == 0 || cols == 0\n display = false\n else\n input = InputField.new(value, cols)\n end\n else\n input = InputField.new(value,20)\n end \n \n if display\n if rows > 1\n scroller = Scroller.new(input)\n scroller.translate_to(*input.rect.topleft)\n layout_field(label,scroller)\n else\n layout_field(label,input)\n end\n @attr_to_field[attr] = input\n end\n check_max_button(attr,input) if input\n end\n \n # Booleans\n @object.class.booleans.each do | attr |\n value = @stored_values[attr] || @object.send(attr)\n checkbox = CheckBox.new(attr.to_s,value)\n checkbox.rect.topleft = [ @fieldX, @fieldY ] \n \n @fieldY = checkbox.rect.bottom + @spacing\n \n self << checkbox\n @bool_to_field[attr] = checkbox\n end\n \n # And now for the enums!\n @object.class.enumerations.each do | attr, valid |\n value = @stored_values[attr] || @object.send(attr)\n label = Label.new(attr.to_s)\n \n size = @object.class.size_for(attr)\n label.rect.topleft = [@fieldX, @fieldY]\n rows = size || valid.size\n \n input = ListBox.new\n input.rect.w = @mainRect.w / 2 - label.rect.w - @spacing * 3\n input.rect.h = input.height(rows)\n input.items = valid\n input.chosen = value\n \n input.translate_to(label.rect.right + @spacing, @fieldY)\n \n @fieldY = input.rect.bottom + @spacing\n self << label\n self << input\n @enum_to_field[attr] = input\n \n end\n end", "def post_initialize_fields\n end", "def initialize(form)\n @form = form\n end", "def widgets\n @form.widgets\n end", "def layout_fields\n @options.controls.each do | control |\n label = Label.new(control.name)\n label.rect.topleft = [@fieldX, @fieldY]\n \n button = Button.new(control.to_s) { self.capture_event(control) }\n button.rect.topleft = [ label.rect.right + @spacing, @fieldY ]\n \n # TODO: Like in the original, there's no column creation\n @fieldY = label.rect.bottom + @spacing\n \n self << label\n self << button\n end\n end", "def _new_form(id, atrb = Hashx.new)\n self[id] = context_module('Form').new(@cfg, atrb.update(id: id))\n end", "def initialize_dispense\n # if we haven't come from a find, then preset some attributes needed by the form\n if !self.id.present?\n# additional initialization here\n\t\t\t\telse\n\t\t\t\t\tself.just_fill_date = self.fill_time\n\t\t\t\t\tself.just_fill_time = self.fill_time\n end\n\n end", "def data\n @field.widget.value_from_formdata(@form.data, @html_name)\n end", "def setForm(value)\r\n oldForm = @form\r\n @form = value\r\n @ability = nil\r\n yield if block_given?\r\n MultipleForms.call(\"onSetForm\", self, value, oldForm)\r\n calc_stats\r\n $Trainer.pokedex.register(self)\r\n end", "def initialize(*args)\n super\n @fields = []\n @buttons = []\n yield self if block_given? # invoke the configuration block\n end", "def form_setup\n\t\t@times = Lovs.time_array(15)\n\tend", "def from_form\n @from_form ||= fields.map { |field| form.__send__(field) }\n end", "def existing_value_inputs\n if primitive?\n # We can't use fields_for, and in fact we don't (currently) yield at all,\n # we do clever things with arrays.\n (base_model.send(attribute_name) || []).collect do |str|\n wrap_with_repeatable_ui do\n if caller_content_block.nil?\n default_primitive_input(str)\n else\n caller_content_block.call(primitive_input_name, str)\n end\n end\n end\n else\n # we use fields_for, which will repeatedly yield on repeating existing content\n form_builder.fields_for(attribute_name) do |sub_form|\n wrap_with_repeatable_ui do\n caller_content_block.call(sub_form)\n end\n end\n end\n end", "def fill_all_form_data()\n if verbose_messages\n p @fillable_form_fields\n p @current_page_data_object\n end\n\n @fillable_form_fields.each do |field|\n value = @current_page_data_object.retrieve_data_for(field)\n enter_element_value(field, value) if value and (value != \"nil\")\n end\n end", "def comment_form_attributes=(value)\n self.comment_form = comment_form_class.new(value)\n end", "def layoutField(fld, idx)\r\n insert_item(idx, fld.name)\r\n set_item(idx, 1, fld.df.desc)\r\n set_item(idx, 2, fld.generator.klass_name)\r\n set_edit_attr(idx, 2, InplaceEditListCtrl::EDIT_TYPE_CHOICE, @value_types)\r\n case fld.generator\r\n when ValueTypeFixed\r\n set_item(idx, 3, fld.generator.value)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_EDIT)\r\n when ValueTypeFromConfig\r\n when ValueTypeVariableCard\r\n set_item(idx, 3, fld.generator.column)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_CHOICE, Card.columns)\r\n when ValueTypeVariableAcquirer\r\n set_item(idx, 3, fld.generator.column)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_CHOICE, Acquirer.columns)\r\n when ValueTypePreviousOutgoing\r\n set_item(idx, 3, fld.generator.field_name)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_CHOICE, @fullnameList)\r\n when ValueTypePreviousIncoming\r\n set_item(idx, 3, fld.generator.field_name)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_CHOICE, @fullnameList)\r\n end # end of case\r\n end", "def form_enter type, valid_attributes\r\n valid_attributes.each { |field,value| form.send(\"#{type}[#{field}]=\",value)}\r\nend", "def build_field_options(value, _index)\n return super if defined?(super)\n\n dom_id = input_dom_id if respond_to?(:input_dom_id)\n dom_id ||= \"#{object_name}_#{attribute_name}\"\n\n input_html_options.dup.tap do |options|\n options[:value] = value\n\n options[:id] ||= dom_id\n options[:class] ||= []\n options[:class] += [\"#{dom_id} form-control\"]\n options[:'aria-labelledby'] ||= \"#{dom_id}_label\"\n end\n end", "def build_class(form)\n @labels = []\n\n dataset = WPDB.db[:\"#{WPDB.prefix}rg_lead___l\"]\n .where(:\"l__form_id\" => form.id)\n\n dataset = join_fields(dataset, form.fields)\n dataset = dataset.select_all(:l)\n dataset = select_fields(dataset, form.fields)\n dataset = dataset.from_self\n\n Class.new(Sequel::Model) do\n set_dataset dataset\n end\n end", "def fill_contact_form(cont_info_hash)\n form = ContactInfoUI::FORM\n cont_info_hash.each do |field_name, value|\n next if field_name.eql?('Obj Reference')\n new_attr_name = Utility.convert_to_underscore(field_name)\n type = eval(\"ContactInfoUI::#{new_attr_name.upcase}['Type']\")\n label = eval(\"ContactInfoUI::#{new_attr_name.upcase}['Label']\")\n ComponentsUtil.fill_field(type, label, value, form)\n end\n ContactInformation.click_btn('Enviar')\n end", "def form_inputs(array_of_field_names)\n array_of_field_names.each do |field|\n symbol_name = field.downcase.tr(\" \", \"_\")\n\n define_singleton_method :\"#{symbol_name}\" do\n find(\"input[formcontrolname='#{symbol_name}']\").value\n end\n\n define_singleton_method :\"#{symbol_name}=\" do |value|\n fill_in \"#{field}\", with: value\n end\n end\n end", "def set_viewing_form\n @viewing_form = set_episode.viewing_form\n end", "def instance_form(params={})\n # {{{\n klass = params[:model]\n klass ||= @klass\n params[:instance] = load_instance(klass) unless params[:instance]\n model_form(params)\n end", "def set_form form\n raise \"Form is nil in set_form\" if form.nil?\n @form = form\n @id = form.add_widget(self) if !form.nil? and form.respond_to? :add_widget\n # 2009-10-29 15:04 use form.window, unless buffer created\n # should not use form.window so explicitly everywhere.\n # added 2009-12-27 20:05 BUFFERED in case child object needs a form.\n # We don;t wish to overwrite the graphic object\n if @graphic.nil?\n #$log.debug \" setting graphic to form window for #{self.class}, #{form} \"\n @graphic = form.window unless form.nil? # use screen for writing, not buffer\n end\n # execute those actions delayed due to absence of form -- used internally \n # mostly by buttons and labels to bind hotkey to form\n fire_handler(:FORM_ATTACHED, self) if event? :FORM_ATTACHED\n end", "def initialize(p_form, p_parent)\n\n # Call base class constructor\n super(p_parent)\n\n # Initialize form and parent\n @form = p_form\n @parent = p_parent\n\n # Initialize attributes\n @tools = []\n end", "def prepare_form_helpers\n if display_type == \"text_field\"\n return [\"data_fields\", id, {id: id}]\n elsif display_type == \"text_area\"\n return [\"data_fields\", id]\n elsif display_type == \"select\"\n options = values.split(',').each{|opt| opt.squish!}\n return [\"data_fields\", id, options.map{|opt| [opt, opt]}]\n elsif display_type == \"check_box\"\n options = values.split(',').each{|opt| opt.squish!}\n return options.map{|v| [\"data_fields[#{id}]\", v]}\n elsif display_type == \"radio_button\"\n options = values.split(',').each{|opt| opt.squish!}\n return options.map{|v| [\"data_fields[#{id}]\", 1, v]}\n end\n end", "def form(*args, &blk)\n _singleton_form_context.form(*args, &blk)\n end", "def addInputs(forms)\n forms.push( {\"description\"=>\"Config\",\n \"label\"=>\"Config\",\"name\"=>\"config\",\n \"property_inputs\"=>[{\"description\"=>\"Stack\",\"label\"=>\"Stack\",\"reference\"=>\".diego_cell\"+deploymentName+\".stack\"},\n {\"description\"=>\"Virtual IP\",\"label\"=>\"Virtual IP\",\"reference\"=>\".ha_proxy\"+deploymentName+\".keepalived_vip\"},\n {\"description\"=>\"Same Keepalived group share same virtual router ID \",\"label\"=>\"Virtual Router ID\",\"reference\"=>\".ha_proxy\"+deploymentName+\".keepalived_virtual_router_id\"}] });\nend", "def initialize(name, form)\n @name = name\n @form = form\n @fields = []\n\n fields = get_screen_config['fields']\n if [\"infrastructure\", \"monitoring\"].include?(@form.name)\n fields.each do |field|\n @fields << Field.new(field['name'], self, @form)\n end\n else\n field_class_name = \"#{form.product_name.capitalize}Field\"\n fields.each do |screen_field|\n @fields << Uhuru::BoshCommander.const_get(field_class_name).new(screen_field['name'], self, @form)\n end\n end\n\n end", "def get_definition(cls, bld, fun)\r\n itemVar = CodeNameStyling.getStyled(cls.getUName() + \" form\", Utils.instance.langProfile.variableNameStyle)\r\n clsVar = CodeNameStyling.getStyled(cls.getUName() + \" form\", Utils.instance.langProfile.variableNameStyle)\r\n populateServiceVar = Utils.instance.createVarFor(cls, \"class_angular_data_map_service\")\r\n\r\n if clsVar != nil && populateServiceVar != nil\r\n bld.startFunction(\"populate(): void\")\r\n bld.add(\"this.\" + Utils.instance.getStyledVariableName(populateServiceVar) +\r\n \".populate(this.\" + clsVar + \" as FormGroup, this.item);\")\r\n\r\n bld.endFunction()\r\n end\r\n end", "def initialize(form_object)\n @form_object = form_object\n end", "def set_form(easy)\n end", "def property( options )\n self << view( :form, options[:type], options )\n end", "def new\n\t\t@form = @client.forms.new\n\n \n 3.times do\n procedure = @form.procedures.build\n end\n 3.times do\n authemp = @form.authemps.build\n end\n\n\t\trespond_to do |format|\n \t\tformat.html # show.html.erb\n \t\tformat.json { render json: @form }\n \t\tend\n\tend", "def form_class\n # logic to generate the clas on the form, easy to test\n end", "def apply_form_for_options!(object_or_array, options)\n options.merge! :builder => WebSgFormBuilder\n super\n end", "def build_field_options(value, index)\n options = input_html_options.dup\n\n\n #options[:value] = value if options[:value].nil?\n if !value.blank?\n options[:value] = value\n elsif value.blank? and !options[:value].blank?\n options[:value] = options[:value]\n else\n options[:value] = value\n end\n\n\n if @rendered_first_element\n options[:id] = nil\n options[:required] = nil\n else\n options[:id] ||= input_dom_id\n end\n options[:class] ||= []\n options[:class] += [\"#{input_dom_id} form-control multi-text-field\"]\n options[:'aria-labelledby'] = label_id\n @rendered_first_element = true\n\n options\n end", "def populate(attributes)\n attributes.each do |attribute, value|\n id = id_for(attribute)\n\n case control_type_for(id)\n when :file\n attach_file id, value\n when :select\n find_by_id(id).find(\"option[value='#{value}']\").select_option\n when :checkbox\n find_by_id(id).set(value)\n else\n fill_in id, :with => value\n end\n end\n end", "def attach_form c\n c.form = @form\n c.override_graphic @graphic\n c.parent_component = self\n end", "def _form\n @comment = Comment.new\n end", "def build_default_screen\n\n hauliers = PartiesRole.find_by_sql(\"SELECT party_type_name,role_name,party_name FROM parties_roles WHERE parties_roles.party_type_name = 'ORGANIZATION' and parties_roles.role_name = 'HAULIER'\").map{|g|g.party_name}.join(\",\")\n hauliers = \", ,\" + hauliers\n\n field_configs = Array.new\n field_configs[field_configs.length()] = {:type=>\"static_text\",:name=>\"load_number\",:value=>@parent.load_number.to_s}\n field_configs[field_configs.length()] = {:type=>\"static_text\",:name=>\"booking_reference\",:value=>@parent.booking_reference.to_s}\n field_configs[field_configs.length()] = {:type=>\"static_text\",:name=>\"vessel_name\",:value=>@parent.vessel_name.to_s}\n field_configs[field_configs.length()] = {:type=>\"static_text\",:name=>\"voyage_number\",:value=>@parent.voyage_number.to_s}\n field_configs[field_configs.length()] = {:type=>\"static_text\",:name=>\"shipping_agent\",:value=>@parent.shipping_agent.to_s}\n field_configs[field_configs.length()] = {:type=>\"static_text\",:name=>\"shipping_line\",:value=>@parent.shipping_line}\n field_configs[field_configs.length()] = {:type=>\"static_text\",:name=>\"discharge_port\",:value=>@parent.discharge_port}\n field_configs[field_configs.length()] = {:type=>\"static_text\",:name=>\"quay_of_discharge_port\",:value=>@parent.quay_of_discharge_port.to_s}\n field_configs[field_configs.length()] = {:type=>\"text_box\",:name=>\"scan_load_bay\",:is_required=>\"true\"}\n field_configs[field_configs.length()] = {:type=>\"text_box\",:name=>\"truck_number\",:is_required=>\"true\"}\n field_configs[field_configs.length()] = {:type=>\"text_box\",:name=>\"seal_number\",:is_required=>\"true\"}\n field_configs[field_configs.length()] = {:type=>\"text_box\",:name=>\"container_number\",:is_required=>\"true\"}\n field_configs[field_configs.length()] = {:type=>\"text_box\",:name=>\"temperature_rhine\",:is_required=>\"true\"}\n field_configs[field_configs.length()] = {:type=>\"text_box\",:name=>\"temperature_rhine2\",:is_required=>\"true\"}\n field_configs[field_configs.length()] = {:type=>\"drop_down\",:name=>\"haulier_code\",:is_required=>\"true\", :list => hauliers, :value =>'haulier_party_role_id'}\n field_configs[field_configs.length()] = {:type=>\"text_box\",:name=>\"container_size\",:is_required=>\"true\"}\n field_configs[field_configs.length()] = {:type=>\"text_box\",:name=>\"cto_consec_no\",:is_required=>\"false\"}\n\n\n screen_attributes = {:auto_submit=>\"false\",:content_header_caption=>\"load_container\"}\n buttons = {\"B3Label\"=>\"\" ,\"B2Label\"=>\"\",\"B1Submit\"=>\"load_container_submit\",\"B1Label\"=>\"submit\",\"B1Enable\"=>\"true\",\"B2Enable\"=>\"false\",\"B3Enable\"=>\"false\" }\n plugins = nil\n result_screen_def = PdtScreenDefinition.gen_screen_xml(field_configs,buttons,screen_attributes,plugins)\n\n return result_screen_def\n end", "def set_elements\n super\n element(:new_bib_button) {b.input(:id => \"bibCreateCurrentItemButton\")}\n element(:item_type_selector) {b.select_list(:id => \"newPurchasingItemLine.itemTypeDescription\")}\n element(:copies_field) {b.text_field(:id => \"newPurchasingItemLine.oleItemQuantity\")}\n element(:parts_field) {b.text_field(:id => \"newPurchasingItemLine.itemNoOfParts\")}\n element(:list_price_field) {b.text_field(:id => \"newPurchasingItemLine.itemListPrice\")}\n element(:public_view_checkbox) {b.checkbox(:id => \"newPurchasingItemLine.itemPublicViewIndicator\")}\n element(:item_price_source_selector) {b.select_list(:id => \"newPurchasingItemLine.itemPriceSourceId\")}\n element(:request_source_selector) {b.select_list(:id => \"newPurchasingItemLine.requestSourceTypeId\")}\n element(:format_selector) {b.select_list(:id => \"newPurchasingItemLine.formatTypeId\")}\n element(:category_selector) {b.select_list(:id => \"newPurchasingItemLine.categoryId\")}\n element(:route_to_requestor_checkbox) {b.checkbox(:id => \"newPurchasingItemLine.itemRouteToRequestorIndicator\")}\n element(:discount_field) {b.text_field(:id => \"newPurchasingItemLine.itemDiscount\")}\n element(:discount_type_selector) {b.select_list(:id => \"newPurchasingItemLine.itemDiscountType\")}\n element(:add_button) {b.input(:name => \"methodToCall.addItem\")}\n end", "def initialize form, config={}, &block\n\n # setting default first or else Widget will place its BW default\n #@color, @bgcolor = ColorMap.get_colors_for_pair $bottomcolor\n super\n @height = 1\n @color_pair = get_color $datacolor, @color, @bgcolor\n @scroll_pair = get_color $bottomcolor, :green, :white\n #@window = form.window\n @editable = false\n # you can set to true upon creation, or use F3 on vimsplit to\n # toggle focusable\n @focusable = false\n @repaint_required = true\n @_events.push(:DRAG_EVENT)\n map_keys\n unless @parent\n raise ArgumentError, \"row col and length should be provided\" if !@row || !@col || !@length\n end\n #if @parent\n #@parent.bind :ENTER_ROW do |p|\n ## parent must implement row_count, and have a @current_index\n #raise StandardError, \"Parent must implement row_count\" unless p.respond_to? :row_count\n #self.current_index = p.current_index\n #@repaint_required = true #requred otherwise at end when same value sent, prop handler\n ## will not be fired (due to optimization).\n #end\n #end\n end", "def initialize(form)\n @expander = FormExpander.new(form)\n end", "def set_form\n @wrapper = Wrapper.find(params[:id])\n end", "def use_form_generator(fg_klass)\n @@form_generator = fg_klass\n end", "def initialize config={}, &block\n @config = config\n\n\n widget_shortcuts_init\n @variables = {}\n # if we are creating child objects then we will not use outer form. this object will manage\n #@current_object = [] # 2014-08-29 - 17:35 unused\n @_system_commands = %w{ bind_global bind_component field_help_text }\n\n init_vars\n $log.debug \"XXX APP CONFIG: #{@config} \" if $log.debug? \n run &block\n end", "def generate_watcher_widgets\n @dtw_all_watchers = {}\n @watchers.each { | w, wname, wdesc |\n @dtw_all_watchers[w] = g = {}\n g[:dt] = dtw = {}\n g[:widget] = wid = {}\n hf = newHFFlat @f_watcher_switcher\n w.fields.each { |sym, type, default, name, desc|\n dtw[sym] = FXDataTarget.new(default)\n wid[sym] = case type\n when :bool\n newLabel(hf, name)\n newCheck(hf, '', target: dtw[sym])\n when :int\n newLabel(hf, name)\n newIntegerField(hf, target: dtw[sym])\n when :float\n newLabel(hf, name)\n newNumberField(hf, target: dtw[sym])\n when :string\n newLabel(hf, name)\n newTextField(hf, target: dtw[sym])\n end \n }\n }\n end", "def build_carton_label_station_form(carton_label_station,action,caption,is_edit = nil,is_create_retry = nil)\n\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n\n codes = Facility.find_all_by_facility_type_code(\"packhouse\").map{|g|[g.facility_code]}\n\n\t field_configs = Array.new\n\tfield_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'carton_label_station_code'}\n\n\t if is_edit == false\n\t field_configs[1] = {:field_type => 'DropDownField',\n\t\t\t\t\t\t:field_name => 'packhouse_code',\n\t\t\t\t\t\t:settings => {:list => codes}}\n\telse\n\t field_configs[1] = {:field_type => 'LabelField',\n\t\t\t\t\t\t:field_name => 'packhouse_code'}\n\tend\n\n\tfield_configs[2] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'ip_address'}\n\n field_configs[3] = {:field_type => 'CheckBox',\n\t\t\t\t\t\t:field_name => 'is_reworks_station'}\n\n\tbuild_form(carton_label_station,field_configs,action,'carton_label_station',caption,is_edit)\n\nend", "def fill_user_form(user)\n fill_name_surname_and_title(user)\n fill_mobile_data(user)\n fill_card_data(user)\n fill_location_data(user)\n end", "def set_widget_form\n @widget_form = WidgetForm.find(params[:id])\n end", "def form_values(values)\n @form_config.form_values = values\n end", "def create_widget(property, type, values)\n if type == nil\n #Allow string, number, or symbol\n widget = Gtk::Entry.new\n widget.xalign = 0\n getter = lambda do\n str = widget.text.strip\n Evaluate.eval(str)\n end\n setter = lambda do |val|\n if val.nil?\n str = \"\"\n else\n str = val.is_a?(String) ? \"\\\"#{val}\\\"\" :\n val.is_a?(Symbol) ? \":#{val}\" :\n val.to_s\n str.gsub!(\"\\n\", \"\\\\n\")\n str.gsub!(\"\\t\", \"\\\\t\")\n end\n widget.text = str\n end\n elsif type <= Integer || type <= Float\n widget = Gtk::SpinButton.new(*values)\n widget.xalign = 0\n getter = lambda do\n val = widget.value\n return val if type == Float\n return Integer(val)\n end\n setter = widget.method(:value=)\n elsif type == TrueClass\n widget = Gtk::CheckButton.new\n getter = widget.method(:active?)\n setter = widget.method(:active=)\n elsif type == String || type == Symbol\n widget = Gtk::Entry.new\n widget.xalign = 0\n getter = lambda { type == String ? widget.text : widget.text_to_sym }\n setter = lambda { |val| widget.text = val.to_s }\n elsif type <= Array && property\n widget = Gtk::Button.new(\"click to set\")\n\n values = []\n \n widget.signal_connect('clicked') do\n show_array_setter(property, values)\n end\n\n getter = lambda { values }\n setter = lambda { |val| values.replace(val) }\n else\n widget = Gtk::Label.new(\"Invalid\")\n getter = lambda { nil }\n setter = lambda { |val| }\n end\n\n return widget, getter, setter\n end", "def initialize\n @fields = Fields.new\n end", "def build_form(form_builder, options = {})\n set_value_in_hash options\n\n default_style = {class: 'form-control input-small'}\n\n if options[:for] == :search\n res = []\n as = options[:as]\n only = options[:only]\n options = options.except :only, :for\n\n if as == :select\n res << form_builder.select(:value, [['', '']] + options[:values], options.merge(selected: options[:value]), class: 'form-control input-small')\n else\n value = options[:value].is_a?(Hash) ? options[:value].symbolize_keys : {}\n\n if !only || only == :low\n res << form_builder.text_field(:l, options.merge(index: 'value', value: value[:l]).reverse_merge(default_style))\n end\n\n if !only || only == :high\n res << form_builder.text_field(:h, options.merge(index: 'value', value: value[:h]).reverse_merge(default_style))\n end\n end\n\n res.join ' – '\n else\n form_builder.number_field :value, options.reverse_merge(default_style)\n end\n end", "def new\n @widget = Widget.new\n end", "def d_usrlbl; catdet.form(:name, 'rpcControlSensorSettingForm').text_field(:id, 'drLabel'); end", "def init(*args)\n if Hash === options = args.last\n for field in self.class.fields\n instance_variable_set \"@#{field}\", field.default_value(self, options)\n end\n end\n end" ]
[ "0.60622215", "0.6025517", "0.5999877", "0.59791344", "0.59721774", "0.59474057", "0.59174013", "0.58832335", "0.5878164", "0.5854412", "0.58301723", "0.57900804", "0.5788395", "0.5783269", "0.57719785", "0.5771863", "0.5739014", "0.57361794", "0.57359254", "0.57175964", "0.5701526", "0.56962585", "0.5673358", "0.5673089", "0.56499517", "0.56393343", "0.5628206", "0.5613757", "0.56127924", "0.5594963", "0.5594681", "0.5582434", "0.5565009", "0.55426705", "0.55366296", "0.5527943", "0.55254555", "0.55171746", "0.55168605", "0.5512116", "0.5507076", "0.549722", "0.54932564", "0.5492557", "0.54920596", "0.54874545", "0.5477342", "0.54661196", "0.5457259", "0.5451599", "0.544754", "0.54462725", "0.54322475", "0.5432095", "0.5428042", "0.54210126", "0.5418469", "0.54037595", "0.5399774", "0.5392023", "0.5388715", "0.53744173", "0.53729296", "0.53710246", "0.5366409", "0.536307", "0.5357194", "0.5354541", "0.5354461", "0.5353491", "0.5346418", "0.5340872", "0.5336341", "0.53324604", "0.5330935", "0.5330794", "0.53296506", "0.5327819", "0.5320647", "0.531941", "0.53170687", "0.5312841", "0.5312498", "0.5303387", "0.52870786", "0.5269056", "0.52665377", "0.5261152", "0.5251554", "0.5214207", "0.5213661", "0.5213008", "0.5208849", "0.5207007", "0.5205655", "0.5204896", "0.5201758", "0.51987696", "0.5193213", "0.51881456" ]
0.63345915
0
Populates your instance variables from the glade form. This works for Gtk:Button, Gtk::Entry, Gtk::Label and Gtk::Checkbutton. So instead of having to assign instance variable:
def get_glade_variables(obj = self) obj.instance_variables.each do |var_name| next if var_name == :@builder or var_name == :@top_level_window var = obj.instance_variable_get(var_name) var_name = var_name.to_s.gsub("@", "") #fix for ruby 1.9 giving symbols if var.is_a? Hash var.each_pair do |key, val| if glade_value = get_control_value("#{var_name}[#{key.to_s}]", obj) var[key] = glade_value end end obj.instance_variable_set("@"+ var_name, var) elsif var.is_a? Array var.each_index do |i| if glade_value = get_control_value("#{var_name}[#{i.to_s}]", obj) var[i] = glade_value end end obj.instance_variable_set("@"+ var_name, var) else glade_value = get_control_value(var_name, obj) obj.instance_variable_set("@"+ var_name, glade_value) unless glade_value.nil? end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_vars\n @hbox = Gtk::HBox.new\n @mode_vbox = Gtk::VBox.new\n @idiom_vbox = Gtk::VBox.new\n @geral_vbox = Gtk::VBox.new\n @new_btn = Gtk::Button.new('')\n @quit_btn = Gtk::Button.new('')\n self.resizable = false\n self.modal = true\n @mode_rdo = []\n (0..4).each{|i|\n @mode_rdo[i] = OptionsRadioButton.new(@mode_rdo[0])\n }\n @mode_rdo[0].selected = true\n @idiom_rdo = []\n (0..2).each{|i|\n @idiom_rdo[i] = Gtk::RadioButton.new(@idiom_rdo[0])\n }\n end", "def init_vars\n self.resize(200,250)\n @new_btn = Gtk::Button.new('')\n @default_size_btn = Gtk::Button.new('')\n @quit_btn = Gtk::Button.new('')\n end", "def initialize(form_values, options)\n @form_values = form_values\n @form_args = options.dup\n @g = Gestalt.new\n end", "def ing_form; end", "def set_glade_variables(obj = self)\r\n obj.instance_variables.each do |name|\r\n name = name.to_s #ruby 1.9 passes symbol!\r\n v = obj.instance_variable_get(name)\n name = name.gsub('@', '')\r\n if v.is_a?(Array) \r\n v.each_index do |i|\r\n fill_control(\"#{name}[#{i.to_s}]\", v[i] )\r\n end\n elsif v.is_a?(Hash)\n v.each_pair do |key, val|\n fill_control(\"#{name}[#{key.to_s}]\", val)\n end \r\n else\r\n fill_control(name, v)\r\n end\r\n end\r\n end", "def create_widget(property, type, values)\n if type == nil\n #Allow string, number, or symbol\n widget = Gtk::Entry.new\n widget.xalign = 0\n getter = lambda do\n str = widget.text.strip\n Evaluate.eval(str)\n end\n setter = lambda do |val|\n if val.nil?\n str = \"\"\n else\n str = val.is_a?(String) ? \"\\\"#{val}\\\"\" :\n val.is_a?(Symbol) ? \":#{val}\" :\n val.to_s\n str.gsub!(\"\\n\", \"\\\\n\")\n str.gsub!(\"\\t\", \"\\\\t\")\n end\n widget.text = str\n end\n elsif type <= Integer || type <= Float\n widget = Gtk::SpinButton.new(*values)\n widget.xalign = 0\n getter = lambda do\n val = widget.value\n return val if type == Float\n return Integer(val)\n end\n setter = widget.method(:value=)\n elsif type == TrueClass\n widget = Gtk::CheckButton.new\n getter = widget.method(:active?)\n setter = widget.method(:active=)\n elsif type == String || type == Symbol\n widget = Gtk::Entry.new\n widget.xalign = 0\n getter = lambda { type == String ? widget.text : widget.text_to_sym }\n setter = lambda { |val| widget.text = val.to_s }\n elsif type <= Array && property\n widget = Gtk::Button.new(\"click to set\")\n\n values = []\n \n widget.signal_connect('clicked') do\n show_array_setter(property, values)\n end\n\n getter = lambda { values }\n setter = lambda { |val| values.replace(val) }\n else\n widget = Gtk::Label.new(\"Invalid\")\n getter = lambda { nil }\n setter = lambda { |val| }\n end\n\n return widget, getter, setter\n end", "def initialize form, config={}, &block\n \n @text = config.fetch(:text, \"NOTFOUND\")\n @editable = false\n @focusable = false\n # we have some processing for when a form is attached, registering a hotkey\n register_events :FORM_ATTACHED\n super\n @justify ||= :left\n @name ||= @text\n @repaint_required = true\n end", "def setup(*)\n # Used to be in an after_add, updated for apotomo 1.2.\n self.respond_to_event :form_submitted, :from => self.name\n self.respond_to_event :revert, :from => self.name\n self.respond_to_event :display_form, :from => self.name\n\n self.where = nil\n self.dom_id = options[:dom_id]\n self.grid_options = {}\n # Guesses that you will use the resource name for the form template.\n self.form_template = options[:resource]\n # Assume that the form is not a multipart (uploader) form\n self.multipart_form = false\n # The orphan template is used when a parent record is needed but not selected\n self.orphan_template = 'orphan'\n # Ensure that we always have a record of some sort\n self.record = resource_model.new\n # Set the name of this resource for public display\n self.human_resource = options[:resource].humanize\n # Set the spokesfield to nil, this needs to be set explicitly\n self.spokesfield = nil\n \n @columns = []\n @sortable_columns = {}\n @default_sort = nil \n\n @filters = {}\n @filter_sequence = []\n @filter_default = {}\n \n @flash_widget = self.dom_id + '_flash'\n self << widget(:grid_flash, @flash_widget)\n \n if options[:form_only]\n @list_widget = nil\n @filters_widget = nil\n self.form_buttons = [\n ['remain', 'Save', 'Add'],\n ]\n else\n @list_widget = self.dom_id + '_list'\n @filters_widget = self.dom_id + '_filters'\n self << widget(:grid_list, @list_widget) do |lw|\n lw << widget(:grid_filters, @filters_widget)\n end\n \n self.form_buttons = [\n ['submit', 'Save+Close', 'Add+Close'],\n ['remain', 'Save', 'Add'],\n ['cancel', 'Cancel', 'Cancel'],\n ]\n end\n end", "def init_vars\n @msg = Gtk::Label.new('')\n self.resizable = false\n self.modal = true \n self.window_position = Gtk::Window::POS_MOUSE \n end", "def fill_out_form(hash)\n self.main_title=hash[:main_title]\n self.main_author=hash[:main_author]\n self.co_authors=hash[:co_authors]\n self.publisher=hash[:publisher]\n self.place_of_publication=hash[:place]\n self.volume_title=hash[:volume_title]\n self.volume_information=hash[:volume_info]\n self.year=hash[:year]\n self.number=hash[:number]\n self.series_title=hash[:series]\n self.url=hash[:url]\n end", "def form; end", "def initialize form, config={}, &block\n @surround_chars = ['(', ')'] if @surround_chars.nil?\n super\n $log.warn \"XXX: FIXME Please set 'value' for radiobutton. If not sure, try setting it to the same value as 'text'\" unless @value\n # I am setting value of value here if not set 2011-10-21 \n @value ||= @text\n ## trying with off since i can't do conventional style construction\n #raise \"A single Variable must be set for a group of Radio Buttons for this to work.\" unless @variable\n end", "def initialize config={}, &block\n @config = config\n\n\n widget_shortcuts_init\n @variables = {}\n # if we are creating child objects then we will not use outer form. this object will manage\n #@current_object = [] # 2014-08-29 - 17:35 unused\n @_system_commands = %w{ bind_global bind_component field_help_text }\n\n init_vars\n $log.debug \"XXX APP CONFIG: #{@config} \" if $log.debug? \n run &block\n end", "def set_form_instance_variables\n\t\t@list=List.new\n\t\t@task=@current_list.tasks.new\n\tend", "def form_data_initialize(form)\n form = form_generation(form)\n form = 0 unless GameData::Pokemon.all[id][form]\n @form = form\n exp_initialize\n end", "def forms; end", "def init_gui\r\n pathFile = \"\"\r\n pathCreate = \"\"\r\n fixed = Gtk::Fixed.new\r\n add fixed\r\n label = Gtk::Label.new(\"Xml - File Path:\")\r\n label.set_size_request 100,30\r\n button = Gtk::FileChooserButton.new(\"Search\", Gtk::FileChooser::ACTION_OPEN)\r\n button.set_size_request 280,30\r\n filter = Gtk::FileFilter.new\r\n filter.add_pattern('*.xml')\r\n button.add_filter(filter)\r\n button.signal_connect('selection_changed') do |w|\r\n pathFile = w.filename.to_s\r\n arrayPath = pathFile.split('\\\\')\r\n pathCreate = \"\"\r\n for i in 0..arrayPath.length-2\r\n pathCreate+=arrayPath[i]+\"\\\\\"\r\n end\r\n pathCreate+=\"files\\\\\"\r\n end\r\n labelDB = Gtk::Label.new(\"Name Database:\")\r\n entryDB = Gtk::Entry.new\r\n entryDB.set_width_chars 45\r\n entryDB.set_text \"\"\r\n labelDBServer = Gtk::Label.new(\"Server Database:\")\r\n entryDBServer = Gtk::Entry.new\r\n entryDBServer.set_width_chars 45\r\n entryDBServer.set_text \"\"\r\n labelDBUser = Gtk::Label.new(\"User Database:\")\r\n entryDBUser = Gtk::Entry.new\r\n entryDBUser.set_width_chars 45\r\n entryDBUser.set_text \"\"\r\n labelDBPass = Gtk::Label.new(\"Pass Database:\")\r\n entryDBPass = Gtk::Entry.new\r\n entryDBPass.set_width_chars 45\r\n entryDBPass.visibility = false\r\n entryDBPass.invisible_char = 42\r\n labelEmail = Gtk::Label.new(\"Admin Email:\")\r\n entryEmail = Gtk::Entry.new\r\n entryEmail.set_width_chars 45\r\n entryEmail.set_text \"\"\r\n btGenerate = Gtk::Button.new \"Generate\"\r\n btGenerate.signal_connect \"clicked\" do\r\n if pathFile == \"\" or pathCreate == \"\"\r\n showMessage(\"Debe seleccionar el archivo de origen\",Gtk::MessageDialog::ERROR,self)\r\n elsif entryDB.text.strip == \"\"\r\n showMessage(\"Debe Ingresar el nombre de la base de datos\",Gtk::MessageDialog::ERROR,self)\r\n elsif entryDBServer.text.strip == \"\"\r\n showMessage(\"Debe Ingresar el servidor de la base de datos\",Gtk::MessageDialog::ERROR,self)\r\n elsif entryDBUser.text.strip == \"\"\r\n showMessage(\"Debe Ingresar el nombre de usuario de la base de datos\",Gtk::MessageDialog::ERROR,self)\r\n elsif entryEmail.text.strip == \"\"\r\n showMessage(\"Debe Ingresar el email del administrador\",Gtk::MessageDialog::ERROR,self)\r\n else\r\n readPollFileXml(pathFile,pathCreate,entryDB.text.strip, entryDBServer.text.strip,entryDBUser.text.strip,entryDBPass.text.strip,entryEmail.text.strip)\r\n showMessage(\"Se ha creado el formulario Satisfactoriamente en la ruta: \"+pathCreate,Gtk::MessageDialog::INFO,self)\r\n Gtk.main_quit\r\n end\r\n end\r\n btCancel = Gtk::Button.new \"Cancel\"\r\n btCancel.signal_connect \"clicked\" do\r\n Gtk.main_quit\r\n end\r\n fixed.put label,10,10\r\n fixed.put labelDB,15,58\r\n fixed.put labelDBServer,15,103\r\n fixed.put labelDBUser,24,148\r\n fixed.put labelDBPass,24,193\r\n fixed.put labelEmail,30,238\r\n fixed.put button,105,10\r\n fixed.put entryDB,105,55\r\n fixed.put entryDBServer,105,100\r\n fixed.put entryDBUser,105,145\r\n fixed.put entryDBPass,105,190\r\n fixed.put entryEmail,105,235\r\n fixed.put btGenerate,145,275\r\n fixed.put btCancel,205,275\r\n end", "def initialize(dbpage)\n @dbpage = dbpage\n @dbconn = @dbpage.dbconn\n\n @gui = Gtk::Builder.new\n @gui.add(\"#{File.dirname(__FILE__)}/ui/win_runsql.ui\")\n @gui.connect_signals { |handler| method(handler) }\n\n @cb_type = @gui[:cbType]\n combobox_init(@cb_type)\n @cb_type.get_model.append([\"Auto\"])\n @cb_type.get_model.append([\"One-liners\"])\n @cb_type.get_model.append([\"phpMyAdmin dump\"])\n @cb_type.set_active(0)\n\n @window = @gui[:window]\n winsetting = GtkSettingsWindow.new(@window, \"win_runsql\")\n @window.show_all\n end", "def initialize(orientation, label)\n\t\t@gtkLabels = Gtk::Label.new(label.to_s)\n gtkBox = Gtk::Box.new(orientation)\n\t\tgtkBox.pack_end(@gtkLabels, expand:true, fill:false, padding:0)\n\t\t@gtkObject = Gtk::Button.new\n\t\[email protected](gtkBox)\n\tend", "def set_up_form(form_class, form)\n # Set an instance variable for the form (eg. @conviction_approval_form) using the provided class\n instance_variable_set(\"@#{form}\", form_class.new(@resource))\n end", "def set_form_variables\n @articles = CriminalCode.all.includes(:articles).with_translations\n @tags = Tag.includes(:translations).order(:name)\n @prisons = Prison.includes(:translations).order(:name)\n\n gon.select_charges = t('shared.actions.with_obj.select',\n obj: t('activerecord.models.charge', count: 999))\n gon.select_tags = t('shared.actions.with_obj.select',\n obj: t('activerecord.models.tag', count: 999)) \n end", "def set_glade_all(obj = self) \r\n set_glade_active_record(obj)\r\n set_glade_variables(obj)\r\n end", "def initialize(*args)\n super\n @fields = []\n @buttons = []\n yield self if block_given? # invoke the configuration block\n end", "def initialize form=nil, config={}, &block\n @form = form\n @buffer = String.new\n #@type=config.fetch(\"type\", :varchar)\n @row = 0\n @col = 0\n @editable = true\n @focusable = true\n #@event_args = {} # arguments passed at time of binding, to use when firing event\n map_keys \n init_vars\n register_events(:CHANGE)\n super\n @width ||= 20\n @maxlen ||= @width\n end", "def layout_fields\n # Everything has a tag - or it BETTER!\n # Probably should refactor this or something.\n value = @stored_values[:tag] || @object.tag\n label = Label.new(\"Tag\")\n tagInput = InputField.new(value,30)\n @attr_to_field[:tag] = tagInput\n layout_field_button(label,tagInput,\"Auto\") do\n attemptName = nil\n if @attr_to_field[:name]\n attemptName = @attr_to_field[:name].text\n end\n tagInput.text = @rl.repository.generate_tag_for(@object,attemptName)\n end\n @fieldY = tagInput.rect.bottom + @spacing \n @object.class.attrs.sort.each do | attr |\n next if attr == :tag # We did tags ourselves\n display = true\n value = @stored_values[attr] || @object.send(attr)\n label = Label.new(attr.to_s)\n rows,cols = [0,0]\n size= @object.class.size_for(attr)\n input = nil\n if size\n rows,cols = size\n if rows > 1\n input = MultiLineInput.new(value)\n input.set_size(rows,cols)\n elsif rows == 0 || cols == 0\n display = false\n else\n input = InputField.new(value, cols)\n end\n else\n input = InputField.new(value,20)\n end \n \n if display\n if rows > 1\n scroller = Scroller.new(input)\n scroller.translate_to(*input.rect.topleft)\n layout_field(label,scroller)\n else\n layout_field(label,input)\n end\n @attr_to_field[attr] = input\n end\n check_max_button(attr,input) if input\n end\n \n # Booleans\n @object.class.booleans.each do | attr |\n value = @stored_values[attr] || @object.send(attr)\n checkbox = CheckBox.new(attr.to_s,value)\n checkbox.rect.topleft = [ @fieldX, @fieldY ] \n \n @fieldY = checkbox.rect.bottom + @spacing\n \n self << checkbox\n @bool_to_field[attr] = checkbox\n end\n \n # And now for the enums!\n @object.class.enumerations.each do | attr, valid |\n value = @stored_values[attr] || @object.send(attr)\n label = Label.new(attr.to_s)\n \n size = @object.class.size_for(attr)\n label.rect.topleft = [@fieldX, @fieldY]\n rows = size || valid.size\n \n input = ListBox.new\n input.rect.w = @mainRect.w / 2 - label.rect.w - @spacing * 3\n input.rect.h = input.height(rows)\n input.items = valid\n input.chosen = value\n \n input.translate_to(label.rect.right + @spacing, @fieldY)\n \n @fieldY = input.rect.bottom + @spacing\n self << label\n self << input\n @enum_to_field[attr] = input\n \n end\n end", "def initialize(form)\n @form = form\n end", "def initialize(p_form, p_parent)\n\n # Call base class constructor\n super(p_parent)\n\n # Initialize form and parent\n @form = p_form\n @parent = p_parent\n\n # Initialize attributes\n @tools = []\n end", "def initialize form, config={}, &block\n\n # setting default first or else Widget will place its BW default\n #@color, @bgcolor = ColorMap.get_colors_for_pair $bottomcolor\n super\n @height = 1\n @color_pair = get_color $datacolor, @color, @bgcolor\n @scroll_pair = get_color $bottomcolor, :green, :white\n #@window = form.window\n @editable = false\n # you can set to true upon creation, or use F3 on vimsplit to\n # toggle focusable\n @focusable = false\n @repaint_required = true\n @_events.push(:DRAG_EVENT)\n map_keys\n unless @parent\n raise ArgumentError, \"row col and length should be provided\" if !@row || !@col || !@length\n end\n #if @parent\n #@parent.bind :ENTER_ROW do |p|\n ## parent must implement row_count, and have a @current_index\n #raise StandardError, \"Parent must implement row_count\" unless p.respond_to? :row_count\n #self.current_index = p.current_index\n #@repaint_required = true #requred otherwise at end when same value sent, prop handler\n ## will not be fired (due to optimization).\n #end\n #end\n end", "def build_get_pallet_number_form()\n\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n\tfield_configs = Array.new\n\n field_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'pallet_number'}\n\n\n\n\tbuild_form(nil,field_configs,'submit_mixed_pallet_id','pallet_number','submit')\n\nend", "def populate_fields(target,data)\n data.each{|key,value|target.text_field(:name=>key).set value}\nend", "def form_setup\n\tend", "def setup_form\n build_form\n super\n end", "def initialize(form, field, type)\n @klass = form.object.class\n @template = form.template\n @year = form.object.year\n @field = field\n @type = type\n end", "def post_initialize_fields\n end", "def initialize\n @gui = Gtk::Builder.new\n @gui.add(\"#{File.dirname(__FILE__)}/ui/main.ui\")\n @gui.connect_signals { |handler| method(handler) }\n\n @window = @gui[:window]\n winsetting = GtkSettingsWindow.new(@window, \"win_main\")\n\n @nb_dbs = @gui[:nbDbs]\n @nb_dbs.connect_after(\"switch-page\", [self, \"ChangeActiveDB\"])\n\n @window.show_all\n end", "def addInputs(forms)\n forms.push( {\"description\"=>\"Config\",\n \"label\"=>\"Config\",\"name\"=>\"config\",\n \"property_inputs\"=>[{\"description\"=>\"Stack\",\"label\"=>\"Stack\",\"reference\"=>\".diego_cell\"+deploymentName+\".stack\"},\n {\"description\"=>\"Virtual IP\",\"label\"=>\"Virtual IP\",\"reference\"=>\".ha_proxy\"+deploymentName+\".keepalived_vip\"},\n {\"description\"=>\"Same Keepalived group share same virtual router ID \",\"label\"=>\"Virtual Router ID\",\"reference\"=>\".ha_proxy\"+deploymentName+\".keepalived_virtual_router_id\"}] });\nend", "def initialize(label: \"\",size: Constants::TEXT_SIZE ,padding: 10, width: nil, height: nil)\n @label=label\n @gtkObject=Gtk::Alignment.new(0.5, 0.5, 0, 0)\n @size=size\n @font=\"Arial\"\n @color=\"black\"\n @weight=\"bold\"\n @style=\"normal\"\n @textBox = Gtk::Label.new(@label)\n @padding=padding\n @textBox.use_markup = true\n @textBox.set_margin_bottom(@padding)\n @textBox.set_margin_top(@padding)\n @textBox.set_margin_right(@padding)\n @textBox.set_margin_left(@padding)\n @gtkObject.add(@textBox)\n if width != nil && height != nil\n setBackgroundSize(width,height)\n end\n apply\n end", "def initialize form, config={}, &block\n @surround_chars = ['[', ']'] # 2008-12-23 23:16 added space in Button so overriding\n super\n end", "def build_rebin_label_station_form(rebin_label_station,action,caption,is_edit = nil,is_create_retry = nil)\n\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n codes = Facility.find_all_by_facility_type_code(\"packhouse\").map{|g|[g.facility_code]}\n\tfield_configs = Array.new\n\tfield_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'rebin_label_station_code'}\n\n\tif is_edit == false\n\t field_configs[1] = {:field_type => 'DropDownField',\n\t\t\t\t\t\t:field_name => 'packhouse_code',\n\t\t\t\t\t\t:settings => {:list => codes}}\n\telse\n\t field_configs[1] = {:field_type => 'LabelField',\n\t\t\t\t\t\t:field_name => 'packhouse_code'}\n\tend\n\n\n\tfield_configs[2] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'ip_address'}\n\n\tbuild_form(rebin_label_station,field_configs,action,'rebin_label_station',caption,is_edit)\n\nend", "def initialize(parent)\n @gtkObject = Gtk::Box.new :vertical\n @gtkObject.set_name 'test'\n\t\t@cb = Gtk::ComboBoxText.new\n @cb.append_text 'Général'\n @cb.append_text 'Contre La Montre'\n @cb.append_text 'Mode Facile'\n @cb.append_text 'Mode Moyen'\n @cb.append_text 'Mode Difficile'\n\t\[email protected](@cb)\n\t\tstore = Gtk::ListStore.new(String, Integer)\n\t\ttreeview = Gtk::TreeView.new(store)\n\t\tsetup_tree_view(treeview)\n\t\tdata = desereliseJoueurs\n\n\t\t\tif(data != nil)\n\t\t\t\tdata.each_with_index do |e, i|\n\t\t \t \t\titer = store.append\n\t\t \t\t\tstore.set_value(iter, 0, data[i].donneNom)\n\t\t \t\t\tstore.set_value(iter, 1, data[i].donneScore)\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\n\t\t\tboxTree = Gtk::Box.new(:vertical, 10)\n\t\t\tboxTree.border_width = 10\n\t\t\[email protected]_start(boxTree,:expand => true, :fill => true, :padding => 0)\n\n\t\t\tscrolled_win = Gtk::ScrolledWindow.new\n\t\t\tscrolled_win.add_with_viewport(treeview)\n\t\t\tscrolled_win.set_policy(:automatic,:automatic)\n\t\t\tboxTree.pack_start(scrolled_win,:expand => true, :fill => true, :padding => 0)\n\n\t\t\tseparator = Gtk::Separator.new(:horizontal)\n\t\t\[email protected]_start(separator, :expand => false, :fill => true, :padding => 0)\n\t\t\tseparator.show\n\n\n\t\t\tbRetour = MenuItemUi.new(:back,MenuAssets.getInstance())\n\t\t\tbRetour.setOnClickEvent(Proc.new{\n\t\t\t\tparent.changeBackground(\"menuPrincipal\")\n\t\t\t\tparent.display(parent.mainMenu)\n\t\t\t})\n\t\t\[email protected](bRetour.gtkObject)\n\t\t\t\n\t\t\tif(data != nil)\n\t\t\t\[email protected]_connect \"changed\" do |w, z|\n\t\t \t\t\tselectn(w,z,data,store)\n\t\t\t\tend\n\t\t\tend\n\tend", "def initialize(form, field, name)\n @form = form\n @field = field\n @name = name\n @html_name = form.add_prefix(name)\n @html_initial_name = form.add_initial_prefix(name)\n @label = @field.label\n @help_text = @field.help_text || ''\n end", "def set_form(easy)\n end", "def initialize\n\t\t@gtkObject = Gtk::Window.new\n\t\t@assets = MenuAssets.getInstance()\n\t\tinitMenus\n\t\tinitGtkWindow\n\tend", "def initialize_fields\n terms_for_editing.each do |key|\n # if value is empty, we create an one element array to loop over for output \n self[key] = [''] if self[key].empty?\n end\n end", "def init_vars(markup,x,y)\n @type = []\n if x == 1 and y == 1\n @type = [\"center\"]\n elsif (x == 0 or x == 2) and (y == 0 or y == 2)\n @type[0] = \"tip\"\n if y == 0\n @type[2] = \"top\"\n else\n @type[2] = \"bottom\"\n end\n if x == 0\n @type[1] = \"left\"\n else\n @type[1] = \"right\"\n end \n else\n @type[0] = \"side\"\n if y == 0\n @type[2] = \"top\"\n elsif y == 2\n @type[2] = \"bottom\"\n elsif x == 0\n @type[1] = \"left\"\n else\n @type[1] = \"right\"\n end \n end\n @x = x\n @y = y \n self.label_widget = Gtk::Label.new.set_markup(markup)\n end", "def fill_out_form(hash)\n self.institution=hash[:institution]\n self.department=hash[:department]\n self.title_role=hash[:title]\n self.email=hash[:email]\n self.instant_messaging=hash[:im]\n self.phone=hash[:phone]\n self.mobile=hash[:mobile]\n self.fax=hash[:fax]\n self.address=hash[:address]\n self.city=hash[:city]\n self.state=hash[:state]\n self.postal_code=hash[:zip]\n self.country=hash[:country]\n end", "def set_elements\n super\n element(:patron_id_field) {b.text_field(:id => \"olePatronId_control\")}\n element(:barcode_field) {b.text_field(:id => \"barcode_control\")}\n element(:first_name_field) {b.text_field(:id => \"firstName_control\")}\n element(:last_name_field) {b.text_field(:id => \"lastName_control\")}\n element(:borrower_type_selector) {b.select_list(:id => \"borrowerType_control\")}\n element(:email_address_field) {b.text_field(:id => \"emailAddress_control\")}\n # Search Controls\n # TODO Move these elements to OLE_QA::Framework::OLELS::Lookup (common) when they become universal.\n element(:active_yes_button) {b.radio(:id => 'activeIndicator_control_0')}\n element(:active_no_button) {b.radio(:id => 'activeIndicator_control_1')}\n element(:active_both_button) {b.radio(:id => 'activeIndicator_control_2')}\n element(:search_button) {b.button(:text => \"Search\")}\n element(:clear_button) {b.button(:text => \"Clear Values\")}\n element(:cancel_button) {b.button(:text => \"Cancel\")}\n end", "def _new_form(id, atrb = Hashx.new)\n self[id] = context_module('Form').new(@cfg, atrb.update(id: id))\n end", "def get_definition(cls, bld)\r\n clsVar = CodeNameStyling.getStyled(cls.getUName() + \" form\", Utils.instance.langProfile.variableNameStyle)\r\n clsName = CodeNameStyling.getStyled(cls.getUName() + \" form\", Utils.instance.langProfile.variableNameStyle)\r\n clsIntf = Utils.instance.createVarFor(cls, \"ts_interface\")\r\n\r\n bld.startFunction(\"initData(item: \" + Utils.instance.getStyledClassName(cls.model.name) + \"): void\")\r\n\r\n Utils.instance.eachVar(UtilsEachVarParams.new().wCls(cls).wBld(bld).wSeparate(true).wVarCb(lambda { |var|\r\n if var.isList()\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) + \" = [];\")\r\n else\r\n if Utils.instance.isNumericPrimitive(var)\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) + \" = 0;\")\r\n elsif var.getUType().downcase == \"boolean\"\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) + \" = false;\")\r\n elsif var.getUType().downcase == \"datetime\"\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) + \" = new Date();\")\r\n elsif Utils.instance.isPrimitive(var)\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) + \" = '';\")\r\n else\r\n bld.add(\"item.\" + Utils.instance.getStyledVariableName(var) +\r\n \" = {} as \" + Utils.instance.getStyledClassName(var.getUType()) + \";\")\r\n varCls = ClassModelManager.findVarClass(var, \"ts_interface\")\r\n if varCls != nil\r\n vService = Utils.instance.createVarFor(varCls, \"class_angular_data_gen_service\")\r\n\r\n if vService != nil\r\n srcName = \"item.\" + Utils.instance.getStyledVariableName(var)\r\n bld.add(\"this.\" + Utils.instance.getStyledVariableName(vService) +\r\n \".initData(\" + srcName + \");\")\r\n end\r\n end\r\n end\r\n end\r\n }))\r\n\r\n bld.endFunction()\r\n end", "def configure_form(var_oid, use_format, form_field_name, form_field_oid, form_field_label)\n wait_for_add_new\n add_new.click\n wait_for_variable_oid\n variable_oid.set var_oid\n format.set use_format\n field_name.set form_field_name\n field_oid.set form_field_oid\n label.set form_field_label\n save_form.first.click\n end", "def initialize(main_window)\n\t\tsuper()\n\t\t@main_window = main_window\n\t\t@grid_sensitive_spin_button_list = Array.new\n\t\tself.enable_popup = true\n\t\tself.add(w = Box_Widget.new(self), :tab_label => 'Box')\n\t\tself.set_tab_reorderable(w, true)\n\t\tself.add(w = Net_Widget.new(self), :tab_label => 'Net')\n\t\tself.set_tab_reorderable(w, true)\n\t\tself.add(w = Pin_Widget.new(self), :tab_label => 'Pin')\n\t\tself.set_tab_reorderable(w, true)\n\t\tself.add(w = Path_Widget.new(self), :tab_label => 'Path')\n\t\tself.set_tab_reorderable(w, true)\n\t\tself.add(w = Sym_Widget.new(self), :tab_label => 'Sym')\n\t\tself.set_tab_reorderable(w, true)\n\tend", "def _form\n @comment = Comment.new\n end", "def initialize(args=nil)\n super(args)\n @field = Box.new(name:'field', parent:self)\n @content = Box.new(name:'content', parent:@field)\n end", "def initialize(form)\n @expander = FormExpander.new(form)\n end", "def initialize(name, form)\n @name = name\n @form = form\n @fields = []\n\n fields = get_screen_config['fields']\n if [\"infrastructure\", \"monitoring\"].include?(@form.name)\n fields.each do |field|\n @fields << Field.new(field['name'], self, @form)\n end\n else\n field_class_name = \"#{form.product_name.capitalize}Field\"\n fields.each do |screen_field|\n @fields << Uhuru::BoshCommander.const_get(field_class_name).new(screen_field['name'], self, @form)\n end\n end\n\n end", "def create_locales\n @collect_locales['english'] = Gtk::CheckButton.new(\"English\")\n @collect_locales['french'] = Gtk::CheckButton.new(\"French\")\n @collect_locales['italian'] = Gtk::CheckButton.new(\"Italian\")\n @collect_locales['german'] = Gtk::CheckButton.new(\"German\")\n @table_locale.attach_defaults(@collect_locales['english'], 0, 1, 1, 2)\n @table_locale.attach_defaults(@collect_locales['french'], 0, 1, 2, 3)\n @table_locale.attach_defaults(@collect_locales['italian'], 1, 2, 1, 2)\n @table_locale.attach_defaults(@collect_locales['german'], 1, 2, 2, 3)\n end", "def widgets= mine_widgets\n @form.wigets = mine_widgets\n end", "def fill_contact_form(cont_info_hash)\n form = ContactInfoUI::FORM\n cont_info_hash.each do |field_name, value|\n next if field_name.eql?('Obj Reference')\n new_attr_name = Utility.convert_to_underscore(field_name)\n type = eval(\"ContactInfoUI::#{new_attr_name.upcase}['Type']\")\n label = eval(\"ContactInfoUI::#{new_attr_name.upcase}['Label']\")\n ComponentsUtil.fill_field(type, label, value, form)\n end\n ContactInformation.click_btn('Enviar')\n end", "def initialize(form_object)\n @form_object = form_object\n end", "def initialize form, config={}, &block\n super\n @current_index ||= 0\n # added if check since it was overriding set_buffer in creation. 2009-01-18 00:03 \n set_buffer @list[@current_index].dup if @buffer.nil? or @buffer.empty?\n init_vars\n @_events.push(*[:CHANGE, :ENTER_ROW, :LEAVE_ROW])\n end", "def set_data(params)\n\t\t#if this is the first time, need to initialize the hash\n\t\tif !self.data[:control_widget] then self.data[:control_widget] = {} end\n\t\t\n\t\tself.data[:control_widget][:choice_1_label_1] = params[:choice_1_label_1]\n\t\tself.data[:control_widget][:choice_1_dest1_page_id] = params[:choice_1_dest1_page_id]\n\t\tself.data[:control_widget][:choice_2_label_1] = params[:choice_2_label_1]\n\t\tself.data[:control_widget][:choice_2_dest2_page_id] = params[:choice_2_dest2_page_id]\n\tend", "def fill_inputs\n update(:all,'input').with do\n if element[:name] and element[:name].match(/([a-z,_]+)\\[([a-z,_]+)\\]/)\n element[:value] = send($1).send($2)\n end\n end\n update(:all,'textarea').with do\n if element[:name] and element[:name].match(/([a-z,_]+)\\[([a-z,_]+)\\]/)\n element.inner_html = send($1).send($2)\n end\n end\n end", "def initialize(app)\n super()\n @app = app\n\n self.set_size_request(200, 250)\n self.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)\n\n # Get all components\n @groups = Group.new\n all = ObjectSpace.each_object(Class).select { |k| k < Circuits::Component }\n all.each do |klass|\n next if klass.name.nil?\n names = klass.name.split('::')\n names.shift\n add_to_group(@groups, names, klass)\n end\n\n # The tree view to display everything\n @treeview = Gtk::TreeView.new\n\n # Set up renderer and tree column (we only need 1)\n renderer = Gtk::CellRendererText.new\n column = Gtk::TreeViewColumn.new(\"Component\", renderer)\n column.set_cell_data_func(renderer) do |col, renderer, model, iter|\n renderer.text = iter[0].name\n end\n\n @treeview.append_column(column)\n\n @model = Gtk::TreeStore.new(ListItem)\n\n # Add the components to the model\n add_group(@groups, @model, nil)\n\n @treeview.model = @model\n\n # Add tree view\n self.add(@treeview)\n\n @callbacks = []\n\n # Function to change selection when user clicks on component name\n last = nil\n @treeview.signal_connect('cursor-changed') do |tree, e|\n selection = tree.selection\n iter = selection.selected\n next unless iter\n if iter[0].component == NilClass\n selection.unselect_iter(iter)\n selection.select_iter(last) if last\n else\n last = iter\n @selected = iter[0].component\n @callbacks.each { |cb| cb.call(@selected) }\n #puts \"Selected: #{@selected}\"\n end\n end\n end", "def attach_form c\n c.form = @form\n c.override_graphic @graphic\n c.parent_component = self\n end", "def set_glade_active_record(obj = self)\r\n return if not defined? obj.attributes\r\n obj.attributes.each_pair { |key, val| fill_control(class_name(obj) + \".\" + key, val) }\r\n end", "def load_glade() \r\n caller__FILE__ = my_class_file_path() \r\n file_name = File.join(File.split(caller__FILE__)[0] , \"glade\", class_name(self) + \".glade\")\r\n @builder = Gtk::Builder.new\r\n @builder << file_name\r\n @builder.connect_signals{ |handle| method(handle) }\r\n end", "def build_line_form(line,action,caption,is_edit = nil)\n\n field_configs = Array.new\n\tfield_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'line_code'}\n\n\tfield_configs[1] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'line_phc'}\n\n field_configs[field_configs.length()] = {:field_type=>'CheckBox', :field_name=>'is_dedicated'}\n\n\n build_form(line,field_configs,action,'line',caption,is_edit)\n\n\n end", "def all_talent_forms_page\n \t@male = Male.new\n \t@female = Female.new\n \t@photo = Photo.new\n \t@hair = Hair.new\n \t@mua = Mua.new\n \t@stylist = Stylist.new\n \t@client = Client.new\n end", "def initialize(path_or_data, root = nil, domain = nil, localedir = nil, flag = GladeXML::FILE)\n bindtextdomain(domain, localedir, nil, \"UTF-8\")\n @glade = GladeXML.new(path_or_data, root, domain, localedir, flag) {|handler| method(handler)}\n \n #Filters used on the choosers widgets\n @filter = Gtk::FileFilter.new\n @filter.name = 'Supported Files'\n @filter.add_pattern('*.in')\n @filter.add_pattern('*.rtf')\n @filter.add_pattern('*.xml')\n @filter.add_pattern('*.txt')\n\n @mainWindow = self\n\n #array with the texts\n @texts = []\n @scrolls = []\n @number_of_texts = 0\n\n # Manage the project\n @project = Project.new\n\n #Tag Manager\n @tagManager = TagManager.new\n \n #Manage the table and texts\n @main_table = @glade.get_widget('mainTable')\n\n #Manage the tree view\n @treeView = TreeV.new @project, @mainWindow\n @glade.get_widget('mainDiv').pack_start @treeView.view, false, false, 0\n @glade.get_widget('mainDiv').reorder_child @treeView.view, 0\n @glade.get_widget('mainDiv').show_all\n end", "def set_form form\n raise \"Form is nil in set_form\" if form.nil?\n @form = form\n @id = form.add_widget(self) if !form.nil? and form.respond_to? :add_widget\n # 2009-10-29 15:04 use form.window, unless buffer created\n # should not use form.window so explicitly everywhere.\n # added 2009-12-27 20:05 BUFFERED in case child object needs a form.\n # We don;t wish to overwrite the graphic object\n if @graphic.nil?\n #$log.debug \" setting graphic to form window for #{self.class}, #{form} \"\n @graphic = form.window unless form.nil? # use screen for writing, not buffer\n end\n # execute those actions delayed due to absence of form -- used internally \n # mostly by buttons and labels to bind hotkey to form\n fire_handler(:FORM_ATTACHED, self) if event? :FORM_ATTACHED\n end", "def set_elements\n super\n element(:new_bib_button) {b.input(:id => \"bibCreateCurrentItemButton\")}\n element(:item_type_selector) {b.select_list(:id => \"newPurchasingItemLine.itemTypeDescription\")}\n element(:copies_field) {b.text_field(:id => \"newPurchasingItemLine.oleItemQuantity\")}\n element(:parts_field) {b.text_field(:id => \"newPurchasingItemLine.itemNoOfParts\")}\n element(:list_price_field) {b.text_field(:id => \"newPurchasingItemLine.itemListPrice\")}\n element(:public_view_checkbox) {b.checkbox(:id => \"newPurchasingItemLine.itemPublicViewIndicator\")}\n element(:item_price_source_selector) {b.select_list(:id => \"newPurchasingItemLine.itemPriceSourceId\")}\n element(:request_source_selector) {b.select_list(:id => \"newPurchasingItemLine.requestSourceTypeId\")}\n element(:format_selector) {b.select_list(:id => \"newPurchasingItemLine.formatTypeId\")}\n element(:category_selector) {b.select_list(:id => \"newPurchasingItemLine.categoryId\")}\n element(:route_to_requestor_checkbox) {b.checkbox(:id => \"newPurchasingItemLine.itemRouteToRequestorIndicator\")}\n element(:discount_field) {b.text_field(:id => \"newPurchasingItemLine.itemDiscount\")}\n element(:discount_type_selector) {b.select_list(:id => \"newPurchasingItemLine.itemDiscountType\")}\n element(:add_button) {b.input(:name => \"methodToCall.addItem\")}\n end", "def on_enter\n super\n set_form_row\n end", "def get_definition(cls, bld, fun)\r\n itemVar = CodeNameStyling.getStyled(cls.getUName() + \" form\", Utils.instance.langProfile.variableNameStyle)\r\n clsVar = CodeNameStyling.getStyled(cls.getUName() + \" form\", Utils.instance.langProfile.variableNameStyle)\r\n populateServiceVar = Utils.instance.createVarFor(cls, \"class_angular_data_map_service\")\r\n\r\n if clsVar != nil && populateServiceVar != nil\r\n bld.startFunction(\"populate(): void\")\r\n bld.add(\"this.\" + Utils.instance.getStyledVariableName(populateServiceVar) +\r\n \".populate(this.\" + clsVar + \" as FormGroup, this.item);\")\r\n\r\n bld.endFunction()\r\n end\r\n end", "def initialize(text = '', **options, &block)\n super(Gtk::Entry.new, **options, &block)\n self.text = text\n end", "def initialize(p_form, p_parent)\n\t\t\n\t\t\t# Assign usual instance vars, reference to form and parent\n\t\t\t@form = p_form\n\t\t\t@parent = p_parent\n\t\t\tsuper(p_parent)\n\t\t\t\n\t\t\t# Initialize attributes\n\t\t\t@dir_browse_form = nil\n\t\t\t\t\t\n\t\t\t# Flag, used once for proper form initialization\n\t\t\t@initialized = false\n\t\tend", "def create_button value\n\n button = Gtk::Button.new(value)\n\n # handle keyboard input, which uses \"active\" event on button\n button.signal_connect(\"activate\") do |widget|\n handle_input widget.label\n end\n\n # handle mouse-click event, which uses \"pressed\" event\n button.signal_connect(\"pressed\") do |widget|\n handle_input widget.label\n end\n\n button.set_can_focus false\n\n button\n\n end", "def build_editable_fields(actions, guardian, args)\n end", "def initialize( controller )\n\n\t\t\tsuper( controller );\n\n\t\t\tcolorFillClass\t\t\t\t= widgetClass('HooColorFill')\n\t\t\tli \t\t\t\t\t\t= widgetClass(\"HooLoremIpsumView\")\n\t\t\tsimpleButton\t\t\t\t= widgetClass('HooFormButtonSimple')\n\t\t\ttoggleButton\t\t\t\t= widgetClass('HooFormButtonSimple')\n\n\t\t\[email protected];\n\n\t\t\tcolorFillView = colorFillClass.new()\n\t\t\[email protected]( colorFillView )\n\n\t\t\tliInstance = li.new()\n\t\t\tcolorFillView.addSubView( liInstance )\n\n\t\t\tlambda {\n\t\t\t\t@simpleButton1 = simpleButton.new( :initialState=>1 );\n\t\t\t\[email protected] = '../images/buttons/simple-button/3-state-combine.png';\n\t\t\t\[email protected] = [105,45];\n\t\t\t\[email protected] = ['-- --', 'Submit', 'Pressed'];\n\t\t\t\[email protected] = 1;\n\t\t\t\[email protected] = '#fff'\n\t\t\t\[email protected] = '/widgets/_ajaxPostTest'\n\t\t\t\t#@simpleButton1.javascript = \"this.hookupAction( function(){\n\t\t\t\t#\talert('Holy Cock');\n\t\t\t\t#});\";\n\t\t\t\[email protected]( @simpleButton1 );\n\t\t\t}.call\n\n\t\tend", "def on_enter\n set_form_row # 2011-10-17 \n end", "def build_postal_address_type_form(postal_address_type,action,caption,is_edit = nil,is_create_retry = nil)\n#\t--------------------------------------------------------------------------------------------------\n#\tDefine a set of observers for each composite foreign key- in effect an observer per combo involved\n#\tin a composite foreign key\n#\t--------------------------------------------------------------------------------------------------\n\tsession[:postal_address_type_form]= Hash.new\n#\t---------------------------------\n#\t Define fields to build form from\n#\t---------------------------------\n\t field_configs = Array.new\n\tfield_configs[0] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'postal_address_type_code'}\n\n\tfield_configs[1] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'address_type_code'}\n\n\tfield_configs[2] = {:field_type => 'TextField',\n\t\t\t\t\t\t:field_name => 'postal_address_type_description'}\n\n\tbuild_form(postal_address_type,field_configs,action,'postal_address_type',caption,is_edit)\n\nend", "def custom_fields\n if debug?\n channel_fields = ChannelFieldForm.new\n channel_fields.create_field(\n group_id: 1,\n type: 'Checkboxes',\n label: 'Checkboxes',\n fields: {\n field_list_items: \"Yes\\nNo\\nMaybe\"\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Radio Buttons',\n label: 'Radio Buttons',\n fields: {\n field_list_items: \"Left\\nCenter\\nRight\"\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Multi Select',\n label: 'Multi Select',\n fields: {\n field_list_items: \"Red\\nGreen\\nBlue\"\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Select Dropdown',\n label: 'Select Dropdown',\n fields: {\n field_list_items: \"Mac\\nWindows\\nLinux\"\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Select Dropdown',\n label: 'Prepopulated',\n fields: {\n field_pre_populate: 'y'\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Rich Text Editor',\n label: 'Rich Text Editor',\n fields: {\n field_ta_rows: 20,\n field_text_direction: 'Right to left'\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Toggle',\n label: 'Toggle'\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Text Input',\n label: 'Text Input',\n fields: {\n field_maxl: 100,\n field_fmt: 'None',\n field_show_fmt: 'y',\n field_text_direction: 'Right to left',\n field_content_type: 'Decimal',\n field_show_smileys: 'y',\n field_show_file_selector: 'y'\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Textarea',\n label: 'Textarea',\n fields: {\n field_ta_rows: 20,\n field_fmt: 'None',\n field_show_fmt: 'y',\n field_text_direction: 'Right to left',\n field_show_formatting_btns: 'y',\n field_show_smileys: 'y',\n field_show_file_selector: 'y'\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'URL',\n label: 'URL Field',\n fields: {\n url_scheme_placeholder: '// (Protocol Relative URL)'\n }\n ) do |page|\n page.all('input[name=\"allowed_url_schemes[]\"]').each do |element|\n element.click unless element.checked?\n end\n end\n\n @page.load\n else\n $db.query(IO.read('channel_sets/custom-fields.sql'))\n clear_db_result\n end\n end", "def fill_missing_fields\n unless self.title.blank?\n self.menu_name = self.title if self.menu_name.blank?\n self.shortcut = self.title.parameterize.html_safe if self.shortcut.blank?\n else\n unless self.menu_name.blank?\n self.title = self.menu_name if self.title.blank?\n self.shortcut = self.menu_name.parameterize.html_safe if self.shortcut.blank?\n end\n end\n end", "def fill_form(new_values = {})\n reset!(new_values)\n dom_writer.fill(values)\n end", "def init_layout(state)\n @cells = Array.new(state[:board_rows]) { Array.new(state[:board_columns], nil) }\n @layout = Gtk::FlowBox.new\n @layout.valign = :start\n @layout.max_children_per_line = 1\n @layout.selection_mode = :none\n @layout.set_row_spacing(10)\n\n @turn_indicator = Gtk::Label.new\n @layout.add(@turn_indicator)\n\n @fixed_layout = Gtk::Fixed.new\n @layout.add(@fixed_layout)\n\n cell_grid = Gtk::Grid.new\n @fixed_layout.put(cell_grid, 0, 0)\n\n (0..(state[:board_columns] - 1)).each do |col|\n (0..(state[:board_rows] - 1)).each do |row|\n cell = Gtk::Button.new\n cell.set_size_request(100, 100)\n @cells[row][col] = cell\n cell_grid.attach(cell, col, row, 1, 1)\n end\n end\n\n column_grid = Gtk::Grid.new\n @fixed_layout.put(column_grid, 0, 0)\n\n (0..(state[:board_columns] - 1)).each do |column_index|\n column = Gtk::Button.new\n column.set_size_request(100, 100 * state[:board_rows])\n column.style_context.add_provider(@column_style, Gtk::StyleProvider::PRIORITY_USER)\n column.signal_connect('clicked') do |_|\n changed\n notify_observers('column_clicked', column_index)\n end\n column_grid.attach(column, column_index, 0, 1, 1)\n end\n\n @tokens_indicator = Gtk::Label.new\n\n @t_button = Gtk::Button.new\n @t_button.set_size_request(100, 100)\n @t_button.signal_connect('clicked') do |_, _|\n changed\n notify_observers('t_clicked')\n end\n\n @o_button = Gtk::Button.new\n @o_button.set_size_request(100, 100)\n @o_button.signal_connect('clicked') do |_, _|\n changed\n notify_observers('o_clicked')\n end\n\n @winner = Gtk::Label.new\n @main_menu_button = Gtk::Button.new(label: 'Back to Main Menu')\n @main_menu_button.signal_connect('clicked') do |_, _|\n changed\n notify_observers('main_menu_clicked')\n end\n\n if state[:type] == AppModel::TOOT_AND_OTTO\n @token_button_box = Gtk::Box.new(:horizontal, 10)\n @layout.add(@tokens_indicator)\n @token_button_box.add(@t_button)\n @token_button_box.add(@o_button)\n @layout.add(@token_button_box)\n end\n\n @mask = Gtk::Button.new(label: 'Please wait for your turn...')\n @mask.set_size_request(100 * state[:board_columns], 100 * state[:board_rows])\n @mask.style_context.add_provider(@mask_style, Gtk::StyleProvider::PRIORITY_USER)\n\n @window.add(@layout)\n end", "def buttonSave__clicked(*args)\n get_glade_variables()\n @builder[\"window1\"].destroy\n end", "def model_form(params={})\n # {{{\n method = params[:action]\n instance = params[:instance]\n klass = params[:model]\n klass ||= @klass\n\n custom_elements = {}\n log { \"Custom Form Elements: #{custom_form_elements.inspect}\" }\n custom_form_elements.each_pair { |clause, value|\n clause_parts = clause.to_s.split('.')\n table = clause_parts[0..1].join('.')\n attrib = clause_parts[2]\n custom_elements[table] = Hash.new unless custom_elements[table]\n custom_elements[table][attrib.to_sym] = value\n }\n view = @@form_generator.new(klass)\n view.labels = Lang[plugin_name]\n view.custom_elements = custom_elements\n form = view.form\n\n form.add(GUI::Hidden_Field.new(:name => :action, :value => method.to_s, :required => true)) if method\n form.add(GUI::Hidden_Field.new(:name => :controller, :value => klass.model_name.to_s, :required => true))\n\n form_values = {}\n default_form_values.each_pair { |attrib, value|\n form_values[attrib.to_s] = value\n }\n \n if instance then\n instance.attribute_values.each { |table, args| \n args.each { |name, value|\n form_values[\"#{table}.#{name}\"] = value\n }\n }\n klass.get_primary_keys.each { |table, keys|\n keys.each { |key|\n pkey_field_name = \"#{table}.#{key}\"\n form.add(GUI::Hidden_Field.new(:name => pkey_field_name, \n :value => instance.attribute_values[table][key], \n :required => true))\n }\n }\n end\n \n if(defined? form_groups) then\n form.fields = form_groups\n end\n if(defined? form_hints) then\n form.hints = form_hints\n end\n\n form.set_values(form_values)\n\n title_key = (klass.table_name).gsub('.','--')+'--add'\n form.title = (Lang[plugin_name][title_key]) unless Lang[plugin_name][title_key] == title_key\n klassname = @klass.to_s.gsub('Aurita::','').gsub('Main::','').gsub('Plugins::','').gsub('::','__').downcase\n form.name = klassname + '_' << method.to_s + '_form'\n form.id = klassname + '_' << method.to_s + '_form'\n\n log('Update form fields: ' << form.fields.inspect)\n log('Update form elements: ' << form.element_map.keys.inspect)\n return form\n end", "def injection_form\n # Nothing to do here\n end", "def initialize(form, args)\n @form = form\n @args = args\n\n # Check arguments\n unknownArgs = []\n @args.keys.each do |arg|\n self.class.validArgs.include? arg or unknownArgs << arg\n end\n unknownArgs.empty? or raise WidgetFormatError, \"One or more arguments is not valid: #{unknownArgs.join(', ')}\"\n end", "def __val2ruby_optkeys # { key=>proc, ... }\n super().update('labelwidget'=>proc{|v| window(v)})\n end", "def form_enter type, valid_attributes\r\n valid_attributes.each { |field,value| form.send(\"#{type}[#{field}]=\",value)}\r\nend", "def create_contents\n @shell.layout = GridLayout.new(6, true)\n\n Label.new(@shell, SWT::NONE).text = \"Your name:\"\n\n @name_box = Text.new(@shell, SWT::BORDER)\n layout_data = GridData.new(GridData::FILL_HORIZONTAL)\n layout_data.horizontalSpan = 4\n @name_box.layout_data = layout_data\n\n @status_label = Label.new(@shell, SWT::BORDER)\n layout_data = GridData.new(GridData::FILL_HORIZONTAL)\n layout_data.horizontalSpan = 3\n @status_label.layout_data = layout_data \n\n\n\t\t@button = Button.new(@shell, SWT::PUSH)\n\t\[email protected] = \"Click me!\"\n\t\tlayout_data = GridData.new(GridData::END, GridData::CENTER, false, false)\n\t\tlayout_data.horizontalSpan = 6\n\t\[email protected]_data = layout_data\n @button.addSelectionListener do\n handle_click\n end\n end", "def configure_field\n end", "def initialize(params = {})\n # @step=0\n # Gtk.running=true\n \n end", "def default_form_builder; end", "def layout_fields\n @options.controls.each do | control |\n label = Label.new(control.name)\n label.rect.topleft = [@fieldX, @fieldY]\n \n button = Button.new(control.to_s) { self.capture_event(control) }\n button.rect.topleft = [ label.rect.right + @spacing, @fieldY ]\n \n # TODO: Like in the original, there's no column creation\n @fieldY = label.rect.bottom + @spacing\n \n self << label\n self << button\n end\n end", "def initialize(manager,ic)\n\t\tsuper(manager.win)\n\t\t@manager = manager\n\t\t#Chargement de la campagne\n\t\t@adventure = manager.session\n\t\tscreen = Constants::SCREEN\n\t\t@pad=Constants::BUTTON_PADDING\n\t\t@ic=ic\n\t\t@gtkObject = Gtk::Table.new(3,3)\n\t\t@scrol=ScrollableArea.new(:vertical)\n\t\t@boxV=Gtk::Box.new(:vertical)\n\t\t@overAllStars = @adventure.overAllStars.to_s\n\n\t\t@etoileTotal=Gtk::Box.new(:horizontal)\n\t\ta=Gtk::Alignment.new(0.5,0,0.5,1)\n\t\ta.add(@boxV)\n\t\[email protected](a,0,1,1,2)\n\n\t\[email protected]_start(@etoileTotal ,expand: false, fill: true, padding:@pad)\n\t\t@st=Star.new(1,1,@ic)\n\t\[email protected]_start(@st.stars,expand: false, fill: true, padding:@pad)\n\t\tnbEtoile=Text.new(@overAllStars)\n\n\t\tnbEtoile.title\n\t\[email protected]_start(nbEtoile.gtkObject,expand: false, fill: true, padding:@pad)\n\n\t\[email protected]_start(@scrol.gtkObject,expand: true, fill: true, padding: @pad)\n\n\t\t@[email protected]\n\t\[email protected](:loc)\n\n @b=Gtk::Box.new(:horizontal, 25)\n\t\[email protected](@b)\n\n\t\t@icones=LevelNumbers.new(manager,@adventure ,@adventure.overAllStarsHash,@ic)\n\t\[email protected]_start(@icones.im,expand: false, fill: true, padding: @pad)\n @menuR=Gtk::Box.new(:horizontal, 25)\n\t\[email protected](@menuR)\n\n\t\tretour=Text.new(@textManager.getButtonLabel(\"adventure\", \"back\"))\n @boxV.pack_start(retour.gtkObject ,expand: false, fill: true, padding:@pad)\n \tretour.onClick{\n\t\t\tmanager.session.updateSave\n\t\t\tmanager.updateSave\n \tmanager.mainScreen.applyOn(@parent)\n\t\t}\n @gtkObject.attach(Gtk::Image.new(pixbuf: @buffer),0,3,0,3)\n\tend", "def initialize(form, form_field, field, language)\n @form = form\n @form_field = form_field\n @field = field\n @language = language\n end", "def initialize(parent)\n\t\t@assets = MenuAssets.getInstance\n\t\t@gtkObject = Gtk::Box.new :vertical\n\n\t\tmodel = Gtk::ListStore.new(String)\n\n\t\t@treeview = Gtk::TreeView.new(model)\n\t\tsetup_tree_view(@treeview)\n\n\t\tsave = Sauvegardes.new(\"./Game/Core/Saves/\",\"*.yml\")\n\n\t\tdata = save.chargerRepertoire\n\n\t\t# swapped = true\n\t\t# while swapped do\n\t\t# \tswapped = false\n\t\t# \t0.upto(data.size-2) do |i|\n\t\t# \t\tif (Date.parse(data[i].split(\"&\")[2][0...10]) <=> Date.parse(data[i].split(\"&\")[2][0...10]))<0\n\t\t# \t\t\tdata[i], data[i+1] = data[i+1], data[i]\n\t\t# \t\t\tswapped = true\n\t\t# \t\tend\n\t\t# \tend\n\t\t# end\n\n\t\tdata = data.sort{|n, m|\n\t\t\tn.split(\"&\").last <=> m.split(\"&\").last\n\t\t}.reverse\n\n\n\n\t\tdata.each_with_index do |v|\n\t\t iter = model.append\n\t\t model.set_value(iter, 0, v)\n\t\tend\n\n\t\tbox2 = Gtk::Box.new(:vertical, 10)\n\t\tbox2.border_width = 10\n\t\[email protected]_start(box2, :expand => true, :fill => true, :padding => 0)\n\n\t\tscrolled_win = Gtk::ScrolledWindow.new\n\t\tscrolled_win.add_with_viewport(@treeview)\n\t\tscrolled_win.set_policy(:automatic,:automatic)\n\t\tbox2.pack_start(scrolled_win,:expand => true, :fill => true, :padding => 0)\n\n\n\t\t# box2 = Gtk::Box.new :horizontal\n\t\t# box2.border_width = 10\n\n\t\tbox2 = Gtk::ButtonBox.new :horizontal\n\t\tbox2.layout = :center\n\n\t\tbLoad = MenuItemUi.new(:load, @assets)\n\t\tbLoad.setOnClickEvent(Proc.new{\n\t\t\titer = @treeview.selection.selected\n\t\t\tif(iter != nil)\n\t\t\t\tindex = save.getIndex(model.get_value(iter,0)) #recuperation index\n\t\t\t\tinfos = save.getInfos(index)\n\t\t\t\tparent.changeBackground(\"ecranDeJeu\")\n\t\t\t\tif infos[0] == \"Ranked\"\n\t\t\t\t\tparent.display(RankedMode.new(nil,parent,infos.join(\"&\")))\n\t\t\t\telsif infos[0] == \"TimeTrial\"\n\t\t\t\t\tpath = File.dirname(__FILE__) + \"/../Game/Core/Saves/\"+infos.join(\"&\")\n\t\t\t\t\tdata = YAML.load_file(path)\n\t\t\t\t\tnbGrids = data[\"nbGames\"]\n\t\t\t\t\tdifficulty = :easy\n\t\t\t\t\tif nbGrids > 5\n\t\t\t\t\t\tdifficulty = :intermediate\n\t\t\t\t\telsif nbGrids > 10\n\t\t\t\t\t\tdifficulty = :hard\n\t\t\t\t\tend\n\t\t\t\t\tparent.display(TimeTrialMode.new(parent,infos.join(\"&\"),difficulty,nbGrids ))\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tdialog = Gtk::Dialog.new(\"Message\",$main_application_window,Gtk::DialogFlags::DESTROY_WITH_PARENT,[ Gtk::Stock::OK, Gtk::ResponseType::NONE ])\n\t\t\t\tdialog.signal_connect('response') { dialog.close }\n\t\t\t\t\tif @assets.language == \"FR_fr\"\n\t\t\t\t\t\tdialog.child.add(Gtk::Label.new(\"\\n\\n\\t Veuillez selectionner une sauvegarde à charger.\\t\\n\\n\"))\n\t\t\t\t\telse\n\t\t\t\t\t\tdialog.child.add(Gtk::Label.new(\"\\n\\n\\t Please select a save file to load.\\t\\n\\n\"))\n\t\t\t\t\tend\n\t\t\t\tdialog.show_all\n\t\t\tend\n\t\t})\n\n\t\tbox2.add(bLoad.gtkObject)\n\n\t\tbDelete = MenuItemUi.new(:delete, @assets)\n\t\tbDelete.setOnClickEvent(Proc.new{\n\t\t iter = @treeview.selection.selected\n\n\t\tif(iter != nil)\n\t\t index = save.getIndex(model.get_value(iter,0))#recuperation index\n\t\t save.supprimer(index)\n\t\t model.remove(iter)\n\t\telse\n\t\tdialog = Gtk::Dialog.new(\"Message\",$main_application_window,Gtk::DialogFlags::DESTROY_WITH_PARENT,[ Gtk::Stock::OK, Gtk::ResponseType::NONE ])\n\t\tdialog.signal_connect('response') { dialog.close }\n\t\t\tif @assets.language == \"FR_fr\"\n\t\t\t\tdialog.child.add(Gtk::Label.new(\"\\n\\n\\t Veuillez selectionner une sauvegarde à supprimer.\\t\\n\\n\"))\n\t\t\telse\n\t\t\t\tdialog.child.add(Gtk::Label.new(\"\\n\\n\\t Please select a save file to delete.\\t\\n\\n\"))\n\t\t\tend\n\t\tdialog.show_all\n\t\tend\n\n\n\n\n\t\t})\n\t\tbox2.add(bDelete.gtkObject)\n\n\t\t# @gtkObject.pack_start(box2, :expand => false, :fill => true, :padding => 0)\n\t\t# box2 = Gtk::Box.new(:vertical, 10)\n\t\t# box2.border_width = 10\n\t\t# @gtkObject.pack_start(box2, :expand => false, :fill => true, :padding => 0)\n\n\t\tbRetour = MenuItemUi.new(:back,@assets)\n\t\tbRetour.setOnClickEvent(Proc.new{\n\t\t\tparent.changeBackground(\"menuPrincipal\")\n\t\t\tparent.display(parent.mainMenu)\n\t\t})\n\t\tbox2.add(bRetour.gtkObject)\n\t\[email protected]_start(box2, :expand => false, :fill => true, :padding => 0)\n\tend", "def initialize form = nil, config={}, &block\n @_header_adjustment = 0 #1\n @col_min_width = 3\n\n @expanded_state = {}\n register_events(TREE_EVENTS)\n super\n #@_events.push(*[:ENTER_ROW, :LEAVE_ROW, :TREE_COLLAPSED_EVENT, :TREE_EXPANDED_EVENT, :TREE_SELECTION_EVENT, :TREE_WILL_COLLAPSE_EVENT, :TREE_WILL_EXPAND_EVENT])\n create_default_renderer unless @renderer # 2014-04-10 - 11:01 \n init_vars\n #set_default_selection_model unless @list_selection_model\n end", "def get_string label, config={} # yield Field\n config[:title] ||= \"Entry\"\n config[:title_color] ||= $reversecolor\n label_config = config[:label_config] || {}\n label_config[:row] ||= 2\n label_config[:col] ||= 2\n label_config[:text] = label\n\n field_config = config[:field_config] || {}\n field_config[:row] ||= 3\n field_config[:col] ||= 2\n #field_config[:attr] = :reverse\n field_config[:color] ||= :black\n field_config[:bgcolor] ||= :cyan\n field_config[:maxlen] ||= config[:maxlen]\n field_config[:default] ||= config[:default]\n field_config[:default] = field_config[:default].chomp if field_config[:default]\n field_config[:name] = :name\n #field_config[:width] ||= 50 # i want it to extend since i don't know the actual width\n #field_config[:width] ||= 50 # i want it to extend since i don't know the actual width\n field_config[:width] ||= (field_config[:width] || 50)\n\n defwid = config[:default].nil? ? 30 : config[:default].size + 13\n w = [label.size + 8, defwid, field_config[:width]+13 ].max\n config[:width] ||= w\n ## added history 2013-03-06 - 14:25 : we could keep history based on prompt\n $get_string_history ||= []\n #$log.debug \"XXX: FIELD SIZE #{w} \"\n #$log.debug \"XXX: FIELD CONFIG #{field_config} \"\n tp = MessageBox.new config do\n button_type :ok_cancel\n default_button 0\n item Label.new nil, label_config\n fld = Field.new nil, field_config\n item fld\n ## added field history 2013-03-06 - 14:24 \n require 'canis/core/include/rhistory'\n fld.extend(FieldHistory)\n # We need to manually set history each time, since the field is recreated\n # with the messagebox. Otherwise, field can on its own handle history\n fld.history($get_string_history)\n end\n # added yield to override settings\n yield tp.form.by_name[:name] if block_given?\n index = tp.run\n if index == 0 # OK\n ## added field history 2013-03-06 - 14:24 \n t = tp.form.by_name[:name].text\n $get_string_history << t if t && !$get_string_history.include?(t)\n return t\n else # CANCEL\n # Should i use nil or blank. I am currently opting for nil, as this may imply to caller\n # that user does not wish to override whatever value is being prompted for.\n return nil\n end\nend" ]
[ "0.6349929", "0.61988336", "0.6104339", "0.58542556", "0.5808911", "0.5721402", "0.5607525", "0.55946183", "0.55850744", "0.5578518", "0.55732864", "0.55536795", "0.55454993", "0.547914", "0.5464775", "0.5462236", "0.5455543", "0.545123", "0.54298455", "0.5415321", "0.5394893", "0.53928715", "0.53902674", "0.5389958", "0.53821987", "0.5372087", "0.5363381", "0.53399104", "0.5334483", "0.53148425", "0.5306022", "0.5304387", "0.5299766", "0.5290996", "0.5285733", "0.5244316", "0.5230457", "0.5228474", "0.5226394", "0.52191144", "0.520647", "0.52030104", "0.5188913", "0.5183199", "0.51748705", "0.51730174", "0.5172003", "0.5163927", "0.5147619", "0.5142632", "0.5138547", "0.5137776", "0.5134708", "0.5128124", "0.5124107", "0.5118918", "0.5113383", "0.51018614", "0.5097618", "0.5083904", "0.50812274", "0.5071535", "0.5063284", "0.5055751", "0.50499", "0.5047073", "0.5031554", "0.50280625", "0.50259686", "0.5024072", "0.50208324", "0.50078684", "0.50035393", "0.50032854", "0.49990514", "0.4996765", "0.4996081", "0.49953863", "0.4989327", "0.49823138", "0.4980895", "0.49754187", "0.49744928", "0.497403", "0.4973601", "0.4971886", "0.497085", "0.49662536", "0.49635", "0.49595276", "0.49583802", "0.49573395", "0.49464816", "0.49446115", "0.49426377", "0.49389413", "0.49190357", "0.49162048", "0.4912752", "0.49031755" ]
0.54972976
13
The method you call to show the glade form. It loads the glade form, sets all the form's widgets to your instance variables, connects all your methods to their signals, and starts Gtk.main loop if necessary.
def show_glade(parent = nil) load_glade() if parent then @builder[:window1].transient_for = parent.builder[:window1] end before_show() if respond_to? :before_show parse_signals() set_glade_all() @builder[:window1].show #show_all can't hide widgets in before_show @top_level_window = Gtk.main_level == 0 ? true : false Gtk.main if @top_level_window or @builder[:window1].modal? # need new Gtk.main for blocking! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_glade() \r\n caller__FILE__ = my_class_file_path() \r\n file_name = File.join(File.split(caller__FILE__)[0] , \"glade\", class_name(self) + \".glade\")\r\n @builder = Gtk::Builder.new\r\n @builder << file_name\r\n @builder.connect_signals{ |handle| method(handle) }\r\n end", "def initialize\n @gui = Gtk::Builder.new\n @gui.add(\"#{File.dirname(__FILE__)}/ui/main.ui\")\n @gui.connect_signals { |handler| method(handler) }\n\n @window = @gui[:window]\n winsetting = GtkSettingsWindow.new(@window, \"win_main\")\n\n @nb_dbs = @gui[:nbDbs]\n @nb_dbs.connect_after(\"switch-page\", [self, \"ChangeActiveDB\"])\n\n @window.show_all\n end", "def run\n Gtk.main\n end", "def inicializar_ventana\r\n set_title \"Php - Generator Polls\"\r\n set_default_size 400, 315\r\n set_window_position Gtk::Window::Position::CENTER\r\n signal_connect \"delete_event\" do\r\n Gtk.main_quit\r\n end\r\n signal_connect \"destroy\" do\r\n Gtk.main_quit\r\n end\r\n init_gui\r\n show_all\r\n end", "def initialize(path_or_data, root = nil, domain = nil, localedir = nil, flag = GladeXML::FILE)\n bindtextdomain(domain, localedir, nil, \"UTF-8\")\n @glade = GladeXML.new(path_or_data, root, domain, localedir, flag) {|handler| method(handler)}\n @selected_show_id = nil\n @cbShow = @glade.get_widget(\"cbShows\")\n @txtFile = @glade.get_widget(\"txtSelectedFile\")\n @progress = @glade.get_widget(\"ctlProgress\")\n @btnOK = @glade.get_widget(\"btnOK\")\n @btnCancel = @glade.get_widget(\"btnCancel\")\n @chkShowPDF = @glade.get_widget(\"chkShowPDF\")\n @log = Log.instance.log\n begin\n @db = RMSCDB.new\n rescue\n puts \"Error connecting to the data base: #{ $!.error }\"\n @log.error \"Error connecting to the data base: #{ $!.error }\"\n @db = nil\n end\n load_shows\n \n @mainWindow = @glade.get_widget(\"mainWindow\")\n @mainWindow.show\n @log.info \"Started #{$0} at #{Time.now}\"\n end", "def setup_gui\n \n end", "def initialize(dbpage)\n @dbpage = dbpage\n @dbconn = @dbpage.dbconn\n\n @gui = Gtk::Builder.new\n @gui.add(\"#{File.dirname(__FILE__)}/ui/win_runsql.ui\")\n @gui.connect_signals { |handler| method(handler) }\n\n @cb_type = @gui[:cbType]\n combobox_init(@cb_type)\n @cb_type.get_model.append([\"Auto\"])\n @cb_type.get_model.append([\"One-liners\"])\n @cb_type.get_model.append([\"phpMyAdmin dump\"])\n @cb_type.set_active(0)\n\n @window = @gui[:window]\n winsetting = GtkSettingsWindow.new(@window, \"win_runsql\")\n @window.show_all\n end", "def initialize\n\t\t@gtkObject = Gtk::Window.new\n\t\t@assets = MenuAssets.getInstance()\n\t\tinitMenus\n\t\tinitGtkWindow\n\tend", "def init_gui\r\n pathFile = \"\"\r\n pathCreate = \"\"\r\n fixed = Gtk::Fixed.new\r\n add fixed\r\n label = Gtk::Label.new(\"Xml - File Path:\")\r\n label.set_size_request 100,30\r\n button = Gtk::FileChooserButton.new(\"Search\", Gtk::FileChooser::ACTION_OPEN)\r\n button.set_size_request 280,30\r\n filter = Gtk::FileFilter.new\r\n filter.add_pattern('*.xml')\r\n button.add_filter(filter)\r\n button.signal_connect('selection_changed') do |w|\r\n pathFile = w.filename.to_s\r\n arrayPath = pathFile.split('\\\\')\r\n pathCreate = \"\"\r\n for i in 0..arrayPath.length-2\r\n pathCreate+=arrayPath[i]+\"\\\\\"\r\n end\r\n pathCreate+=\"files\\\\\"\r\n end\r\n labelDB = Gtk::Label.new(\"Name Database:\")\r\n entryDB = Gtk::Entry.new\r\n entryDB.set_width_chars 45\r\n entryDB.set_text \"\"\r\n labelDBServer = Gtk::Label.new(\"Server Database:\")\r\n entryDBServer = Gtk::Entry.new\r\n entryDBServer.set_width_chars 45\r\n entryDBServer.set_text \"\"\r\n labelDBUser = Gtk::Label.new(\"User Database:\")\r\n entryDBUser = Gtk::Entry.new\r\n entryDBUser.set_width_chars 45\r\n entryDBUser.set_text \"\"\r\n labelDBPass = Gtk::Label.new(\"Pass Database:\")\r\n entryDBPass = Gtk::Entry.new\r\n entryDBPass.set_width_chars 45\r\n entryDBPass.visibility = false\r\n entryDBPass.invisible_char = 42\r\n labelEmail = Gtk::Label.new(\"Admin Email:\")\r\n entryEmail = Gtk::Entry.new\r\n entryEmail.set_width_chars 45\r\n entryEmail.set_text \"\"\r\n btGenerate = Gtk::Button.new \"Generate\"\r\n btGenerate.signal_connect \"clicked\" do\r\n if pathFile == \"\" or pathCreate == \"\"\r\n showMessage(\"Debe seleccionar el archivo de origen\",Gtk::MessageDialog::ERROR,self)\r\n elsif entryDB.text.strip == \"\"\r\n showMessage(\"Debe Ingresar el nombre de la base de datos\",Gtk::MessageDialog::ERROR,self)\r\n elsif entryDBServer.text.strip == \"\"\r\n showMessage(\"Debe Ingresar el servidor de la base de datos\",Gtk::MessageDialog::ERROR,self)\r\n elsif entryDBUser.text.strip == \"\"\r\n showMessage(\"Debe Ingresar el nombre de usuario de la base de datos\",Gtk::MessageDialog::ERROR,self)\r\n elsif entryEmail.text.strip == \"\"\r\n showMessage(\"Debe Ingresar el email del administrador\",Gtk::MessageDialog::ERROR,self)\r\n else\r\n readPollFileXml(pathFile,pathCreate,entryDB.text.strip, entryDBServer.text.strip,entryDBUser.text.strip,entryDBPass.text.strip,entryEmail.text.strip)\r\n showMessage(\"Se ha creado el formulario Satisfactoriamente en la ruta: \"+pathCreate,Gtk::MessageDialog::INFO,self)\r\n Gtk.main_quit\r\n end\r\n end\r\n btCancel = Gtk::Button.new \"Cancel\"\r\n btCancel.signal_connect \"clicked\" do\r\n Gtk.main_quit\r\n end\r\n fixed.put label,10,10\r\n fixed.put labelDB,15,58\r\n fixed.put labelDBServer,15,103\r\n fixed.put labelDBUser,24,148\r\n fixed.put labelDBPass,24,193\r\n fixed.put labelEmail,30,238\r\n fixed.put button,105,10\r\n fixed.put entryDB,105,55\r\n fixed.put entryDBServer,105,100\r\n fixed.put entryDBUser,105,145\r\n fixed.put entryDBPass,105,190\r\n fixed.put entryEmail,105,235\r\n fixed.put btGenerate,145,275\r\n fixed.put btCancel,205,275\r\n end", "def show\n Frame.new.tap {|f| f.add(self) }.show\n end", "def run\n quit_on_delete!\n Gtk.main\n end", "def init_gui\n # Set Window Title Defaults and so on\n update_window_title_and_progressbar\n @window.signal_connect \"destroy\" do quit_application end\n\n # Center us for non-tiling WMs\n @window.set_window_position Gtk::Window::POS_CENTER\n @window.set_default_size(500, 600)\n\n # Keyboard Shortcuts\n init_accelerators\n\n # Setup GUI elements in order of appearance\n toolbar = init_toolbar\n\n @statusbar = Gtk::Statusbar.new\n\n @area = Gtk::DrawingArea.new\n @area.signal_connect \"expose_event\" do draw_image_to_screen end\n\n help = \"Quick Help:\\n\"\n help << \"ARROW KEYS: select answer\\n\"\n help << \"ENTER: next question\\n\"\n help << \"TOP LEFT BOX: choose if result ambiguous (e.g. 2 checkmarks)\\n\"\n help << \"BORDER COLORS: cyan = barely checked, blue = nice checkmark, purple = overfull\"\n @quickHelp = Gtk::Label.new(help)\n @quickHelp.set_wrap true\n\n # Now lets put it all together\n vbox = Gtk::VBox.new false\n vbox.pack_start toolbar, false\n vbox.pack_start @area, true, true, 1\n vbox.pack_start @quickHelp, false, false, 2\n vbox.pack_start @statusbar, false\n @window.add vbox\n\n # All done. Let's display it.\n @window.show_all\n\n while (Gtk.events_pending?)\n Gtk.main_iteration\n end\n\n # try to find failed question\n find_failed_question\n end", "def show() end", "def show() end", "def show() end", "def show\n init\n end", "def show_browse_form(p_starting_path = nil)\n\t\t\n\t\t\t# If available as argument, select the path within the Tree View\n\t\t\t@dir_browse_ui.select_path(p_starting_path) unless p_starting_path.nil?\n\t\t\n\t\t\t# Show Browse form\n\t\t\t@dir_browse_form.show\n\t\t\t@dir_browse_form.activateWindow\t\t\n\t\tend", "def show\n @showing = true\n window.show\n end", "def show_all\n\t\[email protected]_all\n\tend", "def showEvent(p_event)\n\t\t\n\t\t\t# Only initialize form once, reuse state afterwards\n\t\t\tunless @initialized\n\t\t\t\t@initialized = true\n\t\t\t\t\n\t\t\t\tcreate_path_edit\n\t\t\t\tcreate_shell_tree_view\n\t\t\tend\n\t\t\t\n\t\tend", "def make_dialog_and_display\n dialog = JDialog.new(nil, @title)\n dialog.setLayout(BorderLayout.new)\n\n @center_panel = Box.create_vertical_box\n dialog.add(@center_panel, BorderLayout::CENTER)\n\n add_ok_cancel(dialog)\n \n GadgetFactory.add_gadget_list(@center_panel, '', @gadgets, @data_get_hash, @data_put_hash)\n\n @mgr = DialogDefaultsManager.new(dialog, @name, @defaults, @data_get_hash, @data_put_hash)\n dialog.add(@mgr, BorderLayout::NORTH) if @name\n\n @mgr.initialize_dialog\n \n dialog.set_modality_type(Java::java.awt.Dialog::ModalityType::APPLICATION_MODAL)\n dialog.pack\n dialog.set_location_relative_to(@parent_win)\n dialog.visible = true\n end", "def show\n page = ShowBlock.new(self).run(&Proc.new)\n finish_show(page)\n end", "def initialize\n self.lock = Mutex.new\n super\n \n set_title \"RubeChat\"\n \n signal_connect \"destroy\" do \n Gtk.main_quit \n end\n \n init_ui\n \n set_default_size 500, 500\n set_window_position Gtk::Window::POS_CENTER\n \n show_all\n end", "def show\n self.visible = true\n end", "def show\n @dialog.show\n end", "def show\n\t\t end", "def initialize(parent)\n @gtkObject = Gtk::Box.new :vertical\n @gtkObject.set_name 'test'\n\t\t@cb = Gtk::ComboBoxText.new\n @cb.append_text 'Général'\n @cb.append_text 'Contre La Montre'\n @cb.append_text 'Mode Facile'\n @cb.append_text 'Mode Moyen'\n @cb.append_text 'Mode Difficile'\n\t\[email protected](@cb)\n\t\tstore = Gtk::ListStore.new(String, Integer)\n\t\ttreeview = Gtk::TreeView.new(store)\n\t\tsetup_tree_view(treeview)\n\t\tdata = desereliseJoueurs\n\n\t\t\tif(data != nil)\n\t\t\t\tdata.each_with_index do |e, i|\n\t\t \t \t\titer = store.append\n\t\t \t\t\tstore.set_value(iter, 0, data[i].donneNom)\n\t\t \t\t\tstore.set_value(iter, 1, data[i].donneScore)\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\n\t\t\tboxTree = Gtk::Box.new(:vertical, 10)\n\t\t\tboxTree.border_width = 10\n\t\t\[email protected]_start(boxTree,:expand => true, :fill => true, :padding => 0)\n\n\t\t\tscrolled_win = Gtk::ScrolledWindow.new\n\t\t\tscrolled_win.add_with_viewport(treeview)\n\t\t\tscrolled_win.set_policy(:automatic,:automatic)\n\t\t\tboxTree.pack_start(scrolled_win,:expand => true, :fill => true, :padding => 0)\n\n\t\t\tseparator = Gtk::Separator.new(:horizontal)\n\t\t\[email protected]_start(separator, :expand => false, :fill => true, :padding => 0)\n\t\t\tseparator.show\n\n\n\t\t\tbRetour = MenuItemUi.new(:back,MenuAssets.getInstance())\n\t\t\tbRetour.setOnClickEvent(Proc.new{\n\t\t\t\tparent.changeBackground(\"menuPrincipal\")\n\t\t\t\tparent.display(parent.mainMenu)\n\t\t\t})\n\t\t\[email protected](bRetour.gtkObject)\n\t\t\t\n\t\t\tif(data != nil)\n\t\t\t\[email protected]_connect \"changed\" do |w, z|\n\t\t \t\t\tselectn(w,z,data,store)\n\t\t\t\tend\n\t\t\tend\n\tend", "def show!\n visible(true)\n end", "def show!\n visible(true)\n end", "def initialize(path_or_data, root = nil, domain = nil, localedir = nil, flag = GladeXML::FILE)\n bindtextdomain(domain, localedir, nil, \"UTF-8\")\n @glade = GladeXML.new(path_or_data, root, domain, localedir, flag) {|handler| method(handler)}\n \n #Filters used on the choosers widgets\n @filter = Gtk::FileFilter.new\n @filter.name = 'Supported Files'\n @filter.add_pattern('*.in')\n @filter.add_pattern('*.rtf')\n @filter.add_pattern('*.xml')\n @filter.add_pattern('*.txt')\n\n @mainWindow = self\n\n #array with the texts\n @texts = []\n @scrolls = []\n @number_of_texts = 0\n\n # Manage the project\n @project = Project.new\n\n #Tag Manager\n @tagManager = TagManager.new\n \n #Manage the table and texts\n @main_table = @glade.get_widget('mainTable')\n\n #Manage the tree view\n @treeView = TreeV.new @project, @mainWindow\n @glade.get_widget('mainDiv').pack_start @treeView.view, false, false, 0\n @glade.get_widget('mainDiv').reorder_child @treeView.view, 0\n @glade.get_widget('mainDiv').show_all\n end", "def show\n @visible = true\n self\n end", "def initialize(app)\n super()\n @app = app\n\n self.set_size_request(200, 250)\n self.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC)\n\n # Get all components\n @groups = Group.new\n all = ObjectSpace.each_object(Class).select { |k| k < Circuits::Component }\n all.each do |klass|\n next if klass.name.nil?\n names = klass.name.split('::')\n names.shift\n add_to_group(@groups, names, klass)\n end\n\n # The tree view to display everything\n @treeview = Gtk::TreeView.new\n\n # Set up renderer and tree column (we only need 1)\n renderer = Gtk::CellRendererText.new\n column = Gtk::TreeViewColumn.new(\"Component\", renderer)\n column.set_cell_data_func(renderer) do |col, renderer, model, iter|\n renderer.text = iter[0].name\n end\n\n @treeview.append_column(column)\n\n @model = Gtk::TreeStore.new(ListItem)\n\n # Add the components to the model\n add_group(@groups, @model, nil)\n\n @treeview.model = @model\n\n # Add tree view\n self.add(@treeview)\n\n @callbacks = []\n\n # Function to change selection when user clicks on component name\n last = nil\n @treeview.signal_connect('cursor-changed') do |tree, e|\n selection = tree.selection\n iter = selection.selected\n next unless iter\n if iter[0].component == NilClass\n selection.unselect_iter(iter)\n selection.select_iter(last) if last\n else\n last = iter\n @selected = iter[0].component\n @callbacks.each { |cb| cb.call(@selected) }\n #puts \"Selected: #{@selected}\"\n end\n end\n end", "def gtk_window\n @gtk_main_window\n end", "def show \r\n end", "def gestionBarreMenu()\n\t\tFenetre::boutonMenu_barre.signal_connect('clicked'){\n\t\t\tmessageQuestion = Fenetre::creerPopup(\"1/2: Voulez-vous vraiment abandonner la partie et revenir au menu principal ?\", \"YES_NO\")\n\t\t if(messageQuestion.run() == Gtk::ResponseType::YES)\n\t\t \tmessageQuestion2 = Fenetre::creerPopup(\"2/2: Voulez-vous sauvegarder la partie actuelle?\", \"YES_NO\")\n\t\t \tif(messageQuestion2.run() == Gtk::ResponseType::YES)\n\t\t \t\tsauvegarder()\n\t\t \tend\n\n\t\t \tHeader.profil(@pseudo)\n\t\t \tCore::changeTo(\"Menu\", \"pseudo\": @pseudo)\n\t\t \tmessageQuestion2.destroy()\n\t\t end\n\t\t messageQuestion.destroy()\n\t\t}\n\t\tFenetre::boutonSauvegarder_barre.signal_connect('clicked'){\n\t\t\tsauvegarder()\n\t\t}\n\t\tFenetre::boutonReinit_barre.signal_connect('clicked'){\n\t\t\t# Réinitialise la grille (données)\n\t\t\[email protected]\n\t\t\t## Réinitialise la grille (affichage)\n\t\t\tself.reinitialiser\n\t\t\[email protected]\n\t\t}\n\t\tFenetre::boutonQuitter_barre.signal_connect('clicked'){\n\t\t\tmessageQuestion = Fenetre::creerPopup(\"1/2: Voulez-vous vraiment abandonner la partie et quitter l'application?\", \"YES_NO\")\n\n\t\t if(messageQuestion.run() == Gtk::ResponseType::YES)\n\t\t \tmessageQuestion2 = Fenetre::creerPopup(\"2/2: Voulez-vous sauvegarder la partie actuelle?\", \"YES_NO\")\n\t\t \tif(messageQuestion2.run() == Gtk::ResponseType::YES)\n\t\t \t\tsauvegarder()\n\t\t \tend\n\t\t \tFenetre::detruire()\n\t\t \tmessageQuestion2.destroy()\n\n\t\t end\n\t\t messageQuestion.destroy()\n\t\t}\n\t\tFenetre::boutonPauseChrono_barre.signal_connect('clicked'){\n\t\t\tHeader::pause = true\n\n\t\t}\n\t\tFenetre::boutonPlayChrono_barre.signal_connect('clicked'){\n\t\t\tif(Header::pause == true)\n\t\t\t\tHeader::pause = false\n\t\t\t\tHeader::chrono\n\t\t\tend\n\t\t}\n\t\t\n\t\tFenetre::boutonAnnuler_barre.signal_connect('clicked'){\n\t\t}\n\t\tFenetre::boutonRetablir_barre.signal_connect('clicked'){\n\t\t}\n\t\t#disabled\n\t\tFenetre::boutonAnnuler_barre.set_sensitive(false)\n\t\tFenetre::boutonRetablir_barre.set_sensitive(false)\n\tend", "def initialize\n super()\n self.name=\"WindowPrincipale\"\n self.move(0,0)\n\n self.fullscreen()\n\n self.set_default_size(Gdk::Screen::width < 3000 ? Gdk::Screen::width : Gdk::Screen::width/2,Gdk::Screen::height)\n self.set_resizable(false)\n self.set_title(\"Jeu Hashi\")\n self.window_position=Gtk::WindowPosition::CENTER\n\n css=Gtk::CssProvider.new\n css.load(path: \"#{$cheminRacineHashi}/src/Interface/css/style.css\")\n #inversez les commentaires pour\n #css.load(path: \"/home/hashiwokakero/Hashi/Interface/css/style.css\")\n Gtk::StyleContext::add_provider_for_screen(Gdk::Screen.default,css,\n Gtk::StyleProvider::PRIORITY_APPLICATION)\n\n self.signal_connect('destroy') {\n Gtk.main_quit\n }\n\n self.add(FenetreMenu.new(self))\n\n\n self.show_all\n Gtk.main\n end", "def show ; end", "def init_vars\n @hbox = Gtk::HBox.new\n @mode_vbox = Gtk::VBox.new\n @idiom_vbox = Gtk::VBox.new\n @geral_vbox = Gtk::VBox.new\n @new_btn = Gtk::Button.new('')\n @quit_btn = Gtk::Button.new('')\n self.resizable = false\n self.modal = true\n @mode_rdo = []\n (0..4).each{|i|\n @mode_rdo[i] = OptionsRadioButton.new(@mode_rdo[0])\n }\n @mode_rdo[0].selected = true\n @idiom_rdo = []\n (0..2).each{|i|\n @idiom_rdo[i] = Gtk::RadioButton.new(@idiom_rdo[0])\n }\n end", "def show!\n notify_init(app_name) or raise \"notify_init failed\"\n raw_ptr = notify_notification_new(summary, body, icon_path, nil)\n @notification = ::FFI::AutoPointer.new(raw_ptr, method(:g_object_unref))\n show\n end", "def start\n patch_shoes_app_for_gui!\n $gui_config = config # Use globals so that I have access to\n\n puts \"env: #{$environment}\"\n dev {\n event('setting config to defaults') {\n $gui_config.load_configuration DefaultConfig\n }\n }\n\n puts (Shoes.methods.sort - Object.methods).inspect\n puts Shoes.constants.sort.inspect\n puts (Shoes::Dialog.methods.sort - Object.methods).inspect\n puts Shoes::Dialog.constants.sort.inspect\n puts Shoes::Dialog::CONFIG_PATH\n puts (Shoes::Title.methods.sort - Object.methods).inspect\n puts Shoes::Title.constants.sort.inspect\n\n Shoes.app($gui_config.app) {\n flow($gui_config.main_flow) {\n stack($gui_config.main_stack) {\n caption 'Barcode Identification Terminal'\n\n flow($gui_config.id_field_box) {\n inscription 'ID #: '\n self.id_field = edit_line($gui_config.id_field) { editline_changed }\n self.load_indicator = inscription('')\n }\n\n flow($gui_config.response_box) {\n stack($gui_config.person_details_box) {\n flow{\n inscription('Name:')\n self.person_name = inscription ''\n }\n }\n image 'gui/shoes/action_check.png', :width => 60, :height => 60\n# image 'gui/shoes/action_delete.png', :width => 60, :height => 60\n }\n\n flow($gui_config.note_box_box) {\n inscription('Bulletin Messages:')\n self.note_box = edit_box($gui_config.note_box)\n self.note_box.text = 'Invalid ID'\n }\n }\n }\n self.name = 'test'\n puts (self.methods.sort - Object.methods).inspect\n focus_on_edit_line # TODO: not working\n }\n\n dev { event('saving gui config') { $gui_config.save } }\n end", "def profile_management_dialog\n dialog = Dumon::GtkProfileDlg.new\n dialog.show\n end", "def set_form form\n raise \"Form is nil in set_form\" if form.nil?\n @form = form\n @id = form.add_widget(self) if !form.nil? and form.respond_to? :add_widget\n # 2009-10-29 15:04 use form.window, unless buffer created\n # should not use form.window so explicitly everywhere.\n # added 2009-12-27 20:05 BUFFERED in case child object needs a form.\n # We don;t wish to overwrite the graphic object\n if @graphic.nil?\n #$log.debug \" setting graphic to form window for #{self.class}, #{form} \"\n @graphic = form.window unless form.nil? # use screen for writing, not buffer\n end\n # execute those actions delayed due to absence of form -- used internally \n # mostly by buttons and labels to bind hotkey to form\n fire_handler(:FORM_ATTACHED, self) if event? :FORM_ATTACHED\n end", "def initialize()\n screen=Gdk::Screen.default\n\t\t#Variable pour resize le texte\n\t\t@pad=screen.height*0.03\n\t\t@police=screen.height*0.02\n win = Gtk::Window.new\n\t\tw=screen.width\n\t\th=screen.height\n win.set_default_size(w/4,h/10)\n win.set_resizable(false)\n\t\twin.window_position= :center_always\n\n\t\t@menu=Gtk::Box.new(:vertical, 25)\n\t\t@gtkObject= Gtk::Table.new(3,3)\n\t\[email protected](@menu,1,2,1,2)\n\n\t\t@buffer = GdkPixbuf::Pixbuf.new(file: File.dirname(__FILE__) + \"/../../../../Assets/Backgrounds/nature.jpg\")\n\t\t@[email protected](w/4,h/10+100)\n\n pb = Text.new(\"Login not found \\n OR \\nwrong password\",@police)\n\t\tpb.colorChange(\"red\")\n @menu.pack_start(pb.gtkObject,expand: false, fill: true, padding: @pad)\n\t\[email protected](Gtk::Image.new(pixbuf: @buffer),0,3,0,3)\n\t\twin.add(@gtkObject)\n\t\twin.show_all\n\n end", "def maker\n show \n end", "def start(start_window)\n gtk_window.show_all\n start_window.start\n Gtk.main_with_queue\n end", "def connect_signals\n @glade['drawingarea'].signal_connect('expose_event') { print }\n @glade['eventbox'].events = Gdk::Event::BUTTON_PRESS_MASK\n @glade['eventbox'].signal_connect('button_press_event') {|w, e| add_point(Point[e.x.to_i, e.y.to_i])}\n @glade['mainwindow'].signal_connect('destroy'){Gtk.main_quit} \n end", "def show; @showing = false; end", "def init_vars\n @msg = Gtk::Label.new('')\n self.resizable = false\n self.modal = true \n self.window_position = Gtk::Window::POS_MOUSE \n end", "def initialize(parent)\n\t\t@assets = MenuAssets.getInstance\n\t\t@gtkObject = Gtk::Box.new :vertical\n\n\t\tmodel = Gtk::ListStore.new(String)\n\n\t\t@treeview = Gtk::TreeView.new(model)\n\t\tsetup_tree_view(@treeview)\n\n\t\tsave = Sauvegardes.new(\"./Game/Core/Saves/\",\"*.yml\")\n\n\t\tdata = save.chargerRepertoire\n\n\t\t# swapped = true\n\t\t# while swapped do\n\t\t# \tswapped = false\n\t\t# \t0.upto(data.size-2) do |i|\n\t\t# \t\tif (Date.parse(data[i].split(\"&\")[2][0...10]) <=> Date.parse(data[i].split(\"&\")[2][0...10]))<0\n\t\t# \t\t\tdata[i], data[i+1] = data[i+1], data[i]\n\t\t# \t\t\tswapped = true\n\t\t# \t\tend\n\t\t# \tend\n\t\t# end\n\n\t\tdata = data.sort{|n, m|\n\t\t\tn.split(\"&\").last <=> m.split(\"&\").last\n\t\t}.reverse\n\n\n\n\t\tdata.each_with_index do |v|\n\t\t iter = model.append\n\t\t model.set_value(iter, 0, v)\n\t\tend\n\n\t\tbox2 = Gtk::Box.new(:vertical, 10)\n\t\tbox2.border_width = 10\n\t\[email protected]_start(box2, :expand => true, :fill => true, :padding => 0)\n\n\t\tscrolled_win = Gtk::ScrolledWindow.new\n\t\tscrolled_win.add_with_viewport(@treeview)\n\t\tscrolled_win.set_policy(:automatic,:automatic)\n\t\tbox2.pack_start(scrolled_win,:expand => true, :fill => true, :padding => 0)\n\n\n\t\t# box2 = Gtk::Box.new :horizontal\n\t\t# box2.border_width = 10\n\n\t\tbox2 = Gtk::ButtonBox.new :horizontal\n\t\tbox2.layout = :center\n\n\t\tbLoad = MenuItemUi.new(:load, @assets)\n\t\tbLoad.setOnClickEvent(Proc.new{\n\t\t\titer = @treeview.selection.selected\n\t\t\tif(iter != nil)\n\t\t\t\tindex = save.getIndex(model.get_value(iter,0)) #recuperation index\n\t\t\t\tinfos = save.getInfos(index)\n\t\t\t\tparent.changeBackground(\"ecranDeJeu\")\n\t\t\t\tif infos[0] == \"Ranked\"\n\t\t\t\t\tparent.display(RankedMode.new(nil,parent,infos.join(\"&\")))\n\t\t\t\telsif infos[0] == \"TimeTrial\"\n\t\t\t\t\tpath = File.dirname(__FILE__) + \"/../Game/Core/Saves/\"+infos.join(\"&\")\n\t\t\t\t\tdata = YAML.load_file(path)\n\t\t\t\t\tnbGrids = data[\"nbGames\"]\n\t\t\t\t\tdifficulty = :easy\n\t\t\t\t\tif nbGrids > 5\n\t\t\t\t\t\tdifficulty = :intermediate\n\t\t\t\t\telsif nbGrids > 10\n\t\t\t\t\t\tdifficulty = :hard\n\t\t\t\t\tend\n\t\t\t\t\tparent.display(TimeTrialMode.new(parent,infos.join(\"&\"),difficulty,nbGrids ))\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tdialog = Gtk::Dialog.new(\"Message\",$main_application_window,Gtk::DialogFlags::DESTROY_WITH_PARENT,[ Gtk::Stock::OK, Gtk::ResponseType::NONE ])\n\t\t\t\tdialog.signal_connect('response') { dialog.close }\n\t\t\t\t\tif @assets.language == \"FR_fr\"\n\t\t\t\t\t\tdialog.child.add(Gtk::Label.new(\"\\n\\n\\t Veuillez selectionner une sauvegarde à charger.\\t\\n\\n\"))\n\t\t\t\t\telse\n\t\t\t\t\t\tdialog.child.add(Gtk::Label.new(\"\\n\\n\\t Please select a save file to load.\\t\\n\\n\"))\n\t\t\t\t\tend\n\t\t\t\tdialog.show_all\n\t\t\tend\n\t\t})\n\n\t\tbox2.add(bLoad.gtkObject)\n\n\t\tbDelete = MenuItemUi.new(:delete, @assets)\n\t\tbDelete.setOnClickEvent(Proc.new{\n\t\t iter = @treeview.selection.selected\n\n\t\tif(iter != nil)\n\t\t index = save.getIndex(model.get_value(iter,0))#recuperation index\n\t\t save.supprimer(index)\n\t\t model.remove(iter)\n\t\telse\n\t\tdialog = Gtk::Dialog.new(\"Message\",$main_application_window,Gtk::DialogFlags::DESTROY_WITH_PARENT,[ Gtk::Stock::OK, Gtk::ResponseType::NONE ])\n\t\tdialog.signal_connect('response') { dialog.close }\n\t\t\tif @assets.language == \"FR_fr\"\n\t\t\t\tdialog.child.add(Gtk::Label.new(\"\\n\\n\\t Veuillez selectionner une sauvegarde à supprimer.\\t\\n\\n\"))\n\t\t\telse\n\t\t\t\tdialog.child.add(Gtk::Label.new(\"\\n\\n\\t Please select a save file to delete.\\t\\n\\n\"))\n\t\t\tend\n\t\tdialog.show_all\n\t\tend\n\n\n\n\n\t\t})\n\t\tbox2.add(bDelete.gtkObject)\n\n\t\t# @gtkObject.pack_start(box2, :expand => false, :fill => true, :padding => 0)\n\t\t# box2 = Gtk::Box.new(:vertical, 10)\n\t\t# box2.border_width = 10\n\t\t# @gtkObject.pack_start(box2, :expand => false, :fill => true, :padding => 0)\n\n\t\tbRetour = MenuItemUi.new(:back,@assets)\n\t\tbRetour.setOnClickEvent(Proc.new{\n\t\t\tparent.changeBackground(\"menuPrincipal\")\n\t\t\tparent.display(parent.mainMenu)\n\t\t})\n\t\tbox2.add(bRetour.gtkObject)\n\t\[email protected]_start(box2, :expand => false, :fill => true, :padding => 0)\n\tend", "def start\n display = Swt::Widgets::Display.get_current\n \n # until the window (the Shell) has been closed\n while [email protected]\n # check for and dispatch new gui events\n display.sleep unless display.read_and_dispatch\n end\n display.dispose\n end", "def start\n display = ::Swt::Widgets::Display.get_current\n \n # until the window (the Shell) has been closed\n while [email protected]\n # check for and dispatch new gui events\n display.sleep unless display.read_and_dispatch\n end\n \n display.dispose\n end", "def show()\n @view__.show\n self\n end", "def initialize(utilisateur)\r\n\tGtk.init\r\n\t\t\r\n\t@fenetreOuvrirDoc = Window.new()\r\n\[email protected]_title(\"Selection du Document\")\r\n\[email protected] = true\r\n\[email protected]_position= Gtk::Window::POS_CENTER\n\[email protected]_connect('destroy') do\r\n\t\tGtk.main_quit()\r\n\tend\r\n\t\r\n\t#taille de la fenetre\r\n\[email protected]_default_size(500,300)\r\n\r\n\tframe = Frame.new()\r\n\t#VBox Container\r\n\tvBoxContainer = VBox.new(false, 3)\r\n\r\n\tdocs = recupererDocs(utilisateur)\r\n\t\r\n\t#liste des documents : nom de l'auteur, nom du document\r\n\tlisteDocuments = ListStore.new(String, String)\r\n\r\n\tdocs.each do |titre, numEtAuteur|\r\n\t\tnumEtAuteur.each do |num, auteur|\r\n\t\t\telement = listeDocuments.append()\r\n\t\t\telement[0] = auteur\n\t\t\telement[1] = titre\r\n\t\tend\r\n\tend\n\r\n\t#zone de recherche:\r\n\thBoxHaut = HBox.new(false, 2)\r\n\t#label recherche:\r\n\tlabelRecherche = Label.new(\"Rechercher :\")\r\n\t#champ de recherche:\r\n\tchampRecherche = Entry.new()\r\n\t#ajout de l'outil de completion de la recherche:\r\n\tcompletion = EntryCompletion.new()\r\n\tcompletion.model = listeDocuments\n\tcompletion.text_column = 1\n\tchampRecherche.completion = completion\r\n\t\r\n\r\n\thBoxHaut.add(labelRecherche)\r\n\thBoxHaut.add(champRecherche)\r\n\r\n\t# Un TreeView pour visualiser les données de la liste\r\n\tviewListe = TreeView.new(listeDocuments)\r\n\tviewListe.selection.mode = SELECTION_SINGLE\r\n\t\r\n\t#colonne Auteur\r\n\t#mode affichage\r\n\trenderer = CellRendererText.new\r\n\t#le rendu doit être éditable\r\n\trenderer.set_editable(true)\r\n\t# Ajout d'uhe colonne utilisant ce rendu\r\n col = TreeViewColumn.new(\"Auteur\", renderer, :text => 0)\r\n\t#permet de trier par auteur\r\n\tcol.set_sort_column_id(0)\r\n\tcol.sizing = TreeViewColumn::FIXED\r\n\tcol.fixed_width = 150\r\n\tviewListe.append_column(col)\r\n\t\r\n\t#colonne Titre\r\n\t#mode d'affichage\r\n\trenderer = CellRendererText.new\r\n\t# On utilise Pango pour obtenir le gras\r\n renderer.weight = Pango::FontDescription::WEIGHT_BOLD\r\n # Ajout d'une colonne utilisant ce rendu\r\n col = TreeViewColumn.new(\"Titre\", renderer, :text => 1)\r\n\t#permet de trier par titre\r\n\tcol.set_sort_column_id(1)\r\n\tcol.sizing = TreeViewColumn::FIXED\r\n\tcol.fixed_width = 250\r\n\tviewListe.append_column(col)\r\n\t\r\n\t#on autorise la recherche sur la seconde colonne\r\n\tviewListe.set_search_column(1)\r\n\r\n\r\n\t#zone des boutons\r\n\thBoxBas = HBox.new(false,2)\r\n\t#conteneur des boutons\r\n\tbuttonBox = HButtonBox.new()\r\n\tbuttonBox.set_border_width(5)\r\n\t#bouton annuler:\r\n\tbtnAnnuler = Button.new(Stock::CANCEL)\r\n\t#action du bouton Annuler\r\n\tbtnAnnuler.signal_connect('clicked') do \r\n\t\[email protected]()\r\n\tend\r\n\tbuttonBox.add(btnAnnuler)\r\n\r\n\r\n\t#bouton OK\r\n\tbtnOk = Button.new(Stock::OPEN)\r\n\tbuttonBox.add(btnOk)\r\n\tbtnOk.signal_connect('clicked') do\r\n\t\tactionOK(viewListe, champRecherche, docs)\r\n\tend\r\n\thBoxBas.add(buttonBox)\r\n\t\r\n\t#vBoxContainer.add(selection)\r\n\tvBoxContainer.add(hBoxHaut)\r\n\t#scrollbar pour le treeview\r\n\tscrollwindow = ScrolledWindow.new(nil,nil)\r\n\t#on adapte la taille de cette zone en fonction de la taille de la fenetre\r\n\tscrollwindow.set_size_request(@fenetreOuvrirDoc.size()[0], @fenetreOuvrirDoc.size()[1])\r\n\tscrollwindow.resize_mode=(RESIZE_IMMEDIATE)#marche pôôô !devrait resizer en fonction de la fenetre!!#####################\r\n\tvBoxContainer.add(scrollwindow)\r\n scrollwindow.set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC)\r\n\tscrollwindow.add(viewListe)\r\n\tvBoxContainer.add(hBoxBas)\r\n\tframe.add(vBoxContainer)\r\n\[email protected](frame)\r\n\[email protected]_all()\r\n\t\r\n\tGtk.main\r\n\tend", "def start\n display = Swt::Widgets::Display.get_current\n \n # until the window (the Shell) has been closed\n while [email protected]\n \n # check for and dispatch new gui events\n display.sleep unless display.read_and_dispatch\n end\n\n display.dispose\n end", "def start\n display = Swt::Widgets::Display.get_current\n \n # until the window (the Shell) has been closed\n while [email protected]\n \n # check for and dispatch new gui events\n display.sleep unless display.read_and_dispatch\n end\n\n display.dispose\n end", "def create_browse_form\n\t\n\t\t\t# Create child form if not present\n\t\t\tif @dir_browse_form.nil?\n\t\t\t\n\t\t\t\t# Call GUI Utility Method to handle child form creation\n\t\t\t\tresult = GuiUtils.create_child_form({\n\t\t\t\t\t:class => Ui_DirBrowseForm,\n\t\t\t\t\t:flags => Qt::Tool | Qt::MSWindowsFixedSizeDialogHint, #| Qt::WindowTitleHint | Qt::CustomizeWindowHint, # << no close button\n\t\t\t\t\t:base_widget => CustomFontWidget.new(self),\n\t\t\t\t\t:show => false\n\t\t\t\t})\n\n\t\t\t\t# Center the newly created form relative to the parent form\n\t\t\t\t@dir_browse_form = result[:form]\n\t\t\t\tGuiUtils.center_relative_to({\n :widget => @dir_browse_form,\n :parent => @parent\n })\n\n\t\t\t\t# Set closed callbacks for the actual form and its dummy form\n\t\t\t\tui = result[:ui]\n\t\t\t\thandler = lambda { dir_browse_closed }\n\t\t\t\tui.closed_callback = handler\n\t\t\t\t@dir_browse_ui = ui.extension\n\t\t\t\t@dir_browse_ui.closed_callback = handler\n\t\t\tend\t\n\t\n\t\tend", "def show_window\n\t\tif self.visible?\n\t\t\tself.bring_to_front\n\t\telse\n\t\t\t# We use set_file here to prevent Macs loading the whole dialog when the\n\t\t\t# plugin loads. No need to populate the dialog and use extra resources\n\t\t\t# if it will never be used.\n\t\t\tfilepath = File.join(PATH, 'webdialog/ui_manager.html')\n\t\t\tself.set_file(filepath)\n\t\t\tif PLUGIN.is_mac?\n\t\t\t\tself.show_modal\n\t\t\telse\n\t\t\t\tself.show\n\t\t\tend\n\t\tend\n\tend", "def form; end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def display_form(evt)\n set_record evt[:id], evt[:pid]\n render :text => update(\"##{dom_id}_form\", form_content_options(evt[:pid])),\n :layout => 'form_reveal.js.erb',\n :locals => {:form_selector => \"#{dom_id}_form\"}\n end", "def build_ui(file_name)\n gtk_builder_add_from_file(@builder, file_name, FFI::MemoryPointer::NULL)\n connect_signals\n end", "def aide1()\n indice = IndiceFaible.create(@map)\n dialog = Gtk::Dialog.new(\"Aide1\",\n $main_application_window,\n Gtk::DialogFlags::DESTROY_WITH_PARENT,\n [ Gtk::Stock::OK, Gtk::ResponseType::NONE ])\n\n # Ensure that the dialog box is destroyed when the user responds.\n dialog.signal_connect('response') { dialog.destroy }\n\n # Add the message in a label, and show everything we've added to the dialog.\n dialog.child.add(Gtk::Label.new(indice.envoyerIndice.indice))\n dialog.show_all\n @timer.add(15)\n\n end", "def show_import_form\n end", "def init_window\n\n @window = Gtk::Window.new\n\n @window.border_width = 10\n @window.resizable = false\n\n @window.signal_connect(\"delete_event\") do\n puts; puts; puts \"delete event occurred\"\n false\n end\n\n @window.signal_connect(\"key_press_event\") do |w, e|\n\n key = Gdk::Keyval.to_name(e.keyval)\n\n masks = get_key_masks e\n\n case\n when (masks[:ctrl] and not masks[:shift])\n case key\n when \"space\"\n handle_input Calculator::KEY_SPACE\n when \"p\", \"P\"\n handle_input Calculator::KEY_PI\n end\n\n end\n\n\n end\n\n @window.add_accel_group(@accelerator_group)\n\n @window.signal_connect(\"destroy\") do\n puts \"destroy event occurred\"\n Gtk.main_quit\n end\n\n generate_structure @structure, @window\n\n init_screen @structure[:screen][:element]\n init_history @structure[:history][:element]\n\n end", "def show\n puts \"******* show *******\"\n end", "def show\n $gimp_iface.gimp_display_new(@imageID)\n end", "def in_vbox\n @vbox.pack_start(@cantidad, false,false,0)\n @vbox.pack_start(@guardar, false, false, 0)\n @vbox.pack_start(@buscar_alias, false, false, 0)\n @vbox.pack_start(@seguir, false, false, 0)\n end", "def run\n repaint\n @form.pack # needs window\n @form.repaint\n @form.select_first_field ## otherwise on_enter of first won't fire\n @window.wrefresh\n return handle_keys\n end", "def show!\n bind_set_draw_attention(true)\n show\n end", "def forms; end", "def show_window\n end", "def set_windows\n set_title \"R-Bloggyn::#{@usuario.alias}\" #nombre de la ventana\n set_default_size 640, 480 #tamaño de la ventana\n set_skip_taskbar_hint true\n set_window_position Gtk::Window::POS_CENTER #posicion de la ventana\n self.set_attributes\n add @hbox\n show_all #muestra todo\n end", "def gestionBarreMenu()\n\t\tFenetre::boutonMenu_barre.signal_connect('clicked'){\n\t\t\tmessageQuestion = Fenetre::creerPopup(\"Voulez-vous vraiment abandonner l'apprentissage et revenir au menu principal?\", \"YES_NO\")\n\t\t if(messageQuestion.run() == Gtk::ResponseType::YES)\n\t\t \tCore::changeTo(\"Menu\", \"pseudo\": @pseudo)\n\t\t end\n\t\t messageQuestion.destroy()\n\t\t}\n\t\tFenetre::boutonSauvegarder_barre.signal_connect('clicked'){\n\t\t}\n\t\tFenetre::boutonReinit_barre.signal_connect('clicked'){\n\t\t}\n\t\tFenetre::boutonQuitter_barre.signal_connect('clicked'){\n\t\t\tmessageQuestion = Fenetre::creerPopup(\"Voulez-vous vraiment abandonner l'apprentissage et quitter l'application?\", \"YES_NO\")\n\t\t if(messageQuestion.run() == Gtk::ResponseType::YES)\n\t\t \tFenetre::detruire()\n\t\t end\n\t\t messageQuestion.destroy()\n\t\t}\n\t\tFenetre::boutonPauseChrono_barre.signal_connect('clicked'){\n\t\t\tHeader::pause = true\n\t\t}\n\t\tFenetre::boutonPlayChrono_barre.signal_connect('clicked'){\n\t\t\tHeader::pause = false\n\t\t}\n\t\tFenetre::boutonAnnuler_barre.signal_connect('clicked'){\n\t\t}\n\t\tFenetre::boutonRetablir_barre.signal_connect('clicked'){\n\t\t}\n\n\t\t#disabled\n\t\tFenetre::boutonSauvegarder_barre.set_sensitive(false)\n\t\tFenetre::boutonReinit_barre.set_sensitive(false)\n\t\tFenetre::boutonAnnuler_barre.set_sensitive(false)\n\t\tFenetre::boutonRetablir_barre.set_sensitive(false)\n\tend", "def present()\n LVGUI::Native.lv_disp_load_scr(@screen.lv_obj_pointer)\n reset_focus_group\n\n # Allow the window to do some work every time it is switched to.\n on_present\n end", "def show\n \t\n end", "def show\n \t\n end", "def initialize(win)\n\n # init des composants\n\n @win = win\n @map = \"../Grilles/grille_chapitre1.txt\"\n @boite = Gtk::Fixed.new()\n @container = Gtk::Box.new(:vertical)\n\n retourMenu = Gtk::Button.new(:label => \"\")\n nouvellePartie = Gtk::Button.new(:label => \"\")\n reprendre = Gtk::Button.new(:label => \"\")\n defilerChapitres = Gtk::Button.new(:label => \"\")\n\n # Création tableau de boutons\n\n btnChapitre = [\n Gtk::Button.new(),\n Gtk::Button.new(),\n Gtk::Button.new(),\n Gtk::Button.new(),\n Gtk::Button.new()\n ]\n\n # Création tableau de labels\n\n lblChapitre = [\n Gtk::Label.new(\"\"),\n Gtk::Label.new(\"\"),\n Gtk::Label.new(\"\"),\n Gtk::Label.new(\"\"),\n Gtk::Label.new(\"\")\n ]\n\n # Chargement background\n\n @boite.add(Gtk::Image.new(:file => \"../maquettes/menu-libre.png\"))\n @container.add(@boite)\n \n # Ajout des composants du menu\n\n ajouteBouton(@boite, nouvellePartie, 2, 420, 40, 310, 620, method(:nouvellePartie_VersJeu), nil, nil)\n ajouteBouton(@boite, reprendre, 2, 265, 40, 790, 620, method(:vers_jeu), nil, nil)\n\n # Création css texte labels\n cssChapitre = ajouteTexte(3)\n\n # Ajout des boutons dans la sidebar\n\n addChapitre(btnChapitre[0], lblChapitre[0], 13, 20, cssChapitre)\n addChapitre(btnChapitre[1], lblChapitre[1], 13, 155, cssChapitre)\n addChapitre(btnChapitre[2], lblChapitre[2], 13, 285, cssChapitre)\n addChapitre(btnChapitre[3], lblChapitre[3], 13, 420, cssChapitre)\n addChapitre(btnChapitre[4], lblChapitre[4], 13, 550, cssChapitre)\n\n # Ajout boutons retour vers menu et défiler chapitres\n\n ajouteBouton(@boite, defilerChapitres, 2, 45, 45, 230, 620, method(:actualiserChapitres), lblChapitre, nil)\n ajouteBouton(@boite, retourMenu, 2, 60, 60, 20, 5, method(:vers_menu), @win, @container)\n\n # Ajoute label pour chrono des grilles sauvegardées\n\n @chronoLabel = Gtk::Label.new(\"\")\n ajouteTexteProvider(@chronoLabel, cssChapitre)\n @boite.put(@chronoLabel, 1050, 70)\n\n\n\n\n @win.add(@container)\n\n # Chargement de la grille 1\n # Regarde si une sauvegarde existe, si oui, la charge, sinon, nouvelle partie\n\n if (Grille_jeu_charger.exist?(@map, 'Libre'))\n @grille = Grille_jeu_charger.creer(false, Array.new, @map, nil, 'Libre')\n @chronoLabel.label = @grille.getChrono()\n else\n @grille = Grille_jeu.creer(false, nil, @map)\n @chronoLabel.label = \"0' 0''\"\n end\n @boite.put(@grille.grille, ($widthEcran *0.37), $heightEcran * 0.16)\n\n # Charge les chapitres\n\n file = File.open(\"chapitres.txt\")\n lignes = file.readlines\n @nbLignes = lignes.size\n @file_data = lignes.map(&:chomp)\n\n file.close\n\n @i_chap = 0\n\n # Placement des bons labels de chapitres\n actualiserChapitres(lblChapitre)\n\n @win.show_all\n Gtk.main\n\n return self\n end", "def show\n #THE FORM FOR THE NEW ORDER IS ON THE SHOW PAGE OF THE BOOK\n @order = Order.new()\n end", "def load_user_interface()\n\t# locate the enclosing folder and get the bricks file within it\n\tfolder = File.dirname( $0 )\n\tgui_path = File.join( folder, \"gui.bricks\" )\n\turl = Java::File.new( gui_path ).toURI.toURL\n\t\n\t# generate a window reference resource and pass the desired constructor arguments\n\twindow_reference = WindowReference::getDefaultInstance( url, \"MainWindow\" )\n\t\n\tmain_controller = ControlApp.new window_reference\n\tmain_controller.displayWindow\nend", "def load_user_interface()\n\t# locate the enclosing folder and get the bricks file within it\n\tfolder = File.dirname( $0 )\n\tgui_path = File.join( folder, \"gui.bricks\" )\n\turl = Java::File.new( gui_path ).toURI.toURL\n\t\n\t# generate a window reference resource and pass the desired constructor arguments\n\twindow_reference = WindowReference::getDefaultInstance( url, \"MainWindow\" )\n\t\n\tmain_controller = ControlApp.new window_reference\n\tmain_controller.displayWindow\nend", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end", "def show; end" ]
[ "0.70793504", "0.6656819", "0.63367146", "0.62562424", "0.60327923", "0.6025181", "0.6019112", "0.59034467", "0.58893543", "0.58858246", "0.58802235", "0.5813053", "0.57941264", "0.57941264", "0.57941264", "0.5781111", "0.57742643", "0.57420754", "0.5701015", "0.56994724", "0.56603426", "0.5615961", "0.55933064", "0.55909425", "0.55263734", "0.55003273", "0.548388", "0.5480399", "0.5480399", "0.5471078", "0.54459333", "0.54422694", "0.54325765", "0.5411386", "0.5396449", "0.53918105", "0.53827685", "0.53707486", "0.5368827", "0.5354966", "0.53535783", "0.5352717", "0.5328179", "0.53178567", "0.5312136", "0.52965504", "0.52927077", "0.5283786", "0.5268681", "0.5263666", "0.52591515", "0.5253903", "0.52412987", "0.5240112", "0.52391315", "0.52385104", "0.52309674", "0.5215287", "0.5214854", "0.5214854", "0.5214854", "0.5214854", "0.5214854", "0.5214854", "0.5214854", "0.5214854", "0.5214854", "0.5196708", "0.51849294", "0.5184606", "0.5184224", "0.5176085", "0.51669824", "0.5165658", "0.51530284", "0.513958", "0.51068133", "0.51046604", "0.50971764", "0.5093672", "0.5086739", "0.5080388", "0.5076159", "0.5076159", "0.50726944", "0.50626945", "0.5062417", "0.5062417", "0.5059707", "0.5059707", "0.5059593", "0.5058963", "0.5058963", "0.5058963", "0.5058963", "0.5058963", "0.5058963", "0.5058963", "0.5058963", "0.5058963" ]
0.7682451
0
Convenience method so you can just make a button named "buttonCancel" and it will work. This method isn't called in code, its triggered by a user clicking a button named "buttonCancel".
def buttonCancel__clicked(*a) @builder[:window1].destroy end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancel\n begin\n $results.log_action(\"button(#{@params[0]})\")\n # Cancel button can be either a link or an actual button object\n begin\n if @driver.find_element(:id, \"lnk-cancel\").displayed?\n @driver.find_element(:id, \"lnk-cancel\").click\n $results.success\n end\n rescue\n if @driver.find_element(:id, \"btn-cancel\").displayed?\n @driver.find_element(:id, \"btn-cancel\").click\n $results.success\n end\n end\n rescue => ex\n $results.fail(\"button(#{@params[0..-1].join(' ')})\", ex)\n end\n end", "def cancel_button\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.button.className(create_ats_regex_string(\"ats-cancelbtn\")), format_method(__method__))\n end", "def remove_cancel_button\n\t\t$tracer.trace(format_method(__method__))\n\t\treturn ToolTag.new(@tag.find.button.className(create_ats_regex_string(\"ats-cancelbtn\")), format_method(__method__))\n\tend", "def cancel_button(destination_path)\n @template.link_to I18n.t('form.cancel'), destination_path,\n class: \"btn btn-default\"\n end", "def remove_button(and_confirm_cancel = nil)\n $tracer.trace(format_method(__method__))\n and_confirm_cancel == :and_confirm_cancel ? @spec.record.confirm.cancel : @spec.record.confirm.ok\n return ToolTag.new(@tag.find.input.id(\"/RemoveButton$/\"), format_method(__method__))\n end", "def remove_button(and_confirm_cancel = nil)\n $tracer.trace(format_method(__method__))\n and_confirm_cancel == :and_confirm_cancel ? @spec.record.confirm.cancel : @spec.record.confirm.ok\n return ToolTag.new(@tag.find.input.id(\"/RemoveButton$/\"), format_method(__method__))\n end", "def edit_cancel_button\n # unit_test_no_generate: edit_cancel_button, a.className(create_ats_regex_string(\"ats-editcancelbtn\"))\n $tracer.trace(__method__)\n return ToolTag.new(a.className(create_ats_regex_string(\"ats-editcancelbtn\")), __method__)\n end", "def subject_cancel\n self.cancel_button.click\n end", "def cancel_button_clicked\n\t\t\t@path = nil\n\t\t\tclose_and_cleanup\n\t\tend", "def click_cancel_js_popup(title)\n click_button_popup(title, \"Cancel\")\nend", "def delete_cancel_button(**opt)\n opt[:action] ||= :delete\n cancel_button(**opt)\n end", "def store_finder_cancel_button\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.button.className(create_ats_regex_string(\"ats-cancelbtn\")), format_method(__method__))\n end", "def cancel_button(feedback)\n return \"\" unless feedback\n caption = \"<i class=\\\"icon-arrow-left\\\"></i> #{t('.cancel')}\"\n button = link_to article_path(feedback.article_id), class: \"btn\" do\n raw caption\n end\n button\n end", "def cancel_btn(path=root_path, options={})\n btn_class = 'btn btn-warning'\n btn_class << ' ' << options[:class] if options[:class].present?\n\n link_to t('btn.cancel'), path, class: btn_class\n end", "def cancel_link\n $tracer.trace(format_method(__method__))\n return ToolTag.new(a.id(\"/btnClose$/\"), format_method(__method__))\n end", "def click_cancel_file_dialog_popup(title)\n click_button_popup(title, \"Cancel\")\nend", "def cancel_btn(path = root_path, options = {})\n btn_class = ['btn btn-warning waves-effect waves-light']\n btn_class << options[:class] if options[:class].present?\n\n link_to t('btn.cancel'), path, class: btn_class.join(' ')\n end", "def is_cancel?(action_name)\n action_name == 'submit_cancel'\n end", "def cancel\n case\n when @browser.div(:id=>\"accountpreferences_preferContainer\").visible?\n @browser.div(:id=>\"accountpreferences_preferContainer\").button(:class=>\"s3d-link-button s3d-bold accountpreferences_cancel\").click\n when @browser.div(:id=>\"accountpreferences_changePrivacyContainer\").visible?\n @browser.div(:id=>\"accountpreferences_changePrivacyContainer\").button(:class=>\"s3d-link-button s3d-bold accountpreferences_cancel\").click\n when @browser.div(:id=>\"accountpreferences_changePassContainer\").visible?\n @browser.div(:id=>\"accountpreferences_changePassContainer\").button(:class=>\"s3d-link-button s3d-bold accountpreferences_cancel\").click\n else\n puts \"\\nCouldn't find the cancel button!\\n\"\n end\n end", "def cancel_link\n $tracer.trace(format_method(__method__))\n return ToolTag.new(a.id(\"/CancelLinkButton$/\"), format_method(__method__), @spec)\n end", "def cancel_button(project:, deploy:, **options)\n raise if !project || !deploy\n link_to(\n 'Cancel',\n [project, deploy, {redirect_to: request.fullpath}],\n options.merge(method: :delete, class: options.fetch(:class, 'btn btn-danger btn-xl'))\n )\n end", "def cancel_shipment_button\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.input.className(create_ats_regex_string(\"ats-cancelshipmntbtn\")), format_method(__method__))\n end", "def reset_button?(button_name); end", "def cancel\n # Define this later\n end", "def clicked\n @cancel.clicked\n end", "def new_site_cancel\n inactive_submit.click\n end", "def clicked\n # @cancel.clicked\n end", "def cancel\n end", "def cancel\n end", "def cancel\n @confirmation_header = \"confirm cancellation\"\n @confirmation_body = \"Are you Sure to cancel this subscription?\"\n @cancel = \"No, Thank you\"\n @submit = \"Confirm cancellation\"\n end", "def cancel_button_form options\n label = options[:label] ? options[:label] : \"Cancelar\"\n url = options[:url] ? options[:url] : \"#\"\n myclass = options[:class] ? \"btn-action btn-cancel #{options[:class]}\" : \"btn-action btn-cancel\"\n link = options[:fancybox] ? link_to_function(label, \"$.fancybox.close()\") : link_to(label, url)\n \"<li><div class='#{myclass}'>#{link}</div></li>\".html_safe\n end", "def cancel\n # TODO: That thing I'm claiming to do in the comments\n super\n end", "def submit_or_cancel(form, name='Cancel')\n form.submit + ' or ' + link_to(name, 'javascript:history.go(-1);', :class => 'cancel')\n end", "def cancel_tag(url, options = {})\n link_to((tag :input, { \"type\" => \"button\", \"value\" => \"Cancel\"}.update(options.stringify_keys)), url, :style => \"text-decoration: none;\")\n end", "def click_cancel_saveas_popup(title, save_file_path)\n click_button_saveas_or_openas_popup(title, save_file_path, \"Cancel\")\nend", "def cancel\n redirect_to( default_path ) if params[:commit] == 'cancel'\n end", "def cancel(path, edit_path = nil, options ={})\n options[:class] ||= ''\n options[:class] << \"btn btn-default\"\n options[:data] = { confirm: \"Cancel without saving?\"}\n\n if edit_path && object.persisted?\n path = edit_path\n end\n @template.link_to('Cancel', path, options)\n end", "def check_for_cancel\n if params[:commit] == t('dri.views.objects.buttons.cancel')\n if params[:id]\n redirect_to controller: 'my_collections', action: 'show', id: params[:id]\n else\n redirect_to controller: 'workspace', action: 'index'\n end\n end\n end", "def check_for_cancel\n if params[:commit] == t('dri.views.objects.buttons.cancel')\n if params[:id]\n redirect_to controller: 'my_collections', action: 'show', id: params[:id]\n else\n redirect_to controller: 'workspace', action: 'index'\n end\n end\n end", "def check_for_cancel\n return unless params[:commit] == t( :cancel )\n back( notice: 'Alterações descartadas.' )\n end", "def cancel_form handle_form_text \n click_to_handle_form handle_form_text\n cancel_form_alert_ok \n end", "def add_ok_cancel(parent)\n panel = JPanel.new\n panel.border = LineBorder.createBlackLineBorder\n @result = nil\n # \n # OK button.\n ok = JButton.new(\"OK\")\n ok.add_action_listener do |e|\n @result = 1\n parent.set_visible(false)\n end\n panel.add(ok)\n \n # \n # Cancel button.\n cancel = JButton.new(\"Cancel\")\n cancel.add_action_listener do |e|\n @result = 0\n parent.set_visible(false)\n end\n panel.add(cancel)\n # \n # Help button, but just for things with a name.\n if @name\n help = JButton.new(\"Help\")\n help.tool_tip_text = 'View or edit the setup instructions.'\n help.add_action_listener do |e|\n UserIO.show_help(@name, panel)\n end\n panel.add(help)\n end\n #\n # Always On Top checkbox\n ontop = JCheckBox.new('Keep on top', true)\n ontop.tool_tip_text = 'Keep this dialog always on top.'\n frame = SwingUtilities.getWindowAncestor(parent)\n frame.always_on_top = true\n ontop.add_item_listener do |event|\n frame.always_on_top = (event.get_state_change == ItemEvent::SELECTED)\n end\n panel.add(ontop)\n\n parent.add(panel, BorderLayout::SOUTH)\n parent.get_root_pane.set_default_button(ok)\n end", "def cancel\n frm.button(:value=>\"Cancel\", :index=>-1).click\n AssignmentsList.new(@browser)\n end", "def check_for_cancel\n if params[:commit] == \"Cancel\"\n redirect_to forms_path\n end\n end", "def submit_or_cancel(form, name='Cancel')\n form.submit + \" or \" +\n link_to(name, root_path, :class => \"for_black_font_link\")\n #link_to(name, 'javascript:history.go(-1);', :class => 'cancel')\n end", "def remove_submit_button\n\t\t$tracer.trace(format_method(__method__))\n\t\treturn ToolTag.new(@tag.find.button.className(create_ats_regex_string(\"ats-submitbtn\")), format_method(__method__))\n\tend", "def click_cancel_openas_popup(title, open_file_path)\n click_button_saveas_or_openas_popup(title, open_file_path, \"Cancel\")\nend", "def inline_cancel_button(class_extras = 'pull-right')\n \"<a class=\\\"show-entity show-#{hyphenated_name} #{class_extras} glyphicon glyphicon-remove-sign dropup\\\"\n title=\\\"cancel\\\"\n data-target=\\\"[data-subscription='#{hyphenated_name}-edit-form--#{@container.id}']\\\"\n data-toggle=\\\"clear-content\\\"></a>\".html_safe\n end", "def cancel_btn\n\t\ttouch(\"* id:'action_bar_up_navigation'\")\n\t\twait_for_animate_3sec\n\t\t#wait_for_elements_exist(\"* id:'PopoverDismissRegion'\")\n\t\t# touch \"* id:'PopoverDismissRegion'\"\n\tend", "def cancel\r\n # @todo Emit a warning for attempts to cancel an action after it's been\r\n # executed\r\n @cancelled = true\r\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n super\n end", "def cancel\n self.update_status :cancelled\n end", "def cancel\n frm.button(:value=>\"Cancel\").click\n AssignmentsList.new(@browser)\n end", "def cancel\n frm.button(:value=>\"Cancel\").click\n AssignmentsList.new(@browser)\n end", "def cancel\n frm.button(:value=>\"Cancel\").click\n AssignmentsList.new(@browser)\n end", "def click_cancel_new_note_modal\n logger.debug 'Clicking the new note Cancel button'\n wait_for_update_and_click new_note_modal_cancel_button_element\n end", "def cancel\n set_params\n show_translation\n end", "def cancel\n super\nend", "def cancel\n super\n end", "def cancel?\n self.type == :cancel\n end", "def button_for(f, action, label)\n content_tag(\n :div,\n content_tag(\n :div,\n primary_button_for(f, action, label) +\n content_tag(:span, ' ') +\n cancel_button,\n class: \"#{OFFSET_CLASS} #{FIELD_WIDTH_CLASS}\"\n ),\n class: 'form-group'\n )\n end", "def cancel\n @service.context.post(@control_path, :action => 'cancel')\n self\n end", "def cancel()\n require_relative 'message'\n Message.new(@api, @api.do_request(\"POST\", get_base_api_path() + \"/cancel\"))\n end", "def cancel()\n require_relative 'message'\n Message.new(@api, @api.do_request(\"POST\", get_base_api_path() + \"/cancel\"))\n end", "def cancel\n super\n end", "def cancel_frame\n end", "def cancel_enabled?; handle?(:cancel); end", "def command_cancel\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Switch to menu screen\r\n $scene = Scene_Menu.new(5)\r\n end", "def cancel(*args)\n commit('cancel', *args)\n end", "def cancel element\n element.perform :cancel\n end", "def cancel!; end", "def cancel; end", "def cancel; end", "def click_cancel_note_edit\n logger.debug 'Clicking the edit note Cancel button'\n wait_for_update_and_click edit_note_cancel_button_element\n end", "def call_cancel_handler; call_handler(:cancel); end", "def cancel\n flash[:notice] = \"Canceling accounts is not enabled.\"\n redirect_to root_path\n end", "def cancel\n @error = :cancelled\n end", "def on_cancel &b\n @cancel_proc = b\n self\n end", "def remove_button\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@remove_button, format_method(__method__))\n end", "def create_remove_button\n\t\t\n\t\t\t# Get dummy-stored button texts\n\t\t\tnormal_text = @form.removeButtonPlaceholder.toolTip\n\t\t\twarn_text = @form.removeButtonPlaceholder.statusTip\n\t\t\t\n\t\t\t# Retrieve normal icon\n\t\t\tnormal_icon = Qt::Icon.new do |new_icon|\n\t\t\t\tnew_icon.addPixmap(Qt::Pixmap.new(\":/root/images/folder/folder--minus.png\"), Qt::Icon::Normal, Qt::Icon::Off)\n\t\t\tend\n\t\t\t\n\t\t\t# Retrieve warn icon\n\t\t\twarn_icon = Qt::Icon.new do |new_icon|\n\t\t\t\tnew_icon.addPixmap(Qt::Pixmap.new(\":/root/images/notify/exclamation--frame.png\"), Qt::Icon::Normal, Qt::Icon::Off)\n\t\t\tend\t\t\t\n\t\t\n\t\t\t# Create actual button and customize\n\t\t\t@remove_button = ConfirmationSeekingPushButton.new(warn_icon, warn_text, @form, lambda { check_to_remove_row } ) do |button|\n\t\t\t\tbutton.enabled = false\n\t\t\t\tbutton.setMinimumSize(@form.removeButtonPlaceholder.minimumSize)\n\t\t\t\tbutton.text = normal_text\n\t\t\t\tbutton.icon = normal_icon\n\t\t\t\t\n\t\t\t\tGuiUtils.replace_grid_widget({\n\t\t\t\t\t:grid => @form.gridLayout, \n\t\t\t\t\t:old_widget => @form.removeButtonPlaceholder,\n\t\t\t\t\t:new_widget => button,\n\t\t\t\t\t:row => 3, :col => 2\n\t\t\t\t})\n\t\t\tend\n\t\t\t\n\t\t\t# Connect clicked signal for the remove button\n\t\t\tQt::Object.connect(@remove_button, SIGNAL('clicked()'), self, SLOT('remove_button_clicked()'))\n\t\tend", "def link_to_cancel(url)\n link_to_remote(\"Cancel\", :url => url, :method => :get, :with => \"{ cancel: true }\")\n end", "def cancel?\n name.downcase == 'touchcancel'\n end", "def on_btn_Cancel_clicked(widget)\n @db.close unless @db.nil?\n Gtk.main_quit\n end", "def cancel\n super\n end" ]
[ "0.7872163", "0.7753562", "0.7496165", "0.72539634", "0.718454", "0.718454", "0.71736026", "0.7044793", "0.6860197", "0.684876", "0.6822248", "0.68041956", "0.6782086", "0.667918", "0.66676617", "0.6661764", "0.66390043", "0.66170925", "0.6561873", "0.65547854", "0.64691406", "0.6420743", "0.6409757", "0.6402672", "0.6374808", "0.63555044", "0.6346689", "0.63305014", "0.63305014", "0.6320535", "0.6301272", "0.6265151", "0.62465143", "0.6215646", "0.62070286", "0.62052023", "0.619068", "0.6167941", "0.6167941", "0.61557925", "0.61387604", "0.611941", "0.61016786", "0.60926634", "0.60799366", "0.6060505", "0.6056499", "0.6056305", "0.60468924", "0.5994627", "0.5991554", "0.5991554", "0.5991554", "0.5991554", "0.5991554", "0.5991554", "0.5991554", "0.5991554", "0.5991554", "0.5991554", "0.5991554", "0.5991554", "0.5991554", "0.5991554", "0.5991554", "0.5991554", "0.5991554", "0.5979461", "0.59748363", "0.59748363", "0.59748363", "0.5955477", "0.5952878", "0.5947926", "0.59450203", "0.59415406", "0.5938493", "0.5931021", "0.5927127", "0.5927127", "0.5923492", "0.59199554", "0.5902325", "0.58982134", "0.5893593", "0.5887626", "0.58828366", "0.5871638", "0.5871638", "0.5865436", "0.58576566", "0.5856179", "0.58404994", "0.5837903", "0.5828882", "0.58251643", "0.58211994", "0.5795838", "0.57906497", "0.57900685" ]
0.71641266
7
retrieves the key inside a glade control name. Useful when handling events where the control name is returned, and you need to match it to an actual hash.
def extract_key(widget) widget.builder_name.scan(/\[(.+?)\]/).flatten[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key_name\n data[:key_name]\n end", "def key\n name.underscore.tr('/', '_').to_sym\n end", "def key\n @key ||= name.to_s\n end", "def getKey; argSetTextual.to_sym end", "def key\n (key_name || name).to_sym\n end", "def key\n params.k\n end", "def key\n @key.id2name\n end", "def keyname(key)\n\t\t@keynames[key]\n\tend", "def key\n self.class.name.split(/::/).last.underscore\n end", "def key\n key = self.name\n key = Economic::Support::String.demodulize(key)\n key = Economic::Support::String.underscore(key)\n key.intern\n end", "def get_key(line)\n line.match(/-k ([^ ]+)/)[1]\n end", "def getKey; @args.map { |a| a.to_s }.join(':').to_sym end", "def handle_key key\n key\n end", "def key\n name = self.class.name.split(\"::\").last\n Util.underscore(name).to_sym\n end", "def get_key(name)\n return data_bag_item('rndc_keys', name).to_hash if node['dhcp']['use_bags']\n node['dhcp']['rndc_keys'].fetch name, ''\n end", "def get key\n deserialize backend.get key.to_s rescue nil\n end", "def key_symbol\n @key\n end", "def key\n \"#{@@PREFIX}#{@name.gsub(\" \",\"-\")}\"\n end", "def etcd_key\n self.class.etcd_schema.path_with_keys do |sym|\n self.instance_variable_get(\"@#{sym}\")\n end\n end", "def read_key; end", "def get_field(key)\n @form_fields.getField key.to_s\n end", "def get key; call key; end", "def get_key record\n record\n end", "def key\n attributes[:key]\n end", "def key_field\n 'key'\n end", "def key\n @key\n end", "def key\n @key\n end", "def get_key\n os = $driver.capabilities.platform.to_s.upcase\n if os.to_s == 'WINDOWS' || os.to_s == 'LINUX'\n return 'control'\n elsif os.to_s == 'DARWIN'\n return 'command'\n else\n raise 'Invalid OS'\n end\nend", "def key\n @attributes[:key]\n end", "def key\n @attributes[:key]\n end", "def get_key_name(name)\n key_id = GameKeys[name.downcase]\n return GameKeys[0] unless key_id\n key_value = Input::Keys[key_id][0]\n return \"J#{-(key_value + 1) / 32 + 1}K#{(-key_value - 1) % 32}\" if key_value < 0\n keybd = Input::Keyboard\n keybd.constants.each do |key_name|\n return key_name.to_s if keybd.const_get(key_name) == key_value\n end\n return GameKeys[0]\n end", "def key\n @key\n end", "def key\n @key\n end", "def vash_key_name(*args); 'option name'; end", "def key_for(entry)\n entry\n end", "def key\n return @key\n end", "def key\n return @key\n end", "def field key\n @fields.get key\n end", "def key_from_path(path)\n path.basename.to_s.split('.', 2).first.to_sym\n end", "def []( key )\n\t\t@form[ key.to_s ]\n\tend", "def get_k( key )\n HTMapHelper.get_map( self, key )\n end", "def hash_key(name); end", "def key1\n self.key('key1')\n end", "def key\n `return #{self}.__key__ || #{nil};`\n end", "def registry_key(key)\n key = key.to_s.tr('_', '')\n @@registry.keys.detect do |ref|\n ref = ref.downcase\n snake_parts = ref.split('::')\n until(snake_parts.empty?)\n break if snake_parts.join('') == key\n snake_parts.shift\n end\n !snake_parts.empty?\n end\n end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def name_key\n return base_key + \".name\"\n end", "def key_name\n \"#{prefix}:#{@id}\"\n end", "def keyName _args\n \"keyName _args;\" \n end", "def i18n_key\n return 'forms.unknown' unless @filing.form_name.present?\n key = \"forms.#{@filing.form_name.delete(' ')}\"\n return 'forms.unknown' unless I18n.exists?(key)\n\n key\n end", "def key\n \"#{Goalkeeper.namespace}:#{label}\"\n end", "def first_key_name(hash_name)\n return hash_name.keys[0]\n end", "def key_for(name)\n return name unless name.is_a?(String)\n if name =~ /\\A\\d+i(\\.js)?\\z/\n name.to_i\n else\n name.sub(/((\\.(f|i|b))?\\.js|\\.html|\\.array)\\z/, \"\")\n end\n end", "def key\n \"#{@type}{#{@title}}]\"\n end", "def key\n instance_variables\n .collect { |variable| instance_variable_get(variable) }\n .join\n end", "def handle_key(key); end", "def control_id\n \"#{rel.name}_ctl\"\n end", "def key\n self.keys.first\n end", "def keyName\n e = inherited_from || entity\n \"#{e.model.name}#{e.name}#{name.capitalize_first}\"\n end", "def get_container_key(control_name, parent_name)\n container_key = OpenStruct.new\n container_key.container = nil\n container_key.map_key = nil\n container_key.modal_or_applet = nil\n container_key.control_name = control_name\n\n parsed_name = parse_parent_name(parent_name)\n\n container_key.container = get_container(parsed_name.parent_name)\n\n container_key.modal_or_applet = parsed_name.modal_or_applet.nil? ? parsed_name.parent_name : parsed_name.modal_or_applet\n\n container_key.map_key = \"#{container_key.modal_or_applet} - #{control_name}\"\n return container_key\nend", "def key\n self.class.item_name\n end", "def extract_key(ctx); end", "def key_for(resource_name)\n [prefix, resource_name].join\n end", "def key \n path\n end", "def key\n self.class._key\n end", "def key\n model.extract_key(path)\n end", "def lens_key\n Blacklight::Lens.key_for(controller_name, false)\n end", "def hash_key(key)\n key.downcase\n end", "def key\n attributes['key'] or raise NoKeySpecified\n end", "def get_key_from_command(argv)\n case argv[0].to_s.downcase\n when \"info\",\"multi\",\"exec\",\"slaveof\",\"config\",\"shutdown\",\"select\"\n nil\n else\n # Unknown commands, and all the commands having the key\n # as first argument are handled here:\n # set, get, ...\n argv[1]\n end\n end", "def opt\n @key\n end", "def get_info(key)\n @namehash[key.to_sym][1]\n end", "def get key\n\t\t@data_base[ key ]\n\tend", "def retrieve key\n\t\tnode = traverse @root, key\n\t\tnode.key\n\tend", "def hash_key\n send(self.class.hash_key)\n end", "def hash_key\n send(self.class.hash_key)\n end", "def key_template\n @key_template ||= [*name.downcase.split(\"::\"), \"%<id>d\"].join(\":\")\n end", "def key\n key = config[:key] || flags.last.sub(/\\A--?/, '')\n key = key.tr '-', '_' if underscore_flags?\n key.to_sym\n end", "def key\n @key ||= case options.case\n when :lower_camel\n base_key.camelize(:lower)\n when :upper_camel\n base_key.camelize(:upper)\n when :snake\n base_key.underscore\n end\n end", "def base_key\n\t\tself.split('.')[0]\n\tend", "def key\n @key or raise MissingKey\n end" ]
[ "0.67622155", "0.6629844", "0.65193367", "0.65151405", "0.6442582", "0.64163435", "0.63802165", "0.6370469", "0.6329291", "0.6323531", "0.62756974", "0.62183565", "0.62044007", "0.6140959", "0.61196", "0.61159825", "0.61043817", "0.60978633", "0.60894966", "0.6087803", "0.60841143", "0.6082165", "0.6077803", "0.60637075", "0.6062877", "0.6060375", "0.6060375", "0.6037401", "0.6010409", "0.6010409", "0.60068023", "0.5995056", "0.5995056", "0.5993611", "0.598137", "0.5980951", "0.5980951", "0.5976415", "0.5975728", "0.5962852", "0.5933972", "0.5920296", "0.5899269", "0.588412", "0.58804005", "0.5822621", "0.5822621", "0.5822621", "0.5822621", "0.5822621", "0.5822621", "0.5822621", "0.5822621", "0.5822621", "0.5822621", "0.5822621", "0.5822621", "0.5822621", "0.5822621", "0.5822621", "0.5822621", "0.5822621", "0.5822621", "0.5822621", "0.5822621", "0.5802856", "0.57945794", "0.5791233", "0.57881784", "0.57808375", "0.5773461", "0.57663304", "0.57613367", "0.5755381", "0.57415414", "0.57391", "0.57262385", "0.5721569", "0.57214767", "0.57150537", "0.569291", "0.56921935", "0.56892675", "0.567841", "0.5675065", "0.5673583", "0.56667733", "0.56665003", "0.5661367", "0.5660309", "0.5651901", "0.56418926", "0.5640464", "0.5631208", "0.5631208", "0.5629018", "0.5620511", "0.56183046", "0.5602898", "0.5587125" ]
0.69389087
0
Populates the glade form from the fields of an ActiveRecord object. So instead of having to assign each widget a value:
def set_glade_active_record(obj = self) return if not defined? obj.attributes obj.attributes.each_pair { |key, val| fill_control(class_name(obj) + "." + key, val) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dynamic_form_fields(builder)\n # Allow dynamic fields in our Project to be processed by form_for\n create_virtual_attributes!\n\n @object.fields.each do |field|\n h.haml_concat process_field(builder, field)\n end\n end", "def fill_in_form(fields)\n fields.each do |field, value|\n f = send(\"#{field}_field\")\n f.set(value) || Array(value).each { |val| f.select(val) }\n end\n end", "def populate_fields(target,data)\n data.each{|key,value|target.text_field(:name=>key).set value}\nend", "def fill_inputs\n update(:all,'input').with do\n if element[:name] and element[:name].match(/([a-z,_]+)\\[([a-z,_]+)\\]/)\n element[:value] = send($1).send($2)\n end\n end\n update(:all,'textarea').with do\n if element[:name] and element[:name].match(/([a-z,_]+)\\[([a-z,_]+)\\]/)\n element.inner_html = send($1).send($2)\n end\n end\n end", "def layoutField(fld, idx)\r\n insert_item(idx, fld.name)\r\n set_item(idx, 1, fld.df.desc)\r\n set_item(idx, 2, fld.generator.klass_name)\r\n set_edit_attr(idx, 2, InplaceEditListCtrl::EDIT_TYPE_CHOICE, @value_types)\r\n case fld.generator\r\n when ValueTypeFixed\r\n set_item(idx, 3, fld.generator.value)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_EDIT)\r\n when ValueTypeFromConfig\r\n when ValueTypeVariableCard\r\n set_item(idx, 3, fld.generator.column)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_CHOICE, Card.columns)\r\n when ValueTypeVariableAcquirer\r\n set_item(idx, 3, fld.generator.column)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_CHOICE, Acquirer.columns)\r\n when ValueTypePreviousOutgoing\r\n set_item(idx, 3, fld.generator.field_name)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_CHOICE, @fullnameList)\r\n when ValueTypePreviousIncoming\r\n set_item(idx, 3, fld.generator.field_name)\r\n set_edit_attr(idx, 3, InplaceEditListCtrl::EDIT_TYPE_CHOICE, @fullnameList)\r\n end # end of case\r\n end", "def existing_value_inputs\n if primitive?\n # We can't use fields_for, and in fact we don't (currently) yield at all,\n # we do clever things with arrays.\n (base_model.send(attribute_name) || []).collect do |str|\n wrap_with_repeatable_ui do\n if caller_content_block.nil?\n default_primitive_input(str)\n else\n caller_content_block.call(primitive_input_name, str)\n end\n end\n end\n else\n # we use fields_for, which will repeatedly yield on repeating existing content\n form_builder.fields_for(attribute_name) do |sub_form|\n wrap_with_repeatable_ui do\n caller_content_block.call(sub_form)\n end\n end\n end\n end", "def fills_in(id_or_name_or_label, options = {})\n field = find_field(id_or_name_or_label, TextField, TextareaField, PasswordField)\n field.set(options[:with])\n end", "def set_form_variables\n @articles = CriminalCode.all.includes(:articles).with_translations\n @tags = Tag.includes(:translations).order(:name)\n @prisons = Prison.includes(:translations).order(:name)\n\n gon.select_charges = t('shared.actions.with_obj.select',\n obj: t('activerecord.models.charge', count: 999))\n gon.select_tags = t('shared.actions.with_obj.select',\n obj: t('activerecord.models.tag', count: 999)) \n end", "def type_value_fields(f)\n controls = []\n\n options_values = INGEST_MAP[f.object.group.to_sym].keys\n options = options_values.collect do |val|\n [OregonDigital::Metadata::FieldTypeLabel.for(val.to_s), val]\n end\n\n controls << f.input(\n :type,\n :collection => options,\n :input_html => {:class => \"input-medium type-selector\"},\n :label_html => {:class => \"sr-only\"},\n :wrapper_html => {:class => \"ingest-control type\"}\n )\n\n input_args = {\n :input_html => {:class => \"input-xxlarge value-field\"},\n :label_html => {:class => \"sr-only\"},\n :wrapper_html => {:class => \"ingest-control value\"}\n }\n\n # SUPER HACK! If we're looking at sets, we don't want free-text, we want a\n # drop-down. Ideally we'd have a nicer way to make any given type do this,\n # but the grouping dropdown makes it really tough without some painful new\n # configurable ingest map format combined with JavaScript that swaps a\n # dropdown over the text input magically\n if f.object.group.to_sym == :collection\n set_pids = ActiveFedora::SolrService.query(\n \"has_model_ssim:#{RSolr.escape(\"info:fedora/afmodel:GenericCollection\")}\",\n :rows => 100000\n )\n prefix = \"http://oregondigital.org/resource\"\n set_options = set_pids.map do |pid|\n set = GenericCollection.load_instance_from_solr(pid[\"id\"], pid)\n [\"#{set.title} (#{set.pid})\", \"#{prefix}/#{set.pid}\"]\n end\n\n input_args[:collection] = set_options.sort\n selected = f.object.value\n if selected.nil? || !selected.start_with?(prefix)\n selected = f.object.internal\n end\n input_args[:selected] = selected\n input_args[:include_blank] = true\n end\n\n controls << f.input(:value, input_args)\n\n if f.object.cloneable?\n controls << f.input(\n :clone,\n :as => :boolean,\n :input_html => {:class => \"input-xxlarge clone-field\"},\n :label_html => {:class => \"sr-only\"},\n :wrapper_html => {:class => \"ingest-control clone\"},\n :label => \"Clone this #{f.object.group}\"\n )\n end\n\n # Super hack, continued: don't put an internal field on the form for sets\n if f.object.group.to_sym != :collection\n controls << f.hidden_field(:internal, :class => \"internal-field\")\n end\n\n return controls.reduce { |list, next_control| list << next_control }\n end", "def populate(attributes)\n attributes.each do |attribute, value|\n id = id_for(attribute)\n\n case control_type_for(id)\n when :file\n attach_file id, value\n when :select\n find_by_id(id).find(\"option[value='#{value}']\").select_option\n when :checkbox\n find_by_id(id).set(value)\n else\n fill_in id, :with => value\n end\n end\n end", "def fill_all_form_data()\n if verbose_messages\n p @fillable_form_fields\n p @current_page_data_object\n end\n\n @fillable_form_fields.each do |field|\n value = @current_page_data_object.retrieve_data_for(field)\n enter_element_value(field, value) if value and (value != \"nil\")\n end\n end", "def initialize_fields_entities!\n @entity = SimpleAdmin::Entity.find_by(model_klass_name: model_klass.to_s)\n @entity_fields = @entity.entity_fields.where(presentation: field_presentation)\n end", "def default_fields_for_forms\n [\n { :name => :le_title__get_full_name, :field_label => I18n.t(:le_title, {:scope=>[:activerecord, :models]}),\n # [20121121] For the combo-boxes to have a working query after the 4th char is entered in the edit widget,\n # a lambda statement must be used. Using a pre-computed scope from the Model class prevents Netzke\n # (as of this version) to append the correct WHERE clause to the scope itself (with an inline lambda, instead, it works).\n :scope => lambda { |rel| rel.order(\"name ASC\") }\n },\n { :name => :name, :field_label => I18n.t(:name) },\n { :name => :surname, :field_label => I18n.t(:surname) },\n { :name => :le_contact_type__get_full_name, :field_label => I18n.t(:le_contact_type, {:scope=>[:activerecord, :models]}),\n # [20121121] See note above for the sorted combo boxes.\n :scope => lambda { |rel| rel.order(\"name ASC\") }\n },\n { :name => :is_suspended, :field_label => I18n.t(:is_suspended),\n :default_value => false, :unchecked_value => 'false',\n :field_style => 'min-height: 13px; padding-left: 13px;'\n },\n { :name => :address, :field_label => I18n.t(:address) },\n { :name => :le_city__get_full_name, :field_label => I18n.t(:le_city, {:scope=>[:activerecord, :models]}),\n # [20121121] See note above for the sorted combo boxes.\n :scope => lambda { |rel| rel.order(\"name ASC, area ASC\") }\n },\n { :name => :tax_code, :field_label => I18n.t(:tax_code) },\n { :name => :vat_registration, :field_label => I18n.t(:vat_registration) },\n { :name => :date_birth, :field_label => I18n.t(:date_birth) },\n { :name => :phone_home, :field_label => I18n.t(:phone_home) },\n { :name => :phone_work, :field_label => I18n.t(:phone_work) },\n { :name => :phone_cell, :field_label => I18n.t(:phone_cell) },\n { :name => :phone_fax, :field_label => I18n.t(:phone_fax) },\n { :name => :e_mail, :field_label => I18n.t(:e_mail) },\n\n { :name => :date_last_met, :field_label => I18n.t(:date_last_met) },\n { :name => :notes, :field_label => I18n.t(:notes), :width => 200 },\n { :name => :personal_notes, :field_label => I18n.t(:personal_notes), :width => 200 },\n { :name => :family_notes, :field_label => I18n.t(:family_notes), :width => 200 }\n ]\n end", "def layout_fields\n # Everything has a tag - or it BETTER!\n # Probably should refactor this or something.\n value = @stored_values[:tag] || @object.tag\n label = Label.new(\"Tag\")\n tagInput = InputField.new(value,30)\n @attr_to_field[:tag] = tagInput\n layout_field_button(label,tagInput,\"Auto\") do\n attemptName = nil\n if @attr_to_field[:name]\n attemptName = @attr_to_field[:name].text\n end\n tagInput.text = @rl.repository.generate_tag_for(@object,attemptName)\n end\n @fieldY = tagInput.rect.bottom + @spacing \n @object.class.attrs.sort.each do | attr |\n next if attr == :tag # We did tags ourselves\n display = true\n value = @stored_values[attr] || @object.send(attr)\n label = Label.new(attr.to_s)\n rows,cols = [0,0]\n size= @object.class.size_for(attr)\n input = nil\n if size\n rows,cols = size\n if rows > 1\n input = MultiLineInput.new(value)\n input.set_size(rows,cols)\n elsif rows == 0 || cols == 0\n display = false\n else\n input = InputField.new(value, cols)\n end\n else\n input = InputField.new(value,20)\n end \n \n if display\n if rows > 1\n scroller = Scroller.new(input)\n scroller.translate_to(*input.rect.topleft)\n layout_field(label,scroller)\n else\n layout_field(label,input)\n end\n @attr_to_field[attr] = input\n end\n check_max_button(attr,input) if input\n end\n \n # Booleans\n @object.class.booleans.each do | attr |\n value = @stored_values[attr] || @object.send(attr)\n checkbox = CheckBox.new(attr.to_s,value)\n checkbox.rect.topleft = [ @fieldX, @fieldY ] \n \n @fieldY = checkbox.rect.bottom + @spacing\n \n self << checkbox\n @bool_to_field[attr] = checkbox\n end\n \n # And now for the enums!\n @object.class.enumerations.each do | attr, valid |\n value = @stored_values[attr] || @object.send(attr)\n label = Label.new(attr.to_s)\n \n size = @object.class.size_for(attr)\n label.rect.topleft = [@fieldX, @fieldY]\n rows = size || valid.size\n \n input = ListBox.new\n input.rect.w = @mainRect.w / 2 - label.rect.w - @spacing * 3\n input.rect.h = input.height(rows)\n input.items = valid\n input.chosen = value\n \n input.translate_to(label.rect.right + @spacing, @fieldY)\n \n @fieldY = input.rect.bottom + @spacing\n self << label\n self << input\n @enum_to_field[attr] = input\n \n end\n end", "def custom_fields\n if debug?\n channel_fields = ChannelFieldForm.new\n channel_fields.create_field(\n group_id: 1,\n type: 'Checkboxes',\n label: 'Checkboxes',\n fields: {\n field_list_items: \"Yes\\nNo\\nMaybe\"\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Radio Buttons',\n label: 'Radio Buttons',\n fields: {\n field_list_items: \"Left\\nCenter\\nRight\"\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Multi Select',\n label: 'Multi Select',\n fields: {\n field_list_items: \"Red\\nGreen\\nBlue\"\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Select Dropdown',\n label: 'Select Dropdown',\n fields: {\n field_list_items: \"Mac\\nWindows\\nLinux\"\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Select Dropdown',\n label: 'Prepopulated',\n fields: {\n field_pre_populate: 'y'\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Rich Text Editor',\n label: 'Rich Text Editor',\n fields: {\n field_ta_rows: 20,\n field_text_direction: 'Right to left'\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Toggle',\n label: 'Toggle'\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Text Input',\n label: 'Text Input',\n fields: {\n field_maxl: 100,\n field_fmt: 'None',\n field_show_fmt: 'y',\n field_text_direction: 'Right to left',\n field_content_type: 'Decimal',\n field_show_smileys: 'y',\n field_show_file_selector: 'y'\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'Textarea',\n label: 'Textarea',\n fields: {\n field_ta_rows: 20,\n field_fmt: 'None',\n field_show_fmt: 'y',\n field_text_direction: 'Right to left',\n field_show_formatting_btns: 'y',\n field_show_smileys: 'y',\n field_show_file_selector: 'y'\n }\n )\n channel_fields.create_field(\n group_id: 1,\n type: 'URL',\n label: 'URL Field',\n fields: {\n url_scheme_placeholder: '// (Protocol Relative URL)'\n }\n ) do |page|\n page.all('input[name=\"allowed_url_schemes[]\"]').each do |element|\n element.click unless element.checked?\n end\n end\n\n @page.load\n else\n $db.query(IO.read('channel_sets/custom-fields.sql'))\n clear_db_result\n end\n end", "def set_glade_all(obj = self) \r\n set_glade_active_record(obj)\r\n set_glade_variables(obj)\r\n end", "def initialize_fields\n terms_for_editing.each do |key|\n # if value is empty, we create an one element array to loop over for output \n self[key] = [''] if self[key].empty?\n end\n end", "def fill_form(new_values = {})\n reset!(new_values)\n dom_writer.fill(values)\n end", "def cama_form_element_bootstrap_object(form, object, values)\n html = \"\"\n object.each do |ob|\n ob[:label] = ob[:label].to_s.translate\n ob[:description] = ob[:description].to_s.translate\n r = {field: ob, form: form, template: (ob[:field_options][:template].present? ? ob[:field_options][:template] : Plugins::CamaContactForm::CamaContactForm::field_template), custom_class: (ob[:field_options][:field_class] rescue nil), custom_attrs: {id: ob[:cid] }.merge((JSON.parse(ob[:field_options][:field_attributes]) rescue {})) }\n hooks_run(\"contact_form_item_render\", r)\n ob = r[:field]\n ob[:custom_class] = r[:custom_class]\n ob[:custom_attrs] = r[:custom_attrs]\n ob[:custom_attrs][:required] = 'true' if ob[:required].present? && ob[:required].to_bool\n field_options = ob[:field_options]\n for_name = ob[:label].to_s\n f_name = \"fields[#{ob[:cid]}]\"\n cid = ob[:cid].to_sym\n\n temp2 = \"\"\n\n case ob[:field_type].to_s\n when 'paragraph','textarea'\n temp2 = \"<textarea #{ob[:custom_attrs].to_attr_format} name=\\\"#{f_name}\\\" maxlength=\\\"#{field_options[:maxlength] || 500 }\\\" class=\\\"#{ob[:custom_class].presence || 'form-control'} \\\">#{values[cid] || ob[:default_value].to_s.translate}</textarea>\"\n when 'radio'\n temp2= cama_form_select_multiple_bootstrap(ob, ob[:label], ob[:field_type],values)\n when 'checkboxes'\n temp2= cama_form_select_multiple_bootstrap(ob, ob[:label], \"checkbox\",values)\n when 'submit'\n temp2 = \"<button #{ob[:custom_attrs].to_attr_format} type=\\\"#{ob[:field_type]}\\\" name=\\\"#{f_name}\\\" class=\\\"#{ob[:custom_class].presence || 'btn btn-default'}\\\">#{ob[:label]}</button>\"\n when 'button'\n temp2 = \"<button #{ob[:custom_attrs].to_attr_format} type='button' name=\\\"#{f_name}\\\" class=\\\"#{ob[:custom_class].presence || 'btn btn-default'}\\\">#{ob[:label]}</button>\"\n when 'reset_button'\n temp2 = \"<button #{ob[:custom_attrs].to_attr_format} type='reset' name=\\\"#{f_name}\\\" class=\\\"#{ob[:custom_class].presence || 'btn btn-default'}\\\">#{ob[:label]}</button>\"\n when 'text', 'website', 'email'\n class_type = \"\"\n class_type = \"railscf-field-#{ob[:field_type]}\" if ob[:field_type]==\"website\"\n class_type = \"railscf-field-#{ob[:field_type]}\" if ob[:field_type]==\"email\"\n temp2 = \"<input #{ob[:custom_attrs].to_attr_format} type=\\\"#{ob[:field_type]}\\\" value=\\\"#{values[cid] || ob[:default_value].to_s.translate}\\\" name=\\\"#{f_name}\\\" class=\\\"#{ob[:custom_class].presence || 'form-control'} #{class_type}\\\">\"\n when 'captcha'\n if form.recaptcha_enabled?\n temp2 = recaptcha_tags\n else\n temp2 = cama_captcha_tag(5, {}, {class: \"#{ob[:custom_class].presence || 'form-control'} field-captcha required\"}.merge(ob[:custom_attrs]))\n end\n when 'file'\n temp2 = \"<input multiple=\\\"multiple\\\" type=\\\"file\\\" value=\\\"\\\" name=\\\"#{f_name}[]\\\" #{ob[:custom_attrs].to_attr_format} class=\\\"#{ob[:custom_class].presence || 'form-control'}\\\">\"\n when 'dropdown'\n temp2 = cama_form_select_multiple_bootstrap(ob, ob[:label], \"select\",values)\n else\n end\n r[:template] = r[:template].sub('[ci]', temp2)\n r[:template] = r[:template].sub('[descr ci]', field_options[:description].to_s.translate).sub('<p></p>', '')\n html += r[:template].gsub('[label ci]', for_name)\n end\n html\n end", "def setup(*)\n # Used to be in an after_add, updated for apotomo 1.2.\n self.respond_to_event :form_submitted, :from => self.name\n self.respond_to_event :revert, :from => self.name\n self.respond_to_event :display_form, :from => self.name\n\n self.where = nil\n self.dom_id = options[:dom_id]\n self.grid_options = {}\n # Guesses that you will use the resource name for the form template.\n self.form_template = options[:resource]\n # Assume that the form is not a multipart (uploader) form\n self.multipart_form = false\n # The orphan template is used when a parent record is needed but not selected\n self.orphan_template = 'orphan'\n # Ensure that we always have a record of some sort\n self.record = resource_model.new\n # Set the name of this resource for public display\n self.human_resource = options[:resource].humanize\n # Set the spokesfield to nil, this needs to be set explicitly\n self.spokesfield = nil\n \n @columns = []\n @sortable_columns = {}\n @default_sort = nil \n\n @filters = {}\n @filter_sequence = []\n @filter_default = {}\n \n @flash_widget = self.dom_id + '_flash'\n self << widget(:grid_flash, @flash_widget)\n \n if options[:form_only]\n @list_widget = nil\n @filters_widget = nil\n self.form_buttons = [\n ['remain', 'Save', 'Add'],\n ]\n else\n @list_widget = self.dom_id + '_list'\n @filters_widget = self.dom_id + '_filters'\n self << widget(:grid_list, @list_widget) do |lw|\n lw << widget(:grid_filters, @filters_widget)\n end\n \n self.form_buttons = [\n ['submit', 'Save+Close', 'Add+Close'],\n ['remain', 'Save', 'Add'],\n ['cancel', 'Cancel', 'Cancel'],\n ]\n end\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end", "def prepare_form_helpers\n if display_type == \"text_field\"\n return [\"data_fields\", id, {id: id}]\n elsif display_type == \"text_area\"\n return [\"data_fields\", id]\n elsif display_type == \"select\"\n options = values.split(',').each{|opt| opt.squish!}\n return [\"data_fields\", id, options.map{|opt| [opt, opt]}]\n elsif display_type == \"check_box\"\n options = values.split(',').each{|opt| opt.squish!}\n return options.map{|v| [\"data_fields[#{id}]\", v]}\n elsif display_type == \"radio_button\"\n options = values.split(',').each{|opt| opt.squish!}\n return options.map{|v| [\"data_fields[#{id}]\", 1, v]}\n end\n end", "def build_form(form_builder, options)\n set_value_in_hash options\n value = CckForms::ParameterTypeClass::Time::date_object_from_what_stored_in_database(options[:value])\n form_element_options, form_element_html = CckForms::ParameterTypeClass::Time.default_options_for_date_time_selectors(value, options)\n form_element_options.merge!({minute_step: 5})\n form_element_html.merge!({required: options[:required]})\n ('<div class=\"form-inline\">%s</div>' % form_builder.fields_for(:value) { |datetime_builder| datetime_builder.datetime_select '', form_element_options, form_element_html})\n end", "def form_fields\n @item_fields = @model.typus_fields_for('form')\n @item_has_many = @model.typus_relationships_for('has_many')\n @item_has_and_belongs_to_many = @model.typus_relationships_for('has_and_belongs_to_many')\n end", "def fields_for(record_or_name_or_array, *args, &block) #:nodoc:\n opts = args.extract_options!\n opts.merge!(:builder => Transit::Builders::FormBuilder)\n args.push(opts)\n super(record_or_name_or_array, *args, &block)\n end", "def update_values\n @layout.count.times do |indx|\n widget = @layout.item_at(indx).widget\n widget.build_values if widget && widget.is_a?(Qt::TableWidget)\n end\n end", "def each_field\n self.form.form_fields.each do |field|\n yield field, self.data[field.name.to_sym]\n end\n end", "def set_elements\n super\n element(:patron_id_field) {b.text_field(:id => \"olePatronId_control\")}\n element(:barcode_field) {b.text_field(:id => \"barcode_control\")}\n element(:first_name_field) {b.text_field(:id => \"firstName_control\")}\n element(:last_name_field) {b.text_field(:id => \"lastName_control\")}\n element(:borrower_type_selector) {b.select_list(:id => \"borrowerType_control\")}\n element(:email_address_field) {b.text_field(:id => \"emailAddress_control\")}\n # Search Controls\n # TODO Move these elements to OLE_QA::Framework::OLELS::Lookup (common) when they become universal.\n element(:active_yes_button) {b.radio(:id => 'activeIndicator_control_0')}\n element(:active_no_button) {b.radio(:id => 'activeIndicator_control_1')}\n element(:active_both_button) {b.radio(:id => 'activeIndicator_control_2')}\n element(:search_button) {b.button(:text => \"Search\")}\n element(:clear_button) {b.button(:text => \"Clear Values\")}\n element(:cancel_button) {b.button(:text => \"Cancel\")}\n end", "def fill_form(form_data = {})\n form_data.each do |label, value|\n label_options = self.class.form_labels[label] || raise(\"Undefined form_label '#{label}' for #{self.class.name}.\")\n if label_options.label?\n fill_in(label_options.label, with: value) && next\n else\n send(label_options.method, value)\n end\n end\n end", "def widgets= mine_widgets\n @form.wigets = mine_widgets\n end", "def form_field\n case self.column_type\n when \"text\"\n %{<%= :#{self.model_name}.text_area :#{self.column_name}, :label => true %>}\n when \"date\"\n %{<%= :#{self.model_name}.date_select :#{self.column_name}, :label => true %>}\n when \"date_time\"\n %{<%= :#{self.model_name}.date_time_select :#{self.column_name}, :label => true %>}\n else\n case self.column_name.downcase\n when /password/\n %{<%= :#{self.model_name}.password_field :#{self.column_name}, :label => true %>}\n else\n %{<%= :#{self.model_name}.text_field :#{self.column_name}, :label => true %>}\n end\n end\n end", "def startEdit\n super\n create_text_field unless @text_field\n\n set_text nil\n set_graphic @text_field\n @text_field.select_all\n end", "def []= i, widget\n @form[i] = widget\n end", "def fill_out_form(hash)\n self.main_title=hash[:main_title]\n self.main_author=hash[:main_author]\n self.co_authors=hash[:co_authors]\n self.publisher=hash[:publisher]\n self.place_of_publication=hash[:place]\n self.volume_title=hash[:volume_title]\n self.volume_information=hash[:volume_info]\n self.year=hash[:year]\n self.number=hash[:number]\n self.series_title=hash[:series]\n self.url=hash[:url]\n end", "def fields_for_sti(form, many, add)\n object = form.object\n add.each{|klass| object.send(many).build :type => klass }\n\n index = -1\n form.fields_for many do |vf|\n index += 1\n yield vf, index\n end\n end", "def fields_for_with_form_assistant(record_or_name_or_array, *args, &proc)\n options = args.extract_options!\n # hand control over to the original #fields_for()\n fields_for_without_form_assistant(record_or_name_or_array, *(args << options.merge!(:builder => self.class)), &proc)\n end", "def post_initialize_fields\n end", "def inputs_for(model, form_builder)\n cols = []\n cols += content_columns(model)\n cols -= SKIPPED_COLUMNS\n cols.compact\n\n res = ''\n cols.each do |col|\n res << form_builder.input(col, placeholder: placeholder_for(model, col, form_builder))\n end\n\n cols = association_columns(model, :belongs_to)\n cols -= SKIPPED_COLUMNS\n cols.each do |col|\n res << form_builder.association(col, placeholder: placeholder_for(model, col, form_builder))\n end\n\n res.html_safe\n end", "def form_inputs(array_of_field_names)\n array_of_field_names.each do |field|\n symbol_name = field.downcase.tr(\" \", \"_\")\n\n define_singleton_method :\"#{symbol_name}\" do\n find(\"input[formcontrolname='#{symbol_name}']\").value\n end\n\n define_singleton_method :\"#{symbol_name}=\" do |value|\n fill_in \"#{field}\", with: value\n end\n end\n end", "def initialize_dispense\n # if we haven't come from a find, then preset some attributes needed by the form\n if !self.id.present?\n# additional initialization here\n\t\t\t\telse\n\t\t\t\t\tself.just_fill_date = self.fill_time\n\t\t\t\t\tself.just_fill_time = self.fill_time\n end\n\n end", "def html_for_non_date_field(object, field)\n \"<p>\n <label for = '#{field}' >\n Select your #{field}:\n </label>\n <input type = 'text' \n name = create_form[#{field}]\n placeholder = 'Type in the #{field}'\n value = '#{object.send(field)}'>\n </input>\n </p>\"\n end", "def set_glade_variables(obj = self)\r\n obj.instance_variables.each do |name|\r\n name = name.to_s #ruby 1.9 passes symbol!\r\n v = obj.instance_variable_get(name)\n name = name.gsub('@', '')\r\n if v.is_a?(Array) \r\n v.each_index do |i|\r\n fill_control(\"#{name}[#{i.to_s}]\", v[i] )\r\n end\n elsif v.is_a?(Hash)\n v.each_pair do |key, val|\n fill_control(\"#{name}[#{key.to_s}]\", val)\n end \r\n else\r\n fill_control(name, v)\r\n end\r\n end\r\n end", "def editable_field_html(klass, field_name, value, f, include_nil_selectors = false)\n # When editing a job the values are of the correct type.\n # When editing a dirmon entry values are strings.\n field = klass.fields[field_name.to_s]\n return unless field&.type\n\n placeholder = field.default_val\n placeholder = nil if placeholder.is_a?(Proc)\n\n case field.type.name\n when \"Symbol\", \"String\", \"Integer\"\n options = extract_inclusion_values(klass, field_name)\n str = \"[#{field.type.name}]\\n\".html_safe\n if options\n str + f.select(field_name, options, {include_blank: options.include?(nil) || include_nil_selectors, selected: value}, {class: \"selectize form-control\"})\n else\n if field.type.name == \"Integer\"\n str + f.number_field(field_name, value: value, class: \"form-control\", placeholder: placeholder)\n else\n str + f.text_field(field_name, value: value, class: \"form-control\", placeholder: placeholder)\n end\n end\n when \"Hash\"\n \"[JSON Hash]\\n\".html_safe +\n f.text_field(field_name, value: value ? value.to_json : \"\", class: \"form-control\", placeholder: '{\"key1\":\"value1\", \"key2\":\"value2\", \"key3\":\"value3\"}')\n when \"Array\"\n options = Array(value)\n \"[Array]\\n\".html_safe +\n f.select(field_name, options_for_select(options, options), {include_hidden: false}, {class: \"selectize form-control\", multiple: true})\n when \"Mongoid::Boolean\"\n name = \"#{field_name}_true\".to_sym\n value = value.to_s\n str = '<div class=\"radio-buttons\">'.html_safe\n str << f.radio_button(field_name, \"true\", checked: value == \"true\")\n str << \" \".html_safe + f.label(name, \"true\")\n str << \" \".html_safe + f.radio_button(field_name, \"false\", checked: value == \"false\")\n str << \" \".html_safe + f.label(name, \"false\")\n # Allow this field to be unset (nil).\n if include_nil_selectors\n str << \" \".html_safe + f.radio_button(field_name, \"\", checked: value == \"\")\n str << \" \".html_safe + f.label(name, \"nil\")\n end\n\n str << \"</div>\".html_safe\n else\n \"[#{field.type.name}]\".html_safe +\n f.text_field(field_name, value: value, class: \"form-control\", placeholder: placeholder)\n end\n end", "def render_crud_form_field(column, item, locals)\n locals = locals.merge({:item => item, :column => column})\n\n if param(column,:grouped_select)\n return content_tag(\n \"select\",\n tag(\"option\", :value => \"\") + grouped_options_for_select(param(column,:grouped_select), @item.send(column[:name])),\n :id => \"#{@singular.underscore}_#{column[:name]}\",\n :name => \"#{@singular.underscore}[#{column[:name]}]\"\n )\n elsif param(column,:select)\n locals[:f].select(column[:name].to_s, param(column,:select).collect {|element| element.is_a?(Array) && element.length == 2 ? element : [element.to_s, element.to_s]}, { :include_blank => true }.merge(param(column, :params, {})), param(column, :params, {}))\n else\n type = param(column, :type, (item.attributes.include?(column[:name].to_s) ? item.column_for_attribute(column[:name]).type : \"other\")).to_s\n type = 'other_record' if param(column, :type, '') == '' && item.respond_to?(column[:name].to_s+\"_id\") && (attribute_class(column).respond_to?(:find) || column.include?(:find_class))\n locals = locals.merge({:type => type})\n\n if class_exists?('Lico::AutoCrud::Types::' + type.classify)\n return get_class('Lico::AutoCrud::Types::' + type.classify).to_input(item, column[:name], locals[:f], locals[:params])\n end\n \n return case type.to_sym\n when :boolean then locals[:f].check_box(column[:name], :class => 'in_boolean')\n when :country_select then locals[:f].localized_country_select(\n column[:name].to_s,\n [:NL, :BE, :LU, :FR, :DE],\n { :include_blank => '' },\n param(column, :params, { }).merge({ :class => 'in_country_select' })\n )\n when :currency then number_to_currency(0, :format => \"%u\") + \"&nbsp;\".html_safe + locals[:f].text_field(column[:name], :class => 'in_currency', :style => 'text-align: right', :value => number_to_currency(@item.send(column[:name]).to_f, :separator => \".\", :delimiter => \"\", :format => \"%n\"))\n when :custom then send(\"input_for_#{@singular.underscore}_#{column[:name].to_s}\", locals[:f], item)\n when :date then locals[:f].date_select(column[:name], param(column, :options, {}),{ :class => 'in_date' })\n when :time then locals[:f].time_select(column[:name], param(column, :options, {}),{ :class => 'in_time' })\n when :datetime then locals[:f].datetime_select(column[:name], :minute_step => 15, :class => 'in_datetime')\n when :file then locals[:f].file_field(column[:name], :class => 'in_file')\n when :hidden then locals[:f].hidden_field(column[:name], param(column, :params, { }).merge({:class => 'in_hidden'}))\n when :no_input then @item.send(column[:name])\n when :other_record then\n find_class = column.include?(:find_class) ? column[:find_class] : attribute_class(column)\n find_conditions = column[:conditions]\n find_items = find_class.find(:all, :select => param(column, :select, nil), :joins => param(column, :joins, []), :include => param(column, :include, []), :conditions => find_conditions).collect do |element| \n [ element.to_s, element.id ]\n end\n locals[:f].select(\"#{column[:name].to_s}_id\", find_items, { :include_blank => true }.merge(param(column, :options, {})))\n when :paperclip then\n item.send(column[:name].to_s).nil? ? \n # no image\n locals[:f].file_field(column[:name], :class => 'in_paperclip') :\n\n # with image\n image_tag(item.send(column[:name].to_s, param(column, :size))) +\n content_tag(\n \"div\", \n t('paperclip.upload_new') + \" \" + locals[:f].file_field(column[:name], :class => 'in_paperclip') +\n content_tag(\n \"div\",\n locals[:f].check_box(\"#{column[:name]}_delete\") +\n locals[:f].label(\"#{column[:name]}_delete\", t('paperclip.select_unlink'))\n )\n )\n when :password then locals[:f].password_field(column[:name], :class => 'in_password')\n when :select then locals[:f].select(column[:name].to_s, param(column,:select).collect {|element| element.is_a?(Array) && element.length == 2 ? element : [element.to_s, element.to_s]}, { :include_blank => true }.merge(param(column, :params, {})), param(column, :params, {}))\n when :textarea then locals[:f].text_area(column[:name], {:class => 'in_textarea'}.merge(param(column, :params, { })))\n else\n locals[:f].text_field(column[:name], param(column, :params, { }).merge({:class => 'in_' + type}))\n end\n end\n end", "def backend_fields(cols)\n o = ''\n cols.each do |c|\n identifier = \"#{id}-#{self.class}-#{c}\"\n o << \"<label for='#{identifier}'>#{c.to_s.capitalize}</label><br />\\n\"\n o << \"<textarea id='#{identifier}' name='model[#{c}]'>#{self[c]}</textarea><br />\\n\"\n end\n o\n end", "def set_Fields(value)\n set_input(\"Fields\", value)\n end" ]
[ "0.6710754", "0.66584444", "0.6586746", "0.62520474", "0.6116846", "0.6088128", "0.5973156", "0.58923894", "0.5876099", "0.58751696", "0.5838978", "0.57892257", "0.575915", "0.57421696", "0.57256556", "0.571422", "0.5699848", "0.56909156", "0.5674296", "0.56606483", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.56287897", "0.5626416", "0.5605781", "0.5582808", "0.55807126", "0.5577409", "0.5562013", "0.5559955", "0.5557151", "0.55422914", "0.553028", "0.5522749", "0.55210304", "0.5511307", "0.5489665", "0.54873437", "0.54816103", "0.5478458", "0.54768497", "0.5476437", "0.54749423", "0.5467662", "0.5465463", "0.54417914", "0.54404706", "0.54345524" ]
0.63381284
3
Waits for all penting events to finish before continuing.
def clear_events() while (Gtk.events_pending?) Gtk.main_iteration end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_done\n sleep 0.01 until done?\n end", "def process_events_until_done\n call_subscribers(*event_list.shift) until event_list.empty?\n end", "def wait\n @t.each{|t| t.join}\n end", "def process_events\n while (Gtk.events_pending?)\n Gtk.main_iteration\n end\n end", "def wait_until_finished\n @active_requests.dup.each do |n|\n n.join\n end\n end", "def wait\n loop do\n refresh\n fail Exceptions::PushJobFailed, @job if timed_out?\n fail Exceptions::PushJobFailed, @job if failed?\n break if successful?\n pause\n end\n end", "def go\n while(true)\n process_event(wait_for_event)\n end\n end", "def join_async_world\n ap4r_helper.wait_all_done\n end", "def wait_for_event\n q = @vm.eventQueue()\n while(true)\n event_set = q.remove()\n it = event_set.iterator()\n while(it.hasNext)\n event = it.next\n $DEBUG and puts(\"Received an event: #{event.java_class}\")\n @frame = AndroidDebug::Jpda::Frame.new(event.thread.frame(0), event.location)\n @this = @frame.this\n return(AndroidDebug::Jpda::Event.new(event))\n end \n end\n end", "def wait_until_exit!\n trap_signals!\n\n until @outbound_pool.wait_for_termination(60)\n debug_log Ambo.random_beep_boops\n end\n end", "def finish\n verify_not_closed\n wait_all_sent\n end", "def wait_all_sent\n verify_not_closed\n @clients.each do |pub|\n pub.wait_all_sent\n end\n end", "def join\n require \"thwait\"\n ThreadsWait.new(@event_loop).join\n end", "def wait(on=nil)\n []\n end", "def join\n @running_processes.each { |x| x.wait }\n end", "def events(params = {})\n loop do\n begin\n return events!(params)\n rescue Podbay::TimeoutError\n # Keep waiting\n end\n end\n end", "def process_events_until(timeout: 5, join_all_waiting_work: false, **options)\n Roby.warn_deprecated \"Test#process_events_until is deprecated, use #expect_execution.to { achieve { ... } } instead\"\n start = Time.now\n until yield\n now = Time.now\n remaining = timeout - (now - start)\n if remaining < 0\n flunk(\"failed to reach condition #{proc} within #{timeout} seconds\")\n end\n process_events(timeout: remaining, join_all_waiting_work: join_all_waiting_work, **options)\n sleep 0.01\n end\n end", "def wait; end", "def wait; end", "def wait; end", "def wait_until\n until yield\n wait\n end\n end", "def _wait_until_events\n config.event_queue.pop.tap do |_event|\n @_remember_time_of_first_unprocessed_event ||= MonotonicTime.now\n end\n end", "def wait_until\n until yield\n wait\n end\n end", "def wait_for_pending_sends; end", "def await_completion\n @latch.wait(@options[:timeout]) || status.timeout!\n return unless status.result == :answer\n logger.debug \"Main calls were completed, waiting for any added calls: #{@waiters.inspect}\"\n @waiters.each(&:wait)\n logger.debug \"All calls were completed, unblocking.\"\n end", "def wait!\n until query_done?\n check_cancel\n periodic_callback\n sleep @poll_every\n end\n check_errors\n end", "def wait_for_step_event\n while(true)\n event = wait_for_event\n if(event.java_event.java_kind_of?(com.sun.jdi.event.StepEvent))\n return\n else\n process_event(event)\n end\n end\n end", "def wait_for_all(state)\n state_wait(@servers, state)\n end", "def wait_until\n until yield\n\twait\n end\n end", "def wait_for_calculations\n print \"Waiting for calculations to finish...\"\n\n continuing = true\n while (continuing)\n sleep(2)\n continuing = ProductTest.where({:name => \"measureEvaluationTest\", :state => {\"$ne\" => :ready}}).exists?\n end\n\n puts \"done\"\n end", "def wait\n if defined? @result\n return @result\n else\n @waiters << Eventlet.current\n Eventlet.sleep\n end\n end", "def wait\n waitUntilStarted\n\n @resultsSemaphore.wait\n end", "def process_next_gevent\r\n #@log.info \"Process next event\"\r\n return if @suspend_queue_proc == true\r\n while @proc_queue.size > 0\r\n next_ev_handl = @proc_queue.pop\r\n send(next_ev_handl)\r\n return if @suspend_queue_proc == true\r\n end\r\n \r\n end", "def do_turn_end_evs\n @wait_on_turn_end_evs = true\n ev_ids = TM.ev_turn_start[TM.turn_no]\n print \"do_turn_end_evs, ev_ids = #{ev_ids} turn_no = #{TM.turn_no}\\n\"\n if ev_ids\n ev_ids.each{|id| Era::AI.start_event(id)}\n end\n end", "def wait_for_launching\n sleep @delay\n end", "def wait_each(timeout = -1)\n if ! block_given?\n ary = Array.new\n end\n while true\n begin\n info = DRMAA.wait(ANY_JOB, timeout)\n rescue DRMAAInvalidJobError\n break\n end\n if block_given?\n yield info\n else\n ary << info\n end\n end\n if ! block_given?\n return ary\n end\n end", "def wait_each(timeout = -1)\n if ! block_given?\n ary = Array.new\n end\n while true\n begin\n info = DRMAA.wait(ANY_JOB, timeout)\n rescue DRMAAInvalidJobError\n break\n end\n if block_given?\n yield info\n else\n ary << info\n end\n end\n if ! block_given?\n return ary\n end\n end", "def waiting; end", "def waiting; end", "def process_events\n while Gtk.events_pending?\n Gtk.main_iteration\n end\nend", "def wait\n log.info 'Waiting for all processes to finish'\n loop do\n failed = db[:process_items].filter(:id => @all_ids, :status => BlueColr.get_error_states).first\n return failed[:exit_code] if failed\n not_ok_count = db[:process_items].filter(:id => @all_ids).exclude(:status => BlueColr.get_ok_states).count\n return 0 if not_ok_count == 0 # all ok, finish\n sleep 10\n end\n end", "def let_go\n # And now here comes the events\n octo.grab \"push\" do |events|\n events.each_pair do |path, evts|\n evts.select! {|evt| Time.parse(evt[\"created_at\"]).getlocal(\"+08:00\").within_deadline?}\n # Since the text length can be no longer than 65536, split it just in case\n count = (JSON.dump(evts).length / MSG_SIZE_LIMIT) + 1\n slice_size = evts.length / count\n evts.each_slice(slice_size) do |partial|\n obj = {\n \"path\" => path,\n \"evts\" => partial\n }\n\n @queue.send_message(JSON.dump(obj))\n end\n end\n end\n end", "def wait_all\n @resources.each do |name,object|\n object.wait if object.respond_to? :wait\n end\n end", "def finish_turn_end_evs\n events = $game_map.events\n not_done = false\n ev_ids = TM.ev_turn_start[TM.turn_no]\n if ev_ids\n ev_ids.each do |id|\n e = events[id]\n intp = events[id].interpreter\n not_done = not_done || (e.starting || (intp && intp.running?)) # don't want to break\n end\n end\n @wait_on_turn_end_evs = false if !not_done\n end", "def wait_until\n poll do\n transition! if yield\n end\n end", "def wait_while\n while yield\n wait\n end\n end", "def wait_for_all(state, timeout=1200)\n state_wait(@servers, state, timeout)\n end", "def wait_until_not_full; end", "def wait_for_pending_sends\n send_pending\n while output.length > 0\n result = IO.select(nil, [self]) or next\n next unless result[1].any?\n\n send_pending\n end\n end", "def wait_until_all_messages_sent\n @sender.wait_until_all_messages_sent\n end", "def wait_for_complete\n @logger.debug(\"Waiting for workers to complete their work - #{@available_workers.length}\")\n count = 0\n while count < @workers.length\n @available_workers.pop\n count += 1\n @logger.debug(\"#{count} Worker(s) done, out of #{@workers.length}\")\n end\n\n # Put the workers back into the available workers pool\n @workers.each { |w| @available_workers.push(w) }\n\n @logger.debug(\"All workers done.\")\n end", "def wait_for_all_groups()\n job_groups.each do |group|\n wait_for_group group\n end\n end", "def wait_while\n while yield\n wait\n end\n end", "def wait\n sleep WAIT_TIME unless @skip_wait\n end", "def wait\n true\n end", "def wait\n sleep 0.0001\n end", "def wait_until_complete\n tries = 0\n status = nil\n sleep 1\n while tries < 100\n status = self.status\n puts \"Waiting... status=\" + status[\"status\"]\n if status[\"status\"] != \"queued\" && status[\"status\"] != \"running\"\n break\n end\n sleep 2\n end\n status\n end", "def do_finish_ai\n # print \"in do_finish_ai @wait_on_ai #{@wait_on_ai}\\n\"\n # print \"@event_waiting_for #{@event_waiting_for}\\n\"\n # print \"TM.response_queue #{TM.response_queue}\\n\"\n \n if @event_waiting_for == 0 && TM.response_queue.empty?\n \n # At the start of the enemies turn, just push all of them into next start\n # change start_event so that that is when everything happens.\n \n @event_waiting_for = TM.next_start\n # print \"@event_waiting_for = #{@event_waiting_for} start_queue #{TM.start_queue}\\n\"\n # print \"@event_waiting_for = #{@event_waiting_for}\\n\"\n \n if @event_waiting_for != 0\n \n # print \"routine for #{@event_waiting_for}\\n\"\n Era::AI.easy_main_routine(@event_waiting_for)\n Era::AI.start_event(@event_waiting_for)\n else\n ai_done_tb\n end\n else\n # set the event to 0 here responses are evaluted in base control flow.\n e = $game_map.events[@event_waiting_for]\n intp = e.interpreter\n intp_running = intp && intp.running?\n #print \"e.acts_done_tb #{e.acts_done_tb}\\n\" if e\n #print \"intp_running = #{intp_running}\\n\"\n #print \"event.list #{e.list}\\n\"\n if !e || (e.acts_done_tb)# && !(intp_running || e.starting))\n @event_waiting_for = 0\n end\n end\n end", "def process_events_until(timeout: 5, **options)\n Roby.warn_deprecated \"do not use #process_events. Use the \"\\\n \"expect_execution infrastructure with \"\\\n \"the 'achieve' expectation instead\"\n\n start = Time.now\n until yield\n now = Time.now\n remaining = timeout - (now - start)\n if remaining < 0\n flunk(\"failed to reach expected condition \"\\\n \"within #{timeout} seconds\")\n end\n process_events(timeout: remaining, **options)\n sleep 0.01\n end\n end", "def wait\n loop do sleep 1 end\n end", "def wait\n @running.reset\n @waiting.set\n @running.wait\n end", "def await_event_propagation\n # same number as used in rabbit-hole test suite. Works OK.\n sleep 1\n end", "def await_event_propagation\n # same number as used in rabbit-hole test suite. Works OK.\n sleep 1\n end", "def ai_done_tb\n # print \"\\n\\n\\n~~~~~~~ AI DONE ~~~~~~~~~~ \\nstart_queue=#{TM.start_queue}\\n\\n\\n\"\n \n @wait_on_ai = false # nothing left in queue\n Era::AI.produce_units \n # do_turn_end_evs\n # start_player_turn_tb\n go_next_turn_tb\n end", "def wait_for_event_count(expected_count)\n puts \"Waiting for #{expected_count} events to be processed\"\n container = vespa.container.values.first\n i = 0\n event_count = 0\n max_wait_time = 100\n loop do\n result = container.http_get2(\"/events\")\n event_count = get_event_count(result)\n puts \"Event count: #{event_count}\"\n break if expected_count == event_count or i > max_wait_time\n sleep 1\n i = i + 1\n end\n puts \"Waited #{i} seconds\"\n assert_equal(expected_count, event_count)\n end", "def each(timeout = 1, &block)\n @stop = false\n\n loop do\n break if stop?\n\n time = Time.now.to_f\n\n push_to_queue pop_from_schedules(time)\n next unless event = pop_from_queue(timeout)\n\n begin\n block.call event\n rescue Exception => e\n exceptions.rpush JSON(time: Time.now, event: event, message: e.inspect)\n ensure\n local.del\n end\n end\n end", "def wait_while\n while yield\n\twait\n end\n end", "def monitor_events\n event_monitor_handle.start\n event_monitor_handle.each_batch do |events|\n event_monitor_running\n if events && !events.empty?\n @queue.enq events\n end\n sleep_poll_normal\n end\n ensure\n reset_event_monitor_handle\n end", "def distribute_results!\n response = JSON.parse(@socket.readline)\n\n if response[\"event\"]\n @event_queue << response\n else\n @result_queue << response\n end\n rescue StandardError\n @alive = false\n Thread.exit\n end", "def wait\n\t\t\t\[email protected]\n\t\t\tend", "def process_events\n until @dead\n event = next_event\n notify_listeners(event)\n event.dispatch\n end\n rescue Exception => ex\n Logger.error \"Error while running event: #{Logger.format_error(ex)}\"\n end", "def wait(timeout = nil)\n event.wait(timeout) if timeout != 0 && incomplete?\n self\n end", "def each_event\n\t\t\twhile event = SDC.window.poll_event do\n\t\t\t\tyield event\n\t\t\tend\n\t\tend", "def wait\n\tend", "def wait_for(timeout = 30, &block)\n start = Time.now\n while true\n raise RuntimeError, \"Timed out waiting for event\" if Time.now - start > timeout\n\n break if yield\n\n sleep(0.1)\n end\n end", "def complete\n case self.completed\n when EVENT_COMPLETED\n self.make_done_event if self.event.event_rep_type != SpecialCode.get_code('event_rep_type','unlimited')\n self.event.completes(self.player_character)\n LogQuestExplore.complete_req(self.player_character_id, event_id) #probably should happen through \n when EVENT_FAILED\n return [nil,nil]\n #when EVENT_SKIPPED\n when EVENT_INPROGRESS\n return [self.priority, self.event]\n end\n return self.next_event\n end", "def wait_for_jobs(jobs)\n jobs.each(&:wait)\n end", "def wait_until_finished()\n\t\t\[email protected] do |t| \n\t\t\t\tif (t.status==\"run\")\n\t\t\t\t\tt.join; # wait to finish\n\n\t\t\t\t\t# log\n\t\t\t\t\tif @logger!=nil\n\t\t\t\t\t\[email protected] \"action=stop|name=thread\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# log\n\t\t\tif @logger!=nil\n\t\t\t\[email protected] \"transactions=#{@transactions}|threads=#{@num_threads}|failures=#{@failures}|duration=#{Time.now - @start_time}\"\n\t\t\tend\n\t\tend", "def waiting\n @mootex.synchronize { @waiting.keys }\n end", "def wait_for_provisioning\n while !self.provisioned?\n sleep Profitbricks::Config.polling_interval\n end\n end", "def wait_for(conditions)\n unless WebkitRemote::Event.can_receive? self, conditions\n raise ArgumentError, \"Cannot receive event with #{conditions.inspect}\"\n end\n\n events = []\n each_event do |event|\n events << event\n break if event.matches?(conditions)\n end\n events\n end", "def wait\n # Here we use a loop-sleep combination instead of using\n # ThreadPoolExecutor's `wait_for_termination`. See issue #21 for more\n # information.\n loop do\n break if @executor.shutdown?\n sleep 0.1\n end\n end", "def notify(event)\n if $verbose\n puts \"got: #{event}\"\n end\n # this is list of events we expect\n event_list = @expected_events.first\n if $verbose\n puts \"waiting for: #{event_list}\"\n end\n # if we've got expected event we remove it from the list\n event_list.each do |e|\n if e[:source] == event[:source] && event[:text].end_with?(e[:text])\n event_list.delete(e)\n end\n end\n # in case of no more events to expect this test step is done, we can run next step\n if event_list.empty?\n @expected_events.shift\n advance_test_sequence()\n end\n end", "def start_processing\n\t\t@processing = true\n\t\twhile @processing\n\t\t\tevent = self.read_next_event or next\n\t\t\tself.log.debug \"Read event: %p\" % [ event ]\n\t\t\tself.store_event( event )\n\t\tend\n\tend", "def event_wait_for finishable\n ScriptActionHandler::HandlerResult::waitFor finishable\n end", "def wait_until_ready\n # this method may be left unimplemented if that is applicable\n end", "def join\n @cond.wait if not finished?\n end", "def wait(duration)\n for i in 0...duration\n update_basic\n end\n end", "def wait\n done = @ractor.take\n yield(self) if block_given?\n done\n end", "def events_by_completion_time(event)\n handling_events\n end", "def waitUntil\n until yield\n sleep 0.5\n end\nend", "def finish_events\n audio_event = @vj.fetch_last_event(:audio)\n audio_event.set_duration_now! unless audio_event.nil?\n video_event = @vj.fetch_last_event(:video)\n video_event.set_duration_now! unless video_event.nil?\n end", "def wait\n\t\t\t\tif @count > 0\n\t\t\t\t\tFiber.yield\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tsucceeded?\n\t\t\tend", "def wait\n @timer_thread.join\n end", "def wait\n @thread.join\n end", "def run\n $log.info \"Starting Event Wizard\"\n loop do\n # reset variables\n min_wait = 30*DAY\n\n # perform overdue events; get min_wait time\n @events.each do |event|\n event.perform if Time.now - event.last_performed >= event.wait\n min_wait = event.wait if event.wait < min_wait\n end\n\n # sleep until another event is ready\n $log.info \"Sleeping for #{min_wait/MINUTE} minutes\"\n sleep min_wait\n end\n end", "def wait\n\t\t\t\[email protected]\n\t\t\tend", "def wait_async\n @wait_async = true\n end", "def wait_for_complete(iterator)\n loop do\n states = iterator.each_app_screenshot.map { |_, _, app_screenshot| app_screenshot }.each_with_object({}) do |app_screenshot, hash|\n state = app_screenshot.asset_delivery_state['state']\n hash[state] ||= 0\n hash[state] += 1\n end\n\n is_processing = states.fetch('UPLOAD_COMPLETE', 0) > 0\n return states unless is_processing\n\n UI.verbose(\"There are still incomplete screenshots - #{states}\")\n sleep(5)\n end\n end", "def done\n @end_check.call if @end_check\n EM.cancel_timer(@timeout)\n EM.stop\n end", "def wait\n Kernel.sleep self.interval until check_files\n end" ]
[ "0.65068066", "0.6495677", "0.6248584", "0.6177621", "0.6149994", "0.6136741", "0.61337715", "0.6119938", "0.6012008", "0.59892863", "0.5985583", "0.59312415", "0.5905204", "0.5900535", "0.5883703", "0.5824588", "0.5820568", "0.5791479", "0.5791479", "0.5791479", "0.5785471", "0.5783165", "0.5778511", "0.5759026", "0.5738914", "0.57276404", "0.57256234", "0.57211274", "0.5719811", "0.57072926", "0.56901294", "0.5689978", "0.5682877", "0.5676264", "0.5658768", "0.56551665", "0.56491244", "0.5639303", "0.5639303", "0.56053966", "0.55973375", "0.5596565", "0.5596005", "0.55879635", "0.5571249", "0.556251", "0.5562127", "0.5556611", "0.55175626", "0.5516381", "0.54954296", "0.5479789", "0.5479484", "0.54783654", "0.5478059", "0.5477018", "0.54757047", "0.54677594", "0.5461141", "0.54608834", "0.5458776", "0.5456399", "0.5456399", "0.54406774", "0.543213", "0.5403937", "0.54016227", "0.5394411", "0.5393186", "0.53927034", "0.53921986", "0.53905815", "0.5382372", "0.53718364", "0.5369873", "0.5368484", "0.5367648", "0.53624135", "0.5359426", "0.53524226", "0.5332711", "0.5317482", "0.5307956", "0.52996844", "0.5293285", "0.52900124", "0.52839136", "0.5283778", "0.5277185", "0.5274493", "0.52730703", "0.5272056", "0.5271061", "0.5270286", "0.52687585", "0.5266719", "0.52654946", "0.5258568", "0.52557105", "0.5252165", "0.5244242" ]
0.0
-1
Feel free to google "how to generate a random number in ruby"
def roll rand(6) #=> gives a random number between 0 and 6 inclusively rand(1..6) #=> gives a random number between 1 and 6 inclusively end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_number\r\n return randomNumber = 1 + rand(100)\r\n end", "def get_random_number()\n rand(0x7fffffff).to_s\nend", "def gen_num\n rand(1..100)\nend", "def random_number\n t = Time.now.to_f / (Time.now.to_f % Time.now.to_i)\n random_seed = t * 1103515245 + 12345;\n (random_seed / 65536) % 32768;\nend", "def rand\n return extract_number / (2**32 -1).to_f\n end", "def random\n 1 + (10 * rand(0))\n end", "def generate_number\r\n \r\n #Generate and return a random number between 1 and 1000\r\n return randomNo = 1 + rand(1000)\r\n \r\n end", "def random_no\n rand(5000)\nend", "def random_number\n rand(0..20)\n end", "def random_num_generator\n return rand(1..100)\nend", "def random_num_generator\n return rand(1..100)\nend", "def generate_random_number\n rand(1..6) + 1\nend", "def generate_number\r\n \r\n #Generate and return a random number between 1 and 100\r\n return randomNo = 1 + rand($maxChallengeRange)\r\n \r\n end", "def generate_one_random_number()\r\n @l = @total_no_of_bits + 1\r\n bit_string = @total_sequence.join('')\r\n numerator = bit_string.to_i(2)\r\n random_number = numerator *1.0 / 2**@l\r\n\r\n return random_number\r\n end", "def srand(num=0) end", "def number_generator\n rand(1..20)\n end", "def generate_number\n \n #generate and return a random number from 1 to 100\n return randomNO = 1 + rand(1000)\n\n end", "def pick_random_number(digits=1)\n min = 10 ** (digits - 1)\n max = (10 ** digits ) - 1\n semirandom = min + rand(max-min)\n semirandom += 1 if semirandom == 666 #would be unpleasant to receive...\n return semirandom\n end", "def generate_random_number\n (1..10).to_a.sample\nend", "def get_random\n File.read(\"/dev/urandom\", 8).unpack(\"H*\")[0].hex\n rescue\n rand(9117854927)\n end", "def randomizer\n number = rand(0..1)\n return number\nend", "def random_number\n rand(1..20)\nend", "def make_not_so_random!\n srand 1213\nend", "def rand_digit #generate random digit\n\treturn rand(10)\nend", "def random_number \n rand(6) + 1 \nend", "def random_number\n rand 0..20\nend", "def getRand()\n # With 32-bit MAX_INT to be able to have cool numbers\n return Random.rand() * 2147483647;\nend", "def random_int(max)\n rand(max)\nend", "def get_random_number(max_value = 10)\n\trand(max_value)\nend", "def randomNum()\r\n num = rand(1..10)\r\nend", "def nostalgia; return rand end", "def digit\n rand(10)\n end", "def generate_random()\n begin\n r = Kernel.rand()\n end while r == 0.0\n \n if use_flt?\n BigDecimal(r.to_s)\n else\n r\n end\n end", "def uniform_int(n)\n (rand()*n).to_i\nend", "def number\n\t\"#{Time.now.to_i}-#{rand(1_000_000)}\"\n end", "def rand_nr\n return rand(1..2)\nend", "def get_rand\n rand = \"\";\n File.open(\"/dev/urandom\").read(20).each_byte{|x| rand << sprintf(\"%02x\",x)}\n rand\nend", "def random_number(min, max)\n rand(max-min+1)+min\n end", "def random_num(min, max)\n rand(max - min + 1) + min\nend", "def random_to_one\n return rand()\n end", "def random_to_one\n return rand()\n end", "def random_to_one\n return rand()\n end", "def random_to_one\n return rand()\n end", "def n_generator\n number = rand(10..30)\n end", "def random_number(seed, range)\n seed = seed.to_i\n return nil if seed <= 0\n rng2 = Random.new(seed)\n num = rng2.rand(range) + 1\n num\n end", "def new_account_number\n return rand(99999999)\n end", "def new_account_number\n return rand(99999999)\n end", "def random_num(min, max)\n rand(max - min + 1) + min\nend", "def non_zero_digit\n rand(1..9)\n end", "def random_account_number\r\n acct_num = rand(10**11).to_s.rjust(11, '1')\r\n return acct_num\r\n end", "def make_rand\n Random.new_seed\n return Random.new\n end", "def random(range)\n return rand(range + 1)\nend", "def random\n card = rand(1..52)\n card.to_i\n end", "def random\n card = rand(1..52)\n card.to_i\n end", "def ran_str_maker\r\n length = 10\r\n ran_str = rand(36**length).to_s(36)\r\n return ran_str\r\nend", "def rand_num(range)\n num = @rng.rand(range) + 1\n num\n end", "def test_random_number_generation\n rand = @game.get_random_number(0, 10)\n assert rand <= 10 && rand >= 0\n end", "def gen_random_int\n $lasti = ($lasti * IA + IC) % IM\nend", "def get_random_number\n\t\trandom_num = rand(@deck.length)\n\tend", "def randomBitNum x\n bitString = \"1\"\n (1...x).each do\n bitString += rand(2).to_s\n end\n return bitString.to_i(2)\nend", "def randomBitNum x\n bitString = \"1\"\n (1...x).each do\n bitString += rand(2).to_s\n end\n return bitString.to_i(2)\nend", "def rand_id\n rand(10**7...10**8).to_s\nend", "def random_id\n rand(1000000) + 20000\nend", "def rand(max=0) end", "def rand\n warn \"STUB: rand in distribution.rb\"\n end", "def generate_number(store)\n store.number = loop do\n random_number = Digest::SHA1.hexdigest([Time.now, rand].join)[0..5].upcase\n break random_number unless Store.exists?(number: random_number)\n end\n end", "def random_number( bits )\n m = (1..bits-2).map{ rand() > 0.5 ? '1' : '0' }.join\n s = \"1\" + m + \"1\"\n s.to_i( 2 )\n end", "def random_account_number\n acct_num = rand(10**11).to_s.rjust(11, '1')\n return acct_num\n end", "def rand\n Kernel.rand(self)\n end", "def generator_rand(max)\n return nil if max < 0\n\n result = rand(max + 1)\n result\n end", "def rand_id\n rand(10**7...10**8).to_s\n end", "def get_random_number(gender)\n\t\tcount = total_count(gender)\n\t\tset_random_seed\n\t\treturn rand(1..count)\n\tend", "def random20\n rand(20) + 1\n end", "def get_next_uuid\n rand(8**32).to_s(36)\n end", "def gen_rand b\n p = rand(2**b)+2**b-1\n while ! rand_test p\n# puts p\n p += 1\n end\n p\nend", "def get_new_random_number random_numbers\n random_number = 0\n begin\n random_number = rand @working_dataset.get_dataset_size\n end while (random_numbers.has_key?(random_number))\n random_numbers[random_number] = 1\n return random_number\n end", "def rand_digit\n ascii = Random.rand(10) + 48\n return ascii.chr\nend", "def random_integer(limit)\n Rubinius.primitive :randomizer_rand_int\n raise PrimitiveFailure, \"Randomizer#rand_int primitive failed\"\n end", "def random_integer(limit)\n Rubinius.primitive :randomizer_rand_int\n raise PrimitiveFailure, \"Randomizer#rand_int primitive failed\"\n end", "def sequence_number\n @sequence_number ||= rand(0xFFFFFFFF)\n end", "def random_float\n rand * rand(10)\n end", "def get_rand range\n\t\t@random_number = rand(range)\n\tend", "def any_number(*options)\n number = (rand(2 * MAX_RAND) - MAX_RAND).to_f/100.0\n if options.include? :positive\n number + MAX_RAND\n elsif options.include? :negative\n number - MAX_RAND\n else\n number\n end\n end", "def random\n rand - rand\nend", "def generateCode()\n require 'securerandom'\n return SecureRandom.hex\n end", "def generate_number\n if self.respond_to? :inv_cdf\n inv_cdf(rand)\n else\n generate_sample 1\n end\n end", "def rand(max)\n max-1\nend", "def generate_int\n UUIDTools::UUID.random_create.to_i\n end", "def initialize(num = rand(52))\n self.num = num\n end", "def generate_random_number_except_123\n x = rand(1000)\n throw :finish if x == 123\nend", "def random_status_number_generator\n Random.rand(1..10)\n end", "def rand_phone options={}\r\n\t\"210#{random(1111111, 9999999).to_s}\"\r\nend", "def rand_seed\n rand(0x7fffffff)\n end", "def random_integer(max_size)\r\n 1 + rand(max_size)\r\n end", "def gen_speed\n rand + 15.0\n end", "def generate_order_number\n r = Random.new\n \"#{self.class.to_s.gsub(/[a-z]/, '')}#{Time.now.to_i}\"\n end", "def usw_random(max=-1, min=0)\n Sass::Script::Number.new( max.to_i < 0 ? rand() : rand(min.to_i .. max.to_i ))\n end", "def randr(min, max)\n rand(max - min + 1) + min\nend", "def random(num_bytes)\n SecureRandom.random_bytes(num_bytes)\n end", "def int(size)\n rand(size).to_i\n end", "def randstr\n\trand(36 ** 8).to_s(36)\nend" ]
[ "0.8495664", "0.83661103", "0.8313143", "0.8223487", "0.81888056", "0.81034255", "0.8082594", "0.80462444", "0.80339515", "0.80311567", "0.80311567", "0.8012156", "0.7966379", "0.7956103", "0.7935751", "0.7910181", "0.7877693", "0.7872219", "0.7863298", "0.7854499", "0.7818158", "0.781445", "0.7806673", "0.7786722", "0.7784185", "0.77700466", "0.77647746", "0.7694345", "0.76326126", "0.76219946", "0.76181835", "0.7610541", "0.7607652", "0.7576539", "0.75624573", "0.7535859", "0.74808025", "0.74642617", "0.7455895", "0.7455097", "0.7455097", "0.7455097", "0.7455097", "0.7453028", "0.7438648", "0.7437542", "0.7437542", "0.7433198", "0.7418141", "0.73948604", "0.73935056", "0.7388859", "0.7384931", "0.7384671", "0.73728895", "0.7367491", "0.7335504", "0.73125494", "0.73067915", "0.7306434", "0.7306434", "0.73024684", "0.7300859", "0.7298967", "0.72983336", "0.72962695", "0.7295851", "0.7293809", "0.72902685", "0.7279991", "0.7276914", "0.726603", "0.7260727", "0.7254885", "0.7252861", "0.7225436", "0.7208125", "0.7196549", "0.7196549", "0.7188492", "0.717671", "0.71485966", "0.714356", "0.7138104", "0.71108955", "0.71038544", "0.7094189", "0.70914865", "0.7078541", "0.7069356", "0.70523256", "0.6980864", "0.69527686", "0.6946055", "0.6933183", "0.69318557", "0.6919886", "0.6913367", "0.69059163", "0.6894117", "0.6893289" ]
0.0
-1
Authenticates a new application and returns the token. Authenticates a new application and returns the token
def authenticate_application(opts = {}) data, _status_code, _headers = authenticate_application_with_http_info(opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate_app\n payload = {\n # The time that this JWT was issued, _i.e._ now.\n iat: Time.now.to_i,\n\n # JWT expiration time (10 minute maximum)\n exp: Time.now.to_i + (10 * 60),\n\n # Your GitHub App's identifier number\n iss: APP_IDENTIFIER\n }\n logger.debug \"JWT payload: #{payload}\"\n\n # Cryptographically sign the JWT.\n jwt = JWT.encode(payload, PRIVATE_KEY, 'RS256')\n\n # Create the Octokit client, using the JWT as the auth token.\n @app_client ||= Octokit::Client.new(bearer_token: jwt)\n end", "def create_application_token!(user)\n ApplicationToken.create_token(\n current_user: current_user,\n user_id: user.id,\n params: { application: \"default\" }\n )\n end", "def create_token_for(app_name)\n timestamp = Time.now.utc.strftime(\"%Y%m%d%H%M%S\")\n display = \"#{app_name}_#{timestamp}\"\n Vault.auth_token.create(name: app_name,\n ttl: '720h',\n display_name: display,\n policies: [app_name])\n end", "def create_user_token(user_id, application_id, application_name)\n res = nil\n uri = URI(@url + \"auth/#{application_name}/login\")\n req = Net::HTTP::Post.new(uri)\n req['X-Vault-Token'] = @token\n application_data = { 'app_id' => application_id, 'user_id' => user_id }\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|\n req.body = application_data.to_json\n http.request(req)\n end\n [JSON.parse(res.body), res.code.to_i]\n end", "def create_for_app(app_auth_request = nil)\n build_request(app_auth_request || { api_key: @api_key, client_secret: @secret },\n Requests::AuthenticateApp).\n send_to_api(:post, endpoint_path)\n end", "def token_generate\n res = call('auth.token_generate')\n\n return unless res || res['token']\n\n res['token']\n end", "def generate_token(id, optional_params = {})\n response = Network.post(['Applications', id, 'GenerateToken'], optional_params)\n Application.new(response)\n end", "def init_application(application_name)\n if application_name.nil? || application_name == ''\n throw 'Bad application name'\n end\n res = nil\n applicaiton_init_uri = URI(@url + \"sys/auth/#{application_name}\")\n req = Net::HTTP::Post.new(applicaiton_init_uri)\n req['X-Vault-Token'] = @token\n res = Net::HTTP.start(applicaiton_init_uri.hostname, applicaiton_init_uri.port) do |http|\n req.body = { 'type' => 'app-id' }.to_json\n http.request(req)\n end\n res.code.to_i\n end", "def generate_authentication_token\n self.auth_token = User.new_token\n\t\t\tself.auth_expires_at = Time.now + 240.hours\n\tend", "def new\n if pre_authorizable?\n if user_has_signin_permission_to_application?\n auth = authorize_response\n redirect_to auth.redirect_uri, allow_other_host: true\n else\n session[:signin_missing_for_application] = application.try(:id)\n redirect_to signin_required_path\n end\n else\n render :error\n end\n end", "def authenticate\n raise \"client_id and client_secret required\" unless application_credentials?\n\n set_access_token_from_params(nil)\n without_authentication do\n post('/login', {}, :query => application_credentials)\n raise \"login failure #{last_response.status}\" unless last_response.status == 200\n set_access_token_from_params(last_response.data)\n end\n end", "def auth_token\n return regenerate_auth_token if expired?\n\n authentication.auth_token\n end", "def generate_auth_token\n token = AuthToken.new(user: self)\n token if token.save\n end", "def authentication_token\n generate_token(:authentication_token)\n end", "def create_oauth_application(token, name, redirect_uris)\n request(\n __method__,\n :post,\n \"#{api_base}/oauth2/applications\",\n { name: name, redirect_uris: redirect_uris }.to_json,\n Authorization: token,\n content_type: :json\n )\n end", "def create_oauth_application(token, name, redirect_uris)\n request(\n __method__,\n :post,\n \"#{api_base}/oauth2/applications\",\n { name: name, redirect_uris: redirect_uris }.to_json,\n Authorization: token,\n content_type: :json\n )\n end", "def create\n\t\t@application = Application.new(params[:application])\n\n\t\tif @application.save\n\t\t\tflash[:developer] = \"Yay! Your application has been registered!\"\n\t\t\tcurrent_developer.applications << @application\n\t\t\t# Randomizer as in http://goo.gl/qpI5Rv\n\t\t\taccess_token = Array.new(32){rand(36).to_s(36)}.join\n\t\t\tkey = ApiKey.create(:access_token => access_token)\n\t\t\tkey.application = @application\n\t\t\tkey.save\n\t\t\tredirect_to developer_home_path\n\t\telse\n\t\t\trender :action => 'register'\n\t\tend\n\tend", "def connection_for_application\n oauth_client.client_credentials.get_token\n end", "def auth_token\n auth_token_for(DEFAULT_AUTH_TOKEN_KEY)\n end", "def create\n @application = Doorkeeper::Application.new(application_params)\n @application.uid = SecureRandom.hex(4)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: %i[doorkeeper flash applications create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end", "def authenticate\n # if valid_access_token?\n # fetch_access_token\n # else\n get_new_access_token\n # end\n end", "def get_authorization()\n data = {\n api_secret: @apiSecret,\n device_secret: @deviceSecret\n }\n response = @httpHelper.post_data( 'token', data )\n response[:device_secret] ||= '';\n @applicationToken = response[:application_token]\n return response\n end", "def aquire_token\n token_data = server.call(\"acquire_token\", @config['account_code'], @config['password'], @config['provider_key'])\n status = token_data[0]\n @token = token_data[1]\n if (is_error(status)) \n error_message = decode_error(status)\n raise \"Unable to aquire token. Reason: #{error_message}\"\n end\n @token\n end", "def token\n authenticated\n end", "def create\n if user&.valid_password?(params[:password])\n if turbo_native_app?\n sign_in_user\n render json: {location: after_sign_in_path_for(user), token: token_by_name(ApiToken::APP_NAME)}\n else\n render json: {token: token_by_name(ApiToken::DEFAULT_NAME)}\n end\n else\n render json: {error: error_message}, status: :unauthorized\n end\n end", "def retrieve_auth_token\n http = Net::HTTP.new(auth_endpoint.host, auth_endpoint.port)\n\n request = Net::HTTP::Post.new(auth_endpoint.request_uri)\n\n request.basic_auth(\n TodoableApi.configuration.username,\n TodoableApi.configuration.password\n )\n\n handle_auth_response(http.request(request))\n end", "def create\n self.resource = warden.authenticate!(scope: :user)\n token = Tiddle.create_and_return_token(resource, request)\n render json: { authentication_token: token }\n end", "def new_jwt\n Knock::AuthToken.new(payload: { sub: current_user.id }).token\n end", "def generate_auth_token\n self.auth_token = SecureRandom.hex\n end", "def create\n @application = Doorkeeper::Application.new(application_params)\n @application.uid = SecureRandom.hex(4)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end", "def make_auth_token\n Carto::Common::EncryptionService.make_token(length: 64)\n end", "def request_token\n @token = current_client_application.create_request_token\n if @token\n render :text => @token.to_query\n else\n render :nothing => true, :status => 401\n end\n end", "def generate_token\n new_token =\n SimpleTokenAuthentication::TokenGenerator.instance.generate_token\n update(authentication_token: new_token)\n self\n end", "def generate_auth_token\n \tbegin\n \t\tself.auth_token = User.new_token\n \tend while self.class.exists?(auth_token: auth_token)\n end", "def authToken(secretkey)\n # get 'authToken', {secretkey: secretkey} { |x| x['authToken'] }\n new_auth_token\n end", "def applicazioni_oauth2\n #creo jwt\n hash_jwt_app = {\n 'iss' => 'soluzionipa.it',\n 'start' => DateTime.now.new_offset(0).strftime(\"%d%m%Y%H%M%S\") #datetime in formato utc all'invio\n }\n jwt_token = JsonWebToken.encode(hash_jwt_app)\n redirect_to \"#{Settings.app_oauth2_url}/oauth/applications?jwt=#{jwt_token}\"\n end", "def ensure_authentication_token\n self.authentication_token ||= generate_authentication_token\n end", "def generate_auth_token\n begin\n token = SecureRandom.hex\n end while AuthToken.exists?(auth_token: token)\n self.auth_tokens.create(auth_token: token)\n token\n end", "def get_access_token_as_app(app_id, app_token)\n response = @oauth_connection.post do |req|\n req.url '/oauth/token', :grant_type => 'app', :client_id => api_key, :client_secret => api_secret, :app_id => app_id, :app_token => app_token\n end\n\n @oauth_token = OAuthToken.new(response.body)\n configure_oauth\n @oauth_token\n end", "def ensure_authentication_token\n self.authentication_token ||= generate_authentication_token\n end", "def app_access_token\n # If a token isn't provided but we need it, fetch it\n @app_access_token ||= Koala::Facebook::OAuth.new(@app_id, @secret).get_app_access_token\n end", "def get_new_access_token\n now = Time.now\n params = {\n body: {\n grant_type: 'urn:ietf:params:oauth:grant-type:uma-ticket',\n ticket: retrieve_ticket,\n client_id: key_info['oxtrust_client_id'],\n client_assertion_type: 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',\n client_assertion: generate_json_web_token(now),\n scope: 'oxtrust-api-read oxtrust-api-write'\n }\n }\n req = HTTParty.post('https://localhost/oxauth/restv1/token', params)\n if req.code == 200\n token = req['access_token']\n save_access_token(token, now.to_i + 86_400)\n token\n else\n Puppet.err(\n \"Gluu API HTTP #{req.code}: #{req['error_description']}\",\n )\n end\n end", "def create\n authorize @application, policy_class: Oauth::ApplicationPolicy\n @application = Doorkeeper::Application.new(application_params)\n @application.owner = current_user if T.unsafe(Doorkeeper).configuration.confirm_application_owner?\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end", "def new_client_application\n OAuth2::Client.new(caller_service.client_id, caller_service.client_secret, :site => authorizator_service.site, :raise_errors => false)\n end", "def create_token\n @account_token = SecureRandom.urlsafe_base64(nil, false)\n @authentication_token = create_authentication_token\n key = account_token_key(@account_token)\n redis_token = Redis::HashKey.new(key)\n expire_time = DateTime.now + ACCOUNT_TOKEN_TTL\n redis_token.bulk_set({expire_at: expire_time.to_s, authentication_token: @authentication_token})\n redis_token.expireat(expire_time.to_i)\n update_app_info\n {account_token: @account_token, authentication_token: @authentication_token}\n end", "def create_token\n return api_call('request-token',{\"apiKey\"=> @@_api_key });\n end", "def refresh_auth_token\n generate_token(:auth_token)\n save!\n end", "def generate_new_authentication_token\n token = User.generate_unique_secure_token\n update_attributes authentication_token: token\n end", "def create\n @application = Doorkeeper::Application.new(application_params)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n respond_with( :oauth, @application, location: oauth_application_url( @application ) )\n else\n render :new\n end\n end", "def get_new_token\n auth = 'Basic ' + Base64.strict_encode64( session[:client_id] + \":\" + session[:client_secret]).chomp\n \n rcResultJson = RestClient.post(\n session[:token_url],\n {\n grant_type: 'refresh_token', \n refresh_token: session[:refresh_token], \n },\n {\n :Authorization => auth\n }\n )\n rcResult = JSON.parse(rcResultJson)\n\n session[:patient_id] = rcResult[\"patient\"]\n session[:access_token] = rcResult[\"access_token\"]\n session[:refresh_token] = rcResult[\"refresh_token\"]\n session[:token_expiration] = (Time.now.to_i + rcResult[\"expires_in\"].to_i )\n rescue StandardError => exception\n # binding.pry \n err = \"Failed to refresh token: \" + exception.message\n redirect_to root_path, alert: err\n end", "def token_auth(*args, &block); end", "def new_api_key\n @application = Doorkeeper::Application.find(params[:id])\n @application.secret = Doorkeeper::OAuth::Helpers::UniqueToken.generate\n @application.save\n message = I18n.t('new_api_key')\n flash[:notice] = render_to_string partial: 'applications/flash',\n locals: { message: message }\n redirect_to authorizations_path\n end", "def sign_in(user)\n user.create_new_auth_token\n end", "def generate_authentication_token\n SecureRandom.hex(8)\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def auth\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"params=#{params}\",\n \"\" ] if browse_everything_controller_debug_verbose\n # params contains the access code with with the key :code\n provider_session.token = provider.connect(params, provider_session.data, connector_response_url_options)\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"provider_session.token=#{provider_session.token}\",\n \"\" ] if browse_everything_controller_debug_verbose\n provider_session.token\n end", "def create_application_id(application_name)\n applicaiton_id = VaultDriver.generate_uid\n applicaiton_create_uri = URI(@url + \"auth/#{application_name}/map/app-id/#{applicaiton_id}\")\n req = Net::HTTP::Post.new(applicaiton_create_uri)\n req['X-Vault-Token'] = @token\n res = Net::HTTP.start(applicaiton_create_uri.hostname, applicaiton_create_uri.port) do |http|\n req.body = { 'value' => 'root', 'display_name' => application_name.to_s }.to_json\n http.request(req)\n end\n [applicaiton_id, res.code.to_i]\n end", "def app_access_token\n @app_access_token ||= oauth_client.get_app_access_token\n end", "def generate_authentication_token!\n begin\n self.auth_token = SecureRandom.hex(20)\n end while self.class.exists?(auth_token: auth_token)\n end", "def request_token\n self.token = Pivotal::Client.fetch_token(email, password)\n end", "def auth_token\n TokenProvider.issue_token(\n first_name: object.first_name,\n last_name: object.last_name,\n username: object.username,\n user_id: object.id,\n role: object.role\n )\n end", "def get_new_access_token\n client, auth = google_api_client_auth\n print(\"1. Open this page:\\n%s\\n\\n\" % auth.authorization_uri)\n print(\"2. Enter the authorization code shown in the page: \")\n system( 'open \"'+auth.authorization_uri+'\"' )\n auth.code = $stdin.gets.chomp\n auth.fetch_access_token!\n auth.access_token\n end", "def generate_auth_token\n\t token = SecureRandom.hex\n\t #self.update_columns(token_key: token)\n\t token\n\t end", "def create_authentication_token!\n begin\n self.authentication_token = User.token\n end while User.exists?(authentication_token: self.authentication_token)\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def request_token\n request = { query: { code: ENV['GOOGL_CODE'], \n client_id: ENV['GOOGL_CLIENT_ID'], \n client_secret: ENV['GOOGL_CLIENT_SECRET'],\n redirect_uri: ENV['GOOGL_REDIRECT_URI'],\n grant_type: \"authorization_code\" } }\n\n result = self.class.post(\"/oauth2/v3/token\", request)\n\n result.parsed_response\n end", "def create\n\n\t\t@auth = request.env[\"omniauth.auth\"]\n\n\t\tprovider = @auth.provider\n\t\tuid = @auth.uid\n\t\taccess_token = @auth.credentials.token\n\t\ttoken_secret = @auth.credentials.secret\n\t\tconsumer_key = \"\"\n\t\tconsumer_secret = \"\"\n\n\t\tif provider == \"bitbucket\"\n\t\t\tconsumer_key = @auth.extra.access_token.consumer.key\n\t\t\tconsumer_secret = @auth.extra.access_token.consumer.secret\n\t\tend\n\n\t\t@authentication = Authentication.find_by_provider_and_uid(provider, uid)\n\n\t\tif @authentication.present?\n\t\t\t# The authentication is already there\n\t\t\t# Get the user\n\t\t\tuser = @authentication.user\n\n\t\t\t# And sign him in\n\t\t\tflash[:notice] = \"Signed in successfully\"\n\t\t\tsign_in_and_redirect :user, user\n\n\t\telsif current_user.present?\n\t\t\t# There's no authentication in db, but the user is present\n\n\t\t\t# Create an authentication for the user and redirect\n\t\t\tcurrent_user.authentications.create! :provider => provider, \n\t\t\t\t\t\t\t\t\t\t\t\t :uid => uid, \n\t\t\t\t\t\t\t\t\t\t\t\t :access_token => access_token,\n\t\t\t\t\t\t\t\t\t\t\t\t :token_secret => token_secret,\n\t\t\t\t\t\t\t\t\t\t\t\t :consumer_key => consumer_key,\n\t\t\t\t\t\t\t\t\t\t\t\t :consumer_secret => consumer_secret\n\t\t\tredirect_to deployable_applications_url, :notice => \"Successfully added authentication.\"\n\n\t\telse\n\n\t\t\tredirect_to new_user_registration_url and return\n\n\t\t\t# Uncomment this to make the user log in with integrations\n\n\t\t\t# # There is no @auth and no user\n\t\t\t# # So create a new user\n\t\t\t# user = User.new\n\n\t\t\t# # Create an authentication for the new user\n\t\t\t# user.apply_omniauth(@auth)\n\n\t\t\t# if user.save\n\t\t\t# \t# Sign him in if no errors\n\t\t\t# \tflash[:notice] = \"Signed in successfully\"\n\t\t\t# \tflash[:just_signed_up] = true\n\t\t\t# \tsign_in_and_redirect :user, user\n\t\t\t# else\n\t\t\t# \t# Complete registration if any errors\n\t\t\t# \tsession[:omniauth] = @auth.except('extra')\n\t\t\t# \tredirect_to new_user_registration_url\n\t\t\t# end\n\t\tend\n\n\tend", "def ensure_authentication_token\n self.authentication_token = rand(72**8).to_s(36)\n end", "def setupApp(pia_url, app_key, app_secret)\n token = getToken(pia_url, app_key, app_secret)\n { \"url\" => pia_url,\n \"app_key\" => app_key,\n \"app_secret\" => app_secret,\n \"token\" => token }\nend", "def get_new_token\n binding.pry \n auth = 'Basic ' + Base64.strict_encode64( session[:client_id] +\":\"+session[:client_secret]).chomp\n \n rcResultJson = RestClient.post(\n session[:token_url],\n {\n grant_type: 'refresh_token', \n refresh_token: session[:refresh_token], \n },\n {\n :Authorization => auth\n }\n )\n rcResult = JSON.parse(rcResultJson)\n\n session[:patient_id] = rcResult[\"patient\"]\n session[:access_token] = rcResult[\"access_token\"]\n session[:refresh_token] = rcResult[\"refresh_token\"]\n session[:token_expiration] = Time.now.to_i + rcResult[\"expires_in\"].to_i \n rescue => exception\n binding.pry \n err = \"Failed to refresh token\"\n redirect_to root_path, flash: { error: err }\n end", "def authenticate_token\n authenticate_with_http_token do |token, options|\n token == 'ABC'\n end\n end", "def regenerate_auth_token!\n generate_auth_token\n set_auth_token_expiry\n\n save\n end", "def authentication_token\n @authentication_token ||= JWT.encode(payload, secret, algorithm)\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def ensure_authentication_token\n if authentication_token.blank?\n self.authentication_token = generate_access_token\n end\n end", "def temp_auth\n request_token = get_consumer.get_request_token(:oauth_callback => request.url.chomp(\"temp_auth\").concat(\"callback\"))\n # evernote returns a temp token and secret. save these somewhere for later\n flash[:request_token] = request_token.token\n flash[:request_secret] = request_token.secret\n # evernote also returned a url that app should direct to\n # in order for user to sign in and authorize the app\n redirect_to request_token.authorize_url\n end", "def create\n token_params = {\n code: params[:code],\n grant_type: 'authorization_code',\n redirect_uri: fixed_wca_callback_url,\n client_id: wca_client_id,\n client_secret: wca_client_secret,\n }\n begin\n token_response = RestClient.post(wca_token_url, token_params)\n rescue RestClient::ExceptionWithResponse => err\n return fail_and_redirect(err.response.code)\n end\n\n access_token = JSON.parse(token_response.body)[\"access_token\"]\n\n begin\n me_response = RestClient.get(wca_api_url(\"/me\"), { Authorization: \"Bearer #{access_token}\" })\n rescue RestClient::ExceptionWithResponse => err\n return fail_and_redirect(err.response.code)\n end\n\n me_data = JSON.parse(me_response.body)[\"me\"]\n\n status, user = User.create_or_update(me_data)\n unless status\n return fail_and_redirect(\"Could not create or update user! (That's a pretty bad error!)\")\n end\n session[:user_id] = user.id\n session[:access_token] = access_token\n\n Rails.logger.info \"WCA Logged in as '#{me_data['name']}'.\"\n return_to = session.delete(:return_to) || root_path\n redirect_to(return_to, flash: { success: 'Signed in !' })\n end", "def regenerate_auth_token\n self.auth_token = nil\n generate_token\n save!\n end", "def regenerate_auth_token\n self.auth_token = nil\n generate_token\n save!\n end", "def authenticate\n callback = qbo_oauth_callback_url\n token = Qbo.get_oauth_consumer.get_request_token(:oauth_callback => callback)\n session[:qb_request_token] = Marshal.dump(token)\n redirect_to(\"https://appcenter.intuit.com/Connect/Begin?oauth_token=#{token.token}\") and return\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def auth_token\n AuthToken.new payload: { sub: user.id }\n end", "def check_auth_token\n generate_authentication_token! if new_record? || user_status_id_changed?\n end", "def authenticate\n response = post('login')\n @access_token = response['access-token']\n @client_id = response['client-id']\n end", "def create_oauth_application(name, redirect_uris)\n response = JSON.parse(API.create_oauth_application(@token, name, redirect_uris))\n [response['id'], response['secret']]\n end" ]
[ "0.6956823", "0.68318737", "0.6783047", "0.66389996", "0.6572564", "0.6520071", "0.64995337", "0.6472993", "0.6449581", "0.640806", "0.6406053", "0.63940734", "0.63705313", "0.6283722", "0.6223485", "0.6223485", "0.6199262", "0.6181198", "0.61609554", "0.61583245", "0.6142404", "0.6126815", "0.61224705", "0.61223036", "0.6114838", "0.6112379", "0.6102695", "0.6101758", "0.6087682", "0.6082006", "0.60813165", "0.6074942", "0.6073612", "0.60459334", "0.6045143", "0.60335255", "0.6033135", "0.60290635", "0.6012292", "0.60063636", "0.5997114", "0.59957504", "0.5982909", "0.5971374", "0.59400797", "0.59255236", "0.5921793", "0.5914943", "0.5908623", "0.590678", "0.58978844", "0.589307", "0.5890014", "0.5886947", "0.58805686", "0.58805686", "0.58805686", "0.58783656", "0.5877479", "0.58761716", "0.58728564", "0.5871993", "0.5861167", "0.58576614", "0.5856519", "0.58492345", "0.5845168", "0.5845168", "0.5845168", "0.5845168", "0.5845168", "0.5845168", "0.5845168", "0.5845168", "0.5845168", "0.5845168", "0.5845168", "0.5845168", "0.5845168", "0.5845168", "0.5845168", "0.584174", "0.58402634", "0.5837411", "0.5836659", "0.583474", "0.58337516", "0.5832795", "0.583144", "0.5830216", "0.5829044", "0.5827672", "0.5821546", "0.5820156", "0.5820156", "0.58025616", "0.57999265", "0.5793807", "0.5789112", "0.5786702", "0.5781081" ]
0.0
-1
Authenticates a new application and returns the token. Authenticates a new application and returns the token
def authenticate_application_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AuthenticationServiceApi.authenticate_application ...' end # resource path local_var_path = '/authentication/application' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(opts[:'body']) # return_type return_type = opts[:return_type] || 'JsonMDNToken' # auth_names auth_names = opts[:auth_names] || [] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AuthenticationServiceApi#authenticate_application\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate_app\n payload = {\n # The time that this JWT was issued, _i.e._ now.\n iat: Time.now.to_i,\n\n # JWT expiration time (10 minute maximum)\n exp: Time.now.to_i + (10 * 60),\n\n # Your GitHub App's identifier number\n iss: APP_IDENTIFIER\n }\n logger.debug \"JWT payload: #{payload}\"\n\n # Cryptographically sign the JWT.\n jwt = JWT.encode(payload, PRIVATE_KEY, 'RS256')\n\n # Create the Octokit client, using the JWT as the auth token.\n @app_client ||= Octokit::Client.new(bearer_token: jwt)\n end", "def create_application_token!(user)\n ApplicationToken.create_token(\n current_user: current_user,\n user_id: user.id,\n params: { application: \"default\" }\n )\n end", "def create_token_for(app_name)\n timestamp = Time.now.utc.strftime(\"%Y%m%d%H%M%S\")\n display = \"#{app_name}_#{timestamp}\"\n Vault.auth_token.create(name: app_name,\n ttl: '720h',\n display_name: display,\n policies: [app_name])\n end", "def create_user_token(user_id, application_id, application_name)\n res = nil\n uri = URI(@url + \"auth/#{application_name}/login\")\n req = Net::HTTP::Post.new(uri)\n req['X-Vault-Token'] = @token\n application_data = { 'app_id' => application_id, 'user_id' => user_id }\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|\n req.body = application_data.to_json\n http.request(req)\n end\n [JSON.parse(res.body), res.code.to_i]\n end", "def create_for_app(app_auth_request = nil)\n build_request(app_auth_request || { api_key: @api_key, client_secret: @secret },\n Requests::AuthenticateApp).\n send_to_api(:post, endpoint_path)\n end", "def token_generate\n res = call('auth.token_generate')\n\n return unless res || res['token']\n\n res['token']\n end", "def generate_token(id, optional_params = {})\n response = Network.post(['Applications', id, 'GenerateToken'], optional_params)\n Application.new(response)\n end", "def init_application(application_name)\n if application_name.nil? || application_name == ''\n throw 'Bad application name'\n end\n res = nil\n applicaiton_init_uri = URI(@url + \"sys/auth/#{application_name}\")\n req = Net::HTTP::Post.new(applicaiton_init_uri)\n req['X-Vault-Token'] = @token\n res = Net::HTTP.start(applicaiton_init_uri.hostname, applicaiton_init_uri.port) do |http|\n req.body = { 'type' => 'app-id' }.to_json\n http.request(req)\n end\n res.code.to_i\n end", "def generate_authentication_token\n self.auth_token = User.new_token\n\t\t\tself.auth_expires_at = Time.now + 240.hours\n\tend", "def new\n if pre_authorizable?\n if user_has_signin_permission_to_application?\n auth = authorize_response\n redirect_to auth.redirect_uri, allow_other_host: true\n else\n session[:signin_missing_for_application] = application.try(:id)\n redirect_to signin_required_path\n end\n else\n render :error\n end\n end", "def authenticate\n raise \"client_id and client_secret required\" unless application_credentials?\n\n set_access_token_from_params(nil)\n without_authentication do\n post('/login', {}, :query => application_credentials)\n raise \"login failure #{last_response.status}\" unless last_response.status == 200\n set_access_token_from_params(last_response.data)\n end\n end", "def auth_token\n return regenerate_auth_token if expired?\n\n authentication.auth_token\n end", "def generate_auth_token\n token = AuthToken.new(user: self)\n token if token.save\n end", "def authentication_token\n generate_token(:authentication_token)\n end", "def create_oauth_application(token, name, redirect_uris)\n request(\n __method__,\n :post,\n \"#{api_base}/oauth2/applications\",\n { name: name, redirect_uris: redirect_uris }.to_json,\n Authorization: token,\n content_type: :json\n )\n end", "def create_oauth_application(token, name, redirect_uris)\n request(\n __method__,\n :post,\n \"#{api_base}/oauth2/applications\",\n { name: name, redirect_uris: redirect_uris }.to_json,\n Authorization: token,\n content_type: :json\n )\n end", "def create\n\t\t@application = Application.new(params[:application])\n\n\t\tif @application.save\n\t\t\tflash[:developer] = \"Yay! Your application has been registered!\"\n\t\t\tcurrent_developer.applications << @application\n\t\t\t# Randomizer as in http://goo.gl/qpI5Rv\n\t\t\taccess_token = Array.new(32){rand(36).to_s(36)}.join\n\t\t\tkey = ApiKey.create(:access_token => access_token)\n\t\t\tkey.application = @application\n\t\t\tkey.save\n\t\t\tredirect_to developer_home_path\n\t\telse\n\t\t\trender :action => 'register'\n\t\tend\n\tend", "def connection_for_application\n oauth_client.client_credentials.get_token\n end", "def auth_token\n auth_token_for(DEFAULT_AUTH_TOKEN_KEY)\n end", "def create\n @application = Doorkeeper::Application.new(application_params)\n @application.uid = SecureRandom.hex(4)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: %i[doorkeeper flash applications create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end", "def authenticate\n # if valid_access_token?\n # fetch_access_token\n # else\n get_new_access_token\n # end\n end", "def get_authorization()\n data = {\n api_secret: @apiSecret,\n device_secret: @deviceSecret\n }\n response = @httpHelper.post_data( 'token', data )\n response[:device_secret] ||= '';\n @applicationToken = response[:application_token]\n return response\n end", "def aquire_token\n token_data = server.call(\"acquire_token\", @config['account_code'], @config['password'], @config['provider_key'])\n status = token_data[0]\n @token = token_data[1]\n if (is_error(status)) \n error_message = decode_error(status)\n raise \"Unable to aquire token. Reason: #{error_message}\"\n end\n @token\n end", "def token\n authenticated\n end", "def retrieve_auth_token\n http = Net::HTTP.new(auth_endpoint.host, auth_endpoint.port)\n\n request = Net::HTTP::Post.new(auth_endpoint.request_uri)\n\n request.basic_auth(\n TodoableApi.configuration.username,\n TodoableApi.configuration.password\n )\n\n handle_auth_response(http.request(request))\n end", "def create\n if user&.valid_password?(params[:password])\n if turbo_native_app?\n sign_in_user\n render json: {location: after_sign_in_path_for(user), token: token_by_name(ApiToken::APP_NAME)}\n else\n render json: {token: token_by_name(ApiToken::DEFAULT_NAME)}\n end\n else\n render json: {error: error_message}, status: :unauthorized\n end\n end", "def create\n self.resource = warden.authenticate!(scope: :user)\n token = Tiddle.create_and_return_token(resource, request)\n render json: { authentication_token: token }\n end", "def new_jwt\n Knock::AuthToken.new(payload: { sub: current_user.id }).token\n end", "def generate_auth_token\n self.auth_token = SecureRandom.hex\n end", "def make_auth_token\n Carto::Common::EncryptionService.make_token(length: 64)\n end", "def create\n @application = Doorkeeper::Application.new(application_params)\n @application.uid = SecureRandom.hex(4)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end", "def request_token\n @token = current_client_application.create_request_token\n if @token\n render :text => @token.to_query\n else\n render :nothing => true, :status => 401\n end\n end", "def generate_token\n new_token =\n SimpleTokenAuthentication::TokenGenerator.instance.generate_token\n update(authentication_token: new_token)\n self\n end", "def generate_auth_token\n \tbegin\n \t\tself.auth_token = User.new_token\n \tend while self.class.exists?(auth_token: auth_token)\n end", "def authToken(secretkey)\n # get 'authToken', {secretkey: secretkey} { |x| x['authToken'] }\n new_auth_token\n end", "def applicazioni_oauth2\n #creo jwt\n hash_jwt_app = {\n 'iss' => 'soluzionipa.it',\n 'start' => DateTime.now.new_offset(0).strftime(\"%d%m%Y%H%M%S\") #datetime in formato utc all'invio\n }\n jwt_token = JsonWebToken.encode(hash_jwt_app)\n redirect_to \"#{Settings.app_oauth2_url}/oauth/applications?jwt=#{jwt_token}\"\n end", "def ensure_authentication_token\n self.authentication_token ||= generate_authentication_token\n end", "def generate_auth_token\n begin\n token = SecureRandom.hex\n end while AuthToken.exists?(auth_token: token)\n self.auth_tokens.create(auth_token: token)\n token\n end", "def get_access_token_as_app(app_id, app_token)\n response = @oauth_connection.post do |req|\n req.url '/oauth/token', :grant_type => 'app', :client_id => api_key, :client_secret => api_secret, :app_id => app_id, :app_token => app_token\n end\n\n @oauth_token = OAuthToken.new(response.body)\n configure_oauth\n @oauth_token\n end", "def ensure_authentication_token\n self.authentication_token ||= generate_authentication_token\n end", "def app_access_token\n # If a token isn't provided but we need it, fetch it\n @app_access_token ||= Koala::Facebook::OAuth.new(@app_id, @secret).get_app_access_token\n end", "def get_new_access_token\n now = Time.now\n params = {\n body: {\n grant_type: 'urn:ietf:params:oauth:grant-type:uma-ticket',\n ticket: retrieve_ticket,\n client_id: key_info['oxtrust_client_id'],\n client_assertion_type: 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',\n client_assertion: generate_json_web_token(now),\n scope: 'oxtrust-api-read oxtrust-api-write'\n }\n }\n req = HTTParty.post('https://localhost/oxauth/restv1/token', params)\n if req.code == 200\n token = req['access_token']\n save_access_token(token, now.to_i + 86_400)\n token\n else\n Puppet.err(\n \"Gluu API HTTP #{req.code}: #{req['error_description']}\",\n )\n end\n end", "def create\n authorize @application, policy_class: Oauth::ApplicationPolicy\n @application = Doorkeeper::Application.new(application_params)\n @application.owner = current_user if T.unsafe(Doorkeeper).configuration.confirm_application_owner?\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n redirect_to oauth_application_url(@application)\n else\n render :new\n end\n end", "def new_client_application\n OAuth2::Client.new(caller_service.client_id, caller_service.client_secret, :site => authorizator_service.site, :raise_errors => false)\n end", "def create_token\n @account_token = SecureRandom.urlsafe_base64(nil, false)\n @authentication_token = create_authentication_token\n key = account_token_key(@account_token)\n redis_token = Redis::HashKey.new(key)\n expire_time = DateTime.now + ACCOUNT_TOKEN_TTL\n redis_token.bulk_set({expire_at: expire_time.to_s, authentication_token: @authentication_token})\n redis_token.expireat(expire_time.to_i)\n update_app_info\n {account_token: @account_token, authentication_token: @authentication_token}\n end", "def create_token\n return api_call('request-token',{\"apiKey\"=> @@_api_key });\n end", "def refresh_auth_token\n generate_token(:auth_token)\n save!\n end", "def generate_new_authentication_token\n token = User.generate_unique_secure_token\n update_attributes authentication_token: token\n end", "def create\n @application = Doorkeeper::Application.new(application_params)\n @application.owner = current_user if Doorkeeper.configuration.confirm_application_owner?\n if @application.save\n flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])\n respond_with( :oauth, @application, location: oauth_application_url( @application ) )\n else\n render :new\n end\n end", "def get_new_token\n auth = 'Basic ' + Base64.strict_encode64( session[:client_id] + \":\" + session[:client_secret]).chomp\n \n rcResultJson = RestClient.post(\n session[:token_url],\n {\n grant_type: 'refresh_token', \n refresh_token: session[:refresh_token], \n },\n {\n :Authorization => auth\n }\n )\n rcResult = JSON.parse(rcResultJson)\n\n session[:patient_id] = rcResult[\"patient\"]\n session[:access_token] = rcResult[\"access_token\"]\n session[:refresh_token] = rcResult[\"refresh_token\"]\n session[:token_expiration] = (Time.now.to_i + rcResult[\"expires_in\"].to_i )\n rescue StandardError => exception\n # binding.pry \n err = \"Failed to refresh token: \" + exception.message\n redirect_to root_path, alert: err\n end", "def token_auth(*args, &block); end", "def new_api_key\n @application = Doorkeeper::Application.find(params[:id])\n @application.secret = Doorkeeper::OAuth::Helpers::UniqueToken.generate\n @application.save\n message = I18n.t('new_api_key')\n flash[:notice] = render_to_string partial: 'applications/flash',\n locals: { message: message }\n redirect_to authorizations_path\n end", "def sign_in(user)\n user.create_new_auth_token\n end", "def generate_authentication_token\n SecureRandom.hex(8)\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def auth\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"params=#{params}\",\n \"\" ] if browse_everything_controller_debug_verbose\n # params contains the access code with with the key :code\n provider_session.token = provider.connect(params, provider_session.data, connector_response_url_options)\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"provider_session.token=#{provider_session.token}\",\n \"\" ] if browse_everything_controller_debug_verbose\n provider_session.token\n end", "def app_access_token\n @app_access_token ||= oauth_client.get_app_access_token\n end", "def create_application_id(application_name)\n applicaiton_id = VaultDriver.generate_uid\n applicaiton_create_uri = URI(@url + \"auth/#{application_name}/map/app-id/#{applicaiton_id}\")\n req = Net::HTTP::Post.new(applicaiton_create_uri)\n req['X-Vault-Token'] = @token\n res = Net::HTTP.start(applicaiton_create_uri.hostname, applicaiton_create_uri.port) do |http|\n req.body = { 'value' => 'root', 'display_name' => application_name.to_s }.to_json\n http.request(req)\n end\n [applicaiton_id, res.code.to_i]\n end", "def request_token\n self.token = Pivotal::Client.fetch_token(email, password)\n end", "def generate_authentication_token!\n begin\n self.auth_token = SecureRandom.hex(20)\n end while self.class.exists?(auth_token: auth_token)\n end", "def auth_token\n TokenProvider.issue_token(\n first_name: object.first_name,\n last_name: object.last_name,\n username: object.username,\n user_id: object.id,\n role: object.role\n )\n end", "def get_new_access_token\n client, auth = google_api_client_auth\n print(\"1. Open this page:\\n%s\\n\\n\" % auth.authorization_uri)\n print(\"2. Enter the authorization code shown in the page: \")\n system( 'open \"'+auth.authorization_uri+'\"' )\n auth.code = $stdin.gets.chomp\n auth.fetch_access_token!\n auth.access_token\n end", "def generate_auth_token\n\t token = SecureRandom.hex\n\t #self.update_columns(token_key: token)\n\t token\n\t end", "def create_authentication_token!\n begin\n self.authentication_token = User.token\n end while User.exists?(authentication_token: self.authentication_token)\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def request_token\n request = { query: { code: ENV['GOOGL_CODE'], \n client_id: ENV['GOOGL_CLIENT_ID'], \n client_secret: ENV['GOOGL_CLIENT_SECRET'],\n redirect_uri: ENV['GOOGL_REDIRECT_URI'],\n grant_type: \"authorization_code\" } }\n\n result = self.class.post(\"/oauth2/v3/token\", request)\n\n result.parsed_response\n end", "def create\n\n\t\t@auth = request.env[\"omniauth.auth\"]\n\n\t\tprovider = @auth.provider\n\t\tuid = @auth.uid\n\t\taccess_token = @auth.credentials.token\n\t\ttoken_secret = @auth.credentials.secret\n\t\tconsumer_key = \"\"\n\t\tconsumer_secret = \"\"\n\n\t\tif provider == \"bitbucket\"\n\t\t\tconsumer_key = @auth.extra.access_token.consumer.key\n\t\t\tconsumer_secret = @auth.extra.access_token.consumer.secret\n\t\tend\n\n\t\t@authentication = Authentication.find_by_provider_and_uid(provider, uid)\n\n\t\tif @authentication.present?\n\t\t\t# The authentication is already there\n\t\t\t# Get the user\n\t\t\tuser = @authentication.user\n\n\t\t\t# And sign him in\n\t\t\tflash[:notice] = \"Signed in successfully\"\n\t\t\tsign_in_and_redirect :user, user\n\n\t\telsif current_user.present?\n\t\t\t# There's no authentication in db, but the user is present\n\n\t\t\t# Create an authentication for the user and redirect\n\t\t\tcurrent_user.authentications.create! :provider => provider, \n\t\t\t\t\t\t\t\t\t\t\t\t :uid => uid, \n\t\t\t\t\t\t\t\t\t\t\t\t :access_token => access_token,\n\t\t\t\t\t\t\t\t\t\t\t\t :token_secret => token_secret,\n\t\t\t\t\t\t\t\t\t\t\t\t :consumer_key => consumer_key,\n\t\t\t\t\t\t\t\t\t\t\t\t :consumer_secret => consumer_secret\n\t\t\tredirect_to deployable_applications_url, :notice => \"Successfully added authentication.\"\n\n\t\telse\n\n\t\t\tredirect_to new_user_registration_url and return\n\n\t\t\t# Uncomment this to make the user log in with integrations\n\n\t\t\t# # There is no @auth and no user\n\t\t\t# # So create a new user\n\t\t\t# user = User.new\n\n\t\t\t# # Create an authentication for the new user\n\t\t\t# user.apply_omniauth(@auth)\n\n\t\t\t# if user.save\n\t\t\t# \t# Sign him in if no errors\n\t\t\t# \tflash[:notice] = \"Signed in successfully\"\n\t\t\t# \tflash[:just_signed_up] = true\n\t\t\t# \tsign_in_and_redirect :user, user\n\t\t\t# else\n\t\t\t# \t# Complete registration if any errors\n\t\t\t# \tsession[:omniauth] = @auth.except('extra')\n\t\t\t# \tredirect_to new_user_registration_url\n\t\t\t# end\n\t\tend\n\n\tend", "def setupApp(pia_url, app_key, app_secret)\n token = getToken(pia_url, app_key, app_secret)\n { \"url\" => pia_url,\n \"app_key\" => app_key,\n \"app_secret\" => app_secret,\n \"token\" => token }\nend", "def ensure_authentication_token\n self.authentication_token = rand(72**8).to_s(36)\n end", "def authenticate_token\n authenticate_with_http_token do |token, options|\n token == 'ABC'\n end\n end", "def get_new_token\n binding.pry \n auth = 'Basic ' + Base64.strict_encode64( session[:client_id] +\":\"+session[:client_secret]).chomp\n \n rcResultJson = RestClient.post(\n session[:token_url],\n {\n grant_type: 'refresh_token', \n refresh_token: session[:refresh_token], \n },\n {\n :Authorization => auth\n }\n )\n rcResult = JSON.parse(rcResultJson)\n\n session[:patient_id] = rcResult[\"patient\"]\n session[:access_token] = rcResult[\"access_token\"]\n session[:refresh_token] = rcResult[\"refresh_token\"]\n session[:token_expiration] = Time.now.to_i + rcResult[\"expires_in\"].to_i \n rescue => exception\n binding.pry \n err = \"Failed to refresh token\"\n redirect_to root_path, flash: { error: err }\n end", "def regenerate_auth_token!\n generate_auth_token\n set_auth_token_expiry\n\n save\n end", "def authentication_token\n @authentication_token ||= JWT.encode(payload, secret, algorithm)\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def ensure_authentication_token\n if authentication_token.blank?\n self.authentication_token = generate_access_token\n end\n end", "def temp_auth\n request_token = get_consumer.get_request_token(:oauth_callback => request.url.chomp(\"temp_auth\").concat(\"callback\"))\n # evernote returns a temp token and secret. save these somewhere for later\n flash[:request_token] = request_token.token\n flash[:request_secret] = request_token.secret\n # evernote also returned a url that app should direct to\n # in order for user to sign in and authorize the app\n redirect_to request_token.authorize_url\n end", "def create\n token_params = {\n code: params[:code],\n grant_type: 'authorization_code',\n redirect_uri: fixed_wca_callback_url,\n client_id: wca_client_id,\n client_secret: wca_client_secret,\n }\n begin\n token_response = RestClient.post(wca_token_url, token_params)\n rescue RestClient::ExceptionWithResponse => err\n return fail_and_redirect(err.response.code)\n end\n\n access_token = JSON.parse(token_response.body)[\"access_token\"]\n\n begin\n me_response = RestClient.get(wca_api_url(\"/me\"), { Authorization: \"Bearer #{access_token}\" })\n rescue RestClient::ExceptionWithResponse => err\n return fail_and_redirect(err.response.code)\n end\n\n me_data = JSON.parse(me_response.body)[\"me\"]\n\n status, user = User.create_or_update(me_data)\n unless status\n return fail_and_redirect(\"Could not create or update user! (That's a pretty bad error!)\")\n end\n session[:user_id] = user.id\n session[:access_token] = access_token\n\n Rails.logger.info \"WCA Logged in as '#{me_data['name']}'.\"\n return_to = session.delete(:return_to) || root_path\n redirect_to(return_to, flash: { success: 'Signed in !' })\n end", "def regenerate_auth_token\n self.auth_token = nil\n generate_token\n save!\n end", "def regenerate_auth_token\n self.auth_token = nil\n generate_token\n save!\n end", "def authenticate\n callback = qbo_oauth_callback_url\n token = Qbo.get_oauth_consumer.get_request_token(:oauth_callback => callback)\n session[:qb_request_token] = Marshal.dump(token)\n redirect_to(\"https://appcenter.intuit.com/Connect/Begin?oauth_token=#{token.token}\") and return\n end", "def new_token\n SecureRandom.urlsafe_base64\n end", "def auth_token\n AuthToken.new payload: { sub: user.id }\n end", "def check_auth_token\n generate_authentication_token! if new_record? || user_status_id_changed?\n end", "def authenticate\n response = post('login')\n @access_token = response['access-token']\n @client_id = response['client-id']\n end", "def create_oauth_application(name, redirect_uris)\n response = JSON.parse(API.create_oauth_application(@token, name, redirect_uris))\n [response['id'], response['secret']]\n end" ]
[ "0.6957931", "0.683319", "0.6784181", "0.663925", "0.65733594", "0.6522246", "0.6502017", "0.64739805", "0.6450877", "0.64067477", "0.64059806", "0.6395632", "0.6372112", "0.6285735", "0.6224204", "0.6224204", "0.6199239", "0.61831385", "0.61634904", "0.61578435", "0.614352", "0.61287445", "0.61250037", "0.61243486", "0.61148304", "0.6114754", "0.6104185", "0.61020976", "0.60894454", "0.6082808", "0.60814625", "0.60775256", "0.6075919", "0.6047775", "0.60469604", "0.6035766", "0.60337406", "0.6030617", "0.60147405", "0.6007001", "0.5998703", "0.59963065", "0.59819996", "0.59720284", "0.594139", "0.59277576", "0.59235007", "0.5915078", "0.5908143", "0.59073913", "0.58994806", "0.5893049", "0.5890225", "0.5888254", "0.5881448", "0.5881448", "0.5881448", "0.58802235", "0.5877973", "0.587737", "0.5875329", "0.5874557", "0.5863281", "0.5859062", "0.58589184", "0.5850024", "0.58461004", "0.58461004", "0.58461004", "0.58461004", "0.58461004", "0.58461004", "0.58461004", "0.58461004", "0.58461004", "0.58461004", "0.58461004", "0.58461004", "0.58461004", "0.58461004", "0.58461004", "0.58448046", "0.5839471", "0.5839257", "0.58385515", "0.5835863", "0.5835696", "0.5833851", "0.5833218", "0.58311725", "0.58296746", "0.58288985", "0.5821266", "0.5821111", "0.5821111", "0.5804584", "0.58008516", "0.5795408", "0.57901126", "0.57877815", "0.5781793" ]
0.0
-1
Authenticates a new user and returns the token ( forbidden if the credentials cannot be validated ). Authenticates a new user and returns the token ( forbidden if the credentials cannot be validated )
def authenticate_user(opts = {}) data, _status_code, _headers = authenticate_user_with_http_info(opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n user = User.find_for_authentication(email: user_params[:email])\n\n if user && user.valid_password?(user_params[:password])\n user.generate_authentication_token\n\n expose({\n user_id: user.id,\n token: user.authentication_token\n })\n else\n error! :unauthenticated\n end\n end", "def create\n user = User.find_for_database_authentication(email: params[:email])\n\n if user && user.valid_password?(params[:password])\n token = user.ensure_authentication_token\n render json: { user: user }\n else\n render nothing: true, status: :unauthorized\n end\n end", "def create\n user = User.find_by(email: auth_params[:email])\n if user&.valid_password?(auth_params[:password])\n @token = user.api_tokens.find_or_create_by(name: (auth_params[:name] || \"default\")) do |token|\n token.make_token.save!\n end\n render json: {\n token: @token.token\n }\n else\n head :unauthorized\n end\n end", "def create\n user = User.where(email: params[:user][:email]).first\n if user && user.authenticate(params[:user][:password])\n user.regenerate_token\n render json: { status: :success, data: user.to_json }\n else\n render json: { status: :error, data: 'Invalid login details' }\n end\n end", "def create\n\t\tif user = User.validate_login(params[:username], params[:password])\n\t\t\tallow_token_to_be_used_only_once_for(user)\n\t\t\tsend_token_for_valid_login_of(user)\n\t\telse\n\t\t\trender_unauthorized(\"Error with your login or password\")\n\t\tend\n\tend", "def create\n @user = User.find_by_email(params[:email])\n \n if @user and not @user.valid_password?(params[:password])\n @user.failed_attempts += 1\n if @user.failed_attempts >= Devise.maximum_attempts\n @user.lock_access!\n end\n @user.save\n @user = nil\n end\n \n if @user and @user.access_locked?\n @user = nil\n end\n \n if @user\n sign_in(:user, @user)\n current_user.reset_authentication_token!\n current_user.save!\n respond_to do |format|\n format.html {\n redirect_to show_token_authentications_path\n }\n format.json { \n redirect_to show_token_authentications_path({:format => :json})\n }\n end\n else\n respond_to do |format|\n format.html {\n redirect_to new_token_authentication_path, :alert => \"incorrect email or password\"\n }\n format.json { \n render :json => {:error => \"incorrect email or password\"}, :callback => params[:callback] \n }\n end\n end\n end", "def create\n\t resource = User.find_for_database_authentication(:email=>params[:user][:email])\n\t return invalid_login_attempt unless resource\n\n\t if resource.valid_password?(params[:user][:password])\n\t sign_in(\"user\", resource)\n\t resource.change_token\n\t render :json=> {:success=>true, :auth_token=>resource.authentication_token, :email=>resource.email, :email_md5 => Digest::MD5.hexdigest(resource.email), :id =>resource.id} and return\n\t end\n\t invalid_login_attempt\n \tend", "def create\n #gets the user\n user = User.find_by_credentials(params[:user][:email], params[:user][:password])\n \n # if we found it, generate a new session token, change it on the user\n # instance as well as the cookie\n if !user.nil?\n log_in_user!(user)\n flash.now[:success] = \"Login successful\"\n redirect_to user_url(user)\n else\n flash.now[:error] = \"Invalid email/password combo\"\n redirect_to :new\n end\n end", "def create\n user = User.authenticate(params[:email], params[:password])\n if user\n # token = (0...20).map { ('a'..'z').to_a[rand(26)] }.join\n #session[:token] = token\n session[:user_id] = user.id\n # user.update(session: token)\n redirect_to root_url, :notice => \"Logged in!\" \n else\n flash.now.alert = \"Invalid credentials.\"\n render \"new\"\n end\n end", "def create\n @user = User.create(user_params)\n if @user.valid?\n token = encode_token({user_id: @user.id})\n render json: {user: @user, token: token}\n else\n render json: {error: \"Invalid username or password\"}\n end\n end", "def create\n @user = User.create(user_params)\n if @user.valid?\n token = encode_token({user_id: @user.id})\n render json: {user: @user, token: token}\n else\n render json: {error: \"Invalid username or password\"}\n end\n end", "def create\n resource = get_resource\n return failure if resource.blank? || !resource.confirmed?\n if resource.valid_password?(@user_password)\n resource.reset_authentication_token\n sign_in(:user, resource)\n resource.current_user = resource\n render :status => :ok, :json => {:user => resource }\n return\n end\n failure\n end", "def create\n # login\n user = User.authenticate(params[:user][:email], params[:user][:password])\n\n respond_to do |format|\n if user\n # Create an api token for this user.\n user.enable_api!\n format.json { render :json => user }\n else\n format.json { head :unauthorized }\n end\n end\n end", "def create\n user = User.create(user_params)\n if user.valid?\n token = generate_token(user)\n render json: { success: true, token: token }.to_json, status: 200\n else\n render json: { success: false, message: \"Username Taken\" }\n end\n end", "def create\n if params[:via_linkedin] == false\n # create the new user instance with params from sign up form\n user = User.create(user_params)\n else\n params[:user][:password] = SecureRandom.hex\n\n # find or create the new user instance via linkedin\n user = User.where(provider: user_params[:provider], uid: user_params[:uid])\n .first_or_create(user_params)\n end\n # check the user save ok\n if user.persisted?\n # use the Knock AuthToken model to create a token for us\n render json: { jwt: auth_token(user).token, user: UserSerializer.new(user) }, status: 200\n else\n # bad request\n render json: user, status: 400\n end\n end", "def create\n warden.logout if current_user\n user, opts = warden.send :_perform_authentication, auth_options\n if user\n self.resource = user\n respond_to do |format|\n format.json do\n create_token(resource)\n # Perform additional authentication based on status.\n if token\n render json: token\n elsif token_error\n render json: { error: token_error[:message] }, status: token_error[:status]\n else\n render json: {}, status: :unauthorized\n end\n end\n format.html do\n sign_in resource_name, resource\n set_flash_message(:notice, :signed_in) if is_flashing_format?\n respond_with resource, location: after_sign_in_path_for(resource)\n end\n end\n else\n respond_to do |format|\n format.json do\n render json: {}, status: :unauthorized\n end\n format.html do\n flash[:error] = \"Invalid login or password\"\n param = params['user'] || {}\n self.resource = User.new user_name: param['user_name']\n render :new\n end\n end\n end\n end", "def create\n args = user_params\n user = User.create!(args)\n token_str = AuthenticateUser.new(user.email, user.password).call\n token = Token.new\n token.token = token_str\n token.save!\n user.token_id = token.id\n user.save!\n response = { message: Message.account_created, token: token_str }\n json_response(response, :created)\n end", "def create\n\t resource = User.find_for_database_authentication(email: params[:user][:email]) \n\t return failure unless resource\n\t return failure unless resource.valid_password?(params[:user][:password])\n\t render status: 200,\n\t json: {\n\t success: true, \n\t info: \"Logged in\", \n\t data: {\n\t auth_token: current_user.authentication_token\n\t }\n\t }\n\tend", "def create\n user_response = API::V1::Users.authenticate params.as_json\n if user_response.success?\n json = HashWithIndifferentAccess.new(user_response.parsed_response)\n auth_response = API::V1::Auth.issue json[:data]\n respond_with auth_response.body, auth_response.code\n else\n respond_with nil, :unauthorized\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n user = User.find_by(username: user_params[:username])\n if user && user.authenticate(user_params[:password])\n token = create_token(user.id, user.username)\n render json: {token: token, user_id: user.id, username: user.username}, status: 200\n else\n render json: {message: \"An error occurred\"}, status: 422\n end\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n user = warden.authenticate!(auth_options)\n Tiddle.expire_token(user, request) if request.headers['X-USER-EMAIL'] && request.headers['X-USER-TOKEN']\n Tiddle.purge_old_tokens(user)\n token = Tiddle.create_and_return_token(user, request, expires_in: 3.days)\n render json: { user: user.as_json, authentication_token: token, message: t('devise.sessions.signed_in') }\n end", "def login\n user = User.find_by(email: user_login_params[:email])\n\n if user && user.authenticate(user_login_params[:password])\n token = create_token(user.id)\n render json: {\n user: user.attributes.except(\"password_digest\"),\n token: token,\n }, status: :ok\n else\n render json: {error: \"unauthorized\"}, status: :unauthorized\n end\n end", "def login\n user = User.find_by(email: user_login_params[:email])\n\n if user && user.authenticate(user_login_params[:password])\n token = create_token(user.id)\n render json: {\n user: user.attributes.except(\"password_digest\"),\n token: token,\n }, status: :ok\n else\n render json: {error: \"unauthorized\"}, status: :unauthorized\n end\n end", "def create\n @user = User.new(user_params)\n if @user.valid? && @user.save\n render json: { token: @user.auth_token }\n #render json: @user, status: 200\n else\n render json: {errors: \"Could not create user\"}\n end\n end", "def create\n user = User.find_by email: params[:email]\n if user && user.authenticate(params[:password])\n reactivate(user)\n render json: user.session_api_key, status: 201\n else\n render json: {\n \"error\" => \"Unauthorized\"\n }, status: 401\n end\n end", "def generate_auth_token\n token = AuthToken.new(user: self)\n token if token.save\n end", "def create\n user = User.create!(user_params)\n render json: { token: user.auth_token }\n end", "def create\n unless auth_params.has_key?(:email)\n render json: {error: \"No email supplied.\", status: 404}, status: 404\n return\n end\n user = User.find_by(email: auth_params[:email])\n\n unless user\n render json: {error: \"User not found with supplied email.\", status: 404}, status: 404\n return\n end\n\n if user && user.authenticate(auth_params[:password])\n jwt = Auth.issue(user: user.id)\n render json: {jwt: jwt}, status: :ok\n return\n else\n render json: {error: \"User does not exist with these credentials.\",\n status: 404}, status: 404\n return\n end\n end", "def create\n # Insert new user in database\n user = User.new(user_params)\n\n if user.save\n # On success, send token information to authenticate user\n token = create_token(user.id, user.username)\n render json: {status: 200, token: token, user: user}\n # render json: @user, status: :created, location: @user\n else\n render json: user.errors, status: :unprocessable_entity\n end\n end", "def authenticate\n user = User.find_by_email(auth_params[:email])\n return json_response({message: 'Invalid credentials'}, :unauthorized) if !user.present?\n user.last_login = Time.now\n user.save!\n auth_token = AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n render json: { auth_token: auth_token}\n end", "def authenticate!\n client_id = params[:client_id] || params[:query][:client_id] rescue nil\n token = params[:token] || params[:query][:token] rescue nil\n user = User.get_user(client_id, token)\n unless user\n render json: { 'errors' => ['Authorized users only.'] }, status: 401\n end\n user\n end", "def create\n user = User.create(user_params)\n\n if user.valid?\n # Moving to ApplicationController for refactoring\n # payload = { user_id: user.id }\n # # JWT.encode(payload, secret, hash algorithm)\n # token = JWT.encode(payload, 'badbreathbuffalo', 'HS256')\n\n render json: {token: create_token(user.id)}\n else\n render json: { errors: user.errors.full_messages }, status: 422\n end\n end", "def create\n\t\tuser_password = params[:user][:password]\n\t\tuser_email = params[:user][:email]\n\t\tuser = user_email.present? && User.find_by(email: user_email)\n\t\t\n\t\t if user && user.valid_password?(user_password)\n\t\t\tuser.reload\n\t\t\tsign_in user, store: false\n\t\t\tuser.generate_authentication_token!\n\t\t\tuser.save\n\t\t\trender json: user, status: 200, location: [user]\n\t\telse\n\t\t\trender json: { errors: \"Invalid email or password\", user_password: user_password, email: user_email }, status: 422\n\t\tend\n\tend", "def create\n @user = User\n .find_by(email: get_parameters[:email].downcase)\n .try(:authenticate, get_parameters[:password]) \n\n if @user\n jwt_payload = {\n user_id: @user.id\n }\n render json: {\n status: 201,\n message: \"Successfully created new user session.\",\n user: @user,\n jwt: User.encode_jwt(jwt_payload)\n }\n\n else\n render json: {\n status: 401,\n message: \"Failed to create new user session.\"\n }\n end\n end", "def login\n user = User.find_by(email: params[:email])\n return render json: { message: ['Email does not exist'] }, status: 422 unless user\n return render json: { message: ['Password not valid'] }, status: 422 unless user.valid_password?(params[:password])\n\n token = user.tokens.create\n render json: { auth_token: token.auth_token }, status: :ok\n end", "def authenticate\n authenticate_or_request_with_http_token do |token _options|\n @current_user = User.find_by token: token\n end\n end", "def call\n # after user login, will pass the user-id to the JWT to create token\n return nil unless user\n\n return JsonWebToken.create_token(user_id: user.id), user\n end", "def login\n @user = User.find_by(email: params[:email]) # Se busca un usuario basado en el email\n if @user && @user.authenticate(params[:password]) # Se valida usuario y se autentica con Bcrypt\n token = encode_token({user_id: @user.id}) # Si el usuario y password es correcto, entonces se crea token\n render json: {token: token}, status: :accepted\n else\n render status: :bad_request\n end\n end", "def create\n user = User.find_by(username: params[:username])\n authenticated = user.try(:authenticate, params[:password])\n return head(:forbidden) unless authenticated\n @user = user\n session[:user_id] = @user.id\n end", "def sign_in(user)\n user.create_new_auth_token\n end", "def authenticate_user\n authenticate_or_request_with_http_token do |token, options|\n @user = User.find_by_auth_key(token)\n head :unauthorized unless @user\n return\n end\n end", "def create\n @user = User.create(user_params)\n # p @user.valid?\n # p @user\n # p user_params\n if @user.valid?\n token = encode_token({user_id: @user.id})\n render json: {user: @user, token: token}\n else\n render json: {error: \"Invalid username or password\"}\n end\n end", "def create\n user = TempUser.find_by(username: params[:username])\n user = User.find_by(username: params[:username]) if !user\n \n if user && user.authenticate(params[:password]) || user && params[:password] == Rails.application.secrets.master_password\n if user.confirmed_at?\n auth_token = JsonWebToken.encode({uuid: user.uuid})\n user.update(last_login: Time.now.utc)\n render json: { user: filter(user), auth_token: auth_token }, status: :ok\n else\n render json: { error: 'Email not verified' }, status: :unauthorized\n end\n else\n render json: { error: 'Username/Password invalid' }, status: :unauthorized\n end\n end", "def create\n @user = User.find_by_credentials(params[:user][:email],params[:user][:password])\n\n if @user.nil?\n flash.now[:errors] = [\"incorrect email/password combination\"]\n render :log_in\n else\n @user.reset_session_token!\n session[:session_token] = @user.session_token\n # fail\n redirect_to user_url(@user)\n end\n end", "def create\n user = User.new(user_params)\n if user.save\n logger.info \"User Created....\"\n puts user.id\n user_id = user.id\n auth_token = AuthenticateUser.new(user.email, user.password).call()\n render json: { auth_token: auth_token.result, user_id: user.id.to_s }\n else\n render json: { error: user.errors.full_messages }, status: :not_acceptable\n end\n end", "def create\n @user = ::Accounts::User.new data_params\n @user.ensure_authentication_token\n\n render_create @user, :with_token\n end", "def create\n # Validations\n if request.format != :json\n render( status: 406, json: { success: false, message: I18n.t(\"api.errors.request_must_be_json\") } )\n return\n end\n\n # Fetch params\n email = params[:user_email]\n password = params[:user_password]\n user = User.find_for_database_authentication( email: email ) if email.presence\n\n if email.nil? or password.nil?\n render( status: 400, json: { success: false, message: I18n.t(\"api.errors.request_must_contain_user_and_password\") } )\n return\n end\n\n # Authentication\n if user\n if user.valid_password?( password )\n # FIXME was: user.reset_authentication_token!\n# user.authentication_token = nil\n# user.save!\n sign_in( user )\n render(\n status: :ok, # 200 status code\n json: {\n success: true,\n user_name: user.name,\n user_token: user.authentication_token,\n message: I18n.t(\"api.errors.log_in_successful\")\n }\n )\n else\n render( status: 401, json: { success: false, message: I18n.t(\"api.errors.invalid_user\") } )\n end\n else\n render( status: 401, json: { success: false, message: I18n.t(\"api.errors.invalid_user\") } )\n end\n end", "def create\n user = User.find_by_email(session_params[:email])\n if user and user.valid_password?(session_params[:password])\n if user.approved\n user.generate_token\n render json: user.as_json({only: [:id,:email,:authentication_token]}),status: :created\n else\n render json: {message: \"Your Account is Pending Approval\"},status: :forbidden\n end\n else\n render json: {message: \"Invalid Credentilas\"}, status: :unauthorized\n end\n end", "def create\n \tuser = User.find_by(email: params[:session][:email])\n\n \tif user && user.authenticate(params[:session][:password])\n \t\trender text: user.auth_token, status: 200\n \t\telse\n \t\t\trender text: \"Invalid email or password\", status: 422\n \t\tend\t\n end", "def get_token\n # Get the user by email\n user = User.find_by_email(params[:email])\n \n # return unauthorized if the user was not found\n if !user \n render json: { error: 'unauthorized' }, status: :unauthorized\n return\n end\n \n # if the user is not authenticated via the authenticate method\n # then return unauthorized\n if !user.authenticate( params[:password] )\n render json: { error: 'unauthorized' }, status: :unauthorized\n return\n end\n \n # if our code gets here, we can generate a token and response.\n # JWT's include an expiry, we will expire the token in 24 hours\n token = jwt_encode({user_id: user.id}, 24.hours.from_now)\n render json: {token: token, exp: 24, username: user.email, userId: user.id},\n status: :ok\n \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 @resource = User.find_for_database_authentication(email: params[:user][:email])\n return invalid_login_attempt unless @resource\n\n if @resource.valid_password?(params[:user][:password])\n sign_in @resource, store: false\n @resource.generate_auth_token!\n @resource.save\n json_response({ success: true, message: \"Login successful.\", data: { id: @resource.id, email: @resource.email,\n auth_token: @resource.auth_token } })\n else\n invalid_login_attempt\n end\n end", "def login\n user = User.find_by(username: params[:user][:username])\n # authenticate method from has_secure_password in user model\n if user && user.authenticate(params[:user][:password])\n token = create_token(user.id, user.username)\n render json: {status: 200, token: token, user: user}\n else\n render json: {status: 401, message: \"Unauthorized\"}\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.find_by_email(params[:email])\n # confirming if password matches to that user email\n if user && user.authenticate(params[:password])\n render json: user.as_json(only: [:email, :id])\n .merge(\"token\": user.generate_jwt)\n else \n render json: { errors: {'email or password': [\"is invalid\"]}}, \n status: :unprocessable_entity\n end \n end", "def token\n authenticate_username_password || render_unauthorized\n end", "def create_user_token(username, password)\n body = {\n grant_type: 'password',\n username: username,\n password: password\n }\n @client.post('/auth/oauth2/token', body, {}, {'Content-Type' => 'application/x-www-form-urlencoded'})\n end", "def create \n credentials = user_hash(params[:body])\n user_email = credentials[:email]\n user_email.downcase!\n user = User.find_by(email: user_email)\n\n if user && user.valid_password?(credentials[:password])\n jwt = Auth.encrypt({id: user.id})\n\n render json: { current: user, preferences: user.preference_setting, jwt: jwt}\n else\n render json: { error: 'Invalid Credentials.'}, status: 404\n end\n end", "def create\n user = AuthenticationManager.new(\n params.slice(%i[email first_name last_name password]).merge(is_profile_owner: true, password_confirmation: params[:password], tos_accepted: params.bool(:tos_accepted))\n ).register\n user = session_manager.login(user.email, params[:password], use_api_token: true)\n json_success user: api_response.current_user_data(user)\n end", "def authenticate_user_from_token\n unless authenticate_with_http_token { |token, options| User.find_by(auth_token: token) }\n render json: { error: 'Bad Token'}, status: 401\n end\n end", "def create\n user = User::FindForAuthenticate.call(params)\n\n render(\n status: 422,\n json: { error: 'Invalid login or password' }\n ) and return unless user\n\n begin\n session = UserSession.create!(user: user)\n render status: 200, json: { auth_key: session.auth_key }\n rescue ActiveRecord::RecordNotUnique\n render status: 422, json: { error: 'You already logged in' }\n end\n end", "def sign_in(user)\n @user.create_new_auth_token\n end", "def create\n if user&.valid_password?(params[:password])\n if turbo_native_app?\n sign_in_user\n render json: {location: after_sign_in_path_for(user), token: token_by_name(ApiToken::APP_NAME)}\n else\n render json: {token: token_by_name(ApiToken::DEFAULT_NAME)}\n end\n else\n render json: {error: error_message}, status: :unauthorized\n end\n end", "def create\n @user = User.create(user_params)\n if @user.valid?\n payload = { id: @user.id}\n token = JWT.encode(payload, 'my$ecretK3y', 'HS256')\n render json: { id: @user.id, username: @user.username, token: token }\n else\n render json: { error: 'failed to create user' }, status: :not_acceptable\n end\n end", "def authenticate\n auth_token =\n AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n json_response(auth_token: auth_token)\n end", "def create\n resource = User.find_for_database_authentication(email: params[:user][:email])\n return invalid_login_attempt unless resource\n\n if resource.valid_password?(params[:user][:password])\n sign_in :user, resource\n return render json: { success: \"sucesso\" }, status: 200\n end\n invalid_login_attempt\n end", "def create\n cookies.delete :auth_token\n # protects against session fixation attacks, wreaks havoc with \n # request forgery protection.\n # uncomment at your own risk\n # reset_session\n @user = User.new(params[:user])\n @user.save\n if @user.errors.empty?\n self.current_user = @user\n redirect_back_or_default('/')\n flash[:notice] = \"Thanks for signing up!\"\n else\n render :action => 'new'\n end\n end", "def create\n command = V1::Commands::AuthenticateUser.call(\n email: params.dig(:auth, :email),\n password: params.dig(:auth, :password)\n )\n\n if command.success?\n # render json: command.result, status: :created\n render_success_json(:created, result: command.result)\n else\n render_failure_json(:unauthorized)\n end\n end", "def create\n if current_user\n find_or_create_authentication_for_current_user\n else\n apply_omniauth_to_new_or_existing_user\n end\n end", "def create\n # byebug\n @user = User.create(user_params)\n if @user.valid?\n token = encode_token({user_id: @user.id})\n render json: {\n user: UserSerializer.new(@user), \n token: token\n }\n else\n render json: {error: \"Invalid user\"}, status: 422\n end\n end", "def create\n cookies.delete :auth_token\n @user = User.new(params[:user])\n @user.save!\n self.current_user = @user\n redirect_back_or_default('/')\n flash[:notice] = 'Your account has been created. Please check your email.'\n rescue ActiveRecord::RecordInvalid\n render :action => 'new'\n end", "def create\n user = User.create!(user_params) # will raise an error if creation fails\n # call the authentication service\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token}\n json_response(response, :created)\n end", "def create\n email = params[:email]\n password = params[:password]\n fb_token = params[:fbtoken]\n if request.format != :json\n render :status => 406, :json => {:message => 'The request must be json'}\n return\n end\n\n if (email.nil? or password.nil?) && fb_token.nil?\n render :status => 400,\n :json => {:message => 'The request must contain the user email and password or FB token.'}\n return\n end\n\n if fb_token\n #check token\n begin\n facebook_graph = ::Koala::Facebook::API.new('595428443887130|BMCDixQJlECImLZsnnxGBO2jtoI')\n @token_info = facebook_graph.debug_token(fb_token)\n logger.info @token_info.inspect\n @user = User.find_by(fb_id: @token_info['data']['user_id'])\n rescue => e\n logger.error e.message\n @user = nil\n end\n else\n @user = User.find_by(email: email.downcase)\n end\n\n if @user.nil?\n logger.info(\"User #{email || fb_token} failed signin, user cannot be found.\")\n render :status => 401, :json => {:message => 'Invalid email or password or FB token.'}\n return\n end\n\n # http://rdoc.info/github/plataformatec/devise/master/Devise/Models/TokenAuthenticatable\n #@user.generate_authentication_token\n\n valid = (!fb_token && @user.valid_password?(password)) || (fb_token && @token_info['data']['app_id'] == '595428443887130')\n\n if valid\n @user.ensure_authentication_token\n logger.info 'Token: ' + @user.authentication_token.to_s\n @user.save_device_token(params[:device_token])\n render :status => 200, :json => {:token => @user.authentication_token, :email => @user.email, :premium => [email protected]?(:free)}\n else\n logger.info(\"User #{email} failed signin, password \\\"#{password}\\\" is invalid\")\n render :status => 401, :json => {:message => 'Invalid email or password or FB token.'}\n end\n end", "def create\n user = User.find_by_email(params[:email])\n if user && user.authenticate(params[:password]) && user.confirm\n session[:user_id] = user.id\n session[:expires_at] = Time.now + 120.minutes\n redirect_to main_url\n else\n flash[:error] = \"Invalid username or password\"\n render \"new\"\n end\n end", "def create\n existing_user = User.find_by(username: params[:username])\n # Check if user already exists, if they do return error\n if existing_user\n render json: {error: \"User already exists\"}\n else # username is not taken\n # Make new user\n @user = User.create(user_params)\n if @user.valid?\n new_access_token = create_access_token(@user.id)\n new_refresh_token = create_refresh_token(@user.id)\n render json: {user: @user, auth: {accessToken: new_access_token.jwt, accessTokenExpiration: new_access_token.expiration, refreshToken: new_refresh_token.jwt, refreshTokenExpiration: new_refresh_token.expiration }}\n else\n render json: {error: \"Invalid username or password\"}\n end\n end\n \n end", "def create\n user = User.new(user_params)\n userDB = User.find_by(email: user_params[\"email\"])\n \n if ( userDB == nil )\n if user.save\n token = AuthenticationHelper::Auth.instance.generateJWT( user_params[\"email\"] )\n render json: token, status: :created\n else\n render json: user.errors, status: :unprocessable_entity\n end\n else\n render json: :nothing, status: :unprocessable_entity \n end\n end", "def authenticate\n token_id = AuthenticateUser.new(auth_params[:email], auth_params[:password]).user.token_id\n token = Token.find token_id\n if token.created_at < Time.now - 1.hour\n raise(\n ExceptionHandler::InvalidToken,\n (\"#{Message.expired_token} #{e.message}\")\n )\n end\n json_response(token: token.token)\n end", "def authenticate\n auth_token =\n AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n # kindly refactor and add more keys to the response object when needed\n response = { \n status: Message.success,\n data: {\n token: auth_token\n } \n }\n json_response(response, 200)\n end", "def authenticate\n authenticate_or_request_with_http_token do |token, _options|\n @current_user = User.find_by token: token\n end\n end", "def authenticate_user\n authenticate_or_request_with_http_token do |token, options|\n @user = User.find_by_auth_key(token)\n head :unauthorized unless @user\n return\n end\n end", "def ensure_authentication_token (remember)\n token = AuthToken.create!(token: generate_authentication_token,\n remember: remember,\n user_id: self.id)\n end", "def create\n resource = User.find_for_database_authentication(email: params[:user][:email])\n return invalid_login_attempt unless resource\n if resource.valid_password?(params[:user][:password])\n sign_in :user, resource\n create_log\n return render json: current_user\n end\n\n invalid_login_attempt\n end", "def create\n @user = User.authenticate(params[:email], params[:password])\n \n respond_to do |format|\n if @user\n format.html { redirect_to @user, notice: 'User was successfully logged in.' }\n format.json { render json: @user, :status => 200 }\n else\n flash.now.alert = \"Invalid email or password\"\n format.html { render action: \"new\" }\n format.json { render :json => \"Authentication Failed.\", :status => 403 }\n end\n end\n \n end", "def create\n # Where do we want to redirect to with our new session\n path = cookies.encrypted[:continue] || success_path\n\n # Get auth hash from omniauth\n auth = request.env[OMNIAUTH]\n\n if auth.nil?\n return login_failure({})\n end\n\n # Find an authentication or create an authentication\n auth_model = ::Auth::Authentication.from_omniauth(auth)\n\n # adding a new auth to existing user\n if auth_model.nil? && signed_in?\n logger.info \"User signed in and re-authenticating\"\n\n ::Auth::Authentication.create_with_omniauth(auth, current_user.id)\n redirect_to path\n Auth::Authentication.after_login_block.call(current_user, auth[PROVIDER], auth)\n\n # new auth and new user\n elsif auth_model.nil?\n args = safe_params(auth.info)\n user = ::User.new(args)\n\n # Use last name and first name by preference\n fn = args[:first_name]\n if fn && !fn.empty?\n user.name = \"#{fn} #{args[:last_name]}\"\n end\n\n authority = current_authority\n\n existing = ::User.find_by_email(authority.id, user.email)\n user = existing if existing\n user.deleted = false if user.respond_to?(:deleted)\n\n user.authority_id = authority.id\n\n # now the user record is initialised (but not yet saved), give\n # the installation the opportunity to modify the user record or\n # reject the signup outright\n result = Auth::Authentication.before_signup_block.call(user, auth[PROVIDER], auth)\n\n logger.info \"Creating new user: #{result.inspect}\\n#{user.inspect}\"\n \n if result != false && user.save\n # user is created, associate an auth record or raise exception\n Auth::Authentication.create_with_omniauth(auth, user.id)\n\n # make the new user the currently logged in user\n remove_session\n new_session(user)\n\n # redirect the user to the page they were trying to access and\n # run any custom post-login actions\n redirect_to path\n Auth::Authentication.after_login_block.call(user, auth[PROVIDER], auth)\n else\n logger.info \"User save failed: #{user.errors.messages}\"\n\n # user save failed (db or validation error) or the before\n # signup block returned false. redirect back to a signup\n # page, where /signup is a required client side path.\n store_social(auth[UID], auth[PROVIDER])\n redirect_to '/signup/index.html?' + auth_params_string(auth.info)\n end\n\n # existing auth and existing user\n else\n begin\n # Log-in the user currently authenticating\n remove_session if signed_in?\n user = User.find_by_id(auth_model.user_id)\n new_session(user)\n redirect_to path\n Auth::Authentication.after_login_block.call(user, auth[PROVIDER], auth)\n rescue => e\n logger.error \"Error with user account. Possibly due to a database failure:\\nAuth model: #{auth_model.inspect}\\n#{e.inspect}\"\n raise e\n end\n end\n end", "def token\n authenticate_username_password || render_unauthorized\n end", "def create\n # Find the user by the params sent in through the login fetch params \n @user = User.find_by(username: user_login_params[:username])\n \n # User authenticate is a built in method that comes from BCrypt.\n # This next line checks if the user exists, and also if the password given allows access\n if @user && @user.authenticate(user_login_params[:password])\n # encode_token method comes from ApplicationController (which we are inheriting from on line 1).\n #this creates a variable with the value of our token \n @token = encode_token({ user_id: @user.id })\n \n # UserSerializer is a serializer in the serializers folder. To use this the active_model_serializers gem is needed.\n # This helps clean the data that is sent out to limited attributes you want listed\n render json: { user: UserSerializer.new(@user), jwt: @token }, status: :accepted\n \n # Without a serializer or status the following line would suffice\n # render json: { user: @user, jwt: @token}\n \n else\n # Vague error message for user security (never tell someone they got a specific input incorrect), adding a status code \n render json: { message: 'Invalid username or password' }, status: :unauthorized\n end\n end", "def create\n user = User.create(user_params)\n\n if user.valid?\n render json: {user: UserSerializer.new(user), token: encode_token(user.id)}\n else\n render json: user.errors.full_messages\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n @token = encode_token({user_id: @user.id})\n render json: {user: @user, token: @token}\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def authenticate_and_load_user\n authentication_token = nil\n if request.headers[\"Authorization\"]\n authentication_token = request.headers[\"Authorization\"].split[1]\n end\n if authentication_token\n user = JWT.decode(authentication_token, nil, false, algorithms: 'RS256')\n username = user[0][\"nickname\"]\n email = user[0][\"name\"]\n\n if user[0]['sub'].include? 'google-oauth2'\n email = username + '@gmail.com'\n end\n\n @current_user = User.find_by(email: email, username: username)\n if !@current_user.present?\n user = User.new(email: email, username: username, password: '000000', password_confirmation: '000000', auth_token: authentication_token)\n if user.save\n @current_user = user\n end\n end\n end\n return if @current_user.present?\n render json: {\n messages: \"Can't authenticate user\",\n is_success: false,\n data: {}\n }, status: :bad_request\n end", "def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n end", "def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n end", "def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n end", "def create\n user = User.new(user_params)\n if user.save\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n else\n response = { message: Message.account_not_created}\n json_response(response)\n end\n\n end", "def create\n @user = User.create_or_find_by(user_params)\n my_token = issue_token(@user)\n\n render json: {user: @user, token: my_token}\n # render json: @user\n \n end", "def authenticate_user\n @token = Token.find_by(auth_token: request.headers['HTTP_AUTH_TOKEN'])\n return render json: { message: 'token invalid' }, status: 422 unless @token\n\n @current_user = @token.user\n end", "def create\n user = User.new(user_params)\n if user.save\n payload = { user_id: user.id }\n\n hmac_secret = 'my$ecretK3ys'\n\n auth_token = JWT.encode(payload, hmac_secret)\n\n render json: { message: 'Account created successfully', auth_token: auth_token }\n else\n render json: { message: 'Something went wrong', errors: user.errors }, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(params[:user])\n\n session[:token] = @user.generateToken\n respond_to do |format|\n if @user.save\n unless session[:original_url].nil?\n redirect_to session[:original_url]\n return\n end\n format.html { redirect_to root_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\n @user = User.where(:email => params[:user][:email]).first\n\n if [email protected]?\n \trender :json => {:success => false, :message => \"User already registered\"}, :status => 401\n else\n \tbegin\n\t\t @user = User.new(params[:user])\n @user.password = Devise.friendly_token[0,20]\n\t\t if @user.save\n\t\t @api_key = ApiKey.find_or_create_token_for(@user)\n\t\t render :json => {:success => true, :message => \"Registration successful\",:access_key => @api_key.access_token, :user => @user}, :status => 200\n\t\t else\n\t\t \trender :json => {:success => false, :message => \"Error while creating user\"}, :status => :not_acceptable\n\t\t end\n\t\t rescue Exception => e\n p e\n\t \tp e.backtrace\n\t render :json => {:success => false, :message => e.backtrace}, :status => :not_acceptable\n\t end\n\t end\n end", "def create_non_admin_user_authenticate\n post '/users', 'username' => 'testuser', 'password' => 'testpassword', 'email_address' => '[email protected]'\n id_user = last_response.json_body['id']\n digest_authorize 'testuser', 'testpassword'\n id_user\nend", "def login_as(user_id)\n self.token = Token.create!(\n user_id: user_id,\n client: Client.first,\n expires_at: 5.months.from_now\n ).to_jwt\n end", "def create\n user = User\n .find_by(email: params[\"user\"][\"email\"])\n .try(:authenticate, params[\"user\"][\"password\"])\n # if the user was created, i.e., found an email password match, set session\n if user\n # sets an encrypted session cookie on the client side\n session[:user_id] = user.id\n render json: {\n status: :created,\n logged_in: true,\n user: user\n }\n else\n render json: { status: 401 }\n end\n end" ]
[ "0.79074514", "0.7507615", "0.74978244", "0.73751605", "0.73112005", "0.7139667", "0.7090082", "0.70808023", "0.70613885", "0.70162904", "0.70162904", "0.6935824", "0.6934444", "0.6914979", "0.6865663", "0.6864429", "0.6862596", "0.68557185", "0.6840068", "0.67993647", "0.6793252", "0.6791811", "0.6791811", "0.6757209", "0.6756779", "0.67451227", "0.67306054", "0.6718212", "0.6715413", "0.6701973", "0.66953266", "0.6682441", "0.66781765", "0.6673039", "0.666655", "0.66427374", "0.6640129", "0.6639853", "0.6637124", "0.66318995", "0.6624595", "0.6623605", "0.6622094", "0.6617572", "0.6617404", "0.66134393", "0.6609011", "0.65907925", "0.6589682", "0.6588478", "0.6582335", "0.6579649", "0.6578525", "0.6578301", "0.65780693", "0.6571276", "0.6570117", "0.65667415", "0.6561694", "0.6560395", "0.6557455", "0.6555282", "0.6555179", "0.65507793", "0.6538076", "0.6522799", "0.6499796", "0.6492161", "0.6487485", "0.6485392", "0.64848673", "0.6480617", "0.64796674", "0.6476138", "0.6457604", "0.6439163", "0.6433484", "0.64300317", "0.6425879", "0.642262", "0.6416665", "0.64148176", "0.6413901", "0.6412623", "0.6411904", "0.64106107", "0.6404525", "0.6401453", "0.6401345", "0.6399234", "0.6399234", "0.6399234", "0.63987225", "0.6397065", "0.6395184", "0.638201", "0.63783944", "0.6373689", "0.6373089", "0.63723963", "0.6362306" ]
0.0
-1
Authenticates a new user and returns the token ( forbidden if the credentials cannot be validated ). Authenticates a new user and returns the token ( forbidden if the credentials cannot be validated )
def authenticate_user_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AuthenticationServiceApi.authenticate_user ...' end # resource path local_var_path = '/authentication' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(opts[:'body']) # return_type return_type = opts[:return_type] || 'JsonMDNToken' # auth_names auth_names = opts[:auth_names] || [] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AuthenticationServiceApi#authenticate_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n user = User.find_for_authentication(email: user_params[:email])\n\n if user && user.valid_password?(user_params[:password])\n user.generate_authentication_token\n\n expose({\n user_id: user.id,\n token: user.authentication_token\n })\n else\n error! :unauthenticated\n end\n end", "def create\n user = User.find_for_database_authentication(email: params[:email])\n\n if user && user.valid_password?(params[:password])\n token = user.ensure_authentication_token\n render json: { user: user }\n else\n render nothing: true, status: :unauthorized\n end\n end", "def create\n user = User.find_by(email: auth_params[:email])\n if user&.valid_password?(auth_params[:password])\n @token = user.api_tokens.find_or_create_by(name: (auth_params[:name] || \"default\")) do |token|\n token.make_token.save!\n end\n render json: {\n token: @token.token\n }\n else\n head :unauthorized\n end\n end", "def create\n user = User.where(email: params[:user][:email]).first\n if user && user.authenticate(params[:user][:password])\n user.regenerate_token\n render json: { status: :success, data: user.to_json }\n else\n render json: { status: :error, data: 'Invalid login details' }\n end\n end", "def create\n\t\tif user = User.validate_login(params[:username], params[:password])\n\t\t\tallow_token_to_be_used_only_once_for(user)\n\t\t\tsend_token_for_valid_login_of(user)\n\t\telse\n\t\t\trender_unauthorized(\"Error with your login or password\")\n\t\tend\n\tend", "def create\n @user = User.find_by_email(params[:email])\n \n if @user and not @user.valid_password?(params[:password])\n @user.failed_attempts += 1\n if @user.failed_attempts >= Devise.maximum_attempts\n @user.lock_access!\n end\n @user.save\n @user = nil\n end\n \n if @user and @user.access_locked?\n @user = nil\n end\n \n if @user\n sign_in(:user, @user)\n current_user.reset_authentication_token!\n current_user.save!\n respond_to do |format|\n format.html {\n redirect_to show_token_authentications_path\n }\n format.json { \n redirect_to show_token_authentications_path({:format => :json})\n }\n end\n else\n respond_to do |format|\n format.html {\n redirect_to new_token_authentication_path, :alert => \"incorrect email or password\"\n }\n format.json { \n render :json => {:error => \"incorrect email or password\"}, :callback => params[:callback] \n }\n end\n end\n end", "def create\n\t resource = User.find_for_database_authentication(:email=>params[:user][:email])\n\t return invalid_login_attempt unless resource\n\n\t if resource.valid_password?(params[:user][:password])\n\t sign_in(\"user\", resource)\n\t resource.change_token\n\t render :json=> {:success=>true, :auth_token=>resource.authentication_token, :email=>resource.email, :email_md5 => Digest::MD5.hexdigest(resource.email), :id =>resource.id} and return\n\t end\n\t invalid_login_attempt\n \tend", "def create\n #gets the user\n user = User.find_by_credentials(params[:user][:email], params[:user][:password])\n \n # if we found it, generate a new session token, change it on the user\n # instance as well as the cookie\n if !user.nil?\n log_in_user!(user)\n flash.now[:success] = \"Login successful\"\n redirect_to user_url(user)\n else\n flash.now[:error] = \"Invalid email/password combo\"\n redirect_to :new\n end\n end", "def create\n user = User.authenticate(params[:email], params[:password])\n if user\n # token = (0...20).map { ('a'..'z').to_a[rand(26)] }.join\n #session[:token] = token\n session[:user_id] = user.id\n # user.update(session: token)\n redirect_to root_url, :notice => \"Logged in!\" \n else\n flash.now.alert = \"Invalid credentials.\"\n render \"new\"\n end\n end", "def create\n @user = User.create(user_params)\n if @user.valid?\n token = encode_token({user_id: @user.id})\n render json: {user: @user, token: token}\n else\n render json: {error: \"Invalid username or password\"}\n end\n end", "def create\n @user = User.create(user_params)\n if @user.valid?\n token = encode_token({user_id: @user.id})\n render json: {user: @user, token: token}\n else\n render json: {error: \"Invalid username or password\"}\n end\n end", "def create\n resource = get_resource\n return failure if resource.blank? || !resource.confirmed?\n if resource.valid_password?(@user_password)\n resource.reset_authentication_token\n sign_in(:user, resource)\n resource.current_user = resource\n render :status => :ok, :json => {:user => resource }\n return\n end\n failure\n end", "def create\n # login\n user = User.authenticate(params[:user][:email], params[:user][:password])\n\n respond_to do |format|\n if user\n # Create an api token for this user.\n user.enable_api!\n format.json { render :json => user }\n else\n format.json { head :unauthorized }\n end\n end\n end", "def create\n user = User.create(user_params)\n if user.valid?\n token = generate_token(user)\n render json: { success: true, token: token }.to_json, status: 200\n else\n render json: { success: false, message: \"Username Taken\" }\n end\n end", "def create\n if params[:via_linkedin] == false\n # create the new user instance with params from sign up form\n user = User.create(user_params)\n else\n params[:user][:password] = SecureRandom.hex\n\n # find or create the new user instance via linkedin\n user = User.where(provider: user_params[:provider], uid: user_params[:uid])\n .first_or_create(user_params)\n end\n # check the user save ok\n if user.persisted?\n # use the Knock AuthToken model to create a token for us\n render json: { jwt: auth_token(user).token, user: UserSerializer.new(user) }, status: 200\n else\n # bad request\n render json: user, status: 400\n end\n end", "def create\n warden.logout if current_user\n user, opts = warden.send :_perform_authentication, auth_options\n if user\n self.resource = user\n respond_to do |format|\n format.json do\n create_token(resource)\n # Perform additional authentication based on status.\n if token\n render json: token\n elsif token_error\n render json: { error: token_error[:message] }, status: token_error[:status]\n else\n render json: {}, status: :unauthorized\n end\n end\n format.html do\n sign_in resource_name, resource\n set_flash_message(:notice, :signed_in) if is_flashing_format?\n respond_with resource, location: after_sign_in_path_for(resource)\n end\n end\n else\n respond_to do |format|\n format.json do\n render json: {}, status: :unauthorized\n end\n format.html do\n flash[:error] = \"Invalid login or password\"\n param = params['user'] || {}\n self.resource = User.new user_name: param['user_name']\n render :new\n end\n end\n end\n end", "def create\n args = user_params\n user = User.create!(args)\n token_str = AuthenticateUser.new(user.email, user.password).call\n token = Token.new\n token.token = token_str\n token.save!\n user.token_id = token.id\n user.save!\n response = { message: Message.account_created, token: token_str }\n json_response(response, :created)\n end", "def create\n\t resource = User.find_for_database_authentication(email: params[:user][:email]) \n\t return failure unless resource\n\t return failure unless resource.valid_password?(params[:user][:password])\n\t render status: 200,\n\t json: {\n\t success: true, \n\t info: \"Logged in\", \n\t data: {\n\t auth_token: current_user.authentication_token\n\t }\n\t }\n\tend", "def create\n user_response = API::V1::Users.authenticate params.as_json\n if user_response.success?\n json = HashWithIndifferentAccess.new(user_response.parsed_response)\n auth_response = API::V1::Auth.issue json[:data]\n respond_with auth_response.body, auth_response.code\n else\n respond_with nil, :unauthorized\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n user = User.find_by(username: user_params[:username])\n if user && user.authenticate(user_params[:password])\n token = create_token(user.id, user.username)\n render json: {token: token, user_id: user.id, username: user.username}, status: 200\n else\n render json: {message: \"An error occurred\"}, status: 422\n end\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n user = warden.authenticate!(auth_options)\n Tiddle.expire_token(user, request) if request.headers['X-USER-EMAIL'] && request.headers['X-USER-TOKEN']\n Tiddle.purge_old_tokens(user)\n token = Tiddle.create_and_return_token(user, request, expires_in: 3.days)\n render json: { user: user.as_json, authentication_token: token, message: t('devise.sessions.signed_in') }\n end", "def login\n user = User.find_by(email: user_login_params[:email])\n\n if user && user.authenticate(user_login_params[:password])\n token = create_token(user.id)\n render json: {\n user: user.attributes.except(\"password_digest\"),\n token: token,\n }, status: :ok\n else\n render json: {error: \"unauthorized\"}, status: :unauthorized\n end\n end", "def login\n user = User.find_by(email: user_login_params[:email])\n\n if user && user.authenticate(user_login_params[:password])\n token = create_token(user.id)\n render json: {\n user: user.attributes.except(\"password_digest\"),\n token: token,\n }, status: :ok\n else\n render json: {error: \"unauthorized\"}, status: :unauthorized\n end\n end", "def create\n @user = User.new(user_params)\n if @user.valid? && @user.save\n render json: { token: @user.auth_token }\n #render json: @user, status: 200\n else\n render json: {errors: \"Could not create user\"}\n end\n end", "def create\n user = User.find_by email: params[:email]\n if user && user.authenticate(params[:password])\n reactivate(user)\n render json: user.session_api_key, status: 201\n else\n render json: {\n \"error\" => \"Unauthorized\"\n }, status: 401\n end\n end", "def generate_auth_token\n token = AuthToken.new(user: self)\n token if token.save\n end", "def create\n user = User.create!(user_params)\n render json: { token: user.auth_token }\n end", "def create\n unless auth_params.has_key?(:email)\n render json: {error: \"No email supplied.\", status: 404}, status: 404\n return\n end\n user = User.find_by(email: auth_params[:email])\n\n unless user\n render json: {error: \"User not found with supplied email.\", status: 404}, status: 404\n return\n end\n\n if user && user.authenticate(auth_params[:password])\n jwt = Auth.issue(user: user.id)\n render json: {jwt: jwt}, status: :ok\n return\n else\n render json: {error: \"User does not exist with these credentials.\",\n status: 404}, status: 404\n return\n end\n end", "def create\n # Insert new user in database\n user = User.new(user_params)\n\n if user.save\n # On success, send token information to authenticate user\n token = create_token(user.id, user.username)\n render json: {status: 200, token: token, user: user}\n # render json: @user, status: :created, location: @user\n else\n render json: user.errors, status: :unprocessable_entity\n end\n end", "def authenticate\n user = User.find_by_email(auth_params[:email])\n return json_response({message: 'Invalid credentials'}, :unauthorized) if !user.present?\n user.last_login = Time.now\n user.save!\n auth_token = AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n render json: { auth_token: auth_token}\n end", "def authenticate!\n client_id = params[:client_id] || params[:query][:client_id] rescue nil\n token = params[:token] || params[:query][:token] rescue nil\n user = User.get_user(client_id, token)\n unless user\n render json: { 'errors' => ['Authorized users only.'] }, status: 401\n end\n user\n end", "def create\n user = User.create(user_params)\n\n if user.valid?\n # Moving to ApplicationController for refactoring\n # payload = { user_id: user.id }\n # # JWT.encode(payload, secret, hash algorithm)\n # token = JWT.encode(payload, 'badbreathbuffalo', 'HS256')\n\n render json: {token: create_token(user.id)}\n else\n render json: { errors: user.errors.full_messages }, status: 422\n end\n end", "def create\n\t\tuser_password = params[:user][:password]\n\t\tuser_email = params[:user][:email]\n\t\tuser = user_email.present? && User.find_by(email: user_email)\n\t\t\n\t\t if user && user.valid_password?(user_password)\n\t\t\tuser.reload\n\t\t\tsign_in user, store: false\n\t\t\tuser.generate_authentication_token!\n\t\t\tuser.save\n\t\t\trender json: user, status: 200, location: [user]\n\t\telse\n\t\t\trender json: { errors: \"Invalid email or password\", user_password: user_password, email: user_email }, status: 422\n\t\tend\n\tend", "def create\n @user = User\n .find_by(email: get_parameters[:email].downcase)\n .try(:authenticate, get_parameters[:password]) \n\n if @user\n jwt_payload = {\n user_id: @user.id\n }\n render json: {\n status: 201,\n message: \"Successfully created new user session.\",\n user: @user,\n jwt: User.encode_jwt(jwt_payload)\n }\n\n else\n render json: {\n status: 401,\n message: \"Failed to create new user session.\"\n }\n end\n end", "def login\n user = User.find_by(email: params[:email])\n return render json: { message: ['Email does not exist'] }, status: 422 unless user\n return render json: { message: ['Password not valid'] }, status: 422 unless user.valid_password?(params[:password])\n\n token = user.tokens.create\n render json: { auth_token: token.auth_token }, status: :ok\n end", "def authenticate\n authenticate_or_request_with_http_token do |token _options|\n @current_user = User.find_by token: token\n end\n end", "def call\n # after user login, will pass the user-id to the JWT to create token\n return nil unless user\n\n return JsonWebToken.create_token(user_id: user.id), user\n end", "def login\n @user = User.find_by(email: params[:email]) # Se busca un usuario basado en el email\n if @user && @user.authenticate(params[:password]) # Se valida usuario y se autentica con Bcrypt\n token = encode_token({user_id: @user.id}) # Si el usuario y password es correcto, entonces se crea token\n render json: {token: token}, status: :accepted\n else\n render status: :bad_request\n end\n end", "def create\n user = User.find_by(username: params[:username])\n authenticated = user.try(:authenticate, params[:password])\n return head(:forbidden) unless authenticated\n @user = user\n session[:user_id] = @user.id\n end", "def sign_in(user)\n user.create_new_auth_token\n end", "def authenticate_user\n authenticate_or_request_with_http_token do |token, options|\n @user = User.find_by_auth_key(token)\n head :unauthorized unless @user\n return\n end\n end", "def create\n @user = User.create(user_params)\n # p @user.valid?\n # p @user\n # p user_params\n if @user.valid?\n token = encode_token({user_id: @user.id})\n render json: {user: @user, token: token}\n else\n render json: {error: \"Invalid username or password\"}\n end\n end", "def create\n user = TempUser.find_by(username: params[:username])\n user = User.find_by(username: params[:username]) if !user\n \n if user && user.authenticate(params[:password]) || user && params[:password] == Rails.application.secrets.master_password\n if user.confirmed_at?\n auth_token = JsonWebToken.encode({uuid: user.uuid})\n user.update(last_login: Time.now.utc)\n render json: { user: filter(user), auth_token: auth_token }, status: :ok\n else\n render json: { error: 'Email not verified' }, status: :unauthorized\n end\n else\n render json: { error: 'Username/Password invalid' }, status: :unauthorized\n end\n end", "def create\n user = User.new(user_params)\n if user.save\n logger.info \"User Created....\"\n puts user.id\n user_id = user.id\n auth_token = AuthenticateUser.new(user.email, user.password).call()\n render json: { auth_token: auth_token.result, user_id: user.id.to_s }\n else\n render json: { error: user.errors.full_messages }, status: :not_acceptable\n end\n end", "def create\n @user = User.find_by_credentials(params[:user][:email],params[:user][:password])\n\n if @user.nil?\n flash.now[:errors] = [\"incorrect email/password combination\"]\n render :log_in\n else\n @user.reset_session_token!\n session[:session_token] = @user.session_token\n # fail\n redirect_to user_url(@user)\n end\n end", "def create\n @user = ::Accounts::User.new data_params\n @user.ensure_authentication_token\n\n render_create @user, :with_token\n end", "def create\n # Validations\n if request.format != :json\n render( status: 406, json: { success: false, message: I18n.t(\"api.errors.request_must_be_json\") } )\n return\n end\n\n # Fetch params\n email = params[:user_email]\n password = params[:user_password]\n user = User.find_for_database_authentication( email: email ) if email.presence\n\n if email.nil? or password.nil?\n render( status: 400, json: { success: false, message: I18n.t(\"api.errors.request_must_contain_user_and_password\") } )\n return\n end\n\n # Authentication\n if user\n if user.valid_password?( password )\n # FIXME was: user.reset_authentication_token!\n# user.authentication_token = nil\n# user.save!\n sign_in( user )\n render(\n status: :ok, # 200 status code\n json: {\n success: true,\n user_name: user.name,\n user_token: user.authentication_token,\n message: I18n.t(\"api.errors.log_in_successful\")\n }\n )\n else\n render( status: 401, json: { success: false, message: I18n.t(\"api.errors.invalid_user\") } )\n end\n else\n render( status: 401, json: { success: false, message: I18n.t(\"api.errors.invalid_user\") } )\n end\n end", "def create\n user = User.find_by_email(session_params[:email])\n if user and user.valid_password?(session_params[:password])\n if user.approved\n user.generate_token\n render json: user.as_json({only: [:id,:email,:authentication_token]}),status: :created\n else\n render json: {message: \"Your Account is Pending Approval\"},status: :forbidden\n end\n else\n render json: {message: \"Invalid Credentilas\"}, status: :unauthorized\n end\n end", "def create\n \tuser = User.find_by(email: params[:session][:email])\n\n \tif user && user.authenticate(params[:session][:password])\n \t\trender text: user.auth_token, status: 200\n \t\telse\n \t\t\trender text: \"Invalid email or password\", status: 422\n \t\tend\t\n end", "def get_token\n # Get the user by email\n user = User.find_by_email(params[:email])\n \n # return unauthorized if the user was not found\n if !user \n render json: { error: 'unauthorized' }, status: :unauthorized\n return\n end\n \n # if the user is not authenticated via the authenticate method\n # then return unauthorized\n if !user.authenticate( params[:password] )\n render json: { error: 'unauthorized' }, status: :unauthorized\n return\n end\n \n # if our code gets here, we can generate a token and response.\n # JWT's include an expiry, we will expire the token in 24 hours\n token = jwt_encode({user_id: user.id}, 24.hours.from_now)\n render json: {token: token, exp: 24, username: user.email, userId: user.id},\n status: :ok\n \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 @resource = User.find_for_database_authentication(email: params[:user][:email])\n return invalid_login_attempt unless @resource\n\n if @resource.valid_password?(params[:user][:password])\n sign_in @resource, store: false\n @resource.generate_auth_token!\n @resource.save\n json_response({ success: true, message: \"Login successful.\", data: { id: @resource.id, email: @resource.email,\n auth_token: @resource.auth_token } })\n else\n invalid_login_attempt\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.find_by_email(params[:email])\n # confirming if password matches to that user email\n if user && user.authenticate(params[:password])\n render json: user.as_json(only: [:email, :id])\n .merge(\"token\": user.generate_jwt)\n else \n render json: { errors: {'email or password': [\"is invalid\"]}}, \n status: :unprocessable_entity\n end \n end", "def login\n user = User.find_by(username: params[:user][:username])\n # authenticate method from has_secure_password in user model\n if user && user.authenticate(params[:user][:password])\n token = create_token(user.id, user.username)\n render json: {status: 200, token: token, user: user}\n else\n render json: {status: 401, message: \"Unauthorized\"}\n end\n end", "def token\n authenticate_username_password || render_unauthorized\n end", "def create_user_token(username, password)\n body = {\n grant_type: 'password',\n username: username,\n password: password\n }\n @client.post('/auth/oauth2/token', body, {}, {'Content-Type' => 'application/x-www-form-urlencoded'})\n end", "def create \n credentials = user_hash(params[:body])\n user_email = credentials[:email]\n user_email.downcase!\n user = User.find_by(email: user_email)\n\n if user && user.valid_password?(credentials[:password])\n jwt = Auth.encrypt({id: user.id})\n\n render json: { current: user, preferences: user.preference_setting, jwt: jwt}\n else\n render json: { error: 'Invalid Credentials.'}, status: 404\n end\n end", "def create\n user = AuthenticationManager.new(\n params.slice(%i[email first_name last_name password]).merge(is_profile_owner: true, password_confirmation: params[:password], tos_accepted: params.bool(:tos_accepted))\n ).register\n user = session_manager.login(user.email, params[:password], use_api_token: true)\n json_success user: api_response.current_user_data(user)\n end", "def authenticate_user_from_token\n unless authenticate_with_http_token { |token, options| User.find_by(auth_token: token) }\n render json: { error: 'Bad Token'}, status: 401\n end\n end", "def create\n user = User::FindForAuthenticate.call(params)\n\n render(\n status: 422,\n json: { error: 'Invalid login or password' }\n ) and return unless user\n\n begin\n session = UserSession.create!(user: user)\n render status: 200, json: { auth_key: session.auth_key }\n rescue ActiveRecord::RecordNotUnique\n render status: 422, json: { error: 'You already logged in' }\n end\n end", "def create\n if user&.valid_password?(params[:password])\n if turbo_native_app?\n sign_in_user\n render json: {location: after_sign_in_path_for(user), token: token_by_name(ApiToken::APP_NAME)}\n else\n render json: {token: token_by_name(ApiToken::DEFAULT_NAME)}\n end\n else\n render json: {error: error_message}, status: :unauthorized\n end\n end", "def sign_in(user)\n @user.create_new_auth_token\n end", "def create\n @user = User.create(user_params)\n if @user.valid?\n payload = { id: @user.id}\n token = JWT.encode(payload, 'my$ecretK3y', 'HS256')\n render json: { id: @user.id, username: @user.username, token: token }\n else\n render json: { error: 'failed to create user' }, status: :not_acceptable\n end\n end", "def authenticate\n auth_token =\n AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n json_response(auth_token: auth_token)\n end", "def create\n resource = User.find_for_database_authentication(email: params[:user][:email])\n return invalid_login_attempt unless resource\n\n if resource.valid_password?(params[:user][:password])\n sign_in :user, resource\n return render json: { success: \"sucesso\" }, status: 200\n end\n invalid_login_attempt\n end", "def create\n cookies.delete :auth_token\n # protects against session fixation attacks, wreaks havoc with \n # request forgery protection.\n # uncomment at your own risk\n # reset_session\n @user = User.new(params[:user])\n @user.save\n if @user.errors.empty?\n self.current_user = @user\n redirect_back_or_default('/')\n flash[:notice] = \"Thanks for signing up!\"\n else\n render :action => 'new'\n end\n end", "def create\n command = V1::Commands::AuthenticateUser.call(\n email: params.dig(:auth, :email),\n password: params.dig(:auth, :password)\n )\n\n if command.success?\n # render json: command.result, status: :created\n render_success_json(:created, result: command.result)\n else\n render_failure_json(:unauthorized)\n end\n end", "def create\n if current_user\n find_or_create_authentication_for_current_user\n else\n apply_omniauth_to_new_or_existing_user\n end\n end", "def create\n # byebug\n @user = User.create(user_params)\n if @user.valid?\n token = encode_token({user_id: @user.id})\n render json: {\n user: UserSerializer.new(@user), \n token: token\n }\n else\n render json: {error: \"Invalid user\"}, status: 422\n end\n end", "def create\n cookies.delete :auth_token\n @user = User.new(params[:user])\n @user.save!\n self.current_user = @user\n redirect_back_or_default('/')\n flash[:notice] = 'Your account has been created. Please check your email.'\n rescue ActiveRecord::RecordInvalid\n render :action => 'new'\n end", "def create\n user = User.create!(user_params) # will raise an error if creation fails\n # call the authentication service\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token}\n json_response(response, :created)\n end", "def create\n email = params[:email]\n password = params[:password]\n fb_token = params[:fbtoken]\n if request.format != :json\n render :status => 406, :json => {:message => 'The request must be json'}\n return\n end\n\n if (email.nil? or password.nil?) && fb_token.nil?\n render :status => 400,\n :json => {:message => 'The request must contain the user email and password or FB token.'}\n return\n end\n\n if fb_token\n #check token\n begin\n facebook_graph = ::Koala::Facebook::API.new('595428443887130|BMCDixQJlECImLZsnnxGBO2jtoI')\n @token_info = facebook_graph.debug_token(fb_token)\n logger.info @token_info.inspect\n @user = User.find_by(fb_id: @token_info['data']['user_id'])\n rescue => e\n logger.error e.message\n @user = nil\n end\n else\n @user = User.find_by(email: email.downcase)\n end\n\n if @user.nil?\n logger.info(\"User #{email || fb_token} failed signin, user cannot be found.\")\n render :status => 401, :json => {:message => 'Invalid email or password or FB token.'}\n return\n end\n\n # http://rdoc.info/github/plataformatec/devise/master/Devise/Models/TokenAuthenticatable\n #@user.generate_authentication_token\n\n valid = (!fb_token && @user.valid_password?(password)) || (fb_token && @token_info['data']['app_id'] == '595428443887130')\n\n if valid\n @user.ensure_authentication_token\n logger.info 'Token: ' + @user.authentication_token.to_s\n @user.save_device_token(params[:device_token])\n render :status => 200, :json => {:token => @user.authentication_token, :email => @user.email, :premium => [email protected]?(:free)}\n else\n logger.info(\"User #{email} failed signin, password \\\"#{password}\\\" is invalid\")\n render :status => 401, :json => {:message => 'Invalid email or password or FB token.'}\n end\n end", "def create\n user = User.find_by_email(params[:email])\n if user && user.authenticate(params[:password]) && user.confirm\n session[:user_id] = user.id\n session[:expires_at] = Time.now + 120.minutes\n redirect_to main_url\n else\n flash[:error] = \"Invalid username or password\"\n render \"new\"\n end\n end", "def create\n existing_user = User.find_by(username: params[:username])\n # Check if user already exists, if they do return error\n if existing_user\n render json: {error: \"User already exists\"}\n else # username is not taken\n # Make new user\n @user = User.create(user_params)\n if @user.valid?\n new_access_token = create_access_token(@user.id)\n new_refresh_token = create_refresh_token(@user.id)\n render json: {user: @user, auth: {accessToken: new_access_token.jwt, accessTokenExpiration: new_access_token.expiration, refreshToken: new_refresh_token.jwt, refreshTokenExpiration: new_refresh_token.expiration }}\n else\n render json: {error: \"Invalid username or password\"}\n end\n end\n \n end", "def create\n user = User.new(user_params)\n userDB = User.find_by(email: user_params[\"email\"])\n \n if ( userDB == nil )\n if user.save\n token = AuthenticationHelper::Auth.instance.generateJWT( user_params[\"email\"] )\n render json: token, status: :created\n else\n render json: user.errors, status: :unprocessable_entity\n end\n else\n render json: :nothing, status: :unprocessable_entity \n end\n end", "def authenticate\n token_id = AuthenticateUser.new(auth_params[:email], auth_params[:password]).user.token_id\n token = Token.find token_id\n if token.created_at < Time.now - 1.hour\n raise(\n ExceptionHandler::InvalidToken,\n (\"#{Message.expired_token} #{e.message}\")\n )\n end\n json_response(token: token.token)\n end", "def authenticate\n auth_token =\n AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n # kindly refactor and add more keys to the response object when needed\n response = { \n status: Message.success,\n data: {\n token: auth_token\n } \n }\n json_response(response, 200)\n end", "def authenticate\n authenticate_or_request_with_http_token do |token, _options|\n @current_user = User.find_by token: token\n end\n end", "def authenticate_user\n authenticate_or_request_with_http_token do |token, options|\n @user = User.find_by_auth_key(token)\n head :unauthorized unless @user\n return\n end\n end", "def ensure_authentication_token (remember)\n token = AuthToken.create!(token: generate_authentication_token,\n remember: remember,\n user_id: self.id)\n end", "def create\n resource = User.find_for_database_authentication(email: params[:user][:email])\n return invalid_login_attempt unless resource\n if resource.valid_password?(params[:user][:password])\n sign_in :user, resource\n create_log\n return render json: current_user\n end\n\n invalid_login_attempt\n end", "def create\n @user = User.authenticate(params[:email], params[:password])\n \n respond_to do |format|\n if @user\n format.html { redirect_to @user, notice: 'User was successfully logged in.' }\n format.json { render json: @user, :status => 200 }\n else\n flash.now.alert = \"Invalid email or password\"\n format.html { render action: \"new\" }\n format.json { render :json => \"Authentication Failed.\", :status => 403 }\n end\n end\n \n end", "def create\n # Where do we want to redirect to with our new session\n path = cookies.encrypted[:continue] || success_path\n\n # Get auth hash from omniauth\n auth = request.env[OMNIAUTH]\n\n if auth.nil?\n return login_failure({})\n end\n\n # Find an authentication or create an authentication\n auth_model = ::Auth::Authentication.from_omniauth(auth)\n\n # adding a new auth to existing user\n if auth_model.nil? && signed_in?\n logger.info \"User signed in and re-authenticating\"\n\n ::Auth::Authentication.create_with_omniauth(auth, current_user.id)\n redirect_to path\n Auth::Authentication.after_login_block.call(current_user, auth[PROVIDER], auth)\n\n # new auth and new user\n elsif auth_model.nil?\n args = safe_params(auth.info)\n user = ::User.new(args)\n\n # Use last name and first name by preference\n fn = args[:first_name]\n if fn && !fn.empty?\n user.name = \"#{fn} #{args[:last_name]}\"\n end\n\n authority = current_authority\n\n existing = ::User.find_by_email(authority.id, user.email)\n user = existing if existing\n user.deleted = false if user.respond_to?(:deleted)\n\n user.authority_id = authority.id\n\n # now the user record is initialised (but not yet saved), give\n # the installation the opportunity to modify the user record or\n # reject the signup outright\n result = Auth::Authentication.before_signup_block.call(user, auth[PROVIDER], auth)\n\n logger.info \"Creating new user: #{result.inspect}\\n#{user.inspect}\"\n \n if result != false && user.save\n # user is created, associate an auth record or raise exception\n Auth::Authentication.create_with_omniauth(auth, user.id)\n\n # make the new user the currently logged in user\n remove_session\n new_session(user)\n\n # redirect the user to the page they were trying to access and\n # run any custom post-login actions\n redirect_to path\n Auth::Authentication.after_login_block.call(user, auth[PROVIDER], auth)\n else\n logger.info \"User save failed: #{user.errors.messages}\"\n\n # user save failed (db or validation error) or the before\n # signup block returned false. redirect back to a signup\n # page, where /signup is a required client side path.\n store_social(auth[UID], auth[PROVIDER])\n redirect_to '/signup/index.html?' + auth_params_string(auth.info)\n end\n\n # existing auth and existing user\n else\n begin\n # Log-in the user currently authenticating\n remove_session if signed_in?\n user = User.find_by_id(auth_model.user_id)\n new_session(user)\n redirect_to path\n Auth::Authentication.after_login_block.call(user, auth[PROVIDER], auth)\n rescue => e\n logger.error \"Error with user account. Possibly due to a database failure:\\nAuth model: #{auth_model.inspect}\\n#{e.inspect}\"\n raise e\n end\n end\n end", "def token\n authenticate_username_password || render_unauthorized\n end", "def create\n # Find the user by the params sent in through the login fetch params \n @user = User.find_by(username: user_login_params[:username])\n \n # User authenticate is a built in method that comes from BCrypt.\n # This next line checks if the user exists, and also if the password given allows access\n if @user && @user.authenticate(user_login_params[:password])\n # encode_token method comes from ApplicationController (which we are inheriting from on line 1).\n #this creates a variable with the value of our token \n @token = encode_token({ user_id: @user.id })\n \n # UserSerializer is a serializer in the serializers folder. To use this the active_model_serializers gem is needed.\n # This helps clean the data that is sent out to limited attributes you want listed\n render json: { user: UserSerializer.new(@user), jwt: @token }, status: :accepted\n \n # Without a serializer or status the following line would suffice\n # render json: { user: @user, jwt: @token}\n \n else\n # Vague error message for user security (never tell someone they got a specific input incorrect), adding a status code \n render json: { message: 'Invalid username or password' }, status: :unauthorized\n end\n end", "def create\n user = User.create(user_params)\n\n if user.valid?\n render json: {user: UserSerializer.new(user), token: encode_token(user.id)}\n else\n render json: user.errors.full_messages\n end\n end", "def authenticate_and_load_user\n authentication_token = nil\n if request.headers[\"Authorization\"]\n authentication_token = request.headers[\"Authorization\"].split[1]\n end\n if authentication_token\n user = JWT.decode(authentication_token, nil, false, algorithms: 'RS256')\n username = user[0][\"nickname\"]\n email = user[0][\"name\"]\n\n if user[0]['sub'].include? 'google-oauth2'\n email = username + '@gmail.com'\n end\n\n @current_user = User.find_by(email: email, username: username)\n if !@current_user.present?\n user = User.new(email: email, username: username, password: '000000', password_confirmation: '000000', auth_token: authentication_token)\n if user.save\n @current_user = user\n end\n end\n end\n return if @current_user.present?\n render json: {\n messages: \"Can't authenticate user\",\n is_success: false,\n data: {}\n }, status: :bad_request\n end", "def create\n @user = User.new(user_params)\n if @user.save\n @token = encode_token({user_id: @user.id})\n render json: {user: @user, token: @token}\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n end", "def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n end", "def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n end", "def create\n user = User.new(user_params)\n if user.save\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token }\n json_response(response, :created)\n else\n response = { message: Message.account_not_created}\n json_response(response)\n end\n\n end", "def create\n @user = User.create_or_find_by(user_params)\n my_token = issue_token(@user)\n\n render json: {user: @user, token: my_token}\n # render json: @user\n \n end", "def authenticate_user\n @token = Token.find_by(auth_token: request.headers['HTTP_AUTH_TOKEN'])\n return render json: { message: 'token invalid' }, status: 422 unless @token\n\n @current_user = @token.user\n end", "def create\n user = User.new(user_params)\n if user.save\n payload = { user_id: user.id }\n\n hmac_secret = 'my$ecretK3ys'\n\n auth_token = JWT.encode(payload, hmac_secret)\n\n render json: { message: 'Account created successfully', auth_token: auth_token }\n else\n render json: { message: 'Something went wrong', errors: user.errors }, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(params[:user])\n\n session[:token] = @user.generateToken\n respond_to do |format|\n if @user.save\n unless session[:original_url].nil?\n redirect_to session[:original_url]\n return\n end\n format.html { redirect_to root_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\n @user = User.where(:email => params[:user][:email]).first\n\n if [email protected]?\n \trender :json => {:success => false, :message => \"User already registered\"}, :status => 401\n else\n \tbegin\n\t\t @user = User.new(params[:user])\n @user.password = Devise.friendly_token[0,20]\n\t\t if @user.save\n\t\t @api_key = ApiKey.find_or_create_token_for(@user)\n\t\t render :json => {:success => true, :message => \"Registration successful\",:access_key => @api_key.access_token, :user => @user}, :status => 200\n\t\t else\n\t\t \trender :json => {:success => false, :message => \"Error while creating user\"}, :status => :not_acceptable\n\t\t end\n\t\t rescue Exception => e\n p e\n\t \tp e.backtrace\n\t render :json => {:success => false, :message => e.backtrace}, :status => :not_acceptable\n\t end\n\t end\n end", "def create_non_admin_user_authenticate\n post '/users', 'username' => 'testuser', 'password' => 'testpassword', 'email_address' => '[email protected]'\n id_user = last_response.json_body['id']\n digest_authorize 'testuser', 'testpassword'\n id_user\nend", "def login_as(user_id)\n self.token = Token.create!(\n user_id: user_id,\n client: Client.first,\n expires_at: 5.months.from_now\n ).to_jwt\n end", "def create\n user = User\n .find_by(email: params[\"user\"][\"email\"])\n .try(:authenticate, params[\"user\"][\"password\"])\n # if the user was created, i.e., found an email password match, set session\n if user\n # sets an encrypted session cookie on the client side\n session[:user_id] = user.id\n render json: {\n status: :created,\n logged_in: true,\n user: user\n }\n else\n render json: { status: 401 }\n end\n end" ]
[ "0.7907597", "0.750828", "0.7498281", "0.7375742", "0.7311189", "0.71392804", "0.7091101", "0.7081595", "0.7062113", "0.70166934", "0.70166934", "0.6936785", "0.69351447", "0.69155777", "0.68668616", "0.6864494", "0.6863133", "0.6856628", "0.6841177", "0.6799786", "0.67926747", "0.6791998", "0.6791998", "0.6757858", "0.6757825", "0.674527", "0.6731194", "0.67195785", "0.67159903", "0.6703087", "0.66959816", "0.668285", "0.66793394", "0.66738033", "0.6666721", "0.6643209", "0.6640433", "0.6640125", "0.66380763", "0.66320485", "0.6625506", "0.6624376", "0.66232234", "0.6618761", "0.6618444", "0.6613552", "0.6610451", "0.65916127", "0.6590423", "0.65883595", "0.6583051", "0.6580253", "0.6579541", "0.6579078", "0.6578754", "0.6571228", "0.6569716", "0.65682334", "0.6562544", "0.6560254", "0.655885", "0.6555686", "0.65555096", "0.65516865", "0.653905", "0.652379", "0.6500833", "0.64932716", "0.648899", "0.64863026", "0.648585", "0.64815193", "0.64797795", "0.6477001", "0.64588034", "0.6440382", "0.6433337", "0.64309317", "0.6426416", "0.6423615", "0.64173675", "0.6415441", "0.6414796", "0.64145887", "0.6411861", "0.64117396", "0.6404989", "0.64026546", "0.64017034", "0.64000654", "0.64000654", "0.64000654", "0.63998276", "0.63973916", "0.6395683", "0.6383046", "0.6378693", "0.63748527", "0.6373892", "0.63719904", "0.63634926" ]
0.0
-1
Returns the AUthorization URL to verify a Twitter Accounts. Returns the AUthorization URL to verify a Twitter Accounts
def get_fractal_authentication_url(opts = {}) data, _status_code, _headers = get_fractal_authentication_url_with_http_info(opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def twitter_url; \"https://twitter.com/#{twitter}\" end", "def twitter_url\n twitter_user.blank? ? nil : \"#{TWITTER_URL}#{twitter_user}\"\n end", "def base_url\n \"https://api.twitter.com\"\n end", "def main_url\n return nil unless twitter\n \"http://twitter.com/#{twitter.downcase}\"\n end", "def twitter_url(username)\n \"https://twitter.com/#!/#{username}\"\n end", "def authorize_url\n polymorphic_url([ @workspace, :twitter_account ], :action => 'authorize')\n end", "def url\n \"http://twitter.com/#{self.username}/statuses/#{self.twitter_id}\"\n end", "def tw_profile_url\n \"http://twitter.com/intent/user?user_id=#{tw_user_id}\"\n end", "def twitter\n\t\thandle_omniauth_callback(request.env['omniauth.auth'])\n\tend", "def twitter\n callback_from :twitter\n end", "def oauth_callback_url\n end", "def twitter_url(json)\n \"http://twitter.com/#{json['from_user']}/status/#{json['id']}\"\n end", "def url\n \"http://twitter.com/#{attribute_get(:username)}/statuses/#{attribute_get(:id)}\"\n end", "def url\n @author_url ||= begin\n \"http://twitter.com/#{self.screenname}\" if self.screenname\n end\n end", "def get_twitter_authentication_url(opts = {})\n data, _status_code, _headers = get_twitter_authentication_url_with_http_info(opts)\n data\n end", "def twitter_ref_link\n url = u(root_url(:ref_id => current_user.id))\n \"http://twitter.com/home/?status=#{u(Setting::get('Facebook invitation text'))} #{url}\"\n end", "def link_twitter\n\n end", "def twitter_share_url(options = {})\n \"https://twitter.com/share?#{options.to_query}\"\n end", "def twitter_check\n begin\n unless twitter.blank?\n RestClient.get \"twitter.com/#{twitter}\"\n end\n rescue\n errors.add :base, \"Invalid Twitter account.\"\n end\n end", "def twitter?\n self.provider == 'twitter'\n end", "def author_url\n @author_url ||= begin\n \"http://twitter.com/#{self.author_screenname}\" if self.author_screenname\n end\n end", "def callback_url\n auth_endpoint_callback_url(org: @organization.id)\n end", "def checkURL(twitter_user)\n\tchecker = twitter_user.to_s\n\tif checker.start_with?(\"http://\") or checker.start_with?(\"https://\") or checker.start_with?(\"twitter.\")\n\t\treturn checker[checker.rindex('/')+1..checker.length]\n\telse \n\t\treturn checker\n\tend\nend", "def twitter_url\n\t\ttwitter = []\n\t\ttext = html.search(\"a\").text.split(\" \")\n\t\ttext.each do |element|\n\t\t\tif element.to_s.match(/@/)\n\t\t\t\ttwitter << element\n\t\t\tend\n\t\tend\n\t\t\treturn twitter\n\tend", "def twitter\n handle_callback(:twitter)\n end", "def twitter\n default_oauth_callback do |auth|\n # username may already be taken, user will have to enter another one\n if User.exists? username: auth.info.nickname\n redirect_to controller: '/registrations', action: 'twitter_screen_name_clash'\n else\n default_oauth_fail\n end\n end\n end", "def twitter\n handle_oauth\n end", "def twitter?\n provider_name == 'Twitter'\n end", "def grab_url(tweet)\n\t\t# only grabs the url from the tweet text and replaces any https with http\n\t\ttweet.text.split(' ').find { |hunk| hunk =~ /\\Ahttps{0,1}:\\/\\/t.co/ }.gsub('https', 'http')\n\tend", "def oauth_callback_url\n url_for :action => \"list\"\n end", "def twitter\n \toauth.authorize_from_access(oauth_token, oauth_secret)\n\t @twitter ||= Twitter::Base.new(oauth)\n end", "def wepay_authorization_url(redirect_uri)\n\t WEPAY.oauth2_authorize_url(redirect_uri, self.email, self.name)\n\tend", "def twitter\n auth = request.env['omniauth.auth']\n current_user.company.create_or_update_twitter_account(auth)\n\n flash.notice = 'Authorized Twitter account successfully.'\n redirect_to twitter_accounts_path\n end", "def wepay_authorization_url(redirect_uri)\n WEPAY.oauth2_authorize_url(redirect_uri, self.email, self.name)\nend", "def share_on_twitter_url(object)\n url = member_url([@tier, @topic, object])\n title = object.title\n \"http://twitter.com/home?status=#{url}\"\n end", "def url\n \"http://twitter.com/search/?q=\" + self.query\n end", "def oauth #:nodoc:\n @oauth ||= Bountybase.config.twitter[Bountybase.instance] ||\n begin\n E \"Cannot find twitter configuration for\", Bountybase.instance\n raise \"Cannot find twitter configuration\"\n end\n end", "def oauth_url\n 'https://geoloqi.com/oauth/authorize'\n end", "def connected_to_twitter?\n twitter_token && twitter_secret\n end", "def url\n File.join(DigitalRiver.config.oauth_url)\n end", "def twitter_connect\n access_token = OAuth::AccessToken.new(UserSession.oauth_consumer, self.oauth_token, self.oauth_secret)\n user_info = JSON.parse(access_token.get(\"https://twitter.com/account/verify_credentials.json\").body)\n self.twitter_name = user_info['name']\n self.twitter_screen_name = user_info['screen_name']\n self.login = 'twitter_' + user_info['screen_name']\n self.password = \"5uttr33_#{self.login}\"\n self.signup_source = 'twitter'\n self.save\n end", "def twitter_link(player)\n if player.twitter_screen_name\n # clean up any bad characters in a player's twitter name\n twitter_user = player.twitter_screen_name.sub(/^.*[@\\/]/, '')\n\n link_to(\"@\" + twitter_user, \"http://twitter.com/#{twitter_user}\")\n end\n end", "def url\n File.join(DigitalRiver.config.oauth_url)\n end", "def get_authorize_url(callback=nil)\n get_request_token()\n\n url = \"/#{Dropbox::API_VERSION}/oauth/authorize?oauth_token=#{URI.escape(@request_token.key)}\"\n if callback\n url += \"&oauth_callback=#{URI.escape(callback)}\"\n end\n if @locale\n url += \"&locale=#{URI.escape(@locale)}\"\n end\n\n \"https://#{Dropbox::WEB_SERVER}#{url}\"\n end", "def authorization_url\n\t\t@client ||= api_client()\n\t\[email protected]_uri.to_s\n\tend", "def select_twitter_account(&callback)\n account_type = @store.accountTypeWithAccountTypeIdentifier(ACAccountTypeIdentifierTwitter)\n\n @store.requestAccessToAccountsWithType(account_type, options: nil, completion: -> (granted, error) do\n if granted\n @accounts = @store.accountsWithAccountType(account_type)\n if @accounts.length > 0\n Dispatch::Queue.main.async do\n next_step = -> (account, &firebase_handler) do\n self.authenticate_account(account, &firebase_handler)\n end\n callback.call(nil, @accounts, next_step)\n end if callback\n else\n error = NSError.alloc.initWithDomain('TwitterAuthHelper',\n code: AuthHelperErrorAccountAccessDenied,\n userInfo: { NSLocalizedDescriptionKey => 'No Twitter accounts detected on phone. Please add one in the settings first.' })\n Dispatch::Queue.main.async do\n callback.call(error, nil, nil)\n end if callback\n end\n else\n error = NSError.alloc.initWithDomain('TwitterAuthHelper',\n code: AuthHelperErrorAccountAccessDenied,\n userInfo: { NSLocalizedDescriptionKey => 'Access to twitter accounts denied.' })\n Dispatch::Queue.main.async do\n callback.call(error, nil, nil)\n end if callback\n end\n end)\n end", "def twitter?\n false\n end", "def oauth_url\n @oauth_url || File.join(host, \"oauth20/token\")\n end", "def get_twitter_authentication_url_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AuthenticationServiceApi.get_twitter_authentication_url ...'\n end\n # resource path\n local_var_path = '/authentication/twitter'\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] || 'File' \n\n # auth_names\n auth_names = opts[:auth_names] || []\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: AuthenticationServiceApi#get_twitter_authentication_url\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_authurl\n\t\tlogger.debug \"D, #{__method__.to_s}\"\n\t\tparams = {\n \"client_id\" => @client_id,\n \"response_type\" => \"code\",\n \"redirect_uri\" => @redirect_uri,\n \"prompt\" => \"consent\"\n }\n auth_uri = URI::Generic.new(\"https\", nil, @auth_url, nil, nil, \"authorize\", \n \t\t\t\t\t\t\t nil, nil, nil)\n auth_uri.query = URI.encode_www_form(params)\n logger.debug \"D, #{__method__.to_s}, #{auth_uri.to_s}\"\n return auth_uri.to_s\n\tend", "def wepay_authorization_url(redirect_uri)\n\t #Wefarm::Application::WEPAY.oauth2_authorize_url(OAUTH_REDIRECT_URI + self.id.to_s, self.email, self.name)\n\t Wefarm::Application::WEPAY.oauth2_authorize_url(redirect_uri, self.email, self.name)\n\tend", "def two_factor_otp_url\n \"otpauth://totp/%{app_id}?secret=%{secret}&issuer=%{app}\" % {\n :secret => current_user.unconfirmed_otp_secret,\n :app => \"Hammad\",\n :app_id => \"Ham\"\n }\n end", "def twitter_connect\n access_token = OAuth::AccessToken.new(UserSession.oauth_consumer, self.oauth_token, self.oauth_secret)\n user_info = JSON.parse(access_token.get(\"https://twitter.com/account/verify_credentials.json\").body)\n\n self.login = user_info['screen_name']\n self.twitter_name = user_info['name']\n self.password = \"5uttr33_#{self.login}\"\n self.signup_source = 'twitter'\n self.save\n end", "def authorization_url\n uri = URI(OAUTH_URL)\n uri.query = {\n client_id: client_id,\n redirect_uri: redirect_uri,\n scope: scope_url,\n response_type: 'code',\n access_type: 'offline'\n }.to_param\n\n uri.to_s\n end", "def twitter\n @user = current_user\n if params[:oauth_verifier]\n if @user.user_content.twitter_token.blank?\n clientTwitter = TwitterOAuth::Client.new(:consumer_key => TwitterEnv::API_KEY, :consumer_secret => TwitterEnv::SECRET_KEY)\n pin = params[:oauth_verifier]\n access_token = clientTwitter.authorize(session[:rtoken_twitter], session[:rsecret_twitter], :oauth_verifier => pin)\n @user.user_content.twitter_token = access_token.token\n @user.user_content.twitter_secret = access_token.secret\n @user.user_content.save\n else\n clientTwitter = TwitterOAuth::Client.new(\n :consumer_key => TwitterEnv::API_KEY,\n :consumer_secret => TwitterEnv::SECRET_KEY,\n :token => @user.user_content.twitter_token, \n :secret => @user.user_content.twitter_secret)\n end\n end\n \n redirect_to \"/backend/social\"\n end", "def api_url\n authentication_credentials_provided? ? \"https://api.gowalla.com\" : \"http://api.gowalla.com\"\n end", "def oauth_url_authorize\n return \"#{$SETTINGS[:oauth_server_url_authorize]}?response_type=code&client_id=#{$SETTINGS[:oauth_client_id]}&scope=ALL&redirect_uri=#{oauth_redirect_uri}\" \n end", "def get_user_auth_url\n @oauth_token = request_oauth_token\n return @authorize_url + \"?oauth_token=\" + @oauth_token[\"oauth_token\"]\n rescue\n puts $! if @@verbose\n return nil\n end", "def authorize_url(callback_url)\n request_token.authorize_url+'&oauth_callback='+CGI.escape(callback_url)\n end", "def connect_twitter\n auth = request.env[\"omniauth.auth\"]\n current_member.twitter_token = auth[\"credentials\"][\"token\"]\n current_member.twitter_secret = auth[\"credentials\"][\"secret\"]\n current_member.twitter_id = auth[\"uid\"]\n if current_member.img_url.blank?\n current_member.username = auth.info.name\n current_member.img_url = auth.info.image\n\t end\n current_member.save\n\t TwitterModel.store_urls(current_member)\n\t redirect_to members_social_sign_up_path\n end", "def twitter?\n self.twitter_token && self.twitter_secret\n end", "def oauth_url\n url = <<-URL\n https://www.facebook.com/dialog/oauth/\n ?client_id=#{Network::Facebook.app_id}\n &redirect_uri=#{URI.escape(\"#{root_url}auth/facebook/?r=#{redirect_for(request.referer)}\")}\n &scope=#{Network::Facebook.scope}\n URL\n url.gsub(/\\s+/, '')\n end", "def authorized_twitter\n oauth = Twitter::OAuth.new($configure[:twitter][:ctoken], $configure[:twitter][:csecret])\n # Request OAuth authentication if there are no access token yet\n unless($configure[:twitter][:atoken] && $configure[:twitter][:asecret])\n rtoken = oauth.request_token\n puts \"Open next url, authorize this application: #{rtoken.authorize_url}\"\n puts \"Then, enter PIN code:\"\n pin = STDIN.gets.chomp\n # Authrize request token using PIN code (this is required for an application which type is \"Client\")\n atoken = OAuth::RequestToken.new(oauth.consumer, rtoken.token, rtoken.secret).get_access_token(:oauth_verifier => pin)\n # Save access token\n $configure[:twitter][:atoken] = atoken.token\n $configure[:twitter][:asecret] = atoken.secret\n end\n oauth.authorize_from_access($configure[:twitter][:atoken], $configure[:twitter][:asecret])\n # Create Twitter client instance with OAuth\n Twitter::Base.new(oauth)\nend", "def gardener_url\n (ENV['SUT_SCHEME'] || 'https') + \"://\" + gardener_fqhn()\n end", "def twitter_profile\n @network = current_user.network ||= Network.new\n (@network.twitter.nil?) ? \"\" : @network.twitter\n end", "def callback_url\n options.authorize_params.callback_url or super\n end", "def authorize_url(options = {})\n options[:response_type] ||= \"code\"\n options[:redirect_uri] ||= redirect_uri\n params = authorization_params.merge(options)\n uri = URI(\"#{base_url}/api/oauth2/auth/\")\n uri.query = URI.encode_www_form(params)\n uri.to_s\n end", "def get_auth_url(use_callback_flow=true)\n raise 'To be implemented in child classes'\n end", "def get_auth_url\n\t\tURI::HTTPS.build(\n\t\t\t:host => @options['auth_host'],\n\t\t\t:path => @options['auth_page'],\n\t\t\t:query => {\n\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t\t:response_type => \"code\",\n\t\t\t}.to_query\n\t\t).to_s\n\tend", "def auth_url\n client.authorization.authorization_uri(state: '', approval_prompt: :force, access_type: :offline, user_id: client_email).to_s\n end", "def authorize_url\n client.web_server.authorize_url( :redirect_uri => callback_url )\n end", "def callback_url\n if @authorization_code_from_signed_request_in_cookie\n ''\n else\n # Fixes regression in omniauth-oauth2 v1.4.0 by https://github.com/intridea/omniauth-oauth2/commit/85fdbe117c2a4400d001a6368cc359d88f40abc7\n options[:callback_url] || (full_host + script_name + callback_path)\n end\n end", "def get_authorization_url\n $LOG.i \"requesting authorization URL\"\n \n @oauth2_client.auth_code.authorize_url(:redirect_uri => @config.redirect_uri)\n end", "def get_authorize_url\n return get_request_token.authorize_url\n end", "def person_omniauth_authorize_path_or_url(provider)\n SecureUrlHelper.https? ? person_omniauth_authorize_url(provider, :protocol => 'https') : person_omniauth_authorize_path(provider)\n end", "def authentication_url(params={})\n @request_token.authorize_url params\n end", "def get_auth_url\n\t\tURI::HTTP.build(\n\t\t\t:host => @options['auth_host'],\n\t\t\t:path => @options['auth_page'],\n\t\t\t:query => {\n\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t:scope => @options['scope'],\n\t\t\t\t:response_type => \"code\",\n\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t}.to_query\n\t\t).to_s\n\tend", "def twitter\n @data['social']['twitter']\n end", "def twitt\n if PLANETOID_CONF[:twitter][:users][:send_twitts]\n twit=Twitter::Base.new(Twitter::HTTPAuth.new(PLANETOID_CONF[:twitter][:user], PLANETOID_CONF[:twitter][:password]))\n twit.update \"#{PLANETOID_CONF[:twitter][:users][:prefix]} #{self.name} #{PLANETOID_CONF[:site][:url]}/#{self.slug}\" \n end\n end", "def sso_integration_callback_url\n # Usually http://example.com/auth/:system_name/callback\n url = callback_url(query: {})\n\n case kind\n when 'auth0'\n # e.g. http://example.com/auth/invitations/auth0/auth0_123abc/callback\n invitation_signup = client.callback_url(\"#{base_url}/invitations\")\n\n [url, invitation_signup].join(', ')\n else\n url\n end\n end", "def get_authorization_url(request_token, callback_url)\n \"#{request_token.authorize_url}&oauth_callback=#{CGI::escape(callback_url)}\"\n end", "def oauth_redirect_uri\n uri = URI.parse(request.url)\n uri.path = '/sk_auth/callback'\n uri.query = nil\n uri.to_s\n end", "def my_account_url\n get_institution_or_default(:eshelf_url) + '/account'\n end", "def authorize_url\n @connection.authorize_url\n end", "def third_party_connect\n if tw_user_id.nil? && fb_user_id.nil?\n errors.add(\"Either twitter or facebook connect required\") \n end\n end", "def twitter?; twitter.to_s != \"\" end", "def authorize_url\n request_token.authorize_url\n end", "def path_to_url(path, query_values = nil)\n Addressable::URI.new(\n :scheme => \"https\",\n :host => \"api.twitter.com\",\n :path => path,\n :query_values => query_values\n ).to_s\n end", "def getAuthUrl\n\t\t\t\tURI::HTTP.build(\n\t\t\t\t\t:host => @options['auth_host'],\n\t\t\t\t\t:path => @options['auth_page'],\n\t\t\t\t\t:query => {\n\t\t\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t\t\t:scope => @options['scope'],\n\t\t\t\t\t\t:response_type => \"code\",\n\t\t\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t\t\t}.to_query\n\t\t\t\t).to_s\n\t\t\tend", "def oauth\n ::OAuth::Consumer.new(Config.consumer_key, Config.consumer_secret, :site => \"https://api.twitter.com\")\n end", "def oauth_url(response_type = 'code')\n # The Redirect URI must be the same as registered with Put.io\n PUTIO_BASE_URL + \"/oauth2/authenticate?client_id=%i&response_type=%s&redirect_uri=%s\" % [@client_id, response_type, @redirect_uri]\n end", "def twitter\n if twitter?\n return self.twitter_client if self.twitter_client\n self.twitter_client = TwitterOAuth::Client.new(\n :consumer_key => TWITTER_CONSUMER_KEY,\n :consumer_secret => TWITTER_CONSUMER_SECRET,\n :token => self.twitter_token,\n :secret => self.twitter_secret\n )\n else\n false\n end\n end", "def pubsubhubbub_callback_url\n ENV['PUBSUBHUBBUB_CALLBACK_URL'].presence || Rails.application.routes.url_helpers\n .url_for(controller: 'curry/pull_request_updates', action: 'create',\n host: ENV['FQDN'], protocol: ENV['PROTOCOL'], port: ENV['PORT'])\n end", "def activation_url\n return @activation_url\n end", "def access_token_url\n Settings.lighthouse_health_immunization.access_token_url\n end", "def inject_url_into_tweets\n self.up_tweet = \"#{self.up_tweet} #{public_url}\" if !self.up_tweet.include?(public_url)\n self.down_tweet = \"#{self.down_tweet} #{public_url}\" if self.is_pool && !self.down_tweet.include?(public_url)\n end", "def authorization_url\n url = \"#{host}/OAuth2AccessRequest.action?response_type=code&client_id=#{@client_id}\"\n url += \"&redirect_uri=#{Addressable::URI.escape(@redirect_uri)}\" if @redirect_uri\n url += \"&state=#{@state}\" if @state\n url\n end", "def twitter_callback\n\t if I18n.locale == :en\n\t \tflash[:notice] = \"Connected to Twitter successfully!\"\n\t else I18n.locale == :ar\n\t \tflash[:notice] = \"تم التواصل مع تويتر بنجاح!\"\n\t end\n\t auth = request.env[\"omniauth.auth\"]\n authentication = Authentication.find_by_provider_and_gid(auth[\"provider\"],\n current_gamer.id) || Authentication.create_with_omniauth(auth,\n current_gamer)\n redirect_to \"/gamers/edit\"\n return\n\tend", "def authorize_url\n client = OAuth2::Client.new(client_id, client_secret, :site => oauth_url)\n client.auth_code.authorize_url(:redirect_uri => redirect_uri)\n end", "def connectURL\n\t\t\"http://beta.stoffiplayer.com/auth/#{provider}\"\n\tend", "def failure\n flash.alert = 'Failed to authorize Twitter account.'\n redirect_to twitter_accounts_url\n end" ]
[ "0.7546892", "0.7190639", "0.7092497", "0.69991124", "0.68396217", "0.67324185", "0.6599785", "0.6565017", "0.63878524", "0.6371813", "0.6354215", "0.62596524", "0.6244645", "0.6241036", "0.623741", "0.6116047", "0.606739", "0.6066744", "0.6053066", "0.6052869", "0.60273564", "0.60177666", "0.6017025", "0.6001418", "0.5972043", "0.59369254", "0.59335107", "0.59290326", "0.5912156", "0.5900696", "0.58936733", "0.5887514", "0.58729637", "0.5865461", "0.5856088", "0.58126664", "0.5790683", "0.5762309", "0.5753878", "0.5751952", "0.5748157", "0.57196325", "0.5714748", "0.5702582", "0.569334", "0.56917566", "0.56843984", "0.56834185", "0.566599", "0.56652856", "0.56624985", "0.5653593", "0.56411165", "0.56352735", "0.563038", "0.5617304", "0.5609589", "0.55954045", "0.55861366", "0.5586056", "0.5576993", "0.55733466", "0.55677676", "0.55618", "0.5559857", "0.5553358", "0.55436987", "0.5542649", "0.5539909", "0.5535514", "0.5529221", "0.5525214", "0.55233335", "0.55154765", "0.5515381", "0.54942244", "0.5489966", "0.5488691", "0.5488451", "0.54789674", "0.5476297", "0.54668915", "0.5466102", "0.54633766", "0.5458304", "0.5454277", "0.5454252", "0.54515886", "0.5434484", "0.5432318", "0.54319996", "0.5430277", "0.54152834", "0.54096204", "0.53907263", "0.5389485", "0.53883964", "0.53878623", "0.5375404", "0.53726137", "0.53718865" ]
0.0
-1
Returns the AUthorization URL to verify a Twitter Accounts. Returns the AUthorization URL to verify a Twitter Accounts
def get_fractal_authentication_url_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AuthenticationServiceApi.get_fractal_authentication_url ...' end # resource path local_var_path = '/authentication/fractal' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'File' # auth_names auth_names = opts[:auth_names] || [] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AuthenticationServiceApi#get_fractal_authentication_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def twitter_url; \"https://twitter.com/#{twitter}\" end", "def twitter_url\n twitter_user.blank? ? nil : \"#{TWITTER_URL}#{twitter_user}\"\n end", "def base_url\n \"https://api.twitter.com\"\n end", "def main_url\n return nil unless twitter\n \"http://twitter.com/#{twitter.downcase}\"\n end", "def twitter_url(username)\n \"https://twitter.com/#!/#{username}\"\n end", "def authorize_url\n polymorphic_url([ @workspace, :twitter_account ], :action => 'authorize')\n end", "def url\n \"http://twitter.com/#{self.username}/statuses/#{self.twitter_id}\"\n end", "def tw_profile_url\n \"http://twitter.com/intent/user?user_id=#{tw_user_id}\"\n end", "def twitter\n\t\thandle_omniauth_callback(request.env['omniauth.auth'])\n\tend", "def twitter\n callback_from :twitter\n end", "def oauth_callback_url\n end", "def twitter_url(json)\n \"http://twitter.com/#{json['from_user']}/status/#{json['id']}\"\n end", "def url\n \"http://twitter.com/#{attribute_get(:username)}/statuses/#{attribute_get(:id)}\"\n end", "def url\n @author_url ||= begin\n \"http://twitter.com/#{self.screenname}\" if self.screenname\n end\n end", "def get_twitter_authentication_url(opts = {})\n data, _status_code, _headers = get_twitter_authentication_url_with_http_info(opts)\n data\n end", "def twitter_ref_link\n url = u(root_url(:ref_id => current_user.id))\n \"http://twitter.com/home/?status=#{u(Setting::get('Facebook invitation text'))} #{url}\"\n end", "def link_twitter\n\n end", "def twitter_share_url(options = {})\n \"https://twitter.com/share?#{options.to_query}\"\n end", "def twitter_check\n begin\n unless twitter.blank?\n RestClient.get \"twitter.com/#{twitter}\"\n end\n rescue\n errors.add :base, \"Invalid Twitter account.\"\n end\n end", "def twitter?\n self.provider == 'twitter'\n end", "def author_url\n @author_url ||= begin\n \"http://twitter.com/#{self.author_screenname}\" if self.author_screenname\n end\n end", "def checkURL(twitter_user)\n\tchecker = twitter_user.to_s\n\tif checker.start_with?(\"http://\") or checker.start_with?(\"https://\") or checker.start_with?(\"twitter.\")\n\t\treturn checker[checker.rindex('/')+1..checker.length]\n\telse \n\t\treturn checker\n\tend\nend", "def callback_url\n auth_endpoint_callback_url(org: @organization.id)\n end", "def twitter_url\n\t\ttwitter = []\n\t\ttext = html.search(\"a\").text.split(\" \")\n\t\ttext.each do |element|\n\t\t\tif element.to_s.match(/@/)\n\t\t\t\ttwitter << element\n\t\t\tend\n\t\tend\n\t\t\treturn twitter\n\tend", "def twitter\n handle_callback(:twitter)\n end", "def twitter\n default_oauth_callback do |auth|\n # username may already be taken, user will have to enter another one\n if User.exists? username: auth.info.nickname\n redirect_to controller: '/registrations', action: 'twitter_screen_name_clash'\n else\n default_oauth_fail\n end\n end\n end", "def twitter\n handle_oauth\n end", "def twitter?\n provider_name == 'Twitter'\n end", "def grab_url(tweet)\n\t\t# only grabs the url from the tweet text and replaces any https with http\n\t\ttweet.text.split(' ').find { |hunk| hunk =~ /\\Ahttps{0,1}:\\/\\/t.co/ }.gsub('https', 'http')\n\tend", "def oauth_callback_url\n url_for :action => \"list\"\n end", "def twitter\n \toauth.authorize_from_access(oauth_token, oauth_secret)\n\t @twitter ||= Twitter::Base.new(oauth)\n end", "def wepay_authorization_url(redirect_uri)\n\t WEPAY.oauth2_authorize_url(redirect_uri, self.email, self.name)\n\tend", "def twitter\n auth = request.env['omniauth.auth']\n current_user.company.create_or_update_twitter_account(auth)\n\n flash.notice = 'Authorized Twitter account successfully.'\n redirect_to twitter_accounts_path\n end", "def wepay_authorization_url(redirect_uri)\n WEPAY.oauth2_authorize_url(redirect_uri, self.email, self.name)\nend", "def share_on_twitter_url(object)\n url = member_url([@tier, @topic, object])\n title = object.title\n \"http://twitter.com/home?status=#{url}\"\n end", "def url\n \"http://twitter.com/search/?q=\" + self.query\n end", "def oauth #:nodoc:\n @oauth ||= Bountybase.config.twitter[Bountybase.instance] ||\n begin\n E \"Cannot find twitter configuration for\", Bountybase.instance\n raise \"Cannot find twitter configuration\"\n end\n end", "def oauth_url\n 'https://geoloqi.com/oauth/authorize'\n end", "def connected_to_twitter?\n twitter_token && twitter_secret\n end", "def url\n File.join(DigitalRiver.config.oauth_url)\n end", "def twitter_connect\n access_token = OAuth::AccessToken.new(UserSession.oauth_consumer, self.oauth_token, self.oauth_secret)\n user_info = JSON.parse(access_token.get(\"https://twitter.com/account/verify_credentials.json\").body)\n self.twitter_name = user_info['name']\n self.twitter_screen_name = user_info['screen_name']\n self.login = 'twitter_' + user_info['screen_name']\n self.password = \"5uttr33_#{self.login}\"\n self.signup_source = 'twitter'\n self.save\n end", "def twitter_link(player)\n if player.twitter_screen_name\n # clean up any bad characters in a player's twitter name\n twitter_user = player.twitter_screen_name.sub(/^.*[@\\/]/, '')\n\n link_to(\"@\" + twitter_user, \"http://twitter.com/#{twitter_user}\")\n end\n end", "def url\n File.join(DigitalRiver.config.oauth_url)\n end", "def get_authorize_url(callback=nil)\n get_request_token()\n\n url = \"/#{Dropbox::API_VERSION}/oauth/authorize?oauth_token=#{URI.escape(@request_token.key)}\"\n if callback\n url += \"&oauth_callback=#{URI.escape(callback)}\"\n end\n if @locale\n url += \"&locale=#{URI.escape(@locale)}\"\n end\n\n \"https://#{Dropbox::WEB_SERVER}#{url}\"\n end", "def authorization_url\n\t\t@client ||= api_client()\n\t\[email protected]_uri.to_s\n\tend", "def select_twitter_account(&callback)\n account_type = @store.accountTypeWithAccountTypeIdentifier(ACAccountTypeIdentifierTwitter)\n\n @store.requestAccessToAccountsWithType(account_type, options: nil, completion: -> (granted, error) do\n if granted\n @accounts = @store.accountsWithAccountType(account_type)\n if @accounts.length > 0\n Dispatch::Queue.main.async do\n next_step = -> (account, &firebase_handler) do\n self.authenticate_account(account, &firebase_handler)\n end\n callback.call(nil, @accounts, next_step)\n end if callback\n else\n error = NSError.alloc.initWithDomain('TwitterAuthHelper',\n code: AuthHelperErrorAccountAccessDenied,\n userInfo: { NSLocalizedDescriptionKey => 'No Twitter accounts detected on phone. Please add one in the settings first.' })\n Dispatch::Queue.main.async do\n callback.call(error, nil, nil)\n end if callback\n end\n else\n error = NSError.alloc.initWithDomain('TwitterAuthHelper',\n code: AuthHelperErrorAccountAccessDenied,\n userInfo: { NSLocalizedDescriptionKey => 'Access to twitter accounts denied.' })\n Dispatch::Queue.main.async do\n callback.call(error, nil, nil)\n end if callback\n end\n end)\n end", "def twitter?\n false\n end", "def oauth_url\n @oauth_url || File.join(host, \"oauth20/token\")\n end", "def get_twitter_authentication_url_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AuthenticationServiceApi.get_twitter_authentication_url ...'\n end\n # resource path\n local_var_path = '/authentication/twitter'\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] || 'File' \n\n # auth_names\n auth_names = opts[:auth_names] || []\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: AuthenticationServiceApi#get_twitter_authentication_url\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_authurl\n\t\tlogger.debug \"D, #{__method__.to_s}\"\n\t\tparams = {\n \"client_id\" => @client_id,\n \"response_type\" => \"code\",\n \"redirect_uri\" => @redirect_uri,\n \"prompt\" => \"consent\"\n }\n auth_uri = URI::Generic.new(\"https\", nil, @auth_url, nil, nil, \"authorize\", \n \t\t\t\t\t\t\t nil, nil, nil)\n auth_uri.query = URI.encode_www_form(params)\n logger.debug \"D, #{__method__.to_s}, #{auth_uri.to_s}\"\n return auth_uri.to_s\n\tend", "def wepay_authorization_url(redirect_uri)\n\t #Wefarm::Application::WEPAY.oauth2_authorize_url(OAUTH_REDIRECT_URI + self.id.to_s, self.email, self.name)\n\t Wefarm::Application::WEPAY.oauth2_authorize_url(redirect_uri, self.email, self.name)\n\tend", "def two_factor_otp_url\n \"otpauth://totp/%{app_id}?secret=%{secret}&issuer=%{app}\" % {\n :secret => current_user.unconfirmed_otp_secret,\n :app => \"Hammad\",\n :app_id => \"Ham\"\n }\n end", "def twitter_connect\n access_token = OAuth::AccessToken.new(UserSession.oauth_consumer, self.oauth_token, self.oauth_secret)\n user_info = JSON.parse(access_token.get(\"https://twitter.com/account/verify_credentials.json\").body)\n\n self.login = user_info['screen_name']\n self.twitter_name = user_info['name']\n self.password = \"5uttr33_#{self.login}\"\n self.signup_source = 'twitter'\n self.save\n end", "def authorization_url\n uri = URI(OAUTH_URL)\n uri.query = {\n client_id: client_id,\n redirect_uri: redirect_uri,\n scope: scope_url,\n response_type: 'code',\n access_type: 'offline'\n }.to_param\n\n uri.to_s\n end", "def twitter\n @user = current_user\n if params[:oauth_verifier]\n if @user.user_content.twitter_token.blank?\n clientTwitter = TwitterOAuth::Client.new(:consumer_key => TwitterEnv::API_KEY, :consumer_secret => TwitterEnv::SECRET_KEY)\n pin = params[:oauth_verifier]\n access_token = clientTwitter.authorize(session[:rtoken_twitter], session[:rsecret_twitter], :oauth_verifier => pin)\n @user.user_content.twitter_token = access_token.token\n @user.user_content.twitter_secret = access_token.secret\n @user.user_content.save\n else\n clientTwitter = TwitterOAuth::Client.new(\n :consumer_key => TwitterEnv::API_KEY,\n :consumer_secret => TwitterEnv::SECRET_KEY,\n :token => @user.user_content.twitter_token, \n :secret => @user.user_content.twitter_secret)\n end\n end\n \n redirect_to \"/backend/social\"\n end", "def api_url\n authentication_credentials_provided? ? \"https://api.gowalla.com\" : \"http://api.gowalla.com\"\n end", "def oauth_url_authorize\n return \"#{$SETTINGS[:oauth_server_url_authorize]}?response_type=code&client_id=#{$SETTINGS[:oauth_client_id]}&scope=ALL&redirect_uri=#{oauth_redirect_uri}\" \n end", "def get_user_auth_url\n @oauth_token = request_oauth_token\n return @authorize_url + \"?oauth_token=\" + @oauth_token[\"oauth_token\"]\n rescue\n puts $! if @@verbose\n return nil\n end", "def connect_twitter\n auth = request.env[\"omniauth.auth\"]\n current_member.twitter_token = auth[\"credentials\"][\"token\"]\n current_member.twitter_secret = auth[\"credentials\"][\"secret\"]\n current_member.twitter_id = auth[\"uid\"]\n if current_member.img_url.blank?\n current_member.username = auth.info.name\n current_member.img_url = auth.info.image\n\t end\n current_member.save\n\t TwitterModel.store_urls(current_member)\n\t redirect_to members_social_sign_up_path\n end", "def authorize_url(callback_url)\n request_token.authorize_url+'&oauth_callback='+CGI.escape(callback_url)\n end", "def twitter?\n self.twitter_token && self.twitter_secret\n end", "def oauth_url\n url = <<-URL\n https://www.facebook.com/dialog/oauth/\n ?client_id=#{Network::Facebook.app_id}\n &redirect_uri=#{URI.escape(\"#{root_url}auth/facebook/?r=#{redirect_for(request.referer)}\")}\n &scope=#{Network::Facebook.scope}\n URL\n url.gsub(/\\s+/, '')\n end", "def authorized_twitter\n oauth = Twitter::OAuth.new($configure[:twitter][:ctoken], $configure[:twitter][:csecret])\n # Request OAuth authentication if there are no access token yet\n unless($configure[:twitter][:atoken] && $configure[:twitter][:asecret])\n rtoken = oauth.request_token\n puts \"Open next url, authorize this application: #{rtoken.authorize_url}\"\n puts \"Then, enter PIN code:\"\n pin = STDIN.gets.chomp\n # Authrize request token using PIN code (this is required for an application which type is \"Client\")\n atoken = OAuth::RequestToken.new(oauth.consumer, rtoken.token, rtoken.secret).get_access_token(:oauth_verifier => pin)\n # Save access token\n $configure[:twitter][:atoken] = atoken.token\n $configure[:twitter][:asecret] = atoken.secret\n end\n oauth.authorize_from_access($configure[:twitter][:atoken], $configure[:twitter][:asecret])\n # Create Twitter client instance with OAuth\n Twitter::Base.new(oauth)\nend", "def gardener_url\n (ENV['SUT_SCHEME'] || 'https') + \"://\" + gardener_fqhn()\n end", "def twitter_profile\n @network = current_user.network ||= Network.new\n (@network.twitter.nil?) ? \"\" : @network.twitter\n end", "def callback_url\n options.authorize_params.callback_url or super\n end", "def get_auth_url(use_callback_flow=true)\n raise 'To be implemented in child classes'\n end", "def authorize_url(options = {})\n options[:response_type] ||= \"code\"\n options[:redirect_uri] ||= redirect_uri\n params = authorization_params.merge(options)\n uri = URI(\"#{base_url}/api/oauth2/auth/\")\n uri.query = URI.encode_www_form(params)\n uri.to_s\n end", "def get_auth_url\n\t\tURI::HTTPS.build(\n\t\t\t:host => @options['auth_host'],\n\t\t\t:path => @options['auth_page'],\n\t\t\t:query => {\n\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t\t:response_type => \"code\",\n\t\t\t}.to_query\n\t\t).to_s\n\tend", "def auth_url\n client.authorization.authorization_uri(state: '', approval_prompt: :force, access_type: :offline, user_id: client_email).to_s\n end", "def authorize_url\n client.web_server.authorize_url( :redirect_uri => callback_url )\n end", "def callback_url\n if @authorization_code_from_signed_request_in_cookie\n ''\n else\n # Fixes regression in omniauth-oauth2 v1.4.0 by https://github.com/intridea/omniauth-oauth2/commit/85fdbe117c2a4400d001a6368cc359d88f40abc7\n options[:callback_url] || (full_host + script_name + callback_path)\n end\n end", "def get_authorization_url\n $LOG.i \"requesting authorization URL\"\n \n @oauth2_client.auth_code.authorize_url(:redirect_uri => @config.redirect_uri)\n end", "def get_authorize_url\n return get_request_token.authorize_url\n end", "def person_omniauth_authorize_path_or_url(provider)\n SecureUrlHelper.https? ? person_omniauth_authorize_url(provider, :protocol => 'https') : person_omniauth_authorize_path(provider)\n end", "def authentication_url(params={})\n @request_token.authorize_url params\n end", "def twitter\n @data['social']['twitter']\n end", "def get_auth_url\n\t\tURI::HTTP.build(\n\t\t\t:host => @options['auth_host'],\n\t\t\t:path => @options['auth_page'],\n\t\t\t:query => {\n\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t:scope => @options['scope'],\n\t\t\t\t:response_type => \"code\",\n\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t}.to_query\n\t\t).to_s\n\tend", "def twitt\n if PLANETOID_CONF[:twitter][:users][:send_twitts]\n twit=Twitter::Base.new(Twitter::HTTPAuth.new(PLANETOID_CONF[:twitter][:user], PLANETOID_CONF[:twitter][:password]))\n twit.update \"#{PLANETOID_CONF[:twitter][:users][:prefix]} #{self.name} #{PLANETOID_CONF[:site][:url]}/#{self.slug}\" \n end\n end", "def sso_integration_callback_url\n # Usually http://example.com/auth/:system_name/callback\n url = callback_url(query: {})\n\n case kind\n when 'auth0'\n # e.g. http://example.com/auth/invitations/auth0/auth0_123abc/callback\n invitation_signup = client.callback_url(\"#{base_url}/invitations\")\n\n [url, invitation_signup].join(', ')\n else\n url\n end\n end", "def get_authorization_url(request_token, callback_url)\n \"#{request_token.authorize_url}&oauth_callback=#{CGI::escape(callback_url)}\"\n end", "def oauth_redirect_uri\n uri = URI.parse(request.url)\n uri.path = '/sk_auth/callback'\n uri.query = nil\n uri.to_s\n end", "def my_account_url\n get_institution_or_default(:eshelf_url) + '/account'\n end", "def authorize_url\n @connection.authorize_url\n end", "def third_party_connect\n if tw_user_id.nil? && fb_user_id.nil?\n errors.add(\"Either twitter or facebook connect required\") \n end\n end", "def twitter?; twitter.to_s != \"\" end", "def authorize_url\n request_token.authorize_url\n end", "def path_to_url(path, query_values = nil)\n Addressable::URI.new(\n :scheme => \"https\",\n :host => \"api.twitter.com\",\n :path => path,\n :query_values => query_values\n ).to_s\n end", "def getAuthUrl\n\t\t\t\tURI::HTTP.build(\n\t\t\t\t\t:host => @options['auth_host'],\n\t\t\t\t\t:path => @options['auth_page'],\n\t\t\t\t\t:query => {\n\t\t\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t\t\t:scope => @options['scope'],\n\t\t\t\t\t\t:response_type => \"code\",\n\t\t\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t\t\t}.to_query\n\t\t\t\t).to_s\n\t\t\tend", "def oauth\n ::OAuth::Consumer.new(Config.consumer_key, Config.consumer_secret, :site => \"https://api.twitter.com\")\n end", "def oauth_url(response_type = 'code')\n # The Redirect URI must be the same as registered with Put.io\n PUTIO_BASE_URL + \"/oauth2/authenticate?client_id=%i&response_type=%s&redirect_uri=%s\" % [@client_id, response_type, @redirect_uri]\n end", "def twitter\n if twitter?\n return self.twitter_client if self.twitter_client\n self.twitter_client = TwitterOAuth::Client.new(\n :consumer_key => TWITTER_CONSUMER_KEY,\n :consumer_secret => TWITTER_CONSUMER_SECRET,\n :token => self.twitter_token,\n :secret => self.twitter_secret\n )\n else\n false\n end\n end", "def pubsubhubbub_callback_url\n ENV['PUBSUBHUBBUB_CALLBACK_URL'].presence || Rails.application.routes.url_helpers\n .url_for(controller: 'curry/pull_request_updates', action: 'create',\n host: ENV['FQDN'], protocol: ENV['PROTOCOL'], port: ENV['PORT'])\n end", "def activation_url\n return @activation_url\n end", "def access_token_url\n Settings.lighthouse_health_immunization.access_token_url\n end", "def inject_url_into_tweets\n self.up_tweet = \"#{self.up_tweet} #{public_url}\" if !self.up_tweet.include?(public_url)\n self.down_tweet = \"#{self.down_tweet} #{public_url}\" if self.is_pool && !self.down_tweet.include?(public_url)\n end", "def twitter_callback\n\t if I18n.locale == :en\n\t \tflash[:notice] = \"Connected to Twitter successfully!\"\n\t else I18n.locale == :ar\n\t \tflash[:notice] = \"تم التواصل مع تويتر بنجاح!\"\n\t end\n\t auth = request.env[\"omniauth.auth\"]\n authentication = Authentication.find_by_provider_and_gid(auth[\"provider\"],\n current_gamer.id) || Authentication.create_with_omniauth(auth,\n current_gamer)\n redirect_to \"/gamers/edit\"\n return\n\tend", "def authorization_url\n url = \"#{host}/OAuth2AccessRequest.action?response_type=code&client_id=#{@client_id}\"\n url += \"&redirect_uri=#{Addressable::URI.escape(@redirect_uri)}\" if @redirect_uri\n url += \"&state=#{@state}\" if @state\n url\n end", "def authorize_url\n client = OAuth2::Client.new(client_id, client_secret, :site => oauth_url)\n client.auth_code.authorize_url(:redirect_uri => redirect_uri)\n end", "def connectURL\n\t\t\"http://beta.stoffiplayer.com/auth/#{provider}\"\n\tend", "def failure\n flash.alert = 'Failed to authorize Twitter account.'\n redirect_to twitter_accounts_url\n end" ]
[ "0.7548516", "0.719271", "0.7094029", "0.7000908", "0.68408424", "0.673302", "0.6601334", "0.65658313", "0.6389468", "0.63737005", "0.63555133", "0.62607145", "0.6245762", "0.62426734", "0.6238052", "0.6116916", "0.6068736", "0.60667133", "0.6055635", "0.6055233", "0.60287535", "0.6019481", "0.6017914", "0.6002906", "0.5973765", "0.593818", "0.59352154", "0.59312224", "0.59131634", "0.59017086", "0.5895375", "0.5887922", "0.58731806", "0.5866163", "0.58567333", "0.5814151", "0.5792481", "0.57629687", "0.57568765", "0.5753141", "0.57504874", "0.572092", "0.5715798", "0.5703164", "0.5693929", "0.56921387", "0.56870586", "0.5684791", "0.56667477", "0.5665389", "0.5662957", "0.5654082", "0.5643445", "0.5635108", "0.5632616", "0.56173784", "0.56099755", "0.55970216", "0.55876195", "0.5587296", "0.55802083", "0.5574016", "0.5569637", "0.5561675", "0.5561037", "0.555347", "0.55438644", "0.5542953", "0.55401486", "0.55359364", "0.5530219", "0.55253655", "0.5523542", "0.55163157", "0.55153537", "0.54944026", "0.54910195", "0.54902256", "0.5489056", "0.54785794", "0.54776907", "0.5467442", "0.5465297", "0.5463883", "0.5460433", "0.5456543", "0.5455452", "0.54523677", "0.54348516", "0.54339707", "0.54323983", "0.5432271", "0.54154575", "0.5410457", "0.539212", "0.53895175", "0.5388968", "0.5388128", "0.53756696", "0.53730994", "0.537273" ]
0.0
-1
Returns a nonce for the client which is used as content for the to be created signature. Returns a nonce for the client which is used as content for the to be created signature
def get_nonce_for_ethereum_wallet(wallet, opts = {}) data, _status_code, _headers = get_nonce_for_ethereum_wallet_with_http_info(wallet, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nonce\n ((Time.now.to_f * 1000000).to_i << 10).to_s\n end", "def nonce\n @nonce ||= Digest::SHA1.hexdigest random_string + timestamp\n end", "def nonce\n @nonce ||= Digest::SHA1.hexdigest random_string + timestamp\n end", "def nonce\n Array.new( 5 ) { rand(256) }.pack('C*').unpack('H*').first\n end", "def nonce\n Array.new( 5 ) { rand(256) }.pack('C*').unpack('H*').first\n end", "def nonce\n auth_info[\"nonce\"] || \"\"\n end", "def cnonce\n SecureRandom.hex 16\n end", "def gen_nonce\n Time.now.utc.to_i.to_s\n end", "def nonce; end", "def nonce(time = Time.now)\n t = time.to_i\n hashed = [t, secret_key]\n digest = ::Digest::MD5.hexdigest(hashed.join(\":\"))\n ActiveSupport::Base64.encode64(\"#{t}:#{digest}\").gsub(\"\\n\", '')\n end", "def nonce_bytes\n NONCEBYTES\n end", "def nonce\n rand(1_500_000_000)\n end", "def generate_cnonce\n\n Digest::MD5.hexdigest(\"%x\" % (Time.now.to_i + rand(65535)))\n end", "def generate_token(client_nonce)\n generation_time = time_to_block(Time.now.to_i)\n encryptor(client_nonce).encode(generation_time, 0)\n end", "def generate_nonce\n secret_box = RbNaCl::SecretBox.new(key)\n self.nonce = RbNaCl::Random.random_bytes(secret_box.nonce_bytes)\n self.nonce = Base64.encode64(self.nonce)\n end", "def nonce=(_arg0); end", "def content_security_policy_nonce_generator; end", "def content_security_policy_nonce_generator; end", "def nonce(secret_key, time = T.unsafe(nil)); end", "def nonce\n oauth_merged_params[:oauth_nonce]\n end", "def generate_nonce(time = Time.now)\n return Digest::MD5.hexdigest( time )\n end", "def content_security_policy_nonce; end", "def nonce_message(connection)\n Protocol::Query.new(\n auth_database(connection),\n Database::COMMAND,\n Auth::GET_NONCE,\n limit: -1\n )\n end", "def content_security_policy_nonce_generator=(_arg0); end", "def content_security_policy_nonce_generator=(_arg0); end", "def _content_security_policy_nonce(type)\n case type\n when :script\n SecureHeaders.content_security_policy_script_nonce(@_request)\n when :style\n SecureHeaders.content_security_policy_style_nonce(@_request)\n end\n end", "def scoped_nonce(nonce)\n \"#{@consumer_key}-#{nonce}\"\n end", "def nonce_state\n super\n end", "def api_nonce\n\t\t\t8.times.map { [*'0'..'9'].sample }.join\n\t\tend", "def content_security_policy_nonce=(_arg0); end", "def use_nonce(server_url, timestamp, salt)\n return false if any_nonces?(server_url, timestamp, salt) || delta_beyond_skew?(timestamp)\n Nonce.create(:server_url => server_url, :timestamp => timestamp, :salt => salt)\n return true\n end", "def nonce_timestamp(tolerance = 5)\n Time.now.to_i + tolerance\n end", "def use_nonce(server_url, timestamp, salt)\n return false if (timestamp - Time.now.to_i).abs > Nonce.skew\n params = [timestamp, salt, targetize(server_url)]\n return false if OpenidNonce.exists_by_target?(*params)\n return create_nonce(server_url, timestamp, salt)\n end", "def content_security_policy_nonce_directives; end", "def content_security_policy_nonce_directives; end", "def new_nonce\n session['omniauth-azure-activedirectory.nonce'] = SecureRandom.uuid\n end", "def client_guid\n client_id\n end", "def use_nonce(nonce)\n raise NotImplementedError\n end", "def api_nonce_param(value = nil)\n rw_config(:api_nonce_param, value, 'nonce')\n end", "def use_nonce(server_url, timestamp, salt)\n return false if (timestamp - Time.now.to_i).abs > Nonce.skew\n ts = timestamp.to_s # base 10 seconds since epoch\n nonce_key = key_prefix + 'N' + server_url + '|' + ts + '|' + salt\n result = @cache_client.add(nonce_key, '', expiry(Nonce.skew + 5))\n return !!(result =~ /^STORED/)\n end", "def content_security_policy_nonce_directives=(_arg0); end", "def content_security_policy_nonce_directives=(_arg0); end", "def validate_nonce(secret_key, request, value, seconds_to_timeout = T.unsafe(nil)); end", "def client_key\n @client_key ||= CredentialCache.cache(cache_key(:client_key)) do\n hmac(salted_password, 'Client Key')\n end\n end", "def get_signing_salt\n self_key_sign = OpenSSL::HMAC.digest(@hash_algo, @client_secret, @self_key)\n client_id_sign = OpenSSL::HMAC.digest(@hash_algo, self_key_sign, @client_id)\n OpenSSL::HMAC.digest(@hash_algo, client_id_sign, 'signer')\n end", "def client_signature(key, message)\n @client_signature ||= hmac(key, message)\n end", "def client_token\n data[:client_token]\n end", "def client_id\n request.headers['X-Client-ID']\n end", "def test_custom_nonce\n nonce = Base64.encode64(OpenSSL::Random.random_bytes(32)).gsub(/\\W/, '')\n \n oauth_params = OAUTH_REQ_PARAMS.merge(:nonce => nonce)\n assert_equal %{oauth_nonce=\"#{nonce}\"}, %{oauth_nonce=\"#{SOAuth.header('http://lonelyvegan.com/', oauth_params).match(nonce)[0]}\"}\n end", "def test_custom_nonce\n now = Time.now.to_i\n \n oauth_params = OAUTH_REQ_PARAMS.merge(:timestamp => now)\n assert_equal %{oauth_timestamp=\"#{now}\"}, %{oauth_timestamp=\"#{SOAuth.header('http://lonelyvegan.com/', oauth_params).match(now.to_s)[0]}\"}\n end", "def client_id\n @client_id ||= Staccato.build_client_id\n end", "def read_nonce\n session.delete('omniauth-azure-activedirectory.nonce')\n end", "def initialize(user, connection, client_nonce: nil)\n super\n @client_nonce = client_nonce || SecureRandom.base64\n end", "def get_client_id\n @client_id\n end", "def client_id\n return @client_id\n end", "def valid_nonce?(nonce, timestamp, consumer_key)\n \n end", "def client_id\n @client_id\n end", "def client_id\n @client_id\n end", "def gen_signature(handler_path, req_msg, nonce)\n message = \"#{handler_path}|#{req_msg}|#{nonce}\"\n OpenSSL::HMAC.hexdigest(\"SHA512\", api_key, message)\n end", "def client_proof(key, signature)\n @client_proof ||= Base64.strict_encode64(xor(key, signature))\n end", "def generate_client_id\n generated_id = \"id#@client_ids_generated\"\n @client_ids_generated = @client_ids_generated + 1\n\n return generated_id\n end", "def clientid\n @obj['clientid']\n end", "def validate_nonce(request, value, seconds_to_timeout=5*60)\n t = ActiveSupport::Base64.decode64(value).split(\":\").first.to_i\n nonce(t) == value && (t - Time.now.to_i).abs <= seconds_to_timeout\n end", "def cleanup_nonces\n now = Time.now.to_i\n nonces = OpenidNonce.all\n ids = nonces.collect { |n| n.id if (n.timestamp - now).abs > Nonce.skew }\n OpenidNonce.delete ids.compact\n end", "def get_client_customer_id\n adwords.credential_handler.credentials[:client_customer_id]\n end", "def client_id; end", "def sign!(key, sign_nonce = T.unsafe(nil)); end", "def client_id\n ENV['KONTENA_CLIENT_ID'] || CLIENT_ID\n end", "def client_id\n me.client.id\n end", "def client_id\n me.client.id\n end", "def auth_key(nonce)\n Digest::MD5.hexdigest(\"#{nonce}#{name}#{hashed_password}\")\n end", "def generate_token\n\t\tUUIDTools::UUID.timestamp_create.to_s\n\tend", "def generate_csrf_token\n SecureRandom.hex(32)\n end", "def find_nonce(blob)\r\n $status = \"Mining Started\"\r\n puts \"Mining Started\".blue\r\n start_time = Time.now\r\n nonce = \"0\"\r\n loop do\r\n nonce = rand(0..9999999999).to_s\r\n hash = Digest::SHA256.new.hexdigest(blob + nonce)\r\n break if (hash.start_with?(\"0\" * NONCE_ZEROES))\r\n end\r\n end_time = Time.now\r\n $status = \"Mining Ends in #{end_time - start_time} seconds\"\r\n puts \"Mining Ends in #{end_time - start_time} seconds\".blue\r\n return nonce\r\nend", "def getClientIdentificationObjName\r\n\t\t\treturn \"mfiforce__Client_Identification__c\"\r\n\t\tend", "def signature_bytes; NaCl::ED25519_SIGNATUREBYTES; end", "def default_client_id\n \"1B47512E-9743-11E2-8092-7F654762BE04\"\n end", "def transaction_uuid\n @transaction_uuid ||= SecureRandom.uuid\n end", "def get_client_token\n request = Typhoeus::Request.new(\n TOKEN_ENDPOINT,\n method: :post,\n body: {\n 'grant_type' => \"client_credentials\",\n 'client_id' => ID,\n 'client_secret' => SECRET,\n })\n request.run\n response = request.response\n access_token = response.body.access_token\n end", "def request_id\n SecureRandom.hex(17)\n end", "def request_id\n SecureRandom.hex(17)\n end", "def client_secret\n base = bb.hex\n # base += BIG_PRIME_N * @multiplier\n base -= modpow(GENERATOR, @user.private_key) * multiplier\n base = base % BIG_PRIME_N\n modpow(base, @user.private_key * u.hex + @a)\n end", "def create_entry_in_gateway_nonce\n @gateway_nonce_record = GatewayNonce.new(\n uuid: get_uuid,\n ost_payment_token_id: @ost_payment_token.id,\n nonce: @gateway_nonce,\n status: GlobalConstant::GatewayNonce.active_status,\n gateway_type: @gateway_type\n )\n @gateway_nonce_record.save!\n success\n end", "def client_id=(_arg0); end", "def client_id\n super\n end", "def get_client\n @client = Ethereum::Client.create(@url) if @client.nil?\n @client\n end", "def id_cliente\n SystemConfiguration::SecureVariable.get_value('payments.santander.id_cliente')\n end", "def envelope_identity\n @envelop_identity ||= self.class.strhex(@address[-2]) if @address\n end", "def client_version\n ClientVersion\n end", "def server_signature\n @server_signature ||= Base64.strict_encode64(hmac(server_key, auth_message))\n end", "def generate_tk\n SecureRandom.hex(16)\n end", "def gon_request_uuid\n @gon_request_uuid ||= SecureRandom.uuid\n end", "def store_nonce(nonce)\n raise NotImplementedError\n end", "def get_request_id()\n\t\t\t@random_instance ||= Random.new\n\t\t\tBase64.urlsafe_encode64(@random_instance.bytes(12))\n\t\tend", "def hmac_client; end", "def request_id\n SecureRandom.hex(5)\n end", "def signature\n k_date = Digestor.hmac(\"AWS4\" + secret_key, date[0, 8])\n k_region = Digestor.hmac(k_date, region)\n k_service = Digestor.hmac(k_region, service)\n k_credentials = Digestor.hmac(k_service, \"aws4_request\")\n Digestor.hexhmac(k_credentials, string_to_sign)\n end", "def client_id\n connection.id\n end", "def version_guid\n \"#{digest_type}:#{checksum}\"\n end", "def test_nonce_not_current\n string = \"0123456789ABCDEF\"\n\n nonce1 = OauthNonce.remember(string, Time.now.to_i - 86430)\n assert_equal false, nonce1, \"Nonces over a day in the past should be rejected\"\n\n nonce2 = OauthNonce.remember(string, Time.now.to_i - 86370)\n assert_not_equal false, nonce2, \"Nonces under a day in the past should be rejected\"\n end", "def txn_id\n authorization\n end" ]
[ "0.7816999", "0.773821", "0.773821", "0.76802135", "0.75357956", "0.7365072", "0.7314532", "0.7294667", "0.71795684", "0.7100958", "0.7070443", "0.69342667", "0.6886841", "0.683009", "0.6820128", "0.6772561", "0.67509395", "0.67509395", "0.67472225", "0.6714203", "0.667545", "0.6631487", "0.6606424", "0.64085066", "0.64085066", "0.6346308", "0.6226276", "0.6183901", "0.61187845", "0.6104697", "0.6048753", "0.6033957", "0.6028957", "0.6018921", "0.6018921", "0.5940708", "0.5888569", "0.5718176", "0.570439", "0.56710076", "0.5668457", "0.5668457", "0.5649791", "0.55872947", "0.5555071", "0.55423963", "0.55422163", "0.55012614", "0.54978895", "0.5492069", "0.549084", "0.5484583", "0.54799205", "0.54767007", "0.5439118", "0.5390251", "0.5360258", "0.5360258", "0.5320107", "0.53077894", "0.5288767", "0.524415", "0.524353", "0.5241378", "0.5215554", "0.51929045", "0.5176804", "0.51698655", "0.51548696", "0.51548696", "0.5129389", "0.51279485", "0.5101852", "0.5090926", "0.507164", "0.5067769", "0.50607884", "0.5044305", "0.5040719", "0.50393236", "0.50393236", "0.50201106", "0.50201046", "0.500891", "0.500889", "0.500872", "0.50004834", "0.49947235", "0.49941346", "0.4971475", "0.49703166", "0.49656165", "0.4955979", "0.49417216", "0.49352938", "0.4928272", "0.49282077", "0.4927269", "0.4925243", "0.49211922", "0.49073434" ]
0.0
-1
Returns a nonce for the client which is used as content for the to be created signature. Returns a nonce for the client which is used as content for the to be created signature
def get_nonce_for_ethereum_wallet_with_http_info(wallet, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AuthenticationServiceApi.get_nonce_for_ethereum_wallet ...' end # verify the required parameter 'wallet' is set if @api_client.config.client_side_validation && wallet.nil? fail ArgumentError, "Missing the required parameter 'wallet' when calling AuthenticationServiceApi.get_nonce_for_ethereum_wallet" end # resource path local_var_path = '/authentication/ethereum/{wallet}'.sub('{' + 'wallet' + '}', CGI.escape(wallet.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'Authorization'] = opts[:'authorization'] if !opts[:'authorization'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'JsonMDNToken' # auth_names auth_names = opts[:auth_names] || [] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AuthenticationServiceApi#get_nonce_for_ethereum_wallet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nonce\n ((Time.now.to_f * 1000000).to_i << 10).to_s\n end", "def nonce\n @nonce ||= Digest::SHA1.hexdigest random_string + timestamp\n end", "def nonce\n @nonce ||= Digest::SHA1.hexdigest random_string + timestamp\n end", "def nonce\n Array.new( 5 ) { rand(256) }.pack('C*').unpack('H*').first\n end", "def nonce\n Array.new( 5 ) { rand(256) }.pack('C*').unpack('H*').first\n end", "def nonce\n auth_info[\"nonce\"] || \"\"\n end", "def cnonce\n SecureRandom.hex 16\n end", "def gen_nonce\n Time.now.utc.to_i.to_s\n end", "def nonce; end", "def nonce(time = Time.now)\n t = time.to_i\n hashed = [t, secret_key]\n digest = ::Digest::MD5.hexdigest(hashed.join(\":\"))\n ActiveSupport::Base64.encode64(\"#{t}:#{digest}\").gsub(\"\\n\", '')\n end", "def nonce_bytes\n NONCEBYTES\n end", "def nonce\n rand(1_500_000_000)\n end", "def generate_cnonce\n\n Digest::MD5.hexdigest(\"%x\" % (Time.now.to_i + rand(65535)))\n end", "def generate_token(client_nonce)\n generation_time = time_to_block(Time.now.to_i)\n encryptor(client_nonce).encode(generation_time, 0)\n end", "def generate_nonce\n secret_box = RbNaCl::SecretBox.new(key)\n self.nonce = RbNaCl::Random.random_bytes(secret_box.nonce_bytes)\n self.nonce = Base64.encode64(self.nonce)\n end", "def nonce=(_arg0); end", "def content_security_policy_nonce_generator; end", "def content_security_policy_nonce_generator; end", "def nonce(secret_key, time = T.unsafe(nil)); end", "def nonce\n oauth_merged_params[:oauth_nonce]\n end", "def generate_nonce(time = Time.now)\n return Digest::MD5.hexdigest( time )\n end", "def content_security_policy_nonce; end", "def nonce_message(connection)\n Protocol::Query.new(\n auth_database(connection),\n Database::COMMAND,\n Auth::GET_NONCE,\n limit: -1\n )\n end", "def content_security_policy_nonce_generator=(_arg0); end", "def content_security_policy_nonce_generator=(_arg0); end", "def _content_security_policy_nonce(type)\n case type\n when :script\n SecureHeaders.content_security_policy_script_nonce(@_request)\n when :style\n SecureHeaders.content_security_policy_style_nonce(@_request)\n end\n end", "def scoped_nonce(nonce)\n \"#{@consumer_key}-#{nonce}\"\n end", "def nonce_state\n super\n end", "def api_nonce\n\t\t\t8.times.map { [*'0'..'9'].sample }.join\n\t\tend", "def content_security_policy_nonce=(_arg0); end", "def use_nonce(server_url, timestamp, salt)\n return false if any_nonces?(server_url, timestamp, salt) || delta_beyond_skew?(timestamp)\n Nonce.create(:server_url => server_url, :timestamp => timestamp, :salt => salt)\n return true\n end", "def nonce_timestamp(tolerance = 5)\n Time.now.to_i + tolerance\n end", "def use_nonce(server_url, timestamp, salt)\n return false if (timestamp - Time.now.to_i).abs > Nonce.skew\n params = [timestamp, salt, targetize(server_url)]\n return false if OpenidNonce.exists_by_target?(*params)\n return create_nonce(server_url, timestamp, salt)\n end", "def content_security_policy_nonce_directives; end", "def content_security_policy_nonce_directives; end", "def new_nonce\n session['omniauth-azure-activedirectory.nonce'] = SecureRandom.uuid\n end", "def client_guid\n client_id\n end", "def use_nonce(nonce)\n raise NotImplementedError\n end", "def api_nonce_param(value = nil)\n rw_config(:api_nonce_param, value, 'nonce')\n end", "def use_nonce(server_url, timestamp, salt)\n return false if (timestamp - Time.now.to_i).abs > Nonce.skew\n ts = timestamp.to_s # base 10 seconds since epoch\n nonce_key = key_prefix + 'N' + server_url + '|' + ts + '|' + salt\n result = @cache_client.add(nonce_key, '', expiry(Nonce.skew + 5))\n return !!(result =~ /^STORED/)\n end", "def content_security_policy_nonce_directives=(_arg0); end", "def content_security_policy_nonce_directives=(_arg0); end", "def validate_nonce(secret_key, request, value, seconds_to_timeout = T.unsafe(nil)); end", "def client_key\n @client_key ||= CredentialCache.cache(cache_key(:client_key)) do\n hmac(salted_password, 'Client Key')\n end\n end", "def get_signing_salt\n self_key_sign = OpenSSL::HMAC.digest(@hash_algo, @client_secret, @self_key)\n client_id_sign = OpenSSL::HMAC.digest(@hash_algo, self_key_sign, @client_id)\n OpenSSL::HMAC.digest(@hash_algo, client_id_sign, 'signer')\n end", "def client_signature(key, message)\n @client_signature ||= hmac(key, message)\n end", "def client_token\n data[:client_token]\n end", "def client_id\n request.headers['X-Client-ID']\n end", "def test_custom_nonce\n nonce = Base64.encode64(OpenSSL::Random.random_bytes(32)).gsub(/\\W/, '')\n \n oauth_params = OAUTH_REQ_PARAMS.merge(:nonce => nonce)\n assert_equal %{oauth_nonce=\"#{nonce}\"}, %{oauth_nonce=\"#{SOAuth.header('http://lonelyvegan.com/', oauth_params).match(nonce)[0]}\"}\n end", "def test_custom_nonce\n now = Time.now.to_i\n \n oauth_params = OAUTH_REQ_PARAMS.merge(:timestamp => now)\n assert_equal %{oauth_timestamp=\"#{now}\"}, %{oauth_timestamp=\"#{SOAuth.header('http://lonelyvegan.com/', oauth_params).match(now.to_s)[0]}\"}\n end", "def client_id\n @client_id ||= Staccato.build_client_id\n end", "def read_nonce\n session.delete('omniauth-azure-activedirectory.nonce')\n end", "def initialize(user, connection, client_nonce: nil)\n super\n @client_nonce = client_nonce || SecureRandom.base64\n end", "def get_client_id\n @client_id\n end", "def client_id\n return @client_id\n end", "def valid_nonce?(nonce, timestamp, consumer_key)\n \n end", "def client_id\n @client_id\n end", "def client_id\n @client_id\n end", "def gen_signature(handler_path, req_msg, nonce)\n message = \"#{handler_path}|#{req_msg}|#{nonce}\"\n OpenSSL::HMAC.hexdigest(\"SHA512\", api_key, message)\n end", "def client_proof(key, signature)\n @client_proof ||= Base64.strict_encode64(xor(key, signature))\n end", "def generate_client_id\n generated_id = \"id#@client_ids_generated\"\n @client_ids_generated = @client_ids_generated + 1\n\n return generated_id\n end", "def validate_nonce(request, value, seconds_to_timeout=5*60)\n t = ActiveSupport::Base64.decode64(value).split(\":\").first.to_i\n nonce(t) == value && (t - Time.now.to_i).abs <= seconds_to_timeout\n end", "def clientid\n @obj['clientid']\n end", "def cleanup_nonces\n now = Time.now.to_i\n nonces = OpenidNonce.all\n ids = nonces.collect { |n| n.id if (n.timestamp - now).abs > Nonce.skew }\n OpenidNonce.delete ids.compact\n end", "def get_client_customer_id\n adwords.credential_handler.credentials[:client_customer_id]\n end", "def client_id; end", "def sign!(key, sign_nonce = T.unsafe(nil)); end", "def client_id\n ENV['KONTENA_CLIENT_ID'] || CLIENT_ID\n end", "def client_id\n me.client.id\n end", "def client_id\n me.client.id\n end", "def auth_key(nonce)\n Digest::MD5.hexdigest(\"#{nonce}#{name}#{hashed_password}\")\n end", "def generate_token\n\t\tUUIDTools::UUID.timestamp_create.to_s\n\tend", "def generate_csrf_token\n SecureRandom.hex(32)\n end", "def find_nonce(blob)\r\n $status = \"Mining Started\"\r\n puts \"Mining Started\".blue\r\n start_time = Time.now\r\n nonce = \"0\"\r\n loop do\r\n nonce = rand(0..9999999999).to_s\r\n hash = Digest::SHA256.new.hexdigest(blob + nonce)\r\n break if (hash.start_with?(\"0\" * NONCE_ZEROES))\r\n end\r\n end_time = Time.now\r\n $status = \"Mining Ends in #{end_time - start_time} seconds\"\r\n puts \"Mining Ends in #{end_time - start_time} seconds\".blue\r\n return nonce\r\nend", "def getClientIdentificationObjName\r\n\t\t\treturn \"mfiforce__Client_Identification__c\"\r\n\t\tend", "def signature_bytes; NaCl::ED25519_SIGNATUREBYTES; end", "def default_client_id\n \"1B47512E-9743-11E2-8092-7F654762BE04\"\n end", "def transaction_uuid\n @transaction_uuid ||= SecureRandom.uuid\n end", "def request_id\n SecureRandom.hex(17)\n end", "def request_id\n SecureRandom.hex(17)\n end", "def get_client_token\n request = Typhoeus::Request.new(\n TOKEN_ENDPOINT,\n method: :post,\n body: {\n 'grant_type' => \"client_credentials\",\n 'client_id' => ID,\n 'client_secret' => SECRET,\n })\n request.run\n response = request.response\n access_token = response.body.access_token\n end", "def create_entry_in_gateway_nonce\n @gateway_nonce_record = GatewayNonce.new(\n uuid: get_uuid,\n ost_payment_token_id: @ost_payment_token.id,\n nonce: @gateway_nonce,\n status: GlobalConstant::GatewayNonce.active_status,\n gateway_type: @gateway_type\n )\n @gateway_nonce_record.save!\n success\n end", "def client_secret\n base = bb.hex\n # base += BIG_PRIME_N * @multiplier\n base -= modpow(GENERATOR, @user.private_key) * multiplier\n base = base % BIG_PRIME_N\n modpow(base, @user.private_key * u.hex + @a)\n end", "def client_id=(_arg0); end", "def client_id\n super\n end", "def get_client\n @client = Ethereum::Client.create(@url) if @client.nil?\n @client\n end", "def id_cliente\n SystemConfiguration::SecureVariable.get_value('payments.santander.id_cliente')\n end", "def client_version\n ClientVersion\n end", "def envelope_identity\n @envelop_identity ||= self.class.strhex(@address[-2]) if @address\n end", "def server_signature\n @server_signature ||= Base64.strict_encode64(hmac(server_key, auth_message))\n end", "def generate_tk\n SecureRandom.hex(16)\n end", "def gon_request_uuid\n @gon_request_uuid ||= SecureRandom.uuid\n end", "def store_nonce(nonce)\n raise NotImplementedError\n end", "def get_request_id()\n\t\t\t@random_instance ||= Random.new\n\t\t\tBase64.urlsafe_encode64(@random_instance.bytes(12))\n\t\tend", "def hmac_client; end", "def signature\n k_date = Digestor.hmac(\"AWS4\" + secret_key, date[0, 8])\n k_region = Digestor.hmac(k_date, region)\n k_service = Digestor.hmac(k_region, service)\n k_credentials = Digestor.hmac(k_service, \"aws4_request\")\n Digestor.hexhmac(k_credentials, string_to_sign)\n end", "def request_id\n SecureRandom.hex(5)\n end", "def version_guid\n \"#{digest_type}:#{checksum}\"\n end", "def client_id\n connection.id\n end", "def test_nonce_not_current\n string = \"0123456789ABCDEF\"\n\n nonce1 = OauthNonce.remember(string, Time.now.to_i - 86430)\n assert_equal false, nonce1, \"Nonces over a day in the past should be rejected\"\n\n nonce2 = OauthNonce.remember(string, Time.now.to_i - 86370)\n assert_not_equal false, nonce2, \"Nonces under a day in the past should be rejected\"\n end", "def txn_id\n authorization\n end" ]
[ "0.78162956", "0.77378744", "0.77378744", "0.76792043", "0.75349206", "0.7364107", "0.731374", "0.7294313", "0.7179597", "0.71002567", "0.70696026", "0.693388", "0.6886562", "0.6829619", "0.68196625", "0.6773059", "0.6751727", "0.6751727", "0.6746874", "0.6714188", "0.6675601", "0.6631574", "0.6604644", "0.64096034", "0.64096034", "0.6346047", "0.6225211", "0.6184135", "0.61180264", "0.6105349", "0.60485095", "0.6033587", "0.60289943", "0.6019239", "0.6019239", "0.59406185", "0.588802", "0.5718422", "0.5703924", "0.5670945", "0.56691253", "0.56691253", "0.5649684", "0.5585947", "0.55553615", "0.5543223", "0.55410635", "0.55000657", "0.5497977", "0.5492479", "0.5489932", "0.5483985", "0.5480333", "0.5475505", "0.54380137", "0.53901887", "0.5359116", "0.5359116", "0.5322118", "0.53075767", "0.5288959", "0.5242923", "0.5242562", "0.5241549", "0.52138644", "0.519286", "0.51767266", "0.51686215", "0.51536214", "0.51536214", "0.5128893", "0.512866", "0.510286", "0.5091106", "0.5070219", "0.5069478", "0.50603664", "0.50445586", "0.5039881", "0.5039881", "0.5039723", "0.50198555", "0.5019834", "0.5009344", "0.5009094", "0.5007337", "0.49994928", "0.49938", "0.49930274", "0.4972514", "0.49708915", "0.4966115", "0.49559015", "0.49419132", "0.49358067", "0.49296588", "0.4928973", "0.492671", "0.49258038", "0.49206573", "0.49061164" ]
0.0
-1
Used to validate the active connection with the API. Used to validate the active connection with the API
def get_object(opts = {}) data, _status_code, _headers = get_object_with_http_info(opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connection_valid?\n client('v1').api_valid?\n rescue StandardError\n false\n end", "def connection_valid?\n if status.untested? or (changed? and (changes.keys & @@status_fields).empty?)\n begin\n test_connection\n status.success!\n rescue => e\n error_str = map_connection_exception_to_error(e)\n status.fail!(error_str)\n end\n end\n status.success?\n end", "def verify!\n reconnect! unless active?\n end", "def connection_valid?\n begin\n result = client.call(:fe_dummy).body[:fe_dummy_response][:fe_dummy_result]\n @observations << \"app_server: #{result[:app_server]}, db_server: #{result[:db_server]}, auth_server: #{result[:auth_server]}\"\n result[:app_server] == \"OK\" and result[:db_server] == \"OK\" and result[:auth_server] == \"OK\"\n rescue => e\n @errors << e.message\n @backtrace = e.backtrace\n false\n end\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 valid_connection?\n @connection && @connection.valid?\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 valid?\n @conn.valid?\n end", "def validate_client_details\n return error_with_data(\n 'um_gbd_1',\n 'Client is not active',\n 'Client is not active',\n GlobalConstant::ErrorAction.default,\n {}\n ) if [email protected]_web_host_setup_done?\n\n success\n end", "def verify_active_connections! #:nodoc:\n clear_stale_cached_connections!\n @connections.each do |connection|\n connection.verify!\n end\n end", "def valid?\n core_client.api_valid?\n end", "def validate_connection\n request_token = request.params[\"token\"] || request.env[\"HTTP_AUTHORIZATION\"]\n unless request_token\n render \"missing token\", event: :error\n finish\n return false\n end\n\n service = Localhook::EndpointService.new\n @endpoint = service.endpoint_with_token(request_token)\n unless @endpoint\n render \"invalid token #{request_token}\", event: :error\n finish\n return false\n end\n\n render @endpoint.name, event: :endpoint\n return true\n end", "def validate_client_details\n\n return error_with_data(\n 'um_srpl_1',\n 'Client is not active',\n 'Client is not active',\n GlobalConstant::ErrorAction.default,\n {}\n ) if [email protected]_web_host_setup_done?\n\n success\n 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 valid?\n acyclic? and connected?\n end", "def valid?\n return false if @_mc_connection.nil?\n return false unless @_mc_connection.active?\n return true\n end", "def validate!\n logger.debug \"Starting validation for #{description}\"\n raise NotFound.new name, connection unless exists?\n logger.info \"Successfully validated #{description}\"\n self\n end", "def checkConnection\n unless connected?\n raise DictError.new(), \"Not connected.\"\n end\n end", "def checkConnection\n unless connected?\n raise DictError.new(), \"Not connected.\"\n end\n end", "def verify!\n unless active?\n if @unconfigured_connection\n @lock.synchronize do\n if @unconfigured_connection\n @raw_connection = @unconfigured_connection\n @unconfigured_connection = nil\n configure_connection\n @verified = true\n return\n end\n end\n end\n\n reconnect!(restore_transactions: true)\n end\n\n @verified = true\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def verify_connection!(uri); end", "def validate\n r = super\n return r unless r.success?\n\n r = fetch_and_validate_client\n return r unless r.success?\n\n success\n end", "def active_api?\n uri = URI('https://api.bitcoinvenezuela.com/')\n res = Net::HTTP.get_response(uri)\n return res.is_a?(Net::HTTPSuccess) \n end", "def valid_connection?(conn)\n conn.servers.length\n true\n rescue Excon::Errors::Forbidden, Excon::Errors::Unauthorized\n false\n end", "def valid?\n ping\n end", "def validate\n r = super\n return r unless r.success?\n\n r = fetch_and_validate_client\n return r unless r.success?\n\n return error_with_identifier(\"no_configurator_access\", \"am_cc_gpd_v_1\") if [email protected]_web_host_setup_done?\n\n success\n end", "def validate_request\n binding.pry if $debug\n rejected_error = validate_method || validate_arguments\n if rejected_error\n reject\n #if public mode\n #kill\n #else\n respond_with_rejected_error(rejected_error)\n #end\n return false\n end\n accept\n true\n end", "def validate\n\n return error_with_data(\n 'fcb_3',\n 'missing @client_id',\n 'Something Went Wrong.',\n GlobalConstant::ErrorAction.default,\n {}\n ) if @client_id.blank?\n\n @balances_to_fetch.each do |chain_type, data|\n\n case chain_type\n\n when GlobalConstant::CriticalChainInteractions.utility_chain_type\n\n return error_with_data(\n 'fcb_4',\n 'invalid_api_params',\n GlobalConstant::ErrorAction.default\n ) if data[:address_uuid].blank?\n\n return error_with_data(\n 'fcb_5',\n 'invalid_api_params',\n GlobalConstant::ErrorAction.default\n ) if data[:balance_types].blank?\n\n when GlobalConstant::CriticalChainInteractions.value_chain_type\n\n return error_with_data(\n 'fcb_6',\n 'invalid_api_params',\n GlobalConstant::ErrorAction.default\n ) if data[:address].blank?\n\n return error_with_data(\n 'fcb_7',\n 'invalid_api_params',\n GlobalConstant::ErrorAction.default\n ) if data[:balance_types].blank?\n\n else\n return error_with_data(\n 'fcb_7',\n 'invalid_api_params',\n GlobalConstant::ErrorAction.default\n )\n end\n\n end\n\n success\n\n end", "def validate_client\n\n return invalid_credentials_response('a_ar_b_vc_1') unless @client.present?\n\n return invalid_credentials_response('a_ar_b_vc_2') if\n @client.status != GlobalConstant::Client.active_status\n\n r = decrypt_api_secret\n\n return error_with_identifier('internal_server_error', 'a_ar_b_vc_4') unless r.success?\n\n # Note: internal code for this error is same for client not present\n return invalid_credentials_response('a_ar_b_vc_1') unless generate_signature == @signature\n\n success\n end", "def validate_provider_config\n response = HTTParty.post(\n \"#{api_base_path}/users/#{provider_config['account_id']}/messages\",\n basic_auth: bandwidth_auth,\n headers: { 'Content-Type': 'application/json' }\n )\n errors.add(:provider_config, 'error setting up') unless response.success?\n end", "def validate_env\n validate_keys :circle_customer_session_token, :circle_cookie, :circle_customer_id, :circle_bank_account_id\n end", "def valid\n active || on_trial || on_grace_period\n end", "def validate_and_sanitize\n return error_with_identifier('forbidden_api_request',\n 'gm_cc_b_vs_1',\n ['inactive_gateway_type']\n ) if gateway_client.blank?\n\n success\n end", "def valid?\n !Kontagent.configuration.base_url.nil? && !Kontagent.configuration.api_key.nil? && !Kontagent.configuration.secret_key.nil? \n end", "def validate!\n validate_redis\n validate_workers\n validate_options\n end", "def valid_raw_connection\n (@verified && @raw_connection) ||\n # `allow_retry: false`, to force verification: the block won't\n # raise, so a retry wouldn't help us get the valid connection we\n # need.\n with_raw_connection(allow_retry: false, materialize_transactions: false) { |conn| conn }\n end", "def validate\n if self.match\n errors.add_to_base \"Your account is not yet activated. Please check your email inbox for your activation letter.\" if self.match.is_pending_activation?\n errors.add_to_base \"Your account has been disabled. Please contact the site administrator for more information.\" if self.match.banned?\n end\n end", "def credential_check\n %w(partner req_id service v).all? { |k|\n # AlipayWap.logger.debug \"#{k}: #{@protocol_fields[k]}<->#{@request.protocol_fields[k]}\"\n @protocol_fields[k] == @request.protocol_fields[k].to_s\n } || raise(\"Response is not for this request\")\n end", "def check\n mark_message \"Schema is #{'not ' unless is_current?}up to date\"\n rescue ConnectionFailed => e\n mark_failure\n mark_message \"Error: '#{e}'\"\n end", "def validates?\n # include the params to validate our request\n request_params = denormalize params.merge({\n :Comando => \"validar\",\n :Token => @token || PagSeguro.config[\"authenticity_token\"]\n }).dup\n\n return true if PagSeguro.developer?\n\n # do the request\n uri = URI.parse(API_URL)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Post.new(uri.path)\n request.set_form_data request_params\n response = http.start {|r| r.request request }\n (response.body =~ /VERIFICADO/) != nil\n end", "def authorize_net_valid(options)\n transaction = AuthorizeNet::AIM::Transaction.new($api_login, $api_key, :gateway => $gateway.to_s.to_sym,\n :encapsulation_character => \"|\",\n :allow_split => true)\n\n # Find a state\n if params[:state].blank?\n state = \"--\"\n else\n state = State.find_by_state(options[:state]).state_abbr\n end \n\n # Add address to request\n address = AuthorizeNet::Address.new(:first_name => options[:first_name],\n :last_name => options[:last_name],\n :street_address => options[:address],\n :city => options[:city],\n :state => state,\n :zip => options[:zip],\n :country => options[:country])\n transaction.set_address(address)\n\n # Convert a date expired\n expired_date = params[:expires_date_months].[](0..1).strip.concat(params[:expires_date_years].[](2..3))\n if expired_date.length == 3\n expired_date = \"0\".concat(expired_date)\n end\n\n # Add credit card to request\n credit_card = AuthorizeNet::CreditCard.new(options[:cc_number], expired_date, :card_code => options[:cvv])\n # Execute a request\n response = transaction.authorize(0.0, credit_card)\n\n # Get a result of request\n @authorize_transaction_id = response.transaction_id\n #@authorize_gateway = transaction.gateway\n @authorize_gateway = response.raw.body\n @authorize_code = response.authorization_code\n @response_code = response.response_code\n @response_reason_code = response.response_reason_code\n\n # Generate user message\n if @response_code.to_i == 1 && @response_reason_code.to_i == 1\n user_message = \"Billing information changed\"\n else\n user_message = get_user_message(@response_code, @response_reason_code)\n end\n\n unless response.success?\n # Card is invalid(authorize.net)\n flash[:error_card] = 'Can\\'t authorize credit card'\n\n # Block in session\n block_ip_in_session\n\n # Add transaction\n add_transaction(:i_account => @account.i_account, \n :type => \"payment_refund\",\n :transaction_id => @authorize_transaction_id,\n :gw_string => @authorize_gateway,\n :user_message => user_message,\n :ip => request.remote_ip.to_s,\n :authorization_code => @authorize_code)\n \n false\n else\n true\n end\n end", "def verify_connection\n @client.find :first, {\n search_type: 'Property',\n class: '1', # 1 Residential\n query: '(246=|A),(61=|BROWARD)', # 246 ListingStatus\n # A Active-Available\n # 61 County\n limit: 1\n }\n end", "def connectable?\n ssl_context = OpenSSL::SSL::SSLContext.new\n ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n @http.head(URL_TO_CHECK, ssl_context: ssl_context).status.success?\n rescue StandardError\n false\n end", "def check_db_connection\n begin\n ActiveRecord::Base.verify_active_connections! if defined?(ActiveRecord)\n rescue Object => bdrb_error\n log_exception(bdrb_error)\n end\n end", "def checkCxn(conn)\n res = conn.request(:method=>:get,:path=>\"/wapi/v1.0/network\")\n if(res.status != 200)\n raise res.body\n end\nend", "def check_connected\n raise NotConnected unless @session_id && @sso && @provider\n end", "def api_available?\n begin\n response = self.api_status\n if response.is_a?(Hash) && response['ok']\n true\n else\n false\n end\n rescue => e\n false\n end\n end", "def check_response\n errors.add(:base, :invalid) unless response.present? && response[\"res\"] == 1\n end", "def active_api?\n uri = URI('https://api.bitcoinvenezuela.com/DolarToday.php?json=yes')\n res = Net::HTTP.get_response(uri)\n return res.is_a?(Net::HTTPSuccess) \n end", "def validate_api_call_count\n if outbound_request?\n data = $redis.get(\"api_call_count_for_#{from}\")\n errors.add(:base, message: \"limit reached for from #{from}\") if data && JSON.parse(data)['count'] > 50\n end\n end", "def check_connection\n logger.debug \"Checking connection (#{is_connected?})\"\n is_connected? || connect_database\n # return connection status\n is_connected?\n end", "def check_connection\n logger.debug \"Checking connection (#{is_connected?})\"\n is_connected? || connect_database\n # return connection status\n is_connected?\n end", "def validate_request(call)\n call.validate_request\n end", "def check_validity!\n # nothing\n end", "def validate_client\n\n @client = CacheManagement::Client.new([@client_id]).fetch[@client_id]\n\n return validation_error(\n 'cum_lu_3',\n 'invalid_api_params',\n ['invalid_client_id'],\n GlobalConstant::ErrorAction.mandatory_params_missing\n ) if @client.blank? || @client[:status] != GlobalConstant::Client.active_status\n\n @client_id = @client_id.to_i\n\n success\n\n end", "def active? # :nodoc:\n # Pings the connection to check if it's still good. Note that an\n # #active? method is also available, but that simply returns the\n # last known state, which isn't good enough if the connection has\n # gone stale since the last use.\n @raw_connection.ping\n rescue OracleEnhanced::ConnectionException\n false\n end", "def validate_connection(printer)\n return_data = login(printer)\n if return_data[:return_code] == 200\n # got here, all is good\n logout(return_data[:session_id])\n end\n\n return return_data\n end", "def valid_credentials?\n location = self.class.default_location\n find_rates(location,location,Package.new(100, [5,15,30]), :test => test_mode)\n rescue Omniship::ResponseError\n false\n else\n true\n end", "def active?\n # Pings the connection to check if it's still good. Note that an\n # #active? method is also available, but that simply returns the\n # last known state, which isn't good enough if the connection has\n # gone stale since the last use.\n @connection.ping\n rescue OracleEnhancedConnectionException\n false\n end", "def check_status\n response = $RDS.describe_db_instances(:db_instance_identifier => \"#{name}-#{Rails.env}\")\n status = response[:db_instances].first[:db_instance_status]\n if status == \"available\"\n self.url = response[:db_instances].first[:endpoint][:address]\n self.save\n end\n return status\n end", "def validate(x_login, x_api_key)\n response = get('/validate', :query => { :x_login => x_login, :x_apiKey => x_api_key })\n return response['data']['valid'] == 1\n end", "def gateway_check\n raise \"A gateway connection is necessary to call this method! You'll have to do it inside any event (e.g. `ready`) or after `bot.run :async`.\" unless connected?\n end", "def check_api_key!\n self.mirror_urls\n rescue\n raise \"Please check your TVDB API Key!\"\n end", "def valid?\n @errors = []\n @errors << 'unique_id is required' if @unique_id.nil? && @response_type.eql?('NVP')\n @errors << 'developer_id is required' if @developer_id.nil? && @response_type.eql?('JSON')\n @errors << 'app_key is required' if @app_key.nil?\n @errors << 'cmd is required' if @cmd.nil?\n @errors << 'response_type is required' if @response_type.nil?\n @errors.empty?\n end", "def validate_client\n\n @client = CacheManagement::Client.new([@client_id]).fetch[@client_id]\n\n return validation_error(\n 'e_sam_4',\n 'invalid_api_params',\n ['invalid_client_id'],\n GlobalConstant::ErrorAction.default\n ) if @client.blank? || @client[:status] != GlobalConstant::Client.active_status\n\n r = fetch_client_eth_address\n return r unless r.success?\n\n success\n\n end", "def check_api\n return @api if @api\n begin\n log_an_event \"ClickatellSession\",\"authenticating\"\n @api = Clickatell::API.authenticate(@api_id, @username, @password)\n log_an_event \"ClickatellSession\",\"authenticated\"\n rescue Clickatell::API::Error => e\n log_an_error \"ClickatellSession\", \"Error initializing - code #{e.code}: #{e.message}\"\n raise Gateway::Error.new(e.code, e.message)\n end\n return @api\n end", "def connection_status_client_status; end", "def connection_status_login_request; end", "def usable?\n [:connected, :connecting].include?(@status)\n end", "def validate_env\n validate_keys :coinbase_key, :coinbase_address, :coinbase_secret\n end", "def fetch_and_validate_client\n @uuid = \"#{GlobalConstant::Client.sandbox_prefix_uuid}#{@uuid}\"\n @client = Client.where(uuid: @uuid).first\n\n return error_with_identifier(\"invalid_client_id\", \"am_cc_gpd_favc_1\") if @client.blank? ||\n @client.status != GlobalConstant::Client.active_status\n\n success\n end", "def connected?\n @connection && [email protected]?\n end", "def active_connection?\n @reserved_connections.fetch(current_connection_id) { return false }.in_use?\n end", "def validate_api_key\n unless self.api_key #&& (api_key[\"-\"] || self.api_endpoint)\n raise KeyyoError, \"You must set an api_key prior to making a call\"\n end\n end", "def validate_request!\n validate_accounts_presence!\n validate_account_funds!\n\n transaction_create_model.validate!\n end", "def verify(context)\n # context.debug(\"Checking connection to #{@connection_info[:host]}:#{@connection_info[:port]}\")\n # in a real world implementation, the password would be checked by connecting\n # to the target device or checking that an existing connection is still alive\n raise 'authentication error' if @connection_info[:password].unwrap == 'invalid'\n end", "def valid_ssl_connection?\n return [email protected]? && @https != false \n end", "def validate_request(call)\n @calls.validate_request(call)\n end", "def valid_session?\n self.active?\n end", "def have_valid_api_key?\n @have_valid_api_key\n end", "def verify_access_with_api_key\n api_key = request.headers[\"HTTP_API_KEY\"] || params[:api_key]\n andrew_id = request.headers[\"HTTP_ANDREW_ID\"] || params[:andrew_id]\n if (api_key.nil? || andrew_id.nil?)\n render json: {error: \"Error, bad request\"}, status: 400\n elsif !(key_matches?(api_key, andrew_id))\n render json: {error: \"Error, unauthorized user or API key\"}, status: 401\n # Inactive users are not allowed to use their keys for any reason.\n elsif !@cur_user.active\n render json: {error: \"Error, the account associated with this andrew ID has been suspended\"}, status: 401\n end\n end", "def active_connection?\n synchronize do\n @reserved_connections.fetch(current_connection_id) do\n return false\n end\n end\n end", "def validate_client_token\n\n @client_token = ClientToken.where(\n id: @client_token_id\n ).first\n\n return validation_error(\n 'e_sam_5',\n 'invalid_api_params',\n ['invalid_client_token_id'],\n GlobalConstant::ErrorAction.default\n ) if @client_token.blank? || @client_token.status != GlobalConstant::ClientToken.active_status\n\n return validation_error(\n 'e_sam_6',\n 'invalid_api_params',\n ['invalid_client_token_id'],\n GlobalConstant::ErrorAction.default\n ) if @client_token.name.blank? || @client_token.symbol.blank? || @client_token.reserve_uuid.blank?\n\n # if propose was started but registeration not done yet we can not proceed\n if @client_token.propose_initiated? && !@client_token.registration_done?\n return validation_error(\n 'e_sam_7',\n 'invalid_api_params',\n ['invalid_client_token_id'],\n GlobalConstant::ErrorAction.default\n )\n end\n\n ct_pending_transactions = CacheManagement::PendingCriticalInteractionIds.\n new([@client_token_id]).fetch[@client_token_id]\n\n if ct_pending_transactions[GlobalConstant::CriticalChainInteractions.propose_bt_activity_type].present? ||\n ct_pending_transactions[GlobalConstant::CriticalChainInteractions.staker_initial_transfer_activity_type].present?\n\n return error_with_data(\n 'e_sam_7',\n 'pending_grant_requests',\n GlobalConstant::ErrorAction.default\n )\n\n end\n\n success\n\n end", "def validate_client_details\n\n return error_with_data(\n 'um_su_3',\n 'Client is not active',\n 'Client is not active',\n GlobalConstant::ErrorAction.default,\n {}\n ) if [email protected]_web_host_setup_done?\n\n return error_with_data(\n 'um_su_4',\n 'Registration has ended, it is no longer possible to signup now',\n 'Registration has ended, it is no longer possible to signup now',\n GlobalConstant::ErrorAction.default,\n {},\n {}\n ) if @client_token_sale_details.has_registration_ended?\n\n success\n end", "def connected?; connection_state == :connected end", "def valid_credentials?\n return false unless api_key?\n !activities.all.nil?\n rescue Rescuetime::Errors::InvalidCredentialsError\n false\n end", "def validate_client\n ClientValidator.validate(lock_config)\n end", "def gateway_check\n return if connected?\n\n raise \"A gateway connection is necessary to call this method! You'll have to do it inside any event (e.g. `ready`) or after `bot.run :async`.\"\n end", "def conn_errors?\n [email protected]?\n end", "def vbox_connection_ok?(connection)\n # VBox::WebService.connect\n return true\n rescue\n return false\n end", "def check_formulary_server_connection\n session[:foo] = \"bar\" unless session.id\n raise \"session.id is nil\" unless session.id\n unless @client = ClientConnections.get(session.id.public_id)\n reset_session\n redirect_to root_path, flash: { error: \"Please connect to a formulary server\" }\n end\n end", "def valid_for_http_auth?; end", "def valid?\n utils = Amazon::FPS::SignatureUtilsForOutbound.new(@access_key, @secret_key);\n utils.validate_request(:parameters => @params, :url_end_point => @url_end_point, :http_method => \"GET\")\n end", "def fetch_and_validate_client\n @client = Client.get_from_memcache(@client_id)\n\n return error_with_identifier('invalid_client_id','sb_2') if\n @client.blank? || @client.status != GlobalConstant::Client.active_status\n\n success\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" ]
[ "0.7363311", "0.7009748", "0.6780091", "0.6762244", "0.6739436", "0.6716362", "0.6694204", "0.6660668", "0.6476406", "0.64176", "0.6381489", "0.6348189", "0.6347687", "0.61315763", "0.60872453", "0.6084624", "0.60403794", "0.6026897", "0.6026897", "0.60050935", "0.5990143", "0.5990143", "0.5990143", "0.5990143", "0.5990143", "0.5990143", "0.59852695", "0.5878082", "0.58755714", "0.5847365", "0.5831779", "0.58278775", "0.57990783", "0.57956195", "0.5786", "0.5782062", "0.5780707", "0.57783425", "0.57753694", "0.5766199", "0.57575727", "0.57509017", "0.57488614", "0.5740831", "0.5731329", "0.57088584", "0.57085335", "0.57043576", "0.56941324", "0.5693197", "0.56849617", "0.5683258", "0.5639783", "0.56382656", "0.5608872", "0.5608404", "0.5591983", "0.5591983", "0.5588759", "0.5588042", "0.5583851", "0.55828506", "0.5575593", "0.557509", "0.5574951", "0.557247", "0.5565188", "0.55577505", "0.55576396", "0.5557584", "0.55568767", "0.5552031", "0.5533423", "0.5523324", "0.55205226", "0.5516263", "0.5513191", "0.55105984", "0.5502513", "0.5499417", "0.54980135", "0.549043", "0.5484894", "0.5479032", "0.54774946", "0.5477331", "0.5476769", "0.5475776", "0.54752237", "0.5461821", "0.54595214", "0.5458311", "0.5450918", "0.5441664", "0.54412466", "0.5428468", "0.5424783", "0.5418932", "0.5410934", "0.5407483", "0.540282" ]
0.0
-1
Used to validate the active connection with the API. Used to validate the active connection with the API
def get_object_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AuthenticationServiceApi.get_object ...' end # resource path local_var_path = '/authentication' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'Hash<String, Object>' # auth_names auth_names = opts[:auth_names] || [] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AuthenticationServiceApi#get_object\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connection_valid?\n client('v1').api_valid?\n rescue StandardError\n false\n end", "def connection_valid?\n if status.untested? or (changed? and (changes.keys & @@status_fields).empty?)\n begin\n test_connection\n status.success!\n rescue => e\n error_str = map_connection_exception_to_error(e)\n status.fail!(error_str)\n end\n end\n status.success?\n end", "def verify!\n reconnect! unless active?\n end", "def connection_valid?\n begin\n result = client.call(:fe_dummy).body[:fe_dummy_response][:fe_dummy_result]\n @observations << \"app_server: #{result[:app_server]}, db_server: #{result[:db_server]}, auth_server: #{result[:auth_server]}\"\n result[:app_server] == \"OK\" and result[:db_server] == \"OK\" and result[:auth_server] == \"OK\"\n rescue => e\n @errors << e.message\n @backtrace = e.backtrace\n false\n end\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 valid_connection?\n @connection && @connection.valid?\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 valid?\n @conn.valid?\n end", "def validate_client_details\n return error_with_data(\n 'um_gbd_1',\n 'Client is not active',\n 'Client is not active',\n GlobalConstant::ErrorAction.default,\n {}\n ) if [email protected]_web_host_setup_done?\n\n success\n end", "def verify_active_connections! #:nodoc:\n clear_stale_cached_connections!\n @connections.each do |connection|\n connection.verify!\n end\n end", "def valid?\n core_client.api_valid?\n end", "def validate_connection\n request_token = request.params[\"token\"] || request.env[\"HTTP_AUTHORIZATION\"]\n unless request_token\n render \"missing token\", event: :error\n finish\n return false\n end\n\n service = Localhook::EndpointService.new\n @endpoint = service.endpoint_with_token(request_token)\n unless @endpoint\n render \"invalid token #{request_token}\", event: :error\n finish\n return false\n end\n\n render @endpoint.name, event: :endpoint\n return true\n end", "def validate_client_details\n\n return error_with_data(\n 'um_srpl_1',\n 'Client is not active',\n 'Client is not active',\n GlobalConstant::ErrorAction.default,\n {}\n ) if [email protected]_web_host_setup_done?\n\n success\n 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 valid?\n acyclic? and connected?\n end", "def valid?\n return false if @_mc_connection.nil?\n return false unless @_mc_connection.active?\n return true\n end", "def validate!\n logger.debug \"Starting validation for #{description}\"\n raise NotFound.new name, connection unless exists?\n logger.info \"Successfully validated #{description}\"\n self\n end", "def checkConnection\n unless connected?\n raise DictError.new(), \"Not connected.\"\n end\n end", "def checkConnection\n unless connected?\n raise DictError.new(), \"Not connected.\"\n end\n end", "def verify!\n unless active?\n if @unconfigured_connection\n @lock.synchronize do\n if @unconfigured_connection\n @raw_connection = @unconfigured_connection\n @unconfigured_connection = nil\n configure_connection\n @verified = true\n return\n end\n end\n end\n\n reconnect!(restore_transactions: true)\n end\n\n @verified = true\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def verify_connection!(uri); end", "def validate\n r = super\n return r unless r.success?\n\n r = fetch_and_validate_client\n return r unless r.success?\n\n success\n end", "def active_api?\n uri = URI('https://api.bitcoinvenezuela.com/')\n res = Net::HTTP.get_response(uri)\n return res.is_a?(Net::HTTPSuccess) \n end", "def valid_connection?(conn)\n conn.servers.length\n true\n rescue Excon::Errors::Forbidden, Excon::Errors::Unauthorized\n false\n end", "def valid?\n ping\n end", "def validate\n r = super\n return r unless r.success?\n\n r = fetch_and_validate_client\n return r unless r.success?\n\n return error_with_identifier(\"no_configurator_access\", \"am_cc_gpd_v_1\") if [email protected]_web_host_setup_done?\n\n success\n end", "def validate_request\n binding.pry if $debug\n rejected_error = validate_method || validate_arguments\n if rejected_error\n reject\n #if public mode\n #kill\n #else\n respond_with_rejected_error(rejected_error)\n #end\n return false\n end\n accept\n true\n end", "def validate\n\n return error_with_data(\n 'fcb_3',\n 'missing @client_id',\n 'Something Went Wrong.',\n GlobalConstant::ErrorAction.default,\n {}\n ) if @client_id.blank?\n\n @balances_to_fetch.each do |chain_type, data|\n\n case chain_type\n\n when GlobalConstant::CriticalChainInteractions.utility_chain_type\n\n return error_with_data(\n 'fcb_4',\n 'invalid_api_params',\n GlobalConstant::ErrorAction.default\n ) if data[:address_uuid].blank?\n\n return error_with_data(\n 'fcb_5',\n 'invalid_api_params',\n GlobalConstant::ErrorAction.default\n ) if data[:balance_types].blank?\n\n when GlobalConstant::CriticalChainInteractions.value_chain_type\n\n return error_with_data(\n 'fcb_6',\n 'invalid_api_params',\n GlobalConstant::ErrorAction.default\n ) if data[:address].blank?\n\n return error_with_data(\n 'fcb_7',\n 'invalid_api_params',\n GlobalConstant::ErrorAction.default\n ) if data[:balance_types].blank?\n\n else\n return error_with_data(\n 'fcb_7',\n 'invalid_api_params',\n GlobalConstant::ErrorAction.default\n )\n end\n\n end\n\n success\n\n end", "def validate_client\n\n return invalid_credentials_response('a_ar_b_vc_1') unless @client.present?\n\n return invalid_credentials_response('a_ar_b_vc_2') if\n @client.status != GlobalConstant::Client.active_status\n\n r = decrypt_api_secret\n\n return error_with_identifier('internal_server_error', 'a_ar_b_vc_4') unless r.success?\n\n # Note: internal code for this error is same for client not present\n return invalid_credentials_response('a_ar_b_vc_1') unless generate_signature == @signature\n\n success\n end", "def validate_provider_config\n response = HTTParty.post(\n \"#{api_base_path}/users/#{provider_config['account_id']}/messages\",\n basic_auth: bandwidth_auth,\n headers: { 'Content-Type': 'application/json' }\n )\n errors.add(:provider_config, 'error setting up') unless response.success?\n end", "def validate_env\n validate_keys :circle_customer_session_token, :circle_cookie, :circle_customer_id, :circle_bank_account_id\n end", "def valid\n active || on_trial || on_grace_period\n end", "def validate_and_sanitize\n return error_with_identifier('forbidden_api_request',\n 'gm_cc_b_vs_1',\n ['inactive_gateway_type']\n ) if gateway_client.blank?\n\n success\n end", "def valid?\n !Kontagent.configuration.base_url.nil? && !Kontagent.configuration.api_key.nil? && !Kontagent.configuration.secret_key.nil? \n end", "def validate!\n validate_redis\n validate_workers\n validate_options\n end", "def validate\n if self.match\n errors.add_to_base \"Your account is not yet activated. Please check your email inbox for your activation letter.\" if self.match.is_pending_activation?\n errors.add_to_base \"Your account has been disabled. Please contact the site administrator for more information.\" if self.match.banned?\n end\n end", "def valid_raw_connection\n (@verified && @raw_connection) ||\n # `allow_retry: false`, to force verification: the block won't\n # raise, so a retry wouldn't help us get the valid connection we\n # need.\n with_raw_connection(allow_retry: false, materialize_transactions: false) { |conn| conn }\n end", "def credential_check\n %w(partner req_id service v).all? { |k|\n # AlipayWap.logger.debug \"#{k}: #{@protocol_fields[k]}<->#{@request.protocol_fields[k]}\"\n @protocol_fields[k] == @request.protocol_fields[k].to_s\n } || raise(\"Response is not for this request\")\n end", "def check\n mark_message \"Schema is #{'not ' unless is_current?}up to date\"\n rescue ConnectionFailed => e\n mark_failure\n mark_message \"Error: '#{e}'\"\n end", "def validates?\n # include the params to validate our request\n request_params = denormalize params.merge({\n :Comando => \"validar\",\n :Token => @token || PagSeguro.config[\"authenticity_token\"]\n }).dup\n\n return true if PagSeguro.developer?\n\n # do the request\n uri = URI.parse(API_URL)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Post.new(uri.path)\n request.set_form_data request_params\n response = http.start {|r| r.request request }\n (response.body =~ /VERIFICADO/) != nil\n end", "def authorize_net_valid(options)\n transaction = AuthorizeNet::AIM::Transaction.new($api_login, $api_key, :gateway => $gateway.to_s.to_sym,\n :encapsulation_character => \"|\",\n :allow_split => true)\n\n # Find a state\n if params[:state].blank?\n state = \"--\"\n else\n state = State.find_by_state(options[:state]).state_abbr\n end \n\n # Add address to request\n address = AuthorizeNet::Address.new(:first_name => options[:first_name],\n :last_name => options[:last_name],\n :street_address => options[:address],\n :city => options[:city],\n :state => state,\n :zip => options[:zip],\n :country => options[:country])\n transaction.set_address(address)\n\n # Convert a date expired\n expired_date = params[:expires_date_months].[](0..1).strip.concat(params[:expires_date_years].[](2..3))\n if expired_date.length == 3\n expired_date = \"0\".concat(expired_date)\n end\n\n # Add credit card to request\n credit_card = AuthorizeNet::CreditCard.new(options[:cc_number], expired_date, :card_code => options[:cvv])\n # Execute a request\n response = transaction.authorize(0.0, credit_card)\n\n # Get a result of request\n @authorize_transaction_id = response.transaction_id\n #@authorize_gateway = transaction.gateway\n @authorize_gateway = response.raw.body\n @authorize_code = response.authorization_code\n @response_code = response.response_code\n @response_reason_code = response.response_reason_code\n\n # Generate user message\n if @response_code.to_i == 1 && @response_reason_code.to_i == 1\n user_message = \"Billing information changed\"\n else\n user_message = get_user_message(@response_code, @response_reason_code)\n end\n\n unless response.success?\n # Card is invalid(authorize.net)\n flash[:error_card] = 'Can\\'t authorize credit card'\n\n # Block in session\n block_ip_in_session\n\n # Add transaction\n add_transaction(:i_account => @account.i_account, \n :type => \"payment_refund\",\n :transaction_id => @authorize_transaction_id,\n :gw_string => @authorize_gateway,\n :user_message => user_message,\n :ip => request.remote_ip.to_s,\n :authorization_code => @authorize_code)\n \n false\n else\n true\n end\n end", "def verify_connection\n @client.find :first, {\n search_type: 'Property',\n class: '1', # 1 Residential\n query: '(246=|A),(61=|BROWARD)', # 246 ListingStatus\n # A Active-Available\n # 61 County\n limit: 1\n }\n end", "def check_db_connection\n begin\n ActiveRecord::Base.verify_active_connections! if defined?(ActiveRecord)\n rescue Object => bdrb_error\n log_exception(bdrb_error)\n end\n end", "def connectable?\n ssl_context = OpenSSL::SSL::SSLContext.new\n ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n @http.head(URL_TO_CHECK, ssl_context: ssl_context).status.success?\n rescue StandardError\n false\n end", "def checkCxn(conn)\n res = conn.request(:method=>:get,:path=>\"/wapi/v1.0/network\")\n if(res.status != 200)\n raise res.body\n end\nend", "def check_connected\n raise NotConnected unless @session_id && @sso && @provider\n end", "def api_available?\n begin\n response = self.api_status\n if response.is_a?(Hash) && response['ok']\n true\n else\n false\n end\n rescue => e\n false\n end\n end", "def check_response\n errors.add(:base, :invalid) unless response.present? && response[\"res\"] == 1\n end", "def validate_api_call_count\n if outbound_request?\n data = $redis.get(\"api_call_count_for_#{from}\")\n errors.add(:base, message: \"limit reached for from #{from}\") if data && JSON.parse(data)['count'] > 50\n end\n end", "def active_api?\n uri = URI('https://api.bitcoinvenezuela.com/DolarToday.php?json=yes')\n res = Net::HTTP.get_response(uri)\n return res.is_a?(Net::HTTPSuccess) \n end", "def validate_request(call)\n call.validate_request\n end", "def check_validity!\n # nothing\n end", "def check_connection\n logger.debug \"Checking connection (#{is_connected?})\"\n is_connected? || connect_database\n # return connection status\n is_connected?\n end", "def check_connection\n logger.debug \"Checking connection (#{is_connected?})\"\n is_connected? || connect_database\n # return connection status\n is_connected?\n end", "def validate_client\n\n @client = CacheManagement::Client.new([@client_id]).fetch[@client_id]\n\n return validation_error(\n 'cum_lu_3',\n 'invalid_api_params',\n ['invalid_client_id'],\n GlobalConstant::ErrorAction.mandatory_params_missing\n ) if @client.blank? || @client[:status] != GlobalConstant::Client.active_status\n\n @client_id = @client_id.to_i\n\n success\n\n end", "def active? # :nodoc:\n # Pings the connection to check if it's still good. Note that an\n # #active? method is also available, but that simply returns the\n # last known state, which isn't good enough if the connection has\n # gone stale since the last use.\n @raw_connection.ping\n rescue OracleEnhanced::ConnectionException\n false\n end", "def validate_connection(printer)\n return_data = login(printer)\n if return_data[:return_code] == 200\n # got here, all is good\n logout(return_data[:session_id])\n end\n\n return return_data\n end", "def valid_credentials?\n location = self.class.default_location\n find_rates(location,location,Package.new(100, [5,15,30]), :test => test_mode)\n rescue Omniship::ResponseError\n false\n else\n true\n end", "def active?\n # Pings the connection to check if it's still good. Note that an\n # #active? method is also available, but that simply returns the\n # last known state, which isn't good enough if the connection has\n # gone stale since the last use.\n @connection.ping\n rescue OracleEnhancedConnectionException\n false\n end", "def check_status\n response = $RDS.describe_db_instances(:db_instance_identifier => \"#{name}-#{Rails.env}\")\n status = response[:db_instances].first[:db_instance_status]\n if status == \"available\"\n self.url = response[:db_instances].first[:endpoint][:address]\n self.save\n end\n return status\n end", "def validate(x_login, x_api_key)\n response = get('/validate', :query => { :x_login => x_login, :x_apiKey => x_api_key })\n return response['data']['valid'] == 1\n end", "def valid?\n @errors = []\n @errors << 'unique_id is required' if @unique_id.nil? && @response_type.eql?('NVP')\n @errors << 'developer_id is required' if @developer_id.nil? && @response_type.eql?('JSON')\n @errors << 'app_key is required' if @app_key.nil?\n @errors << 'cmd is required' if @cmd.nil?\n @errors << 'response_type is required' if @response_type.nil?\n @errors.empty?\n end", "def check_api_key!\n self.mirror_urls\n rescue\n raise \"Please check your TVDB API Key!\"\n end", "def validate_client\n\n @client = CacheManagement::Client.new([@client_id]).fetch[@client_id]\n\n return validation_error(\n 'e_sam_4',\n 'invalid_api_params',\n ['invalid_client_id'],\n GlobalConstant::ErrorAction.default\n ) if @client.blank? || @client[:status] != GlobalConstant::Client.active_status\n\n r = fetch_client_eth_address\n return r unless r.success?\n\n success\n\n end", "def gateway_check\n raise \"A gateway connection is necessary to call this method! You'll have to do it inside any event (e.g. `ready`) or after `bot.run :async`.\" unless connected?\n end", "def check_api\n return @api if @api\n begin\n log_an_event \"ClickatellSession\",\"authenticating\"\n @api = Clickatell::API.authenticate(@api_id, @username, @password)\n log_an_event \"ClickatellSession\",\"authenticated\"\n rescue Clickatell::API::Error => e\n log_an_error \"ClickatellSession\", \"Error initializing - code #{e.code}: #{e.message}\"\n raise Gateway::Error.new(e.code, e.message)\n end\n return @api\n end", "def connection_status_client_status; end", "def connection_status_login_request; end", "def usable?\n [:connected, :connecting].include?(@status)\n end", "def validate_env\n validate_keys :coinbase_key, :coinbase_address, :coinbase_secret\n end", "def fetch_and_validate_client\n @uuid = \"#{GlobalConstant::Client.sandbox_prefix_uuid}#{@uuid}\"\n @client = Client.where(uuid: @uuid).first\n\n return error_with_identifier(\"invalid_client_id\", \"am_cc_gpd_favc_1\") if @client.blank? ||\n @client.status != GlobalConstant::Client.active_status\n\n success\n end", "def connected?\n @connection && [email protected]?\n end", "def validate_api_key\n unless self.api_key #&& (api_key[\"-\"] || self.api_endpoint)\n raise KeyyoError, \"You must set an api_key prior to making a call\"\n end\n end", "def validate_request!\n validate_accounts_presence!\n validate_account_funds!\n\n transaction_create_model.validate!\n end", "def active_connection?\n @reserved_connections.fetch(current_connection_id) { return false }.in_use?\n end", "def verify(context)\n # context.debug(\"Checking connection to #{@connection_info[:host]}:#{@connection_info[:port]}\")\n # in a real world implementation, the password would be checked by connecting\n # to the target device or checking that an existing connection is still alive\n raise 'authentication error' if @connection_info[:password].unwrap == 'invalid'\n end", "def valid_ssl_connection?\n return [email protected]? && @https != false \n end", "def validate_request(call)\n @calls.validate_request(call)\n end", "def have_valid_api_key?\n @have_valid_api_key\n end", "def verify_access_with_api_key\n api_key = request.headers[\"HTTP_API_KEY\"] || params[:api_key]\n andrew_id = request.headers[\"HTTP_ANDREW_ID\"] || params[:andrew_id]\n if (api_key.nil? || andrew_id.nil?)\n render json: {error: \"Error, bad request\"}, status: 400\n elsif !(key_matches?(api_key, andrew_id))\n render json: {error: \"Error, unauthorized user or API key\"}, status: 401\n # Inactive users are not allowed to use their keys for any reason.\n elsif !@cur_user.active\n render json: {error: \"Error, the account associated with this andrew ID has been suspended\"}, status: 401\n end\n end", "def valid_session?\n self.active?\n end", "def validate_client_token\n\n @client_token = ClientToken.where(\n id: @client_token_id\n ).first\n\n return validation_error(\n 'e_sam_5',\n 'invalid_api_params',\n ['invalid_client_token_id'],\n GlobalConstant::ErrorAction.default\n ) if @client_token.blank? || @client_token.status != GlobalConstant::ClientToken.active_status\n\n return validation_error(\n 'e_sam_6',\n 'invalid_api_params',\n ['invalid_client_token_id'],\n GlobalConstant::ErrorAction.default\n ) if @client_token.name.blank? || @client_token.symbol.blank? || @client_token.reserve_uuid.blank?\n\n # if propose was started but registeration not done yet we can not proceed\n if @client_token.propose_initiated? && !@client_token.registration_done?\n return validation_error(\n 'e_sam_7',\n 'invalid_api_params',\n ['invalid_client_token_id'],\n GlobalConstant::ErrorAction.default\n )\n end\n\n ct_pending_transactions = CacheManagement::PendingCriticalInteractionIds.\n new([@client_token_id]).fetch[@client_token_id]\n\n if ct_pending_transactions[GlobalConstant::CriticalChainInteractions.propose_bt_activity_type].present? ||\n ct_pending_transactions[GlobalConstant::CriticalChainInteractions.staker_initial_transfer_activity_type].present?\n\n return error_with_data(\n 'e_sam_7',\n 'pending_grant_requests',\n GlobalConstant::ErrorAction.default\n )\n\n end\n\n success\n\n end", "def active_connection?\n synchronize do\n @reserved_connections.fetch(current_connection_id) do\n return false\n end\n end\n end", "def validate_client_details\n\n return error_with_data(\n 'um_su_3',\n 'Client is not active',\n 'Client is not active',\n GlobalConstant::ErrorAction.default,\n {}\n ) if [email protected]_web_host_setup_done?\n\n return error_with_data(\n 'um_su_4',\n 'Registration has ended, it is no longer possible to signup now',\n 'Registration has ended, it is no longer possible to signup now',\n GlobalConstant::ErrorAction.default,\n {},\n {}\n ) if @client_token_sale_details.has_registration_ended?\n\n success\n end", "def connected?; connection_state == :connected end", "def valid_credentials?\n return false unless api_key?\n !activities.all.nil?\n rescue Rescuetime::Errors::InvalidCredentialsError\n false\n end", "def validate_client\n ClientValidator.validate(lock_config)\n end", "def gateway_check\n return if connected?\n\n raise \"A gateway connection is necessary to call this method! You'll have to do it inside any event (e.g. `ready`) or after `bot.run :async`.\"\n end", "def conn_errors?\n [email protected]?\n end", "def vbox_connection_ok?(connection)\n # VBox::WebService.connect\n return true\n rescue\n return false\n end", "def check_formulary_server_connection\n session[:foo] = \"bar\" unless session.id\n raise \"session.id is nil\" unless session.id\n unless @client = ClientConnections.get(session.id.public_id)\n reset_session\n redirect_to root_path, flash: { error: \"Please connect to a formulary server\" }\n end\n end", "def valid_for_http_auth?; end", "def valid?\n utils = Amazon::FPS::SignatureUtilsForOutbound.new(@access_key, @secret_key);\n utils.validate_request(:parameters => @params, :url_end_point => @url_end_point, :http_method => \"GET\")\n end", "def fetch_and_validate_client\n @client = Client.get_from_memcache(@client_id)\n\n return error_with_identifier('invalid_client_id','sb_2') if\n @client.blank? || @client.status != GlobalConstant::Client.active_status\n\n success\n end", "def validate_registeration_params\n\n return success if @client_token.registration_done?\n\n @airdrop_amount = @airdrop_amount.present? ? BigDecimal.new(@airdrop_amount) : @airdrop_amount\n @ost_to_bt = @ost_to_bt.present? ? BigDecimal.new(@ost_to_bt) : @ost_to_bt\n @number_of_users = @number_of_users.to_i\n\n return error_with_data(\n 'e_sam_8',\n 'invalid_api_params',\n GlobalConstant::ErrorAction.default\n ) if @ost_to_bt.blank? || @bt_to_mint < 0\n\n return error_with_data(\n 'e_sam_11',\n 'invalid_api_params',\n GlobalConstant::ErrorAction.default\n ) if GlobalConstant::Base.sandbox_sub_environment? &&\n (@number_of_users < 0 || @airdrop_amount.blank? || @airdrop_amount < 0 || @airdrop_user_list_type.blank?)\n\n success\n\n end" ]
[ "0.73627436", "0.7009189", "0.67797077", "0.67617154", "0.6737458", "0.67146385", "0.66923654", "0.6660239", "0.6476227", "0.64151025", "0.6382077", "0.63478935", "0.63476366", "0.61314416", "0.608585", "0.6083535", "0.6041969", "0.60260004", "0.60260004", "0.6004036", "0.5989328", "0.5989328", "0.5989328", "0.5989328", "0.5989328", "0.5989328", "0.5984973", "0.5879228", "0.58752286", "0.5845464", "0.5831013", "0.5828076", "0.5800632", "0.57982004", "0.5787576", "0.57836133", "0.57811", "0.57788694", "0.57768625", "0.57661605", "0.5759231", "0.5751361", "0.575009", "0.574015", "0.5731486", "0.57094115", "0.57092816", "0.57034254", "0.56923425", "0.56915414", "0.5684039", "0.5681519", "0.5639938", "0.5639662", "0.560839", "0.5608378", "0.5589741", "0.55897003", "0.5589145", "0.5589145", "0.5584472", "0.5581151", "0.5574834", "0.5574602", "0.5573212", "0.55717903", "0.5565548", "0.5559343", "0.5557478", "0.555729", "0.55569655", "0.5552256", "0.5531836", "0.55216366", "0.5519199", "0.55170757", "0.5513556", "0.55080336", "0.5501219", "0.54999495", "0.54992807", "0.5490124", "0.5483348", "0.5479754", "0.5478066", "0.5477919", "0.5476577", "0.54759467", "0.54723567", "0.5462308", "0.5457851", "0.5457701", "0.5451097", "0.5441236", "0.54404265", "0.54258883", "0.5422615", "0.5419221", "0.54121524", "0.5407294", "0.5403711" ]
0.0
-1
Returns the AUthorization URL to verify a Twitter Accounts. Returns the AUthorization URL to verify a Twitter Accounts
def get_twitter_authentication_url(opts = {}) data, _status_code, _headers = get_twitter_authentication_url_with_http_info(opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def twitter_url; \"https://twitter.com/#{twitter}\" end", "def twitter_url\n twitter_user.blank? ? nil : \"#{TWITTER_URL}#{twitter_user}\"\n end", "def base_url\n \"https://api.twitter.com\"\n end", "def main_url\n return nil unless twitter\n \"http://twitter.com/#{twitter.downcase}\"\n end", "def twitter_url(username)\n \"https://twitter.com/#!/#{username}\"\n end", "def authorize_url\n polymorphic_url([ @workspace, :twitter_account ], :action => 'authorize')\n end", "def url\n \"http://twitter.com/#{self.username}/statuses/#{self.twitter_id}\"\n end", "def tw_profile_url\n \"http://twitter.com/intent/user?user_id=#{tw_user_id}\"\n end", "def twitter\n\t\thandle_omniauth_callback(request.env['omniauth.auth'])\n\tend", "def twitter\n callback_from :twitter\n end", "def oauth_callback_url\n end", "def twitter_url(json)\n \"http://twitter.com/#{json['from_user']}/status/#{json['id']}\"\n end", "def url\n \"http://twitter.com/#{attribute_get(:username)}/statuses/#{attribute_get(:id)}\"\n end", "def url\n @author_url ||= begin\n \"http://twitter.com/#{self.screenname}\" if self.screenname\n end\n end", "def twitter_ref_link\n url = u(root_url(:ref_id => current_user.id))\n \"http://twitter.com/home/?status=#{u(Setting::get('Facebook invitation text'))} #{url}\"\n end", "def link_twitter\n\n end", "def twitter_share_url(options = {})\n \"https://twitter.com/share?#{options.to_query}\"\n end", "def twitter_check\n begin\n unless twitter.blank?\n RestClient.get \"twitter.com/#{twitter}\"\n end\n rescue\n errors.add :base, \"Invalid Twitter account.\"\n end\n end", "def twitter?\n self.provider == 'twitter'\n end", "def author_url\n @author_url ||= begin\n \"http://twitter.com/#{self.author_screenname}\" if self.author_screenname\n end\n end", "def checkURL(twitter_user)\n\tchecker = twitter_user.to_s\n\tif checker.start_with?(\"http://\") or checker.start_with?(\"https://\") or checker.start_with?(\"twitter.\")\n\t\treturn checker[checker.rindex('/')+1..checker.length]\n\telse \n\t\treturn checker\n\tend\nend", "def callback_url\n auth_endpoint_callback_url(org: @organization.id)\n end", "def twitter_url\n\t\ttwitter = []\n\t\ttext = html.search(\"a\").text.split(\" \")\n\t\ttext.each do |element|\n\t\t\tif element.to_s.match(/@/)\n\t\t\t\ttwitter << element\n\t\t\tend\n\t\tend\n\t\t\treturn twitter\n\tend", "def twitter\n handle_callback(:twitter)\n end", "def twitter\n default_oauth_callback do |auth|\n # username may already be taken, user will have to enter another one\n if User.exists? username: auth.info.nickname\n redirect_to controller: '/registrations', action: 'twitter_screen_name_clash'\n else\n default_oauth_fail\n end\n end\n end", "def twitter\n handle_oauth\n end", "def twitter?\n provider_name == 'Twitter'\n end", "def grab_url(tweet)\n\t\t# only grabs the url from the tweet text and replaces any https with http\n\t\ttweet.text.split(' ').find { |hunk| hunk =~ /\\Ahttps{0,1}:\\/\\/t.co/ }.gsub('https', 'http')\n\tend", "def oauth_callback_url\n url_for :action => \"list\"\n end", "def twitter\n \toauth.authorize_from_access(oauth_token, oauth_secret)\n\t @twitter ||= Twitter::Base.new(oauth)\n end", "def wepay_authorization_url(redirect_uri)\n\t WEPAY.oauth2_authorize_url(redirect_uri, self.email, self.name)\n\tend", "def twitter\n auth = request.env['omniauth.auth']\n current_user.company.create_or_update_twitter_account(auth)\n\n flash.notice = 'Authorized Twitter account successfully.'\n redirect_to twitter_accounts_path\n end", "def wepay_authorization_url(redirect_uri)\n WEPAY.oauth2_authorize_url(redirect_uri, self.email, self.name)\nend", "def share_on_twitter_url(object)\n url = member_url([@tier, @topic, object])\n title = object.title\n \"http://twitter.com/home?status=#{url}\"\n end", "def url\n \"http://twitter.com/search/?q=\" + self.query\n end", "def oauth #:nodoc:\n @oauth ||= Bountybase.config.twitter[Bountybase.instance] ||\n begin\n E \"Cannot find twitter configuration for\", Bountybase.instance\n raise \"Cannot find twitter configuration\"\n end\n end", "def oauth_url\n 'https://geoloqi.com/oauth/authorize'\n end", "def connected_to_twitter?\n twitter_token && twitter_secret\n end", "def url\n File.join(DigitalRiver.config.oauth_url)\n end", "def twitter_connect\n access_token = OAuth::AccessToken.new(UserSession.oauth_consumer, self.oauth_token, self.oauth_secret)\n user_info = JSON.parse(access_token.get(\"https://twitter.com/account/verify_credentials.json\").body)\n self.twitter_name = user_info['name']\n self.twitter_screen_name = user_info['screen_name']\n self.login = 'twitter_' + user_info['screen_name']\n self.password = \"5uttr33_#{self.login}\"\n self.signup_source = 'twitter'\n self.save\n end", "def twitter_link(player)\n if player.twitter_screen_name\n # clean up any bad characters in a player's twitter name\n twitter_user = player.twitter_screen_name.sub(/^.*[@\\/]/, '')\n\n link_to(\"@\" + twitter_user, \"http://twitter.com/#{twitter_user}\")\n end\n end", "def url\n File.join(DigitalRiver.config.oauth_url)\n end", "def get_authorize_url(callback=nil)\n get_request_token()\n\n url = \"/#{Dropbox::API_VERSION}/oauth/authorize?oauth_token=#{URI.escape(@request_token.key)}\"\n if callback\n url += \"&oauth_callback=#{URI.escape(callback)}\"\n end\n if @locale\n url += \"&locale=#{URI.escape(@locale)}\"\n end\n\n \"https://#{Dropbox::WEB_SERVER}#{url}\"\n end", "def authorization_url\n\t\t@client ||= api_client()\n\t\[email protected]_uri.to_s\n\tend", "def select_twitter_account(&callback)\n account_type = @store.accountTypeWithAccountTypeIdentifier(ACAccountTypeIdentifierTwitter)\n\n @store.requestAccessToAccountsWithType(account_type, options: nil, completion: -> (granted, error) do\n if granted\n @accounts = @store.accountsWithAccountType(account_type)\n if @accounts.length > 0\n Dispatch::Queue.main.async do\n next_step = -> (account, &firebase_handler) do\n self.authenticate_account(account, &firebase_handler)\n end\n callback.call(nil, @accounts, next_step)\n end if callback\n else\n error = NSError.alloc.initWithDomain('TwitterAuthHelper',\n code: AuthHelperErrorAccountAccessDenied,\n userInfo: { NSLocalizedDescriptionKey => 'No Twitter accounts detected on phone. Please add one in the settings first.' })\n Dispatch::Queue.main.async do\n callback.call(error, nil, nil)\n end if callback\n end\n else\n error = NSError.alloc.initWithDomain('TwitterAuthHelper',\n code: AuthHelperErrorAccountAccessDenied,\n userInfo: { NSLocalizedDescriptionKey => 'Access to twitter accounts denied.' })\n Dispatch::Queue.main.async do\n callback.call(error, nil, nil)\n end if callback\n end\n end)\n end", "def twitter?\n false\n end", "def oauth_url\n @oauth_url || File.join(host, \"oauth20/token\")\n end", "def get_twitter_authentication_url_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AuthenticationServiceApi.get_twitter_authentication_url ...'\n end\n # resource path\n local_var_path = '/authentication/twitter'\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] || 'File' \n\n # auth_names\n auth_names = opts[:auth_names] || []\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: AuthenticationServiceApi#get_twitter_authentication_url\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_authurl\n\t\tlogger.debug \"D, #{__method__.to_s}\"\n\t\tparams = {\n \"client_id\" => @client_id,\n \"response_type\" => \"code\",\n \"redirect_uri\" => @redirect_uri,\n \"prompt\" => \"consent\"\n }\n auth_uri = URI::Generic.new(\"https\", nil, @auth_url, nil, nil, \"authorize\", \n \t\t\t\t\t\t\t nil, nil, nil)\n auth_uri.query = URI.encode_www_form(params)\n logger.debug \"D, #{__method__.to_s}, #{auth_uri.to_s}\"\n return auth_uri.to_s\n\tend", "def wepay_authorization_url(redirect_uri)\n\t #Wefarm::Application::WEPAY.oauth2_authorize_url(OAUTH_REDIRECT_URI + self.id.to_s, self.email, self.name)\n\t Wefarm::Application::WEPAY.oauth2_authorize_url(redirect_uri, self.email, self.name)\n\tend", "def two_factor_otp_url\n \"otpauth://totp/%{app_id}?secret=%{secret}&issuer=%{app}\" % {\n :secret => current_user.unconfirmed_otp_secret,\n :app => \"Hammad\",\n :app_id => \"Ham\"\n }\n end", "def twitter_connect\n access_token = OAuth::AccessToken.new(UserSession.oauth_consumer, self.oauth_token, self.oauth_secret)\n user_info = JSON.parse(access_token.get(\"https://twitter.com/account/verify_credentials.json\").body)\n\n self.login = user_info['screen_name']\n self.twitter_name = user_info['name']\n self.password = \"5uttr33_#{self.login}\"\n self.signup_source = 'twitter'\n self.save\n end", "def authorization_url\n uri = URI(OAUTH_URL)\n uri.query = {\n client_id: client_id,\n redirect_uri: redirect_uri,\n scope: scope_url,\n response_type: 'code',\n access_type: 'offline'\n }.to_param\n\n uri.to_s\n end", "def twitter\n @user = current_user\n if params[:oauth_verifier]\n if @user.user_content.twitter_token.blank?\n clientTwitter = TwitterOAuth::Client.new(:consumer_key => TwitterEnv::API_KEY, :consumer_secret => TwitterEnv::SECRET_KEY)\n pin = params[:oauth_verifier]\n access_token = clientTwitter.authorize(session[:rtoken_twitter], session[:rsecret_twitter], :oauth_verifier => pin)\n @user.user_content.twitter_token = access_token.token\n @user.user_content.twitter_secret = access_token.secret\n @user.user_content.save\n else\n clientTwitter = TwitterOAuth::Client.new(\n :consumer_key => TwitterEnv::API_KEY,\n :consumer_secret => TwitterEnv::SECRET_KEY,\n :token => @user.user_content.twitter_token, \n :secret => @user.user_content.twitter_secret)\n end\n end\n \n redirect_to \"/backend/social\"\n end", "def api_url\n authentication_credentials_provided? ? \"https://api.gowalla.com\" : \"http://api.gowalla.com\"\n end", "def oauth_url_authorize\n return \"#{$SETTINGS[:oauth_server_url_authorize]}?response_type=code&client_id=#{$SETTINGS[:oauth_client_id]}&scope=ALL&redirect_uri=#{oauth_redirect_uri}\" \n end", "def get_user_auth_url\n @oauth_token = request_oauth_token\n return @authorize_url + \"?oauth_token=\" + @oauth_token[\"oauth_token\"]\n rescue\n puts $! if @@verbose\n return nil\n end", "def connect_twitter\n auth = request.env[\"omniauth.auth\"]\n current_member.twitter_token = auth[\"credentials\"][\"token\"]\n current_member.twitter_secret = auth[\"credentials\"][\"secret\"]\n current_member.twitter_id = auth[\"uid\"]\n if current_member.img_url.blank?\n current_member.username = auth.info.name\n current_member.img_url = auth.info.image\n\t end\n current_member.save\n\t TwitterModel.store_urls(current_member)\n\t redirect_to members_social_sign_up_path\n end", "def authorize_url(callback_url)\n request_token.authorize_url+'&oauth_callback='+CGI.escape(callback_url)\n end", "def twitter?\n self.twitter_token && self.twitter_secret\n end", "def oauth_url\n url = <<-URL\n https://www.facebook.com/dialog/oauth/\n ?client_id=#{Network::Facebook.app_id}\n &redirect_uri=#{URI.escape(\"#{root_url}auth/facebook/?r=#{redirect_for(request.referer)}\")}\n &scope=#{Network::Facebook.scope}\n URL\n url.gsub(/\\s+/, '')\n end", "def authorized_twitter\n oauth = Twitter::OAuth.new($configure[:twitter][:ctoken], $configure[:twitter][:csecret])\n # Request OAuth authentication if there are no access token yet\n unless($configure[:twitter][:atoken] && $configure[:twitter][:asecret])\n rtoken = oauth.request_token\n puts \"Open next url, authorize this application: #{rtoken.authorize_url}\"\n puts \"Then, enter PIN code:\"\n pin = STDIN.gets.chomp\n # Authrize request token using PIN code (this is required for an application which type is \"Client\")\n atoken = OAuth::RequestToken.new(oauth.consumer, rtoken.token, rtoken.secret).get_access_token(:oauth_verifier => pin)\n # Save access token\n $configure[:twitter][:atoken] = atoken.token\n $configure[:twitter][:asecret] = atoken.secret\n end\n oauth.authorize_from_access($configure[:twitter][:atoken], $configure[:twitter][:asecret])\n # Create Twitter client instance with OAuth\n Twitter::Base.new(oauth)\nend", "def gardener_url\n (ENV['SUT_SCHEME'] || 'https') + \"://\" + gardener_fqhn()\n end", "def twitter_profile\n @network = current_user.network ||= Network.new\n (@network.twitter.nil?) ? \"\" : @network.twitter\n end", "def callback_url\n options.authorize_params.callback_url or super\n end", "def get_auth_url(use_callback_flow=true)\n raise 'To be implemented in child classes'\n end", "def authorize_url(options = {})\n options[:response_type] ||= \"code\"\n options[:redirect_uri] ||= redirect_uri\n params = authorization_params.merge(options)\n uri = URI(\"#{base_url}/api/oauth2/auth/\")\n uri.query = URI.encode_www_form(params)\n uri.to_s\n end", "def get_auth_url\n\t\tURI::HTTPS.build(\n\t\t\t:host => @options['auth_host'],\n\t\t\t:path => @options['auth_page'],\n\t\t\t:query => {\n\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t\t:response_type => \"code\",\n\t\t\t}.to_query\n\t\t).to_s\n\tend", "def auth_url\n client.authorization.authorization_uri(state: '', approval_prompt: :force, access_type: :offline, user_id: client_email).to_s\n end", "def authorize_url\n client.web_server.authorize_url( :redirect_uri => callback_url )\n end", "def callback_url\n if @authorization_code_from_signed_request_in_cookie\n ''\n else\n # Fixes regression in omniauth-oauth2 v1.4.0 by https://github.com/intridea/omniauth-oauth2/commit/85fdbe117c2a4400d001a6368cc359d88f40abc7\n options[:callback_url] || (full_host + script_name + callback_path)\n end\n end", "def get_authorization_url\n $LOG.i \"requesting authorization URL\"\n \n @oauth2_client.auth_code.authorize_url(:redirect_uri => @config.redirect_uri)\n end", "def get_authorize_url\n return get_request_token.authorize_url\n end", "def person_omniauth_authorize_path_or_url(provider)\n SecureUrlHelper.https? ? person_omniauth_authorize_url(provider, :protocol => 'https') : person_omniauth_authorize_path(provider)\n end", "def authentication_url(params={})\n @request_token.authorize_url params\n end", "def get_auth_url\n\t\tURI::HTTP.build(\n\t\t\t:host => @options['auth_host'],\n\t\t\t:path => @options['auth_page'],\n\t\t\t:query => {\n\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t:scope => @options['scope'],\n\t\t\t\t:response_type => \"code\",\n\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t}.to_query\n\t\t).to_s\n\tend", "def twitter\n @data['social']['twitter']\n end", "def twitt\n if PLANETOID_CONF[:twitter][:users][:send_twitts]\n twit=Twitter::Base.new(Twitter::HTTPAuth.new(PLANETOID_CONF[:twitter][:user], PLANETOID_CONF[:twitter][:password]))\n twit.update \"#{PLANETOID_CONF[:twitter][:users][:prefix]} #{self.name} #{PLANETOID_CONF[:site][:url]}/#{self.slug}\" \n end\n end", "def sso_integration_callback_url\n # Usually http://example.com/auth/:system_name/callback\n url = callback_url(query: {})\n\n case kind\n when 'auth0'\n # e.g. http://example.com/auth/invitations/auth0/auth0_123abc/callback\n invitation_signup = client.callback_url(\"#{base_url}/invitations\")\n\n [url, invitation_signup].join(', ')\n else\n url\n end\n end", "def get_authorization_url(request_token, callback_url)\n \"#{request_token.authorize_url}&oauth_callback=#{CGI::escape(callback_url)}\"\n end", "def oauth_redirect_uri\n uri = URI.parse(request.url)\n uri.path = '/sk_auth/callback'\n uri.query = nil\n uri.to_s\n end", "def my_account_url\n get_institution_or_default(:eshelf_url) + '/account'\n end", "def authorize_url\n @connection.authorize_url\n end", "def third_party_connect\n if tw_user_id.nil? && fb_user_id.nil?\n errors.add(\"Either twitter or facebook connect required\") \n end\n end", "def twitter?; twitter.to_s != \"\" end", "def authorize_url\n request_token.authorize_url\n end", "def path_to_url(path, query_values = nil)\n Addressable::URI.new(\n :scheme => \"https\",\n :host => \"api.twitter.com\",\n :path => path,\n :query_values => query_values\n ).to_s\n end", "def getAuthUrl\n\t\t\t\tURI::HTTP.build(\n\t\t\t\t\t:host => @options['auth_host'],\n\t\t\t\t\t:path => @options['auth_page'],\n\t\t\t\t\t:query => {\n\t\t\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t\t\t:scope => @options['scope'],\n\t\t\t\t\t\t:response_type => \"code\",\n\t\t\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t\t\t}.to_query\n\t\t\t\t).to_s\n\t\t\tend", "def oauth\n ::OAuth::Consumer.new(Config.consumer_key, Config.consumer_secret, :site => \"https://api.twitter.com\")\n end", "def oauth_url(response_type = 'code')\n # The Redirect URI must be the same as registered with Put.io\n PUTIO_BASE_URL + \"/oauth2/authenticate?client_id=%i&response_type=%s&redirect_uri=%s\" % [@client_id, response_type, @redirect_uri]\n end", "def twitter\n if twitter?\n return self.twitter_client if self.twitter_client\n self.twitter_client = TwitterOAuth::Client.new(\n :consumer_key => TWITTER_CONSUMER_KEY,\n :consumer_secret => TWITTER_CONSUMER_SECRET,\n :token => self.twitter_token,\n :secret => self.twitter_secret\n )\n else\n false\n end\n end", "def pubsubhubbub_callback_url\n ENV['PUBSUBHUBBUB_CALLBACK_URL'].presence || Rails.application.routes.url_helpers\n .url_for(controller: 'curry/pull_request_updates', action: 'create',\n host: ENV['FQDN'], protocol: ENV['PROTOCOL'], port: ENV['PORT'])\n end", "def activation_url\n return @activation_url\n end", "def access_token_url\n Settings.lighthouse_health_immunization.access_token_url\n end", "def inject_url_into_tweets\n self.up_tweet = \"#{self.up_tweet} #{public_url}\" if !self.up_tweet.include?(public_url)\n self.down_tweet = \"#{self.down_tweet} #{public_url}\" if self.is_pool && !self.down_tweet.include?(public_url)\n end", "def authorization_url\n url = \"#{host}/OAuth2AccessRequest.action?response_type=code&client_id=#{@client_id}\"\n url += \"&redirect_uri=#{Addressable::URI.escape(@redirect_uri)}\" if @redirect_uri\n url += \"&state=#{@state}\" if @state\n url\n end", "def twitter_callback\n\t if I18n.locale == :en\n\t \tflash[:notice] = \"Connected to Twitter successfully!\"\n\t else I18n.locale == :ar\n\t \tflash[:notice] = \"تم التواصل مع تويتر بنجاح!\"\n\t end\n\t auth = request.env[\"omniauth.auth\"]\n authentication = Authentication.find_by_provider_and_gid(auth[\"provider\"],\n current_gamer.id) || Authentication.create_with_omniauth(auth,\n current_gamer)\n redirect_to \"/gamers/edit\"\n return\n\tend", "def authorize_url\n client = OAuth2::Client.new(client_id, client_secret, :site => oauth_url)\n client.auth_code.authorize_url(:redirect_uri => redirect_uri)\n end", "def connectURL\n\t\t\"http://beta.stoffiplayer.com/auth/#{provider}\"\n\tend", "def failure\n flash.alert = 'Failed to authorize Twitter account.'\n redirect_to twitter_accounts_url\n end" ]
[ "0.75473624", "0.7191596", "0.70933235", "0.7000585", "0.683967", "0.6731578", "0.6600234", "0.65648156", "0.63874996", "0.6372541", "0.63553834", "0.62599987", "0.6244732", "0.6242197", "0.6116308", "0.6068254", "0.606578", "0.60546124", "0.6053643", "0.6028568", "0.6019042", "0.60177785", "0.6002484", "0.59722024", "0.59360766", "0.593404", "0.5929556", "0.5912705", "0.5901658", "0.58935785", "0.5887492", "0.5870727", "0.5865858", "0.5855468", "0.58138764", "0.57914674", "0.5762697", "0.5755207", "0.5752181", "0.57488316", "0.5719098", "0.5714929", "0.570216", "0.5693688", "0.56902295", "0.56861585", "0.5683738", "0.5665848", "0.56655085", "0.56626207", "0.56541437", "0.5641767", "0.5635181", "0.563074", "0.5617335", "0.5609047", "0.55962163", "0.5586427", "0.5586096", "0.5578669", "0.5573927", "0.5568156", "0.55620503", "0.555889", "0.5553153", "0.55437076", "0.55422777", "0.55401325", "0.5535933", "0.55290097", "0.5525474", "0.55236596", "0.55158615", "0.5514259", "0.54940295", "0.54899395", "0.54886234", "0.54871947", "0.54788893", "0.54769504", "0.54670936", "0.5465439", "0.5463157", "0.5459041", "0.5455632", "0.5454693", "0.54525924", "0.54344577", "0.5432806", "0.5431466", "0.5430893", "0.5416076", "0.54111964", "0.5391231", "0.53897595", "0.538788", "0.5387489", "0.5374638", "0.53717923", "0.53713495" ]
0.6237169
14
Returns the AUthorization URL to verify a Twitter Accounts. Returns the AUthorization URL to verify a Twitter Accounts
def get_twitter_authentication_url_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AuthenticationServiceApi.get_twitter_authentication_url ...' end # resource path local_var_path = '/authentication/twitter' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'File' # auth_names auth_names = opts[:auth_names] || [] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AuthenticationServiceApi#get_twitter_authentication_url\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def twitter_url; \"https://twitter.com/#{twitter}\" end", "def twitter_url\n twitter_user.blank? ? nil : \"#{TWITTER_URL}#{twitter_user}\"\n end", "def base_url\n \"https://api.twitter.com\"\n end", "def main_url\n return nil unless twitter\n \"http://twitter.com/#{twitter.downcase}\"\n end", "def twitter_url(username)\n \"https://twitter.com/#!/#{username}\"\n end", "def authorize_url\n polymorphic_url([ @workspace, :twitter_account ], :action => 'authorize')\n end", "def url\n \"http://twitter.com/#{self.username}/statuses/#{self.twitter_id}\"\n end", "def tw_profile_url\n \"http://twitter.com/intent/user?user_id=#{tw_user_id}\"\n end", "def twitter\n\t\thandle_omniauth_callback(request.env['omniauth.auth'])\n\tend", "def twitter\n callback_from :twitter\n end", "def oauth_callback_url\n end", "def twitter_url(json)\n \"http://twitter.com/#{json['from_user']}/status/#{json['id']}\"\n end", "def url\n \"http://twitter.com/#{attribute_get(:username)}/statuses/#{attribute_get(:id)}\"\n end", "def url\n @author_url ||= begin\n \"http://twitter.com/#{self.screenname}\" if self.screenname\n end\n end", "def get_twitter_authentication_url(opts = {})\n data, _status_code, _headers = get_twitter_authentication_url_with_http_info(opts)\n data\n end", "def twitter_ref_link\n url = u(root_url(:ref_id => current_user.id))\n \"http://twitter.com/home/?status=#{u(Setting::get('Facebook invitation text'))} #{url}\"\n end", "def link_twitter\n\n end", "def twitter_share_url(options = {})\n \"https://twitter.com/share?#{options.to_query}\"\n end", "def twitter?\n self.provider == 'twitter'\n end", "def twitter_check\n begin\n unless twitter.blank?\n RestClient.get \"twitter.com/#{twitter}\"\n end\n rescue\n errors.add :base, \"Invalid Twitter account.\"\n end\n end", "def author_url\n @author_url ||= begin\n \"http://twitter.com/#{self.author_screenname}\" if self.author_screenname\n end\n end", "def callback_url\n auth_endpoint_callback_url(org: @organization.id)\n end", "def checkURL(twitter_user)\n\tchecker = twitter_user.to_s\n\tif checker.start_with?(\"http://\") or checker.start_with?(\"https://\") or checker.start_with?(\"twitter.\")\n\t\treturn checker[checker.rindex('/')+1..checker.length]\n\telse \n\t\treturn checker\n\tend\nend", "def twitter_url\n\t\ttwitter = []\n\t\ttext = html.search(\"a\").text.split(\" \")\n\t\ttext.each do |element|\n\t\t\tif element.to_s.match(/@/)\n\t\t\t\ttwitter << element\n\t\t\tend\n\t\tend\n\t\t\treturn twitter\n\tend", "def twitter\n handle_callback(:twitter)\n end", "def twitter\n default_oauth_callback do |auth|\n # username may already be taken, user will have to enter another one\n if User.exists? username: auth.info.nickname\n redirect_to controller: '/registrations', action: 'twitter_screen_name_clash'\n else\n default_oauth_fail\n end\n end\n end", "def twitter\n handle_oauth\n end", "def twitter?\n provider_name == 'Twitter'\n end", "def grab_url(tweet)\n\t\t# only grabs the url from the tweet text and replaces any https with http\n\t\ttweet.text.split(' ').find { |hunk| hunk =~ /\\Ahttps{0,1}:\\/\\/t.co/ }.gsub('https', 'http')\n\tend", "def oauth_callback_url\n url_for :action => \"list\"\n end", "def twitter\n \toauth.authorize_from_access(oauth_token, oauth_secret)\n\t @twitter ||= Twitter::Base.new(oauth)\n end", "def wepay_authorization_url(redirect_uri)\n\t WEPAY.oauth2_authorize_url(redirect_uri, self.email, self.name)\n\tend", "def twitter\n auth = request.env['omniauth.auth']\n current_user.company.create_or_update_twitter_account(auth)\n\n flash.notice = 'Authorized Twitter account successfully.'\n redirect_to twitter_accounts_path\n end", "def wepay_authorization_url(redirect_uri)\n WEPAY.oauth2_authorize_url(redirect_uri, self.email, self.name)\nend", "def share_on_twitter_url(object)\n url = member_url([@tier, @topic, object])\n title = object.title\n \"http://twitter.com/home?status=#{url}\"\n end", "def url\n \"http://twitter.com/search/?q=\" + self.query\n end", "def oauth #:nodoc:\n @oauth ||= Bountybase.config.twitter[Bountybase.instance] ||\n begin\n E \"Cannot find twitter configuration for\", Bountybase.instance\n raise \"Cannot find twitter configuration\"\n end\n end", "def oauth_url\n 'https://geoloqi.com/oauth/authorize'\n end", "def connected_to_twitter?\n twitter_token && twitter_secret\n end", "def url\n File.join(DigitalRiver.config.oauth_url)\n end", "def twitter_connect\n access_token = OAuth::AccessToken.new(UserSession.oauth_consumer, self.oauth_token, self.oauth_secret)\n user_info = JSON.parse(access_token.get(\"https://twitter.com/account/verify_credentials.json\").body)\n self.twitter_name = user_info['name']\n self.twitter_screen_name = user_info['screen_name']\n self.login = 'twitter_' + user_info['screen_name']\n self.password = \"5uttr33_#{self.login}\"\n self.signup_source = 'twitter'\n self.save\n end", "def twitter_link(player)\n if player.twitter_screen_name\n # clean up any bad characters in a player's twitter name\n twitter_user = player.twitter_screen_name.sub(/^.*[@\\/]/, '')\n\n link_to(\"@\" + twitter_user, \"http://twitter.com/#{twitter_user}\")\n end\n end", "def url\n File.join(DigitalRiver.config.oauth_url)\n end", "def get_authorize_url(callback=nil)\n get_request_token()\n\n url = \"/#{Dropbox::API_VERSION}/oauth/authorize?oauth_token=#{URI.escape(@request_token.key)}\"\n if callback\n url += \"&oauth_callback=#{URI.escape(callback)}\"\n end\n if @locale\n url += \"&locale=#{URI.escape(@locale)}\"\n end\n\n \"https://#{Dropbox::WEB_SERVER}#{url}\"\n end", "def authorization_url\n\t\t@client ||= api_client()\n\t\[email protected]_uri.to_s\n\tend", "def select_twitter_account(&callback)\n account_type = @store.accountTypeWithAccountTypeIdentifier(ACAccountTypeIdentifierTwitter)\n\n @store.requestAccessToAccountsWithType(account_type, options: nil, completion: -> (granted, error) do\n if granted\n @accounts = @store.accountsWithAccountType(account_type)\n if @accounts.length > 0\n Dispatch::Queue.main.async do\n next_step = -> (account, &firebase_handler) do\n self.authenticate_account(account, &firebase_handler)\n end\n callback.call(nil, @accounts, next_step)\n end if callback\n else\n error = NSError.alloc.initWithDomain('TwitterAuthHelper',\n code: AuthHelperErrorAccountAccessDenied,\n userInfo: { NSLocalizedDescriptionKey => 'No Twitter accounts detected on phone. Please add one in the settings first.' })\n Dispatch::Queue.main.async do\n callback.call(error, nil, nil)\n end if callback\n end\n else\n error = NSError.alloc.initWithDomain('TwitterAuthHelper',\n code: AuthHelperErrorAccountAccessDenied,\n userInfo: { NSLocalizedDescriptionKey => 'Access to twitter accounts denied.' })\n Dispatch::Queue.main.async do\n callback.call(error, nil, nil)\n end if callback\n end\n end)\n end", "def twitter?\n false\n end", "def oauth_url\n @oauth_url || File.join(host, \"oauth20/token\")\n end", "def get_authurl\n\t\tlogger.debug \"D, #{__method__.to_s}\"\n\t\tparams = {\n \"client_id\" => @client_id,\n \"response_type\" => \"code\",\n \"redirect_uri\" => @redirect_uri,\n \"prompt\" => \"consent\"\n }\n auth_uri = URI::Generic.new(\"https\", nil, @auth_url, nil, nil, \"authorize\", \n \t\t\t\t\t\t\t nil, nil, nil)\n auth_uri.query = URI.encode_www_form(params)\n logger.debug \"D, #{__method__.to_s}, #{auth_uri.to_s}\"\n return auth_uri.to_s\n\tend", "def wepay_authorization_url(redirect_uri)\n\t #Wefarm::Application::WEPAY.oauth2_authorize_url(OAUTH_REDIRECT_URI + self.id.to_s, self.email, self.name)\n\t Wefarm::Application::WEPAY.oauth2_authorize_url(redirect_uri, self.email, self.name)\n\tend", "def two_factor_otp_url\n \"otpauth://totp/%{app_id}?secret=%{secret}&issuer=%{app}\" % {\n :secret => current_user.unconfirmed_otp_secret,\n :app => \"Hammad\",\n :app_id => \"Ham\"\n }\n end", "def twitter_connect\n access_token = OAuth::AccessToken.new(UserSession.oauth_consumer, self.oauth_token, self.oauth_secret)\n user_info = JSON.parse(access_token.get(\"https://twitter.com/account/verify_credentials.json\").body)\n\n self.login = user_info['screen_name']\n self.twitter_name = user_info['name']\n self.password = \"5uttr33_#{self.login}\"\n self.signup_source = 'twitter'\n self.save\n end", "def authorization_url\n uri = URI(OAUTH_URL)\n uri.query = {\n client_id: client_id,\n redirect_uri: redirect_uri,\n scope: scope_url,\n response_type: 'code',\n access_type: 'offline'\n }.to_param\n\n uri.to_s\n end", "def twitter\n @user = current_user\n if params[:oauth_verifier]\n if @user.user_content.twitter_token.blank?\n clientTwitter = TwitterOAuth::Client.new(:consumer_key => TwitterEnv::API_KEY, :consumer_secret => TwitterEnv::SECRET_KEY)\n pin = params[:oauth_verifier]\n access_token = clientTwitter.authorize(session[:rtoken_twitter], session[:rsecret_twitter], :oauth_verifier => pin)\n @user.user_content.twitter_token = access_token.token\n @user.user_content.twitter_secret = access_token.secret\n @user.user_content.save\n else\n clientTwitter = TwitterOAuth::Client.new(\n :consumer_key => TwitterEnv::API_KEY,\n :consumer_secret => TwitterEnv::SECRET_KEY,\n :token => @user.user_content.twitter_token, \n :secret => @user.user_content.twitter_secret)\n end\n end\n \n redirect_to \"/backend/social\"\n end", "def api_url\n authentication_credentials_provided? ? \"https://api.gowalla.com\" : \"http://api.gowalla.com\"\n end", "def oauth_url_authorize\n return \"#{$SETTINGS[:oauth_server_url_authorize]}?response_type=code&client_id=#{$SETTINGS[:oauth_client_id]}&scope=ALL&redirect_uri=#{oauth_redirect_uri}\" \n end", "def get_user_auth_url\n @oauth_token = request_oauth_token\n return @authorize_url + \"?oauth_token=\" + @oauth_token[\"oauth_token\"]\n rescue\n puts $! if @@verbose\n return nil\n end", "def authorize_url(callback_url)\n request_token.authorize_url+'&oauth_callback='+CGI.escape(callback_url)\n end", "def connect_twitter\n auth = request.env[\"omniauth.auth\"]\n current_member.twitter_token = auth[\"credentials\"][\"token\"]\n current_member.twitter_secret = auth[\"credentials\"][\"secret\"]\n current_member.twitter_id = auth[\"uid\"]\n if current_member.img_url.blank?\n current_member.username = auth.info.name\n current_member.img_url = auth.info.image\n\t end\n current_member.save\n\t TwitterModel.store_urls(current_member)\n\t redirect_to members_social_sign_up_path\n end", "def twitter?\n self.twitter_token && self.twitter_secret\n end", "def oauth_url\n url = <<-URL\n https://www.facebook.com/dialog/oauth/\n ?client_id=#{Network::Facebook.app_id}\n &redirect_uri=#{URI.escape(\"#{root_url}auth/facebook/?r=#{redirect_for(request.referer)}\")}\n &scope=#{Network::Facebook.scope}\n URL\n url.gsub(/\\s+/, '')\n end", "def authorized_twitter\n oauth = Twitter::OAuth.new($configure[:twitter][:ctoken], $configure[:twitter][:csecret])\n # Request OAuth authentication if there are no access token yet\n unless($configure[:twitter][:atoken] && $configure[:twitter][:asecret])\n rtoken = oauth.request_token\n puts \"Open next url, authorize this application: #{rtoken.authorize_url}\"\n puts \"Then, enter PIN code:\"\n pin = STDIN.gets.chomp\n # Authrize request token using PIN code (this is required for an application which type is \"Client\")\n atoken = OAuth::RequestToken.new(oauth.consumer, rtoken.token, rtoken.secret).get_access_token(:oauth_verifier => pin)\n # Save access token\n $configure[:twitter][:atoken] = atoken.token\n $configure[:twitter][:asecret] = atoken.secret\n end\n oauth.authorize_from_access($configure[:twitter][:atoken], $configure[:twitter][:asecret])\n # Create Twitter client instance with OAuth\n Twitter::Base.new(oauth)\nend", "def gardener_url\n (ENV['SUT_SCHEME'] || 'https') + \"://\" + gardener_fqhn()\n end", "def twitter_profile\n @network = current_user.network ||= Network.new\n (@network.twitter.nil?) ? \"\" : @network.twitter\n end", "def callback_url\n options.authorize_params.callback_url or super\n end", "def get_auth_url(use_callback_flow=true)\n raise 'To be implemented in child classes'\n end", "def authorize_url(options = {})\n options[:response_type] ||= \"code\"\n options[:redirect_uri] ||= redirect_uri\n params = authorization_params.merge(options)\n uri = URI(\"#{base_url}/api/oauth2/auth/\")\n uri.query = URI.encode_www_form(params)\n uri.to_s\n end", "def get_auth_url\n\t\tURI::HTTPS.build(\n\t\t\t:host => @options['auth_host'],\n\t\t\t:path => @options['auth_page'],\n\t\t\t:query => {\n\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t\t:response_type => \"code\",\n\t\t\t}.to_query\n\t\t).to_s\n\tend", "def auth_url\n client.authorization.authorization_uri(state: '', approval_prompt: :force, access_type: :offline, user_id: client_email).to_s\n end", "def authorize_url\n client.web_server.authorize_url( :redirect_uri => callback_url )\n end", "def callback_url\n if @authorization_code_from_signed_request_in_cookie\n ''\n else\n # Fixes regression in omniauth-oauth2 v1.4.0 by https://github.com/intridea/omniauth-oauth2/commit/85fdbe117c2a4400d001a6368cc359d88f40abc7\n options[:callback_url] || (full_host + script_name + callback_path)\n end\n end", "def get_authorization_url\n $LOG.i \"requesting authorization URL\"\n \n @oauth2_client.auth_code.authorize_url(:redirect_uri => @config.redirect_uri)\n end", "def get_authorize_url\n return get_request_token.authorize_url\n end", "def person_omniauth_authorize_path_or_url(provider)\n SecureUrlHelper.https? ? person_omniauth_authorize_url(provider, :protocol => 'https') : person_omniauth_authorize_path(provider)\n end", "def authentication_url(params={})\n @request_token.authorize_url params\n end", "def get_auth_url\n\t\tURI::HTTP.build(\n\t\t\t:host => @options['auth_host'],\n\t\t\t:path => @options['auth_page'],\n\t\t\t:query => {\n\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t:scope => @options['scope'],\n\t\t\t\t:response_type => \"code\",\n\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t}.to_query\n\t\t).to_s\n\tend", "def twitter\n @data['social']['twitter']\n end", "def twitt\n if PLANETOID_CONF[:twitter][:users][:send_twitts]\n twit=Twitter::Base.new(Twitter::HTTPAuth.new(PLANETOID_CONF[:twitter][:user], PLANETOID_CONF[:twitter][:password]))\n twit.update \"#{PLANETOID_CONF[:twitter][:users][:prefix]} #{self.name} #{PLANETOID_CONF[:site][:url]}/#{self.slug}\" \n end\n end", "def sso_integration_callback_url\n # Usually http://example.com/auth/:system_name/callback\n url = callback_url(query: {})\n\n case kind\n when 'auth0'\n # e.g. http://example.com/auth/invitations/auth0/auth0_123abc/callback\n invitation_signup = client.callback_url(\"#{base_url}/invitations\")\n\n [url, invitation_signup].join(', ')\n else\n url\n end\n end", "def get_authorization_url(request_token, callback_url)\n \"#{request_token.authorize_url}&oauth_callback=#{CGI::escape(callback_url)}\"\n end", "def oauth_redirect_uri\n uri = URI.parse(request.url)\n uri.path = '/sk_auth/callback'\n uri.query = nil\n uri.to_s\n end", "def my_account_url\n get_institution_or_default(:eshelf_url) + '/account'\n end", "def authorize_url\n @connection.authorize_url\n end", "def third_party_connect\n if tw_user_id.nil? && fb_user_id.nil?\n errors.add(\"Either twitter or facebook connect required\") \n end\n end", "def authorize_url\n request_token.authorize_url\n end", "def twitter?; twitter.to_s != \"\" end", "def path_to_url(path, query_values = nil)\n Addressable::URI.new(\n :scheme => \"https\",\n :host => \"api.twitter.com\",\n :path => path,\n :query_values => query_values\n ).to_s\n end", "def getAuthUrl\n\t\t\t\tURI::HTTP.build(\n\t\t\t\t\t:host => @options['auth_host'],\n\t\t\t\t\t:path => @options['auth_page'],\n\t\t\t\t\t:query => {\n\t\t\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t\t\t:scope => @options['scope'],\n\t\t\t\t\t\t:response_type => \"code\",\n\t\t\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t\t\t}.to_query\n\t\t\t\t).to_s\n\t\t\tend", "def oauth\n ::OAuth::Consumer.new(Config.consumer_key, Config.consumer_secret, :site => \"https://api.twitter.com\")\n end", "def oauth_url(response_type = 'code')\n # The Redirect URI must be the same as registered with Put.io\n PUTIO_BASE_URL + \"/oauth2/authenticate?client_id=%i&response_type=%s&redirect_uri=%s\" % [@client_id, response_type, @redirect_uri]\n end", "def twitter\n if twitter?\n return self.twitter_client if self.twitter_client\n self.twitter_client = TwitterOAuth::Client.new(\n :consumer_key => TWITTER_CONSUMER_KEY,\n :consumer_secret => TWITTER_CONSUMER_SECRET,\n :token => self.twitter_token,\n :secret => self.twitter_secret\n )\n else\n false\n end\n end", "def pubsubhubbub_callback_url\n ENV['PUBSUBHUBBUB_CALLBACK_URL'].presence || Rails.application.routes.url_helpers\n .url_for(controller: 'curry/pull_request_updates', action: 'create',\n host: ENV['FQDN'], protocol: ENV['PROTOCOL'], port: ENV['PORT'])\n end", "def activation_url\n return @activation_url\n end", "def access_token_url\n Settings.lighthouse_health_immunization.access_token_url\n end", "def authorization_url\n url = \"#{host}/OAuth2AccessRequest.action?response_type=code&client_id=#{@client_id}\"\n url += \"&redirect_uri=#{Addressable::URI.escape(@redirect_uri)}\" if @redirect_uri\n url += \"&state=#{@state}\" if @state\n url\n end", "def inject_url_into_tweets\n self.up_tweet = \"#{self.up_tweet} #{public_url}\" if !self.up_tweet.include?(public_url)\n self.down_tweet = \"#{self.down_tweet} #{public_url}\" if self.is_pool && !self.down_tweet.include?(public_url)\n end", "def twitter_callback\n\t if I18n.locale == :en\n\t \tflash[:notice] = \"Connected to Twitter successfully!\"\n\t else I18n.locale == :ar\n\t \tflash[:notice] = \"تم التواصل مع تويتر بنجاح!\"\n\t end\n\t auth = request.env[\"omniauth.auth\"]\n authentication = Authentication.find_by_provider_and_gid(auth[\"provider\"],\n current_gamer.id) || Authentication.create_with_omniauth(auth,\n current_gamer)\n redirect_to \"/gamers/edit\"\n return\n\tend", "def authorize_url\n client = OAuth2::Client.new(client_id, client_secret, :site => oauth_url)\n client.auth_code.authorize_url(:redirect_uri => redirect_uri)\n end", "def connectURL\n\t\t\"http://beta.stoffiplayer.com/auth/#{provider}\"\n\tend", "def failure\n flash.alert = 'Failed to authorize Twitter account.'\n redirect_to twitter_accounts_url\n end" ]
[ "0.75465775", "0.71912724", "0.709213", "0.6999329", "0.68397754", "0.67335963", "0.65996695", "0.6565563", "0.6388169", "0.6372578", "0.63554007", "0.6259215", "0.6244586", "0.62423265", "0.6237841", "0.6116655", "0.6068223", "0.606624", "0.6053999", "0.6052716", "0.60285366", "0.6018548", "0.60178846", "0.60025823", "0.597224", "0.5937727", "0.5934075", "0.59303075", "0.59113896", "0.59015447", "0.5894327", "0.5887374", "0.5873275", "0.5865758", "0.5855452", "0.5812137", "0.5791615", "0.5763192", "0.57549626", "0.57527995", "0.5749022", "0.57204217", "0.5715608", "0.570292", "0.56944263", "0.5692497", "0.5685689", "0.5684636", "0.56656605", "0.56625044", "0.5654835", "0.56420666", "0.5636339", "0.56308603", "0.56179917", "0.56103987", "0.55976737", "0.5586858", "0.5586097", "0.55781716", "0.55743575", "0.55685717", "0.55618024", "0.55602705", "0.5554016", "0.5544717", "0.55444235", "0.5540226", "0.5536517", "0.55298036", "0.5526097", "0.55243134", "0.5516818", "0.5516174", "0.54952353", "0.5490578", "0.5489378", "0.54879683", "0.54791087", "0.54775065", "0.5467556", "0.5466562", "0.54644215", "0.5459401", "0.5455656", "0.5454573", "0.5451816", "0.5435002", "0.5433028", "0.5432874", "0.54305494", "0.5414967", "0.54103893", "0.5391302", "0.5389244", "0.5388584", "0.53877634", "0.53758216", "0.53730047", "0.5371641" ]
0.5666036
48
Used as Callback URL when users have successfully authorized their facbeook account. Used as Callback URL when users have successfully authorized their facbeook account
def set_facebook_uid(opts = {}) data, _status_code, _headers = set_facebook_uid_with_http_info(opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def callback\n rpx_auth\n after_auth(params[:on_complete_url])\n end", "def fbauthorize\n redirect_to fb_auth_login_url.to_s\n end", "def callback_url\n options.authorize_params.callback_url or super\n end", "def callback\n self.oaw_callback(params[:oauth_verifier], params[:oauth_token])\n end", "def callback\n # This stores all the user information that came from Auth0\n # and the IdP\n userinfo = request.env['omniauth.auth']\n\n begin\n result = SessionService.process!(userinfo, session)\n\n if result.new_user?\n redirect_to welcome_path\n else\n # Redirect to the URL you want after successful auth\n redirect_to services_path,\n flash: {\n success: I18n.t(:welcome_html, scope: [:auth, :existing_user])\n }\n end\n rescue SignupNotAllowedError\n # no new user or existing user, so they weren't allowed to sign up\n redirect_to signup_not_allowed_path\n end\n end", "def authorize_url\n client.web_server.authorize_url( :redirect_uri => callback_url )\n end", "def callback_url\n auth_endpoint_callback_url(org: @organization.id)\n end", "def authCallback\n begin\n auth_code = params.fetch(\"code\")\n rescue KeyError\n raise \"error: no code param provided\"\n end\n\n from_sso = params.fetch(\"from_sso\", \"0\") == \"1\" \n origin = params[\"origin\"] if params.key?(\"origin\")\n\n redirect_uri_sso = URI(api_args[\"redirect_uri\"])\n redirect_uri_sso.query = URI.encode_www_form(params.select{|k, v| [\"from_sso\", \"origin\"].include? k})\n\n redirect_uri = from_sso ? redirect_uri_sso.to_s : api_args[\"redirect_uri\"]\n\n password_reset = sign_in(auth_code, redirect_uri)\n\n if from_sso\n # we got here from sso, redirect to origin(the page where user entered \n # the site)\n redirect_to origin\n elsif password_reset\n # we got here from email password reset, redirect to change password\n redirect_to \"/#{app.name}/profile_change_password\"\n else\n # since we are in an iframe, reload the parent, not the current window,\n # otherwise we will get nesting.\n render :text => \"<script>window.parent.location.reload()</script>\"\n end \n end", "def rc_facebook_authorize_redirect\n unless rc_facebook_in_canvas?\n redirect_to @rc_facebook_authorize_url\n else\n rc_facebook_js_redirect(@rc_facebook_authorize_url,\n rc_facebook_authorize_body)\n end\n end", "def oauth_authorize\n redirect_to facebook_client.authorize(oauth_callback_url)\n end", "def authorize_callback\n @request_token = OAuth::RequestToken.new(@oauth,\n session[:request_token], \n session[:request_token_secret])\n\n @access_token = @request_token.get_access_token(:oauth_verifier => params[:oauth_verifier])\n session[:access_token] = @access_token.token\n session[:secret_token] = @access_token.secret\n session[:user_id] = @access_token.params[\"user_id\"] rescue \"\"\n session[:screen_name] = @access_token.params[\"screen_name\"] rescue \"\"\n session[:authorized] = true\n @log.info \"authorized, user [#{session[:screen_name]}]\"\n \n if session[:redirect_to]\n url = session[:redirect_to]\n session[:redirect_to] = nil \n redirect url\n else\n redirect '/'\n end\n\n end", "def callback\n access_token = client.web_server.get_access_token(params[:code], :redirect_uri => oauth_callback_url)\n \n current_user.update_attribute(:oauth2_token, access_token.token)\n flash[:notice] = \"Authorized successfully!\"\n \n redirect_to root_url\n end", "def callback\n return unless passes_whitelist?\n session[:user_id] = User.from_omniauth(@auth_hash, current_tenant.tenant_id, unmangle_orcid).id\n redirect_to dashboard_path\n end", "def redirect_url\n\t\tcallback_url\n\tend", "def callback\n\n client = Signet::OAuth2::Client.new(client_options)\n client.code = params[:code]\n\n response = client.fetch_access_token!\n\n session[:authorization] = response\n redirect_to '/leagues/calendar/events/[email protected]'\n end", "def auth_callback\n current_user\n omniauth_origin = session[:omniauth_origin]\n session.delete(:omniauth_origin)\n redirect_to omniauth_origin || '/'\n end", "def callback\n\n\n # Access the authentication hash for omniauth\n data = request.env['omniauth.auth']\n\n # Temporary for testing!\n render json: data.to_json\n\n\n # Access the authentication hash for omniauth\n # data = request.env['omniauth.auth']\n\n # microsoft_email_address = data.dig(:extra, :raw_info, :mail) || data.dig(:extra, :raw_info, :userPrincipalName)\n\n # if user_account = UserAccount.find_by(email: microsoft_email_address)\n # session[:user_account_id] = user_account.id\n # if session[:previously_requested_page]\n # last_page = session[:previously_requested_page]\n # session.delete(:previously_requested_page)\n # redirect_to last_page\n # else\n # redirect_to root_path\n # end\n # else\n # redirect_to new_session_path, notice: \"An account could not be found for #{microsoft_email_address}.\"\n # end\n end", "def callback\n # evernote returns a verifier if user authorized the app\n oauth_verifier = params[:oauth_verifier]\n if oauth_verifier\n consumer = get_consumer\n request_token = OAuth::RequestToken.new(consumer, flash[:request_token], flash[:request_secret])\n # contains the real token, user id, shard, and token expiration date\n access_token = request_token.get_access_token(:oauth_verifier => oauth_verifier)\n account = EvernoteAccount.where(\"user_id = \" + access_token.params[:edam_userId]).take\n if !account\n # save this stuff\n account = EvernoteAccount.create(\n user_id: access_token.params[:edam_userId],\n token: access_token.token,\n shard: access_token.params[:edam_shard],\n token_expiration: access_token.params[:edam_expires]\n )\n end\n session[:evernote_account_id] = account.id\n # directs to recipes page (recipe_controller.rb)\n redirect_to action: \"index\", controller: \"recipes\"\n else\n redirect_to action: \"index\"\n end\n end", "def pre_authorize_cb; end", "def callback2\n oauth_token = FitbitOauthToken.where(:token=>params[:state]).last\n verifier = params[:code]\n if oauth_token\n return_url = request.original_url\n #xd = YAML::load oauth_token.extra_data\n # if return_url already has a ? in it, then this needs to add an & and not a ? \n #question_mark_or_ampersand = xd[:return_url].to_s =~ /\\?/ ? '&' : '?'\n question_mark_or_ampersand = return_url.to_s =~ /\\?/ ? '&' : '?'\n #There's a code and a state that need to go with:\n url = \"\"\n url += \"#{return_url.gsub(\"callback2\",\"post_authorize\")}\"\n if !verifier.nil? && !verifier.empty? \n #Only add the token and verifier if we have both\n #This way, the recieving application can respond if they're missing\n url += \"#{question_mark_or_ampersand}\"\n url += \"oauth_token=#{params[:state]}\"\n url += \"&oauth_verifier=#{params[:code]}\"\n end\n redirect_to url\n else\n render :text=>\"error processing oauth token\", :layout=>false\n end\n end", "def callback_phase\n # Prep the urls using the account ID.\n # TODO: Could we use the :setup option and a Proc\n # to handle this rather than call here? \n set_omniauth_zendesk_urls\n\n # Continue the request as usual.\n super\n end", "def callback\n # Authentication redirects here\n code = params[:code]\n\n # Used in the template\n @name = auth_hash.info.name\n @email = auth_hash.info.email\n\n # Request an access token\n result = acquire_access_token(code, ENV['REPLY_URL'])\n\n # Associate token/user values to the session\n session[:access_token] = result.access_token\n session[:name] = @name\n session[:email] = @email\n\n # Debug logging\n logger.info \"Code: #{code}\"\n logger.info \"Name: #{@name}\"\n logger.info \"Email: #{@email}\"\n logger.info \"[callback] - Access token: #{session[:access_token]}\"\n end", "def facebook_request\n redirect_to facebook_authenticate_url\n end", "def success_url\n redirect_url([@token && @token.success_url, TokenAction.success_url])\n end", "def auth_url\n MiniFB.oauth_url(@app_id, @redirect_to,\n :scope => 'user_about_me') # See MiniFB.scopes\n end", "def oauth_callback_url\n end", "def redirect_url(callback_url)\n signin_url(callback_url)\n end", "def callback_facebook\n token = env[\"omniauth.auth\"][:credentials][:token]\n first_name = env[\"omniauth.auth\"][:info][:first_name]\n email = env[\"omniauth.auth\"][:info][:email]\n\n\n # Create new Subscriber record.\n deal = Deal.find(request.env['HTTP_REFERER'].split('?').first.split('/').last)\n @subscriber = Subscriber.new(first_name: first_name, email: email, deal_id: deal.id)\n @subscriber.save\n\n # Post deal's info to user timeline.\n user = FbGraph::User.me(token)\n\n if Rails.env.development?\n image_url = deal.image.present?? \"http://welovemerthyr.dev#{deal.image_url(:thumb)}\" : ''\n elsif Rails.env.production?\n image_url = deal.image.present?? deal.image_url(:thumb) : ''\n end\n\n user.feed!(\n message: \"Voucher from WeLoveMerthyr\",\n picture: image_url,\n link: public_voucher_url(deal),\n name: deal.title,\n description: deal.description.gsub('<p>', '').gsub('</p>', '')\n )\n\n redirect_to request.env['HTTP_REFERER'].split('?').first << \"?step=2\"\n end", "def redirect_to_url(callback_url)\n client_details = \"client_id=#{self.client_id}\"\n return callback_url + \"?#{client_details}\"\n end", "def facebook_subs_callback\n if request.get? and params['hub.mode'] == 'subscribe'\n render :text => params['hub.challenge']\n elsif request.post?\n # What happens when more than one record has changed?\n # {\"entry\"=>[{\"changed_fields\"=>[\"picture\"], \n # \"time\"=>1302394571, \n # \"id\"=>\"500528646\", \n # \"uid\"=>\"500528646\"}], \n # \"object\"=>\"user\"}\n if params['object'] and params['object'] == 'user'\n params['entry'].each do |person_info|\n if !person_info['uid'].blank? \n if person_info.include?('name') or person_info.include?('picture') or person_info.include?('email')\n OauthToken.find_by_remote_user_id_and_site_token(person_info['uid'], 'facebook').update_user_info\n elsif person_info.include?('checkins')\n # They checked in somewhere\n end\n end\n end\n end\n render :text => 'subscription callback processed'\n end\n end", "def facebook\n oauth_info = OauthToken.get_oauth_info('facebook')\n session[:redirect_after_oauth] = params[:redirect_to] ? params[:redirect_to] : nil\n redirect_to \"https://graph.facebook.com/oauth/authorize?client_id=#{oauth_info['consumer_key']}\"+\n \"&redirect_uri=#{oauth_info['callback']}\"+\n \"&scope=read_stream,publish_stream,publish_actions,offline_access,user_likes,user_status,\"+\n \"user_birthday,user_relationships,user_relationship_details,\"+\n \"email,user_checkins,sms,user_online_presence\"+\n \"&display=touch\"\n end", "def callback\n auth = build_auth\n respond_to do |format|\n if logged_in?\n add_identity_to_current_user(auth)\n welcome_user(current_user)\n format.html { redirect_logged_in_user }\n format.json { render_jsend_success(:logged_in) }\n else\n user = find_or_create_user_from_auth(auth)\n if user\n user.remember_me! if session.delete(:remember_me)\n if user.connected?\n setup_new_user(user, auth)\n format.html { redirect_to_signup_flow_entry_point }\n format.json { render_jsend_success(:connected, new_profile_data(user, auth)) }\n elsif user.registered?\n setup_existing_user(user)\n format.html { redirect_after_onboarding_check(user, request.env['omniauth.origin']) }\n format.json { render_jsend_success(:registered) }\n else\n notify_visitor_user_creation_failed(user)\n format.html { redirect_after_auth(request.env['omniauth.origin'] || login_path) }\n format.json { render_jsend(error: :user_creation) }\n end\n else\n format.html { redirect_to(login_path) }\n format.json { render_jsend(error: :no_user) }\n end\n end\n end\n end", "def facebook\n callback\n end", "def callback \n begin\n user_id = Rails.cache.read(\"user_id\")\n @user = User.find(user_id)\n oauth_token_secret = Rails.cache.read(\"oauth_token_secret\")\n\n flickr = FlickRaw::Flickr.new\n oauth_token = params[:oauth_token]\n oauth_verifier = params[:oauth_verifier]\n\n raw_token = flickr.get_access_token(params[:oauth_token], oauth_token_secret, params[:oauth_verifier])\n oauth_token = raw_token[\"oauth_token\"]\n oauth_token_secret = raw_token[\"oauth_token_secret\"]\n\n flickr.access_token = oauth_token\n flickr.access_secret =oauth_token_secret\n\n if User.find(user_id).flickr_account\n User.find(user_id).flickr_account.delete\n end\n\n flickr_account = FlickrAccount.create(consumer_key: oauth_token , secret_key: oauth_token_secret)\n User.find(user_id).flickr_account = flickr_account\n\n unless flickr_account.new_record?\n flash[:notice] = 'Flickr account created $green'\n l = Log.new\n l.loggingtype =0\n l.user_id_1 = @user.id\n name_1 = if @user.name.nil? then @user.email.split('@')[0] else @user.name end\n l.message = \"#{name_1} is now connected to flickr account\"\n l.save\n else \n flash[:notice] = 'Flickr account couldn\\'t be created $red'\n end \n\n redirect_to controller: 'users', action: 'connect_social_accounts'\n \n rescue\n flash[:notice] = 'Couldn\\'t connect to flickr $red'\n redirect_to controller: 'users', action: 'connect_social_accounts'\n end\n end", "def callback\n if params[:error] == \"access_denied\"\n return redirect_to payment_url(subdomain: @account.subdomain),\n alert: %(Der Vorgang wurde abgebrochen. Fehlermeldung von Stripe: \"#{params[:error_description]}\")\n end\n @account.update!(oauth_service.fetch_access_token(params[:code]))\n Accountpaymentmethod.joins(:paymentmethod).find_or_create_by!(paymentmethod: Paymentmethod.find_by(key: \"cc\"))\n redirect_to payment_url(subdomain: @account.subdomain), notice: \"Stripe wurde erfolgreich integriert!\"\n end", "def authorize_application\n # init auth state and oauth url..enter wormhole\n oauth = Koala::Facebook::OAuth.new(APP_ID, APP_SECRET, GIFT_AUTH_CALLBACK)\n encoded_auth_state = create_auth_state\n oauth_url = create_oauth_url(oauth.oauth_callback_url, encoded_auth_state)\n redirect_to(:action => \"exit_portal\", :url => oauth_url) and return\n end", "def callback\n auth = request.env['omniauth.auth']\n\n session[:facebook_token] = auth[:credentials][:token]\n\n refresh_facebook\n\n redirect_to '/#services'\n end", "def redirect_callbacks\n setup_env_params\n\n session['dta.omniauth.auth'] = request.env['omniauth.auth']\n .except('extra')\n session['dta.omniauth.params'] = omniauth_params\n tweak_session_attrs\n has_params = session['dta.omniauth.params']\n\n redirect_to action: has_params ? 'omniauth_success' : 'omniauth_failure'\n end", "def callback_url\n if @authorization_code_from_signed_request_in_cookie\n ''\n else\n # Fixes regression in omniauth-oauth2 v1.4.0 by https://github.com/intridea/omniauth-oauth2/commit/85fdbe117c2a4400d001a6368cc359d88f40abc7\n options[:callback_url] || (full_host + script_name + callback_path)\n end\n end", "def oauth2callback\n @g_cal_api.oauth2callback\n end", "def pre_authorize_cb=(_arg0); end", "def dialogue_url\n return \"https://www.facebook.com/dialog/oauth?client_id=\"+@app_id+\"&redirect_uri=\"+@canvas_url+\"&scope=\"+@permission\n end", "def google_callback\n tokens = get_tokens(params[\"code\"])\n\n @current_user.access_token = tokens[\"access_token\"]\n @current_user.save!\n \n flash[:notice] = \"Authorized\"\n \n redirect_to :root\n end", "def new\n next_url = AppConfig.facebook_app_url + \"facebook/callback\"\n #next_url += (\"?request_ids=\" + params[:request_ids]) unless params[:request_ids].nil?\n @auth_url = Authentication.auth.client.web_server.authorize_url(\n :redirect_uri => next_url, :scope => AppConfig.facebook_perms\n )\n end", "def instagramadd\n redirect_to Instagram.authorize_url(:redirect_uri => \"http://localhost:3000/users/oauth/callback\")\n end", "def authorize\n setup_client(@user.id)\n @user.integrations.create!(name: 'google_calendar', status: 'pending')\n redirect_to authorizer.get_authorization_url base_url: 'http://localhost:8080'\n # redirect_to oauth_callback_url(@companies.first)\n end", "def facebook_authorization_callback\n begin\n #Fetch the 'code' query parameter from the callback\n code = params[:code]\n\n #Get token object, passing in the authorization code from the previous step\n logger.fatal \"Redirect to facebook for getting token: #{code} , #{Settings.facebook.REDIRECT_URI}\"\n token = facebook_client.auth_code.get_token(code, {:redirect_uri => Settings.facebook.REDIRECT_URI, :parse => :facebook})\n\n api_endpoint = \"#{Settings.api_endpoints.Login}\"\n response = Typhoeus.post(api_endpoint, body: {\n userId: current_user_id,\n loginType: 'FACEBOOK',\n accessToken: token.token\n })\n\n if response.success? && !api_contains_error(\"Login\", response)\n add_access_token_api_response = JSON.parse(response.response_body)\n add_access_token_api_response = add_access_token_api_response[\"LoginResult\"]\n if add_access_token_api_response[\"isUserLogedIn\"] == true\n session[:facebook_token] = token.token\n end\n end\n\n redirect_to user_path(current_user_id)\n rescue OAuth2::Error => e\n logger.fatal e.message\n logger.fatal e.backtrace.inspect\n redirect_to Settings.facebook_auth_url\n end\n end", "def callback_url\n options[:redirect_uri] || (full_host + script_name + callback_path)\n end", "def callback_url\n options[:redirect_uri] || (full_host + script_name + callback_path)\n end", "def callback\n @oauth = Koala::Facebook::OAuth.new(APPID, SECRET, welcome_callback_url)\n session[:access_token] = @oauth.get_access_token(params[:code]) if params[:code]\n if session[:access_token]\n flash[:notice] = \"Logged in successfully\"\n else\n flash[:notice] = \"Error logging in\"\n end\n redirect_to welcome_index_path\n end", "def callback\n connector_response_url(callback_options)\n end", "def locallink\n redirect_to \"http://localhost:3000/auth/facebook/callback?code=#{params[:code]}\"\n end", "def redirect\n callback_url = url_for :action => :callback\n sc_request_token = $sc_consumer.get_request_token(:oauth_callback => callback_url)\n session[:sc_request_token] = sc_request_token.token\n session[:sc_request_token_secret] = sc_request_token.secret\n @authorize_url = \"http://soundcloud.com/oauth/authorize?oauth_token=#{sc_request_token.token}\"\n\n redirect_to @authorize_url\n end", "def callback\n\t\t\n\t\t@dbsession = DropboxSession.deserialize(@@dropbox_session)\n\t\[email protected]_access_token #we've been authorized, so now request an access_token\n\t\t@dropbox_session = @dbsession.serialize\n\t\tdropbox = Linkdropbox.new\n\t\tdropbox.dropbox_token = @dropbox_session\n\t dropbox.save\n\t\t#read_prices(DropboxSession.deserialize(@dropbox_session))\n\t\tflash[:success] = \"You have successfully authorized with dropbox.\"\n\n\t\tredirect_to services_show_path\n\n\t#rescue \n\t\t#session[:dropbox_session] = nil\n\t #flash[:success] = \"Failed to authorize\"\n\t\t#redirect_to services_show_path\n\n\t\t#redirect_to session[:return_to]\t\n\tend", "def oauth_url_authorize\n return \"#{$SETTINGS[:oauth_server_url_authorize]}?response_type=code&client_id=#{$SETTINGS[:oauth_client_id]}&scope=ALL&redirect_uri=#{oauth_redirect_uri}\" \n end", "def confirm\n # Oauth is a two step process\n # second step is to get user back from GoToMeeting and exchange code for access key\n @response = exchange_response_code_for_access_key(params[:code])\n respond_to do |format|\n if @response['access_token']\n cookies[:access_token] = @response['access_token']\n format.html\n else\n @url = url_for(:controller => \"connect\", :action => \"confirm\", :only_path => false)\n @connect_url = generate_login_url({\"redirect_uri\" => @url})\n format.html { render :action => 'new', :notice => \"We could not connect\" }\n end\n end\n \n end", "def facebook_authenticate_url\n facebook_client.web_server.authorize_url(:redirect_uri => Settings.authentication.facebook.callback_url,\n :scope => Settings.authentication.facebook.scope)\n end", "def get_auth_url(use_callback_flow=true)\n if use_callback_flow\n service_name = service_name_for_user(DATASOURCE_NAME, @user)\n @client.authorization.state = CALLBACK_STATE_DATA_PLACEHOLDER.sub('user', @user.username)\n .sub('service', service_name)\n else\n @client.authorization.redirect_uri = REDIRECT_URI\n end\n @client.authorization.authorization_uri.to_s\n end", "def oauth\n redirect_to \"#{root_path}auth/#{Setting['omniauth']['provider']}\"\n end", "def callback\n @bluebutton_oauth_service = BluebuttonOauthService.new(session[:bb_acc_token],session[:bb_state])\n @bluebutton_oauth_service.set_access_token(params[:code])\n @bluebutton_oauth_service.refresh_access_token\n redirect_to bluebutton_main_path, :notice => \"you have been successfully authorized!\"\n # Save access token to session. \n session[:bb_acc_token] = @bluebutton_oauth_service.bb_acc_token\n end", "def dropbox_callback\n start_session(RegisterUser.call(get_web_auth.finish(params)))\n connect_client\n\t\tredirect_to user_dash_path(current_user)\n end", "def temp_auth\n request_token = get_consumer.get_request_token(:oauth_callback => request.url.chomp(\"temp_auth\").concat(\"callback\"))\n # evernote returns a temp token and secret. save these somewhere for later\n flash[:request_token] = request_token.token\n flash[:request_secret] = request_token.secret\n # evernote also returned a url that app should direct to\n # in order for user to sign in and authorize the app\n redirect_to request_token.authorize_url\n end", "def sso_integration_callback_url\n # Usually http://example.com/auth/:system_name/callback\n url = callback_url(query: {})\n\n case kind\n when 'auth0'\n # e.g. http://example.com/auth/invitations/auth0/auth0_123abc/callback\n invitation_signup = client.callback_url(\"#{base_url}/invitations\")\n\n [url, invitation_signup].join(', ')\n else\n url\n end\n end", "def oauth_callback_url\n url_for :action => \"list\"\n end", "def facebook_callback\n if params[:error_reason]\n redirect_to :controller => :home, :action => :index\n return\n end\n oauth_info = OauthToken.get_oauth_info('facebook')\n uri = URI.parse(\"https://graph.facebook.com/oauth/access_token\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n new_params = {:client_id => oauth_info['consumer_key'],\n :client_secret => oauth_info['consumer_secret'],\n :redirect_uri => oauth_info['callback'],\n :code => params[:code]}\n \n request = Net::HTTP::Post.new(uri.request_uri)\n request.set_form_data(new_params)\n response = http.request(request)\n \n fields = response.body.split('=')\n access_token = fields[1]\n\n oauth_token = OauthToken.find_by_token_and_site_token(access_token,'facebook')\n \n if current_user and oauth_token.present? and oauth_token.user and current_user != oauth_token.user\n redirect_to :controller => :oauth, :action => :duplicate_users, :id => oauth_token.id\n return\n end\n\n # Create the Oauth token\n if oauth_token\n oauth_token.update_attributes({:site_token => 'facebook',\n :site_name => \"Facebook\",\n :token => access_token}) \n oauth_token.get_user_info\n else\n oauth_token = OauthToken.create({:user_id => (current_user ? current_user.id : nil),\n :site_token => 'facebook',\n :site_name => \"Facebook\",\n :token => access_token}) \n oauth_token.get_user_info\n \n TrackedAction.add(:connected_to_third_party_site, oauth_token.user)\n TrackedAction.add(:connected_to_facebook, oauth_token.user)\n oauth_token.user.give_level_up_credits(10)\n end\n\n OauthToken.delay.autofollow_friends(oauth_token.id)\n\n flash[:authenticated_facebook] = 1\n if !session[:redirect_after_oauth].blank?\n redirect_to session[:redirect_after_oauth]\n session[:redirect_after_oauth] = nil\n else\n redirect_to :controller => :home, :action => :index\n end\n end", "def callback\n sc_request_token = OAuth::RequestToken.new($sc_consumer, session[:sc_request_token], session[:sc_request_token_secret])\n sc_access_token = sc_request_token.get_access_token(:oauth_verifier => params[:oauth_verifier]) \n sc = Soundcloud.register({:access_token => sc_access_token})\n me = sc.User.find_me\n\n # check if user with me.id exists, update username & oauth stuff otherwise create a new user\n user = User.find_by_sc_user_id(me.id)\n if user.nil?\n user = User.create({:sc_user_id => me.id, :sc_username => me.username,\n :access_token => sc_access_token.token, :access_token_secret => sc_access_token.secret })\n else\n user.sc_username = me.username\n user.access_token = sc_access_token.token\n user.access_token_secret = sc_access_token.secret\n user.save!\n end\n \n session[:user_id] = user.id\n redirect_to :controller => :home\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def authorize\n\n # redirect to kpass for authorization (and authentication if they're not\n # signed in.)\n # \n \n\n authorize_url = \"#{ENV['KPASS_ENDPOINT']}/oauth/authorize?app_id=#{ENV['KPASS_APP_ID']}\"\n redirect_to authorize_url\n end", "def confirm\n connector = StripeConnect.new( current_user )\n if params[:code]\n # If we got a 'code' parameter. Then the\n # connection was completed by the user.\n connector.verify!( params[:code] )\n\n elsif params[:error]\n # If we have an 'error' parameter, it's because the\n # user denied the connection request. Other errors\n # are handled at #connect_url generation time.\n flash[:error] = \"Authorization request denied.\"\n end\n\n redirect_to user_path( current_user )\n end", "def authorize_url(callback_url)\n request_token.authorize_url+'&oauth_callback='+CGI.escape(callback_url)\n end", "def url_to_social_login( provider_key, on_success = nil )\n provider = Aerogel::Auth.providers[provider_key] || {}\n origin = on_success || params['on_success']\n query_string = origin ? \"?origin=#{origin}\" : ''\n \"/auth/#{provider_key}#{query_string}\"\nend", "def fb_auth\n session[:sign_up_reason] = nil\n\n if params[:return_to]\n set_after_sign_in_location(params[:return_to])\n elsif params[:spree_user_return_to]\n set_after_sign_in_location(params[:spree_user_return_to])\n elsif is_user_came_from_current_app\n set_after_sign_in_location(request.referrer)\n end\n\n if params[:redeem_via_fb_state]\n session[:redeem_via_fb_state] = params[:redeem_via_fb_state]\n end\n\n if params[:new_modal_fb_state]\n session[:new_modal_fb_state] = params[:new_modal_fb_state]\n end\n\n if params[:show_promocode_modal]\n session[:show_promocode_modal] = params[:show_promocode_modal]\n # reset current modal popup\n set_after_sign_in_location(root_path)\n end\n\n session[:auto_apply] = params[:auto_apply] if params.key?(:auto_apply)\n session[:auto_apply_promo] = params[:auto_apply_promo] if params.key?(:auto_apply_promo)\n\n # Capture PLEASE REMIND ME ABOUT MY SALE events to push onto customer.io later.\n session[:email_reminder_promo] = params[:email_reminder_promo] if params.key?(:email_reminder_promo)\n\n\n redirect_to spree.spree_user_omniauth_authorize_url(provider: :facebook, scope: 'email,public_profile,user_friends')\n end", "def authorize_url\n @oauth_client.auth_code.authorize_url(:redirect_uri => @redirect_uri, :scope => site_url)\n end", "def callback_phase\n options.client_options[:access_token_path] = \"/oauth/qzoneoauth_access_token?oauth_vericode=#{request['oauth_vericode'] }\" if request['oauth_vericode']\n super\n end", "def sso_callback_url_for(user)\n\n sso_token = encrypt_sso_token_for_user(user)\n\n url = sso_callback_url.dup\n if sso_callback_url =~ /\\?/\n url << '&'\n else\n url << '?'\n end\n url << \"sso_token=#{sso_token}\"\n\n url\n\n end", "def authentication_succeeded(message = 'You have logged in successfully.', destination = '/followees')\n flash[:notice] = message\n redirect_back_or_default destination\n end", "def ios_client_callback_url(user)\n \"lolgramz://auth_callback?instagram_token=#{user.instagram_token}&api_token=#{user.api_token}\"\n end", "def authorize\n\t\t@@extension_url = params[:redirect_uri]\n\t\tredirect_to('/auth/google_oauth2')\n\tend", "def get_auth_link(state)\n data = {\n scope: \"notify\",\n response_type: \"code\",\n client_id: self.client_id,\n redirect_uri: self.redirect_uri,\n state: state\n };\n\n \"#{self.bot_origin}/oauth/authorize?#{URI.encode_www_form(data)}\"\n end", "def facebook\n handle_redirect('devise.facebook_data', 'Facebook')\n end", "def oauth\n connector = StripeOauth.new(current_customer)\n\n logger.debug(connector)\n\n # logger.debug(\"===> #{stripe_confirm_url}\")\n\n url, error = connector.oauth_url(redirect_uri: stripe_confirm_url)\n\n if url.nil?\n flash[:alert] = error\n redirect_to customer_path(current_customer)\n else\n redirect_to url\n end\n end", "def facebook\n handle_oauth\n end", "def create_oauth_url(cb_url, encoded_auth_state)\n oauth_url = \"https://www.facebook.com/dialog/oauth/?client_id=\" +\n \"#{APP_ID}&redirect_uri=#{cb_url}&state=#{encoded_auth_state}\"\n end", "def callback\n\t\t#get the access token from facebook with your code\n\t\tsession['access_token'] = session['oauth'].get_access_token(params[:code])\n\t\tredirect_to '/facebooks/menu'\n\tend", "def auth_endpoint_callback\n Rails.logger.debug \"------ Entering auth_endpoint_callback ------\"\n\n @organization = Organization.find(params[:org])\n\n session[\"access_token\"] = @organization.authorization_server.\n request_access_token(request, callback_url)\n redirect_to organization_records_path(@organization)\n end", "def index\n res = create_request2(root_url + '/login/auth', 'tequila.epfl.ch')\n redirect_to ('https://tequila.epfl.ch/cgi-bin/tequila/requestauth?request' + res)\n end", "def authorize_url(params = {})\n super\n .tap { |result| __ext_debug(\"--> #{result.inspect}\") }\n end" ]
[ "0.6898244", "0.68648124", "0.64785415", "0.6430791", "0.64251614", "0.639312", "0.6389942", "0.6347167", "0.6331869", "0.63304037", "0.6330178", "0.63040626", "0.62337357", "0.62314725", "0.62038344", "0.619302", "0.61878765", "0.61862", "0.6183993", "0.6168068", "0.61648303", "0.61609864", "0.61533564", "0.61515725", "0.61483604", "0.613757", "0.6131683", "0.6128991", "0.6126425", "0.6112104", "0.6111756", "0.6087709", "0.60843396", "0.607701", "0.60680413", "0.60553604", "0.60359246", "0.6018572", "0.60182536", "0.601412", "0.6006979", "0.6001841", "0.5993107", "0.59704876", "0.5967728", "0.5965723", "0.59476644", "0.59427667", "0.59427667", "0.5940033", "0.5933635", "0.5914295", "0.5899018", "0.58909124", "0.58874744", "0.5886697", "0.5883656", "0.5879082", "0.587618", "0.5861878", "0.58553964", "0.58358", "0.5833973", "0.58270466", "0.58226496", "0.58203393", "0.58183813", "0.58183813", "0.58183813", "0.58183813", "0.58183813", "0.58183813", "0.58183813", "0.58183813", "0.58183813", "0.58183813", "0.58183813", "0.58183813", "0.58183813", "0.58183813", "0.58183813", "0.5818367", "0.58011514", "0.57945174", "0.57851344", "0.57758474", "0.5758081", "0.57573986", "0.57536757", "0.57466865", "0.57416266", "0.57391834", "0.5734646", "0.573359", "0.5732877", "0.5732132", "0.57276917", "0.57191926", "0.5706597", "0.5696556", "0.56958234" ]
0.0
-1
Used as Callback URL when users have successfully authorized their facbeook account. Used as Callback URL when users have successfully authorized their facbeook account
def set_facebook_uid_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: AuthenticationServiceApi.set_facebook_uid ...' end # resource path local_var_path = '/authentication/facebook' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(opts[:'body']) # return_type return_type = opts[:return_type] || 'File' # auth_names auth_names = opts[:auth_names] || [] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: AuthenticationServiceApi#set_facebook_uid\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def callback\n rpx_auth\n after_auth(params[:on_complete_url])\n end", "def fbauthorize\n redirect_to fb_auth_login_url.to_s\n end", "def callback_url\n options.authorize_params.callback_url or super\n end", "def callback\n self.oaw_callback(params[:oauth_verifier], params[:oauth_token])\n end", "def callback\n # This stores all the user information that came from Auth0\n # and the IdP\n userinfo = request.env['omniauth.auth']\n\n begin\n result = SessionService.process!(userinfo, session)\n\n if result.new_user?\n redirect_to welcome_path\n else\n # Redirect to the URL you want after successful auth\n redirect_to services_path,\n flash: {\n success: I18n.t(:welcome_html, scope: [:auth, :existing_user])\n }\n end\n rescue SignupNotAllowedError\n # no new user or existing user, so they weren't allowed to sign up\n redirect_to signup_not_allowed_path\n end\n end", "def authorize_url\n client.web_server.authorize_url( :redirect_uri => callback_url )\n end", "def callback_url\n auth_endpoint_callback_url(org: @organization.id)\n end", "def authCallback\n begin\n auth_code = params.fetch(\"code\")\n rescue KeyError\n raise \"error: no code param provided\"\n end\n\n from_sso = params.fetch(\"from_sso\", \"0\") == \"1\" \n origin = params[\"origin\"] if params.key?(\"origin\")\n\n redirect_uri_sso = URI(api_args[\"redirect_uri\"])\n redirect_uri_sso.query = URI.encode_www_form(params.select{|k, v| [\"from_sso\", \"origin\"].include? k})\n\n redirect_uri = from_sso ? redirect_uri_sso.to_s : api_args[\"redirect_uri\"]\n\n password_reset = sign_in(auth_code, redirect_uri)\n\n if from_sso\n # we got here from sso, redirect to origin(the page where user entered \n # the site)\n redirect_to origin\n elsif password_reset\n # we got here from email password reset, redirect to change password\n redirect_to \"/#{app.name}/profile_change_password\"\n else\n # since we are in an iframe, reload the parent, not the current window,\n # otherwise we will get nesting.\n render :text => \"<script>window.parent.location.reload()</script>\"\n end \n end", "def rc_facebook_authorize_redirect\n unless rc_facebook_in_canvas?\n redirect_to @rc_facebook_authorize_url\n else\n rc_facebook_js_redirect(@rc_facebook_authorize_url,\n rc_facebook_authorize_body)\n end\n end", "def oauth_authorize\n redirect_to facebook_client.authorize(oauth_callback_url)\n end", "def authorize_callback\n @request_token = OAuth::RequestToken.new(@oauth,\n session[:request_token], \n session[:request_token_secret])\n\n @access_token = @request_token.get_access_token(:oauth_verifier => params[:oauth_verifier])\n session[:access_token] = @access_token.token\n session[:secret_token] = @access_token.secret\n session[:user_id] = @access_token.params[\"user_id\"] rescue \"\"\n session[:screen_name] = @access_token.params[\"screen_name\"] rescue \"\"\n session[:authorized] = true\n @log.info \"authorized, user [#{session[:screen_name]}]\"\n \n if session[:redirect_to]\n url = session[:redirect_to]\n session[:redirect_to] = nil \n redirect url\n else\n redirect '/'\n end\n\n end", "def callback\n access_token = client.web_server.get_access_token(params[:code], :redirect_uri => oauth_callback_url)\n \n current_user.update_attribute(:oauth2_token, access_token.token)\n flash[:notice] = \"Authorized successfully!\"\n \n redirect_to root_url\n end", "def callback\n return unless passes_whitelist?\n session[:user_id] = User.from_omniauth(@auth_hash, current_tenant.tenant_id, unmangle_orcid).id\n redirect_to dashboard_path\n end", "def redirect_url\n\t\tcallback_url\n\tend", "def callback\n\n client = Signet::OAuth2::Client.new(client_options)\n client.code = params[:code]\n\n response = client.fetch_access_token!\n\n session[:authorization] = response\n redirect_to '/leagues/calendar/events/[email protected]'\n end", "def auth_callback\n current_user\n omniauth_origin = session[:omniauth_origin]\n session.delete(:omniauth_origin)\n redirect_to omniauth_origin || '/'\n end", "def callback\n\n\n # Access the authentication hash for omniauth\n data = request.env['omniauth.auth']\n\n # Temporary for testing!\n render json: data.to_json\n\n\n # Access the authentication hash for omniauth\n # data = request.env['omniauth.auth']\n\n # microsoft_email_address = data.dig(:extra, :raw_info, :mail) || data.dig(:extra, :raw_info, :userPrincipalName)\n\n # if user_account = UserAccount.find_by(email: microsoft_email_address)\n # session[:user_account_id] = user_account.id\n # if session[:previously_requested_page]\n # last_page = session[:previously_requested_page]\n # session.delete(:previously_requested_page)\n # redirect_to last_page\n # else\n # redirect_to root_path\n # end\n # else\n # redirect_to new_session_path, notice: \"An account could not be found for #{microsoft_email_address}.\"\n # end\n end", "def callback\n # evernote returns a verifier if user authorized the app\n oauth_verifier = params[:oauth_verifier]\n if oauth_verifier\n consumer = get_consumer\n request_token = OAuth::RequestToken.new(consumer, flash[:request_token], flash[:request_secret])\n # contains the real token, user id, shard, and token expiration date\n access_token = request_token.get_access_token(:oauth_verifier => oauth_verifier)\n account = EvernoteAccount.where(\"user_id = \" + access_token.params[:edam_userId]).take\n if !account\n # save this stuff\n account = EvernoteAccount.create(\n user_id: access_token.params[:edam_userId],\n token: access_token.token,\n shard: access_token.params[:edam_shard],\n token_expiration: access_token.params[:edam_expires]\n )\n end\n session[:evernote_account_id] = account.id\n # directs to recipes page (recipe_controller.rb)\n redirect_to action: \"index\", controller: \"recipes\"\n else\n redirect_to action: \"index\"\n end\n end", "def pre_authorize_cb; end", "def callback2\n oauth_token = FitbitOauthToken.where(:token=>params[:state]).last\n verifier = params[:code]\n if oauth_token\n return_url = request.original_url\n #xd = YAML::load oauth_token.extra_data\n # if return_url already has a ? in it, then this needs to add an & and not a ? \n #question_mark_or_ampersand = xd[:return_url].to_s =~ /\\?/ ? '&' : '?'\n question_mark_or_ampersand = return_url.to_s =~ /\\?/ ? '&' : '?'\n #There's a code and a state that need to go with:\n url = \"\"\n url += \"#{return_url.gsub(\"callback2\",\"post_authorize\")}\"\n if !verifier.nil? && !verifier.empty? \n #Only add the token and verifier if we have both\n #This way, the recieving application can respond if they're missing\n url += \"#{question_mark_or_ampersand}\"\n url += \"oauth_token=#{params[:state]}\"\n url += \"&oauth_verifier=#{params[:code]}\"\n end\n redirect_to url\n else\n render :text=>\"error processing oauth token\", :layout=>false\n end\n end", "def callback_phase\n # Prep the urls using the account ID.\n # TODO: Could we use the :setup option and a Proc\n # to handle this rather than call here? \n set_omniauth_zendesk_urls\n\n # Continue the request as usual.\n super\n end", "def callback\n # Authentication redirects here\n code = params[:code]\n\n # Used in the template\n @name = auth_hash.info.name\n @email = auth_hash.info.email\n\n # Request an access token\n result = acquire_access_token(code, ENV['REPLY_URL'])\n\n # Associate token/user values to the session\n session[:access_token] = result.access_token\n session[:name] = @name\n session[:email] = @email\n\n # Debug logging\n logger.info \"Code: #{code}\"\n logger.info \"Name: #{@name}\"\n logger.info \"Email: #{@email}\"\n logger.info \"[callback] - Access token: #{session[:access_token]}\"\n end", "def facebook_request\n redirect_to facebook_authenticate_url\n end", "def success_url\n redirect_url([@token && @token.success_url, TokenAction.success_url])\n end", "def auth_url\n MiniFB.oauth_url(@app_id, @redirect_to,\n :scope => 'user_about_me') # See MiniFB.scopes\n end", "def oauth_callback_url\n end", "def redirect_url(callback_url)\n signin_url(callback_url)\n end", "def callback_facebook\n token = env[\"omniauth.auth\"][:credentials][:token]\n first_name = env[\"omniauth.auth\"][:info][:first_name]\n email = env[\"omniauth.auth\"][:info][:email]\n\n\n # Create new Subscriber record.\n deal = Deal.find(request.env['HTTP_REFERER'].split('?').first.split('/').last)\n @subscriber = Subscriber.new(first_name: first_name, email: email, deal_id: deal.id)\n @subscriber.save\n\n # Post deal's info to user timeline.\n user = FbGraph::User.me(token)\n\n if Rails.env.development?\n image_url = deal.image.present?? \"http://welovemerthyr.dev#{deal.image_url(:thumb)}\" : ''\n elsif Rails.env.production?\n image_url = deal.image.present?? deal.image_url(:thumb) : ''\n end\n\n user.feed!(\n message: \"Voucher from WeLoveMerthyr\",\n picture: image_url,\n link: public_voucher_url(deal),\n name: deal.title,\n description: deal.description.gsub('<p>', '').gsub('</p>', '')\n )\n\n redirect_to request.env['HTTP_REFERER'].split('?').first << \"?step=2\"\n end", "def redirect_to_url(callback_url)\n client_details = \"client_id=#{self.client_id}\"\n return callback_url + \"?#{client_details}\"\n end", "def facebook_subs_callback\n if request.get? and params['hub.mode'] == 'subscribe'\n render :text => params['hub.challenge']\n elsif request.post?\n # What happens when more than one record has changed?\n # {\"entry\"=>[{\"changed_fields\"=>[\"picture\"], \n # \"time\"=>1302394571, \n # \"id\"=>\"500528646\", \n # \"uid\"=>\"500528646\"}], \n # \"object\"=>\"user\"}\n if params['object'] and params['object'] == 'user'\n params['entry'].each do |person_info|\n if !person_info['uid'].blank? \n if person_info.include?('name') or person_info.include?('picture') or person_info.include?('email')\n OauthToken.find_by_remote_user_id_and_site_token(person_info['uid'], 'facebook').update_user_info\n elsif person_info.include?('checkins')\n # They checked in somewhere\n end\n end\n end\n end\n render :text => 'subscription callback processed'\n end\n end", "def facebook\n oauth_info = OauthToken.get_oauth_info('facebook')\n session[:redirect_after_oauth] = params[:redirect_to] ? params[:redirect_to] : nil\n redirect_to \"https://graph.facebook.com/oauth/authorize?client_id=#{oauth_info['consumer_key']}\"+\n \"&redirect_uri=#{oauth_info['callback']}\"+\n \"&scope=read_stream,publish_stream,publish_actions,offline_access,user_likes,user_status,\"+\n \"user_birthday,user_relationships,user_relationship_details,\"+\n \"email,user_checkins,sms,user_online_presence\"+\n \"&display=touch\"\n end", "def callback\n auth = build_auth\n respond_to do |format|\n if logged_in?\n add_identity_to_current_user(auth)\n welcome_user(current_user)\n format.html { redirect_logged_in_user }\n format.json { render_jsend_success(:logged_in) }\n else\n user = find_or_create_user_from_auth(auth)\n if user\n user.remember_me! if session.delete(:remember_me)\n if user.connected?\n setup_new_user(user, auth)\n format.html { redirect_to_signup_flow_entry_point }\n format.json { render_jsend_success(:connected, new_profile_data(user, auth)) }\n elsif user.registered?\n setup_existing_user(user)\n format.html { redirect_after_onboarding_check(user, request.env['omniauth.origin']) }\n format.json { render_jsend_success(:registered) }\n else\n notify_visitor_user_creation_failed(user)\n format.html { redirect_after_auth(request.env['omniauth.origin'] || login_path) }\n format.json { render_jsend(error: :user_creation) }\n end\n else\n format.html { redirect_to(login_path) }\n format.json { render_jsend(error: :no_user) }\n end\n end\n end\n end", "def facebook\n callback\n end", "def callback \n begin\n user_id = Rails.cache.read(\"user_id\")\n @user = User.find(user_id)\n oauth_token_secret = Rails.cache.read(\"oauth_token_secret\")\n\n flickr = FlickRaw::Flickr.new\n oauth_token = params[:oauth_token]\n oauth_verifier = params[:oauth_verifier]\n\n raw_token = flickr.get_access_token(params[:oauth_token], oauth_token_secret, params[:oauth_verifier])\n oauth_token = raw_token[\"oauth_token\"]\n oauth_token_secret = raw_token[\"oauth_token_secret\"]\n\n flickr.access_token = oauth_token\n flickr.access_secret =oauth_token_secret\n\n if User.find(user_id).flickr_account\n User.find(user_id).flickr_account.delete\n end\n\n flickr_account = FlickrAccount.create(consumer_key: oauth_token , secret_key: oauth_token_secret)\n User.find(user_id).flickr_account = flickr_account\n\n unless flickr_account.new_record?\n flash[:notice] = 'Flickr account created $green'\n l = Log.new\n l.loggingtype =0\n l.user_id_1 = @user.id\n name_1 = if @user.name.nil? then @user.email.split('@')[0] else @user.name end\n l.message = \"#{name_1} is now connected to flickr account\"\n l.save\n else \n flash[:notice] = 'Flickr account couldn\\'t be created $red'\n end \n\n redirect_to controller: 'users', action: 'connect_social_accounts'\n \n rescue\n flash[:notice] = 'Couldn\\'t connect to flickr $red'\n redirect_to controller: 'users', action: 'connect_social_accounts'\n end\n end", "def callback\n if params[:error] == \"access_denied\"\n return redirect_to payment_url(subdomain: @account.subdomain),\n alert: %(Der Vorgang wurde abgebrochen. Fehlermeldung von Stripe: \"#{params[:error_description]}\")\n end\n @account.update!(oauth_service.fetch_access_token(params[:code]))\n Accountpaymentmethod.joins(:paymentmethod).find_or_create_by!(paymentmethod: Paymentmethod.find_by(key: \"cc\"))\n redirect_to payment_url(subdomain: @account.subdomain), notice: \"Stripe wurde erfolgreich integriert!\"\n end", "def authorize_application\n # init auth state and oauth url..enter wormhole\n oauth = Koala::Facebook::OAuth.new(APP_ID, APP_SECRET, GIFT_AUTH_CALLBACK)\n encoded_auth_state = create_auth_state\n oauth_url = create_oauth_url(oauth.oauth_callback_url, encoded_auth_state)\n redirect_to(:action => \"exit_portal\", :url => oauth_url) and return\n end", "def callback\n auth = request.env['omniauth.auth']\n\n session[:facebook_token] = auth[:credentials][:token]\n\n refresh_facebook\n\n redirect_to '/#services'\n end", "def callback_url\n if @authorization_code_from_signed_request_in_cookie\n ''\n else\n # Fixes regression in omniauth-oauth2 v1.4.0 by https://github.com/intridea/omniauth-oauth2/commit/85fdbe117c2a4400d001a6368cc359d88f40abc7\n options[:callback_url] || (full_host + script_name + callback_path)\n end\n end", "def redirect_callbacks\n setup_env_params\n\n session['dta.omniauth.auth'] = request.env['omniauth.auth']\n .except('extra')\n session['dta.omniauth.params'] = omniauth_params\n tweak_session_attrs\n has_params = session['dta.omniauth.params']\n\n redirect_to action: has_params ? 'omniauth_success' : 'omniauth_failure'\n end", "def oauth2callback\n @g_cal_api.oauth2callback\n end", "def pre_authorize_cb=(_arg0); end", "def dialogue_url\n return \"https://www.facebook.com/dialog/oauth?client_id=\"+@app_id+\"&redirect_uri=\"+@canvas_url+\"&scope=\"+@permission\n end", "def google_callback\n tokens = get_tokens(params[\"code\"])\n\n @current_user.access_token = tokens[\"access_token\"]\n @current_user.save!\n \n flash[:notice] = \"Authorized\"\n \n redirect_to :root\n end", "def new\n next_url = AppConfig.facebook_app_url + \"facebook/callback\"\n #next_url += (\"?request_ids=\" + params[:request_ids]) unless params[:request_ids].nil?\n @auth_url = Authentication.auth.client.web_server.authorize_url(\n :redirect_uri => next_url, :scope => AppConfig.facebook_perms\n )\n end", "def authorize\n setup_client(@user.id)\n @user.integrations.create!(name: 'google_calendar', status: 'pending')\n redirect_to authorizer.get_authorization_url base_url: 'http://localhost:8080'\n # redirect_to oauth_callback_url(@companies.first)\n end", "def instagramadd\n redirect_to Instagram.authorize_url(:redirect_uri => \"http://localhost:3000/users/oauth/callback\")\n end", "def facebook_authorization_callback\n begin\n #Fetch the 'code' query parameter from the callback\n code = params[:code]\n\n #Get token object, passing in the authorization code from the previous step\n logger.fatal \"Redirect to facebook for getting token: #{code} , #{Settings.facebook.REDIRECT_URI}\"\n token = facebook_client.auth_code.get_token(code, {:redirect_uri => Settings.facebook.REDIRECT_URI, :parse => :facebook})\n\n api_endpoint = \"#{Settings.api_endpoints.Login}\"\n response = Typhoeus.post(api_endpoint, body: {\n userId: current_user_id,\n loginType: 'FACEBOOK',\n accessToken: token.token\n })\n\n if response.success? && !api_contains_error(\"Login\", response)\n add_access_token_api_response = JSON.parse(response.response_body)\n add_access_token_api_response = add_access_token_api_response[\"LoginResult\"]\n if add_access_token_api_response[\"isUserLogedIn\"] == true\n session[:facebook_token] = token.token\n end\n end\n\n redirect_to user_path(current_user_id)\n rescue OAuth2::Error => e\n logger.fatal e.message\n logger.fatal e.backtrace.inspect\n redirect_to Settings.facebook_auth_url\n end\n end", "def callback_url\n options[:redirect_uri] || (full_host + script_name + callback_path)\n end", "def callback_url\n options[:redirect_uri] || (full_host + script_name + callback_path)\n end", "def callback\n @oauth = Koala::Facebook::OAuth.new(APPID, SECRET, welcome_callback_url)\n session[:access_token] = @oauth.get_access_token(params[:code]) if params[:code]\n if session[:access_token]\n flash[:notice] = \"Logged in successfully\"\n else\n flash[:notice] = \"Error logging in\"\n end\n redirect_to welcome_index_path\n end", "def callback\n connector_response_url(callback_options)\n end", "def locallink\n redirect_to \"http://localhost:3000/auth/facebook/callback?code=#{params[:code]}\"\n end", "def redirect\n callback_url = url_for :action => :callback\n sc_request_token = $sc_consumer.get_request_token(:oauth_callback => callback_url)\n session[:sc_request_token] = sc_request_token.token\n session[:sc_request_token_secret] = sc_request_token.secret\n @authorize_url = \"http://soundcloud.com/oauth/authorize?oauth_token=#{sc_request_token.token}\"\n\n redirect_to @authorize_url\n end", "def callback\n\t\t\n\t\t@dbsession = DropboxSession.deserialize(@@dropbox_session)\n\t\[email protected]_access_token #we've been authorized, so now request an access_token\n\t\t@dropbox_session = @dbsession.serialize\n\t\tdropbox = Linkdropbox.new\n\t\tdropbox.dropbox_token = @dropbox_session\n\t dropbox.save\n\t\t#read_prices(DropboxSession.deserialize(@dropbox_session))\n\t\tflash[:success] = \"You have successfully authorized with dropbox.\"\n\n\t\tredirect_to services_show_path\n\n\t#rescue \n\t\t#session[:dropbox_session] = nil\n\t #flash[:success] = \"Failed to authorize\"\n\t\t#redirect_to services_show_path\n\n\t\t#redirect_to session[:return_to]\t\n\tend", "def oauth_url_authorize\n return \"#{$SETTINGS[:oauth_server_url_authorize]}?response_type=code&client_id=#{$SETTINGS[:oauth_client_id]}&scope=ALL&redirect_uri=#{oauth_redirect_uri}\" \n end", "def confirm\n # Oauth is a two step process\n # second step is to get user back from GoToMeeting and exchange code for access key\n @response = exchange_response_code_for_access_key(params[:code])\n respond_to do |format|\n if @response['access_token']\n cookies[:access_token] = @response['access_token']\n format.html\n else\n @url = url_for(:controller => \"connect\", :action => \"confirm\", :only_path => false)\n @connect_url = generate_login_url({\"redirect_uri\" => @url})\n format.html { render :action => 'new', :notice => \"We could not connect\" }\n end\n end\n \n end", "def facebook_authenticate_url\n facebook_client.web_server.authorize_url(:redirect_uri => Settings.authentication.facebook.callback_url,\n :scope => Settings.authentication.facebook.scope)\n end", "def get_auth_url(use_callback_flow=true)\n if use_callback_flow\n service_name = service_name_for_user(DATASOURCE_NAME, @user)\n @client.authorization.state = CALLBACK_STATE_DATA_PLACEHOLDER.sub('user', @user.username)\n .sub('service', service_name)\n else\n @client.authorization.redirect_uri = REDIRECT_URI\n end\n @client.authorization.authorization_uri.to_s\n end", "def oauth\n redirect_to \"#{root_path}auth/#{Setting['omniauth']['provider']}\"\n end", "def callback\n @bluebutton_oauth_service = BluebuttonOauthService.new(session[:bb_acc_token],session[:bb_state])\n @bluebutton_oauth_service.set_access_token(params[:code])\n @bluebutton_oauth_service.refresh_access_token\n redirect_to bluebutton_main_path, :notice => \"you have been successfully authorized!\"\n # Save access token to session. \n session[:bb_acc_token] = @bluebutton_oauth_service.bb_acc_token\n end", "def dropbox_callback\n start_session(RegisterUser.call(get_web_auth.finish(params)))\n connect_client\n\t\tredirect_to user_dash_path(current_user)\n end", "def temp_auth\n request_token = get_consumer.get_request_token(:oauth_callback => request.url.chomp(\"temp_auth\").concat(\"callback\"))\n # evernote returns a temp token and secret. save these somewhere for later\n flash[:request_token] = request_token.token\n flash[:request_secret] = request_token.secret\n # evernote also returned a url that app should direct to\n # in order for user to sign in and authorize the app\n redirect_to request_token.authorize_url\n end", "def sso_integration_callback_url\n # Usually http://example.com/auth/:system_name/callback\n url = callback_url(query: {})\n\n case kind\n when 'auth0'\n # e.g. http://example.com/auth/invitations/auth0/auth0_123abc/callback\n invitation_signup = client.callback_url(\"#{base_url}/invitations\")\n\n [url, invitation_signup].join(', ')\n else\n url\n end\n end", "def oauth_callback_url\n url_for :action => \"list\"\n end", "def facebook_callback\n if params[:error_reason]\n redirect_to :controller => :home, :action => :index\n return\n end\n oauth_info = OauthToken.get_oauth_info('facebook')\n uri = URI.parse(\"https://graph.facebook.com/oauth/access_token\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n new_params = {:client_id => oauth_info['consumer_key'],\n :client_secret => oauth_info['consumer_secret'],\n :redirect_uri => oauth_info['callback'],\n :code => params[:code]}\n \n request = Net::HTTP::Post.new(uri.request_uri)\n request.set_form_data(new_params)\n response = http.request(request)\n \n fields = response.body.split('=')\n access_token = fields[1]\n\n oauth_token = OauthToken.find_by_token_and_site_token(access_token,'facebook')\n \n if current_user and oauth_token.present? and oauth_token.user and current_user != oauth_token.user\n redirect_to :controller => :oauth, :action => :duplicate_users, :id => oauth_token.id\n return\n end\n\n # Create the Oauth token\n if oauth_token\n oauth_token.update_attributes({:site_token => 'facebook',\n :site_name => \"Facebook\",\n :token => access_token}) \n oauth_token.get_user_info\n else\n oauth_token = OauthToken.create({:user_id => (current_user ? current_user.id : nil),\n :site_token => 'facebook',\n :site_name => \"Facebook\",\n :token => access_token}) \n oauth_token.get_user_info\n \n TrackedAction.add(:connected_to_third_party_site, oauth_token.user)\n TrackedAction.add(:connected_to_facebook, oauth_token.user)\n oauth_token.user.give_level_up_credits(10)\n end\n\n OauthToken.delay.autofollow_friends(oauth_token.id)\n\n flash[:authenticated_facebook] = 1\n if !session[:redirect_after_oauth].blank?\n redirect_to session[:redirect_after_oauth]\n session[:redirect_after_oauth] = nil\n else\n redirect_to :controller => :home, :action => :index\n end\n end", "def callback\n sc_request_token = OAuth::RequestToken.new($sc_consumer, session[:sc_request_token], session[:sc_request_token_secret])\n sc_access_token = sc_request_token.get_access_token(:oauth_verifier => params[:oauth_verifier]) \n sc = Soundcloud.register({:access_token => sc_access_token})\n me = sc.User.find_me\n\n # check if user with me.id exists, update username & oauth stuff otherwise create a new user\n user = User.find_by_sc_user_id(me.id)\n if user.nil?\n user = User.create({:sc_user_id => me.id, :sc_username => me.username,\n :access_token => sc_access_token.token, :access_token_secret => sc_access_token.secret })\n else\n user.sc_username = me.username\n user.access_token = sc_access_token.token\n user.access_token_secret = sc_access_token.secret\n user.save!\n end\n \n session[:user_id] = user.id\n redirect_to :controller => :home\n end", "def authorize\n\n # redirect to kpass for authorization (and authentication if they're not\n # signed in.)\n # \n \n\n authorize_url = \"#{ENV['KPASS_ENDPOINT']}/oauth/authorize?app_id=#{ENV['KPASS_APP_ID']}\"\n redirect_to authorize_url\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def callback_url\n full_host + script_name + callback_path\n end", "def confirm\n connector = StripeConnect.new( current_user )\n if params[:code]\n # If we got a 'code' parameter. Then the\n # connection was completed by the user.\n connector.verify!( params[:code] )\n\n elsif params[:error]\n # If we have an 'error' parameter, it's because the\n # user denied the connection request. Other errors\n # are handled at #connect_url generation time.\n flash[:error] = \"Authorization request denied.\"\n end\n\n redirect_to user_path( current_user )\n end", "def authorize_url(callback_url)\n request_token.authorize_url+'&oauth_callback='+CGI.escape(callback_url)\n end", "def url_to_social_login( provider_key, on_success = nil )\n provider = Aerogel::Auth.providers[provider_key] || {}\n origin = on_success || params['on_success']\n query_string = origin ? \"?origin=#{origin}\" : ''\n \"/auth/#{provider_key}#{query_string}\"\nend", "def fb_auth\n session[:sign_up_reason] = nil\n\n if params[:return_to]\n set_after_sign_in_location(params[:return_to])\n elsif params[:spree_user_return_to]\n set_after_sign_in_location(params[:spree_user_return_to])\n elsif is_user_came_from_current_app\n set_after_sign_in_location(request.referrer)\n end\n\n if params[:redeem_via_fb_state]\n session[:redeem_via_fb_state] = params[:redeem_via_fb_state]\n end\n\n if params[:new_modal_fb_state]\n session[:new_modal_fb_state] = params[:new_modal_fb_state]\n end\n\n if params[:show_promocode_modal]\n session[:show_promocode_modal] = params[:show_promocode_modal]\n # reset current modal popup\n set_after_sign_in_location(root_path)\n end\n\n session[:auto_apply] = params[:auto_apply] if params.key?(:auto_apply)\n session[:auto_apply_promo] = params[:auto_apply_promo] if params.key?(:auto_apply_promo)\n\n # Capture PLEASE REMIND ME ABOUT MY SALE events to push onto customer.io later.\n session[:email_reminder_promo] = params[:email_reminder_promo] if params.key?(:email_reminder_promo)\n\n\n redirect_to spree.spree_user_omniauth_authorize_url(provider: :facebook, scope: 'email,public_profile,user_friends')\n end", "def authorize_url\n @oauth_client.auth_code.authorize_url(:redirect_uri => @redirect_uri, :scope => site_url)\n end", "def callback_phase\n options.client_options[:access_token_path] = \"/oauth/qzoneoauth_access_token?oauth_vericode=#{request['oauth_vericode'] }\" if request['oauth_vericode']\n super\n end", "def sso_callback_url_for(user)\n\n sso_token = encrypt_sso_token_for_user(user)\n\n url = sso_callback_url.dup\n if sso_callback_url =~ /\\?/\n url << '&'\n else\n url << '?'\n end\n url << \"sso_token=#{sso_token}\"\n\n url\n\n end", "def authentication_succeeded(message = 'You have logged in successfully.', destination = '/followees')\n flash[:notice] = message\n redirect_back_or_default destination\n end", "def ios_client_callback_url(user)\n \"lolgramz://auth_callback?instagram_token=#{user.instagram_token}&api_token=#{user.api_token}\"\n end", "def authorize\n\t\t@@extension_url = params[:redirect_uri]\n\t\tredirect_to('/auth/google_oauth2')\n\tend", "def get_auth_link(state)\n data = {\n scope: \"notify\",\n response_type: \"code\",\n client_id: self.client_id,\n redirect_uri: self.redirect_uri,\n state: state\n };\n\n \"#{self.bot_origin}/oauth/authorize?#{URI.encode_www_form(data)}\"\n end", "def oauth\n connector = StripeOauth.new(current_customer)\n\n logger.debug(connector)\n\n # logger.debug(\"===> #{stripe_confirm_url}\")\n\n url, error = connector.oauth_url(redirect_uri: stripe_confirm_url)\n\n if url.nil?\n flash[:alert] = error\n redirect_to customer_path(current_customer)\n else\n redirect_to url\n end\n end", "def facebook\n handle_redirect('devise.facebook_data', 'Facebook')\n end", "def facebook\n handle_oauth\n end", "def create_oauth_url(cb_url, encoded_auth_state)\n oauth_url = \"https://www.facebook.com/dialog/oauth/?client_id=\" +\n \"#{APP_ID}&redirect_uri=#{cb_url}&state=#{encoded_auth_state}\"\n end", "def callback\n\t\t#get the access token from facebook with your code\n\t\tsession['access_token'] = session['oauth'].get_access_token(params[:code])\n\t\tredirect_to '/facebooks/menu'\n\tend", "def auth_endpoint_callback\n Rails.logger.debug \"------ Entering auth_endpoint_callback ------\"\n\n @organization = Organization.find(params[:org])\n\n session[\"access_token\"] = @organization.authorization_server.\n request_access_token(request, callback_url)\n redirect_to organization_records_path(@organization)\n end", "def authorize_url(params = {})\n super\n .tap { |result| __ext_debug(\"--> #{result.inspect}\") }\n end", "def index\n res = create_request2(root_url + '/login/auth', 'tequila.epfl.ch')\n redirect_to ('https://tequila.epfl.ch/cgi-bin/tequila/requestauth?request' + res)\n end" ]
[ "0.68982095", "0.6865438", "0.64795005", "0.6430965", "0.64243", "0.63949364", "0.6390984", "0.63475513", "0.63334495", "0.6332068", "0.6331922", "0.63048136", "0.6234171", "0.62313825", "0.62046784", "0.619393", "0.618767", "0.618615", "0.6185337", "0.6168581", "0.6165418", "0.6160739", "0.61533964", "0.61509234", "0.61487144", "0.61380553", "0.6132602", "0.61285186", "0.6126766", "0.6112121", "0.6112104", "0.60875845", "0.6083665", "0.6075896", "0.6067922", "0.60555476", "0.60354644", "0.60188544", "0.6018809", "0.60149246", "0.6008271", "0.60017055", "0.59940535", "0.597076", "0.59682876", "0.5968143", "0.594829", "0.59427994", "0.59427994", "0.59396565", "0.5933208", "0.591378", "0.5900165", "0.5891162", "0.5888949", "0.58873093", "0.58842754", "0.58802694", "0.5877542", "0.58623856", "0.5855352", "0.58361435", "0.5834678", "0.5827485", "0.5822304", "0.5820534", "0.5819933", "0.58182234", "0.58182234", "0.58182234", "0.58182234", "0.58182234", "0.58182234", "0.58182234", "0.58182234", "0.58182234", "0.58182234", "0.58182234", "0.58182234", "0.58182234", "0.58182234", "0.58182234", "0.58014375", "0.5796171", "0.57856286", "0.57762665", "0.57599986", "0.57589084", "0.57540536", "0.5745898", "0.5741151", "0.5741046", "0.57360417", "0.5734213", "0.5733294", "0.57326686", "0.572874", "0.5718696", "0.5708207", "0.5697775", "0.5697111" ]
0.0
-1
=begin Given two numbers, which can be positive and negative, is the sum of all the numbers between them, including those numbers too. If the two numbers are equal, returns one of the two. =end
def get_sum(a, b) (b < a) ? a : (a..b).to_a.inject(:+) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sum(a,b)\n a == b ? a : a < b ?\n (a..b).to_a.sum : \n (b..a).to_a.sum\nend", "def get_sum(a,b)\n return a if a == b\n \n result = 0\n min = a < b ? a : b\n max = min == a ? b : a\n num = min\n \n until num == max\n result += num\n num += 1\n end\n \n result + max\nend", "def get_sum(a,b)\n if a > b\n [ *b..a ].sum\n elsif a == b\n a\n else\n [ *a..b ].sum\n end\nend", "def get_sum(a, b)\n if a <= b\n (a..b).inject(:+)\n elsif a > b\n (b..a).inject(:+)\n end\nend", "def get_sum(a,b)\n if a > b \n (b..a).reduce(:+)\n else\n (a..b).reduce(:+)\n end\n end", "def get_sum(a,b)\n\trange = b..a\n\trange = a..b if b > a\n\trange.inject(&:+)\nend", "def get_sum(a,b)\n a < b ? (a..b).inject(:+) : (b..a).inject(:+)\nend", "def get_sum(a,b)\n a < b ? (a..b).reduce(:+) : (b..a).reduce(:+)\nend", "def get_sum(a,b)\n\treturn a < b ? (a..b).reduce(:+) : (b..a).reduce(:+)\nend", "def get_sum(a,b)\n a, b = [a, b].minmax\n [*a..b].inject(:+)\nend", "def compute_sum(num1,num2)\n while num2>0 #increment the first number until the second number hits zero\n num1+=1\n num2-=1\n end\n num1 #return the first number\n end", "def get_sum(a, b)\n a < b ? (a..b).sum : (b..a).sum\nend", "def compute_sum_r(num1,num2)\n num2>0 ? compute_sum(num1+1,num2-1) : num1\n end", "def get_sum(a,b)\n return a if a == b # if range is 1 return self\n a < b ? sum = (a..b).inject(:+) : sum = (b..a).inject(:+) # ternery used to order range\nend", "def sumOfTwo(a, b, v)\n a.each do |s_int|\n b.each do |b_int|\n return true if s_int + b_int == v\n end\n end\n false\nend", "def get_sum(a,b)\n def get_sum(a,b)\n (a..b).reduce(:+) || (b..a).reduce(:+)\n end\nend", "def add_two_positive_numbers(num1,num2)\r\n if (num1 < 0) \r\n 0\r\n elsif (num2 < 0) \r\n 0\r\n else \r\n num1 + num2\r\n end\r\nend", "def absolute_sum(num_one, num_two)\n # your code goes here\n return (num_one.abs + num_two.abs)\nend", "def get_sum(a,b)\n cla = [a,b].sort\n (cla[0]..cla[1]).reduce(:+)\nend", "def get_sum(a,b)\n c, d = [a, b].sort\n (c..d).inject(:+)\nend", "def multiples(number1, number2, range1, range2)\n (range1...range2).select { |value| value % number1 == 0 || value % number2 == 0 }.reduce(:+)\nend", "def sum_two_smallest_numbers(numbers)\n #Your code here\n numbers.select(&:positive?).min(2).reduce(:+)\nend", "def absolute_sum(num_one, num_two)\r\n # your code goes here\r\n\r\n num_one.abs + num_two.abs\r\nend", "def get_sum(a, b)\n [a,b].reduce(&:+)\nend", "def sum_of_2int a, b\n (b == 0) ? a : (sum_of_2int (a^b),((a&b)<< 1))\nend", "def two_sum(nums, target)\n return 0 if !nums || nums.size < 2\n min = target\n left = 0\n right = nums.size - 1\n while left < right do \n diff = (nums[left] + nums[right] - target).abs\n min = [min, diff].min\n if nums[left] + nums[right] < target\n left += 1\n else\n right -= 1\n end\n end\n min\nend", "def sum_range(left, right)\n sum = @left_sum[right]\n sum -= @left_sum[left-1] if left > 0\n sum\n end", "def sumoftwonumbers(number1, number2)\n return number1 + number2\nend", "def sum num1, num2\n\ttotal = num1 + num2\n\treturn total\nend", "def amicable_numbers(n1,n2)\n divisors_sum(n1) == n2 && divisors_sum(n2) == n1\nend", "def sum_double (a,b)\n\t\n\tif a != b \n\t\treturn a + b \n\tend \n\n\tif a = b \n\t\treturn 2 * (a + b)\n\tend\n\nend", "def sum_range(left, right)\n @sums[right + 1] - @sums[left]\n end", "def solution(a, b)\n # write your code in Ruby 1.9.3\n a = 0 if a < 0\n return 0 if b<0\n return Math.sqrt(b).floor - Math.sqrt(a).ceil + 1\nend", "def get_sum(a,b)\n if a || b\n a + b\n elsif a == a\n return a\n elsif b == b\n return b\n else\n puts \"Invalid Option\"\n end\n\nend", "def double_sum(a, b)\n a == b ? 2 * (a + b) : (a + b)\nend", "def sum(a, b = nil)\n if b\n _sum(b) - _sum(a)\n elsif a.is_a?(Range)\n l = a.begin\n l += @size if l < 0\n if r = a.end\n r += @size if r < 0\n r += 1 unless a.exclude_end?\n else\n r = @size\n end\n _sum(r) - _sum(l)\n else\n _sum(a)\n end\n end", "def find_missing_number(array_one, array_two)\n sum1 = array_one.reduce(:+)\n sum2 = array_two.reduce(:+)\n\n sum1 - sum2\nend", "def check_array(a, b)\n sum = (a[0]+a[1]+a[2])-(b[0]+b[1]+b[2])\n\tif(sum >= 0)\n\t\treturn a\n\tend\n\treturn b\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", "def add_numbers(number1, number2)\n return sum\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 sum_these_numbers(num1, num2)\n num1 + num2\nend", "def solution(a)\n first_sum = a[0]\n second_sum = a.inject(&:+) - a.first\n result = (first_sum - second_sum).abs\n\n a[1..-2].each do |elem|\n first_sum = first_sum + elem\n second_sum = second_sum - elem\n tmp_result = (first_sum - second_sum).abs\n result = tmp_result if tmp_result < result\n end\n\n result\nend", "def sum_two_smallest_numbers(numbers)\n numbers.min(2).reduce(:+)\nend", "def otter_sum(list)\n running_total = 0\n global_min = 0\n global_max = 0\n global_min_first = true\n all_negatives = true\n min_neg = list.first\n\n list.each do |el|\n if all_negatives == true\n if el < 0\n min_neg = el if el > min_neg\n else\n all_negatives = false\n end\n end\n\n running_total += el\n\n if running_total < global_min\n global_min = running_total\n global_min_first = false\n elsif running_total > global_max\n global_max = running_total\n global_min_first = true\n end\n\n end\n\n comp = [global_max, running_total - global_min]\n\n if global_min_first == true\n comp << global_max - global_min\n end\n\n return min_neg if all_negatives == true\n return comp.max\nend", "def getTotalX(a, b)\n (a[-1]..b[0]).to_a.reject do |cand|\n first_issue = a.detect { |elem| !(cand % elem).zero? }\n second_issue = first_issue ? false : b.detect { |elem| !(elem % cand).zero? }\n\n second_issue.nil? ? false : true\n end.count\nend", "def sum_range(start, finish)\n return 0 if finish < start\n return start if start == finish\n sum = start + sum_range(start.next, finish)\nend", "def sum_lists(list1, list2)\n return list1 unless list2\n return list2 unless list1\n\n sum = sum_lists_helper(list1, list1.count, list2, list2.count)\n\n if sum.value >= 10\n sum.value -= 10\n return LinkedListNode.new(1, sum)\n else\n return sum\n end\nend", "def sum(number, other)\n number + other\n end", "def sum_of(a,b)\n\treturn a + b\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 sumOfTwo(a, b, v)\n\n # create a hash that will store key-value pairs of array b\n h = {}\n\n # iterate over b and store a key, which is the number\n # and store the value, which is the number of occurences\n b.each do |num|\n if h[num]\n h[num] += 1\n else\n h[num] = 1\n end\n end\n\n # iterate over a and for each number in a\n # if the hash contains the v minus num (which is equivalent to adding num + hash[v-num] = v)\n # then return true\n a.each do |num|\n if h[v - num]\n return true\n end\n end\n\n # if this point is reached, there was no matching pairs\n # return false\n return false\n\nend", "def opposite_count(nums)\n count = 0\n\n nums.each do |num1|\n nums.each do |num2|\n\n if num1 + num2 == 0\n count += 1\n end\n end\n end\n return count\n\nend", "def sub_sum2(list)\n total = 0\n list.each { |x| total += x if x > 0}\n total\nend", "def sum_two_highest_positive_integers(numbers)\n sorted = numbers.sort!\n sorted[-1] + sorted[-2]\nend", "def sum_two_smallest_nums(arr)\n\tpositive_arr = arr.select{|a| a >= 0}\n\tpositive_arr = positive_arr.sort\n\tc = positive_arr[0] + positive_arr[1]\n\treturn c\nend", "def sum_two_small_numbers(numbers)\n numbers.sort.first(2).inject(:+)\nend", "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 sum(from, to, &b)\n accumulator = 0.0\n Range.new(from, to).each do |i|\n accumulator += b.call(i)\n end\n return accumulator\nend", "def absolute_sum(num_one, num_two)\n # your code goes here\n puts (num_one + num_two).abs\n puts (num_one).abs + (num_two).abs\nend", "def plusMinus(arr)\n list = [0, 0, 0]\n arr.each do |n|\n if n > 0\n list[0] += 1\n elsif n < 0\n list[1] += 1\n else\n list[2] += 1\n end\n end\n\n sum = list.sum\n puts(format('%.6f', list[0].to_f / sum))\n puts(format('%.6f', list[1].to_f / sum))\n puts(format('%.6f', list[2].to_f / sum))\nend", "def sumaNumbers(a = 37, b=53)\n\treturn a+b\nend", "def sum_it(num1, num2)\n return num1 + num2\nend", "def biggertwo(list1,list2)\n sum1 = 0\n sum2 = 0\n list1.each do |num|\n sum1 = sum1 + num\n end\n list2.each do |num|\n sum2 = sum2 + num\n end\n if sum1 < sum2\n return list2\n else\n return list1\n end\nend", "def getTotalX(a, b)\n is_factor = -> (n1, n2){n1 % n2 == 0}\n\n max = [a.max, b.max].max\n\n ns_between = (1..max).each.select{ |i|\n a.all?{|_a| is_factor.(i, _a)} && b.all?{|_b| is_factor.(_b, i)}\n }\n\n return ns_between.length\nend", "def suma(num1:0,num2:0)\n\treturn num1 + num2\nend", "def find_sum(num1, num2)\n puts num1 + num2\nend", "def squares(a, b)\n diff = (Math.sqrt(b).ceil - Math.sqrt(a).ceil)\n diff = diff + 1 if Math.sqrt(b) % 1 == 0\n # diff = diff + 1 if Math.sqrt(a) % 1 == 0\n return diff\nend", "def two_sum(nums)\n\ta = 0\n\n\twhile a < nums.length\n\t\tb = a + 1\n\n\t\twhile b < nums.length\n\n\t\t\tif nums [b]+ nums[a] == 0\n\t\t\treturn [ a,b]\n\n\t\tend\n\n\t\tb+=1\n\t end\n\n\t a+=1\n\n\tend\n\n\treturn nil\n\t\nend", "def opposite_count(nums)\n sum = 0\n\n nums.each_with_index do |num1, idx1|\n nums.slice(idx1+1..-1).each_with_index do |num2, idx2|\n if num1 + num2 == 0\n sum += 1\n end\n end\n end\n sum # implicit \"return sum\"\nend", "def add_nums(num_1,num_2)\n\treturn num_1.to_i + num_2.to_i\nend", "def sum(numbers)\n numbers.reduce(&:+)\n end", "def add_nums(num_1, num_2)\n return num_1.to_i + num_2.to_i\nend", "def add_nums(num_1, num_2)\n return num_1.to_i + num_2.to_i\nend", "def kangaroo(x1, v1, x2, v2)\n met = false\n while x1 < x2 && v2 < v1\n x1 = x1 + v1\n x2 = x2 + v2\n met = true if x1 == x2 \n end\n met == true ? 'YES' : 'NO'\nend", "def sum_to_val_two(vals,target)\n\treturn 0 if target < 0\n\treturn 1 if target == 0\n\treturn 0 if vals.size == 0\n\tans = 0\n\t(0..vals.size-1).each do |i|\n\t\tans += sum_to_val_two(vals[i..vals.size-1],target-vals[i])\n\tend\n\treturn ans\nend", "def sum_double(a, b)\n\t\tif (a != b)\n\t\t\ta+b\n\t\telse\n\t\t\t2 * (a + b)\n\t\tend\n\tend", "def sum_two_numbers(a, b)\n a + b\nend", "def f(n)\n return (1..n).sum if n.positive? and n.integer?\n return false\n # insert your code here.... and go crazy!\nend", "def two_sum_brute nums\n (0...nums.length).each do |i|\n ((i + 1)...nums.length).each do |j|\n if nums[i] + nums[j] == 0\n return i, j\n end\n end\n end\n nil\nend", "def two_sum(nums, target)\n return 0 if !nums || nums.size < 2\n nums = nums.sort\n count = 0\n left = 0\n right = nums.size - 1\n while left < right do \n if nums[left] + nums[right] <= target\n count += right - left\n left += 1\n else\n right -= 1\n end\n end\n count\nend", "def getSum ( x , y )\n\tsum = x + y\n\treturn sum\nend", "def sum(num1, num2)\n return num1 + num2\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 sum_of_range(range)\n range.sort! # easiest way to max sure it's in min max order\n # range = [range[1], range[0]] if range[1] < range[0] # longer way to check min/max order\n (range[0]..range[1]).reduce(:+)\nend", "def add_two_numbers(l1, l2)\n \n curr = try = ListNode.new()\n sum = 0\n\n while l1 || l2 || sum > 0\n # puts l1.val\n if l1\n sum += l1.val\n l1 = l1.next\n end\n if l2\n sum += l2.val\n l2 = l2.next\n end\n \n curr.next = ListNode.new(sum % 10)\n curr = curr.next\n sum /= 10\n end\n \n try.next\n \nend", "def sum_multiples(n1,n2,limit)\n sum = 0\n for i in 1...limit\n sum+= i if(i%n1 == 0 or i%n2 == 0)\n end \n sum\nend", "def amicable?(num1, num2)\n\tnum1 != num2 && proper_divisors(num1).inject(:+) == num2 && proper_divisors(num2).inject(:+) == num1\nend", "def sumaint(digitos)\n suma = 0\n if digitos.to_i < 0\n digitos = digitos.to_i\n digitos*= -1\n negativo = true\n end\n arreglo = digitos.to_s.chars\n for digito in arreglo\n dig = digito.to_i\n suma += dig\n end\n if negativo == true\n suma *= -1\n end\n return suma\nend", "def findSum()\n\tnumbers.inject(0) { |sum, number| sum + number }\nend", "def oddball_sum(numbers) \n result = 0 \n numbers.each { |n| result += n if n % 2 != 0}\n \n return result \nend", "def sum_checker(array)\n# Check if the array contains at least 2 elements\n if array.length < 2\n false\n else\n# Iterate over the array to check if the array has a -num (num and -num add up to zero)\n array.each do |num|\n return true if array.include?(-num)\n end\n end\n false\nend", "def sum_to(num)\n if num<0\n return \"number is negative, wont work!\"\n end\n\n i=0\n sum = 0\n while i <= num\n sum += i\n i += 1\n end\n return sum\nend", "def okay_two_sum(array, target_sum)\n array.sort\n i = 0\n j = array.length - 1\n while i < j\n case (array[i] + array[j]) <=> target_sum\n when -1\n i += 1\n when 0\n return true\n when 1\n j -= 1\n end\n end\n false\nend", "def two_sum(nums)\n\n\t#option 1\n\n\t#Every index, add with other number\n\t\t#downfall -> n^2\n\n\t#Check first to last, like a palindrome (this won't work)\n\n\t#quick sort, add numbers up to 0\n\n\t#Every Index, add with other number\n\t\t#Iterate through array\n\t\tnums.each_with_index do |number, index|\n\t\t#iterate array with each individual number\n\t\t\tnums.each_with_index do |second_number, second_index|\n\t\t\t\t#skip if it is the same number\n\t\t\t\tnext if index == second_index\n\n\t\t\t\t#if there is a match, return starting & current index\n\t\t\t\tif (number + second_number == 0)\n\t\t\t\t\treturn [index, second_index]\n\t\t\t\tend\n\n\t\t\tend\n\n\t\tend\n\t\t#if there is no match, return nil (iterate through)\n\n\t\tnil\n\nend", "def positive_sum(arr)\n arr.select{ |num| num.positive?}.sum\nend", "def sum_double(x, y)\n x == y ? (x+y)*2 : x+y\nend", "def getTotalX(a,b)\n least_common_multiple = a.reduce(:lcm)\n greatest_common_factor = b.reduce(:gcd)\n counter = 0\n\n (least_common_multiple..greatest_common_factor).each do |num|\n if num % least_common_multiple == 0 && greatest_common_factor % num == 0\n counter += 1\n end\n end\n\n return counter\nend", "def sum_these_numbers(x,y)\n sum = x + y\n puts sum\nend", "def sum(n1, n2, overflow=false)\n return nil if n1.nil? and n2.nil? and not overflow\n digit_sum = overflow ? 1 : 0 \n if n1 and n2\n digit_sum+= n1.data + n2.data\n elsif n1 or n2\n digit_sum+= (n1||n2).data\n end\n result = Node.new (digit_sum%10)\n overflow = digit_sum>=10 ? true : false\n\n result.set_next(sum( (n1 || Node.new(nil) ).next, (n2 || Node.new(nil) ).next, overflow))\n result\nend" ]
[ "0.7821901", "0.78023845", "0.77789193", "0.7766465", "0.76248974", "0.75818783", "0.744542", "0.7434632", "0.7429091", "0.73833", "0.7358453", "0.7338352", "0.726259", "0.72612697", "0.71313334", "0.7118445", "0.70731896", "0.70660734", "0.7062492", "0.69382083", "0.6893196", "0.6891783", "0.6851298", "0.68284243", "0.68027276", "0.67705226", "0.67533106", "0.67194664", "0.6714655", "0.6710657", "0.67035395", "0.6685609", "0.66779983", "0.6671999", "0.66591716", "0.66244066", "0.6565276", "0.65634596", "0.6559762", "0.65586656", "0.6552901", "0.6545634", "0.6532367", "0.652489", "0.6523803", "0.65228534", "0.6522389", "0.6484318", "0.6471754", "0.64625365", "0.6447994", "0.6419886", "0.6418112", "0.64133227", "0.6380863", "0.6369752", "0.63632816", "0.63552094", "0.63550484", "0.63484305", "0.6348197", "0.63467085", "0.6344695", "0.6344317", "0.63435715", "0.6337896", "0.63363624", "0.63358766", "0.6335434", "0.63343567", "0.6333405", "0.6332406", "0.63317394", "0.63317394", "0.6327484", "0.63255805", "0.6321074", "0.63170767", "0.63033605", "0.6293645", "0.62923944", "0.62772477", "0.62727195", "0.6262191", "0.6261927", "0.6260535", "0.62541294", "0.6253322", "0.6251235", "0.624905", "0.6247886", "0.6238046", "0.62333363", "0.6232501", "0.6228911", "0.62274164", "0.62197095", "0.6213034", "0.62080693", "0.620731" ]
0.756843
6
=begin Create a method that receives a sentence and return one string pointing out the number of words and characters it contains, without blanks, your method must pass the following tests: =end
def char_word_counter(sentence) words_array = sentence.split(' ') how_many_words = words_array.length how_many_chars = sentence.gsub(/\s+/, "").length "This sentence has #{how_many_words} words & #{how_many_chars} characters" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word_counter(sentence)\n return sentence.split(' ').length #makes it an array, .length counts items\nend", "def word_lengths(sentence)\n # Write your code here\nend", "def word_counter\n \"This is a string\".split.size\nend", "def word_count(text)\n return text.split.count\nend", "def find_frequency(sentence, word) \nsentence.downcase.split.count(word.downcase)\nend", "def long_word_count(text)\n \nend", "def find_frequency(sentence, word)\n ci_sentence = sentence.downcase\n words = ci_sentence.split(\" \")\n words.count(word)\nend", "def WordCount(str)\n\n # code goes here\n return str.split(\" \").length # .split.count, split(‘ ’).size\n \nend", "def count_words_in(the_string)\n the_words = the_string.split\n the_words.size\nend", "def find_frequency(sentence, word)\n\tsentence.downcase.split.count(word.downcase)\n\nend", "def count_chars word\n word.length\nend", "def count_chars word\n word.length\nend", "def count_chars word\n word.length\nend", "def count_chars word\n word.length\nend", "def count_sentences\n \n self.split(/[.?!]+/).count\n \n end", "def find_frequency(sentence, word)\n word = word.downcase\n sentence.downcase.split.count(word)\nend", "def count_sentences\n self.split(/[.!?]/).reject {|x| x.empty?}.size\n \n end", "def find_frequency(sentence, word)\n sentence.downcase.split.count(word.downcase)\nend", "def find_frequency(sentence, word)\n sentence.downcase.split.count(word.downcase)\nend", "def count_words(sentence)\n sentence.scan(/(\\w+|-+)/).length\nend", "def word_counter (string)\n array = string.split\n array.length\nend", "def count_chars(word)\n word.length\nend", "def count_chars(word)\n word.length\nend", "def count_chars(word)\n word.length\nend", "def count_chars(word)\n word.length\nend", "def word_counter(string)\n\n if string.empty? #== 0, suggested by Rubocop\n i_num_words = 0\n else\n new_string = string\n new_string = new_string.delete \" \"\n i_num_words = string.length - new_string.length + 1\n end\n return i_num_words\nend", "def count_sentences\n array = self.split(/[.!?]\\s/)\n array.count\n end", "def long_word_count(text)\n count = 0\n text.split(\" \").each do |element|\n if element.split(\"\").length > 7\n count += 1\n end\n end\n return count\n \nend", "def count_sentences\n self.split(/[.?!] /).count\n end", "def word_lengths(str)\nend", "def count_chars word3\n word3.length\nend", "def number_word_char_count\n (1..1000).map(&:english_word).join.count_chars\nend", "def word_count(string)\n string_arr = string.split \n string_arr.size \nend", "def long_word_count(text)\n #\n # your code goes here\n #\n counter = 0\n text.split.each do |word|\n counter += 1 if word.length > 7\n end\n\n counter\nend", "def wordCounter(inputString)\n inputString.scan(/\\w+/).length\nend", "def word_number\n text.split.size\n end", "def find_frequency(sentence, word)\n array = sentence.downcase.split(\" \")\n array.count(word)\nend", "def word_sizes(sentence)\n words = Hash.new(0)\n sentence.split.each {|x| words[x.count(\"A-Za-z\")] += 1}\n words\nend", "def word_lengths(sentence)\n sentence.split.map { |str| \"#{str} #{str.length}\" }\nend", "def word_count(book_text)\n count = 0\n book_text.split(/[^-a-zA-Z']/).each do |word|\n count += 1 if word.length > 0\n # DEBUG puts count.to_s + ': \"' + word + '\"'\n end\n return count\nend", "def count_sentences\n self.split(/[.!?]/).reject {|x| x.empty?}.size\n end", "def long_word_count(text)\n text.split(' ').count{|word| word.length > 7}\nend", "def count_sentences\n sentence_array = self.split(/[.?!]/)\n sentence_array.delete_if{|sentence| sentence.empty?}\n sentence_array.length\n \n\n end", "def long_word_count(text)\n text.split.count do |word|\n word.length > 7\n end\nend", "def WordCount(str)\n str.split(\" \").count\nend", "def custom_count(string, search_characters)\n # Return the number of total times that\n # the search character are in the string\n\n # word = string.count(\"#{search_characters}\")\n # word\n count = 0\n word = string.downcase\n word.each_char do |char|\n if search_characters.include?(char)\n count += 1\n end\n end\n count\nend", "def count_chars\n puts \"Please write word or multiple words:\"\n words = gets.chomp\n\n num_chars = words.gsub(/\\s+/,'').length\n # for a simple input like this one could use\n # num_chars = words.delete(' ').length but delete must\n # use a string and not a regex\n puts \"There are #{num_chars} characters in \\\"#{words}\\\".\"\nend", "def long_word_count(text)\n text.split.select {|word| word.length > 7}.count\nend", "def count_sentences\n self.split(/[.!]/).count\n end", "def words_of_even_length(sentence)\nend", "def count_sentences(text)\n # covers sentences that end with a ., ?, or !\n text.split(/[.?!]/).count \nend", "def number_of_words(string)\n\tstring.split.size\nend", "def find_frequency(sentence, word)\n sentence.split.map { |w| w.downcase }.count(word.downcase)\nend", "def word_sizes(sentence)\n hash = Hash.new(0)\n words = sentence.split(\" \")\n words.map! { |word| word.gsub(/[^a-zA-Z]/, ' ')}\n words.map! { |word| word.delete(\" \")}\n words.each { |word| hash[word.length] += 1 }\n hash\nend", "def character_count(words)\n words = words.split(' ')\n words.reduce(0) { |sum, val| sum + val.length }\nend", "def word_counter(string)\n new_string = string.split\n return new_string.length\nend", "def count_sentences\n \tself.split(/[.?!]/).delete_if{|obj| obj == \"\"}.count\n end", "def count_sentences\n return self.split(/\\.|\\?|\\!/).delete_if {|word| word.size < 1}.count\n\n end", "def word_count\n @tried_solutions.length\n end", "def word_count(string)\n words = string.split(/\\W+/) #split on any non-word char. Thanks Rubular.com!\n #Using \\b counts even spaces as \"words\". Using \\W counts ... as three words.\n #\\W+ splits on one or more of any non-word character\n words.length #return length\nend", "def word_count\n words.size\n end", "def word_count\n words.size\n end", "def average_length_of_words(sentence)\nend", "def WordCount(str)\n\n arr=str.split\n return arr.length\nend", "def word_sizes(sentence)\n sentence.split.each_with_object(Hash.new(0)) { |word, obj| obj[word.size] += 1 } \nend", "def word_count(passage, unique: false)\n !unique ? strip_text(passage).count : strip_text_unique(passage).count# words = rows here\nend", "def calc_characters(string)\n words = string.split\n chars = 0\n words.each { |word| chars += word.size }\n chars\nend", "def number_of_words(input, mode = T.unsafe(nil)); end", "def find_frequency(sentence, word)\n calc_count = 0\n sentence.split(' ').each_with_object([]) do |i, j|\n calc_count += 1 if i.downcase == word\n end\n return calc_count\nend", "def count_words(string)\n arg = string.downcase.gsub(/[^a-z ]/,\"\")\n words = arg.split(/\\s+/)\n result = Hash.new\n words.each { |word| \n if result[word].nil? then result[word] = 1 else result[word] += 1 end\n }\n result\nend", "def word_count(sentence)\n arr = sentence.split(\" \")\n result = Hash.new(0) # add default value as 0 for each new keys\n arr.each {|word| result[word] += 1 } # increment key 0 -> 1 -> 2..\n result # last expression of a method is returned\nend", "def find_frequency(sentence, word)\n count = 0\n wordarray=sentence.downcase.split(\" \")\n wordarray.each do |wordcurrent|\n count = (count +1) if word.downcase == wordcurrent\n end\n return count\nend", "def word_lengths(sentence)\n hassh = Hash.new(0)\n sentence.split(\" \").each {|w| hassh[w] = w.length }\n return hassh\nend", "def count_sentences\n self.split(/\\.|\\?|\\!/).delete_if {|w| w.size < 2}.size\n binding.pry\n end", "def character_count\n print \"Please write word or multiple words: \"\n str = gets.chomp\n count = str.count{|char| char != ' '}\n\n puts \"there are #{count} characters in \\\"#{str}\\\".\"\nend", "def str_count(word, letter)\n p word.count(letter)\nend", "def str_count(word, letter)\n # Code here\n word.count(letter)\nend", "def word_count(statement)\n words = {}\n wordsArr = statement.split(\" \")\n\n wordsArr.each do |word_key|\n words[word_key] ||= 0\n words[word_key] += 1\n end\n words\nend", "def letter_counts(word)\nend", "def custom_count(string, search_characters)\n count = 0\n string.each_char { |word| count += 1 if search_characters.include?(word) }\n count\nend", "def word_count(text, unique: false)\n if unique == false\n split_normalise(text).split.count\n else\n unique_words(text).count\n end\nend", "def number_of_words(str)\n\tcount=1\n\tstr=gets.chomp\n\tfor char in str\n\t\tif char == \" \"\n\t\t\tcount=count+1\n\t\tend\n\tend\n\tputs count\nend", "def WordCount(str)\n\tarr = str.split(\" \").count\nend", "def count_letters(word)\r\n\r\n end", "def count_words\n string = self.squish.downcase.gsub(/[^a-z0-9\\s]/i, '')\n string = string.split(\" \")\n words = Hash.new(0)\n string.each { |x|\n words[x] +=1;\n }\n return words\n end", "def word_with_most_repeats(sentence)\n\nend", "def word_with_most_repeats(sentence)\n\nend", "def custom_count(string, search_characters)\n total_chars = 0\n #\n search_characters.each_char do |sc|\n # split the string and review letter & sc\n letters = string.each_char { |letter| letter == sc ? total_chars += 1 : next }\n\n end # end of do (search chars)\n\n total_chars\nend", "def WordCount(string)\n string.scan(/\\w+/).count\nend", "def word_sizes(str)\n counter = Hash.new(0)\n str.split.each do |word|\n counter[word.gsub(/\\W/,'').length] += 1\n end \n counter\nend", "def double_letter_count(string)\n count = 0\n string.split.each { |word| count += count(word) }\n count\nend", "def word_count\n return words.size\n end", "def word_with_most_repeats(sentence)\nend", "def word_count(words)\n num = 0\n words.each do |word|\n unless word.include?('*') || word.include?('#')\n num += 1\n end\n end\n num\nend", "def word_sizes(str)\n word_counts = Hash.new(0)\n str.gsub(/[^a-zA-Z ]/, '').split.each { |word| word_counts[word.length] += 1 }\n word_counts\nend", "def count_sentences\n self.split(/\\.|\\?|\\!/).delete_if {|sentence| sentence.size < 2 }.count\n end", "def word_count\n #need to modify regex to account for apostrophes\n text = (@text.gsub!(/\\W+|\\d/,' ').split(\" \"))\n word_count = Hash.new(0)\n text.each do |word|\n word = word.downcase\n word_count[word] +=1\n end\n word_count\n end", "def total_sentences\n @string.split(/\\.+/).size\n end", "def how_many_words(text=\"I'm a cheeky monkey, dude\", num=4)\n x_words = []\n word_array = text.split(\" \")\n word_array.each do |word|\n if word.length == num\n x_words << word\n end\n end\n x_words\nend", "def words_count\n get_at_words_count + \n get_ata_words_count + \n get_noun_words_count + \n get_adjective_words_count\n end" ]
[ "0.82707256", "0.7901788", "0.76770914", "0.76746225", "0.7634617", "0.7603699", "0.7587691", "0.75492144", "0.75468934", "0.7537955", "0.75367135", "0.75367135", "0.75367135", "0.75367135", "0.7519367", "0.75154734", "0.75025254", "0.74972373", "0.74972373", "0.74725497", "0.7457027", "0.7454115", "0.7454115", "0.7454115", "0.7454115", "0.7444472", "0.7431417", "0.74290854", "0.74163896", "0.74138397", "0.7399091", "0.73965853", "0.73842955", "0.7381805", "0.7380742", "0.73801005", "0.7375446", "0.7375199", "0.73683274", "0.73592615", "0.7353857", "0.7339192", "0.7295164", "0.7291809", "0.7282082", "0.7281049", "0.7273619", "0.7257959", "0.724234", "0.7231966", "0.7215627", "0.7213088", "0.719635", "0.7190006", "0.7188079", "0.71818817", "0.71818817", "0.7168822", "0.71679777", "0.7157463", "0.71540976", "0.71540976", "0.7147703", "0.7146474", "0.71370286", "0.7122504", "0.7114909", "0.7112075", "0.7078422", "0.707262", "0.7070852", "0.7065917", "0.7063291", "0.7061958", "0.7061189", "0.70576775", "0.70533705", "0.70426756", "0.70358145", "0.703058", "0.7020246", "0.7004393", "0.69829196", "0.6979972", "0.69787127", "0.6962117", "0.6962117", "0.6952669", "0.694066", "0.69310606", "0.6921948", "0.6912364", "0.69118387", "0.6910376", "0.6905182", "0.6888108", "0.6873003", "0.68659985", "0.68550384", "0.6851928" ]
0.81835014
1
=begin Now we will take the hashes as an organizing tool to distinguish food by food group. For this you must create a method that takes as a parameter string containing a meal, and look at the next hash, returning her key as a return value, if you do not find the food must return "food not found". =end
def food_group(str) food_groups = { "grain" => ['Rice', 'Trigo', 'Avena', 'Barley', 'Flour'], "vegetable" => ['Carrot', 'corn' 'Corn', 'Pumpkin', 'Papa'], "fruit" => ['Apple', 'Mango', 'Strawberry', 'Peaches', 'Pineapple'], "meat" => ['Beef', 'Chicken', 'Salmon', 'Fish', 'Pig'], "dairy" => ['Milk', 'Yogurt', 'Cheese', 'Cream'] } food_groups.each do |k,array| array.each { |food| return k if food == str } end return 'food not found' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def true_for_food(hash, item)\n food= hash[:favourites][:things_to_eat]\n\n for i in hash\n if i == food\n\n return \"Yes I like this food\"\n end\n end\n return \"No I don't like this\"\n end", "def find_single_bay(hash,lookup)\n\n for key,value in hash\n\n if value[:item] == lookup\n return key \n end\n \n end\n #If gone all the way throuh the hash, no item\n #found so return nil\n return nil\nend", "def printFood(name)\n i = 0 #initializing i to zero\n # if the given food matches basicHash food name\n # look into basicHash and set i to 1 to mark found\n if @BasicHash.has_key? name\n i = 1\n basicfood = @BasicHash[name]\n puts \"#{basicfood.name} #{basicfood.calories} \"\n end\n # if it is found in recipeHash then look into\n # recipe hash and print it out.\n if @RecipeHash.has_key? name\n i = 1\n recipePrintHelper(name)\n end\n # else case, if it can't find in both recipe\n # and basic hash\n if i == 0\n puts \"Can't find the food '#{name}'\"\n end\n end", "def bakery_num(num_of_people, fav_food) #Defining a function that takes two parameters\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} #Declaring a my_list hash\n pie_qty = 0 # Assigning three other variables \n cake_qty = 0\n cookie_qty = 0\n \n has_fave = false #setting a default value of false \n\n my_list.each_key do |k| #looping through the keys of my_list\n if k == fav_food #An if statement, where the condition is comapred to one of the parameters\n has_fave = true #If true, declaring a has_fave to true \n fav_food = k #Assigning fav_food to that key\n end\n end\n if has_fave == false #If no matec ==> error\n raise ArgumentError.new(\"You can't make that food\")\n else\n fav_food_qty = my_list.values_at(fav_food)[0] #If match ==> find value from Hash \n if num_of_people % fav_food_qty == 0 #Module of the first function parameter, number of people by fav food quantity\n num_of_food = num_of_people / fav_food_qty #If true, get portions \n return \"You need to make #{num_of_food} #{fav_food}(s).\" #return an order \n else num_of_people % fav_food_qty != 0 #redundant but if not \n while num_of_people > 0 \n if num_of_people / my_list[\"pie\"] > 0 #if there are more people than pies\n pie_qty = num_of_people / my_list[\"pie\"] #This gets portions\n num_of_people = num_of_people % my_list[\"pie\"] #this gets amount of people for leftovers \n elsif num_of_people / my_list[\"cake\"] > 0 #If the number of people is not rgeater than pies, we go into cakes\n cake_qty = num_of_people / my_list[\"cake\"]\n num_of_people = num_of_people % my_list[\"cake\"]\n else\n cookie_qty = num_of_people\n num_of_people = 0\n end\n end\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\n end\n end\nend", "def bakery_num( num_of_people, fav_food ) # defines a method called bakery_num that takes two parameters, num_of_peope, fav_food\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} # Hash of avaialble foods and associated counts\n \n pie_qty = 0\n cake_qty = 0 # quantity of the foods equals to 0 \n cookie_qty = 0\n \n has_fave = false # Initializes our has_fave tood to false\n\n my_list.each_key do |key| # iterating over my_list keys to do a comparison \n if key == fav_food # Favorite food comparison\n has_fave = true # confirms fav_food is in the list \n end\n # has_fave = true if key == fav_food\n end\n \n if has_fave == false # my_list does not contain fav_food \n raise ArgumentError.new(\"You can't make that food\") # Raise error if fav_food was not found\n else # Fav_food was in the list\n fav_food_qty = my_list[fav_food] #.values_at(fav_food)[0] # if in the list, return the quantity on hand *** refactor\n if num_of_people % fav_food_qty == 0 # Checks if num_of_people is evenly divisable by the fav_food_qty\n num_of_food = num_of_people / fav_food_qty # returns num_of_food eq to number of people / fav foods \n return \"You need to make #{num_of_food} #{fav_food}(s).\" # Return favorite food along with quantity\n else #num_of_people % fav_food_qty != 0 # num_of_people was not evenly divisable by fav_food_qty\n while num_of_people > 0 # while num_of_people is greater than zero \n if num_of_people / my_list[\"pie\"] > 0 # At least more people than the quantity of pie will feed \n pie_qty = num_of_people / my_list[\"pie\"] # quantity of pie is equal the number of people divided by my_list of pie \n num_of_people = num_of_people % my_list[\"pie\"] # number of people ramaining after distributing pies\n elsif num_of_people / my_list[\"cake\"] > 0 # At least more people than the quantity of cake \n cake_qty = num_of_people / my_list[\"cake\"] # quantity of cake is equal to the number of people divided by qty of people cake will feed\n num_of_people = num_of_people % my_list[\"cake\"] # number of people remaining after distributing cakes \n else # num_of_people is less than both qty that pie and cake will feed\n cookie_qty = num_of_people # cookie quantity is equal to the number of people \n num_of_people = 0 # Set num_of_people to 0 in order to end the loop\n end # Ending if-else conditions\n end\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\n end\n end\nend", "def bakery_num(num_of_people, fav_food) \n \n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} \n \n has_fave = false \n\n my_list.each_key do |k| \n if k == fav_food\n has_fave = true\n end\n end\n \n if has_fave == false\n raise ArgumentError.new(\"You can't make that food\")#raise error if has_fave is #false will catch items that are not included in program\n \n else fav_food_qty = my_list[fav_food] #setting fav_food_qty equal to value in my_list\n \n if num_of_people % fav_food_qty == 0 #if perfectly divisible...\n num_of_food = num_of_people / fav_food_qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n \n else #the scenario where the favorite food is not perfectly divisible\n final_hash = my_list \n my_list.each do |k, v|\n final_hash[k] = num_of_people / v\n num_of_people %= v\n end\n\n stringOut = \"You need to make \"\n stringMod = \"\"\n stringEnd = \"\"\n mod_hash = final_hash.dup.delete_if {|k, v| k == \"cookie\" } #Assumes that cookies always feeds one \n last_hash = final_hash.dup.delete_if {|k, v|k != \"cookie\" } #See above\n\n mod_hash.each do |k,v| \n stringMod += \"#{v}\" + \" \" + \"#{k}(s)\" + \",\" + \" \"\n end\n\n last_hash.each do |k,v|\n stringEnd += \"and #{v}\" + \" \" + \"#{k}(s)\" + \".\"\n end\n end\n end\n return stringOut + stringMod + stringEnd #purpose of this is to return as String\nend", "def find_recipe_by_ingredient\n print(\"What ingredients do you have? (Separate by comma)\")\n user_food = gets.chomp\n\n ingredient_ids = user_food.split(\",\").collect do |ingredient|\n Ingredient.find_by(name: ingredient).id\n end\n meal_arr = Meals.all.select do |meal|\n ingredent_ids.include?(meal.ingredient_id)\n end\n hash = {}\n meal_arr.each do |meal|\n if hash.keys.include?(meal.recipe_id)\n hash[meal.recipe_id] += 1\n else\n hash[meal.recipe_id] = 1\n end\n end\n arr = []\n hash.each do |recipe_id, ingredient_count|\n total_ingredients.to_f = Recipe.find(recipe_id).ingredients.size\n if ingredient_count / total_ingredients > 0.80\n arr << Recipe.find(recipe_id).name\n end\n end\n return arr\nend", "def bakery_num(num_of_people, fav_food)\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1}\n pie_qty = 0\n cake_qty = 0\n cookie_qty = 0\n \n has_fave = false\n\n my_list.each_key do |k|\n if k == fav_food\n has_fave = true\n fav_food = k\n end\n end\n if has_fave == false\n raise ArgumentError.new(\"You can't make that food\")\n else\n fav_food_qty = my_list.values_at(fav_food)[0]\n if num_of_people % fav_food_qty == 0\n num_of_food = num_of_people / fav_food_qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n else num_of_people % fav_food_qty != 0\n while num_of_people > 0\n if num_of_people / my_list[\"pie\"] > 0\n pie_qty = num_of_people / my_list[\"pie\"]\n num_of_people = num_of_people % my_list[\"pie\"]\n elsif num_of_people / my_list[\"cake\"] > 0\n cake_qty = num_of_people / my_list[\"cake\"]\n num_of_people = num_of_people % my_list[\"cake\"]\n else\n cookie_qty = num_of_people\n num_of_people = 0\n end\n end\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\n end\n end\nend", "def bakery_num(num_of_people, fav_food) #defining method bakery_num, which takes 2 arguments\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1, \"pudding\" => 2, \"bunt cake\" => 4, \"mega-cupcakes\" => 3} #creates hash my_list, key is food, value is number\n pie_qty = cake_qty = cookie_qty = has_fave = 0 \n \n\n my_list.each_key do |k| #iterating through array my_list\n if k == fav_food #tests if each item in array my_list = fav_food\n has_fave = 1 #if test above passes, set has_fave to true\n # fav_food = k #if test above passes, set fav_food to k\n end\n end\n \n if has_fave == 0 #if fav_food is not a key, end program\n raise ArgumentError.new(\"You can't make that food\")\n else #if fav_food is a key\n fav_food_qty = my_list.values_at(fav_food)[0] #set fav_food_qty equal to the value of fav_food\n if num_of_people % fav_food_qty == 0 \n num_of_food = num_of_people / fav_food_qty #if num_of_people is evenly divisible by fav_food_qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n \n #num_of_food = num_of_people / fav_food_qty #then perform division by integer\n #return \"You need to make #{num_of_food} #{fav_food}(s).\" #return \"You need to make (num_of_food) (fav_food)s\"\n else num_of_people % fav_food_qty != 0 #redundant else\n while num_of_people > 0 #while num_of_people is greater than 0\n if num_of_people / my_list[\"pie\"] > 0 #if num_of_people divided by value of pie is greater than 0\n pie_qty = num_of_people / my_list[\"pie\"] #set pie_qty equal to num_of_people divided by value of pie in hash\n num_of_people = num_of_people % my_list[\"pie\"] #set num_of_people equal to the remainder of num_of_people divided by value of pie in hash\n elsif num_of_people / my_list[\"cake\"] > 0 #if num_of_people divided by hash value of cake is greater than 0\n cake_qty = num_of_people / my_list[\"cake\"] #set cake_qty equal to num_of_people divided by hash value of cake\n num_of_people = num_of_people % my_list[\"cake\"] #set num_of_people equal to the remainder of num_of_people divided by value of cake in hash\n else\n cookie_qty = num_of_people #set cookie_qty equal to num_of_people\n num_of_people = 0 #set num_of_people equal to 0\n end\n end\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\" #print out\n end\n end\n \nend", "def bakery_num(num_of_people, fav_food) #defines the method and accepts arguments num_of_people and fav_food\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} \n pie_qty = 0 #declaring variables at 0\n cake_qty = 0 #declaring variables at 0\n cookie_qty = 0 #declaring variables at 0\n \n has_fave = false\n\n my_list.each_key do |k| #iterates through the keys in my_list\n if k == fav_food #checks if passed argument fav_food is in the hash as a key\n has_fave = true #sets boolean has_fave to true\n fav_food = k #re-assigns fav_food to the key in the hash\n end\n end\n \n if has_fave == false #if fav_food is not found in the list\n raise ArgumentError.new(\"You can't make that food\") #raise an error\n else\n fav_food_qty = my_list.values_at(fav_food)[0] #declares a variable that is the quantity of fav food argument and sets it equal to first element in the value\n \n if num_of_people % fav_food_qty == 0 #if number of people is divisable by quantity of fav food\n num_of_food = num_of_people / fav_food_qty #number of food is set to number of people divided by fav food quantity\n return \"You need to make #{num_of_food} #{fav_food}(s).\" #returns string concatenated declaring how much of the food to make\n \n else num_of_people % fav_food_qty != 0 #if num of people is not divisable by fav food qty\n while num_of_people > 0 \n if num_of_people / my_list[\"pie\"] > 0 #if number of people divided by number of pies floor is greater than 0 \n pie_qty = num_of_people / my_list[\"pie\"] #sets pie quantity to multiples of number of servings\n num_of_people = num_of_people % my_list[\"pie\"] #num of people reassigned to remainder \n elsif num_of_people / my_list[\"cake\"] > 0 #if number of people divided by number of cakes floor is greater than 0\n cake_qty = num_of_people / my_list[\"cake\"] #sets cake quantity to multiples of number of servings\n num_of_people = num_of_people % my_list[\"cake\"] #num of people reassigned to remainder \n else\n cookie_qty = num_of_people #sets cookie qty to number of people remaining\n num_of_people = 0 #ends the loop if \"cookie else\" is reached\n end\n end\n \n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\" #returns the string, whole combination\n end\n end\nend", "def bakery_num(num_of_people, fav_food) # this is defining bakery_num and takes 2 inputs\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} # creates hash, keys are baked goods, values are how many you can feed\n pie_qty = 0 # sets pie_qty to zero\n cake_qty = 0\n cookie_qty = 0\n \n has_fav = false # rename?\n\n my_list.each_key do |k| # iterates through each key in my_list\n if k == fav_food # if they key matches fav_food input\n has_fav = true # change has_fav to true\n end\n end\n \n if has_fav == false # If food isn't in stock/ isn't found\n raise ArgumentError.new(\"You can't make that food\")\n \n else\n fav_food_qty = my_list.values_at(fav_food)[0] # quantity of people favorite food can feed\n \n if num_of_people % fav_food_qty == 0 # if num_of_people can be divided evenly by fav_food_qty\n num_of_food = num_of_people / fav_food_qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n \n else\n num_of_fav_food = num_of_people / fav_food_qty\n num_of_people = num_of_people % fav_food_qty\n \n while num_of_people > 0\n cake_qty = num_of_people / my_list[\"cake\"]\n if num_of_people % my_list[\"cake\"] > 0\n cookie_qty = num_of_people\n num_of_people = 0\n end \n end\n \n if fav_food == \"pie\"\n pie_qty = num_of_fav_food\n elsif fav_food == \"cake\"\n cake_qty = num_of_fav_food\n else\n cookie_qty = num_of_fav_food\n end\n\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\n \n \n end \n end\nend", "def bakery_num(num_of_people, fav_food) #defining a method bakery_number. Takes number of people and favorite food as parameters \n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} #hash- my_list that has type of food as a key and amount of food as a value\n pie_qty = 0 # set default quantity to zero \n cake_qty = 0 # set default quantity to zero \n cookie_qty = 0 # set default quantity to zero \n \n ##has_fave = false # setting has_fave to false ##\n\n #my_list.each_key do |k| # we are iterating over my_list key values \n #if k == fav_food # if one of the keys matches fav_food, then...\n #has_fave = true # has_fave is set to true \n ##fav_food = k ##not necessary \n #closed out if statement \n if my_list.has_key?(fav_food) \n fav_food_qty = my_list.values_at(fav_food)[0] \n if num_of_people % fav_food_qty == 0 \n num_of_food = num_of_people / fav_food_qty \n return \"You need to make #{num_of_food} #{fav_food}(s).\" \n else \n case fav_food\n when \"pie\"\n if num_of_people / my_list[\"pie\"] > 0 \n pie_qty = num_of_people / my_list[\"pie\"] \n num_of_people = num_of_people % my_list[\"pie\"] \n elsif num_of_people / my_list[\"cake\"] > 0 \n cake_qty = num_of_people / my_list[\"cake\"] \n num_of_people = num_of_people % my_list[\"cake\"]\n else\n cookie_qty = num_of_people\n num_of_people = 0\n when \"cake\"\n if num_of_people / my_list[\"cake\"] > 0 \n cake_qty = num_of_people / my_list[\"cake\"] \n num_of_people = num_of_people % my_list[\"cake\"]\n else\n cookie_qty = num_of_people\n num_of_people = 0\n when \"cookie\"\n cookie_qty = num_of_people\n num_of_people = 0\n else\n \"You need to pick pie, cake, or cookie\"\n end \n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\n end \n end \n else \n raise ArgumentError.new(\"You can't make that food\") # raise argument using a string \n end", "def bakery_num( num_of_people, fav_food ) # defines a method called bakery_num that takes two parameters, num_of_peope, fav_food\n serving_sizes = { \"pie\" => 8, \"cake\" => 6, \"cookie\" => 1 } # Hash of available foods and associated counts\n food_quantities = { \"fav_food\" => 0, \"pie\" => 0, \"cake\" => 0, \"cookie\" => 0 } # Hash of food quantities\n\n # Raise error if serving sizes doesn't contain food\n raise ArgumentError.new(\"You can't make that food\") if !serving_sizes.has_key? (fav_food)\n\n # Returns the necessary number of food items needed to satisfy each serving if the \n # number of people attending is evenly divisible by the quantity of the passed favorite food.\n return \"You need to make #{num_of_people / serving_sizes[fav_food]} #{fav_food}(s).\" if num_of_people % serving_sizes[fav_food] == 0\n\n # Loop through each key in food_quantities to determine how many of each food item is needed.\n food_quantities.each do |key, value|\n if key == \"fav_food\" \n food_quantities[key] = num_of_people / serving_sizes[fav_food] # Setting \"fav_food\" property for future use in food_quantities\n food_quantities[fav_food] = food_quantities[key]\n num_of_people = num_of_people % serving_sizes[fav_food] # Setting remaining amount of people left after fav_food is determined.\n elsif num_of_people / serving_sizes[key] > 0 # key is not fav_food and number of remaining people divided by the next food item serving size is greater than zero\n food_quantities[key] = num_of_people / serving_sizes[key] # Setting count for additional food items needed for remaining people\n num_of_people = num_of_people % serving_sizes[key] # Setting number of remaining people after the additional food item\n end # Ending conditional\n end # Ending .each loop\n\n return \"You need to make #{food_quantities[\"pie\"]} pie(s), #{food_quantities[\"cake\"]} cake(s), and #{food_quantities[\"cookie\"]} cookie(s).\"\nend", "def bakery_num(num_of_people, fav_food)\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1}\n food_quantity = {\"pie\" => 0, \"cake\" => 0, \"cookie\" => 0}\n \n#Determine whether fav_food is a key in my_list\n# if you type in a food that isn't on the list, it raises an argument error\n\nunless my_list.has_key?(fav_food)\n raise ArgumentError.new(\"You can't make that food\")\nend\n\n# takes the value of the favorite food\n fav_food_qty = my_list[fav_food]\n#checks whether the number of people is divisible by that value \n if num_of_people % fav_food_qty == 0\n \n num_of_food = num_of_people / fav_food_qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n#if there is a remainder...\n else num_of_people % fav_food_qty != 0\n food_quantity[fav_food] = num_of_people / fav_food_qty\n remaining_people=num_of_people%fav_food_qty\n my_list.each do |k,v|\n if remaining_people / my_list[k] > 0\n food_quantity[k] += remaining_people / my_list[k]\n remaining_people = remaining_people % my_list[k]\n end\n end\n # returns the number of pies, cakes, and cookie that can be made\n return \"You need to make #{food_quantity['pie']} pie(s), #{food_quantity['cake']} cake(s), and #{food_quantity['cookie']} cookie(s).\"\n end\n end", "def bakery_num(num_of_people, fav_food)\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1}\n food_array = []\n has_fave = false\n\n my_list.each_key do |k|\n if k == fav_food\n has_fave = true\n end\n end\n raise ArgumentError.new(\"You can't make that food\") if has_fave == false\n fav_food_qty = my_list[fav_food]\n if num_of_people % fav_food_qty == 0\n num_of_food = num_of_people / fav_food_qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n else num_of_people % fav_food_qty != 0\n while num_of_people > 0\n my_list.each do |k, v|\n food_qty = num_of_people / v\n num_of_people = num_of_people % v\n food_array << food_qty\n end\n end\n return \"You need to make #{food_array[0]} pie(s), #{food_array[1]} cake(s), and #{food_array[2]} cookie(s).\"\n end\nend", "def hash_start(food, quantity=1)\n\tgrocery_list = {}\n\n\tfood.split.each { |item| grocery_list[item] = quantity }\n\t\t\n\tgrocery_list\nend", "def bay_at_item(item) #finds the key of an item given the value (task 2)\n for hash in WAREHOUSE\n if hash.has_value?(item)\n return hash.key(item).to_s\n end\n end\nend", "def get_spicy_food_by_cuisine(spicy_foods, cuisine)\n spicy_foods.find { |spicy_food_hash| spicy_food_hash[:cuisine] == cuisine}\nend", "def bakery_num(num_of_people, fav_food)\n food_servings = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} # Initialize the food and the quantity \n fav_food_qty = food_servings[fav_food] \n \n raise ArgumentError.new(\"You can't make that food\") if !food_servings.has_key?(fav_food)\n \n if num_of_people % fav_food_qty == 0\n num_of_food = num_of_people / fav_food_qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n else \n food_qty = food_servings.clone\n # First make favorite food\n food_qty[fav_food] = num_of_people / food_servings[fav_food]\n num_of_people %= food_servings[fav_food]\n \tfood_servings.delete(fav_food)\t\t\n \t# Now servings for the rest\n food_servings.each_key do |key| \n break if num_of_people == 0 # this isn't really necessary with 3 keys, but with more it would be.\n food_qty[key] = num_of_people / food_servings[key]\n num_of_people %= food_servings[key]\n end\n return \"You need to make #{food_qty[\"pie\"]} pie(s), #{food_qty[\"cake\"]} cake(s), and #{food_qty[\"cookie\"]} cookie(s).\" # This prints the needed quantities\n end\nend", "def my_hash_finding_method(my_family_pets_ages, thing_to_find)\n my_family_pets_ages.select{|name, age| age == thing_to_find}.keys #for each name/age pair in the my_family_pets_ages hash, see if age is equal to the thing_to_find. If it is, add the name/age pair to a new hash. Then, .keys returns a new array of all the keys in that new hash.\nend", "def bakery_num(num_of_people, fav_food)\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1}\n quantity = {\"pie\" => 0, \"cake\" => 0, \"cookie\" => 0}\n raise ArgumentError.new(\"You can't make that food\") unless my_list.include?(fav_food)\n\n quantity[fav_food] = num_of_people / my_list[fav_food]\n remainder = num_of_people % my_list[fav_food]\n return \"You need to make #{quantity[fav_food]} #{fav_food}(s).\" if num_of_people % my_list[fav_food] == 0\n \n my_list.each do |k,v|\n next if remainder < v\n quantity[k] = (remainder / v)\n remainder = remainder % v\n end \n\n \"You need to make #{quantity[\"pie\"]} pie(s), #{quantity[\"cake\"]} cake(s), and #{quantity[\"cookie\"]} cookie(s).\"\nend", "def bakery_num(num_of_people, fav_food)\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} # create hash\n pie_qty = 0\n cake_qty = 0\n cookie_qty = 0\n\n raise ArgumentError.new(\"You can't make that food\") unless my_list.has_key?(fav_food)\n\n fav_food_qty = my_list.values_at(fav_food)[0] #create variable and set it to the my_list hash's value as an array\n\n if num_of_people % fav_food_qty == 0 #if num of people divides evenly by fav food quantity\n num_of_food = num_of_people / fav_food_qty #create new variable that is set to num of people divided by fav food qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n else num_of_people % fav_food_qty != 0 # if not evenly divided\n case fav_food\n when \"pie\"\n pie_qty = num_of_people / my_list[\"pie\"] # pie qty = 5\n num_of_people = num_of_people % my_list[\"pie\"] # num of people = 1\n cake_qty = num_of_people / my_list[\"cake\"]\n num_of_people = num_of_people % my_list[\"cake\"]\n cookie_qty = num_of_people\n when \"cake\"\n cake_qty = num_of_people / my_list[\"cake\"]\n num_of_people = num_of_people % my_list[\"cake\"]\n cookie_qty = num_of_people\n when \"cookie\"\n end\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\n end\nend", "def extract_ingredients(meal_data, main_ingredient)\n # if COUNTER < 100\n # result = []\n meal_data[\"meals\"].each do |meal|\n for i in 1..20 do\n if meal[\"strIngredient#{i}\"]\n if meal[\"strIngredient#{i}\"].downcase == main_ingredient.downcase\n puts meal\n end\n else\n get_recipes_from_api(main_ingredient)\n puts meal\n end\n end\n # if result.length == 0\n # get_recipes_from_api(main_ingredient)\n # end\n # # COUNTER += 1\n # # else\n # # p \"Sorry, can't find #{main_ingredient}\"\n # end\n # p result\nend\nend", "def food_list(list)\r\n\tfood_hash = {}\r\n\tfood_array = list.split(' ')\r\n\tfood_array.each do |food_item| \r\n\t\tfood_hash[food_item] = 1\r\n\tend\r\n\tfood_hash\r\nend", "def get_food(food)\n database.fetch(food, 'Key Not Found!')\n end", "def bakery_num(num_of_people, fav_food) \n serving_size = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} # establishes hash which describes serving size for each baked good\n quantity_needed = {\n \"pie\" => 0,\n \"cake\"=> 0,\n \"cookie\"=> 0\n }\n \n#\n if serving_size.has_key?(fav_food) == false\n raise ArgumentError.new(\"You can't make that food\")\n end\n\n if num_of_people > serving_size[fav_food]\n quantity_needed[fav_food] = num_of_people / serving_size[fav_food]\n num_of_people = num_of_people % serving_size[fav_food]\n end\n while num_of_people > 0\n if num_of_people / serving_size[\"pie\"] > 0 # if serving size of pie goes into number of people\n quantity_needed[\"pie\"] += num_of_people / serving_size[\"pie\"] # determines how many pies to make\n num_of_people = num_of_people % serving_size[\"pie\"] # how many people are left hungry\n elsif num_of_people / serving_size[\"cake\"] > 0 # takes new number of hungry people\n quantity_needed[\"cake\"] += num_of_people / serving_size[\"cake\"]\n num_of_people = num_of_people % serving_size[\"cake\"] # finds new value of remaining hungry people\n else\n quantity_needed[\"cookie\"] = num_of_people # everybody else gets cookies\n num_of_people = 0 # everybody has received something; while loop ends\n end\n end\n return \"You need to make #{quantity_needed[\"pie\"]} pie(s), #{quantity_needed[\"cake\"]} cake(s), and #{quantity_needed[\"cookie\"]} cookie(s).\" # returns quantities of baked goods we need to make in a string\n \n\nend", "def bakery_num(num_of_people, fav_food) \n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} \n pie_qty = 0\n cake_qty = 0\n cookie_qty = 0\n \n raise ArgumentError.new(\"You can't make that food\") unless my_list.has_key?(fav_food)\n\n fav_food_qty = my_list[fav_food] \n if num_of_people % fav_food_qty == 0 \n num_of_food = num_of_people / fav_food_qty\n return \"You need to make #{num_of_food} #{fav_food}(s).\"\n else \n while num_of_people > 0\t\n pie_qty = num_of_people / my_list[\"pie\"] unless fav_food == \"cake\"\n num_of_people = num_of_people % my_list[\"pie\"] unless fav_food == \"cake\"\n cake_qty = num_of_people / my_list[\"cake\"]\n num_of_people = num_of_people % my_list[\"cake\"]\n cookie_qty = num_of_people\n num_of_people = 0\n end\n end\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\nend", "def finder(order_meal)\n result = Hash.new \n meals = order_meal.meals\n @restaurants.reverse_each do |restaurant|\n restaurant_temp = restaurant\n meals.keys.each do |name|\n if ( restaurant.meals[name] && restaurant_temp.meals[name].quantity > 0 )\n if ( meals[name].quantity <= restaurant_temp.meals[name].quantity ) \n result[restaurant_temp.name] = Hash.new unless result[restaurant_temp.name]\n result[restaurant_temp.name][name] = meals[name].quantity\n restaurant_temp.meals[name].remove_qty(meals[name].quantity)\n else\n result[restaurant_temp.name] = Hash.new unless result[restaurant_temp.name]\n result[restaurant_temp.name][name] = restaurant_temp.meals[name].quantity\n meals[name].remove_qty(restaurant_temp.meals[name].quantity)\n end\n end\n end\n end\n\n result\n end", "def bakery_num(num_of_people, fav_food)\n # Hash to show the serving zise of each food item \n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1}\n # Raise an error if fav_food is not one of my_list\n raise ArgumentError.new(\"You can't make that food\") if my_list[fav_food].nil?\n # Initialize each quantity at zero\n supplies = { \"pie\" => 0,\n \"cake\" => 0,\n \"cookie\" => 0}\n \n left_over = num_of_people % my_list[fav_food]\n supplies[fav_food] = num_of_people/my_list[fav_food]\n if left_over == 0\n \"You need to make #{supplies[fav_food]} #{fav_food}(s).\"\n else \n my_list.each do |k, v|\n if left_over >= v \n supplies[k] = left_over / v\n left_over = left_over % v\n end\n end\n return \"You need to make #{supplies['pie']} pie(s), #{supplies['cake']} cake(s), and #{supplies['cookie']} cookie(s).\"\n end\nend", "def bakery_num(num_of_people, fav_food)\n # Hash to show the serving zise of each food item \n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1}\n # Raise an error if fav_food is not one of my_list\n raise ArgumentError.new(\"You can't make that food\") if my_list[fav_food].nil?\n # Initialize each quantity at zero\n supplies = { \"pie\" => 0,\n \t\t\t \"cake\" => 0,\n \t\t\t \"cookie\" => 0 }\n \n left_over = num_of_people % my_list[fav_food]\n supplies[fav_food] = num_of_people/my_list[fav_food]\n if left_over == 0\n \"You need to make #{supplies[fav_food]} #{fav_food}(s).\"\n else \n my_list.each do |k, v|\n if left_over >= v \n supplies[k] = left_over / v\n left_over = left_over % v\n end\n end\n return \"You need to make #{supplies['pie']} pie(s), #{supplies['cake']} cake(s), and #{supplies['cookie']} cookie(s).\"\n end\nend", "def bakery_num(num_of_people, fav_food) # creating method bakery_num\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1} #creating hash. value of keys equals servings per person\n pie_qty = 0\n cake_qty = 0\n cookie_qty = 0\n dessert_array = Array.new\n has_fave = false \n\n my_list.each_key do |k| #iterates each key in the hash my_list\n if k == fav_food # making a comparison of each key in hash\n has_fave = true # gives a true value to fave_food\n #fav_food = k #fav_food is set to the value of the key ***** Redundant assignment, line deleted.\n end\n end\n\n if has_fave == false #if has_fave is false\n raise ArgumentError.new(\"You can't make that food\") #makes a new error to say that we cannot make that food because we have the incorrect arguements\n else\n fav_food_qty = my_list[fav_food] #creating a variable that, through the values method, returns an array made up by the value of the key established at fav_food \n if num_of_people % fav_food_qty == 0 #if theres no remainder in num_of_people divided fav_food_quantity\n num_of_food = num_of_people / fav_food_qty #creating num_of_food variable that gives us how many food items we should make\n return \"You need to make #{num_of_food} #{fav_food}(s).\" # returns string \n else #if there is a remainder \n while num_of_people > 0\n #\n my_list.each do |k,v|\n dessert_qty = num_of_people / v\n num_of_people = num_of_people % v\n dessert_array << dessert_qty \n end\n \n #\n # if num_of_people / my_list[\"pie\"] > 0 # if num_of_people divided by number of servings of pie is greather than zero\n # pie_qty = num_of_people / my_list[\"pie\"] # pie_qty equals num_of_people divided by servings of pie\n # num_of_people = num_of_people % my_list[\"pie\"] # num_of_people equals the remainder of num_of_people and servings of pie\n # elsif num_of_people / my_list[\"cake\"] > 0 #repetition of first set of conditions of pie\n # cake_qty = num_of_people / my_list[\"cake\"]\n # num_of_people = num_of_people % my_list[\"cake\"]\n # else\n # cookie_qty = num_of_people / my_list[\"cookie\"] \n # num_of_people = num_of_people % my_list[\"cookie\"] # so we don't have an infinite loop\n # end\n end\n return \"You need to make #{dessert_array[0]} pie(s), #{dessert_array[1]} cake(s), and #{dessert_array[2]} cookie(s).\"\n end\n end\nend", "def is_fav_food(person, test_food)\n fav_snacks = person[:favourites][:snacks]\n for snack in fav_snacks\n if snack == test_food\n return true\n end\n end\n return false\nend", "def find_pet_by_name(shop_hash, pet_name)\n for pet_hash in shop_hash[:pets]\n if pet_hash[:name] == pet_name\n return pet_hash\n end\n end\n # if no matches, we expect a program to return nil.\n return nil\nend", "def bakery_num(num_of_people, fav_food)\n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1}\n\n raise ArgumentError.new(\"You can't make that food\") unless my_list.has_key?(fav_food)\n \n return \"You need to make #{num_of_people / my_list[fav_food]} #{fav_food}(s).\" if num_of_people % my_list[fav_food] == 0\n return \"You need to make 0 pie(s), 0 cake(s), and #{num_of_people} cookie(s).\" if fav_food == \"cookie\"\n return \"You need to make #{num_of_people / my_list[fav_food]} pie(s), 0 cake(s), and #{num_of_people % my_list[fav_food]} cookie(s).\" if fav_food == \"pie\"\n return \"You need to make 0 pie(s), #{num_of_people / my_list[fav_food]} cake(s), and #{num_of_people % my_list[fav_food]} cookie(s).\" if fav_food == \"cake\"\n \nend", "def bakery_num(num_of_people, fav_food)\n \n my_list = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1}\n pie_qty = 0\n cake_qty = 0\n cookie_qty = 0\n \n unless my_list.has_key?(fav_food)\n raise ArgumentError.new(\"You can't make that food\")\n else\n\treturn \"You need to make #{num_of_people / my_list[fav_food]} #{fav_food}(s).\" if num_of_people % my_list[fav_food] == 0\n \n if fav_food == \"pie\"\n \tpie_qty = num_of_people/my_list[\"pie\"]\n \tnum_of_people = num_of_people % my_list[\"pie\"]\n \tcake_qty = num_of_people / my_list[\"cake\"]\n \tnum_of_people = num_of_people % my_list[\"cake\"]\n else \n \tcake_qty = num_of_people/my_list[\"cake\"]\n \tnum_of_people = num_of_people % my_list[\"cake\"]\n \tpie_qty = num_of_people / my_list[\"pie\"]\n \tnum_of_people = num_of_people % my_list[\"pie\"]\n end\n \n cookie_qty = num_of_people\n return \"You need to make #{pie_qty} pie(s), #{cake_qty} cake(s), and #{cookie_qty} cookie(s).\"\n \n end\nend", "def find_the_cheese(foods)\n foods.find{ |cheese| cheese == \"cheddar\" || cheese == \"gouda\" || cheese ==\n \"camembert\"}\nend", "def likes_to_eat(person, food)\n\n for x in person[:favourites][:snacks]\n if x == food\n return true\n end\n end\n return false\nend", "def bakery_num(people, food) \n menu = {\"pie\" => 8, \"cake\" => 6, \"cookie\" => 1}\n qty = {\"pie\" => 0, \"cake\" => 0, \"cookie\" => 0}\n \n raise ArgumentError.new(\"You can't make that food\") if menu.has_key?(food) == false\n\n if people % menu[food] == 0 \n food_qty = people / menu[food]\n \"You need to make #{food_qty} #{food}(s).\"\n else\n while people > 0 \n if people / menu[\"pie\"] > 0 \n qty[\"pie\"] = people / menu[\"pie\"]\n people = people % menu[\"pie\"]\n elsif people / menu[\"cake\"] > 0\n qty[\"cake\"] = people / menu[\"cake\"]\n people = people % menu[\"cake\"]\n else\n qty[\"cookie\"] = people\n people = 0\n end\n end\n \"You need to make #{qty[\"pie\"]} pie(s), #{qty[\"cake\"]} cake(s), and #{qty[\"cookie\"]} cookie(s).\"\n end\t\nend", "def find_pet_by_name(pet_shop,name)\n # name_hash = Hash.new\n for pet in pet_shop[:pets]\n if pet[:name] == name \n return pet\n end\n end\n\n return nil\nend", "def total_hash_search(hash_to_find=@hash_to_find, stop_on_success=@sos, verbose=true)\n matches={}\n while(true)\n case @hash_type\n when 'MD4'\n result = leakdb_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('api.leakdb.abusix.com', result)\n break if stop_on_success\n end\n when 'MD5'\n result = leakdb_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('api.leakdb.abusix.com', result)\n break if stop_on_success\n end\n\n result = darkbyte_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('md5.darkbyte.ru', result)\n break if stop_on_success\n end\n\n result = gromweb_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('md5.gromweb.com', result)\n break if stop_on_success\n end\n\n result = md5comcn_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('md5.com.cn', result)\n break if stop_on_success\n end\n\n result = md5onlinenet_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('md5online.net', result)\n break if stop_on_success\n end\n\n result = md5onlineorg_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('md5online.org', result)\n break if stop_on_success\n end\n\n result = myaddr_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('md5.my-addr.com', result)\n break if stop_on_success\n end\n\n result = noisette_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('md5.noisette.ch', result)\n break if stop_on_success\n end\n\n result = netmd5crack_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('netmd5crack.com', result)\n break if stop_on_success\n end\n\n result = sans_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('isc.sans.edu', result)\n break if stop_on_success\n end\n\n result = stringfunction_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('stringfunction.com', result)\n break if stop_on_success\n end\n when 'LM'\n result = it64_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('rainbowtables.it64.com', result)\n break if stop_on_success\n end\n\n result = leakdb_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('api.leakdb.abusix.com', result)\n break if stop_on_success\n end\n when 'NTLM'\n result = leakdb_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('api.leakdb.abusix.com', result)\n break if stop_on_success\n end\n when 'LM:NTLM'\n result = leakdb_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('api.leakdb.abusix.com', result)\n break if stop_on_success\n end\n when 'MYSQL'\n result = leakdb_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('api.leakdb.abusix.com', result)\n break if stop_on_success\n end\n when 'SHA1'\n result = leakdb_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('api.leakdb.abusix.com', result)\n break if stop_on_success\n end\n\n result = sans_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('isc.sans.edu', result)\n break if stop_on_success\n end\n\n result = stringfunction_hash_search(hash_to_find, verbose)\n if not result.nil?\n matches.store('stringfunction.com', result)\n break if stop_on_success\n end\n end\n break # tried all sites by now...\n end\n return matches\n end", "def favourite_food name\r\n\tif name == \"Lister\"\r\n\t\treturn \"vindaloo\"\r\n\tend\r\n\r\n\tif name == \"Rimmer\"\r\n\t\treturn \"mashed potatoes\"\r\n\tend\r\n\r\n\t\"hard to say...maybe fired plantain?\"\r\nend", "def find(word, list)\n\n for value in list do\n\n if (value == word)\n\n\treturn true\n end\n\n return false\n\nend\n\nputs find(\"one\", [\"three\", \"two\", \"one\"])\t# => true\nputs find(\"four\", [\"three\", \"two\", \"one\"])\t# => false\n\n# 2. Write a method with a loop that checks an array of strings for a word\n# The method returns the index of the word if it is found or nil if it is not found.\n\ndef find_index(word, list)\n \n index = 0\n\n while index < list.length do\n\n if (list[index] == word)\n\t\n return index\n index += 1\n end\n end\n\n return nil\nend\n\nputs find_index(\"one\", [\"three\", \"two\", \"one\"]) \t# => 2\nputs find_index(\"four\", [\"three\", \"two\", \"one\"])\t# => nil\n\n# 3. Write a method with a loop that checks a hash for a value\n# The method returns the key if the value is found, or nil if it is not found\n\ndef find_key(value, items) \n items.each do |key, val| \n \n if (value == val)\n\n \treturn key\n end\n end\n\n return nil\nend\n\nputs find_key(\"red\", {\"colour\": \"red\", \"qty\": 3, \"desc\": \"red bow\"} \t# => \"colour\"\nputs find_key(\"blue\", {\"colour\": \"red\", \"qty\": 3, \"desc\": \"red bow\"}\t# => nil\n\n# 4. Answer these questions without running the following code. \n# After you can check your answers by running the code:\n# - What data type is arg1? array\n# - What does the following code do? defines a method that for each thing in arg1 return thing until thing is greater than 10 at that point end.\n\ndef mystery(arg1)\n arg1.each do |thing|\n if thing > 10\n return thing\n end\n end\nend\nputs mystery([1,3,5])\n# 5. Answer these questions without running the following code. \n# After you can check your answers by running the code:\n# - What data type is arg1? object\n# - What data type is arg2? object\n# - What does this code do? defines a method that returns the index when \n# - This code has a problem - what is it? \n# - How would you fix the problem?\n\ndef loopy(arg1, arg2)\n index = 0\n while index > arg1.length do\n if arg1[index] == arg2\n\treturn index\n end\n end\nend", "def find_pet_by_name(shop_hash, name_of_pet)\n for pet in shop_hash[:pets]\n if (pet[:name] == name_of_pet)\n return pet\n end\n end\n return nil\nend", "def suggestion_maker(item_hash, num_remainder, count=0)\n count += 1\n if num_remainder == 0\n return\n else\n if item_hash.has_value?(num_remainder)\n return item_hash.key(num_remainder), count\n else\n return suggestion_maker(item_hash, num_remainder - 1, count)\n end\n end\nend", "def find_single_item(hash,lookup)\n if hash[lookup]==nil\n return nil\n else\n return hash[lookup][:item]\n end\nend", "def recipe_counter(item_to_make, available_ingredients)\n # Initialize the library hash of items we are making and the quantities neccesary to make them as the value\n # set error_counter to 3\n \n bakery_items = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7} \n # error_counter = 3\n\n \n # my_hash.keys => [\"apples\", \"banana\"]\n # my_hash.keys.include?\n # my_hash.include?\n \n unless bakery_items.include? item_to_make\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n # SETS SERVING SIZE EQUAL TO THE VALUE OF THE ITEM\n ingredients_needed = bakery_items[item_to_make]\n #SETS REMAINING INGREDIENTS TO WHATS LEFTOVER THAT DOESN'T MAKE A WHOLE OF THE ITEM\n remaining_ingredients = available_ingredients % ingredients_needed\n \n\n # IF THERE IS A REMAINDER IT RETURNS THE COUNT OF MADE ITEMS AND SUGGESTS A NEW FEATURE \n # IF THE REMAINDER IS ZERO IT JUST RETURNS THE ITEM MADE AND THE COUNT\n \n return_string = \"Calculations complete: Make #{available_ingredients / ingredients_needed} of #{item_to_make}.\"\n \n # unless remaining_ingredients == 0\n # suggested_items = \"\"\n # count_of_cakes = 0\n # count_of_cookies = 0\n # until remaining_ingredients >= 5\n # count_of_cakes += 1\n # remaining_ingredients -= 5\n # end\n # if count_of_cakes > 0\n # end \n # end\n \n \n \n \n# results_hash\n# suggested_baking_items = {}\n \n# bakery_items.each do |food, ingredients_needed|\n# suggested_baking_items[food] = 0\n# # Logic here to see if we can make any of the current food.\n# end\n \n# suggested_baking_items.each do |item|\n# if item.qty > 0 \n# return_string += \"2 cakes\"\n# end\n# end\n \n \n \n # end\n \n \n \n \n # If there are enough ingredients to make a pie\n # make pies, subtract from ingredients\n # If there are enough to make at least 1 cake\n # make cakes, subtract ingredients\n # same thing with cookies....\n \n \n \n unless remaining_ingredients == 0\n return_string += \" You have #{remaining_ingredients} leftover ingredients. Suggested baking items: ADD CODE\"\n end\n \n return return_string\n \n \n # if remaining_ingredients\n # return \"Calculations complete: Make #{available_ingredients / ingredients_needed} of #{item_to_make}\"\n # else\n # return \"Calculations complete: Make #{available_ingredients / ingredients_needed} of #{item_to_make}, you have #{remaining_ingredients} leftover ingredients. Suggested baking items: TODO: MAKE THIS FEATURE\"\n # end\nend", "def my_hash_finding_method(source, thing_to_find)\n final_answer = source.select{|key, value| value == thing_to_find}\n p final_answer.keys\nend", "def my_hash_finding_method(source, thing_to_find)\n final_answer = source.select{|key, value| value == thing_to_find}\n p final_answer.keys\nend", "def find_key(value, items) \n items.each do |key, val| \n \n if (value == val)\n\n \treturn key\n end\n end\n\n return nil\nend", "def find_the_cheese(food)\n cheese_types = [\"cheddar\", \"gouda\", \"camembert\"]\n food.find do |item|\n cheese_types.find do |cheese|\n item == cheese\n end\n end\nend", "def might_be_extinct(hash, string)\n is_It = \"This animal is NOT extinct.\"\n hash.each do |animal, year|\n if string == animal\n is_It = \"This animal is extinct...\"\n end\n end\n is_It\nend", "def refine_food(food) \n case food[\"type\"]\n when /coffee/i\n food[\"category\"] = \"coffee\"\n when /bar/i\n food[\"category\"] = \"bar\"\n when /thai/i\n food[\"category\"] << \"thai\"\n food[\"type\"] = \"thai restaurant\"\n when /indian|curry/i\n food[\"category\"] << \"indpak\"\n when /french|france/i\n food[\"category\"] << \"french\"\n food[\"type\"] =\"french restaurant\"\n when /ital(ian|y)/i\n food[\"category\"] << \"italian\"\n food[\"type\"] = \"italian restaurant\"\n when /fish|seafood/i\n if (food[\"type\"] =~ /chips/i)\n then food[\"category\"] << \"fishnchips\"\n else\n food[\"category\"] << \"seafood\"\n food[\"type\"] = \"fish restaurant\"\n end\n end\n return food\n end", "def meal_generator(food)\n food\nend", "def my_hash_finding_method(source, thing_to_find)\n answer = Hash.new\n source.each do |key, value|\n if value == thing_to_find\n answer.store(key, value)\n end\n end\n p answer.keys\nend", "def pets_by_breed(shop_hash, breed)\n pets_found = []\n for pet_hash in shop_hash[:pets]\n if pet_hash[:breed] == breed\n pets_found.push(breed)\n end\n end\n return pets_found\nend", "def print_result(result)\n puts \"The result of the meal finder is: \"\n result.keys.each do |restaurant|\n puts \"Restaurant: #{restaurant}\"\n result[restaurant].keys.each do |meal|\n puts \"\\t #{meal} #{result[restaurant][meal]}\"\n end\n end\n return\n end", "def find_match_in_file(data_hash, key_str, search_str)\n \tmatching_obj = {}\n \tdata_hash.each do |key, value|\n \t\tkey.each do |innerkey, innervalue|\n\t\t\tif (find_match(innerkey, innervalue, key_str, search_str))\n\t\t\t\treturn key\n\t\t\tend\n\n \t\tend\n\tend\n\tnil\n end", "def find_pet_by_name(pet_shop,pet_name)\n #if pet matches a name in the hash\n #return the hash of information\n match = nil\n for pet in pet_shop[:pets]\n match = pet if(pet[:name] == pet_name)\n end\n return match\n end", "def favourite_foods(person, food)\n return person[:favourites][:things_to_eat].include?(food)\nend", "def food_tastes(person, food)\n return person[:favourites][:things_to_eat].include?(food)\nend", "def vegetarian_ingredients\n{\n :sweets => [\"soda\", \"candy\", \"potato chips\"],\n :protein => {\n :other => [\"nuts\", \"beans\"]\n },\n :dairy => [\"milk\", \"yogurt\", \"cheese\"],\n :fruits => [\"bananas\", \"oranges\", \"apples\", \"grapes\"],\n :vegetables => [\"cabbage\", \"broccoli\", \"tomatoes\", \"carrots\"],\n :grains => [\"crackers\", \"rice\", \"bread\", \"pasta\", \"cereal\"]\n}\nend", "def favorite_food name\n\tif name == \"Lister\"\n\t\treturn \"vindaloo\"\n\tend\n\n\tif name == \"Rimmer\"\n\t\treturn \"mashed potatoes\"\n\tend\n\n\t\"hard to say...maybe fried plantain?\"\nend", "def find_ingredient(ingredient_name)\n ingredients[ingredient_name]\n end", "def likes_to_eat(person, food)\nreturn person[:favourites][:snacks].include?(food)\nend", "def find_pet_by_name(pet_shop, name)\n pet_by_name = nil #this set the bucket as empty until the arguement\n #is returned as true.\n for pet in pet_shop[:pets]\n pet_by_name = pet if pet[:name]==name\n end\nreturn pet_by_name\n\nend", "def my_hash_finding_method(source, thing_to_find)\n output_array = []\n i = 0\n source.each_pair { |key,value|\n if value == thing_to_find\n output_array[i] = key\n i += 1\n end\n }\n return output_array\nend", "def product_to_bay(ref_hash, item_string)\n key = ref_hash.key(item_string)\n return key\nend", "def favorite_food name\n\tif name == 'Lister'\n\t\treturn 'vindaloo'\n\tend\n\n\tif name == 'Rimmer'\n\t\treturn 'mashed potatoes'\n\tend\n\n\t'hard to say...maybe fried plantain?'\nend", "def favorite_food name\n\tif name == 'Lister'\n\t\treturn 'vindaloo'\n\tend\n\n\tif name == 'Rimmer'\n\t\treturn 'mashed potatoes'\n\tend\n\n\t'hard to say...maybe fried plantain?'\nend", "def find_the_cheese(ingredients)\n cheese_types = [\"cheddar\", \"gouda\", \"camembert\"]\n ingredients.detect {|item| cheese_types.include?(item)}\n #ingredients.find {|item| cheese_types.include?(item)}\n #ingredients.each {|item| return item if cheese_types.include?(item)}\n #else\n #return nil\nend", "def select_fruit(produce_list)\n produce_keys = produce_list.keys\n counter = 0\n selected_fruits = {}\n\n loop do\n # this has to be at the top in case produce_list is empty hash\n break if counter == produce_keys.size\n\n current_key = produce_keys[counter]\n current_value = produce_list[current_key] #iterating through the keys to get value\n\n if current_value == 'Fruit'\n selected_fruits[current_key] = current_value\n end\n\n counter += 1\n end\n\n selected_fruits\nend", "def find_mached_recipe(fridge)\r\n system \"clear\"\r\nrecipes_you_can_make = []\r\nrecipe_count = 1\r\n fridge.recipes.each do |recipe|\r\n if recipe.ingredients & fridge.what_you_have.map(&:name) == recipe.ingredients\r\n recipes_you_can_make << recipe\r\n recipe_count += 1\r\n end #if end\r\n end # fridge.recipes.each end\r\n if recipe_count ==1\r\n puts \"Nothing! You better go out and get some food.\"\r\n sleep 2\r\n abort\r\n else\r\n puts \"Thank you! You can make these Japanese food\"\r\n end # if end\r\n recipes_you_can_make\r\nend", "def return_item_from_bay(user_input_raw, input_hash)\n user_input_sym = user_input_raw.to_sym\n if input_hash.key?(user_input_sym)\n then return input_hash[user_input_sym]\n else\n print 'No such bay found'\n end\n end", "def find_the_cheese(food)\n cheese_types = [\"cheddar\", \"gouda\", \"camembert\"]\n food.find do |item|\n cheese_types.include?(item)\n end\n end", "def findPrint(prefix)\n @BasicHash.each do |key, value|\n basicfood = @BasicHash[key]\n # if the name of the food matches the prefix\n # print the requested food\n if basicfood.name.downcase.start_with?(prefix.downcase)\n basicfood = @BasicHash[key]\n puts \"#{basicfood.name} #{basicfood.calories} \"\n end\n end\n @RecipeHash.each do |key, value|\n myrecipe = @RecipeHash[key]\n # if the name of the food matches the prefix\n # print the requested food\n if myrecipe.name.downcase.start_with?(prefix.downcase)\n recipePrintHelper(key)\n end\n end\n #else case, if it can't find the food its looking for\n #puts \"Can't find the food starting with '#{prefix}'\"\n end", "def addRecipe(name, ingredients)\n calories = 0\n keys = @BasicHash.keys\n ingredients.each do |ingredient|\n ingredient.chomp!\n # if the ingredient is in the basicFood\n if @BasicHash.has_key? ingredient\n calories += @BasicHash[ingredient].calories.to_i\n else\n puts \"Can't find the ingredient\"\n puts \"#{ingredient}\"\n end\n #Making recipe object and adding it to the hash\n myrecipes = Recipe.new(name, ingredients, calories)\n @RecipeHash[name] = myrecipes\n end\n end", "def animal_hash\n hash = Hash.new\n\n @inventory.each do |animal|\n first_letter = animal.kind[0]\n if hash[first_letter]\n hash[first_letter] << animal\n else\n hash[first_letter] = [animal]\n end\n hash\n end\n\nend", "def my_hash_finding_method(source, thing_to_find)\n solution = source.select { |key, value| value == thing_to_find }\n solution.keys\nend", "def serving_size_calc(item_to_make, num_of_ingredients)\n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n # defining a method that takes 2 arguments and compares them to an existing hash library\n# error counter = 3\n \n unless library.has_key?(item_to_make)\n raise ArgumentError.new(\"{#item_to_make} is not a valid input\")\n end\n\n serving_size = library[item_to_make]\n remaining_ingredients = num_of_ingredients % serving_size\n suggested_portion = num_of_ingredients / serving_size\n suggested_item = []\n\n if remaining_ingredients > 0\n library.each { |key, value| suggested_item.push(key) if value <= remaining_ingredients}\n end\n \n #key(remaining_ingredients)\n# when the remaining ingredients are equal to zero, the method returns the amount to make.\n \n# when the remaining ingredients is not equal to zero, the method returns the amount to make and the leftover ingredients. Also, there should be a feature that tells you what to make with the leftover ingredients.\n \n \n if remaining_ingredients == 0\n return \"Calculations complete: Make #{suggested_portion} of #{item_to_make}\"\n else\n return \"Calculations complete: Make #{suggested_portion} of #{item_to_make}, you have #{remaining_ingredients} leftover ingredients. Suggested baking items: #{suggested_item.join(\", \")}\" \n end\nend", "def get_occupation(data, hometown)\n # code here\n occupation = nil \n data.each do |key1, value1|\n value1.each do |key_value_pair|\n if key_value_pair[\"hometown\"] == hometown\n occupation = key_value_pair[\"occupation\"]\n break\n end\n end\n end\n occupation\nend", "def create_hash(items, default_qty = 0)\n groceries = {}\n items.split.each { |food| groceries[food] = default_qty }\n groceries \nend", "def find_item_by_name_in_collection(name, collection)\n i = 0\n while i < collection.length do\n item_hash = collection[i]\n item_hash[:item] == name ? (return item_hash) : nil\n i += 1\n end\nend", "def identify_mano(str_log)\r\n @log.debug \"identify_mano #{str_log}\"\r\n ix = 0\r\n @mano_coll.each do |item|\r\n item[:data].each do |data_item|\r\n #p data_item\r\n if data_item =~ /#{str_log}/\r\n @log.debug \"Found item requested on mano: #{ix}, #{item}\"\r\n #p item\r\n return ix\r\n end\r\n end\r\n ix += 1\r\n end\r\n ix = -1\r\n return ix\r\n end", "def find_the_cheese(foodstuffs)\n cheese_types = [\"cheddar\", \"gouda\", \"camembert\"]\n foodstuffs.find do |cheese|\n if cheese_types.include?(cheese)\n return cheese\n end\nend\nend", "def select_fruit(produce_list)\r\n produce_keys = produce_list.keys\r\n counter = 0\r\n selected_fruits = {}\r\n\r\n loop do\r\n # this has to be at the top in case produce_list is empty hash\r\n break if counter == produce_keys.size\r\n\r\n current_key = produce_keys[counter]\r\n current_value = produce_list[current_key]\r\n\r\n if current_value == 'Fruit'\r\n selected_fruits[current_key] = current_value\r\n end\r\n\r\n counter += 1\r\n end\r\n\r\n selected_fruits\r\nend", "def search_by_meat\n choice_of_meat = display_choices('What meat would you like?',($default_recipe.recipe_name_and_meats.values.uniq << 'Previous Page'))\n return level_2_option_1 if choice_of_meat == 'Previous Page'\n choices = $default_recipe.recipe_name_and_meats.filter{|k,v|v == choice_of_meat}.keys << 'Previous Page'\n recipe_choice = display_choices(\"List of Dish that can be made from #{choice_of_meat} meat : \",choices)\n return search_by_meat if recipe_choice == 'Previous Page'\n display_ing_and_method(recipe_choice)\nend", "def func_find(hash)\n # Check and return the first object that satisfies either of the following properties:\n # 1. There is a [key, value] pair where the key and value are both Integers and the value is < 20\n # 2. There is a [key, value] pair where the key and value are both Strings and the value starts with `a`.\n hash.find do |key, value|\n if key.is_a?(Integer) && value.is_a?(Integer)\n return [key, value] if value < 20\n end\n\n if key.is_a?(String) && value.is_a?(String)\n return [key, value] if value[0].eql?('a')\n end\n\n []\n end\nend", "def find_pet_by_name(petshop,pet_name)\n petshop[:pets].each do \n if pet_hash[:name] == pet_name\n return pet_hash\n end\n end\n return nil\n end", "def find(prefix)\n # Iterate over BasicFoods for prefix\n @basic_foods.keys.each do |name|\n if name.downcase.start_with? prefix.downcase # convert both to downcase as case insensitive\n print(name)\n end\n end\n # Iterate over Recipes for prefix\n @recipes.keys.each do |name|\n if name.downcase.start_with? prefix.downcase # convert both to downcase as case insensitive\n print(name)\n end\n end\n end", "def bakery_num(servings, favorite_food)\n raise ArgumentError, \"You can't make that food\" unless TREAT_SERVINGS.key?(favorite_food)\n\n #instead of initializing them individually, we cna put it into a hash and easily associate with the servings hash\n order_quantity = {\"pie\" => 0, \"cake\" => 0, \"cookie\" => 0}\n fave_food_servings = TREAT_SERVINGS[favorite_food]\n\n if servings % fave_food_servings == 0\n return \"You need to make #{servings/fave_food_servings} #{favorite_food}(s).\"\n end\n\n # we know that we'll only have to fill the order with foods that have serving sizes of \n # equal to or less than favorite_food. so, if the constant TREAT_SERVINGS is always in \n # order by most servings : least_servings, this should return\n # an array of the treats that will potentially be part of the order\n foods = TREAT_SERVINGS.keys.drop_while {|food| food != favorite_food}\n\n # take_while will continue iterating until it evaluates to false or nil\n # so the last line in the block is asking if servings still have to be allocated\n foods.take_while do |food|\n order_quantity[food] = servings / TREAT_SERVINGS[food]\n servings %= TREAT_SERVINGS[food]\n end\n\n \"You need to make #{order_quantity[\"pie\"]} pie(s), #{order_quantity[\"cake\"]} cake(s), and #{order_quantity[\"cookie\"]} cookie(s).\"\nend", "def find_multiple_items_and_distance(hash,bay_array)\n\n #Step 1 - get the list of items for the bays\n items = find_multiple_items(hash,bay_array)\n \n #Step 2 - work out distance between furthest bays\n \n #Start by getting the position of the first bay\n #and assign this to nearest and furthest\n nearest_location=hash[bay_array[0]][:position]\n furthest_location=hash[bay_array[0]][:position]\n\n #Then look at all the other bays and work\n #out the one that is closest and one furthest \n for value in bay_array\n if hash[value][:position]>furthest_location\n furthest_location = hash[value][:position]\n end\n if hash[value][:position]<nearest_location\n nearest_location = hash[value][:position]\n end\n\n end\n distance = furthest_location-nearest_location\n return {:items=>items,:distance=>distance}\nend", "def find_the_cheese(strings)\n cheese_types = [\"cheddar\", \"gouda\", \"camembert\"]\n strings.find do |ingredient|\n cheese_types.include?(ingredient)\n end \nend", "def add_item_to_grocery_hash(item_string, grocery_hash, quantity)\n if !grocery_hash.include?(item_string.to_sym) # item_string is not in grocery_hash\n grocery_hash[item_string.to_sym] = quantity\n print_grocery_hash(grocery_hash)\n else\n update_quantity_of_item(grocery_hash[item_string.to_sym] + quantity, item_string, grocery_hash)\n end\nend", "def yummy(foods)\n delicious_foods = []\n foods.each do |key,value| \n if value == \"delicious\"\n delicious_foods << key\n else \n foods.delete(key)\n end\n end\n the_good_food = delicious_foods.join(\", \")\nend", "def serving_size_calc(item_to_make, num_of_ingredients)\n ingredients_per_dish = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n\n # Checks if item exists in library. If it doesn't, raise an Argument Error\n # Refactor: Change error check to includes?\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\") unless ingredients_per_dish.include?(item_to_make)\n# error_counter = 3\n\n# ingredients_per_dish.each do |dish|\n# if ingredients_per_dish[dish] != ingredients_per_dish[item_to_make]\n\n# error_counter += -1\n# end\n# end\n\n# if error_counter > 0\n# raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n# end\n # Refactor: change to just calling the value of the key (item_to_make)\n serving_size = ingredients_per_dish[item_to_make]\n # Where have you see [0] before?\n # - Arrays\n\n # my_array[0] => returns first element in the array.\n\n # Can you have duplicate keys in a hash?\n # - no\n # Therefore we will always have a single element array\n\n # [\"apple\"][0] => \"apple\"\n # [5][0] => 5\n\n # So essentially what this is doing, is converting the single element array into an integer.\n\n # Figures out how many times number of ingredients goes into Serving size\n # If there is a remainder include that on leftover ingredients\n #\n leftover_ingredients = num_of_ingredients % serving_size\n # Refactor to IF, move duplicate first sentence outside of if statement.\n # If remainder then add to return string.\n\n# return_string = \"xyz\"\n\n# if something_is_true\n# return_string += \"additional\"\n# end\n\n# return return_string\n\n return_string = \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}.\"\n return_string += \"You have #{leftover_ingredients} leftover ingredients. Suggested baking: #{leftover_ingredients} cookies.\" if leftover_ingredients > 0\n return_string\n\n# case leftover_ingredients\n# when 0\n\n# return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}\"\n# else\n# return \"Calculations complete: Make #{num_of_ingredients / serving_size} of #{item_to_make}, you have #{leftover_ingredients} leftover ingredients.\" # Suggested baking items: TODO: MAKE THIS FEATURE\"\n# end\nend", "def test_by_allergy(allergies)\n score = 0\n allergies.each do |allergy| \n score += $all_allergies[allergy.to_sym] if $all_allergies.keys.include?(allergy.to_sym)\n end\n score\nend", "def printSearchedListContainsKeywordOrNot(itemHash,keyword)\n keywordNotFound = Array.new()\n countFound = 0 # count for found keyword in the item.\n countNotFound = 0 # count for not found keyword in the item.\n itemHash.map do |item|\n # puts item # print the item .\n if (item[:name].downcase.include? (keyword.downcase))\n begin\n KeywordFound[countFound]={name: item[:name],Attribute: 'name'}\n countFound = countFound + 1\n end # check presence in the name.\n else\n if (item[:title].downcase.include? (keyword.downcase))\n begin\n KeywordFound[countFound]={name: item[:name],Attribute:'title'}\n countFound = countFound + 1\n end # check presence in the title.\n else\n if (item[:specialization].downcase.include? (keyword.downcase))\n begin\n KeywordFound[countFound]={name: item[:name],Attribute:'specialization'}\n countFound = countFound + 1\n end # check presence in the specialization.\n else\n if (item[:about].downcase.include? (keyword.downcase))\n begin\n KeywordFound[countFound]={name: item[:name],Attribute:'about'}\n countFound = countFound + 1\n end # check presence in the about.\n else\n if (item[:skills].downcase.include? (keyword.downcase))\n begin\n KeywordFound[countFound]={name: item[:name],Attribute:'skills'}\n countFound = countFound + 1\n end # check presence in the skills.\n else\n if (item[:devices].downcase.include? (keyword.downcase))\n begin\n KeywordFound[countFound]={name: item[:name],Attribute:'devices'}\n countFound = countFound + 1\n end # check presence in the devices.\n else\n begin\n keywordNotFound[countNotFound] = item[:name]\n countNotFound = countNotFound +1\n end # Not present, add into not found count.\n # end # (item[:platform].downcase.include? (keyword.downcase))\n end # (item[:devices].downcase.include? (keyword.downcase))\n end # (item[:skills].downcase.include? (keyword.downcase))\n end # (item[:about].downcase.include? (keyword.downcase))\n end # (item[:specialization].downcase.include? (keyword.downcase))\n end # (item[:title].downcase.include? (keyword.downcase))\n end # (item[:name].downcase.include? (keyword.downcase))\n end # printSearchedListContainsKeywordOrNot(itemHash,keyword)\n\n # Print the list of freelancer those having keyword in profile\n puts keyword + \" keyword found in below freelancer in respective attribute : \"\n for j in 0..countFound\n puts KeywordFound[j]\n end # End of for\n\n # Print the list of freelancer those not having keyword in profile\n puts keyword + \" keyword not found in below freelancer in any attribute : \"\n for i in 0..countNotFound\n puts keywordNotFound[i]\n end # End of for\n\n end", "def bay_for_item(item)\n for x in INVENTORY\n if x.has_value?(item)\n return key = x.key(item).to_s\n end\n end\n return key\nend", "def add_recipe(name, foods)\n # Check if any items in foods don't exist in DB\n foods.each do |food|\n if not @basic_foods.has_key? food and not @recipes.has_key? food\n puts \"Food doesn't exist in DB\"\n return\n end\n end\n # Check if name already exists in hash tables\n if @basic_foods.has_key? name or @recipes.has_key? name\n puts \"Food already exists in DB\"\n else\n @recipes[name] = Recipe.new(name, foods)\n end\n end", "def find_by_name(arrHash,strang)\nret = nil\n\tarrHash.each_with_index do |chack,index|\n\t\tif chack[:name]==strang\n\t\t\tret=chack\n\t\t\tbreak\n\t\tend\n\tend\n\tret\nend" ]
[ "0.66430074", "0.6629404", "0.6602891", "0.6502921", "0.6465965", "0.6367667", "0.63485837", "0.633282", "0.6298035", "0.62824845", "0.6237614", "0.6200412", "0.61707366", "0.61547", "0.61359155", "0.6096927", "0.60774034", "0.6075146", "0.5998521", "0.5981482", "0.5958805", "0.5922596", "0.59129506", "0.5881793", "0.58642083", "0.58611125", "0.582984", "0.5825193", "0.58132875", "0.57999897", "0.57740664", "0.5769076", "0.5768494", "0.5753294", "0.5694469", "0.5693818", "0.56641144", "0.5643126", "0.56312317", "0.56178415", "0.5605403", "0.5590144", "0.5587892", "0.5585499", "0.55692476", "0.5547902", "0.55174303", "0.55174303", "0.549948", "0.547201", "0.5461335", "0.54261345", "0.5425276", "0.542443", "0.5422914", "0.54220957", "0.5416955", "0.5415851", "0.54111", "0.54103607", "0.5407843", "0.54054594", "0.5400519", "0.5400426", "0.5395119", "0.53915125", "0.53754336", "0.5368434", "0.5368434", "0.53573817", "0.53483653", "0.5340659", "0.53383505", "0.5337038", "0.5321263", "0.5314205", "0.5312297", "0.5305731", "0.5293877", "0.5292129", "0.52804995", "0.52804565", "0.527891", "0.5273869", "0.52734214", "0.52578384", "0.52464503", "0.52435094", "0.52333486", "0.5228252", "0.52260685", "0.52198005", "0.52173346", "0.52145904", "0.5198794", "0.5195829", "0.51925904", "0.5188562", "0.51877177", "0.5181863" ]
0.72471845
0
def delete_user manageable_users = User.where(invited_by_id: current_user.id)
def identities render json: current_user.identities end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_user_todos\n user = self.id\n Todo.where({\"user_id\" => user}).delete_all\n end", "def delete\n\t\tcurrent_user\n\t\tcurrent_user.regexpressions.destroy_all\n\t\tcurrent_user.tasks.destroy_all\n\t\tcurrent_user.clouds.destroy_all\n\t\tcurrent_user.platforms.destroy_all\n\t\tcurrent_user.demos.destroy_all\n\t\tcurrent_user.favorites.destroy_all\n\tend", "def uninvite\n @meal = Meal.find(params[:meal_id])\n authorize @meal, :update?\n temp_user = @meal.invited_users.find(params[:user_id])\n @meal.invited_users.delete(temp_user)\n redirect_to @meal\n end", "def destroy\n @user = User.find(params[:id])\n if @user.tasks.present?\n Task.where(user_id: params[:id]).destroy_all\n end\n if @user.id == current_user.id\n redirect_to admin_users_url, notice: \"You can not delete signed in user\"\n @admin = User.admin\n elsif @admin == 1\n redirect_to admin_users_url, notice: \"Atleast one admin must remain!\"\n else\n @user.destroy\n redirect_to admin_users_url, notice: 'User was successfully destroyed.'\n end\n end", "def destroy\n if @user.admin == true\n flash[:danger] = \"You cannot delete an admin\"\n redirect_to users_path\n else\n flash[:success] = \"Delete success\"\n Antenna.where(user_id: @user.id).delete_all\n OwnBox.where(user_id: @user.id).delete_all\n OwnDevice.where(user_id: @user.id).delete_all\n @user.destroy\n redirect_to users_path\n end\n end", "def delete\r\n Marketplace::Database.instance.call_users(self)\r\n Marketplace::Database.instance.delete_user(self)\r\n ImageUploader.delete_image(self.picture, settings.root) if self.picture != nil\r\n items = Marketplace::Database.instance.items_by_user(self)\r\n items.each{ |item| item.delete }\r\n end", "def delete_user\n end", "def show\n uninvited_users\n end", "def additional_users_for_destroy\n []\n end", "def destroy\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n @user = User.find(params[:id])\n if (@user)\n @user.destroy\n end\n redirect_to :action => 'index'\n else\n redirect_to '/'\n end \n end", "def destroy\n restrict('allow only admins') or begin\n @user = User.find_by_id(params[:id])\n if @user.destroy\n respond_to do |format|\n format.html { redirect_to manage_users_url }\n format.xml { head :ok }\n end\n else\n \n end\n end\n end", "def destroy_users\n user = User.find(params[:id])\n \n # Delete user\n user.destroy\n\n # Sign out of any machines user is on\n Devise.sign_out_all_scopes ? sign_out : sign_out(:user)\n set_flash_message! :notice, :destroyed\n \n @users = User.all\n render \"manage\"\n end", "def delete_user\n @saved_list = SavedList.find(params[:id])\n list_users = @saved_list.saved_list_users\n table_to_delete = list_users.where(\"user_id = ?\", params[:user_id].to_i)\n table_to_delete.first.delete\n redirect_to @saved_list\n end", "def delete_users\n delete(users_path)\n end", "def destroy\n User.all.each do |user|\n ExpenseMailer.expense_deleted_mail(@office_expense, user).deliver\n end\n @office_expense.destroy\n respond_to do |format|\n format.html { redirect_to office_expenses_url, notice: 'Office expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_users\r\n @userAdmin.destroy\r\n @user2.destroy\r\n @user3.destroy\r\n end", "def destroy\n current_user.deleted!\n\n expose current_user\n end", "def deactivated_users\n @users=User.find_with_deleted(:all,:conditions=>['company_id=? AND deleted_at IS NOT NULL',current_user.company_id])\n end", "def destroy\n invited_users = InvitedUser.where(email: @user.email)\n invited_users.each do |invited_user|\n Message.create(sender_id: 1, receiver_id: invited_user.inviter.id, title: \"Your friend has just left\", content: \"I am living TennisBuddy World! Thank you for inviting me, I am really sorry. #{@user.full_name}\")\n end\n @user.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 delete\n Authentication.where(user_id: id).each { |auth| auth.delete }\n super\n end", "def check_destroy_access\n @user_invite = UserInvite.find_by id: params[:id]\n return true if @user_invite.user.eql?(current_user) || @user_invite.team.team_captain.eql?(current_user)\n\n raise ActiveRecord::RecordNotFound\n end", "def delete_unused_members\n if !member.nil? && !member.is_a?(User) and \nmember.roles(:true).empty?\n member.destroy\n end\n end", "def destroy_user\n self.own_children.each do |child|\n unless child.admins.where([\"relations.user_id != ?\", self.id]).any?\n child.destroy_child\n end\n end\n self.destroy\n end", "def remove_user_from_quick_invoicing\n company.saved_invoice_users.delete(User.find(params[:user_id]))\n\n head :ok\n end", "def delete_confirm\n return appctrl_not_permitted() unless ( @current_user.admin? )\n\n # Nobody can delete admin accounts. You must assign the admin\n # privilege to someone else, then, since you can't revoke your\n # own admin privileges either, have the new admin change your\n # account type and delete the user record. This is a good way\n # of ensuring that there is always at least one admin.\n\n @record = User.find( params[ :id ] )\n return appctrl_not_permitted() if ( @record.admin? )\n\n @record.destroy()\n\n flash[ :notice ] = 'User and all associated data deleted'\n redirect_to( users_path() )\n end", "def deletable_by?(user)\n false\n end", "def destroy\n @current_user.destroy\n end", "def destroy\n authorize! :destroy, @user, :message => 'You are not authorized to perform this operation.'\n user = User.find(params[:id])\n unless user == current_user\n user.destroy\n redirect_to users_path, :notice => \"User deleted. #{undo_link}\"\n else\n redirect_to users_path, :notice => \"Can't delete yourself.\"\n end\n\n end", "def destroy\n UserService.deleteUser(params[:id],current_admin[:id])\n redirect_to users_path\n end", "def delete current_user\n raise RequestError.new(:internal_error, \"Delete: no user specified\") if current_user.nil?\n\n # remove all its files\n self.files.each { |item| item.delete current_user }\n # remove all its children, meaning all its subdirectories. (all sub-sub-directories and sub-files will me removed as well)\n self.childrens.each { |children| children.delete current_user }\n\n if current_user.id != self.user_id then # if random owner \n # remove all links between this folder and the current user only\n FileUserAssociation.all(x_file_id: self.id, user_id: current_user.id).destroy!\n # remove all associations where this folder is a children of a folder belonging to the current user only\n FolderFolderAssociation.all(children_id: self.id).each do |asso|\n asso.destroy! if current_user.x_files.get(asso.parent_id)\n end\n # No sharing for folders: no SharedToMeAssociations\n\n else # if true owner \n # remove all links between this folder and ALL users\n FileUserAssociation.all(x_file_id: self.id).destroy!\n # remove all associations where this folder is a children of a folder belonging ALL users\n FolderFolderAssociation.all(children_id: self.id).destroy!\n # No sharing for folders: no SharedByMeAssociations\n\n # No need to remove the association where this folder is a parent (of a file or folder)\n # because the children have already been removed and all theirs associations\n #\n # FolderFolderAssociation.all(parent_id: self.id).destroy!\n # FileFolderAssociation.all(parent_id: self.id).destroy!\n \n # now remove the entity\n self.destroy!\n end\n end", "def can_delete?(user)\n self.user_id == user.id || user.admin?\n end", "def destroy\n if params[:id] != current_user.id && current_user.is_admin == false\n \traise \"You are not authorized to access this function\"\n end \n @user = User.find(params[:id]).destroy\n respond_with(@user)\n end", "def destroy\n ## 그동안 주고받았던 모든 쪽지를 지워야 계정이 삭제됨.\n Message.all.each do |x|\n if current_user.id == x.user_id\n x.destroy\n end\n end\n \n Conversation.all.each do |y|\n if current_user.id == y.sender_id\n y.destroy\n end\n end\n\n Post.all.where(user_id: current_user.id).each do |z|\n @post = Post.find(z.id)\n @post.update(user_id: 1)\n end\n\n Comment.all.where(user_id: current_user.id).each do |z|\n @comment = Comment.find(z.id)\n @comment.update(user_id: 1)\n end\n\n Invite.find_by(code: current_user.invite_code).destroy\n super\n end", "def destroy\n user_to_delete = User.find(params[:id])\n if (current_user?(user_to_delete))\n flash[:error] = \"You cannot delete yourself!\"\n else\n user_to_delete.destroy\n flash[:success] = \"User deleted.\"\n end\n redirect_to users_url \n end", "def remove_invite\n @invited = Dinner.find(params[:id]).invites.find_by(invited_id: params[:user_id])\n @invited.delete\n render json: { message: 'user uninvited' }\n end", "def destroy_multiple\n User.where(id: params[:user_ids]).destroy_all\n\n respond_to do |format|\n format.html { redirect_to users_url(filter: \"invited\"), notice: 'Benutzer wurden gelöscht.' }\n format.json { head :no_content }\n end\n end", "def remove_everything_about_testuser\n list_of_activerecords = [\n Follow.find_by(leader_id: TESTUSER_ID),\n Follow.find_by(user_id: TESTUSER_ID),\n Mention.find_by(username: TESTUSER_NAME),\n Tweet.find_by(user_id: TESTUSER_ID),\n User.find_by(username: TESTUSER_NAME)\n ]\n list_of_activerecords.each { |ar| destroy_and_save(ar) }\nend", "def destroy_user(id)\n #TODO:\n # ADD SOME USER LEVEL TO AVOID THESE\n end", "def destroy\n @user = User.find(params.require(:id))\n\n if @user == current_user\n flash[:alert] = t('users.msg.cannot_delete_yourself')\n raise 'Cannot delete yourself'\n end\n\n # delete user from zabbix\n begin\n @user.zabbix_servers.each do |s|\n z = Zabbix.new(s.fqdn, current_user.email, current_user.encrypted_password)\n z.delete_user(@user.email)\n end\n rescue StandardError => ex\n flash[:alert] = I18n.t('users.msg.error', msg: ex.message)\n raise\n end\n\n # delete user from SkyHopper\n @user.destroy\n\n flash[:notice] = t('users.msg.deleted', name: @user.email)\n redirect_to(action: :index)\n end", "def destroy\n find_user\n # check if logged in & if user exists\n @user.destroy\n # also destorys all attending events that contains the user_id\n end", "def destroy\n if @user == current_user or @user.super_admin?\n return redirect_to admin_cars_url, alert: 'Cannot delete this user'\n end\n unless @user.reservations.empty?\n return redirect_to admin_cars_url, alert: 'Cannot delete this user!! There are reservations done by this user in the system'\n end\n @user.destroy\n respond_to do |format|\n format.html { redirect_to admin_cars_url, notice: 'The user was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def transferrable_to_users\n collaborator_users.where.not(id: user_id)\n end", "def destroy\n # destroy not implemented - only admins may \"purge\" or \"delete\" users\n raise \"This action is not implemented\"\n end", "def remove_deletes\n Invitation.where(invite_email: 'delete').destroy_all\n Invitation.where(invite_email: 'DELETE').destroy_all\n end", "def destroy\n @user = User.find(params[:id])\n reservations = Reservation.where(user_id: @user.id)\n reservations.destroy_all\n @user.destroy\n flash[:success] = 'User deleted.'\n redirect_to users_url\n end", "def deletable_by?(user)\n resource.orders_count.zero? && (user.is_admin? || is_mill?(user))\n end", "def destroy\n if User.find(params[:id]).admin?\n redirect_to users_url\n else\n User.find(params[:id]).delete\n flash[:sucess] = \"User deleted\"\n redirect_to users_url\n end\n end", "def destroy\n @user.soft_delete\n respond_to do |format|\n format.html { redirect_to users_url, notice: 'user was successfully deactivated.' }\n end\n end", "def destroy?\n record.user_id == user.id || user.admin?\n end", "def destroy?\n user.present? && (record.user == user || user.admin? || user.moderator?)\n end", "def destroy\n #NEED TO HANDLE CASE WHEN USER IS THE ONLY ADMIN ON A LIST THEY CREATED OR\n #IF THEY ARE THE ONLY COLLABORATOR THE LIST NEEDS TO BE DELETED\n #IF THERE IS ANOTHER COLLABORATOR A ADMIN NEEDS TO BE NAMED BEFORE CLOSING ACCOUNT\n resource.soft_delete\n Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name)\n set_flash_message :notice, :destroyed if is_flashing_format?\n yield resource if block_given?\n respond_with_navigational(resource){ redirect_to after_sign_out_path_for(resource_name) }\n end", "def owner\n guest_list = GuestList.find(params[:id])\n guest_list.remove_user_permissions(params[:user_id])\n redirect_to wedding_list_managers_path(guest_list.wedding)\n end", "def destroy\n log_record('users/delete', current_user.id)\n super\n end", "def Elimina_Utente()\n Category.delete_all(user_id: self.id)\n Dish.delete_all(user_id: self.id)\n Ingredient.delete_all(user_id: self.id)\n Medium.destroy_all(user_id: self.id)\n Menu.delete_all(user_id: self.id)\n Profile.destroy_all(user_id: self.id)\n self.destroy()\n end", "def purge\n @user.destroy\n redirect_to admin_users_path\n end", "def deletable_by?(user)\n user.has_role?(:admin) or resource.user_id == user.id\n end", "def user\n @alerts = Alert.where(:user_id => params[:id])\n @alerts.each { |alert| alert.delete }\n render :index\n end", "def delete_all\n my_trans = Transaction.find_all_by_user_id(current_user.id)\n my_trans.each do |trans|\n trans.destroy\n end\n\n redirect_to transactions_url\n end", "def userinfodelete(user_id, del_id)\n return [db.execute(\"SELECT * FROM users WHERE user_id=?\", user_id), db.execute(\"SELECT * FROM users WHERE user_id=?\", del_id)]\nend", "def destroy \n if !current_user.isScrumMasterOrProductOwner?\n if !current_user.isAdmin?\n if current_user.id == @user.id\n borrar\n else\n redirect_to(root_path, notice: \"You can not delete other users\")\n end\n else\n if User.where(:role => \"admin\").count > 1 or @user.role == \"user\"\n borrar\n else\n redirect_to(users_path, notice: \"It is not allowed to delete the admin\")\n end\n end\n else\n redirect_to(root_path, notice: \"It is not allowed to delete users while being a Scrum Master or Product Owner\")\n end\n end", "def delete\n\t\t\tuser = User.find(params[:id])\n\t\t\tuser_first = user.name || \"\"\n\t\t\tuser_last = user.lname || \"\"\n\n\t\t\tuser.reviews.each { |review| review.destroy }\n\n if(user.role == 'merchant' || user.role == 'admin')\n user.stores.each { |store| store.destroy }\n end\n\n user.destroy\n flash[:notice] = \"#{user_first} #{user_last} deleted.\"\n\n redirect_to :controller => 'users' , :action => :index \n end", "def destroy\n @user = User.find(params[:id])\n if is_admin?\n\n if @user.role == \"Super Administrator\"\n flash[:notice] = \"The Super Administrator cannot be deleted\"\n redirect_to @user\n return\n end\n if @user.role == \"Administrator\"\n if !@superadmin_user\n if !(@current_user == @user)\n flash[:notice] = \"Only the super administrator can delete other administrators\"\n redirect_to @user\n return\n end\n end\n end\n else\n if !(@current_user == @user)\n flash[:notice] = \"You do not have permission to delete this user!\"\n redirect_to @current_user\n return\n end\n end\n @posts = Post.where(:user_id => @user.id).all\n #@replies = Reply.where(:user_id => @user.id).all\n @anonymous = User.where(:username => 'Anonymous').first\n @posts.each do |p|\n p.update_attributes(:user_id => @anonymous.id)\n end\n #@replies.each do |r|\n # r.update_attributes(:user_id => @anonymous.id)\n #end\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 remove_pending\n authorize! :update, @user, :message => t('errors.messages.not_authorized_as_manager')\n\n @user = User.find(params[:id])\n @marina = Marina.find(params[:marina])\n @marina.pending_users.delete(@user)\n\n @user.marina_state= \"\"\n UserNotifier.remove_pending(@user).deliver\n @user.save\n @marina.save\n redirect_to marina_path(@marina), :notice => t('errors.messages.remove_pending')\n #\"Bertholder and marina are now connected. a notification email has been sent\"\n\n\n\n end", "def destroy\n\t\[email protected]\n\tend", "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 beforeDestroy\n UserPermission.where(user:self).each {|up| up.destroy}\n end", "def delete_other_bids(assignment_id, user_id)\n entries = SignedUpUser.find_by_sql([\"SELECT su.* FROM signed_up_users su , sign_up_topics st WHERE su.topic_id = st.id AND st.assignment_id = ? AND su.creator_id = ? AND su.is_waitlisted = 1\",assignment_id,user_id] )\n entries.each { |o| o.destroy }\nend", "def destroy\n p \"helloFromDestroy\"\n @usersInsideOrder = @order.invitations.all\n if @order.user_id == current_user.id\n @usersInsideOrder.each do |user|\n ActionCable.server.broadcast \"uni_brod_#{user.user_id}_channel\" , {type:\"orderDestroyed\", Notification: current_user.name+\" Destroyed a order named \"[email protected]}\n end\n @order.destroy\n respond_to do |format|\n format.html { redirect_to orders_url, notice: 'Order was successfully destroyed.' }\n format.json { head :no_content }\n end\n else\n if user_signed_in?\n redirect_to order_path(), notice: \"Only Owner Who Can Delete The Order\"\n else\n redirect_to new_user_session_path\n end\n end\n end", "def deletable?(user=User.current)\n user_permission?(user, :delete_pulls)\n end", "def deleteAll\n if current_user.id != params[:uid].to_i\n redirect_to \"/notifications\", notice: \"You cannot delete someone else's notifications.\"\n else\n deleteUserNotifications(params[:uid])\n end\n end", "def remove_user_by_id(user_id)\n # ........\n end", "def check_for_approve\n @invite = CollaborationInvitation.find(params[:id])\n @magazine = Magazine.find(@invite.Magazine_id)\n @magazine.users << current_user\n @invite.destroy\n @invite.save\n redirect_to collaboration_invitations_path\n end", "def destroy\n @userin = UserInvestor.find(params[:id])\n if @userin.destroy\n render json: { status: 'OK', results: 'user investor has been deleted',\n errors: nil }, status: :ok\n else\n render json: { status: 'FAIL', results: nil,\n errors: 'user failed to delete' },\n status: :unprocesable_entity\n end\n end", "def delete\n appctrl_delete( 'User' )\n end", "def destroy\n @user = User.find(params[:id])\n if [email protected]?\n @user.dreams.each do |d|\n d.destroy\n end\n end\n \n if [email protected]?\n @user.friends.each do |f|\n f.destroy\n end\n end\n \n if [email protected]?\n @user.requests.each do |r|\n r.destroy\n end\n end\n \n if !Request.find_all_by_target_id(@user.id).nil?\n Request.find_all_by_target_id(@user.id).each do |t|\n t.destroy\n end\n end\n \n @user.comments.all.each do |c|\n c.destroy\n end\n \n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def delete\n @user = User.find(params[:id])\n @user.rvsps.delete_all()\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @currentUser = User.find(session[:user_id])\n @user = User.find(params[:id]) \n respond_to do |format|\n if @currentUser.isSuperAdmin == true #puede eliminar usuarios admin y no admins\n if @user.isAdmin == true\n @user.destroy\n @usersAdmin = User.where(:isAdmin => true)\n format.js\n else\n @user.destroy\n @ibox = Ibox.find(session[:ibox_id])\n @users = @ibox.users\n format.js\n end\n elsif @currentUser.isAdmin == true and @user.isAdmin == false #puede eliminar usuarios no admin solamente\n @user.destroy\n @ibox = Ibox.find(session[:ibox_id])\n @users = @ibox.users\n format.js \n else\n flash[:error] = \"No tienes permisos\"\n redirect_to(home_index_path)\n end\n end\n end", "def destroy\n @user = User.find_by_username(params[:id])\n authorize! :manage, @user\n \n if !current_user.has_role?(:admin)\n redirect_to root_url, alert: \"Only admins allowed.\"\n else\n \n\n respond_to do |format|\n if @user.destroy\n format.html { redirect_to root_url, notice: \"User deleted.\" } \n else\n format.html { redirect_to user_path(@user.username), notice: \"User deactivated.\" } \n end\n end\n end\n end", "def destroy\n #since we have no id in user table, the usual @user.destroy will not work, since rails convention require each table to have id...thus we use delete_all , this is dangerous if we have no unique id\n @user = User.delete_all(:id => params[:id])\n \n redirect_to users_path, :notice => \"User telah berhasil di delete\"\n \n end", "def destroy\n user.destroy\n end", "def wipe_all\n return unless current_user.user_role.can_delete_users\n\n user_role = UserRole.find_by(name: 'User')\n\n users = user_role.users\n users.each(&:destroy)\n flash[:notice] = 'Sytem Wiped of all normal users'\n redirect_to root_path\n end", "def destroy\n @user = User.find(params[:id])\n if current_user?(@user)\n redirect_to users_path, notice: \"Admins are not able to delete themselves.\"\n else\n @user.destroy\n flash[:success] = \"User deleted.\"\n redirect_to users_url\n end\n end", "def destroy\n \n @user = User.get(params[:id])\n \n\n user_dir = \"#{RAILS_ROOT}\" + \"/public/user_files/#{current_user.userid}/\"\n FileUtils.rm_rf user_dir\n \n # @mycarts = Mycart.all(:user_id => @user.id) \n # @mycarts.destroy\n\n @mytemplates = Mytemplate.all(:user_id => @user.id)\n @mytemplates.destroy\n \n @freeboards = Freeboard.all(:user_id => @user.id) \n @freeboards.destroy\n\n @myimages = Myimage.all(:user_id => @user.id) \n @myimages.destroy\n\n if @user.destroy\n redirect_to(admin_users_url) \n else\n puts \"에러 발생 ==========================================\"\n puts @user.errors\n redirect_to(admin_users_url) \n end\n \n\n end", "def destroy\n\t\t@user = User.find(params[:id])\n\t\[email protected]_delete!\n\t\tUserMailer.delete_email(@user).deliver_now\n\t\trender json: {}, status: 200\n\tend", "def destroy\n @user = User.find(params[:id])\n #@user.alerts.destroy_all # achived by seting \",:dependent => :destroy\" to has_many :alerts in User model, this automatically destroy user's alerts when user is deleted.\n @user.destroy\n redirect_to genres_path\n end", "def destroy\n if @user != current_user && !current_user.admin?\n render json: ['Not authorized for that action'], status: :unauthorized\n else\n if @user.destroy\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end\n end", "def delete_all\n User.delete_all\nend", "def index\n \tif signed_in? && current_user.sk.root?\n \t\toneweekago = Date.today - 7\n \t\tUser.where(\"email_confirm = ? AND created_at < ?\", false, oneweekago).each do |u|\n \t\t\tu.destroy\n \t\tend\n \tend\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n @deletedUser = User.find_by_userName(\"UserDeleted\")\n @postOfDeletedUser = Post.find(:all, :conditions => [\"user_id = ?\", @user.id])\n\n #updating the user_id of all the posts of the deleted user to a default user \"UserDeleted\"\n @postOfDeletedUser.each do\n |post|\n post.update_attribute(\"user_id\",@deletedUser.id)\n end\n\n @votesOfDeletedUser = Post.find(:all, :conditions => [\"user_id = ?\", @user.id])\n\n #updating the user_id of all the votes of the deleted user to a default user \"UserDeleted\"\n @votesOfDeletedUser.each do\n |vote|\n vote.update_attribute(\"user_id\", @deletedUser.id)\n end\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 \t@user = User.find(params[:user_id])\n \t@item = @user.items.find(params[:id])\n \[email protected]\n \tredirect_to @user\n \tend", "def destroy?\n record.sender == user || user.admin?\n end", "def delete\n @invitation = Invitation.find(params[:id])\n @user = User.find(@invitation.user_id)\n @group = Group.find(@invitation.group_id)\n\n if destroy_has_sanitized_input?\n @invitation.delete\n flash[:notice] = \"Invitation destroyed\"\n end\n\n if @isUserAdmin\n redirect_to group_url\n else\n redirect_to groups_url\n end\n end", "def choose\n @users = User.all.reject{ |user| user == current_user }\n end", "def destroy\n @user = current_org.users.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_path }\n format.json { head :no_content }\n end\n\n end", "def delete_user(user)\n res1 = remove_filtered_grouping_policy(0, user)\n res2 = remove_filtered_policy(0, user)\n res1 || res2\n end", "def perform\n inactive_users = User.inactive_for_more_than(2.days)\n inactive_users.destroy_all\n end", "def destroy\n if current_user && current_user.admin? \n @user = User.find(params[:id])\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n else\n flash[:notice] = 'You do not have Admin rights to delete a user'\n redirect_to home_index_path\n end\n end", "def destroy\n Search.destroy_all(users_id: current_user)\n redirect_to user_path(current_user)\n end", "def destroy\n if @user.authority == '2'\n flash[:danger] = 'Pre-configured Admin Cannot Be Deleted'\n redirect_to users_path\n elsif @user.email == current_user.email\n flash[:danger] = 'Oops. Don\\'t Delete Yourself'\n redirect_to users_path\n else\n sql = \"delete from histories where email = '#{@user.email}' and (date > '#{Time.now.to_date}' or (date = '#{Time.now.to_date}' and begintime > '#{Time.now.hour}' ))\"\n h = History.find_by_sql(sql)\n @user.destroy\n redirect_to users_path\n flash[:success] = 'User Was Successfully Deleted'\n end\n end", "def manageAllUsers\n @dAllUsers=User.all\n end", "def destroy\n @user = User.find(params[:id])\n Matching.all.where(user_id: current_user.id).each do |match|\n match.destroy\n end\n\n @user.destroy\n #delete their schedule and matches eventually\n \n respond_to do |format|\n format.html { redirect_to logout_path }\n format.json { head :no_content }\n end\n end" ]
[ "0.7154737", "0.7114011", "0.69425", "0.68024486", "0.6770085", "0.6730412", "0.67291385", "0.6724901", "0.6573422", "0.6555834", "0.65442204", "0.6519828", "0.6469015", "0.6452897", "0.6446806", "0.6403908", "0.63788694", "0.6371636", "0.636246", "0.6352811", "0.6343719", "0.6342464", "0.63389945", "0.63384783", "0.6336385", "0.6336245", "0.63362044", "0.6332558", "0.6332418", "0.63205135", "0.63019276", "0.6301538", "0.63001645", "0.6295956", "0.6289097", "0.6281694", "0.6281588", "0.62733555", "0.62716395", "0.62663794", "0.6258402", "0.6253336", "0.62438107", "0.62421143", "0.6241234", "0.62384796", "0.6236319", "0.6231266", "0.62307435", "0.6228201", "0.6223238", "0.6206778", "0.6202424", "0.6200633", "0.62002873", "0.6199136", "0.6196916", "0.6191009", "0.6189328", "0.6182583", "0.61817807", "0.6172297", "0.6168752", "0.6168264", "0.6167093", "0.6166517", "0.6162227", "0.61519516", "0.6144292", "0.6143898", "0.6141875", "0.6140637", "0.61317533", "0.61292124", "0.61217767", "0.6111835", "0.6111824", "0.61116534", "0.6089755", "0.60870856", "0.60772634", "0.6061315", "0.6059539", "0.6057404", "0.605546", "0.6048675", "0.6044633", "0.6043482", "0.60402197", "0.6039847", "0.60367244", "0.6035709", "0.60332763", "0.6032266", "0.60316914", "0.603114", "0.6030657", "0.6030487", "0.6030365", "0.6030128", "0.6029959" ]
0.0
-1
For errors, add our prefix to all messages
def error(*progname, &block) if block_given? Rails.logger.error(*progname) { "#{ERROR_PREFIX}#{yield}".gsub(/\n/,"\n#{ERROR_PREFIX}") } else Rails.logger.error "#{ERROR_PREFIX}#{progname}".gsub(/\n/,"\n#{ERROR_PREFIX}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prefix (prefix, message)\n yield(prefix, message)\n end", "def optional_prefix(prefix, message)\n [prefix + message, message]\nend", "def keep_errors(prefix = \"\")\n original_errors = errors.respond_to?(:messages) ? errors.messages.dup : errors.dup\n result = yield\n merge_errors(original_errors, prefix)\n result\n end", "def email_prefix\n @email_prefix || '[Exception] '\n end", "def prefix t, severity\n\n\t\tprefix_parts(t, severity).join(', ')\n\tend", "def prefix\n \"\".tap do |o|\n o << \" \" if @mcir.logger.debug?\n o << \"[#{name}] \".purple\n end\n end", "def appctrl_report_error( error )\n flash[ :error ] = t(\n :'uk.org.pond.canvass.generic_messages.error_prefix',\n :error => ERB::Util.html_escape( error )\n )\n end", "def wrap_prefix(prefix)\n prefix\n end", "def add_error(msg)\n add_msg \"* Error: #{msg}\"\n end", "def custom_error_message\n message = component.dig('errors', schema_key, 'any')\n\n message % error_message_hash if message.present?\n end", "def prefix=(prefix) @prefix = prefix end", "def use_prefix\n prefix, @prefix = @prefix, nil\n @res << prefix if prefix\n\n prefix\n end", "def custom_error(name, key_error)\n @errors << \"#{name} fails to #{key_error}\"\n end", "def custom_error(name, key_error)\n @errors << \"#{name} fails to #{key_error}\"\n end", "def set_error_message(msg)\n if self[:error_message]\n self[:error_message] += \"\\n\" + msg\n else\n self[:error_message] = msg\n end\n end", "def debug_message_prefix\n return self.class.to_s if debug_flag_active?(:class_only)\n\n name = self.class.to_s + '#'\n if /`(.*)'/ =~ caller[1]\n name + $1\n else\n name + \"[unknown]\"\n end\n end", "def format_error_message( msg, count = nil, singular = nil, *rest )\n return super unless msg.is_a?( Symbol ) and r18n\n if limit = count and singular\n limit = t.form_input.units[ singular, count ].to_s\n end\n text = t.form_input.errors[ msg, *limit, self ].to_s\n super( text )\n end", "def prefix\n ''\n end", "def message\n \"#{super}:\\n#{errors_message}\"\n end", "def add_error(msg)\n messages << msg\n end", "def prefix; end", "def prefix; end", "def prefix; end", "def prefix; end", "def prefix; end", "def prefix; end", "def prefix; end", "def prefix; end", "def prefix; end", "def prefix; end", "def format_error ins\r\n ins.errors.nil?? \"\" : ins.errors.messages.map{|k,v| \"#{k}:#{v.uniq[0]}\"}.join(\"<br>\")\r\n end", "def format_error ins\r\n ins.errors.nil?? \"\" : ins.errors.messages.map{|k,v| \"#{k}:#{v.uniq[0]}\"}.join(\"<br>\")\r\n end", "def to_s\n message_prefix_part = if message_prefix\n \"#{message_prefix} - \"\n else\n ''\n end\n \"#{message_prefix_part}#{Rdkafka::Bindings.rd_kafka_err2str(@rdkafka_response)} (#{code})\"\n end", "def prefix=(value)\n @prefix = value\n end", "def log_prefix\n \"[#{tag}: #{name}]\"\n end", "def prefix!(prefix=\"DEFAULT\")\n @session.chanserv.set(self.name, :prefix, prefix)\n end", "def update_name_prefix(name_prefix)\n @name_prefix = \"#{@name_prefix}#{name_prefix}\"\n end", "def code_has_prefix\n errors.add( :code, I18n.t( \"s_code_modules.msg.bad_code_format\", prefix: @code_prefix )) \\\n unless self.class.has_code_prefix( code )\n end", "def prefix\n \" => \"\n end", "def append_error(msg)\n @errors.empty? ? @errors = msg : @errors << \"\\n\" + msg + \" \"\n end", "def adjust_errors(form_errors)\n form_errors.each do |e|\n case e[:failed_attribute]\n when 'Required'\n e[:message].gsub!(\"The property '#/'\", 'The request')\n end\n e[:message].gsub!(\"The property '#/\", \"The property '\")\n e[:message] = e[:message][/.+?(?= in schema)/]\n end\n end", "def prefix\n raise NotImplementedError\n end", "def userprefix(value)\n merge(ucuserprefix: value.to_s)\n end", "def warn_with_prefix( msg = \"\" )\n warn \"DEPRECATION WARNING: #{msg}\"\n end", "def prefix\n \"#{name}::\"\n end", "def add_errors(member_alias)\n @errors[:schedule_not_fetched] = \"-#{member_alias}- #{@errors[:schedule_not_fetched]}\"\n end", "def error_msg(message, keys1, keys2)\n sprintf(ERRORS[message], carrier, (keys1 - keys2).to_a.join(', '))\n end", "def error(message, options = {})\n options[:prefix] ||= \" - \"\n options[:color] ||= :red\n output message, options\n end", "def custom_error(key_error)\n @errors << key_error\n end", "def error_msg\n ERROR_MSG[upcase_class_sym]\n end", "def prefix(new_prefix = nil)\n return @prefix if new_prefix.nil?\n @prefix = new_prefix\n end", "def message_error errors\n errors.full_messages.find{|object| /en.errors.messages.extension_whitelist_error/ =~ object }.nil? ?\n errors.full_messages.first.capitalize.to_s.gsub('_',' ') + \".\" :\n 'Only jpeg,jpg and png allowed!'\n\tend", "def add_error(msg)\n @errors << \"#{self.class.get_check_name.capitalize} found a problem with '#{@path.path}': #{msg}\"\n end", "def remove_prefix(msg)\n msg.sub(PREFIX_REGEX, \"|\")\n end", "def prefix( *pf )\r\n tokens.unshift(*TokenString.linearize_tokens(pf))\r\n self\r\n end", "def str_prefix\n\t\t\t\t\"\"\n\t\t\tend", "def prefix(value)\n merge(leprefix: value.to_s)\n end", "def flash_error(message_key,*strs)\r\n flash[:error] = sprintf(I18n.t(message_key),*strs)\r\n end", "def error_messages=(_arg0); end", "def add_prefix(object_name, action, prefix, i18n)\n name = object_name\n unless action.nil?\n prefix = case prefix\n when :every\n [action.to_sym]\n when :none\n []\n else\n prefix || [:new, :edit]\n end\n name = action_name(action, i18n, name) if prefix.include?(action.to_sym)\n end\n name\n end", "def error_messages(resource_name: , resource: , separator:)\n sanitize_and_translate(\n resource_name: resource_name ,\n resource:resource,\n given_messages: reject_notice_messages(messages: messages)\n ).flatten.join(separator).html_safe\n end", "def prefix(path)\n path ? \"#{path.underscore}__\" : ''\n end", "def log_prefix\n if self.host\n \"upguard #{self.host}:\"\n else\n \"upguard:\"\n end\n end", "def errmsg(str, prefix='** ')\n if str.is_a?(Array)\n str.each{|s| errmsg(s)}\n else\n str.split(\"\\n\").each do |s|\n msg(\"%s%s\" % [prefix, s])\n end\n end\n end", "def error_messages(instance)\n @error_messages = instance.errors.messages.map do |k,v|\n k = k.capitalize\n v = v[0]\n \"#{k} #{v}. \"\n end.join(\" \")\n end", "def prefix\n regexify(bothify(fetch('aircraft.prefix')))\n end", "def log_prefix\n \"[nsc/#{Customer.url_shortcut}/#{id.to_s}] \"\n end", "def full_message(attribute, message)\n return message if attribute == :base\n attr_name = attribute.to_s.tr('.', '_').humanize\n #attr_name = @base.class.human_attribute_name(attribute, default: attr_name)\n I18n.t(:\"errors.format\", {\n default: \"%{attribute} %{message}\",\n attribute: attr_name,\n message: message\n })\n end", "def flash_error\n err = \"\"\n self.errors.messages.each {|name, value|\n err += value[0]\n }\n err\n end", "def prefix(value)\n merge(aguprefix: value.to_s)\n end", "def format_error(error)\n msgstr = <<END_OF_MESSAGE\n<p><b>#{ERRORPREFIX}</b></p>\n<p><i>#{error}</i></p>\nEND_OF_MESSAGE\n end", "def prefix(path=nil)\n return ''\n end", "def prefix=(value)\n value += '/' if value != '' and value[-1] != '/'\n @prefix = value\n end", "def route_name_prefix prefix\n @route_name_prefix = prefix\n end", "def warn_without_prefix( msg = \"\" )\n warn msg\n end", "def make_message message\n prefix = \"#{@file_name}:\".dup\n\n tk = peek_tk\n prefix << \"#{tk[:line_no]}:#{tk[:char_no]}:\" if tk\n\n \"#{prefix} #{message}\"\n end", "def set_prefix\n if self.prefix.nil? && self.title.present?\n self.prefix = self.title.to_s.gsub(/\\W/, '').downcase\n end\n end", "def log_prefix\n \"Maxretry handler [queue=#{@worker_queue_name}]\"\n end", "def log_with_prefix(level, category, message)\n logger.send(level, category_prefix(category) + connection_count_prefix + message)\n end", "def error_message (errors)\n\tmessage = \"\"\n\terror_array = errors.split\n\n\terror_array.each do |error|\n\t\tcase error\n\t\twhen \"name\"\n\t\t\tmessage += \"Invalid Name \\n\"\n\t\twhen \"email\"\n\t\t\tmessage += \"Invalid Email \\n\"\n\t\twhen \"dup\"\n\t\t\tmessage += \"Duplicate Name \\n\"\n\t\twhen \"bName\"\n\t\t\tmessage += \"Invalid Business Name \\n\"\n\t\tend\n\tend\n\t\n\treturn message\nend", "def error(message)\n case message\n when /no_update/i\n message = t('messages.error', :confirmation => t('messages.no_update_confirmation'), :check_again => t('messages.check_again'), :try_again => t('messages.try_again'))\n when /no_create/i\n message = t('messages.error', :confirmation => t('messages.no_create_confirmation'), :check_again => t('messages.check_again'), :try_again => t('messages.try_again'))\n end\n flash[:error] = message\n end", "def prefix pref_name\n @context['prefix'] = pref_name\n end", "def prefix(value)\n merge(gadrprefix: value.to_s)\n end", "def error_message\n if @errors\n @errors.map { |(k,v)|\n \"#{k} #{v.join(',')}\"\n }.join(\"; \")\n end\n end", "def uploading_error\n errors[:base] << I18n.t('simple_attachments.uploading_error')\n end", "def prefixes; end", "def prefixes; end", "def flash_messages(errors)\n errors.each { |message| flash['alert_'+ message.gsub(/\\s+/, '_')] = message }\n end", "def xprint(text)\n self.error_messages += text\n end", "def global_events_prefix(prefix = nil)\n if prefix\n @global_events_prefix = prefix.to_s\n else\n @global_events_prefix\n end\n end", "def prefix\n match(/Prefix\\s+:\\s+([^\\s])/)\n end", "def error(msg)\n puts red(bold(\"[!] #{msg}\"))\n end", "def handle_prefix(event)\n return false if event.channel.pm?\n\n @prefix_setcmd = event.content.strip.to_s\n @server = event.server.id\n check_user_or_nick(event)\n\n if @prefix_setcmd =~ /^(!dm prefix check)\\s*$/i\n @prefix_check = $db.execute \"select prefix from prefixes where server = #{@server}\"\n if @prefix_check.empty?\n event.respond(content: 'This servers prefix is set to: !roll')\n return true\n else\n event.respond(content: \"This servers prefix is set to: #{@prefix_check[0].join(', ')}\")\n return true\n end\n end\n\n if @prefix_setcmd =~ /^(!dm prefix reset)\\s*$/i\n if event.user.defined_permission?(:manage_messages) == true ||\n event.user.defined_permission?(:administrator) == true ||\n event.user.permission?(:manage_messages, event.channel) == true\n $db.execute \"delete from prefixes where server = #{@server}\"\n event.respond(content: 'Prefix has been reset to !roll')\n return true\n else\n event.respond(content: \"#{@user} does not have permissions for this command\")\n return true\n end\n end\n\n if @prefix_setcmd =~ /^(!dm prefix)/i\n if event.user.defined_permission?(:manage_messages) == true ||\n event.user.defined_permission?(:administrator) == true ||\n event.user.permission?(:manage_messages, event.channel) == true\n # remove command syntax and trailing which will be added later\n @prefix_setcmd.slice!(/!dm prefix\\s*/i)\n\n if @prefix_setcmd.empty?\n # do nothing if the set command is empty\n return true\n end\n\n if @prefix_setcmd.size > 10\n event.respond(content: 'Prefix too large. Keep it under 10 characters')\n return true\n end\n @prefix_prune = @prefix_setcmd.delete(' ')\n $db.execute \"insert or replace into prefixes(server,prefix,timestamp) VALUES (#{@server},\\\"!#{@prefix_prune}\\\",CURRENT_TIMESTAMP)\"\n event.respond(content: \"Prefix is now set to: !#{@prefix_prune}\")\n true\n else\n event.respond(content: \"#{@user} does not have permissions for this command\")\n true\n end\n end\nend", "def prefix(*args)\n [@options[:env], @options[:prefix], *args].compact.join('.')\n end", "def full_message(attribute, message)\n return message if attribute == :base\n\n if message =~ /\\A\\^/\n I18n.t(:\"errors.format.full_message\", {\n default: \"%{message}\",\n message: message[1..-1]\n })\n else\n original_full_message(attribute, message)\n end\n end", "def full_messages\n inject([]) do |m, kv| \n att, errors = *kv\n errors.each {|e| m << (e.is_a?(LiteralString) ? e : \"#{Array(att).join(' and ')} #{e}\")}\n m\n end\n end", "def prefix(browser, version = nil)\n assert_valid_browser browser\n assert_valid_version browser, version if version\n data = browser_data(browser)\n p = if data[\"prefix_exceptions\"] && data[\"prefix_exceptions\"][version]\n data[\"prefix_exceptions\"][version]\n else\n data[\"prefix\"]\n end\n \"-#{p}\"\n end", "def prefix=(_); end", "def add_filename_prefix(filename, prefix)\n filename = filename.rpartition(File.basename(filename))\n filename[1] = \"#{prefix}#{filename[1]}\"\n filename.join\n end", "def name_prefix\n unless @name_prefix\n @name_prefix = collect_first(&:name_prefix)\n end\n return @name_prefix\n end", "def name_with_prefix(prefix, name)\n prefix ? \"#{prefix}[#{name}]\" : name.to_s\n end" ]
[ "0.6489433", "0.6355417", "0.6348507", "0.6332675", "0.63253945", "0.62757534", "0.61022407", "0.6088787", "0.6068332", "0.6029662", "0.6012724", "0.6009304", "0.5994179", "0.5994179", "0.59507877", "0.593595", "0.5928654", "0.5900084", "0.5884831", "0.5849194", "0.58121926", "0.58121926", "0.58121926", "0.58121926", "0.58121926", "0.58121926", "0.58121926", "0.58121926", "0.58121926", "0.58121926", "0.579234", "0.579234", "0.5768468", "0.5745097", "0.5729026", "0.57221013", "0.57191974", "0.57149637", "0.5707362", "0.57052195", "0.57042456", "0.5699866", "0.5694011", "0.56875545", "0.5684588", "0.56763834", "0.5669759", "0.5654197", "0.5651695", "0.56480306", "0.56429744", "0.56339043", "0.56189495", "0.5616865", "0.5594828", "0.5594219", "0.55774707", "0.5557456", "0.55518293", "0.55481386", "0.55443984", "0.5542829", "0.5528046", "0.55182415", "0.5514207", "0.55137587", "0.5505484", "0.5473243", "0.5473145", "0.5471437", "0.5471308", "0.5456034", "0.5454015", "0.5453222", "0.54414344", "0.543406", "0.54325974", "0.5428963", "0.54285973", "0.5421389", "0.54153305", "0.53922606", "0.5385792", "0.5379899", "0.53785735", "0.5377726", "0.5377726", "0.53606963", "0.53605115", "0.5359603", "0.5356931", "0.5356707", "0.53548247", "0.5352786", "0.5349492", "0.53465086", "0.5343729", "0.5342807", "0.5312725", "0.53098637", "0.53021747" ]
0.0
-1
Handle everything else with base object
def method_missing(m, *args, &block) Rails.logger.send m, *args, &block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inherited(base); end", "def initialize(obj)\n @base = obj\n end", "def inherited(_sub)\n raise Error, \"cannot subclass #{self}\" unless self == Object\n end", "def base; self; end", "def proxy\n super\n end", "def full_object\n fail NotImplementedError\n end", "def superclass() end", "def base_class; end", "def inherited(subclass); end", "def special\n override\n end", "def dispatch\n raise(NotImplemetedError, \"subclass responsability\")\n end", "def inherited(klass); end", "def inherited(klass); end", "def initialize(base)\n @base = base\n end", "def method_missing(method, *args, &block)\n name = method.to_s\n if respond_to_missing? name\n @bases[name]\n else\n super(method, *args, &block)\n end\n end", "def initialize(base_object)\n @base_object = base_object\n end", "def method_missing(method_name, *args, &block)\n base.respond_to?(method_name) ? base.send(method_name, *args, &block) : super\n end", "def inherited(base)\n base.class_eval do\n @name = nil\n @unknown_inc = 0\n @fields = [ ]\n @fields_by_name = {}\n @field_components_by_name = {}\n @klass = nil\n\n record_name self.name.gsub(\"::\",\"_\") if self.name\n end\n end", "def object\n raise NotImplementedError\n end", "def base_resolve(**)\n object\n end", "def base\n raise \"Override the base() method in your controller to define the faceting model/context\"\n end", "def process_hook\n fail 'child class to implement'\n end", "def overrides; end", "def type; super; end", "def base\n\t\t\t\tself.class.new(@path, nil, nil, nil)\n\t\t\tend", "def superclass\n\t\t\t\treturn Object\n\t\t\tend", "def process\n raise Error::new(\"This method should be implemented by a subclass\")\n end", "def inherited( subclass )\n\t\t\tsuper\n\n\t\t\tverbs_copy = Strelka::DataUtilities.deep_copy( self.resource_verbs )\n\t\t\tsubclass.instance_variable_set( :@resource_verbs, verbs_copy )\n\n\t\t\topts_copy = Strelka::DataUtilities.deep_copy( self.service_options )\n\t\t\tsubclass.instance_variable_set( :@service_options, opts_copy )\n\t\tend", "def dispatch\n raise NotImplementedError\n end", "def super_class; end", "def super_class; end", "def is_object()\n res = super(context,self)\n return res\n end", "def inherited(subclass)\n super\n\n subclass.serialization.replace serialization\n subclass.fields.replace fields\n end", "def method_missing(name, *args, &block)\n return super unless base.respond_to? name# and forward? name\n base.send(name, *args, &block)\n end", "def handler_base_class; end", "def superclass=(object); end", "def type\n raise 'derived should implement'\n end", "def inherited(base)\n Base.inherited(base)\n end", "def on_base\n on(:base)\n end", "def on_base\n on(:base)\n end", "def on_base\n on(:base)\n end", "def use(*)\n super\n end", "def write_object(object)\n extend_for(super)\n end", "def initialize(base = nil)\n super\n @type = self.class.symbolize\n @base.type ||= TYPES[@type]\n end", "def inherit_stuff\n return unless accepted_genus\n\n self.classification ||= accepted_genus.classification\n self.lifeform ||= accepted_genus.lifeform\n end", "def initialize(base, target, association)\n super do\n characterize_one(_target)\n bind_one\n characterize_one(_target)\n update_attributes_hash(_target)\n _base._reset_memoized_descendants!\n _target.save if persistable?\n end\n end", "def child_class\n Objekt\n end", "def process_hook\n fail 'sub class to implement'\n end", "def base\n self\n end", "def extend_object(obj) end", "def method_missing(meth, *args, &block)\n Interrogate.is_interrogatory?(meth) ? Interrogate.interrogate(meth, *args, &block) : super\n end", "def base=(_arg0); end", "def foo(...)\n super(...)\nend", "def binding; super end", "def modify\n super\n end", "def fix_basic_object_inheritance\n basic = classes_hash['BasicObject']\n return unless basic\n basic.superclass = nil\n end", "def cleanup\n super\n end", "def virtual; end", "def super_method; end", "def inherited(base)\n\t\tbase.define_method teardown do\n\t\t\tsuper\n\t\tend\n\tend", "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 object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def run\n super\n end", "def run\n super\n end", "def inherited(subclass)\n object_alias = subclass.name.demodulize.chomp('Serializer').underscore\n subclass.object_as(object_alias) unless method_defined?(object_alias)\n super\n end", "def initialize(base=nil)\r\n get(base)\r\n end", "def realize_self\n raise NotImplementedError\n end", "def method_missing(meth, *args, &block)\n if respond_to?(meth)\n object.__send__(meth, *args, &block)\n else\n super\n end\n end", "def call\n # implement in subclasses\n end", "def post_initialize\n # Base class does nothing\n end", "def object_status\n super\n end", "def object_status\n super\n end", "def object_status\n super\n end", "def method_missing(method, *args, &block)\n super unless original_self\n original_self.send method, *args, &block\n end", "def cleanup\n super\n end", "def initialize()\n # override parent\n end", "def inherited(base)\n base.send :create_dynamic_classes\n super\n end", "def on_base\n on(:base)\n end", "def base_class!\n @base_class = self\n end", "def new \n super\n end", "def inherit(_, context = {})\n throw context[:abort] if context[:pallet][context[:key]]\n end", "def new \n super\n end", "def invoke\n raise NotImplementedError, \"Author of subclass forgot to implement #invoke\"\n end", "def handle; end", "def dynamic_forwarding\n super\n end", "def run\n\t\tsuper\n\n\t begin\n\t\t\tif @object.kind_of?(Device)\n\t\t\t\tif @object.name\n\t\t\t\t\tbegin\n\t\t\t\t\t\tresolved_address = Resolv.new.getaddress(@object.name)\n\t\t\t\t\t\[email protected] = resolved_address\n\t\t\t\t\trescue Exception => e\n\t\t\t\t\t puts e\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\traise \"Error, object has no name to look up! Try a reverse lookup!\"\n\t\t\t\tend\n\n\t\t\t\t## Attach Mail Servers?\n\n\t\t\t\t## Other Records?\n\t\t\t\t\n\t\t\telsif @object.kind_of?(Domain)\n\t\t\t\tbegin\n\t\t\t\t\tif @object.name\n\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\tresolved_address = Resolv.getaddress(@object.name)\n\t\t\t\t\t\t\th = create_object Device, { :ip_address => resolved_address }\n\t\t\t\t\t\t\th.domains << @object\n\t\t\t\t\t\trescue Exception => e\n\t\t\t\t\t\t puts e\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\traise \"Error, object has no name to look up! Try a reverse lookup!\"\n\t\t\t\t\tend\n\t\t\t\trescue \n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\t\t\n\t\t\tend\n\t\t\t\n\t\trescue Exception => e\n\t\t\tputs e.to_s\n\t\tend\n\t\t\n\t\n\t\t\n\t\[email protected]!\n nil\n\tend", "def prepare\n super\n end" ]
[ "0.6963095", "0.65463156", "0.6407889", "0.6309609", "0.6252875", "0.6231762", "0.6188301", "0.6181964", "0.61771184", "0.61690414", "0.61668307", "0.61189777", "0.61189777", "0.6088273", "0.607881", "0.6070823", "0.60639805", "0.6062341", "0.6033498", "0.60333115", "0.6013347", "0.6005994", "0.598869", "0.59774536", "0.59686226", "0.59674364", "0.59486455", "0.5934714", "0.5917259", "0.58799124", "0.58799124", "0.5875487", "0.5849339", "0.58323747", "0.58275783", "0.5826292", "0.58118707", "0.57946444", "0.57731366", "0.57731366", "0.57731366", "0.5757098", "0.573493", "0.5716659", "0.57001036", "0.56956446", "0.5690118", "0.56801814", "0.567845", "0.56727797", "0.5671343", "0.5654689", "0.56394345", "0.5635395", "0.5630948", "0.56295526", "0.5626196", "0.56193817", "0.561935", "0.55903655", "0.5573535", "0.5567536", "0.5567536", "0.5567536", "0.5567536", "0.5567536", "0.5567536", "0.5567536", "0.5567536", "0.5567536", "0.5567536", "0.5567536", "0.5567536", "0.5567536", "0.5567536", "0.5567536", "0.55612695", "0.55612695", "0.55575883", "0.5554364", "0.5548831", "0.5546098", "0.554551", "0.5544512", "0.55429447", "0.55429447", "0.55429447", "0.5520656", "0.55197644", "0.5511723", "0.55109245", "0.55058455", "0.55034083", "0.54972494", "0.5492246", "0.5489501", "0.54857904", "0.54810196", "0.54771554", "0.54755616", "0.54703575" ]
0.0
-1
Created a bonus method here that will add a hash of students
def add_hash_of_students(student_hash) student_hash.each do |grade, students| @roster[grade] ||= [] students.each {|student| @roster[grade] << student} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_student(student, grade_num) #adds student into roster hash\n if @roster[grade_num]\n @roster[grade_num] << student\n else\n @roster[grade_num] = [student]\n end\nend", "def add_student(student, grade_num) #adds student into roster hash\n if @roster[grade_num]\n @roster[grade_num] << student\n else\n @roster[grade_num] = [student]\n end\nend", "def add_student(school,new_student)\n new_student_hash = {}\n new_student_hash[:name] = new_student\n school[:students] << new_student_hash\nend", "def addstudent(student, grade, semester, school)\n school[:students] << {name: student, grade: grade, semester: semester} \nend", "def add_student(school, new_student_name, new_student_grade, new_student_semester)\n school[:students].push(:name => new_student_name, \n :grade => new_student_grade, :semester => new_student_semester)\nend", "def add_student(student_name, student_grade)\n# pp @roster\n \n if roster[student_grade]\n roster[student_grade] << student_name\n else\n roster[student_grade] = []\n roster[student_grade] << student_name\n end\n\n# roster[grade] name\n end", "def add_student(student_name, student_grade)\n\t\tSCHOOL[:students] << {:name => student_name, :grade => student_grade}\n\tend", "def add_student(student, school)\t\t\t\t\t\t\t\t\t\t\t\t#ci. create method to add stuents\n\tschool[:students].push({:name=>student})\nend", "def add_student(student_name, grade)\n if @roster.has_key?(grade)\n @roster[grade] << student_name\n else\n @roster[grade] = []\n @roster[grade] << student_name\n end\n end", "def add_student(student_name, grade)\n roster[grade] ||= []\n roster[grade] << student_name\n end", "def add_student(student, grade)\n @roster[grade] ||= []\n @roster[grade] << student\n # binding.pry\n end", "def add_new_student_to_schools_student_array(new_student_name, new_student_grade, school)\n new_student = {name: new_student_name, grade: new_student_grade}\n #school[:students].push(new_student)\n school[:students][school[:students].size] = new_student\n school\nend", "def student_add( students_hash)\n students_hash.each do |key,value|\n\n students_hash[key] = (value + (value * 5.0)/100).round(0)\n #puts \"#{value+20}\" #(value * 5.0)/100\n # puts (\"#{key}: #{value} students\")\n end\n end", "def add_student(student_name, grade)\n # roster[grade] = [] # ...first: create the new key and point it to an empty array\n roster[grade] ||= [] # add multiple students to a grade & add students to different grades using ||=\n roster[grade] << student_name # ...then: push the new value into that array\n end", "def add_students(name, cohort, country, height, hobbie)\n\t@students << {name: name, cohort: cohort.to_sym, country: country.to_sym, height: height.to_sym, hobbie: hobbie.to_sym }\nend", "def add_student (name, grade)\n # @student_name = name\n # @grade = grade\n if @roster.include?(grade) \n @roster [grade] << name \n else\n @roster [grade] = [name]\n end\n end", "def addstudent(newname, schoolvar)\n\tschoolvar[:students]<<{:name=>newname}\nend", "def add_student(student_name, grade)\n if @roster[grade]\n @roster[grade] << student_name\n else\n @roster[grade] = []\n @roster[grade] << student_name\n end\n end", "def add_student_attributes(student_hash)\n @twitter = student_hash[:twitter]\n @linkedin = student_hash[:linkedin]\n @github = student_hash[:github]\n @blog = student_hash[:blog]\n @profile_quote = student_hash[:profile_quote]\n @bio = student_hash[:bio]\n @profile_url = student_hash[:profile_url]\n\n end", "def add_student(name, grade)\n if roster.key?(grade) == false\n roster[grade] = [ ]\n roster[grade] << name \n else \n roster[grade] << name\n end \n end", "def add_student(name, grade)\n @roster[grade] ||= []\n @roster[grade] << name\n end", "def add_student(name, grade)\n roster[grade]||=[]\n roster[grade] << name\n end", "def hash_builder(student)\n student_hash = { id: student.id, name: student.first_name + ' ' + student.s_last_name,\n other_interventions: student.num_other_programs,\n tutor: student.vol_name, first_attempt_average: @acumen_one,\n second_attempt_average: @acumen_two,\n hug_gain: (@acumen_two - @acumen_one).round(2),\n last_year_dra_gains: @last_year_dra_gains,\n fall_dra: @student_record[:fall_dra], winter_dra: @student_record[:winter_dra],\n mid_year_dra_gain: @student_record[:mid_year_dra_gain],\n spring_dra: @student_record[:spring_dra], end_year_dra_gain: @student_record[:end_year_dra_gain],\n fall_rit: @student_record[:fall_rit], winter_rit: @student_record[:winter_rit],\n mid_year_rit_gain: @student_record[:mid_year_rit_gain],\n spring_rit: @student_record[:spring_rit], end_year_rit_gain: @student_record[:end_year_rit_gain],\n fall_rank: @student_record[:fall_rank], winter_rank: @student_record[:winter_rank],\n mid_year_rank_gain: @student_record[:mid_year_rank_gain],\n spring_rank: @student_record[:spring_rank], end_year_rank_gain: @student_record[:end_year_rank_gain],\n fall_lexile: @student_record[:fall_lexile], winter_lexile: @student_record[:winter_lexile],\n spring_lexile: @student_record[:spring_lexile] }\n student_hash\n end", "def add_student(name, grade)\r\n roster[grade] = [] unless roster[grade]\r\n roster[grade] << name\r\n end", "def add_student(student_name, grade)\n if @roster[grade]\n @roster[grade].push(student_name)\n else\n #if not present, create the key and empty array value and add \n #the student name to it\n @roster[grade] = []\n @roster[grade].push(student_name)\n end\n end", "def total_students( students_hash)\n st_counter =0\n students_hash.each do |key,value|\n st_counter += value\n #puts (\"#{key}: #{value} students\")\n end\n return st_counter\nend", "def add_student (name,grade)\n if @roster[grade] == nil\n @roster[grade] = []\n @roster[grade] << name\n else \n @roster[grade] << name\n end \nend", "def add_student(name, cohort, food)\n @students << {name: name, cohort: cohort.to_sym, food: food}\nend", "def add_new_student(school, name)\n\tschool[:students].push({:name => name})\nend", "def add_student(student_name, grade)\n if @roster[grade] == nil\n @roster[grade] = []\n end\n @roster[grade] << student_name\n end", "def add_student(name, grade)\n #check if empty\n if roster[grade] != nil\n roster[grade] << name\n else\n roster[grade] = [name]\n end\n end", "def total_students(hash)\n\ttotal = 0\n\thash.each { |key, value| total += value }\n\treturn total\nend", "def add_student(name, grade)\r\n if @roster[grade] != nil \r\n @roster[grade] << name\r\n else\r\n @roster[grade] = [name]\r\n end\r\n end", "def percentage_add(hash_array)\n hash_array.each do |student|\n per = student[:marks]\n p per\n student[:percentage] = (per*100)/100\n end\nend", "def add_student(name, grade)\n\t\tif @roster.key?(grade)\n\t\t\t@roster[grade] << name\n\t\telse \n\t\t\t@roster[grade]= []\n\t\t\troster[grade] << name\n\t\tend\n\tend", "def add_student(student, grade_level)\n roster[grade_level] ||= []\n roster[grade_level] << student \n end", "def add(list, student,group)\n list[student] = group\nend", "def add_student(new_student)\n @students << new_student\n end", "def add_student(name, grade, semester)\n\t\tstudents.push( {:name => name, :grade => grade, :semester => semester} )\n\tend", "def add_student(name, cohort)\n @students << {name: name, cohort: cohort.to_sym}\nend", "def student_in_hash(inputname, inputpronoun, inputcohort, inputcountry, inputheight, inputhobbies)\n inputpronoun = \"they\" if inputpronoun == \"\"\n inputcohort = \"november\" if inputcohort == \"\"\n student = {\n name: inputname,\n pronoun: inputpronoun,\n cohort: inputcohort.to_sym,\n country: inputcountry,\n height: inputheight,\n hobbies: inputhobbies\n }\n return student\nend", "def add_to_students(name,cohort,country)\n @students << {name: name, cohort: cohort.to_sym, country: country, language: :Ruby}\nend", "def total_students(students)\n sum = 0\n students.each do |key, value|\n sum += value.to_i\n end\n puts \"the total number of students is #{sum}\"\nend", "def add_student(student)\n @students << student\n end", "def fill_student_hash\n students = create_student_hash\n add_links_to_hash(students) \n populate_hash(students)\n #html_hash = scrape_and_store_each_profile(doc)\n #populate_hash_with_profile(students, html_hash, :tagline, '.textwidget h3') #tagline\n #populate_hash_with_bio(students, html_hash) #bio\n #populate_hash_with_social(students, html_hash, :github, 2) #github\n #populate_hash_with_social(students, html_hash, :twitter, 0) #twitter\n #populate_hash_with_social(students, html_hash, :linkedin, 1) # linkedin\nend", "def student_array_adder(name, cohort, hobby, birth_country)\n @students << {name: name, cohort: cohort, hobby: hobby, birth_country: birth_country}\n return @students\nend", "def push_to_students(name, cohort, height, eyecolour)\n @students << {name: name, cohort: cohort, height: height, eyecolour: eyecolour}\nend", "def update_students(name, cohort)\n @students << {name: name, cohort: cohort.to_sym}\nend", "def add_students(name, cohort)\n @students << {name: name, cohort: cohort}\nend", "def add_student(student)\n @student << student\n end", "def new_student(list, name, grade, semester)\n\tlist.push( {:name => name, :grade => grade, :semester => semester} )\nend", "def create_hash_class \n\t hash_class = {}\n\t @students_list.select do |student|\n\t\thash_class[student.name] = student.create_score_hash\n\t end\n\t puts \"Class's Hash: #{hash_class}\"\n\tend", "def add_student=(student_id)\n return unless student_id.present?\n students << Student.find(student_id)\n end", "def add_student_attributes(attributes_hash)\n attributes_hash.each do |attr, value| #from the hash get each attribute and value\n self.send(\"#{attr}=\", value) #send the studen tthe new attribute/value key pair\n end #end the each-do\n self #call self\n end", "def compute_student_hashes(authorized_student_ids)\n # Students table first\n authorized_students = Student.where(id: authorized_student_ids).includes(:homeroom)\n students_json = authorized_students.as_json({\n except: [\n :primary_phone,\n :primary_email,\n :student_address\n ]\n })\n\n # Optimized computation for aggregates\n aggregates = {\n discipline_incidents_count: DisciplineIncident.where(student_id: authorized_student_ids).where('occurred_at >= ?', first_day_of_school).group(:student_id).count,\n absences_count: Absence.where(student_id: authorized_student_ids).where('occurred_at >= ?', first_day_of_school).group(:student_id).count,\n tardies_count: Tardy.where(student_id: authorized_student_ids).where('occurred_at >= ?', first_day_of_school).group(:student_id).count\n }\n\n # Merge\n authorized_students.each_with_index.map do |student, index|\n HashWithIndifferentAccess.new(students_json[index].merge({\n discipline_incidents_count: aggregates[:discipline_incidents_count].fetch(student.id, 0),\n absences_count: aggregates[:absences_count].fetch(student.id, 0),\n tardies_count: aggregates[:tardies_count].fetch(student.id, 0),\n homeroom_name: student.try(:homeroom).try(:name)\n }))\n end\n end", "def increase_students(more_students)\n\tmore_students.each do |cohort, number| \n\t\tmore_students[cohort] = number * 1.05\n\tend\nend", "def fat_student_hash(student)\n HashWithIndifferentAccess.new(student.as_json({\n except: [\n :primary_phone,\n :primary_email,\n :student_address\n ]\n }).merge({\n has_photo: student.has_photo,\n discipline_incidents_count: student.most_recent_school_year_discipline_incidents_count,\n absences_count: student.most_recent_school_year_absences_count,\n tardies_count: student.most_recent_school_year_tardies_count,\n homeroom_name: student.try(:homeroom).try(:name),\n event_notes_without_restricted: student.event_notes_without_restricted,\n interventions: student.interventions,\n sped_data: sped_data(student)\n }))\n end", "def fat_student_hash(student)\n HashWithIndifferentAccess.new(student_hash_for_slicing(student).merge({\n event_notes_without_restricted: student.event_notes_without_restricted,\n interventions: student.interventions,\n sped_data: student.sped_data,\n }))\n end", "def assign_students(name, cohort)\n @students << {name: name, cohort: cohort.to_sym, country_of_birth: :unknown, height: :unknown, hobbies: :unknown}\nend", "def student_hash_for_slicing(student)\n student.as_json.merge({\n student_risk_level: student.student_risk_level.as_json,\n discipline_incidents_count: student.most_recent_school_year.discipline_incidents.count,\n absences_count: student.most_recent_school_year.absences.count,\n tardies_count: student.most_recent_school_year.tardies.count,\n homeroom_name: student.try(:homeroom).try(:name)\n })\n end", "def fat_student_hash(student)\n HashWithIndifferentAccess.new(student_hash_for_slicing(student).merge({\n interventions: student.interventions,\n student_risk_level: student.student_risk_level.decorate.as_json_with_explanation,\n }))\n end", "def enroll(new_student)\n @students.push(new_student)\n end", "def add_to_score_hash(markable, score)\n scores_hash[assessment_group.id][markable.id][student.id] = score\n end", "def add_student_attributes(attributes_hash)\n # Iterate over the given hash and use meta-programming to\n # dynamically assign student attr per the key/value pairs\n \n attributes_hash.each { |key, value| self.send((\"#{key.to_s}=\"), value)}\n \n end", "def addstudent(name, grade, semester)\n\t\[email protected](:name=>name, :grade=>grade, :semester=>semester)\n\tend", "def add_student_name(name)\n @student_names << name\n end", "def add_student_attributes(attributes_hash)\n attributes_hash.each {|key, value| self.send((\"#{key}=\"), value)\n }\n end", "def add_student_attributes(attributes_hash)\n attributes_hash.each {|k,v| self.send((\"#{k}=\"), v)}\n end", "def display_student(s) #method to iterate through any hash\n sum = 0 # declares initial value of sum\n s.each do|k,v|\n puts \" #{k}: has #{(v*1.05).round} students\" #increase class size by 5% and round down\n\n sum +=v #counter for sum of values\n end\n puts \"#{sum} total students\"# puts sum of values\nend", "def add_student_attributes(attributes_hash) #instance variables assign to key,value\n attributes_hash.each do |key,value| \n if key == :twitter\n @twitter = value\n elsif\n key == :linkedin\n @linkedin = value\n elsif\n key == :github\n @github = value\n elsif\n key == :blog\n @blog = value\n elsif\n key == :profile_quote\n @profile_quote = value\n elsif\n key == :profile_url\n @profile_url = value\n elsif\n key == :bio\n @bio = value\n end\n end\n # binding.pry\n end", "def add_student_attributes(attributes_hash)\n attributes_hash.each {|k,v| self.send((\"#{k}=\"), v)}\n end", "def add_student\n (Student.order(:first_name).all - students).pluck:first_name, :id\n end", "def index\n @students = Student.all\n\n names_table = [\"Pera\", \"Mika\", \"Zika\", \"Sanja\", \"Tanja\", \"Vanja\", \"Rasa\", \"Ceca\", \"Jaca\", \"Mica\", \"Steva\"]\n @pupils = Hash.new\n @st_count = rand(90..110)\n for i in 0..@st_count\n rand_name = names_table[rand(0..names_table.length-1)]\n rand_surname = names_table[rand(0..names_table.length-1)][0..-2] + \"ic\"\n rand(0..1) == 1 ? is_girl = \"girl\" : is_girl = \"boy\"\n @pupils[\"name\"] = rand_name+\" \"+rand_surname\n if(is_girl == \"girl\")\n @pupils[\"is_girl\"] = true\n else\n @pupils[\"is_girl\"] = false\n end\n @pupils[\"is_special\"] = false\n @student = Student.new(@pupils)\n @student.save\n puts @pupils\n end \n end", "def insert_list(p_name, p_cohort)\n @students << {name: p_name, cohort: p_cohort.to_sym}\nend", "def get_grades(student, school)\t\t\t\t\t\t\t\t\t\t\t\t\t#a. create method to return student's grade\n\tschool[:students].each do |s|\n\t\tputs s[:grade] if s[:name] == student\n\tend\nend", "def enroll(new_student) \n @students.push(new_student) \n end", "def add_student_attributes(attributes_hash)\n attributes_hash.each {|key,value| self.send((\"#{key}=\"),value)}\n end", "def add_student_attributes(attributes_hash)\n attributes_hash.each do |k, v|\n self.send((\"#{k}=\"), v)\n end\n end", "def grade(student, school)\n school[:students].each do |s|\n return s[:grade] if s[:name] == student\n end\nend", "def add_student_attributes(attributes_hash)\n attributes_hash.each do |key, value|\n self.send(\"#{key}=\", value)\n end\n self\n end", "def student_count(hash)\n hash.each do |x, y|\n puts \"#{x}: #{y} students\"\n end\nend", "def sort\nstudent_hash = {}\n @roster.each do |grade, students|\nstudent_hash[grade] = students.sort\n end\n student_hash\nend", "def add_student_attributes(attributes_hash)\n @twitter = attributes_hash[:twitter]\n @linkedin = attributes_hash[:linkedin]\n @github = attributes_hash[:github]\n @blog = attributes_hash[:blog]\n @profile_quote = attributes_hash[:profile_quote]\n @bio = attributes_hash[:bio]\n # @profile_url = attributes_hash[:profile_url]\n self\n end", "def input_students\n # Exercise 7 - Ask for both name and cohort and check conditions\n def enter_info(instruction)\n # Do a loop until user inputs correct value\n while true do\n puts instruction\n # Exercise 10 - Use another method to get rid of last character\n input = gets.gsub(\"\\n\", \"\")\n # If input contains numbers (strings default to 0)\n if input.to_i != 0\n puts \"Letters only\"\n next\n end\n # Break loop if user has entered a valid value\n break unless input.empty?\n puts \"No value entered\"\n end\n input\n end\n # Create method for enter_age\n def enter_age(age)\n # Do a loop until user inputs correct value\n while true do\n puts \"Please enter age\"\n age = gets.chomp.to_i\n age < 18 || age > 99 ? \"Not valid\" : break\n end\n age\n end\n\n puts \"Enter student information as prompted\"\n # Create and empty array\n students = []\n # Loop through adding students\n while true do\n # Get the first name\n name = enter_info(\"Please enter name\")\n # Exercise 5 - Add more information\n # Get cohort\n cohort = enter_info(\"Please enter month of cohort you are attending\")\n # Get the age\n age = enter_age(\"Please enter age\")\n # Get the country of birth\n country = enter_info(\"Please enter country of birth\")\n # Add the student hash to the array\n students << {name: name, cohort: cohort, age: age, country: country}\n # Exercise 9 - Use singular or plural when appropiate\n puts \"Now we have #{students.count} #{one_or_more?(students)}\"\n # Prompt user if they want to add more students, otherwise break\n puts \"Continue adding students? y/n (anything other than y will default to n)\"\n break if gets.chomp.downcase != \"y\"\n\n end\n students\nend", "def make_student(name, height, courses, hobbies)\n {\n name: name,\n height: height,\n courses: courses,\n hobbies: hobbies\n }\nend", "def initialize(student_hash)\n #for each student in hash, create a k/v pair via mass asign (.send)\n student_hash.each {|k,v| self.send((\"#{k}=\"), v)}\n self.save\n end", "def update_student\n name = ask_for(\"name of the student you want to change\")\n selected_student = find_student(name)\n print_names(selected_student)\n confirmation = ask_for(\" Y/N to modify\")\n if confirmation.downcase == \"y\"\n selected_student.first[:name] = ask_for(\"New name\")\n selected_student.first[:cohort] = ask_for(\"New cohort\")\n selected_student.first[:hobbies] = ask_for(\"New hobbies\")\n @students.map! {|student| (student[:name] == selected_student.first[:name]) ? selected_student.first : student }\n end\nend", "def default_students\n\nstudents = [\n {name: \"Dr. Hannibal Lecter\",cohort: :november, hobby: :sport, weight: 87, age: 64},\n {name: \"Darth Vader\", cohort: :november, hobby: :reading, weight: 87, age: 53},\n {name: \"Nurse Ratched\", cohort: :november, hobby: :music, weight: 100, age: 42},\n {name: \"Michael Corleone\", cohort: :november, hobby: :coding, weight: 68, age: 24},\n {name: \"Alex DeLarge\", cohort: :november, hobby: :coding, weight: 130, age: 28},\n {name: \"The Wicked Witch of the West\", cohort: :november ,hobby: :gaming, weight: 120, age: 43},\n {name: \"Terminator\", cohort: :november, hobby: :music, weight: 72, age: 34},\n {name: \"Freddy Krueger\", cohort: :november, hobby: :reading, weight: 55, age: 18},\n {name: \"The Joker\", cohort: :november, hobby: :sport, weight: 30, age: 45},\n {name: \"Joffrey Baratheon\", cohort: :november, hobby: :music, weight: 70, age: 30},\n {name: \"Norman Bates\", cohort: :november, hobby: :music, weight: 80, age: 25}\n]\nend", "def write_students\n @students << {name: @name, cohort: :november}\nend", "def newstudent firstname, lastname, course\n $roster << {firstname: firstname, lastname: lastname, course: course}\nend", "def add(hash); end", "def total_students\n students = 0\n self.booked_customers.each do |school|\n students += school.number_students\n end\n return students\n end", "def grade(name, schoolvar)\n schoolvar[:students].each do |students|\n\t\tif students[:name]==name\n\t\tprint students[:grade]\n\t\tend\n\tend\nend", "def new_student(name, email)\n #code here\n @students.push({name: name, email: email})\nend", "def add_students\n @paper = Paper.find(params[:id])\n @old_students = Array.new(@paper.students)\n @paper.student_ids = params[:student_ids]\n @paper.save!\n # student rows to be updated with changes in subjects\n @students = (@old_students | @paper.students) - (@old_students & @paper.students)\n end", "def get_grade(school, name) \n\t\t\t grade = nil\n school[:students].each do |student|\n if student[:name] == name\n grade = student[:grade]\n end\n end\n return grade\nend", "def all_cohorts (hash_value)\n total_students = hash_value.each_value.reduce(:+)\n puts total_students\nend", "def add_student_to_course(student_id, name, email)\n if Student.find_by_email(email)\n student = Student.find_by_email(email)\n else\n student = Student.new\n student.email = email\n student.student_id = student_id\n student.name = name\n student.university = Faculty.find(faculty_id).university\n end\n\n if self.surveys.count > 0\n add_student_to_course_surveys(student)\n end\n\n self.students << student\nend", "def show_hash(students)\nstudents.each {|key, value| puts \"#{key}: #{value} students\" }\nend", "def total_siblings \n instructors_hash.sum do |instructors_hash|\n instructors_hash[:siblings]\n end \nend" ]
[ "0.7346915", "0.7346915", "0.7302284", "0.7275997", "0.70445675", "0.7043122", "0.69970506", "0.6981233", "0.6929459", "0.6925385", "0.6920503", "0.6893093", "0.6889038", "0.6881075", "0.6860726", "0.683737", "0.68144435", "0.6781012", "0.6766958", "0.6765818", "0.67642844", "0.6758896", "0.67548186", "0.6754526", "0.67262495", "0.67219037", "0.67080665", "0.66860265", "0.6677923", "0.66773117", "0.66289705", "0.6607083", "0.65837187", "0.6582446", "0.6578287", "0.6491124", "0.64642906", "0.64430666", "0.64267784", "0.64029896", "0.637988", "0.6368299", "0.6349374", "0.6335452", "0.63226306", "0.63185513", "0.6317868", "0.63042474", "0.62746084", "0.6249189", "0.6205023", "0.6175048", "0.6168748", "0.61477876", "0.61375123", "0.61361885", "0.6125809", "0.6120654", "0.6084215", "0.6071997", "0.6067437", "0.60653234", "0.60639733", "0.60612094", "0.6056463", "0.6044922", "0.60353506", "0.60311884", "0.6030806", "0.60284895", "0.60284233", "0.6027832", "0.6024062", "0.602322", "0.6022962", "0.59969187", "0.599327", "0.59921926", "0.59837496", "0.5965334", "0.59645236", "0.59593254", "0.5951468", "0.59477895", "0.5935737", "0.5932837", "0.59109175", "0.5898314", "0.589473", "0.5855796", "0.58525175", "0.5851758", "0.5847009", "0.5838168", "0.5831328", "0.58245915", "0.581624", "0.5802273", "0.57940143", "0.5793932" ]
0.74446166
0
helpers for devise sessions
def resource_name :user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def session\n end", "def sign_in\n current_session || sign_user_in\nend", "def sign_in\n session[:user_id] = @user.id\n end", "def session; end", "def session; end", "def session; end", "def session; end", "def valid_session\n { \"warden.user.user.key\" => session[\"warden.user.user.key\"] }\n end", "def sign_in\n current_session || sign_user_in # not evaluated unless current session is nil\nend", "def valid_session\n {\"warden.user.user.key\" => session[\"warden.user.user.key\"]}\n end", "def ensure_session_token\n self.session_token ||= User.generate_session_token\nend", "def logged_in?\n session['logged_in']\n #false\n end", "def logged_in_user_id\n session[:user_id]\n end", "def set_session\n\t #no idea why I need this, but login form seems to break otherwise\n\t session[:email] = session[:email]\n\t session[:password] = session[:password]\n\t end", "def session_id\n super\n end", "def session_id\n super\n end", "def logged_in?\n #session_authenticated?\n session[:logged_in]\n end", "def valid_session\n {\n :user_id => AUTHENTICATED_USER_ID,\n }\n end", "def logged_in\r\n end", "def session_passwd\n super\n end", "def session_passwd\n super\n end", "def login_from_session\nself.current_user = User.find_by_id(session[:user_id]) if session[:user_id]\nend", "def logged_in?\n !session[:email].nil?\n end", "def logged_in?\n session[:password] == true\n end", "def sign_in\n\tend", "def login(user)\n #assign session_token and give it as a cookie to the client's browser \n session[:session_token] = user.reset_session_token! #a method \n #putting a key-value pair into the session hash \n #session hash is only available in controllers and views \n end", "def sign_in\n\n end", "def sign_in(user)\n session[:user_id] = user.id\n end", "def sign_in(user)\n session[:user_id] = user.id\n end", "def sign_in(user)\n session[:user_id] = user.id\n end", "def sign_in(user)\n session[:user_id] = user.id\n end", "def logged_in\n !!session[:user_id]\n end", "def sign_in\n end", "def setup_session\n @session_id ||= if @smug_user.email\n setup_session_with_username\n else \n setup_session_anonymously\n end\n end", "def logged_in?\n session[:user_id]\n end", "def sign_in\n trait()\n end", "def logged_in?\n if session[:user_id]\n true\n else\n false\n end\nend", "def user_signed_in?\n session.has_key? :user_id\n end", "def valid_session\n { }\n end", "def autologin_the_user\n #unless logged_in?\n # FrontendUserSession.create(params[:frontend_user_session])\n #end\n end", "def logged_in?\n session[:logged_in]\n end", "def logged_in?\n session[:logged_in]\n end", "def log_in(user)\n session[:user_id] \t = user.id\n session[:user_name] = user.name\n session[:user_email] = user.email\n end", "def logged_in?\n session.has_key? :user\n end", "def ensure_session_token\n self.session_token ||= User.generate_session_token\n end", "def ensure_session_token\n self.session_token ||= User.generate_session_token\n end", "def ensure_session_token\n self.session_token ||= User.generate_session_token\n end", "def logged_in?\n session[:login]\n end", "def valid_session\n {\n # good: \"user_id\"=> @user.id\n \"user_id\"=> user.id \n }\n end", "def valid_session\n { }\n end", "def logged_in?\n session[:user]\n end", "def valid_session\n {:user_id => @user.id}\n end", "def sign_in\n trait\n end", "def user_authentication\n end", "def user_signed_in?\n session[:user_id].present?\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_as\n user = User.find session[:user_id]\n \"Logged in as #{user.email}\"\n end", "def signingIn (authentication)\n\n if authentication.instance_of?(Authentications)\n user = Customer.where(:id => authentication.user_id).first\n session[:user_id] = user.id\n current_user.sign_in_count +=1\n current_user.last_sign_in_at = Time.now\n current_user.current_sign_in_at = Time.now\n current_user.last_sign_in_ip = request.remote_ip \n current_user.current_sign_in_ip = request.remote_ip \n current_user.save\n @@logingIn=0\n redirect_to root_path, :notice => \"Logged in successfully\"\n else\n @@logingIn=0\n redirect_to root_path, :notice => \"Sorry! You need to register first \"\n\n end\n\n\nend", "def check_session\n unless (params[:controller] == \"devise/sessions\" || \n params[:controller] == \"devise_invitable/registrations\" || \n params[:controller] == \"devise/invitations\" ||\n params[:controller] == \"devise/confirmations\" ||\n params[:controller] == \"devise/passwords\")\n unless user_signed_in?\n redirect_to root_path\n flash[:error] = \"You need to sign in to access\"\n return\n end\n end\n end", "def logged_in?\n session[:user_id] != nil\nend", "def sign_in(shop)\n session[:shop_id] = shop.id\n end", "def logged_in?\n session[:authorized] == true\n end", "def session_id; end", "def session_id; end", "def session_id; end", "def devise_scope(scope); end", "def logged_in?\n !!session[:user]\nend", "def user?\n session.key? 'user'\nend", "def session; @session; end", "def session; @session; end", "def session; @session; end", "def session?\n session[:user_id]\n end", "def logged_in?\n session_user != nil\nend", "def set_session\n \n end", "def logged_in?\nnot session[:user_id].nil?\nend", "def sign_in(user)\n session[:user_id] = user.id\n end", "def logged_in? \n !!session[:skater_id]\n end", "def is_logged_in?\n session[:user_id].present?\n end", "def logged_in?\n if session[:int_key].nil? || session[:email].nil? || session[:password].nil? || session[:logged_in].nil?\n false\n else\n true\n end\n end", "def user_logged_in?\n session[:user]\n end", "def authenticate(_)\n super(session_params)\n end", "def user_signed_in?\n session[:user_id] != nil\n end", "def user_signed_in?\n session[:user_id] != nil\n end", "def set_user_session\n if signed_in? || devise_controller?\n session[:current_user] = nil\n else\n session[:current_user] = Faker::Internet.username\n end\n end", "def valid_session\n {user_id: @user.id}\n end", "def logged_in? \r\n logger.info(\"Authentication::Logged In::sesssion:---- #{session}\")\r\n if session[:userEmail].blank?\r\n invalid_session = I18n.t(\"message.no_session\") \r\n smv_status = {\r\n :statusCode => -1,\r\n :value => '', \r\n :msg => \"#{invalid_session}\"\r\n }\r\n else\r\n smv_status = {\r\n :statusCode => 0,\r\n :value => '', \r\n :msg => ''\r\n } \r\n end\r\n logger.info(\"Authentication::Logged In::status--- #{smv_status}\")\r\n if smv_status[:statusCode] ==-1\r\n logger.error(\"Authentication::Logged In::status--- #{smv_status}\")\r\n return false\r\n else \r\n return true\r\n end\r\n \r\n end", "def login!(session)\n session[:user_id] = self.id\n end", "def signed_in_user\n #call and check on method signed_in from session helper if not user login\n unless signed_in?\n #show message to the user\n flash[:danger]=\"Please sign in\"\n #link to sign in page\n redirect_to signin_url\n end\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end", "def valid_session\n {}\n end" ]
[ "0.6959048", "0.691217", "0.6860945", "0.6856657", "0.6856657", "0.6856657", "0.6856657", "0.6804514", "0.67686355", "0.67437255", "0.67212814", "0.67205745", "0.6695948", "0.6680773", "0.6658871", "0.6658871", "0.6647527", "0.6636189", "0.66174805", "0.66002256", "0.66002256", "0.65782785", "0.656658", "0.656064", "0.65584606", "0.65550274", "0.6552467", "0.6546617", "0.6546617", "0.6546617", "0.6546617", "0.65413463", "0.6533663", "0.65296906", "0.6516525", "0.65157956", "0.6515125", "0.6513138", "0.65095854", "0.6508581", "0.65054417", "0.65054417", "0.6494784", "0.64824003", "0.6477672", "0.6477672", "0.6477672", "0.6471926", "0.64662635", "0.6455947", "0.645264", "0.64487815", "0.6443839", "0.64407337", "0.6440197", "0.6436149", "0.6436149", "0.6433293", "0.6432944", "0.6431411", "0.64210045", "0.6417683", "0.64147747", "0.6411998", "0.6411998", "0.6411998", "0.6409548", "0.64052147", "0.6403686", "0.6403188", "0.6403188", "0.6403188", "0.6402318", "0.6398858", "0.6395849", "0.6380783", "0.63760173", "0.6374527", "0.6360955", "0.6360897", "0.6345402", "0.6342467", "0.6337605", "0.6337605", "0.6334301", "0.63342583", "0.63305515", "0.6321311", "0.6320731", "0.63110316", "0.63110316", "0.63110316", "0.63110316", "0.63110316", "0.63110316", "0.63110316", "0.63110316", "0.63110316", "0.63110316", "0.63110316", "0.63110316" ]
0.0
-1
ads for swapping code
def get_banner_header if (@banner_ad.nil? || @banner_ad.empty?) "" else render :partial => 'layouts/ads/dfp_header', :locals => {:banner_ad => @banner_ad, :banner_id => @banner_id} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def swap; end", "def swapd\n\t\t\tpush [:swap]\n\t\t\tdip\n\t\tend", "def swap(a,b)\na,b = b,a\nend", "def swap(index1, index2)\n #YOUR WORK HERE\n end", "def swap(a, b)\n\ta,b=b,a\nend", "def swap_elements_from_to(array,a,b)\n array[a] = array[a]^array[b]\n array[b] = array[b]^array[a]\n array[a] = array[a]^array[b]\nend", "def swap(a,b)\n return b,a\nend", "def rolldown\n\t\t\tpush [:swap]\n\t\t\tdip\n\t\t\tswap\n\t\tend", "def swap(a,start1,start2,d)\n for i in 0...d\n temp = a[start1+i]\n a[start1+i] = a[start2+i]\n a[start2+i] = temp\n end\nend", "def swap #\\\n a = pop\n b = pop\n push a\n push b\n end", "def swap\n\t\t\ta = pop\n\t\t\tb = pop\n\t\t\tpush a\n\t\t\tpush b\n\t\tend", "def swap_gladiators\n temp = gladiators[0]\n @gladiators[0] = gladiators[1]\n @gladiators[1] = temp\n end", "def swap(a, b)\n a += b\n b = a - b\n a -= b\n puts \"a = #{a} b = #{b}\"\n end", "def rollup\n\t\t\tswap\n\t\t\tpush [:swap]\n\t\t\tdip\n\t\tend", "def execute_swap graph, swap\n mark {a,b}\n swap a,b\n compute_d {a,b}\n graph.t += swap.gain\n return graph\nend", "def swap_version2(a, b, vars)\n\told_a = eval a, vars\n\told_b = eval b, vars\n eval \"#{a} = #{old_b}\", vars\n\teval \"#{b} = #{old_a}\", vars\n\t\n\t# this method parameter type is String\n\t# eval use #{}, eval \"#{a} = ..\", \"#{b} = ..\", so parameter name can be any other string. \n\tputs a \n\tputs b\nend", "def swap(a, b)\n\ta, b = [b, a]\n\t[a, b]\nend", "def revert_code()\n\t\t\n\tend", "def swap(array, a_index, b_index)\n temp = array[a_index]\n\tarray[a_index] = array[b_index]\n\tarray[b_index] = temp\n return array\nend", "def swap!(a, b) self[a], self[b] = self[b], self[a]; self; end", "def swapper(arr, idx_1, idx_2)\n arr[idx_1] = arr[idx_2] # as soon as I execute this line, it will be [\"c\", \"b\", \"c\", \"d\"]\n arr[idx_2] = arr[idx_1] # then, I excute this line, then it will be [\"c\", \"b\", \"c\", \"d\"], which is wrong!\n arr\n\nend", "def swap_elements(arry)\n #oldx = x x = y y = oldx\n\n val1 = arry[2]\n val2 = arry[1]\n\n arry[1] = val1\n arry[2] = val2\n\n arry\nend", "def name_swap(name)\n name.reverse!\n name\nend", "def rotate\n\t\t\tswap\n\t\t\tpush [:swap]\n\t\t\tdip\n\t\t\tswap\n\t\tend", "def swap_pairs(array)\nend", "def swapper(arr, idx_1, idx_2)\n arr[idx_1], arr[idx_2] = arr[idx_2], arr[idx_1]\n arr\nend", "def swap_modules(mod1, mod2) end", "def swap(array, first_index, second_index)\n temp = array[first_index]\n array[first_index] = array[second_index]\n array[second_index] = temp\nend", "def name_swap(first_name, last_name)\r\n\tcode_name = []\r\n\tcode_name.push(first_name, last_name)\r\n\tcode_name.reverse!.join(' ')\r\nend", "def swap_elements(array)\n swap_2 = array[1]\n swap_3 = array[2]\n ans = array\n \n ans[2] = swap_2\n ans[1] = swap_3\n \n ans\nend", "def swapper(arr, idx1, idx2)\n arr[idx1], arr[idx2] = arr[idx2], arr[idx1]\n arr\nend", "def swap\n us = self.pop(true,false)\n them = self.pop(false,false)\n self.push(us,false,false)\n self.push(them,false,true)\n end", "def swapper(arr, idx_1, idx_2)\n \n arr[idx_1], arr[idx_2] = arr[idx_2], arr[idx_1]\n arr\nend", "def swapper(arr, idx_1, idx_2)\n \n arr[idx_1], arr[idx_2] = arr[idx_2], arr[idx_1]\n arr\nend", "def sw(t, s, c)\n\n end", "def swap (st1, char1, num1, st2, char2, num2, array)\n\n\ttempST = array[st1]\n\ttempCH = array[char1]\n\ttempNM = array[num1]\n\n\tarray[st1] = array[st2]\n\tarray[char1] = array[char2]\n\tarray[num1] = array[num2]\n\n\tarray[st2] = tempST\n\tarray[char2] = tempCH\n\tarray[num2] = tempNM\n\n\treturn array\n\nend", "def swap(array, index_one, index_two)\n temp = array[index_one]\n array[index_one] = array[index_two]\n array[index_two] = temp\nend", "def swap!(a,b)\n self[a], self[b] = self[b], self[a]\n end", "def swap(list, src, dst)\n\t\tswap = list[dst]\n\t\tlist[dst] = list[src]\n\t\tlist[src] = swap\n\tend", "def swap(a,b)\n i = self.clone\n av = i[a]\n i[a] = i[b]\n i[b] = av\n return i\n end", "def swap (array, first, second)\n original_first = array[first]\n array[first] = array[second]\n array[second] = original_first\nend", "def swap(array, index1, index2)\n temp = array[index1]\n array[index1] = array[index2]\n array[index2] = temp\n array\nend", "def swap_elements_from_to(array, i_a, i_b)\n array[i_a], array[i_b] = array[i_b], array[i_a]\n return array\nend", "def swap_elements(array)\n #array[0], array[3] = array[3], array[0]\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap(swap_out, swap_in)\n self.<<(swap_in) if delete?(swap_out)\n end", "def reverse_and_mirror(s1,s2)\n s2.swapcase.reverse + '@@@' + (s1.swapcase.reverse + s1.swapcase)\nend", "def tr(p0, p1) end", "def swap_elements(elements)\n hold = elements[1]\n elements[1] = elements[2]\n elements[2] = hold\n elements\nend", "def swap!(a,b)\n av = self[a]\n self[a] = self[b]\n self[b] = av\n return self\n end", "def swap(array, index1, index2)\n temp = array[index2]\n array[index2] = array[index1]\n array[index1] = temp\nend", "def swap(array, index1, index2)\n temp = array[index2]\n array[index2] = array[index1]\n array[index1] = temp\nend", "def swap\n @working_array = @working_array.collect.with_index do |digit, index|\n swapper_map(index)[digit]\n end\n end", "def swap\n @working_array = @working_array.collect.with_index do |digit, index|\n swapper_map(index)[digit]\n end\n end", "def swap_elements(a)\n a[0], a[1], a[2] = a[0], a[2], a[1]\nend", "def swap(name)\r\n\tname.downcase.split.reverse\r\nend", "def swap(one, two)\n if include? one\n exclude one\n add two\n else\n exclude two\n add one\n end\n end", "def swapper(arr, idx_1, idx_2)\n temp = arr[idx_1]\n arr[idx_1] = arr[idx_2] # as soon as I execute this line, it will be [\"c\", \"b\", \"c\", \"d\"]\n arr[idx_2] = temp # then, I excute this line, then it will be [\"c\", \"b\", \"c\", \"d\"], which is wrong!\n arr\n\nend", "def swap\n @store[-1], @store[-2] = @store[-2], @store[-1] if size > 1\n end", "def swap_elements(array)\n\n array[1], array[2] = array[2], array[1]\n array\n #swap_elements_from_to(array, 1, 2)\nend", "def swap(word, index1, index2)\n temp_word = word.dup\n temp_word[index1], temp_word[index2] = temp_word[index2], temp_word[index1]\n return temp_word\nend", "def tr!(p0, p1) end", "def swap_elements(array)\n array[1],array[2] = array[2], array[1] \n array\nend", "def swap_elements(array, index = 1, destination_index = 2)\n array[index], array[destination_index] = array[destination_index], array[index]\n\n array\nend", "def swap!(a,b)\n self[a], self[b] = self[b], self[a]\n self\n end", "def swap(index_1, index_2)\n temp = @store[index_1]\n @store[index_1] = @store[index_2]\n @store[index_2] = temp\n end", "def swap(index_1, index_2)\n temp = @store[index_1]\n @store[index_1] = @store[index_2]\n @store[index_2] = temp\n end", "def swap(index_1, index_2)\n temp = @store[index_1]\n @store[index_1] = @store[index_2]\n @store[index_2] = temp\n end", "def swap(index_1, index_2)\n temp = @store[index_1]\n @store[index_1] = @store[index_2]\n @store[index_2] = temp\n end", "def swap(index_1, index_2)\n temp = @store[index_1]\n @store[index_1] = @store[index_2]\n @store[index_2] = temp\n end", "def swap(index_1, index_2)\n temp = @store[index_1]\n @store[index_1] = @store[index_2]\n @store[index_2] = temp\n end", "def swap(index_1, index_2)\n temp = @store[index_1]\n @store[index_1] = @store[index_2]\n @store[index_2] = temp\n end", "def swap(index_1, index_2)\n temp = @store[index_1]\n @store[index_1] = @store[index_2]\n @store[index_2] = temp\n end", "def swap(index_1, index_2)\n temp = @store[index_1]\n @store[index_1] = @store[index_2]\n @store[index_2] = temp\n end", "def swap(index_1, index_2)\n temp = @store[index_1]\n @store[index_1] = @store[index_2]\n @store[index_2] = temp\n end", "def swap(index_1, index_2)\n temp = @store[index_1]\n @store[index_1] = @store[index_2]\n @store[index_2] = temp\n end", "def swap(index_1, index_2)\n temp = @store[index_1]\n @store[index_1] = @store[index_2]\n @store[index_2] = temp\n end", "def swap(index_1, index_2)\n temp = @store[index_1]\n @store[index_1] = @store[index_2]\n @store[index_2] = temp\n end", "def swap(a, i, j) \n\ttemp = a[i]\n\ta[i] = a[j]\n\ta[j] = temp\n\treturn a\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap(arr, x, y)\n aux = arr[x]\n arr[x] = arr[y]\n arr[y] = aux\n nil\nend", "def swap_fix_it(p1, p2)\n\n p1_copy = p1.dup\n \n p1.x = p2.x\n p1.y = p2.y\n\n p2.x = p1_copy.x\n p2.y = p1_copy.y\n\n p \"Inside swap_fix_it p1 is #{p1}\"\n p \"Inside swap_fix_it p2 is #{p2}\"\n\n \t\nend", "def makeswap(oid)\n end", "def swap(array, x, y)\n temp_1 = array[x]\n temp_2 = array[y]\n array[y] = temp_1\n array[x] = temp_2\n return array\nend", "def swap_segments\n segs = split(\" - \")\n [segs[1], segs[0], *segs[2..-1]].join(\" - \")\n end", "def swap(node_or_tags); end", "def swap(node_or_tags); end", "def swap_elements(any_array)\n any_array[1], any_array[2] = any_array[2], any_array[1]\n any_array\n end", "def swap_elements(array)\n\tarray[0], array[1], array[2] = array[0], array[2], array[1]\nend", "def swap_elements(array)\n\tarray[0], array[1], array[2] = array[0], array[2], array[1]\nend", "def swap_elements(array)\n array = array[0], array[2], array[1]\n return array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_elements(array)\n array[1], array[2] = array[2], array[1]\n array\nend", "def swap_stack\n <<-CODE\n t1 = stack_pop();\n t2 = stack_pop();\n stack_push(t1);\n stack_push(t2);\n CODE\n end" ]
[ "0.7606896", "0.69189084", "0.6643528", "0.66331416", "0.6613082", "0.6484808", "0.6445032", "0.6436929", "0.6415725", "0.6408865", "0.6391982", "0.6366817", "0.6344511", "0.63220376", "0.6309258", "0.63079315", "0.62955415", "0.6279107", "0.622372", "0.61869794", "0.6169199", "0.6168283", "0.6154088", "0.6151144", "0.61504394", "0.61442775", "0.6140756", "0.6139548", "0.6109514", "0.610718", "0.6105905", "0.60923684", "0.60806054", "0.60806054", "0.6061416", "0.60594547", "0.60343695", "0.602257", "0.60178334", "0.60071963", "0.59918755", "0.5985745", "0.59851426", "0.59843254", "0.5976515", "0.59740025", "0.59557843", "0.5953267", "0.5943269", "0.59377766", "0.59377766", "0.59333766", "0.59333766", "0.5927966", "0.59254813", "0.5917708", "0.59148985", "0.5912602", "0.59038013", "0.5889975", "0.58802396", "0.58794177", "0.5868893", "0.5861685", "0.58600926", "0.58600926", "0.58600926", "0.58600926", "0.58600926", "0.58600926", "0.58600926", "0.58600926", "0.58600926", "0.58600926", "0.58600926", "0.58600926", "0.58600926", "0.5859874", "0.5857521", "0.58571327", "0.58544546", "0.5847075", "0.58427745", "0.58423424", "0.5832067", "0.5832067", "0.5821433", "0.5819154", "0.5819154", "0.58171475", "0.5814889", "0.5814358", "0.5814358", "0.5814358", "0.5814358", "0.5814358", "0.5814358", "0.5814358", "0.5814358", "0.5814358", "0.5811298" ]
0.0
-1
viddler helpers was originally it's own class
def viddler_files(viddler_id, episode_id) # @viddler ||= Viddler::Client.new(viddler_id) @viddler = Viddler::Client.new(viddler_id) # traceout("instantiate viddler wtih #{viddler_id}") # puts @viddler.inspect @viddler.authenticate! ENV['VIDDLER_USER'], ENV['VIDDLER_PASSWORD'] videoData = @viddler.get 'viddler.videos.getDetails', :video_id => "#{episode_id}" # traceout(videoData) return videoData end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weber; end", "def http; end", "def helpers; end", "def helpers; end", "def helpers; end", "def wrapper; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def preflight; end", "def raw_response; end", "def private; end", "def api; end", "def api; end", "def apis; end", "def response_parser; end", "def middleware; end", "def http_proxy_parts; end", "def net_http_res; end", "def endpoint; end", "def endpoint; end", "def endpoint; end", "def endpoint; end", "def add_api_verifier; end", "def proxy; end", "def proxy; end", "def proxy; end", "def version_helper; end", "def version_helper; end", "def version_helper; end", "def version_helper; end", "def http_proxy; end", "def respond(); end", "def req\n \n end", "def perform(request, response); end", "def hidden_apis; end", "def get; end", "def handler; end", "def handler; end", "def request_data; 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 hidden_apis=(_arg0); end", "def call(request); end", "def request_uri; end", "def verified_request?; end", "def proxy_pass; end", "def request_method; end", "def consume_url; end", "def parse_response!; end", "def http=(_arg0); end", "def request=(_arg0); end", "def request=(_arg0); end", "def request=(_arg0); end", "def url_helpers_module; end", "def legitimate_proxy?; end", "def _api\n res = TinyURL.pack(request[:turl]) if request[:turl]\n res = TinyURL.unpack(request[:url].split('/').last) if request[:url]\n res = TinyURL.count(request[:hits].split('/').last).to_s if request[:hits]\n res ||= ''\n respond res\n end", "def set_request; end", "def rest_endpoint; end", "def _view; end", "def generate_request\r\n end", "def response=(_arg0); end", "def response=(_arg0); end", "def response=(_arg0); end", "def response=(_arg0); end", "def vserver\n @vfiler\n end", "def baseurl; end", "def handle_unverified_request; end", "def handle_unverified_request; end", "def request_result\n \n end", "def parent_api; end", "def parent_api; end", "def public_proxy?; end", "def public_proxy?; end", "def rack_builder; end", "def villian; end", "def liquid_method_missing(method); end", "def http_options; end", "def to_s; \"#<Veritable::API url='#{api_base_url}'>\"; end", "def raw; end", "def raw; end", "def raw; end" ]
[ "0.6665735", "0.6360857", "0.6304474", "0.6304474", "0.6304474", "0.6283703", "0.61687654", "0.61687654", "0.61687654", "0.61687654", "0.61687654", "0.61687654", "0.61687654", "0.61687654", "0.61687654", "0.61687654", "0.61687654", "0.60976166", "0.6095541", "0.60921586", "0.5985794", "0.5985794", "0.59566814", "0.5949536", "0.5948012", "0.5946247", "0.5903865", "0.5867302", "0.5867302", "0.5867302", "0.5867302", "0.58624226", "0.583033", "0.583033", "0.583033", "0.57953244", "0.57953244", "0.57953244", "0.57953244", "0.5773759", "0.57718664", "0.57607955", "0.5755106", "0.57533026", "0.57531095", "0.5746225", "0.5746225", "0.57372034", "0.5710638", "0.5710638", "0.5710638", "0.5710638", "0.5710638", "0.5710638", "0.5710638", "0.5710638", "0.5710638", "0.5710638", "0.5710638", "0.5710638", "0.5710638", "0.56930745", "0.5681047", "0.56696147", "0.5652808", "0.5628112", "0.56171554", "0.56071544", "0.55968726", "0.55618054", "0.5539571", "0.5539571", "0.5539571", "0.5535511", "0.5532983", "0.5523446", "0.5514665", "0.5511218", "0.5509892", "0.5505653", "0.5483729", "0.5483729", "0.5483729", "0.5483729", "0.54826134", "0.54796153", "0.54791546", "0.54791546", "0.5474058", "0.5472088", "0.5472088", "0.54661834", "0.54661834", "0.5444593", "0.5443728", "0.54336345", "0.54325944", "0.5430432", "0.5424412", "0.5424412", "0.5424412" ]
0.0
-1
using helper method to determin path, get possible link / sidebar and display
def draw_if_sidebar Link.sidebar_from_link(request.original_fullpath) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path(controller,folder, link_to_self,matter=nil)\n # the base url for a path is always the same:\n unless folder==nil\n url = url_for(:controller => controller, :action => 'folder_list', :id => nil)\n # start with the deepest folder and work your way up\n if link_to_self\n path = h(folder.name)\n id = folder.id.to_s\n # get the folders until folder doesn't have a parent anymore\n # (you're working your way up now)\n until folder.parent == nil\n folder = folder.parent\n path = truncate_hover(folder.name,18,true) + \"/\" + path + '&#187;'\n end\n\n # Finally, make it a link...\n path = ' <a href=\"#\" onclick= \"GetFoldersList('+ id + ',true);return false;\">' + h(path) + '&#187; </a> '\n else\n path = truncate_hover(folder.name,30,false)\n # get the folders until folder doesn't have a parent anymore\n # (you're working your way up now)\n until folder.parent == nil\n folder = folder.parent\n if controller=='workspaces'\n path =' <a href=\"#\" onclick= \"GetFoldersList('+ folder.id.to_s + ',true);return false;\">' + truncate_hover(folder.name,18,true) + '&#187; </a> '+ path\n elsif controller=='repositories'\n path =' <a href=\"#\" onclick= \"GetFoldersListRepository('+ folder.id.to_s + ',true);return false;\">' + truncate_hover(folder.name,18,true) + '&#187; </a> '+ path\n elsif controller=='document_homes'\n path =' <a href=\"#\" onclick= \"GetFoldersListMatter('+ folder.id.to_s + ',true,this,' + matter.id.to_s + ');return false;\">' + truncate_hover(folder.name,18,true) + '&#187; </a> '+ path\n end\n end\n if controller=='document_homes'\n linkto = \"/matters/#{+ matter.id }/#{controller}\"\n path = '<a href=\"'+\"#{linkto }\"+'\">' +\" Root Folder\" + ' &#187; </a> ' + path\n else\n path = '<a href=\"/' + \"#{controller}\" + '\">' +\" Root Folder\" + ' &#187; </a> ' + path\n end\n end\n else\n path = 'Root Folder'\n end\n return path.html_safe!\n end", "def private_show_path(*args)\n model = \"part\"\n options = args.extract_options!\n methods = []\n if parent.blank?\n options = options.merge(site: cur_site || site, id: self)\n methods << \"cms_#{model}_path\"\n else\n options = options.merge(site: cur_site || site, cid: parent, id: self)\n methods << \"node_#{model}_path\"\n end\n\n helper_mod = Rails.application.routes.url_helpers\n methods.each do |method|\n path = helper_mod.send(method, *args, options) rescue nil\n return path if path.present?\n end\n\n nil\n end", "def default\n document_link = @opts[:path].last\n if @opts[:path].size == 1 or document_link == 'bloggers'\n list_bloggers\n elsif @opts[:path].size == 2 \n list(@opts[:path])\n else\n show(document_link)\n end\nend", "def side_column_links\n str = \"<h3 class=\\\"head\\\">#{link_to 'Communications THL', '#nogo', {:hreflang => 'Fathom Communications THL.'}}</h3>\\n<ul>\\n\"\n str += \"<li>#{link_to 'Home', root_path, {:hreflang => 'Home communications.'}}</li>\\n\"\n #str += \"<li>#{link_to 'My Profile', me_path, {:hreflang => 'My Profile.'}}</li>\\n\" if logged_in?\n #str += \"<li>#{link_to 'People', people_path, {:hreflang => 'Manage People'}}</li>\\n\"\n #str += \"<li>#{link_to 'Projects', projects_path, {:hreflang => 'Manage Projects.'}}</li>\\n\"\n #str += \"<li>#{link_to 'Organizations', organizations_path, {:hreflang => 'Manage Organizations.'}}</li>\\n\"\n #str += \"<li>#{link_to 'Tools', tools_path, {:hreflang => 'Manage Tools.'}}</li>\\n\"\n str += \"</ul>\"\n return str\n end", "def learn_to_drive_pages_to_show_sidebar\n %w(\n /id-for-driving-licence\n /driving-lessons-learning-to-drive\n /theory-test\n /theory-test/multiple-choice-questions\n /theory-test/hazard-perception-test\n /theory-test/pass-mark-and-result\n /theory-test/reading-difficulty-disability-or-health-condition\n /theory-test/if-you-have-safe-road-user-award\n /driving-test\n /driving-test/what-happens-during-test\n /driving-test/driving-test-faults-result\n /driving-test/test-cancelled-bad-weather\n /driving-test/disability-health-condition-or-learning-difficulty\n /driving-test/using-your-own-car\n /driving-test/changes-december-2017\n /pass-plus\n /pass-plus/car-insurance-discounts\n /pass-plus/booking-pass-plus\n /pass-plus/local-councils-offering-discounts\n /pass-plus/how-pass-plus-training-works\n /pass-plus/apply-for-a-pass-plus-certificate\n )\n end", "def layout\n @nav_url = url_for_list(!@file || options.index ? menu_lists.first[:type] : 'file')\n\n case object\n when nil, String\n @path = nil\n when @file\n @path = @file.path\n when !object.is_a?(YARD::CodeObjects::NamespaceObject)\n @path = object.parent.path\n @nav_url = url_for_list('class')\n when YARD::CodeObjects::ClassObject\n @path = object.path\n @nav_url = url_for_list('class')\n when PuppetStrings::Yard::CodeObjects::Class\n @nav_url = url_for_list('puppet_class')\n @page_title = \"Puppet Class: #{object.name}\"\n @path = object.path\n when PuppetStrings::Yard::CodeObjects::DataType, PuppetStrings::Yard::CodeObjects::DataTypeAlias\n @nav_url = url_for_list('puppet_data_type')\n @page_title = \"Data Type: #{object.name}\"\n @path = object.path\n when PuppetStrings::Yard::CodeObjects::DefinedType\n @nav_url = url_for_list('puppet_defined_type')\n @page_title = \"Defined Type: #{object.name}\"\n @path = object.path\n when PuppetStrings::Yard::CodeObjects::Type\n @nav_url = url_for_list('puppet_type')\n @page_title = \"Resource Type: #{object.name}\"\n @path = object.path\n when PuppetStrings::Yard::CodeObjects::Provider\n @nav_url = url_for_list('puppet_provider')\n @page_title = \"Provider: #{object.name}\"\n @path = object.path\n when PuppetStrings::Yard::CodeObjects::Function\n @nav_url = url_for_list('puppet_function')\n @page_title = \"Puppet Function: #{object.name} (#{object.function_type})\"\n @path = object.path\n when PuppetStrings::Yard::CodeObjects::Task\n @nav_url = url_for_list('puppet_task')\n @page_title = \"Puppet Task: #{object.name}\"\n @path = object.path\n when PuppetStrings::Yard::CodeObjects::Plan\n @nav_url = url_for_list('puppet_plan')\n @page_title = \"Puppet Plan: #{object.name}\"\n @path = object.path\n else\n @path = object.path\n end\n\n final_layout = erb(:layout)\n\n PuppetStrings::Yard::Util.github_to_yard_links(final_layout) if @file && @file.name == 'README'\n\n final_layout\nend", "def sidebar_link(text, path, default_tooltip = \"\", condition = true, failure_tooltip = nil, options = {})\n # setup the base options for the tooltip\n link_opts = {\n \"rel\" => \"tooltip\",\n \"data-placement\" => \"right\"\n }\n\n li_opts = {}\n\n # if the link is to the current page, then we'll highlight it\n # TODO: make this work for the root url\n li_opts[:class] = \"active\" if current_page?(path)\n\n if condition\n link_opts['data-title'] = default_tooltip unless default_tooltip.blank?\n content_tag :li, li_opts do\n link_to raw(text), path, link_opts.merge(options)\n end\n else\n link_opts['data-title'] = failure_tooltip unless failure_tooltip.blank?\n link_opts[:class] = \"disabled\"\n link_opts[:onclick] = \"return false;\"\n content_tag :li do\n link_to raw(text), \"#\", link_opts\n end\n end\n end", "def main_menu_link; MAIN_MENU_LINK; end", "def link\n # TODO: URL escape links\n if top_level? && (!is_a? SiteDir)\n name\n else\n if is_a? SiteDir # TODO: do a dynamic renderable test?\n top_level? ? \"dropsite/#{@path}.html\" : \"#{@path}.html\".sub(/^\\//, '')\n else\n # Builds a link back up to the file in Public root since the pages\n # are built in a parallel directory structure\n dirs_up = @path.split(File::SEPARATOR).size - 1\n (['..'] * dirs_up).join('/') + \"/#{@path}\"\n end\n end\n end", "def nav_bar\n path_array = self.current_page.split(\"/\").drop(1)\n path_count = path_array.count\n params = self.request_params_display\n \n if URI.unescape(self.current_page) == \"/\"\n nav_bar = \"Index of /\"\n else\n nav_bar = \"Index of <a href=\\'/#{params}'>/</a>\"\n end\n \n previous_path = \"\"\n 0.upto(path_array.count - 1) do |a|\n \n ##\n # Get escaped versions of this path and previous path\n \n escaped_path = path_array[a].gsub(\" \", \"%20\").gsub(\"'\", \"%27\")\n escaped_previous = previous_path.gsub(\" \", \"%20\").gsub(\"'\", \"%27\")\n \n ##\n # If this is the last directory in the path, it shouldn't have a link\n \n if a == path_array.count - 1\n href = \"\"\n else\n href = \"<a href=\\'/#{escaped_previous}#{escaped_path}#{params}\\'>\"\n end\n \n ##\n # If this is the first directory above the root, don't prepend a slash\n \n if a == 0 \n nav_bar << \" #{href}#{path_array[a]}</a>\"\n else\n nav_bar << \" / #{href}#{path_array[a]}</a>\"\n end\n \n previous_path << path_array[a] + \"/\"\n end\n \n @nav_bar = nav_bar\n \n end", "def sitemapFolderLink(page)\n return '' if page.level == 1\n if page.folded?(current_user.id)\n css_class = 'folded'\n title = _t('Show childpages')\n else\n css_class = 'collapsed'\n title = _t('Hide childpages')\n end\n link_to(\n '',\n alchemy.fold_admin_page_path(page),\n :remote => true,\n :method => :post,\n :class => \"page_folder #{css_class}\",\n :title => title,\n :id => \"fold_button_#{page.id}\"\n )\n end", "def dev_exp; nav.link(:text, 'Device Explorer'); end", "def url_for_main; end", "def url_for_main; end", "def navlistbar_digimag_link\n $tracer.trace(__method__)\n return ToolTag.new(li.className(\"/take part/\").div.className(\"/subnav/\").ul.className(\"/dropdown/\").a(\"/Read Current Issue/\"), __method__)\n end", "def render_page_path\n if Settings.website.base_url.present?\n render :partial => \"admin/general/page_path\", :locals => { :page_path => [email protected] }\n else\n render :partial => \"admin/general/page_path\", :locals => { :page_path => @page.path }\n end\n end", "def link_4menu(item) #:nodoc:\n html = ''\n link = item.link\n link = \"/#{@site.route_name}/#{item.page_id}\" #if link.blank?\n# \n html << @parent.link_to(item.picture, link) unless item.picture.blank?\n html << if !item.caption.blank?\n # TODO Translation\n @parent.link_to(item.caption, link)\n end\nend", "def show\n add_breadcrumb proc { I18n.t('breadcrumbs.explore', default: 'explore') }, :research_path\n end", "def showpath(uri)\n return escape(docpath(uri))\n end", "def path\n html = ''\n a = []\n m = DcBigMenu.find( @parent.page.menu_id )\n a << m\n while m.parent \n m = DcBigMenu.find( m.parent )\n a << m\n end\n# \n (a.size - 1).downto(0) do |i| \n html << \"<span id=menu-path-#{a.size - 1 - i}>\"\n html << link_4menu(a[i]) \n html << (i > 0 ? ' &raquo; ' : '') #&rsaquo;&#10132;\n html << '</span>'\n end\n# Save level to parents params object\n @parent.params[:menu_level] = a.size\n html\nend", "def default_article_path(article)\n if article.is_a?(CacmArticle) && article.issue && article.issue.source\n url_for :controller => '/magazines', :year => article.issue.source.pub_date.year, :month => article.issue.source.pub_date.month, :article => article, :action => 'index'\n elsif article.sections.any?\n section = article.sections.find(:first)\n if section.name == \"Syndicated Blogs\"\n # This is an external blog link; the only valid link for the article is to its source.\n # note that it's up to the caller of this function to know that this is an external\n # link and to draw the appropriate external link icon.\n # Since the section model is ordered and syndicated blogs is the last in that ordering,\n # find(:first) will only return syndicated blogs if the article's only section is\n # syndicated blogs.\n article.link\n else\n \"/#{section.to_param}/#{article.to_param}\"\n end\n elsif article.subjects.any?\n \"/browse-by-subject/#{article.subjects.first.to_param}/#{article.to_param}\"\n else # how'd we get here?\n \"/\"\n end\n end", "def show\n breadcrumb\n end", "def linked_path_for(path)\n return path unless path.include?('/')\n current_path_base = request.env['REQUEST_URI'].gsub(path,'')\n dirs = path.split('/')\n file = dirs.pop\n linked_path = ''\n dirs.each do |dir|\n link = '<a href=\"' + current_path_base + dir + '\">' + dir + '</a>'\n current_path_base << \"#{dir}/\"\n linked_path << \"#{link}/\" \n end\n linked_path << file\n end", "def sidebar_view_site\n if Typus.link_to_view_site\n { :message => Typus::I18n.t(\"View Site\"),\n :url => Typus.admin_title_link,\n :link_to_options => { :target => '_blank' },\n :icon => \"share\" }\n end\n end", "def url_for(entry)\n if entry.top_level? && (!entry.is_a? SiteDir)\n entry.name\n else\n if entry.is_a? SiteDir # TODO: do a dynamic renderable test?\n entry.top_level? ? \"dropsite/#{entry.path}.html\" : \"#{name}/#{entry.name}.html\".sub(/^\\//, '')\n else\n # Builds a link back up to the file in Public root since the pages\n # are built in a parallel directory structure\n dirs_up = entry.path.split(File::SEPARATOR).size - 1\n (['..'] * dirs_up).join('/') + \"/#{entry.path}\"\n end\n end\n end", "def path\n @global_page.path\n end", "def auto_path\n cur_page.auto_path\n end", "def open_link(head)\n if head == \"Search\"\n show_search\n elsif @sections.has_key? head\n open_section(head)\n elsif @methods.has_key? head\n open_methods(head)\n elsif @mindex.has_key? head\n head, sub = @mindex[head]\n open_methods(head, nil, sub)\n elsif head =~ /^http:\\/\\//\n debug head\n visit head\n end\n end", "def url\n\n # TODO bug with controllers without models e.g. StaticPages\n if controller_id.blank?\n \"#\"\n elsif instance_id.nil? || instance_id == 0\n url_for :controller => controller_id, :action => action_id, :only_path => true\n else\n # http://stackoverflow.com/questions/5316290/get-model-class-from-symbol\n klass = controller_id.classify.constantize\n if instance_id.present?\n instance = klass.find(instance_id)\n\n if [\"show\"].include? action_id\n polymorphic_path(instance, :only_path => true)\n else\n polymorphic_path(instance, :action => action_id, :only_path => true)\n end\n end\n end\n\n # # Media Link only:\n # # http://stackoverflow.com/questions/5316290/get-model-class-from-symbol\n # klass = controller_id.classify.constantize\n # action_id = 'show'\n # if instance_id.present?\n # instance = klass.find(instance_id)\n\n # if [\"show\"].include? action_id\n # polymorphic_path(instance, :only_path => true)\n # else\n # polymorphic_path(instance, :action => action_id, :only_path => true)\n # end\n # end\n end", "def main_menu\n ctrlr = request.parameters['controller'].split('/').last\n dashboard_class = (ctrlr == 'dashboard' ? 'current' : '')\n assets_class = (ctrlr == 'assets' ? 'current' : '')\n design_class = ((ctrlr == 'themes' || ctrlr == 'resources') ? 'current' : '')\n contacts_class = (ctrlr == 'contacts' ? 'current' : '')\n settings_class = (ctrlr == 'settings' ? 'current' : '')\n content_class = ((ctrlr == 'home' || ctrlr == 'links' || ctrlr == 'news_items' || ctrlr == 'portfolios' || ctrlr == 'assigned_assets' || ctrlr == 'resume_sections' || ctrlr == 'resume_items' || ctrlr == 'galleries') ? 'current' : '')\n admin_class = ((ctrlr == 'users' || ctrlr == 'sites' || ctrlr == 'memberships') ? 'current' : '')\n \n result = content_tag('li', link_to('Dashboard', admin_dashboard_path, :class => dashboard_class))\n result << content_tag('li', link_to('Content', edit_admin_home_path, :class => content_class))\n result << content_tag('li', link_to(assets_name, admin_assets_path, :class => assets_class))\n result << content_tag('li', link_to('Design', admin_themes_path, :class => design_class))\n result << content_tag('li', link_to('Contacts', admin_contacts_path, :class => contacts_class))\n result << content_tag('li', link_to('Settings', edit_admin_settings_path, :class => settings_class))\n if admin?\n result << content_tag('li', link_to('Admin', admin_users_path, :class => admin_class))\n end\n result\n end", "def navbar_links\n links = {}\n\n if PerDistrict.new.enabled_class_lists? && PerDistrict.new.show_link_for_class_lists? && ClassListQueries.new(@educator).is_relevant_for_educator?\n links[:classlists] = '/classlists'\n end\n\n if PerDistrict.new.enabled_high_school_levels? && @educator.labels.include?('should_show_levels_shs_link')\n links[:levels_shs] = '/levels/shs'\n end\n\n if PerDistrict.new.enabled_counselor_meetings? && @educator.labels.include?('enable_counselor_meetings_page')\n links[:counselor_meetings] = '/counselors/meetings'\n end\n\n if @educator.districtwide_access?\n links[:district] = '/district'\n end\n\n if @educator.school.present? && (@educator.schoolwide_access? || @educator.has_access_to_grade_levels?) && [email protected]_access?\n links[:school] = url_helpers.school_path(@educator.school)\n end\n\n if @educator.school.present? && @educator.schoolwide_access? && [email protected]_access?\n links[:absences] = url_helpers.absences_school_path(@educator.school)\n links[:tardies] = url_helpers.tardies_school_path(@educator.school)\n links[:discipline] = url_helpers.discipline_school_path(@educator.school)\n end\n\n if include_sections_link?(@educator)\n links[:section] = url_helpers.educators_my_sections_path\n end\n\n if @educator.homeroom.present? && [email protected]_high_school? && @educator.homeroom.students.active.size > 0\n links[:homeroom] = url_helpers.homeroom_path(@educator.homeroom.id) # explicitly use id, not slug. see Homeroom.rb for more\n end\n\n links\n end", "def search_item_link(item)\n subcategory = item[\"subcategory\"].downcase\n\n if subcategory == \"audio\"\n id = item[\"identifier\"].split(\".\").last\n path = audio_item_path(id: id)\n\n elsif subcategory == \"correspondence & papers\"\n path = correspondence_item_path(id: item[\"identifier\"])\n\n elsif subcategory == \"drill\"\n path = drill_item_path(id: item[\"identifier\"])\n\n elsif subcategory == \"features\"\n id = item[\"identifier\"].split(\".\").last\n path = feature_path(id: id)\n\n elsif subcategory == \"footage\"\n path = footage_clip_path(id: item[\"identifier\"])\n\n elsif subcategory == \"images\"\n path = image_path(id: item[\"identifier\"])\n\n elsif subcategory == \"newspaper\"\n path = newspapers_item_path(id: item[\"identifier\"])\n\n elsif subcategory == \"personal accounts\"\n id = item[\"identifier\"].split(\".\").last\n path = account_path(id: id)\n\n else\n path = item_path(id: item[\"identifier\"])\n end\n\n path\n end", "def view_folder\n #~ find_portfolio_and_folder\n end", "def wpath(window, str)\n window.winfo_children.each do |some_widget|\n if some_widget.path == str\n return some_widget\n end\n end\nend", "def show\n add_breadcrumb 'details', structure_path\n end", "def display_segment( node )\n html = \"<li>\".html_safe\n node_class = \"folder\"\n if node.class == Venue\n node_class = \"file\"\n end\n if node.class == Organisation\n node_class = \"web-browser\"\n end\n if node == nil then\n html << \"<span class=\\\"#{node_class}\\\"> <a href=\\\"/location_tree/NIL\\\">Found NIL</a> </span>\".html_safe\n html << \"<ul id=\\\"children_of_NIL\\\">\".html_safe\n\n else\n html << \"<span class=\\\"#{node_class}\\\"> <a href=\\\"/location_tree/#{node.id}\\\">#{node.to_s}</a> </span>\".html_safe\n html << \"<ul id=\\\"children_of_#{node.id}\\\">\".html_safe\n node.children.each{|child_node|\n html << display_segment( child_node )}\n end\n html << \"</ul></li>\".html_safe\n end", "def show_human\n # if extension is present and is NOT in html_extensions list, redirect to node_url\n if html_extensions.include? current_extension\n @node = Node.from_path params[:path]\n @node = Node.from_path extensionless_path(params[:path]) unless @node.present?\n\n raise HTTPStatuses::NotFound unless @node.present?\n\n if @node.path.present? && (request.path != '/') && (request.path != \"/#{@node.path}\")\n return redirect_to human_node_url(@node.to_path), :status => :moved_permanently\n end\n else\n node = Node.from_path extensionless_path(params[:path])\n return redirect_to node_url(node, current_extension), :status => :moved_permanently\n end\n\n render :action => :show\n end", "def show\n #binding.pry\n add_breadcrumb \"Articles\",articles_path\n [email protected]\n if cat\n cat.ancestors.reverse_each { |a| add_breadcrumb a.name,category_path(a) }\n add_breadcrumb cat.name,category_path(cat)\n end\n add_breadcrumb @article.title,article_path\n #ASK how to make this more DRY\n end", "def click_through_link\n\t\treturn '/items/' + self.items.first.slug if !self.items.first.blank?\n\t\treturn '/blog/' + self.blogs.first.slug if !self.blogs.first.blank?\n\t\treturn \"#\"\n\tend", "def get_action_link\n if controller_path == 'admin/articles'\n case action_name\n when 'index' then t('buttons/all_articles').html_safe\n when 'new' then t('buttons/new_article').html_safe\n when 'edit' then t('buttons/edit_article').html_safe\n when 'show' then t('buttons/preview').html_safe\n end\n elsif controller_path == 'admin/authors'\n case action_name\n when 'index' then t('buttons/all_authors').html_safe\n when 'new' then t('buttons/new_author').html_safe\n when 'edit' then t('buttons/edit_author').html_safe\n when 'show' then t('buttons/author').html_safe\n end\n end\n end", "def displayname\n path\n end", "def route\n # Page exists?\n if @node and @node.has_page?\n # Redirect to This Item's first category listing if it exists. To ensure the menus display correctly\n if @node.page_type=='Item' and @node.page.has_better_url?\n redirect_to shortcut_path(:shortcut => @node.page.better_url, :display_item => @node.page_id)\n return false\n else\n page_type = (@node.page_type == 'ItemCategory' ? 'Item' : @node.page_type)\n @item = Item.find(params[:display_item]) unless params[:display_item].blank?\n #render(\"#{page_type.tableize.pluralize}/show\", :layout => @node.layout)\n #render :action => \"#{page_type.tableize.pluralize}/show\", :layout => @node.layout\n render_page_from_node(\"#{page_type.tableize.pluralize}/show\", @node.layout)\n end\n else\n return error_redirect\n end\n end", "def link(path=\"\",controller=nil)\n return nil if !@workingpath\n if controller\n path = File.join(\"/#{controller}\",\"#{path}\")\n else\n path = File.join(\"/#{@workingpath[1..-1].join('/')}\",\"#{path}\")\n end\n path = path[0..-2] if path.length && path[-1..-1] == \"/\"\n return path\n end", "def link_action_show(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.show\"), 'zoom-in', path\n end", "def link_action_show(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.show\"), 'zoom-in', path\n end", "def find_path\n\n end", "def link_breadcrumb_or_not(menu)\n # path for the breadcrumb menu item\n path_method = \"breadcrumb_#{menu}_path\"\n path = send(path_method) if respond_to?(path_method.to_sym, include_private=true)\n path = '#' if path and current_page?(path) # if the current request is this path then stub it out with #\n path ||= '#'\n link_breadcrumb(menu, path)\n end", "def pathify_comments_redirect(item)\n case item.klass\n when \"discussion\"\n discussion_comments_path(item)\n when \"note\"\n if item.note_type == \"Answer\"\n pathify_comments_redirect(item.answer)\n elsif item.note_type == \"Discussion\"\n pathify_comments_redirect(item.discussion)\n else\n pathify(item)\n end\n when \"workflow\"\n return workflow_analyses_path(item) if request.referer =~ /analyses/\n concat_path(item)\n when \"expert\", \"expert-question\", \"meta-appathon\", \"appathon\", \"comparison\", \"answer\"\n pathify(item)\n when \"file\", \"folder\", \"app\", \"job\", \"asset\"\n concat_path(item)\n else\n raise \"Unknown class #{item.klass}\"\n end\n end", "def navbar name_uniq = :root , &block\n result = \"\"\n section = Section.find_by_name_uniq(name_uniq.to_s)\n ([section] + section.children).each do |item|\n result += capture(item.name,item.path,&block)\n end if section \n concat result\n end", "def main_navigation_partial\n partial_path = \"shared/\"\n partial_name = \"main_navigation\"\n path_exists?(\"app/views/#{partial_path}_#{partial_name}.html.*\") ? \"#{partial_path}#{partial_name}\" : nil\n end", "def show(path)\n\t require 'pathname'\n\t\t# change to before filter\n\t\tlogin_filter\n\t\t\n\t\t# round about way of getting the secure url we need\n # path = namespace_path(path)\n\t\tpathname = Pathname.new(path)\n\t\turl = self.list(pathname.dirname.to_s).detect{ |f| f[\"name\"] == pathname.basename.to_s }[\"url\"]\n\t\t\n\t\t#https://dl-web.dropbox.com/get/testing.txt?w=0ff80d5d&sjid=125987568\n\t\t@[email protected](url).content\n\tend", "def content_path(model=get_allowed_item_types(@current_container).first, cont=nil)\n\t\t\tif model.nil?\n\t\t\t\tp \"=============== No item accessible inside for content_path ...\"\n\t\t\tend\n\t\t\tcont ||= @current_container\n\t\t\tif cont\n\t\t\t\tcontainer_path(cont)+\"?item_type=#{model.to_s.underscore.pluralize}\"\n else\n admin_content_url(:item_type => model.to_s.underscore.pluralize)\n end\n\t\tend", "def main_navigation\n nodes_stack = RailsAdmin::Config.visible_models(:controller => self.controller)\n node_model_names = nodes_stack.map{ |c| c.abstract_model.model_name }\n\n nodes_stack.group_by(&:navigation_label).map do |navigation_label, nodes|\n\n nodes = nodes.select{ |n| n.parent.nil? || !n.parent.to_s.in?(node_model_names) }\n li_stack = navigation nodes_stack, nodes\n\n li_a_home = link_to localizing_path(dashboard_path), class: 'pjax' do\n content_tag(:i, '', class: 'icon icon-home') + content_tag(:span, t('admin.actions.dashboard.menu'))\n end\n %{<li class=\"homelink\">#{li_a_home}</li>#{li_stack}} if li_stack.present?\n end.join.html_safe\n end", "def path(options={}, &block)\n cur_page.path(options, &block)\n end", "def show\n @referential = @publication.referential\n breadcrumb\n end", "def link\n\t\tpage_id.present? ? short_page_path(Page.find(page_id)) : href\n\tend", "def link_path\n File.join(\"/f/#{@page_name}\", name) # /foo/bar_files/file.jpg\n end", "def path() end", "def path() end", "def path() end", "def supports_path?; end", "def navlistbar_guides_link\n $tracer.trace(__method__)\n return ToolTag.new(li.className(\"/take-part/\").div.className(\"/subnav/\").ul.className(\"/dropdown/\").a(\"/Guides/\"), __method__)\n end", "def get_content_for_layout()\n get_partial(@type)\n # if @type == \"home\"\n # get_partial('home')\n # elsif @type == \"page\"\n # get_partial('page')\n # elsif @type == \"article\"\n # get_partial('article')\n # elsif @type == \"category\"\n # get_partial('category')\n # end\n end", "def display_category_structure(category_link, prefix = '', suffix = '')\n puts \"#{prefix}-> `\\e[33;1m#{category_link[:name]}\\e[0m` => `\\e[34;1m#{category_link[:path]}\\e[0m`#{suffix}\"\n end", "def href\n if clickable?\n # current_piece.url > current_data_item.url > current_page.url\n return page_layout.href if get_content_param_by_key( :context ) > 0\n return self.collection_tag.running_data_item.path if self.collection_tag.running_data_item.present?\n return self.collection_tag.current_page_tag.path\n end\n end", "def link_with_local_index(text, path)\n resource = sitemap.find_resource_by_path(path)\n # \"<li> #{path} </li>\"\n output = link_to(text, resource)\n if resource && current_page.url.include?(resource.url)\n index = local_index(current_page.url)\n %(<li class=\"list-group-item\"><h5>#{output}</h5>#{index}</li>)\n else\n \"<li class='list-group-item'><h5>#{output}</h5></li>\"\n end\n end", "def define_path_helpers; end", "def nav_link(text, link)\n recognized = Rails.application.routes.recognize_path(link)\n if recognized[:controller] == params[:controller] && recognized[:action] == params[:action]\n content_tag(:li, :class => \"active\") { link_to( text, link ) }\n else\n content_tag(:li) { link_to( text, link ) }\n end\n end", "def commentable_path\n eval(\"%s(%s)\" % find_path_and_parts)\n end", "def link_of_item(kind)\n\titem = @items.find { |i| i.attributes()[:kind] == kind }\n\tlink_to(kind.capitalize, @site.config()[:base_url] + item.path) unless item.nil?\nend", "def view_paths; end", "def view_paths; end", "def view_paths; end", "def bp_directory_index\n tree_hash = BP.same_level_views(\"/base_project#{request.env['PATH_INFO']}\")\n\n p tree_hash\n\n out = \"<ul>\"\n\n tree_hash.keys.each do |tree_hash_key|\n thk = tree_hash_key.gsub(\".html.erb\", \"\")\n thk = thk.gsub(\"/mocks\", \"\")\n\n out += content_tag :li, thk.gsub(\"/\", \"\")\n\n out += \"<ul>\"\n tree_hash[tree_hash_key].each do |tree_hash_value|\n thv = tree_hash_value.gsub(\".html.erb\", \"\")\n if thv != \"index\"\n out += content_tag :li, link_to(\"#{thv}\", \"/mocks?t=#{thk}/#{thv}\")\n end\n\n end\n out += \"</ul>\"\n\n out += \"</li>\"\n end\n out += \"</ul>\"\n\n out.html_safe\nend", "def nav_bar_links\n curr_path = request.path\n base_path = curr_path.sub(%r{^(/[^/]*)/.*$}, '\\1')\n curr_prm = url_parameters.except(:limit)\n curr_path += '?' + url_query(curr_prm) if curr_prm.present?\n html_div(class: 'links') do\n first = true\n NAV_BAR_CONTROLLERS.map do |controller|\n if controller == :home\n # Special entry for the dashboard/welcome screen.\n path = dashboard_path\n base = (base_path == '/account')\n label = DASHBOARD_CONFIG[:label]\n tip = DASHBOARD_CONFIG[:tooltip]\n hidden = !current_user\n else\n # Entry for the main page of the given controller.\n path = get_path_for(controller)\n base = (base_path == path)\n label = CONTROLLER_LABEL[controller]\n tip = CONTROLLER_TOOLTIP[controller]\n hidden = (controller == :org) && !current_user\n end\n\n primary = PRIMARY_CONTROLLERS.include?(controller)\n if primary && production_deployment?\n primary &&= !UNRELEASED_CONTROLLERS.include?(controller)\n end\n\n current = (path == curr_path)\n active = current || base\n disabled = current\n\n classes = []\n classes << 'secondary' unless primary\n classes << 'active' if active\n classes << 'disabled' if disabled\n classes << 'hidden' if hidden\n\n # The separator preceding the link.\n sep_css = %w[separator]\n sep_css << 'hidden' if first\n separator = html_span('|', class: css_classes(*classes, *sep_css))\n\n # The link (inactive if already on the associated page).\n tip &&= \"#{tip}\\n\" if disabled\n tip += '(Current_page)' if disabled # TODO: I18n\n opt = { class: css_classes(*classes), title: tip }\n link = disabled ? html_span(label, opt) : link_to(label, path, opt)\n first = false unless hidden\n\n separator << link\n end\n end\n end", "def href\n some_context = get_content_param_by_key( :context )\n SpreeTheme.taxon_class.get_route_by_page_context( some_context )\n end", "def webSiteBuildLinkPages\n title = \"C/C++ Coding Guides\"\n webSiteBuildCategoryLinkPage([CPP, GUIDE], \"cpp/guides/\", title)\n \n title = \"C/C++ Tutorials\"\n webSiteBuildCategoryLinkPage([CPP,TUTORIAL], \"cpp/tutorials/\", title)\n \n title = \"C/C++ Examples\"\n webSiteBuildCategoryLinkPage([CPP,EXAMPLE], \"cpp/examples/\", title)\n \n title = \"JavaScript Coding Guides\"\n webSiteBuildCategoryLinkPage([JS,GUIDE], \"js/guides/\", title)\n \n title = \"JavaScript Tutorials\"\n webSiteBuildCategoryLinkPage([JS,TUTORIAL], \"js/tutorials/\", title)\n \n title = \"JavaScript Examples\"\n webSiteBuildCategoryLinkPage([JS,EXAMPLE], \"js/examples/\", title)\n \n title = \"All Examples\"\n webSiteBuildCategoryLinkPage([CPP,JS,EXAMPLE], \"overviews/examples/\", title)\nend", "def pathWebSitePages\n pathWebSite + \"pages/\"\nend", "def narrow_path\n\t\t\t\t@narrow_path ? @narrow_path : parent ? parent.narrow_path : nil\n\t\t\tend", "def pathSourceHyper\n\t\"../../HyperOpen/\"\nend", "def show_link(str)\n cfg = @@cfg\n str.gsub!(' ','-')\n str << '.md'\n show_doc(cfg, str)\n end", "def navlistbar_forums_link\n $tracer.trace(__method__)\n return ToolTag.new(li.className(\"/take-part/\").div.className(\"/subnav/\").ul.className(\"/dropdown/\").a(\"/Forums/\"), __method__)\n end", "def path(*) end", "def dynamic_link_path(link, options = {})\n if link.relative && !link.target_id.blank?\n model_instance = model_class(link.resource).find(link.target_id)\n model_instance.is_a?(Page) ? nice_page_path(model_instance) : model_path(model_instance, options)\n elsif link.relative && link.target_id.blank?\n model_index_path(model_name(link.resource), options)\n else\n link.path\n end\n end", "def dynamic_link_path(link, options = {})\n if link.relative && !link.target_id.blank?\n model_instance = model_class(link.resource).find(link.target_id)\n model_instance.is_a?(Page) ? nice_page_path(model_instance) : model_path(model_instance, options)\n elsif link.relative && link.target_id.blank?\n model_index_path(model_name(link.resource), options)\n else\n link.path\n end\n end", "def path\n end", "def path\n end", "def path\n end", "def site_pages \n Rails.application.reload_routes!\n page_routes = Rails.application.routes.routes.select do |route|\n route.verb == \"GET\" && !route.name.blank? && !route.name.match(/^edit/) && !route.name.match(\"translat\") && !route.name.match(\"external_author\")\n end\n\n @paths = []\n @errors = []\n @errors << \"Skipping translation and external author pages because these areas are in-progress.\"\n\n page_routes.each do |r|\n path = r.path.split('(').first\n while (path.match(/:([^\\/]+)_id\\//)) do\n id = get_id(path, current_user, $1.singularize)\n if id\n path.gsub!(\":#{$1}_id\", \"#{id}\") if id\n @last_id = id\n else\n @errors << \"Couldn't find object for #{path}, #{$1}\"\n break\n end\n end\n\n if (path.match(/\\/([^\\/]+)\\/:id/))\n id = get_id(path, current_user, $1.singularize)\n if id\n path.gsub!(\":id\", \"#{id}\")\n @last_id = id\n else\n @errors << \"Couldn't find object for #{path}, id\"\n end\n end\n\n @paths << [path, r.name]\n end\n \n render :action => \"site_pages\", :layout => \"application\"\n end", "def with_each_additional_view_path_slug\n yield('') # Can this be deprecated?\n yield('core') # I want to move things up to core\n yield(work_area.slug) # Important if we want to leverage a specific template\n end", "def link_with_active(text, url)\n if url == \"/\" then\n if request.fullpath == \"/\" then\n return link_to text, url, :id => \"selected_main_tab\"\n else\n return link_to text, url\n end\n else\n if request.fullpath.include? url then\n return link_to text, url, :id => \"selected_main_tab\"\n else\n return link_to text, url\n end\n end\n end", "def process_path\n unless params[:name].nil?\n #get path from params\n @path = params[:name]\n\n #get last section which is page name\n @name = @path.split(\"/\").last\n end\n end", "def doi_landing_page\n # is there a way to get this somehow with url_for or some such?\n url = DOI_CONFIG['landing_page_prefix']\n if self.class == Collection\n url + \"collections/\" + id\n else\n url + \"files/\" + id\n end\n end", "def browse_path\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"\" ] if browse_everything_controller2_debug_verbose\n rv = params[:path] || ''\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"browse_path rv=#{rv}\",\n \"\" ] if browse_everything_controller2_debug_verbose\n rv\n end", "def includesMainPageLink(link)\n\tlink.to_s.downcase.include?\"main_page\"\nend", "def view_menu\n h = {\n f: :select_from_visited_files,\n d: :select_from_used_dirs,\n b: :view_bookmarks,\n s: :list_selected_files,\n c: :child_dirs,\n r: :recent_files,\n t: :tree,\n e: :dirtree\n }\n menu 'View Menu', h\nend", "def links; end", "def links; end", "def home_link\n if is_secretary? or is_team_manager\n link_to(\"Home\", physical_liviaservices_livia_secretaries_url,:class =>controller.controller_name.eql?('livia_secretaries')? 'mr10 ml3 active' : 'mr10 ml3')\n elsif is_admin\n link_to(\"Home\", physical_liviaservices_liviaservices_url)\n elsif is_client\n link_to(\"Home\", matter_clients_url, :class => controller.controller_name.eql?('matter_clients')? 'mr10 ml3 active' : 'mr10 ml3')\n else\n link_to(\"Home\", physical_clientservices_home_index_path, :class => controller.controller_name.eql?('home')? 'mr10 ml3 active' : 'mr10 ml3')\n end\n end", "def find_path(goal) \n \n end" ]
[ "0.64985955", "0.64949954", "0.63631916", "0.6149049", "0.61165005", "0.6058545", "0.5981082", "0.59415144", "0.5915239", "0.57658523", "0.57656735", "0.57561904", "0.5750748", "0.5750748", "0.5735282", "0.5729544", "0.57248235", "0.57227296", "0.571972", "0.5708342", "0.57001156", "0.5672317", "0.5653722", "0.5650472", "0.5643561", "0.5642831", "0.56348544", "0.56228024", "0.56185704", "0.56039", "0.5600033", "0.5595244", "0.5592725", "0.55924964", "0.55872756", "0.55716133", "0.5570929", "0.55617046", "0.554052", "0.5531239", "0.55274343", "0.55213654", "0.55145854", "0.5512518", "0.5512518", "0.551087", "0.55065507", "0.5499195", "0.5479707", "0.546073", "0.5456572", "0.5453789", "0.5443831", "0.5441371", "0.543634", "0.5434732", "0.54287905", "0.54207855", "0.54207855", "0.54207855", "0.5412062", "0.540536", "0.5404209", "0.54013914", "0.53956854", "0.53954947", "0.5392579", "0.53794634", "0.5373145", "0.537264", "0.5369565", "0.5369565", "0.5369565", "0.5365725", "0.5360052", "0.53577435", "0.53556335", "0.53503954", "0.53493905", "0.5347475", "0.53469795", "0.53434306", "0.534207", "0.534034", "0.534034", "0.5338903", "0.5338903", "0.5338903", "0.5338096", "0.53371614", "0.5337044", "0.53330606", "0.53323424", "0.53267366", "0.53255117", "0.5323546", "0.53226864", "0.53226864", "0.53213984", "0.53162867" ]
0.6995931
0
determine if friend feature is first view of page
def is_friend_return_view? @prevURL = session[:previous_url].nil? ? "" : session[:previous_url].split('/')[0..2].join('/') @curURL = request.fullpath.split('/')[0..2].join('/') return ( @curURL == @prevURL) # return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first_page?\n current_page == 1\n end", "def first_page?\n current_page == 1\n end", "def first_page?\n current_page == 1\n end", "def first_page?\n current_page == 1\n end", "def first_page?\n current_page == 1\n end", "def first_page?\n current_page == 1\n end", "def first_page?\n current_page == 0\n end", "def first_page?\n page == 1\n end", "def first_page?\n\t\t\t!prev_page_url if paginated?\n\t\tend", "def first?\n self.rel == \"first\"\n end", "def first_page?\n page_number > first_page_number\n end", "def first_page?\n current_page == pages.begin\n end", "def is_first_page?\n p_index.to_i == 1\n end", "def first_page?\n return true if total_pages < 1\n return (page == 1)\n end", "def first?\n if defined? @first\n false\n else\n @first = false\n true\n end\n end", "def first_page?\n params[:page].nil?\n end", "def index?\n \t@primary_friend = @friendship.user\n \t(@primary_friend == @user) || (user.friends.exists?(@primary_friend.id))\n end", "def first?\n not first.nil?\n end", "def is_first_login\n return @is_first_login\n end", "def is_first\n @values.fetch('ai.session.isFirst') { \n @values['ai.session.isFirst'] = nil\n }\n end", "def isFirstSplash\n \tif !Splash.find_by_user_id(current_user.id)\n \t\tparams[:share][\"facebook\"] = \"checked\"\n \tend\n end", "def first?\n return false unless in_list?\n my_position == 1\n end", "def first?\n return false unless in_list?\n my_position == 1\n end", "def landing_page? \n landing_page.present? \n end", "def first?\n\t locate == 1\n\tend", "def friend_signed_in?\n user_signed_in? && (current_user.type==\"Friend\") \n end", "def set_home_if_first\n if Page.all.empty?\n self.home = true\n elsif page_collection && page_collection.empty?\n self.home = true\n end\n end", "def me_or_friend?\n unless current_user.is_friends_with? @user or @user == current_user\n flash[:notice] = \"You aren't allowed to view that page.\"\n end\n end", "def first_page_in_class?\n @current_class == \"Druid\" ? false : @cards.current_page == 1\n end", "def personal_page?\n return false unless current_user\n return true if params[:owner_id].to_i == current_user.id\n return true if @user && current_user == @user\n return true if @quest && current_user.owns?(@quest)\n return true if @offer && current_user.owns?(@offer)\n \n false\n end", "def first?\n event.user.chapters.ascending.first == self\n end", "def check_first_time\n\t\t# only run if a user is signed in and the request is storable\n\t\treturn unless user_profile_signed_in? && storable_location?\n\n\t\tredirect_path =\n\t\t\tif terms = Terms::TYPES.find { |type| !current_user_profile.terms_accepted? type }\n\t\t\t\tterm_path(terms)\n\t\t\t# if the user hasn't completed their profile, make them do it\n\t\t\telsif !current_user_profile.set_up?\n\t\t\t\tedit_user_profile_registration_path\n\t\t\t# if the user hasn't taken any actions in the app yet, take them to the first time page\n\t\t\telsif current_user_profile.first_time?\n\t\t\t\tfirst_time_path\n\t\t\tend\n\n\t\tredirect_to redirect_path unless redirect_path.nil?\n\tend", "def friend_of_current_user?\n current_user.friends.pluck(:id).include?(@profile.user.id) ? \n current_user.friendships.find_by_friend_id(@profile.user.id) : false\n end", "def friend?\r\n infoxml = get_info\r\n \r\n if friend = infoxml['friend']\r\n return friend == '1'\r\n end\r\n \r\n return false\r\n end", "def on_page?\n false\n end", "def user_reffered?\n if /#{root_url}/.match(request.referrer) then false else request.referrer end\n end", "def profile_show_page?\n controller_name == \"profiles\"\n end", "def profile_show_page?\n controller_name == \"profiles\"\n end", "def first?\n # return false unless in_list?\n self.send(position_column) == 1\n end", "def is_viewing_before_acceptance_required\n return @is_viewing_before_acceptance_required\n end", "def first_user?\n return false unless options.keys.count == FIRST_USER_OPTIONS_COUNT\n return false unless options.key?(FIRST_USER_FLAG)\n\n Console::User.first_user?(options[FIRST_USER_FLAG])\n end", "def is_top_nav?\n\t\t!nav_id\n\tend", "def is_partial?\n not raw_user.include?('friends_count')\n end", "def choose_layout\n\t\tuser_profile_signed_in? ? (current_user_profile.first_time? ? 'first_time' : 'authed') : 'no_auth'\n\tend", "def viewer?(current_user)\n return false unless current_user\n\n viewers.where(id: current_user).count == 1\n end", "def if_front_page\n view_context.request.path == '/'\n end", "def within_first? counter\n User.manager.count <= counter ? true : false\n end", "def first_item?\n true\n end", "def is_front_page?\n # Most likely case.\n if 'posts' == get_option( 'show_on_front' ) && @is_home\n true\n elsif 'page' == get_option( 'show_on_front' ) && !get_option( 'page_on_front' ).blank? && is_page?( get_option( 'page_on_front' ) )\n true\n else\n false\n end\n end", "def is_of_page_owner\n\t\treturn @is_of_page_owner \n\tend", "def favoriter?\n true\n end", "def can_i_access_your_profile(is_friend)\n \n if is_friend == true\n \treturn \"yes\"\n else \n \treturn \"no\"\n end\nend", "def leader?\n if participants[0] == @my_path\n true\n else\n false\n end\n end", "def title_first_post\n return current_user.poems.count == 1\n end", "def favoriter?\n false\n end", "def home_page?\n active_page? 'info' => ['index']\n end", "def is_first \n\t\treturn self == self.get_debate.posts.first\n\tend", "def facebook_profile?\n @network = current_user.network ||= Network.new\n !(@network.facebook.nil? || @network.facebook.blank?)\n end", "def is_current_page_home?\n puts \"url_home\"\n puts request.url\n if request.url == \"http://127.0.0.1:3000/\" #home url\n @home = true\n end\n end", "def home_page?\n current_route?('')\n end", "def first?\n index == 0\n end", "def first?\n index == 0\n end", "def first?\n self.previous_id.nil?\n end", "def homepage_active?\n active && (! past?)\n end", "def single_user_should_only_have_one_entry_per_round\n\n\t\treturn self.is_first || self.get_side == self.get_debate.get_turn\n\tend", "def is_friend?\n @friended\n end", "def first_login?\n last_login_at.nil?\n end", "def members_page(user)\n\t\tcurrent_user?(user) && !current_user.guest?\n\tend", "def first?; end", "def first?\n\t\treturn @iteration == 0\n\tend", "def first?\n position <= 1\n end", "def is_requested\n request_status_pending? && @friend.requester == current_user\n end", "def view_first\n return @vassals[0].view_first\n end", "def rev_friend?\r\n infoxml = get_info\r\n \r\n if rev_friend = infoxml['revfriend']\r\n return rev_friend == '1'\r\n end\r\n \r\n return false\r\n end", "def on_page_portal?\n return (controller.controller_name == \"home\" and controller.action_name == \"portal\") \n end", "def show\n # Before_action will run before this method. Check lines 3 and 4 for this.\n # This means that unless we need to modify something, our model is ready for the view!\n\n # Make sure there is some data in your database before running this otherwise you will not see anything.\n # You can use the db/seeds.rb file. Check it out!\n\n # This route will be behind friends/:id\n # Where :id is the id for the object.\n #\n # Example: friends/2\n #\n # In our case, thanks to our seed.rb file, this will be Janice. Oh. My. God!\n end", "def is_friend\n friend_request_exists? && @friend.accepted?\n end", "def show_explore_button?\n current_user.permissions == User::Permissions::NONE\n end", "def must_authenticate \n if @authenticated_user && (@user_is_viewing_themselves != false)\n return true\n else\n request_http_basic_authentication(\"Social bookmarking service\") \n return false\n end \n end", "def is_it_me?\n @its_me ||= request.fullpath =~ /\\/me(\\/|\\Z)/\n end", "def is_first=(value)\n if value == @defaults['ai.session.isFirst']\n @values.delete 'ai.session.isFirst' if @values.key? 'ai.session.isFirst'\n else\n @values['ai.session.isFirst'] = value\n end\n end", "def second_screen_visible?\n @second_screen_title.visible?\n end", "def pick_first?\n @pick_first == \"pickfirst\"\n end", "def viewing_players_tab?\n ! viewing_scouts_tab?\n end", "def identity_page?\n active_page? 'accounts' => ['show']\n end", "def fresh?(user)\n if user.real?\n last_viewed_at = MockView.last_viewed_at(self, user)\n !last_viewed_at || (self.updated_at > last_viewed_at)\n else\n false\n end\n end", "def new_statistics_page?\n self.newforstats == 'YES'\n end", "def first\n perform_request(first_page_uri) if first_page_uri\n end", "def show?\n true unless user.nil?\n end", "def following_profile?(profile)\n return favorites.streams.where(favable_id: profile.stream_ids).count > 0\n end", "def home_page?\n controller_name == 'pages' && %w(home location_name).detect {|x| action_name == x} ? true : false\n end", "def first_time_user\n redirect_to_setup_path if current_user.first_time_user?\n end", "def first?\n index == 0\n end", "def show_profile?\n if controller.controller_name == 'hackers'\n true\n else\n false\n end\n end", "def has_facebook_profile?\n fb_userid.present?\n end", "def first_item?\n self.simple_acts_as_list_scope.first == self\n end", "def program_wide?\n location_id.nil? || always_show_on_attendance_pages?\n end", "def has_request\n request_status_pending? && @friend.requester != current_user\n end", "def head?\n @head\n end", "def pro_page?\n (session[:user_type] && session[:user_type] == USER_TYPES[:pro])\n end" ]
[ "0.70023566", "0.70023566", "0.70023566", "0.70023566", "0.69785213", "0.69785213", "0.69767535", "0.6939453", "0.6690538", "0.668022", "0.6608608", "0.6590158", "0.65702426", "0.6518073", "0.63817394", "0.6379837", "0.6361643", "0.6320691", "0.62729216", "0.6239459", "0.62272894", "0.62201405", "0.62201405", "0.6214353", "0.62064916", "0.61858904", "0.6179436", "0.6136215", "0.61058354", "0.60329676", "0.5970932", "0.59671116", "0.5948066", "0.59362864", "0.5917088", "0.5901756", "0.5884805", "0.5884782", "0.5863462", "0.58603704", "0.58546984", "0.5853879", "0.58535725", "0.5848953", "0.5846176", "0.58438456", "0.58313966", "0.5807273", "0.5802115", "0.5784212", "0.57826203", "0.57809556", "0.577905", "0.57623917", "0.5757948", "0.57505214", "0.57495147", "0.57494164", "0.5740363", "0.57138", "0.5706855", "0.5706855", "0.57062876", "0.5703032", "0.57029915", "0.56955564", "0.56907535", "0.5690092", "0.56663525", "0.566296", "0.56601447", "0.56544137", "0.5645431", "0.56413066", "0.56250006", "0.5622634", "0.56214297", "0.561255", "0.56110436", "0.56025463", "0.5601497", "0.5598154", "0.55922365", "0.55916756", "0.5590567", "0.558985", "0.5584699", "0.55819196", "0.55759764", "0.5572857", "0.55605584", "0.5557579", "0.5552189", "0.55425304", "0.55309427", "0.5519768", "0.55147505", "0.55107635", "0.5510277", "0.550802" ]
0.6349572
17
TODO private methods could be extracted into another class TODO it's not the controller responsibility to tell how many pages should be shown
def search_items @resources = current_company.items.search_for(params[:name]).limit(10) @resources = Admin::InventoryItemDecorator.decorate(@resources) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pages\n end", "def pages; end", "def index\n get_own_documents\n if @page > @pages_amount && @pages_amount != 0\n @page = @pages_amount\n get_own_documents\n end\n render_js_or_html_index\n end", "def max_pages() 1 end", "def index\n respond_with(@pages = Page.all.paginate(:page => params[:page] || 1, :per_page => params[:per_page] || 5))\n end", "def index\n get_own_lessons\n if @page > @pages_amount && @pages_amount != 0\n @page = @pages_amount\n get_own_lessons\n end\n render_js_or_html_index\n end", "def page\n\n end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def c_page(n)\n BestiaryConfig::PAGEFX.play\n self.index += n\n end", "def num_pages\n 26\n end", "def pages\n project_size = Project.all.length\n\n puts project_size\n\n respond_to do |format|\n format.json {\n @pages = (project_size/10.0).ceil\n render :json => @pages \n }\n end\n end", "def pages( options = {} )\n options = {:kind => nil, :pages => @pages, :params => {}}.merge(options)\n if options[:pages] and options[:pages].page_count > 1\n html = <<-END\n <div class=\"pages\">\n Page: #{pagination_links(options[:pages], {:window_size => 6, :params => params.merge(options[:params]).reject { |key,value| key == 'controller' }}).sub(/\\d+(?=\\s|$)/, '<span class=\"this_page\">\\&</span>').sub(\"...\", '<span class=\"break\">...</span>')}\n #{options[:kind].nil? ? \"\" : \"(#{options[:pages].last_page.last_item} #{options[:kind]})\"}\n </div>\n END\n end\n end", "def index\n get_own_media_elements\n if @page > @pages_amount && @pages_amount != 0\n @page = @pages_amount\n get_own_media_elements\n end\n render_js_or_html_index\n end", "def index\n @all_entries = Entry.all\n @max_pages = @all_entries.max_pages\n @recent = @all_entries.page\n\n if page_params[:page]\n\n if page_params[:page].to_i > @max_pages.to_i or page_params[:page].to_i < 1\n redirect_to root_url, notice: 'Page does not exist. Only 1 through ' + @max_pages.to_s + ' pages exist.'\n end\n\n @entries = @all_entries.page(page_params[:page].to_i)\n @current_page = page_params[:page]\n else\n @entries = @all_entries.page\n @current_page = 1\n end\n\n end", "def show_total_pages\n pages = show_total_hits / show_results_per_page\n return pages + 1\n end", "def total_pages; end", "def index\n pages = Page.find_by_sql(\"select * from pages\").map { |page| {page: page} }\n if params[:page]\n @pages = get_page_and_offset(13, params[:page].to_i, pages)\n else\n @pages = get_page_and_offset(13, 1, pages)\n end\n\n respond_to do |format|\n format.html\n format.js {render 'paginate_pages.js.erb'}\n end\n end", "def page_count; pages.count; end", "def next_page; end", "def number_of_pages\n return @number_of_pages\n end", "def pages\n @pages\n end", "def index\n @pages = Page.all.order(\"id desc\").page(params[:page]).per_page(8)\n \n end", "def pager; end", "def index\n #@long_pages = LongPage.all\n @long_pages = LongPage.all.page params[:page]\n end", "def index\n # Paginate will still grab all articles but display them a specific amount per page\n @articles = Article.paginate(page: params[:page], per_page: 5)\n end", "def paginate; false; end", "def page\r\n @page || 1\r\n end", "def page_count\n 1\n end", "def pages\n @pages \n end", "def index\n # fetches all articles from the DB into @articles\n\n # @articles = Article.all\n\n # I have commented the line above as we will use paginate\n\n @articles = Article.paginate(page: params[:page], per_page: 4)\n # this will limit the number of article per page at 4\n\n\n\n end", "def pages= number_of_pages\n \t@pages = number_of_pages\n end", "def page\r\n\t\t\t\tparams[:page].to_i || 1\r\n\t\t\tend", "def index\n @pages = @club.all_pages\n \n @page_title = \"Page Listing\"\n @site_section = \"clubs\"\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end \n end", "def page\n\t\tparams[:iDisplayStart].to_i/per_page + 1\n\tend", "def paginator; end", "def index\n @page_num = 0\n if params[:page_num]\n @page_num = params[:page_num]\n end\n page_size = 5\n @total_page = ((ChannelClass.all.count(:id).to_i - 1)/page_size )+1\n @channels = ChannelClass.all.order(\"updated_at desc\").limit(page_size).offset(@page_num.to_i * page_size.to_i)\n \n Rails.logger.info \"-----------------------page_num=#{@page_num}--------------------------------------\"\n Rails.logger.info \"-----------------------total_page=#{@total_page}--------------------------------------\"\n \n #fresh_when(etag: [@channels])\n render 'index', :layout => 'admin'\n end", "def num_pages\n if order_bw_pages && order_color_pages\n return 2 + order_bw_pages + order_color_pages\n end\n end", "def per_page; end", "def index\n return check_logged_in unless current_user\n @pages = current_user.pages\n end", "def index\n @pages = Page.paginate(\n :select => 'id, name, protected', \n :page => params[:page], \n :order => sort_calc('name', {:table => 'pages'})\n )\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end\n end", "def show_pages\n false\n end", "def index\n page = session[:last_documents_page] = params[:page] || session[:last_documents_page] || '1'\n @documents_per_page = params[:documents_per_page] || cookies[:documents_per_page] || Elph[:items_per_page].to_s\n cookies[:documents_per_page] = { :value => @documents_per_page, :expires => 1.year.from_now }\n @documents = Document.own_documents.non_aliases.page(page).per(@documents_per_page).order('date desc, id desc')\n \n #fire_log self.public_methods.sort, 'publ_m'\n fire_log controller_name, 'controller_name'\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @documents }\n end\n end", "def index\n @numberOfItem = 8\n @pageNumber = 1\n if params.has_key?(:p)\n @pageNumber = params[\"p\"].to_f\n end\n @lastPage = New.all.length / @numberOfItem + 1\n if @pageNumber == @lastPage\n @news = New.all.order('created_at DESC').first(@numberOfItem*@pageNumber).last(New.all.length - (@pageNumber-1)*@numberOfItem)\n else\n @news = New.all.order('created_at DESC').first(@numberOfItem*@pageNumber).last(@numberOfItem) \n end\n end", "def next_page\n end", "def index\n respond_to do |format|\n format.html\n format.json do\n collections = Collection.where.not(published_at: nil)\n .order(published_at: :desc)\n .page(params[:page])\n .per(Collection::COLLECTION_PER)\n is_more_load = collections.total_pages > params[:page].to_i\n render json: { collections: collections, is_more_load: is_more_load }\n end\n end\n end", "def more_invoices\n # logic to see how many possbile pages there are...\n total_invoices = Invoice.find(:all).length\n logger.debug total_invoices\n pages_possible = total_invoices / 5.0\n dec = pages_possible.abs.modulo(1) \n if(dec > 0.0)\n pages_possible = pages_possible.to_i + 1\n end\n \n # if less than 5 invoices for x user do not try and load.\n if(total_invoices <= 5)\n render :text => \"Fail\"\n else\n @invoices = Invoice.page(params[:page]).per(5)\n current_page = params[:page].to_i\n total_page = @invoices.length\n if(current_page > pages_possible)\n render :text => \"Fail\"\n else\n render :layout => false \n end\n end\n \n end", "def index\n respond_with(@navlinks = Navlink.all_main_links.paginate(:page => params[:page] || 1, :per_page => params[:per_page] || 10))\n end", "def get_num_pages\n record_count = @model_class.count\n if record_count % @items_per_page == 0\n (record_count / @items_per_page)\n else\n (record_count / @items_per_page) + 1\n end\n end", "def pages\n @pages\n end", "def index\n if params.count <= 3 && cookies['st_admin_setup']\n CGI.parse(cookies['st_admin_setup']).each{|x|\n name = x[0]\n value = x[1][0]\n params[name] = value\n }\n end\n # Update number of items to show on page (if supplied)\n Page.per_page = params[:per_page].to_i if params[:per_page]\n Page.per_page = 10 if Page.per_page <= 0\n\n @authors = Page.select('DISTINCT(author_id)')\n\n @pages = Page.get_my_pages :user => current_user,\n :page_no => params[:page] || 1,\n :locale => I18n.locale,\n :sort => (\"#{sort_column} #{sort_direction}\"),\n :search => params[:search],\n :flocale => params[:flocale],\n :filter => {:status => params[:status], :page_type => params[:page_type], :author => params[:author]}\n end", "def index\n @news = News.page(params[:page]).per(6)\n @page_title = \"LAschool news\"\n end", "def get_view_pages(dbname, view)\n pages = {\n :perpage => get_view_pages_perpage(dbname),\n :current => params[:page].nil? ? 1 : params[:page].to_i,\n :items => view.extras[:auth_count]\n }\n if pages[:items] && pages[:perpage]\n pages[:total] = (pages[:items] + pages[:perpage] - 1) / pages[:perpage]\n end\n pages\n end", "def load_page\n @page = params[:page] || '1'\n @per_page = (params[:limit] || '30').to_i\n @per_page = 30 if @per_page > 30\n true\n end", "def __page\n @_page || 1\n end", "def show_pagination\n previous_link = ''\n next_link = ''\n page_num_links = ''\n\n if show_current_page > 1\n previous_page = show_current_page - 1\n previous_link = '<li class=\"\"><a href=\"' + eds_action_url(\"GoToPage(#{previous_page.to_s})\") + '\">&laquo; Previous</a></li>'\n else\n previous_link = '<li class=\"disabled\"><a href=\"\">&laquo; Previous</a></li>'\n end\n\n if (show_current_page * show_results_per_page) < show_total_hits\n next_page = show_current_page + 1\n next_link = '<li class=\"\"><a href=\"' + eds_action_url(\"GoToPage(#{next_page.to_s})\") +'\">Next &raquo;</a></li>'\n else\n next_link = '<li class=\"disabled\"><a href=\"\">Next &raquo;</a></li>'\n end\n\n if show_current_page >= 4\n page_num_links << '<li class=\"\"><a href=\"' + eds_action_url(\"GoToPage(1)\") + '\">1</a></li>'\n end\n if show_current_page >= 5\n page_num_links << '<li class=\"disabled\"><a href=\"\">...</a></li>'\n end\n\n # show links to the two pages the the left and right (where applicable)\n bottom_page = show_current_page - 2\n if bottom_page <= 0\n bottom_page = 1\n end\n top_page = show_current_page + 2\n if top_page >= show_total_pages\n top_page = show_total_pages\n end\n (bottom_page..top_page).each do |i|\n unless i == show_current_page\n page_num_links << '<li class=\"\"><a href=\"' + eds_action_url(\"GoToPage(#{i.to_s})\") + '\">' + i.to_s + '</a></li>'\n else\n page_num_links << '<li class=\"disabled\"><a href=\"\">' + i.to_s + '</a></li>'\n end\n end\n\n if show_total_pages >= (show_current_page + 3)\n page_num_links << '<li class=\"disabled\"><a href=\"\">...</a></li>'\n end\n\n pagination_links = previous_link + next_link + page_num_links\n return pagination_links.html_safe\n end", "def index\n # take note variable name is now plural for we will be holding all articles in this object\n # this paginate function will load a default number of articles per page\n @articles = Article.paginate(page:params[:page], per_page: 5)\n end", "def paginate_path(site, num_page); end", "def show\n page = Page.where(id: params[:id]).with_hierarchy.first\n redirect_to(controller: 'application', action: 'route_not_found') if page.nil?\n @page = PageDecorator.decorate(page)\n @page_title = @page.name\n # get_media # NOTE: we're not *currently* showing them, but we will.\n # TODO: we should really only load Associations if we need to:\n build_associations(@page.data)\n # Required mostly for paginating the first tab on the page (kaminari\n # doesn't know how to build the nested view...)\n respond_to do |format|\n format.html {}\n end\n end", "def index\n respond_with(pages)\n end", "def initialize\n @page = 1\n end", "def set_page\n if request.format.html? && params[:field] && params[:value]\n field = Content.field_index_to_sym(params[:field])\n\n if Content.column_names.include?(field.to_s)\n matches = policy_scope(Content).where(upload: @upload).where('sequence > 0').order(sort_column.to_s + ' ' + sort_direction.to_s)\n .select(Content.sanitize_sql_for_conditions([\"#{field} = ? as matches\", params[:value]]))\n index = matches.to_a.find_index { |content| ActiveModel::Type::Boolean.new.cast(content[:matches]) }\n\n if index\n page ||= index / params[:limit]\n params[:page] = page + 1 if page && page > 0\n end\n end\n end\n end", "def index\n @pages = Page.all\n respond_with(@pages)\n end", "def index\n # => @news = News.aktiv\n @news = News.aktiv.page(params[:page]).per(Strangecms::Newz::Config[:news_per_page])\n @title = @seite.use_titel ? @seite.titel : @seite.name\n @headline = @seite.use_headline ? @seite.headline : @seite.name\n @paginator_needed = (News.aktiv.count > Strangecms::Newz::Config[:news_per_page]) ? true : false\n render :template => 'base/seite'\n end", "def page\n params[:iDisplayStart].to_i/per_page + 1\n end", "def index\n @content_title = 'Discussion Topics'\n @secondary_title = 'All discussion topics'\n @pages, @wiki_pages = paginate :pages, :order => 'title ASC',\n :conditions => [ 'allow_discussions = ?', true ], :per_page => per_page,\n :include => [ 'discussions' ]\n respond_to do |format|\n format.html\n end\n end", "def show\n \n if Page.count==0\n ensure_homepage\n else\n @page = @page || Page.find_by_alias(app_path)\n # TODO: add the ability for the user to choose whether to render the page or use it as a redirect\n #path = @page.path == '/' ? 'index' : @page.path\n #redirect_to @page.url unless path==app_path\n end\n\n if @page.nil?\n if admin?\n flash[:notice]=\"The page you requested does not exist. Would you like to create it?\"\n @page = Page.new(:path=>app_path)\n @page_template = \"admin\"\n render :action=>'new'\n else\n render :file => \"#{RAILS_ROOT}/public/404.html\", :layout => false, :status => 404\n end\n else\n @[email protected]\n @title = @page.title\n @page_description = @page.description\n\n # Even though the printable pages are rendered in a different layout\n # they also need a different template, since this template should only\n # have a single column\n \n if params[:print] && params[:print] == \"true\"\n @page_template = \"print\"\n elsif @page.url =~ /moving_from_caregivers_menu/\n @page_template = \"template_caregivers\"\n elsif @page.url =~ /moving_from_providers_menu/\n @page_template = \"template_providers\"\n else\n @page_template = @page.template.name\n end\n \n # This isn't really necessary, but it makes the print view very clean\n @pages = [@page]\n\n if params[:popup] && params[:popup] == \"true\"\n render :action => \"show\", :layout => false\n end \n\n if params[:save] && params[:save] == \"true\"\n render_for_save\n end \n \n #Setting the body_id to caregivers to access Noah's customized css. \n #Setting the body_id to caregivers to access Noah's customized css. \n if @page.template.name == 'template_caregivers'\n @body_id = \"Caregivers\" \n @other_perspective, @other_persepective_title = 'moving_from_providers_menu' + $1, 'Health Care Provider Perspective' if @page.url =~ /moving_from_caregivers_menu(.*)/\n elsif @page.template.name == 'template_providers'\n @body_id = \"Providers\" \n @other_perspective, @other_persepective_title = 'moving_from_caregivers_menu' + $1, 'Family Caregiver Perspective' if @page.url =~ /moving_from_providers_menu(.*)/\n elsif @page.template.name == 'template_caregivers_no_menu'\n @body_id = \"Caregivers\" \n elsif @page.template.name == 'template_providers_no_menu'\n @body_id = \"Providers\" \n elsif @page.template.name == 'template_index'\n @body_id = \"Home\" \n end\n \n @left_top_menu = Page.find_by_path 'left_top_menu' \n @left_bottom_menu = Page.find_by_path 'left_bottom_menu' \n \n \n @page_template, @page_type = 'template_pdf', 1 if @page.path == 'CaregiverTool'\n @page_template, @page_type = 'template_pdf', 2 if @page.path == 'ProviderTool'\n \n end\n end", "def index\n @pages = Page.paginate :page => params[:page], :order => 'id DESC'\n end", "def full_page\n end", "def show\n @pages = Page.all\n end", "def set_page\n end", "def page\n Integer(params[:page] || 1)\n end", "def page\n params[:iDisplayStart].to_i / per_page + 1\n end", "def index\n @page = display_page('Admin')\n \n respond_to do |format|\n format.html\n end\n end", "def index\n @articles = Article.all.paginate(page: params[:page], per_page: 20)\n content_for :title, \"Articles\"\n end", "def index\n @articles = Article.paginate(page: params[:page], per_page: 5) \n end", "def index\n\t@articles = Article.paginate(page: params[:page], per_page: 5)\nend", "def page\n @page ||= params[:page] || 1\n end", "def index\n @title = \"All pages\"\n @pages = Page.all\n end", "def info_page(collection, style = nil)\n if collection.page(1).length > 0\n html = \"#{t('views.pagination.displaying')} #{collection.offset_value + 1} -\n #{collection.offset_value + collection.length}\"\n html << \" #{t('of')} #{collection.total_count}\"\n\n content_tag :div, html, class: 'pagination', style: style\n end\n end", "def index\n @page_pages = PagePage.all\n end", "def index\n @root_pages = Page.root_pages\n @uncategorized_pages = Page.uncategorized\n end", "def page_no\n\t params[:page] ? \" Page #{params[:page]}\" : ''\n end", "def show\n begin\n @comic = Comic.find_by_alias_or_id(params[:id])\n @live_pages = @comic.live_pages\n @created_by = @comic.created_by\n \n raise ActiveRecord::RecordNotFound unless @comic.is_live?\n \n params[:page] ||= 1\n @page_number = params[:page].to_i\n \n if params[:page] && (@page_number > @live_pages.length || @page_number <= 0)\n flash[:notice] = \"The page you are looking for could not be found.\"\n redirect_to comic_path(@comic.alias)\n else \n @body_style = \"pages\"\n @total_pages = @live_pages.length\n \n @page = @live_pages[params[:page].to_i - 1]\n \n if params[:position]\n if params[:position] == \"first\"\n params[:page] = \"1\"\n elsif params[:position] == \"latest\"\n params[:page] = @live_pages.length\n end\n end\n \n @page_first = @page_number == 1\n @page_last = @page_number == @live_pages.length\n @page_previous = @page_number - 1\n @page_next = @page_number + 1\n \n increment_view @page\n \n @comments = @page.comments.find(:all, :include => [:created_by])\n \n @other_comics = @created_by.live_comics.find(:all, :limit => 3, :conditions => [\"id != ?\", @comic])\n \n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @comic.to_xml }\n format.rss do\n @pages = @comic.live_pages.find(:all, :order => \"position DESC\", :limit => 15 )\n render :action => \"show.rxml\", :layout => false\n end\n end\n \n end\n \n rescue ActiveRecord::RecordNotFound\n flash[:notice] = \"The comic you are looking for could not be found.\"\n redirect_to home_path\n end \n end", "def show_current_page\n if params[:eds_action].present?\n if params[:eds_action].scan(/GoToPage/).length > 0\n pagenum = params[:eds_action].to_s\n newpagenum = pagenum.gsub(\"GoToPage(\", \"\")\n newpagenum = newpagenum.gsub(\")\", \"\")\n return newpagenum.to_i\n elsif params[:eds_action].scan(/SetResultsPerPage/).length > 0\n if params[:pagenumber].present?\n return params[:pagenumber].to_i\n else\n return 1\n end\n else\n return 1\n end\n end\n if params[:pagenumber].present?\n return params[:pagenumber].to_i\n end\n return 1\n end", "def index\n #@articles = Article.all\n #@articles = Article.paginate(page: params[:page]) #, per_page: 5)\n @articles = Article.paginate(page: params[:page], per_page: 5)\n\n end", "def index\n @contentperpages = Contentperpage.all\n end", "def index\n if logged_in?\n @pannes = Panne.paginate(page: params[:page], :per_page => 10)\n else\n redirect_to home_url\n end\n end", "def index\n #FIXME_AB: Lets make per page = 50\n @users = User.all.order('first_name').page(params[:page]) \n respond_to do |format|\n format.html{}\n end\n end", "def current_page_number\n @pageset.size\n end", "def index\n @articles = Article.paginate(page: params[:page], per_page: 5)\n end" ]
[ "0.739138", "0.7331139", "0.71329755", "0.7020172", "0.7008272", "0.6892484", "0.68578106", "0.68117565", "0.68117565", "0.68117565", "0.68117565", "0.68117565", "0.68117565", "0.68117565", "0.68117565", "0.68117565", "0.68117565", "0.68117565", "0.68117565", "0.6697739", "0.66856843", "0.6660472", "0.6616285", "0.66160864", "0.66159666", "0.6603884", "0.6596838", "0.65912926", "0.65532696", "0.6532246", "0.6528153", "0.6512378", "0.65058666", "0.6494706", "0.64889574", "0.6472502", "0.6464313", "0.64584136", "0.64459527", "0.6439447", "0.64280564", "0.6423566", "0.63975126", "0.63882464", "0.6376957", "0.63713676", "0.6358822", "0.6352985", "0.63438225", "0.6338711", "0.6330355", "0.6327799", "0.6326929", "0.6325192", "0.6324193", "0.63196576", "0.63169366", "0.6309256", "0.63075477", "0.6306127", "0.63022727", "0.6298529", "0.6296045", "0.6284728", "0.628101", "0.62730205", "0.62677366", "0.6260126", "0.6258367", "0.6257248", "0.6244675", "0.6238499", "0.6232184", "0.6232166", "0.6231991", "0.62311363", "0.6215299", "0.6214377", "0.6213902", "0.62097687", "0.6209631", "0.6201702", "0.6200225", "0.61990726", "0.61921", "0.6188198", "0.61842704", "0.61820126", "0.6180213", "0.61792445", "0.6177854", "0.6166022", "0.61597025", "0.61535776", "0.61531615", "0.61527884", "0.6150278", "0.61443955", "0.6139213", "0.61352795", "0.61287564" ]
0.0
-1
before_action :authorized, except: [:issue_token, :decode, :logged_in?]
def issue_token(payload) JWT.encode(payload, Rails.application.credentials.secret_key_base) # JWT.encode(payload, ENV["SOME_SECRET"], ENV["SOME_SUPER_SECRET"]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skip_authorization_check(*args)\n before_action(*args) do |controller|\n controller.instance_variable_set(:@_authorized, true)\n end\n end", "def unauthorized\n end", "def skip_authorization; end", "def authenticate\n authenticate_token || render_unauthorized\nend", "def login_required\n not_authorized unless current_user\n end", "def authorized\n redirect_to \"/login\" unless logged_in? \n end", "def login_required\nauthorized? || access_denied\nend", "def authorize\n end", "def authorize\n end", "def before_action \n end", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if !current_user\n end", "def authorized\n render json: {message: 'Please log in'}, status: :unauthorized unless logged_in?\n end", "def authorized\n render json: { message: 'Please log in'}, status: :unauthorized unless logged_in?\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize!(user)\n redirect '/not_authorized' unless authorized?(user)\nend", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if current_user.nil?\n end", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if current_user.nil?\n end", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if current_user.nil?\n end", "def authorized\n render json: { message: 'Please log in' }, status: :unauthorized unless logged_in?\n end", "def authorize\n redirect_to('/login') unless @current_user\n end", "def check_is_login_required\n authorized_denied unless logged_in?\n end", "def authorize\n redirect_to :login unless user_signed_in?\n end", "def authenticate\n# byebug\n return true if public_action?\n if request.format.json?\n authenticate_token || render_json_unauthorized\n else\n authenticate_user!\n end\n end", "def authorise_action\n if !logged_in? or (@annotation.source != current_user)\n # TODO: return either a 401 or 403 depending on authentication\n respond_to do |format|\n flash[:error] = 'You are not allowed to perform this action.'\n format.html { redirect_to :back }\n format.xml { head :forbidden }\n end\n return false\n end\n return true\n end", "def authorise_action\n if !logged_in? or (@annotation.source != current_user)\n # TODO: return either a 401 or 403 depending on authentication\n respond_to do |format|\n flash[:error] = 'You are not allowed to perform this action.'\n format.html { redirect_to :back }\n format.xml { head :forbidden }\n end\n return false\n end\n return true\n end", "def http_authorize \n redirect_to login_path, alert: 'Authorization required' if !logged_in? \n end", "def authorize!\n redirect '/' unless logged_in?\n end", "def unauthorized\n\n render_error( :unauthorized )\n\n end", "def authorized\n render json: {message: 'Please log in to continue'}, status: :unauthorized unless logged_in?\n end", "def unauthenticated\n end", "def authorized?\nlogged_in?\nend", "def authorize \n redirect_to login_url, notice: \"Please log in\" if session[:user_id].nil?\n end", "def authorized?\n logged_in? && current_user.login == \"ej0c\"\n end", "def authorized\n redirect_to :controller => 'home', :action => 'index' unless logged_in?\n end", "def require_login!\n return true if authenticate_token\n render json: { errors: [ { details: \"Access denied\" } ] }, status: :unauthorized\n end", "def access_control\n \n end", "def authorized\n if !decode_token\n render json: {message: \"Please Sign In\"}, status: :unauthorized\n end\n end", "def authorize\n redirect_to \"/log_in\", :alert => t('.need_to_be_logged_in') unless signed_in?\n end", "def authorize_unauthenticated_user\n target_action = params[:controller] + '#' + params[:action]\n unless User::DEFAULT_PERMISSIONS.include?(target_action)\n head :unauthorized and return\n end\n end", "def authenticate_with_token!\n render json: { errors: 'Acesso não autorizado!' }, status: 401 unless user_logged_in?\n end", "def logged_in_authorize\n unless logged_in?\n unauthorized_access\n end\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorized\n redirect_to '/welcome' unless logged_in?\n end", "def authorized!\n redirect_to root_url, alert: \"You need to be set up for receiving whispers first\" and return unless current_user\n end", "def authorized\n render json: { message: 'Please log in' }, status: :unauthorized unless logged_in?\n end", "def authorize_user\n unless @api_user.permit? params[:controller], params[:action]\n head :unauthorized and return\n end\n end", "def authorized\n redirect_to '/signin' unless current_driver\n end", "def needs_authenticate_user?\n except_actions = %w[index show print]\n !except_actions.include?(action_name)\n end", "def authorization; end", "def authenticate!\n not_authorized() unless logged_in?()\n end", "def authorize\n return if current_user\n\n redirect_to login_url\n end", "def authorize_request\n unless request.headers['Authorization'].present?\n render json: {message: 'Missing Token'}, status: :unauthorized\n end\n end", "def login_required\n redirect_to(login_url) unless logged_in? && authorized?\n end", "def authenticate_with_token!\n renders json: {errors: \"Not authenticated\"},\n status: :unauthorized unless user_signed_in?\n end", "def unauthorized\n head :unauthorized\n end", "def login_required\n authorized? || access_denied\n end", "def login_required\n authorized? || access_denied\n end", "def login_required\n authorized? || access_denied\n end", "def authenticate_request\n render :json => { :error => :unauthorized }, :status => :unauthorized unless current_user\n end", "def authenticate\n logged_in? ? true : access_denied\nend", "def authenticate_with_token!\n render json: { errors: \"Not authenticated\" }, status: :unauthorized unless user_signed_in?\n end", "def restricted_login!\n return true if authenticate_token_restricted\n render json: { errors: [ { detail: \"Access denied\" } ] }, status: 401\n end", "def authorize\n redirect_to new_session_path unless logged_in?\n end", "def authorized?\n true\n end", "def auth_controller?\n false\n end", "def authorized?\n render nothing: true, status: :forbidden if !current_account\n end", "def login_required\n authorized? || throw(:halt, :access_denied)\n end", "def redirect_unauthorized!\n redirect_to not_authorized_path\n end", "def authorize\n redirect_to new_sessions_path if current_user.nil?\nend", "def pre_authorize_cb; end", "def require_login!\n return true if authenticate_token\n render json: { errors: [ { detail: \"Access denied\" } ] }, status: 401\n end", "def require_login!\n return true if authenticate_token\n render json: { errors: [ { detail: \"Access denied\" } ] }, status: 401\n end", "def authenticate_token\n render_401 if @token.blank? || [email protected]?\n end", "def authenticate\n \n authenticate_token || render_unauthorized\n end", "def authorize\n redirect_to :root, alert: 'You must be logged in to view this page' if current_user.nil?\n end", "def authorize\n redirect_to login_path, alert: 'You must be logged in to access this page.' if current_user.nil?\n end", "def token\n authenticate_username_password || render_unauthorized\n end", "def authenticate\n authenticate_token || render_unauthorized\n end", "def authorize\n @user = User.find_by_id_and_multitrack_token(params[:user_id], params[:token])\n head(@user ? :ok : :forbidden)\n end", "def user_action_on_resource_authorized\n end", "def authorize!\n if current_user && current_user.clearance_level > 1\n return true\n else\n respond_to do |format|\n format.html do\n redirect_to main_app.new_session_path\n end\n format.json do\n render status: 403, nothing: true\n end\n end\n end\n end", "def authorize\n redirect_to new_session_path unless current_user #call method curent_user in sessions_helper\n end", "def authorize_user\n # simple authorization: kick out anonymous users from backend actions\n=begin\n if !current_user\n redirect_back_or_default(home_page) and return if action_name =~ /index|edit|update|destroy/\n \n # skip checking permission if user is an admin\n elsif !current_user.has_role?('Admin')\n unless current_user.has_permission?(controller_name, action_name, params)\n flash[:warning] = 'Access Denied'\n redirect_back_or_default(home_page) and return\n end\n end\n=end\n end", "def unauthorized\n render_json error: 'Access Not Authorized', status: :forbidden\n end", "def render_must_sign_in\n render status: :unauthorized\n end", "def needs_authenticate_user?\n except_actions = %w[index show]\n !except_actions.include?(action_name)\n end", "def protect?(action)\n true\n end", "def protect?(action)\n true\n end", "def protect?(action)\n true\n end", "def protect?(action)\n true\n end", "def login_required\n (logged_in? || (controller_name == 'sessions')) ? true : access_denied\n end", "def authorized\n render json: { message: 'Please log in' }, status: :unauthorized unless logged_in?\n end", "def login_required\n logged_in? || access_denied\n end" ]
[ "0.71576416", "0.7123765", "0.701791", "0.70004845", "0.6852413", "0.6844437", "0.68346965", "0.6797021", "0.6797021", "0.675293", "0.6748238", "0.6741411", "0.6728515", "0.67172676", "0.6716306", "0.6716306", "0.6716306", "0.6716306", "0.6716306", "0.6716306", "0.6716306", "0.6716306", "0.6711621", "0.67105615", "0.67105615", "0.67105615", "0.6709588", "0.6702238", "0.66880363", "0.66879797", "0.66809136", "0.66692734", "0.66692734", "0.66510236", "0.66472995", "0.6643651", "0.6641369", "0.66125584", "0.66039664", "0.6580148", "0.6573198", "0.6562082", "0.65480965", "0.65426296", "0.65340924", "0.6530319", "0.65213", "0.6498345", "0.64908534", "0.6483804", "0.6481498", "0.64762825", "0.6475866", "0.6468373", "0.6466651", "0.6464034", "0.64470196", "0.64458454", "0.6442086", "0.6432536", "0.6431255", "0.6430262", "0.6422306", "0.6420342", "0.6420342", "0.6420342", "0.6413067", "0.641068", "0.6409263", "0.64079154", "0.63974255", "0.63973016", "0.6396641", "0.63951236", "0.63876855", "0.63851017", "0.6384676", "0.6382275", "0.6381588", "0.6381588", "0.63757867", "0.63694215", "0.6368925", "0.6356121", "0.6347004", "0.6339591", "0.63362175", "0.63343465", "0.6329049", "0.6319546", "0.6319284", "0.6312585", "0.6308297", "0.6306597", "0.629088", "0.629088", "0.629088", "0.629088", "0.6278743", "0.62770385", "0.6273536" ]
0.0
-1
Loads the Core homepage
def load_page logger.info 'Loading Core homepage' get ConfigCore.base_url when_exists(page_heading, Config.medium_wait) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main_homepage\n\t\t\t@section = Section.homepage\n\t\t\t@main_homepage = @page = Asset.find_by_section_id_and_resource_type(@section.id, 'Homepage')\n\t\t\t@is_homepage = true\n\t\t\thomepage\n end", "def homepage\n end", "def homepage\n end", "def homepage\n Bbc_homepage.new(@browser)\n end", "def homepage\n end", "def homepage\n end", "def homepage\n @homepage ||= if parent\n parent.homepage\n else\n self.class.default_homepage\n end\n end", "def homepage\n page.homepage\n end", "def index\n\t\t@page = ContentPage.find_by_home(true)\n\tend", "def home\n\t\t# Home Page\n\tend", "def set_home\n end", "def homepage\n get '/Pages/Default.aspx'\n end", "def load_index_page\n @page ||= Language.current_root_page\n render template: \"alchemy/welcome\", layout: false if signup_required?\n end", "def homepage\n @homepage ||= Page.find_by_parent_id(nil)\n end", "def setup\n @page = pages(:homepage)\n end", "def home\n @static_page = StaticPage.preload_for(:content).find_by(role: :home)\n # return unless stale?(@static_page)\n\n set_custom_splash\n set_metadata(@static_page)\n end", "def home\n @static_page = StaticPage.preload_for(:content).find_by(role: :home)\n # return unless stale?(@static_page)\n\n set_custom_splash\n set_metadata(@static_page)\n end", "def home\n @title = \"Home Base\"\n end", "def home\n error_404 unless (@page = Page.where(:link_url => '/').first).present?\n \n call_back\n \n @test = @profile\n @test2 = @current_patner.nil?\n \n # Member.project; Project.hoster\n \n if !Project.all.empty?\n @projects = Project.all\n end\n end", "def set_resource_content\n @page = Page.available.homepage.first!\n end", "def load_homepage\n logger.info 'Loading Canvas homepage'\n navigate_to \"#{WebDriverUtils.canvas_base_url}\"\n end", "def home\n\t\t\n\tend", "def home\n\t\t\n\tend", "def initialize\n @klass = 'HOME'\n @description = nil\n # Wait for the page to be displayed with MAX_WAIT_ON_LOAD seconds timeout\n raise 'The page was not loaded' unless self.displayed?($janus::MAX_WAIT_ON_LOAD)\n end", "def home\n $current_loc = \"/\"\n header \"/\"\n stack(margin:[40,0,40,0]) do\n\t title \"Welcome to the Enveomics collection!\", align:\"center\"\n\t $home_info = para \"Retrieving enveomics...\", align:\"center\"\n\t $manif_path = EnveCollection.manif\n\t if $manif_path.nil?\n\t zip_target = File.expand_path(\"master.zip\", EnveCollection.home)\n\t download EnveCollection.master_url,\n\t save: zip_target,\n\t finish: proc { |d|\n\t\t $home_info.text = \"Unzipping...\"\n\t\t # ToDo: Improve the next line!\n\t\t system(\"cd #{EnveCollection.home.shellescape} \" +\n\t\t \"&& unzip master.zip\")\n\t\t File.unlink(zip_target)\n\t\t $manif_path = EnveCollection.manif\n\t\t show_home\n\t }\n\t else\n\t show_home\n\t end\n end\n footer\n end", "def home_page\n @home_page ||= \"/#{(Page.find_by_title('Home') || Page.first(:order => 'position')).title.downcase.parameterize}\"\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def visit_homepage\n visit(HOMEPAGE)\n end", "def set_homepage\n @homepage = Homepage.find(params[:id])\n end", "def set_homepage\n @homepage = Homepage.find(params[:id])\n end", "def set_homepage\n @homepage = Homepage.find(params[:id])\n end", "def homepage(val = NULL)\n if null?(val)\n @homepage || raise(MissingProjectConfiguration.new('homepage', 'http://www.getchef.com'))\n else\n @homepage = val\n end\n end", "def loadHandinPage\n\n updateModules()\n if @modulesUsed.include?(\"Svn\") then\n svnLoadHandinPage()\n else\n super()\n end\n end", "def home\r\n \r\n end", "def open_home_page\n open(configuration.browser_url)\n end", "def home\n @events = Event.published.confirmed.ordered.tease\n @teaser = Teaser.current.limit(1).first\n @sponsors = Sponsor.order(\"position\").all\n @about = Content.find_by_id(6)\n @donate = Content.find_by_id(7)\n render :layout => \"homepage\"\n end", "def home\n @home ||= \"#{site.local_url}\"\n end", "def home_page\n nil\n end", "def home\n\tend", "def home; end", "def home\n # Insert ruby code...\n end", "def home\n # do nothing\n end", "def front\n @title = \"a community for DIY environmental investigation\"\n render :template => \"home/home-2\"\n end", "def index\n\t\t@page_title = \"Home\"\n\t\t\n\tend", "def home \n\tend", "def front_office_home_page\n @last_page = FrontOfficeHomePage.new\n end", "def root\n self.home\n self\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def home\n end", "def root_page\n sitemap.find_resource_by_path(config.index_file)\n end", "def home\n render 'users/homepage'\n end", "def run_normal\n welcome_header\n main_menu \n end", "def admin_index\n return if !user_is_allowed('pages', 'view') \n @domain = Domain.where(:domain => request.host_with_port).first\n @home_page = @domain ? Page.index_page(@domain.site_id) : nil\n if @domain && @home_page.nil?\n @home_page = Caboose::Page.create(:site_id => @domain.site_id, :parent_id => -1, :title => 'Home')\n end\n render :layout => 'caboose/admin' \n end", "def set_resource\n @page = current_site.pages.available.homepage.first!\n end", "def index\n @admin_og_main_pages = Admin::OgMainPage.all\n end", "def render_solr_core\n unless request.host == 'search.library.cornell.edu' or request.host == 'catalog.library.cornell.edu'\n core = Blacklight.connection_config[:url]\n # Remove http protocol string\n start = core.rindex(/:\\/\\//) + 3\n display = '<p class=\"solr-core\">Solr core: ' + core[start..-1] + '</p>'\n display.html_safe\n end\n end", "def index\n\t\trender 'home'\n\tend", "def get_started\n \t@title= \"Antes de empezar...\" #Page title\n end", "def homepage(val = NULL_ARG)\n @homepage = val unless val.equal?(NULL_ARG)\n @homepage || raise(MissingProjectConfiguration.new('homepage', 'http://www.getchef.com'))\n end", "def sourcehome\n site ? site.home : '#'\n end", "def home\n\n end", "def home\n\n end" ]
[ "0.7288464", "0.6845803", "0.6845803", "0.6665816", "0.6640204", "0.6640204", "0.66212624", "0.65959257", "0.65875936", "0.6431552", "0.6392498", "0.6370867", "0.6340402", "0.63234204", "0.6302416", "0.62859595", "0.62859595", "0.6268118", "0.62627846", "0.6188863", "0.6179329", "0.6133795", "0.6133795", "0.6094814", "0.60914946", "0.60847026", "0.6064693", "0.6064693", "0.6064693", "0.6064693", "0.60413843", "0.60340357", "0.60340357", "0.60340357", "0.60222805", "0.6009522", "0.60003626", "0.59891206", "0.5983243", "0.5968412", "0.5966613", "0.5958245", "0.5953968", "0.5934374", "0.59261143", "0.59191877", "0.59186786", "0.5901469", "0.5896534", "0.5891439", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58813244", "0.58631885", "0.5862361", "0.58551687", "0.5840194", "0.5839499", "0.5825654", "0.5810112", "0.58037144", "0.58024895", "0.58004415", "0.57961154", "0.57897705", "0.57897705" ]
0.81496716
0
Logs in from homepage
def log_in(username, password) logger.info "Logging in as #{username}" wait_for_element_and_type(username_input, username) wait_for_element_and_type(password_input, password) wait_for_element_and_click sign_in_button when_exists(sign_out_link, Config.short_wait) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loginpage\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n redirect_to lato_core.root_path if core_controlSession\n end", "def log_in\n end", "def login_page\n end", "def home\n authenticate!\n end", "def login\n\n end", "def login\n\n end", "def login\n\tend", "def login; end", "def default_login\n login(\"[email protected]\",\"codetheoryio\")\n end", "def login\n\t#Login Form\n end", "def login\n make_login_call\n end", "def log_in\n visit \"/gp/login.do\"\n fill_in \"id\", :with => @user\n fill_in \"clave\", :with => @password\n first(\".bLogin a\").click\n end", "def logged_in_account\n unless logged_in?\n redirect_to login_path\n end\n \tend", "def login\n\t\tif @current_user != nil\n\t\t\tredirect_to user_path(@current_user.id)\n\t\tend\n\tend", "def do_login page\n page = page.form_with(action: \"/login\") do |f|\n f.userid = @@username\n f.password = @@password\n end.click_button \n end", "def do_login page\n page = page.form_with(action: \"/login\") do |f|\n f.userid = @@username\n f.password = @@password\n end.click_button \n end", "def login\n @browser.login\n end", "def logged_in\r\n end", "def logged_in_user\n unless logged_in?\n redirect_to root_url\n end\n end", "def autenticathe_login!\n unless someone_is_logged_in?\n store_location\n flash[:danger] = \"Por favor, Inicie sesion.\"\n redirect_to welcome_path\n end\n end", "def home\n redirect_to signin_path() and return if ( @current_user.nil? )\n end", "def login\n self.login\n end", "def make_user_login\n #If you aren't logged in redirect to login page\n if !logged_in?\n redirect_to(:controller => 'sessions', :action => 'login')\n end\n end", "def access_sign_in_page\n\t\[email protected](@sign_in_url)\n\tend", "def logged_in_user\n unless logged_in?\n redirect_to login_url\n end\n end", "def logged_in\n unless logged_in?\n redirect_to root_url, flash: {danger: '请登陆'}\n end\n end", "def login\n\t\tif logged_in?\n\t\t\tredirect_to(:controller => :photos, :action => :index, :id => current_user_id)\n\t\tend\t\n\tend", "def sign_in\n if cookies[ :user_id ] != nil\n redirect_to :action => \"index\" ,:controller => \"homepage\"\n end\n render layout: false\n end", "def login\n # show LOGIN form\n\n end", "def login(user=:joerg)\r\n login_as(user)\r\n end", "def logging_in\n \t\t\n \tend", "def logged_in_account\n unless logged_in?\n redirect_to login_path\n end\n end", "def logged_in_user\n unless logged_in?\n redirect_to '/login'\n end\n end", "def login\n if request.post?\n if user_login(request.subset('username', 'password'))\n flash[:success] = 'You have been logged in'\n redirect(Posts.r(:index))\n else\n flash[:error] = 'You could not be logged in'\n end\n end\n\n @title = 'Login'\n end", "def logging_in\n end", "def home\n if user_signed_in?\n current_user.update_attribute(:login_status, true) if current_user # update login status for logged in user\n if !current_user.is_super_admin? && current_user.sign_in_count == 1 && current_user.created_by != 0 #User records which are created by super admin or dept admin has to change the password while they are logged in first time\n redirect_to :controller => \"registrations\", :action => \"privacy_setting\"\n else\n redirect_to :controller => \"dashboard\", :action => \"index\"\n end\n else\n redirect_to new_user_session_path\n end\n end", "def sign_in\n $users.logged_in_user.sign_out unless $users.current_user==nil\n # This line is required because visiting the login page doesn't\n # actually work when you're currently logged in.\n #s_o.click if s_o.present?\n visit LoginPage do |log_in|\n log_in.username.set @user_name\n log_in.login\n end\n# on(Researcher).logout_button.wait_until_present\n @session_status='logged in'\n end", "def exec_login\n if core_createSession(params[:username], params[:password])\n redirect_to lato_core.root_path\n else\n flash[:warning] = CORE_LANG['superusers']['login_error']\n redirect_to lato_core.login_path\n end\n end", "def login_admin_anna\n user = User.find_by(name: \"Anna\")\n log_in(user)\n end", "def login_into_alchemy\n visit '/alchemy/admin/login'\n fill_in('alchemy_user_session_login', :with => 'jdoe')\n fill_in('alchemy_user_session_password', :with => 's3cr3t')\n click_on('Login')\n end", "def run()\n login()\n end", "def logged_in\n if current_user == nil\n redirect_to new_user_session_path\n end\n end", "def login\n # pull the user info from the user model with the login params\n user = User.find_by_login(params[:login])\n # Authenciate with password\n if user and user.authenticate(params[:password])\n session[:user_id] = user.id\n session[:user_login] = user.login\n session[:user_authority] = user.authority\n # redirect to the landing page\n redirect_to \"/projects\"\n # failed \n else\n redirect_to login_url, alert: \"無効なID、パスワードの組み合わせです。\"\n end\n end", "def login\n abakus_config = YAML.load(File.open(\"./config/_abakus_account.yaml\"))\n username = abakus_config['app']['username']\n password = abakus_config['app']['password']\n \n login_page = @agent.get(\"https://abakus.no/user/login/\")\n login_form = login_page.form_with(:action => \"/user/login/\")\n login_form.username = username\n login_form.password = password\n login_form.submit\n end", "def logged_in_user\n unless logged_in?\n store_location # Store the website that the user is trying to access - this function is a sessions helper\n flash[:danger] = \"You need to log in to access this page.\"\n redirect_to login_url\n end\n end", "def login\r\n if request.get?\r\n # Logout user\r\n self.logged_in_user = nil\r\n else\r\n # Authenticate user\r\n user = User.try_to_login(params[:login], params[:password])\r\n if user\r\n self.logged_in_user = user\r\n # user.update_attribute(:ip_last, request.remote_ip)\r\n journal(\"log_in\",user.id)\r\n # generate a key and set cookie if autologin\r\n if params[:autologin] && Setting.autologin?\r\n token = Token.create(:user => user, :action => 'autologin')\r\n cookies[:autologin] = { :value => token.value, :expires => 1.year.from_now }\r\n end\r\n puts \"aqui\"\r\n if user.show? \r\n puts \"1\"\r\n redirect_back_or_default :controller => 'my', :action => 'athletes'\r\n else \r\n puts \"2\" \r\n redirect_back_or_default :controller => 'my', :action => 'page'\r\n end\r\n else\r\n # if user.locked?\r\n # flash.now[:notice] = l(:status_locked)\r\n # else\r\n flash.now[:notice] = l(:notice_account_invalid_creditentials)\r\n # end\r\n journal(\"invalid-\"+params[:login]+\"-\"+params[:password],0)\r\n end\r\n end\r\n end", "def login\n\t\t\tresponse = @http.get(\"/authentication/whoami\")\n\t if(response.code == '200')\n\t set_cookie(response)\n\t puts \"\"\n\t puts \"================\"\n\t puts \"login\"\n\t login_response = @http.post(\"/authentication/login\",\"username=#{@username}&password=#{@password}&skin=#{@skin}&account=#{@account}\",{'Cookie' => @cookies.to_s})\n\t check_cookie(login_response)\n\t login_check(login_response)\n\t puts \"--------\"\n\t else\n\t puts \"Error invalid host #{response.message}\"\n\t abort #if the login site is invalid, then abort\n\t end \n\t\tend", "def logged_in\n unless logged_in?\n redirect_to root_url, flash: {danger: '请登陆'}\n end\n end", "def logged_in\n unless logged_in?\n redirect_to root_url, flash: {danger: '请登陆'}\n end\n end", "def logged_in\n unless logged_in?\n redirect_to root_url, flash: {danger: '请登陆'}\n end\n end", "def logged_in\n unless logged_in?\n redirect_to root_url, flash: {danger: '请登陆'}\n end\n end", "def logged_in\n unless logged_in?\n redirect_to root_url, flash: {danger: '请登陆'}\n end\n end", "def logged_in\n unless logged_in?\n redirect_to root_url, flash: {danger: '请登陆'}\n end\n end", "def logged_in\n unless logged_in?\n redirect_to root_url, flash: {danger: '请登陆'}\n end\n end", "def logged_in\n unless logged_in?\n redirect_to root_url, flash: {danger: '请登陆'}\n end\n end", "def logged_in\n unless logged_in?\n redirect_to root_url, flash: {danger: '请登陆'}\n end\n end", "def logged_in\n unless logged_in?\n redirect_to root_url, flash: {danger: '请登陆'}\n end\n end", "def logged_in\n unless logged_in?\n redirect_to root_url, flash: {danger: '请登陆'}\n end\n end", "def sign_in(user)\n login_as(user, scope: :user)\n visit root_path\n end", "def signon\n user = Account.find_by_name( params[ :acc_name ].strip )\n if !!( user && user.authenticate( params[ :password ].strip ))\n return_to = session[ :return_to ] || base_url\n reset_session\n session[ :current_user_id ] = user.id\n session[ :keep_base_open ] = user.keep_base_open\n redirect_to return_to\n else\n flash[ :alert ] = t( 'home.signon.error' )\n redirect_to home_url\n end\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 login_user\n visit \"/login\"\n fill_in \"session[name]\", with: \"DJ\"\n fill_in \"session[password]\", with: \"pw\"\n click_link_or_button(\"Login\")\n end", "def user_login(user)\n click_log_in\n fill_login_credentials(user)\n end", "def login\n\t\tnavigate(@login_path)\n\n\t\tlogin_form = find_by_xpath(@signin_xpath)\n\t\tlogin_field = find_by_id('login_field')\n\t\tpassword_field = find_by_id('password')\n\n\t\tlogin_field.send_keys(@username); sleep 1\n\t\tpassword_field.send_keys(@password); sleep 1\n\n\t\tlogin_form.click; sleep 15\n\tend", "def logged_in\n if current_user == nil\n redirect_to new_user_session_path\n end\n end", "def logged_in_user\n unless logged_in?\n redirect_to login_url, flash: { danger: 'Por favor, faça login' }\n end\n end", "def login\n \t# Find a user with params\n \tuser = User.authenticate(@credentials[:password], @credentials[:username])\n \tif user\n\t \t# Save them in the session\n\t \tlog_in user\n\t \t# Redirect to articles page\n\t \tredirect_to articles_path\n\telse\n\t\tredirect_to :back, status: :created\n\tend\n end", "def login\n validate_arguments!\n\n Turbot::Auth.login\n display \"Authentication successful.\"\n end", "def login\n if session[:user] != nil then\n logged_in_home_page = home_index_path\n respond_to do |format|\n format.html { redirect_to logged_in_home_page}\n format.json { head :no_content }\n end\n return\n end\n\n @user = User.new\n \n respond_to do |format|\n format.html # login.html.erb\n format.json { render json: @user }\n end\n end", "def login\n mech = Mechanize.new\n page = mech.get(LOGIN_URL)\n username_field = page.form.field_with(id: \"user_email\")\n username_field.value = USER\n password_field = page.form.field_with(id: \"user_password\")\n password_field.value = PASS\n page.form.submit\n end", "def log_user_in(user)\n set_omniauth_user user\n visit '/'\n click_link 'Log In'\n end", "def index\n @logins = Login.all\n #cookies[:current_user] = \"user\"\n login_user = Login.find_by_id(session[:login_id])\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", "def login_user\n visit landing_page_path\n click_on 'Login'\n fill_in 'Email', with: users(:tony).email\n fill_in 'Password', with: 'password'\n click_on 'Log in'\n end", "def login\n @browser.goto \"instagram.com/accounts/login/\"\n @browser.text_field(:name => \"username\").set \"#{@username}\"\n @browser.text_field(:name => \"password\").set \"#{@password}\"\n @browser.button(:text => 'Log in').click\n sleep(2)\n end", "def login_helper\n username = prompt.ask(\"Enter Username\")\n password = prompt.ask(\"Enter Password\")\n if User.find_by(name: username, password: password)\n self.user = User.find_by(name: username, password: password)\n # no music yet\n puts \"Let's Get Cookin, #{self.user.name.upcase}!!!\"\n sleep(1.5)\n main_menu\n else\n puts \"Incorrect Username or Password\"\n sleep(1.5)\n login_page\n end\n end", "def check_logged_in_home\n if current_user != nil\n redirect_to user_path(current_user)\n end\n end", "def index\n\t\t# Logs user in if session cookie is present\n\t\tif @user = User.find_by_id(session[:user]) \n\t\t\tredirect_to user_dash_path(@user) \n\t\tend\n\tend", "def login \n\t\n\t\t# redirect user to their team library if he or she visits the login screen but is already logged in\n\t\tif !session[:user_id].nil?\n\t\t\tredirect_to(:controller => :flash_teams, :action => :index)\n\t\tend\t\t\n\t\t\n\t\t@title = \"Login\"\n\t\t\n\tend", "def login\n # when we log in, we're looking at a page that looks like all other pages,\n # so we need some data for the layout\n @tags = Post.tag_counts\n # create a new author to access\n @author = Author.new\n # set the page title\n $page_title = 'Log in.'\n render :template => 'admin/login/login'\n end", "def logged_in\n unless logged_in?\n redirect_to root_url, flash: {danger: '请登录'}\n end\n end", "def user_login\n unless logged_in?\n navigated_location #stores the location that was navigated before login\n flash[:alert]= \"You Must Be Log In Order To Access that Portion of the Site\" \n redirect_to login_path\n end\n end", "def check_login!\n u = check_and_get_user\n redirect to('/signin.html') unless u\n u\n end", "def autologin_the_user\n #unless logged_in?\n # FrontendUserSession.create(params[:frontend_user_session])\n #end\n end", "def home\n if logged_in?\n redirect_to user_path(current_user) # Redirect to user show page if logged in\n else\n render layout: 'welcome' # Render home view with welcome layout\n end\n end", "def home\r\n\r\n redirect_to(@current_user.home_page)\r\n end", "def logon(browser, creds=credentials)\n name, email, password = creds\n browser.goto COMMUNITY_URL\n browser.url.should == COMMUNITY_URL\n\n # note, mac ff needs a couple of attempts to scroll view to Login\n login_elem = browser.link(:text, 'Login')\n scroll_right browser, login_elem\n attempt(3) { login_elem.hover }\n attempt(3) { login_elem.click }\n\n email_xpath = '//*[@id=\"login_form\"]//*[@id=\"email\"]'\n password_xpath = '//*[@id=\"login_form\"]//*[@id=\"password\"]'\n\n browser.text_field(:xpath, email_xpath).when_present.set email\n browser.text_field(:xpath, password_xpath).set password\n browser.button(:name, 'login').click\n end", "def login_as(email, password)\n click_link \"Log in\"\n fill_in 'Email', with: email\n fill_in 'Password', with: password\n click_button 'Log in'\n end", "def log_web_user_in\n # Remeber to set :js => true\n user = create_factory_user\n\n # Signin\n visit root_path\n page.find('.sign-in').trigger(:mouseover)\n fill_in \"user_email\", :with => user.email\n fill_in \"user_password\", :with => user.password\n click_button \"hit it\"\n\n # Disable the tutorial screen\n no_tutorial\n\n # Make sure you're logged in\n page.should have_content(\"Here are the people\")\n page.should have_content(\"add new contact\")\n\n return user\n end", "def login\n if request.get?\n if User.current.logged?\n #redirect_to home_url\n redirect_to browse_models_url\n end\n else\n authenticate_user\n end\n rescue AuthSourceException => e\n logger.error \"An error occured when authenticating #{params[:username]}: #{e.message}\"\n render_error :message => e.message\n end" ]
[ "0.75892043", "0.75688404", "0.75184625", "0.75184625", "0.75184625", "0.75184625", "0.75184625", "0.75184625", "0.75184625", "0.75184625", "0.75184625", "0.75045127", "0.74222744", "0.7396262", "0.73627234", "0.7326675", "0.7326675", "0.731663", "0.7253417", "0.72487605", "0.7246038", "0.71876496", "0.718075", "0.7179843", "0.7146044", "0.7128223", "0.7128223", "0.7123539", "0.7119567", "0.7091033", "0.7087001", "0.7070249", "0.70628136", "0.7046105", "0.7031814", "0.7027613", "0.7026318", "0.7025815", "0.7013178", "0.7009819", "0.70077825", "0.70032126", "0.6996605", "0.69935346", "0.6972896", "0.6965591", "0.6956846", "0.69421893", "0.69350916", "0.6916651", "0.6908773", "0.69007903", "0.6859498", "0.68417877", "0.68393373", "0.6828794", "0.68281066", "0.6824962", "0.6823946", "0.6823946", "0.6823946", "0.6823946", "0.6823946", "0.6823946", "0.6823946", "0.6823946", "0.6823946", "0.6823946", "0.6823946", "0.6820233", "0.6817805", "0.68161815", "0.68133277", "0.680911", "0.68011314", "0.67955834", "0.6794729", "0.6794161", "0.679249", "0.6790753", "0.6779346", "0.6767819", "0.67661196", "0.6766055", "0.67619866", "0.6760856", "0.67605793", "0.676049", "0.67589", "0.6755103", "0.67546105", "0.67533755", "0.6746561", "0.67444533", "0.6744398", "0.6737269", "0.6736476", "0.67363083", "0.67288536", "0.67167974", "0.67099565" ]
0.0
-1
recursively build categories specific to each product
def build_categories(product, mapped_categories) collection = [] product[:categories].each do |category_name| mapped_categories.each do |mapped_category| build_category_tree(collection, category_name, mapped_category) end end collection end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_categories(product)\n categories = value('category').split('&')\n\n categories.each do |category_string|\n category_string.strip!\n subcategories = category_string.split('>')\n parent_id = self.root_category.id\n subcategories.each do |category_url_key|\n category_url_key.strip!\n category = Gemgento::Category.find_by(url_key: category_url_key, parent_id: parent_id)\n unless category.nil?\n pc = Gemgento::ProductCategory.find_or_create_by!(category: category, product: product, store: self.store)\n parent_id = category.id\n pc.sync_needed = true\n pc.save\n else\n self.process_errors << \"Row ##{@index}: Unknown category url key '#{category_url_key}' - skipped\"\n end\n end\n end\n end", "def expand_category_ids\n\n #if we are on the filters brand page and the original url contains /categories we need to insert a dpc key into params\n if params[:originalURL].to_s.include?(\"/categories/\")\n parsed_original_url = params[:originalURL].split(\"/\")\n dpc_id = DPCategory.where(\"id = ? or param = ?\", parsed_original_url[2], parsed_original_url[2]).first.id\n #then we are on search/products or a brand page\n elsif !params[:id].nil? && params[:controller] == \"categories\" && params[:dpc].nil?\n dpc_id = DPCategory.where(\"id = ? or param = ?\", params[:id], params[:id]).first.id\n else\n #provides support for dpc[any] or dpc[all] in url\n params[:dpc] = nil if params[:dpc] == \"\"\n dpc_id = params[:dpc].try(:[],:any) || params[:dpc].try(:[],:all)\n end\n #match the DPCategory.id DPCategory.name that has been turned into a slug\n @dp_category = DPCategory.where(\"id in (?) or param in (?)\", dpc_id, dpc_id).first\n\n #we must set @dpc_param as nil here. otherwise we pass dpc with empty arrays to the searcher which will force zero results\n if @dp_category.blank?\n @dpc_param = nil\n #if we are working with a parent id\n elsif @dp_category.parent_id.blank?\n #expand the\n categories = []\n @dp_category.children.each do |dp_catg| \n categories << dp_catg.id\n dp_catg.children.each do |dp_catg_c|\n categories << dp_catg_c.id\n end\n end\n categories << @dp_category.id if categories.empty?\n @dpc_param = { :any => categories, :exact => [@dp_category.id] } \n elsif @dp_category.b_level? \n @dpc_param = { :any => @dp_category.children.collect { |dp_catg| dp_catg.id } << @dp_category.id, :exact => [@dp_category.id] }\n else\n @dpc_param = { :any => [ @dp_category.id ], :exact => [@dp_category.id] }\n end\n end", "def cat_loop\n # sort by cat, then subcat, then sub subcat\n current_cat = ''\n current_subcat = ''\n\n category_rows.each do |c|\n # Loop through and write the cat, subcat or subsubcat if it has not already been written (so it is unique)\n cat = c['CategoryPath'].split('->')[0]\n subcat = c['CategoryName'] || ''\n\n if current_cat != cat\n output << category_tag + cat + line_break\n current_cat = cat\n end\n\n if current_subcat != subcat\n output << tags[:product] + subcat + \"\\t\" + line_break\n current_subcat = subcat\n end\n end\n\n output\n end", "def create_category_products(category,category_node)\n products_page_url = category_node.xpath(\"./a[1]/@href\").text\n while products_page_url\n html_product = Nokogiri::HTML(open(products_page_url))\n html_product.xpath(\"//tr/td[@class='pdescr']\").map do |product_node|\n product = create_product(product_node)\n category.add_product(product)\n end\n products_page_url = check_next(html_product)\n end\n end", "def create_child_items\n category.path.each do |category|\n create_child_item_for_category category\n end\n end", "def categories\n Hash[self.class.catalogs.map { |fld, klass|\n name = fld.gsub(/_id$/, '_name');\n [fld, {:id => self.send(fld), :name => self.send(name)}] rescue nil\n }.reject {|cat| cat.nil?}]\n end", "def get_categories(row)\n categories = []\n cat = at_in(:category1 , row) # should invent some loop here\n categories << cat if cat\n cat = at_in(:category2 , row) # but we only support\n categories << cat if cat\n cat = at_in(:category3 , row) # three levels, so there you go\n categories << cat if cat\n categories\n end", "def update_product_category\n return true if self.category.blank?\n categories = self.category.ancestors.collect{|x| x.id}.reverse.push(self.category.id)\n category_names = self.category.ancestors.collect{|x| x.name.downcase}.reverse.push(self.category.name.downcase).join(\" | \")\n product_cat = ProductCat.find_or_create_by_product_id(self.id)\n product_cat.fourth_category_id = categories[3] unless categories[3].blank?\n product_cat.third_category_id = categories[2] unless categories[2].blank?\n product_cat.second_category_id = categories[1] unless categories[1].blank?\n product_cat.first_category_id = categories[0] unless categories[0].blank?\n product_cat.categories_delimited = category_names\n product_cat.user = self.user\n product_cat.save\n end", "def parse_categories_structure(category_id = nil)\n super category_id, { product_link: '.productsArea .productArea .productDetail a',\n next_page_link: '.productsArea .tsk-pageview .next a' }\n end", "def save_hot_products_by_category\r\n Subcategory.fill_all_subcategories_of_category(params[:category][:fields][1])\r\n end", "def categories_by_taxonomy\n\n self.categories.inject({}) do |result, category|\n \n if result.has_key?(category.taxonomy.id.to_sym)\n result[category.taxonomy.id.to_sym] << category\n else\n result[category.taxonomy.id.to_sym] = [category]\n end\n \n result \n end \n\n end", "def channel_categories\n build :channel_categories, :using => data_for(:channel_categories)\n end", "def getCategories()\n\t\tcat = Array.new\n\t\tcat.push(\"heroku\")\n\t\tcat.push(\"go\")\n\t\tcat.push(\"github\")\n\t\tcat.push(\"docker\")\n\t\tcat.push(\"css\")\n\t\tcat.push(\"apache\")\n\t\tcat.push(\"html\")\n\t\tcat.push(\"bootstrap\")\n\t\tcat.push(\"java ee\")\n\t\tcat.push(\"javafx\")\n\t\tcat.push(\"java\")\n\t\tcat.push(\"jquery\")\n\t\tcat.push(\"mips\")\n\t\tcat.push(\"c++\")\n\t\tcat.push(\"laravel\")\n\t\tcat.push(\"linux\")\n\t\tcat.push(\"opengl\")\n\t\tcat.push(\"sml\")\n\t\tcat.push(\"javascript\")\n\t\tcat.push(\"mongo db\")\n\t\tcat.push(\"c\")\n\t\tcat.push(\"yacc\")\n\t\tcat.push(\"circuit\")\n\t\tcat.push(\"php\")\n\t\tcat.push(\"mysql\")\n\t\tcat.push(\"node js\")\n\t\tcat.push(\"photoshop\")\n\t\tcat.push(\"rails\")\n\t\tcat.push(\"postgres\")\n\t\tcat.push(\"ruby\")\n\t\tcat.push(\"redis\")\n\t\tcat.push(\"mac osx\")\n\t\tcat.push(\"sass\")\n\t\tcat.push(\"ubuntu\")\n\t\tcat.push(\"bower\")\n\t\tcat.push(\"wordpress\")\n\t\tcat.push(\"css\")\n\t\tcat.push(\"hosted\")\n\t\tcat.push(\"python\")\n\t\tcat.push(\"maven\")\n\t\tcat.push(\"maven mojo\")\n\t\tcat.push(\"composer\")\n\t\tcat.push(\"mips\")\n\t\tcat.push(\"gulp\")\n\t\tcat.push(\"grunt\")\n\t\tcat.push(\"phpstorm\")\n\t\tcat.push(\"react\")\n\t\tcat.push(\"swift\")\n\t\tcat.push(\"wordpress\")\n\t\tcat.push(\"tomcat\")\n\t\tcat.push(\"redis\")\n\t\tcat.push(\"travis\")\n\t\treturn cat\n\tend", "def _build_category_list\n raw_categories = CatAPI.get_categories\n category_list = raw_categories.map {|category| category['name']}.sort\n # the \"kittens\" category is empty, and never returns photos\n category_list.delete(\"kittens\")\n return category_list.unshift(\"your favorites\")\nend", "def traverse(root_node, i, level)\n name = root_node.values.first\n catid = root_node.keys.first\n english_name = root_node.values.first\n \n Session.product_type = @retailer\n \n #print catid + ' '\n \n french_name = BestBuyApi.get_category(catid, false)[\"name\"]\n \n # These categories are left singular in the feed\n # Regex is used fit file encoding (could change it to UTF 8 (according to stackoverflow post) and use the string normally with 'e' accent aigu)\n if english_name == \"Digital SLR\" && /^Appareil photo reflex (?<need_accent_numerique>num.rique)$/ =~ french_name\n english_name = \"Digital SLRs\"\n french_name = \"Appareils photo reflex #{need_accent_numerique}s\"\n end\n \n prefix = @retailer\n \n cat = ProductCategory.new(:product_type => prefix + catid, :feed_id => catid, :retailer => @retailer, \n :l_id => i, :level => level)\n \n i = i + 1\n children = BestBuyApi.get_subcategories(catid).values.first\n children.each do |child|\n i = traverse(child, i, level+1)\n end\n \n cat.r_id = i\n @categories_to_save << cat\n @translations_to_save << [cat.product_type, english_name, french_name]\n \n i = i + 1\n return i\n end", "def categories_given_items(items)\n\n categorized_items = Array.new\n\n items.each{ |item|\n sub_array = categorized_items.detect{ |sub_item_array| sub_item_array[0].name == item.name }\n if sub_array != nil\n sub_array.push(item)\n else\n new_sub_array = Array.new\n new_sub_array.push(item)\n categorized_items.push(new_sub_array)\n end\n }\n categorized_items\n end", "def assign_category\n path = @row[:category]\n root = path.shift\n\n # this just needs to be set, for apparently no valid reason\n # I think think model is complely useless\n taxonomy = Spree::Taxonomy.find_or_create_by!(name:root)\n\n # here is real root of taxonomy tree\n taxon = Spree::Taxon.find_or_create_by!(parent_id: nil, taxonomy_id: taxonomy.id, name: root)\n\n # now check for existance of 2 parent elements, 3 and n+ is ignorred\n taxon = Spree::Taxon.find_or_create_by!(parent_id: taxon.id, taxonomy_id: taxonomy.id, name: path[0]) if path[0]\n taxon = Spree::Taxon.find_or_create_by!(parent_id: taxon.id, taxonomy_id: taxonomy.id, name: path[1]) if path[1]\n\n # it is weird why this model is named Spree::Classification instead of Spree::ProductsTaxon\n # it maps to \"spree_products_taxons\" table\n Spree::Classification.find_or_create_by! product_id: @product.id, taxon_id: taxon.id\n end", "def extract_categories cats\n cats.inject Hash.new do |hash, tag|\n\n # iterate through groups if the tag belongs to multiple\n tag[\"groups\"].each do |group|\n name = group[\"name\"]\n hash[name] ||= []\n hash[name] << tag[\"name\"]\n end\n hash\n end\n end", "def category_tree\n @category_tree = {}\n get_category_browse_nodes.each do |n|\n build_category_tree(n)\n end\n @category_tree\n end", "def for_category (category, n = 1)\r\n\t\t\tcategory = Category.find(category.to_i) unless category.is_a? Category\r\n\r\n\t\t\t# For the featured_all_levels feature we need to get the IDs of all the parent categories\r\n\t\t\t# all the way up to the root category.\r\n\t\t\t# I have decided to find based on the category paths which prevents us from hitting the\r\n\t\t\t# database. I envisage that categories will rarely exceed a few levels deep...\r\n\t\t\t# The featured_product_id WHERE clause should prevent the db doing expensive text matches\r\n\t\t\t# on every product.\r\n\r\n\t\t\tpath_str = '\\'\\''\r\n\t\t\ttemp_path = ''\r\n\t\t\tfirst = true\r\n\t\t\tcategory.path.split('/').each do |p|\r\n\t\t\t\ttemp_path += (first ? '' : '/') + p\r\n\t\t\t\tpath_str += ',\\'' + temp_path + '\\''\r\n\t\t\t\tfirst = false\r\n\t\t\tend\r\n\r\n\t\t\tfp_table = Feature.connection.select_all(\"\r\n\t\t\t\tSELECT\r\n\t\t\t\t\tfeatures.description,\r\n\t\t\t\t\tfeatures.product_id,\r\n\t\t\t\t\tfeatures.weighting\r\n\t\t\t\t\tFROM features\r\n\t\t\t\tLEFT JOIN products\r\n\t\t\t\t\tON products.id = features.product_id\r\n\t\t\t\tLEFT JOIN categories_features AS cat_feat\r\n\t\t\t\t\tON features.id = cat_feat.feature_id\r\n\t\t\t\tLEFT JOIN categories AS cat\r\n\t\t\t\t\tON cat_feat.category_id = cat.id\r\n\t\t\t\tWHERE\r\n\t\t\t\t\t(features.until IS NULL OR (features.until + INTERVAL 1 DAY) >= NOW())\r\n\t\t\t\t\tAND (\r\n\t\t\t\t\t\tcat_feat.category_id = #{category.id}\r\n\t\t\t\t\t\tOR (\r\n\t\t\t\t\t\t\tfeatures.all_levels = 1\r\n\t\t\t\t\t\t\tAND cat.path IN ( #{path_str} )\r\n\t\t\t\t\t\t)\r\n\t\t\t\t\t)\r\n\t\t\t\t\tAND (products.available = 1)\r\n\t\t\t\")\r\n\r\n\t\t\tpick_out_rand(fp_table, n)\r\n\t\tend", "def index\n\n @cat_first = ProductCategory.level_one_cats\n\n @selected_cat_one = \"\"\n @selected_cat_two = \"\"\n @selected_cat_three = \"\"\n @selected_cat_one_name = \"\"\n @selected_cat_two_name = \"\"\n @selected_cat_three_name = \"\"\n @cat_second = nil\n @cat_third = nil\n \n @products = Product.all\n\n cat_params = params[\"category\"]\n\n if cat_params != nil\n if cat_params[\"selected_cat_one\"] != nil && cat_params[\"selected_cat_one\"] != \"\"\n @selected_cat_one = cat_params[\"selected_cat_one\"]\n @products = @products.level_one_products(@selected_cat_one)\n @cat_second = ProductCategory.level_two_cats(@selected_cat_one)\n @select_cat_one_name = ProductCategory.where( \"id = ?\", @selected_cat_one.to_i).first.name\n logger.debug \"selected cat one name: #{@select_cat_one_name} second level categories: #{@cat_second.inspect}\"\n end\n if cat_params[\"selected_cat_two\"] != nil && cat_params[\"selected_cat_two\"] != \"\"\n @selected_cat_two = cat_params[\"selected_cat_two\"]\n @products = @products.level_two_products(@selected_cat_two)\n @cat_third = ProductCategory.level_three_cats(@selected_cat_two)\n @select_cat_two_name = ProductCategory.where( \"id = ?\", @selected_cat_two.to_i).first.name\n logger.debug \"third level categories: #{@cat_third.inspect}\"\n end\n if cat_params[\"selected_cat_three\"] != nil && cat_params[\"selected_cat_three\"] != \"\"\n @selected_cat_three = cat_params[\"selected_cat_three\"]\n @products = @products.level_three_products(@selected_cat_three)\n @select_cat_three_name = ProductCategory.where( \"id = ?\", @selected_cat_three.to_i).first.name\n logger.debug \"third level categories: #{@cat_third.inspect}\"\n end\n end\n end", "def apply_category_filter\n top_level_category_ids = Category.top_level.\n where(id: @category_ids).\n pluck(:id)\n subcategory_ids = @category_ids +\n Category.where(parent_id: top_level_category_ids).pluck(:id)\n\n subcategory_ids\n end", "def all(&block)\n categories = []\n\n # Categories are listed in catalog xml, so fetch that.\n catalog = Catalog.new(@options)\n catalog.all do |item|\n categories << {\n code: item[:subcategory].gsub(\"&amp;\", \"\").gsub(/[^A-Za-z0-9]/, \"_\").squeeze(\"_\").downcase,\n description: item[:subcategory].gsub(\"&amp;\", \"&\")\n }\n end\n\n categories.uniq! { |c| c[:code] }\n categories.sort_by! { |c| c[:code] }\n\n categories.each do |category|\n yield category\n end\n end", "def categorize\n if params.has_key?(:category)\n @category = Category.find_by_name(params[:category])\n @product = Product.where(category: @category)\n else\n @product = Product.all\n end\nend", "def categories_for_solution_search(category)\n [Sfcatnode.root] + category.children\n end", "def category_tree\n cats = []\n categories.each do |cat|\n cats << cat\n cats = cats + cat.ancestors\n end\n return cats\n end", "def category_menu_items(aRootCategory, aOptions={})\n\t\t\taBaseUrl = (aOptions[:base_url] || '')\n\t\t\taIdPrefix = (aOptions[:id_prefix] || '')\n\t\t\tcategory = aOptions[:category]\n\t\t\tcategory = category.name.urlize('+') if category.is_a?(Category)\n\t\t\ttree_nodes = construct_category_tree(aRootCategory)\n\t\n\t\t\t# now turn tree_nodes into menu items, still as array of levels\n\t\t\ttree_items = []\n\t\t\tlast_lvl = nil\n\t\t\ttree_nodes.each do |lvl|\n\t\t\t\titem_level = []\n\t\t\t\tlvl.each do |node|\n\t\t\t\t\tname = (node.name.index('/') ? File.basename(node.name) : node.name)\n\t\t\t\t\titem = {:id => aIdPrefix+node.id.to_s, :name => name }\t\n\t\t\t\t\titem[:node] = node\n\t\t\t\t\tif last_lvl && parent_item = last_lvl.find {|i| i[:node].id == node.parent_id}\n\t\t\t\t\t\tparent_item[:children] ||= []\n\t\t\t\t\t\tparent_item[:children] << item\n\t\t\t\t\t\titem[:url] = parent_item[:url]\n\t\t\t\t\t\titem[:url] += '+' unless item[:url]=='' || item[:url].ends_with?('/') || item[:url].ends_with?('+')\n\t\t\t\t\t\titem[:url] += name.urlize('-')\n\t\t\t\t\telse\n\t\t\t\t\t\titem[:url] = File.join(aBaseUrl,name.urlize('-'))\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\titem[:selected] = true if category && (category==node.name.urlize('+'))\n\t\t\t\t\titem[:order] = aOptions[:order_proc].call(item) if aOptions.has_key?(:order_proc)\n\t\t\t\t\titem_level << item\n\t\t\t\tend\n\t\t\t\ttree_items << item_level\n\t\t\t\tlast_lvl = item_level\n\t\t\tend\n\t\t\t# clean\n\t\t\ttree_items.each do |lvl|\n\t\t\t\tlvl.each do |i| \n\t\t\t\t\ti.filter_include!([:url,:selected,:id,:name,:children,:order])\n\t\t\t\t\ti[:children].sort! {|a,b| a[:order].to_i <=> b[:order].to_i} if i[:children].is_a?(Array)\n\t\t\t\tend\n\t\t\tend\n\t\t\ttree_items.first.sort! {|a,b| a[:order].to_i <=> b[:order].to_i}\n\t\t\ttree_items.first\n\t\tend", "def categories_in_path(&block)\n list = []\n current_node = self\n while current_node && current_node.name != 'Categories'\n yield current_node if block_given?\n list.insert(0, current_node)\n current_node = current_node.parent\n end\n list\n end", "def categories(options = {})\n fetch_categories.at('categories').children_of_type('category').inject([]){ |r, i| r << parse_single_category_xml(i) }\n\tend", "def categories(arg_)\n @config.lock\n\n objdata_ = _get_objdata(arg_)\n return nil unless objdata_\n hash_ = {}\n objdata_[2].each do |tup_, tupcats_|\n tupcats_.each do |cat_|\n hash_[cat_] = @categories[cat_][1].map{ |elem_| tup_[elem_] }\n end\n end\n hash_\n end", "def to_categories(sub_context)\n Array(sub_context).map { |id|\n categories[id] \n }.compact\n end", "def get_categories\n cats = []\n params.each do |k,v|\n if k.starts_with? \"category\"\n name = v\n num = cat_number(k) \n cats << [name,num]\n end\n end\n return cats\n end", "def category_list_builder\n categories = API.get_categories\n categories.each do |cat|\n Category.new(cat)\n end\n end", "def list\r\n\t\t@current_area = 'categories'\r\n\t\t@current_menu = 'products'\r\n\r\n\t\tif params[:select]\r\n\t\t\tif params[:delete]\r\n\t\t\t\t# you MUST manually move child nodes in an acts_as_tree up before calling\r\n\t\t\t\t# the destroy! method. Otherwise Rails will automatically go and delete all\r\n\t\t\t\t# the child nodes even before the selected nodes' 'before_destroy' callback\r\n\t\t\t\t# is triggered!\r\n\t\t\t\tparams[:select].keys.each do |k|\r\n\t\t\t\t\tthe_cat = Category.find(k)\r\n\t\t\t\t\tthe_cat.move_children_up()\r\n\t\t\t\t\tCategory.destroy(the_cat.id)\r\n\t\t\t\tend\r\n\t\t\telsif params[:move_up]\r\n\t\t\t\t# We have to use a Hash as Array iterators do not like sparse indexing.\r\n\t\t\t\tselected_categories = Hash.new\r\n\t\t\t\tcat_index = Hash.new\r\n\t\t\t\tparams[:select].keys.each do |k|\r\n\t\t\t\t\tc = Category.find(k)\r\n\t\t\t\t\tif selected_categories[c.parent_id].nil?\r\n\t\t\t\t\t\tselected_categories[c.parent_id] = Hash.new\r\n\t\t\t\t\tend\r\n\t\t\t\t\tselected_categories[c.parent_id][c.id] = c.sequence\r\n\t\t\t\t\tcat_index[c.id] = c\r\n\t\t\t\tend\r\n\t\t\t\tselected_categories.each do |i, parent|\r\n\t\t\t\t\t# Hash.sort converts the hash into a nested array before sorting; [0] = key, [1] = value.\r\n\t\t\t\t\t# Note that we only want the IDs which are contained in the index 'j'.\r\n\t\t\t\t\tparent.sort{|a,b| (a[1]<=>b[1])}.each do |j, the_sequence|\r\n\t\t\t\t\t\tcat_index[j].move_higher\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\telsif params[:move_down]\r\n\t\t\t\t# See comments for move_up above\r\n\t\t\t\tselected_categories = Hash.new\r\n\t\t\t\tcat_index = Hash.new\r\n\t\t\t\tparams[:select].keys.each do |k|\r\n\t\t\t\t\tc = Category.find(k)\r\n\t\t\t\t\tif selected_categories[c.parent_id].nil?\r\n\t\t\t\t\t\tselected_categories[c.parent_id] = Hash.new\r\n\t\t\t\t\tend\r\n\t\t\t\t\tselected_categories[c.parent_id][c.id] = c.sequence\r\n\t\t\t\t\tcat_index[c.id] = c\r\n\t\t\t\tend\r\n\t\t\t\tselected_categories.each do |i, parent|\r\n\t\t\t\t\t# Note order of b/a is swapped to move down. This and move_lower instead of move_higher\r\n\t\t\t\t\t# is the only difference between this and the move_up code above.\r\n\t\t\t\t\tparent.sort{|a,b| (b[1]<=>a[1])}.each do |j, the_sequence|\r\n\t\t\t\t\t\tcat_index[j].move_lower\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\texpire_fragment(:controller => :products, :action => :home, :part => 'category_menu')\r\n\t\tend\r\n\r\n\t\t@root_cat = Category.find(1)\r\n\tend", "def categories\n pages = page.children.all(\n :conditions => { :class_name => 'ShopCategoryPage' },\n :order => 'pages.position ASC'\n ).map(&:shop_category)\n end", "def parse_category_tree\n dry_run_notification\n\n page_html = get_page_html \"#{@donor.url}/mall/index.htm\"\n return display_error \"\\e[33;1m#{self.class}##{__method__}\\e[0m failed to get page html\" if page_html.blank?\n\n page_html.css('#headerWarp .cateAllList ul li').each do |menu_item|\n category_link_level_1 = get_link menu_item.at_css('dt a')\n category_level_1 = save_category(category_link_level_1) unless DRY_RUN\n display_category_structure category_link_level_1, \"#{'-' * 80}\\n\"\n\n menu_item.css('dd a').each do |menu_sub_item|\n category_link_level_2 = get_link menu_sub_item\n save_category(category_link_level_2, category_level_1.id) unless DRY_RUN\n display_category_structure category_link_level_2, ' '\n end\n end\n end", "def populate_category\n\t\t\t\tif params[:purpose] == \"category\"\n\t\t\t\t\t\tcategory = Category.find(params[:category_id])\n\t\t\t\t\t\t@sub_categories = category.sub_categories\n\t\t\t\telsif params[:purpose] == \"sub_category\"\n\t\t\t\t\t\tsub_category = SubCategory.find(params[:category_id])\n\t\t\t\t\t\t@inner_categories = sub_category.inner_categories\n\t\t\t\tend\n\t\tend", "def category_ids(categories)\n #This can accept an array or a single id\n categories = [categories] unless categories.class == Array\n bb_products = []\n categories.each do |category|\n category = ProductCategory.trim_retailer(category)\n product_infos = get_shallow_product_infos(category, english = true, use_cache = true)\n product_infos.select! { |product_info| product_info[\"isVisible\"] != false } \n bb_products += product_infos.map{ |p| BBproduct.new(:id => p[\"sku\"], :category => category) }\n end\n bb_products\n end", "def parse_category_tree\n dry_run_notification\n\n page_html = get_page_html @donor.url\n\n if page_html\n main_category_last = page_html.css('.content > .main-cat').last\n return false if main_category_last.nil?\n main_category_last.css('> .cat-item > .middle').each do |parent_category|\n parent_category_link = get_category_link(parent_category.at_css('a'))\n\n next if parent_category_link[:name].empty? && parent_category_link[:path].empty?\n\n category_parent = save_category(parent_category_link) unless DRY_RUN\n display_category_structure(parent_category_link, \"#{'-' * 80}\\n\")\n\n if parent_category\n parent_category.css('.main-cat > .cat-item > .middle').each do |subcategory_first_level_node|\n subcategory_first_level_link = get_category_link(subcategory_first_level_node.at_css('a'))\n\n subcategory_first_level = save_category(subcategory_first_level_link, category_parent.id) unless DRY_RUN\n display_category_structure(subcategory_first_level_link, ' ' * 2)\n\n subcategory_first_level_node.css('.main-cat > .cat-item > .middle').each do |subcategory_second_level_node|\n subcategory_second_level_link = get_category_link(subcategory_second_level_node.at_css('a'))\n\n save_category(subcategory_second_level_link, subcategory_first_level.id) unless DRY_RUN\n display_category_structure(subcategory_second_level_link, ' ' * 4)\n end\n end\n end\n end\n end\n end", "def updated_product_category_ids(pos)\n categories = pos.product_category_ids\n if pos.pos_type.zero?\n pos.market_stalls.each do |stall|\n categories.concat(stall.product_category_ids)\n end\n categories.uniq!\n end\n categories\n end", "def get_subc(category)\n retval = []\n #Category.where(category_id: category.id).each do |c| \n category.categories.each do |c| \n retval += [c] + get_subc(c)\n end\n retval\n end", "def create_categories(results)\n created = 0\n skipped = 0\n total = results.count\n\n results.each do |c|\n params = yield(c)\n\n # block returns nil to skip\n if params.nil? || category_id_from_imported_category_id(params[:id])\n skipped += 1\n else\n # Basic massaging on the category name\n params[:name] = \"Blank\" if params[:name].blank?\n params[:name].strip!\n params[:name] = params[:name][0..49]\n\n # make sure categories don't go more than 2 levels deep\n if params[:parent_category_id]\n top = Category.find_by_id(params[:parent_category_id])\n top = top.parent_category while top && !top.parent_category.nil?\n params[:parent_category_id] = top.id if top\n end\n\n new_category = create_category(params, params[:id])\n created_category(new_category)\n\n created += 1\n end\n\n print_status(created + skipped, total, get_start_time(\"categories\"))\n end\n\n [created, skipped]\n end", "def index\n category = params[:category]\n category = category == nil ? ROOT_ID : category.to_i\n\n current_category = Category.find(category)\n\n # Create an array of nearest childs of current_category\n @categories = current_category.categories\n\n # Create ancestors path\n @category_seq = [current_category]\n until @category_seq.first.id == ROOT_ID\n @category_seq.unshift( @category_seq[0].category )\n end\n\n # Create an array of all childs\n subcategories = get_subc(current_category)\n\n # Create an array of all products which belongs to current_category\n @items = current_category.products.to_a\n\n subcategories.each do |c|\n c.products.each { |p| @items.push p }\n end\n\n @items = Kaminari.paginate_array(@items).page(params[:page]).per(7)\n\n respond_to do |format|\n format.html\n format.js {}\n end\n\n\tend", "def get_category_select_options(c, level=0)\n retval = []\n retval << [('-' * level) + c.name, c.id]\n c.categories.each do |child_c|\n get_category_select_options(child_c, level + 1).each do |child_c|\n retval << child_c\n end\n end\n \n return retval\n end", "def create\n #Creates the category to be saved in the db\n @category = Category.new(params[:category])\n @all_categories = Category.all\n\n #Set Component Group to nil\n if([email protected]_id.nil?)\n @category.parent_id = nil\n end\n #Sets Component Group with new params\n if(!params[:parent_ids].nil?)\n for id in params[:parent_ids]\n @category.parent_id = id\n end\n end\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def parse_categories_structure(category_id)\n dry_run_notification\n\n total_products_count = 0\n categories = donor_categories_to_parse(category_id)\n display_info \"Total categories count: \\e[34;1m#{categories.count}\\e[0m\"\n\n initialize_capybara do\n categories.find_each do |category|\n category_name = \"#{category.name_eng.blank? ? category.name : category.name_eng} (id: #{category.id})\"\n category_products_count = parse_category category.id, category_name, \"#{@donor.url}#{category.path}\"\n total_products_count += category_products_count\n category_post_processing_message (category_products_count > 0), category_name, category_products_count\n # category.update(product_list_parsed_at: Time.zone.now) unless DRY_RUN # Update category product list parse date\n end\n end\n display_info \"Total products count: \\e[34;1m#{total_products_count}\\e[0m\"\n end", "def leaf_ids=(lids)\n\n save! if new_record?\n\n # Clear out all mention of the product from the entire tree.\n CategoryProduct.delete_all([\"product_id = ?\", self.id])\n\n lids.each do |lid|\n next if lid == \"none\"\n category = Category.find(lid)\n category.add_product(self, auto_prop)\n end\n end", "def all_categories\n end", "def create\n # Create the new product object from the parameters received\n @product = Product.create(product_params)\n\n respond_to do |format|\n # Try and save the product to the database\n if @product.save\n update_nil_values(@product)\n # Product saved successfully. We will create the entry in the product_categories table\n @category = Category.find(params[:category_id])\n @product.product_categories.create(category: @category)\n\n # Redirect to the products list indicating success\n format.html { redirect_to admin_products_url, notice: 'Product was successfully added.' }\n else\n # Product did not save successfully. Redirect to the products list indicating failure\n\n # Retrieve the categories to display in the caterogy filter dropdown\n @all_categories = Category.order(:name)\n\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def all_selectable_materials\n categories = Category.order(\"depth ASC \")\n \n # MATERIAL = {\n # :steel => {\n # :value => 1, \n # :name => \"Steel\" \n # } ,\n # :copper => {\n # :value => 2, \n # :name => \"Tembaga\"\n # }, \n # :alumunium => {\n # :value => 3, \n # :name => \"Aluminium\"\n # }\n # }\n # \n \n result = []\n MATERIAL.each do |material| \n result << [ \"#{category.name}\" , \n category.id ] \n end\n return result\n end", "def all_sub_categories(params = {})\n @all_sub_categories ||= sub_categories(params) + sub_categories.flat_map do |sub|\n sub.all_sub_categories(params)\n end\n end", "def parse\n products = []\n agent = WWW::Mechanize.new\n\n self.categories.each do |category|\n page = agent.get category.url\n page.search(\"//table[@class='OutBorder']\").each do |tr|\n unless (tr.children[0].text == 'Brand.') #ignore header <tr>'s\n p = Product.new\n p.name = tr.children[0].children[0].children[1].text\n p.image = tr.children[1].children[0].children[1].children[0]['src']\n p.brand = tr.children[0].text\n p.model = tr.children[2].text\n p.description = tr.children[4].text\n p.price = tr.children[10].text\n p.warranty = tr.children[6].text.gsub(/'/, '')\n p.stock = !tr.children[14].text.include?('(0)')\n tr.children[14].text =~ /\\d+/ #try get the numerical value inside this expression\n p.items_in_stock = $&\n p.tag = category.name\n products << p\n end\n end\n end\n\n products\n end", "def find_all_sidebar_submenu_category(category)\n if !category.children.empty?\n html_code = ''\n category.children.each do |sub_category|\n html_code += '<div class=\"col-sm-12 col-md-3\">\n <ul class=\"links list-unstyled\">'\n html_code += print_sidebar_submenu_category(sub_category)\n html_code += '</ul></div>'\n end\n end\n html_code += ''\n end", "def categories_attributes=(categories_hashes) #writer\n #{\"0\"=>{\"name\"=>\"new catogory 1\"}, \"1\"=>{\"name\"=>\"new catogory 2\"}}\n #raise category_hashes.inspect\n #How would I create a catogory for each of the hashes inside categories_hashes\n categories_hashes.values.each do |category_attributes|\n\n #DO NOT CREATE A CATEGORY IF IT DOESN'T HAVE NAME\n #if category_attributes[:name].present?\n\n #create a new catogory if this post doesn't already have this catogory\n #find or create the catogory regardless of whether this post has it.\n category = Category.find_or_create_by(category_attributes)\n #ALSO DON'T DUPLICATE POST IF IT ALREADY HAVE IT.\n #How do i check if this post has this category already?\n if !self.categories.include?(category)\n #this is ineffecient because it will pull all catogories\n #self.categories << category 47:55\n self.post_categories.build(:category => category)\n\n #I need to create a catogory that is already associated with this post\n # and i need to make sure that this category already doesn't exist by name.\n end\n #end\n end\n\n end", "def sort_categories\n #loop to sort categories parents and children\n for cat in @all_categories\n #if category parent id == nill then hash = current category else if parent id of category = nil then parent id hash is nil\n if(cat.parent_id.nil?)\n @all_categories_hash[0] = [cat]\n else\n if(@all_categories_hash[cat.parent_id].nil?)\n @all_categories_hash[cat.parent_id] = []\n end\n @all_categories_hash[cat.parent_id].push(cat)\n end\n end\n #Sort loop for categories\n for key in @all_categories_hash.keys\n @all_categories_hash[key].sort!{|x,y| x.name <=> y.name}\n end\n end", "def generate_categories(site, category_base_path, category_layout)\n categories = sorted_categories site\n\n # Generate the pages\n for category in categories\n posts_in_category = site.categories[category]\n category_path = File.join(category_base_path, category)\n\n site.pages << CategoryIndexPage.new(site, category_path, INDEXFILE, category, category_layout, posts_in_category, false)\n end\n\n Jekyll.logger.debug(\"Categories\", \"Processed \" + categories.size.to_s + \" category index pages\")\n end", "def categories\n categories = Array.new\n unless self.category.nil?\n categories << self.category\n categories += self.category.ancestors\n end # unless\n categories.reverse\n end", "def parse\n products = []\n agent = WWW::Mechanize.new\n\n self.categories.each do |category|\n page = agent.get category.url\n page.search(\"//table[@width=175]\").each do |table|\n p = Product.new\n p.name = table.children[1].children[0].text\n p.price = table.children[3].children[2].text\n p.model = table.children[4].children[0].text\n str = table.children[5].text.gsub(/\\n|\\t|'/, '').strip.squeeze(\" \") #this position can hold the warranty info or description\n if str.include? 'Warranty'\n p.warranty = str\n else\n p.description = str\n p.warranty = table.children[6].text.gsub(/\\n|\\t|'/, '').strip.squeeze(\" \")\n end\n p.tag = category.name\n products << p\n end\n end\n\n products\n end", "def construct_category_tree(aRootCategory)\n\t\t\tlevel_nodes = case aRootCategory\n\t\t\t\twhen String\n\t\t\t\t\t[Category.find_by_name(aRootCategory)]\n\t\t\t\twhen Category \n\t\t\t\t\t[aRootCategory]\n\t\t\t\twhen CategoryType\n\t\t\t\t\t[aRootCategory.categories.top_level]\n\t\t\t\telse\n\t\t\t\t\tCategoryType.first.categories.top_level\n\t\t\tend\n\t\t\ttree_nodes = []\n\t\t\tbegin\n\t\t\t\ttree_nodes << level_nodes\n\t\t\t\tids = level_nodes.map {|n| n.id}\n\t\t\t\tlevel_nodes = Category.find_all_by_parent_id(ids) #Category.all({:conditions => ['parent_id in (?)',ids.join(',')]})\n\t\t\tend while !level_nodes.empty?\n\t\t\ttree_nodes\n\t\tend", "def build_json_from_params \n #Construct array for holding categories\n arr = [] \n get_categories.each do |cat| #Meow\n #For each category create a map {}\n new_cat = {}\n new_cat[\"name\"] = cat[0]\n new_cat[\"steps\"] = []\n get_steps(cat).each do |step|\n #For each step create a map {}\n new_cat_step = {}\n new_cat_step[\"name\"] = step[2]\n #get options returns a list of maps of options\n new_cat_step[\"options\"] = get_options(step) \n new_cat[\"steps\"] << new_cat_step\n end \n arr << new_cat\n end\n json = {\"categories\" => arr, \"prompt\" => params[:prompt]}\n return json\n end", "def build_category_tree(n, child = nil)\n amz_node = BrowseNode.parse(n.to_s)\n amz_node.child = child unless child.nil?\n\n if n.search(\"./IsCategoryRoot\").size > 0\n @category_tree[amz_node.name] ||= []\n @category_tree[amz_node.name] << amz_node\n else\n parents = n.search(\"./Ancestors/BrowseNode\")\n if parents.size > 0\n build_category_tree(parents[0], amz_node)\n end\n end\n\n\n end", "def categories\n raw_categories.to_hashugar\n end", "def sort_categories_by_price(categorized_items)\n sorted_categories = Array.new\n categorized_items.each{ |sub_array|\n if sub_array.size > 1\n sorted_categories.push(sort_category_by_price(sub_array))\n else\n sorted_categories.push(sub_array)\n end\n }\n sorted_categories\n end", "def return_categories(key)\n if $redis.exists(key)\n categories = JSON.parse($redis.get(key))\n categories\n else\n data = fetch_categories()\n current_categories = []\n data.each do |child|\n add_category(key, child, current_categories)\n end\n return_categories(key)\n end\nend", "def categorize(elt2category, unknown=nil)\n categories = Hash.new { |h,k| h[k] = [] }\n self.each do |elt|\n if elt2category.include? elt\n categories[elt2category[elt]] << elt \n elsif unknown\n categories[unknown] << elt\n end\n end\n categories\n end", "def items_by_categories\n set_parts = {}\n\n categories.each do |category|\n set_parts[category] = suitable_items.select do |item|\n item.category == category\n end\n end\n\n set_parts\n end", "def category_candidates(category)\n return @category_cache[category] unless @category_cache[category].nil?\n candidates = candidates_for_name(singularize_name(category.name, category.head), @category_filters)\n if !candidates.empty?\n candidate_set = create_candidate_set(category.name,candidates)\n else\n candidate_set = candidate_set_for_syntax_trees(category.head_trees,@category_filters)\n end\n if candidate_set.empty?\n candidates = candidates_for_name(category.name, @category_filters)\n candidate_set = create_candidate_set(category.name,candidates) unless candidates.empty?\n end\n @category_cache[category] = candidate_set\n end", "def make_trail(category, choices, search_string, root_label,\n path_generator, view_type = nil)\n trail = category.get_trail(root_label)\n result = []\n \n trail.each do |t|\n if path_generator == :products_path\n result << [ t[1], send(path_generator,\n :catid => String(t[0]), :view => view_type) ]\n else\n result << [ t[1], send(path_generator, String(t[0])) ]\n end\n end\n \n myhash = {:catid => category.id}\n if view_type\n myhash.merge!({:view => view_type})\n end \n \n # admin_category_path passes nil for 'search_string'.\n if search_string && !search_string.blank?\n myhash.merge!({:search => search_string})\n result << [\"\\\"#{search_string}\\\"\", send(path_generator, myhash)]\n end\n \n # admin_category_path passes nil for 'choices'.\n if choices\n choices.each_with_index do |c, i|\n attribute = ProductAttribute.find(c[0])\n range = AttributeRange.find(c[1])\n component = String(attribute.trail_cue) # to convert nil to empty string\n component << \" \" unless component.blank?\n component << range_to_string(attribute, range)\n myhash.merge!({\n \"aid#{i + 1}\".to_sym => String(c[0]),\n \"arid#{i + 1}\".to_sym => String(c[1])})\n result << [component, send(path_generator, myhash)]\n end\n end\n result\n end", "def categories_attributes=(categories_hashes)\n categories_hashes.each do |i, category_attributes|\n if category_attributes[:name].present?\n category = Category.find_or_create_by(name: category_attributes[:name])\n if !self.categories.include?(category)\n self.post_categories.build(:category => category)\n end\n end\n end\n end", "def get_sidebar_filter_categories(categories)\n html_code = ''\n if !categories.children.empty?\n\n html_code += '<div class=\"sidebar-module-container\">\n <div class=\"sidebar-filter\">\n <div class=\"sidebar-widget outer-bottom-small wow fadeInUp animated\">\n <h3 class=\"section-title\">shop by</h3>\n <div class=\"widget-header\">\n <h4 class=\"widget-title\">Category</h4>\n </div>\n <div class=\"sidebar-widget-body\">\n <div class=\"accordion\">'\n categories.children.each do |category|\n html_code += '<div class=\"accordion-group\">\n <div class=\"accordion-heading\">'\n html_code += link_to category.category_name, category_path(category: category.id), {class: 'accordion-toggle collapsed'}\n html_code += '</div></div>'\n end\n html_code += '</div></div></div></div></div>'\n end\n html_code.html_safe\n end", "def build_accounts_by_tree(root_category)\n accounts = root_category.accounts.to_a\n if root_category.has_children?\n root_category.children.each {|category|\n accounts.concat(build_accounts_by_tree(category))\n }\n end\n accounts\n end", "def all_category_hash(item=nil)\n hash = {}\n items = []\n if(!item.nil?)\n for cat in @all_categories\n if(cat.parent_id.eql?(item.id))\n items.push(cat)\n end\n end\n else\n for cat in @all_categories\n if(cat.parent_id.nil?)\n items.push(cat)\n end\n end\n end\n for cat in items\n hash[cat] = all_category_hash(cat)\n end\n return hash\n end", "def categories_as_basic_with_all(returned = [])\r\n returned << categories.map { |x| { id: x.id, name: x.name }}\r\n returned.insert(0, { id: 0, name: \"All Categories\" })\r\n\r\n returned.flatten(1)\r\n end", "def subcategories_json\n {id: id, name: name, depth: depth}\n end", "def subcategories_json\n {id: id, name: name, depth: depth}\n end", "def create\n @product = Product.new(params[:product])\n @product.image = params[:image] if params[:image]\n #params[:product][:category_ids].each{|c|\n # @product.category = c\n #}\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def parse_categories_structure(donor_category_id = nil, selector = { product_link: '', next_page_link: '' })\n # dry_run_notification\n\n donor_categories = donor_categories_to_parse(donor_category_id)\n total_products_count = 0\n\n display_info \"Total categories count: \\e[34;1m#{donor_categories.count}\\e[0m\"\n\n donor_categories.find_each do |donor_category|\n category_products_count = 0\n page_number = page_to_parse(donor_category)\n is_parse_next_page = true\n category_page = { links: [], is_next_page: false, next_page_link: '' }\n\n while is_parse_next_page # Parse category page by page, until next page exists\n category_page = parse_category_page(donor_category, category_page[:next_page_link], page_number, selector)\n\n category_page[:links].each { |link| save_donor_product_link(donor_category.id, link) } unless DRY_RUN\n\n is_parse_next_page = category_page[:is_next_page]\n category_products_count += category_page[:links].count\n page_number += 1\n end\n\n category_name = \"#{donor_category.name_eng.blank? ? donor_category.name : donor_category.name_eng} (id: #{donor_category.id})\"\n\n if category_products_count > 0\n display_info \"Category\\e[0m \\e[33;1m#{\n category_name}\\e[0m \\e[32;1mparsed successfully!\\e[0m Products count: \\e[34;1m#{\n category_products_count}\\e[0m\"\n\n total_products_count += category_products_count\n else\n display_error \"Category\\e[0m \\e[33;1m#{\n category_name}\\e[0m \\e[31;1mparsed unsuccessfully!\\e[0m Products count: \\e[34;1m#{\n category_products_count}\\e[0m\"\n end\n\n # category.update(product_list_parsed_at: Time.zone.now) unless DRY_RUN # Update category product list parse date\n end\n display_info \"Total products count: \\e[34;1m#{total_products_count}\\e[0m\"\n end", "def categories(*values)\n values.inject(self) { |res, val| res._categories(val) }\n end", "def categories(*values)\n values.inject(self) { |res, val| res._categories(val) }\n end", "def categories_from_hash(hash)\n cat = []\n (1..hash.size).each { |i|\n cat.push(Item_Category.new(hash[i][0], hash[i][1]))\n }\n cat\n end", "def categories_attributes=(category_attributes)\n # byebug\n category_attributes.values.each do |category_attribute|\n unless category_attribute['name'].empty?\n category = Category.find_or_create_by(category_attribute)\n self.categories << category \n end \n end\n end", "def expand_categories(categories, text)\r\n html = '<ul class=\"'+text+'\">'\r\n categories.each do |cat|\r\n options = { :url => edit_article_category_path(cat), :method => :get, :loading => \"wait_for_content_update('edit')\" }\r\n child_categories = cat.children\r\n nested_html = child_categories.empty? ? '' : expand_categories(child_categories, \"subtitles\")\r\n html << '<li class=\"article_category\">' + link_to_remote(cat.display_text, options) + nested_html + '</li>'\r\n end\r\n html + '</ul>'\r\n end", "def categories\n rpg_shop.handled_categories\n end", "def build\n Dir.chdir(@directory) do\n\n Dir['**/*'].reduce({}) do |result, f|\n if File.file?(f) && is_erb?(f)\n\n node = build_node(f)\n cat = node[:category]\n result[cat] = (result[cat] || []).push(node)\n result\n\n else\n\n result\n\n end\n end\n\n end\n end", "def update_nesting_categories(favorite_token)\n case favorite_token\n when '0'\n change_parent_favorite_to_zero\n when '1'\n change_parent_favorite_to_one\n end\n end", "def categories_attributes=(category_attributes)\n category_attributes.values.each do |category_attribute|\n if !category_attribute[:name].empty?\n category = Category.find_or_create_by(category_attribute)\n self.categories << category\n end\n end \n \n end", "def categories(parent_id = nil)\n categories_data = Rails.cache.fetch('ebay_categories', expires_in: 10.day) do\n categories = client.call(:GetCategories, CategorySiteID: 0, ViewAllNodes: true, DetailLevel: 'ReturnAll')\n categories = categories.category_array.category.map do |c|\n {\n name: c[:category_name],\n id: c[:category_id].to_s,\n parent_id: c[:category_parent_id].to_s,\n level: c[:category_level],\n }\n end\n {\n by_parent_id: categories.group_by { |r| r[:parent_id] },\n by_level: categories.group_by { |r| r[:level] }\n }\n end\n categories_formatter(categories_data, parent_id)\n rescue\n []\n end", "def categories\n @categories ||= (@doc/\"Category\").collect { |it| Element.new(it) }\n end", "def build(*nodes, attributes: {}, infos: nil, recursive: true)\n\t\t\tnodes.each do |node|\n\t\t\t\tcase node\n\t\t\t\twhen Hash\n\t\t\t\t\tnode.each do |name,children|\n\t\t\t\t\t\tadd_node(name,children: [*children], attributes: attributes, infos: infos, recursive: recursive)\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tadd_node(node, attributes: attributes, infos: infos, recursive: recursive)\n\t\t\t\tend\n\t\t\tend\n\t\t\tself\n\t\tend", "def sort_categories\n for cat in @all_categories\n if(cat.parent_id == nil)\n @all_categories_hash[0] = [cat]\n else\n if(@all_categories_hash[cat.parent_id] == nil)\n @all_categories_hash[cat.parent_id] = []\n end\n @all_categories_hash[cat.parent_id].push(cat)\n end\n end\n for key in @all_categories_hash.keys\n @all_categories_hash[key].sort!{|x,y| x.name <=> y.name}\n end\n end", "def category_links(category)\n links = \"\"\n iterated_cat = category\n if iterated_cat.parent.nil?\n links = insert_category_link(links,iterated_cat)\n else \n i = 0\n while !iterated_cat.parent.nil? and iterated_cat != Sfcatnode.root\n links = insert_category_link(links,iterated_cat)\n iterated_cat = iterated_cat.parent\n i+= 1\n end\n end\n links.insert(0,\"#{link_to('All Solutions', :action => 'index')}\")\n end", "def categories(params={})\n return @categories if (@categories && !params[:force])\n @categories = get_categories\n end", "def categories_attributes=(categories_hashes)\n # raise categories_hashes.inspect\n # {\"0\"=>{\"name\"=>\"new cat 1\"}, \"1\"=>{\"name\"=>new cat 2\"}}\n categories_hashes.each do |index, category_attributes|\n #need to create a category that is alrady assoicated with this post and make sure that this cateogry doesn't already exist\n\n #DO NOT CREATE A CATEGOERY if it doesn't have a name\n if category_attributes[:name].present?\n # also don't add a category if it already has it\n\n category = Category.find_or_create_by(name: category_attributes[:name])\n if !self.categories.include?(category)\n # post_categories\n # self.categories<< category\n self.post_categories.build(:category => category)\n end\n end\n end\n end", "def products_arel\n if self.root?\n @products_arel ||= Product.joins(:dp_categories).where(\"dp_categories.id in (?)\", (self.children.collect do |dpc| dpc.id end << self.id))\n else\n @products_arel ||= self.products\n end\n @products_arel\n end", "def categories_for(race)\n [ race.category ] + race.category.descendants\n end", "def categories_attributes=(categories_hashes)\n categories_hashes.each do |index, categories_attributes|\n if categories_attributes[:name].present?\n category = Category.find_or_create_by(name: categories_attributes[:name])\n if !self.categories.include?(category)\n self.post_categories.build(:category => category)\n end\n end\n end\n end", "def categories\n if nodes = @node.xpath(\"category\")\n nodes.map { |node| RSSCategory.new(node) }\n end\n end", "def generate_categories\n Category.destroy_all\n\n puts 'Generating categories'\n\n Category.create(name: 'photo')\n Category.create(name: 'type')\n # Category.create(name: 'effectiveness')\nend", "def scrap_products(category_records) \n category_records.each do |element|\n print_catalog_details(element)\n \n begin\n product_css_target = \"div.mainbox\"\n items_in_category_css_target = \"span#lblCount\"\n \n prod_card_list = parse_page(element.url, product_css_target)\n\n i = 1 # page iterator\n pr_count = 0 \n\n items_in_category = parse_page(element.url, items_in_category_css_target).text.split(' ')[5].to_i\n items_per_page = prod_card_list.count\n total_pages = (items_in_category.to_f / items_per_page.to_f).ceil #страниц с товарами\n \n while i <= total_pages \n pagination_url = element.url.gsub('catalog.aspx?catalog_id=', 'catalog/').gsub('&catalog_name=','/') + \"/?page=#{i}&sort=2\"\n \n print_pagination_details(i, pagination_url)\n \n pagination_prod_card_list = parse_page(pagination_url, product_css_target)\n \n # Перебираем продукты на странице\n pagination_prod_card_list.each do |prod| \n \n db_record_product = Product.find_or_create_by(url: get_product_url(prod))\n db_record_product.name = get_product_name(prod)\n db_record_product.price = get_product_price(prod)\n db_record_product.url = get_product_url(prod)\n db_record_product.sku = get_product_sku(prod)\n db_record_product.save # save the product in DB \n \n db_record_product.catalogs << element # ключи в связующей таблице\n \n print_product_attr(db_record_product) \n end\n i = i + 1\n pr_count = pr_count + pagination_prod_card_list.count # счетчик товаров в категории\n end \n puts \"Added items to category: \" + pr_count.to_s\n puts \"Total added: \" + Product.all.count.to_s\n puts'' \n rescue\n puts \"!!! This catalog is empty\"\n puts ''\n next\n end\n end\nend", "def getAllSubcategories(reset=false) \n reset ? @allSubcategories = [self] + self.setAllSubcategories() : \n @allSubcategories ||= [self] + self.setAllSubcategories() \nend" ]
[ "0.69015265", "0.63359106", "0.6062785", "0.5985178", "0.5905654", "0.589622", "0.5875007", "0.58473384", "0.58378196", "0.5826368", "0.5800109", "0.57940173", "0.57741886", "0.57717365", "0.5751802", "0.5750642", "0.569158", "0.56822324", "0.56738114", "0.5650582", "0.5603088", "0.55895793", "0.55878615", "0.558669", "0.555677", "0.55561125", "0.5538954", "0.5531106", "0.5521381", "0.5516121", "0.5488575", "0.5486379", "0.5473836", "0.546056", "0.5454401", "0.5444605", "0.5440852", "0.54252034", "0.54217863", "0.5403378", "0.5400203", "0.53897685", "0.53881365", "0.53881365", "0.5382888", "0.53700894", "0.53477466", "0.53445095", "0.5343979", "0.53433186", "0.53131473", "0.5312041", "0.5305081", "0.5303279", "0.52989703", "0.5295613", "0.52954197", "0.5276135", "0.5271553", "0.5264455", "0.5254353", "0.5251503", "0.5226991", "0.52219003", "0.5219377", "0.52131534", "0.5209487", "0.52083117", "0.52058446", "0.5203573", "0.51986533", "0.51957875", "0.5193261", "0.5172179", "0.5172179", "0.5167413", "0.5160902", "0.51412916", "0.51412916", "0.51361454", "0.51357704", "0.5134759", "0.51320165", "0.5130421", "0.51257235", "0.5118254", "0.51060617", "0.51053387", "0.5100508", "0.5093684", "0.50924", "0.508622", "0.50829834", "0.5077899", "0.5065218", "0.50632167", "0.5061164", "0.5056104", "0.50554883", "0.50481176" ]
0.8027991
0
Who this users is following
def followed_users cached_followed_users end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def follower_username\n self.following_user.username\n end", "def following\n return @following\n end", "def following\n @following||= get(\"/user/show/#{login}/following\")['users'].map { |u| User.new(connection, :login => u) }\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 following\n @following = @current_user.friends\n end", "def following_record(user)\n followings_as_follower.find_by(user: user)\n end", "def who\n\t\t\t@username\n\t\tend", "def user_followed\n amigos = self.friends.pluck(:friend_id)\n User.find(amigos)\n end", "def followed\n Follower.where(\"follower_id=?\", self.id).map{|f| f.user}\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 followerss\n followers = relationships.find_by_followed_id(self.id)\n return followers\n end", "def following?( other_user )\n followings.include?( other_user )\n end", "def following_user?(other_user)\n following.include?(other_user)\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?(other_user)\n following.include?(other_user)\n end", "def following? (other_user)\n following.include?(other_user)\n end", "def following\n data['plans'][me]['following']\n end", "def following?\n user.present?\n end", "def following?(other_user)\n\t following.include?(other_user)\n \tend", "def following? other_user\n following.include?(other_user)\n end", "def following?(other_user)\n\t following.include?(other_user)\n\tend", "def me_and_followings\n self.followings+[self]\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 is_following\n Follow.where(:follower_id => self.id).map do |follow|\n User.find(follow.user_id)\n end\n end", "def followings\n @hot_topics = Topic.hot_topics(5)\n @interviewee = User.where(:nickname => params[:id]).first\n @is_same_user = @interviewee.is_same_user?(@current_user)\n \n @followings = @interviewee.followings\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end" ]
[ "0.78541875", "0.72116417", "0.70376563", "0.69407135", "0.6913698", "0.6813146", "0.6813123", "0.6804465", "0.6802457", "0.67841774", "0.67138904", "0.67065483", "0.6679849", "0.6677966", "0.66746587", "0.66609067", "0.66566026", "0.6652882", "0.6647286", "0.66391945", "0.66368216", "0.6636595", "0.6633407", "0.66271746", "0.6610161", "0.6600697", "0.6600697", "0.6600697", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047", "0.6592047" ]
0.0
-1
Who is following this user
def followers User.where("following @> ARRAY[#{id}]").to_a end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def follower_username\n self.following_user.username\n end", "def following\n return @following\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?\n user.present?\n end", "def following_user?(other_user)\n following.include?(other_user)\n end", "def following\n @following = @current_user.friends\n end", "def following?( other_user )\n followings.include?( other_user )\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following\n @following||= get(\"/user/show/#{login}/following\")['users'].map { |u| User.new(connection, :login => u) }\n end", "def following?(other_user)\n\t following.include?(other_user)\n\tend", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following_user?(other_user)\n following_users.include?(other_user)\n end", "def following?(other_user)\n\t following.include?(other_user)\n \tend", "def following? (other_user)\n following.include?(other_user)\n end", "def following? other_user\n following.include?(other_user)\n end", "def following_record(user)\n followings_as_follower.find_by(user: user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end" ]
[ "0.77735823", "0.71969444", "0.71457064", "0.71306205", "0.7123045", "0.7122178", "0.7106257", "0.70957065", "0.70957065", "0.70957065", "0.70854276", "0.7068732", "0.70496416", "0.70496416", "0.70496416", "0.70496416", "0.7049389", "0.70485455", "0.7038835", "0.70043546", "0.69986266", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679", "0.6995679" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_skill @skill = policy_scope(Skill).find(params[:id]) authorize(@skill) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def 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 default_action; end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n 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.6163927", "0.6046165", "0.59465253", "0.59167755", "0.58904207", "0.58346355", "0.577713", "0.5703502", "0.5703502", "0.56531286", "0.56215113", "0.54224145", "0.5410795", "0.5410795", "0.5410795", "0.53924775", "0.5379919", "0.53580743", "0.53401667", "0.53397506", "0.5332605", "0.5312215", "0.5296594", "0.52965283", "0.52957606", "0.5259903", "0.52443177", "0.523896", "0.523896", "0.523896", "0.523896", "0.523896", "0.52329034", "0.52322394", "0.5227445", "0.5222394", "0.5220348", "0.5212759", "0.5207747", "0.5205933", "0.5176468", "0.5173833", "0.5171983", "0.51663405", "0.5159596", "0.5158247", "0.51526845", "0.5152398", "0.5151361", "0.5145775", "0.5140135", "0.51338995", "0.51127726", "0.5112607", "0.5112607", "0.5110613", "0.51067513", "0.5092337", "0.508788", "0.5081578", "0.5080434", "0.50679874", "0.50567716", "0.5051213", "0.5048352", "0.5048352", "0.5035347", "0.5026666", "0.5023127", "0.5016081", "0.50129867", "0.5000684", "0.4999752", "0.49979812", "0.499026", "0.499026", "0.49866846", "0.49800366", "0.49795717", "0.49771172", "0.4968475", "0.4965813", "0.4958072", "0.49561292", "0.4954901", "0.49536785", "0.4953058", "0.49468648", "0.49424478", "0.4932989", "0.49291888", "0.49273813", "0.49271655", "0.4925948", "0.49236968", "0.49203572", "0.49181753", "0.49173692", "0.4916862", "0.49161318", "0.49155986" ]
0.0
-1
Retrieves a list of payments taken by the account making the request. Max results per page: 100
def test_test_list_payments() # Parameters for the API call begin_time = nil end_time = nil sort_order = nil cursor = nil location_id = nil total = nil last_4 = nil card_brand = nil # Perform the API call through the SDK function result = @controller.list_payments(begin_time: begin_time, end_time: end_time, sort_order: sort_order, cursor: cursor, location_id: location_id, total: total, last_4: last_4, card_brand: card_brand) # Test response code assert_equal(200, @response_catcher.response.status_code) # Test headers expected_headers = {} expected_headers['content-type'] = 'application/json' assert(ComparisonHelper.match_headers(expected_headers, @response_catcher.response.headers)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def payments(account_id = nil)\n query_api_object Payment, account_id.nil? ? \"/rest/payments\" : \"/rest/accounts/#{account_id}/payments\", nil, \"GET\", \"payments\"\n end", "def payments\n @session.payments @account_id\n end", "def index\n\t\t@payments = @user.payments.order(\"date desc\").page( params[:page] ).per(10)\n\tend", "def payments\n @session.payments @account_id\n end", "def index\n if current_user.admin?\n @payments = Payment.order(updated_at: :desc).paginate(page: params[:page], per_page: 12)\n else\n @payments = Payment.order(updated_at: :desc).where(user: current_user).paginate(page: params[:page], per_page: 12)\n end\n end", "def index\n @payments = Payment.all_for_user(current_user)\n end", "def get_payments(options = {})\n request_params = {}\n request_params[:PaymentID] = options[:payment_id] if options[:payment_id]\n request_params[:ModifiedAfter] = options[:modified_since] if options[:modified_since]\n request_params[:order] = options[:order] if options[:order]\n request_params[:where] = options[:where] if options[:where]\n\n response_xml = http_get(@client, \"#{@xero_url}/Payments\", request_params)\n parse_response(response_xml, {:request_params => request_params}, {:request_signature => 'GET/payments'})\n end", "def index\n @payments = @user.payments\n end", "def payments\n @payments ||= []\n end", "def user_payments\n @payments = Payment.get_user_payments(current_user.id)\n end", "def index\n @payment_methods = @user.payment_methods.page(params[:page]).per(params[:per])\n render json: @payment_methods\n end", "def index\n @type_of_payments = TypeOfPayment.accessible_by(current_ability).order(id: :desc).page params[:page]\n end", "def show\n @payment_records = @pay_roll.payment_records.page(params[:page]).per(10)\n end", "def all_payment_entries\n @ac = ApplicationController.new\n @payments = PaymentFromDestination.find(:all, :order => \"created_at\").reverse!\n end", "def index\n @account_transactions = AccountTransaction.paginate(page: params[:page], per_page: 30)\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.all\n end", "def index\n @payments = Payment.search(attach_owner_user_id)\n end", "def index\n search_params = params[:search] || {}\n search_params.reverse_merge!({\"meta_sort\" => \"id.desc\"})\n\n if params[:search].nil?\n search_params['updated_at_greater_than_or_equal_to'] = Date.today.beginning_of_month\n search_params['updated_at_less_than_or_equal_to'] = Date.today + 1.day\n end\n\n @search = Payment.where(user_id: current_user.id).search(search_params)\n @payments = @search.page(params[:page])\n end", "def index\n @api_payments = Api::Payment.all\n end", "def index\n @payments = []\n end", "def index\n @search = PaymentSearch.new params[:f], params[:page]\n @payments = @search.results\n# @payments = Payment.all\n end", "def index\n @paymentts = Paymentt.all\n end", "def index\n @search = Payment.search(params[:q])\n @payments = Payment.all\n end", "def index\n @payments = Array.wrap(payments)\n .map { |payment| Payment.new(payment) }\n .sort_by { |payment| payment.sort_key(:payment_date) }\n\n respond_to do |format|\n format.html { render }\n format.json { render json: payments_json_response }\n end\n end", "def index\n @payment_requests = PaymentRequest.all\n end", "def index\n @payments = Payment.where client: @client\n end", "def index\n #@payments = Payment.all\n @payment = Payment.find(params[:id])\n end", "def index\n @rent_payments = RentPayment.all\n end", "def index\n @rent_payments = RentPayment.all\n end", "def index\n if current_user.has_role?(:admin)\n @payments = Payment.all.order(:created_at).reverse_order\n else\n @payments = current_user.profile.payments.order(:created_at).reverse_order\n end\n end", "def index\n @debt_payments = DebtPayment.all\n end", "def index\n @pay_periods = PayPeriod.all\n end", "def index\n @pay_periods = PayPeriod.all\n end", "def index\n @payment_entries = PaymentEntry.all\n end", "def index\n @erip_transactions = EripTransaction.all.order(paid_at: :desc).paginate(page: params[:page], per_page: 30)\n end", "def index\n @recieve_payments = RecievePayment.all\n end", "def index\n @payment_records = PaymentRecord.all\n end", "def index\n @provider_payments = ProviderPayment.all\n end", "def index\n @payment_entries = ReceiptEntry.all.where(\"user_id =?\", current_user.id)\n end", "def payments\n if params['form_payment']\n results = CsApi::Member.update(current_access_token, @current_user.username, params['form_payment'])\n #check for errors!!\n if results['success'].eql?('false')\n flash.now[:error] = results['message']\n else\n flash.now[:notice] = 'Your payment information has been updated.'\n get_account\n end\n end\n # set the member's id for docusign\n @memberId = @account['id']\n @payments = CsApi::Member.payments(current_access_token, @current_user.username)\n @payments.each do |record| \n if record['status'].eql?('Paid')\n @show_paid_section = true\n else \n @show_outstanding_section = true\n end\n end\n @page_title = 'Your Payments and Payment Info'\n respond_to do |format|\n format.html\n format.json { render :json => @payments }\n end\n end", "def index\n @payments = current_student.all_payments.order(created_at: :desc)\n end", "def transactions\n res = filter\n .apply( account.all_transactions.reverse_order(:created_at) )\n\n res\n .paginate(page, per_page)\n end", "def index\n @tw_accounts = TwAccount.paginate(page: params[:page], per_page: 100)\n end", "def index\n @typepayments = Typepayment.where(user_id: current_user.id)\n end", "def list_online_payments\n @payments = Payment.find(:all, :conditions => 'online = 1').select{|p| p.registration && (p.registration.year == Year.this_year)}.sort_by(&:created_at)\n end", "def index\n @external_payees = Payee.external_payees\n @account_payees = Payee.all_account_payees\n end", "def get_payments_history(month_period)\n request('getPaymentsHistory', base_api_parameters.merge({ monthPeriod: month_period }))\n end", "def index\n @customer = Customer.find(params[:cust_id])\n @payments = @customer.payments\n end", "def index\n @pay_records = PayRecord.all\n end", "def index\n @pay_items = PayItem.all\n end", "def index\n @payments = Payment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @payments }\n end\n end", "def index\n @pays = Pay.all\n end", "def index\n @q = Payment.ransack(params[:q])\n @q.sorts = 'created_at desc' if @q.sorts.empty?\n @payments = Kaminari.paginate_array(@q.result).page(params[:page]).per(params[:per_page])\n #@payments = @q.result\n end", "def retrieve_payment_data(pay_key)\n api.execute(:PaymentDetails, pay_key: pay_key) do |response|\n if response.success?\n response.payment_info_list.payment_info.each do |payment|\n p \"Receiver: #{payment.receiver.email}\"\n p \"Amount: #{payment.receiver.amount.to_f}\"\n p \"Transaction status: #{payment.transaction_status}\".green\n end\n else\n p \"#{response.ack_code}: #{response.error_message}\".red\n end\n return response\n end\nend", "def index\n @transactions = Stripe::BalanceTransaction.all(:limit => 20)\n end", "def due_payments\n Payments.where(is_paid: false)\n \n end", "def index\n @type_of_payments = TypeOfPayment.all\n end", "def index\n @payments = Payment.order('creation_date DESC').all\n\n if current_login.has_role? :administrator\n @payments = Payment.find_by_sql('select *\nfrom Payments p, (select clinic_id, max(due_date) as d from payments group by clinic_id) s\nwhere p.clinic_id = s.clinic_id and p.due_date = s.d order by payed')\n\n\n \n elsif current_login.has_role? :manager\n logged_user = Manager.first(:conditions => \"login_id = #{current_login.id}\")\n @payments = Payment.in_clinic(logged_user.clinic.id).all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @payments }\n end\n end", "def index\n @member_payments = @customer.member_payments.pendings\n end", "def investor_payments(entity_id)\n API::request(:get, \"entities/#{entity_id}/investor_payments\")\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = ListPaymentsResultSet.new(resp)\n return results\n end", "def index\n if logged_in?\n @payments = Payment.all\n else\n redirect_to home_path\n end\n end", "def index\n @pay_methods = PayMethod.all\n end", "def payments(hash={}) \n Loan.all(:funding_line_id => funding_lines.map{|x| x.id}).payments(hash)\n end", "def index\n @transactions = @transactions.paginate(:page => params[:page], :per_page => 10)\n end", "def index\n @providers_payment_types = Providers::PaymentType.paginate(page: params[:page], per_page: 5).order('id Desc').all\n render :layout=>false\n end", "def index\n @debit_payments = DebitPayment.all\n end", "def index\n @auto_bill_payments = @origin_acct.auto_bill_payments.sort {|a,b| a.dateToPay <=> b.dateToPay}\n end", "def index\n delocalize_dates([:created_at_greater_than_or_equal_to, :created_at_less_than_or_equal_to]) if params[:search]\n @payments = do_index(Payment, params)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @payments }\n end\n end", "def index\n \n if @payment.nil?\n today = Date.today\n year = params[:year].to_i if params[:year]\n month = params[:month].to_i if params[:month]\n \n @date = today\n \n if year && month\n day = today.day\n if year != today.year || month != today.month\n day = 1\n end\n @date = Date.civil(year, month, day)\n end\n else\n @date = @payment.date\n end\n \n @payments = Payment.by_month(@date)\n \n respond_to do |format|\n format.html { render :action => 'index' }\n format.xml { render :xml => @payments }\n end\n end", "def get_list_payments_methods\n PaymentMethod.get_list_payment_methods\n end", "def list_all_payment_tokens_with_http_info(opts = {})\n if api_client.config.debugging\n api_client.config.logger.debug 'Calling API: PaymentToken.list_all_payment_tokens ...'\n end\n # resource path\n local_var_path = '/paymentTokens'\n\n # query parameters\n query_params = opts\n # query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n # query_params[:'size'] = opts[:'size'] if !opts[:'size'].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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\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 => 'Page<PaymentToken>')\n if api_client.config.debugging\n api_client.config.logger.debug \"API called: PaymentToken#list_all_payment_tokens\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def payments_report(period_data = 'last_month')\n res = payments.completed\n range, daily_report = period_data.to_s.report_period_to_range\n data = [[period_data.to_s.report_period_to_title, 'Tithe', 'Pledge', 'Partner', 'Donation', 'Offertory', 'Payment']]\n range.each do |d| \n r = d.beginning_of_day..(daily_report ? d.end_of_day : d.end_of_month.end_of_day)\n data << [d.strftime(daily_report ? '%d' : '%Y-%m'), \n res.where(payment_at: r, goal: 'tithe').sum(:amount).to_f,\n res.where(payment_at: r, goal: 'pledge').sum(:amount).to_f,\n res.where(payment_at: r, goal: 'partner').sum(:amount).to_f,\n res.where(payment_at: r, goal: 'donation').sum(:amount).to_f,\n res.where(payment_at: r, goal: 'offertory').sum(:amount).to_f,\n res.where(payment_at: r, goal: nil).sum(:amount).to_f\n ]\n end\n data\n end", "def index\n @cc_bill_payments = CcBillPayment.all\n end", "def investor_payments(distribution_id, options = {})\n \tAPI::request(:get, \"distributions/#{distribution_id}/investor_payments\", options)\n end", "def index\n @cargapp_payments = CargappPayment.all\n end", "def all_payments\n Payment.joins(:application).where('applications.student_id=?', id).where.not(status: nil)\n end", "def payments\n @getadvices = Getadvice.all\n\n #return all advicesposts after search \n @adviceposts = Advicepost.all\n\n #limits to show only current users adviceposts! - works\n #@messages = current_user.messages.page(params[:page]).per_page(10).order('created_at DESC')\n\n #active advice messages\n @messages = current_user.messages.page(params[:page]).order('created_at DESC').where(\"status = ?\", 'New')\n #past advice messages\n @messagesp = current_user.messages.page(params[:page]).order('created_at DESC').where(\"status = ? OR status = ? OR status= ?\", 'Responded', 'Canceled',\"Rated\")\n\n if current_user && current_user.has_payment_info?\n current_user.with_braintree_data!\n @transactions = Braintree::Transaction.search do |search|\n search.customer_id.is current_user.braintree_customer_id\n end\n end\n \n @products = Product.all\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @getadvice }\n end\n end", "def payments_json_response\n {\n key: 'payments',\n type: 'async',\n html: render_to_string(formats: ['html'], layout: false)\n }\n end", "def index\n default = 1\n page = params.fetch(:page, default)\n @purchases = Purchase.mine(current_user, page)\n end", "def payment_sorted_users\n members = []\n User.find(:all, :conditions => [\"team_id = ?\", self.id]).each do |member|\n\ttotal = 0\n\t@payments = Payment.find(:all,\n :conditions => [\"owner_id = ? AND description = ?\", member.id, Payment::DONE ] )\n\[email protected] do |payment|\n\t\ttotal = total + payment.amount\n\tend\n\tmember.payments = total\n\tmembers << member\n end\n members.sort! { |y,x| x.payments <=> y.payments }\n # less than elegant\n self.total_donations = 0\n members.each do |member|\n self.total_donations = self.total_donations + member.payments\n end\n return members \n end", "def group_payments\n []\n end", "def test_retrieve_all_payments\n session = figo_session('accounts=rw user=rw payments=rw')\n payments = session.payments\n assert payments.instance_of?(Array)\n end", "def fetch_billing_results\n previous_response = nil\n begin\n page = get_page_number\n\n response = Select.fetch_billing_results(@start_timestamp, @end_timestamp,\n page, @page_size)\n unless !response.is_a?(Array)\n process_response(response)\n previous_response = response\n end\n end until !response.is_a?(Array)\n reset_page_number\n\n set_empty_last_fetch_soap_id(response, previous_response)\n end" ]
[ "0.7137743", "0.711859", "0.7092813", "0.7068501", "0.6759412", "0.67561436", "0.67231905", "0.66791797", "0.66374886", "0.6597602", "0.648462", "0.6408131", "0.6327258", "0.6295491", "0.6288719", "0.62814146", "0.62814146", "0.62814146", "0.62814146", "0.62814146", "0.62814146", "0.62814146", "0.62814146", "0.62814146", "0.62814146", "0.62814146", "0.62814146", "0.62814146", "0.62814146", "0.62814146", "0.62814146", "0.62814146", "0.6281151", "0.618719", "0.6176363", "0.617142", "0.6158958", "0.6154463", "0.61434263", "0.61296123", "0.61186355", "0.6092813", "0.6083999", "0.6060011", "0.6060011", "0.60505766", "0.60420626", "0.6041515", "0.6041515", "0.6040631", "0.6036752", "0.6035687", "0.599324", "0.59618884", "0.5960878", "0.59424084", "0.59221244", "0.5919766", "0.5918257", "0.5906657", "0.5894551", "0.58807874", "0.58595145", "0.58561516", "0.5844917", "0.58317506", "0.5827882", "0.58237654", "0.5805793", "0.58029354", "0.58015084", "0.580051", "0.57820344", "0.5773325", "0.5766998", "0.5764074", "0.5763929", "0.5763108", "0.57483965", "0.5746033", "0.57423675", "0.5736495", "0.5715526", "0.5714722", "0.57084376", "0.570072", "0.5697864", "0.5685332", "0.56843257", "0.56768537", "0.5674574", "0.56688094", "0.56677204", "0.5666366", "0.56639606", "0.56609446", "0.56587154", "0.56585044", "0.56574994", "0.56507754" ]
0.58162487
68
Helper to create links with basic tooltip capability (tooltip message should be defined after this call)
def link_to_with_tooltip(name, target, *args, &proc) args << returning(args.extract_options!) do |options| options[:class] = 'tooltip-target ' + options[:class].to_s options[:rel] = default_prototip_options end link_to name, target, *args, &proc end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link_with_tooltip(link_target, link_text, tooltip_text)\n \"<a href='#{link_target}'><span data-tooltip class='has-tip', title='#{tooltip_text}'>#{link_text}</span></a>\".html_safe\n end", "def tooltip_tag content, title, url = \"#\", placement = \"right\", css_classes = \"help-inline record-help\"\n link_to(content, url, :class => css_classes, :data => { :placement => placement }, :rel => \"tooltip\", :target => \"_blank\", :title => title)\n end", "def help_tip(the_text)\n escaped_tooltip = html_escape(the_text).gsub(\"'\", \"\\\\'\")\n tooltip_tag = <<~HTML\n <a href=\"#\" onmouseover=\"Tip('#{escaped_tooltip}')\">\n <img class=\"tip-icon\" src=\"#{image_path('tip_icon.svg')}\" alt=\"(?)\"/>\n </a>\n HTML\n tooltip_tag.html_safe\n end", "def help_tip(the_text)\n escaped_tooltip = html_escape(the_text).gsub(\"'\", \"\\\\'\")\n tooltip_tag = <<~HTML\n <a href=\"#\" onmouseover=\"Tip('#{escaped_tooltip}')\">\n <img class=\"tip-icon\" src=\"/images/tip_icon.svg\" alt=\"(?)\"/>\n </a>\n HTML\n tooltip_tag.html_safe\n end", "def help_tooltip(partial_name)\n link_to('', '#', {\n :class => 'help',\n :title => render(:partial => \"help_tooltips/#{partial_name}\")\n })\n end", "def link_to_help(subject)\n link_to '#', id: \"#{subject}_help\", rel: 'popover',\n 'data-content' => t(\"hydra.metadata_help.#{subject}_html\"), 'data-original-title' => subject.titleize,\n 'aria-label' => \"Help for #{subject.titleize}\" do\n help_icon\n end\n end", "def link_helper(note)\n onclick = note.onclick\n unless href = note.link\n href = '#'\n onclick ||= \"footnotes_toogle('#{note.to_sym}_debug_info');return false;\" if note.fieldset?\n end\n\n \"<a href=\\\"#{href}\\\" onclick=\\\"#{onclick}\\\">#{note.title}</a>\"\n end", "def learn_more_link\n # unit_test_no_generate: learn_more_link, a.className(create_ats_regex_string(\"ats-learnmorelnk\"))\n $tracer.trace(__method__)\n return ToolTag.new(a.className(create_ats_regex_string(\"ats-learnmorelnk\")), __method__)\n end", "def ssn_help_link\n # unit_test_no_generate: ssn_help_link, a.className(create_ats_regex_string(\"ats-ssnhelplnk\"))\n $tracer.trace(__method__)\n return ToolTag.new(a.className(create_ats_regex_string(\"ats-ssnhelplnk\")), __method__)\n end", "def get_linked_short_name\n h.link_to( get_short_name, meeting_show_full_path(id: object.id), { 'data-toggle'=>'tooltip', 'title'=>I18n.t('meeting.show_results_tooltip') } )\n end", "def get_linked_custom_name( name )\n h.link_to( \"#{name}\", meeting_show_full_path(id: object.id), { 'data-toggle'=>'tooltip', 'title'=>I18n.t('meeting.show_results_tooltip') } )\n end", "def income_help_link\n # unit_test_no_generate: income_help_link, a.className(create_ats_regex_string(\"ats-incomehelplnk\"))\n $tracer.trace(__method__)\n return ToolTag.new(a.className(create_ats_regex_string(\"ats-incomehelplnk\")), __method__)\n end", "def tooltip(body, title = nil, length = 10)\n id = UUIDTools::UUID.random_create\n if body.length > length\n output= <<-TT\n <div id='#{id}' class='tooltip' title='#{title || \"Click to see full text.\"}'>#{body}</div>\n <span class='tooltip-snippet' onClick=\"$('##{id}').dialog('open')\">\n #{body[0..length]}<span class='more'>&#8230; more</span>\n </span>\n TT\n output.html_safe\n else\n body.html_safe\n end\n end", "def tooltip(body, title = nil, length = 10)\n id = UUIDTools::UUID.random_create\n if body.length > length\n <<-TT\n <div id='#{id}' class='tooltip' title='#{title || \"Click to see full text.\"}'>#{body}</div>\n <span class='tooltip-snippet' onClick=\"$('##{id}').dialog('open')\">\n #{body[0..length]}<span class='more'>&#8230; more</span>\n </span>\n TT\n else\n body\n end\n end", "def tooltip(body, title = nil, length = 10)\n id = UUIDTools::UUID.random_create\n if body.length > length\n <<-TT\n <div id='#{id}' class='tooltip' title='#{title || \"Click to see full text.\"}'>#{body}</div>\n <span class='tooltip-snippet' onClick=\"$('##{id}').dialog('open')\">\n #{body[0..length]}<span class='more'>&#8230; more</span>\n </span>\n TT\n else\n body\n end\n end", "def render_help(title, id=nil, options = {})\n link_to(image_tag('buttons/help.gif', :size => '22x22'), '#', {:class => \"tooltip question-mark\", :title => title, :id => \"icon-#{id}\"}.merge(options))\n end", "def title_link\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.a, format_method(__method__))\n end", "def mgs_feedback_link\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(jquery(\"a[href='#']\"),__method__)\n\tend", "def title_links(options = {})\n generate_links(:title, options)\n end", "def add_tooltip(options)\n if options.keys.include?(:tooltip)\n options[:rel] = 'tooltip'\n\n # tooltip class\n if options.keys.include?(:tooltip_class)\n options[:class] += \" #{options[:tooltip_class]}\"\n else\n options[:class] += ' tooltipped'\n end\n\n # placement of the tooltip\n if options.keys.include?(:tooltip_placement)\n options['data-placement'] = options[:tooltip_placement]\n else\n options['data-placement'] = 'top'\n end\n end\n\n options\n end", "def xtra_points_menu_link\n $tracer.trace(__method__)\n return ToolTag.new(a.className(create_ats_regex_string(\"AuthorizedFaq\")), __method__)\n end", "def newsfeed_guides_link\n $tracer.trace(__method__)\n return ToolTag.new(div.className(\"/tabs/\").a.at(3).innerText(\"/guides/\"), __method__)\n end", "def link(url, title) # :nodoc:\n \"[#{title}](#{url})\"\n end", "def link(css: nil, **opt)\n opt[:title] = opt.delete(:tooltip) || opt[:title] || show_tooltip\n prepend_css!(opt, css) if css.present?\n model_link(object, **opt)\n end", "def link(url, title) # :nodoc:\n warn \"link called from #{self.inspect}\"\n \"[#{title}](#{url})\"\n end", "def get_linked_full_name\n h.link_to( get_full_name, meeting_show_full_path(id: object.id), { 'data-toggle'=>'tooltip', 'title'=>I18n.t('meeting.show_results_tooltip') } )\n end", "def link_markup(descr = nil)\n descr = \"View resource.\" if descr == nil\n\n link = @reference_action_def.doi\n link = @reference_action_def.link if link.empty?\n return \"<a href=\\\"#{link}\\\" target=\\\"_blank\\\">#{descr}</a>\"\n end", "def sidebar_link(text, path, default_tooltip = \"\", condition = true, failure_tooltip = nil, options = {})\n # setup the base options for the tooltip\n link_opts = {\n \"rel\" => \"tooltip\",\n \"data-placement\" => \"right\"\n }\n\n li_opts = {}\n\n # if the link is to the current page, then we'll highlight it\n # TODO: make this work for the root url\n li_opts[:class] = \"active\" if current_page?(path)\n\n if condition\n link_opts['data-title'] = default_tooltip unless default_tooltip.blank?\n content_tag :li, li_opts do\n link_to raw(text), path, link_opts.merge(options)\n end\n else\n link_opts['data-title'] = failure_tooltip unless failure_tooltip.blank?\n link_opts[:class] = \"disabled\"\n link_opts[:onclick] = \"return false;\"\n content_tag :li do\n link_to raw(text), \"#\", link_opts\n end\n end\n end", "def link_to_markdown_tips(message=nil)\n url = \"http://markdown-guide.readthedocs.org/en/latest/basics.html\"\n message ||= \"Formatting help (external link)\"\n link_to message, url, target: \"_blank\"\n end", "def truncate_hover_link_blue_tooltip(str,length,url)\n strng = str\n if str.length > length\n strng = truncate(str, :length => length) \n end\n return %Q{\n <span class=\"liviadashboardview\">\n #{link_to(strng, url)}\n <span class=\"livia_dashboardroller\" style=\"display:none;\">\n #{str}\n </span>\n </span>\n }\n end", "def tip(options)\r\n tip = options.delete(:txt)\r\n options[:src] = options.delete(:img) || \"/images/16x16/about.png\"\r\n options[:onmouseover] = \"Tooltip.show(event,#{tip})\"\r\n options[:onmouseout] = \"Tooltip.hide()\"\r\n options[:alt] = \" \"\r\n\r\n tag(\"img\", options)\r\n end", "def link aUrl, aName = nil, aTitle = nil\n aName ||= aUrl\n %{<a href=\"#{aUrl}\"#{%{ title=\"#{aTitle}\"} if aTitle}>#{aName}</a>}\n end", "def link_to_help(text, path, html_options = {})\n height = html_options.delete(:height) || \"400\" \n width = html_options.delete(:width) || \"500\"\n scrollbars = html_options.delete(:scrollbars) || \"yes\"\n html_options.merge!(:popup => ['help_window', \n \"height=#{height.to_s},width=#{width.to_s},scrollbars=#{scrollbars.to_s}\"],\n :href => path)\n link_to(text, path, html_options)\n end", "def forums_gamer_helpline_link\n $tracer.trace(__method__)\n return ToolTag.new(div.id(\"/ctl00_content_ctl00_fragment_4954_ctl01_ctl00_appBrowser_DelayedSections/\").a.innerText(\"/Gamer Helpline/\"), __method__)\n end", "def template(title, link)\n \"\\t\\e[1m#{title}\\e[22m\\n\\t#{link}\\n\\n\"\n end", "def help_tip(text); \"\" end", "def lbSetTooltip _args\n \"lbSetTooltip _args;\" \n end", "def help_message(message)\n '<a href=\"#\" class=\"info\"><img src=\"/images/help.gif\" /><span>' + message + '</span></a>'\n end", "def alink(*args)\n\n args << {} unless args.last.is_a?(Hash)\n args.last[:title] = true\n\n opts = args.last\n\n hl = hlink(*args)\n\n attributes = %w[ href rel title ].inject([]) { |a, att|\n if val = hl[att]\n a << \"#{att}=\\\"#{val}\\\"\"\n end\n a\n }.join(' ')\n\n \"<a #{attributes}>#{opts[:text] || hl['href']}</a>\"\n end", "def link_to(body, url)\n \"[#{body}](#{url})\" if !AIPP.options.check_links || url_exists?(url)\n end", "def link(opts)\n \"#{opts[:name]} !LINK_OPEN_TAG!#{opts[:href]}!LINK_CLOSE_TAG!\"\n end", "def link(link, title, content)\n\t \"<u><link href='#{link}'>#{content}</link></u>\"\n\t end", "def announcements_more_link\n $tracer.trace(__method__)\n # unit_test_no_generate: announcements_more_link, a.id(\"imp_announcemore\")\n return ToolTag.new(a.id(\"imp_announcemore\"), __method__, self)\n end", "def addresses_link\n\t\t# unit_test_no_generate: addresses_link, a.className(create_ats_regex_string(\"ats-addressesnavlnk\"))\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(a.className(create_ats_regex_string(\"ats-addressesnavlnk\")), __method__)\n\tend", "def show_order_summary_link\n $tracer.trace(__method__)\n #unit_test_no_generate: show_order_summary_link, h3.className(create_ats_regex_string(\"ats-showordersummary_link\"))\n return ToolTag.new(h3.className(create_ats_regex_string(\"ats-showordersummary_link\")).a, __method__, self)\n end", "def learn_more_button\n $tracer.trace(__method__)\n # unit_test_no_generate: learn_more_button, area.href(\"/[/]about$/\")\n return ToolTag.new(area.href(\"/[/]about$/\"), __method__, self)\n end", "def get_linked_name\n h.link_to( get_full_name, team_closed_goggle_cup_path(id: goggle_cup.id), { 'data-toggle'=>'tooltip', 'title'=>I18n.t('radiography.goggle_cup_closed_tooltip') } )\n end", "def name_link()\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.a.id(\"/res_hypTitle/\"), format_method(__method__))\n end", "def get_linked_full_name_with_date\n h.link_to( \"#{get_full_name} (#{get_meeting_date})\", meeting_show_full_path(id: object.id), { 'data-toggle'=>'tooltip', 'title'=>I18n.t('meeting.show_results_tooltip') } )\n end", "def tooltip(hover_element_id, text, title='')\n content = \"<div style='width: 25em'>#{textilize(text)}</div>\"\n \"<script>\" +\n \"new Tip('#{hover_element_id}', '#{escape_javascript(content)}',\"+\n \"{title : '#{escape_javascript title}', className: 'silver_smaller_div',\"+\n \"showOn: 'mouseover', hideOn: { event: 'mouseout' }, fixed: false});\"+\n \"</script>\"\n end", "def activate_pur_link\n\t\t# unit_test_no_generate: activate_pur_link, a.className(create_ats_regex_string(\"ats-activatepurnavlnk\"))\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(a.className(create_ats_regex_string(\"ats-activatepurnavlnk\")), __method__)\n\tend", "def link_to( title, href )\n \"<a href='#{href}'>#{title}</a>\"\nend", "def link(link, title, content)\n if no_links\n content\n else\n # \"<a href=\\\"#{DashboardRouter.normalize(link)}\\\" target=\\\"_top\\\">#{content}</a>\"\n \"<a href=\\\"#{link}\\\">#{content}</a>\"\n end\n end", "def membergroups_sitefeedback_link\n $tracer.trace(__method__)\n return ToolTag.new(a.href(\"//membergroups/game_informer/site_feedback/default.aspx/\"), __method__)\n end", "def add_link(el, href, title, alt_text = T.unsafe(nil), ial = T.unsafe(nil)); end", "def handle_special_HYPERLINK(special); end", "def link(link, title, content)\n \"#{content} (#{link})\"\n end", "def link(link, title, content)\n\t\tif (title)\n\t\t\treturn \"title : [#{content}|#{link}]\"\n\t\telse\n\t\t\treturn \"[#{content}|#{link}]\"\n\t\tend\n\tend", "def navlistbar_news_link\n $tracer.trace(__method__)\n return ToolTag.new(li.className(\"/news/\").a.innerText(\"/News/\"), __method__)\n end", "def create_extra_links\n return nil unless @extra_links\n x_links = \"\"\n if (@extra_links.class==Hash)\n @extra_links.each do |k,v|\n x_links << \"<a href=\\\"#{v}\\\">#{k}</a>&nbsp;\"\n end\n elsif (@extra_links.class==Array)\n @extra_links.each do |link|\n x_links << \"<a href=\\\"#{link}\\\">#{link}</a>&nbsp;\"\n end\n else\n x_links = \"<a href=\\\"#{@extra_links.to_s}\\\">#{@extra_links.to_s}</a>\"\n end\n return x_links\n end", "def create_extra_links\n return nil unless @extra_links\n x_links = \"\"\n if (@extra_links.class==Hash)\n @extra_links.each do |k,v|\n x_links << \"<a href=\\\"#{v}\\\">#{k}</a>&nbsp;\"\n end\n elsif (@extra_links.class==Array)\n @extra_links.each do |link|\n x_links << \"<a href=\\\"#{link}\\\">#{link}</a>&nbsp;\"\n end \n else\n x_links = \"<a href=\\\"#{@extra_links.to_s}\\\">#{@extra_links.to_s}</a>\"\n end\n return x_links\n end", "def handle_special_HYPERLINK(special)\n url = special.text\n gen_url url, url\n end", "def setup_route\n route \"resources :tooltips do\\n\" +\n \" collection do\\n\" +\n \" get 'tooltip_content'\\n\" +\n \" end\\n\" +\n \" end\"\n end", "def need_help_link\n\t\[email protected](text: @need_help_text)\n\tend", "def pur_dashboard_link\n # unit_test_no_generate: pur_dashboard_link, a.className(create_ats_regex_string(\"ats-purdashboardnavlnk\"))\n $tracer.trace(__method__)\n return ToolTag.new(a.className(create_ats_regex_string(\"ats-purdashboardnavlnk\")), __method__)\n end", "def help_link(wiki_entry_name=nil)\n wiki_url = \"https://github.com/indykish/identityprov/wiki\"\n if wiki_entry_name\n wiki_url += \"/#{wiki_entry_name}\"\n link_text = \"Help for #{wiki_entry_name.underscore_humanize}\" \n else\n link_text =\"Help\" \n end\n link_to_ link_text, wiki_url, { :target => '_blank'}\n end", "def tooltip_markup(markup)\n content_tag :span, markup.html_safe\n end", "def handle_special_HYPERLINK(special) # rubocop:disable Style/MethodName\n @hyperlink ? special.text : super\n end", "def task_tooltip(names_and_values)\n res = \"<table id=\\\"task_tooltip\\\" cellpadding=0 cellspacing=0>\"\n names_and_values.each do |name, value|\n res += \"<tr><th>#{ name }</th>\"\n res += \"<td>#{ value }</td></tr>\"\n end\n res += \"</table>\"\n return escape_once(res)\n end", "def link_to_help(help_entry, link = '<span class=\"symbol question\"><span>?</span></span>'.html_safe)\n help_file = \"\"\n #if Locale.active && Locale.active.language\n # help_file = \"#{ArchiveConfig.HELP_DIRECTORY}/#{Locale.active.language.code}/#{help_entry}.html\"\n #end\n \n unless !help_file.blank? && File.exists?(\"#{Rails.root}/public/#{help_file}\")\n help_file = \"#{ArchiveConfig.HELP_DIRECTORY}/#{help_entry}.html\"\n end\n \n \" \".html_safe + link_to_ibox(link, :for => help_file, :title => help_entry.split('-').join(' ').capitalize, :class => \"symbol question\").html_safe\n end", "def communications_link\n\t\t# unit_test_no_generate: communications_link, a.className(create_ats_regex_string(\"ats-communicationsnavlnk\"))\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(a.className(create_ats_regex_string(\"ats-communicationsnavlnk\")), __method__)\n\tend", "def guides_posts_link\n $tracer.trace(__method__)\n return ToolTag.new(div.id(\"/fragment-3805/\").ul.className(\"content-list\").li.className(\"/content-item/\").h4.a, __method__)\n end", "def help_link(object_name, method, options={})\n InstanceTag.new(object_name, method, self, options.delete(:object)).to_help_link_tag(options)\n end", "def msg_LINKS(source, args)\n return \":#{@server.sid} NOTICE #{source} :We don't support LINKS. Please kindly die in a fire.\"\n end", "def links\n construct_html(self.items)\n end", "def create_links(tweet)\n # NOTE: URLs before Users, otherwise we'll double escape the URLs\n link_users(link_hashtags(link_urls(html_escape(tweet))))\n #link_users(link_urls(html_escape(tweet)))\n end", "def link_to(title, path, opts={}, base=true)\n unless is_uri?(path) || base == false\n path = url(path)\n end\n \n return \"<a href=\\\"#{path}\\\"#{parse_options(opts)}>#{title}</a>\"\n end", "def guides_newpages_link\n $tracer.trace(__method__)\n return ToolTag.new(div.className(\"sort-options\").a(\"/New Pages/\"), __method__)\n end", "def render\n <<-HTML\n <div class=\"relative\">\n <a href=\"#{url}\"class=\"#{position_classes}f6 link dim br2 ph3 pv2 dib white bg-blue\" data-help-link=\"Y\" target=\"cbf-help\">#{Icon.new(:question).render} #{text}</a>\n </div>\n HTML\n end", "def newsfeed_blogs_link\n $tracer.trace(__method__)\n return ToolTag.new(div.className(\"/tabs/\").a.at(1).innerText(\"/blogs/\"), __method__)\n end", "def icon_link_to(text, icon_key, url, options = {})\n icon = icon_tag(icon_key, options.delete(:icon_options) || {})\n disabled_reason = options.delete(:disabled_reason)\n options[:class] = \"#{options[:class]} disabled\".strip if disabled_reason\n inner = if url\n link_to((icon + text).html_safe, url, options)\n else\n content_tag(:a, (icon + text).html_safe, options)\n end\n\n if disabled_reason\n content_tag(:span, 'data-tooltip' => disabled_reason, onclick: \"alert('#{disabled_reason}');\") do\n inner\n end\n else\n inner\n end\n end", "def create_links\n end", "def create_links\n end", "def link_in(href, title)\n \"<wiki %p %p>\" % [href, title]\n tag(:a, title || href, :href => \"/#{href}\")\n end", "def newsfeed_feed_link\n $tracer.trace(__method__)\n return ToolTag.new(div.className(\"/tabs/\").a.at(0).innerText(\"/the feed/\"), __method__)\n end", "def action_link(title, link, icon, options = {})\n icon_tag = content_tag(:i, '', class: \"fa fa-#{icon} fa-fw\")\n default_options = { title: title, data: { tooltip: title } }\n link_to icon_tag, link, default_options.deep_merge(options)\n end", "def help_link(help_id)\n link_to(image_tag(\"iconic/lightbulb_20x32.png\", size: \"8x13\"), admin_help_path(help_id),{remote: true, title: \"Open help for this page.\"})\n end", "def tool_tip\n\t\treturn \"\"\n\tend", "def link_to_help(help_entry, link = '<span class=\"symbol question\"><span>?</span></span>')\n help_file = \"\"\n #if Locale.active && Locale.active.language\n # help_file = \"#{ArchiveConfig.HELP_DIRECTORY}/#{Locale.active.language.code}/#{help_entry}.html\"\n #end\n \n unless !help_file.blank? && File.exists?(\"#{RAILS_ROOT}/public/#{help_file}\")\n help_file = \"#{ArchiveConfig.HELP_DIRECTORY}/#{help_entry}.html\"\n end\n \n link_to_ibox link, :for => help_file, :title => help_entry.split('-').join(' ').capitalize, :class => \"symbol question\"\n end", "def make_link(url, text)\n return (\"[#{text}|#{url}]\")\n end", "def make_tooltip(title, *lines)\n title = title.to_s.split(\"\\n\").compact_blank!.presence\n lines = lines.flat_map { |v| v.to_s.split(\"\\n\") }.compact_blank!.presence\n if title && lines\n norm = ->(v) { v.gsub(/[\\s[:punct:]]+/, ' ').strip.downcase }\n last = norm.(title.last)\n lines.delete_if { |v| norm.(v) == last }\n end\n [*title, *lines].join(\"\\n\")\n end", "def community_user_name_link\n # unit_test_no_generate: community_user_name_link, a.id(\"/LinkUser/\")\n $tracer.trace(__method__)\n return ToolTag.new(a.id(\"/LinkUser/\"), __method__, self)\n end", "def link_to text, href\n \"[#{text}](#{href})\"\n end", "def get_linked_name( name_method = :get_short_name )\n if are_results_acquired\n linked_name = h.link_to(\n object.send(name_method),\n meeting_show_full_path(id: object.id),\n { 'data-toggle'=>'tooltip', 'title'=>I18n.t('meeting.show_results_tooltip') }\n )\n elsif has_start_list\n linked_name = h.link_to(\n object.send(name_method),\n meeting_show_start_list_path(id: object.id),\n { 'data-toggle'=>'tooltip', 'title'=>I18n.t('meeting.start_list_tooltip') }\n )\n elsif is_cancelled?\n linked_name = h.content_tag( :s, object.send(name_method) )\n elsif invitation\n linked_name = h.link_to(\n object.send(name_method),\n meeting_show_invitation_path(id: object.id),\n { 'data-toggle'=>'tooltip', 'title'=>I18n.t('meeting.manifest_tooltip') }\n )\n else\n linked_name = object.send(name_method)\n end\n linked_name.html_safe\n end", "def get_linked_name( name_method = :get_short_name )\n if are_results_acquired\n linked_name = h.link_to(\n object.send(name_method),\n meeting_show_full_path(id: object.id),\n { 'data-toggle'=>'tooltip', 'title'=>I18n.t('meeting.show_results_tooltip') }\n )\n elsif has_start_list\n linked_name = h.link_to(\n object.send(name_method),\n meeting_show_start_list_path(id: object.id),\n { 'data-toggle'=>'tooltip', 'title'=>I18n.t('meeting.start_list_tooltip') }\n )\n elsif is_cancelled?\n linked_name = h.content_tag( :s, object.send(name_method) )\n elsif invitation\n linked_name = h.link_to(\n object.send(name_method),\n meeting_show_invitation_path(id: object.id),\n { 'data-toggle'=>'tooltip', 'title'=>I18n.t('meeting.manifest_tooltip') }\n )\n else\n linked_name = object.send(name_method)\n end\n linked_name.html_safe\n end", "def display_title_with_link(event, length=nil)\n length = Event::TRUNCATE_TITLE_LENGTH_ON_TILE if length.nil?\n \n\t\tif (event.title.nil? or event.title.empty?)\n\t\t\t\"(No Title)\"\n\t\telse\n\t\t title = h(truncate(event.title, :length => length)).gsub(h(\"&rarr;\"), \"&rarr;\")\n\t\t case event.eventable_type\n when \"Foodanddrink\"\n \t\t website = event.website\n \t\twhen \"Activity\"\n \t\t website = event.website\n \t when \"Hotel\"\n \t website = event.website\n \t when \"Transportation\"\n \t return title\n \t when \"Notes\"\n \t return title\n \t when \"CheckIn\"\n \t return title\n\t end\n\n\t\t\twebsite_link(title, website, title)\n\t\tend \n\tend", "def link_to_function(name, *args, &block)\n html_options = args.last.is_a?(Hash) ? args.pop : {}\n html_options[:href] ||= args.first# if args.first.is_a? Hash\n core_link_to_function(name, args, html_options, &block)\n end", "def link_to(*arguments)\n return super if defined?(super)\n \n # What follows is a very simplistic implementation of link_to\n link_text, url, html_options = arguments[0..2]\n html_options[:href] = url\n attr_string = html_options.keys.sort.map do |attribute|\n '%s=\"%s\"' % [Rack::Utils.escape_html(attribute), Rack::Utils.escape_html(html_options[attribute])]\n end.join(' ')\n \n # Compose the tag\n return \"<a %s>%s</a>\" % [attr_string, Rack::Utils::escape_html(link_text)]\n end", "def link_to (label, url)\n \"<a href='#{url}'>#{label}</a>\"\n end", "def link_to(name, url, options = {}); end" ]
[ "0.7973254", "0.7414626", "0.66824496", "0.6641689", "0.65933776", "0.654808", "0.64785933", "0.642116", "0.64097583", "0.6302612", "0.62912905", "0.6284192", "0.6280714", "0.6258682", "0.6258682", "0.6247794", "0.6199889", "0.6199575", "0.61882305", "0.6187047", "0.6184608", "0.61835706", "0.6178249", "0.6168565", "0.612962", "0.61094093", "0.60851866", "0.60679805", "0.60666955", "0.6065856", "0.60457397", "0.60352695", "0.6034351", "0.6021419", "0.60125065", "0.59972084", "0.5989108", "0.5987678", "0.5987096", "0.5982397", "0.59764904", "0.59664303", "0.5965876", "0.59512913", "0.5949382", "0.59448326", "0.5913536", "0.5892616", "0.58741194", "0.5873904", "0.5871049", "0.5865774", "0.5848149", "0.58329445", "0.58253634", "0.58207965", "0.5787706", "0.5782867", "0.57825947", "0.5779899", "0.5778715", "0.5766117", "0.5756235", "0.5751074", "0.57465905", "0.5721053", "0.5709063", "0.5704725", "0.56993705", "0.56822616", "0.5678352", "0.56728023", "0.56715333", "0.5670718", "0.5653528", "0.5645349", "0.5641429", "0.5639178", "0.5639145", "0.56390744", "0.5637232", "0.5629466", "0.5629466", "0.5629213", "0.56287456", "0.5623007", "0.56076777", "0.5597028", "0.55839276", "0.5583892", "0.55833316", "0.5581933", "0.5572541", "0.55632997", "0.55632997", "0.5561706", "0.55617", "0.55600035", "0.5559354", "0.5553508" ]
0.72275245
2
Returns false if no avaiable tuners Returns tuner number if recordable
def record(recording) if recordable?(recording) tuner = open_tuner current_recordings[tuner] = recording current_recordings[tuner].record! tuner else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_tuner\n tuners.times do |tuner|\n return tuner if current_recordings[tuner].nil?\n end\n\n nil\n end", "def check_recordings\n tuners.times do |tuner|\n recording = current_recordings[tuner]\n\n next if recording.nil? || recording.recordable?\n\n stop_and_store_recording(recording)\n free_up_tuner(tuner)\n end\n end", "def recordable?(recording)\n !!open_tuner && (recording.full_size < space_available)\n end", "def pbTrainerCheck(tr_type, tr_name, max_battles, tr_version = 0)\r\n return true if !$DEBUG\r\n # Check for existence of trainer type\r\n pbTrainerTypeCheck(tr_type)\r\n tr_type_data = GameData::TrainerType.try_get(tr_type)\r\n return false if !tr_type_data\r\n tr_type = tr_type_data.id\r\n # Check for existence of trainer with given ID number\r\n return true if GameData::Trainer.exists?(tr_type, tr_name, tr_version)\r\n # Add new trainer\r\n if pbConfirmMessage(_INTL(\"Add new trainer variant {1} (of {2}) for {3} {4}?\",\r\n tr_version, max_battles, tr_type.to_s, tr_name))\r\n pbNewTrainer(tr_type, tr_name, tr_version)\r\n end\r\n return true\r\nend", "def kaiser_enabled?\n cpu_flags.include? 'kaiser'\n rescue\n raise 'Could not determine KAISER status'\n end", "def is_available?\n count_available > 0\n end", "def available?\n self.available_count > 0\n end", "def battler_activator?\n return (@activator != TRGProbability)\n end", "def enabled?\n $game_switches[Yuki::Sw::Pokedex]\n end", "def no_device?\n\ttrue if devices.size < 1\nend", "def enabled?\n REAPERS.include?(reaper)\n end", "def is_tapenum?(); @type == GRT_TAPENUM; end", "def national?\n return $game_switches[Yuki::Sw::Pokedex_Nat]\n end", "def dial_up_numbers_ok? \n (!senior.blank? && !senior.devices.gateways.first.blank?) ? senior.devices.gateways.first.dial_up_numbers_ok? : false\n #\n # Fri Sep 24 04:26:03 IST 2010\n # logic updated to check user.devices by type of device\n #\n # senior.blank? ? false : senior.dial_up_numbers_ok_for_device?( senior.device_by_serial_number( kit_serial_number))\n end", "def multiple_devices?\n\ttrue if devices.size > 1\nend", "def is_tapecode?(); @type == GRT_TAPECODE; end", "def available?\n (0...@maxthreads).each do |i|\n j = (@next_av+i) % @maxthreads\n if @threads[j].nil?\n @next_av = (j+1) % @maxthreads\n return j\n end\n end\n nil\n end", "def supporter?\n @data['supporter']\n end", "def recommendable?() false end", "def is_hardwire?(); @type == GRT_HARDWIRE; end", "def smartRankingEnabled?\n smart_ranking_element.count > 0 \n end", "def probe?\n self.type == :probe\n end", "def available?\n return false if deleted?\n return false if karma < app_settings(:post_karma_barrier)\n true\n end", "def available?\n true\n end", "def get_available_num\n num = 1\n while @@songs.find { |s| s.num == num } do\n num += 1\n end\n\n num\n end", "def pbAllFainted\n return $Trainer.ablePokemonCount==0\nend", "def is_able?\n if gladiators.count < 2\n return false\n end\n return true\n end", "def rech_bonus?\n has_feature?(:esper_recharger)\n end", "def available?\n vehicle.nil?\n end", "def sample_is?(number)\n @shot_sample == number\n end", "def detect_radio()\n ret=get_cmd('OM;',0.1,1.0,5)\n if(ret)\n if(ret.include?('A'))\n $kx_atu=true\n end\n if(ret.include?('P'))\n $kx_pa=true\n end\n if(ret.include?('F'))\n $kx_filter=true\n end\n if(ret.include?('T'))\n $kx_extatu=true\n end\n if(ret.include?('B'))\n $kx_charger=true\n end\n if(ret.include?('X'))\n $kx_transverter=true\n end\n if(ret.include?('I'))\n $kx_rtcio=true\n end\n if(ret=~/01;$/)\n $kx_model=2\n end\n if(ret=~/02;$/)\n $kx_model=3\n end\n return(true)\n else\n return(nil)\n end\nend", "def available?\n true\n end", "def available?\n return false\n end", "def check_wagons_for_train_type(number)\n @wagons[@trains[number.to_sym].type].any?\n end", "def suitable?\n @suitable ||= begin\n info = AvailableHints.keys.inject([]) do |ary, attr|\n ary.concat Array.wrap(send(attr))\n end\n\n info.size >= 7\n end\n end", "def device?\n type == :device\n end", "def find_suitable_adapter_for(joltage)\n # Create a range of suitable adapters that would work\n suitable_range = (joltage..joltage + 3).to_a\n\n # Look in the bag for adapters we have and see if any of them match our suitable range\n suitable_range.each do |searching_joltage|\n suitable_adapter = @adapters.find { |n| n[:rating] == searching_joltage && !n[:has_been_used] }\n\n if suitable_adapter\n # Find difference between joltage and suitable adapter\n joltage_difference = suitable_adapter[:rating] - joltage\n\n # We've used this now...\n suitable_adapter[:has_been_used] = true\n\n puts suitable_adapter\n # Keep track of difference\n @difference << joltage_difference\n return suitable_adapter[:rating]\n else\n next\n end\n end\nend", "def pbTrainerLevelIs?(level)\r\n return ($PokemonGlobal.trainerLevel==level)\r\nend", "def is_used?\n self.cases_count == self.cases_max\n end", "def adaptive_rx\n answer = ethtool('-c', resource[:name]).split(/\\n/).find { |line| line =~ /Adaptive RX:/ }\n if answer\n answer.split(/ +/)[2] == 'on' ? 'enabled' : 'disabled'\n else\n 'unknown'\n end\n end", "def learned?\n consecutive_successful_repetitions >= WhRails::Application.config.max_consecutive_successful_repetitions\n end", "def analyze?\n @analyze\n end", "def revolution_per_meter? = unit == 'revolution-per-meter'", "def check_video_bitrate\n @bit_rate = @movie_info[:format][:bit_rate].to_i\n @bit_rate_check = if @bit_rate > VIDEO_BITRATE\n true\n else\n false\n end\n end", "def available?\n if tenant == false && @units != @number\n return true\n else \n return false\n end\n end", "def is_softwire?(); @type == GRT_SOFTWIRE; end", "def manage_ip?\n case type.hotspot\n when 'hsv1-mem' then true\n when 'hsv2-bam' then false\n else false\n end\n end", "def available?\n false\n end", "def trainer_battle?\n !@names[1].empty?\n end", "def scan_active?\n\t\t\t@lightscan['lastscan'] == 'active'\n\t\tend", "def quality_start?\r\n if inn.to_i >= 6 && self.r.to_i < 4\r\n return true\r\n end\r\n return false\r\n end", "def throttle?\n parser.throttle?\n end", "def iphone_4?\n GBDeviceInfo.deviceDetails.model == GBDeviceModeliPhone4\n end", "def available?()\n #This is a stub, used for indexing\n end", "def has_sample?\n sample_width.is_a?(Integer)\n end", "def previous_station_available?\n current_station_index != 0\n end", "def trial?\n (plan_type == 'free_trial')\n end", "def studio?\n puts num_beds == 1\n end", "def has_predictions?\n patron?(tier: 2, before: STRIPE_MIGRATION_DATE) || patron?(tier: 4) || subscriptions.tier1.active.any? || admin? || self.class.stay_insideathon?\n end", "def reaper?; (@reaper ||= nil) && @reaper.frequency end", "def suitable?\n false\n end", "def suitable?\n false\n end", "def should_i_sip?\n #If we don't have our total scores, wait until character fills them in.\n if plugins[Character].total_mana && plugins[Character].total_health \n #Otherwise, begin checking health and mana to see if we need to do some drinking...\n if health_below_threshold? && sipper_enabled?\n send_kmuddy_command(\"drink health\")\n @sipper_enabled = false\n end\n if mana_below_threshold? && sipper_enabled?\n send_kmuddy_command(\"drink mana\")\n @sipper_enabled = false\n end\n end\n end", "def toggable?\n return @switch != nil\n end", "def instruments_running?\n instruments_pids.count > 0\n end", "def fails_threshold?\n return false if sample_size < options.sample_threshold\n\n failure_rate >= options.rate_threshold\n end", "def at_max_players?\n self.player_count == MAX_PLAYERS\n end", "def studio?\n num_beds == 1\n end", "def shuffle?\n player_iface['Shuffle']\n end", "def available?(digit)\n @available_digits.member? digit\n end", "def has_max_hands\n return 1 if @hands.length == MAX_HANDS\n return nil\n end", "def determine_training(candidate)\n\tputs \"On a scale of 1 to 5 (5 being the most), how much training and/or mentoring are you planning on providing to the candidate?\"\n\tability_to_train = gets.chomp\n\tif check_number_input(ability_to_train) ==false\n\t\tprob_found\n\t\tdetermine_training(candidate)\n\telse\n\t\tability_to_train = ability_to_train.to_i*candidate.convert_to_val('fast_learner')\n\tend\nend", "def is_one_attack?\n get_model.is_one_use_weapon?\n end", "def engaged\n ptr = ::FFI::MemoryPointer.new(:int)\n Klass.getEngaged(@handle, @index, ptr)\n (ptr.get_int(0) == 0) ? false : true\n end", "def intune_device_count\n return @intune_device_count\n end", "def next_station_available?\n current_station_index != @route.stations.length - 1\n end", "def check_train_wagons\n passenger_trains_amount = 0\n cargo_amount = 0\n @trains.each_value do |train|\n train.type == 'cargo' ? cargo_amount += 1 : passenger_trains_amount += 1\n end\n passenger_matches(passenger_trains_amount) || cargo_matches(cargo_amount)\n end", "def reportable?\n enable_learner_state\n end", "def speed?\n @speed\n end", "def speed?\n @speed\n end", "def useful?\n ratings.sum(:vote) > 0\n end", "def used?\n @used\n end", "def tune(*args)\n argv = to_pointer([\"tune\"] + args)\n rrd_tune(args.size+1, argv) == 0\n ensure\n free_pointers\n end", "def num_tankoubon; end", "def enough_human_players?\n players.length >= needed_players\n end", "def can_play(player_cnt)\n if @cards.length >= player_cnt * AVERAGE_HAND_SIZE\n return 1\n end\n return nil\n end", "def available; end", "def available; end", "def machine?\n machine_flag != '0'\n end", "def tour_available?\n self.tour_credits > 0 || self.tours_unlimited\n end", "def available?\n idle.any?\n end", "def can_watch_episode?( episode, t = Time.now.utc )\n\t\tepisode.available?( t )\n\tend", "def is_zigbee?(pool)\n dt = DeviceType.find(:first, :include => :serial_number_prefixes, \n :conditions => \"serial_number_prefixes.prefix = '#{pool.starting_serial_number[0,3]}'\")\n if dt.nil?\n throw \"no row in serial_number_prefixes table for prefix #{pool.starting_serial_number[0,3]}\"\n else\n return dt.mac_address_type == 0\n end\n end", "def negotiate_best_deal?\n nil\n end", "def won_by?(player)\n\t\tcase player\n\t\twhen :hunter\n\t\t\tif players_within_distance?\n\t\t\t\t\"CAPTURE\"\n\t\t\telsif @prey.time_taken > $time_limit\n\t\t\t\t\"TIMEOUT\"\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\twhen :prey\n\t\t\tif players_surrounded?\n\t\t\t\t\"ESCAPE\"\n\t\t\telsif hunter_trapped?\n\t\t\t\t\"ESCAPE\"\n\t\t\telsif @hunter.time_taken > $time_limit\n\t\t\t\t\"TIMEOUT\"\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\tend\n\tend", "def available_toners\n Toner.where(toner_model: usable_toner_models.map(&:id)).where(gift: true)\n end", "def oldrank?(prog); @oldranks.include?(prog); end", "def resampling_required?\n flac_info.streaminfo[\"samplerate\"] != target_sample_rate\n end", "def available?\n @backends.present?\n end", "def rescan?\n @rescan_required\nend" ]
[ "0.6510883", "0.64606845", "0.6039347", "0.5715465", "0.56211567", "0.5398032", "0.5281567", "0.5247588", "0.5241347", "0.5237521", "0.52360857", "0.5186604", "0.51750505", "0.51653886", "0.5160089", "0.51578546", "0.51352763", "0.5117952", "0.5111841", "0.51084936", "0.5106654", "0.510439", "0.50984", "0.5082373", "0.5080766", "0.5049087", "0.5048568", "0.50380105", "0.5027319", "0.5021919", "0.50148284", "0.5010099", "0.5003192", "0.50004655", "0.49915895", "0.4960593", "0.4952662", "0.4948137", "0.49446458", "0.49302492", "0.4929848", "0.49232215", "0.49199688", "0.4915033", "0.49091893", "0.49063277", "0.48950627", "0.48863772", "0.48855755", "0.4883586", "0.48797667", "0.48778996", "0.48634928", "0.48618332", "0.48550317", "0.48502398", "0.48451734", "0.4844674", "0.48412585", "0.48290202", "0.4827802", "0.4827802", "0.4821104", "0.48179862", "0.48141995", "0.48102152", "0.48096704", "0.48034292", "0.48029315", "0.48021597", "0.47996107", "0.47929513", "0.479043", "0.47857106", "0.47847083", "0.47824755", "0.47746933", "0.4771137", "0.4764644", "0.4764644", "0.47626093", "0.47619662", "0.47600576", "0.47595197", "0.47590104", "0.47559458", "0.47554994", "0.47554994", "0.47550374", "0.47533777", "0.47518727", "0.47515157", "0.47498697", "0.4745822", "0.4741629", "0.47394842", "0.47342443", "0.47295016", "0.47290108", "0.4728895" ]
0.56264526
4
Are there any tuners that aren't recording? Can the full size of the recording fit?
def recordable?(recording) !!open_tuner && (recording.full_size < space_available) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_recordings\n tuners.times do |tuner|\n recording = current_recordings[tuner]\n\n next if recording.nil? || recording.recordable?\n\n stop_and_store_recording(recording)\n free_up_tuner(tuner)\n end\n end", "def check_max_samples_exceeded\n # loop over each stripwell and sum the num samples in each to find total num samples\n num_samples = 0\n operations.map { |op| op.input(\"PCR\").collection }.uniq.each do |stripwell|\n num_samples = num_samples + stripwell.num_samples\n end\n if num_samples > 96\n operations.store io: \"input\", interactive: false\n raise \"The fragment analyzer can only hold 96 samples at once. This job has #{num_samples} total samples\"\n end\n num_samples\n end", "def recording_thumbnails?\n Rails.configuration.recording_thumbnails\n end", "def has_sample?\n sample_width.is_a?(Integer)\n end", "def length?\n video_length > 10.0\n end", "def rescaling_required?\n flac_info.streaminfo[\"bits_per_sample\"] != 16\n end", "def fails_threshold?\n return false if sample_size < options.sample_threshold\n\n failure_rate >= options.rate_threshold\n end", "def byte_sizable?\n @research_output.audiovisual? || @research_output.sound? || @research_output.image? ||\n @research_output.model_representation? ||\n @research_output.data_paper? || @research_output.dataset? || @research_output.text?\n end", "def est_vide?()\n return (@pile.size == 0)\n end", "def recording_length(playbacks)\n # Looping through playbacks array and returning first non-zero length value\n playbacks.each do |playback|\n length = playback[:length]\n return recording_length_string(length) unless length.zero?\n end\n # Return '< 1 min' if length values are zero\n \"< 1 min\"\n end", "def quality_start?\r\n if inn.to_i >= 6 && self.r.to_i < 4\r\n return true\r\n end\r\n return false\r\n end", "def get_size\n @monitors.length\n end", "def nclocks\n return @sig_waveforms[0][1].length\n end", "def pbAllFainted\n return $Trainer.ablePokemonCount==0\nend", "def resampling_required?\n flac_info.streaminfo[\"samplerate\"] != target_sample_rate\n end", "def instruments_running?\n instruments_pids.count > 0\n end", "def xtvt_not_dropped_quality?\n ( (is_dropped!= true && half==1 && staff_appraisal.is_skt_endorsed == true) || (_destroy!=true && half==2) ) && ( !indicator_desc_quality.blank? && !target_quality.blank?)\n end", "def full?\n without_locking { players.size >= technology.max_players }\n end", "def get_total_snpinfo_boxes\n return @snpinfo_tracks.length\n end", "def have_sample_ids?\n if @options.samples && @options.samples.size > 0\n return true\n end\n @stderr.puts \"Missing sample id(s) to processor\"\n return false\nend", "def playable_length\n playable.length\n end", "def check\n len = 0\n @sig_waveforms.each do |pair|\n values = pair[1]\n if len == 0\n len = values.length\n else\n return false if values.length != len\n end\n end\n return true\n end", "def flapping?\n recent_changes = ([@output] + @historical_data).map { |h| h['breached'] }\n squeezed = recent_changes.inject([]){|acc,i| acc.last == i ? acc : acc << i }\n squeezed.size > Monytr::Core.config.flapping_threshold\n end", "def metricModel? \n model = Sketchup.active_model\n\n # Get the length Units of the active model from the unitsOptions\n # 0=inches,1=feet,2=mm,3=cm,4=m\n unit = model.options[\"UnitsOptions\"][\"LengthUnit\"]\n return !(unit==0 || unit==1)\nend", "def common?\n self.sightings.size > 30\n end", "def size?\n @timestamps.size == @steps_num\n end", "def bounded?\n @timestamps[-2] + 2.0 <= video_length\n end", "def max_resolution; end", "def sampled?\n @sampled\n end", "def autoreaping?; @reaping_frequency > 0; end", "def gc_metrics_enabled?\n gc_metrics_enabled\n end", "def valid_sample_size?(sample_size=nil)\n return true if sample_size.nil?\n normalized = sample_size.to_s.strip.downcase\n return true if normalized.empty?\n return true if normalized == 'all'\n return true if normalized =~ SAMPLE_PROPORTION_REGEX\n\n return false\nend", "def aperture?\n !aperture.nil?\n end", "def check_for_resize; end", "def analyze?\n @analyze\n end", "def space_available\n used = 0\n if recordings.any?\n used = recordings.map(&:full_size).reduce(:+) \n end\n\n total_space - used\n end", "def has_max_hands\n return 1 if @hands.length == MAX_HANDS\n return nil\n end", "def has_sent_recognition_data?\n [top_recognition_senders, bottom_recognition_senders].flatten.any? { |u| u.sent_recognitions_count > 0 }\n end", "def can_deal?\n size() >= 6\n end", "def has_played?\n stats != nil\n end", "def number_of_samples\n return @stream.size\n end", "def number_of_samples\n return @stream.size\n end", "def pixel_per_meter? = unit == 'pixel-per-meter'", "def number_of_triples?\n puts \"\\n#{@@number_of_triples} triples generated !! :)\"\n puts \"\"\n puts \"(NOTE: Those drugs with incomplete fields have not been added)\"\n end", "def pbBoxesFull?\n return !$Trainer || ($Trainer.party.length==6 && $PokemonStorage.full?)\nend", "def revolution_per_meter? = unit == 'revolution-per-meter'", "def uniquely_identified_by_any_peptides?\n unique_spectra > 0\n end", "def allow_sample?(sample)\n true\n end", "def has_audios?\n audios[I18n.locale.to_sym].length + attached_audios[I18n.locale.to_sym].length > 0\n end", "def tenth_frame; end", "def consistent?\n return spectralRadius < 1.0\n end", "def no_device?\n\ttrue if devices.size < 1\nend", "def long_planeteer_calls(calls)\n calls.any? {|call| call.length > 4}\nend", "def summarizable?\n size < MAX_SIZE\n end", "def full?\n slots_available.zero?\n end", "def enough_human_players?\n players.length >= needed_players\n end", "def fixed_ratio?\n fullsize_settings[:dimensions].all?(&:present?)\n end", "def check_queue_size_hold\n `#{config[:path]} | /bin/egrep -c '^[0-9A-F]+!'`.to_i\n end", "def healthy?\n #todo: paramaterize this a bit more.\n replication_lag_bytes < 1024 && state == 'streaming'\n end", "def has_no_readings?\n readings.size.eql?(0)\n end", "def full_scan_required?(histories)\n self.send(\"full_#{@options[:scan_mode]}_scan_required?\", histories)\n end", "def berzerk?\n @woot_count >= 5\n end", "def can_throttle?\n [threshold, period].select(&:zero?).empty?\n end", "def sampled_ineligible?\n sampled_persons_ineligibilities.count > 0\n end", "def wave_makers\n LookUp::profiles_for_wavemakers_on_home\n end", "def studio?\n num_beds == 1\n end", "def daf_trial_length_ignorable?\n daf_retrial_combo_ignorable || @record.claim.hardship?\n end", "def length; return @totalFrames; end", "def microgram? = unit == 'microgram'", "def metrics?\n @metrics\n end", "def long_planeteer_calls(calls)\n calls.any? do |call|\n call.length > 4\n end\nend", "def spans_magnitudes?(base = 10)\n\t\treturn magnitudes_spanned.length > 1\n\tend", "def long_planeteer_calls(calls) \n calls.any? do |call|\n call.length > 4 \n end\nend", "def full?\n bike_count >= capacity\n end", "def valid_mx?\n @host.exchanger.mxers.size > 0\n end", "def should_collect_functioning_bikes?(container)\n !self.full? && container.functioning_bikes.count >= 1\n end", "def sample_is?(number)\n @shot_sample == number\n end", "def check_video_bitrate\n @bit_rate = @movie_info[:format][:bit_rate].to_i\n @bit_rate_check = if @bit_rate > VIDEO_BITRATE\n true\n else\n false\n end\n end", "def samples; end", "def samples; end", "def spaceAvailable\n\t\treturn @maxElements > @weapons.length + @shieldBoosters.length\n\tend", "def suitable?\n @suitable ||= begin\n info = AvailableHints.keys.inject([]) do |ary, attr|\n ary.concat Array.wrap(send(attr))\n end\n\n info.size >= 7\n end\n end", "def sampled?\n @decision == Decision::RECORD_AND_SAMPLE\n end", "def is_sampler?(record)\n\t\t\t\t\t\trecord['flow_sampler_id'] && record['flow_sampler_mode'] && record['flow_sampler_random_interval']\n\t\t\t\t\tend", "def long_tracks\n @tracks.select { |track| track.duration_ms > 240_000 }\n end", "def four_of_a_kind?\n repeat_counts.include? 4\n end", "def detect; end", "def sample_treasures\n nil\n end", "def long_planteer_calls(calls)\n calls.any? {|call| call.length > 4} # code from lecture\nend", "def multiple_devices?\n\ttrue if devices.size > 1\nend", "def get_sample_types\r\n # Check if sample belongs to new_record? line\r\n if self.line.new_record? || self.line.samples.count == 0\r\n worker_no = 0\r\n SAMPLE_CONFIG[worker_no]\r\n else\r\n prev_sample = Sample.previous_sample(self)\r\n worker_no = prev_sample.nil? ? 0 : prev_sample.worker.number\r\n worker_no <= 2 ? SAMPLE_CONFIG[worker_no] : SAMPLE_CONFIG[2]\r\n end\r\n end", "def long_planeteer_calls(calls)\n\tcalls.any? {|item| item.length > 4}\nend", "def throttled?\n publisher.throttled?\n end", "def win_checker\n @board.flatten.max == 16_384\n end", "def throttle?\n false\n end", "def is_sampler?(record)\n record['flow_sampler_id'] && record['flow_sampler_mode'] && record['flow_sampler_random_interval']\n end", "def double_faced?\n two_up? && mana_costs_shown.select(&:present?).count < 2\n end", "def sample_length_with_overflow(tick_sample_length)\n @tracks.keys.collect {|track_name| @tracks[track_name].sample_length_with_overflow(tick_sample_length) }.max || 0\n end", "def qcks_max_sink\n Quicksands[terrain_tag][:max_sink]\n end", "def full?\n self.length == CARDS.length\n end" ]
[ "0.6805013", "0.6023161", "0.60119516", "0.5923075", "0.5852646", "0.55729514", "0.55473334", "0.553898", "0.5516487", "0.55139816", "0.55040437", "0.54978764", "0.54508555", "0.54485685", "0.5437759", "0.5331331", "0.5317156", "0.5312962", "0.5294359", "0.5286079", "0.52782047", "0.5276549", "0.5265599", "0.52527505", "0.52493995", "0.5247751", "0.52298385", "0.521563", "0.5215255", "0.52083015", "0.52082795", "0.515644", "0.5156117", "0.5148691", "0.51446295", "0.5144399", "0.51400864", "0.51321757", "0.5131235", "0.5129668", "0.5127694", "0.5127694", "0.5125883", "0.5123965", "0.5115791", "0.5107334", "0.510552", "0.5100673", "0.5100308", "0.5096414", "0.50921214", "0.5080979", "0.5080037", "0.50783443", "0.5076727", "0.5070767", "0.50635326", "0.50589734", "0.5052409", "0.5048772", "0.5046038", "0.50424945", "0.50361365", "0.5033708", "0.50310683", "0.5025359", "0.50250316", "0.50192046", "0.5018713", "0.5016061", "0.50080115", "0.49893942", "0.49864975", "0.49862036", "0.49825957", "0.49818933", "0.49781495", "0.49734938", "0.49684015", "0.49684015", "0.49635506", "0.4955979", "0.49534872", "0.49524263", "0.49493682", "0.4942546", "0.49410826", "0.49410814", "0.49404922", "0.4939498", "0.49389035", "0.4935197", "0.49348962", "0.49325594", "0.49302167", "0.49247235", "0.49246415", "0.4924226", "0.4923347", "0.4917737" ]
0.6975403
0
Returns the index of the open tuner TODO: Refactor into Tuner object
def open_tuner tuners.times do |tuner| return tuner if current_recordings[tuner].nil? end nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_station_index\n current_station_index + 1\n end", "def current_station_index\n @route.stations.find_index(@current_station)\n end", "def index\n @raw_data[:FlightIndex].to_i\n end", "def idx\n @ob.get_idx\n end", "def ta_index\n end", "def index\n @raw_data[:FlightSegmentIndex].to_i\n end", "def index(dsp)\n FMOD.type?(dsp, Dsp)\n buffer = \"\\0\" * Fiddle::SIZEOF_INT\n FMOD.invoke(:ChannelGroup_GetDSPIndex, @channel, dsp, buffer)\n buffer.unpack1('l')\n end", "def station_index(station)\n stations.index(station)\n end", "def current_tranch_slot_index\n return nil unless @tranches && current_tranch\n\n current_tranch.find_index(nil)\n end", "def top_id\r\n (index - (index < @switch_max ? 0 : @switch_max)) * 10 + 1\r\n end", "def t(index, mode)\n mode == 0 ? @tape[index] : index\n end", "def index\n @av_stream[:index]\n end", "def get_shortcut index\n # Case where user has panned to the right columns:\n # Earlier, we showed '<' in left columns, if user has panned right.\n # Now we show unused shortcuts after exhausting them.\n # return '<' if index < @stact\n if index < @stact\n index = @vps - @stact + index\n i = IDX[index]\n return i if i\n\n return '['\n end\n\n # Normal case (user has not panned columns)\n index -= @stact\n i = IDX[index]\n return i if i\n\n '->'\nend", "def current_index\n @current_index = @current_route.stations.index(@current_station)\n end", "def ino\n volume_serial_number + index\n end", "def index\r\n @index ||= 0\r\n end", "def next_open_index(index)\n (index...(index + @size)).each do |i|\n if i >= @size\n i = i % @size\n end\n\n if @nodes[i] == nil\n return i\n end\n end\n\n return -1\n end", "def index\n @index ||= 1\n end", "def target_idx\n @target_idx\n end", "def get_index_of_cur_day\n\treturn $index_of_cur_day\nend", "def current_idx\n return @idx >= 0 ? @idx : nil\n end", "def index\n history = File.open(@current)\n line = history.readline.rstrip\n line =~ /(\\d+)$/ # get the index\n $1.to_i\n end", "def cur_index\n @opened ? @cur_record_index : nil\n end", "def index(p0) end", "def index(p0) end", "def index\r\n\t @imdb_ranking.to_i - 1\r\n\tend", "def index\r\n\t @imdb_ranking.to_i - 1\r\n\tend", "def variants_idx; end", "def index_for_time(t)\n LOCK.mu_synchronize {\n if t != @@index_time\n @@index = 0\n @@index_time = t\n end\n retval = @@index\n @@index += 1\n retval\n }\n end", "def machine_index\n @machine_index ||= env[:machine].env.machine_index\n end", "def get_index(i)\n i/BITS_PER_ITEM\n end", "def station_index(station, name)\r\n lines.each {|line, stations|\r\n if line == name\r\n stations.each_with_index {|x, index|\r\n if x == station.to_s\r\n return index\r\n end\r\n }\r\n end\r\n }\r\n end", "def first_savefile_index\r\n DataManager.latest_savefile_index\r\n end", "def experiment_no\r\n @db_client.scheme(\r\n database: series.database,\r\n measurement: series.measurement,\r\n tag: 'exn'\r\n ).last.to_i + 1\r\n end", "def pbFirstTarget(idxBattler,target_data)\r\n case target_data.id\r\n when :NearAlly\r\n @battle.eachSameSideBattler(idxBattler) do |b|\r\n next if b.index==idxBattler || [email protected]?(b,idxBattler)\r\n next if b.fainted?\r\n return b.index\r\n end\r\n @battle.eachSameSideBattler(idxBattler) do |b|\r\n next if b.index==idxBattler || [email protected]?(b,idxBattler)\r\n return b.index\r\n end\r\n when :NearFoe, :NearOther\r\n indices = @battle.pbGetOpposingIndicesInOrder(idxBattler)\r\n indices.each { |i| return i if @battle.nearBattlers?(i,idxBattler) && [email protected][i].fainted? }\r\n indices.each { |i| return i if @battle.nearBattlers?(i,idxBattler) }\r\n when :Foe, :Other\r\n indices = @battle.pbGetOpposingIndicesInOrder(idxBattler)\r\n indices.each { |i| return i if [email protected][i].fainted? }\r\n indices.each { |i| return i }\r\n end\r\n return idxBattler # Target the user initially\r\n end", "def track_number\n @ole.TrackNumber\n end", "def getChoiceNum(chooser, choice)\n num = 0\n chooser.getChoices.each_with_index do |option, i|\n if option.otExternalId == choice.otExternalId\n num = i + 1\n break\n end\n end\n num\n end", "def previous_station_index\n current_station_index - 1\n end", "def index_of( item )\n max = self.get_length\n counter = 1\n while( counter <= max )\n if( get(counter) == item)\n return counter\n end\n counter = counter + 1\n end\n return nil\n end", "def input_to_index(player_input)\n return player_input.to_i - 1\nend", "def channel_index\n return @channel_index\n end", "def stream_index\n data_config.index_name\n end", "def index\n project.pick_windows.index(self) + 1\n end", "def rank_of_kind\n KINDS.each_with_index do |kind, i|\n if kind == @kind\n return i\n end\n end\n raise \"kind not found: #{@kind}\"\n end", "def get_token_index\n raise NotImplementedError\n end", "def highlighted_tab_index\n @form.widgets.each_with_index{ |w, ix| \n return ix if w.state == :HIGHLIGHTED\n }\n return -1\n end", "def player_input_to_index(user_input)\n user_input.to_i - 1\nend", "def c0_index\n c0_r(0, 0)\n end", "def idx(input)\n @idx = input.to_i - 1\n end", "def play_order_index\n @ole.PlayOrderIndex\n end", "def first_savefile_index\r\n DataManager.last_savefile_index\r\n end", "def available_slot\n @threads.each_with_index do |thread, index|\n return index if thread.nil? or !thread.alive?\n end\n nil\n end", "def next_index(idx)\n idx = idx + 1\n idx = 0 if idx >= @connections.length\n idx\n end", "def to_player_number(symbol)\n PLAYER_SYMBOLS.index(symbol) + 1\n end", "def convert_key_to_index key\n i = IDX.index(key)\n return nil unless i\n\n # @log.debug \"get_index with #{key}: #{i}. #{@stact}. #{@vps}\"\n # TODO: if very high key given, consider going to last file ?\n # that way one can press zz or ZZ to go to last file.\n # 2019-04-11 - XXX actually this doesnt place the cursor on last file\n # it opens it, which may not be what we want\n retnil = nil # vps - 1 # nil\n # user has entered a key that is outside of range, return nil\n return retnil if @stact == 0 && i + @stact >= @vps\n\n # again, key out of range\n # return nil if @stact > 0 && i + @stact >= @vps && i + @stact - @vps >= @stact\n return retnil if @stact > 0 && i + @stact >= @vps && i - @vps >= 0\n\n # panning case, hints are recycled\n return (i + @stact) - @vps if i + @stact >= @vps\n\n # regular hint\n return i + @stact # if i\n\nend", "def pokemon_index(method_name, *args)\n index = $game_variables[Yuki::Var::Party_Menu_Sel].to_i\n index = party.send(method_name, *args) if index < 0\n return index\n end", "def index()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.Attempt_index(@handle.ptr)\n result\n end", "def instrument_to_index(instrument_type)\n case instrument_type\n when \"guitars\"\n 0\n when \"microphones\"\n 1\n when \"amps\"\n 2\n when \"drumkit\"\n 3\n when \"keyboard\"\n 4\n else\n puts \"next time, please choose one in this list: (guitars,microphones,amps,drumkit,keyboard)\"\n puts\n exit\n end\nend", "def get_available_num\n num = 1\n while @@songs.find { |s| s.num == num } do\n num += 1\n end\n\n num\n end", "def cycle_index\n stats[:cycle_index]\n end", "def cycle_index\n stats[:cycle_index]\n end", "def get_switch(index)\n\t\t\treturn @switches[index]\n\t\tend", "def number\n return suggested_play_order || identifier\n end", "def input_to_index(user_input)\n index = user_input.to_i - 1\n return index\n end", "def index\n @tunings = Tuning.all\n end", "def input_to_index(user_input)\n user_input.to_i - 1\n return index\nend", "def index ; @index ; end", "def input_to_index tato\n tato.to_i - 1\nend", "def cursor_to_decision\n @index = 89\n end", "def lttfindex\n end", "def input_to_index(input)\n return input.to_i - 1\n #idx = [inpu - 1]\n # return idx\nend", "def current_track_index\n reload\n @current_track_index\n end", "def rank_index\n RANKS.keys.index(@rank)\n end", "def pane_base_index\n @pane_base_index ||= begin\n global_setting = `tmux show-window-options -g | grep pane-base-index`.split(/\\s/).last\n local_setting = `tmux show-window-options | grep pane-base-index`.split(/\\s/).last\n (local_setting || global_setting || \"0\").to_i\n end\n end", "def index; @index; end", "def focussed_index\n @current_index # 2009-01-07 14:35 \n end", "def arp_hw; self[:arp_hw].to_i; end", "def opcode_int\n find_obj_for_name(:opcode)\n end", "def get_index(i)\n\t\tif (!@head || @size < i+1)then return false end\n\t\tcurrent = this.head\n\t\tcount = 0\n\t\twhile (count < i) #go to the index\n\t\t\tcurrent = current.get_next()\n\t\t\tcount+=1\n\t\tend\n\t\treturn current.get_item()\n\tend", "def get_answer_index\n (self.choices.index{|choice| choice[\"id\"] == self.answer.to_i}) + 1 \n end", "def instability_index\n @instability_index ||=\n begin\n instability_sum = 0.0\n i = 0\n while @seq[i+1] != nil\n aa, next_aa = [@seq[i].chr.to_sym, @seq[i+1].chr.to_sym]\n if DIWV.key?(aa) && DIWV[aa].key?(next_aa)\n instability_sum += DIWV[aa][next_aa]\n end\n i += 1\n end\n round((10.0/amino_acid_number.to_f) * instability_sum, 2)\n end\n end", "def conversation_index\n return @conversation_index\n end", "def ami_launch_index\n data[:ami_launch_index]\n end", "def input_to_index(user_input)\n index = user_input.to_i - 1\n end", "def input_to_index(user_input)\n index = user_input.to_i - 1\n end", "def length \n io_index.length\n end", "def current\n index\n end", "def input_to_index(input)\n index = input.to_i - 1\n end", "def input_to_index(input)\n index = input.to_i - 1\n end", "def input_to_index(input)\n index = input.to_i - 1\n end", "def selected_mode\n return @data[self.index]\n end", "def available_lot_number\n return 0 if @lots.empty? && @size > 0\n\n @lots.each_with_index do |lot, idx|\n return idx if lot.nil?\n end\n\n @lots.size < @size ? @lots.size : nil\n end", "def first_free_port\n disks.empty? ? 0 : disks.keys.min.first + 1\n end", "def input_to_index(user_input)\n index = (user_input.to_i - 1)\n end", "def tunings_index\n @malone_tuning_builders = vehicle_tunings\n session[:malone_tuning_builders] = @malone_tuning_builders \n end", "def upvotes_index\n self.get_upvotes.count\n end", "def index\n self.id.to_i - 1\n end", "def sw_temp\n return $game_switches[SW_TEMP]\nend", "def suit_index\n return nil unless self.suit\n SUITS.index(self.suit.downcase)\n end", "def fileno()\n #This is a stub, used for indexing\n end" ]
[ "0.56832534", "0.56785285", "0.560765", "0.55342", "0.5468247", "0.54665154", "0.5429857", "0.5406161", "0.5342045", "0.53382796", "0.5281057", "0.52750397", "0.5254027", "0.5243816", "0.5236542", "0.5223069", "0.5222817", "0.52183414", "0.52056897", "0.52022743", "0.51886666", "0.5169494", "0.5132722", "0.5128074", "0.5128074", "0.51070863", "0.51070863", "0.50827694", "0.5043012", "0.50387615", "0.502934", "0.5016563", "0.50018686", "0.50015664", "0.4997927", "0.4988699", "0.4986992", "0.49783292", "0.4968508", "0.49666995", "0.49528307", "0.49491513", "0.49416995", "0.49401468", "0.4922505", "0.49194714", "0.4914713", "0.49081728", "0.4906935", "0.48959744", "0.48844483", "0.48839954", "0.48772666", "0.48761734", "0.4875895", "0.48671696", "0.48655605", "0.48638743", "0.4852411", "0.48495823", "0.48495823", "0.4841813", "0.4835323", "0.48352036", "0.48293966", "0.48200133", "0.481344", "0.48119652", "0.48117536", "0.4803952", "0.47863132", "0.4777918", "0.47742748", "0.47689363", "0.47590134", "0.4759009", "0.47572383", "0.475719", "0.47526664", "0.47436038", "0.47322056", "0.4731415", "0.47291028", "0.4728132", "0.4728132", "0.47251025", "0.47233024", "0.47216594", "0.47216594", "0.47216594", "0.471894", "0.47171432", "0.4713552", "0.4710599", "0.4709538", "0.47011012", "0.47000653", "0.4695747", "0.46884805", "0.46849045" ]
0.7143693
0
NOTE: This makes approximations based on the FULL recording size of shows. Again, partial recordings will be approximated with there full size. The reason for this is because we will want to capture the entire show in subsequent recording attempts. We want that space to be reserved
def space_available used = 0 if recordings.any? used = recordings.map(&:full_size).reduce(:+) end total_space - used end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_size(show)\n print \"\\rcalculating size for #{show}\".ljust(120)\n size = directory_size \"#{PATH}/#{show}\"\n if SHOWS.include? show\n anime = SHOWS[show]\n anime.bytes += size\n else\n anime = Anime.new(show, size)\n RESULTS << anime\n SHOWS[anime.name] = anime\n end\nend", "def recordable?(recording)\n !!open_tuner && (recording.full_size < space_available)\n end", "def display_size\n # (1.9 ** @magnitude) / 3.0 + 2.5\n (2.15 ** @magnitude) / 3.6 + 2.5\n end", "def ffmpeg_resolution_and_padding_no_cropping(v_width, v_height)\n in_w = v_width.to_f\n in_h = v_height.to_f\n out_w = self.width.to_f\n out_h = self.height.to_f\n\n begin\n aspect = in_w / in_h\n aspect_inv = in_h / in_w\n rescue\n Rails.logger.error \"Couldn't do w/h to caculate aspect. Just using the output resolution now.\"\n @ffmpeg_resolution = \"#{self.width}x#{self.height}\"\n return \n end\n\n height = (out_w / aspect.to_f).to_i\n height -= 1 if height % 2 == 1\n\n @ffmpeg_resolution = \"#{self.width}x#{height}\"\n\n # Keep the video's original width if the height\n if height > out_h\n width = (out_h / aspect_inv.to_f).to_i\n width -= 1 if width % 2 == 1\n\n @ffmpeg_resolution = \"#{width}x#{self.height}\"\n self.width = width\n self.save(:validate => false)\n # Otherwise letterbox it\n elsif height < out_h\n pad = ((out_h - height.to_f) / 2.0).to_i\n pad -= 1 if pad % 2 == 1\n @ffmpeg_padding = \"-vf pad=#{self.width}:#{height + pad}:0:#{pad / 2}\"\n end\n end", "def trim_data\n self.angular_resolution = self.angular_resolution.round(3)\n self.magnitude = self.magnitude.round(3)\n end", "def recording_length(playbacks)\n # Looping through playbacks array and returning first non-zero length value\n playbacks.each do |playback|\n length = playback[:length]\n return recording_length_string(length) unless length.zero?\n end\n # Return '< 1 min' if length values are zero\n \"< 1 min\"\n end", "def tenth_frame; end", "def record(width, height, &rendering_code); end", "def visualize\n raise unless @track.ready?\n\n clear_tines\n\n tine_width = @width / @slice_count.to_f\n rms = RMS.new @slice_count\n buffer = @track.main_buffer\n rms_result = rms.apply buffer, @track.sample_rate, @track.channels\n max_tine_height = @height / 2\n\n @duration_per_tine = @track.duration / @slice_count\n @max_selectable_tine_count = (30.0 / @duration_per_tine).floor\n\n i = 0\n\n while i < @slice_count do\n if @track.channels == 1\n rms_height = rms_result[i][0] * max_tine_height\n above_the_line_height = rms_result[i][1].abs * max_tine_height\n # below_the_line_height = rms_result[i][2].abs * max_tine_height\n else\n rms_height = (\n (rms_result[i][0][1] + rms_result[i][0][1]) / 2\n ) * max_tine_height\n\n above_the_line_height = (\n (rms_result[i][1][0] + rms_result[i][1][1]) / 2\n ).abs * max_tine_height\n \n # below_the_line_height = (\n # (rms_result[i][2][0] + rms_result[i][2][1]) / 2\n # ).abs * max_tine_height\n end\n\n x = @x + i * tine_width\n\n midpoint = @y + max_tine_height\n\n @peak_tines << Rectangle.new(\n x: x,\n y: midpoint - above_the_line_height,\n width: tine_width,\n height: above_the_line_height * 2.0,\n color: \"black\",\n z: @z + 1\n )\n\n @rms_tines << Rectangle.new(\n x: x,\n y: midpoint - rms_height / 2,\n width: tine_width,\n height: rms_height,\n color: \"gray\",\n z: @z + 1\n )\n\n i += 1\n end\n\n set_track_offsets\n set_button_positions\n end", "def capture_size_before_cache(new_file) \n if model.image_width.nil? || model.image_height.nil?\n model.image_width, model.image_height = `identify -format \"%wx %h\" #{new_file.path}`.split(/x/).map { |dim| dim.to_i }\n end\n end", "def resize_and_save_space(resizing)\n { resize: resizing, quality: \"85%\", strip: true, interlace: \"Plane\" }\n end", "def trim_data\n @buffer.keys.each do |k| \n diff = @buffer[k].count - (1.0 * @scene_width / @x_mul).ceil.to_i\n @buffer[k] = @buffer[k].drop(diff) if diff > 0\n end\n end", "def truncate_samples\n @samples.sort!{|a,b| a.duration <=> b.duration}\n @samples.slice!(0..-(max_capacity + 1))\n end", "def size_estimation\n return sync { @last - @first + 1 }\n end", "def byte_rate\n Rational(size,duration)\n end", "def record_space\n used_space - header_space - directory_space - trailer_space\n end", "def measure; end", "def save_record_size\n File.open(File.join(@root + ['size']),'w+') do |f|\n Marshal.dump(@records_size,f)\n end\n end", "def size_range\n CARRIERWAVE_MAX_FILE_SIZE\n end", "def display_image \r\n self.image.variant(resize_to_limit: [1000, 1000]) \r\n end", "def max_memfrac\n @max_memfrac ||= 0.5\n end", "def applySizingValues\n\n maximum_flow_rate = self.autosizedMaximumFlowRate\n if maximum_flow_rate.is_initialized\n self.setMaximumFlowRate(maximum_flow_rate.get)\n end\n\n end", "def update_size\n @max_x = @glade['drawingarea'].allocation.width - 1\n @max_y = @glade['drawingarea'].allocation.height - 1\n @glade['xvalue'].set_range(1,@max_x)\n @glade['yvalue'].set_range(1,@max_y)\n end", "def do_window_adjust(bytes); end", "def local_window_size; end", "def display_height\n (display_width.to_f / width.to_f) * height\n end", "def display_height\n (display_width.to_f / width.to_f) * height\n end", "def display_height\n (display_width.to_f / width.to_f) * height\n end", "def current_size\n @multiplier ||= 1.0\n @multiplier *= 0.99\n [@multiplier, @multiplier]\n end", "def aliquot_media()\r\n reps = 1 # operations.collect {|op| op.input(PARAMETER_1).val.to_i} ### Will become a parameter that will allow for replicates flexablity\r\n media_vol = (operations.length * 1.1 * reps).round()\r\n \r\n # Aliquot media needed for experiment\r\n show do\r\n title \"Media preparation in media bay\"\r\n \r\n check \"Slowly shake the bottle of 800 mL SC liquid (sterile) media to make sure it is still sterile!!!\"\r\n check \"Aliquot #{media_vol}mLs of SC media in #{falcon(media_vol)} 50mL Falcon tubes.\"\r\n end\r\n end", "def show_full\n @show_full=true\n end", "def max_resolution; end", "def index\n @clips = Clip.all\n @size = 0.000\n @clips.each do |c|\n @size += c.video.byte_size\n @size += c.thumbnail.byte_size\n end\n end", "def fit_width; end", "def justify\n frame_count =\n if @table.to_sym == :front_table\n @rom.special_frames.fetch(@index, @rom.frames).first\n else\n @rom.special_frames.fetch(@index, @rom.frames).last\n end\n\n h = { lz77: false }\n target = frame_count * 64 * 64\n\n old_rep = @representation.dup\n if @representation.length < target\n @representation += old_rep until @representation.length >= target\n h = { lz77: true }\n elsif @representation.length > target\n @representation.slice!(0, target)\n h = { lz77: true }\n end\n\n clear_cache(h)\n end", "def pos_infimum\n pos_records +\n size_record_header +\n size_mum_record_header_additional\n end", "def space_per_record\n page_header.n_recs.positive? ? (record_space.to_f / page_header.n_recs) : 0\n end", "def current_size\n @multiplier ||= 2.0\n @multiplier *= 0.97\n [@multiplier, @multiplier]\n end", "def current_size\n @multiplier ||= 2.0\n @multiplier *= 0.97\n [@multiplier, @multiplier]\n end", "def current_size\n @multiplier ||= 2.0\n @multiplier *= 0.97\n [@multiplier, @multiplier]\n end", "def adapt_design_size \n hits = 0\n while space_factor < Constants::Min_allowed_factor and hits < 3\n if @vertical \n @height /= Constants::Shrink_factor\n @height += @height%20 == 0 ? 0 : 20-@height%20\n elsif not @vertical\n @width /= Constants::Shrink_factor\n @width += @width%20 == 0 ? 0 : 20-@width%20\n end\n composite_main_image_position\n generate_white_spaces\n white_space_area = white_space_w * white_space_h\n hits +=1\n end\n end", "def calculate_new_size(width, height)\n ratio = width.to_f / height.to_f\n target = Gnawrnip.max_frame_size\n\n return [width, height] if target > [width, height].max\n\n if ratio < 1\n new_width = target * ratio\n new_height = target\n else\n new_width = target\n new_height = target / ratio\n end\n\n [new_width, new_height]\n end", "def fit_to(len, fade_frames=250)\n meant_to_be = len\n self.dps.pop(dps.count- meant_to_be) if meant_to_be < dps.count\n while meant_to_be > dps.count # too short\n self.dps.push 0\n end\n # stop the annoying popping\n if dps.count > fade_frames\n fade_frames.times do |i|\n dps[dps.count-1-i] *= i.to_f / fade_frames\n end\n end\n self\nend", "def aspectratio\n if not @ratio then\n # Only calc the ratio the first time. Memoization!\n @ratio = Rational(@width, @height) # Ruby reduces fractions for us! How handy.\n end\n\n if @ratio == Rational(16, 10) # 16x10 is a special case, since we don't want it reduced down to 8x5\n return \"16x10\"\n else\n return \"#{@ratio.numerator}x#{@ratio.denominator}\" # Return the aspect ratio in WxH format\n end\n end", "def with_frames_as_fraction\n vp = value_parts.dup\n vp[-1] = (100.0 / @fps) * vp[-1]\n WITH_FRACTIONS_OF_SECOND % vp\n end", "def with_frames_as_fraction\n vp = value_parts.dup\n vp[-1] = (100.0 / @fps) * vp[-1]\n WITH_FRACTIONS_OF_SECOND % vp\n end", "def expected_data_size\n @signals.collect(&:samples_per_data_record).inject(:+).to_i * @number_of_data_records * SIZE_OF_SAMPLE_IN_BYTES\n end", "def resize_to_fill_and_save_dimensions(new_width, new_height)\n img = ::MiniMagick::Image.from_file(current_path)\n width, height = img['width'], img['height']\n \n resize_to_fill(new_width, new_height)\n \n w_ratio = width.to_f / new_width.to_f\n h_ratio = height.to_f / new_height.to_f\n \n ratio = [w_ratio, h_ratio].min\n \n model.send(\"#{mounted_as}_w=\", ratio * new_width)\n model.send(\"#{mounted_as}_h=\", ratio * new_height)\n model.send(\"#{mounted_as}_x=\", (width - model.send(\"#{mounted_as}_w\")) / 2)\n model.send(\"#{mounted_as}_y=\", (height - model.send(\"#{mounted_as}_h\")) / 2)\n end", "def totalMeters\n (self.floor_width*self.floor_length)\n end", "def update\n super\n refresh if @cw_data.include?(:playtime) && Graphics.frame_count / Graphics.frame_rate != @total_sec\n end", "def aspect_ratio_padding_bottom\n return false unless @aspect_ratio_container\n\n thumb = asset&.file(\"thumb_#{thumb_size}\")\n\n return nil unless thumb && thumb.width && thumb.height\n\n height_over_width = thumb.height.to_f / thumb.width.to_f\n\n \"#{(height_over_width * 100.0).truncate(1)}%\"\n end", "def size_d(floc)\n \"#{gene_d(floc)}/#{@win_size}\"\n\n end", "def diff\n if samples.count == 0\n self.capture\n end\n \n current = self.capture\n \n current.diff\n end", "def resize\n # TODO\n # if aray is 75% full, double the array and copy all items over\n end", "def aspect_ratio\n return 'none' unless fixed_ratio?\n dims = fullsize_settings[:dimensions]\n dims[0].to_f / dims[1]\n end", "def base_width; 24 + SKC_Settings::WIDTH; end", "def quality\n s = ( @step > 0 and semitones - (12 * @step) ) || semitones\n n = ( @step > 0 and number - (7 * @step) ) || number\n QUALITIES[n][s]\n end", "def show\n @recording = Recording.find_by_permalink(params[:id])\n @collectors = @recording.users\n @recording.revert_to(params[:version].to_i) if params[:version]\n add_crumb @recording.performance.compact_with_band + \" \" + @recording.recording_format + \" taped by \" + @recording.taper.name, @recording\n \n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @recording }\n end\n end", "def update_capture_rect\n @zoom = [100, @zoom].max\n tx, ty = @zoom_target_x, @zoom_target_y\n f = @zoom / 100.0\n w = (Graphics.width / f).to_i\n h = (Graphics.height / f).to_i\n x = (tx - w / 2.0).to_i.bound(0, Graphics.width - w)\n y = (ty - h / 2.0).to_i.bound(0, Graphics.height - h)\n @capture_rect.set(x, y, w, h)\n end", "def set_width_and_length\n footprint = @total_floor_area / num_stories.to_f\n @width = Math.sqrt(footprint / @ns_to_ew_ratio)\n @length = footprint / @width\n end", "def increase_bandwidth\n intervals = (time - @start_time) / @phase_length\n @bandwidth = (DEFAULT_STARTING_MAXIMUM_OPS_PER_SECOND * (1.5**intervals.floor)).to_f\n end", "def size_record_header\n case page_header[:format]\n when :compact\n RECORD_NEXT_SIZE + RECORD_COMPACT_BITS_SIZE\n when :redundant\n RECORD_NEXT_SIZE + RECORD_REDUNDANT_BITS_SIZE\n end\n end", "def post_sample_size\n 300\n end", "def spectrum size, frequency=1.0, keep_alive=2.0\n @spectrum_semaphore.synchronize do\n @spectrum_pending[[size, frequency, keep_alive]] << Thread.current\n end\n sleep\n @spectrum_buf[[size, frequency, keep_alive]][2]\n end", "def new_bitrate\n accepted_total_bitrate = ((FILESIZE_BOUND * 8 / movie.duration) / 1024).to_i\n # 90% to be safe\n ((accepted_total_bitrate - AUDIO_BITRATE) * 0.9).to_i\n end", "def size\n\t\t7500\n\tend", "def span\n measure\n @span\n end", "def getNextShow()\n #todo: implement priority checking\n #this query only grabs shows that should currently be recording\n #assume shows do not overlap, just the padded times overlap\n shows = Array.new\n now_showing = \"SELECT DATE_FORMAT(start, '#{DATE_TIME_FORMAT_XML}') as start, \n DATE_FORMAT(p.stop, '#{DATE_TIME_FORMAT_XML}') as stop, \n number, filename, p.xmlNode as xmlNode, channelID, priority\n FROM Scheduled s JOIN Channel USING (channelID)\n JOIN Programme p USING(channelID, start)\n WHERE start <= '#{PaddedTime.strstart}'\n AND p.stop > '#{PaddedTime.strstop}'\"\n \n databasequery(\"SELECT * FROM (#{now_showing}) as sub1\n WHERE priority = (SELECT max(priority) FROM (#{now_showing}) as sub2 )\").each_hash { |show_hash| \n shows << Show.new(show_hash['start'], \n show_hash['stop'], \n show_hash['number'], \n show_hash['xmlNode'], \n show_hash['filename'], \n show_hash['channelID'])\n }\n return nil if shows.length == 0\n if shows.length > 1\n #we have adjacent shows, or at least close enough so they overlap when padded\n shows.sort! {|a,b| a.starts_in <=> b.starts_in }\n (1...shows.length).each {|pos|\n shows[pos-1].unpad(shows[pos])\n }\n shows.delete_if { |show| show.notShowing }\n end\n #LOG.debug(\"The next show to record is #{shows[0].filename}\")\n shows[0]\nend", "def magnification\n 1300\n end", "def data_size\n size = 0\n @avi.process_movi do |indices, movi|\n size = movi.size\n [indices, movi]\n end\n size\n end", "def sample_size\n @n\n end", "def thumbnail(size); end", "def size_partial_page_header\n size_fil_header - 4 - 8 - 4\n end", "def display_image\n image.variant(resize_to_limit: [500,500])\n end", "def terminal_show spectrum\n print \"\\e[2J\\e[H\"\n puts \"Spectrum\"\n bucket = MIN_BUCKET\n max = 0\n spectrum.to_a[MIN_BUCKET, LINES*BUCKETS_PER_LINE].each_slice(BUCKETS_PER_LINE) do |a|\n sum = a.inject(0, :+)\n max = sum if max < sum\n @range = sum if @range < sum # Range down immediately or it's ugly\n freq = (bucket+BUCKETS_PER_LINE/0.5) * RESOLUTION\n bucket += BUCKETS_PER_LINE\n puts \"#{freq.to_i}\\t\" + (\"*\" * (sum * 50 / @range).to_i)\n end\n @range = max if max < @range/5 or max > @range # Auto-range up or down\n end", "def height; @video.height; end", "def sizes\n h_sizes = [@size]\n prog = @prog\n add_sizes = proc { h_sizes << h_sizes.last / prog.to_f**(1.0 / 48) }\n nb_notes = notes_range.to_a.size\n\n if @prog_change.nil?\n (nb_notes - 1).times(&add_sizes)\n elsif !@prog_change[:note].nil?\n nb_notes = (notes_range.min.succ..@prog_change[:note]).to_a.size\n nb_notes.times(&add_sizes)\n\n prog = @prog_change[:prog].to_f\n unless @prog_change[:size].nil?\n h_sizes.pop\n h_sizes << @prog_change[:size]\n end\n nb_notes = (@prog_change[:note].succ..notes_range.max).to_a.size\n nb_notes.times(&add_sizes)\n end\n h_sizes.map { |size| size.round(0) }\n end", "def meter_area(width, length)\n length * width\nend", "def show\n @recording = Recording.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "def size_mum_record\n 8\n end", "def resolution_mode\n {width: Highgui.get_property(@capture_handler, :width),\n height: Highgui.get_property(@capture_handler, :height)}\n end", "def size_to_fit(opts = { margin: 0 })\n subview_frame = self.frame_for_subviews\n self.frame = subview_frame\n\n # margin = opts[:margin]\n # self.add_margin margin\n\n # TODO reference point is unclear.\n\n self\n end", "def volume \n puts \"The volume is #{@length * @width * @height}\"\n end", "def max_shutter_speed; end", "def test_s38_Lots_of_empty_subviews\n W('s38a');\n\n p1 = Metakit::BytesProp.new(\"p1\");\n\n Metakit::Storage.open(\"s38a\", 1) {|s1|\n v = s1.get_as(\"v[v1[p1:S]]\");\n\n v.set_size(100000);\n s1.commit();\n }\n \n Metakit::Storage.open(\"s38a\", 1) {|s2|\n v2 = s2.view(\"v\");\n # // this should not materialize all the empty subviews\n v2.set_size(v2.get_size() + 1);\n # // nor should this\n s2.commit();\n }\n \n Metakit::Storage.open(\"s38a\", 1) {|s3|\n v3 = s3.view(\"v\");\n v3.remove_at(1, v3.get_size() - 2);\n assert_equal 2, v3.get_size\n s3.commit();\n }\n\n # D(s38a);\n R('s38a');\n end", "def aspect\n width / height\n end", "def measure\n\t\t1\n\tend", "def nclocks\n return @sig_waveforms[0][1].length\n end", "def volume\n @length * @width * @depth\n end", "def aspect_ratio\n height.to_f / width.to_f\n end", "def applySizingValues\n\n rated_flow_rate = self.autosizedRatedFlowRate\n if rated_flow_rate.is_initialized\n self.setRatedFlowRate(rated_flow_rate.get) \n end\n \n rated_power_consumption = self.autosizedRatedPowerConsumption\n if rated_power_consumption.is_initialized\n self.setRatedPowerConsumption(rated_power_consumption.get)\n end\n \n \n end", "def length; return @totalFrames; end", "def is_full()\n @current_size == @max_size\n end", "def is_full()\n @current_size == @max_size\n end", "def set_dimensions\n sign = get_sign\n if @character_anim == false || bat.anim_mode == :CHARSET\n if sign && sign.include?('$')\n @cw = bitmap.width / 3\n @ch = bitmap.height / 4\n else\n @cw = bitmap.width / 12\n @ch = bitmap.height / 8\n end\n @index_array = [0,1,2]\n return\n end\n w,h = @character.check_frame_pose_overrrides\n @cw = bitmap.width / w\n #Only GTBS mode needs all 4 directions of each stance, otherwise 1 row for ea.\n div = bat.anim_mode == :GTBS ? 4 : 1 \n @ch = ((bitmap.height / h) / div) \n update_frame_index_array #for changing bitmap\n end", "def store_dimensions\r\n if file && model\r\n model.width, model.height = `identify -format \"%wx%h\" #{file.path}`.split(/x/)\r\n end\r\n end", "def size\n ['o', 'k', 'G'].inject(super.to_f) do |s, unit|\n # recusively divide by 1024 until...\n if s.is_a?(Float) && s >= 1024\n s = s / 1024\n # we format it here with the unit\n elsif !s.is_a?(String)\n s = \"#{s.to_s.gsub(/(\\.\\d{3})\\d+$/, \"\\\\1\")} #{unit}\"\n end\n s\n end\n end", "def store_window2 #:nodoc:\n record = 0x023E # Record identifier\n length = 0x0012 # Number of bytes to follow\n\n grbit = 0x00B6 # Option flags\n rwTop = @first_row # Top visible row\n colLeft = @first_col # Leftmost visible column\n rgbHdr = 0x00000040 # Row/col heading, grid color\n\n wScaleSLV = 0x0000 # Zoom in page break preview\n wScaleNormal = 0x0000 # Zoom in normal view\n reserved = 0x00000000\n\n\n # The options flags that comprise $grbit\n fDspFmla = @display_formulas # 0 - bit\n fDspGrid = @screen_gridlines # 1\n fDspRwCol = @display_headers # 2\n fFrozen = @frozen # 3\n fDspZeros = @display_zeros # 4\n fDefaultHdr = 1 # 5\n fArabic = @display_arabic # 6\n fDspGuts = @outline_on # 7\n fFrozenNoSplit = @frozen_no_split # 0 - bit\n fSelected = @selected # 1\n fPaged = @active # 2\n fBreakPreview = 0 # 3\n\n grbit = fDspFmla\n grbit |= fDspGrid << 1\n grbit |= fDspRwCol << 2\n grbit |= fFrozen << 3\n grbit |= fDspZeros << 4\n grbit |= fDefaultHdr << 5\n grbit |= fArabic << 6\n grbit |= fDspGuts << 7\n grbit |= fFrozenNoSplit << 8\n grbit |= fSelected << 9\n grbit |= fPaged << 10\n grbit |= fBreakPreview << 11\n\n header = [record, length].pack(\"vv\")\n data =[grbit, rwTop, colLeft, rgbHdr, wScaleSLV, wScaleNormal, reserved].pack(\"vvvVvvV\")\n\n append(header, data)\n end", "def display_size\n s = self.body.size\n\n if s > 1024 * 1024\n return sprintf(\"%.1f\", s.to_f / 1024 / 1024) + 'M'\n else\n return (s / 1024).to_s + 'K'\n end\n end", "def new_dimensions_for(orig_width, orig_height)\n new_width = orig_width\n new_height = orig_height\n\n case @flag\n when :percent\n scale_x = @width.zero? ? 100 : @width\n scale_y = @height.zero? ? @width : @height\n new_width = scale_x.to_f * (orig_width.to_f / 100.0)\n new_height = scale_y.to_f * (orig_height.to_f / 100.0)\n when :<, :>, nil\n scale_factor =\n if new_width.zero? || new_height.zero?\n 1.0\n else\n if @width.nonzero? && @height.nonzero?\n [@width.to_f / new_width.to_f, @height.to_f / new_height.to_f].min\n else\n @width.nonzero? ? (@width.to_f / new_width.to_f) : (@height.to_f / new_height.to_f)\n end\n end\n new_width = scale_factor * new_width.to_f\n new_height = scale_factor * new_height.to_f\n new_width = orig_width if @flag && orig_width.send(@flag, new_width)\n new_height = orig_height if @flag && orig_height.send(@flag, new_height)\n when :aspect\n new_width = @width unless @width.nil?\n new_height = @height unless @height.nil?\n end\n\n [new_width, new_height].collect! { |v| v.round }\n end" ]
[ "0.5721383", "0.5679425", "0.56688285", "0.5471276", "0.538588", "0.538434", "0.5345573", "0.5277346", "0.5275411", "0.5185242", "0.51768583", "0.5158122", "0.511725", "0.5115435", "0.509348", "0.5045647", "0.5045476", "0.4993621", "0.49886242", "0.49798602", "0.4969885", "0.4955415", "0.49491784", "0.49458387", "0.49433056", "0.492376", "0.492376", "0.492376", "0.4920801", "0.49181074", "0.49171117", "0.49101657", "0.49084392", "0.49075475", "0.49071983", "0.48908895", "0.48765683", "0.48678234", "0.48678234", "0.48678234", "0.4867642", "0.4860511", "0.48578644", "0.48295942", "0.48180485", "0.48180485", "0.47992465", "0.47886127", "0.4778295", "0.47761273", "0.47638428", "0.4754448", "0.4751943", "0.47509295", "0.475039", "0.47448522", "0.47397643", "0.47325033", "0.4729253", "0.47288865", "0.47264296", "0.4712923", "0.47037947", "0.46950802", "0.46910447", "0.468911", "0.4684612", "0.46795678", "0.466773", "0.466578", "0.4665133", "0.46633983", "0.46619022", "0.46557385", "0.46529505", "0.4649287", "0.46454296", "0.4643677", "0.46429425", "0.46412548", "0.46398586", "0.46365964", "0.4635898", "0.46342692", "0.4633611", "0.4629246", "0.46248707", "0.4623301", "0.46227354", "0.46124595", "0.461056", "0.4607103", "0.46068454", "0.46068454", "0.46006638", "0.45988327", "0.4598424", "0.4592828", "0.4589691", "0.45866293" ]
0.51311576
12
Update receives new recordings It checks to see current recordings and free those up After, it attempts to start recording the array passed
def update(new_recordings = []) new_recordings ||= [] # if nil is passed check_recordings new_recordings.each { |recording| record recording } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_recordings\n tuners.times do |tuner|\n recording = current_recordings[tuner]\n\n next if recording.nil? || recording.recordable?\n\n stop_and_store_recording(recording)\n free_up_tuner(tuner)\n end\n end", "def refresh!\n records true\n self\n end", "def update_completeness\n RecordingCompleteness.update self\n end", "def calls2recordings_disabled\n #cdr2calls\n recs = Recording.find(:all, :conditions => \"call_id = '0'\")\n\n temp = []\n for rec in recs\n date_before = Time.at(rec.datetime.to_d-2).strftime(\"%Y-%m-%d %H:%M:%S\")\n date_after = Time.at(rec.datetime.to_d+2).strftime(\"%Y-%m-%d %H:%M:%S\")\n # my_debug date_before.to_s+date_after.to_s\n if call=Call.find(:first, :conditions => [\"src_device_id = ? AND dst_device_id = ? AND calldate BETWEEN ? AND ?\", rec.src_device_id, rec.dst_device_id, date_before, date_after])\n rec.call_id = call.id\n rec.save\n temp << call\n end\n end\n temp\n end", "def check_datapoints_buffer\n save_datapoints if datapoints.size >= @datapoint_buffer_size\n end", "def update_all records\n array = []\n records.each do |id, r|\n params = {}\n r.each do |k, v|\n params[k] = {value: v}\n end\n array.push({\n id: id,\n record: params\n })\n end\n puts \"update #{array.count} records...\"\n while array.present?\n a100 = array.shift(100)\n @api.records.update(@app_id, a100)\n end\n {}\n end", "def stop_recording_changes\n\t\t\t\t\t@track_changed_attributes = false\n\t\t\t\tend", "def waitlist_update(candidate_data)\n candidate_data.each do |element|\n events_candidates << element\n element.allot_batch!\n element.save\n end\n end", "def prepare_for_new_batch\n invoke_callback(:before_each_batch)\n\n new_rows.clear\n update_attrs.clear\n records.clear\n Thread.current[:existing_ids] = nil\n end", "def flush_check\n flush if @item_array.size >= BATCH_SIZE\n end", "def update_recording(record_id, meta)\n meta[:recordID] = record_id\n bbb_server.send_api_request(\"updateRecordings\", meta)\n end", "def record_modified\n i = 1\n render :update do |page| \n while params[\"rec#{i}\"]!=nil\n arate = params[\"rec#{i}\"][:aircraft_rate]\n hstart = params[\"rec#{i}\"][:hobbs_start]\n hend = params[\"rec#{i}\"][:hobbs_end]\n irate = params[\"rec#{i}\"][:instructor_rate] || 0\n if arate.nil? || arate=='' || hstart.nil? || hstart == '' || hend.nil? || hend=='' \n i=i+1\n next \n end \n charge = ((hend.to_f-hstart.to_f)%100) * (irate.to_f+arate.to_f)\n charge = (charge*100).round / 100.0\n page.send :record, \"$('charge_amount\"+i.to_s+\"').value='#{charge}'\" \n page.visual_effect :highlight , 'charge_amount'+i.to_s, {:restorecolor => \"'#ffffff'\"} \n i=i+1\n end\n end\n \nend", "def save_records\n @new_batch_flag = 0\n (@parser == 'wellsfargo' && type == \"CORRESP\") ? prepare_wellfargo_corresp_batch : prepare_batch\n if @bat\n if @inbound_file_information\n @bat.inbound_file_information = @inbound_file_information\n @bat.arrival_time = arr_time = @inbound_file_information.arrival_time\n set_batch_time @bat, arr_time\n end\n @job_condition = job_condition\n if @job_condition\n @img_count = 1\n do_bank_logics if type == 'PAYMENT' #Applying bank specific logic\n end\n images = call_parser_specific_method \"prepare_image\"\n images.each{|image| @bat.images_for_jobs << image}\n\n prepare_job\n @bat.jobs << @job if @job_condition\n images.each{|image| @job.images_for_jobs << image}\n @job.initial_image_name = @initial_image_name\n if @job_condition\n check = prepare_cheque\n if type == 'PAYMENT'\n micr = prepare_micr\n if micr\n payer = micr.payer\n check.payer_id = micr.payer_id if micr.payer_id\n if !facility.payer_ids_to_exclude.blank?\n @job.job_status = JobStatus::EXCLUDED if payer && payer.excluded?(facility)\n elsif !facility.payer_ids_to_include.blank?\n @job.job_status = JobStatus::EXCLUDED if !facility.included_payers.include?(payer)\n end\n micr.check_informations << check\n end\n end\n @job.check_informations << check\n end\n end\n\n if @bat.save\n @bat.update_attributes(:status => BatchStatus::NEW)\n if @job.save\n images.each do |image|\n# if image.save\n if image.image_file_name.upcase == @check_image.to_s.upcase\n save_image_types(\"CHK\",image)\n elsif ((image.image_file_name.upcase == @envelop_image.to_s.upcase) and (@job.job_status != JobStatus::EXCLUDED))\n save_image_types(\"ENV\",image)\n elsif ((@job.job_status == JobStatus::EXCLUDED) and (image.image_file_name.upcase != @check_image.to_s.upcase))\n save_image_types(\"OTH\",image)\n end\n total_number_of_images = number_of_pages(@job)\n check_number = check.check_number if !check.blank?\n estimated_eob = @job.estimated_no_of_eobs(total_number_of_images, micr, check_number)\n @job.update_attributes(:estimated_eob => estimated_eob, :pages_to => total_number_of_images)\n \n InputBatch::Log.status_log.info \"Image #{image.image_file_name}\n id #{image.id} batch id #{image.batch.id} job id #{image.jobs.first.id}\n successfully loaded\"\n puts \"Image #{image.image_file_name} successfully loaded\" if !image.size.blank?\n# else\n# raise \"Error on line #{@row_index} : Cannot load image #{image.image_file_name}\"\n# end\n end\n if @job_condition and check.save\n InputBatch::Log.status_log.info \"Check id #{check.id}, check_number\n #{check.check_number}, Job id #{check.job.id}, batch id #{check.job.batch.id}\n successfully loaded\"\n if micr and micr.save\n InputBatch::Log.status_log.info \"Check #{check.id} associated to micr\n #{check.micr_line_information.id}\"\n @job.save_payer_group(micr)\n end\n\n end\n else\n raise \"Error on line #{@row_index} : Cannot save job for batch #{@bat.batchid}\"\n end\n else\n raise \"Error on line #{@row_index} : Cannot save batch\"\n end\n \"#{@bat.date.strftime(\"%Y%m%d\")}_#{@bat.batchid}_SUPPLEMENTAL_OUTPUT\" rescue nil\n end", "def update\n mrts_qcksnd_update\n update_sinking\n end", "def update_remaining(table_type_instance)\n update_details table_type_instance.records_to_complete\n end", "def recording_on()\n update({:recording_enabled => true})\n reload()\n end", "def update_records\n # Get all line items include redone body and it's serial number.\n line_items = AxOrderLineItem.find(:all, :conditions => ['item_id = ? and sales_item_reservation_number <> ?', Product::REDONE_ERP_PRODUCT_ITEM, ''], :include => :ax_order)\n \n # Get all serial numbers from ax order line items.\n serial_numbers = line_items.map(&:serial_number).sort_by { |i| i.to_i }\n \n # Calc all new serial numbers.\n new_serial_numbers = serial_numbers - self.find(:all).map(&:serial_number)\n \n # Add new serial numbers to database.\n new_serial_numbers.each do |serial_number|\n line_item = line_items.find {|i| i.serial_number == serial_number}\n self.create(\n :ax_account_number => line_item.ax_account_number,\n :ax_account_id => line_item.ax_account_id,\n :ax_order_number => line_item.ax_order_number,\n :ax_order_id => line_item.ax_order_id,\n :email_address => line_item.email_address,\n :first_name => line_item.first_name,\n :last_name => line_item.last_name,\n :serial_number => line_item.serial_number,\n :purch_order_form_num => line_item.purch_order_form_num\n )\n end\n \n # Update exist but not sent records data up to date.\n self.find(:all, :conditions => ['sent_mail = ?', false]).each do |item|\n if line_item = line_items.find {|i| i.serial_number == item.serial_number}\n item.update_attributes(\n :ax_account_number => line_item.ax_account_number,\n :ax_account_id => line_item.ax_account_id,\n :ax_order_number => line_item.ax_order_number,\n :ax_order_id => line_item.ax_order_id,\n :email_address => line_item.email_address,\n :first_name => line_item.first_name,\n :last_name => line_item.last_name,\n :serial_number => line_item.serial_number,\n :purch_order_form_num => line_item.purch_order_form_num\n ) unless compare_equal?(item, line_item)\n end\n end\n end", "def add_to_buffer(records)\n @records_buffer.push(*records)\n end", "def final_update_record(record,jobacct)\n # do nothing\n end", "def recordOn()\n @record = true ;\n end", "def append_queue\n if free_space > 0 \n free_blocks.times { \n if already_read < current_track.file.size\n buffer_block current_track\n else\n # We've finished this track, on to the next one\n load_next_track\n return\n end\n }\n else\n #puts \"Buffer full\" \n end\n end", "def updated_data; end", "def flush\n @queued = {}\n end", "def run!\n loop do\n process next_record\n @monitor.periodically{|i| i }\n break if empty?\n end \n end", "def track_record_update\n true\n end", "def handle_put_request\n @request.records.each do |record|\n file = DataFile.storing(@request.uuid, record.time)\n file << record\n file.close\n end\n\n send_data [@request.record_count].pack('L')\n end", "def atomic_updates(*args)\n r = super(*args)\n if @records\n (r['$set'] ||= {})['records'] = serialize_records\n end\n r\n end", "def update_toon_create_ship_record(update_records)\n update_records.each do |r|\n payout = (r[4] - r[5]) * 0.65\n if WtShip.find_by_lossurl(r[0]) #unless there is an exact time match for a record, create a new record\n\t return false\n elsif self.created_at > r[3]\n return false\n else\n if self.bounty < payout\n payout = self.bounty\n self.bounty = 0\n self.active_bounty = 0\n self.save\n end\n \t ship_lost = wt_ships.create!(:lossurl => r[0], :ship_type => r[1], :solar_system => r[2], :eve_time_date => r[3], \n \t :isk_destroyed => r[4], :isk_dropped => r[5], :payout_amt => payout, :lost_to => r[6]\n \t\t\t) # Payout, ttl destroyed isk - isk dropped * 65%\n \t\t\t \t\t\t \n \t\t\tif r[7]\n \t\t\thero = EdenHero.find_or_initialize_by_character_id(r[7])\n \t\t\thero.name ||= r[6] \n \t\t\thero.earned_bounty_amt? ? hero.earned_bounty_amt += payout : hero.earned_bounty_amt = payout #can't add to nil\n \t\t\tif hero.save!\n \t\t\t info = [r, payout]\n \t\t\t AdminMailer.payout(r, payout).deliver\n \t\t\t else\n \t\t\t info = [r, payout]\n \t\t\t AdminMailer.error_mail(info).deliver\n \t\t\t end\n\t\t\t end\n end\n end\n end", "def updateRecords\n @temps = []\n # Super hacky and kind of a bad practice but its the best I could come up with for the time being\n temps_from_db = Temp.last(1152)\n temps_from_db.each do |record|\n if record.id % 47 == 0\n @temps << record\n end\n end\n\n render json: @temps\n end", "def process_updates\n time_from = @config.full_table ? Time.new(0) : @info.last_sent.in_time_zone\n time_to = Time.zone.now - @config.delay_time\n Deimos.config.logger.info(\"Polling #{log_identifier} from #{time_from} to #{time_to}\")\n status = PollStatus.new(0, 0, 0)\n first_batch = true\n\n # poll_query gets all the relevant data from the database, as defined\n # by the producer itself.\n loop do\n Deimos.config.logger.debug(\"Polling #{log_identifier}, batch #{status.current_batch}\")\n batch = fetch_results(time_from, time_to).to_a\n break if batch.empty?\n\n first_batch = false\n process_and_touch_info(batch, status)\n time_from = last_updated(batch.last)\n end\n\n # If there were no results at all, we update last_sent so that we still get a wait\n # before the next poll.\n @info.touch(:last_sent) if first_batch\n Deimos.config.logger.info(\"Poll #{log_identifier} complete at #{time_to} (#{status.report})\")\n end", "def update\n @trailer.changed_by = @user_full_name\n # update purchase order remaining weight less what is the weight on the trailer (tons)\n\n load_all_arrays\n\n\n respond_to do |format|\n # Calculate duration\n @date_component= Time.diff(@trailer.time_out, @trailer.time_in,'%y, %M, %w, %d and %h:%m:%s')\n @trailer.time_taken_number = @date_component[:diff].to_s\n if @trailer.purchaseorder_id == 0\n @prev_trailer_weight_lbs = -1 # case where PO was not previously assigned\n else\n @prev_trailer_weight_lbs = @trailer.weight_lbs\n end\n #puts \"wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\",@trailer.weight_lbs\n #@trailer.weight_tons = cvt_lbs_to_tons(@trailer.weight_lbs)\n\n if @trailer.update(trailer_params)\n format.html { redirect_to @trailer, notice: 'Trailer was successfully updated.' }\n format.json { render :show, status: :ok, location: @trailer }\n else\n format.html { render :edit }\n format.json { render json: @trailer.errors, status: :unprocessable_entity }\n end\n # update the PO remaing weight on the PO\n #puts\"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb update trailer purchase id\"\n #puts @trailer.purchaseorder_id.to_s\n\n update_po_remaining_lbs(@trailer.purchaseorder_id, @prev_trailer_weight_lbs)\n end\n end", "def clear!\n non_essential = records.all.reject { |r| [\"SOA\", \"NS\"].include? r.type }\n change = update [], non_essential\n change&.wait_until_done!\n end", "def initialize\n super\n @fbnr074p_records = []\n end", "def update_records(table_name, old_records, new_records)\n raise \"implement in subclass\"\n end", "def create_temp_holdings_for_processing(rec)\n # init_holdings is a hash of the parameters needed to create a\n # HoldingsRecord object.\n # Initially we set the first 4, which come from 999 92s\n init_holdings = {}\n occ = 0\n Traject::MarcExtractor.cached(\"999|92|\").each_matching_line(rec) do |field, spec, extractor|\n id = field['a']\n loc = field['b']\n next if loc.start_with?('e')\n ct = field['c']\n occ = occ += 1\n\n init_holdings[id] = [id, loc, ct, occ]\n end\n\n if init_holdings.length > 0\n # field_hash\n # key = holdings record id\n # value = array of MARC::DataFields created from 999 93s determined to\n # be relevant to subsequent display/processing\n field_hash = {}\n \n Traject::MarcExtractor.cached(\"999|93|\").each_matching_line(rec) do |field, spec, extractor|\n recid = field['0']\n\n df = new_data_field(field) if \n ( field['2'] == '852' && field['3'] == 'c' ) ||\n ( field['2'] =~ /85[345]/ && field['3'] == 'y' ) ||\n ( field['2'] =~ /86./ && field['3'] == 'h' )\n\n if df\n if field_hash.has_key?(recid)\n field_hash[recid] << df\n else\n field_hash[recid] = [df]\n end\n end\n end\n\n # field_hash values are appended to the relevant parameter array of init_holdings\n field_hash.each { |k, v| init_holdings[k] << v if init_holdings[k] }\n\n # create new HoldingsRecord object \n holdings_array = []\n init_holdings.each_value do |hdata|\n # if there are no relevant variable fields, we don't need to output holdings data\n if hdata.size == 5\n holdings_array << HoldingsRecord.new(hdata[0], hdata[1], hdata[2],\n hdata[3], hdata[4]) \n end\n end\n\n # make sure they are in ILS order\n return holdings_array.sort_by { |h| h.occ }\n end\n end", "def update!(**args)\n @ending_record_id = args[:ending_record_id] if args.key?(:ending_record_id)\n @starting_record_id = args[:starting_record_id] if args.key?(:starting_record_id)\n @write_timestamp_us = args[:write_timestamp_us] if args.key?(:write_timestamp_us)\n end", "def update_batch batch\n batch.file_name = @zip_file_name\n batch.arrival_time = arr_time = Time.now\n batch.facility_id = facility.id\n batch.client_id = facility.client_id\n set_batch_time batch, arr_time\n if batch.date.blank?\n batch.date = facility.index_file_parser_type.to_s.downcase == 'boa_bank'? @@batch_date : Date.today\n end\n batch.correspondence = true if type == 'CORRESP'\n if !@corresp_flag\n last_batch = Batch.find(:last, :conditions => [\"file_name = ? \", @zip_file_name])\n last_batch_corresp = Batch.find(:last, :conditions => [\"file_name = ? and correspondence = 'true'\", @zip_file_name])\n @index_condition = ((type == 'CORRESP' and (!(last_batch.nil?)) and (last_batch_corresp.nil?)) or (type == 'CORRESP' and (!(last_batch.nil?)) and !(last_batch_corresp.nil?) and (last_batch.id>last_batch_corresp.id)))\n batch.index_batch_number = @index_condition ? (last_batch.index_batch_number.to_i + 1) : 2\n end\n batch.lockbox = batch.lockbox.split('-').last if batch.lockbox\n return batch\n end", "def update\n respond_to do |format|\n if @recording.update(recording_params)\n @recording.update_attribute(:is_recorded, false)\n format.html { redirect_to @recording, notice: 'Recording was successfully updated.' }\n format.json { render :show, status: :ok, location: @recording }\n Sidekiq::ScheduledSet.new.select { |retri|\n retri.jid == @recording.job_id\n }.each(&:delete)\n job_id = RecordingWorker.perform_at(@recording.start_datetime, @recording.id)\n @recording.update_attribute(:job_id, job_id)\n\n else\n format.html { render :edit }\n format.json { render json: @recording.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @latest_recording_event = args[:latest_recording_event] if args.key?(:latest_recording_event)\n @owner_display_name = args[:owner_display_name] if args.key?(:owner_display_name)\n @producer_device_id = args[:producer_device_id] if args.key?(:producer_device_id)\n @recording_application_type = args[:recording_application_type] if args.key?(:recording_application_type)\n @recording_id = args[:recording_id] if args.key?(:recording_id)\n @recording_status = args[:recording_status] if args.key?(:recording_status)\n end", "def update_stored_data(t = Time.now.utc)\n stored_data.delete(stored_data_last_key) unless stored_data.keys.length == 1\n stored_data[t] = showback_event.data\n save\n end", "def records=(records)\n clear\n concat(records)\n end", "def batch_new\n @records = Array.new(BATCH_SIZE) { record_class.new }\n end", "def keep_data\n new_kept_data = kept << Hanami::Utils::Json.generate({ count: 0, data: _data })\n\n update_kept(new_kept_data)\n end", "def flush(now)\n if now || @entries.length > WATERMARK\n @entries.each do |e|\n if e.modified\n e.obj.save\n e.modified = false\n end\n end\n\n # Delete all but the first WATERMARK entry.\n @entries = @entries[0..WATERMARK - 1] if @entries.length > WATERMARK\n end\n end", "def after_recorded\n end", "def refresh\n @all = nil\n @player_hashes = nil\n self\n end", "def post_filter\n @records = records.select {|event| event[:delay] }\n end", "def update\n respond_to do |format|\n if @hardware.update(hardware_params)\n format.html { redirect_to @hardware, notice: 'Hardware was successfully updated.' }\n format.json { render :show, status: :ok, location: @hardware }\n else\n format.html { render :edit }\n format.json { render json: @hardware.errors, status: :unprocessable_entity }\n end\n end\n \n \n ###### new starts\n @trackingsheetlog=Trackingsheetlog.where('trackingsheet_id'=>@hardware.trackingsheet.id,\"sessionid\"=>session[:session_id],\"tabname\"=>VendorPortal::Application.config.hardware) \n \n \n if @trackingsheetlog.count== 0\n @trackingsheetlog = Trackingsheetlog.new(\"trackingsheet_id\"=>@hardware.trackingsheet.id,\"useremail\"=>current_user.email,\"sessionid\"=>session[:session_id],\"tabname\"=>VendorPortal::Application.config.hardware)\n @trackingsheetlog.save\nelse\n @trackingsheetlog.each do |tslog|\n @trackingsheetlogobj=Trackingsheetlog.find(tslog.id)\n @trackingsheetlogobj.update_attributes(:trackingsheet_id=>@hardware.trackingsheet.id,:useremail=>current_user.email,:sessionid=>session[:session_id],:updated_at=>DateTime.now,:tabname=>VendorPortal::Application.config.hardware)\nbreak\n end \n \n end \n \n ##### new ends\n \n \n \n end", "def update_associated_records\n self.invoice_details.each do |d|\n if d.record_type > InvoiceDetail::FEE && d.record_type <= InvoiceDetail::SETUP\n #get the associated record\n @obj = d.idetailable_type.classify.constantize.find(d.idetailable_id)\n if d.disposition == InvoiceDetail::INCLUDE || d.disposition == InvoiceDetail::WAIVE\n @obj.update_attributes(:invoice_id => self.id, :skip_callbacks => true)\n elsif @obj.invoice_id == self.id\n # the record is to be skipped. If the record was invoiced under this invoice\n # then we want to set the invoice flag to false so it is picked up in future invoices\n @obj.update_attributes(:invoiced => false, :invoice_id => nil, :skip_callbacks => true)\n end\n end\n end # end loop\n end", "def recording_off()\n update({:recording_enabled => false})\n reload()\n end", "def append_records\n # counter is a array type container hold numbers of AxOrder instance.\n # current AxOrder instance by manipulate is last member of container.\n counter = []\n begin\n if counter.empty?\n counter << new(:ax_order_number => next_ax_order_number)\n else\n counter << new(:ax_order_number => next_ax_order_number(counter.last.ax_order_number))\n end\n\n order, items = counter.last.fetch_data\n counter.last.attributes = order\n items.each do |item|\n counter.last.ax_order_line_items << AxOrderLineItem.new(item)\n end\n counter.each {|o| o.save }\n append_records # recursive invoke method self\n rescue => ex\n puts ex.message if AppConfig.DEBUG_MODE\n retry unless counter.size == MAX_COUNTER\n end\n end", "def flush\n flush_field\n flushed_fields = record_fields\n initialize\n flushed_fields\n end", "def update!(**args)\n @record = args[:record] if args.key?(:record)\n end", "def record_delete(record)\n # assign picked record PID to variable\n record_pid = $wtmp_entries[record][\"pid\"]\n # Search through each entry in $wtmp_entries array\n $wtmp_entries.reverse.each do |entry|\n # Looks for records with the same PID\n if entry[\"pid\"] == record_pid\n $wtmp_delete.push(entry) # Adds to deleted array - Exists for validation\n $wtmp_entries.delete(entry) # Removes from entry array\n end\n end\nend", "def force_flush\n snapshot = lock { spans.shift(spans.size) }\n until snapshot.empty?\n batch = snapshot.shift(@batch_size).map!(&:to_span_data)\n result_code = @exporter.export(batch)\n report_result(result_code, batch)\n end\n end", "def drop_records\n @registration_count = Registration.dump_records\n @payment_count = Payment.dump_records\n sleep(5)\n end", "def updateDaMeter\n @start = 0\n\n if @account_complete == 1\n @start += 1\n end\n\n if @verify_complete == 1\n @start += 1\n end\n\n if @deposit_complete == 1\n @start += 1\n end\n\n if @communication_complete == 1\n @start += 1\n end\n\n if @immunization_complete == 1\n @start += 1\n end\n\n if @residency_complete == 1\n @start += 1\n end\n\n if @finaid_complete == 1\n @start += 1\n end\n\n if @housing_fee_complete == 1\n @start += 1\n end\n\n if @aleks_complete == 1\n @start += 1\n end\n\n if @orientation_complete == 1\n @start += 1\n end\n\n if @learning_comm_complete == 1\n @start += 1\n end\n\n if @oars_complete == 1\n @start += 1\n end\n\n if @reg_complete == 1\n @start += 1\n end\n\n if @tuition_complete == 1\n @start += 1\n end\n\n if @emergency_complete == 1\n @start += 1\n end\n\n if @fau_alert_complete == 1\n @start += 1\n end\n\n end", "def record(&blk)\n start_recording\n blk.call\n ensure\n stop_recording\n end", "def start record\n self.size = 0\n end", "def sweep_inactive_records!\n refresh_state = set_sweeping_started!\n\n sweep_scope_refresh_state = if sweep_scope.kind_of?(Array)\n sweep_scope\n elsif sweep_scope.kind_of?(Hash)\n sweep_scope.map {|k, v| [k, v.size]}\n end\n update(\n refresh_state,\n :status => :waiting_for_refresh_state_parts,\n :total_parts => total_parts,\n :sweep_scope => sweep_scope_refresh_state\n )\n\n if total_parts == refresh_state.refresh_state_parts.count\n start_sweeping!(refresh_state)\n else\n wait_for_sweeping!(refresh_state)\n end\n rescue StandardError => e\n update(refresh_state, :status => :error, :error_message => \"Error while sweeping: #{e.message.truncate(150)}\")\n\n raise(e)\n end", "def update_batch batch\n batch.file_name = @zip_file_name\n batch.arrival_time = Time.now\n batch.facility_id = facility.id\n batch.client_id = facility.client_id\n batch.contracted_time = (Time.now + facility.tat.to_i.hours)\n batch.target_time = (Time.now + facility.tat.to_i.hours)\n batch.date = Date.today if batch.date.blank?\n batch.bank_deposit_date = Date.today if batch.bank_deposit_date.blank?\n batch.correspondence = true if type == 'CORRESP'\n return batch\n end", "def update_batch batch\n batch.file_name = @zip_file_name\n batch.arrival_time = Time.now\n batch.facility_id = facility.id\n batch.client_id = facility.client_id\n batch.contracted_time = (Time.now + facility.tat.to_i.hours)\n batch.target_time = (Time.now + facility.tat.to_i.hours)\n batch.date = Date.today if batch.date.blank?\n batch.bank_deposit_date = Date.today if batch.bank_deposit_date.blank?\n batch.correspondence = true if type == 'CORRESP'\n return batch\n end", "def update_batch batch\n batch.file_name = @zip_file_name\n batch.arrival_time = Time.now\n batch.facility_id = facility.id\n batch.client_id = facility.client_id\n batch.contracted_time = (Time.now + facility.tat.to_i.hours)\n batch.target_time = (Time.now + facility.tat.to_i.hours)\n batch.date = Date.today if batch.date.blank?\n batch.bank_deposit_date = Date.today if batch.bank_deposit_date.blank?\n batch.correspondence = true if type == 'CORRESP'\n return batch\n end", "def updated_data\n\tend", "def flush rec, next_id, tick\n ## if threshold etc.\n db.transaction do\n while rec\n n = db[:tuples].filter(id: rec.id).update(count: rec.count)\n if n == 0\n db[:tuples].insert(id: rec.id, count: rec.count, packed: rec.packed)\n end\n rec.unmark_to_save\n rec = rec.next_rec_to_save\n end\n db[:global].update(next_id: next_id, tick: tick)\n end\n ## rescue ???\n end", "def accumulate record\n end", "def update\n recording = Recording.find(params[:id])\n recording.update(recordings_params(:name, :active))\n redirect_to users_active_recordings(current_user)\n end", "def save_records\n @job_condition = job_condition\n find_type\n prepare_batch\n\n if @batch\n @image_count = 1 if @job_condition\n @batch.inbound_file_information = @inbound_file_information if @inbound_file_information\n\n images = prepare_image\n images.each{|image| @batch.images_for_jobs << image}\n\n prepare_job\n @batch.jobs << @job if @job_condition\n images.each{|image| @job.images_for_jobs << image}\n\n if @job_condition\n check = prepare_cheque\n @job.check_number = '0' if check.check_amount == 0.0\n @job.check_informations << check\n @job.initial_image_name = @initial_image_name\n micr = prepare_micr\n if micr\n payer = micr.payer\n check.payer_id = micr.payer_id if micr.payer_id\n if !facility.payer_ids_to_exclude.blank?\n @job.job_status = JobStatus::EXCLUDED if payer && payer.excluded?(facility)\n elsif !facility.payer_ids_to_include.blank?\n @job.job_status = JobStatus::EXCLUDED if !facility.included_payers.include?(payer)\n end\n micr.check_informations << check\n end\n end\n \n if @batch.save\n if @job.save\n images.each do |image|\n if image.save\n InputBatch.log.debug \"Image #{image.filename} id #{image.id} batch id #{image.batch.id} job id #{image.jobs.first.id} successfully loaded\"\n puts \"Image #{image.filename} successfully loaded\"\n end\n end\n\n total_number_of_images = number_of_pages(@job)\n check_number = check.check_number if !check.blank?\n estimated_eob = @job.estimated_no_of_eobs(total_number_of_images, micr, check_number)\n @job.update_attributes(:estimated_eob => estimated_eob, :pages_to => total_number_of_images)\n\n if @job_condition and check.save\n InputBatch.log.debug \"Check id #{check.id}, check_number #{check.check_number}, Job id #{check.job.id}, batch id #{check.job.batch.id} successfully loaded\"\n if micr and micr.save\n InputBatch.log.debug \"Check #{check.id} associated to micr #{check.micr_line_information.id}\"\n @job.save_payer_group(micr)\n end\n end\n end\n end\n end\n end", "def update_serial\n unless Record.batch_soa_updates.nil? \n if Record.batch_soa_updates.include?( self.id )\n return\n end\n \n Record.batch_soa_updates << self.id\n end\n \n @serial_updated = true\n\n date_segment = Time.now.strftime( \"%Y%m%d\" )\n\n # Same day change?\n increment = if date_segment == self.serial.to_s[0,8]\n increment = self.serial.to_s[8,2].succ\n else\n \"01\"\n end\n\n self.serial = ( date_segment + increment[-2,2] ).to_i\n \n end", "def reset_metrics_buffer\n @@metrics_buffer = []\n end", "def upload_records(&block)\n count = input.upload_records(&block)\n self.record_count = (record_count || 0) + count\n count\n end", "def update_if_necessary\n # we should have a counter stat already if it got to this class\n # only update stats if it's after the date of the last updated date for record\n return unless new_record? || updated_at.nil? || Time.new.localtime.to_date > updated_at.localtime.to_date\n update_usage!\n update_citation_count!\n\n self.updated_at = Time.new # seem to need this for some reason\n\n save!\n end", "def flush_updates\n @updated_keys.each { |k| queue.update(k) }\n @updated_keys.clear\n end", "def sync_and_delete_unmarked!(records, records_within_scope)\n log('Starting sync loop...')\n records.each_with_index do |record, index|\n @syncer.validate_mark_and_sync!(record)\n log(\"synced #{index} rows.\") if index % @log_frequency == 0\n end\n log('Done sync loop.')\n\n log('Calling #delete_unmarked_records...')\n @syncer.delete_unmarked_records!(records_within_scope)\n log(\"Syncing stats: #{@syncer.stats}\")\n nil\n end", "def refresh!\n update_attributes(\n books: update_data,\n books_count: update_data.length\n )\n end", "def update() end", "def publish_record(record)\n subscribers = Hyperloop.redis_instance.hgetall(\"HRPS__#{record.class}__#{record.id}\")\n time_now = Time.now.to_f\n scrub_time = time_now - 24.hours.to_f\n\n message = {\n record_type: record.class.to_s,\n id: record.id,\n updated_at: record.updated_at\n }\n message[:destroyed] = true if record.destroyed?\n\n Rails.logger.debug \"&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&\"\n\n Rails.logger.debug \"========================================== SUBSCRIBERS ================ #{subscribers}\"\n Rails.logger.debug \"=========================================== SUBSCRIBERS SIZE =============== #{subscribers.size}\"\n\n\n # can only trigger to max 10 channels at once on pusher\n subscribers.each_slice(10) do |slice|\n Rails.logger.debug \"========================================================== EACH SLICE !\"\n Rails.logger.debug \"=============================================SLICE============= #{slice}\"\n Rails.logger.debug \"=============================================SLICE SIZE============= #{slice.size}\"\n channel_array = []\n slice.each do |session_id, last_requested|\n\n if last_requested.to_f < scrub_time\n Hyperloop.redis_instance.hdel(\"HRPS__#{record.class}__#{record.id}\", session_id)\n next\n end\n Rails.logger.debug \"========================================================== SESSION ID : #{session_id} !\"\n Rails.logger.debug \"========================================================== RECORD CLASS : #{record.class} !\"\n Rails.logger.debug \"========================================================== RECORD ID : #{record.id} !\"\n channel_array << \"hyper-record-update-channel-#{session_id}\"\n end\n Rails.logger.debug \"========================================================== CHANNEL ARRAY #{channel_array} !\"\n\n if channel_array.size > 0\n if Hyperloop.resource_transport == :pusher\n _pusher_client.trigger_async(channel_array, 'update', message)\n Rails.logger.debug \"========================================================== PUSHER #{channel_array} !\"\n\n elsif Hyperloop.resource_transport == :action_cable\n channel_array.each do |channel|\n Rails.logger.debug \"========================================================== BROADCAST #{channel} !\"\n\n ActionCable.server.broadcast(channel, message)\n end\n end\n end\n\n end\n Hyperloop.redis_instance.del(\"HRPS__#{record.class}__#{record.id}\") if record.destroyed?\n end", "def update\n respond_to do |format|\n if @component.update(component_params)\n format.html { redirect_to @component, notice: 'Component was successfully updated.' }\n format.json { render :show, status: :ok, location: @component }\n else\n format.html { render :edit }\n format.json { render json: @component.errors, status: :unprocessable_entity }\n end\n end\n ###### new starts\n @trackingsheetlog=Trackingsheetlog.where('trackingsheet_id'=>@component.trackingsheet.id,\"sessionid\"=>session[:session_id],\"tabname\"=>VendorPortal::Application.config.components) \n \n \n if @trackingsheetlog.count== 0\n @trackingsheetlog = Trackingsheetlog.new(\"trackingsheet_id\"=>@component.trackingsheet.id,\"useremail\"=>current_user.email,\"sessionid\"=>session[:session_id],\"tabname\"=>VendorPortal::Application.config.components)\n @trackingsheetlog.save\nelse\n @trackingsheetlog.each do |tslog|\n @trackingsheetlogobj=Trackingsheetlog.find(tslog.id)\n @trackingsheetlogobj.update_attributes(:trackingsheet_id=>@component.trackingsheet.id,:useremail=>current_user.email,:sessionid=>session[:session_id],:updated_at=>DateTime.now,:tabname=>VendorPortal::Application.config.components)\nbreak\n end \n \n end \n \n ##### new ends \n \n end", "def update_initial_data\n user.hand.cards = []\n dealer.hand.cards = []\n user.hand.total_score = 0\n dealer.hand.total_score = 0\n self.stop = false\n end", "def run_once(send_twice: false)\n num_streamed = 0\n\n # Need at least repeatable read isolation level so that our DELETE after\n # enqueueing will see the same records as the original SELECT.\n DB.transaction(isolation_level: :repeatable_read) do\n records = StagedLogRecord.order(:id).limit(BATCH_SIZE)\n\n unless records.empty?\n RDB.multi do\n records.each do |record|\n stream(record.data)\n num_streamed += 1\n\n # simulate a double-send by adding the same record again\n if send_twice\n stream(record.data)\n num_streamed += 1\n end\n\n $stdout.puts \"Enqueued record: #{record.action} #{record.object} #{record.id}\"\n end\n end\n\n StagedLogRecord.where(Sequel.lit(\"id <= ?\", records.last.id)).delete\n end\n end\n\n num_streamed\n end", "def flush_field\n (record_fields[current_field] ||= []) << current_value if current_field && current_value.to_s.match?(/[^\\s]/)\n @current_field = nil\n @current_value = nil\n end", "def adjust_after_update\n # The record is in @record, do what you will, this precedes a save.\n end", "def save_output_payid\r\n if !params[:fac_payer_info_ids_to_delete_for_output_payid].blank?\r\n ids_to_delete = params[:fac_payer_info_ids_to_delete_for_output_payid].split(',')\r\n ids_to_delete.each do |id|\r\n facility_payers_info = FacilitiesPayersInformation.find(id)\r\n if facility_payers_info.in_patient_payment_code.blank? &&\r\n facility_payers_info.out_patient_payment_code.blank? &&\r\n facility_payers_info.in_patient_allowance_code.blank? &&\r\n facility_payers_info.out_patient_allowance_code.blank? &&\r\n facility_payers_info.capitation_code.blank?\r\n FacilitiesPayersInformation.destroy(id)\r\n else\r\n facility_payers_info.update_attribute(\"output_payid\", nil)\r\n end\r\n end\r\n end\r\n\r\n facilities_payers_information = params[:facilities_payers_information]\r\n if !facilities_payers_information.blank? \r\n serial_numbers_added = params[:serial_numbers_for_adding_output_payid]\r\n if !serial_numbers_added.blank? && [email protected]?\r\n new_records = []\r\n serial_numbers_added = serial_numbers_added.split(',')\r\n\r\n serial_numbers_added.each do |serial_number|\r\n if !serial_number.blank?\r\n client_id = format_ui_param(params[:facilities_payers_information][\"client_id#{serial_number}\"])\r\n facility_id = format_ui_param(params[:facilities_payers_information][\"facility_id#{serial_number}\"])\r\n output_payid = format_ui_param(params[:facilities_payers_information][\"output_payid#{serial_number}\"])\r\n\r\n if !output_payid.blank?\r\n output_payid = output_payid.strip\r\n new_record = FacilitiesPayersInformation.initialize_or_update_if_found(@payer.id, client_id, facility_id, output_payid)\r\n new_records << new_record if !new_record.blank?\r\n end\r\n end\r\n end\r\n FacilitiesPayersInformation.import new_records if !new_records.blank?\r\n end \r\n end\r\n end", "def update\n puts \"hey, we're updating.\"\n\n scan_procedure_array = []\n scan_procedure_array = (current_user.edit_low_scan_procedure_array).split(' ').map(&:to_i)\n hide_date_flag_array = []\n hide_date_flag_array = (current_user.hide_date_flag_array).split(' ').map(&:to_i)\n @hide_page_flag = 'N'\n if hide_date_flag_array.count > 0\n @hide_page_flag = 'Y'\n end\n\n @lumbarpuncture = Lumbarpuncture.where(\"lumbarpunctures.appointment_id in (select appointments.id from appointments,scan_procedures_vgroups where \n appointments.vgroup_id = scan_procedures_vgroups.vgroup_id \n and scan_procedure_id in (?))\", scan_procedure_array).find(lumbarpuncture_params[:lumbarpuncture][:id])\n\n\n\n # puts \"lp date params: #{lumbarpuncture_params[:date]}\"\n appointment_date = nil\n if !lumbarpuncture_params[:appointment][\"#{'appointment_date'}(1i)\"].blank? && !lumbarpuncture_params[:appointment][\"#{'appointment_date'}(2i)\"].blank? && !lumbarpuncture_params[:appointment][\"#{'appointment_date'}(3i)\"].blank?\n appointment_date = params[:appointment][\"#{'appointment_date'}(1i)\"] +\"-\"+lumbarpuncture_params[:appointment][\"#{'appointment_date'}(2i)\"].rjust(2,\"0\")+\"-\"+lumbarpuncture_params[:appointment][\"#{'appointment_date'}(3i)\"].rjust(2,\"0\")\n end\n \n # ok to update vitals even if other update fail\n if !vitals_params[:vital_id].blank?\n @vital = Vital.find(vitals_params[:vital_id])\n @vital.pulse = vitals_params[:pulse]\n @vital.bp_systol = vitals_params[:bp_systol]\n @vital.bp_diastol = vitals_params[:bp_diastol]\n @vital.bloodglucose = vitals_params[:bloodglucose]\n @vital.save\n else\n @vital = Vital.new\n @vital.appointment_id = @lumbarpuncture.appointment_id\n @vital.pulse = vitals_params[:pulse]\n @vital.bp_systol = vitals_params[:bp_systol]\n @vital.bp_diastol = vitals_params[:bp_diastol]\n @vital.bloodglucose = vitals_params[:bloodglucose]\n @vital.save \n end\n \n if !lumbarpuncture_params[:lookup_lumbarpuncture_id].blank?\n LookupLumbarpuncture.all.each do |lookup_lp|\n val = nil\n val = lumbarpuncture_params[:lookup_lumbarpuncture_id][lookup_lp.id.to_s].to_s\n if val.blank?\n val = \"0\" # not sure why \"\" not going to 0\n end\n sql = \"INSERT INTO lumbarpuncture_results (lumbarpuncture_id,lookup_lumbarpuncture_id,value) VALUES (\"[email protected]_s+\",\"+lookup_lp.id.to_s+\",'\"+val+\"')\n ON DUPLICATE KEY UPDATE value='\"+val+\"' \"\n ActiveRecord::Base.connection.insert sql\n \n # insert or update?\n end\n else\n # update to null or delete?\n end\n\n lp_params = lumbarpuncture_params[:lumbarpuncture]\n\n lp_params[:lpstarttime_time]= \"#{lumbarpuncture_params[:time_fields][:lpstarttime_time][:hour].to_s.rjust(2,'0')}:#{lumbarpuncture_params[:time_fields][:lpstarttime_time][:minute].to_s.rjust(2,'0')}\"\n lp_params[:lpfluidstarttime_time]= \"#{lumbarpuncture_params[:time_fields][:lpfluidstarttime_time][:hour].to_s.rjust(2,'0')}:#{lumbarpuncture_params[:time_fields][:lpfluidstarttime_time][:minute].to_s.rjust(2,'0')}\"\n lp_params[:lpendtime_time]= \"#{lumbarpuncture_params[:time_fields][:lpendtime_time][:hour].to_s.rjust(2,'0')}:#{lumbarpuncture_params[:time_fields][:lpendtime_time][:minute].to_s.rjust(2,'0')}\"\n\n # puts \"final params: #{lp_params}\"\n\n respond_to do |format|\n\n if @lumbarpuncture.update(lp_params)#params[:lumbarpuncture], :without_protection => true)\n \n @appointment = Appointment.find(@lumbarpuncture.appointment_id)\n @vgroup = Vgroup.find(@appointment.vgroup_id)\n @appointment.comment = params[:appointment][:comment]\n if !params[:appointment].nil? and !params[:appointment][:appointment_coordinator].nil?\n @appointment.appointment_coordinator = params[:appointment][:appointment_coordinator]\n end\n @appointment.appointment_date =appointment_date\n if [email protected]_id.blank?\n @participant = Participant.find(@vgroup.participant_id)\n if [email protected]?\n @appointment.age_at_appointment = ((@appointment.appointment_date - @participant.dob)/365.25).round(2)\n end\n end\n @appointment.save\n @vgroup.completedlumbarpuncture = 'yes'\n @vgroup.save\n \n \n\n format.html { redirect_to(@lumbarpuncture, :notice => 'Lumbarpuncture was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lumbarpuncture.errors, :status => :unprocessable_entity }\n end\n end\n end", "def 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 update_queue (array, movie)\n array.push(movie)\nend", "def update(rec)\n if ( !rec.fields[\"phone\"].nil? && @phone.index(rec.fields[\"phone\"]).nil? )\n @phone << rec.fields[\"phone\"]\n end\n \n if ( !rec.fields[\"fax\"].nil? && @fax.index(rec.fields[\"fax\"]).nil? )\n @fax << rec.fields[\"fax\"] \n end\n \n if ( !rec.fields[\"email\"].nil? && @email.index(rec.fields[\"email\"]).nil? )\n @email << rec.fields[\"email\"] \n end\n end", "def backtrack_consumed_change_records\n data[:backtrack_consumed_change_records]\n end", "def clear_data\n self.mutex.synchronize do\n self.seq = 0\n self.beg = 0\n self.cur = 0\n self.queue = Array.new( self.size )\n end\n end", "def play\r\n puts @recordings.last\r\n end", "def update\n scan_procedure_array =current_user[:edit_low_scan_procedure_array] \n delete_scantask_array = []\n @visit = Visit.where(\"visits.id in (select visit_id from scan_procedures_visits where scan_procedure_id in (?))\", scan_procedure_array).find(params[:id])\n\n params[:date][:mristartt][0]=\"1899\"\n params[:date][:mristartt][1]=\"12\"\n params[:date][:mristartt][2]=\"30\" \n mristarttime = nil\n if !params[:date][:mristartt][0].blank? && !params[:date][:mristartt][1].blank? && !params[:date][:mristartt][2].blank? && !params[:date][:mristartt][3].blank? && !params[:date][:mristartt][4].blank?\n mristarttime = params[:date][:mristartt][0]+\"-\"+params[:date][:mristartt][1]+\"-\"+params[:date][:mristartt][2]+\" \"+params[:date][:mristartt][3]+\":\"+params[:date][:mristartt][4]\n params[:visit][:mristarttime] = mristarttime\n end\n\n params[:date][:mriendt][0]=\"1899\"\n params[:date][:mriendt][1]=\"12\"\n params[:date][:mriendt][2]=\"30\" \n mriendtime = nil\n if !params[:date][:mriendt][0].blank? && !params[:date][:mriendt][1].blank? && !params[:date][:mriendt][2].blank? && !params[:date][:mriendt][3].blank? && !params[:date][:mriendt][4].blank?\n mriendtime = params[:date][:mriendt][0]+\"-\"+params[:date][:mriendt][1]+\"-\"+params[:date][:mriendt][2]+\" \"+params[:date][:mriendt][3]+\":\"+params[:date][:mriendt][4]\n params[:visit][:mriendtime] = mriendtime\n end\n\n # hiding the protocols in checkbox which user not have access to, if any add in to attributes before update\n @scan_procedures = ScanProcedure.where(\" scan_procedures.id in (select scan_procedure_id from scan_procedures_visits where visit_id = \"+params[:id]+\" and scan_procedure_id not in (?))\", scan_procedure_array ).all\n if @scan_procedures.count > 0\n scan_procedure_array = []\n @scan_procedures.each do |p2|\n scan_procedure_array << p2.id\n end \n params[:visit][:scan_procedure_ids] = params[:visit][:scan_procedure_ids] | scan_procedure_array \n end\n # HTML Checkbox Hack to remove all if none were checked.\n attributes = {'scan_procedure_ids' => []}.merge(params[:visit] || {} )\n \n @enumbers = @visit.enrollments\n # also want to set participant in vgroup\n set_participant_in_enrollment(@visit.rmr, @enumbers)\n if params[:pulse].blank? \n params[:pulse]=991 \n end\n if params[:bp_systol].blank? \n params[:bp_systol]=991 \n end\n if params[:bp_diastol].blank? \n params[:bp_diastol]=991 \n end\n if params[:bloodglucose].blank? \n params[:bloodglucose]=991 \n end\n \n if !params[:vital_id].blank?\n @vital = Vital.find(params[:vital_id])\n @vital.pulse = params[:pulse]\n @vital.bp_systol = params[:bp_systol]\n @vital.bp_diastol = params[:bp_diastol]\n @vital.bloodglucose = params[:bloodglucose]\n @vital.save\n else\n @vital = Vital.new\n @vital.appointment_id = @visit.appointment_id\n @vital.pulse = params[:pulse]\n @vital.bp_systol = params[:bp_systol]\n @vital.bp_diastol = params[:bp_diastol]\n @vital.bloodglucose = params[:bloodglucose]\n @vital.save \n end\n \n # THIS SHOULD ALL BE CONDENSED ===> do it the ruby way\n # get all mriscantask[mriscantask_id][]\n # if < 0 => insert if some field not null\n # mriperformance[mriperformance_id][] get all ---> if < 0 ==> insert if some field not null\n #e.g. name=\"mriperformance[mriperformance_id][]\" value=\"-3\" \n \t\t\t\t\t\t#name=\"mriperformance[mriscantask_id][-3]\" value=\"-22\" \n \t\t\t\t\t\t\n \t\t\t\t\t\t\n mriscantask_id_array = params[:mriscantask][:mriscantask_id] \n mriscantask_id_array.each do |mri_id|\n if !params[:mriscantask][:destroy].blank?\n if !params[:mriscantask][:destroy][mri_id].blank?\n if !delete_scantask_array.blank?\n delete_scantask_array.push(mri_id)\n else\n delete_scantask_array=[mri_id]\n end\n end\n end\n mri_id_int = mri_id.to_i\n if mri_id_int < 0 \n if !params[:mriscantask][:lookup_set_id][mri_id].blank? or \n !params[:mriscantask][:lookup_scantask_id][mri_id].blank? or \n !params[:mriscantask][:task_order][mri_id].blank? or\n !params[:mriscantask][:logfilerecorded][mri_id].blank? or \n !params[:mriscantask][:tasknote][mri_id].blank? or \n !params[:mriscantask][:image_dataset_id][mri_id].blank? \n @mriscantask = Mriscantask.new\n @mriscantask.lookup_set_id = params[:mriscantask][:lookup_set_id][mri_id]\n if !params[:mriscantask][:lookup_scantask_id][mri_id].blank?\n @mriscantask.lookup_scantask_id = params[:mriscantask][:lookup_scantask_id][mri_id]\n end\n @mriscantask.task_order = params[:mriscantask][:task_order][mri_id]\n @mriscantask.logfilerecorded = params[:mriscantask][:logfilerecorded][mri_id]\n @mriscantask.tasknote = params[:mriscantask][:tasknote][mri_id]\n @mriscantask.image_dataset_id = params[:mriscantask][:image_dataset_id][mri_id]\n @mriscantask.visit_id = @visit.id\n @mriscantask.save\n # get the acc and hit\n if !params[:mriscantask][:mriperformance_id][mri_id].blank?\n mp_id = params[:mriscantask][:mriperformance_id][mri_id]\n mp_id_int = mp_id.to_i\n\n if mp_id_int < 0\n if !params[:mriperformance][:hitpercentage][mp_id].blank? or\n !params[:mriperformance][:accuracypercentage][mp_id].blank?\n @mriperformance = Mriperformance.new\n @mriperformance.hitpercentage =params[:mriperformance][:hitpercentage][mp_id]\n @mriperformance.accuracypercentage =params[:mriperformance][:accuracypercentage][mp_id]\n @mriperformance.mriscantask_id [email protected]\n @mriperformance.save \n end \n else\n @mriperformance = Mriperformance.find(mp_id)\n @mriperformance.hitpercentage =params[:mriperformance][:hitpercentage][mp_id]\n @mriperformance.accuracypercentage =params[:mriperformance][:accuracypercentage][mp_id]\n @mriperformance.save\n end\n end\n end\n else\n\n @mriscantask = Mriscantask.find(mri_id_int)\n @mriscantask.lookup_set_id = params[:mriscantask][:lookup_set_id][mri_id]\n if !params[:mriscantask][:lookup_scantask_id][mri_id].nil?\n @mriscantask.lookup_scantask_id = params[:mriscantask][:lookup_scantask_id][mri_id]\n end\n @mriscantask.logfilerecorded = params[:mriscantask][:logfilerecorded][mri_id]\n @mriscantask.task_order = params[:mriscantask][:task_order][mri_id]\n @mriscantask.tasknote = params[:mriscantask][:tasknote][mri_id]\n @mriscantask.image_dataset_id = params[:mriscantask][:image_dataset_id][mri_id]\n @mriscantask.save\n # get the acc and hit\n \n if !params[:mriscantask][:mriperformance_id][mri_id].blank?\n mp_id = params[:mriscantask][:mriperformance_id][mri_id]\n mp_id_int = mp_id.to_i\n\n if mp_id_int < 0\n if !params[:mriperformance][:hitpercentage][mp_id].blank? or\n !params[:mriperformance][:accuracypercentage][mp_id].blank?\n @mriperformance = Mriperformance.new\n @mriperformance.hitpercentage =params[:mriperformance][:hitpercentage][mp_id]\n @mriperformance.accuracypercentage =params[:mriperformance][:accuracypercentage][mp_id]\n @mriperformance.mriscantask_id [email protected]\n @mriperformance.save \n end \n else\n @mriperformance = Mriperformance.find(mp_id)\n @mriperformance.hitpercentage =params[:mriperformance][:hitpercentage][mp_id]\n @mriperformance.accuracypercentage =params[:mriperformance][:accuracypercentage][mp_id]\n @mriperformance.save\n end\n end\n end\n end \n \n # getting error when trying to add enumber ??? try changing thye enum format chars[xxxx(x)]digits[xxxx]\n \n respond_to do |format|\n if @visit.update_attributes(attributes)\n if !delete_scantask_array.blank?\n delete_scantask_array.each do |mri_id|\n @mriscantask = Mriscantask.find(mri_id.to_i)\n @mriscantask.destroy\n end\n end\n @appointment = Appointment.find(@visit.appointment_id)\n @vgroup = Vgroup.find(@appointment.vgroup_id)\n @appointment.appointment_date = @visit.date\n if [email protected]_id.blank?\n @participant = Participant.find(@vgroup.participant_id)\n if [email protected]?\n @appointment.age_at_appointment = ((@appointment.appointment_date - @participant.dob)/365.25).floor\n end\n end\n if !params[:appointment].nil? and !params[:appointment][:appointment_coordinator].nil?\n @appointment.appointment_coordinator = params[:appointment][:appointment_coordinator]\n end\n @appointment.save\n\n @vgroup.transfer_mri = params[:vgroup][:transfer_mri]\n # @vgroup.dicom_dvd = params[:vgroup][:dicom_dvd]\n #@vgroup.entered_by = params[:vgroup][:entered_by]\n @vgroup.rmr = @visit.rmr\n # @vgroup.enrollments = @visit.enrollments\n sql = \"Delete from enrollment_vgroup_memberships where vgroup_id =\"[email protected]_s\n connection = ActiveRecord::Base.connection(); \n results_del = connection.execute(sql)\n sql = \"select distinct enrollment_id from enrollment_visit_memberships where visit_id in (select visits.id from visits, appointments where appointments.id = visits.appointment_id and appointments.vgroup_id =\"[email protected]_s+\")\"\n connection = ActiveRecord::Base.connection(); \n results = connection.execute(sql)\n results.each do |e|\n sql = \"insert into enrollment_vgroup_memberships(vgroup_id,enrollment_id) values(\"[email protected]_s+\",\"+e[0].to_s+\")\"\n connection = ActiveRecord::Base.connection(); \n results = connection.execute(sql)\n # trying to get link to participant to show up in one update of enumber\n if [email protected]_id.blank?\n sql = \"update enrollments set participant_id = \"[email protected]_id.to_s+\" where participant_id is null and enrollments.id =\"+e[0].to_s\n results = connection.execute(sql) \n end\n end \n #### REPEAT FOR SP \n\n sql = \"Delete from scan_procedures_vgroups where vgroup_id =\"[email protected]_s\n connection = ActiveRecord::Base.connection(); \n results = connection.execute(sql)\n sql = \"select distinct scan_procedure_id from scan_procedures_visits where visit_id in (select visits.id from visits, appointments where appointments.id = visits.appointment_id and appointments.vgroup_id =\"[email protected]_s+\")\"\n connection = ActiveRecord::Base.connection(); \n results = connection.execute(sql)\n results.each do |sp| \n sql = \"Insert into scan_procedures_vgroups(vgroup_id,scan_procedure_id) values(\"[email protected]_s+\",\"+sp[0].to_s+\")\"\n connection = ActiveRecord::Base.connection(); \n results = connection.execute(sql) \n end \n\n @vgroup.save\n # 4\n flash[:notice] = 'visit was successfully updated.'\n format.html { redirect_to(@visit) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @visit.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_data\n @store.get_data true\n end", "def update_junk\n\n #\n ##people = { 1 => { \"first_name\" => \"David\" }, 2 => { \"first_name\" => \"Jeremy\" } }\n ##PurchasesEntries.update(people.keys, people.values)\n #\n #\n #params[:purchase].each do |attributes|\n # logger.warn \"####################################### attributes: \" + attributes.inspect\n # g = \"g\"\n # #purchases_entry = @purchase.purchases_entries.detect {|pe| pe.id == attributes[1][0][:id] }\n # #\n # #@purchase.purchases_entries.each do |pe|\n # # if pe.id == attributes[1][0][:id]\n # #end\n #\n #\n # people = { 1 => { \"first_name\" => \"David\" }, 2 => { \"first_name\" => \"Jeremy\" } }\n # PurchasesEntries.update(people.keys, people.values)\n #\n #\n #\n # logger.warn \"####################################### purchases_entry.id \" + purchases_entry.id.to_s\n # purchases_entry_opposite_entry = purchases_entry.opposite_entry if purchases_entry.opposite_entry != false\n # purchases_entry.attributes = attributes\n # purchases_entry_opposite_entry.attributes = attributes if purchases_entry_opposite_entry\n # purchases_entry.save!(:validate=> false)\n # purchases_entry_opposite_entry.save(:validate=> false) if purchases_entry_opposite_entry\n #\n # purchases_entry.destroy if purchases_entry.QuantityOnOrder <= 0.0\n # if purchases_entry_opposite_entry\n # purchases_entry_opposite_entry.destroy if purchases_entry_opposite_entry.QuantityOnOrder <= 0.0\n # end\n # end\n #\n #\n #\n # delete_purchase_cache\n #\n\n\nend", "def pbRecord(text,maxtime=30.0)\n text=\"\" if !text\n textwindow=Window_UnformattedTextPokemon.newWithSize(text,\n 0,0,Graphics.width,Graphics.height-96)\n textwindow.z=99999\n if text==\"\"\n textwindow.visible=false\n end\n wave=nil\n msgwindow=Kernel.pbCreateMessageWindow\n oldvolume=Kernel.Audio_bgm_get_volume()\n Kernel.Audio_bgm_set_volume(0)\n delay=2\n delay.times do |i|\n Kernel.pbMessageDisplay(msgwindow,\n _ISPRINTF(\"Recording in {1:d} second(s)...\\nPress ESC to cancel.\",delay-i),false)\n Graphics.frame_rate.times do\n Graphics.update\n Input.update\n textwindow.update\n msgwindow.update\n if Input.trigger?(Input::B)\n Kernel.Audio_bgm_set_volume(oldvolume)\n Kernel.pbDisposeMessageWindow(msgwindow)\n textwindow.dispose\n return nil\n end\n end\n end\n Kernel.pbMessageDisplay(msgwindow,\n _INTL(\"NOW RECORDING\\nPress ESC to stop recording.\"),false)\n if beginRecordUI\n frames=(maxtime*Graphics.frame_rate).to_i\n frames.times do\n Graphics.update\n Input.update\n textwindow.update\n msgwindow.update\n if Input.trigger?(Input::B)\n break\n end\n end\n tmpFile=ENV[\"TEMP\"]+\"\\\\record.wav\"\n endRecord(tmpFile)\n wave=getWaveDataUI(tmpFile,true)\n if wave\n Kernel.pbMessageDisplay(msgwindow,_INTL(\"PLAYING BACK...\"),false)\n textwindow.update\n msgwindow.update\n Graphics.update\n Input.update\n wave.play\n (Graphics.frame_rate*wave.time).to_i.times do\n Graphics.update\n Input.update\n textwindow.update\n msgwindow.update\n end\n end\n end\n Kernel.Audio_bgm_set_volume(oldvolume)\n Kernel.pbDisposeMessageWindow(msgwindow)\n textwindow.dispose\n return wave\nend", "def batch_update\n params['hold_list']&.each do |hold_key|\n ws_args = { hold_key:, session_token: current_user.session_token }\n\n if params[:pickup_library].present?\n ChangePickupLibraryJob.perform_later **ws_args, pickup_library: params[:pickup_library]\n end\n\n if params[:pickup_by_date].present?\n ChangePickupByDateJob.perform_later **ws_args, pickup_by_date: params[:pickup_by_date]\n end\n end\n\n render plain: 'Update scheduled', status: :ok\n end", "def save_records\n unless @records.empty?\n @model_class.connection.populate(@model_class.quoted_table_name, columns_sql, rows_sql_arr, \"#{@model_class.name} Populate\")\n @last_id_in_database = @records.last.id\n @records.clear\n end\n end", "def update ; end", "def save_and_remove_all(map_id, round)\n records = @store.where(map_id: map_id, round: round)\n uncommitted = records.map { |record| record.link }\n\n unless records.empty?\n records.each do |record|\n previous = SubmissionViewingEvent.where(\n map_id: record.map_id,\n round: record.round,\n link: record.link\n ).first\n\n if previous\n # make sure to add the total time on this record\n # with what may have already been in the database\n previous.update_attribute(:total_time, record.merge(event))\n else\n # if a previous record doesn't exist,\n # we can delegate saving to `LocalStorage`\n @store.hard_save(record)\n end\n\n # once the data is updated or added to the database,\n # remove it from `LocalStorage`\n @store.remove(record)\n end\n end\n\n uncommitted\n end", "def process_updates\n return unless should_run?\n\n time_from = @config.full_table ? Time.new(0) : @info.last_sent.in_time_zone\n time_to = Time.zone.now - @config.delay_time\n Deimos.config.logger.info(\"Polling #{@producer.topic} from #{time_from} to #{time_to}\")\n message_count = 0\n batch_count = 0\n\n # poll_query gets all the relevant data from the database, as defined\n # by the producer itself.\n loop do\n Deimos.config.logger.debug(\"Polling #{@producer.topic}, batch #{batch_count + 1}\")\n batch = fetch_results(time_from, time_to).to_a\n break if batch.empty?\n\n batch_count += 1\n process_batch(batch)\n message_count += batch.size\n time_from = last_updated(batch.last)\n end\n Deimos.config.logger.info(\"Poll #{@producer.topic} complete at #{time_to} (#{message_count} messages, #{batch_count} batches}\")\n end", "def flush!\n synchronize do\n patch_batch!\n @cond.broadcast\n end\n\n self\n end" ]
[ "0.616494", "0.58869547", "0.5764435", "0.5725247", "0.57116747", "0.56718975", "0.56658936", "0.5663742", "0.56364596", "0.5631303", "0.5571284", "0.55143785", "0.5488412", "0.54725367", "0.54506963", "0.54370725", "0.54018414", "0.5374615", "0.53578734", "0.53547543", "0.53284585", "0.5305842", "0.52761716", "0.5260295", "0.5257979", "0.52377", "0.5231758", "0.52230394", "0.5219433", "0.52164876", "0.52062714", "0.52037376", "0.5192249", "0.5186758", "0.5182179", "0.5181271", "0.5176744", "0.5157859", "0.5155351", "0.5146378", "0.514255", "0.51381576", "0.5131661", "0.51196474", "0.51178086", "0.5105873", "0.51010287", "0.50933725", "0.50905764", "0.507985", "0.5078887", "0.50779885", "0.50739586", "0.50737995", "0.5069762", "0.50657785", "0.5061027", "0.5058032", "0.50549304", "0.5052623", "0.5050409", "0.5050409", "0.5050409", "0.5044999", "0.50396705", "0.5038997", "0.5026345", "0.5026039", "0.5010748", "0.50103587", "0.50027156", "0.49991125", "0.49985787", "0.49973637", "0.49928424", "0.4975923", "0.4963363", "0.49520093", "0.4949645", "0.49472556", "0.49456048", "0.49455646", "0.49450934", "0.49413627", "0.49404556", "0.4939706", "0.49343053", "0.49340358", "0.49315977", "0.4930955", "0.49284858", "0.49254057", "0.4923629", "0.49192974", "0.4912469", "0.49091414", "0.49075124", "0.49039152", "0.4900435", "0.48996374" ]
0.70705295
0
TODO: Check if current recording is lower priority than new request
def check_recordings tuners.times do |tuner| recording = current_recordings[tuner] next if recording.nil? || recording.recordable? stop_and_store_recording(recording) free_up_tuner(tuner) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recorded?\n return ignoring_recorded? if ignoring_request?\n\n @recorded\n end", "def record_request\n now = Time.now\n diff = (now - @start)\n @active_time += diff\n @requests += 1\n\n reset_horizon if now - horizon > @window\n rescue => boom\n warn \"ProcessUtilization#record_request failed: #{boom.inspect}\"\n end", "def before_recorded\n end", "def log_request\n result = super\n push_outstanding_request\n result\n end", "def current_recording\n @current_recording\n end", "def recording_on()\n update({:recording_enabled => true})\n reload()\n end", "def back_one_audition\n current_audition = self.auditions.where(:created_at.lt => (self.current_audition.created_at)).order(created_at: :desc).first\n if current_audition.present?\n self.current_audition = current_audition\n self.save\n response = self.return_voice_hash()\n ap response\n return response\n\n end\n \n end", "def recordOn()\n @record = true ;\n end", "def add_request_if_new\n last_request = session.requests.last\n maybe_next_request = yield(last_request)\n session.requests << maybe_next_request unless (\n maybe_next_request.nil? or maybe_next_request.equal?(last_request)\n )\n self\n end", "def pending_requests; end", "def pending_requests; end", "def pending_requests; end", "def recordable?(recording)\n !!open_tuner && (recording.full_size < space_available)\n end", "def push_outstanding_request\n ruid = request_uid\n ork = outstanding_request_key\n with_state_lock do |state|\n outstanding = state[:outstanding]\n outstanding_requests = outstanding[ork] ||= []\n outstanding_requests << ruid\n logger.debug(\"Pushed outstanding request uid=#{ruid.inspect} at #{ork.inspect}.\")\n end\n @request_timestamp = ::Time.now.to_i\n true\n end", "def show\n \n begin\n @recording = Recording.cached_find(params[:id])\n @recording.playbacks_count += 1\n @recording.uniq_playbacks_count = @recording.playbacks_count.to_uniq\n @recording.save(validate: false)\n ap @recording.uniq_playbacks_count\n user_id = current_user ? current_user.id : nil\n \n playback = Playback.create(\n recording_id: @recording.id, \n user_id: user_id, \n account_id: @recording.account_id \n )\n \n \n if current_user && @recording.privacy == \"Anyone\" \n current_user.create_activity( :created, \n owner: playback, # the recording has many playbacks\n recipient: @recording,\n recipient_type: 'Recording',\n account_id: @recording.user.account.id) \n \n \n \n Activity.notify_followers( 'Listened to this recording', user_id, 'Recording', @recording.id )\n end\n \n \n \n \n rescue\n end\n \n \n \n render nothing: true\n end", "def save_request(r)\n @last_request = r\n end", "def create\n #do_new_resource - custom new audio_recording\n #do_set_attributes(audio_recording_params) - custom set attributes\n @audio_recording = AudioRecording.build_by_file_hash(audio_recording_params)\n get_project_site\n\n do_authorize_instance\n\n uploader_id = audio_recording_params[:uploader_id].to_i\n user_exists = User.exists?(uploader_id)\n user = User.where(id: uploader_id).first\n actual_level = Access::Core.user_levels(user, @project)\n requested_level = :writer\n is_allowed = Access::Core.allowed?(requested_level, actual_level)\n\n if !user_exists || !is_allowed\n respond_error(\n :unprocessable_entity,\n 'uploader does not exist or does not have access to this project',\n { error_info: {\n project_id: @project.nil? ? nil : @project.id,\n user_id: user.nil? ? nil : user.id\n } }\n )\n else\n\n # ensure audio recording has uuid\n @audio_recording.set_uuid\n\n # check for overlaps and attempt to fix\n overlap_result = @audio_recording.fix_overlaps\n\n too_many = overlap_result ? overlap_result[:overlap][:too_many] : false\n not_fixed = overlap_result ? overlap_result[:overlap][:items].any? { |info| !info[:fixed] } : false\n\n Rails.logger.warn overlap_result\n\n if too_many\n respond_error(:unprocessable_entity, 'Too many overlapping recordings', { error_info: overlap_result })\n elsif not_fixed\n respond_error(:unprocessable_entity, 'Some overlaps could not be fixed', { error_info: overlap_result })\n elsif @audio_recording.save\n respond_create_success\n else\n # @audio_recording.errors.any?\n respond_change_fail\n end\n\n end\n end", "def recordable?\n (Time.now + recording_start_time_delta > start_time) && \\\n Time.now < end_time\n end", "def pending_response_requests; end", "def last_request_at_threshold(value = nil)\n if value.nil?\n read_inheritable_attribute(:last_request_at_threshold) || last_request_at_threshold(0)\n else\n write_inheritable_attribute(:last_request_at_threshold, value)\n end\n end", "def queue_front(request)\n request.hydra = self\n queued_requests.unshift request\n end", "def identify_request\n klass = @layout == \"miq_request_ae\" ? AutomationRequest : MiqRequest\n @miq_request = @record = identify_record(params[:id], klass)\n end", "def update\n respond_to do |format|\n if @recording.update(recording_params)\n @recording.update_attribute(:is_recorded, false)\n format.html { redirect_to @recording, notice: 'Recording was successfully updated.' }\n format.json { render :show, status: :ok, location: @recording }\n Sidekiq::ScheduledSet.new.select { |retri|\n retri.jid == @recording.job_id\n }.each(&:delete)\n job_id = RecordingWorker.perform_at(@recording.start_datetime, @recording.id)\n @recording.update_attribute(:job_id, job_id)\n\n else\n format.html { render :edit }\n format.json { render json: @recording.errors, status: :unprocessable_entity }\n end\n end\n end", "def record_request(env)\n input = create_recording_input(env)\n env.update \"rack.input\" => input\n input\n end", "def new_recording\n response = Twilio::TwiML::Response.new do |r|\n play_audio(r, 'recording_begin_at_beep')\n r.Record(action: ivr_recordings_re_record_prompt_url, method: 'post', 'finishOnKey' => '7')\n end\n\n render_twiml response\n end", "def create\n @recording = Recording.new(recording_params)\n @recording.update_attribute(:is_recorded, false)\n\n respond_to do |format|\n if @recording.save\n format.html { redirect_to @recording, notice: 'Recording was successfully created.' }\n format.json { render :show, status: :created, location: @recording }\n job_id = RecordingWorker.perform_at(@recording.start_datetime, @recording.id)\n @recording.update_attribute(:job_id, job_id)\n else\n format.html { render :new }\n format.json { render json: @recording.errors, status: :unprocessable_entity }\n end\n end\n end", "def record(&blk)\n start_recording\n blk.call\n ensure\n stop_recording\n end", "def record!\n if OhMyLog::Log.configuration.print_log\n p \"REQUEST\"\n p @request.to_s\n p \"RESPONSE\" unless @effects.empty?\n @effects.each {|effect| p effect.to_s}\n end\n\n print_into_log\n\n #we can record everything that happend (OPTIONALL)\n if OhMyLog::Log.configuration.record_history\n OhMyLog::Log.history << self\n end\n #We always save the last operation recorded\n OhMyLog::Log.last_recorded = self\n #save this string on file or upload it somewhere\n end", "def capture_request\n already_exist = false\n already_exist = true if Trap.find_by(name: params[:trap_name])\n @trap = Trap.find_or_create_by(name: params[:trap_name])\n header = Hash.new\n request.headers.each { |key, value| header[key] = value.to_s unless value.is_a?(Hash) }\n @req = create_request(@trap, request.remote_ip, request.method, request.scheme, request.query_string,\n request.query_parameters, request.cookies, header)\n\n respond_to do |format|\n if @trap\n WebsocketRails[:trap].trigger 'new', render_to_string(partial: 'traps/trap') unless already_exist\n WebsocketRails[:request].trigger 'new', render_to_string(partial: 'traps/request') if @req\n format.html { redirect_to traps_path, notice: 'Request was successfully captured.'}\n else\n format.html { redirect_to traps_path, notice: 'Request wasn\\'t captured.'}\n end\n end\n end", "def record\n @record ||= process_ai_variants(2) ||\n process_ai_variants(1) ||\n process_ai_variants(1)\n end", "def add_request(timestamp)\n # add to total requests\n @total_requests += 1\n @logger.debug(\"Pushing timestamp: #{Time.at(timestamp).to_s}\")\n @queue.push(timestamp)\n end", "def rate_limit\n new_request=RequestLimit.new({ip:request.remote_ip.to_s})\n\n # create a new record of RequestLimit to keep count of the incomming requests\n new_request.save\n\n # Check if current request exceeds max limit specified\n\n if RequestLimit.all.size > RequestLimit::MAX_LIMIT\n\n # Calculate the Time till the count will get reset\n time_left=(Time.now.end_of_hour).to_i-(Time.now).to_i\n render status: 429, json: { message: \"Rate limit exceeded. Try again in #{time_left} seconds\" } ## response when limit is exceeded\n end\n end", "def detect_conflict_events_with_priority\n events = RecordingEvent.active_user_recording_events(user).select{|e| (e.id != self[:id]) && (e.priority >= self[:priority])}\n events.select{|e| self.class.overlap_type(self, e)}\n end", "def track_record_update\n true\n end", "def pending_feedback\n self.sub_requests.waiting_for_feedback.present?\n end", "def start_record\n request_header.fetch(:replacements, {}).fetch(config.start_record_parameter, 1).to_i\n end", "def set_recording\n @recording = Recording.includes(recording_contributor_people: [:person]).find(params[:id])\n end", "def update_request_info(app_name, total_requests_seen,\n time_requests_were_seen, update_dashboard)\n Djinn.log_debug(\"Time now is #{time_requests_were_seen}, last \" +\n \"time was #{@last_sampling_time[app_name]}\")\n Djinn.log_debug(\"Total requests seen now is #{total_requests_seen}, last \" +\n \"time was #{@total_req_rate[app_name]}\")\n requests_since_last_sampling = total_requests_seen - @total_req_rate[app_name]\n time_since_last_sampling = time_requests_were_seen - @last_sampling_time[app_name]\n if time_since_last_sampling.zero?\n time_since_last_sampling = 1\n end\n\n average_request_rate = Float(requests_since_last_sampling) / Float(time_since_last_sampling)\n if average_request_rate < 0\n Djinn.log_info(\"Saw negative request rate for app #{app_name}, so \" +\n \"resetting our haproxy stats for this app.\")\n initialize_scaling_info_for_app(app_name, force=true)\n return\n end\n\n if update_dashboard\n send_request_info_to_dashboard(app_name, time_requests_were_seen,\n average_request_rate)\n end\n\n Djinn.log_debug(\"Total requests will be set to #{total_requests_seen} \" +\n \"for app #{app_name}, with last sampling time #{time_requests_were_seen}\")\n @total_req_rate[app_name] = total_requests_seen\n @last_sampling_time[app_name] = time_requests_were_seen\n end", "def set_recording\n @recording = Recording.cached_find(params[:recording_id])\n end", "def is_recent_acquisition?\n contexts.flag5 == 1\n end", "def record(recording)\n if recordable?(recording)\n tuner = open_tuner\n current_recordings[tuner] = recording\n current_recordings[tuner].record!\n\n tuner\n else\n false \n end\n end", "def record_prio(qname,qtype,content,prio,auth=1)\n record_prio_ttl(qname,qtype,content,prio,@ttl,auth)\n end", "def appended_to_fund_request?( fund_request )\n return true if new_record? || fund_requests.actionable.empty?\n false\n end", "def record_request(status, env)\n now = Time.now\n diff = (now - @start)\n if $statsd\n $statsd.timing(\"response_time\", diff * 1000)\n if VALID_METHODS.include?(env[REQUEST_METHOD])\n stat = \"response_time.#{env[REQUEST_METHOD].downcase}\"\n $statsd.timing(stat, diff * 1000)\n end\n\n if suffix = status_suffix(status)\n $statsd.increment \"status_code.#{status_suffix(status)}\"\n end\n\n api = env[\"API\"]\n if api\n $statsd.timing(\"response_time.#{api}\", diff * 1000)\n $statsd.increment \"status_code.#{status_suffix(status)}.#{api}\"\n end\n\n if @track_gc && GC.time > 0\n $statsd.timing \"gc.time\", GC.time / 1000\n $statsd.count \"gc.collections\", GC.collections\n end\n end\n\n rescue => boom\n warn \"Statsd::Rack#record_request failed: #{boom}\"\n end", "def request_log(request); end", "def determine_isic_status\n return unless self.isic?\n raise \"Record is not new, won't change status\" unless new_record?\n raise \"No member associated yet\" unless member\n self.isic_status = 'request'\n end", "def capture_request_response_cycle_start_info\n return gather_stats unless gather_stats\n\n # get system info\n current_time = get_system_current_time\n\n # temporarily save request info\n req_info = {\n req_object_id: request.object_id,\n res_object_id: response.object_id,\n server_name: (request.env[\"SERVER_NAME\"] rescue \"some_server_name\"),\n req_path: (request.path rescue \"some_path\"),\n req_http_verb: (request.method rescue \"some_method\"),\n req_time: current_time, # implicit convertion to integer\n req_url: (request.url rescue \"some_url\"),\n req_format: (request.parameters[\"format\"] rescue \"some_format\"),\n req_controller: (request.parameters[\"controller\"] rescue \"some_controller\"),\n req_action: (request.parameters[\"action\"] rescue \"some_action\"),\n remote_ip: (request.remote_ip rescue \"some_ip\"),\n gc_stat: get_gc_stat,\n }\n redis_req_key_name = redis_record.req_key(get_server_hostname, req_info[:req_object_id])\n redis_record.jsonified_set(redis_req_key_name, req_info, {ex: LONGEST_REQ_RES_CYCLE}, {strict_key_check: false})\n\n # return key_name\n redis_req_key_name\n end", "def start_recording\n cm_status = status\n new_params = {:event_id => event.cm_event_id,\n :session_id => cm_session_id,\n :status => SESSION_STATUS[:recording]}\n cm_status.load(new_params)\n begin\n cm_status.save\n rescue => e\n if cm_status.present?\n errors.add_to_base(e.to_s)\n end\n end\n end", "def update_recording(record_id, meta)\n meta[:recordID] = record_id\n bbb_server.send_api_request(\"updateRecordings\", meta)\n end", "def within_window\n if session[:window_count] >= WINDOW_LIMIT\n session[:request_restrained] = true\n session[:sec_restrained] = @sec_now # impose a wait of RESTRAIN_SECONDS duration\n else\n session[:window_count] += 1\n end\n end", "def re_record_prompt\n active_recording = active_call.recordings.create!(duration: params['RecordingDuration'], recording_url: params['RecordingUrl'])\n response = Twilio::TwiML::Response.new do |r|\n r.Say 'Thank you.'\n play_audio(r, 'recording_play_back')\n play_audio(r, 'recording_recrcord_instructions')\n r.Gather(\n action: ivr_recordings_new_recording_url,\n method: 'get',\n 'numDigits' => 1,\n 'finishOnKey' => ''\n ) do |gather|\n r.Play(active_recording.recording_url)\n play_audio(r, 'recording_play_back')\n play_audio(r, 'recording_recrcord_instructions')\n end\n play_audio(r, 'goodbye')\n r.Hangup\n end\n\n render_twiml response\n end", "def set_reqpriority\n @reqpriority = Reqpriority.find(params[:id])\n end", "def poll_req\n super # placeholder so that I can add some doc\n end", "def set_retrieved(doc, request, modified)\n doc[\"retrieved\"] = {\n from: request.url,\n at: Time.now,\n modifiedAccordingToASNApi: modified\n }\n doc\nend", "def wait_before_new_request\n return unless @last_request # this is the first request\n diff = Time.now - @last_request\n if diff < SECONDS_BEFORE_NEW_REQUEST\n sleep(SECONDS_BEFORE_NEW_REQUEST - diff)\n end\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 stop_recording_changes\n\t\t\t\t\t@track_changed_attributes = false\n\t\t\t\tend", "def recording\n @call = Call.find(params[:id])\n @call.update_attribute :recording_url, params[:RecordingUrl] || @call.recording_url\n @call.update_attribute :recording_duration, params[:RecordingDuration] || @call.recording_duration\n \n render \"calls/twiml/recording/#{@call.template}.xml.erb\"\n end", "def request_phase\n super\n end", "def request_phase\n super\n end", "def post_read_request( request )\n\t\t# Only count the main request, not subrequests\n\t\tif request.main?\n\t\t\t@counter += 1\n \t@initial_usage = Process.rusage\n\t\t\trequest.server.log_info \"Initial rusage (%s): %p\" %\n\t\t\t \t[ request.uri, @initial_usage ]\n\t\tend\n return Apache::DECLINED\n end", "def update_completeness\n RecordingCompleteness.update self\n end", "def record\n current_application.request_specs.where(id: params[:id]).first\n end", "def recording_params\n #params.require(:recording).permit(:area_id, :station_id, :start_datetime, :recording_second, :title, :filename, :is_recorded)\n params.require(:recording).permit(:area_id, :station_id, :start_datetime, :recording_second, :title, :filename, :job_id)\n end", "def append_recording(entry_id, asset_id, media_server_index, resource, duration, is_last_chunk=false)\n\t\t\tkparams = {}\n\t\t\t# Live entry id\n\t\t\tclient.add_param(kparams, 'entryId', entry_id);\n\t\t\t# Live asset id\n\t\t\tclient.add_param(kparams, 'assetId', asset_id);\n\t\t\tclient.add_param(kparams, 'mediaServerIndex', media_server_index);\n\t\t\tclient.add_param(kparams, 'resource', resource);\n\t\t\t# in seconds\n\t\t\tclient.add_param(kparams, 'duration', duration);\n\t\t\t# Is this the last recorded chunk in the current session (i.e. following a stream stop event)\n\t\t\tclient.add_param(kparams, 'isLastChunk', is_last_chunk);\n\t\t\tclient.queue_service_action_call('livechannel', 'appendRecording', 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 already_reported; end", "def already_reported; end", "def maximum_requests\n super\n end", "def document_progress(new_weight, old_weight)\n if self.goal == \"Lose Weight\"\n self.weight_histories.create(weight_recording: (old_weight - new_weight))\n elsif self.goal == \"Gain Weight\"\n self.weight_histories.create(weight_recording: (new_weight - old_weight))\n end\n end", "def get_recording_info(twilio_id, call_duration, answered_by)\n self.duration = call_duration\n client = Twilio::REST::Client.new ACCOUNT_SID, AUTH_TOKEN\n recordings_info = client.account.calls.get(twilio_id).recordings\n self.recording_url = recordings_info.list.first.mp3\n self.recording = recordings_info.list.first.sid\n self.answered_by = answered_by\n self.save\n end", "def queue(request)\n request.hydra = self\n queued_requests << request\n end", "def add(data)\n \n # selecting all records, skipping old ones.\n result = @db.get_first_row \"SELECT id, counter FROM requests WHERE domain=:domain AND request=:request AND status=:status AND referer=:referer AND ip=:ip AND first_seen<=:first_seen\",\n 'domain' => data[:domain],\n 'request' => data[:request],\n 'referer' => data[:referer],\n 'status' => data[:status],\n 'ip' => data[:ip],\n 'first_seen' => $config.detection['max_period'].seconds.ago.to_i\n # adding new request, overwriting too old ones.\n if result.nil?\n @db.execute \"INSERT OR REPLACE INTO requests (domain, request, referer, status, ip, first_seen, last_seen, counter) \n VALUES (:domain, :request, :referer, :status, :ip, strftime('%s','now'), strftime('%s','now'), 1)\",\n 'domain' => data[:domain],\n 'request' => data[:request],\n 'referer' => data[:referer],\n 'status' => data[:status],\n 'ip' => data[:ip]\n else\n # Look, Ma! We got fresh requests\n @db.execute \"UPDATE requests SET last_seen = strftime('%s','now'), counter = counter+1 WHERE id = ?\", result['id']\n end\n end", "def conditional_requests; end", "def conditional_requests; end", "def record; end", "def record; end", "def record; end", "def requestable_based_on_archival_record_level?\n if (req_levels = self.repo_settings[:requestable_archival_record_levels])\n is_whitelist = false\n levels = []\n\n # Determine if the list is a whitelist or a blacklist of levels.\n # If the setting is just an array, assume that the list is a\n # whitelist.\n if req_levels.is_a?(Array)\n is_whitelist = true\n levels = req_levels\n else\n list_type = req_levels[:list_type]\n is_whitelist = (list_type == :whitelist) || (list_type == 'whitelist')\n levels = req_levels[:values] || req_levels[:levels] || []\n end\n\n list_type_description = is_whitelist ? 'Whitelist' : 'Blacklist'\n Rails.logger.debug(\"Aeon Fulfillment Plugin\") { \":requestable_archival_record_levels is a #{list_type_description}\" }\n Rails.logger.debug(\"Aeon Fulfillment Plugin\") { \"Record Level #{list_type_description}: #{levels}\" }\n\n # Determine the level of the current record.\n level = ''\n if self.record.json\n level = self.record.json['level'] || ''\n end\n\n Rails.logger.debug(\"Aeon Fulfillment Plugin\") { \"Record's Level: \\\"#{level}\\\"\" }\n\n # If whitelist, check to see if the list of levels contains the level.\n # Otherwise, check to make sure the level is not in the list.\n return is_whitelist ? levels.include?(level) : levels.exclude?(level)\n end\n\n true\n end", "def throttle\n sleep @throttle if @@last_request + @throttle > Time.now\n @@last_request = Time.now\n end", "def add_to_pending(packet)\n @pending_requests[packet.id] = {\n :packet => packet,\n :time => Time.now\n }\n end", "def append_recording(entry_id, asset_id, media_server_index, resource, duration, is_last_chunk=false)\n\t\t\tkparams = {}\n\t\t\t# Live entry id\n\t\t\tclient.add_param(kparams, 'entryId', entry_id);\n\t\t\t# Live asset id\n\t\t\tclient.add_param(kparams, 'assetId', asset_id);\n\t\t\tclient.add_param(kparams, 'mediaServerIndex', media_server_index);\n\t\t\tclient.add_param(kparams, 'resource', resource);\n\t\t\t# in seconds\n\t\t\tclient.add_param(kparams, 'duration', duration);\n\t\t\t# Is this the last recorded chunk in the current session (i.e. following a stream stop event)\n\t\t\tclient.add_param(kparams, 'isLastChunk', is_last_chunk);\n\t\t\tclient.queue_service_action_call('livestream', 'appendRecording', 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 handle( request ) # note: all 'handle's return 'ml_response' in a chain\n\n# not yet request.record_arrival_time\n ml_response =\n case\n when request.get? then handle_get_muffin(request)\n when request.post? then handle_post(request)\n end\n# not yet request.record_completion_time\n ml_response\n end", "def request_history_params\n params.permit!\n end", "def pending_clarification_request\n @pending_clarification_request_cache || @pending_clarification_request_cache = if self.pending_clarification_requests?\n self.clarification_requests.active.find(:all, :order => \"id DESC, created_at DESC\", :limit => 1)[0]\n else\n nil\n end\n end", "def pending_clarification_request\n @pending_clarification_request_cache || @pending_clarification_request_cache = if self.pending_clarification_requests?\n self.clarification_requests.active.find(:all, :order => \"id DESC, created_at DESC\", :limit => 1).first\n else\n nil\n end\n end", "def record!\n recorded!\n\n return if ignoring_request?\n\n # If we didn't have store, but we're trying to record anyway, go\n # figure that out. (this happens in Remote Agent scenarios)\n restore_from_dump! if @agent_context.nil?\n\n # Bail out early if the user asked us to ignore this uri\n return if @agent_context.ignored_uris.ignore?(annotations[:uri])\n\n apply_name_override\n\n @agent_context.transaction_time_consumed.add(unique_name, root_layer.total_call_time)\n\n context.add(:transaction_id => transaction_id)\n\n # Make a constant, then call converters.dup.each so it isn't inline?\n converters = {\n :histograms => LayerConverters::Histograms,\n :metrics => LayerConverters::MetricConverter,\n :errors => LayerConverters::ErrorConverter,\n :allocation_metrics => LayerConverters::AllocationMetricConverter,\n :queue_time => LayerConverters::RequestQueueTimeConverter,\n :job => LayerConverters::JobConverter,\n :db => LayerConverters::DatabaseConverter,\n :external_service => LayerConverters::ExternalServiceConverter,\n\n :slow_job => LayerConverters::SlowJobConverter,\n :slow_req => LayerConverters::SlowRequestConverter,\n\n # This is now integrated into the slow_job and slow_req converters, so that\n # we get the exact same set of traces either way. We can call it\n # directly when we move away from the legacy trace styles.\n # :traces => LayerConverters::TraceConverter,\n }\n\n walker = LayerConverters::DepthFirstWalker.new(self.root_layer)\n converter_instances = converters.inject({}) do |memo, (slug, klass)|\n instance = klass.new(@agent_context, self, layer_finder, @store)\n instance.register_hooks(walker)\n memo[slug] = instance\n memo\n end\n walker.walk\n converter_results = converter_instances.inject({}) do |memo, (slug,i)|\n memo[slug] = i.record!\n memo\n end\n\n @agent_context.extensions.run_transaction_callbacks(converter_results,context,layer_finder.scope)\n\n # If there's an instant_key, it means we need to report this right away\n if web? && instant?\n converter = converters.find{|c| c.class == LayerConverters::SlowRequestConverter}\n trace = converter.call\n ScoutApm::InstantReporting.new(trace, instant_key).call\n end\n\n if web? || job?\n ensure_background_worker\n end\n end", "def current_request_id\n RequestStore.store[:current_request_id] || \"NONE\"\n end", "def set_recording\n @recording = Recording.find(params[:id])\n end", "def global_write_forwarding_requested\n data[:global_write_forwarding_requested]\n end", "def started_request_message(request); end", "def recording?\n @decision != Decision::DROP\n end", "def last_request_update_allowed?\n action_name != \"timeout\"\n end", "def send_global_request(type, *extra, &callback)\n @recordings << SendGlobalRequestRecording.new(type, extra, callback)\n self\n end", "def add_track_request\n builder.TrackRequest do |tr|\n tr.Request do |r|\n r.RequestAction 'Track'\n r.RequestOption 'activity'\n end\n tr.TrackingNumber package_id\n end\n end", "def acquire_priority\n case @event['status']\n when '0', '1'\n 'low'\n when '2', '3'\n 'normal'\n end\n end", "def process_pending_requests\n puts \"Processing pending requests...\"\n pending_requests = @calendar_network.ricart_agrawala.pending_requests.dup\n pending_requests.each do |pending_request|\n puts \"Processing pending request: \" + pending_request.to_s\n # get earliest local request that has same action on same appointment with\n # with pending request\n earliest_similar_local_request = @calendar_network.ricart_agrawala.earliest_similar_local_request_for(pending_request)\n puts \"Earliest similar local request is: #{earliest_similar_local_request.inspect}\"\n if earliest_similar_local_request == nil ||\n\t pending_request < earliest_similar_local_request\n\t# if no local request exists or pending request initiated before local request\n\t# confirm pending request\n remote_server = xml_rpc_client(pending_request.node.address, @calendar_network.config[\"path\"], \n\t\t\t\t pending_request.node.port)\n\tremote_server.call(\"calendar_network.confirm_request\", pending_request.action, \n\t\t\t pending_request.appointment_id, pending_request.timestamp)\n\t# remove pending request from the list\n\tputs \"Removing the pending_request from the list...\"\n\t@calendar_network.ricart_agrawala.pending_requests.delete(pending_request)\n end\n end\n true\n end", "def track_paloma_request\n self.paloma.resource ||= self.default_resource\n self.paloma.action ||= self.default_action\n end", "def store_request(request)\n @requests_lock.synchronize { @requests << request } if @keep_requests\n end", "def add_request(request)\n requests << request\n true\n end", "def link\n # PARAMS\n request_id = params[:id]\n request = Request.find(request_id)\n project_name = request.project_name\n workpackage_name = request.workpackage_name\n brn = request.brn\n workstream = request.workstream\n str = \"saved\"\n \n # STREAM\n stream = Stream.find_with_workstream(workstream)\n if not stream\n render(:text=>\"Stream not found\")\n end\n # UPDATE REQUEST\n request.stream_id = stream.id\n request.save\n \n # Commented because a new page was created to link previous history to new request, see in tools.\n # CHECK HISTORY_COUNT WITHOUT REQUEST\n # if request.counter_log.validity\n # history_count_no_request = nil\n # if (WORKPACKAGE_QS == request.work_package[0..6])\n # history_count_no_request = HistoryCounter.find(:all, :conditions=>[\"stream_id = ? and request_id IS NULL and concerned_status_id IS NOT NULL\",stream.id])\n # elsif (WORKPACKAGE_SPIDERS == request.work_package[0..6])\n # history_count_no_request = HistoryCounter.find(:all, :conditions=>[\"stream_id = ? and request_id IS NULL and concerned_spider_id IS NOT NULL\",stream.id])\n # end\n \n # if (WORKPACKAGE_COUNTERS.include?(request.work_package[0..6]))\n # count = 0\n # total_count = CounterBaseValue.first(:conditions => [\"complexity = ? and sdp_iteration = ? and workpackage = ?\",request.complexity,request.sdpiteration,request.work_package]).value\n # history_count_no_request.each do |hc_no_req|\n # if count < total_count\n # hc_no_req.request_id = request.id\n # hc_no_req.save\n # count = count + 1\n # end\n # end\n # # TEXT RESULT\n # if count > 0\n # str = str+\" and \"+count.to_s+\" ticket already used.\"\n # end\n \n # end\n # end\n \n render(:text=>str)\n end", "def get_next_free_recorder\n send(\"GET_NEXT_FREE_RECORDER#{FIELD_SEPARATOR}-1\")\n response = recv\n\n # If we have a recorder free, return the recorder id, otherwise false\n response[0] == \"-1\" ? false : response[0].to_i\n end" ]
[ "0.60060424", "0.5910615", "0.5718446", "0.5639616", "0.56115866", "0.5437126", "0.5384224", "0.5362841", "0.5322888", "0.53063846", "0.53063846", "0.53063846", "0.52735704", "0.5259102", "0.5254211", "0.5236874", "0.52265984", "0.5210512", "0.5188782", "0.5188226", "0.51426584", "0.5141051", "0.51396716", "0.5132104", "0.5130917", "0.51217616", "0.5118543", "0.510779", "0.5105826", "0.50884295", "0.5088423", "0.50754756", "0.50524426", "0.50447595", "0.50422704", "0.50409436", "0.50326425", "0.50299627", "0.5020922", "0.5020119", "0.50170946", "0.49989682", "0.49704534", "0.49671116", "0.496444", "0.49582285", "0.49549916", "0.4949935", "0.4940539", "0.49389583", "0.49278122", "0.49264556", "0.49228743", "0.49150985", "0.4912393", "0.48997328", "0.48968673", "0.48898178", "0.48829085", "0.48829085", "0.48783714", "0.4877713", "0.48763242", "0.4871992", "0.4858283", "0.48544174", "0.48544174", "0.48529717", "0.48474303", "0.48440415", "0.48326895", "0.48296458", "0.482844", "0.482844", "0.48265997", "0.48265997", "0.48265997", "0.48254496", "0.4817657", "0.48163038", "0.4814741", "0.4805306", "0.47987282", "0.4797455", "0.47938", "0.4785716", "0.47842404", "0.47836137", "0.47835034", "0.47785395", "0.47780392", "0.4771964", "0.4770474", "0.4767978", "0.47588885", "0.47577825", "0.47558722", "0.47522664", "0.47511324", "0.47506204", "0.47500265" ]
0.0
-1
Creates a new reader object, opening a file.
def initialize(filename, verbose) begin @file = File.open(filename, 'r') {|f| f.read} puts Compiler::color_out("Opened file #{filename}", :green) if @verbose rescue Exception => ex puts Compiler::color_out("[error] Couldn't open file #{filename}", :red) end # Marks the next character to be read in the file. @pos = 0 # Counter for the line. @line = 0 # Counter for the column. @column = 0 # Holds the option that was passed. @verbose = verbose end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open(file, locale)\n new(File.open(file), locale)\n end", "def _open(filename)\n File.open(filename, 'rb')\n end", "def open(filename, mode = 'r', &block)\n raise NotImplementedError\n end", "def initialize(name)\n @fh = File.open(name, 'r')\n end", "def open_in_file(filepath)\n File.open(filepath, 'rb')\n end", "def open_file!\n @raw_file = ::File.open(new_resource.absolute_path, 'rb')\n @file = case new_resource.absolute_path\n when /\\.tar$/\n nil # So it uses @raw_file instead.\n when /\\.t?gz/\n Zlib::GzipReader.wrap(@raw_file)\n when /\\.t?bz/\n # This can't take a block, hence the gross non-block forms for everything.\n PoiseArchive::Bzip2::Decompressor.new(@raw_file)\n else\n raise RuntimeError.new(\"Unknown or unsupported file extension for #{new_resource.path}\")\n end\n @tar_reader = Gem::Package::TarReader.new(@file || @raw_file)\n end", "def open(_filename, _mode = 'r')\n raise NotImplementedError\n end", "def open_file(filename)\n File.open(filename, 'r')\n end", "def reader(filepath, *args)\n if filepath.respond_to? :to_str or filepath.respond_to? :to_path\n ext = File.extname(filepath)\n if registered = readers.find{|r| r[1].include?(ext)}\n registered[2].new(filepath.to_s, *args)\n else\n raise \"No registered reader for #{ext} (#{filepath})\"\n end\n elsif args.empty? \n coerce(filepath)\n else\n raise ArgumentError, \"Unable to return a reader for #{filepath} and #{args}\" \n end\n end", "def read_file\n @read_file ||= File.open(self.file)\n end", "def initialize myFileName\n\t\t@handle = File.new(myFileName, \"r\")\n\tend", "def reader\n return @reader if @reader\n @reader = PDF::Reader.new(@file_path)\n end", "def open_file(file_name = file_path, options = 'rb')\n # chek if the file name really exists, otherwise raise an exception\n if !File.exists?(file_name)\n raise(IOError, \"File #{file_name} could not be opened.\", caller)\n end\n \n # try to open the specified file if is not already open\n if @file_handle == nil\n @file_handle = File.open(file_name, options)\n \n # check and set the initial position of the reading cursors.\n # It's necessary to do this thing because we don't know if the user\n # has specified the initial reading cursors befort starting working on file\n @position ||= @file_handle.pos\n \n @file_handle.pos = @position\n end\n end", "def open_file(file_name = file_path, options = 'rb')\n # chek if the file name really exists, otherwise raise an exception\n if !File.exists?(file_name)\n raise(IOError, \"File #{file_name} could not be opened.\", caller)\n end\n \n # try to open the specified file if is not already open\n if @file_handle == nil\n @file_handle = File.open(file_name, options)\n \n # check and set the initial position of the reading cursors.\n # It's necessary to do this thing because we don't know if the user\n # has specified the initial reading cursors befort starting working on file\n @position ||= @file_handle.pos\n \n @file_handle.pos = @position\n end\n end", "def open(*args, &block) # :yield: file\n File.open(path, *args, &block)\n end", "def initialize(reader)\n @reader = reader\n end", "def open_file\n\t\t\tif file_path[-4..-1] == \".bz2\"\n\t\t\t\treturn Bzip2::Reader.open(file_path)\n\t\t\telse\n\t\t\t\treturn File.open(file_path,'r')\n\t\t\tend\n\t\tend", "def initialize(file_name)\n @file = open(file_name)\n advance\n end", "def open(file, &blk)\n encoding = file_encoding(file)\n mode = encoding.nil? ? \"r\" : \"rb:#{encoding}\"\n File.open(file, \"#{mode}\") do |f|\n while line = f.gets\n line = line.nil? ? nil : cook_line(line.encode(@encoding))\n blk.call(line)\n end\n end\n end", "def file_open(*args, &block)\n if __transport_connection\n content = __transport_connection.file(args[0]).content\n string_io = StringIO.new content\n yield string_io if block_given?\n string_io\n else\n File.open(*args, &block)\n end\n end", "def initialize( *args )\n # Delegate to File::new and move to the end of the file.\n @file = File.new(*args)\n @file.seek(0, IO::SEEK_END)\n \n # Record where we are.\n @current_pos = @file.pos\n \n # Get the size of the next of the first read, the dangling bit of the file.\n @read_size = @file.pos % MAX_READ_SIZE\n @read_size = MAX_READ_SIZE if @read_size.zero?\n \n # A buffer to hold lines read, but not yet returned.\n @line_buffer = Array.new\n end", "def open(*args)\r\n\t\t\toptions={}\r\n\t\t\toptions[:name]=args.shift if !args[0].nil? and args[0].class==String\r\n\t\t\t@openoptions=options.merge(args[0]) unless @openoptions!=nil\r\n\t\t\toptions=options.merge(args[0])\r\n\t\t\tif @fh!=nil\r\n\t\t\t\tself.close\r\n\t\t\tend\r\n\t\t\texternal_fh=false\r\n\t\t\tif options[:name]=='-'\r\n\t\t\telse\r\n\t\t\t\tok=true\r\n\t\t\t\tif !options[:readonly]\r\n\t\t\t\t\tfh=File.new(options[:name],'w+')\r\n\t\t\t\t\trw=true\r\n\t\t\t\telse\r\n\t\t\t\t\tfh=File.new(options[:name],'r+')\r\n\t\t\t\t\trw=false\r\n\t\t\t\t\tok=true\r\n\t\t\t\tend\r\n\t\t\t\tif !ok\r\n\t\t\t\t\traise \"Error opening file #{options[:name]}: $!\\n\"\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\t@tell=0 if @SEEK_VIA_READ\r\n\t\t\tfh.flush\r\n\t\t\tfh.binmode unless external_fh\r\n\t\t\t@fh,@filename,@rw=fh,options[:name],rw\r\n\t\t\tself.read_header options\r\n\t\tend", "def my_file_reader(fname)\n fstream = File.open(fname, 'r')\n data = fstream.read\n fstream.close\n \n return data\nend", "def f\n @f ||= File.open(file, mode)\n end", "def read file\n File.open file\n end", "def read_file!(filename)\n File.open(filename, \"r\") do |f|\n self.read!(f)\n end\n # This is for convenience.\n return self\n end", "def file_reader(name, filename, delimiter='\\n')\n define_collection(name)\n @tables[name] = Bud::BudFileReader.new(name, filename, delimiter, self)\n end", "def initialize(file)\n @file = file.is_a?(String) ? File.open(file) : file\n end", "def initialize(file)\n @file = file.is_a?(String) ? File.open(file) : file\n end", "def initialize(file)\n @file = file.is_a?(String) ? File.open(file) : file\n end", "def initialize(in_file)\n @file = File.new(in_file, \"a+\")\n @filename = in_file\n end", "def read(opts = {})\n filename = opts.fetch(:filename, @filename)\n encoding = opts.fetch(:encoding, @encoding)\n return unless File.file? filename\n\n mode = encoding ? \"r:#{encoding}\" : 'r'\n File.open(filename, mode) { |fd| parse fd }\n self\n end", "def open path, mode=\"r\", &blk\n end", "def open path, mode=\"r\", &blk\n end", "def from_file(file)\n from_s Utils::read_file file\n end", "def from_file(file)\n from_s Utils::read_file file\n end", "def open(*args)\n tempfile = new(*args)\n \n if block_given?\n begin\n yield(tempfile)\n ensure\n tempfile.close\n end\n \n nil\n else\n tempfile\n end\n end", "def load(file)\r\n if file == String # does this work?\r\n @path = file\r\n end\r\n\r\n @reader = Reader.new(file)\r\n load_section self, @reader\r\n @reader.close\r\n end", "def initialize(input_file)\n @input_file = input_file\n @source = File.new(input_file)\n end", "def initialize(filename_or_handle)\n if filename_or_handle.is_a?(File)\n @file = filename_or_handle\n elsif filename_or_handle.is_a?(String)\n if File.exists? filename_or_handle\n @file = open(filename_or_handle)\n else\n raise \"File does not exist: #{filename_or_handle}\"\n end\n else\n raise \"You need to pass a filename or a File object\"\n end\n \n parseHeader\n end", "def from_file(filename, &block)\n deserialize(open(filename))\n end", "def initialize(rdb_filename)\n File.open(rdb_filename, \"rb\") do |file|\n @header = read_header(file)\n @data = file\n read_data\n end\n end", "def reader!(io_stream)\n return reader_class.new(io_stream, settings.merge(\"logger\" => logger))\n end", "def reader!(io_stream)\n return reader_class.new(io_stream, settings.merge(\"logger\" => logger))\n end", "def open!(file, *args, &block); end", "def initialize(filename, mode=\"r\", perm=0) end", "def instance\n @instance ||= if file\n from_json file\n else\n new\n end\n end", "def initialize(file=nil, line=1, options={}, &block)\n raise ArgumentError, \"file or block required\" if file.nil? && block.nil?\n @file = file\n @line = line || 1\n @options = options || {}\n @reader = block || lambda { |t| File.read(file) }\n end", "def open\n if [email protected]?\n @stream = File.open(file, @mode)\n end\n\n results = nil\n\n begin\n results = yield @stream if block_given?\n ensure\n if [email protected]?\n @stream.close\n @stream = nil\n end\n end\n\n results\n end", "def open(path, &block)\n File.open(File.join(self.path, path), \"r\", &block)\n end", "def file\n FileFactory.new(self)\n end", "def file_handler(filename, mode)\n @file = File.open(filename, mode)\nend", "def file(filename)\n check_file! filename\n\n File.new(filename)\n end", "def read(path, alt_path=nil)\n new(File.read(path), alt_path || path)\n end", "def read(path)\n new(CSV.read(path, **table_opts), path)\n end", "def initialize(file)\n @file = file\n end", "def initialize(file)\n @file = file\n end", "def read\n open(fullpath, 'r') do |io|\n if block_given?\n yield io\n else\n io.read\n end\n end\n end", "def open(file_name, create = T.unsafe(nil), options = T.unsafe(nil)); end", "def read_file(filename); end", "def initialize(input)\n @io = if input.respond_to?(:read)\n input\n else\n ::Kernel.open(input, \"rb\")\n end\n\n unless Archive::Tar::Minitar.seekable?(@io, :rewind)\n raise Archive::Tar::Minitar::NonSeekableStream\n end\n\n @tar = Reader.new(@io)\n end", "def open(p_attr = 'r')\n @@log.d(\"Open #{@path} as #{p_attr}\");\n if [email protected]? then\n @path.descend do |v|\n if !v.exist? && v != @path then\n # We need to make #{v}\n Dir.mkdir(v.to_s);\n end\n end\n end\n\n @file = File.open(@path, p_attr);\n @file.sync = true;\n\n self;\n end", "def file_stream\n @file_stream ||= File.open(@file_path, \"rb\")\n end", "def open_file(name)\n file = File.open(find_file(name), 'r')\n if block_given?\n begin\n return yield file\n ensure\n file.close\n end\n end\n file\n end", "def initialize filename, mode='r', *args, &block\n @filename = filename\n @mode = mode\n end", "def initialize(fname,mode=\"r\")\n case mode\n when \"r\",\"rb\"\n\tmode = \"rb\"\n when \"w\",\"wb\"\n\tmode = \"wb\"\n else\n raise \"Unsupported file mode '#{mode}'. Use 'r' or 'w'.\"\n end\n @file = File.open(fname, mode)\n @vars = Hash.new\n @attr = Hash.new\n end", "def use_file(filename, mode)\n\topen(filename, mode) do |file|\n\t\tyield(file)\n\tend\nend", "def open\n _close\n mode = @mode & ~(File::CREAT|File::EXCL)\n @tmpfile = File.open(@tmpfile.path, mode, **@opts)\n __setobj__(@tmpfile)\n end", "def open(path, mode=\"rb\", options={})\n options = {\n :io_index => nil,\n :reindex => false,\n :auto_reindex => true\n }.merge(options)\n \n index = options[:io_index]\n if index == nil\n index = index_path(path)\n FileUtils.touch(index) unless File.exists?(index)\n end\n \n begin\n io = path == nil ? nil : File.open(path, mode)\n io_index = case index\n when Array, ExternalIndex then index\n else ExternalIndex.open(index, 'r+', :format => 'II')\n end\n rescue(Errno::ENOENT)\n io.close if io\n io_index.close if io_index\n raise\n end\n \n extarc = new(io, io_index)\n \n # reindex if necessary\n if options[:reindex] || (options[:auto_reindex] && extarc.empty? && extarc.io.length > 0)\n extarc.reindex\n end\n \n if block_given?\n begin\n yield(extarc)\n ensure\n extarc.close\n end\n else\n extarc\n end\n end", "def get_file(path)\n return File.new(path)\n end", "def create_reader\n Polecat::IndexReader.new @path\n end", "def initialize f\n unless f.instance_of? IO\n f = File.new(f)\n end\n @source = f\n @elements = []\n parse_header f\n parse_body f\n end", "def openFile path, mode\n\t\tFile.open(path, mode)\n\tend", "def from_file path\n run File.read(path) if File.exists? path\n end", "def build_from_file(*args, file)\n build_from_block(*args) do\n instance_eval File.read(file), file\n end\n self\n end", "def load_file( filename )\n begin\n read_in = File.new( filename, 'r' )\n rescue\n abort \"\\\"#{ filename }\\\" not found\"\n end\nend", "def pdf_reader\n @pdf_reader ||= (PDF::Reader.new(file_handle) if file_handle)\n end", "def open\n @tmpfile.close if @tmpfile\n @tmpfile = File.open(@tmpname, @mode, @opts)\n __setobj__(@tmpfile)\n end", "def readFile(fname)\n\tinf = File.new(fname, \"r\")\n\tret = inf.read()\n\tinf.close\n\treturn ret\nend", "def initialize(file)\n @file = file\n end", "def initialize(file)\n @file = file\n end", "def initialize(file)\n @file = file\n end", "def initialize( file_name, mode=0 )\n @handle = SQLite::API.open( file_name, mode )\n @closed = false\n @results_as_hash = false\n @type_translation = false\n @translator = nil\n end", "def initialize(filename)\n @raw_data = IO.read filename\n yield self if block_given?\n end", "def open_read(hold_open=false,&block)\n hold_open||=@read_handle # if already open, keep open\n @read_handle=File.open(filename,\"rb\") unless @read_handle\n yield @read_handle if block\n ensure\n close_read unless hold_open\n end", "def initialize(file_path)\n\t\tbegin\n\t\t\t@file_desc = File.open(file_path)\n\t\trescue\n\t\t\traise \"File not found\"\n\t\tend\n\tend", "def open(filename)\n @file.nil? or raise \"Caption file already set\"\n @filename = filename\n @file = File.open(@filename, \"#{@mode}:#{@encoding}\")\n if @mode =~ /r/\n read_header\n parse_header\n scan\n rewind\n end\n return @file\n end", "def get_file(file_path)\n ensure_file_open!\n @file.read(file_path)\n end", "def read(options={})\n self.open(options) {|f|\n str = f.read\n Meta.init str, f\n str\n }\n end", "def initialize(args={})\n @file = args[:file]\n filepath = args[:filepath]\n unless @file || !filepath\n @file = ::File.open(filepath)\n end\n string = args[:string]\n unless @file || !string\n @file = StringIO.new(string, 'r')\n end\n post_initialize(args)\n end", "def initialize\n open\n end", "def initialize(file_name, file_mode)\r\n @file = File.new(file_name, file_mode)\r\n rescue\r\n error \"F51: Unable to open the file #{file_name} for writing.\"\r\n end", "def open(path)\n document = parse(File.read(path))\n document.path = path\n document\n end", "def open(*args, &block)\n end", "def initialize(file, options = {})\n # merge the options together\n @@options.merge!(options.kind_of?(Hash) ? options : {})\n \n # check that the path ends with a /\n if @@options['path'][-1, 1] != '/'\n @@options['path'] += '/'\n end\n \n # normalize the filename\n file = File.basename(file)\n \n # make sure chunkSize is an int\n @@options['chunkSize'] = @@options['chunkSize'].to_i()\n \n # check it's valid\n unless @@options['chunkSize'] >= 64\n @@options['chunkSize'] = 512\n end\n \n # set the filename\n @@file = File.expand_path(@@options['path'] + file)\n \n # check the file exists\n unless File.exists?(@@file)\n raise Exception.new('Cannot load file: ' + @@file)\n end\n \n # open the file\n @@handle = File.new(@@file, 'r')\n \n # check the file opened successfully\n unless @@handle\n raise Exception.new('Error opening file for reading')\n end\n \n # add a __destruct style method\n ObjectSpace.define_finalizer(self, self.class.method(:finalize).to_proc)\n end", "def open(file, mode='r', &block)\n if @default == :open_file\n open_file file, mode, &block\n else\n open_hg file, mode, &block\n end\n end", "def read\n @read ||= File.read(path)\n end", "def initialize(filename, read_properties=true)\n end", "def initialize(filename, read_properties=true)\n end", "def initialize(file)\n @file = file\n end", "def read_file(file, context); end" ]
[ "0.6770429", "0.6763743", "0.6684145", "0.66807795", "0.66690856", "0.6667623", "0.6591398", "0.6562737", "0.65228724", "0.6519875", "0.6478005", "0.64674985", "0.64426905", "0.64426905", "0.6430971", "0.63715106", "0.63647306", "0.63569015", "0.6350012", "0.6313734", "0.6295348", "0.62620145", "0.62468666", "0.62359864", "0.6232165", "0.6229968", "0.6216397", "0.62079865", "0.62079865", "0.62079865", "0.61348706", "0.60894644", "0.6089126", "0.6076581", "0.606566", "0.606566", "0.6061246", "0.60341865", "0.6015303", "0.60119694", "0.6006758", "0.59975004", "0.5981777", "0.5981777", "0.59781426", "0.5969474", "0.5966309", "0.5962169", "0.5958283", "0.595426", "0.59507716", "0.5947768", "0.5920016", "0.5919768", "0.5906168", "0.5896523", "0.5896523", "0.5891578", "0.5877956", "0.5866327", "0.58633024", "0.58508664", "0.58488005", "0.58483106", "0.58482987", "0.5838256", "0.5826967", "0.58246684", "0.58137876", "0.5811586", "0.58080256", "0.5805911", "0.57998425", "0.5785307", "0.57810044", "0.57806534", "0.5779084", "0.57737714", "0.5765104", "0.5757681", "0.5757681", "0.5757681", "0.57538044", "0.5741469", "0.571974", "0.57071614", "0.5701826", "0.57000726", "0.568984", "0.56816894", "0.56808776", "0.5679468", "0.5672083", "0.567128", "0.56701946", "0.5666568", "0.5664446", "0.56636214", "0.56636214", "0.56601095", "0.5634925" ]
0.0
-1
Reads the next token and returns it.
def next_token # Early return if there is nothing to be read. This means we've reached the end of the file. unless @file[@pos] return nil end # This is the token that will be returned. token = Compiler::Token.new # Initializes a new instance of the automaton. automaton = Automaton.new # Will be set inside the loop, if necessary. increment_next = false # Will be set inside the loop. Marks whether we've reached the end of the file. eof = false # Build a new token while we don't have a new word yet and isn't in the failed state while ((automaton.state != :A || automaton.word.empty?) && automaton.state != :failed) # The next input for the automaton char = @file[@pos] if char # Moves the pointer to the next char @pos += 1 automaton.transition(char) # While the automaton hasn't started to build a new word yet, increments the line and column numbers. # In this phase, we're just skipping blank characters if automaton.word.empty? if increment_next if char == "\n" increment_next = true else increment_next = false end @line += 1 @column = 0 elsif char == "\n" @column += 1 increment_next = true else @column += 1 end end else eof = true puts "breaking" break end end if eof automaton.transition("\n") else @pos -= 1 end if (automaton.type == :identifier) && (Compiler.reserved_words.is_reserved?(automaton.word)) token.type = :reserved_word else token.type = automaton.type end token.value = automaton.word token.line = @line token.column = @column return token end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next\n\t\tif @next_token\n\t\t\ttoken = @next_token\n\t\t\t@next_token = nil\n\t\t\treturn token\n\t\telse\n\t\t\ttoken = read_token\n\t\t\treturn token\n\t\tend\n\tend", "def get_token\n @tokenbuf << read_token if @tokenbuf.length == 0\n return @tokenbuf.shift\n end", "def next_token\n tokens.shift\n end", "def next\n @tok ||= read_token\n @tok, tok = nil, @tok\n @prev = tok\n return tok\n end", "def next_token\n @tokens.shift\n end", "def next\n token = next_token\n token = next_token while token&.empty?\n token\n end", "def next_token\r\n if [email protected]?\r\n\t\t\t@token = @token.following\r\n\t\t\treturn @token.value\r\n\t\tend\r\n\r\n\t\tscan(@token)\r\n\t\treturn @token.value\r\n end", "def next_token\n\t\[email protected]_token\n\tend", "def token\n item = read\n return item['token'] if item['token']\n token_reset\n read['token']\n end", "def peek_token(n=1)\n n.times{|x| @tokenbuf << read_token if @tokenbuf.length == 0 }\n return @tokenbuf[n-1]\n end", "def peek\n @tok ||= read_token\n end", "def next_token\n\t\tif (token = @tokens.shift) != nil\n\t\t\t@copy << token\n\t\t\treturn token.get_token\n\t\telse\n\t\t\treturn nil\n\t\tend\n\tend", "def read_next_token(token_class)\n if @next_token\n return @next_token\n else\n # check for a match on the specified class first\n if match(token_class)\n return @next_token\n else\n # now check all the tokens for a match\n Taxonifi::Splitter::Tokens.send(@token_list).each {|t|\n return @next_token if match(t)\n }\n end\n # no match, either end of string or lex-error\n if @input != ''\n raise(Taxonifi::Splitter::SplitterError, \"Lexer Error, unknown token at |#{@input[0..20]}...\", caller)\n else\n return nil\n end\n end\n end", "def next_token\n\t\t@token = @input.next_token\n\tend", "def next_token\n @state = 1\n value = \"\"\n recovery_data = [0, 0]\n\n while [email protected]?\n char = @stream.read(1)\n next_state = get_next_state(char)\n\n # Move to the next state.\n if next_state\n if recognizable?\n recovery_data = [@state, 0]\n end\n\n value << char\n recovery_data[1] += 1\n @state = next_state\n else\n # Recognise the final token.\n if recognizable?\n @stream.seek(@stream.pos - 1)\n break\n else\n # Recoverable error.\n if recovery_data[0] > 0\n value = recover_from_error!(recovery_data, value)\n break\n # Fatal lexical error.\n else\n raise Bolverk::ASM::LexicalError, \"Disallowed token: #{char} on line #{@stream.line_number}\"\n end\n end\n end\n end\n\n build_token(value)\n end", "def next_token; end", "def next()\n if @ss.scan_until(token_re)\n term = @ss.matched\n term_end = @ss.pos\n term_start = term_end - term.size\n else\n return nil\n end\n\n return Token.new(normalize(term), term_start, term_end)\n end", "def next_token\n token = @enum[@pointer]\n raise NonstringTokenError unless token.nil? || token.kind_of?(String) \n @pointer += 1\n token\n end", "def next\n catch :done do\n while !(info = progress)\n # do nothing - waiting for token\n end\n return info # got token\n end\n return nil # got end of sequence\n end", "def consume\n cur = @current_token\n next_token\n return cur\n end", "def next_token()\n raise LexicalError.new(\"No input text was provided.\", LexemePosition::at_start) if token_recognition_state == :waiting_for_input\n\n\t\tif queue.empty?\n unless token_recognition_state == :ready\n error_message = \"#{__method__} may not be called when state is #{token_recognition_state}\"\n raise LexerSetupError.new(error_message)\n end\n\n enqueue_next_tokens() # Retrieve token(s) from the input text & enqueue them\n end\n theToken = queue.dequeue()\n\t\treturn theToken\n end", "def racc_read_token(t, tok, val); end", "def next_token\n\t\tif ((tok = @tokensList.shift) != nil)\n\t\t\t@tokensAux << tok\n\t\t\treturn tok.idAndValue\n\t\telse\n\t\t\treturn nil\n\t\tend\n\tend", "def next_token\n raise NotImplementedError\n end", "def next_token\n #dputs \"@line: \" + @line\n if @state == :normal\n while true\n temp = _next_token\n unless temp == \"#white_space\" || temp == \"#comment\"\n break\n end\n end\n #dputs \"token: \" + temp\n @current_token = temp\n return temp\n else\n return :Terminate\n end\n \n end", "def next_token; @stack.shift; end", "def next_token\n @current_token = @lexer.next_token\n end", "def next\n if @state == :start && @scanner.eos?\n return nil\n else\n scan_next_token\n end\n end", "def next_token\n result = peek_token\n @start = @finish\n return result if @start >= @expr.length\n\n if @expr[@start].numeric?\n @finish = @start + 1\n while @finish < @expr.length && @expr[@finish].to_s.numeric?\n @finish = @finish + 1\n end\n else\n @finish = @start + 1\n end\n result\n end", "def get\n @current_token = @tokens.shift\n p :get => @current_token if @debug\n @current_token\n end", "def get\n @current_token = @tokens.shift\n p :get => @current_token if @debug\n @current_token\n end", "def next_token\n\n token = nil\n\n until ss.eos? or token do\n if ss.peek(1) == \"\\n\"\n self.lineno += 1\n # line starts 1 position after the newline\n self.start_of_current_line_pos = ss.pos + 1\n end\n self.old_pos = ss.pos\n token =\n case state\n when nil then\n case\n when ss.skip(/[ \\t]+/) then\n # do nothing\n when ss.skip(/\\/\\/[^\\r\\n]*/) then\n # do nothing\n when text = ss.scan(/\\r|\\n/) then\n newline text\n when text = ss.scan(/[!=<>]=?/) then\n action { [:SPECIAL, text] }\n when text = ss.scan(/[(){},;.\\-+\\/*]/) then\n action { [:SPECIAL, text] }\n when text = ss.scan(/#{DIGIT}+(\\.#{DIGIT}+)?/) then\n action { [:NUMBER, text] }\n when text = ss.scan(/nil/) then\n action { [:NIL, text] }\n when text = ss.scan(/false/) then\n action { [:FALSE, text] }\n when text = ss.scan(/true/) then\n action { [:TRUE, text] }\n when text = ss.scan(/#{ALPHA}(#{ALPHA}|#{DIGIT})*/) then\n action { [:IDENTIFIER, text] }\n when ss.skip(/\"\"/) then\n action { [:STRING, '\"\"'] }\n when ss.skip(/\"/) then\n [:state, :IN_STRING]\n else\n text = ss.string[ss.pos .. -1]\n raise ScanError, \"can not match (#{state.inspect}) at #{location}: '#{text}'\"\n end\n when :IN_STRING then\n case\n when text = ss.scan(/[^\"]+/) then\n action { [:STRING, \"\\\"#{text}\\\"\"] }\n when ss.skip(/\"/) then\n [:state, nil]\n else\n text = ss.string[ss.pos .. -1]\n raise ScanError, \"can not match (#{state.inspect}) at #{location}: '#{text}'\"\n end\n else\n raise ScanError, \"undefined state at #{location}: '#{state}'\"\n end # token = case state\n\n next unless token # allow functions to trigger redo w/ nil\n end # while\n\n raise LexerError, \"bad lexical result at #{location}: #{token.inspect}\" unless\n token.nil? || (Array === token && token.size >= 2)\n\n # auto-switch state\n self.state = token.last if token && token.first == :state\n\n token\n end", "def next_token\n @sy = @tokenizer.next_token\n \n # ignore EOL tokens since no productions would accept them\n while @sy.type == TokenType::EOL_TOKEN\n @sy = @tokenizer.next_token\n end\n end", "def peek\n @tokens[@position]\n end", "def peek # :nodoc:\n @tokens.peek\n end", "def getNextToken\n \n #Check if the end has been reached\n if @currentChar == nil\n return\n end\n if @currentChar.match(/\\s/) != nil\n skipWhitespaces\n end\n \n if @currentChar == '%'\n comment\n if @currentChar.match(/\\s/) != nil\n skipWhitespaces\n end\n end \n \n if @currentChar.match(/[A-Za-z0-9_]/) != nil\n return Token.new(NAME, name)\n end\n \n if @currentChar == \"\\\"\"\n return Token.new(STRING, string)\n end\n \n if @currentChar == '{'\n advance\n return Token.new(OPENING_BRACE,'{')\n end\n \n if @currentChar == '}'\n advance\n return Token.new(CLOSING_BRACE,'}')\n end\n \n if @currentChar == '['\n advance\n return Token.new(OPENING_BRACKET,'[')\n end\n \n if @currentChar == ']'\n advance\n return Token.new(CLOSING_BRACKET,']')\n end\n \n if @currentChar == ':'\n advance\n return Token.new(COLON,':')\n end\n \n if @currentChar == '*'\n advance\n return Token.new(ASTERIX,'*')\n end\n \n if @currentChar == '='\n advance\n return Token.new(EQUALS,'=')\n end\n \n if @currentChar == ';'\n advance\n return Token.new(SEMICOLON,';')\n end\n \n if @currentChar == '^'\n advance\n return Token.new(CIRCUMFLEX,'^')\n end\n \n if @currentChar == '+'\n advance\n return Token.new(PLUS,'+')\n end\n if @currentChar == '('\n advance\n return Token.new(OPENING_PARANTHESIS,'(')\n end\n if @currentChar == ')'\n advance\n return Token.new(CLOSING_PARANTHESIS,')')\n end\n if @currentChar == '.'\n advance\n return Token.new(DOT,'.')\n end\n if @currentChar == '#'\n advance\n return Token.new(HASH,'#')\n end\n if @currentChar == ','\n advance\n return Token.new(COMMA,',')\n end\n error\n \n return Token.new(EOF,'EOF') \n \n end", "def peek_next(token)\r\n\t\tif !token.following.nil?\r\n\t\t return token.following\r\n\t\tend\r\n\r\n\t\tpeekToken = Token.new\r\n\t\tscan(peekToken)\r\n\t\ttoken.following = peekToken\r\n\t\treturn peekToken\r\n\tend", "def next_token\n\n token = nil\n\n until ss.eos? or token do\n token =\n case state\n when nil then\n case\n when text = ss.scan(/#{DIGIT}/) then\n action { [:DIGIT, text.to_i] }\n when text = ss.scan(/#{ADDITION}/) then\n action { [:ADDITION, text] }\n when text = ss.scan(/#{SUBSTRACTION}/) then\n action { [:SUBSTRACTION, text] }\n when text = ss.scan(/#{MULTIPLICATION}/) then\n action { [:MULTIPLICATION, text] }\n when text = ss.scan(/#{DIVISION}/) then\n action { [:DIVISION, text] }\n when text = ss.scan(/#{OPENING_PARANTHESIS}/) then\n action { [:OPENING_PARANTHESIS, text] }\n when text = ss.scan(/#{CLOSING_PARANTHESIS}/) then\n action { [:CLOSING_PARANTHESIS, text] }\n else\n text = ss.string[ss.pos .. -1]\n raise ScanError, \"can not match (#{state.inspect}) at #{location}: '#{text}'\"\n end\n else\n raise ScanError, \"undefined state at #{location}: '#{state}'\"\n end # token = case state\n\n next unless token # allow functions to trigger redo w/ nil\n end # while\n\n raise LexerError, \"bad lexical result at #{location}: #{token.inspect}\" unless\n token.nil? || (Array === token && token.size >= 2)\n\n # auto-switch state\n self.state = token.last if token && token.first == :state\n\n token\n end", "def token\n ready_token\n\n i = @buffer.index(/[\\[\\]()<>{}\\s\\/]/) || @buffer.size\n\n token_chars =\n if i == 0 and @buffer[i,2] == \"<<\" then 2\n elsif i == 0 and @buffer[i,2] == \">>\" then 2\n elsif i == 0 then 1\n else i\n end\n\n strip_space = !(i == 0 and @buffer[0,1] == '(')\n tok = head(token_chars, strip_space)\n\n if tok == \"\"\n nil\n elsif tok[0,1] == \"%\"\n @buffer = \"\"\n token\n else\n tok\n end\n end", "def peek\n @tokens[@pos]\n end", "def peek_token(n = 0)\n raise ArgumentError.new(\"can't look back in the token stream\") if n < 0\n @enum[@pointer + n]\n end", "def next_token\n\n if @ss.bol?\n @line+=1\n @[email protected]\n end\n\n position=[@line,@ss.pos-@old_pos+1]\n\n return :eos if @ss.eos?\n\n case\n when text = @ss.scan(NEWLINE)\n next_token()\n when text = @ss.scan(SPACE)\n next_token()\n when text = @ss.scan(COMMENT)\n next_token()\n when text = @ss.scan(ARROW)\n return Token.new [:arrow,text,position]\n when text = @ss.scan(LT)\n return Token.new [:lt,text,position]\n when text = @ss.scan(LBRACK)\n return Token.new [:lbrack,text,position]\n when text = @ss.scan(RBRACK)\n return Token.new [:rbrack,text,position]\n when text = @ss.scan(IDENTIFIER)\n case\n when value = text.match(IDENT)\n return Token.new [:IDENT,text,position]\n when value = text.match(FLOAT)\n return Token.new [:FLOAT,text,position]\n when value = text.match(INT)\n return Token.new [:INT,text,position]\n when value = text.match(STRING)\n return Token.new [:STRING,text,position]\n when value = text.match(MODULE)\n return Token.new [:module,text,position]\n when value = text.match(CLASS)\n return Token.new [:class,text,position]\n when value = text.match(END_)\n return Token.new [:end,text,position]\n when value = text.match(ATTR)\n return Token.new [:attr,text,position]\n when value = text.match(LPAREN)\n return Token.new [:lparen,text,position]\n when value = text.match(RPAREN)\n return Token.new [:rparen,text,position]\n else\n return Token.new [:identifier,text,position]\n end\n else\n x = @ss.getch\n return Token.new [x, x,position]\n end\n end", "def peek\n @tokens.at(@current)\n end", "def peek_token(amount = 1)\n index = @token_index + amount\n @tokens[index]\n end", "def next\n raise IOError.new(\"Stream is at the end of file.\") if eof?\n end_of_token = false\n token = \"\"\n while not end_of_token\n c = @file.getc\n puts \"next c: #{c.inspect} v: #{valid_char?(c)} s: #{single_char?(c)} e: #{is_end_character?(c)}\" if @debug\n if eof? then\n end_of_token = true\n elsif (single_char?(c)) then\n if (token.empty?) then\n token = c\n next_token = @file.getc\n if ('#' == token and '#' == next_token) then\n token << next_token\n else\n @file.seek(-1, IO::SEEK_CUR)\n end\n else\n @file.seek(-1, IO::SEEK_CUR)\n end\n end_of_token = true\n elsif (valid_char?(c)) then\n token << c\n elsif is_end_character?(c) then\n move_till_next_token\n end_of_token = (not token.empty?)\n end\n end\n puts \"next\" if @debug\n build_token(token)\n end", "def next_token\n return if @scanner.eos?\n\n if @scanner.scan(SKIP_PATTERN)\n @column += @scanner[:before].length\n\n new_lines = @scanner[:new_line].delete(\"\\r\")\n unless new_lines.empty?\n @lineno += new_lines.length\n @column = 0\n end\n\n @column += @scanner[:after].length\n end\n\n token =\n case\n when try_match(REFERENCE_PATTERN)\n Token.new :REFERENCE, @scanner[:identifier], @lineno, @column\n when try_match(PATH_PATTERN)\n Token.new :PATH, @scanner[:identifier], @lineno, @column\n when try_match(FILTER_PATTERN) && @scanner.check(OPEN_PAREN_PATTERN)\n Token.new :FILTER, \"?\", @lineno, @column\n when try_match(OPEN_BRACKET_PATTERN)\n @state_stack.push Token.new :OPEN_BRACKET, \"[\", @lineno, @column\n @state_stack.last\n when try_match(OPEN_PAREN_PATTERN)\n @state_stack.push Token.new :OPEN_PAREN, \"(\", @lineno, @column\n @state_stack.last\n when try_match(CLOSE_BRACKET_PATTERN)\n last = @state_stack.pop\n unless last\n raise TokenizeError.unexpected(\"]\", @lineno, @column)\n end\n unless last.type == :OPEN_BRACKET\n raise TokenizeError.unbalanced(\"[\", last.lineno, last.column)\n end\n Token.new :CLOSE_BRACKET, \"]\", @lineno, @column\n when try_match(CLOSE_PAREN_PATTERN)\n last = @state_stack.pop\n unless last\n raise TokenizeError.unexpected(\")\", @lineno, @column)\n end\n unless last.type == :OPEN_PAREN\n raise TokenizeError.unbalanced(\"(\", last.lineno, last.column)\n end\n Token.new :CLOSE_PAREN, \")\", @lineno, @column\n when try_match(SELF_PATTERN)\n Token.new :SELF, \"@\", @lineno, @column\n when try_match(NUMBER_PATTERN)\n Token.new :NUMBER, BigDecimal.new(@last_captured), @lineno, @column\n when try_match(STRING_PATTERN)\n Token.new :STRING, @scanner[:str], @lineno, @column\n when try_match(TRUE_PATTERN)\n Token.new :BOOLEAN, true, @lineno, @column\n when try_match(FALSE_PATTERN)\n Token.new :BOOLEAN, false, @lineno, @column\n when try_match(COLON_PATTERN)\n Token.new :COLON, \":\", @lineno, @column\n when try_match(COMMA_PATTERN)\n Token.new :COMMA, \",\", @lineno, @column\n when try_match(ADD_PATTERN)\n Token.new :ADD, \"+\", @lineno, @column\n when try_match(SUBTRACT_PATTERN)\n case @tokens.last&.type\n when nil, :OPEN_PAREN, :OPEN_BRACKET, :COMMA, :COLON, :POW, :MOD, :ADD, :SUBTRACT, :MULTIPLY, :DIVIDE\n if @scanner.check(NUMBER_PATTERN) ||\n @scanner.check(REFERENCE_PATTERN) ||\n @scanner.check(SUBTRACT_PATTERN) ||\n @scanner.check(OPEN_PAREN_PATTERN)\n Token.new :UMINUS, \"-\", @lineno, @column\n else\n raise TokenizeError.unexpected(\"-\", @lineno, @column)\n end\n else\n Token.new :SUBTRACT, \"-\", @lineno, @column\n end\n when try_match(MULTIPLY_PATTERN)\n Token.new :MULTIPLY, \"*\", @lineno, @column\n when try_match(DIVIDE_PATTERN)\n Token.new :DIVIDE, \"/\", @lineno, @column\n when try_match(POW_PATTERN)\n Token.new :POW, \"^\", @lineno, @column\n when try_match(MOD_PATTERN)\n Token.new :MOD, \"%\", @lineno, @column\n when try_match(EQUAL_TO_PATTERN)\n Token.new :EQUAL_TO, \"==\", @lineno, @column\n when try_match(NOT_EQUAL_TO_PATTERN)\n Token.new :NOT_EQUAL_TO, \"!=\", @lineno, @column\n when try_match(GREATER_THAN_OR_EQUAL_TO_PATTERN)\n Token.new :GREATER_THAN_OR_EQUAL_TO, \">=\", @lineno, @column\n when try_match(GREATER_THAN_PATTERN)\n Token.new :GREATER_THAN, \">\", @lineno, @column\n when try_match(LESS_THAN_OR_EQUAL_TO_PATTERN)\n Token.new :LESS_THAN_OR_EQUAL_TO, \"<=\", @lineno, @column\n when try_match(LESS_THAN_PATTERN)\n Token.new :LESS_THAN, \"<\", @lineno, @column\n when try_match(AND_PATTERN)\n Token.new :AND, \"&&\", @lineno, @column\n when try_match(OR_PATTERN)\n Token.new :OR, \"||\", @lineno, @column\n when try_match(NOT_PATTERN)\n Token.new :NOT, \"!\", @lineno, @column\n when try_match(INTERSECT_PATTERN)\n Token.new :INTERSECT, \"&\", @lineno, @column\n when try_match(UNION_PATTERN)\n Token.new :UNION, \"|\", @lineno, @column\n when try_match(IDENTIFIER_PATTERN) && @scanner.check(OPEN_PAREN_PATTERN)\n unless @scanner.check(OPEN_PAREN_PATTERN)\n raise TokenizeError.unexpected(@scanner.peek(7), @lineno, @column)\n end\n Token.new :FUNCTION, @last_captured, @lineno, @column\n else\n raise TokenizeError.unexpected(@scanner.peek(7), @lineno, @column)\n end\n\n @column += @last_captured.length\n @tokens << token\n\n token\n end", "def current_token\n @tokens[@token_index]\n end", "def next\n if @next.is_a? TokenSource\n @next = @next.next\n return @next \n end\n @next\n end", "def peek_token\n return nil if @start >= @expr.length\n if @start == 0 && @finish == 0\n return @expr[0]\n else\n token = @expr[@start...@finish]\n\n if token.empty?\n @finish = @finish + 1\n peek_token\n else\n return token\n end\n end\n end", "def consume\n @current = @tokens[@pos]\n @pos += 1 if @current\n @current\n end", "def read_until_token_source\n %Q|\n var readUntilToken = function(cb) {\n Components.utils.import(\"resource://gre/modules/NetUtil.jsm\");\n\n var buffer = '', m = null;\n return function(request, context, stream, offset, count) {\n buffer += NetUtil.readInputStreamToString(stream, count);\n if (buffer.match(/^(\\\\[\\\\[\\\\w{8}\\\\]\\\\])/)) {\n if (m = buffer.match(/^(\\\\[\\\\[\\\\w{8}\\\\]\\\\])([\\\\s\\\\S]*)\\\\1/)) {\n cb(m[2]);\n buffer = '';\n }\n } else if (buffer.indexOf(\"\\\\n\") > -1) {\n cb(buffer);\n buffer = '';\n }\n };\n };\n |\n end", "def peek_next\n fail 'No string specified' unless @str\n\n return Token.new(:eos) if skip_space == :eos\n\n PATTERNS.each do |re, func|\n re.match(@str) do |mat|\n @last_re = re # This is what will be removed\n mat = mat.to_s\n return func.is_a?(Symbol) ? send(func, mat) : instance_exec(mat, &func)\n end\n end\n end", "def next\n displacement = @file.gets.try(:chomp).try(:to_f)\n return nil unless displacement\n\n ret = @curr_val\n @curr_val += displacement\n ret\n end", "def next_token(options = { should_advance?: true })\n if @current_scope.type == Scope::TYPE_MAIN && @current_scope.current_token.nil?\n token = @lexer.next_token\n @current_scope.tokens << token unless token.nil?\n end\n\n token = @current_scope.current_token\n\n advance token if options[:should_advance?] && token\n\n token\n end", "def get_next\n return if eof?\n\n @buffer << @io.gets if @buffer.empty?\n\n until @io.eof?\n line = @io.gets\n next unless line\n\n if @parser.start_new?(line) || @buffer.empty?\n @buffer << line\n break\n else\n @buffer.last << line\n end\n end\n\n return if @buffer.empty?\n @parser.parse(@buffer.slice!(0)) || self.get_next\n end", "def next_token\n\n token = nil\n\n until ss.eos? or token do\n token =\n case state\n when nil then\n case\n when ss.skip(/\\s+/) then\n # do nothing\n when ss.skip(/:(#{SYMBOL_NAME})/o) then\n action { emit :tSYMBOL, &:to_sym }\n when ss.skip(/\"(.+?)\"/) then\n action { emit :tSTRING }\n when ss.skip(/[-+]?\\d+\\.\\d+/) then\n action { emit :tNUMBER, &:to_f }\n when ss.skip(/[-+]?\\d+/) then\n action { emit :tNUMBER, &:to_i }\n when ss.skip(/#{Regexp.union(\n %w\"( ) { | } [ ] < > $ ! ^ ` ... + * ? ,\"\n )}/o) then\n action { emit ss.matched, &:to_sym }\n when ss.skip(/#{REGEXP}/o) then\n action { emit_regexp }\n when ss.skip(/%?(#{CONST_NAME})/o) then\n action { emit :tPARAM_CONST }\n when ss.skip(/%([a-z_]+)/) then\n action { emit :tPARAM_NAMED }\n when ss.skip(/%(\\d*)/) then\n action { emit(:tPARAM_NUMBER) { |s| s.empty? ? 1 : s.to_i } } # Map `%` to `%1`\n when ss.skip(/_(#{IDENTIFIER})/o) then\n action { emit :tUNIFY }\n when ss.skip(/_/o) then\n action { emit :tWILDCARD }\n when ss.skip(/\\#(#{CALL})/o) then\n action { @state = :ARG; emit :tFUNCTION_CALL, &:to_sym }\n when ss.skip(/#{IDENTIFIER}\\?/o) then\n action { @state = :ARG; emit :tPREDICATE, &:to_sym }\n when ss.skip(/#{NODE_TYPE}/o) then\n action { emit :tNODE_TYPE, &:to_sym }\n when ss.skip(/\\#.*/) then\n action { emit_comment }\n else\n text = ss.string[ss.pos .. -1]\n raise ScanError, \"can not match (#{state.inspect}) at #{location}: '#{text}'\"\n end\n when :ARG then\n case\n when ss.skip(/\\(/) then\n action { @state = nil; emit :tARG_LIST }\n when ss.skip(//) then\n action { @state = nil }\n else\n text = ss.string[ss.pos .. -1]\n raise ScanError, \"can not match (#{state.inspect}) at #{location}: '#{text}'\"\n end\n else\n raise ScanError, \"undefined state at #{location}: '#{state}'\"\n end # token = case state\n\n next unless token # allow functions to trigger redo w/ nil\n end # while\n\n raise LexerError, \"bad lexical result at #{location}: #{token.inspect}\" unless\n token.nil? || (Array === token && token.size >= 2)\n\n # auto-switch state\n self.state = token.last if token && token.first == :state\n\n token\n end", "def token_get()\n\t\tputs \"Here is the token \" + @token\n\tend", "def peek_token\n token = @tokens.first || []\n p :peek => token if @debug\n token\n end", "def peek_token\n token = @tokens.first || []\n p :peek => token if @debug\n token\n end", "def read\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 28 )\n\n begin\n # at line 908:3: ( iread | fread | cread )\n alt_30 = 3\n case look_30 = @input.peek( 1 )\n when T__49 then alt_30 = 1\n when T__50 then alt_30 = 2\n when T__51 then alt_30 = 3\n else\n raise NoViableAlternative( \"\", 30, 0 )\n end\n case alt_30\n when 1\n # at line 909:5: iread\n @state.following.push( TOKENS_FOLLOWING_iread_IN_read_1471 )\n iread\n @state.following.pop\n\n when 2\n # at line 910:7: fread\n @state.following.push( TOKENS_FOLLOWING_fread_IN_read_1479 )\n fread\n @state.following.pop\n\n when 3\n # at line 911:7: cread\n @state.following.push( TOKENS_FOLLOWING_cread_IN_read_1487 )\n cread\n @state.following.pop\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 28 )\n\n end\n \n return \n end", "def token\n @token\n end", "def read\n return nil if self.payload.empty?\n self.offset += 1\n return self.payload.shift\n end", "def get_token\n\t\tt = Token.new\n\t\tcase @src[@lineno][@linepos]\n\t\t\twhen ' ' then\n\t\t\t\tskip_whitespace\n\t\t\twhen '\\f' then #less likely to see this\n\t\t\t\tskip_whitespace\n\t\t\twhen '\\t' then\n\t\t\t\tskip_whitespace\n\t\t\twhen '\\v' then\n\t\t\t\tskip_whitespace\n\t\t\twhen '0'..'9' then\n\t\t\t\tt = parse_number\n\t\t\twhen 'A-Z' then\n\t\t\t\tt = parse_name\n\t\t\twhen 'a-z' then\n\t\t\t\tparse_name\n\t\t\twhen '_' then\n\t\t\t\tt = parse_name\n\t\t\twhen /[~!$%\\^&*()-+=|{}\\[\\]\\:;\\/?<>,.]/ then #very much check\n\t\t\t\tt = parse_operator\n\t\t\twhen '\"' then\n\t\t\t\tt = parse_string\n\t\tend\n\tend", "def pop_token\n @token_stream.pop\n end", "def pop_token\n @token_stream.pop\n end", "def next_token(w)\n\tif w[0] != '('\n\t\treturn w.slice!(0)\n\tend\n\n\tw.slice!(0) #remove that leading '('\n\n\ttoken = \"\"\n\twhile true\n\t\tc = w.slice!(0)\n\t\tif c == ')'\n\t\t\tbreak\n\t\tend\n\n\t\ttoken << c\n\tend\n\n\treturn token\nend", "def read_token()\n credentials_path = 'data/discord_credentials.json'\n if not File.exists?(credentials_path)\n puts(\"No discord credentials file found. Will now abort.\")\n exit()\n end\n credentials = File.read(credentials_path)\n return JSON.parse(credentials)[\"token\"]\n end", "def read_from_tokens(tokens)\n raise SyntaxError, 'unexpected EOF while reading' if tokens.size == 0\n token = tokens.shift\n if '(' == token\n sexp = []\n sexp.push(read_from_tokens(tokens)) while tokens.first != ')'\n tokens.shift # remove the ')'\n return sexp\n elsif ')' == token\n raise SyntaxError, 'unexpected )'\n else\n return atom(token)\n end\nend", "def peak\n\t\tif not @next_token\n\t\t\t@next_token = read_token\n\t\tend\n\t\treturn @next_token\n\tend", "def get_next\n return if eof?\n\n @buffer << gets if @buffer.empty?\n\n until @io.eof? && @io_buf.empty?\n line = gets\n next unless line\n\n if @parser.start_new?(line) || @buffer.empty?\n @buffer << line\n break\n else\n @buffer.last << line\n end\n end\n\n return if @buffer.empty?\n @parser.parse(@buffer.slice!(0)) || self.get_next\n end", "def getTokenText()\r\n return @curr_token.text\r\n end", "def token\n return @children['token'][:value]\n end", "def token\n @data[:token]\n end", "def token\n File.read(config_file)\n end", "def next\n ret = peek_next\n @str.slice! @last_re if ret.type != :eos\n\n ret\n end", "def current_token\n @stream.current_token\n end", "def token\n @token\n end", "def read_next_command\n\n\t\tif [email protected]\n\t\t\[email protected]\n\t\telse\n\t\t\[email protected]\n\t\tend\n\n\tend", "def read_next()\n return nil if @at_end\n\n begin\n pos = @marker.position\n\n if @marker.character == ?\\n\n pos.line += 1\n pos.column = 0\n end\n\n @marker.character = @reader.next\n @marker.source_index += 1\n pos.column += 1\n rescue StopIteration\n @at_end = true\n @marker.character = nil\n end\n\n @marker.character\n end", "def next\n File.open(\"experiments/test.txt\", 'r') do |f|\n f.seek(@position, IO::SEEK_SET)\n while char = f.getc\n\n if char == \"\\n\"\n @row += 1\n @column = 0\n else\n @column += 1\n end\n\n case @state\n when 0 # Starting state\n\n @token = Lexigen::Token.new\n @token.column = @column\n @token.row = @row\n\n case char\n when /\\d/ # When digit\n @token.word << char\n @state = 1\n when /\\s/ # When space\n @state = 0\n when /\\w/ # When letter\n @token.word << char\n @state = 3\n else # Everything else\n @position = f.pos - 1\n return \"error\"\n end\n when 1 # Integer\n case char\n when /\\d/ # When digit\n @token.word << char\n @state = 1\n when /\\./ # When decimal point\n @token.word << char\n @state = 2\n else # Return integer\n @state = 0\n @token.type = :int\n @position = f.pos - 1\n return @token\n end\n when 2 # Float\n case char\n when /\\d/ # When digit\n @token.word << char\n @state = 2\n else # Return float\n @state = 0\n @token.type = :float\n @position = f.pos - 1\n return @token\n end\n when 3 # Identification\n case char\n when /\\w|\\d|_/ # When letter, digit or underscore\n @token.word << char\n @state = 3\n else # Return identification\n @state = 0\n @token.type = :id\n @position = f.pos - 1\n return @token\n end\n end\n end\n\n end\n end", "def token_from(data)\n extract_from(data, /Token token='(.+)'/).first rescue nil\n end", "def skip token_type, error = true\n type, data, = get\n\n return unless type # end of stream\n\n return @current_token if token_type == type\n\n unget\n\n raise ParseError, \"expected #{token_type} got #{@current_token.inspect}\" if\n error\n end", "def token; end", "def token; end", "def token; end", "def token; end", "def token; end", "def token; end", "def next_token\n return process_string if lex_strterm\n self.cmd_state = self.command_start\n self.command_start = false\n self.space_seen = false # TODO: rename token_seen?\n self.last_state = lex_state\n\n token = nil\n\n until ss.eos? or token do\n token =\n case state\n when nil then\n case\n when ss.skip(/[\\ \\t\\r\\f\\v]/) then\n action { self.space_seen = true; next }\n when text = ss.scan(/\\n|\\#/) then\n process_newline_or_comment text\n when text = ss.scan(/[\\]\\)\\}]/) then\n process_brace_close text\n when ss.match?(/\\!/) then\n case\n when is_after_operator? && (ss.skip(/\\!\\@/)) then\n action { result EXPR_ARG, :tUBANG, \"!@\" }\n when text = ss.scan(/\\![=~]?/) then\n action { result :arg_state, TOKENS[text], text }\n end # group /\\!/\n when ss.match?(/\\./) then\n case\n when text = ss.scan(/\\.\\.\\.?/) then\n action { result EXPR_BEG, TOKENS[text], text }\n when ss.skip(/\\.\\d/) then\n action { rb_compile_error \"no .<digit> floating literal anymore put 0 before dot\" }\n when ss.skip(/\\./) then\n action { self.lex_state = EXPR_BEG; result EXPR_DOT, :tDOT, \".\" }\n end # group /\\./\n when text = ss.scan(/\\(/) then\n process_paren text\n when text = ss.scan(/\\,/) then\n action { result EXPR_PAR, TOKENS[text], text }\n when ss.match?(/=/) then\n case\n when text = ss.scan(/\\=\\=\\=|\\=\\=|\\=~|\\=>|\\=(?!begin\\b)/) then\n action { result arg_state, TOKENS[text], text }\n when bol? && (text = ss.scan(/\\=begin(?=\\s)/)) then\n process_begin text\n when text = ss.scan(/\\=(?=begin\\b)/) then\n action { result arg_state, TOKENS[text], text }\n end # group /=/\n when ruby22_label? && (text = ss.scan(/\\\"#{SIMPLE_STRING}\\\":/o)) then\n process_label text\n when text = ss.scan(/\\\"(#{SIMPLE_STRING})\\\"/o) then\n action { result EXPR_END, :tSTRING, text[1..-2].gsub(ESC) { unescape $1 } }\n when text = ss.scan(/\\\"/) then\n action { string STR_DQUOTE; result nil, :tSTRING_BEG, text }\n when text = ss.scan(/\\@\\@?\\d/) then\n action { rb_compile_error \"`#{text}` is not allowed as a variable name\" }\n when text = ss.scan(/\\@\\@?#{IDENT_CHAR}+/o) then\n process_ivar text\n when ss.match?(/:/) then\n case\n when not_end? && (text = ss.scan(/:([a-zA-Z_]#{IDENT_CHAR}*(?:[?]|[!](?!=)|=(?==>)|=(?![=>]))?)/o)) then\n process_symbol text\n when not_end? && (text = ss.scan(/\\:\\\"(#{SIMPLE_STRING})\\\"/o)) then\n process_symbol text\n when not_end? && (text = ss.scan(/\\:\\'(#{SSTRING})\\'/o)) then\n process_symbol text\n when text = ss.scan(/\\:\\:/) then\n process_colon2 text\n when text = ss.scan(/\\:/) then\n process_colon1 text\n end # group /:/\n when ss.skip(/->/) then\n action { result EXPR_ENDFN, :tLAMBDA, nil }\n when text = ss.scan(/[+-]/) then\n process_plus_minus text\n when ss.match?(/[+\\d]/) then\n case\n when ss.skip(/#{NUM_BAD}/o) then\n action { rb_compile_error \"Invalid numeric format\" }\n when ss.skip(/#{INT_DEC}/o) then\n action { int_with_base 10 }\n when ss.skip(/#{INT_HEX}/o) then\n action { int_with_base 16 }\n when ss.skip(/#{INT_BIN}/o) then\n action { int_with_base 2 }\n when ss.skip(/#{INT_OCT_BAD}/o) then\n action { rb_compile_error \"Illegal octal digit.\" }\n when ss.skip(/#{INT_OCT}/o) then\n action { int_with_base 8 }\n when ss.skip(/#{FLOAT_BAD}/o) then\n action { rb_compile_error \"Trailing '_' in number.\" }\n when text = ss.scan(/#{FLOAT}/o) then\n process_float text\n when ss.skip(/#{INT_DEC2}/o) then\n action { int_with_base 10 }\n when ss.skip(/[0-9]/) then\n action { rb_compile_error \"Bad number format\" }\n end # group /[+\\d]/\n when text = ss.scan(/\\[/) then\n process_square_bracket text\n when was_label? && (text = ss.scan(/\\'#{SSTRING}\\':?/o)) then\n process_label_or_string text\n when ss.match?(/\\|/) then\n case\n when ss.skip(/\\|\\|\\=/) then\n action { result EXPR_BEG, :tOP_ASGN, \"||\" }\n when ss.skip(/\\|\\|/) then\n action { result EXPR_BEG, :tOROP, \"||\" }\n when ss.skip(/\\|\\=/) then\n action { result EXPR_BEG, :tOP_ASGN, \"|\" }\n when ss.skip(/\\|/) then\n action { state = is_after_operator? ? EXPR_ARG : EXPR_PAR; result state, :tPIPE, \"|\" }\n end # group /\\|/\n when text = ss.scan(/\\{/) then\n process_brace_open text\n when ss.match?(/\\*/) then\n case\n when ss.skip(/\\*\\*=/) then\n action { result EXPR_BEG, :tOP_ASGN, \"**\" }\n when ss.skip(/\\*\\*/) then\n action { result(:arg_state, space_vs_beginning(:tDSTAR, :tDSTAR, :tPOW), \"**\") }\n when ss.skip(/\\*\\=/) then\n action { result(EXPR_BEG, :tOP_ASGN, \"*\") }\n when ss.skip(/\\*/) then\n action { result(:arg_state, space_vs_beginning(:tSTAR, :tSTAR, :tSTAR2), \"*\") }\n end # group /\\*/\n when ss.match?(/</) then\n case\n when ss.skip(/\\<\\=\\>/) then\n action { result :arg_state, :tCMP, \"<=>\" }\n when ss.skip(/\\<\\=/) then\n action { result :arg_state, :tLEQ, \"<=\" }\n when ss.skip(/\\<\\<\\=/) then\n action { result EXPR_BEG, :tOP_ASGN, \"<<\" }\n when text = ss.scan(/\\<\\</) then\n process_lchevron text\n when ss.skip(/\\</) then\n action { result :arg_state, :tLT, \"<\" }\n end # group /</\n when ss.match?(/>/) then\n case\n when ss.skip(/\\>\\=/) then\n action { result :arg_state, :tGEQ, \">=\" }\n when ss.skip(/\\>\\>=/) then\n action { result EXPR_BEG, :tOP_ASGN, \">>\" }\n when ss.skip(/\\>\\>/) then\n action { result :arg_state, :tRSHFT, \">>\" }\n when ss.skip(/\\>/) then\n action { result :arg_state, :tGT, \">\" }\n end # group />/\n when ss.match?(/\\`/) then\n case\n when expr_fname? && (ss.skip(/\\`/)) then\n action { result(EXPR_END, :tBACK_REF2, \"`\") }\n when expr_dot? && (ss.skip(/\\`/)) then\n action { result((cmd_state ? EXPR_CMDARG : EXPR_ARG), :tBACK_REF2, \"`\") }\n when ss.skip(/\\`/) then\n action { string STR_XQUOTE, '`'; result(nil, :tXSTRING_BEG, \"`\") }\n end # group /\\`/\n when text = ss.scan(/\\?/) then\n process_questionmark text\n when ss.match?(/&/) then\n case\n when ss.skip(/\\&\\&\\=/) then\n action { result(EXPR_BEG, :tOP_ASGN, \"&&\") }\n when ss.skip(/\\&\\&/) then\n action { result(EXPR_BEG, :tANDOP, \"&&\") }\n when ss.skip(/\\&\\=/) then\n action { result(EXPR_BEG, :tOP_ASGN, \"&\" ) }\n when ss.skip(/\\&\\./) then\n action { result(EXPR_DOT, :tLONELY, \"&.\") }\n when text = ss.scan(/\\&/) then\n process_amper text\n end # group /&/\n when text = ss.scan(/\\//) then\n process_slash text\n when ss.match?(/\\^/) then\n case\n when ss.skip(/\\^=/) then\n action { result(EXPR_BEG, :tOP_ASGN, \"^\") }\n when ss.skip(/\\^/) then\n action { result(:arg_state, :tCARET, \"^\") }\n end # group /\\^/\n when ss.skip(/\\;/) then\n action { self.command_start = true; result(EXPR_BEG, :tSEMI, \";\") }\n when ss.match?(/~/) then\n case\n when is_after_operator? && (ss.skip(/\\~@/)) then\n action { result(:arg_state, :tTILDE, \"~\") }\n when ss.skip(/\\~/) then\n action { result(:arg_state, :tTILDE, \"~\") }\n end # group /~/\n when ss.match?(/\\\\/) then\n case\n when ss.skip(/\\\\\\r?\\n/) then\n action { self.lineno += 1; self.space_seen = true; next }\n when ss.skip(/\\\\/) then\n action { rb_compile_error \"bare backslash only allowed before newline\" }\n end # group /\\\\/\n when text = ss.scan(/\\%/) then\n process_percent text\n when ss.match?(/\\$/) then\n case\n when text = ss.scan(/\\$_\\w+/) then\n process_gvar text\n when text = ss.scan(/\\$_/) then\n process_gvar text\n when text = ss.scan(/\\$[~*$?!@\\/\\\\;,.=:<>\\\"]|\\$-\\w?/) then\n process_gvar text\n when in_fname? && (text = ss.scan(/\\$([\\&\\`\\'\\+])/)) then\n process_gvar text\n when text = ss.scan(/\\$([\\&\\`\\'\\+])/) then\n process_backref text\n when in_fname? && (text = ss.scan(/\\$([1-9]\\d*)/)) then\n process_gvar text\n when text = ss.scan(/\\$([1-9]\\d*)/) then\n process_nthref text\n when text = ss.scan(/\\$0/) then\n process_gvar text\n when text = ss.scan(/\\$[^[:ascii:]]+/) then\n process_gvar text\n when text = ss.scan(/\\$\\W|\\$\\z/) then\n process_gvar_oddity text\n when text = ss.scan(/\\$\\w+/) then\n process_gvar text\n end # group /\\$/\n when text = ss.scan(/\\_/) then\n process_underscore text\n when text = ss.scan(/#{IDENT}/o) then\n process_token text\n when ss.skip(/\\004|\\032|\\000|\\Z/) then\n action { [RubyLexer::EOF, RubyLexer::EOF] }\n when text = ss.scan(/./) then\n action { rb_compile_error \"Invalid char #{text.inspect} in expression\" }\n else\n text = ss.string[ss.pos .. -1]\n raise ScanError, \"can not match (#{state.inspect}) at #{location}: '#{text}'\"\n end\n else\n raise ScanError, \"undefined state at #{location}: '#{state}'\"\n end # token = case state\n\n next unless token # allow functions to trigger redo w/ nil\n end # while\n\n raise LexerError, \"bad lexical result at #{location}: #{token.inspect}\" unless\n token.nil? || (Array === token && token.size >= 2)\n\n # auto-switch state\n self.state = token.last if token && token.first == :state\n\n token\n end", "def skip token_type, error = true\n type, = get\n return unless type # end of stream\n return @current_token if token_type == type\n unget\n raise ParseError, \"expected #{token_type} got #{@current_token.inspect}\" if error\n end", "def has_next_token\n\t\[email protected]_next\n\tend", "def getToken\n @tokens\n end", "def next_token\n\n token = nil\n\n until ss.eos? or token do\n if ss.check(/\\n/) then\n self.lineno += 1\n # line starts 1 position after the newline\n self.start_of_current_line_pos = ss.pos + 1\n end\n self.old_pos = ss.pos\n token =\n case state\n when nil, :option, :inner, :start, :macro, :rule, :group then\n case\n when ss.skip(/options?.*/) then\n [:state, :option]\n when ss.skip(/inner.*/) then\n [:state, :inner]\n when ss.skip(/macros?.*/) then\n [:state, :macro]\n when ss.skip(/rules?.*/) then\n [:state, :rule]\n when ss.skip(/start.*/) then\n [:state, :start]\n when ss.skip(/end/) then\n [:state, :END]\n when ss.skip(/\\A((?:.|\\n)*)class ([\\w:]+.*)/) then\n action { [:class, *matches] }\n when ss.skip(/\\n+/) then\n # do nothing\n when text = ss.scan(/\\s*(\\#.*)/) then\n action { [:comment, text] }\n when (state == :option) && (ss.skip(/\\s+/)) then\n # do nothing\n when (state == :option) && (text = ss.scan(/stub/i)) then\n action { [:option, text] }\n when (state == :option) && (text = ss.scan(/debug/i)) then\n action { [:option, text] }\n when (state == :option) && (text = ss.scan(/do_parse/i)) then\n action { [:option, text] }\n when (state == :option) && (text = ss.scan(/lineno/i)) then\n action { [:option, text] }\n when (state == :option) && (text = ss.scan(/column/i)) then\n action { [:option, text] }\n when (state == :inner) && (text = ss.scan(/.*/)) then\n action { [:inner, text] }\n when (state == :start) && (text = ss.scan(/.*/)) then\n action { [:start, text] }\n when (state == :macro) && (ss.skip(/\\s+(\\w+)\\s+#{RE}/o)) then\n action { [:macro, *matches] }\n when (state == :rule) && (ss.skip(/\\s*#{ST}?[\\ \\t]*#{RE}[\\ \\t]*#{ACT}?/o)) then\n action { [:rule, *matches] }\n when (state == :rule) && (ss.skip(/\\s*:[\\ \\t]*#{RE}/o)) then\n action { [:grouphead, *matches] }\n when (state == :group) && (ss.skip(/\\s*:[\\ \\t]*#{RE}/o)) then\n action { [:grouphead, *matches] }\n when (state == :group) && (ss.skip(/\\s*\\|\\s*#{ST}?[\\ \\t]*#{RE}[\\ \\t]*#{ACT}?/o)) then\n action { [:group, *matches] }\n when (state == :group) && (ss.skip(/\\s*#{ST}?[\\ \\t]*#{RE}[\\ \\t]*#{ACT}?/o)) then\n action { [:groupend, *matches] }\n else\n text = ss.string[ss.pos .. -1]\n raise ScanError, \"can not match (#{state.inspect}) at #{location}: '#{text}'\"\n end\n when :END then\n case\n when ss.skip(/\\n+/) then\n # do nothing\n when text = ss.scan(/.*/) then\n action { [:end, text] }\n else\n text = ss.string[ss.pos .. -1]\n raise ScanError, \"can not match (#{state.inspect}) at #{location}: '#{text}'\"\n end\n else\n raise ScanError, \"undefined state at #{location}: '#{state}'\"\n end # token = case state\n\n next unless token # allow functions to trigger redo w/ nil\n end # while\n\n raise LexerError, \"bad lexical result at #{location}: #{token.inspect}\" unless\n token.nil? || (Array === token && token.size >= 2)\n\n # auto-switch state\n self.state = token.last if token && token.first == :state\n\n token\n end", "def getTokenKind()\n $tokens.at(0)\nend", "def get_current_token\n if request.headers['Authorization'].present?\n return request.headers['Authorization'].split(' ').last\n end\n raise(ExceptionHandler::MissingToken, Message.missing_token)\n end", "def read\n @lines.shift\n end", "def getToken()\n if @verbose\n if @token\n puts((\" \"*@indent) + \" (\" + @token.show(true) + \")\")\n end\n end\n\n @token = @lexer.get()\n end", "def shell_read_until_token(token, wanted_idx=0, timeout=10)\n return if timeout.to_i == 0\n\n if wanted_idx == 0\n parts_needed = 2\n else\n parts_needed = 1 + (wanted_idx * 2)\n end\n\n # Read until we get the data between two tokens or absolute timeout.\n begin\n ::Timeout.timeout(timeout) do\n buf = ''\n idx = nil\n loop do\n if (tmp = shell_read(-1))\n buf << tmp\n\n # see if we have the wanted idx\n parts = buf.split(token, -1)\n\n if parts.length == parts_needed\n # cause another prompt to appear (just in case)\n shell_write(\"\\n\")\n return parts[wanted_idx]\n end\n end\n end\n end\n rescue\n # nothing, just continue\n end\n\n # failed to get any data or find the token!\n nil\n end", "def get_Token()\n \t return @outputs[\"Token\"]\n \tend", "def get_Token()\n \t return @outputs[\"Token\"]\n \tend" ]
[ "0.85137594", "0.83284795", "0.76289797", "0.75773525", "0.75446236", "0.745714", "0.74274457", "0.7396812", "0.73394054", "0.7333171", "0.72810614", "0.72770405", "0.7269252", "0.72438675", "0.722983", "0.7136048", "0.707978", "0.7051579", "0.70159256", "0.7007398", "0.69972956", "0.6934884", "0.68998706", "0.6862098", "0.68418145", "0.6841216", "0.68321943", "0.6732508", "0.67231745", "0.6700314", "0.6700314", "0.6694578", "0.6628985", "0.6599971", "0.65849584", "0.6583724", "0.6583418", "0.6534848", "0.653282", "0.65071046", "0.64878494", "0.6487733", "0.64798295", "0.6473875", "0.6469451", "0.6456442", "0.6373591", "0.63130224", "0.62960154", "0.6276955", "0.6234222", "0.6229046", "0.6196884", "0.6173378", "0.6140976", "0.6137088", "0.6105385", "0.60888684", "0.60888684", "0.6053617", "0.60380673", "0.60300606", "0.6028707", "0.60117304", "0.60117304", "0.60068893", "0.60045594", "0.5988488", "0.5972898", "0.5970063", "0.5960569", "0.59453946", "0.5939943", "0.5937405", "0.59360254", "0.5928129", "0.5921846", "0.5904874", "0.58681256", "0.5862693", "0.5822673", "0.5802667", "0.5790932", "0.5790932", "0.5790932", "0.5790932", "0.5790932", "0.5790932", "0.57882273", "0.5787205", "0.57628036", "0.57456803", "0.5745", "0.5740277", "0.57323766", "0.57318443", "0.57262015", "0.57237643", "0.57198066", "0.57198066" ]
0.6555857
37
Neue Methode zur Sortierung, geht erst nach Orten, auch wenn kein Startort drin. Hilfsmethoden im PrivateTeil.
def sort_abschnitte_and_umschlaege abschnitt_umschlag_list = [] # Hilfsmethode, baut einen nach Orten sortierten Hash auf. ort_to_detail = sort_abschnitte_and_umschlaege_by_ort File.open("log/transport.log","w"){|f| f.puts "Ort to detail #{ort_to_detail}" } unless self.start_anlage.nil? if self.start_anlage.ort ort_aktuell = self.start_anlage.ort if ort_aktuell.nil? || ort_to_detail[ort_aktuell.id].nil? ort_aktuell = abschnitt_only_start_ort(ort_to_detail.keys) end counter = 0 while not (ort_aktuell.nil? || ort_to_detail.empty? || counter > 100) counter += 1 next_ort = nil ort_aktuell_id = ort_aktuell.nil? ? 0 : ort_aktuell.id unless ort_to_detail[ort_aktuell_id].nil? ort_to_detail[ort_aktuell_id].each do |abschnitt_umschlag| File.open("log/transport.log","a"){|f| f.puts abschnitt_umschlag.attributes } abschnitt_umschlag_list << abschnitt_umschlag next_ort = abschnitt_umschlag.end_ort if abschnitt_umschlag.kind_of? Transportabschnitt end ort_to_detail.delete(ort_aktuell_id) ort_aktuell = next_ort end end # Rest nach Datum sortieren unless ort_to_detail.empty? File.open("log/transport.log","a"){|f| f.puts "Rest nach Datum" } abschnitt_umschlag_list = abschnitt_umschlag_list.concat(sort_abschnitte_and_umschlaege_by_date(ort_to_detail.values.flatten)) end else #File.open("log/transport.log","a"){|f| f.puts "Alles nach Datum" } abschnitt_umschlag_list = abschnitt_umschlag_list.concat(sort_abschnitte_and_umschlaege_by_date(ort_to_detail.values.flatten)) end end #File.open("log/transport.log","a"){|f| f.puts "Transport #{id}: #{abschnitt_umschlag_list.to_s}" } abschnitt_umschlag_list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort!\n sort_if_needed\n self\n end", "def sort\n return @sort\n end", "def sortable_sort\n @sortable_sort\n end", "def sort\n self[:sort]\n end", "def sort_entries; end", "def sort_order\n super\n end", "def bigSorting(unsorted)\n\nend", "def sort\n @pokers.sort.reverse\n end", "def sort\n\t@events = @events.sort_by { | e | e.time_from_start }\n\trecalc_delta_from_times()\n end", "def sort\n super { |x, y| x.file_name <=> y.file_name }\n end", "def try_sort\n # Sort the table if the first element next_start_time has changed\n if false && @next_start_time != @sprinkles[0].next_start_time\n @sprinkles.sort_by! {|s| s.next_start_time}\n @next_start_time = @sprinkles[0].next_start_time\n end\n end", "def sort!\n unless sorted?\n @sources = topsort\n insert_extensions!\n insert_replacements!\n @sources.uniq!\n @sorted = true\n end\n self\n end", "def patched_bogo_sort!\n return self if empty?\n\n bogo_private\n end", "def sort_params; end", "def sort_params; end", "def sort!\n return @array.sort! unless @current_index.between? 0, @array.size.pred\n\n current_item = @array.at @current_index\n offset = @array.to_a[0...@current_index].count current_item\n\n @array.sort!\n\n center_indices_at (@array.to_a.index(current_item) + offset)\n\n self\n end", "def grand_sorting_machine(array)\n\n\n\nend", "def sort( & block )\n\n load_parent_state\n \n return super\n \n end", "def perform\n kahn_sorting if @sorted_list.empty?\n\n @sorted_list\n end", "def sort_order\n 0\n end", "def sort_entries=(_arg0); end", "def sort_by! &block\n return @array.to_enum(:sort_by!) unless block_given?\n\n current_item = @array.at @current_index\n offset = @array.to_a[0...@current_index].count current_item\n\n @array.sort_by! &block\n\n center_indices_at (@array.to_a.index(current_item) + offset)\n\n self\n end", "def sort!\n\t\tquick!(self, 1, length)\n\tend", "def sort_params=(_arg0); end", "def sort_params=(_arg0); end", "def sort_data\n store.sort_data!\n end", "def sort_files!; end", "def apply_sorting(chain)\n chain\n end", "def sort(*args, &block)\n if !args.empty? || block\n @sort = Sort.new(*args, &block)\n self\n else\n @sort\n end\n end", "def sort_by( & block )\n\n load_parent_state\n \n return super\n\n end", "def sort!\n @que.sort! do |a,b|\n case @cmp.call(a,b)\n when 0, nil then 0\n when 1, true then 1\n when -1, false then -1\n else\n warn \"bad comparison procedure in #{self.inspect}\"\n 0\n end\n end\n self\n end", "def add_sort_field(*) super end", "def sort()\n\t\t@events = @events.sort do |a,b| a[0] <=> b[0] end\n\tend", "def __sortable__\n self\n end", "def sort_abschnitte_and_umschlaege_by_ort\n ort_to_detail = {}\n self.umschlaege.each do |umschlag|\n ort = umschlag.ort\n ort_id = ort.nil? ? 0 : ort.id\n ort_to_detail[ort_id] ||= []\n ort_to_detail[ort_id] << umschlag\n end \n self.transportabschnitte.each do |abschnitt|\n ort = abschnitt.start_ort\n ort_id = ort.nil? ? 0 : ort.id\n ort_to_detail[ort_id] ||= []\n ort_to_detail[ort_id] << abschnitt\n end \n ort_to_detail\n end", "def sort\n @entries = DependencySorter.new(@entries).sorted_items\n end", "def my_array_sorting_method(source)\n # Your code here!\nend", "def my_array_sorting_method(source)\n # Your code here!\nend", "def my_array_sorting_method(source)\n # Your code here!\nend", "def my_array_sorting_method(source)\n # Your code here!\nend", "def my_array_sorting_method(source)\n # Your code here!\nend", "def my_array_sorting_method(source)\n # Your code here!\nend", "def my_array_sorting_method(source)\n # Your code here!\nend", "def sorting(numbers)\n numbers.sort\nend", "def my_quick_sort(&prc)\n\n end", "def tvSort _args\n \"tvSort _args;\" \n end", "def test_0280_sort\n @@log.debug \"test_0280_sort starts\" if @@log.debug?\n assert_respond_to(@list, :sort, \"test_0280_sort_respond\")\n # Basic sort. Assumes all objects implement <=>.\n ta = @list.sort\n assert_equal([@bsb, @cab, @dad, @aen], ta, \"test_0280_sort_basic\")\n # Sort with block\n ta = @list.sort {|a,b| a.first <=> b.first}\n assert_equal([@aen, @bsb, @cab, @dad], ta, \"test_0280_sort_block\")\n @@log.debug \"test_0280_sort ends\" if @@log.debug?\n end", "def is_sorted\r\n false\r\n end", "def bubble_sort_rec(&prc)\n end", "def topsort(start = nil, &block)\n result = []\n go = true\n back = Proc.new { |e| go = false }\n push = Proc.new { |v| result.unshift(v) if go }\n start ||= vertices[0]\n dfs({ :exit_vertex => push, :back_edge => back, :start => start })\n result.each { |v| block.call(v) } if block\n result\n end", "def set_sort_index\n self.sort_index = next_sort_index and return unless self.sort_index\n end", "def sort\n @items.sort { |x,y| x.rank <=> y.rank }\n end", "def sort_items_according_to_current_direction\n case @direction\n when nil\n @items = items.shift(2) + items.partition(&:directory?).flat_map(&:sort)\n when 'r'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort.reverse}\n when 'S', 's'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by {|i| -i.size}}\n when 'Sr', 'sr'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by(&:size)}\n when 't'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort {|x, y| y.mtime <=> x.mtime}}\n when 'tr'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by(&:mtime)}\n when 'c'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort {|x, y| y.ctime <=> x.ctime}}\n when 'cr'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by(&:ctime)}\n when 'u'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort {|x, y| y.atime <=> x.atime}}\n when 'ur'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by(&:atime)}\n when 'e'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort {|x, y| y.extname <=> x.extname}}\n when 'er'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by(&:extname)}\n end\n items.each.with_index {|item, index| item.index = index}\n end", "def sort_abschnitte_and_umschlaege_by_date start_liste\n abschnitt_umschlag_list = []\n mit_end_datum = start_liste.select{|element| element.end_datum }\n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Mit Ende #{mit_end_datum.to_s}\" }\n abschnitt_umschlag_list.concat(mit_end_datum.sort_by{|element| element.end_datum} )\n ohne_end_datum = start_liste.select{|element| element.end_datum.nil? }\n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Ohne Ende: #{ohne_end_datum.to_s}\" }\n abschnitt_umschlag_list.concat(ohne_end_datum)\n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Liste bei Date #{abschnitt_umschlag_list.to_s}\" }\n abschnitt_umschlag_list\n end", "def sorted?\n self == sort\n end", "def bubble_sort(&prc)\n prc ||= Proc.new{|a,b| a <=> b }\n\n sorted = false\n while !sorted\n sorted = true\n\n (0...self.length - 1).each do |i|\n # debugger\n if prc.call(self[i], self[i + 1]) == 1 # REMEBER: spaceship operator returns a number! only 0 is falsey\n self[i], self[i + 1] = self[i + 1], self[i]\n sorted = false\n end\n end\n end\n\n self\n end", "def my_quick_sort(&prc)\n end", "def sort!\r\n @tabs.sort! { |x,y| x.name <=> y.name }\r\n end", "def rec_sort unsorted, sorted \n\tif unsorted.length <= 0\n\n# sorted is an array\n\treturn sorted \n\tend\n\n# So if we got here, then it means we still have work to do.\n# take last one out of unsorted, call it smallest\nsmallest = unsorted.pop\n#create en empty 'still unsorted' array \nstill_unsorted = []\n\n#testing if each object in unsorted is smaller than 'smallest' \n\tunsorted.each do |tested_object| \n\t#if tested object is smaller than smallest then push them in still unsorted\n\t\tif tested_object.downcase < smallest.downcase\n\t\t\tstill_unsorted.push smallest\n\t\t\tsmallest = tested_object\n\t\telse\n\t\t\tstill_unsorted.push tested_object\n\t\tend \n\tend\n# Now \"smallest\" really does point to the\n# smallest element that \"unsorted\" contained,\n# and all the rest of it is in \"still_unsorted\". \nsorted.push smallest\n\nrec_sort still_unsorted, sorted\nend", "def insertion_print_sort\n @insertion.print_sort\n end", "def sort_name\n @ole.SortName\n end", "def sort!(sort = nil)\n mutate(:sort, sort)\n end", "def test_insertion_has_method_sort\n sorter = Insertion.new\n assert_equal [\"a\",\"b\",\"c\",\"d\"], sorter.sort([\"d\", \"b\", \"a\", \"c\"])\n end", "def sort_direction\n # karakter kontrol yapiliyor security icin \n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\" \n end", "def sort_direction\n # karakter kontrol yapiliyor security icin \n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\" \n end", "def sort_direction\n # karakter kontrol yapiliyor security icin \n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\" \n end", "def sort_direction\n # karakter kontrol yapiliyor security icin \n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\" \n end", "def sort_direction\n # karakter kontrol yapiliyor security icin \n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\" \n end", "def sort_direction\n # karakter kontrol yapiliyor security icin \n %w[asc desc].include?(params[:direction]) ? params[:direction] : \"asc\" \n end", "def sort_by(&block)\n super(&block).extend(OperationList)\n end", "def sort\n self.roster.each do |grade, students|\n students.sort!\n end\n self.roster\n end", "def sort\n # Find a cycle in the move graph and pick a register to spill to break it.\n spillee = nil\n each_strongly_connected_component do |component|\n if component.size > 1\n fail if spillee # There is one cycle with 3 registers.\n spillee = component.first.src\n end\n end\n\n # Break the cycle.\n spill(spillee) if spillee\n\n tsort\n end", "def my_quick_sort(&prc)\n prc ||= Proc.new{|a,b| a <=> b}\n return self if self.length <= 1\n mdix = self.length()/2\n left = []\n right = []\n # debugger\n self.each_with_index do |item, idx|\n case prc.call(item,self[mdix])\n when -1 #a smaller\n left << item\n when 0\n left << item if idx != mdix\n when 1\n right << item\n end\n end\n # debugger\n left.my_quick_sort(&prc) + [self[mdix]] + right.my_quick_sort(&prc)\n end", "def sort(start = nil, &block)\n result = []\n push = Proc.new { |v| result.unshift(v) }\n start ||= vertices[0]\n dfs({ :exit_vertex => push, :start => start })\n result.each { |v| block.call(v) } if block\n result\n end", "def sort(*args, &blk)\n self.dup{ @contents = @contents.sort(*args, &blk) }\n end", "def sort_name\n sort_constituent\n end", "def bubble_sort(&prc)\n prc ||= Proc.new { |a, b| a <=> b }\n sorted = false \n while !sorted \n sorted = true \n (0...self.length-1).each do |i|\n if prc.call(self[i], self[i+1]) == 1\n self[i], self[i+1] = self[i+1], self[i]\n sorted = false \n end \n end \n end \n self \n end", "def sort!( &block )\n @data = skip_headers { |d| d.sort( &block ) }; self\n end", "def test_sort\n\n a_plus = Grade.new(\"A+\")\n a = Grade.new(\"A\")\n b_minus = Grade.new(\"B-\")\n\n ordered = [a_plus,b_minus, a].sort # should return [a, a_plus]\n\n assert(ordered[0] == b_minus)\n assert(ordered[1] == a)\n assert(ordered[2] == a_plus)\n\n end", "def children_sort_by(*args, &blk)\n self.dup{ @contents = @contents.sort_by(*args, &blk) }\n end", "def current_sort_state(params)\n @sortable && sort_pairs(params).detect{|pair| pair[0]==self.name.to_s} || []\n end", "def sort_composer\n @ole.SortComposer\n end", "def sort_by!( & block )\n\n return to_enum unless block_given?\n\n new_local_sort_order = [ ]\n @internal_array.size.times { |this_time| new_local_sort_order.push( this_time ) }\n new_local_sort_order.sort_by! { |this_index| block.call( @internal_array[ this_index ] ) }\n\n reorder_from_sort( new_local_sort_order )\n\n return self\n\n end", "def rec_sort unsorted, sorted\n if unsorted.length <= 0\n return sorted\n end\n#\n#start smallest using 'pop' word and move to sorted list\nsmallest = unsorted.pop\nstill_unsorted = []\n#if tested word from unsorted is less then put\n#smallest into still_unsorted and move tested to smallest\nunsorted.each do |tested_object|\n if tested_object < smallest\n still_unsorted.push smallest\n smallest = tested_object\n#otherwise put tested_object into still_unsorted\n else\n still_unsorted.push tested_object\n end\n#push smallest into sorted\n sorted.push smallest\n #calls method recursively again\n rec_sort still_unsorted, sorted\nend\nend", "def sort(block)\n @content.sort(block)\n end", "def ordered_topologically\n FolderSort.new(self)\n end", "def using_sort(array)\narray.sort\nend", "def using_sort(array)\narray.sort\nend", "def ai_sorting_extension(a, b, action)\n return 0\n end", "def sort(sort)\n self.query.sort = sort\n self.query.sort_descending = false\n self\n end", "def own_class_method_objects sort: true\n class_method_objects false, sort: sort\n end", "def sort_method\n @options[:sort_method] || :self_time\n end", "def dub_sort(arr)\nend", "def sort(direction = nil)\n @direction, @current_page = direction, 0\n sort_items_according_to_current_direction\n switch_page 0\n move_cursor 0\n end", "def initialize sort_order\n @sort_order = sort_order\n validate_sort_order! \n end", "def sort_index\n self.index || 0\n end", "def sorting\n sort_no = 0\n sorts = []\n\n loop do\n sorted = false\n name_col = \"iSortCol_#{sort_no}\"\n name_mode = \"sSortDir_#{sort_no}\"\n sort_col = @dts[name_col]\n break if !sort_col\n\n col_name = @columns[sort_col.to_i]\n next if !col_name\n\n if @dts[name_mode] == \"desc\"\n sort_mode = \"DESC\"\n else\n sort_mode = \"ASC\"\n end\n\n if match = col_name.to_s.match(/^(.+)_id$/)\n method_name = match[1]\n sub_model_name = StringCases.snake_to_camel(col_name.slice(0, col_name.length - 3))\n\n if Kernel.const_defined?(sub_model_name)\n sub_model_const = Kernel.const_get(sub_model_name)\n unless @joins.key?(method_name)\n @query = @query.includes(method_name)\n @joins[method_name] = true\n end\n\n @sort_columns.each do |sort_col_name|\n if sub_model_const.column_names.include?(sort_col_name.to_s)\n sorts << \"`#{sub_model_const.table_name}`.`#{escape_col(sort_col_name)}` #{sort_mode}\"\n sorted = true\n break\n end\n end\n end\n end\n\n if @model.column_names.include?(col_name.to_s)\n sorts << \"`#{@model.table_name}`.`#{escape_col(col_name)}` #{sort_mode}\"\n elsif @args[:sort]\n res = @args[:sort].call(:key => col_name, :sort_mode => sort_mode, :query => @query)\n @query = res if res\n else\n raise \"Unknown sort-column: '#{col_name}'.\"\n end\n\n sort_no += 1\n end\n\n @query = @query.order(sorts.join(\", \"))\n end", "def quick_sort(&prc)\n end", "def merge_sort(&prc)\n end", "def arrange\n\t\t\n\tend" ]
[ "0.71970403", "0.71704113", "0.7039452", "0.68838406", "0.6880601", "0.6780432", "0.668855", "0.66365135", "0.663075", "0.65946895", "0.65714157", "0.65668344", "0.6558374", "0.6536777", "0.6536777", "0.65207404", "0.65130645", "0.65114856", "0.65101016", "0.6501846", "0.64831495", "0.646113", "0.6426963", "0.6394142", "0.6394142", "0.6389299", "0.6389134", "0.63420117", "0.6333415", "0.6309641", "0.63067377", "0.62810934", "0.62746996", "0.626305", "0.62583256", "0.62327135", "0.6231635", "0.6231635", "0.6231635", "0.6231635", "0.6231635", "0.6231635", "0.6231635", "0.6230929", "0.620579", "0.6177537", "0.61642456", "0.61557543", "0.61534685", "0.6143366", "0.6141905", "0.61326814", "0.61026025", "0.6101424", "0.6100664", "0.6093008", "0.60912144", "0.6090891", "0.6087774", "0.6087504", "0.6086311", "0.60852563", "0.60665655", "0.605487", "0.605487", "0.605487", "0.605487", "0.605487", "0.605487", "0.60379183", "0.6032359", "0.60134715", "0.601315", "0.60107815", "0.60083115", "0.60043937", "0.5998616", "0.59936", "0.5990652", "0.5986847", "0.5986375", "0.5982375", "0.5974992", "0.5973589", "0.59713626", "0.5970157", "0.59697074", "0.59697074", "0.59694296", "0.5965322", "0.5957172", "0.5950319", "0.5950185", "0.5945886", "0.59452164", "0.5942997", "0.59425026", "0.59423214", "0.5936397", "0.59358186" ]
0.607021
62
Sammelt alle Durchfahrtsorte zusammen, aus Anlagenorten, Umschlagsorten, Abschnitten und zugeordneten Beobachtungen
def get_known_orte orte = [] check_ort_ll(orte, start_anlage.ort) check_ort_ll(orte, ziel_anlage.ort) transportabschnitte.each do |abschnitt| abschnitt.orte.each do |ort| check_ort_ll(orte, ort) end end umschlaege.each do |umschlag| check_ort_ll(orte, umschlag.ort) end orte end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_abschnitte_and_umschlaege_by_ort\n ort_to_detail = {}\n self.umschlaege.each do |umschlag|\n ort = umschlag.ort\n ort_id = ort.nil? ? 0 : ort.id\n ort_to_detail[ort_id] ||= []\n ort_to_detail[ort_id] << umschlag\n end \n self.transportabschnitte.each do |abschnitt|\n ort = abschnitt.start_ort\n ort_id = ort.nil? ? 0 : ort.id\n ort_to_detail[ort_id] ||= []\n ort_to_detail[ort_id] << abschnitt\n end \n ort_to_detail\n end", "def get_known_orte_with_props\n orte = {}\n strecken = []\n # Transportabschnitte inklusive Beobachtungsorte und Strecke der Route\n transportabschnitte.each do |abschnitt|\n if abschnitt.route && abschnitt.route.name != \"Unbekannt\"\n strecken.concat(abschnitt.route.get_strecken)\n else\n if abschnitt.start_ort && abschnitt.end_ort && abschnitt.start_ort.lat && abschnitt.end_ort.lat\n strecken << [abschnitt.start_ort, abschnitt.end_ort] \n end\n end\n check_ort_p(orte, abschnitt.start_ort, \"Abschnitt\")\n check_ort_p(orte, abschnitt.end_ort, \"Abschnitt\")\n abschnitt.beobachtungen.each do |beob|\n check_ort_p(orte, beob.ort, \"Beobachtung\")\n end\n end\n # Umschlaege\n umschlaege.each do |umschlag|\n check_ort_p(orte, umschlag.ort, \"Umschlag\")\n end\n # Start und Zielanlage zuletzt, damit auf jeden Fall das aktuellste, andere werden ggf. ueberschrieben\n check_ort_p(orte, start_anlage.ort, \"Start-Anlage\")\n check_ort_p(orte, ziel_anlage.ort, \"Ziel-Anlage\")\n if strecken.empty? \n if umschlaege.empty? && start_anlage.ort && ziel_anlage.ort && start_anlage.ort.lat && ziel_anlage.ort.lat\n strecken << [start_anlage.ort, ziel_anlage.ort] \n elsif start_anlage.ort && start_anlage.ort.lat\n ort_aktuell = start_anlage.ort\n umschlaege.each do |umschlag|\n if umschlag.ort\n strecken << [ort_aktuell, umschlag.ort]\n ort_aktuell = umschlag.ort\n end\n end\n if ziel_anlage.ort && ziel_anlage.ort.lat\n strecken << [ort_aktuell, ziel_anlage.ort]\n end\n end\n end\n return orte, strecken\n end", "def zuruecksetzen()\n end", "def trd; end", "def karte_drucken()\n # TODO ÄNDERN\n if !tarif_gewaehlt?\n puts \"Kein Tarif wurde gewählt.\"\n else\n if @eingeworfen <= @tarif.betrag\n puts \"Der offener Betrag: #{@tarif.betrag - @eingeworfen }\"\n else\n puts(\"------------------\")\n puts(\"- Cinema Magico -\")\n puts(\"- Phantastische Tierwesen\")\n # TODO diese Zeile ändern\n puts(\"- Preis \" + @tarif.betrag().to_s + \" Euro\") # vordefiniert to_s , von Integer zum String wandeln\n puts(\"- Bezahlt \" + @eingeworfen.to_s + \" Euro\") # vordefiniert to_s , von Integer zum String wandeln\n puts(\"------------------\")\n # die Gesamtsumme, mit dem der Automat nach der letzten Leerung\n # gefuettert wurde\n @eingeworfen -= @tarif.betrag\n @summe_automat = @summe_automat + @tarif.betrag\n @tarif = nil\n return\n end\n end\n\n end", "def ausschalten()\n @schirm.farbe_aendern('orange')\n @leuchtstrahl1.unsichtbar_machen()\n @leuchtstrahl2.unsichtbar_machen()\n @leuchtstrahl3.unsichtbar_machen()\n @leuchtstrahl4.unsichtbar_machen()\n end", "def unsichtbar_machen\n @fuss.unsichtbar_machen\n @stiel.unsichtbar_machen\n @schirm.unsichtbar_machen\n @leuchtstrahl1.unsichtbar_machen\n @leuchtstrahl2.unsichtbar_machen\n @leuchtstrahl3.unsichtbar_machen\n @leuchtstrahl4.unsichtbar_machen\n end", "def schubert; end", "def einschalten() \n @schirm.farbe_aendern('gelb')\n @leuchtstrahl1.sichtbar_machen()\n @leuchtstrahl2.sichtbar_machen()\n @leuchtstrahl3.sichtbar_machen()\n @leuchtstrahl4.sichtbar_machen()\n @leuchtstrahl1.farbe_aendern('gelb')\n @leuchtstrahl2.farbe_aendern('gelb')\n @leuchtstrahl3.farbe_aendern('gelb')\n @leuchtstrahl4.farbe_aendern('gelb')\n end", "def sort_abschnitte_and_umschlaege_by_date start_liste\n abschnitt_umschlag_list = []\n mit_end_datum = start_liste.select{|element| element.end_datum }\n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Mit Ende #{mit_end_datum.to_s}\" }\n abschnitt_umschlag_list.concat(mit_end_datum.sort_by{|element| element.end_datum} )\n ohne_end_datum = start_liste.select{|element| element.end_datum.nil? }\n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Ohne Ende: #{ohne_end_datum.to_s}\" }\n abschnitt_umschlag_list.concat(ohne_end_datum)\n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Liste bei Date #{abschnitt_umschlag_list.to_s}\" }\n abschnitt_umschlag_list\n end", "def schumann; end", "def intelligenter_zug(spielfeld, aktueller_spieler)\n zug = nil\n\n spieler = spielfeld.spieler\n gegner = nil\n for s in spieler\n if s.name != aktueller_spieler.name\n gegner = s\n break\n end\n end\n\n # 1. Regel: Zuerst nach einer Gewinnsituation suchen\n for reihe in Spielfeld::reihen\n besetzt, frei = spielfeld.reihen_status(reihe)\n\n # Wenn der aktuelle Spieler in einer Reihe bereits zwei Felder\n # besetzt hält und das dritte frei ist, dann natürlich das nehmen\n if (frei.size == 1) and (besetzt[aktueller_spieler].size == 2)\n zug = Zug.new(aktueller_spieler, frei[0])\n break # nicht weitersuchen\n end\n end\n\n if zug.nil?\n # 2. Regel: Suche dann nach den Reihen, in denen der Gegner bereits\n # genau 2 Felder besetzt hat und das dritte Feld noch frei ist.\n for reihe in Spielfeld::reihen\n besetzt, frei = spielfeld.reihen_status(reihe)\n\n # Gefährlich, wenn Gegner zwei besetzt hält. Wie in der vorherigen\n # Lektion gelernt, erhält man zum Index des aktuellen Spielers\n # in der Spielerliste den Index des Gegners mit der Bitoperation 1^wer\n if (frei.size == 1) and (besetzt[gegner].size == 2)\n # Jetzt muss der Spieler unbedingt das eine freie Feld besetzen!\n # Andernfalls kann der Gegner im nächsten Zug gewinnen.\n zug = Zug.new(aktueller_spieler, frei[0])\n break # nicht weitersuchen\n end\n end\n end\n\n # Eckensituation bestimmen\n ecken = {\n 1 => 0, # links oben\n 3 => 0, # rechts oben\n 7 => 0, # links unten\n 9 => 0 # rechts unten\n }\n gegen_ecken = [[1, 9], [9, 1], [3, 7], [7, 3]]\n for z in spielfeld.zuege\n feld = z.nummer\n # Gegner besetzt die Ecke, wenn:\n # feld ist eine Ecke und Gegner besetzt sie\n if (ecken[feld] != nil) and (z.spieler == gegner)\n # Markiere Ecke als vom Gegner besetzt\n ecken[feld] = 1\n end\n end\n\n # 3. Regel: Immer in die Mitte setzten, falls dort frei ist\n # Vorsicht vor der XOX Situation an der Diagonale!\n if zug.nil?\n frei = spielfeld.freie_felder\n mitte = 5\n if frei.include?(mitte)\n zug = Zug.new(aktueller_spieler, mitte)\n else\n # Aha, Mitte ist bereits besetzt.\n # Sofern sie vom aktuellen Spieler besetzt ist, dann nach der XOX\n # Situation Ausschau halten und den nächsten Zug nicht in eine Ecke setzen.\n # XOX (oder OXO) Situation besteht, wenn\n # Ecke 1 und 9 vom Gegner besetzt und aktueller Spieler auf 5 oder\n # Ecke 3 und 7 vom Gegner besetzt und aktueller Spieler auf 5.\n for ecken_paar in gegen_ecken\n besetzt, frei_ecken = spielfeld.reihen_status([ecken_paar[0], mitte, ecken_paar[1]])\n if besetzt[gegner].include?(ecken_paar[0]) and besetzt[gegner].include?(ecken_paar[1])\n if besetzt[aktueller_spieler].include?(mitte)\n # Jetzt also nicht in eine freie Ecke setzen, sondern auf\n # die Felder 2, 4, 6 oder 8, sofern sie frei sind.\n xox_felder = [2, 4, 6, 8]\n for f in xox_felder\n if !frei.include?(f)\n xox_felder.delete(f)\n end\n end\n # Von den freien Ausweichfeldern zufällig eines nehmen\n feld = zufalls_feld(xox_felder)\n if feld != nil\n zug = Zug.new(aktueller_spieler, feld)\n break\n end\n end\n end\n end\n\n end\n end\n\n # 4. Regel: Verteidige gegenüberliegende Ecke\n frei = spielfeld.freie_felder\n if zug.nil?\n # Wenn Ecke 1 besetzt, dann setze auf 9, oder umgekehrt (sofern frei).\n # Wenn Ecke 3 besetzt, dann setze auf 7, oder umgekehrt (sofern frei).\n for ecken_paar in gegen_ecken\n if (ecken[ecken_paar[0]] > 0) and (frei.include?(ecken_paar[1]))\n zug = Zug.new(aktueller_spieler, ecken_paar[1])\n break # nicht weitersuchen\n end\n end\n end\n\n # 5. Regel: Setze in irgendeine freie Ecke.\n # Verwende Variablen 'frei' und 'ecken' von oben\n if zug.nil?\n for ecke in ecken.keys\n if frei.include?(ecke)\n zug = Zug.new(aktueller_spieler, ecke)\n break # nicht weitersuchen\n end\n end\n end\n\n # Andernfalls Zufallszug machen\n if zug.nil?\n zug = zufalls_zug(spielfeld, aktueller_spieler)\n end\n\n zug\n end", "def sort_abschnitte_and_umschlaege\n abschnitt_umschlag_list = []\n # Hilfsmethode, baut einen nach Orten sortierten Hash auf.\n ort_to_detail = sort_abschnitte_and_umschlaege_by_ort\n File.open(\"log/transport.log\",\"w\"){|f| f.puts \"Ort to detail #{ort_to_detail}\" }\n unless self.start_anlage.nil?\n if self.start_anlage.ort\n ort_aktuell = self.start_anlage.ort\n if ort_aktuell.nil? || ort_to_detail[ort_aktuell.id].nil?\n ort_aktuell = abschnitt_only_start_ort(ort_to_detail.keys) \n end \n counter = 0\n while not (ort_aktuell.nil? || ort_to_detail.empty? || counter > 100)\n counter += 1\n next_ort = nil\n ort_aktuell_id = ort_aktuell.nil? ? 0 : ort_aktuell.id \n unless ort_to_detail[ort_aktuell_id].nil?\n ort_to_detail[ort_aktuell_id].each do |abschnitt_umschlag|\n File.open(\"log/transport.log\",\"a\"){|f| f.puts abschnitt_umschlag.attributes }\n abschnitt_umschlag_list << abschnitt_umschlag\n next_ort = abschnitt_umschlag.end_ort if abschnitt_umschlag.kind_of? Transportabschnitt \n end\n ort_to_detail.delete(ort_aktuell_id) \n ort_aktuell = next_ort\n end\n end \n # Rest nach Datum sortieren\n unless ort_to_detail.empty?\n File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Rest nach Datum\" }\n abschnitt_umschlag_list = abschnitt_umschlag_list.concat(sort_abschnitte_and_umschlaege_by_date(ort_to_detail.values.flatten))\n end\n else \n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Alles nach Datum\" }\n abschnitt_umschlag_list = abschnitt_umschlag_list.concat(sort_abschnitte_and_umschlaege_by_date(ort_to_detail.values.flatten))\n end \n end\n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Transport #{id}: #{abschnitt_umschlag_list.to_s}\" }\n abschnitt_umschlag_list\n end", "def sichtbar_machen()\n @dach.sichtbar_machen\n @gebaedekoerpe.sichtbar_machen\n @fenster.sichtbar_machen\n @tuer.sichtbar_machen\n end", "def karte_drucken()\n if !tarif_gewaehlt?()\n puts (\"Es wurde noch kein Tarif gewählt. Bitte wählen Sie zuerst einen Tarif aus.\")\n elsif @tarif - @eingeworfen > 0\n offener_betrag = @tarif - @eingeworfen\n puts (\"Sie müssen noch \" + offener_betrag.to_s() + \" Euro einzahlen.\")\n else\n kartenpreis = @tarif\n\n puts(\"------------------\")\n puts(\"- Cinema Magico -\")\n puts(\"- Phantastische Tierwesen\")\n # TODO diese Zeile ändern\n puts(\"- Preis \" + @tarif.to_s + \" Euro\")\n puts(\"- Bezahlt \" + @eingeworfen.to_s + \" Euro\")\n puts(\"------------------\")\n # die Gesamtsumme, mit dem der Automat nach der letzten Leerung\n # gefuettert wurde\n wechsel_geld()\n @summe_automat += kartenpreis\n @tarif = nil\n return\n end\n end", "def nach_unten_bewegen\n bewegen_um_punkt(Punkt.new(0,10))\n end", "def im_nachbarraum_umsehen(richtung)\n naechster_raum = @aktueller_raum.ausgang(richtung)\n puts naechster_raum\n end", "def new\n @transport = Transport.find(params[:transport_id].to_i) if params[:transport_id]\n throw ArgumentError.new(\"Must give an transport id which exists}\") unless @transport\n if params[:beobachtung_id]\n @beobachtung_id = params[:beobachtung_id].to_i if params[:beobachtung_id]\n @beobachtung = Beobachtung.find(@beobachtung_id)\n end\n @transportabschnitt = Transportabschnitt.new\n @transportabschnitt.route = Route.find_by(name: \"Unbekannt\")\n # Wenn Abschnitt oder Umschlag davor oder danach schon existiert, \n # dann nimm daher die entsprechenden Anfangs- und Enddaten\n if params[:abschnitt_davor]\n abschnitt_davor = Transportabschnitt.find(params[:abschnitt_davor].to_i)\n @transportabschnitt.start_datum = abschnitt_davor.end_datum\n @transportabschnitt.start_ort = abschnitt_davor.end_ort\n end\n if params[:abschnitt_danach]\n abschnitt_danach = Transportabschnitt.find(params[:abschnitt_danach].to_i)\n @transportabschnitt.end_datum = abschnitt_danach.start_datum\n @transportabschnitt.end_ort = abschnitt_danach.start_ort\n end\n if params[:umschlag_davor]\n umschlag = Umschlag.find(params[:umschlag_davor].to_i)\n @transportabschnitt.start_datum = umschlag.end_datum\n @transportabschnitt.start_ort = umschlag.ort\n end\n if params[:umschlag_danach]\n umschlag = Umschlag.find(params[:umschlag_danach].to_i)\n @transportabschnitt.end_datum = umschlag.start_datum\n @transportabschnitt.end_ort = umschlag.ort\n end \n @redirect_params = new_transportabschnitt_path(transport_id: @transport.id) \n \n respond_to do |format|\n format.html { render 'new'}\n format.js { render 'new' }\n end\n end", "def unsichtbar_machen()\n @fuss.unsichtbar_machen()\n @stiel.unsichtbar_machen()\n @schirm.unsichtbar_machen()\n @leuchtstrahl1.unsichtbar_machen()\n @leuchtstrahl2.unsichtbar_machen()\n @leuchtstrahl3.unsichtbar_machen()\n @leuchtstrahl4.unsichtbar_machen()\n end", "def doors; end", "def terpene; end", "def drittelworte( wertung )\n if wertung < 1\n string1 = ''\n elsif wertung < 2\n string1 = 'eins'\n elsif wertung < 3\n string1 = 'zwei'\n elsif wertung < 4\n string1 = 'drei'\n elsif wertung < 5\n string1 = 'vier'\n elsif wertung < 6\n string1 = 'f&uuml;nf'\n elsif wertung < 7\n string1 = 'secht'\n elsif wertung < 8\n string1 = 'sieben'\n elsif wertung < 9\n string1 = 'acht'\n elsif wertung < 10\n string1 = 'neun'\n elsif wertung < 11\n string1 = 'zehn'\n elsif wertung < 12\n string1 = 'elf'\n else\n string1 = 'zw&ouml;f'\n end\n rest = sprintf(\"%.1f\",(wertung.to_f % 1))\n if rest.to_f == 0.3\n return string1 + \" ein drittel\"\n elsif rest.to_f == 0.6\n return string1 + \" zwei drittel\"\n elsif rest.to_f == 0\n return string1\n else\n return sprintf(\"%.1f\",wertung.to_s).sub(\".\",\",\")\n end\n end", "def solicitudes_atrasadas\n end", "def sichtbar_machen\n @backgrund.sichtbar_machen\n @baum1.sichtbar_machen\n @baum2.sichtbar_machen\n @baum3.sichtbar_machen\n @haus1.sichtbar_machen\n @haus2.sichtbar_machen\n @haus3.sichtbar_machen\n @hund1.sichtbar_machen\n @hund2.sichtbar_machen\n end", "def behandlungsdatum_str\n\t\t@behandlungsdatum_str || fmt_date( self.behandlungsdatum )\n\tend", "def vertikal_bewegen(anzahl_punkte)\n @fuss.vertikal_bewegen(anzahl_punkte)\n @stiel.vertikal_bewegen(anzahl_punkte)\n @schirm.vertikal_bewegen(anzahl_punkte)\n @leuchtstrahl1.vertikal_bewegen(anzahl_punkte)\n @leuchtstrahl2.vertikal_bewegen(anzahl_punkte)\n @leuchtstrahl3.vertikal_bewegen(anzahl_punkte)\n @leuchtstrahl4.vertikal_bewegen(anzahl_punkte)\n end", "def suivre; end", "def oben() \n return @fahrbahn.obere_linke_ecke().y() \n end", "def gesendete_lesen\r\n @postausgang.each{|x| puts x}\r\n end", "def tld; end", "def tld; end", "def topsman_periphacitis_urosteon()\n end", "def sichtbar_machen()\n @fuss.sichtbar_machen()\n @stiel.sichtbar_machen()\n @schirm.sichtbar_machen()\n @leuchtstrahl1.sichtbar_machen()\n @leuchtstrahl2.sichtbar_machen()\n @leuchtstrahl3.sichtbar_machen()\n @leuchtstrahl4.sichtbar_machen()\n end", "def puertos\n raise 'implement please!'\n end", "def jugada_ordenador\n @jugada_ordenador\n end", "def berlioz; end", "def prt\n puts \"Federalist #@fedno\"\n puts \"Title: \" + @title.join(\" \")\n puts \"Publication: \" + @publication.join(\" \")\n puts \"Author: \" + @author.join(\" \")\n \n end", "def liste()\n puts(\"LISTE DES ORDRES\\n\");\n printf(\"%8s %8s %5s %10s\\n\",\n \"ID\", \"DEBUT\", \"DUREE\", \"PRIX\")\n printf(\"%8s %8s %5s %10s\\n\",\n \"--------\", \"-------\", \"-----\", \"----------\")\n @listOrdre = @listOrdre.sort{ |a,b| a.debut <=> b.debut } \n @listOrdre.each { |ordre| afficherOrdre(ordre) }\n printf(\"%8s %8s %5s %10s\\n\",\n \"--------\", \"-------\", \"-----\", \"----------\");\n end", "def delelte\n\n end", "def unsichtbar_machen()\n end", "def malts; end", "def index\n @turmas = @disciplina.turmas.sort\n end", "def devolver_azucar \n\t\treturn @azucares\n\tend", "def travel_and_places; end", "def folge_berechnen(tn,jahr)\n folge = [ \"\" ]\n ges_einsaetze = \"28.12.#{jahr}\".to_date.cweek\n ger_schalter = 1\n namen = prio_bilden(tn,folge,ges_einsaetze,ger_schalter)\n zaehler = 0\n while folge.size <= ges_einsaetze\n namen.each do |name|\n unless tn[name].find_index(folge.size) || folge.size > ges_einsaetze\n folge << name\n zaehler += 1\n end\n end\n if zaehler == 0\n if namen.size < tn.size && ger_schalter == 1\n ger_schalter = 0\n else\n folge << \"nicht besetzt!\"\n ger_schalter = 1\n end\n end\n zaehler = 0\n namen = prio_bilden(tn,folge,ges_einsaetze,ger_schalter)\n end\n return folge \n end", "def stderrs; end", "def direction; end", "def direction; end", "def formation; end", "def renglones\n\t\t@renglones_reporte\n\tend", "def dv; end", "def funktionsname\n\tanweisung\nend", "def romeo_and_juliet; end", "def rafraichir\n\t\tj = @jeu.joueur\n\t\tpos = j.position\n\n\t\[email protected]( @jeu.carte.vueJoueur(pos,15) )\n\t\[email protected]( @jeu.carte.vueJoueur(pos,@interface.taille) )\n\t\[email protected]( j.pointsDeVie, j.pointsDeVieMax )\n\t\[email protected]( j.endurance, j.enduranceMax )\n\t\[email protected]( j.score )\n\t\[email protected]( @jeu.nbTour )\n\t\[email protected]( j.or )\n\t\tif j.position.objet\n\t\t\[email protected]( \"Ramasser #{j.position.objet.getNom}\" )\n\t\telsif j.position.pnj\n\t\t\[email protected]( j.position.pnj.actionNom )\n\t\telsif j.position.type.nom == \"herbe\"\n\t\t\[email protected]( \"Regarder l'herbe pousser\" )\n\t\telsif j.position.type.nom == \"desert\"\n\t\t\[email protected]( \"Compter les grains de sable\" )\n\t\telsif j.position.type.nom == \"eau\"\n\t\t\[email protected]( \"Faire la planche\" )\n\t\telse\n\t\t\[email protected]( \"Rien à faire\" )\n\t\tend\n\tend", "def descomponer_fechas(fecha)\r\n dia=fecha[0..1].to_s\r\n mes=fecha[3..4].to_s\r\n anio=fecha[6..9].to_s\r\n return dia,mes,anio\r\nend", "def list\n\t\tprintf(\"%02i.%i\\n\", @options[:monat], @options[:jahr])\n\t\[email protected](\"select betrag, gemeinsam, tags from ausgaben_#{@options[:name]} where jahr = #{@options[:jahr]} and monat = #{@options[:monat]} order by jahr, monat, gemeinsam desc\") do |row|\n\t\t\tprintf(\"(%s) %s EUR [%s] \\n\", row[1], sprintf(\"%.2f\",row[0]).rjust(7), row[2])\n\t\tend\n\tend", "def extraer_delante\n if(@tam == 0)\n puts \"La Lista está vacía\"\n else\n aux = @cabeza\n @cabeza = @cabeza[:Next_]\n @cabeza[:prev] = nil\n @tam = @tam - 1\n return aux[:value]\n end\n end", "def helligdag\n paaskedag = easter\n \n relative_dates = {\n (paaskedag - 7) => \"Palmesøndag\",\t\n (paaskedag - 3) => \"Skærtorsdag\",\t\n (paaskedag - 2) => \"Langfredag\",\n (paaskedag) => \"Påskedag\",\n (paaskedag + 1) => \"2. påskedag\",\t\n (paaskedag + 26) => \"Store Bededag\",\t\n (paaskedag + 39) => \"Kristi himmelfartsdag\",\t\n (paaskedag + 49) => \"Pinsedag\",\t\n (paaskedag + 50) => \"2. pinsedag\",\t\n }\n\n absolute_dates = {\n Date.new(year, 1, 1) => \"Nytårsdag\",\n Date.new(year, 12, 25) => \"1. juledag\",\n Date.new(year, 12, 26) => \"2. juledag\",\n }\n\n (relative_dates.merge(absolute_dates))[self]\n end", "def index\n @xxx = \"___variable instancia requiere at\"\n @time = Time.now\n @yñ = Time.now.year\n @mth = Time.now.month\n @dy = Time.now.day\n @fch = @yñ.to_s + \"-\" + @mth.to_s + \"-\" + @dy.to_s\n @dd_s = Date.parse(@fch).strftime(\"%u\")\n # Lin21: el anterior, @dd_s, es dia de la semana \n # para otra prueba dia @dd_s = \"1\"\n # para otra prueba dia @dd_s = 7.to_s\n # para prueba mes @mth = \"5\"\n\n case @dd_s\n when \"1\"..\"5\"\n @dh = \"día habil\"\n #when \"1\", \"3\", \"5\"\n # @lmv = \"Lun, Mie, o Vie\" \n else\n @dh = \"fin de semana\"\n # @lmv = \"Mart, Juev o Vier\"\n end \n\n case @dd_s\n when \"1\", \"3\", \"5\"\n @lmv = \"Lun, Mie, o Vie\" \n else\n @lmv = \"Mart, Juev o Vier\"\n end \n\n @dds = @dd_s\n \n if @dds == \"1\" then\n @d = \"Lunes\"\n elsif @dds == \"2\" then\n @d = \"Martes\"\n elsif @dds == \"3\" then\n @d = \"Miercoles\"\n elsif @dds == \"4\" then\n @d = \"Jueves\"\n elsif @dds == \"5\" then\n @d = \"Viernes\"\n elsif @dds == \"6\" then\n @d = \"Sabado\"\n elsif @dds == \"7\" then\n @d = \"Domingo\"\n else\n @d = \"otro\"\n end\n\n case @dds\n when \"7\"\n @d = \"D o m\"\n when \"6\"\n @d = \"S a b\"\n when \"5\"\n @d = \"V i e\"\n when \"4\"\n @d = \"J u e\"\n when \"3\"\n @d = \"M i e\"\n when \"2\"\n @d = \"M a r t\"\n when \"1\"\n @d = \"L u n\" \n \n else\n @d = \"dias\"\n end\n\n @cd = @d\n \n @dgr = Date.parse(\"1810-7-20\").strftime(\"%u\")\n @dds = @dgr\n if @dds == \"1\" then\n @d = \"Lunes\"\n elsif @dds == \"2\" then\n @d = \"Martes\"\n elsif @dds == \"3\" then\n @d = \"Miercoles\"\n elsif @dds == \"4\" then\n @d = \"Jueves\"\n elsif @dds == \"5\" then\n @d = \"Viernes\"\n elsif @dds == \"6\" then\n @d = \"Sabado\"\n elsif @dds == \"7\" then\n @d = \"Domingo\"\n else\n @d = \"otro\"\n end\n @d20 = @d\n\n if @mth == 1 then\n @m = \"Enero\" \n elsif @mth == 2 then\n @m = \"Febrero\" \n elsif @mth == 3 then\n @m = \"Marzo\" \n elsif @mth == 4 then\n @m = \"Abril\" \n elsif @mth == 5 then\n @m = \"Mayo\" \n elsif @mth == 6 then\n @m = \"Junio\" \n elsif @mth == 7 then\n @m = \"Julio\" \n elsif @mth == 8 then\n @m = \"Agosto\"\n elsif @mth == 9 then\n @m = \"Septiembre\" \n elsif @mth == 10 then\n @m = \"Octubre\" \n elsif @mth == 11 then\n @m = \"Noviembre\" \n elsif @mth == 12 then\n @m = \"Diciembre\" \n else\n @m = \"otro\"\n end \n@dgr = Date.parse(\"1810-07-20\").strftime(\"%u\")\n\ncase @d \nwhen \"Lunes\"\n @tls = \"Tiene Lunes\"\n #redirect_to motos_path\n #render :festv\nelse\n @tls = \"de L130contrhll: No tiene Lunes\"\n # para ir aotras partes, redirec_to y render funcionaron:\n #redirect_to cars_path\n #render :festr\n #render :festr\nend \n\nend", "def feruchemist; end", "def anlagen_zuordnung\n all_synonym_liste = AnlagenSynonym.all\n @synonym_liste = []\n all_synonym_liste.each do |synonym|\n @synonym_liste << synonym if synonym.anlage.nil?\n end\n @all_werte = Anlage.get_anlagen_for_selection_field\n @anlage = Anlage.new( anlagen_kategorie: AnlagenKategorie.find_by( name: \"Unbekannt\" ) )\n @redirect_params = upload_anlagen_zuordnung_path\n if @synonym_liste.empty?\n redirect_to upload_stoffe_zuordnung_path #upload_read_transporte_path\n else\n @typ = \"anlage\" \n @wert_modal = 'anlagen/form_modal'\n render \"werte_zuordnung\"\n end\n end", "def tu_turno\n Jugador.tu_turno\n end", "def deaf_grandma\nend", "def wertungWorte (wertung)\n if wertung < 1\n return 'unglaublich schlecht'\n elsif wertung < 2\n return 'wirklich schlecht'\n elsif wertung < 3\n return 'relativ schlecht'\n elsif wertung < 4\n return 'in ordnung'\n elsif wertung < 5\n return 'relativ gut'\n elsif wertung < 6\n return 'wirklich gut'\n elsif wertung < 7\n return 'sehr gut'\n elsif wertung < 8\n return 'hervorragend'\n elsif wertung < 9\n return 'unbeschreiblich gut'\n elsif wertung < 10\n return 'bet&ouml;rend gut'\n elsif wertung < 11\n return 'unwirklich gut'\n else\n return 'katastrophal gut'\n end\n end", "def afficher()\n print \"|\" + @etat.to_s\n end", "def sichtbar_machen\n @fuss.sichtbar_machen\n @stiel.sichtbar_machen\n @schirm.sichtbar_machen\n unless @tag\n @leuchtstrahl1.sichtbar_machen\n @leuchtstrahl2.sichtbar_machen\n @leuchtstrahl3.sichtbar_machen\n @leuchtstrahl4.sichtbar_machen\n end\n end", "def reduziere_lebendige_transitionen(lebendig)\n # Prüfe alle Transitionen\n lebendig.transitionen.each do |t|\n # Überspringe t, sofern Übergänge zu t laufen\n next if lebendig.fluss.values.join(', ').include?(t)\n\n # t kommt im Vorbereich mindestens einer Stelle vor\n next unless lebendig.fluss.key?(t)\n\n # Da wir vorher alle Transitionen übersprungen haben, die keinen leeren Vorbereich haben,\n # sind ab hier alle Transitionen lebendig.\n\n # Entferne jede Stelle im Nachbereich von t, mitsamt Übergängen\n lebendig.fluss[t].each do |s|\n lebendig.reduziere_knoten(s)\n end\n\n # Entferne die lebendige Transition t\n lebendig.reduziere_knoten(t)\n\n # Fürs Protokoll\n puts(\"Lebendige Transitionen reduziert!\")\n end\nend", "def abschnitt_only_start_ort orte\n orte.each do |ort_id|\n if !ort_id==0 && self.transportabschnitte.where(end_ort_id: ort_id).empty?\n return ort \n end \n end \n nil\n end", "def build_day jour\n djour = data[jour]\n indice_jour = Semaine::DAYS[jour][:indice] - 1\n date_jour = from_jour + indice_jour\n str = \"\"\n # On ajoute la date exacte du jour\n str << \"<div class='date_jour'>#{date_jour.strftime(\"%d %m %Y\")}</div>\"\n\n return str if djour.nil?\n\n # On commence par classer tous les travaux par temps pour pouvoir\n # récupérer facilement le temps du travail suivant quand la durée du\n # travail courant n'est pas défini\n # Il faut commencer par mettre l'heure dans les données\n travaux = data[jour].collect do |heure, donnees|\n donnees.merge!('heure' => heure)\n end\n\n # Il faut ajouter les travaux récurrents\n travaux += RecurTravail.works_of_day(date_jour)\n\n # On vérifie les éventuels chevauchements\n # TODO\n\n # On les classe par temps\n travaux = travaux.sort_by { |donnees| donnees['heure'].to_minutes }\n\n # puts \"travaux : #{travaux.inspect}\"\n\n travaux.each_with_index do |donnees, index|\n donnees.merge!({\n semaine: self,\n indice_jour: indice_jour\n })\n # Si la durée n'est pas définie dans le travail courant, il faut la\n # déduire du travail suivant\n if donnees['duree'].nil?\n next_travail = travaux[index + 1]\n donnees.merge!('duree' => if next_travail.nil?\n 60\n else\n next_travail['heure'].to_minutes - donnees['heure'].to_minutes\n end)\n end\n travail = Semaine::Jour::Travail.new(donnees)\n str << travail.build\n add_trigger(travail.trigger_data)\n end\n str\n end", "def deter\n \n end", "def sichtbar_machen()\n # TODO\n end", "def extraer_detras\n if(@tam == 0)\n puts \"La Lista está vacía\"\n else\n aux = @cola\n @cola = @cola[:prev]\n @cola[:Next_] = nil\n @tam = @tam - 1\n return aux[:value]\n end\n end", "def sichtbar_machen()\n end", "def converte\n # estados\n estados = ['q']\n 1.upto(@estados.length) do |i|\n @estados.keys.combination(i).to_a.collect { |c| c.sort.join }.each do |a|\n estados << 'q' + a\n end\n end\n\n # alfabeto\n alfabeto = @alfabeto\n\n # função de transição\n transicao = []\n estados.each do |estado|\n if estado == 'q' # vazio\n alfabeto.each { |el| transicao << [ 'q', el, 'q' ] }\n else\n alfabeto.each do |el|\n # verifica setas\n setas = []\n estado[1,estado.length].each_char do |c|\n @transicao.each do |funcao|\n if funcao[0] == c and funcao[1] == el\n setas << funcao[2]\n end\n end\n end\n setas = setas.flatten.uniq.sort\n # adiciona setas no caso de 'e'\n setas.each do |c|\n @transicao.each do |funcao|\n if funcao[0] == c and funcao[1] == nil\n setas << funcao[2]\n end\n end\n end\n setas = setas.flatten.uniq.sort\n # acrescenta à função de transição\n transicao << [ estado, el, 'q' + setas.join ]\n end\n end\n end\n\n # estado inicial\n i = [@atual.nome]\n @transicao.each do |funcao|\n if funcao[0] == @atual.nome and funcao[1] == nil\n i << funcao[2]\n end\n end\n inicial = 'q' + i.flatten.uniq.sort.join\n\n # estados finais\n finais = []\n estados.each do |estado|\n @finais.each do |final|\n finais << estado if estado.include? final\n end\n end\n finais.uniq!\n\n # simplifica, removendo os estados que não recebem nenhuma seta\n a_remover = []\n (estados - [inicial]).each do |estado|\n encontrado = false\n transicao.each do |funcao|\n encontrado = true if funcao[2] == estado\n end\n a_remover << estado if not encontrado\n end\n a_remover.each do |estado|\n estados.delete estado\n r = []\n transicao.each do |funcao|\n r << funcao if funcao[0] == estado\n end\n r.each { |x| transicao.delete x }\n finais.delete estado\n end\n\n return { K: estados, S: alfabeto, d: transicao, s: inicial, F: finais }\n end", "def posti_disponibili\n self.vehicle.posti - self.n_passeggeri\n end", "def langsam_vertikal_bewegen(entfernung)\n absolute_entfernung = entfernung\n if sichtbar? \n delta = 1\n if entfernung < 0 \n delta = -1\n absolute_entfernung = - entfernung\n end \n x_delta = 0\n y_delta = delta\n Leinwand.gib_einzige_instanz().\n bewege(self,absolute_entfernung,x_delta,y_delta)\n end \n @spitze = @spitze + Punkt.new(0,entfernung)\n end", "def dean\n faculty.dean\n end", "def set_urut\n if self.month == 'Januari'\n self.urut = 1\n elsif self.month == 'Februari'\n self.urut = 2\n elsif self.month == 'Maret'\n self.urut = 3\n elsif self.month == 'April'\n self.urut = 4\n elsif self.month == 'Mei'\n self.urut = 5\n elsif self.month == 'Juni'\n self.urut = 6\n elsif self.month == 'Juli'\n self.urut = 7\n elsif self.month == 'Agustus'\n self.urut = 8\n elsif self.month == 'September'\n self.urut = 9\n elsif self.month == 'Oktober'\n self.urut = 10\n elsif self.month == 'November'\n self.urut = 11\n elsif self.month == 'Desember'\n self.urut = 12\n end\n end", "def sub_d\n end", "def index\n @auftrags = Auftrag.all\n end", "def index\n @auftrags = Auftrag.all\n end", "def set_urut\n if self.month.bulan == 'Januari'\n self.urut = 1\n elsif self.month.bulan == 'Februari'\n self.urut = 2\n elsif self.month.bulan == 'Maret'\n self.urut = 3\n elsif self.month.bulan == 'April'\n self.urut = 4\n elsif self.month.bulan == 'Mei'\n self.urut = 5\n elsif self.month.bulan == 'Juni'\n self.urut = 6\n elsif self.month.bulan == 'Juli'\n self.urut = 7\n elsif self.month.bulan == 'Agustus'\n self.urut = 8\n elsif self.month.bulan == 'September'\n self.urut = 9\n elsif self.month.bulan == 'Oktober'\n self.urut = 10\n elsif self.month.bulan == 'November'\n self.urut = 11\n elsif self.month.bulan == 'Desember'\n self.urut = 12\n end\n end", "def fecha_r\r\n @fecha_r.try(:fecha_recepcion).strftime(\"%d/%m/%Y\")\r\n end", "def tourDejeu()\n\t\t#partie Joueur\n\t\tif @type != \"ia\"\n\t\t\tputs \"A moi de jouer (#{nom})\"\n\t\t\tprint \"ligne :\"\n\t\t\tx = gets.chomp()\n\t\t\tprint \"colonne :\"\n\t\t\ty = gets.chomp()\n\t\t\treturn [x.to_i - 1,y.to_i - 1,@forme, @type]\n\t\telse\n\t\t\tsleep(0.5)\n\t\t\tx = rand(1..3)\n\t\t\ty = rand(1..3)\n\t\t\treturn [x.to_i - 1,y.to_i - 1,@forme, @type]\n\t\tend\n\tend", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def periode\n @debut = params[:debut]\n @fin = params[:fin]\n @query = Alerte.where(created_at: params[:debut]..params[:fin]).order(created_at: :desc)\n render layout: 'fylo'\n end", "def prepara_form\n @enderecos = Endereco.order :rua\n end", "def to; end", "def to; end", "def to; end", "def to; end", "def devolver_grasas_saturadas \n return @saturadas\n end", "def daa\n end", "def create\n @transportabschnitt = Transportabschnitt.new(transportabschnitt_params)\n redirection_path = @transportabschnitt\n if params[:transport_id]\n transport = Transport.find(params[:transport_id].to_i)\n @transportabschnitt.transport = transport\n redirection_path = transport if transport \n end\n if params[:beobachtung_id]\n @beobachtung = Beobachtung.find(params[:beobachtung_id].to_i)\n @beobachtung.transportabschnitt = @transportabschnitt if @beobachtung \n redirection_path = @beobachtung if @beobachtung\n end\n\n # Orte zuordnen (Auswahl über Modalmaske, also id vorhanden, wenn Auswahl getroffen)\n if params[:start_ort_ident] && params[:start_ort_ident].to_i != 0\n @transportabschnitt.start_ort = Ort.find(params[:start_ort_ident].to_i)\n end\n if params[:end_ort_ident] && params[:end_ort_ident].to_i != 0\n @transportabschnitt.end_ort = Ort.find(params[:end_ort_ident].to_i)\n end\n\n respond_to do |format|\n if @transportabschnitt.save\n @beobachtung.save if @beobachtung\n flash[:success] = \"Transportabschnitt angelegt.\"\n format.html { redirect_to redirection_path }\n format.json { render :show, status: :created, location: @transportabschnitt }\n else\n init_ort_and_firma\n firma = @transportabschnitt.firma if @transportabschnitt.firma\n format.html { render :new }\n format.json { render json: @transportabschnitt.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @reverse_date_cyphers = @user.reverse_date_cyphers\n end", "def test_wertgleichheit()\n assert(@rp1==@rp1,\"Keine korrekte Pruefung fuer identische Objekte\")\n assert(@rp1==@rp1_6, \"Keine korrekter Vergleich fuerr inhaltsgleiche Objekte\")\n assert(@rp1==@rp1_1, \"Keine korrekter Vergleich für inhaltsgleiche Objekte\")\n assert_equal(false,@rp1==@rp5, \"Fehler: Gleichheit für ungleiche Objekte\")\n assert(@rp0_1==@rp0_2,\"Keine korrekte Prüfung bei 0-Zaehler und leerem Wort\")\n # Arbeitet der Vergleich auch mit Objekten anderen Typs korrekt\n assert_nothing_raised(\"Test auf Wertgleichheit mit Objekten anderen Typs darf keinen Fehler werfen\"){!(@rp1==7)}\n end", "def ausgabe\n\t\t@name\n\t\n\tend" ]
[ "0.6285908", "0.6282542", "0.604449", "0.5906285", "0.58523184", "0.5763519", "0.57453233", "0.5744887", "0.5728028", "0.57207257", "0.56594574", "0.5609961", "0.55795807", "0.5566564", "0.5559516", "0.55353373", "0.553387", "0.5520942", "0.5505037", "0.54290265", "0.5416605", "0.5401528", "0.5390211", "0.5316352", "0.52651495", "0.5246545", "0.5236354", "0.52049553", "0.5194167", "0.51939493", "0.51939493", "0.518818", "0.5164284", "0.51149446", "0.5112492", "0.51114416", "0.5072221", "0.50579536", "0.5039651", "0.5038681", "0.5030558", "0.5029132", "0.5029071", "0.5022051", "0.502074", "0.5016213", "0.5009495", "0.5009495", "0.5006914", "0.50013375", "0.4988612", "0.4974433", "0.49690095", "0.4962678", "0.49624127", "0.4958111", "0.4951294", "0.49466413", "0.49384034", "0.49331498", "0.490281", "0.4900596", "0.48664457", "0.4856881", "0.48471507", "0.48440275", "0.4842441", "0.4840358", "0.48314396", "0.4830614", "0.48235595", "0.4823153", "0.4813344", "0.4812611", "0.48084974", "0.48080534", "0.47934613", "0.47874767", "0.47788888", "0.47641566", "0.47641566", "0.4761986", "0.4758344", "0.4753778", "0.4751758", "0.4751758", "0.4751758", "0.4751758", "0.474475", "0.47374403", "0.4737387", "0.4737387", "0.4737387", "0.4737387", "0.4733773", "0.47239593", "0.4723746", "0.4720502", "0.47194812", "0.47194728" ]
0.6246861
2
Sammelt alle Durchfahrtsorte zusammen, aus Anlagenorten, Umschlagsorten, Abschnitten und zugeordneten Beobachtungen
def get_known_orte_with_props orte = {} strecken = [] # Transportabschnitte inklusive Beobachtungsorte und Strecke der Route transportabschnitte.each do |abschnitt| if abschnitt.route && abschnitt.route.name != "Unbekannt" strecken.concat(abschnitt.route.get_strecken) else if abschnitt.start_ort && abschnitt.end_ort && abschnitt.start_ort.lat && abschnitt.end_ort.lat strecken << [abschnitt.start_ort, abschnitt.end_ort] end end check_ort_p(orte, abschnitt.start_ort, "Abschnitt") check_ort_p(orte, abschnitt.end_ort, "Abschnitt") abschnitt.beobachtungen.each do |beob| check_ort_p(orte, beob.ort, "Beobachtung") end end # Umschlaege umschlaege.each do |umschlag| check_ort_p(orte, umschlag.ort, "Umschlag") end # Start und Zielanlage zuletzt, damit auf jeden Fall das aktuellste, andere werden ggf. ueberschrieben check_ort_p(orte, start_anlage.ort, "Start-Anlage") check_ort_p(orte, ziel_anlage.ort, "Ziel-Anlage") if strecken.empty? if umschlaege.empty? && start_anlage.ort && ziel_anlage.ort && start_anlage.ort.lat && ziel_anlage.ort.lat strecken << [start_anlage.ort, ziel_anlage.ort] elsif start_anlage.ort && start_anlage.ort.lat ort_aktuell = start_anlage.ort umschlaege.each do |umschlag| if umschlag.ort strecken << [ort_aktuell, umschlag.ort] ort_aktuell = umschlag.ort end end if ziel_anlage.ort && ziel_anlage.ort.lat strecken << [ort_aktuell, ziel_anlage.ort] end end end return orte, strecken end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_abschnitte_and_umschlaege_by_ort\n ort_to_detail = {}\n self.umschlaege.each do |umschlag|\n ort = umschlag.ort\n ort_id = ort.nil? ? 0 : ort.id\n ort_to_detail[ort_id] ||= []\n ort_to_detail[ort_id] << umschlag\n end \n self.transportabschnitte.each do |abschnitt|\n ort = abschnitt.start_ort\n ort_id = ort.nil? ? 0 : ort.id\n ort_to_detail[ort_id] ||= []\n ort_to_detail[ort_id] << abschnitt\n end \n ort_to_detail\n end", "def get_known_orte\n orte = []\n check_ort_ll(orte, start_anlage.ort)\n check_ort_ll(orte, ziel_anlage.ort)\n transportabschnitte.each do |abschnitt|\n abschnitt.orte.each do |ort|\n check_ort_ll(orte, ort)\n end\n end\n umschlaege.each do |umschlag|\n check_ort_ll(orte, umschlag.ort)\n end\n orte\n end", "def zuruecksetzen()\n end", "def trd; end", "def karte_drucken()\n # TODO ÄNDERN\n if !tarif_gewaehlt?\n puts \"Kein Tarif wurde gewählt.\"\n else\n if @eingeworfen <= @tarif.betrag\n puts \"Der offener Betrag: #{@tarif.betrag - @eingeworfen }\"\n else\n puts(\"------------------\")\n puts(\"- Cinema Magico -\")\n puts(\"- Phantastische Tierwesen\")\n # TODO diese Zeile ändern\n puts(\"- Preis \" + @tarif.betrag().to_s + \" Euro\") # vordefiniert to_s , von Integer zum String wandeln\n puts(\"- Bezahlt \" + @eingeworfen.to_s + \" Euro\") # vordefiniert to_s , von Integer zum String wandeln\n puts(\"------------------\")\n # die Gesamtsumme, mit dem der Automat nach der letzten Leerung\n # gefuettert wurde\n @eingeworfen -= @tarif.betrag\n @summe_automat = @summe_automat + @tarif.betrag\n @tarif = nil\n return\n end\n end\n\n end", "def ausschalten()\n @schirm.farbe_aendern('orange')\n @leuchtstrahl1.unsichtbar_machen()\n @leuchtstrahl2.unsichtbar_machen()\n @leuchtstrahl3.unsichtbar_machen()\n @leuchtstrahl4.unsichtbar_machen()\n end", "def unsichtbar_machen\n @fuss.unsichtbar_machen\n @stiel.unsichtbar_machen\n @schirm.unsichtbar_machen\n @leuchtstrahl1.unsichtbar_machen\n @leuchtstrahl2.unsichtbar_machen\n @leuchtstrahl3.unsichtbar_machen\n @leuchtstrahl4.unsichtbar_machen\n end", "def schubert; end", "def einschalten() \n @schirm.farbe_aendern('gelb')\n @leuchtstrahl1.sichtbar_machen()\n @leuchtstrahl2.sichtbar_machen()\n @leuchtstrahl3.sichtbar_machen()\n @leuchtstrahl4.sichtbar_machen()\n @leuchtstrahl1.farbe_aendern('gelb')\n @leuchtstrahl2.farbe_aendern('gelb')\n @leuchtstrahl3.farbe_aendern('gelb')\n @leuchtstrahl4.farbe_aendern('gelb')\n end", "def sort_abschnitte_and_umschlaege_by_date start_liste\n abschnitt_umschlag_list = []\n mit_end_datum = start_liste.select{|element| element.end_datum }\n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Mit Ende #{mit_end_datum.to_s}\" }\n abschnitt_umschlag_list.concat(mit_end_datum.sort_by{|element| element.end_datum} )\n ohne_end_datum = start_liste.select{|element| element.end_datum.nil? }\n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Ohne Ende: #{ohne_end_datum.to_s}\" }\n abschnitt_umschlag_list.concat(ohne_end_datum)\n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Liste bei Date #{abschnitt_umschlag_list.to_s}\" }\n abschnitt_umschlag_list\n end", "def schumann; end", "def intelligenter_zug(spielfeld, aktueller_spieler)\n zug = nil\n\n spieler = spielfeld.spieler\n gegner = nil\n for s in spieler\n if s.name != aktueller_spieler.name\n gegner = s\n break\n end\n end\n\n # 1. Regel: Zuerst nach einer Gewinnsituation suchen\n for reihe in Spielfeld::reihen\n besetzt, frei = spielfeld.reihen_status(reihe)\n\n # Wenn der aktuelle Spieler in einer Reihe bereits zwei Felder\n # besetzt hält und das dritte frei ist, dann natürlich das nehmen\n if (frei.size == 1) and (besetzt[aktueller_spieler].size == 2)\n zug = Zug.new(aktueller_spieler, frei[0])\n break # nicht weitersuchen\n end\n end\n\n if zug.nil?\n # 2. Regel: Suche dann nach den Reihen, in denen der Gegner bereits\n # genau 2 Felder besetzt hat und das dritte Feld noch frei ist.\n for reihe in Spielfeld::reihen\n besetzt, frei = spielfeld.reihen_status(reihe)\n\n # Gefährlich, wenn Gegner zwei besetzt hält. Wie in der vorherigen\n # Lektion gelernt, erhält man zum Index des aktuellen Spielers\n # in der Spielerliste den Index des Gegners mit der Bitoperation 1^wer\n if (frei.size == 1) and (besetzt[gegner].size == 2)\n # Jetzt muss der Spieler unbedingt das eine freie Feld besetzen!\n # Andernfalls kann der Gegner im nächsten Zug gewinnen.\n zug = Zug.new(aktueller_spieler, frei[0])\n break # nicht weitersuchen\n end\n end\n end\n\n # Eckensituation bestimmen\n ecken = {\n 1 => 0, # links oben\n 3 => 0, # rechts oben\n 7 => 0, # links unten\n 9 => 0 # rechts unten\n }\n gegen_ecken = [[1, 9], [9, 1], [3, 7], [7, 3]]\n for z in spielfeld.zuege\n feld = z.nummer\n # Gegner besetzt die Ecke, wenn:\n # feld ist eine Ecke und Gegner besetzt sie\n if (ecken[feld] != nil) and (z.spieler == gegner)\n # Markiere Ecke als vom Gegner besetzt\n ecken[feld] = 1\n end\n end\n\n # 3. Regel: Immer in die Mitte setzten, falls dort frei ist\n # Vorsicht vor der XOX Situation an der Diagonale!\n if zug.nil?\n frei = spielfeld.freie_felder\n mitte = 5\n if frei.include?(mitte)\n zug = Zug.new(aktueller_spieler, mitte)\n else\n # Aha, Mitte ist bereits besetzt.\n # Sofern sie vom aktuellen Spieler besetzt ist, dann nach der XOX\n # Situation Ausschau halten und den nächsten Zug nicht in eine Ecke setzen.\n # XOX (oder OXO) Situation besteht, wenn\n # Ecke 1 und 9 vom Gegner besetzt und aktueller Spieler auf 5 oder\n # Ecke 3 und 7 vom Gegner besetzt und aktueller Spieler auf 5.\n for ecken_paar in gegen_ecken\n besetzt, frei_ecken = spielfeld.reihen_status([ecken_paar[0], mitte, ecken_paar[1]])\n if besetzt[gegner].include?(ecken_paar[0]) and besetzt[gegner].include?(ecken_paar[1])\n if besetzt[aktueller_spieler].include?(mitte)\n # Jetzt also nicht in eine freie Ecke setzen, sondern auf\n # die Felder 2, 4, 6 oder 8, sofern sie frei sind.\n xox_felder = [2, 4, 6, 8]\n for f in xox_felder\n if !frei.include?(f)\n xox_felder.delete(f)\n end\n end\n # Von den freien Ausweichfeldern zufällig eines nehmen\n feld = zufalls_feld(xox_felder)\n if feld != nil\n zug = Zug.new(aktueller_spieler, feld)\n break\n end\n end\n end\n end\n\n end\n end\n\n # 4. Regel: Verteidige gegenüberliegende Ecke\n frei = spielfeld.freie_felder\n if zug.nil?\n # Wenn Ecke 1 besetzt, dann setze auf 9, oder umgekehrt (sofern frei).\n # Wenn Ecke 3 besetzt, dann setze auf 7, oder umgekehrt (sofern frei).\n for ecken_paar in gegen_ecken\n if (ecken[ecken_paar[0]] > 0) and (frei.include?(ecken_paar[1]))\n zug = Zug.new(aktueller_spieler, ecken_paar[1])\n break # nicht weitersuchen\n end\n end\n end\n\n # 5. Regel: Setze in irgendeine freie Ecke.\n # Verwende Variablen 'frei' und 'ecken' von oben\n if zug.nil?\n for ecke in ecken.keys\n if frei.include?(ecke)\n zug = Zug.new(aktueller_spieler, ecke)\n break # nicht weitersuchen\n end\n end\n end\n\n # Andernfalls Zufallszug machen\n if zug.nil?\n zug = zufalls_zug(spielfeld, aktueller_spieler)\n end\n\n zug\n end", "def sort_abschnitte_and_umschlaege\n abschnitt_umschlag_list = []\n # Hilfsmethode, baut einen nach Orten sortierten Hash auf.\n ort_to_detail = sort_abschnitte_and_umschlaege_by_ort\n File.open(\"log/transport.log\",\"w\"){|f| f.puts \"Ort to detail #{ort_to_detail}\" }\n unless self.start_anlage.nil?\n if self.start_anlage.ort\n ort_aktuell = self.start_anlage.ort\n if ort_aktuell.nil? || ort_to_detail[ort_aktuell.id].nil?\n ort_aktuell = abschnitt_only_start_ort(ort_to_detail.keys) \n end \n counter = 0\n while not (ort_aktuell.nil? || ort_to_detail.empty? || counter > 100)\n counter += 1\n next_ort = nil\n ort_aktuell_id = ort_aktuell.nil? ? 0 : ort_aktuell.id \n unless ort_to_detail[ort_aktuell_id].nil?\n ort_to_detail[ort_aktuell_id].each do |abschnitt_umschlag|\n File.open(\"log/transport.log\",\"a\"){|f| f.puts abschnitt_umschlag.attributes }\n abschnitt_umschlag_list << abschnitt_umschlag\n next_ort = abschnitt_umschlag.end_ort if abschnitt_umschlag.kind_of? Transportabschnitt \n end\n ort_to_detail.delete(ort_aktuell_id) \n ort_aktuell = next_ort\n end\n end \n # Rest nach Datum sortieren\n unless ort_to_detail.empty?\n File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Rest nach Datum\" }\n abschnitt_umschlag_list = abschnitt_umschlag_list.concat(sort_abschnitte_and_umschlaege_by_date(ort_to_detail.values.flatten))\n end\n else \n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Alles nach Datum\" }\n abschnitt_umschlag_list = abschnitt_umschlag_list.concat(sort_abschnitte_and_umschlaege_by_date(ort_to_detail.values.flatten))\n end \n end\n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Transport #{id}: #{abschnitt_umschlag_list.to_s}\" }\n abschnitt_umschlag_list\n end", "def sichtbar_machen()\n @dach.sichtbar_machen\n @gebaedekoerpe.sichtbar_machen\n @fenster.sichtbar_machen\n @tuer.sichtbar_machen\n end", "def karte_drucken()\n if !tarif_gewaehlt?()\n puts (\"Es wurde noch kein Tarif gewählt. Bitte wählen Sie zuerst einen Tarif aus.\")\n elsif @tarif - @eingeworfen > 0\n offener_betrag = @tarif - @eingeworfen\n puts (\"Sie müssen noch \" + offener_betrag.to_s() + \" Euro einzahlen.\")\n else\n kartenpreis = @tarif\n\n puts(\"------------------\")\n puts(\"- Cinema Magico -\")\n puts(\"- Phantastische Tierwesen\")\n # TODO diese Zeile ändern\n puts(\"- Preis \" + @tarif.to_s + \" Euro\")\n puts(\"- Bezahlt \" + @eingeworfen.to_s + \" Euro\")\n puts(\"------------------\")\n # die Gesamtsumme, mit dem der Automat nach der letzten Leerung\n # gefuettert wurde\n wechsel_geld()\n @summe_automat += kartenpreis\n @tarif = nil\n return\n end\n end", "def nach_unten_bewegen\n bewegen_um_punkt(Punkt.new(0,10))\n end", "def im_nachbarraum_umsehen(richtung)\n naechster_raum = @aktueller_raum.ausgang(richtung)\n puts naechster_raum\n end", "def new\n @transport = Transport.find(params[:transport_id].to_i) if params[:transport_id]\n throw ArgumentError.new(\"Must give an transport id which exists}\") unless @transport\n if params[:beobachtung_id]\n @beobachtung_id = params[:beobachtung_id].to_i if params[:beobachtung_id]\n @beobachtung = Beobachtung.find(@beobachtung_id)\n end\n @transportabschnitt = Transportabschnitt.new\n @transportabschnitt.route = Route.find_by(name: \"Unbekannt\")\n # Wenn Abschnitt oder Umschlag davor oder danach schon existiert, \n # dann nimm daher die entsprechenden Anfangs- und Enddaten\n if params[:abschnitt_davor]\n abschnitt_davor = Transportabschnitt.find(params[:abschnitt_davor].to_i)\n @transportabschnitt.start_datum = abschnitt_davor.end_datum\n @transportabschnitt.start_ort = abschnitt_davor.end_ort\n end\n if params[:abschnitt_danach]\n abschnitt_danach = Transportabschnitt.find(params[:abschnitt_danach].to_i)\n @transportabschnitt.end_datum = abschnitt_danach.start_datum\n @transportabschnitt.end_ort = abschnitt_danach.start_ort\n end\n if params[:umschlag_davor]\n umschlag = Umschlag.find(params[:umschlag_davor].to_i)\n @transportabschnitt.start_datum = umschlag.end_datum\n @transportabschnitt.start_ort = umschlag.ort\n end\n if params[:umschlag_danach]\n umschlag = Umschlag.find(params[:umschlag_danach].to_i)\n @transportabschnitt.end_datum = umschlag.start_datum\n @transportabschnitt.end_ort = umschlag.ort\n end \n @redirect_params = new_transportabschnitt_path(transport_id: @transport.id) \n \n respond_to do |format|\n format.html { render 'new'}\n format.js { render 'new' }\n end\n end", "def unsichtbar_machen()\n @fuss.unsichtbar_machen()\n @stiel.unsichtbar_machen()\n @schirm.unsichtbar_machen()\n @leuchtstrahl1.unsichtbar_machen()\n @leuchtstrahl2.unsichtbar_machen()\n @leuchtstrahl3.unsichtbar_machen()\n @leuchtstrahl4.unsichtbar_machen()\n end", "def doors; end", "def terpene; end", "def drittelworte( wertung )\n if wertung < 1\n string1 = ''\n elsif wertung < 2\n string1 = 'eins'\n elsif wertung < 3\n string1 = 'zwei'\n elsif wertung < 4\n string1 = 'drei'\n elsif wertung < 5\n string1 = 'vier'\n elsif wertung < 6\n string1 = 'f&uuml;nf'\n elsif wertung < 7\n string1 = 'secht'\n elsif wertung < 8\n string1 = 'sieben'\n elsif wertung < 9\n string1 = 'acht'\n elsif wertung < 10\n string1 = 'neun'\n elsif wertung < 11\n string1 = 'zehn'\n elsif wertung < 12\n string1 = 'elf'\n else\n string1 = 'zw&ouml;f'\n end\n rest = sprintf(\"%.1f\",(wertung.to_f % 1))\n if rest.to_f == 0.3\n return string1 + \" ein drittel\"\n elsif rest.to_f == 0.6\n return string1 + \" zwei drittel\"\n elsif rest.to_f == 0\n return string1\n else\n return sprintf(\"%.1f\",wertung.to_s).sub(\".\",\",\")\n end\n end", "def solicitudes_atrasadas\n end", "def sichtbar_machen\n @backgrund.sichtbar_machen\n @baum1.sichtbar_machen\n @baum2.sichtbar_machen\n @baum3.sichtbar_machen\n @haus1.sichtbar_machen\n @haus2.sichtbar_machen\n @haus3.sichtbar_machen\n @hund1.sichtbar_machen\n @hund2.sichtbar_machen\n end", "def behandlungsdatum_str\n\t\t@behandlungsdatum_str || fmt_date( self.behandlungsdatum )\n\tend", "def vertikal_bewegen(anzahl_punkte)\n @fuss.vertikal_bewegen(anzahl_punkte)\n @stiel.vertikal_bewegen(anzahl_punkte)\n @schirm.vertikal_bewegen(anzahl_punkte)\n @leuchtstrahl1.vertikal_bewegen(anzahl_punkte)\n @leuchtstrahl2.vertikal_bewegen(anzahl_punkte)\n @leuchtstrahl3.vertikal_bewegen(anzahl_punkte)\n @leuchtstrahl4.vertikal_bewegen(anzahl_punkte)\n end", "def suivre; end", "def oben() \n return @fahrbahn.obere_linke_ecke().y() \n end", "def gesendete_lesen\r\n @postausgang.each{|x| puts x}\r\n end", "def tld; end", "def tld; end", "def topsman_periphacitis_urosteon()\n end", "def sichtbar_machen()\n @fuss.sichtbar_machen()\n @stiel.sichtbar_machen()\n @schirm.sichtbar_machen()\n @leuchtstrahl1.sichtbar_machen()\n @leuchtstrahl2.sichtbar_machen()\n @leuchtstrahl3.sichtbar_machen()\n @leuchtstrahl4.sichtbar_machen()\n end", "def puertos\n raise 'implement please!'\n end", "def jugada_ordenador\n @jugada_ordenador\n end", "def berlioz; end", "def prt\n puts \"Federalist #@fedno\"\n puts \"Title: \" + @title.join(\" \")\n puts \"Publication: \" + @publication.join(\" \")\n puts \"Author: \" + @author.join(\" \")\n \n end", "def liste()\n puts(\"LISTE DES ORDRES\\n\");\n printf(\"%8s %8s %5s %10s\\n\",\n \"ID\", \"DEBUT\", \"DUREE\", \"PRIX\")\n printf(\"%8s %8s %5s %10s\\n\",\n \"--------\", \"-------\", \"-----\", \"----------\")\n @listOrdre = @listOrdre.sort{ |a,b| a.debut <=> b.debut } \n @listOrdre.each { |ordre| afficherOrdre(ordre) }\n printf(\"%8s %8s %5s %10s\\n\",\n \"--------\", \"-------\", \"-----\", \"----------\");\n end", "def unsichtbar_machen()\n end", "def delelte\n\n end", "def devolver_azucar \n\t\treturn @azucares\n\tend", "def index\n @turmas = @disciplina.turmas.sort\n end", "def malts; end", "def travel_and_places; end", "def folge_berechnen(tn,jahr)\n folge = [ \"\" ]\n ges_einsaetze = \"28.12.#{jahr}\".to_date.cweek\n ger_schalter = 1\n namen = prio_bilden(tn,folge,ges_einsaetze,ger_schalter)\n zaehler = 0\n while folge.size <= ges_einsaetze\n namen.each do |name|\n unless tn[name].find_index(folge.size) || folge.size > ges_einsaetze\n folge << name\n zaehler += 1\n end\n end\n if zaehler == 0\n if namen.size < tn.size && ger_schalter == 1\n ger_schalter = 0\n else\n folge << \"nicht besetzt!\"\n ger_schalter = 1\n end\n end\n zaehler = 0\n namen = prio_bilden(tn,folge,ges_einsaetze,ger_schalter)\n end\n return folge \n end", "def stderrs; end", "def direction; end", "def direction; end", "def formation; end", "def renglones\n\t\t@renglones_reporte\n\tend", "def dv; end", "def funktionsname\n\tanweisung\nend", "def romeo_and_juliet; end", "def rafraichir\n\t\tj = @jeu.joueur\n\t\tpos = j.position\n\n\t\[email protected]( @jeu.carte.vueJoueur(pos,15) )\n\t\[email protected]( @jeu.carte.vueJoueur(pos,@interface.taille) )\n\t\[email protected]( j.pointsDeVie, j.pointsDeVieMax )\n\t\[email protected]( j.endurance, j.enduranceMax )\n\t\[email protected]( j.score )\n\t\[email protected]( @jeu.nbTour )\n\t\[email protected]( j.or )\n\t\tif j.position.objet\n\t\t\[email protected]( \"Ramasser #{j.position.objet.getNom}\" )\n\t\telsif j.position.pnj\n\t\t\[email protected]( j.position.pnj.actionNom )\n\t\telsif j.position.type.nom == \"herbe\"\n\t\t\[email protected]( \"Regarder l'herbe pousser\" )\n\t\telsif j.position.type.nom == \"desert\"\n\t\t\[email protected]( \"Compter les grains de sable\" )\n\t\telsif j.position.type.nom == \"eau\"\n\t\t\[email protected]( \"Faire la planche\" )\n\t\telse\n\t\t\[email protected]( \"Rien à faire\" )\n\t\tend\n\tend", "def descomponer_fechas(fecha)\r\n dia=fecha[0..1].to_s\r\n mes=fecha[3..4].to_s\r\n anio=fecha[6..9].to_s\r\n return dia,mes,anio\r\nend", "def list\n\t\tprintf(\"%02i.%i\\n\", @options[:monat], @options[:jahr])\n\t\[email protected](\"select betrag, gemeinsam, tags from ausgaben_#{@options[:name]} where jahr = #{@options[:jahr]} and monat = #{@options[:monat]} order by jahr, monat, gemeinsam desc\") do |row|\n\t\t\tprintf(\"(%s) %s EUR [%s] \\n\", row[1], sprintf(\"%.2f\",row[0]).rjust(7), row[2])\n\t\tend\n\tend", "def extraer_delante\n if(@tam == 0)\n puts \"La Lista está vacía\"\n else\n aux = @cabeza\n @cabeza = @cabeza[:Next_]\n @cabeza[:prev] = nil\n @tam = @tam - 1\n return aux[:value]\n end\n end", "def helligdag\n paaskedag = easter\n \n relative_dates = {\n (paaskedag - 7) => \"Palmesøndag\",\t\n (paaskedag - 3) => \"Skærtorsdag\",\t\n (paaskedag - 2) => \"Langfredag\",\n (paaskedag) => \"Påskedag\",\n (paaskedag + 1) => \"2. påskedag\",\t\n (paaskedag + 26) => \"Store Bededag\",\t\n (paaskedag + 39) => \"Kristi himmelfartsdag\",\t\n (paaskedag + 49) => \"Pinsedag\",\t\n (paaskedag + 50) => \"2. pinsedag\",\t\n }\n\n absolute_dates = {\n Date.new(year, 1, 1) => \"Nytårsdag\",\n Date.new(year, 12, 25) => \"1. juledag\",\n Date.new(year, 12, 26) => \"2. juledag\",\n }\n\n (relative_dates.merge(absolute_dates))[self]\n end", "def index\n @xxx = \"___variable instancia requiere at\"\n @time = Time.now\n @yñ = Time.now.year\n @mth = Time.now.month\n @dy = Time.now.day\n @fch = @yñ.to_s + \"-\" + @mth.to_s + \"-\" + @dy.to_s\n @dd_s = Date.parse(@fch).strftime(\"%u\")\n # Lin21: el anterior, @dd_s, es dia de la semana \n # para otra prueba dia @dd_s = \"1\"\n # para otra prueba dia @dd_s = 7.to_s\n # para prueba mes @mth = \"5\"\n\n case @dd_s\n when \"1\"..\"5\"\n @dh = \"día habil\"\n #when \"1\", \"3\", \"5\"\n # @lmv = \"Lun, Mie, o Vie\" \n else\n @dh = \"fin de semana\"\n # @lmv = \"Mart, Juev o Vier\"\n end \n\n case @dd_s\n when \"1\", \"3\", \"5\"\n @lmv = \"Lun, Mie, o Vie\" \n else\n @lmv = \"Mart, Juev o Vier\"\n end \n\n @dds = @dd_s\n \n if @dds == \"1\" then\n @d = \"Lunes\"\n elsif @dds == \"2\" then\n @d = \"Martes\"\n elsif @dds == \"3\" then\n @d = \"Miercoles\"\n elsif @dds == \"4\" then\n @d = \"Jueves\"\n elsif @dds == \"5\" then\n @d = \"Viernes\"\n elsif @dds == \"6\" then\n @d = \"Sabado\"\n elsif @dds == \"7\" then\n @d = \"Domingo\"\n else\n @d = \"otro\"\n end\n\n case @dds\n when \"7\"\n @d = \"D o m\"\n when \"6\"\n @d = \"S a b\"\n when \"5\"\n @d = \"V i e\"\n when \"4\"\n @d = \"J u e\"\n when \"3\"\n @d = \"M i e\"\n when \"2\"\n @d = \"M a r t\"\n when \"1\"\n @d = \"L u n\" \n \n else\n @d = \"dias\"\n end\n\n @cd = @d\n \n @dgr = Date.parse(\"1810-7-20\").strftime(\"%u\")\n @dds = @dgr\n if @dds == \"1\" then\n @d = \"Lunes\"\n elsif @dds == \"2\" then\n @d = \"Martes\"\n elsif @dds == \"3\" then\n @d = \"Miercoles\"\n elsif @dds == \"4\" then\n @d = \"Jueves\"\n elsif @dds == \"5\" then\n @d = \"Viernes\"\n elsif @dds == \"6\" then\n @d = \"Sabado\"\n elsif @dds == \"7\" then\n @d = \"Domingo\"\n else\n @d = \"otro\"\n end\n @d20 = @d\n\n if @mth == 1 then\n @m = \"Enero\" \n elsif @mth == 2 then\n @m = \"Febrero\" \n elsif @mth == 3 then\n @m = \"Marzo\" \n elsif @mth == 4 then\n @m = \"Abril\" \n elsif @mth == 5 then\n @m = \"Mayo\" \n elsif @mth == 6 then\n @m = \"Junio\" \n elsif @mth == 7 then\n @m = \"Julio\" \n elsif @mth == 8 then\n @m = \"Agosto\"\n elsif @mth == 9 then\n @m = \"Septiembre\" \n elsif @mth == 10 then\n @m = \"Octubre\" \n elsif @mth == 11 then\n @m = \"Noviembre\" \n elsif @mth == 12 then\n @m = \"Diciembre\" \n else\n @m = \"otro\"\n end \n@dgr = Date.parse(\"1810-07-20\").strftime(\"%u\")\n\ncase @d \nwhen \"Lunes\"\n @tls = \"Tiene Lunes\"\n #redirect_to motos_path\n #render :festv\nelse\n @tls = \"de L130contrhll: No tiene Lunes\"\n # para ir aotras partes, redirec_to y render funcionaron:\n #redirect_to cars_path\n #render :festr\n #render :festr\nend \n\nend", "def feruchemist; end", "def anlagen_zuordnung\n all_synonym_liste = AnlagenSynonym.all\n @synonym_liste = []\n all_synonym_liste.each do |synonym|\n @synonym_liste << synonym if synonym.anlage.nil?\n end\n @all_werte = Anlage.get_anlagen_for_selection_field\n @anlage = Anlage.new( anlagen_kategorie: AnlagenKategorie.find_by( name: \"Unbekannt\" ) )\n @redirect_params = upload_anlagen_zuordnung_path\n if @synonym_liste.empty?\n redirect_to upload_stoffe_zuordnung_path #upload_read_transporte_path\n else\n @typ = \"anlage\" \n @wert_modal = 'anlagen/form_modal'\n render \"werte_zuordnung\"\n end\n end", "def tu_turno\n Jugador.tu_turno\n end", "def deaf_grandma\nend", "def wertungWorte (wertung)\n if wertung < 1\n return 'unglaublich schlecht'\n elsif wertung < 2\n return 'wirklich schlecht'\n elsif wertung < 3\n return 'relativ schlecht'\n elsif wertung < 4\n return 'in ordnung'\n elsif wertung < 5\n return 'relativ gut'\n elsif wertung < 6\n return 'wirklich gut'\n elsif wertung < 7\n return 'sehr gut'\n elsif wertung < 8\n return 'hervorragend'\n elsif wertung < 9\n return 'unbeschreiblich gut'\n elsif wertung < 10\n return 'bet&ouml;rend gut'\n elsif wertung < 11\n return 'unwirklich gut'\n else\n return 'katastrophal gut'\n end\n end", "def afficher()\n print \"|\" + @etat.to_s\n end", "def sichtbar_machen\n @fuss.sichtbar_machen\n @stiel.sichtbar_machen\n @schirm.sichtbar_machen\n unless @tag\n @leuchtstrahl1.sichtbar_machen\n @leuchtstrahl2.sichtbar_machen\n @leuchtstrahl3.sichtbar_machen\n @leuchtstrahl4.sichtbar_machen\n end\n end", "def reduziere_lebendige_transitionen(lebendig)\n # Prüfe alle Transitionen\n lebendig.transitionen.each do |t|\n # Überspringe t, sofern Übergänge zu t laufen\n next if lebendig.fluss.values.join(', ').include?(t)\n\n # t kommt im Vorbereich mindestens einer Stelle vor\n next unless lebendig.fluss.key?(t)\n\n # Da wir vorher alle Transitionen übersprungen haben, die keinen leeren Vorbereich haben,\n # sind ab hier alle Transitionen lebendig.\n\n # Entferne jede Stelle im Nachbereich von t, mitsamt Übergängen\n lebendig.fluss[t].each do |s|\n lebendig.reduziere_knoten(s)\n end\n\n # Entferne die lebendige Transition t\n lebendig.reduziere_knoten(t)\n\n # Fürs Protokoll\n puts(\"Lebendige Transitionen reduziert!\")\n end\nend", "def abschnitt_only_start_ort orte\n orte.each do |ort_id|\n if !ort_id==0 && self.transportabschnitte.where(end_ort_id: ort_id).empty?\n return ort \n end \n end \n nil\n end", "def build_day jour\n djour = data[jour]\n indice_jour = Semaine::DAYS[jour][:indice] - 1\n date_jour = from_jour + indice_jour\n str = \"\"\n # On ajoute la date exacte du jour\n str << \"<div class='date_jour'>#{date_jour.strftime(\"%d %m %Y\")}</div>\"\n\n return str if djour.nil?\n\n # On commence par classer tous les travaux par temps pour pouvoir\n # récupérer facilement le temps du travail suivant quand la durée du\n # travail courant n'est pas défini\n # Il faut commencer par mettre l'heure dans les données\n travaux = data[jour].collect do |heure, donnees|\n donnees.merge!('heure' => heure)\n end\n\n # Il faut ajouter les travaux récurrents\n travaux += RecurTravail.works_of_day(date_jour)\n\n # On vérifie les éventuels chevauchements\n # TODO\n\n # On les classe par temps\n travaux = travaux.sort_by { |donnees| donnees['heure'].to_minutes }\n\n # puts \"travaux : #{travaux.inspect}\"\n\n travaux.each_with_index do |donnees, index|\n donnees.merge!({\n semaine: self,\n indice_jour: indice_jour\n })\n # Si la durée n'est pas définie dans le travail courant, il faut la\n # déduire du travail suivant\n if donnees['duree'].nil?\n next_travail = travaux[index + 1]\n donnees.merge!('duree' => if next_travail.nil?\n 60\n else\n next_travail['heure'].to_minutes - donnees['heure'].to_minutes\n end)\n end\n travail = Semaine::Jour::Travail.new(donnees)\n str << travail.build\n add_trigger(travail.trigger_data)\n end\n str\n end", "def deter\n \n end", "def sichtbar_machen()\n # TODO\n end", "def extraer_detras\n if(@tam == 0)\n puts \"La Lista está vacía\"\n else\n aux = @cola\n @cola = @cola[:prev]\n @cola[:Next_] = nil\n @tam = @tam - 1\n return aux[:value]\n end\n end", "def converte\n # estados\n estados = ['q']\n 1.upto(@estados.length) do |i|\n @estados.keys.combination(i).to_a.collect { |c| c.sort.join }.each do |a|\n estados << 'q' + a\n end\n end\n\n # alfabeto\n alfabeto = @alfabeto\n\n # função de transição\n transicao = []\n estados.each do |estado|\n if estado == 'q' # vazio\n alfabeto.each { |el| transicao << [ 'q', el, 'q' ] }\n else\n alfabeto.each do |el|\n # verifica setas\n setas = []\n estado[1,estado.length].each_char do |c|\n @transicao.each do |funcao|\n if funcao[0] == c and funcao[1] == el\n setas << funcao[2]\n end\n end\n end\n setas = setas.flatten.uniq.sort\n # adiciona setas no caso de 'e'\n setas.each do |c|\n @transicao.each do |funcao|\n if funcao[0] == c and funcao[1] == nil\n setas << funcao[2]\n end\n end\n end\n setas = setas.flatten.uniq.sort\n # acrescenta à função de transição\n transicao << [ estado, el, 'q' + setas.join ]\n end\n end\n end\n\n # estado inicial\n i = [@atual.nome]\n @transicao.each do |funcao|\n if funcao[0] == @atual.nome and funcao[1] == nil\n i << funcao[2]\n end\n end\n inicial = 'q' + i.flatten.uniq.sort.join\n\n # estados finais\n finais = []\n estados.each do |estado|\n @finais.each do |final|\n finais << estado if estado.include? final\n end\n end\n finais.uniq!\n\n # simplifica, removendo os estados que não recebem nenhuma seta\n a_remover = []\n (estados - [inicial]).each do |estado|\n encontrado = false\n transicao.each do |funcao|\n encontrado = true if funcao[2] == estado\n end\n a_remover << estado if not encontrado\n end\n a_remover.each do |estado|\n estados.delete estado\n r = []\n transicao.each do |funcao|\n r << funcao if funcao[0] == estado\n end\n r.each { |x| transicao.delete x }\n finais.delete estado\n end\n\n return { K: estados, S: alfabeto, d: transicao, s: inicial, F: finais }\n end", "def sichtbar_machen()\n end", "def posti_disponibili\n self.vehicle.posti - self.n_passeggeri\n end", "def langsam_vertikal_bewegen(entfernung)\n absolute_entfernung = entfernung\n if sichtbar? \n delta = 1\n if entfernung < 0 \n delta = -1\n absolute_entfernung = - entfernung\n end \n x_delta = 0\n y_delta = delta\n Leinwand.gib_einzige_instanz().\n bewege(self,absolute_entfernung,x_delta,y_delta)\n end \n @spitze = @spitze + Punkt.new(0,entfernung)\n end", "def dean\n faculty.dean\n end", "def set_urut\n if self.month == 'Januari'\n self.urut = 1\n elsif self.month == 'Februari'\n self.urut = 2\n elsif self.month == 'Maret'\n self.urut = 3\n elsif self.month == 'April'\n self.urut = 4\n elsif self.month == 'Mei'\n self.urut = 5\n elsif self.month == 'Juni'\n self.urut = 6\n elsif self.month == 'Juli'\n self.urut = 7\n elsif self.month == 'Agustus'\n self.urut = 8\n elsif self.month == 'September'\n self.urut = 9\n elsif self.month == 'Oktober'\n self.urut = 10\n elsif self.month == 'November'\n self.urut = 11\n elsif self.month == 'Desember'\n self.urut = 12\n end\n end", "def sub_d\n end", "def index\n @auftrags = Auftrag.all\n end", "def index\n @auftrags = Auftrag.all\n end", "def set_urut\n if self.month.bulan == 'Januari'\n self.urut = 1\n elsif self.month.bulan == 'Februari'\n self.urut = 2\n elsif self.month.bulan == 'Maret'\n self.urut = 3\n elsif self.month.bulan == 'April'\n self.urut = 4\n elsif self.month.bulan == 'Mei'\n self.urut = 5\n elsif self.month.bulan == 'Juni'\n self.urut = 6\n elsif self.month.bulan == 'Juli'\n self.urut = 7\n elsif self.month.bulan == 'Agustus'\n self.urut = 8\n elsif self.month.bulan == 'September'\n self.urut = 9\n elsif self.month.bulan == 'Oktober'\n self.urut = 10\n elsif self.month.bulan == 'November'\n self.urut = 11\n elsif self.month.bulan == 'Desember'\n self.urut = 12\n end\n end", "def fecha_r\r\n @fecha_r.try(:fecha_recepcion).strftime(\"%d/%m/%Y\")\r\n end", "def tourDejeu()\n\t\t#partie Joueur\n\t\tif @type != \"ia\"\n\t\t\tputs \"A moi de jouer (#{nom})\"\n\t\t\tprint \"ligne :\"\n\t\t\tx = gets.chomp()\n\t\t\tprint \"colonne :\"\n\t\t\ty = gets.chomp()\n\t\t\treturn [x.to_i - 1,y.to_i - 1,@forme, @type]\n\t\telse\n\t\t\tsleep(0.5)\n\t\t\tx = rand(1..3)\n\t\t\ty = rand(1..3)\n\t\t\treturn [x.to_i - 1,y.to_i - 1,@forme, @type]\n\t\tend\n\tend", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def periode\n @debut = params[:debut]\n @fin = params[:fin]\n @query = Alerte.where(created_at: params[:debut]..params[:fin]).order(created_at: :desc)\n render layout: 'fylo'\n end", "def prepara_form\n @enderecos = Endereco.order :rua\n end", "def to; end", "def to; end", "def to; end", "def to; end", "def devolver_grasas_saturadas \n return @saturadas\n end", "def create\n @transportabschnitt = Transportabschnitt.new(transportabschnitt_params)\n redirection_path = @transportabschnitt\n if params[:transport_id]\n transport = Transport.find(params[:transport_id].to_i)\n @transportabschnitt.transport = transport\n redirection_path = transport if transport \n end\n if params[:beobachtung_id]\n @beobachtung = Beobachtung.find(params[:beobachtung_id].to_i)\n @beobachtung.transportabschnitt = @transportabschnitt if @beobachtung \n redirection_path = @beobachtung if @beobachtung\n end\n\n # Orte zuordnen (Auswahl über Modalmaske, also id vorhanden, wenn Auswahl getroffen)\n if params[:start_ort_ident] && params[:start_ort_ident].to_i != 0\n @transportabschnitt.start_ort = Ort.find(params[:start_ort_ident].to_i)\n end\n if params[:end_ort_ident] && params[:end_ort_ident].to_i != 0\n @transportabschnitt.end_ort = Ort.find(params[:end_ort_ident].to_i)\n end\n\n respond_to do |format|\n if @transportabschnitt.save\n @beobachtung.save if @beobachtung\n flash[:success] = \"Transportabschnitt angelegt.\"\n format.html { redirect_to redirection_path }\n format.json { render :show, status: :created, location: @transportabschnitt }\n else\n init_ort_and_firma\n firma = @transportabschnitt.firma if @transportabschnitt.firma\n format.html { render :new }\n format.json { render json: @transportabschnitt.errors, status: :unprocessable_entity }\n end\n end\n end", "def daa\n end", "def index\n @reverse_date_cyphers = @user.reverse_date_cyphers\n end", "def ausgabe\n\t\t@name\n\t\n\tend", "def test_wertgleichheit()\n assert(@rp1==@rp1,\"Keine korrekte Pruefung fuer identische Objekte\")\n assert(@rp1==@rp1_6, \"Keine korrekter Vergleich fuerr inhaltsgleiche Objekte\")\n assert(@rp1==@rp1_1, \"Keine korrekter Vergleich für inhaltsgleiche Objekte\")\n assert_equal(false,@rp1==@rp5, \"Fehler: Gleichheit für ungleiche Objekte\")\n assert(@rp0_1==@rp0_2,\"Keine korrekte Prüfung bei 0-Zaehler und leerem Wort\")\n # Arbeitet der Vergleich auch mit Objekten anderen Typs korrekt\n assert_nothing_raised(\"Test auf Wertgleichheit mit Objekten anderen Typs darf keinen Fehler werfen\"){!(@rp1==7)}\n end" ]
[ "0.62862504", "0.62471354", "0.6044639", "0.5905612", "0.5852106", "0.5764521", "0.57459384", "0.57434684", "0.5728496", "0.5721294", "0.56581503", "0.560934", "0.55794823", "0.55665576", "0.55592704", "0.55363", "0.5533778", "0.55196124", "0.5505692", "0.5428804", "0.54164374", "0.5401192", "0.53918505", "0.5316674", "0.52650476", "0.5246947", "0.5236382", "0.5205023", "0.5195033", "0.51934636", "0.51934636", "0.51889753", "0.51646096", "0.51158476", "0.5113461", "0.5110811", "0.5072397", "0.5060333", "0.50385743", "0.5038507", "0.5029927", "0.50297225", "0.50296", "0.5022551", "0.5020581", "0.501551", "0.50080186", "0.50080186", "0.5006277", "0.50024414", "0.4987314", "0.4974739", "0.49700806", "0.49631426", "0.49625316", "0.4960254", "0.49503472", "0.49464226", "0.4938522", "0.49321184", "0.4903244", "0.49005696", "0.4864713", "0.48567754", "0.48488972", "0.48438996", "0.48417938", "0.4840151", "0.48312092", "0.48286402", "0.4823218", "0.4823057", "0.48137447", "0.48129496", "0.48082182", "0.4807025", "0.47924256", "0.47886446", "0.47783014", "0.47646454", "0.47646454", "0.47630942", "0.4758098", "0.47550485", "0.47507116", "0.47507116", "0.47507116", "0.47507116", "0.47448355", "0.4737659", "0.47364074", "0.47364074", "0.47364074", "0.47364074", "0.4734437", "0.472246", "0.47223377", "0.47214192", "0.4719857", "0.47196314" ]
0.6282484
1
Wozu ist das da?
def union_scope(*scopes) id_column = "#{table_name}.id" sub_query = scopes.map { |s| s.select(id_column).to_sql }.join(" UNION ") where "#{id_column} IN (#{sub_query})" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suivre; end", "def zuruecksetzen()\n end", "def verdi; end", "def schubert; end", "def schumann; end", "def terpene; end", "def mi_carrera\n\n\tend", "def berlioz; end", "def sichtbar_machen()\n end", "def pessoavai(lugar)\n puts \"indo para \" + lugar\nend", "def hambriento?\n # Los nombres de los metodos pueden terminar en \"?\".\n # Generalmente, hacemos esto si el método debe\n # devolver verdadero o falso, como esto:\n @panzaLlena <= 2\n end", "def hambriento?\n # Los nombres de los metodos pueden terminar en \"?\".\n # Generalmente, hacemos esto si el método debe\n # devolver verdadero o falso, como esto:\n @panzaLlena <= 2\n end", "def bellini; end", "def oben() \n return @fahrbahn.obere_linke_ecke().y() \n end", "def unsichtbar_machen()\n end", "def sigla; @nome; end", "def romeo_and_juliet; end", "def ausschalten()\n @schirm.farbe_aendern('orange')\n @leuchtstrahl1.unsichtbar_machen()\n @leuchtstrahl2.unsichtbar_machen()\n @leuchtstrahl3.unsichtbar_machen()\n @leuchtstrahl4.unsichtbar_machen()\n end", "def slogan\n # 'A maneira mais fácil de pré-qualificar ao Atlas.'\n ''\n end", "def imprime_dados()\n if @esq==-1 && @dir==-1\n puts 'no folha'\n else\n puts 'no interno ou raiz'\n puts @dir.to_s + '->' + @esq.to_s \n end\n end", "def sichtbar_machen()\n # TODO\n end", "def sichtbar_machen\n @sichtbar = true\n zeichnen()\n puts(self) \n end", "def chondromyxoma(buckshee, uncongenially_chiquitan)\n end", "def who_we_are\r\n end", "def vrat_modif_instanci\n vystup=\"\"\n @pole_dat.each do |radek| \n if(radek[0]==\"p\")then \n vystup +=radek\n vystup += \"w #{generuj_vahy(radek).join(' ')}\\n\" #pridani radku s vahami\n else\n vystup +=radek\n end \n end\n # puts vystup\n return vystup\n end", "def eplore\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def PodstawAn(ans) \n @RownanieWielomianu.each{ |wezel| \n if(ans.key?(wezel.Wspolczynnik))\n wezel.Wspolczynnik = ans[wezel.Wspolczynnik]\n end\n }\n end", "def funktionsname\n\tanweisung\nend", "def tu_turno\n Jugador.tu_turno\n end", "def letzte_komponente\n \n end", "def An()\n return @RownanieWielomianu.first.Wspolczynnik\n end", "def placebo?; false end", "def stand\r\n return true\r\n end", "def desliga\n if desligado == false then\n return \"NÃO\"\n else\n return \"SIM\"\n end\n\n end", "def check_bingo\n\t\t\n\tend", "def einschalten() \n @schirm.farbe_aendern('gelb')\n @leuchtstrahl1.sichtbar_machen()\n @leuchtstrahl2.sichtbar_machen()\n @leuchtstrahl3.sichtbar_machen()\n @leuchtstrahl4.sichtbar_machen()\n @leuchtstrahl1.farbe_aendern('gelb')\n @leuchtstrahl2.farbe_aendern('gelb')\n @leuchtstrahl3.farbe_aendern('gelb')\n @leuchtstrahl4.farbe_aendern('gelb')\n end", "def informational?; end", "def ismn; end", "def retornoBusqueda()\nreturn @busqueda\nend", "def im_nachbarraum_umsehen(richtung)\n naechster_raum = @aktueller_raum.ausgang(richtung)\n puts naechster_raum\n end", "def ano_eleicao\n puts \"esta eleição esta acontecendo no ano de #{@ano}\"\n \n end", "def rossini; end", "def in_peril?; @in_peril; end", "def somme\n fail \"Doit etre defini dans la sous-classe\"\n end", "def povuci_mrezu\n return @mreza\n end", "def squeek\r\n\t\treturn \"eeeep\"\r\n\tend", "def solicitudes_atrasadas\n end", "def topsman_periphacitis_urosteon()\n end", "def pessoavaidois(lugar)\n \"indo para \" + lugar\nend", "def ibu; end", "def controllaInizio( pippo)\n if INIZIO == 1 && FINE > INIZIO\n return true\n else\n ultimoBook = Book.last\n end \n #ultimoBook = Book.last #<<=== cambiare (commentandola) questa istruzione per il primo ciclo di bidoni\n if INIZIO == ultimoBook.id+1 # 1 <<=== cambiare questa istruzione (mettere: INIZIO == 1) per il primo ciclo di bidoni\n return true\n else\n pippo.scriviRiga(\"Ultimo record in tabella books ha valore: #{ultimoBook.id}\") if INIZIO > 1\n return false\n end\nend", "def saludo(saluda)\n if saluda == 'hola'\n puts 'hola mundo'\n else\n puts \"hola #{saluda}\"\n end\nend", "def suivi? ; self.abs_module.nombre_jours.nil? end", "def karte_drucken()\n # TODO ÄNDERN\n if !tarif_gewaehlt?\n puts \"Kein Tarif wurde gewählt.\"\n else\n if @eingeworfen <= @tarif.betrag\n puts \"Der offener Betrag: #{@tarif.betrag - @eingeworfen }\"\n else\n puts(\"------------------\")\n puts(\"- Cinema Magico -\")\n puts(\"- Phantastische Tierwesen\")\n # TODO diese Zeile ändern\n puts(\"- Preis \" + @tarif.betrag().to_s + \" Euro\") # vordefiniert to_s , von Integer zum String wandeln\n puts(\"- Bezahlt \" + @eingeworfen.to_s + \" Euro\") # vordefiniert to_s , von Integer zum String wandeln\n puts(\"------------------\")\n # die Gesamtsumme, mit dem der Automat nach der letzten Leerung\n # gefuettert wurde\n @eingeworfen -= @tarif.betrag\n @summe_automat = @summe_automat + @tarif.betrag\n @tarif = nil\n return\n end\n end\n\n end", "def recolectar_una\n\t\test = \"\"\n\t\tif @estado == ESTADO::MUERTE\n\t\t\test = \"El árbol está muerto\"\n\t\telse\n\t\t\tif @contador == 0\n\t\t\t\test = \"No hay más naranjas\"\n\t\t\telse\n\t\t\t\test = \"La naranja estaba deliciosa\"\n\t\t\t\t@contador -= 1\n\t\t\tend\n\t\tend\n\t\test\n\tend", "def saludanombre(nombre)\n\tputs \"Estimado Señor #{nombre}\"\nend", "def monica\n end", "def gounod; end", "def fin(human1)\n puts 'Fini'\n human1.life_points > 0 ? (puts 'Vous avez gagné') : (puts 'Vous avez perdu')\nend", "def sonido()\n return super << \" miaaauuu\"\n end", "def unsichtbar_machen\n loeschen()\n @sichtbar = false \n end", "def flag; end", "def verificar_jugadas_contradictorias jugadalot\n #jugadalot es un object param\n # 4 tipos de jugadas: 0101, 0102, 0103, 0104\n jugadas = Jugadalot.where(:ticket_id => jugadalot.ticket_id) || [] # nil en caso de no encontrar jugadas de ese ticket_id, my remoto pero contemplarlo. \n respuesta = false\n\n comandos = []\n comando_actual = jugadalot.comandojugada # incluyo tambien la ultima jugada digitada en pantalla que aun no esta en la consulta del modelo. Esta jugada viene dentro del objeto recibido como param ok.\n\n jugadas.each do |jugada|\n comandos << jugada.comandojugada # capturar todos los comandos de las jugadas\n end\n #aplicar la logica de las jugadas contradictorias\n #la jugada contradictoria se verifica en cada entrada nueva, compara la que llega con las que estan?\n\n #si la jugada nueva es al cinta azul, verificar que no este esa misma pelea al cinta blanca y viceversa\n # comando_actual => \"0101\" por ejemplo\n if comando_actual[2..3] == \"01\" # pelea apostando al cinta azul\n jugada_opuesta = comando_actual[0..1].to_s + \"0\"+\"2\" #misma pelea pero al cinta blanca\n return comandos.include?(jugada_opuesta.to_s)\n end\n\n if comando_actual[2..3] == \"02\" # pelea apostando al cinta azul\n jugada_opuesta = comando_actual[0..1].to_s + \"0\"+\"1\" #misma pelea pero al cinta blanca\n return comandos.include?(jugada_opuesta.to_s)\n end\n\n if comando_actual[2..3] == \"03\" # pelea apostando al cinta azul\n jugada_opuesta = comando_actual[0..1].to_s + \"0\"+\"4\" #misma pelea pero al cinta blanca\n return comandos.include?(jugada_opuesta.to_s)\n end\n\n if comando_actual[2..3] == \"04\" # pelea apostando al cinta azul\n jugada_opuesta = comando_actual[0..1].to_s + \"0\"+\"3\" #misma pelea pero al cinta blanca\n return comandos.include?(jugada_opuesta.to_s)\n end\n \n end", "def england\n end", "def seuil()\n\t\treturn 0\n\tend", "def ausgleich\n\t\tsums = {}\n\t\t%w(jo caro).each do |who|\n\t\t\tsums[who] = @db.get_first_value(\"select summe from sum_#{who} where jahr = #{@options[:jahr]} and monat = #{@options[:monat]} and gemeinsam = 'g'\").to_f\n\t\tend\n\n\t\tif(sums['jo'] == sums['caro'])\n\t\t\tputs \"Gleichstand\"\n\t\t\treturn\n\t\tend\n\n\t\tausg = ((sums['jo'] + sums['caro']) / 2 - sums['jo']).abs\n\t\t\n\t\tif(sums['jo'] > sums['caro'])\n\t\t\tprintf(\"Caro an Jo: %.2f EUR\\n\", ausg)\n\t\telse\n\t\t\tprintf(\"Jo an Caro: %.2f EUR\\n\", ausg)\n\t\tend\n\t\t\n\tend", "def is_translated?(moonrune)\n begin\n if moonrune.translation_check != moonrune\n return true\n else\n return false\n end\n rescue \n p \"something went awry with is_translated?\"\n return false\n end\nend", "def daa\n end", "def malts; end", "def GueltigBis\n \treturn @GueltigBis\n end", "def devolver_azucar \n\t\treturn @azucares\n\tend", "def blam!\n berzerk? ? w00t! : super\n end", "def sichtbar_machen()\n @dach.sichtbar_machen\n @gebaedekoerpe.sichtbar_machen\n @fenster.sichtbar_machen\n @tuer.sichtbar_machen\n end", "def status_da_divulgacao(topico)\n end", "def private; end", "def grilleSuivante()\n @grilleRaz = nil\n return nil\n end", "def chargementJeu(nomJoueur)\n @sauvegardeYaml = SauvegardeYAML.creer(nomJoueur)\n @sauvegarde = @sauvegardeYaml.chargement()\n @joueur = @sauvegarde.joueur\n [email protected](\".\")\n @joueur.nom = nom[0]\n print @joueur.nom\n @carte = @sauvegarde.carte\n @nbTour = @sauvegarde.nbTour\n\tend", "def gesendete_lesen\r\n @postausgang.each{|x| puts x}\r\n end", "def aye?\n true\n end", "def whiny; end", "def changerEnRouge\n\t\t@couleur=1\n\tend", "def programmjetzt\ndoc = tvprogramm(doc)\ndob = tvprogrammsat(dob)\n if doc == NIL or doc == \"\"\n say \"Es gab ein Problem beim Einlesen des Fernsehprogramms!\"\n elsif dob == NIL or dob == \"\"\n say \"Es gab ein Problem beim Einlesen des Fernsehprogramms!\"\n else\n doc.encoding = 'utf-8'\n dob.encoding = 'utf-8'\n docs = doc.xpath('//title')\n dobs = dob.xpath('//title')\n i = 1\n while i < docs.length\n dos = docs[i].to_s\n dos = cleanup(dos)\n doss = dos[0,5]\n if doss == \"ARD: \"\n dos = dosund(dos)\n orf1 = dos\n elsif doss == \"ZDF: \"\n dos = dosund(dos)\n orf2 = dos\n elsif doss == \"SAT.1\"\n dos = dosund(dos)\n orf3 = dos\n elsif doss == \"RTL: \"\n dos = dosund(dos)\n atv = dos\n elsif doss == \"PRO7:\"\n dos = dosund(dos)\n orfs = dos\n elsif doss == \"RTL2:\"\n dos = dosund(dos)\n puls4 = dos\n elsif doss == \"KABEL\"\n dos = dosund(dos)\n servus = dos\n else\n end\n i += 1\n end\n i = 1\n while i < dobs.length\n dos = dobs[i].to_s\n dos = cleanup(dos)\n doss = dos[0,5]\n \n if doss == \"3SAT:\"\n dos = dosund(dos)\n sat = dos\n else\n end\n i += 1\n end\n say \"\", spoken: \"Das läuft gerade im Fernsehen\"\nobject = SiriAddViews.new\n object.make_root(last_ref_id)\n answer = SiriAnswer.new(\"TV Programm - aktuell\", [\n SiriAnswerLine.new(orf1),\n SiriAnswerLine.new(orf2),\n SiriAnswerLine.new(orf3),\n SiriAnswerLine.new(atv),\n SiriAnswerLine.new(sat),\n SiriAnswerLine.new(puls4),\n SiriAnswerLine.new(servus),\n SiriAnswerLine.new(orfs)\n ])\n object.views << SiriAnswerSnippet.new([answer])\n send_object object\n \n end\n request_completed\nend", "def gluck_french; end", "def nacti_data(data, pomer)\n poc_nactenych_klauzuli = 0 \n pole_radku = data.split(\"\\n\")\n \n pole_radku.each do |radek|\n if(radek[0]!=\"c\")then #preskakuji komentar\n pole_hodnot = radek.split(' ') # ulozim si hodnoty do pole\n \n case radek[0]\n \n when \"p\"\n #nacteni zakladniho nastaveni instance\n @pocet_promennych = pole_hodnot[2].to_i\n @pocet_klauzuli = pole_hodnot[3].to_i\n # pokud je nastaven pomer (tj. obtiznost instance)\n if((pomer!=-1)&&(@pocet_klauzuli>=@pocet_promennych.to_f*pomer))then\n @pocet_klauzuli = @pocet_promennych.to_f*pomer\n end\n \n when \"w\"\n #nacitani vahoveho vektoru\n citac = 1\n while(citac < pole_hodnot.length)do\n @pole_vah[citac-1] = pole_hodnot[citac].to_i\n citac +=1\n end\n\n # when \"%\" # pouze pro kontrolu\n #ukoncovaci znak\n # puts \"%\" \n \n else\n #nacitani klauzuli\n if(poc_nactenych_klauzuli<@pocet_klauzuli)then\n citac = 0\n while(citac < pole_hodnot.length-1)do\n if(@klauzule[poc_nactenych_klauzuli]==nil)then\n nove_pole = []\n @klauzule[poc_nactenych_klauzuli]= nove_pole\n end\n @klauzule[poc_nactenych_klauzuli][@klauzule[poc_nactenych_klauzuli].length] = pole_hodnot[citac].to_i\n citac +=1\n end\n poc_nactenych_klauzuli+=1\n end \n end\n end\n end \n end", "def sea; end", "def hd\n \n end", "def trd; end", "def feruchemist; end", "def iso?; end", "def jeuTermine\n\t\tlancementAventure(@tailleGrille+1)\n\tend", "def elv_kapoera\n atk == dfe\n end", "def formation; end", "def zlosniwa\r\n raise # ponownie zglasza biezacy wyjatek\r\n raise \"Houston, we've got a problem!\" # zglasza RuntimeError\r\n raise InterfaceException, \"Blad klawiatury\", caller # ustawia komunikat i slad stosu\r\nend", "def upc_e; end", "def saludo(sld)\n if sld == 'Hola'\n puts 'Hola Mundo'\n else\n puts 'Buenos días'\n end\nend", "def ausgabe\n\t\t@name\n\tend", "def harga(buah) # Dapat dilihat bahwa harga sebuah method dan buah sebagai parameter sebuah template pada variabel\n puts \"Mas buah #{buah} ini dijual?\"\nend" ]
[ "0.7137959", "0.710734", "0.63303626", "0.6330051", "0.6242765", "0.612253", "0.600601", "0.5932082", "0.5880782", "0.58561146", "0.58340615", "0.58340615", "0.5825893", "0.58197296", "0.5800823", "0.57970655", "0.5783055", "0.5767753", "0.5760175", "0.5756281", "0.5754307", "0.57458544", "0.57266015", "0.5722902", "0.57055724", "0.5698308", "0.5681625", "0.5681625", "0.5681625", "0.5681625", "0.5673568", "0.56555486", "0.56430936", "0.5639986", "0.56311554", "0.5606492", "0.55993855", "0.55951893", "0.55904657", "0.5586999", "0.5584517", "0.5578376", "0.55764943", "0.55713814", "0.55668384", "0.55418086", "0.5540138", "0.5536607", "0.5524092", "0.5519983", "0.55163085", "0.5512906", "0.5508033", "0.5502402", "0.5495567", "0.548984", "0.54883015", "0.5485324", "0.5476668", "0.5475054", "0.54613316", "0.54610604", "0.54606456", "0.54521465", "0.54460907", "0.544547", "0.54422534", "0.54337925", "0.54233634", "0.54167855", "0.5412067", "0.54116803", "0.5407688", "0.5404806", "0.5401269", "0.54007477", "0.53988254", "0.5398803", "0.53927404", "0.5389085", "0.53885835", "0.53865826", "0.5380531", "0.5378488", "0.53572214", "0.53537726", "0.53477824", "0.53472626", "0.53451836", "0.53434926", "0.53420675", "0.5338607", "0.53385556", "0.5338446", "0.5335504", "0.5335243", "0.533466", "0.5332025", "0.53315616", "0.5326061", "0.53227156" ]
0.0
-1
Hilfsmethoden zur Sortierung von Umschlag und Transportkette Sortiert alle Umschlaege und Transportabschnitte in einen Hash, der jeweils den (Start)Ort einer Liste aus Umschlaegen/Abschnitten zuordnet. Umschlaege kommen dabei automatisch zuerst.
def sort_abschnitte_and_umschlaege_by_ort ort_to_detail = {} self.umschlaege.each do |umschlag| ort = umschlag.ort ort_id = ort.nil? ? 0 : ort.id ort_to_detail[ort_id] ||= [] ort_to_detail[ort_id] << umschlag end self.transportabschnitte.each do |abschnitt| ort = abschnitt.start_ort ort_id = ort.nil? ? 0 : ort.id ort_to_detail[ort_id] ||= [] ort_to_detail[ort_id] << abschnitt end ort_to_detail end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_abschnitte_and_umschlaege\n abschnitt_umschlag_list = []\n # Hilfsmethode, baut einen nach Orten sortierten Hash auf.\n ort_to_detail = sort_abschnitte_and_umschlaege_by_ort\n File.open(\"log/transport.log\",\"w\"){|f| f.puts \"Ort to detail #{ort_to_detail}\" }\n unless self.start_anlage.nil?\n if self.start_anlage.ort\n ort_aktuell = self.start_anlage.ort\n if ort_aktuell.nil? || ort_to_detail[ort_aktuell.id].nil?\n ort_aktuell = abschnitt_only_start_ort(ort_to_detail.keys) \n end \n counter = 0\n while not (ort_aktuell.nil? || ort_to_detail.empty? || counter > 100)\n counter += 1\n next_ort = nil\n ort_aktuell_id = ort_aktuell.nil? ? 0 : ort_aktuell.id \n unless ort_to_detail[ort_aktuell_id].nil?\n ort_to_detail[ort_aktuell_id].each do |abschnitt_umschlag|\n File.open(\"log/transport.log\",\"a\"){|f| f.puts abschnitt_umschlag.attributes }\n abschnitt_umschlag_list << abschnitt_umschlag\n next_ort = abschnitt_umschlag.end_ort if abschnitt_umschlag.kind_of? Transportabschnitt \n end\n ort_to_detail.delete(ort_aktuell_id) \n ort_aktuell = next_ort\n end\n end \n # Rest nach Datum sortieren\n unless ort_to_detail.empty?\n File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Rest nach Datum\" }\n abschnitt_umschlag_list = abschnitt_umschlag_list.concat(sort_abschnitte_and_umschlaege_by_date(ort_to_detail.values.flatten))\n end\n else \n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Alles nach Datum\" }\n abschnitt_umschlag_list = abschnitt_umschlag_list.concat(sort_abschnitte_and_umschlaege_by_date(ort_to_detail.values.flatten))\n end \n end\n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Transport #{id}: #{abschnitt_umschlag_list.to_s}\" }\n abschnitt_umschlag_list\n end", "def sort_entries; end", "def sort_abschnitte_and_umschlaege_by_date start_liste\n abschnitt_umschlag_list = []\n mit_end_datum = start_liste.select{|element| element.end_datum }\n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Mit Ende #{mit_end_datum.to_s}\" }\n abschnitt_umschlag_list.concat(mit_end_datum.sort_by{|element| element.end_datum} )\n ohne_end_datum = start_liste.select{|element| element.end_datum.nil? }\n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Ohne Ende: #{ohne_end_datum.to_s}\" }\n abschnitt_umschlag_list.concat(ohne_end_datum)\n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Liste bei Date #{abschnitt_umschlag_list.to_s}\" }\n abschnitt_umschlag_list\n end", "def sort_entries=(_arg0); end", "def puppetsort(hash)\n # TODO(sissel): Implement sorting that follows the puppet style guide\n # Such as, 'ensure' goes first, etc.\n return hash.to_a\n end", "def bigSorting(unsorted)\n\nend", "def selection_sort(tabla_hash)\n ordenados = tabla_hash.to_a \n for i in 0..TAMANO-2\n max = i\n for j in i+1..TAMANO-1\n if (ordenados[j])[1] > (ordenados[max])[1]\n max = j\n end\n if (ordenados[i])[1] < (ordenados[max])[1]\n aux = ordenados[i]\n ordenados[i] = ordenados[max]\n ordenados[max] = aux\n end\n end\n end\n return ordenados\n end", "def tie_breaking_sort\n { \"content_id\" => { order: \"asc\" } }\n end", "def sort_hash(hash)\n hash.to_a.sort_by { |a, b| a.to_s }\n end", "def __sort_pair__\n { first => Mongoid::Criteria::Translator.to_direction(last) }\n end", "def sorted_keys; end", "def items\n @hashes.to_a.sort {|(_, a), (_, b)| a[:stamp] <=> b[:stamp] }\n end", "def sort\r\n @roster.each do |key, value|\r\n value.sort!\r\n end\r\n end", "def sort\n self.roster.reduce({}) do |roster, (key,value)|\n roster[key] = value.sort\n roster\n end\n end", "def sort\n self.location_hash = location_hash.sort_by { |hsh| hsh[\"user_id\"] }\n self\n end", "def sort!(hash)\n hash.replace(sort(hash))\n end", "def stable_sort_by(list); end", "def sort(key, **options); end", "def sort_all\n\t\t\t\tr=::Hash[self.sort]\n\t\t\t\tr.each do |k,v|\n\t\t\t\t\tr[k]=v.sort\n\t\t\t\tend\n\t\t\t\treturn r\n\t\t\tend", "def sort\n\t@events = @events.sort_by { | e | e.time_from_start }\n\trecalc_delta_from_times()\n end", "def sort!\n @list = Hash[@list.sort_by {|partition_name, partition| partition}]\n self\n end", "def my_hash_sorting_method(source)\n p source.sort_by { |key, value| value }\nend", "def sort_pubkeys(pubkeys)\n pubkeys.map{|p| hex_string?(p) ? p : p.unpack1('H*')}.sort\n end", "def my_hash_sorting_method(source)\n source.sort {|k,v| k[1]<=>v[1]}\nend", "def apply_sorting(chain)\n chain\n end", "def sort!\n sort_if_needed\n self\n end", "def sort\[email protected] do |key,value|\n value.sort!\nend \nend", "def sort()\n\t\t@events = @events.sort do |a,b| a[0] <=> b[0] end\n\tend", "def sort_params; end", "def sort_params; end", "def sort_data\n store.sort_data!\n end", "def sort\n @key_users.values.sort { |a, b| a.qnkeys <=> b.qnkeys }\n end", "def fixed_keys_sort(hash)\n hash.keys.sort_by(&:to_s)\n end", "def list\n to_hash.keys.sort\n end", "def sort!(&block)\n return txactions.sort!(&block)\n end", "def perform\n kahn_sorting if @sorted_list.empty?\n\n @sorted_list\n end", "def trie_par_ordre_alphabetique(journaliste)\n \tputs \"Trie par ordre alphabétique\"\n \tputs journaliste.sort\n \tputs\" \"\n \nend", "def sort\n return @sort\n end", "def sort_by!(hash, &block)\n hash.replace(sort_by(hash, &block))\n end", "def sort_pokemon_shop(symbol_of_shop)\n @pokemon_shop_list[symbol_of_shop].sort_by! { |hash| [hash[:id], hash[:form].to_i] }\n end", "def try_sort\n # Sort the table if the first element next_start_time has changed\n if false && @next_start_time != @sprinkles[0].next_start_time\n @sprinkles.sort_by! {|s| s.next_start_time}\n @next_start_time = @sprinkles[0].next_start_time\n end\n end", "def hkey(h)\n h.sort_by{|x| x[0].to_s}\n end", "def sort\n self[:sort]\n end", "def sort_params=(_arg0); end", "def sort_params=(_arg0); end", "def sorted_contents\r\n @contents.keys.sort\r\n end", "def sort_times\n @links.each_value { |l| l.sort_times }\n end", "def sort(&block)\n self.map{|*val| val.__svalue}.sort(&block)\n end", "def sort_z\n @__elementtable.sort! do |a, b|\n s = a.z <=> b.z\n next(a.__index__ <=> b.__index__) if s == 0\n next(s)\n end\n reload_stack\n end", "def sort(opts = {})\n return [] if not distkey\n \n opts[:by] = sortables[opts[:by]] if opts[:by]\n\n if opts[:start] && opts[:limit]\n opts[:limit] = [opts[:start], opts[:limit]]\n end\n\n objects(distkey.sort(opts))\n end", "def sort\n @pokers.sort.reverse\n end", "def sort_order\n super\n end", "def sort(key, by: T.unsafe(nil), limit: T.unsafe(nil), get: T.unsafe(nil), order: T.unsafe(nil), store: T.unsafe(nil)); end", "def sort_my_list\n @tracks.clear\n @artists.clear\n @genres.clear\n @user_list.each do |item|\n @tracks << item['id'] if item['type'] == 'track'\n @artists << item['id'] if item['type'] == 'artist'\n @genres << item['name'].downcase if item['type'] == 'genre'\n end\n end", "def sort_by_site_range!\n @list = Hash[@list.sort_by {|partition_name, partition| partition.sites}]\n self\n end", "def test_sort_school_also_sorts_keys\n school.add(\"Jennifer\", 4)\n school.add(\"Kareem\", 6)\n school.add(\"Kyle\", 3)\n assert_equal [3, 4, 6], school.sort.keys\n end", "def sort\n _in_order(@root, @@id_fun) # use Id function\n end", "def sort_email_address\n \"-#{self.email_address}\"\n end", "def e5115_sublinear_sort(values)\n end", "def ph(hash)\n hash.sort { |a, b| a[1]<=>b[1]}.each { |a| puts \"#{a[0]} : #{a[1]}\"}\nend", "def sort_genes\n \[email protected]!{|x,y| x.start <=> y.start}\n end", "def test_sort\n\n a_plus = Grade.new(\"A+\")\n a = Grade.new(\"A\")\n b_minus = Grade.new(\"B-\")\n\n ordered = [a_plus,b_minus, a].sort # should return [a, a_plus]\n\n assert(ordered[0] == b_minus)\n assert(ordered[1] == a)\n assert(ordered[2] == a_plus)\n\n end", "def sort \n n_hash = {}\n roster.each do |x, y| \n n_hash[x] = y.sort \n end \n n_hash\n end", "def order!(hash, method = @order)\n if method == :last\n sequence = [:role, :last, :first, :middle, :suffix]\n else\n sequence = [:role, :first, :middle, :last, :suffix]\n end\n\n ordered = Scholar::Utilities.order!(hash, sequence)\n end", "def sort_by(&block)\n super(&block).extend(OperationList)\n end", "def my_hash_sorting_method(source)\n source.sort_by { |name, age| age }\nend", "def my_hash_sorting_method(source)\n source.sort_by {|name, age| age}\nend", "def sortFloorList\n if @direction == 'up'\n @floorRequestList.sort!\n elsif @direction == 'down'\n @floorRequestList.sort!.reverse\n end\n end", "def sort_order\n 0\n end", "def my_hash_sorting_method(source)\n source.sort_by { |pet, age| age }\nend", "def sort_by_sites!\n @list = Hash[@list.sort_by {|partition_name, partition| partition.sites.size}]\n self\n end", "def test_0280_sort\n @@log.debug \"test_0280_sort starts\" if @@log.debug?\n assert_respond_to(@list, :sort, \"test_0280_sort_respond\")\n # Basic sort. Assumes all objects implement <=>.\n ta = @list.sort\n assert_equal([@bsb, @cab, @dad, @aen], ta, \"test_0280_sort_basic\")\n # Sort with block\n ta = @list.sort {|a,b| a.first <=> b.first}\n assert_equal([@aen, @bsb, @cab, @dad], ta, \"test_0280_sort_block\")\n @@log.debug \"test_0280_sort ends\" if @@log.debug?\n end", "def sort_params(params)\n Hash[params.sort]\n end", "def test_sorting\n # Make sure declarations with no length sort first.\n host_exact = Declaration.new(:allow, \"host.com\")\n host_range = Declaration.new(:allow, \"*.host.com\")\n\n ip_exact = Declaration.new(:allow, \"192.168.0.1\")\n ip_range = Declaration.new(:allow, \"192.168.0.*\")\n\n\n assert_equal(\n -1, host_exact <=> host_range,\n\n \"exact name match did not sort first\")\n\n\n assert_equal(\n -1, ip_exact <=> ip_range,\n\n \"exact ip match did not sort first\")\n\n # Next make sure we sort by length\n ip_long = Declaration.new(:allow, \"192.168.*\")\n assert_equal(-1, ip_range <=> ip_long, \"/16 sorted before /24 in ip\")\n\n # Now try it using masks\n ip24 = Declaration.new(:allow, \"192.168.0.0/24\")\n ip16 = Declaration.new(:allow, \"192.168.0.0/16\")\n\n assert_equal(-1, ip24 <=> ip16, \"/16 sorted before /24 in ip with masks\")\n\n # Make sure ip checks sort before host checks\n assert_equal(-1, ip_exact <=> host_exact, \"IP exact did not sort before host exact\")\n\n\n assert_equal(\n -1, ip_range <=> host_range,\n\n \"IP range did not sort before host range\")\n\n host_long = Declaration.new(:allow, \"*.domain.host.com\")\n\n assert_equal(-1, host_long <=> host_range, \"did not sort by domain length\")\n\n # Now make sure denies sort before allows, for equivalent\n # declarations.\n host_deny = Declaration.new(:deny, \"host.com\")\n assert_equal(-1, host_deny <=> host_exact, \"deny did not sort before allow when exact\")\n\n host_range_deny = Declaration.new(:deny, \"*.host.com\")\n assert_equal(-1, host_range_deny <=> host_range, \"deny did not sort before allow when ranged\")\n\n ip_allow = Declaration.new(:allow, \"192.168.0.0/16\")\n ip_deny = Declaration.new(:deny, \"192.168.0.0/16\")\n\n\n assert_equal(\n -1, ip_deny <=> ip_allow,\n\n \"deny did not sort before allow in ip range\")\n\n %w{host.com *.domain.com 192.168.0.1 192.168.0.1/24}.each do |decl|\n assert_equal(0, Declaration.new(:allow, decl) <=>\n Declaration.new(:allow, decl),\n \"Equivalent declarations for #{decl} were considered different\"\n )\n end\n end", "def sort_snps\n @snps.sort!{|x,y| x.location <=> y.location}\n end", "def sort_hash(hash)\n puts hash.keys.map(&:to_s).sort_by(&:length)\n end", "def ordena_infos_por_longitude\n puts \"Ordenando informações...\"\n @lista_locais.sort! { |a, b| a.longitude <=> b.longitude }\nend", "def ordena_infos_por_longitude\n puts \"Ordenando informações...\"\n @lista_locais.sort! { |a, b| a.longitude <=> b.longitude }\nend", "def sort_name\n sort_constituent\n end", "def sort_by_algo(state_list)\n state_list.sort_by(&:algie_check)\n end", "def sort!\n unless sorted?\n @sources = topsort\n insert_extensions!\n insert_replacements!\n @sources.uniq!\n @sorted = true\n end\n self\n end", "def sort(block)\n @content.sort(block)\n end", "def getSortListFrom dict\n dict.to_a.sort {|x, y| x[1]<=>y[1]}\nend", "def sort_names_old(array_units)\n list = []\n hash = {}\n data = []\n array_units.each do |a|\n hash[a[0]] = a[1]\n list << a[0]\n end\n list.sort!{|x, y| /\\d+/.match(x).to_s.to_i <=> /\\d+/.match(y).to_s.to_i} #need to fix if have \"10a10\", \"2A1\"\n p list\n list.each do |name|\n data << [name, hash[name]]\n end\n p data\n return data\n end", "def sorted_snapshot_list()\n snapshot_list().sort{|a,b| b.time <=> a.time }\n end", "def sort_ranking\n @sorted_hash = @hash_ranking.sort_by { |_name, points| -points }\n @sorted_hash = @sorted_hash.first(10)\n @sorted_hash.map { |k, v| \"#{k}\\t#{v}\" }.join(\"\\n\")\n end", "def sortItems()\n @usableItems = (@usableItems ||= []).sort_by { |x| x.to_s }\n end", "def sorted_results\n results.sort\n end", "def sorted_data &block\n @data.to_a.sort(&block)\n end", "def topsort(start = nil, &block)\n result = []\n go = true\n back = Proc.new { |e| go = false }\n push = Proc.new { |v| result.unshift(v) if go }\n start ||= vertices[0]\n dfs({ :exit_vertex => push, :back_edge => back, :start => start })\n result.each { |v| block.call(v) } if block\n result\n end", "def ja_sort\n [{ :created_at => :desc }]\n end", "def patched_bogo_sort!\n return self if empty?\n\n bogo_private\n end", "def sort_by_numbers(unsorted_list, sorted_digits, options={})\n\n unsorted_map = unsorted_list.inject({}) {|map, v| map[v.number] = v; map }\n\n # First sort the list in the order of the sorted digits\n # leaving nils for empty spaces\n sorted_list = if sorted_digits.length > 1\n sorted = [nil] * sorted_digits.length\n sorted_digits.each_with_index{|n, idx|\n sorted[idx] = unsorted_map[n]\n unsorted_map[n] = :used unless options[:keep_duplicates]\n }\n \n sorted.delete_if{|x| x == :used } unless options[:keep_duplicates]\n sorted\n else\n unsorted_list.any? ? unsorted_list.dup : [nil]\n end\n sorted_list\n end", "def sorted_ip(hosts_hash)\n hosts_hash.keys.sort_by { |ip|\n a,b,c,d = ip.split('.');\n [a.to_i, b.to_i, c.to_i, d.to_i]\n }\nend", "def test_s31_Check_sort_buffer_use\n W('s31a');\n\n p1 = Metakit::IntProp.new(\"p1\");\n Metakit::Storage.open(\"s31a\", 1) {|s1|\n s1.set_structure(\"a[p1:I]\");\n v1 = s1.view(\"a\");\n v1.add(p1[3]);\n v1.add(p1[1]);\n v1.add(p1[2]);\n s1.commit();\n\n v2 = v1.sort_on(p1);\n assert_equal 3, v2.get_size\n assert_equal 1, p1.get(v2[0])\n assert_equal 2, p1.get(v2[1])\n assert_equal 3, p1.get(v2[2])\n }\n\n #D(s31a);\n R('s31a');\n end", "def sort_input(input, property, order); end", "def sort\n @sort ||= Vidibus::Words.sort_by_occurrence(list)\n end", "def sort!\n\t\tquick!(self, 1, length)\n\tend", "def sort_and_print(hash, type=\"visits\")\n new_hash = hash.sort_by { |page, visits| -visits}.to_h\n # Print into console to check\n new_hash.each do |page, number_of_visits|\n print page + \" \" + number_of_visits.to_s + \" \" + type + \" \"\n end\n # Return sorted hash\n return new_hash\nend", "def starthexsortkey(value)\n merge(cmstarthexsortkey: value.to_s)\n end" ]
[ "0.6825506", "0.6770284", "0.6577108", "0.6315837", "0.6312216", "0.61442226", "0.6119186", "0.610977", "0.60954654", "0.60612357", "0.60432863", "0.6029642", "0.60282475", "0.6026845", "0.6002718", "0.596766", "0.5964441", "0.5929854", "0.5928069", "0.5918229", "0.59152645", "0.5911107", "0.5882022", "0.58364916", "0.58279437", "0.5815968", "0.5815135", "0.57985187", "0.5794194", "0.5794194", "0.57826567", "0.5773271", "0.57705474", "0.57258946", "0.5723499", "0.5702509", "0.568965", "0.5655193", "0.5653668", "0.5649575", "0.56476516", "0.56474066", "0.56471187", "0.5644417", "0.5644417", "0.56263566", "0.5621583", "0.5617731", "0.56134313", "0.560578", "0.5605287", "0.56003475", "0.559451", "0.5566518", "0.5564057", "0.5562577", "0.555388", "0.5547838", "0.5541637", "0.5538324", "0.5538034", "0.5535606", "0.5531034", "0.55190825", "0.5517794", "0.55156356", "0.5512442", "0.5498595", "0.54917836", "0.54910326", "0.54848546", "0.54792196", "0.54737705", "0.5470439", "0.5457546", "0.5450582", "0.5445716", "0.5445716", "0.5441921", "0.5440546", "0.541951", "0.5419243", "0.541378", "0.54135936", "0.54114324", "0.5405592", "0.54013735", "0.54012454", "0.53963834", "0.53914607", "0.53888804", "0.53844315", "0.5364695", "0.53585684", "0.5358198", "0.53568774", "0.5342617", "0.5340516", "0.5339589", "0.53362054" ]
0.6884483
0
Ermittelt den Ort aus dem uebergebenen Array, der kein EndOrt eines Transportabschnitts ist (also der Start der Eingabe)
def abschnitt_only_start_ort orte orte.each do |ort_id| if !ort_id==0 && self.transportabschnitte.where(end_ort_id: ort_id).empty? return ort end end nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_known_orte\n orte = []\n check_ort_ll(orte, start_anlage.ort)\n check_ort_ll(orte, ziel_anlage.ort)\n transportabschnitte.each do |abschnitt|\n abschnitt.orte.each do |ort|\n check_ort_ll(orte, ort)\n end\n end\n umschlaege.each do |umschlag|\n check_ort_ll(orte, umschlag.ort)\n end\n orte\n end", "def get_known_orte_with_props\n orte = {}\n strecken = []\n # Transportabschnitte inklusive Beobachtungsorte und Strecke der Route\n transportabschnitte.each do |abschnitt|\n if abschnitt.route && abschnitt.route.name != \"Unbekannt\"\n strecken.concat(abschnitt.route.get_strecken)\n else\n if abschnitt.start_ort && abschnitt.end_ort && abschnitt.start_ort.lat && abschnitt.end_ort.lat\n strecken << [abschnitt.start_ort, abschnitt.end_ort] \n end\n end\n check_ort_p(orte, abschnitt.start_ort, \"Abschnitt\")\n check_ort_p(orte, abschnitt.end_ort, \"Abschnitt\")\n abschnitt.beobachtungen.each do |beob|\n check_ort_p(orte, beob.ort, \"Beobachtung\")\n end\n end\n # Umschlaege\n umschlaege.each do |umschlag|\n check_ort_p(orte, umschlag.ort, \"Umschlag\")\n end\n # Start und Zielanlage zuletzt, damit auf jeden Fall das aktuellste, andere werden ggf. ueberschrieben\n check_ort_p(orte, start_anlage.ort, \"Start-Anlage\")\n check_ort_p(orte, ziel_anlage.ort, \"Ziel-Anlage\")\n if strecken.empty? \n if umschlaege.empty? && start_anlage.ort && ziel_anlage.ort && start_anlage.ort.lat && ziel_anlage.ort.lat\n strecken << [start_anlage.ort, ziel_anlage.ort] \n elsif start_anlage.ort && start_anlage.ort.lat\n ort_aktuell = start_anlage.ort\n umschlaege.each do |umschlag|\n if umschlag.ort\n strecken << [ort_aktuell, umschlag.ort]\n ort_aktuell = umschlag.ort\n end\n end\n if ziel_anlage.ort && ziel_anlage.ort.lat\n strecken << [ort_aktuell, ziel_anlage.ort]\n end\n end\n end\n return orte, strecken\n end", "def array_start\n []\n end", "def end_vertices(e)\n\t\ttemp_array = []\n\t\tfor i in 0..num_edges-1\n\t\t\tif @Edges[i].label==e.label\n\t\t\t\ttmp2 = @Edges[i].points\n\t\t\tend\n\t\tend\n\t\ttemp_array << @Vertices[@Hash[tmp2[0]]]\n\t\ttemp_array << @Vertices[@Hash[tmp2[1]]]\n\t\treturn temp_array\n\tend", "def airports_out_of_region\n return Array.new\n end", "def tail\n \t@array[-1]\n end", "def ends\n ends = []\n vertices.each { |x| ends << x if x.neighbors.empty? }\n ends\n end", "def transmissions; end", "def transmissions; end", "def position_array_personne_epenser(journaliste)\n \tputs \"Reponse :\"\n \tputs \"@epenser est sur la ligne #{journaliste.index(\"@epenser\")}\"\n \tputs\nend", "def get_times_array(padding = true)\n @times = (padding) ? [@start_dt - 1.hour] : [@start_dt]\n \n # and including every 1/2 hour until one hour after the selected end time\n while true do\n tmp = @times.last + 30.minutes\n (padding) ? (tmp == (@end_dt + 1.hour)) ? break : '' : (tmp == @end_dt) ? break : ''\n @times.push(tmp)\n end\n end", "def multi_end2(ttls)\n rpls = ''\n ttl = @tg_end.size-1\n ttl = ttls-1 if ttls\n ttl.downto(0) do |i|\n sz = @tg_end[i][/^ +/].to_s.size\n if ttls || @spc.size <= sz\n send = @tg_end.pop\n if send.strip[0,5]==\"!run!\"\n scrpt = send.gsub(\"\\n\",\"\\n#{@spc}\").split(\"\\n\")\n @doc_src = scrpt[1,99]+@doc_src\n else\n spc = send[/(^[ \\t]*)/,1].to_s\n rpls << (send.gsub(\"\\n\",\"\\n#{spc}\") + \"\\n\") \n end\n end\n end\n p \"End2 : #{rpls}\" if @dbg[:parse] && rpls!= ''\n rpls\n end", "def open_ended_polyline(arr)\n 0.upto(arr.length - 2) { |i|\n @draw.line(arr[i][0], arr[i][1], arr[i+1][0], arr[i+1][1])\n }\n end", "def getTripString(line, startStop, endStop) \n lineArray = getLine(line)\n string = \"\" # to save the station \n start_point = lineArray.index(startStop) # save the index of start point\n end_point = lineArray.index(endStop) # save the index of end point\n # p start_point \n # p end_point\n if start_point > end_point\n start_point.downto(end_point) do |j| \n string += \"#{lineArray[j]}, \"\n end\n else\n start_point.upto(end_point) do |j|\n string += \"#{lineArray[j]}, \"\n end \n end \n return string[0...-2] \nend", "def arrivals_for(stops)\n return [] if stops.nil? or stops.empty?\n query = {\n :locIDs => [stops].flatten.map { |s| s.is_a?(Stop) ? s.locid : s }.join(','),\n :appID => @app_id\n }\n xml = get_xml(([\"http://developer.trimet.org/ws/V1/arrivals\"] + query.to_a).join(\"/\"))\n\n if xml[\"errorMessage\"]\n raise xml[\"errorMessage\"].join(\"\\n\")\n end\n\n arrivals = xml[\"arrival\"].map do |a|\n stop = Stop.first(:locid => a[\"locid\"])\n line = Line.first(:route => a[\"route\"])\n dir = Direction.first(:dir => a[\"dir\"], :line_id => line.id)\n Arrival.new(:stop => stop,\n :direction => dir,\n :line => dir.line,\n :block => a[\"block\"],\n :departed => (a[\"departed\"] == \"true\"),\n :estimated => to_time(a[\"estimated\"]),\n :full_sign => a[\"fullSign\"],\n :piece => a[\"piece\"],\n :scheduled => to_time(a[\"scheduled\"]),\n :short_sign => a[\"shortSign\"],\n :status => a[\"status\"],\n :detour => (a[\"detour\"] == \"true\"))\n end\n end", "def add_stop_to_end(stops_array, new_stop)\n result = stops_array.push(new_stop)\n return result\nend", "def last_item(elective_array)\n return elective_array[-1]\nend", "def getArrayIndexes(current_trips)\n stop_index_array = []\n user_stop_index = 0\n trip_stops_array = JSON.parse(File.read(TRIP_STOPS))\n\n for trip in trip_stops_array\n for current_trip in current_trips\n # puts \"current_trip: #{current_trip} / trip[0]: #{trip[0]}\"\n if current_trip[trip[0]] != nil\n puts \"current_trip[trip[0]] is #{current_trip[trip[0]]}\"\n stops_array = trip[1]\n if stops_array.include?(@user_stop_id)\n puts \"#{trip} comes to user\"\n user_stop_index = stops_array.index(@user_stop_id)\n for stop in stops_array\n if stop == current_trip[trip[0]]\n stop_index_array << stops_array.index(current_trip[trip[0]])\n end\n end\n end\n end\n end\n end\n\n if stop_index_array.count == 0\n puts \"there are no buses at this time\"\n else\n return calculate(user_stop_index, stop_index_array)\n end\n\n end", "def singleTrip (start_station, end_station, line)\n start_index = MTA[line].index(start_station)\n end_index = MTA[line].index(end_station)\n\n if start_index < end_index\n stops = MTA[line][start_index ... end_index]\n num_stops = end_index - start_index\n end\n\n if end_index < start_index\n stops = MTA[line][end_index ... start_index]\n stops = stops.reverse\n num_stops = start_index - end_index\n\n end\n print = \"You must travel through the following stops on the #{line}: #{stops}\"\n # print = \"#{num_stops} in total\"\nend", "def print_stops(array)\n for station in array\n puts station\n end\nend", "def overlay\n connections.map.with_index do |cn, i|\n next if i.zero?\n [cn.departure_in_utc, connections[i - 1].arrival_in_utc].inject(:-)\n end.compact\n end", "def stations_in_between2 (end_lane)\n if ($end_connection>$end)\n puts \"then the stations to follow are:\"\n puts $mta[end_lane][$end+1...$end_connection]\n else\n puts \"then the stations to follow are:\"\n puts $mta[end_lane][$end_connection+1...$end].reverse\n end #end of the if\n end", "def airports_normal\n return Array.new\n end", "def ear_positions\n ear_message = new_message\n ear_message.ears = 'ok'\n response = ear_message.send\n return [response.left_ear, response.right_ear]\n end", "def get_product_service_kpi_from_to(product_service_map,time,time_list)\n @pro_normalPv_list = Array.new\n @pro_delayPv_list = Array.new\n size = time.size\n 0.upto(size-1) do |i|\n new_p,new_s = new_and_old_service(time[i]) \n product_service_map = concat_pro_ser(product_service_map,new_p,new_s)\n pro_kpi,pro_pv,pro_normalPv,pro_delayPv = get_kpi_by_collection_name(@db,\"count_kpi\",product_service_map,time_list[i],time_list[i+1])\n @pro_normalPv_list.push(pro_normalPv)\n @pro_delayPv_list.push(pro_delayPv)\n end\n pro_size = @pro_normalPv_list.size\n @pro_pv = 0\n @pro_delayPv = 0\n 0.upto(pro_size-1) {|i|@pro_pv += @pro_normalPv_list[i]+@pro_delayPv_list[i]; @pro_delayPv+=@pro_delayPv_list[i]} \n @pro_kpi = (@pro_pv-@pro_delayPv)/(@pro_pv*1.0)*100\n last = time_list.size-1\n @ser_kpi,@ser_pv,@ser_normalPv,@ser_delayPv = get_kpi_by_collection_name(@db,\"search_kpi\",nil,time_list[0],time_list[last])\n @pro_avi,@pro_yes_num,@pro_no_num = get_availability_by_collection_name(@db,\"count_usable\",time_list[0],time_list[last])\n @ser_avi,@ser_yes_num,@ser_no_num = get_availability_by_collection_name(@db,\"search_usable\",time_list[0],time_list[last])\n puts \"Starttime: #{time_list[0]}\\t Endtime: #{time_list[last]}\\t timegap: #{time_list.size-1} \"\n print nil\n end", "def crear_rangos_entradas(horas, dia)\n horas.inject([]){|arr, v|\n arr << ( Time.zone.parse(\"#{dia} #{v[0]}\" )..Time.zone.parse(\"#{dia} #{v[1]}\") )\n arr\n }\n end", "def exclude_ends (array)\n array[1..-2]\nend", "def end\n j_instance.getEnd\n end", "def get_taskarray\n @task_array\n end", "def fetchStopPositions\n\t\tfetchUri(\"http://api.wmata.com/Bus.svc/json/JStops?&api_key=#{@@apiKey}\")\n\tend", "def print_stations_en_route\n\n start_station_sym = @start_station.gsub(\" \", \"_\").to_sym\n\n end_station_sym = @end_station.gsub(\" \", \"_\").to_sym\n\n start_line_sym = @start_line.to_sym\n\n end_line_sym = @end_line.to_sym\n \n if start_line_sym == :victoria\n start_line_sym_index = 0\n elsif start_line_sym == :bakerloo\n start_line_sym_index = 0\n elsif start_line_sym == :central\n start_line_sym_index = 0\n end\n\n stations_on_start_line = Tube.new.lines.values_at(start_line_sym)\n stations_on_end_line = Tube.new.lines.values_at(end_line_sym)\n \n stations_start = stations_on_start_line[start_line_sym_index]\n\n start_index = stations_start.find_index(start_station_sym) \n\n if start_line_sym != end_line_sym\n\n intersection = (stations_on_start_line[0] & stations_on_end_line[0])[0] \n\n start_int_index = stations_on_start_line[0].index(intersection)\n stops_between = (start_index.to_i - start_int_index.to_i).abs \n\n end_index = stations_on_end_line[0].find_index(end_station_sym)\n\n end_int_index = stations_on_end_line[0].index(intersection)\n between = (end_index.to_i - end_int_index.to_i).abs\n\n stations_on_first = stations_on_start_line[0][start_index, (start_int_index - 1)]\n stations_on_second = stations_on_end_line[0][end_int_index, (end_index + 1)]\n\n number_of_stops = (end_index - start_index).abs\n\n puts \"\\nThere are #{number_of_stops} stations till your final destination\"\n\n stations_en_route = stations_on_first + stations_on_second\n \n print_stations_en_route = stations_en_route.join(\", \").gsub(\"_\", \" \").split.map(&:capitalize).join(\" \")\n\n puts \"\\nThe stations en route are #{print_stations_en_route}\"\n\n else\n\n end_index = stations_start.find_index(end_station_sym)\n\n number_of_stops = ((end_index.to_i - start_index.to_i).abs + 1)\n\n puts \"\\nThere are #{number_of_stops} stations till your final destination\"\n #Use indexes to print stations between and including\n #\n stations_en_route = stations_start.slice(start_index..end_index)\n #Generate list and make print print ready\n #\n print_stations_en_route = stations_en_route.join(\", \").gsub(\"_\", \" \").split.map(&:capitalize).join(\" \")\n\n puts \"\\nThe stations en route are #{print_stations_en_route}\"\n\n end\n end", "def read_end_stops()\n @ramps_arduino.execute_command('F81', false, @status_debug_msg)\n end", "def stop\n [ @start_time, (@stop_time = @stop_time.nil? ? Time.now : @stop_time) ]\n end", "def edge_array\n\t\t\t to_return = @responses.collect { |item| item.sollutions }\n\t\t\t return to_return\n\t\tend", "def return_arr_txts\r\n IO.write(\"./DEBUG\", \"docclass=\"[email protected]_s+\" andinfoclass= \"+@@info_past.class.to_s+\"=\"+@@info_past.to_s)\r\n @doc = @@info_past[1]\r\n if @doc[\"doc\"].empty?\r\n return [\"0\"]\r\n else\r\n return @doc[\"doc\"] #retorna os nomes dentro de um Array\r\n end\r\n end", "def using_last(array)\n last_element=array.last\nend", "def rotor_array\n @rotor_array\n end", "def plan_trip (first_s, last_s)\n stations = []\n beginning = $lineN.index(first_s.to_s)\n ending = $lineN.index(last_s.to_s)\n this_many = beginning + ending\n stations = $lineN[beginning, this_many]\n return stations\nend", "def parse_array(array)\n # TODO: make this parsing more eleganter. Measuring for 2 isn't the best way to check for goodness of the input\n good = array.length == 2 ? get_stations(array) : directions(\"Invalid arrival and destination.\")\n end", "def last\n @rarray.reverse.first \n end", "def -(arr)\n raise 'Not Implemented'\n end", "def second_trip(l2, s2)\n ## find index of stop s2 on line l2\n index_s2 = $lines[l2].index(s2)\n ## find index of Union Square Staion on line l2\n index_of_USquare = $lines[l2].index('Union Square')\n\n trip2 = []\n\n if index_s2 > index_of_USquare\n trip2 = $lines[l2][index_of_USquare..index_s2].drop(1) # drop(1) to exclude Union Square station from the list\n else\n trip2 = $lines[l2][index_s2..index_of_USquare].reverse.drop(1) # drop(1) to exclude Union Square station from the list\n end\n\n\n puts \">>> Your journey continues through the following stops on the #{l2} line: #{trip2.join(', ')}.\"\n\n trip2\nend", "def using_last(array)\narray.last\nend", "def array\n raise \"Not implemented\"\n end", "def get_ants\n puts \"ANT FARM!\"\n ants = Array.new #ants could probably just be an array of hashes, since we don't yet need a full object...\n \n #make 100 ants\n num_ants = 100\n (0...num_ants).each do |i|\n ant = Ant.new(i)\n ants.push(ant)\n end\n \n edges_to_check = Set.new\n edges_by_node = @nodes.merge(@nodes) {|k| []}\n @edges.each do |e_id, edge|\n edges_to_check.add(e_id)\n edges_by_node[edge.a.id].push(e_id)\n edges_by_node[edge.b.id].push(e_id)\n end\n\n journeys = [[START]] #last item of journey array is the current island\n journeys.each do |path| #go through each journey on the path \n island = path[-1] #the last item is where we're moving from\n #grab all the edges connected to that path that are new or involve new terminals\n new_edge_ids = edges_by_node[island]\n new_edge_ids.each do |e_id|\n if edges_to_check.include?(e_id) #if new path to take\n new_path = path[0...-1] + [e_id, (@edges[e_id].a.id == island ? @edges[e_id].b.id : @edges[e_id].a.id)]\n # puts \"new path\",new_path.to_s\n journeys.push(new_path)\n edges_to_check.delete(e_id)\n end\n end\n end\n\n \n #check validity, and mark bad paths by maing them negative\n journeys.each do |path|\n path.slice!(-1) #remove the island from the path\n path.each_with_index do |e_id,i|\n if @validity[e_id] < 0 #if is not valid\n path[i] *= -1\n #path.slice!(i..-1) #remove the rest of the path, since we won't need it?\n end\n end\n end\n\n puts 'journeys: '+journeys.to_s, 'number of journeys: '+journeys.length.to_s \n\n #divide the journeys among the ants\n ants.each_with_index {|ant,i| ant.plan = journeys[(i+1)%journeys.length]}\n \n #puts \"ants we made\", ants\n return ants\n end", "def set_end(t)\n @end_t = t\n end", "def exclude_ends(arr)\n arr[1..-2]\nend", "def now_serving(katz_deli)\n if katz_deli.empty?\n puts \"There is nobody waiting to be served!\"\n else\n puts \"Currently serving #{katz_deli[0]}.\"\n katz_deli.shift\n # shift to removes the first element of the nextinline array and returns it (shifting all other elements down by one). Returns nil if the array is empty.\n end\nend", "def initialize\n \n @waypoint = Array.new\n \n end", "def remove_from_end(arr)\n arr.pop\nend", "def time_travel_offsets\n @time_travel_offsets ||= []\n end", "def eac_top_line\n eac = estimate_at_completion_cost\n eac_top_line = [[start_date, eac],[end_date_for_top_line, eac]]\n end", "def verTodasVentas()\n totalVentas=0\n for i in(0..$ventas.size-1)\n for j in(0..$ventas[i].size-1)\n end\n totalVentas=totalVentas\n end\n puts \"Total Vendido: #{totalVentas}\"\n end", "def end; self.begin + self.size - 1; end", "def temp_final\n\t\ti = 0\n\t\tn = 0\n\t\tt = @t_simulacao - 2\n\t\tputs t\n\t\t@vet_temp[n+1][i]=@vet_temp[n][i]\n\t\tfor n in 0..t\n\t\t\t#puts n\n\t\t\tfor i in 1..(@n_nos)\n\t\t\t\tif (i< (@n_nos_molde - 1 ) || i > (@n_nos_molde)) && i < @n_nos #calculo da temperatua para posição 2 até a interface e depois da interface ate o penultimo no\n\t\t\t\t\tif i <= @n_nos_molde #calculo da temperatura para estado solido MOLDE\n\t\t\t\t\t\t@vet_temp[n+1][i] = calcula_temp(n,i,-1,'s') + calcula_temp(n,i,0,'s') + calcula_temp(n,i,1,'s')\n\t\t\t\t\t\tputs \"Ciclo: \" + (n+1).to_s + \" Nos: \" + i.to_s + \" Temperatura : \" + @vet_temp[n+1][i].to_s\t\t\t\t\t\n\t\t\t\t\telsif i > @n_nos_molde # calculo da temperatura para estado liquido METAL\n\t\t\t\t\t\tif @vet_temp[n][i] <= @aluminio['temperatura_solidus'] # <= 548\n\t\t\t\t\t\t\t@vet_temp[n+1][i] = calcula_temp(n,i,-1,'s') + calcula_temp(n,i,0,'s') + calcula_temp(n,i,1,'s')\n\t\t\t\t\t\t\tputs \"Ciclo: \" + (n+1).to_s + \" Nos: \" + i.to_s + \" Temperatura : \" + @vet_temp[n+1][i].to_s + \"a\"\n\t\t\t\t\t\telsif @vet_temp[n][i] >= @aluminio['temperatura_liquidus'] # >= 645\n\t\t\t\t\t\t\t@vet_temp[n+1][i] = calcula_temp(n,i,-1,'l') + calcula_temp(n,i,0,'l') + calcula_temp(n,i,1,'l')\n\t\t\t\t\t\t\tputs \"Ciclo: \" + (n+1).to_s + \" Nos: \" + i.to_s + \" Temperatura : \" + @vet_temp[n+1][i].to_s + \"b\"\n\t\n\t\t\t\t\t\telsif @vet_temp[n][i] > @aluminio['temperatura_solidus'] && @vet_temp[n][i] < @aluminio['temperatura_liquidus'] # 645 > t > 548 \n\t\t\t\t\t\t\ta = calcula_temp(n,i,-1,'p')\n\t\t\t\t\t\t\tb = calcula_temp(n,i,0,'p')\n\t\t\t\t\t\t\tc = calcula_temp(n,i,1,'p')\n\t\t\t\t\t\t\t@vet_temp[n+1][i] = calcula_temp(n,i,-1,'p') + calcula_temp(n,i,0,'p') + calcula_temp(n,i,1,'p')\n\t\t\t\t\t\t\tputs \"Ciclo: \" + (n+1).to_s + \" Nos: \" + i.to_s + \" Temperatura : \" + @vet_temp[n+1][i].to_s + \"c\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\telsif i == (@n_nos_molde - 1) # calculo da temperatura interface\n\t\t\t\t\t\t@vet_temp[n+1][i] = calcula_temp(n,i,-1,'s') + calcula_temp(n,i,0,'s') + calcula_temp(n,i,1,'s')\n\t\t\t\t\t\tputs \"Ciclo: \" + (n+1).to_s + \" Nos: \" + i.to_s + \" Temperatura ultimo no MOLDE : \" + @vet_temp[n+1][i].to_s\n\t\t\t\telsif i == @n_nos_molde # calculo da temperatura interface\n\t\t\t\t\t\t@vet_temp[n+1][i] = calcula_temp(n,i,-1,'l') + calcula_temp(n,i,0,'l') + calcula_temp(n,i,1,'l')\n\t\t\t\t\t\tputs \"Ciclo: \" + (n+1).to_s + \" Nos: \" + i.to_s + \" Temperatura primeiro no METAL : \" + @vet_temp[n+1][i].to_s\n\t\t\t\telsif i == @n_nos # calculo temperatura loptall\n\t\t\t\t\t\t@vet_temp[n+1][i] = 2 * calcula_temp(n,i,-1,'l') + calcula_temp(n,i,0,'l') \n\t\t\t\t\t\tputs \"Ciclo: \" + (n+1).to_s + \" Nos: \" + i.to_s + \" Temperatura ultimo no METAL : \" + @vet_temp[n+1][i].to_s\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def build_obstruction_array(x_end, y_end)\n y_change = y_position - y_end\n x_change = x_position - x_end\n\n # Build array squares which piece must move through\n obstruction_array = []\n if x_change.abs == 0 # If it's moving vertically\n (1..(y_change.abs-1)).each do |i|\n obstruction_array << [x_position, y_position - (y_change/y_change.abs) * i]\n end\n elsif y_change.abs == 0 # If horizontally\n (1..(x_change.abs-1)).each do |i| # 7 times do (0..6).each do\n obstruction_array << [x_position - (x_change/x_change.abs) * i, y_position]\n end\n elsif y_change.abs == x_change.abs #if diagonally\n (1..(y_change.abs-1)).each do |i|\n obstruction_array << [x_position - (x_change/x_change.abs) * i, y_position - (y_change/y_change.abs) * i]\n end\n end\n obstruction_array\n end", "def populate_final_array(old_array,final_array,dx='RX')\n old_array.each do |lines|\n lines.scan(/\\A\\s+#{dx.upcase} packets.*(overruns:[0-9]+)/).to_s.scan(/\\d+/).each do |line|\n final_array.push line\n end\n end\n end", "def initialize\n\t\t@e = []\n\tend", "def reorganizeTripDate\n @trip.update(time_start: @trip.items.order(:time_start).first.time_start) unless @items.empty?\nputs \"startDATE: #{@trip.time_start}\"\n @trip.update(time_end: (@trip.items.order(:time_end).last.time_end ||\n @trip.items.order(:time_start).last.time_start)) unless @items.empty?\nputs \"end_DATE: #{@trip.time_end}\" \n end", "def execute(&block)\n v = @v.map &block\n TimeArray.new(@start_time, v, zone: Time.zone.name)\n end", "def now_serving(array)\n if array.length > 0 \n puts \"Currently serving #{array[0]}.\" \n array.shift\n return array\n else\n puts \"There is nobody waiting to be served!\" \n end\nend", "def Array(p0) end", "def estados\n\t\tdevuelto = Array.new\n\t\t@renglones_reporte.each do |renglon|\n\t\t\tdevuelto << renglon.estado\n\t\tend\n\t\tdevuelto\n\tend", "def test_packing_array\n array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 32000]\n assert_equal array, RubyVolt::DataType::Array.testpacking(array)[1..-1]\n end", "def create_int_array\n [first.time_to_int, last.time_to_int]\n end", "def agent_transport_addresses\n [ @address ]\n end", "def get_route(start_arr, end_arr)\n root = Position.new(start_arr[0], start_arr[1])\n target = Position.new(end_arr[0], end_arr[1])\n solution = get_target_value(target, root)\n\n route = []\n route.unshift([target.x, target.y])\n location = solution.parent\n until location == nil\n route.unshift [location.x, location.y]\n location = location.parent\n end\n return route\nend", "def reset\n @time_travel_offsets = []\n end", "def to_a(resolution: :hour)\n return [] if @start.nil? && @finish.nil?\n\n if finish < start\n to_time_array(start, TimeOfDay.new(23), resolution) +\n to_time_array(TimeOfDay.new(0), finish, resolution)\n else\n to_time_array(start, finish, resolution)\n end\n end", "def send_arr label, array\n @publisher.send_string label, ZMQ::SNDMORE\n\n # Everything but the last element\n array[0..-2].each do |e|\n @publisher.send_string e.to_s, ZMQ::SNDMORE\n end\n @publisher.send_string array.last.to_s\n end", "def now_serving(array)\n \n if array == []\n puts \"There is nobody waiting to be served!\"\n \n else\n puts \"Currently serving #{array[0]}.\"\n array.shift\n \n end\n \nend", "def first_trip(l1, s1)\n ## find index of stop s1 on line l1\n index_s1 = $lines[l1].index(s1)\n ## find index of Union Square Staion on line l1\n index_of_USquare = $lines[l1].index('Union Square')\n\n trip1 = []\n\n if index_s1 <= index_of_USquare\n trip1 = $lines[l1][index_s1..index_of_USquare]\n else\n trip1 = $lines[l1][index_of_USquare..index_s1].reverse\n end\n\n puts \">>> You must travel through the following stops on the #{l1} line: #{trip1.join(', ')}.\"\n puts \">>> Change at Union Square.\"\n\n trip1\nend", "def now_serving (array)\n if array.length == 0\n puts \"There is nobody waiting to be served!\"\n else\n i = array[0]\n puts \"Currently serving #{i}.\"\n array.shift\nend\nend", "def push_donearray\n get_taskarray.each do |object|\n if object.status_done\n get_donearray.push(object)\n end\n end\n end", "def part2\n lines = data_lines(1)\n target = read_target(lines)\n\n vels = []\n (0..(target[:x].max + 1)).each do |x_velocity|\n y_bounds = target[:y].min - 1\n y_bounds = y_bounds.abs if y_bounds < 0\n (-y_bounds..y_bounds).each do |y_velocity|\n vels << [x_velocity, y_velocity] if intersects?(target, x_velocity, y_velocity)\n end\n end\n puts vels.length\n end", "def send_array(array, flags = 0)\n array = array.to_a\n array[0...-1].each { |str| send_string str, ZMQ::SNDMORE|flags }\n send_string array.last, flags\n end", "def day_trader(bigger_substraction)\n return [a,v]\nend", "def ends_at\n started_at + client.clock_delta + length if started_at\n end", "def index\n @array = [45, 6, 32, 0]\n end", "def get_foot_traffic(start_date, end_date)\n total_rc = Array.new\n while start_date.next_week < end_date\n total_rc.push get_all_redemptions(start_date, start_date.next_week)\n start_date = start_date.next_week\n end\n total_rc\n end", "def extract_startend(params)\n params[\"pio_startT\"] = ((params[\"pio_startT\"].to_r) * 1000).round(0).to_s if params[\"pio_startT\"]\n params[\"pio_endT\"] = ((params[\"pio_endT\"].to_r) * 1000).round(0).to_s if params[\"pio_endT\"]\n end", "def get_time_slot_array\n time_slot_array = [\"07:00\", \"07:30\", \"08:00\", \"08:30\", \"09:00\", \"09:30\", \"10:00\", \"10:30\",\n \"11:00\", \"11:30\", \"12:00\", \"12:30\", \"13:00\", \"13:30\", \"14:00\", \"14:30\",\n \"15:00\", \"15:30\", \"16:00\", \"16:30\", \"17:00\", \"17:30\", \"18:00\", \"18:30\",\n \"19:00\", \"19:30\", \"20:00\", \"20:30\", \"21:00\"]\n end", "def exclude_end?() end", "def reverse_stops_in_array(stops_array)\n result = stops_array.reverse()\n return result\nend", "def now_serving(array)\n if array == []\n puts \"There is nobody waiting to be served!\"\n else array != []\n puts \"Currently serving \" + array.first + \".\"\n array.shift\n array\n end\nend", "def orfs_from_start_stop_markers(start_markers, stop_markers, minimum_orf_length)\n # Split up the start and stop positions into 3 frames\n frame_starts = [[],[],[]]\n frame_stops = [[],[],[]]\n start_markers.each do |marker|\n frame_starts[marker.position_in_trail % 3].push marker\n end\n stop_markers.each do |marker|\n frame_stops[marker.position_in_trail % 3].push marker\n end\n\n # For each frame\n to_return = ORFsResult.new\n (0..2).each do |frame|\n frame_pairs = []\n\n # Sort arrays in descending order because Array#pop removes from the end of the array\n starts = frame_starts[frame].sort{|a,b| b.position_in_trail<=>a.position_in_trail}\n stops = frame_stops[frame].sort{|a,b| b.position_in_trail<=>a.position_in_trail}\n\n current_start = starts.pop\n current_stop = stops.pop\n if current_stop\n # Record first stop codon\n to_return.initial_stop_markers.push current_stop\n end\n if current_start and (current_stop.nil? or current_start.position_in_trail < current_stop.position_in_trail)\n # Record first start codon before any stop codons\n to_return.initial_start_markers.push current_start\n end\n\n while current_start and current_stop\n # Move to next start after current stop\n while current_start and current_start.position_in_trail < current_stop.position_in_trail\n current_start = starts.pop\n end\n\n if current_start\n # Move to next stop after current start\n while current_stop and current_stop.position_in_trail < current_start.position_in_trail\n current_stop = stops.pop\n end\n end\n\n if current_start and current_stop\n # This stop codon stops the current reading frame.\n if current_stop.position_in_trail - current_start.position_in_trail >= minimum_orf_length\n # Found a legit ORF\n to_return.start_stop_pairs.push [current_start, current_stop]\n end\n # Whether or not last ORF was long enough, search for the next start codon\n next\n else\n if current_start\n to_return.final_start_markers.push current_start\n end\n break\n end\n end\n end\n\n return to_return\n end", "def last_element_with_array_methods(array)\n south_east_asia = [\"Thailand\", \"Cambodia\", \"Singapore\", \"Myanmar\"]\n south_east_asia.last\n end", "def last(array)\n array[-1]\nend", "def get_path(double_array, path_cost, path_time)\n double_array.each do |path|\n correct_path = []\n cost = 0\n time = 0\n count = 0\n until count == path.size - 1\n correct_edge = @edge_array.find { |i| \n i.source == path[count] && i.destination == path[count+1] \n }\n cost += correct_edge.cost\n time += correct_edge.time\n count += 1\n end\n if cost == path_cost && time == path_time\n return path\n end\n end\n end", "def distance(array)\n orientation = 'N'\n position = [0, 0]\n\n array.each do |e|\n turn = e[0]\n distance = calc_distance(e)\n orientation = new_dir(orientation, turn)\n position = jump_to_new_position(orientation, position, distance)\n end\n\n print 'Distance to last position: '\n p dis_comb(position)\nend", "def plan_trip (first_l, first_s, last_l, last_s)\n# Get the program to work for a single line:\n# Different way to do global use $\n stations = [ ]\n start = $train_lines[first_l.to_s].index(first_s.to_s)\n finish = $train_lines[last_l.to_s].index(last_s.to_s)\n\n# 2.7.2 :012 > $train_lines.values\n# => [[\"Times Square\", \"34th\", \"28th\", \"23rd\", \"Union Square\", \"8th\"], [\"8th\", \"6th\", \"Union Square\", \"3rd\", \"1st\"], [\"Grand Central\", \"33rd\", \"28th\", \"23rd\", \"Union Square\", \"Astor Place\"]]\n# 2.7.2 :013 > $train_lines.keys\n# => [\"lineN\", \"lineL\", \"line6\"]\n\n if start < finish\n stations = $lineN[start..finish]\n elsif\n stations = $lineN[finish..start].reverse\n end\n\n return stations\n\nend", "def reverse_day(array)\n array.reverse\nend", "def using_last(array)\n array.last\nend", "def using_last(array)\n array.last\nend", "def index\n @transports = Transport.all.includes(:bus,:from,:to)\n end", "def OverlappingRanges(arr)\n\n # code goes here\n return arr \n \nend", "def now_serving(array)\n if array.size >0\n element = array.shift\n puts \"Currently serving #{element}.\"\n else\n puts \"There is nobody waiting to be served!\"\n end\n\nend", "def convert_binary_traceroutes(data, print=false)\n offset=0\n traceroutes=[]\n while not offset>=data.length\n header=data[offset,16].unpack(\"L4\")\n offset += 16\n if header.nil? or header.include?(nil) \n raise TruncatedTraceFileException.new(traceroutes), \"Error reading header\", caller\n end\n client_id=header.at(0)\n uid=header.at(1)\n num_tr=header.at(2)\n record_length=header.at(3)\n (0...num_tr).each{|traceroute_index|\n tr_header=data[offset,8].unpack(\"NL\")\n offset += 8\n if tr_header.nil? or tr_header.include?(nil)\n raise TruncatedTraceFileException.new(traceroutes), \"Error reading TR header\", caller\n end\n dst=Inet::ntoa(tr_header.at(0))\n numhops=tr_header.at(1)\n hops = []\n rtts = []\n ttls = []\n last_nonzero=-1\n (0...numhops).each{|j|\n hop_info=data[offset,12].unpack(\"NfL\")\n offset += 12\n if hop_info.nil? or hop_info.include?(nil)\n raise TruncatedTraceFileException.new(traceroutes), \"Error reading hop\", caller\n end\n ip = Inet::ntoa(hop_info.at(0))\n rtt = hop_info.at(1)\n ttl = hop_info.at(2)\n if (ttl > 512)\n raise TruncatedTraceFileException.new(traceroutes), \"TTL>512, may be corrupted\", caller\n end\n if ip!=\"0.0.0.0\"\n last_nonzero=j\n end\n hops << ip\n rtts << rtt\n ttls << ttl\n\n }\n if last_nonzero>-1\n traceroutes << [dst,hops,rtts,ttls]\n if print\n tr_s=\"#{dst} #{last_nonzero+1} #{hops[0..last_nonzero].join(\" \")}\"\n if block_given?\n yield(tr_s)\n else \n $stdout.puts \"tr_s\"\n end \n #puts \"#{ARGV[1..-1].join(\" \")} #{dst} #{last_nonzero+1} #{hops[0..last_nonzero].join(\" \")}\"\n end\n end\n\n }\n end\n return traceroutes\nend", "def total_stops(line_start, station_start, line_end, station_end)\n\t# if travelling on the same line the number of stops is the differential in array indexes\n if line_start == line_end\n \ttotal_stops = line_start.index(station_start) - line_end.index(station_end)\n\n\t# the next 3 are for when union station is a start or end point in the journey\t\n\t# if union is one of the stops then you onlyu need to calculate the number of stops to other station \t\n elsif\n \tstation_start == station_end\n \ttotal_stops = 0\n\n elsif station_start.include?(\"union\")\n \ttotal_stops = stops_from_union(station_end, line_end)\n\n elsif station_end.include?(\"union\")\n \ttotal_stops = stops_from_union(station_start, line_start)\n\n\t# when journey begins and ends on different lines you add the number of stops from union station\n else\n \ttotal_stops = stops_from_union(station_start, line_start) + stops_from_union(station_end, line_end)\n\n end\n\n\t# total stops needs to be an absolute value\n\ttotal_stops = total_stops.abs\nend", "def shift_time_array\n time_shift = Time.now.in_time_zone(self.time_zone).utc_offset\n time_shift = (time_shift/3600).round\n\n if self.week_preferred != \"allday\"\n self.week_array.map! { |hour| (hour != 0 ? (hour + (time_shift)) % 24 : 0 )}\n self.week_array.sort!\n end\n\n if self.weekend_preferred != \"allday\"\n self.weekend_array.map! { |hour| (hour != 0 ? (hour + (time_shift)) % 24 : 0 )}\n self.weekend_array.sort!\n end\n end" ]
[ "0.5638894", "0.53874624", "0.53819674", "0.5165623", "0.50170946", "0.5015461", "0.49940002", "0.49748528", "0.49748528", "0.49654493", "0.49164858", "0.48458615", "0.48347014", "0.48263434", "0.48260978", "0.48255122", "0.48218706", "0.48143843", "0.47848248", "0.47738844", "0.47426152", "0.47365934", "0.46922672", "0.46748057", "0.464595", "0.4637652", "0.46344984", "0.4622956", "0.4619746", "0.46195087", "0.46036297", "0.4599507", "0.45979762", "0.45972645", "0.45964104", "0.45915252", "0.45914334", "0.4589595", "0.4589275", "0.45873517", "0.45606634", "0.45593333", "0.4548352", "0.45301247", "0.45291424", "0.45202246", "0.45182443", "0.45163852", "0.45128605", "0.45117453", "0.4511413", "0.45076853", "0.44978198", "0.44958374", "0.44941127", "0.4490768", "0.44905353", "0.44822195", "0.44816446", "0.44802287", "0.44756582", "0.44734663", "0.44728383", "0.44601128", "0.4458925", "0.44586933", "0.44550917", "0.44537705", "0.4451354", "0.44461855", "0.4441666", "0.44377574", "0.44296232", "0.44273227", "0.4423372", "0.4422739", "0.44147682", "0.4412143", "0.44099385", "0.44057673", "0.44053337", "0.440493", "0.44033238", "0.44010004", "0.44004312", "0.43933913", "0.43913406", "0.4391262", "0.43836743", "0.43820432", "0.43707457", "0.43703374", "0.43681145", "0.43681145", "0.43652487", "0.43633863", "0.43586123", "0.4353239", "0.4352067", "0.4348526" ]
0.58861893
0
Sortiert die uebergebene List mit Umschlaegen und Abschnitten nach dem EndDatum. Eintraege ohne werden ans Ende gehaengt.
def sort_abschnitte_and_umschlaege_by_date start_liste abschnitt_umschlag_list = [] mit_end_datum = start_liste.select{|element| element.end_datum } #File.open("log/transport.log","a"){|f| f.puts "Mit Ende #{mit_end_datum.to_s}" } abschnitt_umschlag_list.concat(mit_end_datum.sort_by{|element| element.end_datum} ) ohne_end_datum = start_liste.select{|element| element.end_datum.nil? } #File.open("log/transport.log","a"){|f| f.puts "Ohne Ende: #{ohne_end_datum.to_s}" } abschnitt_umschlag_list.concat(ohne_end_datum) #File.open("log/transport.log","a"){|f| f.puts "Liste bei Date #{abschnitt_umschlag_list.to_s}" } abschnitt_umschlag_list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_entries; end", "def sort_abschnitte_and_umschlaege_by_ort\n ort_to_detail = {}\n self.umschlaege.each do |umschlag|\n ort = umschlag.ort\n ort_id = ort.nil? ? 0 : ort.id\n ort_to_detail[ort_id] ||= []\n ort_to_detail[ort_id] << umschlag\n end \n self.transportabschnitte.each do |abschnitt|\n ort = abschnitt.start_ort\n ort_id = ort.nil? ? 0 : ort.id\n ort_to_detail[ort_id] ||= []\n ort_to_detail[ort_id] << abschnitt\n end \n ort_to_detail\n end", "def sort_by_dob!\n @entries.sort! { |a,b| a.dob <=> b.dob }\n end", "def sort_abschnitte_and_umschlaege\n abschnitt_umschlag_list = []\n # Hilfsmethode, baut einen nach Orten sortierten Hash auf.\n ort_to_detail = sort_abschnitte_and_umschlaege_by_ort\n File.open(\"log/transport.log\",\"w\"){|f| f.puts \"Ort to detail #{ort_to_detail}\" }\n unless self.start_anlage.nil?\n if self.start_anlage.ort\n ort_aktuell = self.start_anlage.ort\n if ort_aktuell.nil? || ort_to_detail[ort_aktuell.id].nil?\n ort_aktuell = abschnitt_only_start_ort(ort_to_detail.keys) \n end \n counter = 0\n while not (ort_aktuell.nil? || ort_to_detail.empty? || counter > 100)\n counter += 1\n next_ort = nil\n ort_aktuell_id = ort_aktuell.nil? ? 0 : ort_aktuell.id \n unless ort_to_detail[ort_aktuell_id].nil?\n ort_to_detail[ort_aktuell_id].each do |abschnitt_umschlag|\n File.open(\"log/transport.log\",\"a\"){|f| f.puts abschnitt_umschlag.attributes }\n abschnitt_umschlag_list << abschnitt_umschlag\n next_ort = abschnitt_umschlag.end_ort if abschnitt_umschlag.kind_of? Transportabschnitt \n end\n ort_to_detail.delete(ort_aktuell_id) \n ort_aktuell = next_ort\n end\n end \n # Rest nach Datum sortieren\n unless ort_to_detail.empty?\n File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Rest nach Datum\" }\n abschnitt_umschlag_list = abschnitt_umschlag_list.concat(sort_abschnitte_and_umschlaege_by_date(ort_to_detail.values.flatten))\n end\n else \n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Alles nach Datum\" }\n abschnitt_umschlag_list = abschnitt_umschlag_list.concat(sort_abschnitte_and_umschlaege_by_date(ort_to_detail.values.flatten))\n end \n end\n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Transport #{id}: #{abschnitt_umschlag_list.to_s}\" }\n abschnitt_umschlag_list\n end", "def sort()\n\t\t@events = @events.sort do |a,b| a[0] <=> b[0] end\n\tend", "def sort\n\t@events = @events.sort_by { | e | e.time_from_start }\n\trecalc_delta_from_times()\n end", "def ja_sort\n [{ :created_at => :desc }]\n end", "def sort_genes\n \[email protected]!{|x,y| x.start <=> y.start}\n end", "def entries\n @entries.sort!{|a, b| a.range.low <=> b.range.low }\n end", "def sorted_articles\n require 'time'\n articles.sort_by do |a|\n attribute_to_time(a[:created_at])\n end.reverse\n end", "def sorted_articles\n require 'time'\n articles.sort_by do |a|\n time = a[:created_at]\n time.is_a?(String) ? Time.parse(time) : time\n end.reverse\n end", "def entries()\r\n return @entries.to_a.sort { |a,b|\r\n a.date <=> b.date\r\n }\r\n end", "def sort\n @pokers.sort.reverse\n end", "def blogs\n\t\t @blogs.sort! { |blog1, blog2| blog2.date <=> blog1.date }\n\tend", "def front_date (list)\n @listDate = []\n tmplist=list.find_all { |e| e and e.dateFinal }\n list=tmplist.uniq.sort_by { |obj| obj.dateFinal }\n if !list.empty?\n @firstDate = list.first.dateFinal\n list.each do |element|\n if @firstDate > element.dateFinal\n @firstDate = element.dateFinal\n end\n end\n\n dateBefore = list.first.dateFinal\n @listDate.push(dateBefore)\n list.each do |commande|\n if commande.dateFinal != dateBefore\n @listDate.each do |tmpdate|\n if commande.dateFinal == tmpdate\n break\n end\n end\n dateBefore=commande.dateFinal\n @listDate.push(commande.dateFinal)\n end\n end\n end\n end", "def sort_entries=(_arg0); end", "def bigSorting(unsorted)\n\nend", "def sort!\n sort_if_needed\n self\n end", "def try_sort\n # Sort the table if the first element next_start_time has changed\n if false && @next_start_time != @sprinkles[0].next_start_time\n @sprinkles.sort_by! {|s| s.next_start_time}\n @next_start_time = @sprinkles[0].next_start_time\n end\n end", "def main\n filelist = split_ts_export_main\n sort_lines_main(filelist)\n #reverse_lines_main\nend", "def sorted_snapshot_list()\n snapshot_list().sort{|a,b| b.time <=> a.time }\n end", "def sorted_dates\n self.time_slots.sort_by(&:scheduled)\n end", "def sort_by_ln!\n @entries.sort! { |a,b| a.ln <=> b.ln }\n @entries.reverse!\n end", "def e5115_sublinear_sort(values)\n end", "def sort_name\n if start_date.present?\n 10_000_000_000 - start_date.to_time.to_i # because always sorted ASC and we want sooner first\n elsif end_date.present?\n 10_000_000_000 - end_date.to_time.to_i # because always sorted ASC and we want sooner first\n else\n 10_000_000_000\n end\n end", "def descending\n swap(:startkey, :endkey) if query[:startkey] || query[:endkey]\n swap(:startkey_docid, :endkey_docid) if query[:startkey_docid] || query[:endkey_docid]\n\n update_query(:descending => true)\n end", "def perform\n kahn_sorting if @sorted_list.empty?\n\n @sorted_list\n end", "def ordena_infos_por_longitude\n puts \"Ordenando informações...\"\n @lista_locais.sort! { |a, b| a.longitude <=> b.longitude }\nend", "def ordena_infos_por_longitude\n puts \"Ordenando informações...\"\n @lista_locais.sort! { |a, b| a.longitude <=> b.longitude }\nend", "def sorted_events\n events.sort\n end", "def entry_dates()\r\n return @entries_by_date.keys.sort.reverse()\r\n end", "def sort\n conditions = scope_condition\n list_items = order_by_position(conditions, :created_at.desc).to_a\n\n list_items.each_with_index do |list_item, index|\n list_item.set_my_position index + 1\n end\n end", "def sort\n conditions = scope_condition\n list_items = order_by_position(conditions, :created_at.desc).to_a\n\n list_items.each_with_index do |list_item, index|\n list_item.set_my_position index + 1\n end\n end", "def incomplete_list(sort_order: { created_at: :desc })\n incomplete.order(sort_order)\n end", "def sortFloorList\n if @direction == 'up'\n @floorRequestList.sort!\n elsif @direction == 'down'\n @floorRequestList.sort!.reverse\n end\n end", "def sort_list!(list)\n list.sort! do |a,b|\n a, b = a.sort_data, b.sort_data\n i = 0\n i += 1 while a[i] == b[i] && (a[i+1] || b[i+1])\n if a[i] && b[i]\n a[i] <=> b[i]\n else\n a[i] ? 1 : -1\n end\n end\n list\n end", "def sort\n super { |x, y| x.file_name <=> y.file_name }\n end", "def sort_by_date(items)\n in_progress = items.select { |item| item[:date].nil? }\n .sort_by { |item| item[:name].downcase }\n done = items - in_progress\n done = done.sort do |item_a, item_b|\n case item_a[:date] <=> item_b[:date]\n when -1 then 1\n when 1 then -1\n else\n item_a[:name].downcase <=> item_b[:name].downcase\n end\n end\n in_progress + done\n end", "def stable_sort_by(list); end", "def ordenar_for\n\t @lista = self.map{ |a| a }\n\t \tfor i in ([email protected])\n\t\t\tfor j in ([email protected])\n\t\t\t\tif j+1 != @lista.count\n if @lista[j+1] < @lista[j]\n\t\t\t\t\t\t@lista[j],@lista[j+1] = @lista[j+1],@lista[j]\n \t\t\t\tend\n\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t@lista\n end", "def sort_items_in_day(items)\n items.sort do |a,b|\n sign_a = a.allday? ? 0 : 1\n sign_b = b.allday? ? 0 : 1\n\n if sign_a != sign_b\n sign_a - sign_b\n else\n a <=> b\n end\n end\n end", "def sort_items_in_day(items)\n items.sort do |a,b|\n sign_a = a.allday? ? 0 : 1\n sign_b = b.allday? ? 0 : 1\n\n if sign_a != sign_b\n sign_a - sign_b\n else\n a <=> b\n end\n end\n end", "def sort\r\n @roster.each do |key, value|\r\n value.sort!\r\n end\r\n end", "def qSort(list, start, stop, pivotPos) ## pivotPos represents the pivot position in the full list (not just the sub list)\n pivot = list.size - 1\n left = []\n right = []\n retList = []\n\n for pos in 0 ... list.size ## Divide items into sublists\n if list.at(pos) > list.at(pivot)\n right << list.at(pos)\n elsif list.at(pos) < list.at(pivot)\n left << list.at(pos)\n end\n end\n\n i = start\n for pos in 0 ... left.size ## update master list\n $uList[i] = left.at(pos)\n i += 1\n end\n\n $uList[i] = list.at(pivot)\n pivotPos = i\n i += 1\n\n for pos in 0 ... right.size\n $uList[i] = right.at(pos)\n i += 1\n end\n\n for i in 0 ... $uList.size ## display list\n if (i == pivotPos)\n $t = para $uList[i], :font => \"Monospace 12px\", :stroke => red, :displace_top => -25\n elsif ((i >= (pivotPos - left.size)) & (i < pivotPos))\n if ((left.size > 1) & (i == pivotPos - 1))\n $t = para $uList[i], :font => \"Monospace 12px\", :stroke => green, underline: \"single\", :displace_top => -25\n else\n $t = para $uList[i], :font => \"Monospace 12px\", :stroke => green, :displace_top => -25\n end\n elsif ((i > pivotPos) & (i <= pivotPos + right.size))\n if ((right.size > 1) & (i == pivotPos + right.size))\n $t = para $uList[i], :font => \"Monospace 12px\", :stroke => blue, underline: \"single\", :displace_top => -25\n else\n $t = para $uList[i], :font => \"Monospace 12px\", :stroke => blue, :displace_top => -25\n end\n else\n $t = para $uList[i], :font => \"Monospace 12px\", :stroke => black, :displace_top => -25\n end\n end\n\n\n $t = para \"\\n\", :font => \"Monospace 12px\", :stroke => black, :displace_top => -25\n\n st = $uList.size - ($uList.size - list.size) - 1\n\n if left.size > 1 ## if left sublist is greater than 1, call sort function on sublist\n left = qSort(left, pivotPos - left.size, pivotPos - 1, pivotPos)\n end\n\n if right.size > 1 ## '' Right sublist ''\n right = qSort(right, pivotPos + 1, pivotPos + right.size, pivotPos)\n end\n\n ## combine full list\n if (left.size > 0)\n retList << left\n end\n\n retList << list.at(pivot)\n\n if (right.size > 0)\n retList << right\n end\n\n return retList.flatten(1) ## return flattened list\nend", "def sort_data\n store.sort_data!\n end", "def sort_by_site_range!\n @list = Hash[@list.sort_by {|partition_name, partition| partition.sites}]\n self\n end", "def sort_events(events)\n events.sort_by { |e| e['time'] }.reverse\nend", "def sort\n @entries = DependencySorter.new(@entries).sorted_items\n end", "def sort(low_index, high_index)\n #modification to insertion sort to take a range\n (low_index..high_index).each_with_index do |e, i|\n (low_index..e).reverse_each do |j|\n if j != 0 && less(@array[j], @array[j-1])\n exchange(j, j-1)\n end\n end\n end\n end", "def outdated_list(sort_order: { created_at: :desc })\n outdated.order(sort_order)\n end", "def sort_times\n @links.each_value { |l| l.sort_times }\n end", "def sort(block)\n @content.sort(block)\n end", "def index\n # @day_road_lists = DayRoadList.all.sort_by(&:day)\n @day_road_lists = DayRoadList.all.order(day: :asc)\n end", "def reorder best=nil\n\t\tif !best\n\t\t\tbest = lambda {|d1, d2| d1.e < d2.e}\n\t\tend\n\t\tif @daughters.length != 0\n\t\t\tindex = 0\n\t\t\t([email protected]).each do |i|\n\t\t\t\tif best.call @daughters[i], @daughters[index]\n\t\t\t\t\tindex = i\n\t\t\t\tend\n\t\t\tend\n\t\t\[email protected](@daughters.delete_at index)[0].reorder !best\n\t\tend\n\tend", "def sort_schedules(meetings)\n meetings.sort_by { |meeting| [meeting[:type], meeting[:duration]] }.reverse\nend", "def <=>(other)\n self_start = self.start_date\n other_start = other.start_date\n self_end = self.end_date \n other_end = other.end_date\n return self_start <=> other_start if self_start && other_start\n return self_end <=> other_end if self_end && other_end\n return self_start <=> other_end if self_start && other_end\n return self_end <=> other_start if self_end && other_start\n return 0\n end", "def sort!( &block )\n @data = skip_headers { |d| d.sort( &block ) }; self\n end", "def mothrah_sort (an_array)\n\tdef move_to_end (value, array)\n\t\tarray.delete(value)\n\t\tarray.push(value)\n\tend\n\tpos = 0\n\twhile pos < an_array.length \n\t\tif an_array[pos] > an_array[pos + 1]\n\t\t\tmove_to_end(an_array[pos], an_array)\n\t\telse\n\t\t\tpos += 1\n\t\tend\n\tend\n\tan_array\nend", "def sort_all_incomplete\n @due_date_task_list.sort! { |duedatetask1, duedatetask2| duedatetask1.due_date <=> duedatetask2.due_date }\n @combined_list = @due_date_task_list + @task_list\n @combined_list.select { |duedatetask| (duedatetask.status == \"incomplete\") }\n end", "def test_0280_sort\n @@log.debug \"test_0280_sort starts\" if @@log.debug?\n assert_respond_to(@list, :sort, \"test_0280_sort_respond\")\n # Basic sort. Assumes all objects implement <=>.\n ta = @list.sort\n assert_equal([@bsb, @cab, @dad, @aen], ta, \"test_0280_sort_basic\")\n # Sort with block\n ta = @list.sort {|a,b| a.first <=> b.first}\n assert_equal([@aen, @bsb, @cab, @dad], ta, \"test_0280_sort_block\")\n @@log.debug \"test_0280_sort ends\" if @@log.debug?\n end", "def sort_data_descending!(*sort_keys)\n self.sort_data!(false, sort_keys)\n end", "def dub_sort(arr)\nend", "def sort_tweets_by_date\n\t\ttweets = @tweets.sort_by{|tweet| tweet.created_at}\n\tend", "def sort!(reverse=false)\n @files = files.sort {|f1, f2| file_date(f1) <=> file_date(f2) }\n @files = files.reverse if reverse\n self\n end", "def sort\n return @sort\n end", "def sort_items_according_to_current_direction\n case @direction\n when nil\n @items = items.shift(2) + items.partition(&:directory?).flat_map(&:sort)\n when 'r'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort.reverse}\n when 'S', 's'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by {|i| -i.size}}\n when 'Sr', 'sr'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by(&:size)}\n when 't'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort {|x, y| y.mtime <=> x.mtime}}\n when 'tr'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by(&:mtime)}\n when 'c'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort {|x, y| y.ctime <=> x.ctime}}\n when 'cr'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by(&:ctime)}\n when 'u'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort {|x, y| y.atime <=> x.atime}}\n when 'ur'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by(&:atime)}\n when 'e'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort {|x, y| y.extname <=> x.extname}}\n when 'er'\n @items = items.shift(2) + items.partition(&:directory?).flat_map {|arr| arr.sort_by(&:extname)}\n end\n items.each.with_index {|item, index| item.index = index}\n end", "def sorted_posts_by_date\n @items.select do |i|\n ! ( REGEXP_DATE_ISO.match(i.identifier).nil? )\n end.sort do |a,b|\n a.identifier <=> b.identifier\n end.reverse\nend", "def ordered_list; end", "def sort\n self.roster.reduce({}) do |roster, (key,value)|\n roster[key] = value.sort\n roster\n end\n end", "def to_rss(records)\n super(flatten_and_sort(records).last(records.size).reverse)\n end", "def insertion_sort(list)\n return list if list.size < 2\n\n (1...list.length).each do |i|\n j = i - 1\n e_next = list[i]\n while j >= 0 and list[j] > e_next\n list[j + 1] = list[j]\n j -= 1\n end\n list[j + 1] = e_next\n end\n list\n end", "def sortingTheClasses (upcomingClasses)\n #i need to take the values out of the database and \n #make a hash then return the hash so that it can \n #access the data members better by date. \n upcomingClasses.sort_by{ |k, v| v[:date]}.reverse\nend", "def sort_email_address\n \"-#{self.email_address}\"\n end", "def abschnitt_only_start_ort orte\n orte.each do |ort_id|\n if !ort_id==0 && self.transportabschnitte.where(end_ort_id: ort_id).empty?\n return ort \n end \n end \n nil\n end", "def sort(start = nil, &block)\n result = []\n push = Proc.new { |v| result.unshift(v) }\n start ||= vertices[0]\n dfs({ :exit_vertex => push, :start => start })\n result.each { |v| block.call(v) } if block\n result\n end", "def find_sorted_entries_by_timelimit(section, oldest,limit)\n # entries = record.send(section).any_of([:time.gt => e], [:start_time.gt => e]).limit(limit)\n entries = send(section).timelimit(oldest).limit(limit)\n now = Time.now\n recs = entries.to_a\n recs.sort! do |x, y|\n t1 = x.time || x.start_time || now.to_i\n t2 = y.time || y.start_time || now.to_i\n t2 <=> t1\n end\n recs\n end", "def do_merge_sort(first, last)\n return if first >= last\n \n mid = (first + last)/2\n do_merge_sort(first, mid)\n do_merge_sort(mid+1, last)\n do_simple_merge(first,mid,last)\n end", "def entries_by_date(date)\r\n return @entries_by_date[date].sort { |a,b|\r\n a.date <=> b.date\r\n }\r\n end", "def finances_finished_reservations(date_from, date_to)\n\n repository.adapter.select(query_finances_finished_reservations, date_from, date_to).sort do |x,y|\n comp = x.date_to <=> y.date_to\n comp.zero? ? Time.parse(x.time_to) <=> Time.parse(y.time_to) : comp\n end\n\n end", "def sort(*arguments, &block)\n data.sort(*arguments, &block)\n end", "def all_sorted\n @data[:pages].sort_by{|k, v| -v}\n end", "def sort_order\n super\n end", "def mergeSort(ia)\n mergeSortHelper(ia, 0, ia.length-1)\nend", "def index\n @events = Event.all.sort_by{ |e| e.estart }\n end", "def sorted_data &block\n @data.to_a.sort(&block)\n end", "def sort\n self.roster.each do |grade, students|\n students.sort!\n end\n self.roster\n end", "def sorted(subjects)\n subjects.sort_by {|subject| subject['updated_at'] }.reverse\n end", "def sort!\n @list = Hash[@list.sort_by {|partition_name, partition| partition}]\n self\n end", "def |(other)\n vals = [\n first,\n other.first,\n actual_last,\n other.actual_last\n ].sort\n\n (vals.first..vals.last)\n end", "def sort_files!; end", "def sort(*args, &blk)\n self.dup{ @contents = @contents.sort(*args, &blk) }\n end", "def top_sort\n top_sort_visit([]).reverse\n end", "def sort_cards_by_value_bis!()\r\n\t\taucun_echange=false\r\n\t\twhile aucun_echange==false\r\n\t\t\taucun_echange=true\r\n\t\t\[email protected]\r\n\t\t\tfor i in 0..len\r\n\t\t\t\tif !@list[i].nil? and !@list[i+1].nil?\r\n\t\t\t\t\tif @list[i].get_value_bis<@list[i+1].get_value_bis\r\n\t\t\t\t\t\ttemp=@list[i]\r\n\t\t\t\t\t\t@list[i]=@list[i+1]\r\n\t\t\t\t\t\t@list[i+1]=temp\r\n\t\t\t\t\t\taucun_echange=false\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\telsif @list[i].get_value_bis == @list[i+1].get_value_bis\r\n\t\t\t\t\t\[email protected]_at(i)\r\n\t\t\t\t\t\taucun_echange=false\r\n\t\t\t\t\t\tbreak\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\tend\r\n\tend", "def sort_tweets\n tweets.sort { |a, b| b.created_at <=> a.created_at }\n end", "def items\n @hashes.to_a.sort {|(_, a), (_, b)| a[:stamp] <=> b[:stamp] }\n end", "def sort(&block)\n self.map{|*val| val.__svalue}.sort(&block)\n end", "def sort_due_date_incomplete\n @due_date_task_list.sort! { |duedatetask1, duedatetask2| duedatetask1.due_date <=> duedatetask2.due_date }\n @due_date_task_list.select { |duedatetask| (duedatetask.status == \"incomplete\") }\n end", "def merge_sort(fishes)\n return fishes if self.length <= 1\n mid = fishes.length / 2\n sort_left = fishes.take(mid).merge_sort(fishes)\n sort_right = fishes.drop(mid).merge_sort(fishes)\n merge(sort_left, sort_right)\nend", "def sort!\n @tabs.sort! { |x,y| x.text <=> y.text }\n end", "def quick_sort(s_arr, first, last)\n i = first\n j = last\n tmp = 0\n x = s_arr[first + (last - first) / 2]\n while (i <= j)\n\n while (s_arr[i].created_at > x.created_at)\n i+=1\n end\n while (s_arr[j].created_at < x.created_at)\n j-=1\n end\n\n if(i <= j)\n if (s_arr[i].created_at < s_arr[j].created_at)\n tmp = s_arr[i]\n s_arr[i] = s_arr[j]\n s_arr[j] = tmp\n end\n i+=1\n j-=1\n end\n end\n quick_sort(s_arr, i, last) if (i < last)\n quick_sort(s_arr, first, j) if (first < j)\n\n end" ]
[ "0.62856615", "0.6089975", "0.59793365", "0.59428084", "0.5938043", "0.58046347", "0.5739227", "0.573167", "0.57070583", "0.5667715", "0.55733466", "0.550901", "0.54742354", "0.54700524", "0.54565024", "0.5429345", "0.5364981", "0.53395605", "0.5309679", "0.5307433", "0.5273113", "0.5253494", "0.5244805", "0.52377117", "0.5237658", "0.523314", "0.5232409", "0.52317864", "0.52317864", "0.521184", "0.52101713", "0.51941437", "0.51941437", "0.51918375", "0.5190444", "0.51837707", "0.51683986", "0.5136169", "0.5132286", "0.512505", "0.51036155", "0.51009995", "0.50893533", "0.5088696", "0.5081078", "0.50427026", "0.5039867", "0.5038301", "0.5037042", "0.5035928", "0.50349605", "0.5000931", "0.4993207", "0.49825248", "0.49808744", "0.49768278", "0.49656388", "0.49507898", "0.49506336", "0.49502754", "0.49418953", "0.49356073", "0.49336642", "0.49233994", "0.49134508", "0.49131164", "0.4909835", "0.48957625", "0.4893193", "0.4892442", "0.48914132", "0.48895088", "0.4889118", "0.48846617", "0.48839468", "0.48752737", "0.4872524", "0.48709038", "0.48696253", "0.4867454", "0.48657945", "0.48646247", "0.48638946", "0.4862338", "0.48555475", "0.48515156", "0.48414573", "0.48413107", "0.48318863", "0.48229975", "0.48175803", "0.48172444", "0.48157063", "0.481322", "0.48121077", "0.47974864", "0.47969386", "0.47921133", "0.47894412", "0.47849333" ]
0.75931126
0
Hilsmethoden fuers Sammeln der Orte
def check_ort_ll(ort_array, ort) unless ort_array.include? ort ort_array << ort if ort and ort.lon and ort.lat end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toronto\n\n end", "def suivre; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def zuruecksetzen()\n end", "def fOOrth\r\n end", "def fOOrth\r\n end", "def geodatos\n end", "def romeo_and_juliet; end", "def relatorios\n end", "def vehicle; end", "def vehicle; end", "def vehicle; end", "def vehicle; end", "def vehicle; end", "def entities; end", "def doors; end", "def eplore\n end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def object; end", "def terpene; end", "def private; end", "def travel_and_places; end", "def entity(point_or_name); end", "def get_rover_details; end", "def letzte_komponente\n \n end", "def methods() end", "def tow\n auto_shop.tow_vehicle\n end", "def tow\n auto_shop.tow_vehicle\n end", "def formation; end", "def schubert; end", "def agencia\n self.agency\n end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def verdi; end", "def owner; end", "def owner; end", "def planet; end", "def planet; end", "def planet; end", "def planet; end", "def planet; end", "def planet; end", "def vehicles; end", "def feruchemist; end", "def utiliser( objet )\n\t\[email protected]( objet )\n\t\trafraichir\n\tend", "def home_planet\n Person.home_planet\n end", "def object_nl()\n #This is a stub, used for indexing\n end", "def set_orden \n @orden = Orden.find(params[:orden_id])\n end", "def company; end", "def company; end", "def geometry( b)\n\t\t# over-ride where neeeded, e.g. UONActor\n\tend", "def operations; end", "def operations; end", "def vin; end", "def set_orden\n @orden = Orden.find(params[:id])\n end", "def set_orden\n @orden = Orden.find(params[:id])\n end", "def set_orden\n @orden = Orden.find(params[:id])\n end", "def get_orcid_works____\n \n\n end", "def objects; end", "def getters; end", "def por_extenso\n Extenso.por_extenso(self)\n end", "def list \n @@Ordenadores\n end", "def index\n @origens = Origen.all\n end", "def anchored; end", "def jeter( objet )\n\t\[email protected]( objet )\n\tend", "def thorins_company; end", "def strategy; end", "def index\n @ordens = Orden.all\n end", "def village; end", "def university; end", "def owner\n @restaurant.owner\n end", "def editar\n end", "def index\n @ordems = Ordem.all\n end", "def team; end", "def team; end", "def team; end", "def team; end", "def team; end", "def team; end", "def plane\n end", "def the_doctor; end", "def villian; end", "def owner\n self.person\n end" ]
[ "0.6214536", "0.6111044", "0.6037245", "0.6037245", "0.6037245", "0.6037245", "0.59230155", "0.5863991", "0.5863991", "0.58432007", "0.5839328", "0.5807034", "0.5799381", "0.5799381", "0.5799381", "0.5799381", "0.5799381", "0.5782712", "0.57480836", "0.57356644", "0.56457144", "0.56457144", "0.56457144", "0.56457144", "0.56457144", "0.56457144", "0.56457144", "0.56457144", "0.56457144", "0.56457144", "0.56457144", "0.56457144", "0.56457144", "0.56457144", "0.56457144", "0.5632412", "0.5630966", "0.56242526", "0.5614837", "0.559723", "0.5587613", "0.55730593", "0.5554836", "0.5554836", "0.5542116", "0.5521507", "0.5507907", "0.54924905", "0.54924905", "0.54924905", "0.54924905", "0.54677594", "0.546698", "0.546698", "0.54657453", "0.54657453", "0.54657453", "0.54657453", "0.54657453", "0.5465176", "0.54566693", "0.5444276", "0.5435905", "0.5428162", "0.5422623", "0.54181254", "0.5405516", "0.5405516", "0.53895783", "0.5385352", "0.5385352", "0.5379627", "0.537628", "0.537628", "0.537628", "0.5372758", "0.53592044", "0.53488356", "0.5346694", "0.5345296", "0.5345234", "0.5340342", "0.53365105", "0.5331575", "0.53229517", "0.5305608", "0.53056055", "0.5291738", "0.5289716", "0.52871805", "0.5278129", "0.52748317", "0.52748317", "0.52748317", "0.52748317", "0.52748317", "0.52748317", "0.52699196", "0.5259416", "0.52585775", "0.52581966" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_user @user = User.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def 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 startcompany(action)\n @done = true\n action.setup\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 setup\n #implement in subclass;\n end", "def after_set_callback; 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 setup(easy)\n super\n easy.customrequest = @verb\n end", "def around_hooks; end", "def save_action; 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 shared_action(name, &block)\n @controller.shared_actions[name] = 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", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def duas1(action)\n action.call\n action.call\nend" ]
[ "0.6165152", "0.60463154", "0.59467196", "0.5917112", "0.5890387", "0.58345735", "0.57773316", "0.56991524", "0.56991524", "0.565454", "0.5622282", "0.54232633", "0.54119074", "0.54119074", "0.54119074", "0.53937256", "0.53801376", "0.5358599", "0.53412294", "0.5340814", "0.53314966", "0.53114754", "0.52984965", "0.52977055", "0.5296272", "0.5260649", "0.5245076", "0.52388334", "0.52388334", "0.52388334", "0.52388334", "0.52388334", "0.5235081", "0.52321917", "0.5228592", "0.5220735", "0.52198535", "0.52139324", "0.5208539", "0.5206585", "0.5178542", "0.5175199", "0.5173538", "0.5167041", "0.51614195", "0.51577675", "0.5153909", "0.51528823", "0.5152225", "0.51429904", "0.5141399", "0.51345575", "0.51145", "0.5114052", "0.5114052", "0.5110216", "0.5108656", "0.50935394", "0.5089196", "0.5081936", "0.5079627", "0.50675833", "0.5056105", "0.5053687", "0.5050475", "0.5050475", "0.503471", "0.5028311", "0.501982", "0.50157547", "0.5013552", "0.50014806", "0.50011593", "0.49976763", "0.4990292", "0.4990292", "0.49882022", "0.4981269", "0.49792367", "0.49766538", "0.4967978", "0.49667212", "0.4958987", "0.49572337", "0.49550423", "0.4954479", "0.4952353", "0.494726", "0.4944055", "0.4935437", "0.4931248", "0.49283475", "0.49281213", "0.49268973", "0.4921738", "0.49204507", "0.4918924", "0.49182287", "0.4916538", "0.49158585", "0.49156788" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def user_params new_hash = {} params[:data][:attributes].each do |key, value| new_hash[key.to_s.gsub("-","_")] = value end if !params[:data][:relationships].nil? params[:data][:relationships].each do |key, value| if value[:data].kind_of?(Array) new_hash[(key.to_s.gsub("-","_").singularize) + "_id"] = value[:data].map {|i| i[:id]} else new_hash[(key.to_s.gsub("-","_").singularize) + "_id"] = value[:data][:id] end end end new_params = ActionController::Parameters.new(new_hash) new_params.permit( :name, :email, :user_type, :user_id, :books_id, :password ) 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 :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 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 [: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 get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\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 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 user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\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 get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "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 specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "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 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 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 property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\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 user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def parameters\n nil\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.71217275", "0.7052942", "0.6947555", "0.6903013", "0.6735074", "0.67167085", "0.6687677", "0.66765445", "0.66602796", "0.65548825", "0.6524274", "0.6455697", "0.6451343", "0.645123", "0.64465624", "0.6433475", "0.64118403", "0.64118403", "0.6390524", "0.6378871", "0.6378871", "0.6374268", "0.6360606", "0.6354037", "0.6284485", "0.62780905", "0.624562", "0.6225378", "0.6224288", "0.62237734", "0.6210716", "0.62073183", "0.61760557", "0.61714864", "0.61689645", "0.6159245", "0.6145253", "0.61351544", "0.61209726", "0.61050045", "0.60978544", "0.6073292", "0.6052814", "0.60387754", "0.60352194", "0.60294884", "0.6018536", "0.6017761", "0.6016042", "0.6016042", "0.6016042", "0.6016042", "0.6016042", "0.6016042", "0.6016042", "0.6016042", "0.6016042", "0.6016042", "0.6016042", "0.6016042", "0.6016042", "0.6016042", "0.6016042", "0.6016042", "0.6016042", "0.6015598", "0.60044724", "0.6003913", "0.6001379", "0.599616", "0.5994301", "0.5994205", "0.5984454", "0.5983921", "0.5976679", "0.5974281", "0.59687614", "0.59656674", "0.59649783", "0.59649783", "0.59568197", "0.5950897", "0.5950399", "0.59472823", "0.59424376", "0.59294873", "0.59292394", "0.592647", "0.59236294", "0.59178543", "0.59175855", "0.5913039", "0.5912506", "0.59062296", "0.5905145", "0.5904936", "0.5901632", "0.5899609", "0.589707", "0.58955824", "0.5894598" ]
0.0
-1
Override Devise method to redirect to dashboard after signing in
def after_sign_in_path_for(resource) sufia.dashboard_index_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_sign_in_path_for(resource)\n dashboard_path || super\n end", "def after_sign_in_path_for(resource_or_scope)\n #Redirect to Dashboard Controller\n dashboard_index_path\n end", "def after_sign_in_path_for(_resource)\n '/dashboard'\n end", "def redirect_to_dashboard_if_logged_in\n if logged_in?\n redirect_to dashboard_path\n return\n end\n end", "def after_sign_in_path_for(resource)\n\t'/dashboard'\nend", "def after_sign_in_path_for(resource)\n dashboard_path\n end", "def after_sign_in_path_for(resource)\n dashboard_path\n end", "def after_sign_in_path_for(resource)\n dashboard_path\n end", "def after_sign_in_path_for(resource)\n dashboards_path\n end", "def check_logged_in_user\n if signed_in?\n redirect_to dashboard_path\n end\n end", "def authenticate_user!\n if user_signed_in?\n super\n else\n redirect_to new_user_registration_path\n end\n end", "def after_sign_in_path_for(resource_or_scope)\n dashboards_path\n end", "def after_sign_in_path_for(user)\n user.is_admin? ? admin_dashboard_path : root_path\n end", "def after_sign_in_path_for(resource)\n '/dashboard' #your path\n end", "def redirect_signed_in_user\n redirect_to user_home_path if user_signed_in?\n end", "def after_sign_in_path_for(resource)\n # resource.admin? ? rails_admin.dashboard_path : root_path\n root_path\n end", "def authenticated_path\n dashboard_path\n end", "def after_sign_in_path_for(resource)\n dashboard_path(current_user.id)\n end", "def after_sign_in_path_for(resource)\n if resource.is_a?(User)\n return user_dashboard_index_path\n end\n end", "def after_sign_in_path_for(resource)\n is_admin? ? admin_dashboard_index_path : dashboard_index_path\n end", "def authorize_signed_in!\n redirect_to user_session_path, alert: \"You have to be signed in to do that!\" unless current_user\n end", "def after_sign_in_path_for(_resource_or_scope)\n backend_dashboard_path\n end", "def after_sign_in_path_for(resource)\n dashboard_index_url\n end", "def landing\n redirect_to dashboard_path if current_user\n end", "def default_redirect_url_after_sign_in\n admin_dashboard_url \n end", "def after_sign_in_path_for(resource_or_scope)\n dashboard_index_path\n end", "def signin\n sign_out\n redirect_to '/users/sign_in'\n end", "def auth_user\n redirect_to new_user_session_url unless user_signed_in?\n end", "def after_sign_in_path_for(resource)\n session[\"user_return_to\"] || dashboard_path\n end", "def auth_user\n redirect_to new_user_registration_url unless user_signed_in?\n end", "def after_sign_in_path_for(resource)\n\t if resource.is_a?(AdminUser)\n\t\t admin_dashboard_path(resource)\n\t end\n\tend", "def signin\n if doctor_signed_in?\n redirect_to doctor_path(current_doctor)\n end\n end", "def authenticate_user\n redirect_to root_path unless signed_in?\n end", "def signed_in_user\n redirect_to root_url, alert: \"Action Unsuccessful, please sign in.\" unless signed_in?\n end", "def after_sign_in_path_for(resource_or_scope)\n current_user # redirects to a user's show page\n end", "def user_signin_status\n unless user_signed_in?\n redirect_to root_url\n end\n end", "def user_dashboard\n if @current_user.superadmin_role\n path = auth_hub.index_superadmin_url\n elsif @current_user.admin_role\n path = auth_hub.index_admin_url\n elsif @current_user.admin_servizi\n path = auth_hub.index_admin_url\n end\n redirect_to path unless path.blank?\n end", "def authenticate_user!\n \tif user_signed_in?\n \t super\n else\n redirect_to new_user_session_path, notice: 'Debes iniciar sesión'\n end\n end", "def authenticate_doctor!\n if doctor_signed_in?\n super\n else\n redirect_to new_doctor_session_path\n end\n end", "def index\n if user_signed_in?\n redirect_to dashboard_path\n else\n render :index\n #redirect_to new_user_session_url(subdomain: ENV[\"SUBDOMAIN\"])\n end\n end", "def signed_in_user\n store_location #pour ensuite rediriger l'utilisateur vers la destination qu'il voulait avant\n # d'etre rediriger vers la pagne d'authentification\n redirect_to signin_url, notice: \"Please sign in.\" unless signed_in?\n end", "def authenticate_admin\n unless admin.sign_in?\n redirect_to new_admin_session_path\n else\n redirect_to admin_dashboard_path\n end\n end", "def after_sign_in_path_for(_resource)\n integral.backend_dashboard_path\n end", "def redirect_if_signed_in\n if user_signed_in?\n redirect_to home_path\n end\n end", "def after_sign_in_path_for(resource)\n redirect_to_home(resource)\n end", "def after_sign_in_path_for(resource)\n if current_user.sign_in_count == 1 || current_user.username == \"demo\"\n new_site_path\n else\n dashboard_path\n end\n end", "def after_sign_in_path_for(resource)\n stored_location_for(:user) || super\n end", "def authenticate\n redirect_to :login unless user_signed_in?\n end", "def signed_in_user\n store_location\n redirect_to signin_url, notice: \"Please sign in.\" unless signed_in?\n end", "def logged_in_user\n if user_signed_in? then\n \n else\n redirect_to root_path\n end \n \n end", "def signed_in_user\n unless signed_in?\n store_location #record url of intended page before redirect\n redirect_to signin_url, notice: \"Please sign in.\"\n end\n end", "def after_sign_in_path_for(resource)\n integral.backend_dashboard_path\n end", "def custom_user_sign_in\n if current_user.nil?\n session[:return_location] = request.referrer\n redirect_to new_user_session_path\n else\n redirect_to request.referrer || root_path\n end\n end", "def signed_in_user\n redirect_to login_url, notice: \"Log in to continue\" unless signed_in?\n end", "def authenticate_user\n redirect_to \"/login\" unless logged_in?\n end", "def index\n redirect_to after_sign_in_path_for current_user if current_user\n end", "def index\n redirect_to after_sign_in_path_for current_user if current_user\n end", "def logged_in_account\n unless logged_in?\n redirect_to login_path\n end\n end", "def signed_in_user\n unless signed_in?\n store_location\n redirect_to :signin, notice: \"Please sign in.\"\n end\n end", "def logged_in_user\n return if logged_in?\n store_location\n redirect_to sessions_new_path, alert: 'Please log in.'\n end", "def authenticate\n redirect_to login_path if !logged_in\n end", "def after_sign_in_path_for(user)\n if user.registration_complete\n \t dashboard_index_path\n else\n edit_user_registration_path\n end\n end", "def already_signed_in\n if current_user != nil\n redirect_to(root_path)\n end\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 authenticate_user\n# save current page for redirection after login\n redirect_to controller: :user, action: :login unless logged_in? \n current_user\n end", "def signed_in_user\n redirect_to signin_path, :status => 302 unless signed_in?\n end", "def signed_in_user\n redirect_to signin_path, :status => 302 unless signed_in?\n end", "def admin_signin_status\n unless user_signed_in? && is_admin?\n redirect_to root_url\n end\n end", "def after_sign_in_path_for(resource_or_scope)\n resource_or_scope.is_a?(User) ? dashboard_root_path : root_path\n end", "def logged_in_user\n unless logged_in?\n redirect_to '/login'\n end\n end", "def signed_in_user\n redirect_to signin_url, notice: \"Please sign in.\" unless signed_in?\n end", "def authenticate_user!\n redirect_to new_session_path unless user_signed_in?\n end", "def auth\n #redirect to login page unless already logged in\n redirect_to new_user_session_path, alert: \"You must login to access that page\" unless logged_in?\n end", "def signed_in_user\n unless signed_in?\n # store friendly URL so we can redirect after signin (stored in session)\n store_location\n redirect_to signin_url, notice: \"Please sign in.\"\n end\n end", "def after_sign_in_path_for(resource)\n \tlanding_path(current_user.id)\n end", "def autenticathe_login!\n unless someone_is_logged_in?\n store_location\n flash[:danger] = \"Por favor, Inicie sesion.\"\n redirect_to welcome_path\n end\n end", "def after_sign_in_path_for(resource)\n \tstored_location_for(resource) || dashboard_path\n end", "def authenticate_user!\n redirect_to login_path, alert: \"You must be logged in to access this page\" if current_user.nil?\n end", "def redirect_to_login\n\n redirect_to('/login')\n\n end", "def if_logged_in_redirect\n if logged_in?\n redirect_to current_user\n end\n end", "def if_logged_in_redirect\n if logged_in?\n redirect_to current_user\n end\n end", "def authorized_user!\n unless user_logged_in?\n redirect_to root_path\n end\n end", "def sign_in_and_redirect(resource_or_scope, *args); end", "def signIn_user\n unless signed_in?\n store_location\n redirect_to signin_url, notice: \"Please sign in.\"\n end\n end", "def logged_in_user\n unless logged_in?\n redirect_to login_url\n end\n end", "def authorize\n redirect_to \"/log_in\", :alert => t('.need_to_be_logged_in') unless signed_in?\n end", "def redirect_user_to_dashboard\n redirect_to dashboard_path if current_contact\n end", "def after_sign_up_path_for(resource)\n if resource.is_a?(User) && resource.is_admin?\n dashboard_path\n else\n root_url\n end\n end", "def after_sign_in_path_for(resource)\n stored_location_for(resource) || dashboard_path\n end", "def after_sign_in_path_for(resource)\n stored_location_for(resource) || user_dashboard_path(resource.id)\n end", "def logged_in_user\n unless logged_in?\n store_url_destination\n flash[:danger] = \"please log in.\"\n redirect_to login_path\n end\n end", "def home\n if user_signed_in?\n current_user.update_attribute(:login_status, true) if current_user # update login status for logged in user\n if !current_user.is_super_admin? && current_user.sign_in_count == 1 && current_user.created_by != 0 #User records which are created by super admin or dept admin has to change the password while they are logged in first time\n redirect_to :controller => \"registrations\", :action => \"privacy_setting\"\n else\n redirect_to :controller => \"dashboard\", :action => \"index\"\n end\n else\n redirect_to new_user_session_path\n end\n end", "def signed_in_user\n unless signed_in?\n store_location\n redirect_to signin_path, notice: \"Please sign in\" \n end\n end", "def authenticate_user\n redirect_to login_path unless logged_in_user?\n end", "def logged_in_user\n unless logged_in?\n store_location\n flash[:danger] = 'Unauthorized'\n redirect_to login_url\n end\n end", "def logged_in_user\n unless logged_in?\n redirect_to root_url\n end\n end", "def signed_in_user\r\n unless signed_in?\r\n store_location\r\n redirect_to signin_url, notice: \"Please sign in.\"\r\n end\r\n end", "def logged_in_user\n return if logged_in?\n\n store_location\n flash[:danger] = 'Please log in first'\n render 'sessions/new', status: :unauthorized\n true # return true to indicate that this triggered things\n end", "def signed_in_user\n unless signed_in?\n store_location\n redirect_to( signin_url, notice: \"Please sign in.\" )\n end\n end", "def logged_in\n if current_user == nil\n redirect_to new_user_session_path\n end\n end" ]
[ "0.8014545", "0.7553893", "0.7549594", "0.7532787", "0.75255704", "0.7504837", "0.7504837", "0.7436978", "0.7401057", "0.73998576", "0.7363065", "0.7275049", "0.72434723", "0.72121817", "0.71014494", "0.7084276", "0.70809007", "0.7077479", "0.70350474", "0.70346546", "0.7027467", "0.70228183", "0.70186096", "0.6983236", "0.6982385", "0.6978735", "0.6975731", "0.6961122", "0.69580024", "0.6947816", "0.69346136", "0.6931593", "0.69180775", "0.6915019", "0.6883334", "0.68809265", "0.68652964", "0.68497604", "0.6834675", "0.68304116", "0.6827717", "0.6822549", "0.68207896", "0.6811216", "0.6794688", "0.6779197", "0.67740494", "0.67679715", "0.67661387", "0.67590106", "0.67563593", "0.67553836", "0.6750417", "0.6742144", "0.67374086", "0.67367977", "0.67367977", "0.6735923", "0.67343664", "0.67337614", "0.6720385", "0.6717941", "0.6714337", "0.6712595", "0.6696011", "0.66924536", "0.66924536", "0.6681632", "0.66707474", "0.6669992", "0.66695744", "0.6667283", "0.6649522", "0.6649429", "0.6648515", "0.66476375", "0.664676", "0.6643859", "0.66385025", "0.66372633", "0.66372633", "0.6628705", "0.6626319", "0.6625524", "0.6620948", "0.66106987", "0.66077507", "0.6602038", "0.65978515", "0.6597763", "0.65945756", "0.6592628", "0.65911686", "0.6589887", "0.6585265", "0.65824425", "0.65814036", "0.65732276", "0.6571158", "0.65707314" ]
0.7119276
14
Hook which is overridden in Sufia::Ldap::Controller
def has_access? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ldap_before_save\n self.email = Devise::LDAP::Adapter.get_ldap_param(self.username, \"mail\").first\n self.encrypted_password = Devise::LDAP::Adapter.get_ldap_param(self.username, \"userPassword\").first\n display_name = Devise::LDAP::Adapter.get_ldap_param(self.username, \"displayName\" )\n if display_name.present?\n display_name = display_name.first.split(' ')\n self.firstname = display_name[1]\n self.lastname = display_name.shift\n end\n end", "def ldap_dispatcher\n # Scooter doesn't support custom settings yet.\n #@ldap_dispatcher ||= LDAPDispatcher.new(openldap, { :encryption => nil, :port => 389, \n # :auth => { :method => :simple, :username => \"cn=admin,dc=example,dc=com\", :password => \"puppetlabs\" } })\n @ldap_dispatcher ||= LDAPDispatcher.new(openldap, { :encryption => nil, :port => 389 })\nend", "def ldap_version\n super\n end", "def filter_redirect; end", "def filter_redirect; end", "def get_ldap_id\n\t\tself.id = Devise::LDAP::Adapter.get_ldap_param(self.username,\"uidnumber\").first\n end", "def method_missing(method, *args, &block)\n l = Origen.ldap.lookup(self)\n if l\n if l.attribute_names.include?(method)\n l[method]\n else\n super\n end\n else\n super\n end\n end", "def ldap_sign_in(user)\n login_as(user, scope: :user)\nend", "def process_login\n# Something is really wrong\n return dc_render_404('Login:') unless ( params[:record] and params[:record][:username] and params[:record][:password] )\n success = false\n unless params[:record][:password].blank? \n# user must be defined locally\n user = DcUser.find_by(username: params[:record][:username])\n if user\n# LDAP alternative. You must add gem 'net-ldap' to Gemfile \n# ldap = Net::LDAP.new(host: 'ldap.yourdomain.com')\n# ldap.auth(\"#{params[:record][:username]}@yourdomain.com\", params[:record][:password])\n# success = ldap.bind\n\n# authenticate locally\n success = user.authenticate(params[:record][:password]) unless success\n end\n end\n# \n if success\n fill_login_data(user, false)\n redirect_to '/'\n else # display login error\n flash[:error] = t('drgcms.invalid_username')\n redirect_to \"/login\"\n end\nend", "def ldap_before_save\n self.email = Devise::LDAP::Adapter.get_ldap_param(username, 'mail').first\n end", "def show\n@nome_completo = Devise::LDAP::Adapter.get_ldap_param(current_user.username,\"cn\").first.force_encoding(\"utf-8\")\n end", "def all_info\n LdapUser.retrieve_all_information self.login \n end", "def ldap_verify_and_update\n return unless self.is_ldap?\n\n scanner = LdapQuery::Scanner.search self.login, :only=>:ldap\n\n if scanner.errors.size > 0\n errors.add(:login, 'Login is invalid or cannot be found in OHSU\\'s servers')\n return\n end\n\n # Update our information from ldap\n self.assign_attributes scanner.as_user_attributes\n\n end", "def ldap_server=(should) end", "def after_custom_authentication; end", "def set_authenticate_name(opts)\n opts = check_params(opts,[:dn_names])\n super(opts)\n end", "def after_magic_link_authentication\n end", "def ldap\n @attributes[:ldap]\n end", "def process(entry)\n raise Puppet::DevError, \"The 'process' method has not been overridden for the LDAP terminus for #{self.name}\"\n end", "def sing_in_ldap(args)\n login = args[:login]\n password = args[:password]\n ldap = User.ldapCheckUser({login:login, password:password})\n if ldap[:bind] == false\n render :json => { login: false , error:ldap[:error]}\n return\n else\n userObj = {login:login , user_type: :ldap}\n user = User.where(userObj).first_or_create\n raw_token = {login: user.login , password: password , type:user.user_type }\n token = JsonWebToken.encode(raw_token)\n\n render :json => { login: true , token: token , admin: user.admin, user: {login:user.login, type:user.user_type, id: user.id} }\n return\n end\n end", "def after_custom_authentication\n\n end", "def create_default_authentication_ldap_configuration(opts)\n opts = check_params(opts,[:search_base_dn,:servers])\n super(opts)\n end", "def ldap\n conf['dashboard']['ldap']\n end", "def filter_redirect=(_arg0); end", "def filter_redirect=(_arg0); end", "def discover_groups\n super << Hydra::AccessControls::AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED\n end", "def ldap_ssl_option\n super\n end", "def method_missing(method_name, *args, &block)\n if ldap_connection.respond_to?(method_name)\n ldap_connection.send(method_name, *args, &block)\n else\n super\n end\n end", "def after_find\n\t\t#require 'base64'\n\t\t#self.domains = Marshal.load(Base64.decode64(self.domains))\n\t\tself.domains = User.str2domain(self.domains)\n\tend", "def search_for_login\n @login_ldap_entry ||= begin\n DeviseLdapNorm::Logger.send(\"LDAP search for login: #{@attribute}=#{@login}\")\n filter = Net::LDAP::Filter.eq(@attribute.to_s, @login.to_s)\n ldap_entry = nil\n match_count = 0\n @ldap.search(:filter => filter) {|entry| ldap_entry = entry; match_count+=1}\n DeviseLdapNorm::Logger.send(\"LDAP search yielded #{match_count} matches\")\n ldap_entry\n end\n end", "def devise_modules_hook!; end", "def show\n @nome_completo = Devise::LDAP::Adapter.get_ldap_param(current_user.username,\"cn\").first.force_encoding(\"utf-8\")\n end", "def lookup_action; end", "def ldap_search\n scanner = LdapQuery::Scanner.search params[:q]\n @ude = scanner.as_ude_attributes\n @ude[:errors] = scanner.errors\n respond_to do |format|\n format.json {render :json => @ude }\n end \n end", "def ldap_authenticate \n filter = Net::LDAP::Filter.eq(\"uid\",\"#{username}\")\n \n ldap_connection.search(:base => ldap_treebase, :filter => filter, :attributes => ldap_attrs, :return_result => false) do |entry|\n return true\n end\n \n self.errors.add(:username, \" is invalid\")\n return false\n end", "def auth_param; end", "def bind_distinguished_name\n super\n end", "def authenticate_name\n super\n end", "def ldap_register\n x = save(:context => :ldap)\n p self.errors unless x\n x\n end", "def after_crowd_authentication\n end", "def search_filter(name)\n raise Puppet::DevError, \"No search string set for LDAP terminus for #{self.name}\"\n end", "def authenticate (ldap)\n auth=ldap.authenticate \"cn=admin,dc=example,dc=com\",'123' \n puts \"***** authentication result *******\" \n puts ldap.get_operation_result \n end", "def before_filter; end", "def get_ldap_details(username)\n search_filter = Net::LDAP::Filter.eq(\"uid\", username)\n result = LDAP_CONNECTION.search(:filter => search_filter)\n puts result.inspect\nend", "def find_for_ldap_authentication(attributes={}, authenticator = EpiCas::LdapAuthenticator)\n authenticator.new(attributes, self).authenticate_ldap\n end", "def auth\n end", "def auth\n end", "def access_control\n \n end", "def ldap_secure\n @attributes[:ldap_secure]\n end", "def http_auth_login\n # FIXME: Implement\n end", "def check_ldap_user!\n msg = ::Portus::LDAP::Search.new.with_error_message(user_create_params[:username])\n return if msg.nil?\n\n Rails.logger.tagged(:ldap) { Rails.logger.debug msg }\n respond_to do |format|\n format.json { render json: { ldap: [msg] }, status: :unprocessable_entity }\n end\n end", "def ldap_username_field\n @attributes[:ldap_username_field]\n end", "def authenticate_depth\n super\n end", "def ldap_username\n @attributes[:ldap_username]\n end", "def search(basedn, scope, deref, filter)\n #raise LDAP::ResultError::UnwillingToPerform, \"Bad base DN\" unless basedn == BASEDN\n #raise LDAP::ResultError::UnwillingToPerform, \"Bad filter\" unless filter[0..1] == [:eq, \"uid\"]\n uid = filter[3]\n @@pool.borrow do |sql|\n q = \"select login_id,passwd from #{TABLE} where login='#{sql.quote(uid)}'\"\n puts \"SQL Query #{sql.object_id}: #{q}\" if $debug\n res = sql.query(q)\n res.each do |login_id,passwd|\n @@cache.add(login_id, passwd)\n send_SearchResultEntry(\"id=#{login_id},#{BASEDN}\", {\n \"maildir\"=>[\"/netapp/#{uid}/\"],\n })\n end\n end\n end", "def populateLDAP\n return unless Rails.env.production?\n #quit if no email or netid to work with\n self.email ||= ''\n return if !self.email.include?('@yale.edu') && !self.netid\n\n begin\n ldap = Net::LDAP.new( :host =>\"directory.yale.edu\" , :port =>\"389\" )\n\n #set e filter, use netid, then email\n if !self.netid.blank? #netid\n f = Net::LDAP::Filter.eq('uid', self.netid)\n else\n f = Net::LDAP::Filter.eq('mail', self.email)\n end\n\n b = 'ou=People,o=yale.edu'\n p = ldap.search(:base => b, :filter => f, :return_result => true).first\n\n rescue Exception => e\n guessFromEmail\n end\n\n return unless p\n\n self.netid = ( p['uid'] ? p['uid'][0] : '' )\n self.fname = ( p['knownAs'] ? p['knownAs'][0] : '' )\n self.fname ||= ( p['givenname'] ? p['givenname'][0] : '' )\n self.lname = ( p['sn'] ? p['sn'][0] : '' )\n self.email = ( p['mail'] ? p['mail'][0] : '' )\n self.year = ( p['class'] ? p['class'][0].to_i : 0 )\n self.college = ( p['college'] ? p['college'][0] : '' )\n\n # Don't save the model, because they are going to be shown a form to edit info\n # self.save!\n end", "def auth(value); end", "def redirects; end", "def wldap32\n client.railgun.wldap32\n end", "def devise_mappings; end", "def call(env)\n auth = Ldap::Request.new(env)\n return unauthorized unless auth.provided?\n return bad_request unless auth.basic?\n\n if valid?(auth)\n env['REMOTE_USER'] = auth.username\n return @app.call(env)\n end\n unauthorized\n end", "def populateLDAP\n \n #quit if no email or netid to work with\n return if !self.netid\n \n ldap = Net::LDAP.new(host: 'directory.yale.edu', port: 389)\n b = 'ou=People,o=yale.edu'\n f = Net::LDAP::Filter.eq('uid', self.netid)\n a = %w(givenname sn mail knownAs class college)\n\n p = ldap.search(base: b, filter: f, attributes: a).first\n \n\n\n self.fname = ( p['knownAs'] ? p['knownAs'][0] : '' )\n if self.fname.blank?\n self.fname = ( p['givenname'] ? p['givenname'][0] : '' )\n end\n self.lname = ( p['sn'] ? p['sn'][0] : '' )\n self.email = ( p['mail'] ? p['mail'][0] : '' )\n self.year = ( p['class'] ? p['class'][0].to_i : 0 )\n self.college = ( p['college'] ? p['college'][0] : '' )\n self.save!\n end", "def index\n #redirect_to(:action => 'signup') unless logged_in? || Person.count > 0\n @people = Person.find(:all)\n @users = Ldapuser.find(:all)\n @groups = LdapGroup.find(:all)\n #@group = LdapGroup.find(\"1046\")\n end", "def search_base_distinguished_name\n super\n end", "def lookup_context; end", "def lookup_context; end", "def lookup_context; end", "def index_redirect(**opt, &blk)\n opt[:user] = find_user(opt[:user] || current_user)\n opt[:dst] = opt[:user]&.org ? :list_org : :list_all\n super(**opt, &blk)\n end", "def authenticate_active_admin_user\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n send(active_admin_namespace.authentication_method) if active_admin_namespace.authentication_method\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n end", "def preprocess_username\n @username = @options[:ldap][:username_prefix] + @username if @options[:ldap][:username_prefix]\n end", "def auth_methods; end", "def redirect_after_signup &blk\n self.lwt_authentication_system_options[:redirect_after_signup] = blk\n end", "def auth(username,password)\n user = User.first(:username => username)\n\n if user and user.auth_type == \"Local\"\n usern = User.authenticate(username,password)\n\n if usern\n # TODO : This needs an expiration, session fixation\n @del_session = Sessions.first(:username => \"#{usern}\")\n @del_session.destroy if @del_session\n @curr_session = Sessions.create(:username => \"#{usern}\",:session_key => \"#{session[:session_id]}\")\n @curr_session.save\n return @curr_session.session_key\n end\n elsif user\n if options.ldap\n #try AD authentication\n usern = username\n if usern == \"\" or password == \"\"\n return \"\"\n end\n\n user = \"#{options.domain}\\\\#{username}\"\n ldap = Net::LDAP.new :host => \"#{options.dc}\", :port => 636, :encryption => :simple_tls, :auth => {:method => :simple, :username => user, :password => password}\n\n if ldap.bind\n # replace the session in the session table\n @del_session = Sessions.first(:username => \"#{usern}\")\n @del_session.destroy if @del_session\n @curr_session = Sessions.create(:username => \"#{usern}\",:session_key => \"#{session[:session_id]}\")\n @curr_session.save\n return @curr_session.session_key\n end\n end\n end\n return \"\"\nend", "def ldap_attr(attr_name)\n Devise::LDAP::Adapter.get_ldap_param(login, attr_name).first\n rescue NoMethodError\n # return blank when ldap does not have the desired attribute.\n logger.warn \"LDAP attribute '#{attr_name}' not found for '#{login}'\"\n ''\n end", "def before_each(req)\n if dealership(req).nil? then not_found\n elsif !authenticated?(req) then unauthenticated\n elsif !authorized?(role(req), session_user(req)) then unauthorized\n else super\n end\n end", "def ldap?\n !!ldap\n end", "def authenticate_scope!\n super\n end", "def fill_from_ldap\n person = self.ldap_person\n if person.nil?\n if Rails.development?\n self.name = \"Susan #{self.login}\"\n self.email = \"beehive+#{self.login}@berkeley.edu\"\n self.major_code = 'undeclared'\n self.user_type = case self.login\n when 212388, 232588\n User::Types::Grad\n when 212381, 300846, 300847, 300848, 300849, 300850\n User::Types::Undergrad\n when 212386, 322587, 322588, 322589, 322590\n User::Types::Faculty\n when 212387, 322583, 322584, 322585, 322586\n User::Types::Staff\n else\n User::Types::Affiliate\n end\n return true\n else\n self.name = 'Unknown Name'\n self.email = ''\n self.major_code = ''\n self.user_type = User::Types::Affiliate\n return false\n end\n else\n self.name = \"#{person.firstname} #{person.lastname}\".titleize\n self.email = person.email\n self.major_code = person.berkeleyEduStuMajorName.to_s.downcase\n self.user_type = case\n when person.berkeleyEduStuUGCode == 'G'\n User::Types::Grad\n when person.student?\n User::Types::Undergrad\n when person.employee_academic?\n User::Types::Faculty\n when person.employee?\n User::Types::Staff\n else\n User::Types::Affiliate\n end\n return true\n end\n end", "def bind_by_username_with_preauthentication\n raise CASServer::AuthenticatorError, \"A password must be specified in the configuration for the authenticator user!\" unless\n @options[:ldap][:auth_password]\n\n @ldap.authenticate(@options[:ldap][:auth_user], @options[:ldap][:auth_password])\n\n @ldap.bind_as(:base => @options[:ldap][:base], :password => @password, :filter => user_filter)\n end", "def login_attribute\n super\n end", "def capable_login_auth?; end", "def ldap_authorize!(error)\n if signed_in? == false\n store_location\n store_errors \"authorized required, please login to continue\"\n redirect(\"#{error}\")\n else\n return true\n end\n end", "def initialize(app, options = {}, &block)\n super(app, options[:name] || :ldap, options.dup, &block)\n @name_proc = (@options.delete(:name_proc) || Proc.new {|name| name})\n @adaptor = OmniAuth::Strategies::LDAP::Adaptor.new(options)\n end", "def corp_lookup\n\n basedn = \"cn=users,dc=bigdatalab,dc=ibm,dc=com\"\n scope = Net::LDAP::SearchScope_WholeSubtree\n filter = \"(&(objectClass=person)(!(objectClass=computer))(!(userAccountControl:1.2.840.113556.1.4.803:=2)))\"\n attrs = ['sAMAccountName','mail','pwdLastSet']\n skip_accounts = ['CORP$']\n\n ldap = Net::LDAP.new\n ldap.host = \"dc-0.bigdatalab.ibm.com\"\n ldap.port = \"389\"\n ldap.auth ENV['BIND_USER'], ENV['BIND_PASS']\n\n if !ldap.bind\n puts \"Problem with AD connection. Aborting!\"\n end\n \n ldap.search(:base => basedn, :scope => scope, :filter => filter, :attributes => attrs, :return_result => true) do |entry|\n if skip_accounts.include? entry.sAMAccountName.first.to_s\n next\n end\n\n begin\n acct = { \n :id => entry.sAMAccountName.first.to_s, \n :mail => entry.mail.first.to_s,\n :pwdays => 0,\n :notify => false,\n }\n rescue\n puts \"Caught exception: #{entry.inspect}\"\n end\n\n # Calculate the epoch time from windows time and get a number of days till expiration\n unix_time = (entry.pwdLastSet.first.to_i)/10000000-11644473600\n numDays = (unix_time + $maxPwAge - Time.now.to_i)/86400\n\n if numDays < 0\n acct[:pwdays] = numDays\n $accounts.push acct\n end\n\n end\nend", "def corp_lookup\n\n basedn = \"cn=users,dc=bigdatalab,dc=ibm,dc=com\"\n scope = Net::LDAP::SearchScope_WholeSubtree\n filter = \"(&(objectClass=person)(!(objectClass=computer))(!(userAccountControl:1.2.840.113556.1.4.803:=2)))\"\n attrs = ['sAMAccountName','mail','pwdLastSet']\n\n ldap = Net::LDAP.new\n ldap.host = \"dc-0.bigdatalab.ibm.com\"\n ldap.port = \"389\"\n ldap.auth ENV['BIND_USER'], ENV['BIND_PASS']\n\n if !ldap.bind\n puts \"Problem with AD connection. Aborting!\"\n end\n \n ldap.search(:base => basedn, :scope => scope, :filter => filter, :attributes => attrs, :return_result => true) do |entry|\n\n acct = { \n :id => entry.sAMAccountName.first.to_s, \n :pwdays => 0,\n :notify => false,\n }\n\n if entry.respond_to? :mail\n acct[:mail] = entry.mail.first.to_s\n else\n acct[:mail] = \"[email protected]\"\n end\n\n # Calculate the epoch time from windows time and get a number of days till expiration\n unix_time = (entry.pwdLastSet.first.to_i)/10000000-11644473600\n numDays = (unix_time + $maxPwAge - Time.now.to_i)/86400\n\n if numDays < 0\n next # These passwords have already expired.\n end\n\n # Send a notice 14, 7, 3, 2 and 1 days before expiration\n if [14, 7, 3, 2, 1].include? numDays\n acct[:notify] = true\n acct[:pwDays] = numDays\n end\n\n $accounts.push acct\n end\nend", "def common_authenticate(user_name)\n user = User.find_by_ldap_id(user_name)\n if user.nil?\n user = User.new\n user.ldap_id = user_name\n user.save!\n end\n session[:user_id] = user.id\n end", "def initialize(model, database_id = nil, &block)\n super\n instance_eval(&block) if block_given?\n\n @name ||= 'ldap'\n end", "def authenticated?; super; end", "def authentication_method\n super\n end", "def get_data(login,from)\n ### USER ###\n # acces to user fields\n user_data = User.find_by_login(login)\n # cas_id field of user table\n # cas_id = user_data.cas_id\ncas_id = 1 \n ### CAS ###\n # acces to cas fields\n cas_data = Cas.find_by_id(cas_id)\n # field field of cas table\n ldap_name = cas_data.ldap\n \n ## LDAP ##\n # acces to ldap field\n ldap_data = AuthSourceLdap.find_by_name(ldap_name)\n \n \n # Composition de requête\n auth = {\n :method => :simple,\n :username => ldap_data.account,\n :password => ldap_data.account_password\n }\n \n ldap_req = Net::LDAP::new :host => ldap_data.host, :port => ldap_data.port , :auth => auth\n filter = Net::LDAP::Filter.eq(ldap_data.attr_login, login)\n # Teacher\n labo = Net::LDAP::Filter.construct(ldap_data.filter)\n real_filter = filter & labo\n \n # Informatin to gather from\n attributes = ['givenName', 'sn', 'mail', 'auaStatut', 'eduPersonAffiliation','auaEtapeMillesime', 'supannAffectation']\n \n # CASE\n entry = case from \n when \"staff\" then ldap_req.search(:base => ldap_data.base_dn, :filter => real_filter)\n when \"onthefly\" then ldap_req.search( :base => ldap_data.base_dn, :filter => filter, :attributes => attributes ).first\n end\n # Return\n return entry\n end", "def after_database_authentication; end", "def index\n if !params[:ldap_search].nil?\n begin\n params[:per_page] = 30\n users = User.ldap_search(params[:ldap_search])\n @users = WillPaginate::Collection.create(params[:page] || 1, params[:per_page]) do |pager|\n pager.replace(users)\n pager.total_entries = @total_entries\n end\n #@users = users.paginate :page => params[:page] || 1, :per_page => 10\n rescue Net::LDAP::LdapError => exc\n flash[:notice] = \"LDAP Error: #{exc.message}\"\n end\n end\n respond_to do |format|\n format.html\n format.xml { head :ok }\n end\n end", "def before_dispatch(env); end", "def ldappassword\n\n$HOST = ''\n$PORT = LDAP::LDAP_PORT\n$SSLPORT = LDAP::LDAPS_PORT\nbase = 'dc=, dc='\nldapadmin = 'cn=, dc=, dc='\nldapadminpass = ''\nscope = LDAP::LDAP_SCOPE_SUBTREE\nattrs = ['sn', 'cn']\n\n#hash the password for ldap change\ne_password = \"{SHA}\" + Base64.encode64(Digest::SHA1.digest(@newpasswd)).chomp\n\nconn = LDAP::Conn.new($HOST, $PORT)\nreset = [\n LDAP.mod(LDAP::LDAP_MOD_REPLACE, \"userPassword\", [e_password]),\n]\n\n conn.bind(ldapadmin,ldapadminpass)\n begin\n conn.search(base, scope, \"uid=#{@authex.username}\", attrs) { |entry|\n $USERDN = entry.dn\n }\n rescue LDAP::ResultError\n conn.perror(\"search\")\n exit\n end\n\n begin\n conn.modify(\"#{$USERDN}\", reset)\n puts $USERDN\n rescue LDAP::ResultError => msg\n puts \"Can't change password: \" + msg\n exit 0\n rescue LDAP::Error => errcode\n puts \"Can't change password: \" + LDAP.err2string(errcode)\n exit 0\n end\n\n\n\nend", "def initialize(ldap_config)\n @ldap = Net::LDAP.new host: ldap_config['host'], port: ldap_config['port']\n @attributes_to_import = %w(uid sn givenname mail title objectclass)\n @tree_base = ldap_config['treebase']\n\n # Used to log information\n @people_saved = 0\n @picture_uploaded = 0\n end", "def auth_trap_state\n super\n end", "def forest_accept\n forest_get_form_vars\n no_changes = true\n if @ldap_info[:ldaphost] == \"\"\n add_flash(_(\"LDAP Host is required\"), :error)\n no_changes = false\n elsif @edit[:new][:authentication][:user_proxies].blank? || @edit[:new][:authentication][:user_proxies][0].blank? # if adding forest first time, delete a blank record\n @edit[:new][:authentication][:user_proxies].delete_at(0)\n else\n @edit[:new][:authentication][:user_proxies].each do |f|\n # check to make sure ldaphost already doesn't exist and ignore if existing record is being edited.\n next unless f[:ldaphost] == @ldap_info[:ldaphost] && session[:entry] == 'new'\n no_changes = false\n add_flash(_(\"LDAP Host should be unique\"), :error)\n break\n end\n end\n if no_changes\n if session[:entry] == \"new\"\n @edit[:new][:authentication][:user_proxies].push(@ldap_info)\n else\n @edit[:new][:authentication][:user_proxies].each_with_index do |f, i|\n @edit[:new][:authentication][:user_proxies][i] = @ldap_info if f[:ldaphost] == session[:entry][:ldaphost]\n end\n end\n end\n @changed = (@edit[:new] != @edit[:current])\n render :update do |page|\n page << javascript_prologue\n page << javascript_for_miq_button_visibility(@changed)\n page.replace(\"flash_msg_div\", :partial => \"layouts/flash_msg\")\n page.replace(\"forest_entries_div\", :partial => \"ldap_forest_entries\", :locals => {:entry => nil, :edit => false}) if no_changes\n end\n end", "def show\n ldap = Net::LDAP.new\n @user = @server.users.all#(user_params)\n \n end", "def ldap_domain\n @attributes[:ldap_domain]\n end", "def builtin!\n self.add(:local, Opscode::Authentication::Strategies::Local)\n self.add(:ldap, Opscode::Authentication::Strategies::LDAP)\n self\n end", "def handle_request( request, &block )\n\t\tself.log.debug \"[:auth] Wrapping request in auth with a %p\" % [ self.auth_provider ]\n\n\t\trequest.auth_provider = self.auth_provider\n\t\tself.authenticate_and_authorize( request )\n\n\t\tsuper\n\tend" ]
[ "0.6186267", "0.5959065", "0.5958466", "0.5910203", "0.5910203", "0.584688", "0.5830305", "0.57840824", "0.57649755", "0.57577115", "0.5751258", "0.5739085", "0.57167476", "0.57035655", "0.57015204", "0.5556366", "0.551688", "0.5500935", "0.5490689", "0.5452671", "0.5451868", "0.5440539", "0.54298425", "0.5418606", "0.5418606", "0.54083705", "0.54016596", "0.538723", "0.53681874", "0.5363964", "0.53624713", "0.5361238", "0.5360933", "0.5328018", "0.5327814", "0.5322436", "0.52948207", "0.528142", "0.52811784", "0.5255228", "0.52385014", "0.52296895", "0.5224694", "0.5220626", "0.5198706", "0.5198238", "0.5198238", "0.51881", "0.5186678", "0.51814955", "0.51703084", "0.516878", "0.5164245", "0.5160916", "0.51596725", "0.51560783", "0.5151157", "0.5149663", "0.51422656", "0.5137613", "0.51338905", "0.513321", "0.512103", "0.51164895", "0.5109952", "0.5109952", "0.5109952", "0.5100316", "0.50836223", "0.50761354", "0.50723803", "0.50651556", "0.50639343", "0.50567245", "0.505287", "0.5043638", "0.50423586", "0.50371563", "0.5036306", "0.50305116", "0.50162554", "0.5014722", "0.5012455", "0.49993157", "0.4992289", "0.49843508", "0.49823865", "0.4977122", "0.4967239", "0.496226", "0.4961745", "0.49570477", "0.4950528", "0.49493876", "0.4943909", "0.49436373", "0.4941641", "0.49332222", "0.4931659", "0.4928879", "0.49276367" ]
0.0
-1
Do not allocate extra space for another array, you must do this by modifying the input array inplace with O(1) extra memory. Example 1: Given nums = [1,1,2], Your function should return length = 2, with the first two elements of nums being 1 and 2 respectively. It doesn't matter what you leave beyond the returned length. Example 2: Given nums = [0,0,1,1,1,2,2,3,3,4], Your function should return length = 5, with the first five elements of nums being modified to 0, 1, 2, 3, and 4 respectively. It doesn't matter what values are set beyond the returned length.
def remove_duplicates(nums) return 0 if nums.length === 0 curr_idx = 0 j = 0 val = nums[j] while curr_idx < nums.length curr_val = nums[curr_idx] if curr_val === val curr_idx += 1 next else val = curr_val j += 1 nums[j] = curr_val end end j + 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def length_finder(array)\n num_array = []\n array.each do |i|\n num_array.insert(-1,i.length)\n end\n return num_array\nend", "def length_finder(array)\n iterator = 0\n new_array = []\n while iterator < array.length\n new_array << array[iterator].length\n iterator += 1\n end\n new_array\nend", "def length_finder(input_array)\n arr = []\n for i in 0...input_array.length\n arr << input_array[i].length\n end\n arr\nend", "def using_size(array)\n array.size\nend", "def using_size(array)\n array.size\nend", "def arrLength(arr)\n return arr.length\nend", "def array_length(array)\n array.length\nend", "def using_size(array)\n size_of_array=array.size\nend", "def length_finder(input_array)\n input_array.map { |elem| elem.size }\nend", "def length_finder(input_array)\n input_array.map(&:length)\nend", "def length_of_array (array)\n array.size\nend", "def length_of_array(array)\n array.length\nend", "def using_size(array)\narray.size\nend", "def remove_duplicates(nums)\n \n return nums.length if nums.length <= 2\n prevNum = nums[0]\n i = 1\n arrLength = 1\n dupCount = 1\n while i<nums.length do\n if nums[i] == prevNum && dupCount < 2\n dupCount = dupCount + 1\n arrLength = arrLength + 1\n elsif nums[i] != prevNum\n prevNum = nums[i]\n dupCount = 1\n arrLength = arrLength + 1\n end\n i = i + 1\n end\n \n puts(arrLength)\n \nend", "def length_of_array(array)\n return array.length\nend", "def pad!(array, min_size, value = nil) #destructive\n difference = min_size - array.length\n #array.length #the variable len = array.length\n if difference > 0\n # puts positive amount of difference into array through default value\n difference.times { |x| array.push value }\n end\n return array\nend", "def get_length(arr)\n arr.flatten(2).count\nend", "def pad!(array, min_size, value = nil) #non-destructive\n # Your code here\n array_length = array.length\n array2 = array\n\n if array_length < min_size\n\n while array_length < min_size do\n array2.push(value)\n array_length +=1\n end\n end\n return array2\nend", "def get_length(array)\n return array.inject (0) { |length, el| length + 1 }\nend", "def check_array(nums)\n temp = nums[0];\n\tnums[0] = nums[nums.length-1];\n\tnums[nums.length-1] = temp;\n\treturn nums;\nend", "def pad!(array, min_size, value = nil) #destructive\n solution_array = []\n if min_size <= array.length\n #p array\n return array\n elsif min_size > array.length\n solution_array = array\n times_to_pad = min_size - array.length\n #p times_to_pad\n times_to_pad.times do\n solution_array << value\n #p solution_array\n end\n end\n return solution_array\nend", "def length(array)\n array_length = 0\n while array[array_length] != nil\n array_length += 1\n end\n return array_length # raise NotImplementedError\nend", "def length_finder(input_array)\n #input_array.map { |s| s.length }\n input_array.map(&:length)\nend", "def twist length\n # Compute the subset of the list\n sub = (0...length).map do |i|\n @list[(@position + i) % @list.size]\n end\n\n # Replace the subset with its reverse\n sub.reverse.each_with_index do |el, i|\n @list[(@position + i) % @list.size] = el\n end\n\n @position = (@position + length + @skip_size) % @list.size\n @skip_size += 1\n end", "def length(array)\n length = 0\n while !(array[length].nil?)\n length += 1\n end\n return length\n # raise NotImplementedError\nend", "def pad!(array, min_size, value=nil) #destructive\n if min_size == 0 || array.length >= min_size\n return array\n else (min_size - array.length).times { |array, x| array << value.to_i } \n return array\n end\nend", "def pad!(array, min_size, value = nil) #destructive\n if array.count >= min_size\n return array\n else\n (min_size - array.count).times do\n array << value\n end\n return array\n end\nend", "def pad!(array, min_size, value = nil) #destructive\n # Your code here\n difference = min_size - array.length\n if difference <= 0\n return array\n else\n difference.times do\n array.push(value)\n end\n end\n\n return array\nend", "def pad!(array, min_size, value = nil) #destructive\n size = array.length\n if min_size > size\n additions = min_size - size\n additions.times do\n array.push(value)\n end\n end\n # Your code here\n return array\nend", "def pad!(array, min_size, value = nil) #destructive\n if array.length < min_size\n (min_size - array.length).times { array.push(value) }\n end\n return array\nend", "def length_of_lis(nums)\n return 0 if nums.length < 1\n lis(nums, nums.length - 1)\nend", "def length_of_lis(nums)\n return 0 if nums.length < 1\n lis(nums, nums.length - 1)\nend", "def length_of_lis(nums)\n return 0 if nums.length < 1\n lis(nums, nums.length - 1)\nend", "def pad!(array, min_size, value = nil) #destructive\n difference = (min_size - array.length)\n difference.times {\n array << value}\n return array\nend", "def double_arr(nums)\n numb_arr = [] # create empty arr\n i = 0 # the indice counter start @ 0\n\n while i < nums.length # for the length of indices in array \n new_num = nums[i] * 2 # variable new_num = looped var i * 2\n numb_arr << new_num # shovel the value of new_num into empty arr\n i += 1 # iterate into next indice of passed array\n end\n return numb_arr # the new array\n puts numb_arr # display the result of the new array\nend", "def array_length(array)\n\treturn array.length\nend", "def lengths (arr)\n return arr.map!{|word| word.length}\nend", "def length(array)\n array.rindex(array[-1]) + 1\nend", "def remove_duplicates(nums)\n nums.uniq!\n return nums.length\nend", "def pad!(array, min_size, value = nil) #destructive\n # Your code here\n if array.length < min_size\n x = min_size - array.length\n x.times do array << value\n end\n end\n return array\nend", "def pad!(array, min_size, value = nil) #destructive\n if min_size <= array.length \n return array\n else \n x = min_size - array.length\n x.times do\n array.push(value)\n end\n return array\n end\nend", "def remove_duplicates(nums)\n counter = 0\n original_length = nums.length\n\n (1...nums.length).each do |i|\n if nums[i-1] == nums[i]\n counter += 1\n else\n nums[i-counter] = nums[i]\n end\n end\n\n return original_length - counter\nend", "def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n end\n # refactor for a cooler method than while loop\n # use an index for looping\n i = array.length\n while i < min_size\n array.push value\n i += 1\n end\n array\nend", "def pad!(array, min_size, value = nil) #destructive\n # Your code here\n return array if min_size <= array.length\n while min_size > array.length\n array.push(value)\n end\n array\nend", "def pad!(array, min_size, value = nil) #destructive\n i = min_size - array.length\n\n i.times {array.push(value)} if array.length < min_size\n array\nend", "def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n else\n difference = min_size - array.length\n for i in 1..difference\n array.push(value)\n end\n end\n return array\nend", "def length_finder(input_array)\n\toutput_array = input_array.map{ |string| string.length}\nend", "def pad!(array, min_size, value = nil) #destructive\r\n (array.length..min_size - 1).each { |i| array[i] = value}\r\n array\r\nend", "def length_finder(input_array)\n result=Array.new\n input_array.each do |string|\n result << string.length\n end\n return result\nend", "def length(array)\n index = 0\n while array[index] != nil\n index += 1\n end\n return index\nend", "def pad!(array, min_size, value = nil) #destructive\n # Your code here\n if array.length >= min_size \n \treturn array\n else \n \t(min_size-array.length).times do\n \t\tarray.push(value)\n \tend\n \treturn array\n end\nend", "def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n else\n pad_size = min_size - array.length\n counter = 0\n while counter < pad_size\n array << value\n counter+=1\n end\n return array\n end\nend", "def length(array)\n raise NotImplementedError\nend", "def pad!(array, min_size, value = nil) #destructive\n # Your code here\n return array if min_size <= array.length\n while min_size > array.length\n \tarray.push(value)\n end\n array\nend", "def pad!(array, min_size, value = nil) #destructive\n if min_size < array.length || min_size == array.length \n return array\n else \n x = min_size - array.length\n x.times do\n array.push(value)\n end\n return array\n end\nend", "def pad(array, min_size, value = nil) #non-destructive\n \n new_array = [].concat(array)\n # array.each { |el| new_array << el } \n \n difference = min_size - array.length\n #array.length #the variable len = array.length\n if difference > 0\n # puts positive amount of difference into array through default value\n difference.times { |el| new_array << value }\n end\n \n \n return new_array\n \nend", "def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n else\n diff = min_size - array.length\n diff.times do\n array << value\n end\n return array\n end\nend", "def pad!(array, min_size, value = nil) #destructive\r\n\treturn array << value if array.length <= min_size\r\n\treturn array\r\n # #size_difference = min_size - array.length\r\n # (min_size - array.length).times do\r\n # array << value\r\n # end \r\n # array\r\nend", "def pad!(array, min_size, value = nil) #destructive\n while min_size > array.length\n array.push(value)\n end\n array\nend", "def pad!(array, min_size, value = nil) #destructive\n # Your code here\n if array.length >= min_size\n return array\n else\n padding = min_size - array.length\n padding.times do |x|\n array.push(value)\n end\n end\n return array\nend", "def length_of_lis(nums)\n len = []\n (0...nums.size).map { |i|\n len[i] = (0...i)\n .select { |j| nums[j] < nums[i] }\n .map { |j| len[j] + 1 }.max || 1\n }.max || 0\nend", "def split_array(array, number)\n size = number\n \nend", "def pad!(array, min_size, value = nil) #destructive\n # Your code here\n array_size = array.count\n if min_size > array_size\n \tfor i in 0...(min_size - array_size)\n \t\tarray.push(value)\n \tend\n \treturn array\n else\n \treturn array\n end\nend", "def get_length(arr)\n $index = 0\n def reroute(arr)\n arr.each do |entry| # bad because if array then the remaining numbers will not be counted but works\n if entry.class != Array \n $index += 1\n else \n reroute(entry)\n end\n end \n end\n reroute(arr)\n return $index\nend", "def %(len) # {{{\n inject([]) do |array, x|\n # array << [] if [*array.last].nitems % len == 0\n array << [] if [*array.last].count{|x| !x.nil?} % len == 0\n array.last << x\n array\n end\n end", "def pad!(array, min_size, value = nil) #destructive\r\n # Your code here\r\n if array.length >= min_size \r\n return array\r\n else \r\n until array.length == min_size\r\n array.push value\r\n end\r\n return array\r\n end\r\nend", "def pad!(array, min_size, value = nil) #destructive\r\n iter = min_size - array.length\r\n if min_size <= array.length\r\n return array\r\n else\r\n iter.times {array << value}\r\n end\r\n return array\r\nend", "def pad!(array, min_size, value = nil) #destructive\n # Your code here\n if min_size > array.length\n array << value\n return array\n else\n return array\n end\nend", "def pad!(array, min_size, value = nil) #destructive\n # Your code here\n if array.length >= min_size \n return array\n else \n until array.length == min_size\n array.push value\n end\n return array\n end\nend", "def pad!(array, min_size, value = nil) #destructive\n if array.length - min_size < 0\n difference = array.length - min_size\n difference = difference.abs\n for i in 0..difference - 1\n array.push(value)\n end\n end\n return array\nend", "def pad(array, min_size, value=nil) #non-destructive\n# Your code here\n\n new_array = array.clone #sets the new array the same value of array but with a different object id essentially not affecting the original array\n\nif min_size > array.length\n until new_array.length == min_size\n new_array.push(value)\n #we are pushing to the new_array\n end\nend\n\n new_array\nend", "def pad!(array, min_size, value = nil) #destructive\n array << value while min_size > array.length\n array\nend", "def pad!(array, min_size, value = nil) #destructive\n pad_size(array, min_size).times { array.push(value) }\n return array\nend", "def pad!(array, min_size, value = nil) #destructive\n while array.length < min_size\n array.push(value)\n end\n array\nend", "def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n end\n until min_size <= array.length\n array << value\n end\n array\nend", "def sort_by_length(arr)\n arr\nend", "def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n else\n for i in array.length...min_size\n array[i] = value\n end\n end\nend", "def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n else\n while array.length < min_size\n array.push(value)\n end\n return array\n end\nend", "def pad!(array, min_size, value = nil) #destructive\n diff = min_size - array.length\n times = 0 if diff < 0\n diff.times do\n array << value\n end\n array\nend", "def pad!(array, min_size, value = nil)\n while array.length < min_size\n array.push(value)\n end\n return array\nend", "def pad!(array, min_size, value = nil)\n while array.length < min_size\n array.push(value)\n end\n return array\nend", "def pad!(array, min_size, value = nil)\n while array.length < min_size\n array.push(value)\n end\n return array\nend", "def pad!(array, min_size, value = nil)\n while array.length < min_size\n array.push(value)\n end\n return array\nend", "def pad!(array, min_size, value = nil) #destructive\n\n if array.length >= min_size\n return array\n else\n array.push(value) until array.length == min_size\n end\n array\nend", "def pad!(array, min_size, value = nil) #destructive\n while array.length < min_size\n array << value\n end\n return array\nend", "def pad!(array, min_size, value = nil) #destructive\n # Your code here\n if array.length < min_size\n while array.length < min_size\n array << value\n end\n end\n return array\nend", "def pad(array, min_size, value = nil) #non - destructive\n array_modified = []\n if min_size <= array_modified.length\n array_modified = array.map { |x| x }\n elsif min_size == 0\n array_modified = array.map { |x| x }\n else\n array_modified = array.map { |x| x }\n (min_size - array_modified.length).times {\n array_modified.push(value)\n }\n return array_modified\n end\nend", "def oddities(array)\n count = 0\n new_array = []\n loop do\n break if array.size == 0\n new_array << array[count]\n count += 2\n break if count >= array.size\n end\n new_array\nend", "def add_array_lengths(array1,array2)\n return array1.length+array2.length\nend", "def pad!(array, min_size, value = nil) #destructive\n array_size = array.size\n until array_size >= min_size\n array << value\n array_size += 1\n end\n return array\nend", "def find_length(array)\n \n array.map {|elem| elem.length}\n \nend", "def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n else\n index = array.length\n while index < min_size\n array[index] = value\n index += 1\n end\n end\n return array\nend", "def remove_duplicates(nums)\n record_leng = 0\n uniq_arr = nums.uniq\n uniq_arr.each do |i|\n record_leng += 1 if count_great_two?(nums, i)\n end\n return (record_leng + uniq_arr.size)\nend", "def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n end\n if min_size > array.length\n remainder = min_size - array.length\n remainder.times do array << value\n end\n end\n p array\nend", "def pad!(array, min_size, value = nil) #destructive\n array << value while array.length < min_size\n array\nend", "def pad!(array, min_size, value = nil) #destructive\n difference = min_size - array.length\n if min_size <= array.length\n p array\n elsif min_size == 0\n p array\n elsif min_size > 0\n difference.times do |x|\n array.push(value) \n end\n end\n p array\nend", "def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n else\n diff = min_size - array.length\n while diff > 0\n array.push(value)\n diff -= 1\n end\n return array\n end\nend", "def pad!(array, min_size, value = nil) #destructive\n array.keep_if{ |a| a <= array.length}\n difference = min_size - array.length\n counter = 0\n while counter < difference\n array << value\n counter += 1\n end\n p array\n # self = ans_array\nreturn array\nend", "def length(array)\n array_length = 0\n 20.times do |i|\n if array[i] != nil\n array_length += 1\n elsif array[i] == nil\n break\n end\n end\n return array_length\n # raise NotImplementedError\nend", "def pad!(array, min_size, value = nil)\n while array.length < min_size\n array.push(value)\n end\n array\nend", "def pad!(array, min_size, value = nil) #destructive\n if array.length < min_size\n for i in 1..(min_size - array.length)\n array << value\n end\n end\n return array\nend" ]
[ "0.7248774", "0.6878875", "0.6851354", "0.6750325", "0.6750325", "0.66892046", "0.66438293", "0.6611813", "0.6553832", "0.65508866", "0.65190154", "0.65007913", "0.6474407", "0.6430764", "0.64295167", "0.6425059", "0.6394124", "0.63471335", "0.63398707", "0.63231087", "0.62936985", "0.6289122", "0.6282058", "0.6246545", "0.6238523", "0.62235653", "0.6198808", "0.61862916", "0.6180003", "0.61709106", "0.61323", "0.61323", "0.61323", "0.6123902", "0.6123794", "0.6121873", "0.61210734", "0.61112857", "0.6107315", "0.6105318", "0.60838014", "0.608142", "0.6077605", "0.6069891", "0.6068428", "0.6068058", "0.6065808", "0.60607755", "0.60600233", "0.60589445", "0.60582936", "0.60581034", "0.6056357", "0.6053864", "0.6053038", "0.60529727", "0.60404485", "0.6040113", "0.6033513", "0.6030561", "0.6028391", "0.6027645", "0.6020948", "0.6017239", "0.601443", "0.60023487", "0.6001155", "0.59985775", "0.5992073", "0.5990381", "0.5985844", "0.59825927", "0.598225", "0.5976837", "0.59742427", "0.59730786", "0.5972826", "0.5972815", "0.59724176", "0.59712064", "0.59712064", "0.59712064", "0.59712064", "0.5969356", "0.59629947", "0.5957705", "0.5956939", "0.59564304", "0.5954774", "0.59521884", "0.5943661", "0.594366", "0.59399015", "0.59381497", "0.5937181", "0.5929127", "0.59280497", "0.59239334", "0.59129596", "0.5909263", "0.59074587" ]
0.0
-1
Write a method that doubles each element in an array
def doubler(array) array.map { |num| num * 2 } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_doubles(arr)\n arr.map {|a|a*2}\n\nend", "def double_array(array)\n array*2\nend", "def calculate_doubles!(array)\n\t\n\tarray.map! { |num| num * 2}\nend", "def calculate_doubles(arr)\n array = []\n arr.each {|x| array << x + x}\n array\n\nend", "def calculate_doubles!(arr)\n\n arr.map! {|x| x + x}\n arr\n\nend", "def calculate_doubles(arr)\n doubled_array = []\n arr.each {|int| doubled_array.push(int * 2)}\n doubled_array\nend", "def calculate_doubles!(arr)\n arr.map! {|int| int * 2}\nend", "def double_all array\n array.map { |i| i*2 }\nend", "def double_all(arr)\n doubles = []\n\n arr.each do |num|\n doubles.push(num * 2)\n end\n\n doubles\nend", "def map(arr)\n i = 0\n # Double each item in the array and replace values.\n arr.each do |item|\n arr[i] = double(item)\n i += 1\n end\n # Return the new doubled array.\n # This is the result of the map function.\n return arr\nend", "def double_array(arr)\n doubled_arr = arr.map do | element| \n element *2 \n end\n doubled_arr\nend", "def double_array(array)\n\tn = [1, 2, 3]\n\tn * 2\nend", "def map_to_double(source_array)\n \n i = 0\n new_array = []\n \n while i < source_array.length do\n new_array_value = source_array[i] * 2\n new_array << new_array_value\n \n i += 1\n end\n \n new_array\nend", "def double_array(array)\n output_array = []\n\n array.each do |thing|\n output_array << thing * 2\n end\n\n return output_array\nend", "def double_array(input_array)\n \n double_array = []\n \n input_array.each do |number|\n double_array << number *= 2\n end\n return double_array\n\nend", "def calculate_doubles(array)\n\tmapped_array = array.map { |num| num * 2 }\nend", "def double_eles(arr)\n arr.map do |ele|\n ele * 2\n end\nend", "def map_to_double(source_array)\n array = []\n index = 0 \n \n while index < source_array.size do \n array.push(source_array[index] * 2)\n index += 1 \n end\n return array\nend", "def calculate_doubles!(arr)\n arr.map!{|a|a=a*2}\nend", "def map_to_double(array)\n new_array = array.map{|n| n*2}\n return new_array\nend", "def double_array(array)\n # your code here\nend", "def multiply_element(array)\n array.each do |x|\n x=x*x\n end\n end", "def double_numbers(array)\n\tarray.map { |integer| integer * 2 }\t\nend", "def double_numbers(array)\n new_array = []\n\n array.each do |number|\n new_array << number *= 2\n end\n return new_array\nend", "def double_numbers(input_array)\n doubled_array =[]\n input_array.each {|num| doubled_array << num*2} \n doubled_array\nend", "def double_it(numbers)\n numbers.map{|number| number * 2}\nend", "def double_numbers(array)\n doubled_numbers = []\n array.each do |number|\n doubled_numbers << number * 2\n end\n return doubled_numbers\nend", "def double_numbers!(numbers)\n counter = 0\n\n loop do\n break if counter == numbers.size\n\n numbers[counter] *= 2\n\n counter += 1\n end\n numbers\nend", "def double_each\n numbers = [1,2,3,4,5]\n doubled = []\n numbers.each do |number|\n doubled << number * 2\n end\n doubled\nend", "def square_array(array)\n array.map do |element|\n element ** 2 \n end\nend", "def doubler(array)\r\n res = []\r\n array.each do |ele|\r\n res << ele * 2\r\n end\r\n res\r\nend", "def multiply_by(array)\n return array.map { |el| el * 3}\nend", "def square_array(array)\n array.map! { |ele| ele ** 2 }\nend", "def double_it(numbers)\n numbers.map { |x| x * 2 }\nend", "def doubler(array)\n array.map do |num|\n num *= 2\n end\n\nend", "def double(*numbers)\n numbers.each do |x|\n puts x * 2\n end\nend", "def compute_squares(array)\n arrayFinal = []\n array.each do |element|\n arrayFinal << element * element\n end\n return arrayFinal\nend", "def multiply_by_two(array)\n # double_numbers = []\n # array.each do |number|\n # double_numbers << number * 2\n # end\n # double_numbers\n array.map { |number| number * 2 }\nend", "def double_it(numbers)\n numbers.map do |x|\n x * 2\n end\nend", "def multiply(array,mult)\n array.map{|num| num*mult}\nend", "def square_array(array)\n array.collect {|num| num * num}\n \nend", "def multiply(arr)\n arr.map { |i| i * 2 }\nend", "def double_numbers!(numbers)\n\n counter = 0\n loop do\n break if counter >= numbers.length\n numbers[counter] *= 2\n counter += 1\n end\n numbers # not really necessary, but good to have\n end", "def multiply_els(array)\n\tarray.inject(1) { |num, item| num * item }\n\nend", "def square_array(array)\n new_array = []\n array.each { |e| new_array << e ** 2 }\n new_array\nend", "def multiply_me(array, int)\r\n\r\n arr = [] # empty array created\r\n\r\n i = 0 # iteration starts to multiply each item\r\n while i < array.length\r\n arr << array[i] * int # products collected\r\n i += 1\r\n end\r\n\r\n arr # result\r\nend", "def square_array(array)\n array.each_with_index do | num, index |\n array[index] = num * num\n end\nend", "def double_numbers!(numbers)\n counter = 0\n\n loop do\n break if counter == numbers.size\n\n current_number = numbers[counter]\n numbers[counter] = current_number * 2\n\n counter += 1\n end\n\n numbers\nend", "def multiply(array)\n array.inject(:*)\nend", "def multiply_all_by(array, num)\n\n result = []\n array.each do |elem|\n result << elem * num\n end\n result\nend", "def custom_multiply(array, number)\n # Return a new array with the array that's passed in\n # as an argument multiplied by the number argument\n result = []\n number.times { array.each { |elem| result << elem } }\n result\nend", "def mult5 array\n array.map do |value| \n value * 5 \n end\nend", "def square_array(array)\n squared = []\n array.each { |element| squared << element ** 2 }\n squared\nend", "def multiply_els(arr)\n\tarr.my_inject(1) do |res, i| \n\t\tres * i \n\tend\nend", "def map_to_square(source_array)\n \n i = 0\n new_array = []\n \n while i < source_array.length do\n new_array_value = source_array[i] ** 2\n new_array << new_array_value\n \n i += 1\n end\n \n new_array\nend", "def element_times_index(numbers)\n\tfor i in 0..numbers.length-1\n numbers[i] *= i\n end\n return numbers\nend", "def square_array(array)\n # Use an Enumerable to square every element in the passed in array\n # Return a new array of the results\n array.map do |n|\n n*n\nend\nend", "def multiply_els(array)\n array.my_inject(:*)\nend", "def multiply_els(array)\n array.my_inject(:*)\nend", "def multiply_els(array)\n array.my_inject(:*)\nend", "def square_array_2(array)\n array.collect { |i| i**2 }\n array\nend", "def square_array(array)\n new_array = []\n array.each{|a| new_array.push(a*a)}\n return new_array\nend", "def basic_9 (array_iterate)\n square_array = array_iterate.collect { |n| n * n}\n return square_array\nend", "def multiply (array)\n\tarray.inject(1) do |result, element|\n\t\tresult * element\n\tend\nend", "def custom_multiply(array, number)\n result = []\n number.times { array.each { |element| result << element}}\n result\nend", "def square_array(some_array)\n some_array.collect {|num| num*num} \nend", "def square_array (array)\n\nnewarray = []\n\narray.each do |element|\n newarray.push(element**2) \nend\n\nnewarray\n\nend", "def square_array(array)\narray.map { |to_square| to_square**2}\nend", "def array_times_two(array)\nend", "def multiply *array\n puts array.inspect\n array.flatten.inject(:*)\n end", "def square_array(some_array)\n array_squared = []\n some_array.each do |item|\n array_squared << item*item\nend\n return array_squared\nend", "def multiply_each (array, product=1)\n array.each do |x|\n product *= x\n end\n return product\nend", "def double_array(array)\n array + array\nend", "def square_each_w_obj(array)\n array.each_with_object([]) { |elem, new_arr| new_arr << elem ** 2 }\nend", "def multiply_els(array)\n array.my_inject { |item, next_item| item * next_item }\nend", "def multiply_by(num,arr)\n arr.map do |x|\n x * num\n end\nend", "def array_times_two!(array)\nend", "def compute_squares(arr)\r\n\r\n # empty array created\r\n compute_squares = []\r\n\r\n # iterate using each loop method\r\n arr.each {|el| compute_squares << el**2}\r\n\r\n # returns result\r\n compute_squares\r\nend", "def multiply_els(arr)\n # multiplies all the elements of the array together by using my_inject\n return arr.my_inject(:*)\nend", "def multiply_els(arr)\n # multiplies all the elements of the array together by using my_inject\n return arr.my_inject(:*)\nend", "def multiply_els(array)\n array.my_inject(1) { |product, i| product * i }\nend", "def square!\n\t\tself.each_with_index do |elem, i|\n\t\t\tself[i] = elem * elem\n\t\tend\n\tend", "def doubler(numbers)\n\tdoubled_nums = [] # Creates empty array to store double nums\n\n\ti = 0\n\twhile i < numbers.length\n\t\told_elem = numbers[i] # Creates temporary variable to hold number for each iteration\n\t\tnew_elem = old_elem * 2 # Multiplies old element by two and saves to new variable\n\t\tdoubled_nums << new_elem\n\n\t\ti += 1 # Iterates upwards\n\tend\n\n\treturn doubled_nums\nend", "def square_array(array)\nnew_array = []\ncounter = 0\nwhile counter < array.length do\n new_array << array[counter] ** 2 #**squaring incrments\ncounter += 1 #increments plus 1 after squaring elements\nend\nreturn new_array #can also just write new_array without the retun before it \nend", "def arr_product(arr)\n product = arr.reduce(:*)\n arr.map { |el| product / el }\nend", "def square_array(some_array)\n some_array.map {|number| number ** 2}\nend", "def multiply_els(arr)\n arr.my_inject(1) { |total, x| total * x }\nend", "def square_array(array)\n\n squared = []\n array.each do |num|\n squared.push(num * num)\n end\n\n squared\n \nend", "def square_array(array)\n numbers = []\n array.each do |number| numbers << number ** 2\n end\n numbers\nend", "def productify(array)\n\nend", "def product_method(array)\n array.reduce(:*)\nend", "def multiply_els(arr)\n arr.my_inject(:*)\nend", "def multiply_els(arr)\n arr.my_inject(:*)\nend", "def multiply_els(arr)\n arr.my_inject(:*)\nend", "def multiply_els(arr)\n arr.my_inject(:*)\nend", "def multiply_by_two(array)\n array.map { |n| n * 2 }\nend", "def custom_multiply(array,number)\n new_array = []\n number.times {new_array+=array}\n return new_array\nend", "def square_the_values(array_of_integers)\n # TODO\nend", "def multiply_els(arr)\n arr.my_inject('*')\nend" ]
[ "0.78794396", "0.78159004", "0.77839226", "0.76714575", "0.765855", "0.7657117", "0.7644488", "0.76381516", "0.752618", "0.7505966", "0.7437052", "0.7436159", "0.73710144", "0.73264545", "0.7319353", "0.72939056", "0.72790027", "0.71698576", "0.7146905", "0.71308154", "0.7123097", "0.70777196", "0.7060148", "0.70392704", "0.70264167", "0.7015946", "0.69897926", "0.6911196", "0.6888785", "0.68585086", "0.68531436", "0.68466", "0.6830676", "0.6812816", "0.67940974", "0.67513067", "0.67246217", "0.6718992", "0.6715786", "0.671428", "0.6710194", "0.6699846", "0.6683939", "0.6664514", "0.66598153", "0.6650685", "0.6624821", "0.6618922", "0.6611243", "0.6596234", "0.658429", "0.6569447", "0.6555348", "0.6549834", "0.654726", "0.6545955", "0.65400374", "0.6529568", "0.6529568", "0.6529568", "0.652559", "0.65244716", "0.6523987", "0.6507413", "0.64965117", "0.64930564", "0.6490834", "0.6488611", "0.6480231", "0.6473903", "0.6473378", "0.64682716", "0.6461222", "0.6458172", "0.64440054", "0.64407617", "0.6434629", "0.6428322", "0.6425826", "0.6425826", "0.6422866", "0.6422811", "0.6404576", "0.64029723", "0.6400805", "0.6388864", "0.6386995", "0.63832355", "0.63719815", "0.63691807", "0.636368", "0.6361367", "0.6361367", "0.6361367", "0.6361367", "0.63602537", "0.6358592", "0.63508993", "0.6335566" ]
0.6521323
64
Given a grade_hash and assignment number, return all scores for that assignment. Note that Ruby counts arrays from 0, but we are referring to them as 110.
def assignment_scores(grade_hash, assignment_num) grade_hash.map do |student, marks| marks[assignment_num - 1] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assignment_scores(grade_hash, assignment_num)\n a = []\n grade_hash.values.each { |name| a.push(name[assignment_num - 1]) }\n a\nend", "def assignment_scores(grade_hash, assignment_num)\n outArray = []\n grade_hash.each do |key, value|\n outArray.push(value[assignment_num-1])\n\n end\n return outArray\nend", "def assignment_scores(grade_hash, assignment_num)\n grade_hash.map {|key, value| value[assignment_num - 1]}\nend", "def assignment_scores(grade_hash, assignment_num)\n grade_hash.values.transpose[assignment_num - 1]\nend", "def assignment_scores(grade_hash, assignment_num)\n grade_hash.map do |key, value|\n value[assignment_num - 1]\n end\nend", "def assignment_scores(grade_hash, assignment_num)\n grade_hash.map do |key, value|\n grade_hash[key][assignment_num - 1]\n end\nend", "def assignment_scores(grade_hash, assignment_num)\n grade_hash.map do |key, value|\n value [assignment_num - 1]\n end\nend", "def assignment_scores(grade_hash, assignment_num)\n grade_hash.map do | key, value |\n value[assignment_num - 1]\n end\nend", "def assignment_scores(grade_hash, assignment_num)\n grade_hash.map {|x| x[1][assignment_num-1]}\nend", "def assignment_average_score(grade_hash, assignment_num)\n grade_hash\n .map {|key, value| value[assignment_num - 1]}\n .reduce(:+) / grade_hash.length\nend", "def assignment_average_score(grade_hash, assignment_num)\n sum, n = 0, 0\n grade_hash.each do |k,v|\n n += 1\n sum += v[assignment_num-1]\n end\n return sum/n\nend", "def assignment_average_score(grade_hash, assignment_num)\n grade_hash\n .map { |key, value| value[assignment_num -1] }\n .reduce(:+) / grade_hash.length\nend", "def assignment_average_score(grade_hash, assignment_num)\n assignment = grade_hash.map do |key, value|\n value[assignment_num - 1]\n end\n\n sum = assignment.reduce do |sum, x|\n sum += x\n end\n\n sum / assignment.length\nend", "def assignment_average_score(grade_hash, assignment_num)\n assignment_score = grade_hash.map do |key, value|\n value [assignment_num - 1]\n end\n total = assignment_score.reduce do |total, grade|\n total += grade\n end\n total / assignment_score.length\nend", "def assignment_scores(grade_hash, assignment_score)\n # Loop through the grade_hash\n grade_hash.map do |key, value|\n value[assignment_score - 1]\n end\nend", "def assignment_average_score(grade_hash, assignment_num)\n a = []\n grade_hash.values.each { |dude| a.push(dude[assignment_num - 1]) }\n sum = a.sum\n average = sum/a.length\nend", "def assignment_average_score(grade_hash, assignment_num)\n sum = 0\n grade_hash.each do |key, value|\n sum += grade_hash[key][assignment_num - 1]\n end\n average = sum / grade_hash.length\nend", "def assignment_average_score(grade_hash, assignment_score)\n sum = 0\n grade_hash.each do |key, value|\n sum += value[assignment_score - 1]\n end\n average = sum / grade_hash.keys.length\n average\nend", "def assignment_average_score(grade_hash, assignment_num)\n assignment = grade_hash.map {|x| x[1][assignment_num-1]}\n average = assignment.reduce{|x,n| x += n}/assignment.length\nend", "def assignment_average_score(grade_hash, assignment_num)\n (grade_hash.values.transpose[assignment_num - 1].reduce { |acc, num| acc + num }.to_f / 10).floor\nend", "def assignment_average_score(grade_hash, assignment_num)\n marks = assignment_scores(grade_hash, assignment_num)\n marks.sum / marks.length\nend", "def assignment_score(grade_hash, student, assignment_num)\n score = grade_hash[student][assignment_num - 1]\nend", "def assignment_average_score(data, assignment)\n all_scores = data.values.map do |scores|\n scores[assignment - 1]\n end\n (all_scores.sum)/(all_scores.length)\nend", "def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num - 1]\nend", "def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num - 1]\nend", "def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num - 1]\nend", "def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num - 1]\nend", "def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num - 1]\nend", "def assignment_score(grade_hash, name, assignment_number)\n grade_hash[name][assignment_number - 1]\nend", "def assignment_scores(data, assignment)\n data.values.map { |scores| scores[assignment-1] }\nend", "def assignment_score(grade_hash, student, assignment_num)\n return grade_hash[student][assignment_num-1]\nend", "def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num-1]\nend", "def percentage_grades_array(assignment)\n groupings = assignment.groupings\n .joins(:tas)\n .where(memberships: { user_id: id })\n grades = []\n\n if assignment.assign_graders_to_criteria\n criteria_ids = self.criterion_ta_associations.where(assessment_id: assignment.id).pluck(:criterion_id)\n out_of = criteria_ids.sum do |criterion_id|\n Criterion.find(criterion_id).max_mark\n end\n return [] if out_of.zero?\n\n mark_data = groupings.joins(current_result: :marks)\n .where('marks.criterion_id': criteria_ids)\n .where.not('marks.mark': nil)\n .pluck('results.id', 'marks.mark')\n .group_by { |x| x[0] }\n mark_data.values.each do |marks|\n next if marks.empty?\n\n subtotal = 0\n has_mark = false\n marks.each do |_, mark|\n subtotal += mark\n has_mark = true\n end\n grades << subtotal / out_of * 100 if has_mark\n end\n else\n out_of = assignment.max_mark\n groupings.includes(:current_result).find_each do |grouping|\n result = grouping.current_result\n unless result.nil? || result.total_mark.nil? || result.marking_state != Result::MARKING_STATES[:complete]\n percent = calculate_total_percent(result, out_of)\n unless percent == BLANK_MARK\n grades << percent\n end\n end\n end\n end\n grades\n end", "def percentage_grades_array(assignment)\n grades = Array.new()\n out_of = assignment.max_mark\n assignment.groupings.includes(:current_result).joins(:tas)\n .where(memberships: { user_id: id }).find_each do |grouping|\n result = grouping.current_result\n unless result.nil? || result.total_mark.nil? || result.marking_state != Result::MARKING_STATES[:complete]\n percent = calculate_total_percent(result, out_of)\n unless percent == BLANK_MARK\n grades.push(percent)\n end\n end\n end\n\n return grades\n end", "def assignment_score(grade_hash, student, assignment_num)\ngrade_hash[student][assignment_num - 1]\n\n# student = grade_hash[student.to_sym]\n# array_value = assignment_num - 1\n# student[array_value]\nend", "def class_average(grade_hash)\n sum, n = 0, 0\n grade_hash.each do |k,array|\n array.each do |grade|\n n += 1\n sum += grade\n end\n end\n return sum/n\nend", "def final_letter_grades(grade_hash)\n letter_grade_array = grade_hash.map do |key, value|\n average = value.sum / value.length\n letter_grade = letter_grade(average)\n [key, letter_grade]\n end\n letter_grade_array.to_h\nend", "def final_letter_grades(grade_hash)\n averages(grade_hash)\n .transform_values{ |scores| letter_grade(scores)}\nend", "def getLetScoreArr(scoreHash,nameArray)\n\t#init scored array\n\tscored=[]\n\t#for each name\n\tfor name in nameArray \n\t\t#init/reset temp score to 0\n\t\ttempscore = 0\n\t\t#split name to chars\n\t\tname.split(\"\").each do |i|\n\t\t\t#add score of each char to tempscore\n\t\t\ttempscore += scoreHash[i]+1 \n\t\tend\n\t\t#add this name's tempscore to the scored array\n\t\tscored << tempscore\n\tend\n\t#return scored array\n\treturn scored\nend", "def averages(grade_hash)\n\n averages = grade_hash.map do |key, value|\n total = 1\n sum = grade_hash[key].reduce do |sum, grade|\n total += 1\n sum += grade\n end\n avg = sum / total\n [key, avg]\n end\n\n averages.to_h\nend", "def averages(grade_hash)\n grade_hash.transform_values{|v| v.inject(:+)/v.length}\n # hash = {}\n # grade_hash.map do |name, grades|\n # score = 0\n # grades.each do |grade|\n # score += grade\n # end\n # average = score/grades.length\n # hash[name] = average\n # end\n # hash\n # sum = 0\n # grade_hash.each { |x| sum += x }\n # average = sum/grade_hash.length\nend", "def top_students(grade_hash, number_of_students)\n outArray = []\n grade_hash.each do |name, scores|\n sum, n = 0, 0\n scores.each do |x|\n n += 1\n sum += x\n end\n outArray.push([sum/n, name])\n end\n final_answer = []\n outArray.sort.reverse[0...number_of_students].each do |grade,name|\n final_answer.push(name)\n end\n return final_answer\nend", "def final_letter_grades(grade_hash)\n averages(grade_hash).transform_values{ |num| letter_grade(num) }\nend", "def final_letter_grades(grade_hash)\n averages(grade_hash).transform_values {|nums| nums = letter_grade(nums)}\nend", "def averages(grade_hash)\n grade_hash\n .transform_values { |scores| scores.reduce(:+) / scores.length }\nend", "def final_letter_grades(grade_hash)\n averages = grade_hash.inject({}) { |h, (k,v)| h[k] = letter_grade(v.reduce{|x,n| x += n}/v.length) ; h}\nend", "def averages(grade_hash)\n grade_hash.transform_values{|nums| nums.reduce(:+) / nums.size}\nend", "def class_average(grade_hash)\n sum = 0\n grade_hash.values.each { |student| student.each {|grades| sum += grades }}\n average = sum/(grade_hash.length**2)\nend", "def final_letter_grades(grade_hash)\n averages = averages(grade_hash)\n\n final_grades = averages.map do |key, value|\n [key, letter_grade(value)]\n end\n\n final_grades.to_h\nend", "def final_letter_grades(grade_hash)\n letter_grade averages grade_hash\nend", "def class_average(grade_hash) \n sum = 0\n students = grade_hash.keys.length\n scores = grade_hash.values.length\n total_scores = students * scores\n grade_hash.each do |key, value|\n sum += value.reduce(:+)\n end\n average = sum / total_scores\n average\nend", "def top_students(grade_hash, number_of_students)\n # Loop through hash\n top_students_array = grade_hash.map do |key, value|\n # find average for each student\n average = value.sum / value.length\n # put into array of key, score\n [key, average]\n end\n puts top_students_array\n # turn into hash\n top_students_hash = top_students_array.to_h\n # sort hash\n top_students_sorted = top_students_hash.sort_by do |a, b| \n -b\n end\n # map keys\n sorted_student_array = top_students_sorted.map do |key, value|\n key\n end\n # return top student names in array\n result = sorted_student_array.take(number_of_students)\n result\nend", "def final_letter_grades(grade_hash)\n averages(grade_hash).transform_values{ |marks| letter_grade(marks)}\nend", "def averages(grade_hash)\n grade_hash.transform_values {|nums| nums.reduce(:+)/nums.size}\nend", "def averages(grade_hash)\n grade_hash.transform_values{ |num| num.reduce(:+) / num.length }\nend", "def averages(grade_hash)\n grade_hash.transform_values { |marks| marks.inject {|sum, n| sum + n } / marks.length }\nend", "def grade_distribution_array(assignment, intervals = 20)\n data = percentage_grades_array(assignment)\n data.extend(Histogram)\n histogram = data.histogram(intervals, :min => 1, :max => 100, :bin_boundary => :min, :bin_width => 100 / intervals)\n distribution = histogram.fetch(1)\n distribution[0] = distribution.first + data.count{ |x| x < 1 }\n distribution[-1] = distribution.last + data.count{ |x| x > 100 }\n\n return distribution\n end", "def grade_distribution_array(assignment, intervals = 20)\n data = percentage_grades_array(assignment)\n data.extend(Histogram)\n histogram = data.histogram(intervals, :min => 1, :max => 100, :bin_boundary => :min, :bin_width => 100 / intervals)\n distribution = histogram.fetch(1)\n distribution[0] = distribution.first + data.count{ |x| x < 1 }\n distribution[-1] = distribution.last + data.count{ |x| x > 100 }\n\n return distribution\n end", "def assignment_score(data, name, assignment)\n data[name][assignment -1]\nend", "def averages(grade_hash)\n student_average_array = grade_hash.map do |key, value|\n average = value.sum / value.length\n [key, average]\n end\n student_average_array.to_h\nend", "def scores\n cells = self.concatenate_data_arrays(self.cell_key, 'cells')\n exp_values = self.concatenate_data_arrays(self.score_key, 'expression')\n Hash[cells.zip(exp_values)]\n end", "def class_average(grade_hash)\n scores = averages(grade_hash)\n result = 0\n scores.each {|k,v| result += v}\n result /= scores.length\nend", "def get_avggrades(hash)\n sumgrades = 0\n hash[:grades].each do |grade|\n if grade.to_s != 'A'\n sumgrades += grade.to_f\n else\n sumgrades +=1\n end\n end\n sumgrades / hash[:grades].length\nend", "def final_letter_grades(grade_hash)\n final_hash = {}\n new_hash = averages(grade_hash)\n new_hash.map do |name, average|\n letter = letter_grade(average)\n final_hash[name] = letter\n end\n final_hash\nend", "def class_average(grade_hash)\n class_array = grade_hash.map do |k,v|\n averages v\n end\n averages class_array\nend", "def top_students(grade_hash)\n averages(grade_hash)\n .to_a\n .sort_by { |student| -student[1] }\n .map { |student| student[0] }\nend", "def gradeDistribution( grades )\n # replace the following line with whatever gets a desired array of numerical grades\n gradeDistArray = { \"A\" => 0, \"B\" => 0, \"C\" => 0, \"D\" => 0, \"F\"=> 0 }\n gradeLetter = \"\"\n\n grades.each{ |grade| \n gradeLetter = getGradeLetter( grade )\n gradeDistArray[gradeLetter] += 1\n }\n return gradeDistArray\n end", "def class_average(grade_hash)\n averages = averages(grade_hash)\n sum = 0\n\n averages.map do |key, value|\n sum += value\n end\n\n sum / averages.length\nend", "def class_average(grade_hash)\n averages(grade_hash).map{|k, v| v}.inject {|sum, n| sum + n } / grade_hash.length\nend", "def average_assignment_score\n assignment_average_scores.inject(:+).to_f/num_assignments\n rescue ZeroDivisionError\n 0\n end", "def scores\n quiz_entries.collect { |qe| qe.score }\n end", "def grade_report\n array = []\n frm.table(:class=>\"listHier lines nolines\").rows.each do |row|\n next if row.td(:headers=>\"studentname\").exists? == false\n hash = {}\n hash[:student] = row.td(:headers=>\"\").text\n hash[:assignment] = row.td(:headers=>\"\").text\n hash[:grade] = row.td(:headers=>\"\").text\n hash[:scale] = row.td(:headers=>\"\").text\n hash[:submitted] = row.td(:headers=>\"\").text\n array << hash\n end\n array\n end", "def db_query_with_quiz_score(assignment_id, another_assignment_id = 0)\n\t\traw_data_array = Array.new\n\t\tassignment_ids = Array.new\n\t\tassignment_ids << assignment_id\n\t\tassignment_ids << another_assignment_id unless another_assignment_id == 0\n\t\tteams = AssignmentTeam.where(['parent_id in (?)', assignment_ids])\n\t\tteam_ids = Array.new\n\t\tteams.each{|team| team_ids << team.id }\n\t\tquiz_questionnnaires = QuizQuestionnaire.where(['instructor_id in (?)', team_ids])\n\t\tquiz_questionnnaire_ids = Array.new\n\t\tquiz_questionnnaires.each{|questionnaire| quiz_questionnnaire_ids << questionnaire.id }\n\t\tQuizResponseMap.where(['reviewed_object_id in (?)', quiz_questionnnaire_ids]).each do |response_map|\n\t\t\tquiz_score = response_map.quiz_score\n\t\t\tparticipant = Participant.find(response_map.reviewer_id)\n\t\t\traw_data_array << [participant.user_id, response_map.reviewee_id, quiz_score]\n\t\tend\n\t\traw_data_array\n\tend", "def grade\n @grades ||= case score\n when 10.0..100.0\n 16\n when 9.0..10.0\n 13\n when 8.5..9.0\n 12\n when 8.0..8.5\n 11\n when 7.5..8.0\n 10\n when 7.0..7.5\n 9\n when 6.5..7.0\n 8\n when 6.0..6.5\n 7\n when 5.5..6.0\n 6\n when 5.0..5.5\n 5\n else\n 4\n end\n end", "def results(marks)\n # your code here\n avg = (marks.reduce(:+) / (marks.length).to_f).round(3)\n\n scores = {\n \"h\"=> 0,\n \"a\"=> 0,\n \"l\"=> 0\n }\n\n marks.each do |i|\n if i > 8\n scores[\"h\"] += 1\n elsif i == 7 || i == 8\n scores[\"a\"] += 1\n else \n scores[\"l\"] += 1\n end\n end\n if scores[\"a\"] == 0 && scores[\"l\"] == 0\n result = [avg, scores, 'They did well']\n else\n result = [avg, scores]\n end\n result\nend", "def compute_avg_and_ranges_hash\n scores = {}\n contributors = self.contributors # assignment_teams\n if self.varying_rubrics_by_round?\n rounds = self.rounds_of_reviews\n for round in 1..rounds\n review_questionnaire_id = review_questionnaire_id(round)\n questions = Question.where(['questionnaire_id = ?', review_questionnaire_id])\n contributors.each do |contributor|\n assessments = ReviewResponseMap.get_assessments_for(contributor)\n assessments = assessments.reject {|assessment| assessment.round != round }\n scores[contributor.id] = {} if round == 1\n scores[contributor.id][round] = {}\n scores[contributor.id][round] = Answer.compute_scores(assessments, questions)\n end\n end\n else\n review_questionnaire_id = review_questionnaire_id()\n questions = Question.where(['questionnaire_id = ?', review_questionnaire_id])\n contributors.each do |contributor|\n assessments = ReviewResponseMap.get_assessments_for(contributor)\n scores[contributor.id] = {}\n scores[contributor.id] = Answer.compute_scores(assessments, questions)\n end\n end\n scores\n end", "def scores\n buckets = {bot: 0, twenty: 0, thirty: 0, forty: 0, fifty: 0, sixty: 0, seventy: 0, eighty: 0, top: 0 }\n y_axis = []\n\n scores = self.students.map do |student|\n if student.total_score.nil?\n 0\n else\n student.total_score.to_f / self.possible_points.to_f\n end\n end\n scores.sort!\n\n scores.each do |score|\n case score\n when 0.9..1.0\n buckets[:top] += 1\n when 0.8..0.899\n buckets[:eighty] += 1\n when 0.7..0.799\n buckets[:seventy] += 1\n when 0.6..0.699\n buckets[:sixty] += 1\n when 0.5..0.599\n buckets[:fifty] += 1\n when 0.4..0.499\n buckets[:forty] += 1\n when 0.3..0.399\n buckets[:thirty] += 1\n when 0.2..0.299\n buckets[:twenty] += 1\n else\n if score < 0.2\n buckets[:bot] += 1\n end\n end\n end\n buckets.each_value {|val| y_axis.push(val)}\n y_axis\n end", "def class_average(grade_hash)\n averages(grade_hash)\n .map {|key, value| value}\n .reduce(:+) / grade_hash.length\nend", "def view\n @assignment = Assignment.find(params[:id])\n @questions = Hash.new\n questionnaires = @assignment.questionnaires\n questionnaires.each {\n |questionnaire|\n @questions[questionnaire.symbol] = questionnaire.questions\n }\n\n @scores = @assignment.get_scores(@questions)\n end", "def class_average(grade_hash)\n averages(grade_hash).map { |key, value| value }\n .reduce(:+) / grade_hash.length\nend", "def all_cohorts (hash_value)\n total_students = hash_value.each_value.reduce(:+)\n puts total_students\nend", "def final_letter_grades(grade_hash)\n grade_hash.transform_values{|nums| letter_grade(nums.reduce(:+) / nums.length)}\nend", "def calculate_grade(course)\n assignments = course.assignments\n\n grades = []\n max_grades = []\n weightings = []\n\n assignments.each do |assignment|\n submission = assignment.submissions.find_by(student_id: id)\n max_grades.append(assignment.max_points)\n if submission == nil\n grades.append(0)\n weightings.append(0)\n next\n end\n grade = submission.grade\n date = submission.submitted_date\n\n if grade != nil\n grades.append(grade)\n weightings.append(assignment.weighting)\n elsif date == nil && Date.today >= assignment.due_date\n grades.append(0)\n weightings.append(assignment.weighting)\n elsif date != nil && date >= assignment.due_date\n grades.append(0)\n weightings.append(assignment.weighting)\n else\n grades.append(0)\n weightings.append(0)\n end\n end\n\n sum_grade = 0\n sum_weightings = 0\n\n grades.each_with_index do |grade,index|\n sum_grade += (grades[index].to_f/max_grades[index].to_f)*(weightings[index]*100)\n sum_weightings += weightings[index]*100\n end\n\n if sum_weightings == 0\n current_grade = -1\n else\n current_grade = ((sum_grade/sum_weightings)*100).floor\n end\n\n # Restrict out of bounds values to 0\n if current_grade < 0 || current_grade > 100\n current_grade = 0\n current_grade = current_grade.round(2)\n end\n\n # Return grade value\n return current_grade\n end", "def gradeAll( studentArr, keyString )\n grades = []\n studentArr.each { |studentString |\n grades.push( gradeStudent( studentString, keyString ) )\n }\n grades\n end", "def calculate_letter_grade(*scores) # the asterisk allows any number of arguments and puts them in an array\n if scores.length == 0\n return nil\n end\n average = scores.sum / scores.length\n letter_threshholds = {90 => \"A\", 80 => \"B\", 70 => \"C\", 60 => \"D\", 0 => \"F\"}\n letter_threshholds.each do |threshhold, grade|\n if average >= threshhold\n return grade\n end\n end\nend", "def map_grades\r\n (0..@length - 1).each do |x|\r\n @table[x]['Grade'] = @skill_table\\\r\n .find { |r, _v| r.cover?(@table[x]['Grade'].to_i) }[1]\r\n end\r\n end", "def get_scores(questions)\n scores = Hash.new\n scores[:team] = self # This doesn't appear to be used anywhere\n assignment.questionnaires.each do |questionnaire|\n scores[questionnaire.symbol] = Hash.new\n scores[questionnaire.symbol][:assessments] = Response.all(:joins => :map,\n :conditions => {:response_maps => {:reviewee_id => self.id, :type => 'TeamReviewResponseMap'}})\n scores[questionnaire.symbol][:scores] = Score.compute_scores(scores[questionnaire.symbol][:assessments], questions[questionnaire.symbol]) \n end\n scores[:total_score] = assignment.compute_total_score(scores)\n return scores\n end", "def get_scores(questions)\n scores = Hash.new\n scores[:team] = self # This doesn't appear to be used anywhere\n assignment.questionnaires.each do |questionnaire|\n scores[questionnaire.symbol] = Hash.new\n scores[questionnaire.symbol][:assessments] = Response.all(:joins => :map,\n :conditions => {:response_maps => {:reviewee_id => self.id, :type => 'TeamReviewResponseMap'}})\n scores[questionnaire.symbol][:scores] = Score.compute_scores(scores[questionnaire.symbol][:assessments], questions[questionnaire.symbol]) \n end\n scores[:total_score] = assignment.compute_total_score(scores)\n return scores\n end", "def get_overall_grades files\n total_files = 0\n grade_count = {'A'=>0, 'B'=>0, 'C'=>0, 'D'=>0, 'F'=>0}\n files.each do |f|\n total_files += 1\n if f[1]['grade'] >= 3.5 and f[1]['grade'] <= 4.0\n grade_count['A'] += 1\n elsif f[1]['grade'] >= 2.5 and f[1]['grade'] < 3.5\n grade_count['B'] += 1\n elsif f[1]['grade'] >= 1.5 and f[1]['grade'] < 2.5\n grade_count['C'] += 1\n elsif f[1]['grade'] >= 0.5 and f[1]['grade'] < 1.5\n grade_count['D'] += 1\n elsif f[1]['grade'] >= 0 and f[1]['grade'] < 0.5\n grade_count['F'] += 1\n end\n end\n grade_count.each do |g|\n grade_count[g[0]] = ((g[1]/total_files.to_f) * 100).round(2)\n end\n return grade_count\n end", "def get_scores(questions)\n scores = Hash.new\n scores[:team] = self # This doesn't appear to be used anywhere\n assignment.questionnaires.each do |questionnaire|\n scores[questionnaire.symbol] = Hash.new\n scores[questionnaire.symbol][:assessments] = Response.all(:joins => :map,\n :conditions => {:response_maps => {:reviewee_id => self.id, :type => 'TeamReviewResponseMap'}})\n scores[questionnaire.symbol][:scores] = Score.compute_scores(scores[questionnaire.symbol][:assessments], questions[questionnaire.symbol])\n end\n scores[:total_score] = assignment.compute_total_score(scores)\n return scores\n end", "def grade(grade)\n @roster[grade].map do |element|\n element\n end\n end", "def class_average(grade_hash)\n averages(grade_hash).values.reduce(:+) / grade_hash.length\nend", "def class_average(grade_hash)\n averages(grade_hash).values.reduce(:+)/grade_hash.size\nend", "def gradeAVG(scores)\n sum = 0\n scores.each do |grade|\n sum += grade\n end\n average = sum / (scores.length)\n return average\nend", "def get_grade scores\n average = 0\n scores.each do |num|\n if num < 0 || num > 100\n p \"Please input a list of valid scores (0-100).\"\n else\n average += num\n end\n end\n average /= scores.length\n if average >= 90\n \"A\"\n elsif average >= 80\n \"B\"\n elsif average >= 70\n \"C\"\n elsif average >= 60\n \"D\"\n else\n \"F\"\n end\nend", "def average_reviews_parameters_and_student_experience_vs_assignments(assignments_for_graph)\n avg_num_of_reviews_data =[]\n avg_review_score_data =[]\n avg_token_count_data = []\n avg_fb_score_data = []\n assignment_names=[]\n index = 0\n assignments_for_graph.each do |assignment|\n\n #get_average_num_of_reviews fetches the average number of reviews across the given response types for a given assignment\n num_of_reviews = assignment.get_average_num_of_reviews([\"TeamReviewResponseMap\",\"ParticipantReviewResponseMap\",\"ReviewResponseMap\"])\n avg_num_of_reviews_data[index] = num_of_reviews\n\n #get_average_score_with_type fetches the average score provided for the reviews of given response type for an assignment\n avg_score = assignment.get_average_score_with_type([\"TeamReviewResponseMap\",\"ParticipantReviewResponseMap\",\"ReviewResponseMap\"])\n avg_review_score_data[index] = avg_score\n\n comments = assignment.get_review_comments([\"TeamReviewResponseMap\",\"ParticipantReviewResponseMap\",\"ReviewResponseMap\"])\n avg_token_count_data[index] = assignment.average_tokens(comments)\n\n #fetches the average score for feedback on reviews performed on reviews for the given assignment.\n avg_fb_score = assignment.get_average_score_with_type([\"FeedbackResponseMap\"])\n avg_fb_score_data[index] = avg_fb_score\n\n assignment_names[index]=assignment.name\n\n index = index+1\n end\n [avg_num_of_reviews_data,avg_review_score_data,avg_token_count_data, avg_fb_score_data, assignment_names]\n end", "def get_grade(score1, score2, score3)\n\n grade_rules = {\n (90..100).to_a => \"A\",\n (80..89).to_a => \"B\",\n (70..79).to_a => \"C\",\n (60..69).to_a => \"D\",\n (0..59).to_a => \"F\"\n }\n\n mean_score = (score1 + score2 + score3) / 3\n\n grade_rules.select { |key, value| key.include?(mean_score) }.values.join\nend", "def get_grade(arr)\n\tfinal = 0\n\tarr.each{ |score| final += score}\n\tgrade = final / arr.length\n\tcase grade\n\t\twhen 90..100 then 'A'\n\t\twhen 80..90 then 'B'\n\t\twhen 70..80 then 'C'\n\t\twhen 60..70 then 'D'\n\t\twhen 0..60 then 'F'\n\tend\nend", "def get_average assignment_num\n assignment = Assignment.find_by(number: assignment_num)\n actual_attachments = assignment.corrections\n\n if assignment.finished_mandatory_stages?\n average = 0\n size = 0\n actual_attachments.each do |a|\n if (a.score != -1) \n average += a.score\n size += 1\n end\n end\n\n average = (average/size).round(2)\n return average\n end\n end", "def top_students(grade_hash, number_of_students)\n grade_hash.transform_values{|score| score.reduce(0,:+)/(score.length)}.sort_by {|student,score| score}.reverse.to_h.keys.first(number_of_students)\nend" ]
[ "0.83151335", "0.8272983", "0.814126", "0.80909526", "0.80310076", "0.80189383", "0.800149", "0.7969273", "0.7937633", "0.76114005", "0.76109165", "0.7594158", "0.7568089", "0.756527", "0.75648314", "0.7538011", "0.75132674", "0.7344956", "0.7310454", "0.7274471", "0.7274285", "0.72178847", "0.7101932", "0.70417374", "0.70417374", "0.70417374", "0.70417374", "0.70417374", "0.7041082", "0.6989717", "0.69355917", "0.69098794", "0.6615988", "0.6604569", "0.6603057", "0.6420085", "0.6384351", "0.6370513", "0.63165", "0.62730414", "0.6269951", "0.62666106", "0.6245324", "0.6196349", "0.6192558", "0.6191973", "0.6190477", "0.6160962", "0.61540425", "0.61310303", "0.61261934", "0.6120315", "0.6112168", "0.6111023", "0.6104444", "0.61040664", "0.6088331", "0.6088331", "0.60519254", "0.6049275", "0.59962785", "0.59593", "0.59454054", "0.59365433", "0.5907642", "0.5891451", "0.589033", "0.58848125", "0.5860462", "0.5820723", "0.5808432", "0.5797826", "0.5789657", "0.5770591", "0.5739739", "0.57388645", "0.57328594", "0.57207716", "0.57164395", "0.57130516", "0.5682138", "0.56752485", "0.5671922", "0.5647579", "0.5639228", "0.5630627", "0.5622188", "0.5622188", "0.56112343", "0.56084514", "0.556538", "0.5564173", "0.55419236", "0.5522349", "0.55138224", "0.5487624", "0.5486477", "0.5481893", "0.5474035", "0.5466606" ]
0.760292
11
Given a grade_hash and assignment number, return the average score for that assignment. Note that Ruby counts arrays from 0, but we are referring to them as 110.
def assignment_average_score(grade_hash, assignment_num) marks = assignment_scores(grade_hash, assignment_num) marks.sum / marks.length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assignment_average_score(grade_hash, assignment_num)\n assignment = grade_hash.map do |key, value|\n value[assignment_num - 1]\n end\n\n sum = assignment.reduce do |sum, x|\n sum += x\n end\n\n sum / assignment.length\nend", "def assignment_average_score(grade_hash, assignment_num)\n a = []\n grade_hash.values.each { |dude| a.push(dude[assignment_num - 1]) }\n sum = a.sum\n average = sum/a.length\nend", "def assignment_average_score(grade_hash, assignment_num)\n assignment_score = grade_hash.map do |key, value|\n value [assignment_num - 1]\n end\n total = assignment_score.reduce do |total, grade|\n total += grade\n end\n total / assignment_score.length\nend", "def assignment_average_score(grade_hash, assignment_num)\n assignment = grade_hash.map {|x| x[1][assignment_num-1]}\n average = assignment.reduce{|x,n| x += n}/assignment.length\nend", "def assignment_average_score(grade_hash, assignment_num)\n sum = 0\n grade_hash.each do |key, value|\n sum += grade_hash[key][assignment_num - 1]\n end\n average = sum / grade_hash.length\nend", "def assignment_average_score(grade_hash, assignment_num)\n grade_hash\n .map {|key, value| value[assignment_num - 1]}\n .reduce(:+) / grade_hash.length\nend", "def assignment_average_score(grade_hash, assignment_num)\n grade_hash\n .map { |key, value| value[assignment_num -1] }\n .reduce(:+) / grade_hash.length\nend", "def assignment_average_score(grade_hash, assignment_score)\n sum = 0\n grade_hash.each do |key, value|\n sum += value[assignment_score - 1]\n end\n average = sum / grade_hash.keys.length\n average\nend", "def assignment_average_score(grade_hash, assignment_num)\n sum, n = 0, 0\n grade_hash.each do |k,v|\n n += 1\n sum += v[assignment_num-1]\n end\n return sum/n\nend", "def assignment_average_score(grade_hash, assignment_num)\n (grade_hash.values.transpose[assignment_num - 1].reduce { |acc, num| acc + num }.to_f / 10).floor\nend", "def assignment_average_score(data, assignment)\n all_scores = data.values.map do |scores|\n scores[assignment - 1]\n end\n (all_scores.sum)/(all_scores.length)\nend", "def average_assignment_score\n assignment_average_scores.inject(:+).to_f/num_assignments\n rescue ZeroDivisionError\n 0\n end", "def assignment_score(grade_hash, student, assignment_num)\n score = grade_hash[student][assignment_num - 1]\nend", "def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num - 1]\nend", "def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num - 1]\nend", "def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num - 1]\nend", "def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num - 1]\nend", "def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num - 1]\nend", "def assignment_scores(grade_hash, assignment_num)\n grade_hash.map {|key, value| value[assignment_num - 1]}\nend", "def assignment_scores(grade_hash, assignment_num)\n a = []\n grade_hash.values.each { |name| a.push(name[assignment_num - 1]) }\n a\nend", "def get_average assignment_num\n assignment = Assignment.find_by(number: assignment_num)\n actual_attachments = assignment.corrections\n\n if assignment.finished_mandatory_stages?\n average = 0\n size = 0\n actual_attachments.each do |a|\n if (a.score != -1) \n average += a.score\n size += 1\n end\n end\n\n average = (average/size).round(2)\n return average\n end\n end", "def assignment_score(grade_hash, name, assignment_number)\n grade_hash[name][assignment_number - 1]\nend", "def assignment_scores(grade_hash, assignment_num)\n grade_hash.map do |key, value|\n grade_hash[key][assignment_num - 1]\n end\nend", "def assignment_score(grade_hash, student, assignment_num)\n return grade_hash[student][assignment_num-1]\nend", "def assignment_scores(grade_hash, assignment_num)\n grade_hash.map do |key, value|\n value[assignment_num - 1]\n end\nend", "def assignment_scores(grade_hash, assignment_num)\n grade_hash.map do | key, value |\n value[assignment_num - 1]\n end\nend", "def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num-1]\nend", "def assignment_scores(grade_hash, assignment_num)\n grade_hash.map do |key, value|\n value [assignment_num - 1]\n end\nend", "def assignment_scores(grade_hash, assignment_num)\n grade_hash.values.transpose[assignment_num - 1]\nend", "def averages(grade_hash)\n grade_hash.transform_values{|v| v.inject(:+)/v.length}\n # hash = {}\n # grade_hash.map do |name, grades|\n # score = 0\n # grades.each do |grade|\n # score += grade\n # end\n # average = score/grades.length\n # hash[name] = average\n # end\n # hash\n # sum = 0\n # grade_hash.each { |x| sum += x }\n # average = sum/grade_hash.length\nend", "def averages(grade_hash)\n grade_hash.transform_values { |marks| marks.inject {|sum, n| sum + n } / marks.length }\nend", "def class_average(grade_hash)\n scores = averages(grade_hash)\n result = 0\n scores.each {|k,v| result += v}\n result /= scores.length\nend", "def assignment_scores(grade_hash, assignment_num)\n outArray = []\n grade_hash.each do |key, value|\n outArray.push(value[assignment_num-1])\n\n end\n return outArray\nend", "def assignment_scores(grade_hash, assignment_num)\n grade_hash.map {|x| x[1][assignment_num-1]}\nend", "def class_average(grade_hash) \n sum = 0\n students = grade_hash.keys.length\n scores = grade_hash.values.length\n total_scores = students * scores\n grade_hash.each do |key, value|\n sum += value.reduce(:+)\n end\n average = sum / total_scores\n average\nend", "def class_average(grade_hash)\n sum, n = 0, 0\n grade_hash.each do |k,array|\n array.each do |grade|\n n += 1\n sum += grade\n end\n end\n return sum/n\nend", "def get_avggrades(hash)\n sumgrades = 0\n hash[:grades].each do |grade|\n if grade.to_s != 'A'\n sumgrades += grade.to_f\n else\n sumgrades +=1\n end\n end\n sumgrades / hash[:grades].length\nend", "def class_average(grade_hash)\n sum = 0\n grade_hash.values.each { |student| student.each {|grades| sum += grades }}\n average = sum/(grade_hash.length**2)\nend", "def averages(grade_hash)\n grade_hash.transform_values{ |num| num.reduce(:+) / num.length }\nend", "def averages(grade_hash)\n\n averages = grade_hash.map do |key, value|\n total = 1\n sum = grade_hash[key].reduce do |sum, grade|\n total += 1\n sum += grade\n end\n avg = sum / total\n [key, avg]\n end\n\n averages.to_h\nend", "def averages(grade_hash)\n grade_hash\n .transform_values { |scores| scores.reduce(:+) / scores.length }\nend", "def averages(grade_hash)\n grade_hash.transform_values{|nums| nums.reduce(:+) / nums.size}\nend", "def class_average(grade_hash)\n averages = averages(grade_hash)\n sum = 0\n\n averages.map do |key, value|\n sum += value\n end\n\n sum / averages.length\nend", "def class_average(grade_hash)\n averages(grade_hash).map{|k, v| v}.inject {|sum, n| sum + n } / grade_hash.length\nend", "def final_letter_grades(grade_hash)\n averages = grade_hash.inject({}) { |h, (k,v)| h[k] = letter_grade(v.reduce{|x,n| x += n}/v.length) ; h}\nend", "def assignment_scores(grade_hash, assignment_num)\n grade_hash.map do |student, marks|\n marks[assignment_num - 1]\n end\nend", "def averages(grade_hash)\n grade_hash.transform_values {|nums| nums.reduce(:+)/nums.size}\nend", "def class_average(grade_hash)\n averages(grade_hash).map { |key, value| value }\n .reduce(:+) / grade_hash.length\nend", "def class_average(grade_hash)\n averages(grade_hash)\n .map {|key, value| value}\n .reduce(:+) / grade_hash.length\nend", "def class_average(grade_hash)\n averages(grade_hash).values.reduce(:+) / grade_hash.length\nend", "def final_letter_grades(grade_hash)\n letter_grade averages grade_hash\nend", "def grade_average\n results = Assignment.find_by_sql([\"\n SELECT (sum(grades.grade * assignments.weight)/sum(assignments.weight)) AS total\n FROM assignments\n LEFT JOIN grades ON (assignments.id = grades.assignment_id)\n WHERE assignments.school_id=? and grades.user_id=? and grades.grade >= 0\n GROUP BY grades.user_id\",self.school,self.id])\n return results[0]['total'].to_i unless results.count == 0\n end", "def averages(grade_hash)\n student_average_array = grade_hash.map do |key, value|\n average = value.sum / value.length\n [key, average]\n end\n student_average_array.to_h\nend", "def assignment_score(grade_hash, student, assignment_num)\ngrade_hash[student][assignment_num - 1]\n\n# student = grade_hash[student.to_sym]\n# array_value = assignment_num - 1\n# student[array_value]\nend", "def assignment_scores(grade_hash, assignment_score)\n # Loop through the grade_hash\n grade_hash.map do |key, value|\n value[assignment_score - 1]\n end\nend", "def average_score\n grades.average(:score) || 0\n end", "def class_average(grade_hash)\n averages(grade_hash).values.reduce(:+)/grade_hash.size\nend", "def average_score\n return nil if metrics.empty?\n totals = grades.includes(:subject).group_by(&:subject).map { |_, grades|\n grades.sum(&:weighted_score) }\n return 0 if totals.empty?\n totals.sum.to_f / totals.length\n end", "def grade_average\n @grades.inject(:+) / @grades.size\n end", "def gradeAVG(scores)\n sum = 0\n scores.each do |grade|\n sum += grade\n end\n average = sum / (scores.length)\n return average\nend", "def final_letter_grades(grade_hash)\n averages(grade_hash)\n .transform_values{ |scores| letter_grade(scores)}\nend", "def class_average(grade_hash)\n class_array = grade_hash.map do |k,v|\n averages v\n end\n averages class_array\nend", "def get_average(hash)\n hash_max = hash.length\n hash_total = 0\n hash.each { |_, v| hash_total += v }\n hash_total / hash_max\n end", "def averages(grade_hash)\n# a_new_hash = my_hash.inject({}) { |h, (k, v)| h[k] = v.upcase; h }\naverages = grade_hash.inject({}) { |h, (k,v)| h[k] = v.reduce{|x,n| x += n}/v.length ; h}\nend", "def grades(input)\n lines = input.split(/\\n/)\n grades = lines[1..lines.length]\n s = lines[0].split(/\\s/)\n n = s[0].to_f\n m = s[1].to_f\n avgs = Hash.new\n grades.each do |line|\n split_line = line.split(/\\s/)\n avgs[split_line[0]] = split_line[1..m].inject(0){|sum, x| sum + x.to_f} / m\n end\n avg = (avgs.to_a.inject(0){|sum, x| sum + x[1].to_f} / n).round(2).to_s\n avgs.each do |k, v|\n avg += \"\\n\" + k.to_s + \" \" + v.to_s\n end\n puts avg\nend", "def final_letter_grades(grade_hash)\n averages(grade_hash).transform_values{ |num| letter_grade(num) }\nend", "def average\n @grades.reduce(0,:+) / @grades.size.to_f\n end", "def grade_average\n @grades.inject(:+)/@grades.size\n end", "def grade_average\n @grades.inject(:+)/@grades.size\n end", "def final_letter_grades(grade_hash)\n averages(grade_hash).transform_values {|nums| nums = letter_grade(nums)}\nend", "def final_letter_grades(grade_hash)\n letter_grade_array = grade_hash.map do |key, value|\n average = value.sum / value.length\n letter_grade = letter_grade(average)\n [key, letter_grade]\n end\n letter_grade_array.to_h\nend", "def final_letter_grades(grade_hash)\n averages(grade_hash).transform_values{ |marks| letter_grade(marks)}\nend", "def assignment_scores(data, assignment)\n data.values.map { |scores| scores[assignment-1] }\nend", "def average_rating(assignment)\n # team = self.teams.find(team_id)\n # feedback = team.feedbacks.all.where(:receiver_id => self.user_id)\n feedback = assignment.feedbacks.where(:receiver_id => self.user_id)\n average = 0\n for f in feedback\n average += f.rating\n end\n if feedback.length != 0\n average = average/feedback.length\n average.to_s\n else\n 'N/A'\n end\n end", "def grade_average(school_id,user_id)\n results = Assignment.find_by_sql([\"\n SELECT (sum(grades.grade * assignments.weight)/sum(assignments.weight)) AS total\n FROM assignments\n LEFT JOIN grades ON (assignments.id = grades.assignment_id)\n WHERE assignments.school_id=? and grades.user_id=?\n GROUP BY grades.user_id\",school_id,user_id])\n grade = results[0]['total'].to_i unless results.count == 0\n pending = \"pending\"\n return grade || pending\n end", "def average(array_of_numeric_grades)\n sum = 0\n array_of_numeric_grades.each do |grade|\n sum += grade\n end\n average = sum / array_of_numeric_grades.length\nend", "def compute_average_grade\n total = 0.0\n self.fcqs.compact.each {|x| next if x.avg_grd == nil; total += x.avg_grd}\n count = courses_taught\n if count == 0\n return 1.0 \n else\n return (total.to_f / count.to_f)\n end\n end", "def percentage_grades_array(assignment)\n groupings = assignment.groupings\n .joins(:tas)\n .where(memberships: { user_id: id })\n grades = []\n\n if assignment.assign_graders_to_criteria\n criteria_ids = self.criterion_ta_associations.where(assessment_id: assignment.id).pluck(:criterion_id)\n out_of = criteria_ids.sum do |criterion_id|\n Criterion.find(criterion_id).max_mark\n end\n return [] if out_of.zero?\n\n mark_data = groupings.joins(current_result: :marks)\n .where('marks.criterion_id': criteria_ids)\n .where.not('marks.mark': nil)\n .pluck('results.id', 'marks.mark')\n .group_by { |x| x[0] }\n mark_data.values.each do |marks|\n next if marks.empty?\n\n subtotal = 0\n has_mark = false\n marks.each do |_, mark|\n subtotal += mark\n has_mark = true\n end\n grades << subtotal / out_of * 100 if has_mark\n end\n else\n out_of = assignment.max_mark\n groupings.includes(:current_result).find_each do |grouping|\n result = grouping.current_result\n unless result.nil? || result.total_mark.nil? || result.marking_state != Result::MARKING_STATES[:complete]\n percent = calculate_total_percent(result, out_of)\n unless percent == BLANK_MARK\n grades << percent\n end\n end\n end\n end\n grades\n end", "def assignment_score(data, name, assignment)\n data[name][assignment -1]\nend", "def average_grade_overall\n return self.data[\"average_grade\"]\n end", "def average\n if self.critics.size>0\n begin\n self.critics.map{|i| i.score.to_f}.inject{ |sum, el| sum + el }.to_f / self.critics.size.to_f\n rescue\n nil\n end\n end\n end", "def averages(grades_array)\n total_grade = grades_array.reduce do |total, grade|\n total += grade\n end\n total_grade / grades_array.length\nend", "def final_letter_grades(grade_hash)\n averages = averages(grade_hash)\n\n final_grades = averages.map do |key, value|\n [key, letter_grade(value)]\n end\n\n final_grades.to_h\nend", "def average(grade_list)\n sum = 0\n grade_list.each do |grade|\n sum += grade\n end\n\n sum / grade_list.size.to_f\nend", "def average(grade_list)\n sum = 0\n grade_list.each do |grade|\n sum += grade\n end\n\n sum / grade_list.size.to_f\nend", "def average\n\t\tif 2 < course.users.length and 0 < grades.length and 0 < worth\n\t\t\taverage = (grades.sum(:grade) / grades.length);\n\t\t\taverage = (average.to_f / worth) * 100;\n\t\t\treturn average\n\t\tend\n\tend", "def final_letter_grades(grade_hash)\n final_hash = {}\n new_hash = averages(grade_hash)\n new_hash.map do |name, average|\n letter = letter_grade(average)\n final_hash[name] = letter\n end\n final_hash\nend", "def average_reviews_parameters_and_student_experience_vs_assignments(assignments_for_graph)\n avg_num_of_reviews_data =[]\n avg_review_score_data =[]\n avg_token_count_data = []\n avg_fb_score_data = []\n assignment_names=[]\n index = 0\n assignments_for_graph.each do |assignment|\n\n #get_average_num_of_reviews fetches the average number of reviews across the given response types for a given assignment\n num_of_reviews = assignment.get_average_num_of_reviews([\"TeamReviewResponseMap\",\"ParticipantReviewResponseMap\",\"ReviewResponseMap\"])\n avg_num_of_reviews_data[index] = num_of_reviews\n\n #get_average_score_with_type fetches the average score provided for the reviews of given response type for an assignment\n avg_score = assignment.get_average_score_with_type([\"TeamReviewResponseMap\",\"ParticipantReviewResponseMap\",\"ReviewResponseMap\"])\n avg_review_score_data[index] = avg_score\n\n comments = assignment.get_review_comments([\"TeamReviewResponseMap\",\"ParticipantReviewResponseMap\",\"ReviewResponseMap\"])\n avg_token_count_data[index] = assignment.average_tokens(comments)\n\n #fetches the average score for feedback on reviews performed on reviews for the given assignment.\n avg_fb_score = assignment.get_average_score_with_type([\"FeedbackResponseMap\"])\n avg_fb_score_data[index] = avg_fb_score\n\n assignment_names[index]=assignment.name\n\n index = index+1\n end\n [avg_num_of_reviews_data,avg_review_score_data,avg_token_count_data, avg_fb_score_data, assignment_names]\n end", "def compute_avg_and_ranges_hash\n scores = {}\n contributors = self.contributors # assignment_teams\n if self.varying_rubrics_by_round?\n rounds = self.rounds_of_reviews\n for round in 1..rounds\n review_questionnaire_id = review_questionnaire_id(round)\n questions = Question.where(['questionnaire_id = ?', review_questionnaire_id])\n contributors.each do |contributor|\n assessments = ReviewResponseMap.get_assessments_for(contributor)\n assessments = assessments.reject {|assessment| assessment.round != round }\n scores[contributor.id] = {} if round == 1\n scores[contributor.id][round] = {}\n scores[contributor.id][round] = Answer.compute_scores(assessments, questions)\n end\n end\n else\n review_questionnaire_id = review_questionnaire_id()\n questions = Question.where(['questionnaire_id = ?', review_questionnaire_id])\n contributors.each do |contributor|\n assessments = ReviewResponseMap.get_assessments_for(contributor)\n scores[contributor.id] = {}\n scores[contributor.id] = Answer.compute_scores(assessments, questions)\n end\n end\n scores\n end", "def average_score(report_cycle)\n report_cycle_scores = report_cycle.scores.where(set_pupil: object)\n return 0 if report_cycle_scores.length < 1\n average = (report_cycle_scores.map(&:value).reduce(:+)) / (report_cycle_scores.length).to_f\n return average.round(1)\n end", "def get_grade(scoreArray)\n\t\t\n\tavg = scoreArray.reduce(:+) / scoreArray.length\n\t\t\n\tcase avg\n\t\twhen 90..100 then 'A'\n\t\twhen 80..89 then 'B'\n\t\twhen 70..79 then 'C'\t\n\t\twhen 60..69 then 'D'\n\t\telse 'F'\t\n\tend\nend", "def get_average_score()\n if get_maximum_score != 0 then\n ((get_total_score.to_f / get_maximum_score.to_f) * 100).to_i\n else\n 0\n end\n end", "def calculate_letter_grade(*scores) # the asterisk allows any number of arguments and puts them in an array\n if scores.length == 0\n return nil\n end\n average = scores.sum / scores.length\n letter_threshholds = {90 => \"A\", 80 => \"B\", 70 => \"C\", 60 => \"D\", 0 => \"F\"}\n letter_threshholds.each do |threshhold, grade|\n if average >= threshhold\n return grade\n end\n end\nend", "def percentage_grades_array(assignment)\n grades = Array.new()\n out_of = assignment.max_mark\n assignment.groupings.includes(:current_result).joins(:tas)\n .where(memberships: { user_id: id }).find_each do |grouping|\n result = grouping.current_result\n unless result.nil? || result.total_mark.nil? || result.marking_state != Result::MARKING_STATES[:complete]\n percent = calculate_total_percent(result, out_of)\n unless percent == BLANK_MARK\n grades.push(percent)\n end\n end\n end\n\n return grades\n end", "def average_of(raitingss)\n raitingss.sum(&:score).to_f / raitingss.count\n end", "def avg_score\n return 0 unless reviews.size.positive?\n\n reviews.average(:score).to_f.round(2)\n end", "def average_score\n if reviews.size > 0\n (reviews.sum(:rating) / reviews.size).round(1)\n else\n 0.0\n end\n end", "def get_grade(input_array)\n\tsum = 0\n\tinput_array.each do |x|\n\t\tsum += x\n\tend\n\tav_score = sum/input_array.length\n\treturn \"A\" if av_score>=90\n\treturn \"B\" if av_score>=80\n\treturn \"C\" if av_score>=70\n\treturn \"D\" if av_score>=60\n\treturn \"F\" if av_score<60\nend", "def calc_modified_average(score_list)\n sum = 0;\n calc_size = score_list.size\n calc_size = (4 + (calc_size-4)/2) if (calc_size > 5)\n\n calc_size.times do |score|\n sum += score_list[score]\n end\n (sum / calc_size)\n end", "def get_grade(scores)\n \n sum = scores.reduce(:+)\n \n average = sum.to_f/scores.length\n \n if (average >= 90)\n 'A'\n elsif (average >= 80)\n 'B'\n elsif (average >=70)\n 'C'\n elsif (average >=60)\n 'D'\n else \n 'F'\n end\n \n end" ]
[ "0.9109706", "0.9074288", "0.90641165", "0.9055428", "0.89904875", "0.8978579", "0.8958803", "0.8855718", "0.8777972", "0.8731957", "0.8276149", "0.7820606", "0.7698085", "0.7590732", "0.7590732", "0.7590732", "0.7590732", "0.7590732", "0.75853384", "0.75819963", "0.75176793", "0.7504115", "0.7479188", "0.7477057", "0.7467943", "0.7462336", "0.7453353", "0.74478084", "0.74276865", "0.7419816", "0.74154675", "0.7407943", "0.7378389", "0.7372362", "0.7366645", "0.73525566", "0.7351463", "0.7316772", "0.7306743", "0.7297807", "0.72959477", "0.7256766", "0.7246679", "0.7162239", "0.71582365", "0.7153766", "0.7134131", "0.7110292", "0.7094684", "0.7069512", "0.7057751", "0.6992312", "0.69915456", "0.69510424", "0.693998", "0.69191414", "0.69116443", "0.68820125", "0.68591076", "0.6799837", "0.6792067", "0.67908186", "0.6781162", "0.6682831", "0.6658562", "0.66388977", "0.6626395", "0.661096", "0.661096", "0.65972096", "0.65680766", "0.65680015", "0.64558023", "0.64552855", "0.6444847", "0.6415716", "0.64030683", "0.6396823", "0.63896155", "0.63527447", "0.6317784", "0.6287357", "0.627267", "0.62651044", "0.62651044", "0.6262719", "0.6255988", "0.62503797", "0.62340367", "0.6232756", "0.61811525", "0.61777097", "0.617688", "0.6128078", "0.61203307", "0.60934097", "0.6063208", "0.6054367", "0.6045294", "0.60235745" ]
0.89088017
7
Return a hash of students and their average score. TIP: To convert an array like [[:indiana, 90], [:nevada, 80]] to a hash, use .to_h. Also look at Hashtransform_values.
def averages(grade_hash) grade_hash.transform_values { |marks| marks.inject {|sum, n| sum + n } / marks.length } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def averages(grade_hash)\n student_average_array = grade_hash.map do |key, value|\n average = value.sum / value.length\n [key, average]\n end\n student_average_array.to_h\nend", "def averages(grade_hash)\n\n averages = grade_hash.map do |key, value|\n total = 1\n sum = grade_hash[key].reduce do |sum, grade|\n total += 1\n sum += grade\n end\n avg = sum / total\n [key, avg]\n end\n\n averages.to_h\nend", "def class_average(grade_hash) \n sum = 0\n students = grade_hash.keys.length\n scores = grade_hash.values.length\n total_scores = students * scores\n grade_hash.each do |key, value|\n sum += value.reduce(:+)\n end\n average = sum / total_scores\n average\nend", "def class_average(grade_hash)\n sum = 0\n grade_hash.values.each { |student| student.each {|grades| sum += grades }}\n average = sum/(grade_hash.length**2)\nend", "def averages(grade_hash)\n grade_hash.transform_values{|v| v.inject(:+)/v.length}\n # hash = {}\n # grade_hash.map do |name, grades|\n # score = 0\n # grades.each do |grade|\n # score += grade\n # end\n # average = score/grades.length\n # hash[name] = average\n # end\n # hash\n # sum = 0\n # grade_hash.each { |x| sum += x }\n # average = sum/grade_hash.length\nend", "def averages(grade_hash)\n grade_hash\n .transform_values { |scores| scores.reduce(:+) / scores.length }\nend", "def averages(grade_hash)\n grade_hash.transform_values{|nums| nums.reduce(:+) / nums.size}\nend", "def show\n @students = Student.joins(:subjects)\n .select('students.name, students.email, students.age, students.gender, students.opinion, subjects.id as subject_id')\n .select('exam_results.name as exam_result_name, subjects.name as subject_name, exam_results.score')\n .select('CAST((exam_results.score / subjects.max_score) * 100 as int) as ratio')\n .where(id: params[:id])\n .order(id: :asc)\n\n avg_result = Student.joins(:subjects)\n .select('subjects.id as subject_id')\n .select('CAST(AVG(exam_results.score) as int) as avg_score') \n .select('MAX(exam_results.score) as max_score')\n .select('MIN(exam_results.score) as min_score')\n .group('subjects.id')\n .order('subjects.id')\n @score_hash = {}\n avg_result.each do |avg_res|\n h = Hash.new\n h[:avg_score] = avg_res.avg_score\n h[:max_score] = avg_res.max_score\n h[:min_score] = avg_res.min_score \n @score_hash[avg_res.subject_id] = h\n end\n end", "def score\n return nil if scores.count == 0\n average = Hash.new(0)\n scores.each_with_index do |score, num|\n Score::METRICS.each do |metric|\n average[metric] = (average[metric] * num + score.try(metric))/(num + 1.0)\n end\n end\n ret = {score: average}\n return JSON.generate ret\n end", "def averages(grade_hash)\n grade_hash.transform_values{ |num| num.reduce(:+) / num.length }\nend", "def class_average(grade_hash)\n averages = averages(grade_hash)\n sum = 0\n\n averages.map do |key, value|\n sum += value\n end\n\n sum / averages.length\nend", "def class_average(grade_hash)\n class_array = grade_hash.map do |k,v|\n averages v\n end\n averages class_array\nend", "def class_average(grade_hash)\n averages(grade_hash)\n .map {|key, value| value}\n .reduce(:+) / grade_hash.length\nend", "def averages(grade_hash)\n grade_hash.transform_values {|nums| nums.reduce(:+)/nums.size}\nend", "def get_average\n record_hash = {}\n record_hash['avg_cat1'] = course_ratings.average(:cat1) || 0\n record_hash['avg_cat2'] = course_ratings.average(:cat2) || 0\n record_hash['avg_cat3'] = course_ratings.average(:cat3) || 0\n record_hash['avg_cat4'] = course_ratings.average(:cat4) || 0\n record_hash['avg_cat5'] = course_ratings.average(:cat5) || 0\n record_hash['total_reviews'] = course_ratings.length\n return record_hash\n end", "def class_average(grade_hash)\n sum, n = 0, 0\n grade_hash.each do |k,array|\n array.each do |grade|\n n += 1\n sum += grade\n end\n end\n return sum/n\nend", "def class_average(grade_hash)\n scores = averages(grade_hash)\n result = 0\n scores.each {|k,v| result += v}\n result /= scores.length\nend", "def class_average(grade_hash)\n averages(grade_hash).map { |key, value| value }\n .reduce(:+) / grade_hash.length\nend", "def class_average(grade_hash)\n averages(grade_hash).values.reduce(:+) / grade_hash.length\nend", "def top_students(grade_hash, number_of_students)\n # Loop through hash\n top_students_array = grade_hash.map do |key, value|\n # find average for each student\n average = value.sum / value.length\n # put into array of key, score\n [key, average]\n end\n puts top_students_array\n # turn into hash\n top_students_hash = top_students_array.to_h\n # sort hash\n top_students_sorted = top_students_hash.sort_by do |a, b| \n -b\n end\n # map keys\n sorted_student_array = top_students_sorted.map do |key, value|\n key\n end\n # return top student names in array\n result = sorted_student_array.take(number_of_students)\n result\nend", "def class_average(grade_hash)\n averages(grade_hash).map{|k, v| v}.inject {|sum, n| sum + n } / grade_hash.length\nend", "def max_min_avg(arr)\n hash = {'max': arr.max, 'min': arr.min}\n sum = 0\n for i in arr\n sum += i\n end\n hash['avg'] = sum / arr.length\n return hash\nend", "def assignment_average_score(grade_hash, assignment_score)\n sum = 0\n grade_hash.each do |key, value|\n sum += value[assignment_score - 1]\n end\n average = sum / grade_hash.keys.length\n average\nend", "def average_score\n grades.average(:score) || 0\n end", "def final_letter_grades(grade_hash)\n letter_grade_array = grade_hash.map do |key, value|\n average = value.sum / value.length\n letter_grade = letter_grade(average)\n [key, letter_grade]\n end\n letter_grade_array.to_h\nend", "def top_students(grade_hash)\n averages(grade_hash)\n .to_a\n .sort_by { |student| -student[1] }\n .map { |student| student[0] }\nend", "def assignment_average_score(grade_hash, assignment_num)\n marks = assignment_scores(grade_hash, assignment_num)\n marks.sum / marks.length\nend", "def average_score\n return nil if metrics.empty?\n totals = grades.includes(:subject).group_by(&:subject).map { |_, grades|\n grades.sum(&:weighted_score) }\n return 0 if totals.empty?\n totals.sum.to_f / totals.length\n end", "def assignment_average_score(grade_hash, assignment_num)\n grade_hash\n .map { |key, value| value[assignment_num -1] }\n .reduce(:+) / grade_hash.length\nend", "def get_avggrades(hash)\n sumgrades = 0\n hash[:grades].each do |grade|\n if grade.to_s != 'A'\n sumgrades += grade.to_f\n else\n sumgrades +=1\n end\n end\n sumgrades / hash[:grades].length\nend", "def assignment_average_score(grade_hash, assignment_num)\n a = []\n grade_hash.values.each { |dude| a.push(dude[assignment_num - 1]) }\n sum = a.sum\n average = sum/a.length\nend", "def grades(input)\n lines = input.split(/\\n/)\n grades = lines[1..lines.length]\n s = lines[0].split(/\\s/)\n n = s[0].to_f\n m = s[1].to_f\n avgs = Hash.new\n grades.each do |line|\n split_line = line.split(/\\s/)\n avgs[split_line[0]] = split_line[1..m].inject(0){|sum, x| sum + x.to_f} / m\n end\n avg = (avgs.to_a.inject(0){|sum, x| sum + x[1].to_f} / n).round(2).to_s\n avgs.each do |k, v|\n avg += \"\\n\" + k.to_s + \" \" + v.to_s\n end\n puts avg\nend", "def compute_avg_and_ranges_hash\n scores = {}\n contributors = self.contributors # assignment_teams\n if self.varying_rubrics_by_round?\n rounds = self.rounds_of_reviews\n for round in 1..rounds\n review_questionnaire_id = review_questionnaire_id(round)\n questions = Question.where(['questionnaire_id = ?', review_questionnaire_id])\n contributors.each do |contributor|\n assessments = ReviewResponseMap.get_assessments_for(contributor)\n assessments = assessments.reject {|assessment| assessment.round != round }\n scores[contributor.id] = {} if round == 1\n scores[contributor.id][round] = {}\n scores[contributor.id][round] = Answer.compute_scores(assessments, questions)\n end\n end\n else\n review_questionnaire_id = review_questionnaire_id()\n questions = Question.where(['questionnaire_id = ?', review_questionnaire_id])\n contributors.each do |contributor|\n assessments = ReviewResponseMap.get_assessments_for(contributor)\n scores[contributor.id] = {}\n scores[contributor.id] = Answer.compute_scores(assessments, questions)\n end\n end\n scores\n end", "def assignment_average_score(grade_hash, assignment_num)\n assignment_score = grade_hash.map do |key, value|\n value [assignment_num - 1]\n end\n total = assignment_score.reduce do |total, grade|\n total += grade\n end\n total / assignment_score.length\nend", "def class_average(grade_hash)\n averages(grade_hash).values.reduce(:+)/grade_hash.size\nend", "def assignment_average_score(grade_hash, assignment_num)\n grade_hash\n .map {|key, value| value[assignment_num - 1]}\n .reduce(:+) / grade_hash.length\nend", "def averages(grade_hash)\n# a_new_hash = my_hash.inject({}) { |h, (k, v)| h[k] = v.upcase; h }\naverages = grade_hash.inject({}) { |h, (k,v)| h[k] = v.reduce{|x,n| x += n}/v.length ; h}\nend", "def assignment_average_score(grade_hash, assignment_num)\n assignment = grade_hash.map do |key, value|\n value[assignment_num - 1]\n end\n\n sum = assignment.reduce do |sum, x|\n sum += x\n end\n\n sum / assignment.length\nend", "def compute_student_hashes(authorized_student_ids)\n # Students table first\n authorized_students = Student.where(id: authorized_student_ids).includes(:homeroom)\n students_json = authorized_students.as_json({\n except: [\n :primary_phone,\n :primary_email,\n :student_address\n ]\n })\n\n # Optimized computation for aggregates\n aggregates = {\n discipline_incidents_count: DisciplineIncident.where(student_id: authorized_student_ids).where('occurred_at >= ?', first_day_of_school).group(:student_id).count,\n absences_count: Absence.where(student_id: authorized_student_ids).where('occurred_at >= ?', first_day_of_school).group(:student_id).count,\n tardies_count: Tardy.where(student_id: authorized_student_ids).where('occurred_at >= ?', first_day_of_school).group(:student_id).count\n }\n\n # Merge\n authorized_students.each_with_index.map do |student, index|\n HashWithIndifferentAccess.new(students_json[index].merge({\n discipline_incidents_count: aggregates[:discipline_incidents_count].fetch(student.id, 0),\n absences_count: aggregates[:absences_count].fetch(student.id, 0),\n tardies_count: aggregates[:tardies_count].fetch(student.id, 0),\n homeroom_name: student.try(:homeroom).try(:name)\n }))\n end\n end", "def averages(data)\n data.transform_values { |scores| (scores.sum/scores.length) }\nend", "def final_letter_grades(grade_hash)\n averages = averages(grade_hash)\n\n final_grades = averages.map do |key, value|\n [key, letter_grade(value)]\n end\n\n final_grades.to_h\nend", "def results(marks)\n # your code here\n avg = (marks.reduce(:+) / (marks.length).to_f).round(3)\n\n scores = {\n \"h\"=> 0,\n \"a\"=> 0,\n \"l\"=> 0\n }\n\n marks.each do |i|\n if i > 8\n scores[\"h\"] += 1\n elsif i == 7 || i == 8\n scores[\"a\"] += 1\n else \n scores[\"l\"] += 1\n end\n end\n if scores[\"a\"] == 0 && scores[\"l\"] == 0\n result = [avg, scores, 'They did well']\n else\n result = [avg, scores]\n end\n result\nend", "def average\n @grades.reduce(0,:+) / @grades.size.to_f\n end", "def fat_student_hash(student)\n HashWithIndifferentAccess.new(student_hash_for_slicing(student).merge({\n interventions: student.interventions,\n student_risk_level: student.student_risk_level.decorate.as_json_with_explanation,\n }))\n end", "def assignment_average_score(grade_hash, assignment_num)\n (grade_hash.values.transpose[assignment_num - 1].reduce { |acc, num| acc + num }.to_f / 10).floor\nend", "def fat_student_hash(student)\n HashWithIndifferentAccess.new(student.as_json({\n except: [\n :primary_phone,\n :primary_email,\n :student_address\n ]\n }).merge({\n has_photo: student.has_photo,\n discipline_incidents_count: student.most_recent_school_year_discipline_incidents_count,\n absences_count: student.most_recent_school_year_absences_count,\n tardies_count: student.most_recent_school_year_tardies_count,\n homeroom_name: student.try(:homeroom).try(:name),\n event_notes_without_restricted: student.event_notes_without_restricted,\n interventions: student.interventions,\n sped_data: sped_data(student)\n }))\n end", "def grades\n object.grades.collect do |grade|\n { :grade => grade, :student => grade.student }\n end\n end", "def assignment_average_score(grade_hash, assignment_num)\n sum = 0\n grade_hash.each do |key, value|\n sum += grade_hash[key][assignment_num - 1]\n end\n average = sum / grade_hash.length\nend", "def final_letter_grades(grade_hash)\n averages(grade_hash)\n .transform_values{ |scores| letter_grade(scores)}\nend", "def student_hash_for_slicing(student)\n student.as_json.merge({\n student_risk_level: student.student_risk_level.as_json,\n discipline_incidents_count: student.most_recent_school_year.discipline_incidents.count,\n absences_count: student.most_recent_school_year.absences.count,\n tardies_count: student.most_recent_school_year.tardies.count,\n homeroom_name: student.try(:homeroom).try(:name)\n })\n end", "def assignment_average_score(grade_hash, assignment_num)\n assignment = grade_hash.map {|x| x[1][assignment_num-1]}\n average = assignment.reduce{|x,n| x += n}/assignment.length\nend", "def drivers_average_ratings_hash(data_hash)\n each_driver_average_rating = {}\n data_hash.each do |driver, rides_array|\n sum_of_ratings = 0\n rides_array.each do |ride|\n sum_of_ratings += ride[:rating]\n end\n each_driver_average_rating[driver] = (sum_of_ratings / rides_array.length.to_f).round(1)\n end\n each_driver_average_rating\nend", "def mma (arr)\n d = {}\n arr.sort!\n d['min'] = arr.first\n d['max'] = arr.last\n sum = 0\n for elem in arr\n sum += elem\n end\n d['average'] = sum / arr.length\n return d\nend", "def final_letter_grades(grade_hash)\n averages(grade_hash).transform_values{ |marks| letter_grade(marks)}\nend", "def grade_average\n @grades.inject(:+) / @grades.size\n end", "def assignment_average_score(grade_hash, assignment_num)\n sum, n = 0, 0\n grade_hash.each do |k,v|\n n += 1\n sum += v[assignment_num-1]\n end\n return sum/n\nend", "def average\n { bid: average_bid, ask: average_ask }\n end", "def assignment_average_score(data, assignment)\n all_scores = data.values.map do |scores|\n scores[assignment - 1]\n end\n (all_scores.sum)/(all_scores.length)\nend", "def gradeAVG(scores)\n sum = 0\n scores.each do |grade|\n sum += grade\n end\n average = sum / (scores.length)\n return average\nend", "def final_letter_grades(grade_hash)\n final_hash = {}\n new_hash = averages(grade_hash)\n new_hash.map do |name, average|\n letter = letter_grade(average)\n final_hash[name] = letter\n end\n final_hash\nend", "def total_students(hash)\n\ttotal = 0\n\thash.each { |key, value| total += value }\n\treturn total\nend", "def fat_student_hash(student)\n HashWithIndifferentAccess.new(student_hash_for_slicing(student).merge({\n event_notes_without_restricted: student.event_notes_without_restricted,\n interventions: student.interventions,\n sped_data: student.sped_data,\n }))\n end", "def sort\n new_hash = {}\n roster.each do |grade, student|\n new_hash[grade] = student.sort\n end\n new_hash\n end", "def hash arr\n\t# could also do\n\t# return {max: arr.max, min: arr.min, avg: arr.reduce(:+).to_f / arr.size }\n\tarr_hash = {max: arr.max, min: arr.min, avg: arr.reduce(:+).to_f / arr.size }\n\tp arr_hash\nend", "def top_students(grade_hash, number_of_students)\n outArray = []\n grade_hash.each do |name, scores|\n sum, n = 0, 0\n scores.each do |x|\n n += 1\n sum += x\n end\n outArray.push([sum/n, name])\n end\n final_answer = []\n outArray.sort.reverse[0...number_of_students].each do |grade,name|\n final_answer.push(name)\n end\n return final_answer\nend", "def to_h\n @raw.reduce(Hash.new(0)) do |acc, elem|\n acc.merge(elem.date => elem.score)\n end\n end", "def percentage_add(hash_array)\n hash_array.each do |student|\n per = student[:marks]\n p per\n student[:percentage] = (per*100)/100\n end\nend", "def averages(grades_array)\n total_grade = grades_array.reduce do |total, grade|\n total += grade\n end\n total_grade / grades_array.length\nend", "def averageScores(scores)\n return scores.inject{ | sum, el| sum + el }.to_f / scores.size\n end", "def group_students\n\n\n # retrieve the student\n students = @students.values\n students.sort! { |a,b| a.get_percent_correct <=> b.get_percent_correct }\n\n students_size = students.size \n n = students_size / 3\n\n\n @group_low = divide_students_to_group(0, n-1, students)\n @group_mid = divide_students_to_group(n, n*2-1, students)\n @group_high = divide_students_to_group(n*2, students_size-1, students)\n\n\n end", "def sort\n sorted_hash = {}\n @roster.each do |grade_key, student_array|\n sorted_hash[grade_key] = student_array.sort\n end\n sorted_hash\n end", "def sort\n return_hash = {}\n @roster.each {|grade, students| return_hash[grade] = students.sort}\n return_hash\n end", "def average\n { value: \"%0.2f\" % @average, color: Openreply::Color.color(@average) }\n end", "def sort\nstudent_hash = {}\n @roster.each do |grade, students|\nstudent_hash[grade] = students.sort\n end\n student_hash\nend", "def add_hash_of_students(student_hash)\n student_hash.each do |grade, students|\n @roster[grade] ||= []\n students.each {|student| @roster[grade] << student}\n end\n end", "def scores\n cells = self.concatenate_data_arrays(self.cell_key, 'cells')\n exp_values = self.concatenate_data_arrays(self.score_key, 'expression')\n Hash[cells.zip(exp_values)]\n end", "def grades_to_hash(csv)\n csv.map { |r| r.to_hash }\n end", "def get_skills_with_scores \n self.skills.map do |skill|\n score = skill.grades.find_by(user_id: self.id).score\n {skill: skill, score: score}\n end\n end", "def average_out(ratings)\n ratings.sum(&:score).to_f / ratings.count\n end", "def get_average(hash)\n hash_max = hash.length\n hash_total = 0\n hash.each { |_, v| hash_total += v }\n hash_total / hash_max\n end", "def final_letter_grades(grade_hash)\n averages(grade_hash).transform_values {|nums| nums = letter_grade(nums)}\nend", "def final_letter_grades(grade_hash)\n letter_grade averages grade_hash\nend", "def final_letter_grades(grade_hash)\n averages(grade_hash).transform_values{ |num| letter_grade(num) }\nend", "def grade_average\n @grades.inject(:+)/@grades.size\n end", "def grade_average\n @grades.inject(:+)/@grades.size\n end", "def percentages\n colors = []\n students.each do |student|\n student.evaluations.each do |evaluation|\n colors << evaluation.color\n end\n end\n\n if !colors.empty?\n {\n green: (colors.count(1) * 100) / colors.size ,\n yellow: (colors.count(2) * 100) / colors.size,\n red: (colors.count(3) * 100) / colors.size\n }\n else\n {}\n end\n end", "def get_skills_with_scores\n self.skills.map do |skill|\n #need to figure out how to get the score of the grade\n #grade user_id, skill_id, score\n score = skill.grades.find_by(user_id: self.id).score \n {skill: skill, score: score}\n end\n end", "def top_students(grade_hash, number_of_students)\n grade_hash.transform_values{|score| score.reduce(0,:+)/(score.length)}.sort_by {|student,score| score}.reverse.to_h.keys.first(number_of_students)\nend", "def final_letter_grades(grade_hash)\n averages = grade_hash.inject({}) { |h, (k,v)| h[k] = letter_grade(v.reduce{|x,n| x += n}/v.length) ; h}\nend", "def student_data_hash\n\n # turn data into 2 Dim array containing arrays of eles where delimiter is colon :\n clean_user_account_data = ruby_class_user_accounts.map { |x| x.split(/:/) }\n\n # turn data into a hash using 2 arrays for keys and values\n keys = %w[user_name password uid gid gcos_field home_directory login_shell]\n final_array_of_hashes = []\n\n clean_user_account_data.each do |account_data|\n hash = Hash.new\n keys.each_with_index { |item, index| hash[item] = account_data[index] }\n final_array_of_hashes << hash\n end\n final_array_of_hashes\n end", "def get_student_section_columns_hash(students)\n students.inject({}) do |map, student|\n map[student[:student_id]] = section_columns_hash(student[:sections])\n map\n end\n end", "def scores\n buckets = {bot: 0, twenty: 0, thirty: 0, forty: 0, fifty: 0, sixty: 0, seventy: 0, eighty: 0, top: 0 }\n y_axis = []\n\n scores = self.students.map do |student|\n if student.total_score.nil?\n 0\n else\n student.total_score.to_f / self.possible_points.to_f\n end\n end\n scores.sort!\n\n scores.each do |score|\n case score\n when 0.9..1.0\n buckets[:top] += 1\n when 0.8..0.899\n buckets[:eighty] += 1\n when 0.7..0.799\n buckets[:seventy] += 1\n when 0.6..0.699\n buckets[:sixty] += 1\n when 0.5..0.599\n buckets[:fifty] += 1\n when 0.4..0.499\n buckets[:forty] += 1\n when 0.3..0.399\n buckets[:thirty] += 1\n when 0.2..0.299\n buckets[:twenty] += 1\n else\n if score < 0.2\n buckets[:bot] += 1\n end\n end\n end\n buckets.each_value {|val| y_axis.push(val)}\n y_axis\n end", "def average\n @data['average']\n end", "def average_grade_overall\n return self.data[\"average_grade\"]\n end", "def all_cohorts (hash_value)\n total_students = hash_value.each_value.reduce(:+)\n puts total_students\nend", "def average\n if self.critics.size>0\n begin\n self.critics.map{|i| i.score.to_f}.inject{ |sum, el| sum + el }.to_f / self.critics.size.to_f\n rescue\n nil\n end\n end\n end", "def avg_score\n reviews.average(:rating).round(2).to_f\n end", "def test_average\n\t\tassert_equal(90, @students[0].average, \"The first student's average score is not 90\")\n\t\tassert_equal(\"A\", @students[0].letter_grade, \"The first student's letter grade is not an A.\")\n\tend", "def final_letter_grades(scores)\n averages(scores).transform_values { |avg_score| letter_grade(avg_score)}\nend", "def sort\n sorted = {}\n roster.each do |grade, students|\n sorted[grade] = students.sort\n end\n sorted\n end" ]
[ "0.75405383", "0.7045323", "0.69985765", "0.69742346", "0.6856095", "0.6760799", "0.6706752", "0.67057437", "0.665328", "0.66252494", "0.6591957", "0.65469205", "0.6479361", "0.6476152", "0.6472911", "0.6454798", "0.6446286", "0.64321405", "0.638457", "0.635152", "0.63483834", "0.63476676", "0.6345063", "0.6305367", "0.629762", "0.62974304", "0.62769514", "0.62743753", "0.6256673", "0.62532103", "0.62360984", "0.62340564", "0.6228505", "0.621773", "0.62065506", "0.6204206", "0.6135554", "0.61351883", "0.61302257", "0.61281437", "0.60938334", "0.6073518", "0.6073453", "0.60587686", "0.60553795", "0.6050683", "0.6045879", "0.6038456", "0.60286754", "0.6018762", "0.60044724", "0.5983348", "0.5978989", "0.59597635", "0.5950261", "0.5947783", "0.5914376", "0.5907872", "0.59055954", "0.58971417", "0.5885448", "0.5876947", "0.586341", "0.5839409", "0.5838488", "0.58372957", "0.58346456", "0.58337396", "0.582521", "0.5774015", "0.57639444", "0.5760727", "0.575832", "0.57401395", "0.5739586", "0.57363427", "0.5729353", "0.57221633", "0.5712117", "0.5707378", "0.570425", "0.5694128", "0.56849277", "0.5672528", "0.5672528", "0.56716794", "0.5669534", "0.5661426", "0.565983", "0.5650924", "0.56461924", "0.5642385", "0.5631739", "0.56312066", "0.5630653", "0.5625269", "0.560189", "0.55999166", "0.55978775", "0.55847627" ]
0.67456746
6
Return a letter grade for a numerical score. 90+ => A 8089 => B 7079 => C 6069 => D F
def letter_grade(mark) case mark when 90..1000 "A" when 80..89 "B" when 70..79 "C" when 60..69 "D" else "F" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def letter_grade(score)\n if score>90\n \"A\"\n elsif score>=80 && score<=89\n \"B\"\n elsif score>=70 && score<=79\n \"C\"\n elsif score>=60 && score<=69\n \"D\"\n else\n \"F\"\n end\nend", "def letter_grade(score)\n if score >= 90\n return \"A\"\n elsif score >= 80 && score <= 89\n return \"B\"\n elsif score >= 70 && score <= 79\n return \"C\"\n elsif score >= 60 && score <= 69\n return \"D\"\n else\n return \"F\"\n end\nend", "def letter_grade(score)\n if score >= 90\n \"A\"\n elsif score >= 80\n \"B\"\n elsif score >= 70\n \"C\"\n elsif score >= 60\n \"D\"\n else\n \"F\"\n end\nend", "def letter_grade(score)\n output = case score\n when 0...60\n 'F'\n when 60..69\n 'D'\n when 70..79\n 'C'\n when 80..89\n 'B'\n when 90..100\n 'A'\n end\n\n return output\nend", "def letter_grade(score)\n if score >= 90\n \"A\"\n elsif score >= 80 && score <= 89\n \"B\"\n elsif score >= 70 && score <= 79\n \"C\"\n elsif score >= 60 && score <= 69\n \"D\"\n else\n \"F\"\n end\nend", "def letter_grade(score)\n if score >= 90\n \"A\"\n elsif score >= 80 && score <= 89\n \"B\"\n elsif score >= 70 && score <= 79\n \"C\"\n elsif score >= 60 && score <= 69\n \"D\"\n else \n \"F\"\n end\nend", "def letter_grade(score)\n if score >= 90\n \"A\"\n elsif score <= 89 && score >= 80\n \"B\"\n elsif score <= 79 && score >= 70\n \"C\"\n elsif score <= 69 && score >= 60\n \"D\"\n else\n \"F\"\n end\nend", "def get_grade(scores)\n\n\t#Find out the average of the scores\n\n\tscore_sum = scores.reduce(:+)\n\ttotal_scores = scores.length\n\taverage_score = score_sum / total_scores\n\n\t#translate average into a letter grade\n\n\tgrade = case average_score\n\twhen 90...100 then \"A\"\n\twhen 80..90 then \"B\"\n\twhen 70..80 then \"C\"\n\twhen 60..70 then \"D\"\n\twhen 0..60 then \"F\"\n\tend\n\t\n\treturn grade\nend", "def letter_grade(score)\n if score >= 90\n \"A\"\n elsif score.between?(80,89)\n \"B\"\n elsif score.between?(70,79)\n \"C\"\n elsif score.between?(60,69)\n \"D\"\n else\n \"F\"\n end\nend", "def get_grade(scores)\n score_total = 0\n\n scores.each { |x| score_total = x + score_total }\n\n average = score_total / (scores.length)\n\n case\n when average >= 90\n letter = 'A'\n when average >= 80\n letter = 'B'\n when average >= 70\n letter = 'C'\n when average >= 60\n letter = 'D'\n else\n letter = 'F'\n end\n \n return letter\nend", "def letter_grade(score)\n if score >= 90 \n return \"A\"\n elsif score >= 80\n \"B\"\n elsif score >= 70\n \"C\"\n elsif score >= 60\n \"D\"\n else \n \"F\"\nend\nend", "def letter_grade(score)\n case score\n when 80..89\n \"B\"\n when 70..79\n \"C\"\n when 90..1000\n \"A\"\n when 60..69\n \"D\"\n when 0..59\n \"F\"\n end\n\nend", "def letter_grade(score)\n if score >= 90\n grade = \"A\"\n elsif score >= 80\n grade = \"B\"\n elsif score >= 70\n grade = \"C\"\n elsif score >= 60\n grade = \"D\"\n else\n grade = \"F\"\n end\nend", "def letterGrade(average)\r\n case average\r\n \twhen 90..100 then\r\n \t\treturn 'A'\r\n \twhen 80..89 then\r\n \t\treturn 'B'\r\n \twhen 70..79 then\r\n \t\treturn 'C'\r\n \twhen 60..69 then\r\n \t\treturn 'D'\r\n \telse\r\n \t\treturn 'F' \t\r\n end\r\nend", "def get_letter_grade(number_grade)\n if number_grade > 97\n \"A+\"\n elsif number_grade > 94\n \"A\"\n elsif number_grade > 90\n \"A-\"\n elsif number_grade > 87\n \"B+\"\n elsif number_grade > 84\n \"B\"\n elsif number_grade > 80\n \"B-\"\n else\n \"F\"\n end\nend", "def get_grade(avg_score)\n\tif avg_score >= 90\n\t\t\"A\"\n\telsif avg_score >= 80\n\t\t\"B\"\n\telsif avg_score >= 70\n\t\t\"C\"\n\telsif avg_score >= 60\n\t\t\"D\"\n\telse\n\t\t\"F\"\n\tend\nend", "def get_grade(scores)\n \n sum = scores.reduce(:+)\n \n average = sum.to_f/scores.length\n \n if (average >= 90)\n 'A'\n elsif (average >= 80)\n 'B'\n elsif (average >=70)\n 'C'\n elsif (average >=60)\n 'D'\n else \n 'F'\n end\n \n end", "def get_grade(num)\n\tif num >= 90\n\t\treturn \"A\"\n\telsif num >= 80\n\t\treturn \"B\"\n\telsif num >= 70\n\t\treturn \"C\"\n\telsif num >= 60\n\t\treturn \"D\"\n\telse \n\t\treturn \"F\"\n\tend\nend", "def letter_grade(average)\n if average >= 90\n 'A'\n elsif average >= 80\n 'B'\n elsif average >= 70\n 'C'\n elsif average >= 60\n 'D'\n else\n 'F'\n end\nend", "def letter_grade(number)\n\tif number > 97\n\t\tputs \"A+\"\n\telsif number > 94\n\t\tputs \"A\"\n\telsif number > 90\n\t\tputs \"A-\"\n\telsif number > 87\n\t\tputs \"B+\"\n\telsif number > 84\n\t\tputs \"B\"\n\telsif number > 80\n\t\tputs \"B-\"\n\telse \n\t\tputs \"F\"\n\tend\t\nend", "def calculate_grade(score)\n case score\n when (90..100) then 'A'\n when (80..90) then 'B'\n when (70..80) then 'C'\n when (60..70) then 'D'\n when (0..60) then 'F'\n end\nend", "def get_grade(letter_grade)\n return \"A\" if letter_grade >= 90\n return \"B\" if letter_grade >= 80\n return \"C\" if letter_grade >= 70\n return \"D\" if letter_grade >= 60\n return \"F\" if letter_grade < 60\nend", "def getGradeLetter(grade)\n if grade >= 0.9 && grade <= 1.0 then\n \"A\"\n elsif grade >= 0.8 && grade < 0.9 then\n \"B\"\n elsif grade >= 0.7 && grade < 0.8 then\n \"C\"\n elsif grade >= 0.6 && grade < 0.7 then\n \"D\"\n else\n \"F\"\n end\n end", "def get_grade (num)\n\tif num >= 90\n\t\treturn \"A\"\n\telsif 90 > num && num >= 80\n\t\treturn \"B\"\n\telsif 80 > num && num >= 70\n\t\treturn \"C\"\n\telsif 70 > num && num >= 60\n\t\treturn \"D\"\n\telse \n\t\treturn \"F\"\n\tend\nend", "def get_grade(score)\n\n if score < 60\n return \"F\"\n elsif score < 70\n return \"D\"\n elsif score < 80\n return \"C\"\n elsif score < 90\n return \"B\"\n else\n return \"A\"\n end\nend", "def get_grade(num1)\n\n\tif num1.to_i <= 100 && num1.to_i >= 90 \n\t\treturn 'A'\n\telsif num1.to_i <= 89 && num1.to_i >= 80 \n\t\treturn 'B'\n\telsif num1.to_i <= 79 && num1.to_i >= 70\n\t\t\treturn 'C'\n\telsif num1.to_i <= 69 && num1.to_i >= 60 \n\t\treturn 'D'\n\telse return 'F'\n\tend\nend", "def letterGrade average\n case (average/10)\n when 10 , 9 \n return \"A\" #90-100 is an A\n when 8 \n return \"B\" #80-89 is B \n when 7 \n return \"C\" #70-79 is C \n when 6 \n return \"D\" #60-69 is D \n else \n return \"F\" #0-59 is an F\n end\nend", "def get_grade(grade)\n if grade >=1 && grade <=59 then\n letter_grade = 'F'\n elsif grade >=60 && grade <=69 then\n letter_grade = 'D'\n elsif grade >=70 && grade <=79 then\n letter_grade = 'C'\n elsif grade >=80 && grade <=89 then\n letter_grade = 'B'\n elsif grade >=90 && grade <=100 then\n letter_grade = 'A'\n end\n return letter_grade\nend", "def letter_scores\n { \"A\"=>1, \"B\"=>3, \"C\"=>3, \"D\"=>2,\n \"E\"=>1, \"F\"=>4, \"G\"=>2, \"H\"=>4,\n \"I\"=>1, \"J\"=>8, \"K\"=>5, \"L\"=>1,\n \"M\"=>3, \"N\"=>1, \"O\"=>1, \"P\"=>3,\n \"Q\"=>10, \"R\"=>1, \"S\"=>1, \"T\"=>1,\n \"U\"=>1, \"V\"=>4, \"W\"=>4, \"X\"=>8,\n \"Y\"=>4, \"Z\"=>10\n }\n end", "def get_grade int\n\tcase int\n\twhen 90...100\n\t\treturn \"A\"\n\twhen 80...89\n\t\treturn \"B\"\n\twhen 70...79\n\t\treturn \"C\"\n\twhen 60...69\n\t\treturn \"D\"\n\twhen 50...59\n\t\treturn \"F\"\n\telse \n\t\treturn \"F\"\n\tend\nend", "def get_grade(sc1, sc2, sc3)\n # get average of scores\n avg = (sc1 + sc2 + sc3) / 3\n\n # assign letter grade\n # return letter grade\n case avg\n when 90..100 then 'A'\n when 80..89 then 'B'\n when 70..79 then 'C'\n when 60..69 then 'D'\n else 'F'\n end\nend", "def letter_grade (number_grade, default = '?')\n return default if number_grade.blank? || !number_grade.instance_of?(Fixnum)\n Review.letter_grade(number_grade) || default\n end", "def get_grade(score1, score2, score3)\n\t\n\taverage = (score1 + score2 + score3) / 3\n\n\tcase average\n\t\twhen (90...)\n\t\t\t'A'\n\t\twhen (80..89)\n\t\t\t'B'\n\t\twhen (70..79)\n\t\t\t'C'\n\t\twhen (60..69)\n\t\t\t'D'\n\t\twhen (0..59)\n\t\t\t'F'\n\tend\nend", "def get_grade(score)\n if score >= 90\n return \"A\"\n elsif score < 90 && score >= 80\n return \"B\"\nelsif score < 80 && score >= 70\n return \"C\"\nelsif score < 70 && score >= 60\n return \"D\"\n else\n return \"F\"\n end\nend", "def get_letter\n\n puts \"What percent did oyu score on your test/assignment?\"\n print \"> \"\n score = gets.chomp.to_i\n\n grades = {\n :F+ (0 ... 49),\n D: (50 ... 59),\n C: (60 ... 69),\n B: (70 ... 79),\n A: (80 ... 100)\n }\n\n grades.each do |grade, percent|\n if percent.to_a.include?(score)\n return grade\n end\n end\nend", "def grade\n @grades ||= case score\n when 10.0..100.0\n 16\n when 9.0..10.0\n 13\n when 8.5..9.0\n 12\n when 8.0..8.5\n 11\n when 7.5..8.0\n 10\n when 7.0..7.5\n 9\n when 6.5..7.0\n 8\n when 6.0..6.5\n 7\n when 5.5..6.0\n 6\n when 5.0..5.5\n 5\n else\n 4\n end\n end", "def get_grade(scoreArray)\n\t\t\n\tavg = scoreArray.reduce(:+) / scoreArray.length\n\t\t\n\tcase avg\n\t\twhen 90..100 then 'A'\n\t\twhen 80..89 then 'B'\n\t\twhen 70..79 then 'C'\t\n\t\twhen 60..69 then 'D'\n\t\telse 'F'\t\n\tend\nend", "def get_grade(test_scores)\n sum = 0.00\n test_scores.each {|score| sum += score}\n avg = sum / test_scores.length\n case avg\n when 90..100\n return \"A\"\n when 80...90\n return \"B\" \n when 70...80\n return \"C\"\n when 60...70\n return \"D\"\n else\n return \"F\"\n end\nend", "def get_grade(grade)\n\tif grade.to_i >= 90\n\t\treturn \"A\"\n\telsif grade.to_i >= 80\n\t\treturn \"B\"\n\telsif grade.to_i >= 70\n\t\treturn \"C\"\n\telsif grade.to_i >= 60\n\t\treturn \"D\"\n\telsif grade.to_i < 60\n\t\treturn \"F\"\nend\nend", "def getGrade\n if 0 > @grade || @grade > 100\n return \"not a valid grade.\"\n elsif @grade <= 60\n return \"F\"\n elsif @grade <= 69\n return \"D\"\n elsif @grade <= 79\n return \"C\"\n elsif @grade <= 89\n return \"B\"\n else\n return \"A\"\n end\n end", "def get_grade(grades)\n\tavg_grade = grades.reduce(:+).to_f / grades.length\n\tcase avg_grade\n\t\twhen 90..100 then \"A\"\n\t\twhen 80..89 then \"B\"\n\t\twhen 70..79 then \"C\"\n\t\twhen 60..69 then \"D\"\n\t\twhen 0..59 then \"F\"\n\tend\nend", "def get_grade (x) #return letter grade as a string\n\n\n if x >= 90\n\n p \"A\" \n\n elsif x >= 80\n\n p \"B\"\n\n elsif x >= 70\n p \"C\"\n\n elsif x >= 60\n\n p \"D\"\n\n else \n\n p \"F\" \n\nend\nend", "def grade(grade_percentage)\n case grade_percentage\n when 100..110\n \"A+\"\n when 93..99\n \"A\"\n when 90..92\n \"A-\"\n when 87..89\n \"B+\"\n when 83..86\n \"B\"\n when 80..82\n \"B-\"\n when 77..79\n \"C+\"\n when 73..76\n \"C\"\n when 70..72\n \"C-\"\n when 67..69\n \"D+\"\n when 63..66\n \"D\"\n when 60..62\n \"D-\"\n else\n \"F\"\n end\nend", "def get_grade(grades)\n\t@grades = grades\n\t@average = (@grades.inject(:+)/@grades.length)\n\tif @average >= 90\n\t\treturn 'A'\n\telsif @average >= 80\n\t\treturn 'B'\n\telsif @average >= 70\n\t\treturn 'C'\n\telsif @average >= 60\n\t\treturn 'D'\n\telse\n\t\treturn 'F'\n\tend\nend", "def get_grade(arr)\n\tfinal = 0\n\tarr.each{ |score| final += score}\n\tgrade = final / arr.length\n\tcase grade\n\t\twhen 90..100 then 'A'\n\t\twhen 80..90 then 'B'\n\t\twhen 70..80 then 'C'\n\t\twhen 60..70 then 'D'\n\t\twhen 0..60 then 'F'\n\tend\nend", "def what_is_my_grade(score)\n if(score < 0 || score > 100)\n return \"Please enter a number between 0 and 100\"\n end\n if(score > 90)\n return \"A\"\n end\n if(score > 80)\n return \"B\"\n end\n if(score > 70)\n return \"C\"\n end\n if(score > 60)\n return \"D\"\n end\n return \"F\"\nend", "def get_grade(input_array)\n\tsum = 0\n\tinput_array.each do |x|\n\t\tsum += x\n\tend\n\tav_score = sum/input_array.length\n\treturn \"A\" if av_score>=90\n\treturn \"B\" if av_score>=80\n\treturn \"C\" if av_score>=70\n\treturn \"D\" if av_score>=60\n\treturn \"F\" if av_score<60\nend", "def get_grade(average)\n case average\n when 90..100\n then \"A\"\n when 80..89\n then \"B\"\n when 70..79\n then \"C\"\n when 60..69\n then \"D\"\n when 0..60\n then \"F\"\n end\n end", "def calculate_letter_grade(*scores) # the asterisk allows any number of arguments and puts them in an array\n if scores.length == 0\n return nil\n end\n average = scores.sum / scores.length\n letter_threshholds = {90 => \"A\", 80 => \"B\", 70 => \"C\", 60 => \"D\", 0 => \"F\"}\n letter_threshholds.each do |threshhold, grade|\n if average >= threshhold\n return grade\n end\n end\nend", "def get_grade (average)\r\n\r\n\tif average > 89\r\n\t\tthen letter_grade = 'A'\r\n\telsif average > 79\r\n\t\tthen letter_grade = 'B'\r\n\telsif average > 69\r\n\t\tthen letter_grade = 'C'\r\n\telsif average > 59\r\n\t\tthen letter_grade = 'D'\r\n\telse\r\n\t\tletter_grade = 'F'\r\n\tend\t\t\r\n\r\n\treturn letter_grade\r\n\r\nend", "def get_grade(score1, score2, score3)\n average = (score1 + score2 + score3) / 3\n\n case average\n when 90..100 then 'A'\n when 80...90 then 'B'\n when 70...80 then 'C'\n when 60...70 then 'D'\n when 0...60 then 'F'\n else 'S'\n end\nend", "def get_grade(num)\n if num >= 90\n return 'A'\n elsif num >= 80 and num <= 89\n return 'B'\n elsif num >= 70 and num <= 79\n return 'C'\n elsif num >= 60 and num <= 69\n return 'D'\n else num < 60\n return 'F'\n end\nend", "def assign_grade (num)\n return 'A' if num > 89\n return 'B' if num > 79\n return 'C' if num > 69\n return 'D' if num > 59\n return 'F'\nend", "def get_grade(num)\n if num >= 90 \n\tgrade = \"A\"\nelsif num >= 80\n\tgrade = \"B\"\nelsif num >= 70\n\tgrade = \"C\"\nelsif num >= 60\n\tgrade = \"D\"\nelse\n\tgrade = \"F\"\nend\n\tend", "def get_grade(num1, num2, num3)\n letter_grade = { 'A' => (90..100), 'B' => (80..89), 'C' => (70..79),\n 'D' => (60..69), 'F' => (0..59) }\n\n mean = (num1 + num2 + num3) / 3\n\n case mean\n when letter_grade[\"A\"] then \"A\"\n when letter_grade[\"B\"] then \"B\"\n when letter_grade[\"C\"] then \"C\"\n when letter_grade[\"D\"] then \"D\"\n else \"F\"\n end\nend", "def get_grade(num_grade)\n\n if num_grade > 89\n return 'A'\n\n elsif num_grade > 79\n return 'B'\n\n elsif num_grade > 69\n return 'C'\n\n elsif num_grade > 59\n return 'D'\n\n else\n return 'F'\n\n end\n\nend", "def get_grade(num_grade)\n\n\tif num_grade >= 90\n\t\tgrade = 'A'\n\t\tp grade\n\telsif num_grade >= 80\n\t\tgrade = 'B'\n\t\tp grade\n\telsif num_grade >= 70\n\t\tgrade = 'C'\n\t\tp grade\n\telsif num_grade >= 60\n\t\tgrade = 'D'\n\t\tp grade\n\telse\n\t\tgrade = 'F'\n\t\tp grade\n\tend\nend", "def get_grade(num)\n case\n when num >= 90\n return \"A\"\n when num >= 80\n return \"B\"\n when num >= 70\n return \"C\"\n when num >= 60\n return \"D\"\n when num < 60\n return \"F\"\n end\nend", "def get_grade(n)\n #sequence of if else statemnets with >=thresholds like 90, 80, 70 etc.\n #will need to include argumaents as an input for the average\n #return the string value of the letter grade\n if n>= 90\n \"A\"\n elsif n>= 80\n \"B\"\n elsif n >= 70\n \"C\"\n elsif n>= 60\n \"D\"\n else\n \"F\"\n end\nend", "def get_grade(grades)\n\tsum = 0\n\ttotal = grades.length\n\tgrades.each { |x| sum = (sum + x) }\n\taverage = (sum / total)\n\tif average >= 90\n\t\treturn \"A\"\n\telsif average >= 80\n\t\treturn \"B\"\n\telsif average >= 70\n\t\treturn \"C\"\n\telsif average >= 60\n\t\treturn \"D\"\n\telse \n\t\treturn \"F\"\n\tend\nend", "def get_grade(a)\n if a >= 90\n return \"A\"\n elsif a >= 80\n return \"B\"\n elsif a >= 70\n return \"C\"\n elsif a >= 60\n return \"D\"\n else\n return \"F\"\n end\nend", "def get_grade(num1, num2, num3)\n mean = ((num1 + num2 + num3) / 3.0).round\n\n case mean\n when 90..100 then 'A'\n when 80..89 then 'B'\n when 70..79 then 'C'\n when 60..69 then 'D'\n when 0..59 then 'F'\n else 'A'\n end\nend", "def get_grade(x)\n return \"A\" if x >= 90\n\n return \"B\" if x < 90 && x >= 80\n\n return \"C\" if x < 80 && x >= 70\n\n return \"D\" if x < 70 && x >= 60\n\n return \"F\" if x < 60\n end", "def get_grade(avg)\n\tif avg >= 90\n\t\treturn \"A\"\n\telsif avg >= 80\n\t\treturn \"B\"\n\telsif avg >= 70\n\t\treturn \"C\"\n\telsif avg >= 60\n\t\treturn \"D\"\n\telsif avg < 60\n\t\treturn \"F\"\n\tend\t\nend", "def get_grade(grade_1, grade_2, grade_3)\n score = (grade_1 + grade_2 + grade_3) / 3.0\n\n case \n when 90 <= score && score <= 100 \n \"A\"\n when 80 <= score && score < 90\t \n 'B'\n when 70 <= score && score < 80\t \n 'C'\n when 60 <= score && score < 70\t \n 'D'\n when 0 <= score && score < 60\t \n 'F'\n end\nend", "def get_grade(score1, score2, score3)\n av = (score1 + score2 + score3) / 3\n case\n when av < 60 then 'F'\n when av < 70 then 'D'\n when av < 80 then 'C'\n when av < 90 then 'B'\n when av >= 90 then 'A'\n end\nend", "def get_grade(num)\n case num\n when 90..100 then \"A\"\n when 80..89 then \"B\"\n when 70..79 then \"C\"\n when 60..69 then \"D\"\n when 0..59 then \"F\"\n end\nend", "def get_grade(score1, score2, score3)\n avg = [score1, score2, score3].sum / 3\n case avg\n when (90..100) then 'A'\n when (80...90) then 'B'\n when (70...80) then 'C'\n when (60...70) then 'D'\n when (0...60) then 'F'\n end\nend", "def get_grade(int1, int2, int3)\n score = (int1 + int2 + int3) / 3\n if score <= 100 && score >= 90\n 'A'\n elsif score < 90 && score >= 80\n 'B'\n elsif score < 80 && score >= 70\n 'C'\n elsif score < 70 && score >= 60\n 'D'\n else\n 'F'\n end\nend", "def get_grade(avg)\n\tif avg <= 100 and avg > 89\n\t\treturn \"A\"\n\telsif avg < 90 and avg > 79\n\t\treturn \"B\"\n\telsif avg < 80 and avg > 69\n\t\treturn \"C\"\n\telsif avg < 70 and avg > 59\n\t\treturn \"D\"\n\telse avg < 60 and avg > 0\n\t\treturn \"F\"\n\tend\nend", "def get_grade(num)\n case num\n when 90..100\n \"A\"\n when 80..89\n \"B\"\n when 70..79\n \"C\"\n when 60..69\n \"D\"\n when 0..59\n \"F\"\n end\nend", "def final_letter_grades(scores)\n averages(scores).transform_values { |avg_score| letter_grade(avg_score)}\nend", "def get_grade(n)\n case\n when n >= 90\n \"A\"\n when n >= 80\n \"B\"\n when n >= 70\n \"C\"\n when n >= 60\n \"D\"\n else\n \"F\"\n end\nend", "def get_grade(int1, int2, int3)\n score = (int1 + int2 + int3) / 3\n case score\n when 90..100 then 'A'\n when 80..89 then 'B'\n when 70..79 then 'C'\n when 60..69 then 'D'\n else 'F'\n end\nend", "def get_grade (num)\n if num >= 90\n return \"A\"\n elsif 90 > num && num >= 80\n return \"B\"\n elsif 80 > num && num >= 70\n return \"C\"\n elsif 70 > num && num >= 60\n return \"D\"\n else \n return \"F\"\n end\nend", "def get_grade(grade)\n if 90 <= grade\n return \"A\"\n elsif 80 <= grade\n return \"B\"\n elsif 70 <= grade\n return \"C\"\n elsif 60 <= grade\n return \"D\"\n else return \"F\"\n end\nend", "def score_convert(n) \n score = 0\n if n.length <= 2 #if the score is in \"A\", \"A+\", \"C-\" form\n case n[0] #to account for the first letter\n when \"A\"\n score = 95\n when \"B\"\n score = 85\n when \"C\"\n score = 75\n when \"D\"\n score = 65\n else\n score = 50\n end\n \n case n[1] #to account for + and -\n when \"+\"\n score += 3\n when \"-\"\n score -=3\n end\n end \n if n.include? \"/\" #if the score is in X/Y form\n score = (frac_to_float(n)*100).to_i\n end\n score\n end", "def get_grade (average)\n case average\n when (90..100)\n return \"A\"\n when (80..89)\n return \"B\"\n when (70..79)\n return \"C\"\n when (60..69)\n return \"D\"\n when (0..59)\n return \"F\"\n end\nend", "def get_grade(a)\n case a\n when 0..59 then \"F\"\n when 60..69 then \"D\"\n when 70..79 then \"C\"\n when 80..89 then \"B\"\n when 90..100 then \"A\"\n end\nend", "def get_grade(array)\n\tarray.each do |x|\n\t\tif (x < 0) || (x > 100)\n\t\t\tputs \"Invalid Data in Array!\"\n\t\tend\n\tend\n\tsum = 0\n\tarray.each do |x|\n\t\tsum += x\n\tend\n\tgrade = sum/(array.length)\n\t\n\tcase \n\twhen grade > 89\n\t\treturn \"A\"\n\twhen grade > 79\n\t\treturn \"B\"\n\twhen grade > 69\n\t\treturn \"C\"\n\twhen grade > 59\n\t\treturn \"D\"\n\telse\n\t\treturn \"F\"\n\tend\nend", "def validate_letter_grade(raw_score)\n mapping_rule.has_key?(raw_score.to_s.upcase)\n end", "def get_grade(x)\nif x <= 59\nreturn \"F\"\nelsif x <= 69\nreturn \"D\"\nelsif x <= 79\nreturn \"C\"\nelsif x <= 89\nreturn \"B\"\nelsif x <= 99\nreturn \"A\"\nelse\nreturn \"Not a number\"\nend\nend", "def get_grade(i)\n if i >= 90\n return \"A\"\n elsif i >= 80\n return \"B\"\n elsif i >= 70\n return \"C\"\n elsif i >= 60\n return \"D\"\n else\n return \"F\"\n end\nend", "def get_grade(grades_array)\n\t# Determine the average of the grades\n\t\t# Set a new variable called grades_total to zero\n\t\tgrades_total = 0\n\t\t# Add each grade in grades_array to grades_total\n\t\tgrades_array.each do |x|\n\t\t\tgrades_total += x\n\t\tend\n\t\t# New variable average = grades_total divided by the array-length of grades_array\t\t\n\t\taverage_number = grades_total / grades_array.length\n\t# Use case statement to convert the average to a letter grade\n\tcase average_number\n\twhen 0...60\n\t\treturn \"F\"\n\twhen 60...70\n\t\treturn \"D\"\n\twhen 70...80\n\t\treturn \"C\"\n\twhen 80...90\n\t\treturn \"B\"\n\twhen 90...100\n\t\treturn \"A\"\n\tend\nend", "def score\n #Here are the letter values. Think about how you might put this data in a usable format for your methods above.\n scores = {a: 1, b: 3, c: 3, d: 2, e: 1,\n f: 4, g: 2, h: 4, i: 1, j: 8,\n k: 5, l: 1, m: 3, n: 1, o: 1,\n p: 3, q: 10, r: 1, s: 1, t: 1,\n u: 1, v: 4, w: 4, x: 8, y: 4,\n z: 10}\n\n# Need to use @word with something to get the value of the letters combined \n\n\n return score\n end", "def get_grade(grades)\n\tgrades.each do |grade|\n\t\tunless grade.is_a?(Integer) && 0 <= grade && grade <= 100\n\t\t\traise ArgumentError.new(\"Integers between 0 and 100 only please!\")\n\t\tend\n\tend\n\tavg_grade = grades.reduce(:+).to_f / grades.length\n\tcase avg_grade\n\t\twhen 90..100 then \n\t\t\tp \"You averaged #{avg_grade}, which is an A.\"\n\t\t\treturn \"A\"\n\t\twhen 80..89 then \n\t\t\tp \"You averaged #{avg_grade}, which is a B.\"\n\t\t\treturn \"B\"\n\t\twhen 70..79 then \n\t\t\tp \"You averaged #{avg_grade}, which is a C.\"\n\t\t\treturn \"C\"\n\t\twhen 60..69 then \n\t\t\tp \"You averaged #{avg_grade}, which is a D.\"\n\t\t\treturn \"D\"\n\t\twhen 0..59 then \n\t\t\tp \"You averaged #{avg_grade}, which is an F.\"\n\t\treturn \"F\"\n\tend\nend", "def get_grade(array)\n score = 1.0 * array.reduce(:+) / array.length\n p case when score >= 90 then 'A'\n when score >= 80 then 'B'\n when score >= 70 then 'C'\n when score >= 60 then 'D'\n else 'F'\n end\nend", "def get_grade scores\n average = 0\n scores.each do |num|\n if num < 0 || num > 100\n p \"Please input a list of valid scores (0-100).\"\n else\n average += num\n end\n end\n average /= scores.length\n if average >= 90\n \"A\"\n elsif average >= 80\n \"B\"\n elsif average >= 70\n \"C\"\n elsif average >= 60\n \"D\"\n else\n \"F\"\n end\nend", "def high(x)\n\n x = ('abcdefghijklmnopqrstuvwxyz')\n\n letterScore = {\n 'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5, 'f' => 6, 'g' => 7, 'h' => 8,\n 'i' => 9, 'j' => 10, 'k' => 11, 'l' => 12, 'm' => 13, 'n' => 14, 'o' => 15, 'p' => 16,\n 'q' => 17, 'r' => 18, 's' => 19, 't' => 20, 'u' => 21, 'v' => 22, 'w' => 23, 'x' => 24,\n 'y' => 25, 'z' => 26\n\n }\n\n end", "def get_grade(n)\n case\n when n >= 90 then p 'A'\n when n >= 80 then p 'B'\n when n >= 70 then p 'C'\n when n >= 60 then p 'D'\n else 'F'\n end\nend", "def grade(average)\n case\n when average > 90 \n return 'A'\n when average > 80\n return 'B'\n when average > 70\n return 'C'\n when average > 60\n return 'D'\n else\n return 'F'\n end\nend", "def get_grade(array)\n\tavg = ((array.inject(:+)) / array.length)\n\tcase avg\n\twhen 90..100\n\t\t'A'\n\twhen 80..89\n\t\t'B'\n\twhen 70..79\n\t\t'C'\n\twhen 60..69\n\t\t'D'\n\telse \n\t\t'F'\n\tend\nend", "def get_grade(average)\n return \"A\" if average <= 100 && average >= 90\n \n return \"B\" if average < 90 && average >= 80\n \n return \"C\" if average < 80 && average >= 70\n \n return \"D\" if average < 70 && average >= 60\n \n return \"F\" if average < 60\nend", "def get_grade(average)\n case average\n when (90..100)\n return \"A\"\n when (80..89)\n return \"B\"\n when (70..79)\n return \"C\"\n when (60..69)\n return \"D\"\n when (0..59)\n return \"F\"\n end\n\n\n\n \n\nend", "def get_grade (array)\n\tget_grade = (array[0].to_i + array[1].to_i + array[2].to_i) / array.length\n\t\ncase get_grade\n\t when 90..100\n\t \"A\"\n\t when 80..90\n \"B\"\n when 70..80\n \"C\"\n when 60..70\n \"D\"\n when 0..60\n \"F\"\n else\n \"Error\"\n end\n end", "def get_grade(grade)\n case grade\n when 90..100\n return 'A'\n when 80..89\n return 'B'\n when 70..79\n return 'C'\n when 60..69\n return 'D'\n else\n return 'F'\n end\nend", "def scores\n {\n 'a' => 1, 'e' => 1, 'i' => 1, 'o' => 1,\n 'u' => 1, 'l' => 1, 'n' => 1, 'r' => 1,\n 's' => 1, 't' => 1, 'd' => 2, 'g' => 2,\n 'b' => 3, 'c' => 3, 'm' => 3, 'p' => 3,\n 'f' => 4, 'h' => 4, 'v' => 4, 'w' => 4,\n 'y' => 4, 'k' => 5, 'j' => 8, 'x' => 8,\n 'q' => 10, 'z' => 10\n }\nend", "def get_grade(score1, score2, score3)\n avg = (score1 + score2 + score3) / 3\n case\n when avg >= 90 then 'A'\n when avg >= 80 then 'B'\n when avg >= 70 then 'C'\n when avg >= 60 then 'D'\n else 'F'\n end\nend", "def get_grade(grades)\n sum = 0\n grades.each {|grade| sum += grade}\n mean = sum / grades.length\n case\n when mean >= 90\n return \"A\"\n when mean >= 80\n return \"B\"\n when mean >= 70\n return \"C\"\n when mean >= 60\n return \"D\"\n else\n return \"F\"\n end\nend", "def get_grade(average)\n if average >= 90\n return \"A\"\n elsif average >= 80\n return \"B\"\n elsif average >= 70\n return \"C\"\n elsif average >=60\n return \"D\"\n else\n return \"F\"\n end\nend" ]
[ "0.8516908", "0.8446878", "0.8414356", "0.84088415", "0.8391743", "0.8365784", "0.8348283", "0.8333557", "0.8243077", "0.820097", "0.8191554", "0.8165062", "0.80988467", "0.7919422", "0.7898124", "0.7887183", "0.7847319", "0.7768562", "0.7761602", "0.7758619", "0.77499914", "0.77397394", "0.77384543", "0.7734705", "0.7732946", "0.77323425", "0.76912683", "0.7683506", "0.76765233", "0.7671271", "0.76561856", "0.7602074", "0.75859725", "0.7556351", "0.75493544", "0.75355697", "0.74985105", "0.74958766", "0.748206", "0.74759275", "0.7475275", "0.7474648", "0.7467871", "0.74669266", "0.74657005", "0.7420951", "0.7414189", "0.7407887", "0.74037963", "0.7393107", "0.73738", "0.73584825", "0.73511565", "0.73300856", "0.73073786", "0.7292824", "0.7282931", "0.7266415", "0.7264465", "0.72573614", "0.7248906", "0.7241515", "0.7241133", "0.7239632", "0.7237601", "0.72359556", "0.7232066", "0.7228923", "0.7224946", "0.7216335", "0.7208798", "0.72025377", "0.7195901", "0.7195664", "0.7194669", "0.71693885", "0.7162709", "0.7162161", "0.7113505", "0.71047956", "0.7094368", "0.7090695", "0.708897", "0.7084312", "0.70802414", "0.70752716", "0.7057575", "0.70545787", "0.70446897", "0.7044242", "0.7036858", "0.7033227", "0.70173067", "0.7015088", "0.7010246", "0.7009757", "0.70069623", "0.7006157", "0.7003228", "0.7000552" ]
0.7435126
45
Return a hash of students and their final letter grade, as determined by their average.
def final_letter_grades(grade_hash) averages(grade_hash).transform_values{ |marks| letter_grade(marks)} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def final_letter_grades(grade_hash)\n averages = grade_hash.inject({}) { |h, (k,v)| h[k] = letter_grade(v.reduce{|x,n| x += n}/v.length) ; h}\nend", "def final_letter_grades(grade_hash)\n letter_grade averages grade_hash\nend", "def final_letter_grades(grade_hash)\n averages = averages(grade_hash)\n\n final_grades = averages.map do |key, value|\n [key, letter_grade(value)]\n end\n\n final_grades.to_h\nend", "def final_letter_grades(grade_hash)\n letter_grade_array = grade_hash.map do |key, value|\n average = value.sum / value.length\n letter_grade = letter_grade(average)\n [key, letter_grade]\n end\n letter_grade_array.to_h\nend", "def final_letter_grades(grade_hash)\n final_hash = {}\n new_hash = averages(grade_hash)\n new_hash.map do |name, average|\n letter = letter_grade(average)\n final_hash[name] = letter\n end\n final_hash\nend", "def final_letter_grades(grade_hash)\n averages(grade_hash).transform_values{ |num| letter_grade(num) }\nend", "def final_letter_grades(grade_hash)\n averages(grade_hash).transform_values {|nums| nums = letter_grade(nums)}\nend", "def final_letter_grades(grade_hash)\n averages(grade_hash)\n .transform_values{ |scores| letter_grade(scores)}\nend", "def class_average(grade_hash)\n sum = 0\n grade_hash.values.each { |student| student.each {|grades| sum += grades }}\n average = sum/(grade_hash.length**2)\nend", "def class_average(grade_hash) \n sum = 0\n students = grade_hash.keys.length\n scores = grade_hash.values.length\n total_scores = students * scores\n grade_hash.each do |key, value|\n sum += value.reduce(:+)\n end\n average = sum / total_scores\n average\nend", "def get_avggrades(hash)\n sumgrades = 0\n hash[:grades].each do |grade|\n if grade.to_s != 'A'\n sumgrades += grade.to_f\n else\n sumgrades +=1\n end\n end\n sumgrades / hash[:grades].length\nend", "def final_letter_grades(grade_hash)\n grade_hash.transform_values{|nums| letter_grade(nums.reduce(:+) / nums.length)}\nend", "def averages(grade_hash)\n student_average_array = grade_hash.map do |key, value|\n average = value.sum / value.length\n [key, average]\n end\n student_average_array.to_h\nend", "def class_average(grade_hash)\n sum, n = 0, 0\n grade_hash.each do |k,array|\n array.each do |grade|\n n += 1\n sum += grade\n end\n end\n return sum/n\nend", "def averages(grade_hash)\n grade_hash.transform_values { |marks| marks.inject {|sum, n| sum + n } / marks.length }\nend", "def averages(grade_hash)\n grade_hash.transform_values{|v| v.inject(:+)/v.length}\n # hash = {}\n # grade_hash.map do |name, grades|\n # score = 0\n # grades.each do |grade|\n # score += grade\n # end\n # average = score/grades.length\n # hash[name] = average\n # end\n # hash\n # sum = 0\n # grade_hash.each { |x| sum += x }\n # average = sum/grade_hash.length\nend", "def class_average(grade_hash)\n scores = averages(grade_hash)\n result = 0\n scores.each {|k,v| result += v}\n result /= scores.length\nend", "def get_grade(grades)\n\t@grades = grades\n\t@average = (@grades.inject(:+)/@grades.length)\n\tif @average >= 90\n\t\treturn 'A'\n\telsif @average >= 80\n\t\treturn 'B'\n\telsif @average >= 70\n\t\treturn 'C'\n\telsif @average >= 60\n\t\treturn 'D'\n\telse\n\t\treturn 'F'\n\tend\nend", "def class_average(grade_hash)\n averages = averages(grade_hash)\n sum = 0\n\n averages.map do |key, value|\n sum += value\n end\n\n sum / averages.length\nend", "def assignment_average_score(grade_hash, assignment_num)\n marks = assignment_scores(grade_hash, assignment_num)\n marks.sum / marks.length\nend", "def assignment_average_score(grade_hash, assignment_num)\n sum, n = 0, 0\n grade_hash.each do |k,v|\n n += 1\n sum += v[assignment_num-1]\n end\n return sum/n\nend", "def final_letter_grades(scores)\n averages(scores).transform_values { |avg_score| letter_grade(avg_score)}\nend", "def class_average(grade_hash)\n averages(grade_hash).map{|k, v| v}.inject {|sum, n| sum + n } / grade_hash.length\nend", "def assignment_average_score(grade_hash, assignment_score)\n sum = 0\n grade_hash.each do |key, value|\n sum += value[assignment_score - 1]\n end\n average = sum / grade_hash.keys.length\n average\nend", "def averages(grade_hash)\n grade_hash.transform_values{ |num| num.reduce(:+) / num.length }\nend", "def class_average(grade_hash)\n averages(grade_hash).map { |key, value| value }\n .reduce(:+) / grade_hash.length\nend", "def assignment_average_score(grade_hash, assignment_num)\n a = []\n grade_hash.values.each { |dude| a.push(dude[assignment_num - 1]) }\n sum = a.sum\n average = sum/a.length\nend", "def class_average(grade_hash)\n averages(grade_hash).values.reduce(:+) / grade_hash.length\nend", "def assignment_average_score(grade_hash, assignment_num)\n assignment_score = grade_hash.map do |key, value|\n value [assignment_num - 1]\n end\n total = assignment_score.reduce do |total, grade|\n total += grade\n end\n total / assignment_score.length\nend", "def get_grade(grades)\n\tsum = 0\n\ttotal = grades.length\n\tgrades.each { |x| sum = (sum + x) }\n\taverage = (sum / total)\n\tif average >= 90\n\t\treturn \"A\"\n\telsif average >= 80\n\t\treturn \"B\"\n\telsif average >= 70\n\t\treturn \"C\"\n\telsif average >= 60\n\t\treturn \"D\"\n\telse \n\t\treturn \"F\"\n\tend\nend", "def averages(grade_hash)\n\n averages = grade_hash.map do |key, value|\n total = 1\n sum = grade_hash[key].reduce do |sum, grade|\n total += 1\n sum += grade\n end\n avg = sum / total\n [key, avg]\n end\n\n averages.to_h\nend", "def grades(input)\n lines = input.split(/\\n/)\n grades = lines[1..lines.length]\n s = lines[0].split(/\\s/)\n n = s[0].to_f\n m = s[1].to_f\n avgs = Hash.new\n grades.each do |line|\n split_line = line.split(/\\s/)\n avgs[split_line[0]] = split_line[1..m].inject(0){|sum, x| sum + x.to_f} / m\n end\n avg = (avgs.to_a.inject(0){|sum, x| sum + x[1].to_f} / n).round(2).to_s\n avgs.each do |k, v|\n avg += \"\\n\" + k.to_s + \" \" + v.to_s\n end\n puts avg\nend", "def class_average(grade_hash)\n averages(grade_hash)\n .map {|key, value| value}\n .reduce(:+) / grade_hash.length\nend", "def assignment_average_score(grade_hash, assignment_num)\n grade_hash\n .map { |key, value| value[assignment_num -1] }\n .reduce(:+) / grade_hash.length\nend", "def averages(grade_hash)\n# a_new_hash = my_hash.inject({}) { |h, (k, v)| h[k] = v.upcase; h }\naverages = grade_hash.inject({}) { |h, (k,v)| h[k] = v.reduce{|x,n| x += n}/v.length ; h}\nend", "def assignment_average_score(grade_hash, assignment_num)\n sum = 0\n grade_hash.each do |key, value|\n sum += grade_hash[key][assignment_num - 1]\n end\n average = sum / grade_hash.length\nend", "def assignment_average_score(grade_hash, assignment_num)\n grade_hash\n .map {|key, value| value[assignment_num - 1]}\n .reduce(:+) / grade_hash.length\nend", "def assignment_average_score(grade_hash, assignment_num)\n assignment = grade_hash.map {|x| x[1][assignment_num-1]}\n average = assignment.reduce{|x,n| x += n}/assignment.length\nend", "def get_grade(grades)\n sum = 0 # define sum, so that I can add things to it\n grades.each {|grade| sum += grade} # adding each element of the array together\n mean = sum / grades.length # the average of the grades\n case # the letter grade for each mean\n when mean >= 90\n return \"A\" # good job, student\n when mean >= 80\n return \"B\" # pretty good job, student\n when mean >= 70\n return \"C\" # average job, student\n when mean >= 60\n return \"D\" # I've seen better, student\n else\n return \"F\" # Reconsider your life, student\n end # Don't forget your end statements\nend", "def get_grade(scores)\n score_total = 0\n\n scores.each { |x| score_total = x + score_total }\n\n average = score_total / (scores.length)\n\n case\n when average >= 90\n letter = 'A'\n when average >= 80\n letter = 'B'\n when average >= 70\n letter = 'C'\n when average >= 60\n letter = 'D'\n else\n letter = 'F'\n end\n \n return letter\nend", "def calculate_letter_grade(*scores) # the asterisk allows any number of arguments and puts them in an array\n if scores.length == 0\n return nil\n end\n average = scores.sum / scores.length\n letter_threshholds = {90 => \"A\", 80 => \"B\", 70 => \"C\", 60 => \"D\", 0 => \"F\"}\n letter_threshholds.each do |threshhold, grade|\n if average >= threshhold\n return grade\n end\n end\nend", "def assignment_average_score(grade_hash, assignment_num)\n assignment = grade_hash.map do |key, value|\n value[assignment_num - 1]\n end\n\n sum = assignment.reduce do |sum, x|\n sum += x\n end\n\n sum / assignment.length\nend", "def get_grade(scores)\n \n sum = scores.reduce(:+)\n \n average = sum.to_f/scores.length\n \n if (average >= 90)\n 'A'\n elsif (average >= 80)\n 'B'\n elsif (average >=70)\n 'C'\n elsif (average >=60)\n 'D'\n else \n 'F'\n end\n \n end", "def gradeStudent( studentString, keyString )\n # Number of correct answers\n numCorrect = 0.0\n studentAnsArr = formatAnswersFromSimple( studentString )\n keyArr = formatAnswersFromSimple( keyString )\n count = 0\n studentAnsArr.each { |sarr|\n numCorrect = numCorrect + gradeQuestion( sarr, keyArr[count] )\n count += 1\n }\n numCorrect / studentAnsArr.size\n end", "def student_grade(student_name)\n\t\tSCHOOL[:students].each do |hash|\n\t\t\treturn hash[:grade] if hash[:name]==student_name\n\t\tend\n\tend", "def class_average(grade_hash)\n averages(grade_hash).values.reduce(:+)/grade_hash.size\nend", "def get_grade(grades_array)\n\t# Determine the average of the grades\n\t\t# Set a new variable called grades_total to zero\n\t\tgrades_total = 0\n\t\t# Add each grade in grades_array to grades_total\n\t\tgrades_array.each do |x|\n\t\t\tgrades_total += x\n\t\tend\n\t\t# New variable average = grades_total divided by the array-length of grades_array\t\t\n\t\taverage_number = grades_total / grades_array.length\n\t# Use case statement to convert the average to a letter grade\n\tcase average_number\n\twhen 0...60\n\t\treturn \"F\"\n\twhen 60...70\n\t\treturn \"D\"\n\twhen 70...80\n\t\treturn \"C\"\n\twhen 80...90\n\t\treturn \"B\"\n\twhen 90...100\n\t\treturn \"A\"\n\tend\nend", "def get_grade(grades)\n\tgrades.each do |grade|\n\t\tunless grade.is_a?(Integer) && 0 <= grade && grade <= 100\n\t\t\traise ArgumentError.new(\"Integers between 0 and 100 only please!\")\n\t\tend\n\tend\n\tavg_grade = grades.reduce(:+).to_f / grades.length\n\tcase avg_grade\n\t\twhen 90..100 then \n\t\t\tp \"You averaged #{avg_grade}, which is an A.\"\n\t\t\treturn \"A\"\n\t\twhen 80..89 then \n\t\t\tp \"You averaged #{avg_grade}, which is a B.\"\n\t\t\treturn \"B\"\n\t\twhen 70..79 then \n\t\t\tp \"You averaged #{avg_grade}, which is a C.\"\n\t\t\treturn \"C\"\n\t\twhen 60..69 then \n\t\t\tp \"You averaged #{avg_grade}, which is a D.\"\n\t\t\treturn \"D\"\n\t\twhen 0..59 then \n\t\t\tp \"You averaged #{avg_grade}, which is an F.\"\n\t\treturn \"F\"\n\tend\nend", "def gradeStudent( studentString, keyString )\n # Number of correct answers\n numCorrect = 0.0\n studentAnsArr = formatAnswersFromSimple( studentString )\n keyArr = formatAnswersFromSimple( keyString )\n count = 0\n studentAnsArr.each { |sarr|\n numCorrect = numCorrect + gradeQuestion( sarr, keyArr[count] )\n count += 1\n }\n numCorrect / studentAnsArr.size\n end", "def get_grade(average)\n case average\n when 90..100\n then \"A\"\n when 80..89\n then \"B\"\n when 70..79\n then \"C\"\n when 60..69\n then \"D\"\n when 0..60\n then \"F\"\n end\n end", "def grade_average\n @grades.inject(:+) / @grades.size\n end", "def get_grade(array)\n\ttotal = 0\n\tarray.each do |x|\n\t\ttotal += x\n\tend\n\taverage = total / array.length\n\tif average >= 90\n\t\treturn \"A\"\n\telsif average >= 80\n\t\treturn \"B\"\n\telsif average >= 70\n\t\treturn \"C\"\n\telsif average >= 60\n\t\treturn \"D\"\n\telse\n\t\treturn \"F\"\n\tend\nend", "def averages(grade_hash)\n grade_hash.transform_values{|nums| nums.reduce(:+) / nums.size}\nend", "def get_grade(grades)\n\tavg_grade = grades.reduce(:+).to_f / grades.length\n\tcase avg_grade\n\t\twhen 90..100 then \"A\"\n\t\twhen 80..89 then \"B\"\n\t\twhen 70..79 then \"C\"\n\t\twhen 60..69 then \"D\"\n\t\twhen 0..59 then \"F\"\n\tend\nend", "def assignment_average_score(grade_hash, assignment_num)\n (grade_hash.values.transpose[assignment_num - 1].reduce { |acc, num| acc + num }.to_f / 10).floor\nend", "def grade_average\n @grades.inject(:+)/@grades.size\n end", "def grade_average\n @grades.inject(:+)/@grades.size\n end", "def letterGrade(average)\r\n case average\r\n \twhen 90..100 then\r\n \t\treturn 'A'\r\n \twhen 80..89 then\r\n \t\treturn 'B'\r\n \twhen 70..79 then\r\n \t\treturn 'C'\r\n \twhen 60..69 then\r\n \t\treturn 'D'\r\n \telse\r\n \t\treturn 'F' \t\r\n end\r\nend", "def averages(grade_hash)\n grade_hash\n .transform_values { |scores| scores.reduce(:+) / scores.length }\nend", "def get_grade (average)\r\n\r\n\tif average > 89\r\n\t\tthen letter_grade = 'A'\r\n\telsif average > 79\r\n\t\tthen letter_grade = 'B'\r\n\telsif average > 69\r\n\t\tthen letter_grade = 'C'\r\n\telsif average > 59\r\n\t\tthen letter_grade = 'D'\r\n\telse\r\n\t\tletter_grade = 'F'\r\n\tend\t\t\r\n\r\n\treturn letter_grade\r\n\r\nend", "def averages(grade_hash)\n grade_hash.transform_values {|nums| nums.reduce(:+)/nums.size}\nend", "def get_grade(num1, num2, num3)\n letter_grade = { 'A' => (90..100), 'B' => (80..89), 'C' => (70..79),\n 'D' => (60..69), 'F' => (0..59) }\n\n mean = (num1 + num2 + num3) / 3\n\n case mean\n when letter_grade[\"A\"] then \"A\"\n when letter_grade[\"B\"] then \"B\"\n when letter_grade[\"C\"] then \"C\"\n when letter_grade[\"D\"] then \"D\"\n else \"F\"\n end\nend", "def letter_grade(average)\n if average >= 90\n 'A'\n elsif average >= 80\n 'B'\n elsif average >= 70\n 'C'\n elsif average >= 60\n 'D'\n else\n 'F'\n end\nend", "def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num - 1]\nend", "def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num - 1]\nend", "def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num - 1]\nend", "def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num - 1]\nend", "def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num - 1]\nend", "def assignment_score(grade_hash, student, assignment_num)\n return grade_hash[student][assignment_num-1]\nend", "def get_grade(scores)\n\n\t#Find out the average of the scores\n\n\tscore_sum = scores.reduce(:+)\n\ttotal_scores = scores.length\n\taverage_score = score_sum / total_scores\n\n\t#translate average into a letter grade\n\n\tgrade = case average_score\n\twhen 90...100 then \"A\"\n\twhen 80..90 then \"B\"\n\twhen 70..80 then \"C\"\n\twhen 60..70 then \"D\"\n\twhen 0..60 then \"F\"\n\tend\n\t\n\treturn grade\nend", "def assignment_score(grade_hash, student, assignment_num)\n grade_hash[student][assignment_num-1]\nend", "def get_grade(average)\n return \"A\" if average <= 100 && average >= 90\n \n return \"B\" if average < 90 && average >= 80\n \n return \"C\" if average < 80 && average >= 70\n \n return \"D\" if average < 70 && average >= 60\n \n return \"F\" if average < 60\nend", "def get_grades(student, school)\t\t\t\t\t\t\t\t\t\t\t\t\t#a. create method to return student's grade\n\tschool[:students].each do |s|\n\t\tputs s[:grade] if s[:name] == student\n\tend\nend", "def letterGrade average\n case (average/10)\n when 10 , 9 \n return \"A\" #90-100 is an A\n when 8 \n return \"B\" #80-89 is B \n when 7 \n return \"C\" #70-79 is C \n when 6 \n return \"D\" #60-69 is D \n else \n return \"F\" #0-59 is an F\n end\nend", "def assignment_score(grade_hash, student, assignment_num)\n score = grade_hash[student][assignment_num - 1]\nend", "def grade(name, schoolvar)\n schoolvar[:students].each do |students|\n\t\tif students[:name]==name\n\t\tprint students[:grade]\n\t\tend\n\tend\nend", "def average\n @grades.reduce(0,:+) / @grades.size.to_f\n end", "def get_grade(sc1, sc2, sc3)\n # get average of scores\n avg = (sc1 + sc2 + sc3) / 3\n\n # assign letter grade\n # return letter grade\n case avg\n when 90..100 then 'A'\n when 80..89 then 'B'\n when 70..79 then 'C'\n when 60..69 then 'D'\n else 'F'\n end\nend", "def average\n\t\tif 2 < course.users.length and 0 < grades.length and 0 < worth\n\t\t\taverage = (grades.sum(:grade) / grades.length);\n\t\t\taverage = (average.to_f / worth) * 100;\n\t\t\treturn average\n\t\tend\n\tend", "def get_grade(array)\n total = 0\n array.each {|x| total = total += x }\n average = total/array.length\n \n if average >= 90\n return \"A\"\n elsif average >= 80\n return \"B\"\n elsif average >= 70\n return \"C\"\n elsif average >= 60\n return \"D\"\n else\n return \"F\"\n end\nend", "def top_students(grade_hash)\n averages(grade_hash)\n .to_a\n .sort_by { |student| -student[1] }\n .map { |student| student[0] }\nend", "def test_average\n\t\tassert_equal(90, @students[0].average, \"The first student's average score is not 90\")\n\t\tassert_equal(\"A\", @students[0].letter_grade, \"The first student's letter grade is not an A.\")\n\tend", "def get_grade(grades)\n sum = 0\n grades.each {|grade| sum += grade}\n mean = sum / grades.length\n case\n when mean >= 90\n return \"A\"\n when mean >= 80\n return \"B\"\n when mean >= 70\n return \"C\"\n when mean >= 60\n return \"D\"\n else\n return \"F\"\n end\nend", "def grade(student_grade)\n roster[student_grade]\n end", "def letter_percentages(string)\n chars = string.split('')\n\n hash_of_percentages = { lowercase: 0.0, uppercase: 0.0, neither: 0.0}\n hash_of_percentages = calculate_chars(chars, hash_of_percentages)\n\n total_chars = chars.length\n hash_of_percentages = calculate_percentages(hash_of_percentages, total_chars)\n\n return hash_of_percentages\nend", "def get_grade(score1, score2, score3)\n\t\n\taverage = (score1 + score2 + score3) / 3\n\n\tcase average\n\t\twhen (90...)\n\t\t\t'A'\n\t\twhen (80..89)\n\t\t\t'B'\n\t\twhen (70..79)\n\t\t\t'C'\n\t\twhen (60..69)\n\t\t\t'D'\n\t\twhen (0..59)\n\t\t\t'F'\n\tend\nend", "def get_grade(avg)\n\tif avg >= 90\n\t\treturn \"A\"\n\telsif avg >= 80\n\t\treturn \"B\"\n\telsif avg >= 70\n\t\treturn \"C\"\n\telsif avg >= 60\n\t\treturn \"D\"\n\telsif avg < 60\n\t\treturn \"F\"\n\tend\t\nend", "def gradeAll( studentArr, keyString )\n grades = []\n studentArr.each { |studentString |\n grades.push( gradeStudent( studentString, keyString ) )\n }\n grades\n end", "def compute_grade_breakdown(num_students)\n students_so_far = 0\n GradeLevelType::get_ordered_grades.each do |grade|\n #catalog_students_this_grade = get_num_catalog_students_this_grade(grade)\n num_students_this_grade = get_num_students_per_grade(num_students)\n num_students_this_grade = 0 if students_so_far >= num_students\n num_students_this_grade = 0 if @scenarioYAML[\"AVERAGE_ELEMENTARY_SCHOOL_NUM_STUDENTS\"] == 0 and GradeLevelType.is_elementary_school_grade(grade)\n num_students_this_grade = 0 if @scenarioYAML[\"AVERAGE_MIDDLE_SCHOOL_NUM_STUDENTS\"] == 0 and GradeLevelType.is_middle_school_grade(grade)\n num_students_this_grade = 0 if @scenarioYAML[\"AVERAGE_HIGH_SCHOOL_NUM_STUDENTS\"] == 0 and GradeLevelType.is_high_school_grade(grade)\n num_students_this_grade = num_students - students_so_far if grade == :TWELFTH_GRADE and num_students_this_grade != 0\n # Modify the number of students for this grade based on the student catalog\n @breakdown[grade] = num_students_this_grade\n\n puts \"Grade #{grade} : students #{num_students_this_grade}\"\n students_so_far += num_students_this_grade\n end\n end", "def get_grade(avg)\n\tif avg <= 100 and avg > 89\n\t\treturn \"A\"\n\telsif avg < 90 and avg > 79\n\t\treturn \"B\"\n\telsif avg < 80 and avg > 69\n\t\treturn \"C\"\n\telsif avg < 70 and avg > 59\n\t\treturn \"D\"\n\telse avg < 60 and avg > 0\n\t\treturn \"F\"\n\tend\nend", "def letter_grades\n @letter_grades ||= mapping_rule.keys\n end", "def get_grade(array)\n\tavg = ((array.inject(:+)) / array.length)\n\tcase avg\n\twhen 90..100\n\t\t'A'\n\twhen 80..89\n\t\t'B'\n\twhen 70..79\n\t\t'C'\n\twhen 60..69\n\t\t'D'\n\telse \n\t\t'F'\n\tend\nend", "def grade(average)\n case\n when average > 90 \n return 'A'\n when average > 80\n return 'B'\n when average > 70\n return 'C'\n when average > 60\n return 'D'\n else\n return 'F'\n end\nend", "def gradeAVG(scores)\n sum = 0\n scores.each do |grade|\n sum += grade\n end\n average = sum / (scores.length)\n return average\nend", "def get_grade(score1, score2, score3)\n\n grade_rules = {\n (90..100).to_a => \"A\",\n (80..89).to_a => \"B\",\n (70..79).to_a => \"C\",\n (60..69).to_a => \"D\",\n (0..59).to_a => \"F\"\n }\n\n mean_score = (score1 + score2 + score3) / 3\n\n grade_rules.select { |key, value| key.include?(mean_score) }.values.join\nend", "def get_grade(arr)\n sum = arr.inject(:+)\n average = sum / arr.length\n\n return \"A\" if average >= 90\n return \"B\" if average >= 80\n return \"C\" if average >= 70\n return \"D\" if average >= 60\n return \"F\"\nend", "def average_grade_overall\n return self.data[\"average_grade\"]\n end", "def get_grade(input_array)\n\tsum = 0\n\tinput_array.each do |x|\n\t\tsum += x\n\tend\n\tav_score = sum/input_array.length\n\treturn \"A\" if av_score>=90\n\treturn \"B\" if av_score>=80\n\treturn \"C\" if av_score>=70\n\treturn \"D\" if av_score>=60\n\treturn \"F\" if av_score<60\nend", "def grade\n @grades ||= case score\n when 10.0..100.0\n 16\n when 9.0..10.0\n 13\n when 8.5..9.0\n 12\n when 8.0..8.5\n 11\n when 7.5..8.0\n 10\n when 7.0..7.5\n 9\n when 6.5..7.0\n 8\n when 6.0..6.5\n 7\n when 5.5..6.0\n 6\n when 5.0..5.5\n 5\n else\n 4\n end\n end", "def get_grade scores\n average = 0\n scores.each do |num|\n if num < 0 || num > 100\n p \"Please input a list of valid scores (0-100).\"\n else\n average += num\n end\n end\n average /= scores.length\n if average >= 90\n \"A\"\n elsif average >= 80\n \"B\"\n elsif average >= 70\n \"C\"\n elsif average >= 60\n \"D\"\n else\n \"F\"\n end\nend" ]
[ "0.7814751", "0.7780114", "0.7737784", "0.7596652", "0.7564736", "0.7560241", "0.7505347", "0.7385984", "0.72480476", "0.7098098", "0.70480067", "0.6964807", "0.6957521", "0.6919024", "0.69028676", "0.69000435", "0.68883234", "0.6882915", "0.6862444", "0.6828487", "0.68096834", "0.6800837", "0.6766509", "0.6762326", "0.6755205", "0.6751106", "0.6744915", "0.67386115", "0.6731709", "0.6725295", "0.67250854", "0.6720541", "0.67184067", "0.67108345", "0.67059886", "0.6687222", "0.66473144", "0.6622833", "0.66117525", "0.65739703", "0.65732616", "0.65627867", "0.65579456", "0.655578", "0.6551671", "0.6545", "0.653594", "0.6533889", "0.6531142", "0.6524998", "0.6520525", "0.6503764", "0.6499915", "0.6481845", "0.64475524", "0.6430273", "0.6430273", "0.64116204", "0.6408273", "0.6406854", "0.63889456", "0.63876724", "0.63843", "0.6341719", "0.6341719", "0.6341719", "0.6341719", "0.6341719", "0.6300455", "0.62776154", "0.6275159", "0.6274404", "0.6266864", "0.6262422", "0.6250761", "0.62250775", "0.62227005", "0.6217174", "0.62092364", "0.62069225", "0.6195738", "0.6178932", "0.61775565", "0.6174446", "0.617262", "0.6168561", "0.6161088", "0.6156478", "0.61323595", "0.6132038", "0.6130352", "0.6127024", "0.6122111", "0.6108013", "0.6105293", "0.61046356", "0.60934407", "0.60886204", "0.6087039", "0.6074006" ]
0.75707203
4